@ownclaw/own-prose 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -3
- package/dist/index.js +1 -1
- package/dist/runtime-api.js +1 -1
- package/dist/src/agent-notify.js +1 -1
- package/dist/src/agent-parser.js +1 -1
- package/dist/src/background-cleanup-launcher.js +1 -1
- package/dist/src/background-cleanup-worker.js +1 -1
- package/dist/src/cli.js +1 -1
- package/dist/src/config.js +1 -1
- package/dist/src/execution.d.ts +7 -5
- package/dist/src/execution.js +1 -1
- package/dist/src/plan-compiler.js +1 -1
- package/dist/src/plan-validator.js +1 -1
- package/dist/src/program-parser.js +1 -1
- package/dist/src/state-store.js +1 -1
- package/dist/src/tool.d.ts +35 -2
- package/dist/src/tool.js +1 -1
- package/dist/src/types.d.ts +52 -3
- package/package.json +1 -1
package/dist/src/execution.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x85ffa7=_0x2c31;(function(_0x5bce6d,_0x2934fd){const _0xb9294d=_0x2c31,_0x4862ac=_0x5bce6d();while(!![]){try{const _0x14bd04=-parseInt(_0xb9294d(0x21e))/0x1+-parseInt(_0xb9294d(0x205))/0x2*(-parseInt(_0xb9294d(0x192))/0x3)+parseInt(_0xb9294d(0x195))/0x4+-parseInt(_0xb9294d(0x1b2))/0x5*(parseInt(_0xb9294d(0x167))/0x6)+parseInt(_0xb9294d(0x200))/0x7+parseInt(_0xb9294d(0x214))/0x8+-parseInt(_0xb9294d(0x13b))/0x9;if(_0x14bd04===_0x2934fd)break;else _0x4862ac['push'](_0x4862ac['shift']());}catch(_0x364577){_0x4862ac['push'](_0x4862ac['shift']());}}}(_0x3a51,0xbef89));import{existsSync}from'node:fs';import _0x35f044 from'node:fs/promises';import _0x25f695 from'node:path';import{spawnOwnProseCleanupProcess}from'./background-cleanup-launcher.js';import{deleteAgentSession,getAgentSessionMessages,hasAgentSession,notifyAgentSession,queueAgentSessionRun,waitForAgentSessionRun}from'./agent-notify.js';import{loadAgents}from'./agent-parser.js';import{resolveOwnProseConfig}from'./config.js';import{compilePlan}from'./plan-compiler.js';import{validateCompiledPlan}from'./plan-validator.js';import{parseProgramFile}from'./program-parser.js';import{appendTimeline,createRunId,ensureRunDirectories,getRunDir,initializeRunState,readCompiledPlan,readRunState,writeArtifact,writeProgramSource,writeResumeFile,writeRunState}from'./state-store.js';const NO_REPLY_TOKEN='NO_REPLY',OWN_PROSE_EMBEDDED_LANE=_0x85ffa7(0x19c),SESSION_CLEANUP_RECHECK_DELAYS_MS=[0x32,0x64,0xc8],BACKGROUND_STATE_SETTLE_RETRY_DELAY_MS=0xc8,BACKGROUND_STATE_SETTLE_RETRY_COUNT=0x19,MAX_PARALLEL_TASKS=0x3;function scopeAgentSessionKey(_0x313d59,_0x32839c){const _0x1268ba=_0x85ffa7,_0x1bdbc2=_0x313d59?.[_0x1268ba(0x150)]();if(!_0x1bdbc2||_0x32839c[_0x1268ba(0x1d4)](_0x1268ba(0x215)))return _0x32839c;return _0x1268ba(0x215)+_0x1bdbc2+':'+_0x32839c;}export async function driveOwnProseProgram(_0x36cd28){const _0x4efa5f=_0x85ffa7,_0x5ef7ec=await loadProgramBundle(_0x36cd28[_0x4efa5f(0x20d)],_0x36cd28[_0x4efa5f(0x1f0)]),_0xd1e82d=resolveOwnProseConfig(_0x36cd28[_0x4efa5f(0x1f0)],_0x36cd28[_0x4efa5f(0x1db)][_0x4efa5f(0x213)]),_0x53c1c2=resolveConfiguredAgentRuntimeDefaults(_0x36cd28[_0x4efa5f(0x1db)][_0x4efa5f(0x1a2)]),_0x46136b=resolveRunRuntimeDefaults({'callerProvider':_0x36cd28['callerProvider'],'callerModel':_0x36cd28[_0x4efa5f(0x156)],'callerModelSource':_0x36cd28['callerModelSource'],'agentDefaultProvider':_0x53c1c2[_0x4efa5f(0x19f)],'agentDefaultModel':_0x53c1c2[_0x4efa5f(0x17c)],'pluginDefaultProvider':_0xd1e82d['defaultProvider'],'pluginDefaultModel':_0xd1e82d[_0x4efa5f(0x1c5)]});await _0x35f044[_0x4efa5f(0x225)](_0x25f695[_0x4efa5f(0x189)](_0xd1e82d['stateRoot'],'runs'),{'recursive':!![]});const _0x57d79a=createRunId(),_0x3ac231=getRunDir(_0xd1e82d[_0x4efa5f(0x14a)],_0x57d79a);await ensureRunDirectories(_0x3ac231);const _0x3b11b8=await _0x35f044[_0x4efa5f(0x1b4)](_0x5ef7ec[_0x4efa5f(0x1f5)][_0x4efa5f(0x1e9)],_0x4efa5f(0x157));await writeProgramSource(_0x3ac231,_0x3b11b8);const _0x11f370=await compilePlan({'api':_0x36cd28[_0x4efa5f(0x1db)],'workspaceDir':_0x36cd28[_0x4efa5f(0x1f0)],'runDir':_0x3ac231,'program':_0x5ef7ec['program'],'agents':_0x5ef7ec[_0x4efa5f(0x1bd)],'provider':_0x46136b['provider'],'model':_0x46136b['model'],'timeoutMs':_0xd1e82d[_0x4efa5f(0x1e0)]});validateCompiledPlan(_0x11f370,_0x5ef7ec[_0x4efa5f(0x1f5)],_0x5ef7ec[_0x4efa5f(0x1bd)]);const _0x47d8cb=resolveProgramInputs(_0x5ef7ec[_0x4efa5f(0x1f5)],_0x36cd28['inputs']??{}),_0x457765=await initializeRunState({'runDir':_0x3ac231,'runId':_0x57d79a,'program':_0x5ef7ec[_0x4efa5f(0x1f5)],'inputs':_0x47d8cb,'plan':_0x11f370,'runtime':{'cwd':_0x36cd28[_0x4efa5f(0x1f0)],'provider':_0x46136b['provider'],'model':_0x46136b['model'],'modelSource':_0x46136b[_0x4efa5f(0x1be)],'sessionKey':_0x36cd28[_0x4efa5f(0x176)],'agentId':_0x36cd28['agentId'],'supervisorSessionKey':_0x36cd28[_0x4efa5f(0x176)],'supervisorAgentId':_0x36cd28[_0x4efa5f(0x1d0)],'supervisorCarrier':_0x4efa5f(0x1d6)}}),_0x2c685b=await executePlan({'api':_0x36cd28[_0x4efa5f(0x1db)],'workspaceDir':_0x36cd28[_0x4efa5f(0x1f0)],'runDir':_0x3ac231,'state':_0x457765,'program':_0x5ef7ec[_0x4efa5f(0x1f5)],'plan':_0x11f370,'agents':_0x5ef7ec[_0x4efa5f(0x1bd)],'inputs':_0x47d8cb,'defaultProvider':_0x46136b[_0x4efa5f(0x19f)],'defaultModel':_0x46136b['model'],'defaultTimeoutMs':_0xd1e82d[_0x4efa5f(0x1e0)],'cleanupSessions':_0xd1e82d[_0x4efa5f(0x1a9)]});return{'runId':_0x57d79a,'runDir':_0x3ac231,'state':_0x2c685b,'plan':_0x11f370};}export async function startOwnProseProgram(_0x332f2d){const _0x51ff0d=_0x85ffa7,_0x9e2d3b=await loadProgramBundle(_0x332f2d[_0x51ff0d(0x20d)],_0x332f2d[_0x51ff0d(0x1f0)]),_0x32f40a=resolveOwnProseConfig(_0x332f2d[_0x51ff0d(0x1f0)],_0x332f2d[_0x51ff0d(0x1db)][_0x51ff0d(0x213)]),_0x1e8e39=resolveConfiguredAgentRuntimeDefaults(_0x332f2d[_0x51ff0d(0x1db)][_0x51ff0d(0x1a2)]),_0x969c65=resolveRunRuntimeDefaults({'callerProvider':_0x332f2d[_0x51ff0d(0x219)],'callerModel':_0x332f2d[_0x51ff0d(0x156)],'callerModelSource':_0x332f2d['callerModelSource'],'agentDefaultProvider':_0x1e8e39[_0x51ff0d(0x19f)],'agentDefaultModel':_0x1e8e39['model'],'pluginDefaultProvider':_0x32f40a[_0x51ff0d(0x210)],'pluginDefaultModel':_0x32f40a[_0x51ff0d(0x1c5)]});await _0x35f044[_0x51ff0d(0x225)](_0x25f695['join'](_0x32f40a[_0x51ff0d(0x14a)],_0x51ff0d(0x201)),{'recursive':!![]});const _0xb965b2=createRunId(),_0x4d4efb=getRunDir(_0x32f40a['stateRoot'],_0xb965b2);await ensureRunDirectories(_0x4d4efb);const _0x4de0bd=await _0x35f044['readFile'](_0x9e2d3b[_0x51ff0d(0x1f5)]['sourcePath'],_0x51ff0d(0x157));await writeProgramSource(_0x4d4efb,_0x4de0bd);const _0x2d7aa6=await compilePlan({'api':_0x332f2d[_0x51ff0d(0x1db)],'workspaceDir':_0x332f2d['workspaceDir'],'runDir':_0x4d4efb,'program':_0x9e2d3b[_0x51ff0d(0x1f5)],'agents':_0x9e2d3b['agents'],'provider':_0x969c65[_0x51ff0d(0x19f)],'model':_0x969c65[_0x51ff0d(0x17c)],'timeoutMs':_0x32f40a[_0x51ff0d(0x1e0)]});validateCompiledPlan(_0x2d7aa6,_0x9e2d3b[_0x51ff0d(0x1f5)],_0x9e2d3b[_0x51ff0d(0x1bd)]);const _0x3d7c87=resolveProgramInputs(_0x9e2d3b['program'],_0x332f2d[_0x51ff0d(0x185)]??{}),_0x167320=await initializeRunState({'runDir':_0x4d4efb,'runId':_0xb965b2,'program':_0x9e2d3b['program'],'inputs':_0x3d7c87,'plan':_0x2d7aa6,'runtime':{'cwd':_0x332f2d['workspaceDir'],'provider':_0x969c65[_0x51ff0d(0x19f)],'model':_0x969c65['model'],'modelSource':_0x969c65[_0x51ff0d(0x1be)],'sessionKey':_0x332f2d[_0x51ff0d(0x176)],'agentId':_0x332f2d['agentId'],'supervisorAgentId':_0x332f2d[_0x51ff0d(0x1d0)]}});_0x167320['background']={'mode':_0x51ff0d(0x190),'status':_0x51ff0d(0x1e2),'startedAt':new Date()[_0x51ff0d(0x198)](),'originSessionKey':_0x332f2d[_0x51ff0d(0x176)],'originAgentId':_0x332f2d[_0x51ff0d(0x1d0)]};if(!_0x332f2d[_0x51ff0d(0x176)]?.['trim']()&&!_0x332f2d[_0x51ff0d(0x1d0)]?.[_0x51ff0d(0x150)]())return await writeRunState(_0x4d4efb,_0x167320),await writeResumeFile(_0x4d4efb,_0x167320,_0x2d7aa6),{'runId':_0xb965b2,'runDir':_0x4d4efb,'state':_0x167320,'plan':_0x2d7aa6,'alreadyRunning':![]};const _0x4fc1ff=await queueBackgroundSupervisorRun({'api':_0x332f2d[_0x51ff0d(0x1db)],'agentId':_0x332f2d['agentId'],'runId':_0xb965b2,'runDir':_0x4d4efb});return _0x167320[_0x51ff0d(0x1e3)][_0x51ff0d(0x1ab)]=_0x4fc1ff[_0x51ff0d(0x176)],_0x167320[_0x51ff0d(0x1e3)][_0x51ff0d(0x174)]=_0x4fc1ff[_0x51ff0d(0x18e)],_0x167320[_0x51ff0d(0x190)][_0x51ff0d(0x20b)]={'status':'queued','queuedAt':new Date()[_0x51ff0d(0x198)](),'sessionKey':_0x4fc1ff['sessionKey'],'runId':_0x4fc1ff[_0x51ff0d(0x143)]},await writeRunState(_0x4d4efb,_0x167320),await writeResumeFile(_0x4d4efb,_0x167320,_0x2d7aa6),startBackgroundSupervisorMonitor({'api':_0x332f2d['api'],'runDir':_0x4d4efb,'plan':_0x2d7aa6,'cleanupSessions':_0x32f40a[_0x51ff0d(0x1a9)],'supervisorRunId':_0x4fc1ff[_0x51ff0d(0x143)],'supervisorSessionKey':_0x4fc1ff['sessionKey'],'waitTimeoutMs':_0x32f40a[_0x51ff0d(0x1e0)]}),{'runId':_0xb965b2,'runDir':_0x4d4efb,'state':_0x167320,'plan':_0x2d7aa6,'alreadyRunning':![]};}export async function resumeOwnProseBackgroundRun(_0x27f9ca){const _0x12ebb5=_0x85ffa7,{runDir:_0x59d86d,state:_0x44ff6b,plan:_0x40c4e9}=await loadOwnProseRunState(_0x27f9ca[_0x12ebb5(0x1f0)],_0x27f9ca[_0x12ebb5(0x1db)][_0x12ebb5(0x213)],_0x27f9ca[_0x12ebb5(0x143)],{'runDir':_0x27f9ca[_0x12ebb5(0x15d)]});if(_0x44ff6b[_0x12ebb5(0x152)]!==_0x12ebb5(0x1f6))return{'runId':_0x44ff6b[_0x12ebb5(0x143)],'runDir':_0x59d86d,'state':_0x44ff6b,'plan':_0x40c4e9};const _0xede51e=await loadProgramBundle(_0x44ff6b['programPath']),_0x469a3c=_0x44ff6b[_0x12ebb5(0x1e3)]['cwd']?.[_0x12ebb5(0x150)]()||_0x27f9ca['workspaceDir'],_0x4958d5=resolveOwnProseConfig(_0x469a3c,_0x27f9ca['api'][_0x12ebb5(0x213)]);recoverInterruptedRunningNodes(_0x44ff6b,_0x40c4e9)&&(await writeRunState(_0x59d86d,_0x44ff6b),await writeResumeFile(_0x59d86d,_0x44ff6b,_0x40c4e9));const _0x40498d=resolveConfiguredAgentRuntimeDefaults(_0x27f9ca['api']['config']),_0x20265e=resolveRunRuntimeDefaults({'callerProvider':_0x44ff6b[_0x12ebb5(0x1e3)]['provider'],'callerModel':_0x44ff6b[_0x12ebb5(0x1e3)]['model'],'callerModelSource':_0x44ff6b[_0x12ebb5(0x1e3)][_0x12ebb5(0x15c)],'agentDefaultProvider':_0x40498d['provider'],'agentDefaultModel':_0x40498d[_0x12ebb5(0x17c)],'pluginDefaultProvider':_0x4958d5[_0x12ebb5(0x210)],'pluginDefaultModel':_0x4958d5['defaultModel']}),_0x4636d4=await runInBackground({'api':_0x27f9ca['api'],'workspaceDir':_0x469a3c,'runDir':_0x59d86d,'state':_0x44ff6b,'program':_0xede51e[_0x12ebb5(0x1f5)],'plan':_0x40c4e9,'agents':_0xede51e[_0x12ebb5(0x1bd)],'inputs':_0x44ff6b[_0x12ebb5(0x185)],'defaultProvider':_0x20265e[_0x12ebb5(0x19f)],'defaultModel':_0x20265e[_0x12ebb5(0x17c)],'defaultTimeoutMs':_0x4958d5[_0x12ebb5(0x1e0)],'cleanupSessions':_0x4958d5[_0x12ebb5(0x1a9)]});return{'runId':_0x44ff6b[_0x12ebb5(0x143)],'runDir':_0x59d86d,'state':_0x4636d4,'plan':_0x40c4e9};}export async function waitForOwnProseBackgroundRun(_0x426c82,_0x49146a){const _0x3974eb=_0x85ffa7;return loadOwnProseRunState(_0x49146a[_0x3974eb(0x1f0)],_0x49146a[_0x3974eb(0x213)],_0x426c82);}export async function compileOwnProseProgram(_0x56bac3){const _0x37ccb3=_0x85ffa7,_0x4eb71d=await loadProgramBundle(_0x56bac3['programPath'],_0x56bac3[_0x37ccb3(0x1f0)]),_0x2915b8=resolveOwnProseConfig(_0x56bac3[_0x37ccb3(0x1f0)],_0x56bac3[_0x37ccb3(0x1db)][_0x37ccb3(0x213)]),_0x50cb6f=resolveConfiguredAgentRuntimeDefaults(_0x56bac3[_0x37ccb3(0x1db)][_0x37ccb3(0x1a2)]),_0x59a209=resolveRunRuntimeDefaults({'callerProvider':_0x56bac3[_0x37ccb3(0x219)],'callerModel':_0x56bac3[_0x37ccb3(0x156)],'callerModelSource':_0x56bac3['callerProvider']||_0x56bac3['callerModel']?_0x37ccb3(0x1ce):undefined,'agentDefaultProvider':_0x50cb6f[_0x37ccb3(0x19f)],'agentDefaultModel':_0x50cb6f[_0x37ccb3(0x17c)],'pluginDefaultProvider':_0x2915b8[_0x37ccb3(0x210)],'pluginDefaultModel':_0x2915b8[_0x37ccb3(0x1c5)]}),_0xa4d91b=_0x25f695[_0x37ccb3(0x189)](_0x2915b8[_0x37ccb3(0x14a)],_0x37ccb3(0x149));await ensureRunDirectories(_0xa4d91b);const _0x4215b8=await compilePlan({'api':_0x56bac3['api'],'workspaceDir':_0x56bac3[_0x37ccb3(0x1f0)],'runDir':_0xa4d91b,'program':_0x4eb71d['program'],'agents':_0x4eb71d['agents'],'provider':_0x59a209[_0x37ccb3(0x19f)],'model':_0x59a209['model'],'timeoutMs':_0x2915b8[_0x37ccb3(0x1e0)]});return validateCompiledPlan(_0x4215b8,_0x4eb71d['program'],_0x4eb71d['agents']),{'program':_0x4eb71d[_0x37ccb3(0x1f5)],'agents':_0x4eb71d[_0x37ccb3(0x1bd)],'plan':_0x4215b8};}export async function inspectOwnProseProgramFile(_0x3c428f){return loadProgramBundle(_0x3c428f);}function resolveRunRuntimeDefaults(_0x1a2049){const _0x63bf3e=_0x85ffa7;if(_0x1a2049[_0x63bf3e(0x219)]||_0x1a2049[_0x63bf3e(0x156)])return{'provider':_0x1a2049[_0x63bf3e(0x219)],'model':_0x1a2049[_0x63bf3e(0x156)],'source':_0x1a2049[_0x63bf3e(0x220)]??'caller_session'};if(_0x1a2049[_0x63bf3e(0x199)]||_0x1a2049[_0x63bf3e(0x133)])return{'provider':_0x1a2049[_0x63bf3e(0x199)],'model':_0x1a2049[_0x63bf3e(0x133)],'source':_0x63bf3e(0x18d)};if(_0x1a2049['pluginDefaultProvider']||_0x1a2049['pluginDefaultModel'])return{'provider':_0x1a2049[_0x63bf3e(0x1e8)],'model':_0x1a2049['pluginDefaultModel'],'source':_0x63bf3e(0x21b)};return{};}export async function loadOwnProseRunState(_0x6ee4c3,_0x50e7a4,_0x27d8f3,_0x57e9bd){const _0x5112ae=_0x85ffa7,_0x37323d=resolveOwnProseConfig(_0x6ee4c3,_0x50e7a4),_0x3c833b=_0x57e9bd?.[_0x5112ae(0x15d)]?.[_0x5112ae(0x150)]()?_0x25f695['resolve'](_0x57e9bd[_0x5112ae(0x15d)]):getRunDir(_0x37323d[_0x5112ae(0x14a)],_0x27d8f3),_0x53b4fe=await readRunState(_0x3c833b),_0x231f83=await readCompiledPlan(_0x3c833b);return{'runDir':_0x3c833b,'state':_0x53b4fe,'plan':_0x231f83};}export function resolveOwnProseProgramPath(_0x84c71c,_0x23894f){const _0x15a272=_0x85ffa7;if(!_0x23894f?.['trim']())return undefined;const _0x562793=_0x23894f['trim']();if(_0x25f695[_0x15a272(0x221)](_0x562793))return _0x25f695[_0x15a272(0x1e7)](_0x562793);const _0x48fe80=_0x84c71c[_0x15a272(0x150)]()?_0x25f695[_0x15a272(0x1de)](_0x84c71c,_0x562793):undefined;if(_0x48fe80&&existsSync(_0x48fe80))return _0x48fe80;return _0x25f695[_0x15a272(0x1de)](_0x562793);}export function renderOwnProseStatus(_0x4d3f4f){const _0x4993c0=_0x85ffa7,_0x4120b6=[_0x4993c0(0x13e)+_0x4d3f4f[_0x4993c0(0x143)],'Status:\x20'+_0x4d3f4f[_0x4993c0(0x152)],_0x4d3f4f[_0x4993c0(0x190)]?_0x4993c0(0x1bf)+_0x4d3f4f[_0x4993c0(0x190)][_0x4993c0(0x152)]:undefined,_0x4d3f4f[_0x4993c0(0x190)]?.[_0x4993c0(0x20b)]?_0x4993c0(0x16b)+_0x4d3f4f[_0x4993c0(0x190)][_0x4993c0(0x20b)][_0x4993c0(0x152)]+(_0x4d3f4f['background'][_0x4993c0(0x20b)][_0x4993c0(0x176)]?'\x20('+_0x4d3f4f[_0x4993c0(0x190)]['supervisor']['sessionKey']+')':''):undefined,_0x4d3f4f[_0x4993c0(0x190)]?.['notification']?'Notification:\x20'+_0x4d3f4f[_0x4993c0(0x190)][_0x4993c0(0x136)]['status']:undefined,_0x4993c0(0x168)+(_0x4d3f4f[_0x4993c0(0x1d2)]??_0x4993c0(0x21d)),'Ready\x20nodes:\x20'+(_0x4d3f4f['readyNodeIds'][_0x4993c0(0x1eb)]>0x0?_0x4d3f4f[_0x4993c0(0x158)][_0x4993c0(0x189)](',\x20'):_0x4993c0(0x21d)),_0x4993c0(0x1c7)+(_0x4d3f4f[_0x4993c0(0x164)][_0x4993c0(0x1eb)]>0x0?_0x4d3f4f['runningNodeIds']['join'](',\x20'):_0x4993c0(0x21d)),_0x4993c0(0x15b)+(_0x4d3f4f['completedNodeIds'][_0x4993c0(0x1eb)]>0x0?_0x4d3f4f['completedNodeIds'][_0x4993c0(0x189)](',\x20'):_0x4993c0(0x21d)),_0x4993c0(0x1a0)+_0x4d3f4f[_0x4993c0(0x147)]+'/'+_0x4d3f4f['maxSteps'],_0x4d3f4f[_0x4993c0(0x135)]?_0x4993c0(0x1ea)+_0x4d3f4f[_0x4993c0(0x135)]:undefined,_0x4d3f4f['failure']?_0x4993c0(0x15a)+_0x4d3f4f[_0x4993c0(0x1c4)]['reason']:undefined,'','Node\x20states:',...Object[_0x4993c0(0x1c6)](_0x4d3f4f['nodeStates'])[_0x4993c0(0x1cd)](_0xacc5fb=>{const _0x466b78=_0x4993c0,_0x187d96=[_0xacc5fb[_0x466b78(0x18c)]?'['+_0xacc5fb['subagentCarrier']+']':undefined,_0xacc5fb[_0x466b78(0x134)]]['filter'](_0x4c3293=>Boolean(_0x4c3293));return'-\x20'+_0xacc5fb[_0x466b78(0x1ec)]+':\x20'+_0xacc5fb[_0x466b78(0x152)]+(_0x187d96[_0x466b78(0x1eb)]>0x0?_0x466b78(0x162)+_0x187d96['join']('\x20'):'');})];return _0x4120b6['filter'](_0xf6334e=>Boolean(_0xf6334e))[_0x4993c0(0x189)]('\x0a');}async function loadProgramBundle(_0x398ae3,_0x47838e){const _0x42e4e9=_0x85ffa7,_0x4af03e=resolveOwnProseProgramPath(_0x47838e??process[_0x42e4e9(0x1c2)](),_0x398ae3);if(!_0x4af03e)throw new Error(_0x42e4e9(0x169));const _0x1f5702=await parseProgramFile(_0x4af03e),_0x55d0a3=await loadAgents(_0x1f5702[_0x42e4e9(0x203)],_0x25f695[_0x42e4e9(0x216)](_0x4af03e));return{'program':_0x1f5702,'agents':_0x55d0a3};}function resolveProgramInputs(_0x218cb2,_0x13f54a){const _0x31a620=_0x85ffa7,_0x3d5722={..._0x13f54a};for(const _0x306e7 of _0x218cb2[_0x31a620(0x185)]){_0x3d5722[_0x306e7['key']]==null&&_0x306e7['defaultValue']!=null&&(_0x3d5722[_0x306e7[_0x31a620(0x18f)]]=_0x306e7[_0x31a620(0x175)]);if(_0x306e7[_0x31a620(0x1b8)]&&_0x3d5722[_0x306e7['key']]==null)throw new Error('Missing\x20required\x20input\x20\x22'+_0x306e7[_0x31a620(0x18f)]+'\x22');}return _0x3d5722;}async function executePlan(_0x4f4ccf){const _0x66121b=_0x85ffa7,_0x1a5238=new Map(_0x4f4ccf[_0x66121b(0x183)][_0x66121b(0x1b7)][_0x66121b(0x1cd)](_0x537c16=>[_0x537c16['id'],_0x537c16]));let _0x4220ea=0x0;syncSchedulerState(_0x4f4ccf['state'],_0x4f4ccf[_0x66121b(0x183)]);while(_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x152)]==='running'){if(_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x147)]>=_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x1c9)]){await failRun(_0x4f4ccf[_0x66121b(0x15d)],_0x4f4ccf['state'],_0x4f4ccf[_0x66121b(0x183)],{'reason':_0x66121b(0x193)+_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x1c9)]+')'});break;}const _0x319ac0=getReadyNodesInPlanOrder(_0x4f4ccf[_0x66121b(0x183)],_0x4f4ccf[_0x66121b(0x177)]);_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x158)]=_0x319ac0[_0x66121b(0x1cd)](_0x19c418=>_0x19c418['id']),_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x1d2)]=_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x164)][0x0]??_0x4f4ccf[_0x66121b(0x177)]['readyNodeIds'][0x0]??null;if(_0x319ac0[_0x66121b(0x1eb)]===0x0){if(_0x4f4ccf['state'][_0x66121b(0x164)][_0x66121b(0x1eb)]>0x0)continue;if(_0x4f4ccf['state'][_0x66121b(0x1f9)][_0x66121b(0x186)](_0x34ca12=>_0x1a5238[_0x66121b(0x17f)](_0x34ca12)?.[_0x66121b(0x197)]===_0x66121b(0x12e))){_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x152)]='completed',_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x1d2)]=null,markPendingNodesSkipped(_0x4f4ccf[_0x66121b(0x177)],_0x4f4ccf[_0x66121b(0x183)]),await appendTimeline(_0x4f4ccf[_0x66121b(0x15d)],{'at':new Date()[_0x66121b(0x198)](),'type':_0x66121b(0x1d9),'runId':_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x143)],'message':_0x66121b(0x15f)}),await writeRunState(_0x4f4ccf[_0x66121b(0x15d)],_0x4f4ccf[_0x66121b(0x177)]),await writeResumeFile(_0x4f4ccf[_0x66121b(0x15d)],_0x4f4ccf[_0x66121b(0x177)],_0x4f4ccf['plan']);break;}await failRun(_0x4f4ccf[_0x66121b(0x15d)],_0x4f4ccf[_0x66121b(0x177)],_0x4f4ccf[_0x66121b(0x183)],{'nodeId':_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x1d2)]??undefined,'reason':_0x66121b(0x1a6)});break;}const _0x5902d0=selectExecutionBatch(_0x319ac0);_0x4220ea+=0x1;for(const _0x21c1db of _0x5902d0){if(_0x21c1db['type']==='finish')return _0x4f4ccf[_0x66121b(0x177)]['pendingNodeIds']=_0x4f4ccf['state'][_0x66121b(0x1ee)]['filter'](_0x13d16b=>_0x13d16b!==_0x21c1db['id']),_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x1f9)]=pushUnique(_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x1f9)],_0x21c1db['id']),_0x4f4ccf[_0x66121b(0x177)]['status']=_0x66121b(0x17d),_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x1d2)]=null,markPendingNodesSkipped(_0x4f4ccf[_0x66121b(0x177)],_0x4f4ccf[_0x66121b(0x183)]),await appendTimeline(_0x4f4ccf[_0x66121b(0x15d)],{'at':new Date()[_0x66121b(0x198)](),'type':_0x66121b(0x1d9),'runId':_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x143)],'message':_0x66121b(0x15f)}),await writeRunState(_0x4f4ccf[_0x66121b(0x15d)],_0x4f4ccf['state']),await writeResumeFile(_0x4f4ccf['runDir'],_0x4f4ccf[_0x66121b(0x177)],_0x4f4ccf['plan']),_0x4f4ccf[_0x66121b(0x177)];const _0x35e504=startNodeRecord({'state':_0x4f4ccf[_0x66121b(0x177)],'node':_0x21c1db,'wave':_0x4220ea});_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x1ee)]=_0x4f4ccf['state'][_0x66121b(0x1ee)][_0x66121b(0x1fa)](_0x300a50=>_0x300a50!==_0x21c1db['id']),_0x4f4ccf['state'][_0x66121b(0x164)]=pushUnique(_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x164)],_0x21c1db['id']),await appendTimeline(_0x4f4ccf[_0x66121b(0x15d)],{'at':_0x35e504[_0x66121b(0x20c)],'type':_0x66121b(0x223),'runId':_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x143)],'nodeId':_0x21c1db['id'],'message':_0x66121b(0x1ed)+_0x21c1db[_0x66121b(0x197)]+_0x66121b(0x1b6)+_0x21c1db['id']});}_0x4f4ccf['state'][_0x66121b(0x158)]=_0x4f4ccf[_0x66121b(0x177)]['readyNodeIds'][_0x66121b(0x1fa)](_0x176966=>!_0x5902d0[_0x66121b(0x186)](_0x30f7d7=>_0x30f7d7['id']===_0x176966)),_0x4f4ccf[_0x66121b(0x177)]['currentNodeId']=_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x164)][0x0]??_0x4f4ccf[_0x66121b(0x177)]['readyNodeIds'][0x0]??null,await writeRunState(_0x4f4ccf[_0x66121b(0x15d)],_0x4f4ccf[_0x66121b(0x177)]),await writeResumeFile(_0x4f4ccf[_0x66121b(0x15d)],_0x4f4ccf[_0x66121b(0x177)],_0x4f4ccf[_0x66121b(0x183)]);try{if(_0x5902d0[_0x66121b(0x1eb)]===0x1&&_0x5902d0[0x0]?.[_0x66121b(0x197)]===_0x66121b(0x1f2)){const _0x5d45f3=_0x5902d0[0x0],_0x12d818=_0x4f4ccf['state'][_0x66121b(0x187)][_0x5d45f3['id']],_0xca1795=await executeJudgeNode({'api':_0x4f4ccf['api'],'workspaceDir':_0x4f4ccf[_0x66121b(0x1f0)],'runDir':_0x4f4ccf[_0x66121b(0x15d)],'state':_0x4f4ccf['state'],'program':_0x4f4ccf[_0x66121b(0x1f5)],'plan':_0x4f4ccf[_0x66121b(0x183)],'node':_0x5d45f3,'agent':_0x4f4ccf[_0x66121b(0x1bd)][_0x5d45f3[_0x66121b(0x1d0)]],'inputs':_0x4f4ccf['inputs'],'defaultProvider':_0x4f4ccf[_0x66121b(0x210)],'defaultModel':_0x4f4ccf[_0x66121b(0x1c5)],'defaultTimeoutMs':_0x4f4ccf[_0x66121b(0x1a4)]});if(!_0x5d45f3[_0x66121b(0x1a7)][_0x66121b(0x1b3)](_0xca1795[_0x66121b(0x182)]))throw new Error('Judge\x20node\x20\x22'+_0x5d45f3['id']+'\x22\x20returned\x20invalid\x20branch\x20\x22'+_0xca1795[_0x66121b(0x182)]+'\x22');const _0x492938=_0x5d45f3['branches'][_0xca1795[_0x66121b(0x182)]];_0x12d818['status']=_0x66121b(0x17d),_0x12d818[_0x66121b(0x180)]=new Date()[_0x66121b(0x198)](),_0x12d818['summary']=''+_0xca1795[_0x66121b(0x182)]+(_0xca1795[_0x66121b(0x172)]?_0x66121b(0x162)+_0xca1795[_0x66121b(0x172)]:''),_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x207)][_0x66121b(0x1c3)]({'nodeId':_0x5d45f3['id'],'agentId':_0x5d45f3[_0x66121b(0x1d0)],'decision':_0xca1795['decision'],'reason':_0xca1795[_0x66121b(0x172)],'decidedAt':_0x12d818[_0x66121b(0x180)]}),_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x147)]+=0x1,_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x164)]=_0x4f4ccf['state'][_0x66121b(0x164)][_0x66121b(0x1fa)](_0x289660=>_0x289660!==_0x5d45f3['id']),_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x1f9)]=pushUnique(_0x4f4ccf[_0x66121b(0x177)]['completedNodeIds'],_0x5d45f3['id']),await appendTimeline(_0x4f4ccf[_0x66121b(0x15d)],{'at':_0x12d818[_0x66121b(0x180)],'type':_0x66121b(0x194),'runId':_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x143)],'nodeId':_0x5d45f3['id'],'branch':_0xca1795[_0x66121b(0x182)],'message':_0x12d818[_0x66121b(0x134)]});}else{const _0x423a88=_0x5902d0[_0x66121b(0x1fa)](_0x141c58=>_0x141c58[_0x66121b(0x197)]==='task'),_0x427858=await Promise[_0x66121b(0x204)](_0x423a88[_0x66121b(0x1cd)](async _0x1bbeee=>{const _0x5f29f4=_0x66121b,_0x561618=await executeTaskNode({'api':_0x4f4ccf[_0x5f29f4(0x1db)],'workspaceDir':_0x4f4ccf[_0x5f29f4(0x1f0)],'runDir':_0x4f4ccf['runDir'],'state':_0x4f4ccf[_0x5f29f4(0x177)],'program':_0x4f4ccf[_0x5f29f4(0x1f5)],'plan':_0x4f4ccf[_0x5f29f4(0x183)],'node':_0x1bbeee,'agent':_0x4f4ccf[_0x5f29f4(0x1bd)][_0x1bbeee[_0x5f29f4(0x1d0)]],'inputs':_0x4f4ccf[_0x5f29f4(0x185)],'defaultProvider':_0x4f4ccf[_0x5f29f4(0x210)],'defaultModel':_0x4f4ccf['defaultModel'],'defaultTimeoutMs':_0x4f4ccf['defaultTimeoutMs'],'cleanupSessions':_0x4f4ccf[_0x5f29f4(0x1a9)]});return{'node':_0x1bbeee,'output':_0x561618};}));let _0x409ce5;for(let _0x3f344c=0x0;_0x3f344c<_0x427858[_0x66121b(0x1eb)];_0x3f344c+=0x1){const _0x27bab7=_0x423a88[_0x3f344c],_0x1309c8=_0x4f4ccf[_0x66121b(0x177)]['nodeStates'][_0x27bab7['id']],_0x4b4728=_0x427858[_0x3f344c];_0x4f4ccf['state']['runningNodeIds']=_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x164)]['filter'](_0x4b43bc=>_0x4b43bc!==_0x27bab7['id']);if(_0x4b4728[_0x66121b(0x152)]===_0x66121b(0x211)){const _0x2ba888=await writeArtifact(_0x4f4ccf[_0x66121b(0x15d)],_0x27bab7['id'],_0x4b4728[_0x66121b(0x163)]['output']);_0x1309c8[_0x66121b(0x152)]='completed',_0x1309c8['completedAt']=new Date()[_0x66121b(0x198)](),_0x1309c8[_0x66121b(0x14c)]=_0x2ba888,_0x1309c8['summary']=summarizeText(_0x4b4728['value']['output']),_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x1f4)][_0x27bab7['id']]=_0x2ba888,_0x4f4ccf['state'][_0x66121b(0x147)]+=0x1,_0x4f4ccf[_0x66121b(0x177)]['completedNodeIds']=pushUnique(_0x4f4ccf[_0x66121b(0x177)]['completedNodeIds'],_0x27bab7['id']);shouldCaptureFinalOutput(_0x4f4ccf['plan'],_0x27bab7['id'])&&(_0x4f4ccf['state'][_0x66121b(0x135)]=_0x2ba888);await appendTimeline(_0x4f4ccf[_0x66121b(0x15d)],{'at':_0x1309c8[_0x66121b(0x180)],'type':_0x66121b(0x191),'runId':_0x4f4ccf['state'][_0x66121b(0x143)],'nodeId':_0x27bab7['id'],'message':_0x1309c8['summary']});continue;}_0x1309c8[_0x66121b(0x152)]='failed',_0x1309c8[_0x66121b(0x180)]=new Date()['toISOString'](),_0x1309c8[_0x66121b(0x141)]=_0x4b4728[_0x66121b(0x172)]instanceof Error?_0x4b4728[_0x66121b(0x172)][_0x66121b(0x17e)]:String(_0x4b4728[_0x66121b(0x172)]),!_0x409ce5&&(_0x409ce5={'nodeId':_0x27bab7['id'],'reason':_0x1309c8[_0x66121b(0x141)]});}if(_0x409ce5){await failRun(_0x4f4ccf[_0x66121b(0x15d)],_0x4f4ccf['state'],_0x4f4ccf[_0x66121b(0x183)],_0x409ce5);break;}}syncSchedulerState(_0x4f4ccf[_0x66121b(0x177)],_0x4f4ccf[_0x66121b(0x183)]),await writeRunState(_0x4f4ccf[_0x66121b(0x15d)],_0x4f4ccf[_0x66121b(0x177)]),await writeResumeFile(_0x4f4ccf[_0x66121b(0x15d)],_0x4f4ccf[_0x66121b(0x177)],_0x4f4ccf[_0x66121b(0x183)]);}catch(_0x12a0e8){const _0x5107f=_0x5902d0[0x0],_0x228413=_0x5107f?_0x4f4ccf['state'][_0x66121b(0x187)][_0x5107f['id']]:undefined;_0x228413&&(_0x228413[_0x66121b(0x152)]=_0x66121b(0x14f),_0x228413[_0x66121b(0x180)]=new Date()[_0x66121b(0x198)](),_0x228413[_0x66121b(0x141)]=_0x12a0e8 instanceof Error?_0x12a0e8[_0x66121b(0x17e)]:String(_0x12a0e8));_0x5107f&&(_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x164)]=_0x4f4ccf[_0x66121b(0x177)][_0x66121b(0x164)]['filter'](_0x35317e=>_0x35317e!==_0x5107f['id']));await failRun(_0x4f4ccf[_0x66121b(0x15d)],_0x4f4ccf['state'],_0x4f4ccf[_0x66121b(0x183)],{'nodeId':_0x5107f?.['id'],'reason':_0x228413?.['error']??(_0x12a0e8 instanceof Error?_0x12a0e8[_0x66121b(0x17e)]:String(_0x12a0e8))});break;}}return _0x4f4ccf[_0x66121b(0x177)];}function startNodeRecord(_0x4332a5){const _0x53c215=_0x85ffa7,_0x3aac52=_0x4332a5[_0x53c215(0x177)][_0x53c215(0x187)][_0x4332a5[_0x53c215(0x13a)]['id']],_0x3f4567=(_0x3aac52?.['visitCount']??0x0)+0x1,_0x31e70f={'nodeId':_0x4332a5['node']['id'],'status':_0x53c215(0x1f6),'readyAt':new Date()['toISOString'](),'startedAt':new Date()[_0x53c215(0x198)](),'agentId':_0x4332a5[_0x53c215(0x13a)]['agentId'],'executionTarget':_0x4332a5[_0x53c215(0x13a)][_0x53c215(0x20a)]['executionTarget'],'dependsOnSnapshot':[..._0x4332a5[_0x53c215(0x13a)][_0x53c215(0x208)]],'contextFromSnapshot':[..._0x4332a5[_0x53c215(0x13a)][_0x53c215(0x1ef)]],'visitCount':_0x3f4567,'wave':_0x4332a5[_0x53c215(0x1ff)]};return _0x4332a5[_0x53c215(0x177)]['nodeStates'][_0x4332a5[_0x53c215(0x13a)]['id']]=_0x31e70f,_0x31e70f;}async function executeTaskNode(_0x2f8b63){const _0x42c736=_0x85ffa7,_0x864338=[_0x42c736(0x206),_0x42c736(0x1b1),'',_0x42c736(0x19d)+_0x2f8b63['program'][_0x42c736(0x209)],_0x42c736(0x140)+_0x2f8b63[_0x42c736(0x13a)]['title'],_0x42c736(0x179)+_0x2f8b63[_0x42c736(0x13a)][_0x42c736(0x209)],'',_0x42c736(0x145),_0x2f8b63['agent'][_0x42c736(0x14d)],'',_0x42c736(0x16a),_0x2f8b63[_0x42c736(0x1ca)]['instructions'],'','Node\x20instructions:',_0x2f8b63[_0x42c736(0x13a)][_0x42c736(0x173)],'',_0x42c736(0x1bb),..._0x2f8b63[_0x42c736(0x13a)][_0x42c736(0x1dd)]['map'](_0x5b027b=>'-\x20'+_0x5b027b),'','Inputs\x20JSON:',JSON[_0x42c736(0x1d7)](_0x2f8b63[_0x42c736(0x185)],null,0x2),'',_0x42c736(0x153),await buildNodeContext(_0x2f8b63[_0x42c736(0x15d)],_0x2f8b63['state'],_0x2f8b63[_0x42c736(0x13a)][_0x42c736(0x1ef)]),'',_0x42c736(0x20e),..._0x2f8b63[_0x42c736(0x1f5)][_0x42c736(0x224)][_0x42c736(0x15e)]['map'](_0x15bc45=>'-\x20'+_0x15bc45)][_0x42c736(0x189)]('\x0a');if(_0x2f8b63[_0x42c736(0x13a)]['permissions']['executionTarget']===_0x42c736(0x139))return executeSubagentTaskNode({'api':_0x2f8b63[_0x42c736(0x1db)],'runDir':_0x2f8b63[_0x42c736(0x15d)],'state':_0x2f8b63[_0x42c736(0x177)],'node':_0x2f8b63[_0x42c736(0x13a)],'agent':_0x2f8b63[_0x42c736(0x1ca)],'prompt':_0x864338,'timeoutMs':_0x2f8b63[_0x42c736(0x1ca)]['timeoutMs']??_0x2f8b63[_0x42c736(0x1a4)],'providerOverride':_0x2f8b63[_0x42c736(0x1ca)][_0x42c736(0x19f)],'modelOverride':_0x2f8b63['agent']['model'],'inheritedProvider':_0x2f8b63[_0x42c736(0x210)],'inheritedModel':_0x2f8b63['defaultModel'],'cleanupSessions':_0x2f8b63[_0x42c736(0x1a9)]});return executeEmbeddedPrompt({'api':_0x2f8b63['api'],'workspaceDir':_0x2f8b63[_0x42c736(0x1f0)],'runDir':_0x2f8b63[_0x42c736(0x15d)],'sessionId':_0x2f8b63[_0x42c736(0x177)][_0x42c736(0x143)]+':'+_0x2f8b63['node']['id'],'runId':_0x2f8b63[_0x42c736(0x177)][_0x42c736(0x143)]+':'+_0x2f8b63['node']['id'],'prompt':_0x864338,'provider':_0x2f8b63[_0x42c736(0x1ca)][_0x42c736(0x19f)]??_0x2f8b63[_0x42c736(0x210)],'model':_0x2f8b63[_0x42c736(0x1ca)][_0x42c736(0x17c)]??_0x2f8b63[_0x42c736(0x1c5)],'timeoutMs':_0x2f8b63[_0x42c736(0x1ca)]['timeoutMs']??_0x2f8b63[_0x42c736(0x1a4)]});}async function executeJudgeNode(_0x1f6c3a){const _0x2a7698=_0x85ffa7,_0x8da9a2=[_0x2a7698(0x154),'Return\x20JSON\x20only\x20with\x20shape\x20{\x22decision\x22:\x22branch_key\x22,\x22reason\x22:\x22optional\x20short\x20reason\x22}.','Do\x20not\x20include\x20markdown\x20fences.','',_0x2a7698(0x19d)+_0x1f6c3a[_0x2a7698(0x1f5)][_0x2a7698(0x209)],'Judge\x20title:\x20'+_0x1f6c3a[_0x2a7698(0x13a)][_0x2a7698(0x12f)],'Question:\x20'+_0x1f6c3a[_0x2a7698(0x13a)][_0x2a7698(0x1fe)],'',_0x2a7698(0x145),_0x1f6c3a[_0x2a7698(0x1ca)][_0x2a7698(0x14d)],'','Agent\x20instructions:',_0x1f6c3a[_0x2a7698(0x1ca)]['instructions'],'',_0x2a7698(0x159),_0x1f6c3a[_0x2a7698(0x13a)]['instructions'],'',_0x2a7698(0x1fb)+_0x1f6c3a[_0x2a7698(0x13a)][_0x2a7698(0x1a7)][_0x2a7698(0x189)](',\x20'),'',_0x2a7698(0x1e5),JSON[_0x2a7698(0x1d7)](_0x1f6c3a[_0x2a7698(0x185)],null,0x2),'',_0x2a7698(0x153),await buildNodeContext(_0x1f6c3a[_0x2a7698(0x15d)],_0x1f6c3a['state'],_0x1f6c3a['node']['contextFrom'])][_0x2a7698(0x189)]('\x0a'),_0x346e2e=await executeEmbeddedPrompt({'api':_0x1f6c3a[_0x2a7698(0x1db)],'workspaceDir':_0x1f6c3a[_0x2a7698(0x1f0)],'runDir':_0x1f6c3a[_0x2a7698(0x15d)],'sessionId':_0x1f6c3a['state']['runId']+':'+_0x1f6c3a[_0x2a7698(0x13a)]['id'],'runId':_0x1f6c3a[_0x2a7698(0x177)][_0x2a7698(0x143)]+':'+_0x1f6c3a[_0x2a7698(0x13a)]['id'],'prompt':_0x8da9a2,'provider':_0x1f6c3a[_0x2a7698(0x1ca)][_0x2a7698(0x19f)]??_0x1f6c3a['defaultProvider'],'model':_0x1f6c3a[_0x2a7698(0x1ca)]['model']??_0x1f6c3a[_0x2a7698(0x1c5)],'timeoutMs':_0x1f6c3a[_0x2a7698(0x1ca)][_0x2a7698(0x1e0)]??_0x1f6c3a[_0x2a7698(0x1a4)]});return parseJudgeDecision(_0x346e2e);}async function executeSubagentTaskNode(_0x5e1ff2){const _0x297996=_0x85ffa7,_0x2ad5f1=_0x5e1ff2[_0x297996(0x177)][_0x297996(0x187)][_0x5e1ff2[_0x297996(0x13a)]['id']],_0x55fea4=_0x5e1ff2[_0x297996(0x177)]['runtime']['supervisorAgentId']??_0x5e1ff2[_0x297996(0x177)][_0x297996(0x1e3)]['agentId']??_0x5e1ff2[_0x297996(0x177)][_0x297996(0x190)]?.[_0x297996(0x18a)],_0x796014=scopeAgentSessionKey(_0x55fea4,_0x297996(0x1d3)+_0x5e1ff2[_0x297996(0x177)]['runId']+':'+_0x5e1ff2[_0x297996(0x13a)]['id']+':v'+(_0x2ad5f1?.[_0x297996(0x217)]??0x1));let _0x5d35eb=![];try{const _0x3d11a8=await runOwnProseSubagent({'api':_0x5e1ff2[_0x297996(0x1db)],'sessionKey':_0x796014,'agentId':_0x55fea4,'message':_0x5e1ff2[_0x297996(0x171)],'timeoutMs':_0x5e1ff2[_0x297996(0x1e0)],'idempotencyKey':_0x796014,'providerOverride':_0x5e1ff2[_0x297996(0x17b)],'modelOverride':_0x5e1ff2['modelOverride'],'inheritedProvider':_0x5e1ff2[_0x297996(0x1ba)],'inheritedModel':_0x5e1ff2[_0x297996(0x1dc)],'label':_0x297996(0x1b9)+_0x5e1ff2['state'][_0x297996(0x143)]+':'+_0x5e1ff2[_0x297996(0x13a)]['id']});_0x2ad5f1&&(_0x2ad5f1[_0x297996(0x18c)]=_0x3d11a8[_0x297996(0x18e)]??_0x297996(0x1a8),_0x2ad5f1[_0x297996(0x1fc)]=_0x796014,_0x2ad5f1[_0x297996(0x226)]=_0x3d11a8['runId'],await writeRunState(_0x5e1ff2[_0x297996(0x15d)],_0x5e1ff2[_0x297996(0x177)]));const _0x24265a=await waitForOwnProseSubagentRun({'api':_0x5e1ff2['api'],'runId':_0x3d11a8[_0x297996(0x143)],'timeoutMs':_0x5e1ff2[_0x297996(0x1e0)]});if(_0x24265a[_0x297996(0x152)]!=='ok')throw new Error(_0x24265a[_0x297996(0x152)]==='timeout'?_0x297996(0x130)+_0x5e1ff2[_0x297996(0x13a)]['id']:'Subagent\x20task\x20failed:\x20'+(_0x24265a[_0x297996(0x141)]??_0x5e1ff2[_0x297996(0x13a)]['id']));const _0x5f313e=await getOwnProseSubagentMessages({'api':_0x5e1ff2['api'],'sessionKey':_0x796014,'limit':0xc8}),_0x5108c8=extractSubagentOutputText(_0x5f313e[_0x297996(0x13d)]);return _0x5d35eb=!![],_0x5108c8;}finally{_0x5d35eb&&await cleanupOwnProseSubagentSession({'api':_0x5e1ff2[_0x297996(0x1db)],'sessionKey':_0x796014,'enabled':_0x5e1ff2['cleanupSessions']});}}async function cleanupOwnProseSubagentSession(_0x1c11ee){const _0x5af666=_0x85ffa7;await cleanupOwnProseSession({'api':_0x1c11ee[_0x5af666(0x1db)],'sessionKey':_0x1c11ee['sessionKey'],'enabled':_0x1c11ee[_0x5af666(0x1da)],'deleteMode':_0x5af666(0x166)});}async function cleanupOwnProseSession(_0x4faaa9){const _0x2a570f=_0x85ffa7;if(!_0x4faaa9['enabled'])return;const _0x23f81c=_0x4faaa9[_0x2a570f(0x176)][_0x2a570f(0x150)]();if(!_0x23f81c)return;await deleteOwnProseSession({'api':_0x4faaa9[_0x2a570f(0x1db)],'sessionKey':_0x23f81c,'deleteMode':_0x4faaa9[_0x2a570f(0x1e4)]});let _0x29b628=0x0;for(const _0x229ef4 of SESSION_CLEANUP_RECHECK_DELAYS_MS){await sleep(_0x229ef4);const _0x492bce=await probeOwnProseSession({'sessionKey':_0x23f81c});if(_0x492bce!==!![]){_0x29b628+=0x1;if(_0x29b628>=0x2)return;continue;}_0x29b628=0x0,await deleteOwnProseSession({'api':_0x4faaa9[_0x2a570f(0x1db)],'sessionKey':_0x23f81c,'deleteMode':_0x4faaa9[_0x2a570f(0x1e4)]});}}async function deleteOwnProseSession(_0x2a5cc3){const _0x502494=_0x85ffa7;try{await deleteAgentSession({'sessionKey':_0x2a5cc3[_0x502494(0x176)],'deleteTranscript':!![]});}catch{}}async function probeOwnProseSession(_0xd07973){const _0x417b13=_0x85ffa7;try{return await hasAgentSession({'sessionKey':_0xd07973[_0x417b13(0x176)]});}catch{return undefined;}}async function cleanupOwnProseRunSessions(_0x11bda2){const _0x1f3518=_0x85ffa7;for(const _0xe69850 of collectOwnProseSessionKeys(_0x11bda2[_0x1f3518(0x177)],{'includeSupervisor':_0x11bda2[_0x1f3518(0x1b5)]})){await cleanupOwnProseSession({'api':_0x11bda2[_0x1f3518(0x1db)],'sessionKey':_0xe69850,'enabled':_0x11bda2[_0x1f3518(0x1da)],'deleteMode':_0x11bda2[_0x1f3518(0x1e4)]});}}async function finalizeBackgroundState(_0x502329){const _0x3dd624=_0x85ffa7;_0x502329['state'][_0x3dd624(0x190)]={..._0x502329[_0x3dd624(0x177)][_0x3dd624(0x190)]??{'mode':_0x3dd624(0x190),'startedAt':new Date()['toISOString']()},'mode':_0x3dd624(0x190),'status':_0x502329[_0x3dd624(0x177)][_0x3dd624(0x152)]==='completed'?_0x3dd624(0x142):'failed','finishedAt':new Date()['toISOString']()},_0x502329[_0x3dd624(0x177)][_0x3dd624(0x190)][_0x3dd624(0x20b)]&&(_0x502329[_0x3dd624(0x177)][_0x3dd624(0x190)][_0x3dd624(0x20b)]={..._0x502329[_0x3dd624(0x177)][_0x3dd624(0x190)]['supervisor'],'status':_0x502329[_0x3dd624(0x177)]['status']===_0x3dd624(0x17d)?_0x3dd624(0x142):_0x3dd624(0x14f),'finishedAt':new Date()[_0x3dd624(0x198)](),'error':_0x502329[_0x3dd624(0x177)][_0x3dd624(0x1c4)]?.[_0x3dd624(0x172)]}),await writeRunState(_0x502329[_0x3dd624(0x15d)],_0x502329[_0x3dd624(0x177)]),await writeResumeFile(_0x502329[_0x3dd624(0x15d)],_0x502329[_0x3dd624(0x177)],_0x502329['plan']);}async function executeEmbeddedPrompt(_0x39e2a3){const _0x50bb59=_0x85ffa7,_0x19a0e2=await _0x39e2a3[_0x50bb59(0x1db)][_0x50bb59(0x1e3)][_0x50bb59(0x1ca)][_0x50bb59(0x1d1)]({'sessionId':_0x39e2a3[_0x50bb59(0x181)],'runId':_0x39e2a3[_0x50bb59(0x143)],'sessionFile':_0x25f695[_0x50bb59(0x189)](_0x39e2a3[_0x50bb59(0x15d)],_0x50bb59(0x212),sanitizeId(_0x39e2a3[_0x50bb59(0x181)])+_0x50bb59(0x1cb)),'workspaceDir':_0x39e2a3['workspaceDir'],'config':_0x39e2a3[_0x50bb59(0x1db)]['config'],'lane':OWN_PROSE_EMBEDDED_LANE,'prompt':_0x39e2a3[_0x50bb59(0x171)],'timeoutMs':_0x39e2a3[_0x50bb59(0x1e0)],..._0x39e2a3[_0x50bb59(0x19f)]?{'provider':_0x39e2a3[_0x50bb59(0x19f)]}:{},..._0x39e2a3[_0x50bb59(0x17c)]?{'model':_0x39e2a3[_0x50bb59(0x17c)]}:{}}),_0x520c9f=extractEmbeddedRunOutputText(_0x19a0e2[_0x50bb59(0x196)]);if(_0x520c9f)return _0x520c9f;const _0x3b7d02=_0x19a0e2[_0x50bb59(0x184)]?.[_0x50bb59(0x141)]?.[_0x50bb59(0x17e)]?.[_0x50bb59(0x150)]();throw new Error(_0x3b7d02||_0x50bb59(0x1af));}async function sleep(_0x25f9ca){await new Promise(_0x307d0f=>setTimeout(_0x307d0f,_0x25f9ca));}async function buildNodeContext(_0x2acf85,_0x5e18ff,_0x176fba){const _0xd98574=_0x85ffa7,_0x19d8ac=await Promise[_0xd98574(0x16e)](_0x176fba[_0xd98574(0x1cd)](async _0x2beef2=>{const _0x1804fc=_0xd98574,_0x583181=_0x5e18ff[_0x1804fc(0x1f4)][_0x2beef2];if(!_0x583181)return _0x1804fc(0x146)+_0x2beef2+'\x0a[missing\x20artifact]';const _0x5847c6=await _0x35f044['readFile'](_0x25f695[_0x1804fc(0x1de)](_0x2acf85,_0x583181),_0x1804fc(0x157))[_0x1804fc(0x188)](()=>'');return _0x1804fc(0x146)+_0x2beef2+'\x0a'+truncateText(_0x5847c6,0x5dc);}));return _0x19d8ac['length']>0x0?_0x19d8ac[_0xd98574(0x189)]('\x0a\x0a'):_0xd98574(0x19e);}function syncSchedulerState(_0x5b2336,_0x38b11e){const _0x548d1d=_0x85ffa7;_0x5b2336[_0x548d1d(0x1f9)]=uniqueNodeIds([..._0x5b2336[_0x548d1d(0x1f9)],...Object[_0x548d1d(0x1c6)](_0x5b2336['nodeStates'])[_0x548d1d(0x1fa)](_0x18bfe6=>_0x18bfe6['status']===_0x548d1d(0x17d))[_0x548d1d(0x1cd)](_0x51964b=>_0x51964b['nodeId'])]),_0x5b2336[_0x548d1d(0x164)]=uniqueNodeIds([..._0x5b2336[_0x548d1d(0x164)],...Object[_0x548d1d(0x1c6)](_0x5b2336[_0x548d1d(0x187)])[_0x548d1d(0x1fa)](_0x5bbaec=>_0x5bbaec[_0x548d1d(0x152)]===_0x548d1d(0x1f6))[_0x548d1d(0x1cd)](_0x52bd73=>_0x52bd73[_0x548d1d(0x1ec)])]),_0x5b2336[_0x548d1d(0x1ee)]=_0x5b2336[_0x548d1d(0x1ee)]['filter'](_0x5bc92a=>!_0x5b2336['completedNodeIds'][_0x548d1d(0x1b3)](_0x5bc92a)&&!_0x5b2336[_0x548d1d(0x164)][_0x548d1d(0x1b3)](_0x5bc92a)),_0x5b2336[_0x548d1d(0x158)]=computeReadyNodeIds(_0x38b11e,_0x5b2336),_0x5b2336['currentNodeId']=_0x5b2336['runningNodeIds'][0x0]??_0x5b2336[_0x548d1d(0x158)][0x0]??null;}function recoverInterruptedRunningNodes(_0x21935d,_0x3b967d){const _0x2fb75e=_0x85ffa7,_0x5976d2=_0x21935d[_0x2fb75e(0x164)][_0x2fb75e(0x1fa)](_0x56d883=>!_0x21935d[_0x2fb75e(0x1f9)]['includes'](_0x56d883));if(_0x5976d2['length']===0x0)return![];for(const _0x611395 of _0x5976d2){const _0x42a1e3=_0x21935d['nodeStates'][_0x611395];_0x21935d[_0x2fb75e(0x187)][_0x611395]={..._0x42a1e3??{'nodeId':_0x611395,'visitCount':0x0},'status':_0x2fb75e(0x1a5),'readyAt':undefined,'startedAt':undefined,'completedAt':undefined,'subagentCarrier':undefined,'taskSessionKey':undefined,'subagentRunId':undefined,'artifactPath':undefined,'summary':undefined,'error':undefined};}const _0x56356e=new Set([..._0x21935d[_0x2fb75e(0x1ee)],..._0x5976d2]);return _0x21935d[_0x2fb75e(0x164)]=[],_0x21935d['pendingNodeIds']=_0x3b967d[_0x2fb75e(0x1b7)]['map'](_0x13fbf2=>_0x13fbf2['id'])[_0x2fb75e(0x1fa)](_0x4d5e1b=>!_0x21935d['completedNodeIds']['includes'](_0x4d5e1b)&&_0x56356e[_0x2fb75e(0x137)](_0x4d5e1b)),syncSchedulerState(_0x21935d,_0x3b967d),!![];}function computeReadyNodeIds(_0x6e047e,_0x4a72e9){const _0x2075b3=_0x85ffa7,_0x28eef5=new Set(_0x4a72e9[_0x2075b3(0x1f9)]),_0x5cafdf=new Set(_0x4a72e9[_0x2075b3(0x164)]),_0x2fdecb=new Set(_0x4a72e9['pendingNodeIds']),_0x832f08=new Map(_0x6e047e[_0x2075b3(0x1b7)]['map'](_0x45ee65=>[_0x45ee65['id'],_0x45ee65])),_0x32c67b=new Map(_0x4a72e9[_0x2075b3(0x207)]['map'](_0x1c150a=>[_0x1c150a['nodeId'],_0x1c150a['decision']]));return _0x6e047e[_0x2075b3(0x1b7)][_0x2075b3(0x1fa)](_0x19d775=>_0x2fdecb[_0x2075b3(0x137)](_0x19d775['id'])&&!_0x5cafdf['has'](_0x19d775['id']))[_0x2075b3(0x1fa)](_0x286d20=>isDependencySatisfied({'node':_0x286d20,'completed':_0x28eef5,'nodeMap':_0x832f08,'selectedBranches':_0x32c67b}))['map'](_0x22964a=>_0x22964a['id']);}function isDependencySatisfied(_0x2f9fbf){const _0x5bece1=_0x85ffa7;if(_0x2f9fbf[_0x5bece1(0x13a)]['dependsOn'][_0x5bece1(0x1eb)]===0x0)return!![];const _0x12e77=_0x2f9fbf[_0x5bece1(0x13a)][_0x5bece1(0x208)][_0x5bece1(0x1cd)](_0x58151f=>{const _0x169c37=_0x5bece1;if(!_0x2f9fbf[_0x169c37(0x17d)][_0x169c37(0x137)](_0x58151f))return![];const _0x2efd2b=_0x2f9fbf[_0x169c37(0x14e)][_0x169c37(0x17f)](_0x58151f);if(_0x2efd2b?.[_0x169c37(0x197)]!==_0x169c37(0x1f2))return!![];const _0x2cf959=new Set(Object[_0x169c37(0x1c6)](_0x2efd2b[_0x169c37(0x1a3)]));if(!_0x2cf959['has'](_0x2f9fbf['node']['id']))return!![];const _0x242acc=_0x2f9fbf['selectedBranches'][_0x169c37(0x17f)](_0x2efd2b['id']);return Boolean(_0x242acc)&&_0x2efd2b[_0x169c37(0x1a3)][_0x242acc]===_0x2f9fbf[_0x169c37(0x13a)]['id'];});return _0x2f9fbf['node'][_0x5bece1(0x160)]===_0x5bece1(0x161)?_0x12e77[_0x5bece1(0x186)](Boolean):_0x12e77[_0x5bece1(0x21a)](Boolean);}function getReadyNodesInPlanOrder(_0x1447ab,_0x675fdc){const _0x16c05=_0x85ffa7,_0x48aead=new Set(_0x675fdc['readyNodeIds']);return _0x1447ab['nodes'][_0x16c05(0x1fa)](_0x26aeb5=>_0x48aead[_0x16c05(0x137)](_0x26aeb5['id']));}function selectExecutionBatch(_0x1ce60e){const _0x4285b4=_0x85ffa7,_0x2f1ad2=_0x1ce60e[0x0];if(!_0x2f1ad2)return[];if(_0x2f1ad2[_0x4285b4(0x197)]!=='task')return[_0x2f1ad2];const _0x4ec2f2=[];for(const _0x185363 of _0x1ce60e){if(_0x185363[_0x4285b4(0x197)]!=='task')break;_0x4ec2f2[_0x4285b4(0x1c3)](_0x185363);if(_0x4ec2f2[_0x4285b4(0x1eb)]>=MAX_PARALLEL_TASKS)break;}return _0x4ec2f2;}function shouldCaptureFinalOutput(_0x2885db,_0x5b60a4){const _0x23930a=_0x85ffa7,_0x15ac5b=_0x2885db[_0x23930a(0x1b7)][_0x23930a(0x1fa)](_0x266d39=>_0x266d39[_0x23930a(0x208)]['includes'](_0x5b60a4));return _0x15ac5b[_0x23930a(0x1eb)]===0x0||_0x15ac5b[_0x23930a(0x21a)](_0x32f698=>_0x32f698[_0x23930a(0x197)]===_0x23930a(0x12e));}function markPendingNodesSkipped(_0x922b9c,_0x5a56d1){const _0x679e2a=_0x85ffa7,_0x359f34=new Set([..._0x922b9c[_0x679e2a(0x1ee)],..._0x5a56d1[_0x679e2a(0x1b7)][_0x679e2a(0x1cd)](_0x726c9=>_0x726c9['id'])[_0x679e2a(0x1fa)](_0x251995=>!_0x922b9c[_0x679e2a(0x1f9)][_0x679e2a(0x1b3)](_0x251995)&&!_0x922b9c[_0x679e2a(0x164)]['includes'](_0x251995)&&!_0x922b9c['readyNodeIds'][_0x679e2a(0x1b3)](_0x251995))]);for(const _0x1e7378 of _0x359f34){_0x922b9c['nodeStates'][_0x1e7378]={..._0x922b9c[_0x679e2a(0x187)][_0x1e7378]??{'nodeId':_0x1e7378,'visitCount':0x0},'status':_0x679e2a(0x202),'completedAt':new Date()[_0x679e2a(0x198)](),'summary':_0x679e2a(0x1c8)};}_0x922b9c[_0x679e2a(0x1ee)]=[],_0x922b9c[_0x679e2a(0x158)]=[],_0x922b9c[_0x679e2a(0x164)]=[];}function uniqueNodeIds(_0x19e70){return[...new Set(_0x19e70)];}function pushUnique(_0x16d9f9,_0x398d4b){return _0x16d9f9['includes'](_0x398d4b)?_0x16d9f9:[..._0x16d9f9,_0x398d4b];}function resolveConfiguredAgentRuntimeDefaults(_0x5a888e){const _0x4729be=readConfiguredPrimaryModel(_0x5a888e);if(!_0x4729be)return{};return splitModelRef(_0x4729be);}function readConfiguredPrimaryModel(_0x253b41){const _0x49c662=_0x85ffa7,_0x5bc413=asRecord(_0x253b41?.[_0x49c662(0x1bd)]),_0x123e93=asRecord(_0x5bc413?.[_0x49c662(0x17a)]),_0x5eb514=asRecord(_0x123e93?.[_0x49c662(0x17c)]),_0x28d696=_0x5eb514?.[_0x49c662(0x1e1)];return typeof _0x28d696===_0x49c662(0x178)&&_0x28d696[_0x49c662(0x150)]()?_0x28d696[_0x49c662(0x150)]():undefined;}function splitModelRef(_0x3dfa59){const _0x4b24ef=_0x85ffa7,_0xd96282=_0x3dfa59[_0x4b24ef(0x150)](),_0x19743d=_0xd96282[_0x4b24ef(0x165)]('/');if(_0x19743d<=0x0||_0x19743d>=_0xd96282['length']-0x1)return{'model':_0xd96282||undefined};return{'provider':_0xd96282[_0x4b24ef(0x19a)](0x0,_0x19743d),'model':_0xd96282[_0x4b24ef(0x19a)](_0x19743d+0x1)};}function asRecord(_0x3eb447){const _0x5d718f=_0x85ffa7;return _0x3eb447&&typeof _0x3eb447===_0x5d718f(0x16d)&&!Array[_0x5d718f(0x131)](_0x3eb447)?_0x3eb447:undefined;}function parseJudgeDecision(_0x3c5d2d){const _0x4a4ebb=_0x85ffa7,_0x5a9b4f=_0x3c5d2d[_0x4a4ebb(0x150)]();try{const _0x1bdfe0=extractJsonObject(_0x5a9b4f),_0x133c79=JSON['parse'](_0x1bdfe0),_0x489c99=typeof _0x133c79[_0x4a4ebb(0x182)]==='string'?_0x133c79[_0x4a4ebb(0x182)]['trim']():'';if(!_0x489c99)throw new Error(_0x4a4ebb(0x138));const _0x502f22=typeof _0x133c79[_0x4a4ebb(0x172)]==='string'&&_0x133c79[_0x4a4ebb(0x172)][_0x4a4ebb(0x150)]()?_0x133c79[_0x4a4ebb(0x172)][_0x4a4ebb(0x150)]():undefined;return{'decision':_0x489c99,'reason':_0x502f22};}catch{if(_0x5a9b4f&&!_0x5a9b4f[_0x4a4ebb(0x1b3)]('\x0a'))return{'decision':_0x5a9b4f};throw new Error(_0x4a4ebb(0x1b0));}}async function failRun(_0x1fe369,_0xdc2106,_0x13dbe8,_0x157181){const _0x4d5a3c=_0x85ffa7;_0xdc2106['status']=_0x4d5a3c(0x14f),_0xdc2106['failure']=_0x157181,await appendTimeline(_0x1fe369,{'at':new Date()[_0x4d5a3c(0x198)](),'type':_0x4d5a3c(0x1a1),'runId':_0xdc2106[_0x4d5a3c(0x143)],'nodeId':_0x157181[_0x4d5a3c(0x1ec)],'message':_0x157181[_0x4d5a3c(0x172)]}),await writeRunState(_0x1fe369,_0xdc2106),await writeResumeFile(_0x1fe369,_0xdc2106,_0x13dbe8);}function startBackgroundSupervisorMonitor(_0x4035f9){const _0x58f3f6=_0x85ffa7;void monitorBackgroundSupervisor(_0x4035f9)[_0x58f3f6(0x188)](()=>{});}function _0x2c31(_0x246df1,_0xec106b){_0x246df1=_0x246df1-0x12e;const _0x3a51d5=_0x3a51();let _0x2c317c=_0x3a51d5[_0x246df1];return _0x2c317c;}async function monitorBackgroundSupervisor(_0x28f624){const _0x1c4a86=_0x85ffa7,_0x432be5=await waitForOwnProseSubagentRun({'api':_0x28f624[_0x1c4a86(0x1db)],'runId':_0x28f624['supervisorRunId'],'timeoutMs':_0x28f624[_0x1c4a86(0x1cf)]});if(_0x432be5[_0x1c4a86(0x152)]===_0x1c4a86(0x19b))return;if(_0x432be5['status']==='ok'){const _0x11d0bb=await waitForBackgroundRunToSettle(_0x28f624[_0x1c4a86(0x15d)]);if(!_0x11d0bb||_0x11d0bb[_0x1c4a86(0x152)]===_0x1c4a86(0x1f6))return;const _0x27cf79=await probeOwnProseSession({'sessionKey':_0x28f624[_0x1c4a86(0x1ab)]});_0x27cf79===!![]&&await cleanupOwnProseSession({'api':_0x28f624[_0x1c4a86(0x1db)],'sessionKey':_0x28f624[_0x1c4a86(0x1ab)],'enabled':_0x28f624['cleanupSessions'],'deleteMode':_0x1c4a86(0x166)});return;}await cleanupOwnProseSession({'api':_0x28f624[_0x1c4a86(0x1db)],'sessionKey':_0x28f624['supervisorSessionKey'],'enabled':_0x28f624['cleanupSessions'],'deleteMode':_0x1c4a86(0x166)});const _0x2840dc=await readRunState(_0x28f624[_0x1c4a86(0x15d)])[_0x1c4a86(0x188)](()=>undefined);if(!_0x2840dc||_0x2840dc[_0x1c4a86(0x152)]!==_0x1c4a86(0x1f6))return;const _0x148fc4='Background\x20supervisor\x20failed:\x20'+(_0x432be5[_0x1c4a86(0x141)]??_0x28f624[_0x1c4a86(0x1c1)]),_0x5089cd=new Date()[_0x1c4a86(0x198)]();_0x2840dc['background']={..._0x2840dc[_0x1c4a86(0x190)]??{'mode':_0x1c4a86(0x190),'startedAt':_0x2840dc[_0x1c4a86(0x20c)]},'mode':_0x1c4a86(0x190),'status':_0x1c4a86(0x14f),'finishedAt':_0x5089cd,'supervisor':{..._0x2840dc[_0x1c4a86(0x190)]?.[_0x1c4a86(0x20b)]??{},'status':'failed','sessionKey':_0x2840dc['background']?.[_0x1c4a86(0x20b)]?.[_0x1c4a86(0x176)]??_0x28f624['supervisorSessionKey'],'runId':_0x2840dc[_0x1c4a86(0x190)]?.[_0x1c4a86(0x20b)]?.[_0x1c4a86(0x143)]??_0x28f624[_0x1c4a86(0x1c1)],'finishedAt':_0x5089cd,'error':_0x432be5[_0x1c4a86(0x141)]??_0x28f624[_0x1c4a86(0x1c1)]}},await failRun(_0x28f624[_0x1c4a86(0x15d)],_0x2840dc,_0x28f624[_0x1c4a86(0x183)],{'reason':_0x148fc4});}async function waitForBackgroundRunToSettle(_0x2e03b9){const _0xd26dfa=_0x85ffa7;let _0x587637=await readRunState(_0x2e03b9)[_0xd26dfa(0x188)](()=>undefined);for(let _0xe7d26b=0x0;_0xe7d26b<BACKGROUND_STATE_SETTLE_RETRY_COUNT;_0xe7d26b+=0x1){if(!_0x587637||_0x587637[_0xd26dfa(0x152)]!==_0xd26dfa(0x1f6))return _0x587637;await sleep(BACKGROUND_STATE_SETTLE_RETRY_DELAY_MS),_0x587637=await readRunState(_0x2e03b9)[_0xd26dfa(0x188)](()=>_0x587637);}return _0x587637;}async function runInBackground(_0x1fcb54){const _0x34f43c=_0x85ffa7;let _0x581772=_0x1fcb54[_0x34f43c(0x177)];try{return _0x1fcb54[_0x34f43c(0x177)][_0x34f43c(0x190)]={..._0x1fcb54[_0x34f43c(0x177)]['background']??{'mode':_0x34f43c(0x190),'startedAt':new Date()['toISOString']()},'mode':'background','status':'running'},_0x1fcb54[_0x34f43c(0x177)][_0x34f43c(0x190)][_0x34f43c(0x20b)]&&(_0x1fcb54[_0x34f43c(0x177)][_0x34f43c(0x190)]['supervisor']={..._0x1fcb54[_0x34f43c(0x177)][_0x34f43c(0x190)][_0x34f43c(0x20b)],'status':'running','startedAt':new Date()[_0x34f43c(0x198)](),'error':undefined}),await writeRunState(_0x1fcb54['runDir'],_0x1fcb54[_0x34f43c(0x177)]),await writeResumeFile(_0x1fcb54[_0x34f43c(0x15d)],_0x1fcb54[_0x34f43c(0x177)],_0x1fcb54[_0x34f43c(0x183)]),_0x581772=await executePlan({..._0x1fcb54}),await finalizeBackgroundState({'runDir':_0x1fcb54['runDir'],'state':_0x581772,'plan':_0x1fcb54[_0x34f43c(0x183)]}),await notifyBackgroundRunFinished({'runDir':_0x1fcb54['runDir'],'state':_0x581772,'plan':_0x1fcb54[_0x34f43c(0x183)]}),_0x581772;}finally{await cleanupOwnProseRunSessions({'api':_0x1fcb54['api'],'state':_0x581772,'enabled':_0x1fcb54['cleanupSessions'],'includeSupervisor':![],'deleteMode':_0x34f43c(0x166)}),await cleanupOwnProseSession({'api':_0x1fcb54[_0x34f43c(0x1db)],'sessionKey':_0x581772[_0x34f43c(0x190)]?.[_0x34f43c(0x20b)]?.['sessionKey']??'','enabled':_0x1fcb54['cleanupSessions'],'deleteMode':_0x34f43c(0x166)}),requestBackgroundSupervisorCleanupProcess({'state':_0x581772,'runDir':_0x1fcb54['runDir'],'enabled':_0x1fcb54[_0x34f43c(0x1a9)]});}}async function notifyBackgroundRunFinished(_0x10d8f3){const _0x5ac654=_0x85ffa7,_0x2f322a=_0x10d8f3['state'][_0x5ac654(0x190)];if(!_0x2f322a)return;const _0xbeb553=new Date()['toISOString'](),_0xf23af0=_0x2f322a[_0x5ac654(0x1aa)]?.[_0x5ac654(0x150)]();if(!_0xf23af0){_0x2f322a[_0x5ac654(0x136)]={'status':_0x5ac654(0x202),'attemptedAt':_0xbeb553},await writeRunState(_0x10d8f3[_0x5ac654(0x15d)],_0x10d8f3['state']),await writeResumeFile(_0x10d8f3['runDir'],_0x10d8f3['state'],_0x10d8f3[_0x5ac654(0x183)]),await appendTimeline(_0x10d8f3['runDir'],{'at':_0xbeb553,'type':'notification_skipped','runId':_0x10d8f3[_0x5ac654(0x177)][_0x5ac654(0x143)],'message':_0x5ac654(0x132)});return;}_0x2f322a[_0x5ac654(0x136)]={'status':_0x5ac654(0x1a5),'attemptedAt':_0xbeb553},await writeRunState(_0x10d8f3['runDir'],_0x10d8f3[_0x5ac654(0x177)]),await writeResumeFile(_0x10d8f3[_0x5ac654(0x15d)],_0x10d8f3[_0x5ac654(0x177)],_0x10d8f3['plan']);try{const _0x568873=await notifyAgentSession({'sessionKey':_0xf23af0,'message':await buildOwnProseNotificationMessage(_0x10d8f3[_0x5ac654(0x15d)],_0x10d8f3['state'],_0x10d8f3[_0x5ac654(0x183)])});_0x2f322a[_0x5ac654(0x136)]={'status':_0x5ac654(0x1e2),'attemptedAt':_0xbeb553,'queuedAt':new Date()[_0x5ac654(0x198)](),'runId':_0x568873[_0x5ac654(0x143)]};const _0x5e96ca=_0x2f322a[_0x5ac654(0x136)]['queuedAt']??new Date()[_0x5ac654(0x198)]();await appendTimeline(_0x10d8f3[_0x5ac654(0x15d)],{'at':_0x5e96ca,'type':_0x5ac654(0x1cc),'runId':_0x10d8f3['state']['runId'],'message':_0x5ac654(0x1e6)+_0xf23af0+'\x20as\x20agent\x20run\x20'+_0x568873[_0x5ac654(0x143)]});}catch(_0x54c5fc){const _0x11d708=_0x54c5fc instanceof Error?_0x54c5fc[_0x5ac654(0x17e)]:String(_0x54c5fc);_0x2f322a[_0x5ac654(0x136)]={'status':_0x5ac654(0x14f),'attemptedAt':_0xbeb553,'error':_0x11d708},await appendTimeline(_0x10d8f3['runDir'],{'at':new Date()[_0x5ac654(0x198)](),'type':'notification_failed','runId':_0x10d8f3[_0x5ac654(0x177)][_0x5ac654(0x143)],'message':_0x11d708});}await writeRunState(_0x10d8f3[_0x5ac654(0x15d)],_0x10d8f3[_0x5ac654(0x177)]),await writeResumeFile(_0x10d8f3[_0x5ac654(0x15d)],_0x10d8f3[_0x5ac654(0x177)],_0x10d8f3[_0x5ac654(0x183)]);}async function queueBackgroundSupervisorRun(_0x1425cf){const _0x3ba6ac=_0x85ffa7,_0x46556e=scopeAgentSessionKey(_0x1425cf[_0x3ba6ac(0x1d0)],_0x3ba6ac(0x16c)+_0x1425cf[_0x3ba6ac(0x143)]),_0x554219=await runOwnProseSubagent({'api':_0x1425cf[_0x3ba6ac(0x1db)],'sessionKey':_0x46556e,'agentId':_0x1425cf['agentId']?.[_0x3ba6ac(0x150)]()||undefined,'message':[_0x3ba6ac(0x1f3),_0x3ba6ac(0x218)+_0x1425cf[_0x3ba6ac(0x143)]+'\x22.',_0x3ba6ac(0x13f)+_0x1425cf[_0x3ba6ac(0x15d)]+'\x22.','Do\x20not\x20call\x20own_prose_start,\x20own_prose_drive,\x20or\x20own_prose_status.',_0x3ba6ac(0x13c)+NO_REPLY_TOKEN+'.']['join']('\x0a'),'extraSystemPrompt':['This\x20is\x20an\x20internal\x20own-prose\x20background\x20worker\x20request.',_0x3ba6ac(0x1f8),_0x3ba6ac(0x170),'Do\x20not\x20ask\x20follow-up\x20questions.',_0x3ba6ac(0x144),_0x3ba6ac(0x14b)+NO_REPLY_TOKEN+'.']['join']('\x0a'),'label':_0x3ba6ac(0x151)+_0x1425cf['runId']});return{'runId':_0x554219[_0x3ba6ac(0x143)],'sessionKey':_0x46556e,'carrier':_0x554219[_0x3ba6ac(0x18e)]};}function requestBackgroundSupervisorCleanupProcess(_0x22a052){const _0x16620c=_0x85ffa7;if(!_0x22a052[_0x16620c(0x1da)])return;const _0x2b927c=_0x22a052[_0x16620c(0x177)]['background']?.[_0x16620c(0x20b)]?.[_0x16620c(0x176)]?.[_0x16620c(0x150)]();if(!_0x2b927c||_0x22a052[_0x16620c(0x177)]['status']===_0x16620c(0x1f6))return;spawnOwnProseCleanupProcess(_0x22a052[_0x16620c(0x15d)]);}async function runOwnProseSubagent(_0xa34222){const _0x12fbbe=_0x85ffa7,_0x1c2b03=await queueAgentSessionRun({'sessionKey':_0xa34222[_0x12fbbe(0x176)],'message':_0xa34222[_0x12fbbe(0x17e)],..._0xa34222['agentId']?{'agentId':_0xa34222[_0x12fbbe(0x1d0)]}:{},..._0xa34222[_0x12fbbe(0x1f1)]?{'extraSystemPrompt':_0xa34222[_0x12fbbe(0x1f1)]}:{},..._0xa34222[_0x12fbbe(0x1df)]?{'label':_0xa34222[_0x12fbbe(0x1df)]}:{},..._0xa34222[_0x12fbbe(0x1e0)]?{'timeoutMs':_0xa34222[_0x12fbbe(0x1e0)]}:{},..._0xa34222[_0x12fbbe(0x1c0)]?{'idempotencyKey':_0xa34222['idempotencyKey']}:{},..._0xa34222[_0x12fbbe(0x21f)]!=null?{'deliver':_0xa34222['deliver']}:{},..._0xa34222['providerOverride']??_0xa34222[_0x12fbbe(0x1ba)]?{'provider':_0xa34222[_0x12fbbe(0x17b)]??_0xa34222[_0x12fbbe(0x1ba)]}:{},..._0xa34222[_0x12fbbe(0x1ac)]??_0xa34222[_0x12fbbe(0x1dc)]?{'model':_0xa34222[_0x12fbbe(0x1ac)]??_0xa34222[_0x12fbbe(0x1dc)]}:{}});return{'runId':_0x1c2b03[_0x12fbbe(0x143)],'carrier':'gateway_session'};}async function waitForOwnProseSubagentRun(_0x36d713){const _0x1bb28b=_0x85ffa7,_0x48bbd7=await waitForAgentSessionRun({'runId':_0x36d713[_0x1bb28b(0x143)],'timeoutMs':_0x36d713[_0x1bb28b(0x1e0)]});return{'status':_0x48bbd7['status']==='ok'||_0x48bbd7[_0x1bb28b(0x152)]==='error'||_0x48bbd7[_0x1bb28b(0x152)]===_0x1bb28b(0x19b)?_0x48bbd7[_0x1bb28b(0x152)]:'error',..._0x48bbd7['error']?{'error':_0x48bbd7['error']}:{}};}async function getOwnProseSubagentMessages(_0x2a4eb5){const _0x5d4052=_0x85ffa7;return getAgentSessionMessages({'sessionKey':_0x2a4eb5[_0x5d4052(0x176)],'limit':_0x2a4eb5['limit']});}function collectOwnProseSessionKeys(_0x549052,_0x21a31a){const _0x16a60a=_0x85ffa7,_0x40791b=new Set();for(const _0x5c0bd5 of Object[_0x16a60a(0x1c6)](_0x549052[_0x16a60a(0x187)])){const _0x221eb8=_0x5c0bd5['taskSessionKey']?.['trim']();_0x221eb8&&_0x40791b['add'](_0x221eb8);}if(_0x21a31a[_0x16a60a(0x1b5)]){const _0x38c890=_0x549052[_0x16a60a(0x190)]?.['supervisor']?.['sessionKey']?.[_0x16a60a(0x150)]();_0x38c890&&_0x40791b['add'](_0x38c890);}return[..._0x40791b];}async function buildOwnProseNotificationMessage(_0x526bac,_0x468519,_0x1eb86c){const _0x5cdac1=_0x85ffa7,_0x3b21a0=await readFinalOutputMaybe(_0x468519['finalOutputPath']);return[_0x5cdac1(0x21c),_0x5cdac1(0x222)+_0x468519[_0x5cdac1(0x143)],_0x5cdac1(0x18b)+_0x1eb86c['programName'],_0x5cdac1(0x16f)+_0x468519[_0x5cdac1(0x152)],_0x468519['currentNodeId']?_0x5cdac1(0x168)+_0x468519[_0x5cdac1(0x1d2)]:undefined,_0x468519[_0x5cdac1(0x158)]['length']>0x0?_0x5cdac1(0x1fd)+_0x468519[_0x5cdac1(0x158)][_0x5cdac1(0x189)](',\x20'):undefined,_0x468519[_0x5cdac1(0x164)]['length']>0x0?'Running\x20nodes:\x20'+_0x468519[_0x5cdac1(0x164)][_0x5cdac1(0x189)](',\x20'):undefined,_0x468519['failure']?'Failure:\x20'+_0x468519[_0x5cdac1(0x1c4)][_0x5cdac1(0x172)]:undefined,_0x3b21a0?'':undefined,_0x3b21a0?_0x5cdac1(0x1f7):undefined,_0x3b21a0]['filter'](_0x3ed8e9=>Boolean(_0x3ed8e9))['join']('\x0a');}async function readFinalOutputMaybe(_0x2996c4){const _0x5672a6=_0x85ffa7;if(!_0x2996c4)return undefined;const _0x1c5c63=await _0x35f044['readFile'](_0x2996c4,_0x5672a6(0x157))[_0x5672a6(0x188)](()=>''),_0x255bc0=_0x1c5c63[_0x5672a6(0x150)]();return _0x255bc0||undefined;}function summarizeText(_0x58cae6,_0x1a43fb=0xa0){const _0x5e0363=_0x85ffa7;return truncateText(_0x58cae6['replace'](/\s+/g,'\x20')[_0x5e0363(0x150)](),_0x1a43fb);}function truncateText(_0x20fd3f,_0x5b3e30){const _0x1d2ca7=_0x85ffa7;if(_0x20fd3f[_0x1d2ca7(0x1eb)]<=_0x5b3e30)return _0x20fd3f;return _0x20fd3f[_0x1d2ca7(0x19a)](0x0,_0x5b3e30-0x1)+'...';}function sanitizeId(_0x5837f2){const _0x28c9e4=_0x85ffa7;return _0x5837f2[_0x28c9e4(0x1ae)](/[^a-zA-Z0-9._-]+/g,'_');}function _0x3a51(){const _0x302ce6=['After\x20the\x20tool\x20succeeds\x20or\x20fails,\x20respond\x20with\x20exactly\x20','artifactPath','role','nodeMap','failed','trim','own-prose\x20supervisor\x20','status','Previous\x20completed\x20node\x20outputs:','You\x20are\x20executing\x20one\x20own-prose\x20judge\x20node.','endsWith','callerModel','utf8','readyNodeIds','Judge\x20instructions:','Failure:\x20','Completed\x20nodes:\x20','modelSource','runDir','requirements','Workflow\x20complete','dependencyMode','any','\x20-\x20','value','runningNodeIds','indexOf','gateway_only','5136078tyROQl','Current\x20node:\x20','programPath\x20required','Agent\x20instructions:','Supervisor:\x20','own-prose:supervisor:','object','all','Status:\x20','If\x20a\x20runDir\x20is\x20provided,\x20pass\x20it\x20through\x20exactly\x20as\x20given.','prompt','reason','instructions','supervisorCarrier','defaultValue','sessionKey','state','string','Node\x20goal:\x20','defaults','providerOverride','model','completed','message','get','completedAt','sessionId','decision','plan','meta','inputs','some','nodeStates','catch','join','originAgentId','Program:\x20','subagentCarrier','agent_default','carrier','key','background','node_completed','1263tiVjHM','Run\x20exceeded\x20max\x20steps\x20(','branch_decided','5530576aqsxsP','payloads','type','toISOString','agentDefaultProvider','slice','timeout','nested','Program\x20goal:\x20','None','provider','Steps\x20executed:\x20','run_failed','config','branches','defaultTimeoutMs','pending','Run\x20reached\x20a\x20deadlock\x20with\x20no\x20ready\x20nodes','allowedBranches','gateway_session','cleanupSessions','originSessionKey','supervisorSessionKey','modelOverride','content','replace','Embedded\x20node\x20run\x20returned\x20no\x20output','Judge\x20output\x20must\x20be\x20JSON\x20or\x20a\x20single\x20branch\x20token','Return\x20only\x20the\x20deliverable\x20for\x20this\x20node.\x20Do\x20not\x20explain\x20your\x20process.','5kNxenx','includes','readFile','includeSupervisor','\x20node\x20','nodes','required','own-prose\x20task\x20','inheritedProvider','Done\x20when:','Unable\x20to\x20locate\x20JSON\x20object\x20in\x20output','agents','source','Background:\x20','idempotencyKey','supervisorRunId','cwd','push','failure','defaultModel','values','Running\x20nodes:\x20','Skipped\x20because\x20the\x20workflow\x20completed\x20on\x20a\x20different\x20branch','maxSteps','agent','.jsonl','notification_sent','map','caller_session','waitTimeoutMs','agentId','runEmbeddedPiAgent','currentNodeId','own-prose:task:','startsWith','text','foreground_request','stringify','lastIndexOf','run_completed','enabled','api','inheritedModel','doneWhen','resolve','label','timeoutMs','primary','queued','runtime','deleteMode','Inputs\x20JSON:','Queued\x20background\x20notification\x20to\x20','normalize','pluginDefaultProvider','sourcePath','Final\x20output:\x20','length','nodeId','Started\x20','pendingNodeIds','contextFrom','workspaceDir','extraSystemPrompt','judge','Internal\x20own-prose\x20background\x20continuation\x20request.','artifacts','program','running','Final\x20output:','You\x20must\x20call\x20the\x20own_prose_background_run\x20tool\x20exactly\x20once\x20with\x20the\x20provided\x20runId.','completedNodeIds','filter','Allowed\x20branches:\x20','taskSessionKey','Ready\x20nodes:\x20','question','wave','1241912qUxzpm','runs','skipped','agentIds','allSettled','2600gGGgPV','You\x20are\x20executing\x20one\x20own-prose\x20task\x20node.','branchDecisions','dependsOn','goal','permissions','supervisor','startedAt','programPath','Final\x20output\x20contract:','exec','defaultProvider','fulfilled','sessions','pluginConfig','5643560yHVJDh','agent:','dirname','visitCount','Run\x20the\x20`own_prose_background_run`\x20tool\x20with\x20runId\x20\x22','callerProvider','every','plugin_default','own-prose\x20background\x20run\x20finished.','none','67859ezFbDG','deliver','callerModelSource','isAbsolute','Run\x20ID:\x20','node_started','outputContract','mkdir','subagentRunId','finish','title','Subagent\x20task\x20timed\x20out:\x20','isArray','Skipped\x20background\x20notification\x20because\x20no\x20origin\x20session\x20was\x20recorded','agentDefaultModel','summary','finalOutputPath','notification','has','Judge\x20output\x20is\x20missing\x20decision','subagent','node','9960444xUOJeF','After\x20the\x20tool\x20finishes,\x20reply\x20only\x20with\x20','messages','Run:\x20','Use\x20runDir\x20\x22','Node\x20title:\x20','error','finished','runId','Do\x20not\x20call\x20any\x20other\x20own-prose\x20tool.','Agent\x20role:','###\x20','stepsExecuted','isError','compile-preview','stateRoot'];_0x3a51=function(){return _0x302ce6;};return _0x3a51();}function extractEmbeddedRunOutputText(_0x297aac){const _0x2adcdc=_0x85ffa7;if(!Array[_0x2adcdc(0x131)](_0x297aac))return undefined;for(let _0x5de0a7=_0x297aac[_0x2adcdc(0x1eb)]-0x1;_0x5de0a7>=0x0;_0x5de0a7-=0x1){const _0x4c6e4c=_0x297aac[_0x5de0a7];if(_0x4c6e4c?.[_0x2adcdc(0x148)])continue;const _0xe7c2af=_0x4c6e4c?.[_0x2adcdc(0x1d5)]?.['trim']();if(_0xe7c2af)return _0xe7c2af;}return undefined;}function extractSubagentOutputText(_0x2be7cc){for(let _0x33b98f=_0x2be7cc['length']-0x1;_0x33b98f>=0x0;_0x33b98f-=0x1){const _0x33448e=extractAssistantText(_0x2be7cc[_0x33b98f]);if(_0x33448e)return _0x33448e;}throw new Error('Subagent\x20run\x20returned\x20no\x20assistant\x20output');}function extractAssistantText(_0x4767a5){const _0xa0c3cd=_0x85ffa7,_0xd35122=readRecordMaybe(_0x4767a5),_0x48a4f2=readRecordMaybe(_0xd35122?.[_0xa0c3cd(0x17e)])??_0xd35122;if(readStringMaybe(_0x48a4f2?.[_0xa0c3cd(0x14d)])!=='assistant')return undefined;const _0x754a12=_0x48a4f2?.[_0xa0c3cd(0x1ad)];if(typeof _0x754a12==='string'&&_0x754a12['trim']())return _0x754a12['trim']();if(!Array['isArray'](_0x754a12))return undefined;const _0x5e3d54=_0x754a12[_0xa0c3cd(0x1cd)](_0x56ab13=>{const _0x5ba542=_0xa0c3cd,_0x5a90dc=readRecordMaybe(_0x56ab13);if(typeof _0x5a90dc?.[_0x5ba542(0x1d5)]===_0x5ba542(0x178)&&_0x5a90dc[_0x5ba542(0x1d5)]['trim']())return _0x5a90dc['text'][_0x5ba542(0x150)]();return undefined;})[_0xa0c3cd(0x1fa)](_0x1e4747=>Boolean(_0x1e4747));return _0x5e3d54[_0xa0c3cd(0x1eb)]>0x0?_0x5e3d54[_0xa0c3cd(0x189)]('\x0a')[_0xa0c3cd(0x150)]():undefined;}function extractJsonObject(_0x260fc6){const _0x3af986=_0x85ffa7,_0x463ef3=_0x260fc6['trim']();if(_0x463ef3[_0x3af986(0x1d4)]('{')&&_0x463ef3[_0x3af986(0x155)]('}'))return _0x463ef3;const _0x3b4c40=/```(?:json)?\s*([\s\S]*?)```/i[_0x3af986(0x20f)](_0x463ef3);if(_0x3b4c40?.[0x1]?.[_0x3af986(0x150)]())return _0x3b4c40[0x1][_0x3af986(0x150)]();const _0x2a68c4=_0x463ef3[_0x3af986(0x165)]('{'),_0x157af6=_0x463ef3[_0x3af986(0x1d8)]('}');if(_0x2a68c4>=0x0&&_0x157af6>_0x2a68c4)return _0x463ef3['slice'](_0x2a68c4,_0x157af6+0x1);throw new Error(_0x3af986(0x1bc));}function readRecordMaybe(_0x24abc5){const _0x105d58=_0x85ffa7;return _0x24abc5&&typeof _0x24abc5===_0x105d58(0x16d)&&!Array[_0x105d58(0x131)](_0x24abc5)?_0x24abc5:undefined;}function readStringMaybe(_0x48f281){const _0x18d312=_0x85ffa7;return typeof _0x48f281==='string'&&_0x48f281[_0x18d312(0x150)]()?_0x48f281[_0x18d312(0x150)]():undefined;}
|
|
1
|
+
const _0x56e193=_0x195e;(function(_0x28b9bf,_0x24010d){const _0x282ceb=_0x195e,_0xfdc105=_0x28b9bf();while(!![]){try{const _0xa696bd=parseInt(_0x282ceb(0x187))/0x1*(parseInt(_0x282ceb(0x154))/0x2)+-parseInt(_0x282ceb(0xfe))/0x3*(parseInt(_0x282ceb(0x156))/0x4)+-parseInt(_0x282ceb(0x106))/0x5*(-parseInt(_0x282ceb(0x119))/0x6)+parseInt(_0x282ceb(0x140))/0x7+parseInt(_0x282ceb(0x16c))/0x8*(parseInt(_0x282ceb(0x151))/0x9)+-parseInt(_0x282ceb(0x1ac))/0xa*(-parseInt(_0x282ceb(0x10d))/0xb)+-parseInt(_0x282ceb(0x141))/0xc*(parseInt(_0x282ceb(0x1d9))/0xd);if(_0xa696bd===_0x24010d)break;else _0xfdc105['push'](_0xfdc105['shift']());}catch(_0x28b1da){_0xfdc105['push'](_0xfdc105['shift']());}}}(_0x43ad,0x7ad10));import{existsSync}from'node:fs';import _0x56f899 from'node:fs/promises';import _0x409588 from'node:path';import{spawnOwnProseCleanupProcess}from'./background-cleanup-launcher.js';import{deleteAgentSession,getAgentSessionMessages,hasAgentSession,notifyAgentSession,queueAgentSessionRun,waitForAgentSessionRun}from'./agent-notify.js';import{loadAgents}from'./agent-parser.js';import{resolveOwnProseConfig}from'./config.js';import{compilePlan}from'./plan-compiler.js';import{validateCompiledPlan}from'./plan-validator.js';import{parseProgramFile}from'./program-parser.js';import{appendTimeline,createRunId,ensureRunDirectories,getRunDir,initializeRunState,readCompiledPlan,readRunState,writeArtifact,writeProgramSource,writeResumeFile,writeRunState}from'./state-store.js';const NO_REPLY_TOKEN=_0x56e193(0xf6),OWN_PROSE_EMBEDDED_LANE='nested',SESSION_CLEANUP_RECHECK_DELAYS_MS=[0x32,0x64,0xc8],BACKGROUND_STATE_SETTLE_RETRY_DELAY_MS=0xc8,BACKGROUND_STATE_SETTLE_RETRY_COUNT=0x19,MAX_PARALLEL_TASKS=0x3;function scopeAgentSessionKey(_0x3d9ea1,_0x5095f4){const _0x4a0812=_0x56e193,_0x515ac5=_0x3d9ea1?.['trim']();if(!_0x515ac5||_0x5095f4[_0x4a0812(0x186)]('agent:'))return _0x5095f4;return'agent:'+_0x515ac5+':'+_0x5095f4;}export async function driveOwnProseProgram(_0x4956b9){const _0x39b52b=_0x56e193,_0x52ee7d=await loadProgramBundle(_0x4956b9[_0x39b52b(0x15d)],_0x4956b9[_0x39b52b(0x16d)]),_0x2bdf2a=resolveOwnProseConfig(_0x4956b9[_0x39b52b(0x16d)],_0x4956b9[_0x39b52b(0x133)][_0x39b52b(0x171)]),_0x2b8dc6=resolveRunRuntimeDefaults({'pluginDefaultProvider':_0x2bdf2a[_0x39b52b(0x1f8)],'pluginDefaultModel':_0x2bdf2a['defaultModel']});await _0x56f899[_0x39b52b(0x167)](_0x409588['join'](_0x2bdf2a['stateRoot'],_0x39b52b(0x111)),{'recursive':!![]});const _0x3b978f=createRunId(),_0x3da30a=getRunDir(_0x2bdf2a[_0x39b52b(0x126)],_0x3b978f);await ensureRunDirectories(_0x3da30a);const _0x2ac7bb=await _0x56f899[_0x39b52b(0x10c)](_0x52ee7d[_0x39b52b(0x13c)][_0x39b52b(0x188)],_0x39b52b(0x1e3));await writeProgramSource(_0x3da30a,_0x2ac7bb);const _0x3c25d1=await compilePlan({'api':_0x4956b9[_0x39b52b(0x133)],'workspaceDir':_0x4956b9['workspaceDir'],'runDir':_0x3da30a,'program':_0x52ee7d[_0x39b52b(0x13c)],'agents':_0x52ee7d[_0x39b52b(0x193)],'provider':_0x2b8dc6[_0x39b52b(0x1a1)],'model':_0x2b8dc6['model'],'timeoutMs':_0x2bdf2a[_0x39b52b(0xed)]});validateCompiledPlan(_0x3c25d1,_0x52ee7d[_0x39b52b(0x13c)],_0x52ee7d[_0x39b52b(0x193)]);const _0x2c8539=resolveProgramInputs(_0x52ee7d[_0x39b52b(0x13c)],_0x4956b9['inputs']??{}),_0x2dc069=await initializeRunState({'runDir':_0x3da30a,'runId':_0x3b978f,'program':_0x52ee7d[_0x39b52b(0x13c)],'inputs':_0x2c8539,'plan':_0x3c25d1,'runtime':{'cwd':_0x4956b9['workspaceDir'],'provider':_0x2b8dc6[_0x39b52b(0x1a1)],'model':_0x2b8dc6['model'],'modelSource':_0x2b8dc6[_0x39b52b(0x177)],'sessionKey':_0x4956b9[_0x39b52b(0x164)],'agentId':_0x4956b9[_0x39b52b(0x1ba)],'supervisorSessionKey':_0x4956b9[_0x39b52b(0x164)],'supervisorAgentId':_0x4956b9[_0x39b52b(0x1ba)],'supervisorCarrier':_0x39b52b(0xee)}}),_0xda58a2=await executePlan({'api':_0x4956b9[_0x39b52b(0x133)],'workspaceDir':_0x4956b9['workspaceDir'],'runDir':_0x3da30a,'state':_0x2dc069,'program':_0x52ee7d['program'],'plan':_0x3c25d1,'agents':_0x52ee7d['agents'],'inputs':_0x2c8539,'defaultProvider':_0x2b8dc6['provider'],'defaultModel':_0x2b8dc6[_0x39b52b(0x136)],'defaultTimeoutMs':_0x2bdf2a['timeoutMs'],'cleanupSessions':_0x2bdf2a['cleanupSessions']});return{'runId':_0x3b978f,'runDir':_0x3da30a,'state':_0xda58a2,'plan':_0x3c25d1};}export async function startOwnProseProgram(_0x1624ec){const _0x1738ec=_0x56e193,_0x4eb75d=await loadProgramBundle(_0x1624ec[_0x1738ec(0x15d)],_0x1624ec[_0x1738ec(0x16d)]),_0x58ee5e=resolveOwnProseConfig(_0x1624ec[_0x1738ec(0x16d)],_0x1624ec[_0x1738ec(0x133)]['pluginConfig']),_0x413d2d=resolveRunRuntimeDefaults({'pluginDefaultProvider':_0x58ee5e[_0x1738ec(0x1f8)],'pluginDefaultModel':_0x58ee5e[_0x1738ec(0x18b)]});await _0x56f899[_0x1738ec(0x167)](_0x409588[_0x1738ec(0x165)](_0x58ee5e[_0x1738ec(0x126)],'runs'),{'recursive':!![]});const _0x753c92=createRunId(),_0x419ad0=getRunDir(_0x58ee5e[_0x1738ec(0x126)],_0x753c92);await ensureRunDirectories(_0x419ad0);const _0xed9bf=await _0x56f899[_0x1738ec(0x10c)](_0x4eb75d['program']['sourcePath'],_0x1738ec(0x1e3));await writeProgramSource(_0x419ad0,_0xed9bf);const _0x5dc91c=await compilePlan({'api':_0x1624ec[_0x1738ec(0x133)],'workspaceDir':_0x1624ec['workspaceDir'],'runDir':_0x419ad0,'program':_0x4eb75d[_0x1738ec(0x13c)],'agents':_0x4eb75d[_0x1738ec(0x193)],'provider':_0x413d2d[_0x1738ec(0x1a1)],'model':_0x413d2d[_0x1738ec(0x136)],'timeoutMs':_0x58ee5e[_0x1738ec(0xed)]});validateCompiledPlan(_0x5dc91c,_0x4eb75d[_0x1738ec(0x13c)],_0x4eb75d[_0x1738ec(0x193)]);const _0x385de3=resolveProgramInputs(_0x4eb75d[_0x1738ec(0x13c)],_0x1624ec[_0x1738ec(0x1c8)]??{}),_0x1a9814=await initializeRunState({'runDir':_0x419ad0,'runId':_0x753c92,'program':_0x4eb75d[_0x1738ec(0x13c)],'inputs':_0x385de3,'plan':_0x5dc91c,'runtime':{'cwd':_0x1624ec[_0x1738ec(0x16d)],'provider':_0x413d2d[_0x1738ec(0x1a1)],'model':_0x413d2d[_0x1738ec(0x136)],'modelSource':_0x413d2d[_0x1738ec(0x177)],'sessionKey':_0x1624ec[_0x1738ec(0x164)],'agentId':_0x1624ec['agentId'],'supervisorAgentId':_0x1624ec[_0x1738ec(0x1ba)]}});_0x1a9814[_0x1738ec(0x1d7)]={'mode':_0x1738ec(0x1d7),'status':'queued','startedAt':new Date()[_0x1738ec(0x17b)](),'originSessionKey':_0x1624ec[_0x1738ec(0x164)],'originAgentId':_0x1624ec[_0x1738ec(0x1ba)]};if(!_0x1624ec[_0x1738ec(0x164)]?.[_0x1738ec(0x1f2)]()&&!_0x1624ec[_0x1738ec(0x1ba)]?.[_0x1738ec(0x1f2)]())return await writeRunState(_0x419ad0,_0x1a9814),await writeResumeFile(_0x419ad0,_0x1a9814,_0x5dc91c),{'runId':_0x753c92,'runDir':_0x419ad0,'state':_0x1a9814,'plan':_0x5dc91c,'alreadyRunning':![]};const _0x2aa385=await queueBackgroundSupervisorRun({'api':_0x1624ec[_0x1738ec(0x133)],'agentId':_0x1624ec['agentId'],'runId':_0x753c92,'runDir':_0x419ad0});return _0x1a9814[_0x1738ec(0xf2)][_0x1738ec(0x1f7)]=_0x2aa385[_0x1738ec(0x164)],_0x1a9814['runtime']['supervisorCarrier']=_0x2aa385[_0x1738ec(0x1e6)],_0x1a9814[_0x1738ec(0x1d7)]['supervisor']={'status':'queued','queuedAt':new Date()[_0x1738ec(0x17b)](),'sessionKey':_0x2aa385[_0x1738ec(0x164)],'runId':_0x2aa385[_0x1738ec(0x143)]},await writeRunState(_0x419ad0,_0x1a9814),await writeResumeFile(_0x419ad0,_0x1a9814,_0x5dc91c),startBackgroundSupervisorMonitor({'api':_0x1624ec[_0x1738ec(0x133)],'runDir':_0x419ad0,'plan':_0x5dc91c,'cleanupSessions':_0x58ee5e[_0x1738ec(0x11f)],'supervisorRunId':_0x2aa385[_0x1738ec(0x143)],'supervisorSessionKey':_0x2aa385[_0x1738ec(0x164)],'waitTimeoutMs':_0x58ee5e[_0x1738ec(0xed)]}),{'runId':_0x753c92,'runDir':_0x419ad0,'state':_0x1a9814,'plan':_0x5dc91c,'alreadyRunning':![]};}export async function resumeOwnProseBackgroundRun(_0x340c38){const _0x4e42e7=_0x56e193,{runDir:_0x2e2aa3,state:_0x31ff87,plan:_0x49c41c}=await loadOwnProseRunState(_0x340c38[_0x4e42e7(0x16d)],_0x340c38['api']['pluginConfig'],_0x340c38[_0x4e42e7(0x143)],{'runDir':_0x340c38[_0x4e42e7(0x1c2)]});if(_0x31ff87[_0x4e42e7(0x144)]!==_0x4e42e7(0x108))return{'runId':_0x31ff87[_0x4e42e7(0x143)],'runDir':_0x2e2aa3,'state':_0x31ff87,'plan':_0x49c41c};const _0x37b886=await loadProgramBundle(_0x31ff87[_0x4e42e7(0x15d)]),_0x123c78=_0x31ff87[_0x4e42e7(0xf2)][_0x4e42e7(0x1b9)]?.[_0x4e42e7(0x1f2)]()||_0x340c38[_0x4e42e7(0x16d)],_0x1c01f9=resolveOwnProseConfig(_0x123c78,_0x340c38[_0x4e42e7(0x133)][_0x4e42e7(0x171)]);recoverInterruptedRunningNodes(_0x31ff87,_0x49c41c)&&(await writeRunState(_0x2e2aa3,_0x31ff87),await writeResumeFile(_0x2e2aa3,_0x31ff87,_0x49c41c));const _0xfbf24=resolveRunRuntimeDefaults({'pluginDefaultProvider':_0x1c01f9['defaultProvider'],'pluginDefaultModel':_0x1c01f9['defaultModel']}),_0x590f81=await runInBackground({'api':_0x340c38['api'],'workspaceDir':_0x123c78,'runDir':_0x2e2aa3,'state':_0x31ff87,'program':_0x37b886[_0x4e42e7(0x13c)],'plan':_0x49c41c,'agents':_0x37b886[_0x4e42e7(0x193)],'inputs':_0x31ff87[_0x4e42e7(0x1c8)],'defaultProvider':_0x31ff87[_0x4e42e7(0xf2)][_0x4e42e7(0x1a1)]??_0xfbf24[_0x4e42e7(0x1a1)],'defaultModel':_0x31ff87[_0x4e42e7(0xf2)][_0x4e42e7(0x136)]??_0xfbf24[_0x4e42e7(0x136)],'defaultTimeoutMs':_0x1c01f9['timeoutMs'],'cleanupSessions':_0x1c01f9[_0x4e42e7(0x11f)]});return{'runId':_0x31ff87[_0x4e42e7(0x143)],'runDir':_0x2e2aa3,'state':_0x590f81,'plan':_0x49c41c};}export async function replyOwnProseRun(_0x28301d){const _0x599aef=_0x56e193,_0x709e42=_0x28301d['answer'][_0x599aef(0x1f2)]();if(!_0x709e42)throw new Error('answer\x20required');const {runDir:_0x41b1a5,state:_0x30c22a,plan:_0x6c1755}=await loadOwnProseRunState(_0x28301d[_0x599aef(0x16d)],_0x28301d[_0x599aef(0x133)]['pluginConfig'],_0x28301d[_0x599aef(0x143)],{'runDir':_0x28301d[_0x599aef(0x1c2)]});if(_0x30c22a[_0x599aef(0x144)]!=='blocked'||!_0x30c22a['pendingInput'])throw new Error(_0x599aef(0x198)+_0x28301d[_0x599aef(0x143)]+'\x22\x20is\x20not\x20waiting\x20for\x20reply\x20input');const _0x335b80=await loadProgramBundle(_0x30c22a[_0x599aef(0x15d)]),_0x456412=_0x30c22a[_0x599aef(0xf2)][_0x599aef(0x1b9)]?.[_0x599aef(0x1f2)]()||_0x28301d[_0x599aef(0x16d)],_0x345ef1=resolveOwnProseConfig(_0x456412,_0x28301d[_0x599aef(0x133)]['pluginConfig']),_0x237204=resolveRunRuntimeDefaults({'pluginDefaultProvider':_0x345ef1[_0x599aef(0x1f8)],'pluginDefaultModel':_0x345ef1['defaultModel']}),_0x191dbc=await resumeRunFromReply({'api':_0x28301d[_0x599aef(0x133)],'workspaceDir':_0x456412,'runDir':_0x41b1a5,'state':_0x30c22a,'program':_0x335b80[_0x599aef(0x13c)],'plan':_0x6c1755,'agents':_0x335b80[_0x599aef(0x193)],'answer':_0x709e42,'defaultProvider':_0x30c22a[_0x599aef(0xf2)][_0x599aef(0x1a1)]??_0x237204[_0x599aef(0x1a1)],'defaultModel':_0x30c22a[_0x599aef(0xf2)]['model']??_0x237204[_0x599aef(0x136)],'defaultTimeoutMs':_0x345ef1[_0x599aef(0xed)],'cleanupSessions':_0x345ef1[_0x599aef(0x11f)]});return{'runId':_0x30c22a[_0x599aef(0x143)],'runDir':_0x41b1a5,'state':_0x191dbc,'plan':_0x6c1755};}export async function waitForOwnProseBackgroundRun(_0x2dcd49,_0x5627d1){const _0x54bdbd=_0x56e193;return loadOwnProseRunState(_0x5627d1['workspaceDir'],_0x5627d1[_0x54bdbd(0x171)],_0x2dcd49);}export async function compileOwnProseProgram(_0x38fa66){const _0x47e8b0=_0x56e193,_0x38d45b=await loadProgramBundle(_0x38fa66[_0x47e8b0(0x15d)],_0x38fa66[_0x47e8b0(0x16d)]),_0x5b136d=resolveOwnProseConfig(_0x38fa66[_0x47e8b0(0x16d)],_0x38fa66['api'][_0x47e8b0(0x171)]),_0x5002e0=resolveRunRuntimeDefaults({'pluginDefaultProvider':_0x5b136d[_0x47e8b0(0x1f8)],'pluginDefaultModel':_0x5b136d[_0x47e8b0(0x18b)]}),_0x4065ab=_0x409588[_0x47e8b0(0x165)](_0x5b136d[_0x47e8b0(0x126)],'compile-preview');await ensureRunDirectories(_0x4065ab);const _0x27359d=await compilePlan({'api':_0x38fa66[_0x47e8b0(0x133)],'workspaceDir':_0x38fa66['workspaceDir'],'runDir':_0x4065ab,'program':_0x38d45b[_0x47e8b0(0x13c)],'agents':_0x38d45b[_0x47e8b0(0x193)],'provider':_0x5002e0[_0x47e8b0(0x1a1)],'model':_0x5002e0[_0x47e8b0(0x136)],'timeoutMs':_0x5b136d[_0x47e8b0(0xed)]});return validateCompiledPlan(_0x27359d,_0x38d45b[_0x47e8b0(0x13c)],_0x38d45b[_0x47e8b0(0x193)]),{'program':_0x38d45b['program'],'agents':_0x38d45b[_0x47e8b0(0x193)],'plan':_0x27359d};}export async function inspectOwnProseProgramFile(_0x1ea582){return loadProgramBundle(_0x1ea582);}function resolveRunRuntimeDefaults(_0x40a442){const _0x3667bd=_0x56e193;if(_0x40a442['pluginDefaultProvider']||_0x40a442[_0x3667bd(0x1c5)])return{'provider':_0x40a442[_0x3667bd(0x173)],'model':_0x40a442['pluginDefaultModel'],'source':_0x3667bd(0x17e)};return{};}export async function loadOwnProseRunState(_0xeb3091,_0x57ac41,_0x3c343c,_0x5c6c83){const _0x139537=_0x56e193,_0x5aa1ef=resolveOwnProseConfig(_0xeb3091,_0x57ac41),_0x4b2ae9=_0x5c6c83?.[_0x139537(0x1c2)]?.[_0x139537(0x1f2)]()?_0x409588[_0x139537(0x13d)](_0x5c6c83['runDir']):getRunDir(_0x5aa1ef[_0x139537(0x126)],_0x3c343c),_0x9adcab=await readRunState(_0x4b2ae9),_0x4490e5=await readCompiledPlan(_0x4b2ae9);return{'runDir':_0x4b2ae9,'state':_0x9adcab,'plan':_0x4490e5};}export function resolveOwnProseProgramPath(_0x14a44b,_0x1d8e7f){const _0x21e4d1=_0x56e193;if(!_0x1d8e7f?.[_0x21e4d1(0x1f2)]())return undefined;const _0x3f614c=_0x1d8e7f[_0x21e4d1(0x1f2)]();if(_0x409588[_0x21e4d1(0x1b7)](_0x3f614c))return _0x409588[_0x21e4d1(0xff)](_0x3f614c);const _0x3ca021=_0x14a44b[_0x21e4d1(0x1f2)]()?_0x409588[_0x21e4d1(0x13d)](_0x14a44b,_0x3f614c):undefined;if(_0x3ca021&&existsSync(_0x3ca021))return _0x3ca021;return _0x409588[_0x21e4d1(0x13d)](_0x3f614c);}export function renderOwnProseStatus(_0xd7384){const _0x2ca3bf=_0x56e193,_0x3c3a72=[_0x2ca3bf(0x157)+_0xd7384[_0x2ca3bf(0x143)],_0x2ca3bf(0x1ea)+_0xd7384[_0x2ca3bf(0x144)],_0xd7384['background']?'Background:\x20'+_0xd7384[_0x2ca3bf(0x1d7)][_0x2ca3bf(0x144)]:undefined,_0xd7384[_0x2ca3bf(0x1d7)]?.[_0x2ca3bf(0x1f1)]?_0x2ca3bf(0xe6)+_0xd7384[_0x2ca3bf(0x1d7)][_0x2ca3bf(0x1f1)]['status']+(_0xd7384['background'][_0x2ca3bf(0x1f1)][_0x2ca3bf(0x164)]?'\x20('+_0xd7384[_0x2ca3bf(0x1d7)][_0x2ca3bf(0x1f1)][_0x2ca3bf(0x164)]+')':''):undefined,_0xd7384[_0x2ca3bf(0x1d7)]?.[_0x2ca3bf(0x1d8)]?'Notification:\x20'+_0xd7384['background'][_0x2ca3bf(0x1d8)][_0x2ca3bf(0x144)]:undefined,_0xd7384[_0x2ca3bf(0x1b1)]?_0x2ca3bf(0x10f)+_0xd7384[_0x2ca3bf(0x1b1)][_0x2ca3bf(0x1a7)]+_0x2ca3bf(0x145)+_0xd7384['pendingInput'][_0x2ca3bf(0x1f3)]:undefined,_0x2ca3bf(0x1cb)+(_0xd7384[_0x2ca3bf(0x147)]??_0x2ca3bf(0x197)),_0x2ca3bf(0xea)+(_0xd7384[_0x2ca3bf(0x155)][_0x2ca3bf(0x1c4)]>0x0?_0xd7384[_0x2ca3bf(0x155)][_0x2ca3bf(0x165)](',\x20'):_0x2ca3bf(0x197)),_0x2ca3bf(0x104)+(_0xd7384['runningNodeIds'][_0x2ca3bf(0x1c4)]>0x0?_0xd7384['runningNodeIds'][_0x2ca3bf(0x165)](',\x20'):_0x2ca3bf(0x197)),_0x2ca3bf(0x1e5)+(_0xd7384[_0x2ca3bf(0x1a6)]['length']>0x0?_0xd7384[_0x2ca3bf(0x1a6)][_0x2ca3bf(0x165)](',\x20'):'none'),_0x2ca3bf(0x1be)+_0xd7384[_0x2ca3bf(0x1ce)]+'/'+_0xd7384[_0x2ca3bf(0x120)],_0xd7384[_0x2ca3bf(0x175)]?'Final\x20output:\x20'+_0xd7384['finalOutputPath']:undefined,_0xd7384['failure']?_0x2ca3bf(0xfc)+_0xd7384[_0x2ca3bf(0xe7)][_0x2ca3bf(0x178)]:undefined,_0xd7384[_0x2ca3bf(0x1b1)]?_0x2ca3bf(0x15e)+_0xd7384['pendingInput'][_0x2ca3bf(0x153)]:undefined,'',_0x2ca3bf(0x161),...Object[_0x2ca3bf(0x180)](_0xd7384[_0x2ca3bf(0x15c)])[_0x2ca3bf(0x184)](_0x398b58=>{const _0x31be41=_0x2ca3bf,_0x32591a=[_0x398b58['subagentCarrier']?'['+_0x398b58[_0x31be41(0x135)]+']':undefined,_0x398b58[_0x31be41(0x100)]]['filter'](_0x589d56=>Boolean(_0x589d56));return'-\x20'+_0x398b58[_0x31be41(0x1a7)]+':\x20'+_0x398b58[_0x31be41(0x144)]+(_0x32591a['length']>0x0?_0x31be41(0x17f)+_0x32591a['join']('\x20'):'');})];return _0x3c3a72[_0x2ca3bf(0x12f)](_0x31ac05=>Boolean(_0x31ac05))[_0x2ca3bf(0x165)]('\x0a');}async function loadProgramBundle(_0x39fbab,_0x1c12bb){const _0x5bec40=_0x56e193,_0x36d4c3=resolveOwnProseProgramPath(_0x1c12bb??process[_0x5bec40(0x1b9)](),_0x39fbab);if(!_0x36d4c3)throw new Error(_0x5bec40(0xeb));const _0x31c9a8=await parseProgramFile(_0x36d4c3),_0xdfc64d=await loadAgents(_0x31c9a8[_0x5bec40(0x179)],_0x409588[_0x5bec40(0xf8)](_0x36d4c3));return{'program':_0x31c9a8,'agents':_0xdfc64d};}function resolveProgramInputs(_0x46825f,_0x3c0ee3){const _0x2c90d7=_0x56e193,_0x2634fd={..._0x3c0ee3};for(const _0xb9dc2f of _0x46825f[_0x2c90d7(0x1c8)]){_0x2634fd[_0xb9dc2f[_0x2c90d7(0x170)]]==null&&_0xb9dc2f[_0x2c90d7(0x1bc)]!=null&&(_0x2634fd[_0xb9dc2f[_0x2c90d7(0x170)]]=_0xb9dc2f[_0x2c90d7(0x1bc)]);if(_0xb9dc2f['required']&&_0x2634fd[_0xb9dc2f[_0x2c90d7(0x170)]]==null)throw new Error(_0x2c90d7(0x109)+_0xb9dc2f[_0x2c90d7(0x170)]+'\x22');}return _0x2634fd;}async function executePlan(_0x346228){const _0x4cab00=_0x56e193,_0x5e7e2c=new Map(_0x346228[_0x4cab00(0x19b)][_0x4cab00(0xe5)]['map'](_0x40dee7=>[_0x40dee7['id'],_0x40dee7]));let _0x189df3=0x0;syncSchedulerState(_0x346228[_0x4cab00(0x1d2)],_0x346228[_0x4cab00(0x19b)]);while(_0x346228[_0x4cab00(0x1d2)]['status']===_0x4cab00(0x108)){if(_0x346228['state'][_0x4cab00(0x1ce)]>=_0x346228['state'][_0x4cab00(0x120)]){await failRun(_0x346228[_0x4cab00(0x1c2)],_0x346228[_0x4cab00(0x1d2)],_0x346228[_0x4cab00(0x19b)],{'reason':_0x4cab00(0x146)+_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x120)]+')'});break;}const _0x3322ab=getReadyNodesInPlanOrder(_0x346228[_0x4cab00(0x19b)],_0x346228[_0x4cab00(0x1d2)]);_0x346228['state'][_0x4cab00(0x155)]=_0x3322ab[_0x4cab00(0x184)](_0x9aed11=>_0x9aed11['id']),_0x346228['state']['currentNodeId']=_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x18e)][0x0]??_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x155)][0x0]??null;if(_0x3322ab[_0x4cab00(0x1c4)]===0x0){if(_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x18e)][_0x4cab00(0x1c4)]>0x0)continue;if(_0x346228[_0x4cab00(0x1d2)]['completedNodeIds'][_0x4cab00(0x1df)](_0x1d1ade=>_0x5e7e2c[_0x4cab00(0x148)](_0x1d1ade)?.[_0x4cab00(0x163)]===_0x4cab00(0x181))){_0x346228['state'][_0x4cab00(0x144)]='completed',_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x147)]=null,markPendingNodesSkipped(_0x346228['state'],_0x346228[_0x4cab00(0x19b)]),await appendTimeline(_0x346228[_0x4cab00(0x1c2)],{'at':new Date()[_0x4cab00(0x17b)](),'type':_0x4cab00(0x1aa),'runId':_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x143)],'message':_0x4cab00(0x15f)}),await writeRunState(_0x346228['runDir'],_0x346228[_0x4cab00(0x1d2)]),await writeResumeFile(_0x346228[_0x4cab00(0x1c2)],_0x346228[_0x4cab00(0x1d2)],_0x346228[_0x4cab00(0x19b)]);break;}await failRun(_0x346228[_0x4cab00(0x1c2)],_0x346228['state'],_0x346228[_0x4cab00(0x19b)],{'nodeId':_0x346228['state'][_0x4cab00(0x147)]??undefined,'reason':_0x4cab00(0x1d3)});break;}const _0x3ab6a5=selectExecutionBatch(_0x3322ab);_0x189df3+=0x1;for(const _0x260dd7 of _0x3ab6a5){if(_0x260dd7[_0x4cab00(0x163)]===_0x4cab00(0x181))return _0x346228['state']['pendingNodeIds']=_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0xf7)][_0x4cab00(0x12f)](_0x4063e4=>_0x4063e4!==_0x260dd7['id']),_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x1a6)]=pushUnique(_0x346228['state']['completedNodeIds'],_0x260dd7['id']),_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x144)]=_0x4cab00(0xfa),_0x346228[_0x4cab00(0x1d2)]['currentNodeId']=null,markPendingNodesSkipped(_0x346228[_0x4cab00(0x1d2)],_0x346228[_0x4cab00(0x19b)]),await appendTimeline(_0x346228[_0x4cab00(0x1c2)],{'at':new Date()[_0x4cab00(0x17b)](),'type':'run_completed','runId':_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x143)],'message':_0x4cab00(0x15f)}),await writeRunState(_0x346228[_0x4cab00(0x1c2)],_0x346228[_0x4cab00(0x1d2)]),await writeResumeFile(_0x346228[_0x4cab00(0x1c2)],_0x346228['state'],_0x346228[_0x4cab00(0x19b)]),_0x346228[_0x4cab00(0x1d2)];const _0x58bc28=startNodeRecord({'state':_0x346228[_0x4cab00(0x1d2)],'node':_0x260dd7,'wave':_0x189df3});_0x346228['state'][_0x4cab00(0xf7)]=_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0xf7)][_0x4cab00(0x12f)](_0xdb520d=>_0xdb520d!==_0x260dd7['id']),_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x18e)]=pushUnique(_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x18e)],_0x260dd7['id']),await appendTimeline(_0x346228[_0x4cab00(0x1c2)],{'at':_0x58bc28['startedAt'],'type':_0x4cab00(0x158),'runId':_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x143)],'nodeId':_0x260dd7['id'],'message':_0x4cab00(0x182)+_0x260dd7[_0x4cab00(0x163)]+_0x4cab00(0x1b0)+_0x260dd7['id']});}_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x155)]=_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x155)][_0x4cab00(0x12f)](_0x2dd1e8=>!_0x3ab6a5[_0x4cab00(0x1df)](_0xb640b6=>_0xb640b6['id']===_0x2dd1e8)),_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x147)]=_0x346228['state'][_0x4cab00(0x18e)][0x0]??_0x346228[_0x4cab00(0x1d2)]['readyNodeIds'][0x0]??null,await writeRunState(_0x346228['runDir'],_0x346228['state']),await writeResumeFile(_0x346228['runDir'],_0x346228[_0x4cab00(0x1d2)],_0x346228[_0x4cab00(0x19b)]);try{if(_0x3ab6a5[_0x4cab00(0x1c4)]===0x1&&_0x3ab6a5[0x0]?.[_0x4cab00(0x163)]===_0x4cab00(0x1a0)){const _0x5a5e76=_0x3ab6a5[0x0],_0x59f35e=_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x15c)][_0x5a5e76['id']],_0x552c5d=await executeJudgeNode({'api':_0x346228[_0x4cab00(0x133)],'workspaceDir':_0x346228[_0x4cab00(0x16d)],'runDir':_0x346228['runDir'],'state':_0x346228['state'],'program':_0x346228['program'],'plan':_0x346228[_0x4cab00(0x19b)],'node':_0x5a5e76,'agent':_0x346228[_0x4cab00(0x193)][_0x5a5e76['agentId']],'inputs':_0x346228[_0x4cab00(0x1c8)],'defaultProvider':_0x346228[_0x4cab00(0x1f8)],'defaultModel':_0x346228['defaultModel'],'defaultTimeoutMs':_0x346228[_0x4cab00(0x16a)]});if(!_0x5a5e76['allowedBranches'][_0x4cab00(0x1b5)](_0x552c5d[_0x4cab00(0x101)]))throw new Error('Judge\x20node\x20\x22'+_0x5a5e76['id']+_0x4cab00(0x121)+_0x552c5d[_0x4cab00(0x101)]+'\x22');const _0x3211c9=_0x5a5e76[_0x4cab00(0x1a8)][_0x552c5d['decision']];_0x59f35e[_0x4cab00(0x144)]=_0x4cab00(0xfa),_0x59f35e[_0x4cab00(0x1cc)]=new Date()['toISOString'](),_0x59f35e['summary']=''+_0x552c5d[_0x4cab00(0x101)]+(_0x552c5d['reason']?_0x4cab00(0x17f)+_0x552c5d['reason']:''),_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x1b3)][_0x4cab00(0xe4)]({'nodeId':_0x5a5e76['id'],'agentId':_0x5a5e76['agentId'],'decision':_0x552c5d[_0x4cab00(0x101)],'reason':_0x552c5d[_0x4cab00(0x178)],'decidedAt':_0x59f35e[_0x4cab00(0x1cc)]}),_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x1ce)]+=0x1,_0x346228[_0x4cab00(0x1d2)]['runningNodeIds']=_0x346228[_0x4cab00(0x1d2)]['runningNodeIds'][_0x4cab00(0x12f)](_0x29fcd7=>_0x29fcd7!==_0x5a5e76['id']),_0x346228['state']['completedNodeIds']=pushUnique(_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x1a6)],_0x5a5e76['id']),await appendTimeline(_0x346228[_0x4cab00(0x1c2)],{'at':_0x59f35e['completedAt'],'type':_0x4cab00(0xef),'runId':_0x346228['state'][_0x4cab00(0x143)],'nodeId':_0x5a5e76['id'],'branch':_0x552c5d[_0x4cab00(0x101)],'message':_0x59f35e[_0x4cab00(0x100)]});}else{if(_0x3ab6a5['length']===0x1&&_0x3ab6a5[0x0]?.[_0x4cab00(0x163)]===_0x4cab00(0x1e2)){const _0xb447db=_0x3ab6a5[0x0];await executeAskNode({'api':_0x346228[_0x4cab00(0x133)],'runDir':_0x346228[_0x4cab00(0x1c2)],'state':_0x346228['state'],'program':_0x346228[_0x4cab00(0x13c)],'plan':_0x346228[_0x4cab00(0x19b)],'node':_0xb447db}),_0x346228[_0x4cab00(0x1d2)]['stepsExecuted']+=0x1;}else{const _0x3b4e02=_0x3ab6a5[_0x4cab00(0x12f)](_0x2a0ed9=>_0x2a0ed9[_0x4cab00(0x163)]===_0x4cab00(0x1d5)),_0x5b1d39=await Promise['allSettled'](_0x3b4e02[_0x4cab00(0x184)](async _0x563732=>{const _0x3b5f73=_0x4cab00,_0x486f4e=await executeTaskNode({'api':_0x346228[_0x3b5f73(0x133)],'workspaceDir':_0x346228[_0x3b5f73(0x16d)],'runDir':_0x346228['runDir'],'state':_0x346228['state'],'program':_0x346228[_0x3b5f73(0x13c)],'plan':_0x346228['plan'],'node':_0x563732,'agent':_0x346228[_0x3b5f73(0x193)][_0x563732['agentId']],'inputs':_0x346228[_0x3b5f73(0x1c8)],'defaultProvider':_0x346228['defaultProvider'],'defaultModel':_0x346228[_0x3b5f73(0x18b)],'defaultTimeoutMs':_0x346228[_0x3b5f73(0x16a)],'cleanupSessions':_0x346228[_0x3b5f73(0x11f)]});return{'node':_0x563732,'output':_0x486f4e};}));let _0x13154d;for(let _0x4940c1=0x0;_0x4940c1<_0x5b1d39[_0x4cab00(0x1c4)];_0x4940c1+=0x1){const _0x41deab=_0x3b4e02[_0x4940c1],_0x126302=_0x346228['state']['nodeStates'][_0x41deab['id']],_0x1faa92=_0x5b1d39[_0x4940c1];_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x18e)]=_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x18e)][_0x4cab00(0x12f)](_0x748fb4=>_0x748fb4!==_0x41deab['id']);if(_0x1faa92['status']===_0x4cab00(0x1ec)){const _0x3fbe04=await writeArtifact(_0x346228['runDir'],_0x41deab['id'],_0x1faa92['value'][_0x4cab00(0x19d)]);_0x126302[_0x4cab00(0x144)]=_0x4cab00(0xfa),_0x126302[_0x4cab00(0x1cc)]=new Date()[_0x4cab00(0x17b)](),_0x126302['artifactPath']=_0x3fbe04,_0x126302[_0x4cab00(0x100)]=summarizeText(_0x1faa92[_0x4cab00(0xf9)][_0x4cab00(0x19d)]),_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x1b4)][_0x41deab['id']]=_0x3fbe04,_0x346228['state'][_0x4cab00(0x1ce)]+=0x1,_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x1a6)]=pushUnique(_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x1a6)],_0x41deab['id']);shouldCaptureFinalOutput(_0x346228[_0x4cab00(0x19b)],_0x41deab['id'])&&(_0x346228['state'][_0x4cab00(0x175)]=_0x3fbe04);await appendTimeline(_0x346228[_0x4cab00(0x1c2)],{'at':_0x126302[_0x4cab00(0x1cc)],'type':_0x4cab00(0x1b2),'runId':_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x143)],'nodeId':_0x41deab['id'],'message':_0x126302['summary']});continue;}_0x126302[_0x4cab00(0x144)]=_0x4cab00(0x1ed),_0x126302[_0x4cab00(0x1cc)]=new Date()[_0x4cab00(0x17b)](),_0x126302[_0x4cab00(0x18a)]=_0x1faa92[_0x4cab00(0x178)]instanceof Error?_0x1faa92['reason'][_0x4cab00(0x129)]:String(_0x1faa92[_0x4cab00(0x178)]),!_0x13154d&&(_0x13154d={'nodeId':_0x41deab['id'],'reason':_0x126302[_0x4cab00(0x18a)]});}if(_0x13154d){await failRun(_0x346228[_0x4cab00(0x1c2)],_0x346228['state'],_0x346228['plan'],_0x13154d);break;}}}if(_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x144)]!=='running'){await writeRunState(_0x346228['runDir'],_0x346228['state']),await writeResumeFile(_0x346228[_0x4cab00(0x1c2)],_0x346228[_0x4cab00(0x1d2)],_0x346228[_0x4cab00(0x19b)]);break;}syncSchedulerState(_0x346228[_0x4cab00(0x1d2)],_0x346228[_0x4cab00(0x19b)]),await writeRunState(_0x346228[_0x4cab00(0x1c2)],_0x346228[_0x4cab00(0x1d2)]),await writeResumeFile(_0x346228[_0x4cab00(0x1c2)],_0x346228[_0x4cab00(0x1d2)],_0x346228['plan']);}catch(_0x26b7d8){const _0x1c15fb=_0x3ab6a5[0x0],_0xdc95ef=_0x1c15fb?_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x15c)][_0x1c15fb['id']]:undefined;_0xdc95ef&&(_0xdc95ef[_0x4cab00(0x144)]=_0x4cab00(0x1ed),_0xdc95ef[_0x4cab00(0x1cc)]=new Date()['toISOString'](),_0xdc95ef[_0x4cab00(0x18a)]=_0x26b7d8 instanceof Error?_0x26b7d8[_0x4cab00(0x129)]:String(_0x26b7d8));_0x1c15fb&&(_0x346228[_0x4cab00(0x1d2)][_0x4cab00(0x18e)]=_0x346228['state'][_0x4cab00(0x18e)][_0x4cab00(0x12f)](_0x2ab25b=>_0x2ab25b!==_0x1c15fb['id']));await failRun(_0x346228[_0x4cab00(0x1c2)],_0x346228[_0x4cab00(0x1d2)],_0x346228[_0x4cab00(0x19b)],{'nodeId':_0x1c15fb?.['id'],'reason':_0xdc95ef?.[_0x4cab00(0x18a)]??(_0x26b7d8 instanceof Error?_0x26b7d8[_0x4cab00(0x129)]:String(_0x26b7d8))});break;}}return _0x346228[_0x4cab00(0x1d2)];}function startNodeRecord(_0x14020d){const _0x54de32=_0x56e193,_0x4befdd=_0x14020d[_0x54de32(0x1d2)][_0x54de32(0x15c)][_0x14020d['node']['id']],_0x39f264=(_0x4befdd?.[_0x54de32(0xf0)]??0x0)+0x1,_0x5d9b96={'nodeId':_0x14020d[_0x54de32(0x176)]['id'],'status':_0x54de32(0x108),'readyAt':new Date()[_0x54de32(0x17b)](),'startedAt':new Date()[_0x54de32(0x17b)](),'dependsOnSnapshot':[..._0x14020d[_0x54de32(0x176)][_0x54de32(0x190)]],'visitCount':_0x39f264,'wave':_0x14020d[_0x54de32(0x183)]};return(_0x14020d[_0x54de32(0x176)][_0x54de32(0x163)]===_0x54de32(0x1d5)||_0x14020d[_0x54de32(0x176)]['type']===_0x54de32(0x1a0))&&(_0x5d9b96['agentId']=_0x14020d[_0x54de32(0x176)]['agentId']),_0x14020d[_0x54de32(0x176)][_0x54de32(0x163)]===_0x54de32(0x1d5)&&(_0x5d9b96[_0x54de32(0x1a4)]=_0x14020d[_0x54de32(0x176)][_0x54de32(0x113)]['executionTarget']),_0x5d9b96[_0x54de32(0x107)]=[..._0x14020d['node']['contextFrom']],_0x14020d[_0x54de32(0x1d2)]['nodeStates'][_0x14020d[_0x54de32(0x176)]['id']]=_0x5d9b96,_0x5d9b96;}async function executeTaskNode(_0x5dc4f7){const _0x2b6a18=_0x56e193,_0x3002be=[_0x2b6a18(0x138),_0x2b6a18(0x1e4),'','Program\x20goal:\x20'+_0x5dc4f7[_0x2b6a18(0x13c)]['goal'],_0x2b6a18(0x12c)+_0x5dc4f7[_0x2b6a18(0x176)]['title'],_0x2b6a18(0xf3)+_0x5dc4f7[_0x2b6a18(0x176)][_0x2b6a18(0x191)],'',_0x2b6a18(0x1c3),_0x5dc4f7[_0x2b6a18(0x142)][_0x2b6a18(0x11d)],'',_0x2b6a18(0x11a),_0x5dc4f7['agent'][_0x2b6a18(0x13b)],'',_0x2b6a18(0x1e1),_0x5dc4f7[_0x2b6a18(0x176)][_0x2b6a18(0x13b)],'',_0x2b6a18(0x17a),..._0x5dc4f7[_0x2b6a18(0x176)]['doneWhen'][_0x2b6a18(0x184)](_0xf0bba8=>'-\x20'+_0xf0bba8),'',_0x2b6a18(0x152),JSON[_0x2b6a18(0x14b)](_0x5dc4f7[_0x2b6a18(0x1c8)],null,0x2),'','Previous\x20completed\x20node\x20outputs:',await buildNodeContext(_0x5dc4f7[_0x2b6a18(0x1c2)],_0x5dc4f7[_0x2b6a18(0x1d2)],_0x5dc4f7['node'][_0x2b6a18(0x1c6)]),'','Final\x20output\x20contract:',..._0x5dc4f7['program']['outputContract']['requirements'][_0x2b6a18(0x184)](_0x56791f=>'-\x20'+_0x56791f)][_0x2b6a18(0x165)]('\x0a');if(_0x5dc4f7['node'][_0x2b6a18(0x113)][_0x2b6a18(0x1a4)]===_0x2b6a18(0x169))return executeSubagentTaskNode({'api':_0x5dc4f7['api'],'runDir':_0x5dc4f7['runDir'],'state':_0x5dc4f7[_0x2b6a18(0x1d2)],'node':_0x5dc4f7[_0x2b6a18(0x176)],'agent':_0x5dc4f7[_0x2b6a18(0x142)],'prompt':_0x3002be,'timeoutMs':_0x5dc4f7[_0x2b6a18(0x142)][_0x2b6a18(0xed)]??_0x5dc4f7[_0x2b6a18(0x16a)],'providerOverride':_0x5dc4f7[_0x2b6a18(0x142)][_0x2b6a18(0x1a1)],'modelOverride':_0x5dc4f7['agent']['model'],'inheritedProvider':_0x5dc4f7['defaultProvider'],'inheritedModel':_0x5dc4f7[_0x2b6a18(0x18b)],'cleanupSessions':_0x5dc4f7['cleanupSessions']});return executeEmbeddedPrompt({'api':_0x5dc4f7[_0x2b6a18(0x133)],'workspaceDir':_0x5dc4f7['workspaceDir'],'runDir':_0x5dc4f7[_0x2b6a18(0x1c2)],'sessionId':_0x5dc4f7[_0x2b6a18(0x1d2)]['runId']+':'+_0x5dc4f7['node']['id'],'runId':_0x5dc4f7[_0x2b6a18(0x1d2)]['runId']+':'+_0x5dc4f7['node']['id'],'prompt':_0x3002be,'provider':_0x5dc4f7[_0x2b6a18(0x142)][_0x2b6a18(0x1a1)]??_0x5dc4f7[_0x2b6a18(0x1f8)],'model':_0x5dc4f7[_0x2b6a18(0x142)][_0x2b6a18(0x136)]??_0x5dc4f7['defaultModel'],'timeoutMs':_0x5dc4f7[_0x2b6a18(0x142)][_0x2b6a18(0xed)]??_0x5dc4f7[_0x2b6a18(0x16a)]});}function _0x195e(_0x36aba4,_0x20dbe8){_0x36aba4=_0x36aba4-0xe2;const _0x43ad7a=_0x43ad();let _0x195eef=_0x43ad7a[_0x36aba4];return _0x195eef;}async function executeJudgeNode(_0x54f5bb){const _0x509362=_0x56e193,_0x35174b=[_0x509362(0x1ee),_0x509362(0x11e),'Do\x20not\x20include\x20markdown\x20fences.','',_0x509362(0x128)+_0x54f5bb[_0x509362(0x13c)][_0x509362(0x191)],_0x509362(0x1a2)+_0x54f5bb[_0x509362(0x176)][_0x509362(0x199)],'Question:\x20'+_0x54f5bb[_0x509362(0x176)][_0x509362(0x153)],'',_0x509362(0x1c3),_0x54f5bb[_0x509362(0x142)][_0x509362(0x11d)],'',_0x509362(0x11a),_0x54f5bb['agent']['instructions'],'',_0x509362(0x19e),_0x54f5bb[_0x509362(0x176)][_0x509362(0x13b)],'',_0x509362(0x1ae)+_0x54f5bb[_0x509362(0x176)][_0x509362(0x1a9)][_0x509362(0x165)](',\x20'),'',_0x509362(0x152),JSON['stringify'](_0x54f5bb['inputs'],null,0x2),'',_0x509362(0x14d),await buildNodeContext(_0x54f5bb[_0x509362(0x1c2)],_0x54f5bb['state'],_0x54f5bb[_0x509362(0x176)][_0x509362(0x1c6)])][_0x509362(0x165)]('\x0a'),_0xf59072=await executeEmbeddedPrompt({'api':_0x54f5bb[_0x509362(0x133)],'workspaceDir':_0x54f5bb[_0x509362(0x16d)],'runDir':_0x54f5bb[_0x509362(0x1c2)],'sessionId':_0x54f5bb[_0x509362(0x1d2)][_0x509362(0x143)]+':'+_0x54f5bb['node']['id'],'runId':_0x54f5bb[_0x509362(0x1d2)]['runId']+':'+_0x54f5bb[_0x509362(0x176)]['id'],'prompt':_0x35174b,'provider':_0x54f5bb[_0x509362(0x142)][_0x509362(0x1a1)]??_0x54f5bb[_0x509362(0x1f8)],'model':_0x54f5bb[_0x509362(0x142)]['model']??_0x54f5bb[_0x509362(0x18b)],'timeoutMs':_0x54f5bb[_0x509362(0x142)][_0x509362(0xed)]??_0x54f5bb[_0x509362(0x16a)]});return parseJudgeDecision(_0xf59072);}async function executeAskNode(_0x2ce291){const _0x1d296b=_0x56e193,_0x1c7d7c=_0x2ce291[_0x1d296b(0x1d2)][_0x1d296b(0x15c)][_0x2ce291['node']['id']];if(_0x1c7d7c[_0x1d296b(0xf0)]>_0x2ce291[_0x1d296b(0x176)][_0x1d296b(0x17d)])throw new Error(_0x1d296b(0x10b)+_0x2ce291[_0x1d296b(0x176)]['id']+'\x22\x20exceeded\x20maxAttempts\x20('+_0x2ce291['node'][_0x1d296b(0x17d)]+')');const _0x266065=new Date()[_0x1d296b(0x17b)](),_0x3fda5f=await buildNodeContext(_0x2ce291[_0x1d296b(0x1c2)],_0x2ce291[_0x1d296b(0x1d2)],_0x2ce291[_0x1d296b(0x176)][_0x1d296b(0x1c6)]),_0x2fa9a0=buildAskNotificationMessage({'runId':_0x2ce291[_0x1d296b(0x1d2)][_0x1d296b(0x143)],'programName':_0x2ce291[_0x1d296b(0x13c)][_0x1d296b(0x110)],'node':_0x2ce291[_0x1d296b(0x176)],'context':_0x3fda5f}),_0x3461fc=await writeArtifact(_0x2ce291[_0x1d296b(0x1c2)],_0x2ce291['node']['id'],buildAskArtifact({'title':_0x2ce291[_0x1d296b(0x176)][_0x1d296b(0x199)],'question':_0x2ce291[_0x1d296b(0x176)][_0x1d296b(0x153)],'inputKey':_0x2ce291['node'][_0x1d296b(0x1f3)],'resumeNodeId':_0x2ce291[_0x1d296b(0x176)][_0x1d296b(0x13e)],'context':_0x3fda5f}));_0x1c7d7c[_0x1d296b(0x144)]=_0x1d296b(0x117),_0x1c7d7c[_0x1d296b(0xfb)]=_0x266065,_0x1c7d7c['completedAt']=undefined,_0x1c7d7c[_0x1d296b(0x114)]=_0x3461fc,_0x1c7d7c[_0x1d296b(0x100)]=summarizeText(_0x2fa9a0),_0x2ce291[_0x1d296b(0x1d2)][_0x1d296b(0x1b4)][_0x2ce291[_0x1d296b(0x176)]['id']]=_0x3461fc,_0x2ce291[_0x1d296b(0x1d2)][_0x1d296b(0x18e)]=_0x2ce291[_0x1d296b(0x1d2)]['runningNodeIds'][_0x1d296b(0x12f)](_0x2ae4a3=>_0x2ae4a3!==_0x2ce291[_0x1d296b(0x176)]['id']),_0x2ce291[_0x1d296b(0x1d2)][_0x1d296b(0x155)]=[],_0x2ce291[_0x1d296b(0x1d2)][_0x1d296b(0x147)]=_0x2ce291[_0x1d296b(0x176)]['id'],_0x2ce291['state']['status']=_0x1d296b(0x117),_0x2ce291[_0x1d296b(0x1d2)]['pendingInput']={'nodeId':_0x2ce291[_0x1d296b(0x176)]['id'],'question':_0x2ce291[_0x1d296b(0x176)][_0x1d296b(0x153)],'inputKey':_0x2ce291[_0x1d296b(0x176)][_0x1d296b(0x1f3)],'resumeNodeId':_0x2ce291['node']['resumeNodeId'],'requestedAt':_0x266065,'attemptsUsed':_0x1c7d7c[_0x1d296b(0xf0)]};_0x2ce291[_0x1d296b(0x1d2)]['background']&&(_0x2ce291[_0x1d296b(0x1d2)][_0x1d296b(0x1d7)]={..._0x2ce291[_0x1d296b(0x1d2)]['background'],'status':_0x1d296b(0x117)});await appendTimeline(_0x2ce291[_0x1d296b(0x1c2)],{'at':_0x266065,'type':_0x1d296b(0x18f),'runId':_0x2ce291[_0x1d296b(0x1d2)][_0x1d296b(0x143)],'nodeId':_0x2ce291['node']['id'],'message':_0x2fa9a0}),await appendTimeline(_0x2ce291['runDir'],{'at':_0x266065,'type':_0x1d296b(0x131),'runId':_0x2ce291[_0x1d296b(0x1d2)][_0x1d296b(0x143)],'nodeId':_0x2ce291[_0x1d296b(0x176)]['id'],'message':_0x1d296b(0x166)+_0x2ce291[_0x1d296b(0x176)][_0x1d296b(0x1f3)]+'\x22\x20before\x20resuming\x20\x22'+_0x2ce291[_0x1d296b(0x176)][_0x1d296b(0x13e)]+'\x22'});const _0x1bbbcc=_0x2ce291[_0x1d296b(0x1d2)]['background']?.[_0x1d296b(0x14e)]?.['trim']()||_0x2ce291[_0x1d296b(0x1d2)][_0x1d296b(0xf2)][_0x1d296b(0x164)]?.[_0x1d296b(0x1f2)]();if(!_0x1bbbcc){_0x2ce291[_0x1d296b(0x1d2)][_0x1d296b(0x1b1)][_0x1d296b(0x1d8)]={'status':_0x1d296b(0x125),'attemptedAt':_0x266065},await appendTimeline(_0x2ce291[_0x1d296b(0x1c2)],{'at':_0x266065,'type':_0x1d296b(0x130),'runId':_0x2ce291[_0x1d296b(0x1d2)][_0x1d296b(0x143)],'message':_0x1d296b(0x11c)});return;}try{const _0x1e5e8f=await notifyAgentSession({'sessionKey':_0x1bbbcc,'message':_0x2fa9a0});_0x2ce291['state'][_0x1d296b(0x1b1)][_0x1d296b(0x1d8)]={'status':_0x1d296b(0x14c),'attemptedAt':_0x266065,'queuedAt':new Date()[_0x1d296b(0x17b)](),'runId':_0x1e5e8f[_0x1d296b(0x143)],'targetSessionKey':_0x1bbbcc},await appendTimeline(_0x2ce291[_0x1d296b(0x1c2)],{'at':_0x2ce291[_0x1d296b(0x1d2)][_0x1d296b(0x1b1)]['notification']['queuedAt']??_0x266065,'type':_0x1d296b(0x185),'runId':_0x2ce291[_0x1d296b(0x1d2)][_0x1d296b(0x143)],'message':_0x1d296b(0x1d1)+_0x1bbbcc+'\x20as\x20agent\x20run\x20'+_0x1e5e8f[_0x1d296b(0x143)]});}catch(_0x3bb7ea){const _0x3826a5=_0x3bb7ea instanceof Error?_0x3bb7ea['message']:String(_0x3bb7ea);_0x2ce291[_0x1d296b(0x1d2)]['pendingInput']['notification']={'status':_0x1d296b(0x1ed),'attemptedAt':_0x266065,'error':_0x3826a5,'targetSessionKey':_0x1bbbcc},await appendTimeline(_0x2ce291[_0x1d296b(0x1c2)],{'at':new Date()[_0x1d296b(0x17b)](),'type':_0x1d296b(0x1b8),'runId':_0x2ce291[_0x1d296b(0x1d2)][_0x1d296b(0x143)],'message':_0x3826a5});}}async function executeSubagentTaskNode(_0x441cce){const _0x3431f9=_0x56e193,_0x287ce9=_0x441cce[_0x3431f9(0x1d2)]['nodeStates'][_0x441cce[_0x3431f9(0x176)]['id']],_0x342b1f=_0x441cce[_0x3431f9(0x1d2)][_0x3431f9(0xf2)][_0x3431f9(0x172)]??_0x441cce[_0x3431f9(0x1d2)][_0x3431f9(0xf2)]['agentId']??_0x441cce['state'][_0x3431f9(0x1d7)]?.['originAgentId'],_0x33eb7a=scopeAgentSessionKey(_0x342b1f,'own-prose:task:'+_0x441cce['state'][_0x3431f9(0x143)]+':'+_0x441cce[_0x3431f9(0x176)]['id']+':v'+(_0x287ce9?.[_0x3431f9(0xf0)]??0x1));let _0x4a97f3=![];try{const _0x1573ed=await runOwnProseSubagent({'api':_0x441cce[_0x3431f9(0x133)],'sessionKey':_0x33eb7a,'agentId':_0x342b1f,'message':_0x441cce[_0x3431f9(0xf4)],'timeoutMs':_0x441cce[_0x3431f9(0xed)],'idempotencyKey':_0x33eb7a,'providerOverride':_0x441cce[_0x3431f9(0x16b)],'modelOverride':_0x441cce[_0x3431f9(0x160)],'inheritedProvider':_0x441cce[_0x3431f9(0x137)],'inheritedModel':_0x441cce[_0x3431f9(0x1c7)],'label':_0x3431f9(0xe8)+_0x441cce[_0x3431f9(0x1d2)][_0x3431f9(0x143)]+':'+_0x441cce[_0x3431f9(0x176)]['id']});_0x287ce9&&(_0x287ce9[_0x3431f9(0x135)]=_0x1573ed['carrier']??_0x3431f9(0x1af),_0x287ce9[_0x3431f9(0x11b)]=_0x33eb7a,_0x287ce9['subagentRunId']=_0x1573ed[_0x3431f9(0x143)],await writeRunState(_0x441cce[_0x3431f9(0x1c2)],_0x441cce[_0x3431f9(0x1d2)]));const _0x43761d=await waitForOwnProseSubagentRun({'api':_0x441cce['api'],'runId':_0x1573ed[_0x3431f9(0x143)],'timeoutMs':_0x441cce[_0x3431f9(0xed)]});if(_0x43761d[_0x3431f9(0x144)]!=='ok')throw new Error(_0x43761d[_0x3431f9(0x144)]===_0x3431f9(0x115)?'Subagent\x20task\x20timed\x20out:\x20'+_0x441cce['node']['id']:_0x3431f9(0xe2)+(_0x43761d['error']??_0x441cce[_0x3431f9(0x176)]['id']));const _0x48871c=await getOwnProseSubagentMessages({'api':_0x441cce[_0x3431f9(0x133)],'sessionKey':_0x33eb7a,'limit':0xc8}),_0x1f033a=extractSubagentOutputText(_0x48871c[_0x3431f9(0x1e0)]);return _0x4a97f3=!![],_0x1f033a;}finally{_0x4a97f3&&await cleanupOwnProseSubagentSession({'api':_0x441cce[_0x3431f9(0x133)],'sessionKey':_0x33eb7a,'enabled':_0x441cce[_0x3431f9(0x11f)]});}}async function cleanupOwnProseSubagentSession(_0x18faec){const _0x486890=_0x56e193;await cleanupOwnProseSession({'api':_0x18faec['api'],'sessionKey':_0x18faec[_0x486890(0x164)],'enabled':_0x18faec[_0x486890(0x17c)],'deleteMode':_0x486890(0x1f6)});}async function cleanupOwnProseSession(_0x52166a){const _0x13749b=_0x56e193;if(!_0x52166a[_0x13749b(0x17c)])return;const _0x1a65ab=_0x52166a['sessionKey'][_0x13749b(0x1f2)]();if(!_0x1a65ab)return;await deleteOwnProseSession({'api':_0x52166a[_0x13749b(0x133)],'sessionKey':_0x1a65ab,'deleteMode':_0x52166a[_0x13749b(0x19f)]});let _0x1cb886=0x0;for(const _0x4fe592 of SESSION_CLEANUP_RECHECK_DELAYS_MS){await sleep(_0x4fe592);const _0x45ab21=await probeOwnProseSession({'sessionKey':_0x1a65ab});if(_0x45ab21!==!![]){_0x1cb886+=0x1;if(_0x1cb886>=0x2)return;continue;}_0x1cb886=0x0,await deleteOwnProseSession({'api':_0x52166a[_0x13749b(0x133)],'sessionKey':_0x1a65ab,'deleteMode':_0x52166a[_0x13749b(0x19f)]});}}async function deleteOwnProseSession(_0x15c36d){const _0x4f93a0=_0x56e193;try{await deleteAgentSession({'sessionKey':_0x15c36d[_0x4f93a0(0x164)],'deleteTranscript':!![]});}catch{}}async function probeOwnProseSession(_0x3248e8){const _0x2d80dd=_0x56e193;try{return await hasAgentSession({'sessionKey':_0x3248e8[_0x2d80dd(0x164)]});}catch{return undefined;}}async function cleanupOwnProseRunSessions(_0x5a0bf4){const _0x42cd83=_0x56e193;for(const _0x2034ac of collectOwnProseSessionKeys(_0x5a0bf4['state'],{'includeSupervisor':_0x5a0bf4[_0x42cd83(0x149)]})){await cleanupOwnProseSession({'api':_0x5a0bf4[_0x42cd83(0x133)],'sessionKey':_0x2034ac,'enabled':_0x5a0bf4['enabled'],'deleteMode':_0x5a0bf4['deleteMode']});}}async function finalizeBackgroundState(_0xbf4447){const _0x3e1296=_0x56e193,_0x7f290a=_0xbf4447[_0x3e1296(0x1d2)][_0x3e1296(0x144)]===_0x3e1296(0xfa)?_0x3e1296(0x105):_0xbf4447[_0x3e1296(0x1d2)][_0x3e1296(0x144)]===_0x3e1296(0x117)?'blocked':_0x3e1296(0x1ed);_0xbf4447[_0x3e1296(0x1d2)][_0x3e1296(0x1d7)]={..._0xbf4447[_0x3e1296(0x1d2)][_0x3e1296(0x1d7)]??{'mode':_0x3e1296(0x1d7),'startedAt':new Date()[_0x3e1296(0x17b)]()},'mode':_0x3e1296(0x1d7),'status':_0x7f290a,'finishedAt':new Date()['toISOString']()},_0xbf4447[_0x3e1296(0x1d2)]['background'][_0x3e1296(0x1f1)]&&(_0xbf4447[_0x3e1296(0x1d2)][_0x3e1296(0x1d7)][_0x3e1296(0x1f1)]={..._0xbf4447[_0x3e1296(0x1d2)]['background']['supervisor'],'status':_0xbf4447[_0x3e1296(0x1d2)]['status']===_0x3e1296(0x1ed)?'failed':_0x3e1296(0x105),'finishedAt':new Date()[_0x3e1296(0x17b)](),'error':_0xbf4447[_0x3e1296(0x1d2)]['failure']?.[_0x3e1296(0x178)]}),await writeRunState(_0xbf4447[_0x3e1296(0x1c2)],_0xbf4447[_0x3e1296(0x1d2)]),await writeResumeFile(_0xbf4447['runDir'],_0xbf4447['state'],_0xbf4447[_0x3e1296(0x19b)]);}async function executeEmbeddedPrompt(_0x218a88){const _0x50f69b=_0x56e193,_0x426aca=await _0x218a88[_0x50f69b(0x133)][_0x50f69b(0xf2)][_0x50f69b(0x142)][_0x50f69b(0x1e9)]({'sessionId':_0x218a88[_0x50f69b(0x1db)],'runId':_0x218a88['runId'],'sessionFile':_0x409588['join'](_0x218a88[_0x50f69b(0x1c2)],_0x50f69b(0x1ad),sanitizeId(_0x218a88[_0x50f69b(0x1db)])+'.jsonl'),'workspaceDir':_0x218a88[_0x50f69b(0x16d)],'config':_0x218a88[_0x50f69b(0x133)][_0x50f69b(0x1a3)],'lane':OWN_PROSE_EMBEDDED_LANE,'prompt':_0x218a88['prompt'],'timeoutMs':_0x218a88['timeoutMs'],..._0x218a88[_0x50f69b(0x1a1)]?{'provider':_0x218a88[_0x50f69b(0x1a1)]}:{},..._0x218a88[_0x50f69b(0x136)]?{'model':_0x218a88[_0x50f69b(0x136)]}:{}}),_0x133af4=extractEmbeddedRunOutputText(_0x426aca['payloads']);if(_0x133af4)return _0x133af4;const _0x514589=_0x426aca[_0x50f69b(0x1dd)]?.[_0x50f69b(0x18a)]?.[_0x50f69b(0x129)]?.[_0x50f69b(0x1f2)]();throw new Error(_0x514589||_0x50f69b(0x123));}function _0x43ad(){const _0x29dbbd=['every','Queued\x20ask\x20notification\x20to\x20','state','Run\x20reached\x20a\x20deadlock\x20with\x20no\x20ready\x20nodes','Relevant\x20prior\x20context:','task','extraSystemPrompt','background','notification','13507EBpOeF','programName','sessionId','exec','meta','replace','some','messages','Node\x20instructions:','ask','utf8','Return\x20only\x20the\x20deliverable\x20for\x20this\x20node.\x20Do\x20not\x20explain\x20your\x20process.','Completed\x20nodes:\x20','carrier','idempotencyKey','Unable\x20to\x20locate\x20JSON\x20object\x20in\x20output','runEmbeddedPiAgent','Status:\x20','isArray','fulfilled','failed','You\x20are\x20executing\x20one\x20own-prose\x20judge\x20node.','selectedBranches','own-prose\x20needs\x20more\x20information\x20before\x20it\x20can\x20continue.','supervisor','trim','inputKey','reply_received','context','gateway_only','supervisorSessionKey','defaultProvider','Subagent\x20task\x20failed:\x20','isError','push','nodes','Supervisor:\x20','failure','own-prose\x20task\x20','Reply\x20captured\x20via\x20own_prose_reply.','Ready\x20nodes:\x20','programPath\x20required','\x22\x20and\x20the\x20user\x27s\x20answer.','timeoutMs','foreground_request','branch_decided','visitCount','After\x20the\x20tool\x20finishes,\x20reply\x20only\x20with\x20','runtime','Node\x20goal:\x20','prompt','Input\x20key:\x20','NO_REPLY','pendingNodeIds','dirname','value','completed','blockedAt','Failure:\x20','You\x20must\x20call\x20the\x20own_prose_background_run\x20tool\x20exactly\x20once\x20with\x20the\x20provided\x20runId.','17052poOhXC','normalize','summary','decision','Received\x20reply\x20for\x20input\x20key\x20\x22','assistant','Running\x20nodes:\x20','finished','1511015JBAsaU','contextFromSnapshot','running','Missing\x20required\x20input\x20\x22','nodeIds','Ask\x20node\x20\x22','readFile','11mOpeqc','Use\x20runDir\x20\x22','Pending\x20input:\x20','name','runs','add','permissions','artifactPath','timeout','deliver','blocked','text','6Wqraor','Agent\x20instructions:','taskSessionKey','Skipped\x20ask\x20notification\x20because\x20no\x20origin\x20session\x20was\x20recorded','role','Return\x20JSON\x20only\x20with\x20shape\x20{\x22decision\x22:\x22branch_key\x22,\x22reason\x22:\x22optional\x20short\x20reason\x22}.','cleanupSessions','maxSteps','\x22\x20returned\x20invalid\x20branch\x20\x22','After\x20the\x20tool\x20succeeds\x20or\x20fails,\x20respond\x20with\x20exactly\x20','Embedded\x20node\x20run\x20returned\x20no\x20output','shift','skipped','stateRoot','any','Program\x20goal:\x20','message','has','pending','Node\x20title:\x20','Queued\x20background\x20notification\x20to\x20','If\x20a\x20runDir\x20is\x20provided,\x20pass\x20it\x20through\x20exactly\x20as\x20given.','filter','notification_skipped','run_blocked','own-prose:supervisor:','api','supervisorRunId','subagentCarrier','model','inheritedProvider','You\x20are\x20executing\x20one\x20own-prose\x20task\x20node.','nodeMap','indexOf','instructions','program','resolve','resumeNodeId','resumedFromReplyAt','2779112uOAqUX','12600BdQzMD','agent','runId','status','\x20->\x20','Run\x20exceeded\x20max\x20steps\x20(','currentNodeId','get','includeSupervisor','Internal\x20own-prose\x20background\x20continuation\x20request.','stringify','queued','Previous\x20completed\x20node\x20outputs:','originSessionKey','parse','Resume\x20node:\x20','189PoLRxe','Inputs\x20JSON:','question','604WsOvqX','readyNodeIds','196uUQLDc','Run:\x20','node_started','\x20as\x20agent\x20run\x20','None','Subagent\x20run\x20returned\x20no\x20assistant\x20output','nodeStates','programPath','Question:\x20','Workflow\x20complete','modelOverride','Node\x20states:','set','type','sessionKey','join','Waiting\x20for\x20input\x20key\x20\x22','mkdir','Do\x20not\x20ask\x20follow-up\x20questions.','subagent','defaultTimeoutMs','providerOverride','20152HzeyDu','workspaceDir','Background\x20supervisor\x20failed:\x20','Expected\x20input\x20key:\x20','key','pluginConfig','supervisorAgentId','pluginDefaultProvider','Program:\x20','finalOutputPath','node','source','reason','agentIds','Done\x20when:','toISOString','enabled','maxAttempts','plugin_default','\x20-\x20','values','finish','Started\x20','wave','map','notification_sent','startsWith','745cWBbOh','sourcePath','\x0a[missing\x20artifact]','error','defaultModel','Judge\x20output\x20is\x20missing\x20decision','Run\x20ID:\x20','runningNodeIds','node_blocked','dependsOn','goal','answer','agents','endsWith','all','...','none','Run\x20\x22','title','own-prose\x20supervisor\x20','plan','find','output','Judge\x20instructions:','deleteMode','judge','provider','Judge\x20title:\x20','config','executionTarget','slice','completedNodeIds','nodeId','branches','allowedBranches','run_completed','\x22\x20is\x20not\x20waiting\x20for\x20reply\x20input','8954140sZuIjy','sessions','Allowed\x20branches:\x20','gateway_session','\x20node\x20','pendingInput','node_completed','branchDecisions','artifacts','includes','Reply\x20captured\x20for\x20input\x20key\x20\x22','isAbsolute','notification_failed','cwd','agentId','own-prose\x20background\x20run\x20finished.','defaultValue','startedAt','Steps\x20executed:\x20','##\x20Context','label','catch','runDir','Agent\x20role:','length','pluginDefaultModel','contextFrom','inheritedModel','inputs','Skipped\x20background\x20notification\x20because\x20no\x20origin\x20session\x20was\x20recorded','Do\x20not\x20call\x20own_prose_start,\x20own_prose_drive,\x20or\x20own_prose_status.','Current\x20node:\x20','completedAt','object','stepsExecuted','string'];_0x43ad=function(){return _0x29dbbd;};return _0x43ad();}async function sleep(_0x20113e){await new Promise(_0x3ac5c5=>setTimeout(_0x3ac5c5,_0x20113e));}async function buildNodeContext(_0x19c2aa,_0x30a409,_0x3dbcf8){const _0x2fab79=_0x56e193,_0x352a3f=await Promise[_0x2fab79(0x195)](_0x3dbcf8[_0x2fab79(0x184)](async _0x707328=>{const _0x4d157e=_0x2fab79,_0x4a1362=_0x30a409[_0x4d157e(0x1b4)][_0x707328];if(!_0x4a1362)return'###\x20'+_0x707328+_0x4d157e(0x189);const _0x48b19d=await _0x56f899[_0x4d157e(0x10c)](_0x409588['resolve'](_0x19c2aa,_0x4a1362),_0x4d157e(0x1e3))[_0x4d157e(0x1c1)](()=>'');return'###\x20'+_0x707328+'\x0a'+truncateText(_0x48b19d,0x5dc);}));return _0x352a3f[_0x2fab79(0x1c4)]>0x0?_0x352a3f[_0x2fab79(0x165)]('\x0a\x0a'):_0x2fab79(0x15a);}function buildAskNotificationMessage(_0x79911a){const _0x224152=_0x56e193;return[_0x224152(0x1f0),_0x224152(0x18d)+_0x79911a[_0x224152(0x143)],_0x224152(0x174)+_0x79911a[_0x224152(0x1da)],'Ask\x20node:\x20'+_0x79911a[_0x224152(0x176)]['id'],_0x224152(0x15e)+_0x79911a['node']['question'],_0x224152(0x16f)+_0x79911a[_0x224152(0x176)][_0x224152(0x1f3)],_0x224152(0x150)+_0x79911a['node']['resumeNodeId'],'',_0x224152(0x1d4),_0x79911a[_0x224152(0x1f5)],'','When\x20you\x20have\x20the\x20answer,\x20call\x20the\x20own_prose_reply\x20tool\x20with\x20runId\x20\x22'+_0x79911a[_0x224152(0x143)]+_0x224152(0xec)][_0x224152(0x165)]('\x0a');}function buildAskArtifact(_0xb27463){const _0x1fc919=_0x56e193;return['#\x20'+_0xb27463['title'],'',_0x1fc919(0x15e)+_0xb27463[_0x1fc919(0x153)],_0x1fc919(0xf5)+_0xb27463['inputKey'],'Resume\x20node:\x20'+_0xb27463[_0x1fc919(0x13e)],'',_0x1fc919(0x1bf),_0xb27463[_0x1fc919(0x1f5)],_0xb27463['answer']?['','##\x20Reply',_0xb27463[_0x1fc919(0x192)]]['join']('\x0a'):''][_0x1fc919(0x12f)](Boolean)[_0x1fc919(0x165)]('\x0a');}async function resumeRunFromReply(_0x4752b0){const _0xb92ba0=_0x56e193,_0x162c6c=_0x4752b0[_0xb92ba0(0x1d2)][_0xb92ba0(0x1b1)];if(!_0x162c6c)throw new Error(_0xb92ba0(0x198)+_0x4752b0[_0xb92ba0(0x1d2)][_0xb92ba0(0x143)]+_0xb92ba0(0x1ab));const _0x1970b2=new Date()[_0xb92ba0(0x17b)]();_0x4752b0[_0xb92ba0(0x1d2)][_0xb92ba0(0x1c8)][_0x162c6c[_0xb92ba0(0x1f3)]]=_0x4752b0[_0xb92ba0(0x192)],_0x4752b0[_0xb92ba0(0x1d2)][_0xb92ba0(0xe7)]=undefined,await appendTimeline(_0x4752b0[_0xb92ba0(0x1c2)],{'at':_0x1970b2,'type':_0xb92ba0(0x1f4),'runId':_0x4752b0[_0xb92ba0(0x1d2)][_0xb92ba0(0x143)],'nodeId':_0x162c6c[_0xb92ba0(0x1a7)],'message':_0xb92ba0(0x102)+_0x162c6c[_0xb92ba0(0x1f3)]+'\x22'});const _0x514016=collectDescendantNodeIds(_0x4752b0[_0xb92ba0(0x19b)],_0x162c6c[_0xb92ba0(0x13e)]);invalidateNodesForReplyResume({'state':_0x4752b0[_0xb92ba0(0x1d2)],'plan':_0x4752b0[_0xb92ba0(0x19b)],'nodeIds':_0x514016});const _0x123f76=await writeArtifact(_0x4752b0[_0xb92ba0(0x1c2)],_0x162c6c[_0xb92ba0(0x1a7)],buildAskArtifact({'title':_0x4752b0['plan']['nodes'][_0xb92ba0(0x19c)](_0x135846=>_0x135846['id']===_0x162c6c[_0xb92ba0(0x1a7)])?.[_0xb92ba0(0x199)]??_0x162c6c[_0xb92ba0(0x1a7)],'question':_0x162c6c[_0xb92ba0(0x153)],'inputKey':_0x162c6c['inputKey'],'resumeNodeId':_0x162c6c[_0xb92ba0(0x13e)],'context':_0xb92ba0(0xe9),'answer':_0x4752b0[_0xb92ba0(0x192)]})),_0x2abdbe=_0x4752b0[_0xb92ba0(0x1d2)][_0xb92ba0(0x15c)][_0x162c6c[_0xb92ba0(0x1a7)]];_0x4752b0['state'][_0xb92ba0(0x15c)][_0x162c6c[_0xb92ba0(0x1a7)]]={..._0x2abdbe??{'nodeId':_0x162c6c['nodeId'],'visitCount':0x1},'status':_0xb92ba0(0xfa),'completedAt':_0x1970b2,'resumedFromReplyAt':_0x1970b2,'artifactPath':_0x123f76,'summary':_0xb92ba0(0x1b6)+_0x162c6c['inputKey']+'\x22','error':undefined},_0x4752b0[_0xb92ba0(0x1d2)]['artifacts'][_0x162c6c['nodeId']]=_0x123f76,_0x4752b0[_0xb92ba0(0x1d2)][_0xb92ba0(0x1a6)]=pushUnique(_0x4752b0[_0xb92ba0(0x1d2)][_0xb92ba0(0x1a6)],_0x162c6c['nodeId']),await appendTimeline(_0x4752b0['runDir'],{'at':_0x1970b2,'type':'node_completed','runId':_0x4752b0[_0xb92ba0(0x1d2)][_0xb92ba0(0x143)],'nodeId':_0x162c6c[_0xb92ba0(0x1a7)],'message':'Captured\x20reply\x20for\x20input\x20key\x20\x22'+_0x162c6c[_0xb92ba0(0x1f3)]+'\x22'}),_0x4752b0['state'][_0xb92ba0(0x1b1)]=undefined,_0x4752b0['state']['status']='running',_0x4752b0[_0xb92ba0(0x1d2)]['currentNodeId']=_0x162c6c[_0xb92ba0(0x13e)];_0x4752b0['state'][_0xb92ba0(0x1d7)]&&(_0x4752b0[_0xb92ba0(0x1d2)][_0xb92ba0(0x1d7)]={..._0x4752b0[_0xb92ba0(0x1d2)][_0xb92ba0(0x1d7)],'status':_0xb92ba0(0x108),'finishedAt':undefined});syncSchedulerState(_0x4752b0['state'],_0x4752b0[_0xb92ba0(0x19b)]),await writeRunState(_0x4752b0[_0xb92ba0(0x1c2)],_0x4752b0[_0xb92ba0(0x1d2)]),await writeResumeFile(_0x4752b0[_0xb92ba0(0x1c2)],_0x4752b0[_0xb92ba0(0x1d2)],_0x4752b0[_0xb92ba0(0x19b)]);const _0x707f21=await executePlan({'api':_0x4752b0[_0xb92ba0(0x133)],'workspaceDir':_0x4752b0[_0xb92ba0(0x16d)],'runDir':_0x4752b0['runDir'],'state':_0x4752b0['state'],'program':_0x4752b0['program'],'plan':_0x4752b0[_0xb92ba0(0x19b)],'agents':_0x4752b0['agents'],'inputs':_0x4752b0[_0xb92ba0(0x1d2)][_0xb92ba0(0x1c8)],'defaultProvider':_0x4752b0['defaultProvider'],'defaultModel':_0x4752b0[_0xb92ba0(0x18b)],'defaultTimeoutMs':_0x4752b0[_0xb92ba0(0x16a)],'cleanupSessions':_0x4752b0[_0xb92ba0(0x11f)]});return _0x4752b0['state'][_0xb92ba0(0x1d7)]&&await finalizeBackgroundState({'runDir':_0x4752b0['runDir'],'state':_0x707f21,'plan':_0x4752b0[_0xb92ba0(0x19b)]}),_0x707f21;}function collectDescendantNodeIds(_0x15fb5d,_0x2def9f){const _0xd4c5f2=_0x56e193,_0x5b1b81=new Map();for(const _0x3ab9a7 of _0x15fb5d[_0xd4c5f2(0xe5)]){_0x5b1b81[_0xd4c5f2(0x162)](_0x3ab9a7['id'],[]);}for(const _0x1a4ca2 of _0x15fb5d['nodes']){for(const _0x5c189a of _0x1a4ca2['dependsOn']){_0x5b1b81[_0xd4c5f2(0x148)](_0x5c189a)?.[_0xd4c5f2(0xe4)](_0x1a4ca2['id']);}}const _0x5e567a=new Set(),_0x1946f6=[_0x2def9f];while(_0x1946f6[_0xd4c5f2(0x1c4)]>0x0){const _0x2c5c46=_0x1946f6[_0xd4c5f2(0x124)]();if(_0x5e567a[_0xd4c5f2(0x12a)](_0x2c5c46))continue;_0x5e567a['add'](_0x2c5c46);for(const _0x48a1b7 of _0x5b1b81[_0xd4c5f2(0x148)](_0x2c5c46)??[]){_0x1946f6[_0xd4c5f2(0xe4)](_0x48a1b7);}}return _0x5e567a;}function invalidateNodesForReplyResume(_0x573bab){const _0x5c1ea3=_0x56e193,_0x379319=new Set();for(const _0x44b350 of _0x573bab[_0x5c1ea3(0x10a)]){const _0x5c1d2c=_0x573bab['state'][_0x5c1ea3(0x15c)][_0x44b350];_0x5c1d2c?.[_0x5c1ea3(0x114)]&&_0x379319[_0x5c1ea3(0x112)](_0x5c1d2c[_0x5c1ea3(0x114)]),delete _0x573bab[_0x5c1ea3(0x1d2)][_0x5c1ea3(0x1b4)][_0x44b350],_0x573bab[_0x5c1ea3(0x1d2)][_0x5c1ea3(0x15c)][_0x44b350]={..._0x5c1d2c??{'nodeId':_0x44b350,'visitCount':0x0},'status':'pending','readyAt':undefined,'startedAt':undefined,'completedAt':undefined,'blockedAt':undefined,'resumedFromReplyAt':_0x44b350===_0x573bab[_0x5c1ea3(0x1d2)][_0x5c1ea3(0x1b1)]?.[_0x5c1ea3(0x1a7)]?new Date()[_0x5c1ea3(0x17b)]():_0x5c1d2c?.[_0x5c1ea3(0x13f)],'subagentCarrier':undefined,'dependsOnSnapshot':undefined,'contextFromSnapshot':undefined,'taskSessionKey':undefined,'subagentRunId':undefined,'artifactPath':undefined,'summary':undefined,'error':undefined,'wave':undefined};}_0x573bab[_0x5c1ea3(0x1d2)]['branchDecisions']=_0x573bab['state'][_0x5c1ea3(0x1b3)]['filter'](_0x5c5b9f=>!_0x573bab[_0x5c1ea3(0x10a)][_0x5c1ea3(0x12a)](_0x5c5b9f['nodeId'])),_0x573bab[_0x5c1ea3(0x1d2)][_0x5c1ea3(0x1a6)]=_0x573bab[_0x5c1ea3(0x1d2)][_0x5c1ea3(0x1a6)][_0x5c1ea3(0x12f)](_0x3ec52d=>!_0x573bab[_0x5c1ea3(0x10a)][_0x5c1ea3(0x12a)](_0x3ec52d)),_0x573bab['state'][_0x5c1ea3(0x18e)]=_0x573bab[_0x5c1ea3(0x1d2)][_0x5c1ea3(0x18e)][_0x5c1ea3(0x12f)](_0x458b3a=>!_0x573bab[_0x5c1ea3(0x10a)][_0x5c1ea3(0x12a)](_0x458b3a)),_0x573bab[_0x5c1ea3(0x1d2)][_0x5c1ea3(0x155)]=_0x573bab[_0x5c1ea3(0x1d2)][_0x5c1ea3(0x155)][_0x5c1ea3(0x12f)](_0x2bff28=>!_0x573bab[_0x5c1ea3(0x10a)][_0x5c1ea3(0x12a)](_0x2bff28)),_0x573bab[_0x5c1ea3(0x1d2)][_0x5c1ea3(0xf7)]=uniqueNodeIds([..._0x573bab[_0x5c1ea3(0x1d2)][_0x5c1ea3(0xf7)][_0x5c1ea3(0x12f)](_0x353cc1=>!_0x573bab[_0x5c1ea3(0x10a)][_0x5c1ea3(0x12a)](_0x353cc1)),..._0x573bab[_0x5c1ea3(0x10a)]]),_0x573bab['state'][_0x5c1ea3(0x175)]&&_0x379319[_0x5c1ea3(0x12a)](_0x573bab[_0x5c1ea3(0x1d2)][_0x5c1ea3(0x175)])&&(_0x573bab[_0x5c1ea3(0x1d2)][_0x5c1ea3(0x175)]=undefined);}function syncSchedulerState(_0x31ed7d,_0x4e3dff){const _0x42b9c8=_0x56e193;_0x31ed7d['completedNodeIds']=uniqueNodeIds([..._0x31ed7d['completedNodeIds'],...Object[_0x42b9c8(0x180)](_0x31ed7d['nodeStates'])[_0x42b9c8(0x12f)](_0xcecbde=>_0xcecbde[_0x42b9c8(0x144)]===_0x42b9c8(0xfa))[_0x42b9c8(0x184)](_0x69b07e=>_0x69b07e['nodeId'])]),_0x31ed7d['runningNodeIds']=uniqueNodeIds([..._0x31ed7d[_0x42b9c8(0x18e)],...Object['values'](_0x31ed7d['nodeStates'])[_0x42b9c8(0x12f)](_0xe0f720=>_0xe0f720[_0x42b9c8(0x144)]==='running')[_0x42b9c8(0x184)](_0x1173f3=>_0x1173f3[_0x42b9c8(0x1a7)])]),_0x31ed7d['pendingNodeIds']=_0x31ed7d[_0x42b9c8(0xf7)][_0x42b9c8(0x12f)](_0x466022=>!_0x31ed7d['completedNodeIds']['includes'](_0x466022)&&!_0x31ed7d[_0x42b9c8(0x18e)]['includes'](_0x466022)),_0x31ed7d['readyNodeIds']=computeReadyNodeIds(_0x4e3dff,_0x31ed7d),_0x31ed7d[_0x42b9c8(0x147)]=_0x31ed7d[_0x42b9c8(0x18e)][0x0]??_0x31ed7d[_0x42b9c8(0x155)][0x0]??null;}function recoverInterruptedRunningNodes(_0x183715,_0x762fa4){const _0x139db4=_0x56e193,_0x15eff5=_0x183715[_0x139db4(0x18e)][_0x139db4(0x12f)](_0x500ecd=>!_0x183715[_0x139db4(0x1a6)][_0x139db4(0x1b5)](_0x500ecd));if(_0x15eff5['length']===0x0)return![];for(const _0x7d57d5 of _0x15eff5){const _0x38916a=_0x183715[_0x139db4(0x15c)][_0x7d57d5];_0x183715[_0x139db4(0x15c)][_0x7d57d5]={..._0x38916a??{'nodeId':_0x7d57d5,'visitCount':0x0},'status':_0x139db4(0x12b),'readyAt':undefined,'startedAt':undefined,'completedAt':undefined,'subagentCarrier':undefined,'taskSessionKey':undefined,'subagentRunId':undefined,'artifactPath':undefined,'summary':undefined,'error':undefined};}const _0xc4bd39=new Set([..._0x183715[_0x139db4(0xf7)],..._0x15eff5]);return _0x183715[_0x139db4(0x18e)]=[],_0x183715[_0x139db4(0xf7)]=_0x762fa4[_0x139db4(0xe5)][_0x139db4(0x184)](_0x3952f8=>_0x3952f8['id'])['filter'](_0x4f01df=>!_0x183715[_0x139db4(0x1a6)]['includes'](_0x4f01df)&&_0xc4bd39[_0x139db4(0x12a)](_0x4f01df)),syncSchedulerState(_0x183715,_0x762fa4),!![];}function computeReadyNodeIds(_0x4effc8,_0x3bf3c2){const _0x21c9f1=_0x56e193,_0x28e13f=new Set(_0x3bf3c2[_0x21c9f1(0x1a6)]),_0x3ab0c9=new Set(_0x3bf3c2[_0x21c9f1(0x18e)]),_0x50e66f=new Set(_0x3bf3c2[_0x21c9f1(0xf7)]),_0x12e5cf=new Map(_0x4effc8['nodes']['map'](_0xe8e9a7=>[_0xe8e9a7['id'],_0xe8e9a7])),_0x26e776=new Map(_0x3bf3c2[_0x21c9f1(0x1b3)][_0x21c9f1(0x184)](_0x533a73=>[_0x533a73['nodeId'],_0x533a73[_0x21c9f1(0x101)]]));return _0x4effc8[_0x21c9f1(0xe5)][_0x21c9f1(0x12f)](_0x5382bc=>_0x50e66f[_0x21c9f1(0x12a)](_0x5382bc['id'])&&!_0x3ab0c9[_0x21c9f1(0x12a)](_0x5382bc['id']))[_0x21c9f1(0x12f)](_0x106135=>isDependencySatisfied({'node':_0x106135,'completed':_0x28e13f,'nodeMap':_0x12e5cf,'selectedBranches':_0x26e776}))[_0x21c9f1(0x184)](_0x2c1e14=>_0x2c1e14['id']);}function isDependencySatisfied(_0x29bd67){const _0x1798b6=_0x56e193;if(_0x29bd67[_0x1798b6(0x176)][_0x1798b6(0x190)][_0x1798b6(0x1c4)]===0x0)return!![];const _0x32551c=_0x29bd67[_0x1798b6(0x176)][_0x1798b6(0x190)][_0x1798b6(0x184)](_0x3ae999=>{const _0x4cc4f2=_0x1798b6;if(!_0x29bd67[_0x4cc4f2(0xfa)]['has'](_0x3ae999))return![];const _0x5ef92e=_0x29bd67[_0x4cc4f2(0x139)][_0x4cc4f2(0x148)](_0x3ae999);if(_0x5ef92e?.[_0x4cc4f2(0x163)]!==_0x4cc4f2(0x1a0))return!![];const _0x2965d4=new Set(Object[_0x4cc4f2(0x180)](_0x5ef92e[_0x4cc4f2(0x1a8)]));if(!_0x2965d4[_0x4cc4f2(0x12a)](_0x29bd67['node']['id']))return!![];const _0x565c14=_0x29bd67[_0x4cc4f2(0x1ef)][_0x4cc4f2(0x148)](_0x5ef92e['id']);return Boolean(_0x565c14)&&_0x5ef92e['branches'][_0x565c14]===_0x29bd67[_0x4cc4f2(0x176)]['id'];});return _0x29bd67[_0x1798b6(0x176)]['dependencyMode']===_0x1798b6(0x127)?_0x32551c['some'](Boolean):_0x32551c[_0x1798b6(0x1d0)](Boolean);}function getReadyNodesInPlanOrder(_0x47709f,_0x300801){const _0x344d01=_0x56e193,_0x2cf639=new Set(_0x300801[_0x344d01(0x155)]);return _0x47709f[_0x344d01(0xe5)]['filter'](_0x100beb=>_0x2cf639[_0x344d01(0x12a)](_0x100beb['id']));}function selectExecutionBatch(_0x1650d6){const _0x317272=_0x56e193,_0x3a7e96=_0x1650d6[0x0];if(!_0x3a7e96)return[];if(_0x3a7e96['type']===_0x317272(0x1a0)||_0x3a7e96[_0x317272(0x163)]===_0x317272(0x1e2)||_0x3a7e96[_0x317272(0x163)]===_0x317272(0x181))return[_0x3a7e96];const _0x32592e=[];for(const _0x22d3c9 of _0x1650d6){if(_0x22d3c9[_0x317272(0x163)]!==_0x317272(0x1d5))break;_0x32592e[_0x317272(0xe4)](_0x22d3c9);if(_0x32592e[_0x317272(0x1c4)]>=MAX_PARALLEL_TASKS)break;}return _0x32592e;}function shouldCaptureFinalOutput(_0x31a63a,_0x20467e){const _0x4411ce=_0x56e193,_0xece555=_0x31a63a['nodes']['filter'](_0x1a2c1d=>_0x1a2c1d[_0x4411ce(0x190)]['includes'](_0x20467e));return _0xece555[_0x4411ce(0x1c4)]===0x0||_0xece555[_0x4411ce(0x1d0)](_0x53b0ce=>_0x53b0ce['type']===_0x4411ce(0x181));}function markPendingNodesSkipped(_0x12ebe7,_0x5a4f5a){const _0x5f06e7=_0x56e193,_0x583f93=new Set([..._0x12ebe7[_0x5f06e7(0xf7)],..._0x5a4f5a['nodes'][_0x5f06e7(0x184)](_0x558ae0=>_0x558ae0['id'])['filter'](_0x177956=>!_0x12ebe7[_0x5f06e7(0x1a6)]['includes'](_0x177956)&&!_0x12ebe7[_0x5f06e7(0x18e)][_0x5f06e7(0x1b5)](_0x177956)&&!_0x12ebe7['readyNodeIds'][_0x5f06e7(0x1b5)](_0x177956))]);for(const _0x51005b of _0x583f93){_0x12ebe7['nodeStates'][_0x51005b]={..._0x12ebe7[_0x5f06e7(0x15c)][_0x51005b]??{'nodeId':_0x51005b,'visitCount':0x0},'status':_0x5f06e7(0x125),'completedAt':new Date()['toISOString'](),'summary':'Skipped\x20because\x20the\x20workflow\x20completed\x20on\x20a\x20different\x20branch'};}_0x12ebe7['pendingNodeIds']=[],_0x12ebe7[_0x5f06e7(0x155)]=[],_0x12ebe7[_0x5f06e7(0x18e)]=[];}function uniqueNodeIds(_0x22c8e8){return[...new Set(_0x22c8e8)];}function pushUnique(_0x2a7fee,_0x9d0ea4){return _0x2a7fee['includes'](_0x9d0ea4)?_0x2a7fee:[..._0x2a7fee,_0x9d0ea4];}function asRecord(_0x406571){const _0x3cabf7=_0x56e193;return _0x406571&&typeof _0x406571==='object'&&!Array[_0x3cabf7(0x1eb)](_0x406571)?_0x406571:undefined;}function parseJudgeDecision(_0x1b48ad){const _0x2ee72d=_0x56e193,_0x5703d7=_0x1b48ad[_0x2ee72d(0x1f2)]();try{const _0x506c8f=extractJsonObject(_0x5703d7),_0x5e5bff=JSON[_0x2ee72d(0x14f)](_0x506c8f),_0x3d10db=typeof _0x5e5bff[_0x2ee72d(0x101)]===_0x2ee72d(0x1cf)?_0x5e5bff[_0x2ee72d(0x101)][_0x2ee72d(0x1f2)]():'';if(!_0x3d10db)throw new Error(_0x2ee72d(0x18c));const _0x1fd8a2=typeof _0x5e5bff['reason']===_0x2ee72d(0x1cf)&&_0x5e5bff['reason'][_0x2ee72d(0x1f2)]()?_0x5e5bff[_0x2ee72d(0x178)]['trim']():undefined;return{'decision':_0x3d10db,'reason':_0x1fd8a2};}catch{if(_0x5703d7&&!_0x5703d7['includes']('\x0a'))return{'decision':_0x5703d7};throw new Error('Judge\x20output\x20must\x20be\x20JSON\x20or\x20a\x20single\x20branch\x20token');}}async function failRun(_0x3c2d8c,_0x2c573a,_0x375182,_0xd80592){const _0x22994a=_0x56e193;_0x2c573a['status']=_0x22994a(0x1ed),_0x2c573a['failure']=_0xd80592,await appendTimeline(_0x3c2d8c,{'at':new Date()['toISOString'](),'type':'run_failed','runId':_0x2c573a[_0x22994a(0x143)],'nodeId':_0xd80592['nodeId'],'message':_0xd80592[_0x22994a(0x178)]}),await writeRunState(_0x3c2d8c,_0x2c573a),await writeResumeFile(_0x3c2d8c,_0x2c573a,_0x375182);}function startBackgroundSupervisorMonitor(_0xfb569b){const _0x407c86=_0x56e193;void monitorBackgroundSupervisor(_0xfb569b)[_0x407c86(0x1c1)](()=>{});}async function monitorBackgroundSupervisor(_0x479dcf){const _0x1ee9d9=_0x56e193,_0x4513c8=await waitForOwnProseSubagentRun({'api':_0x479dcf[_0x1ee9d9(0x133)],'runId':_0x479dcf[_0x1ee9d9(0x134)],'timeoutMs':_0x479dcf['waitTimeoutMs']});if(_0x4513c8[_0x1ee9d9(0x144)]===_0x1ee9d9(0x115))return;if(_0x4513c8[_0x1ee9d9(0x144)]==='ok'){const _0x327183=await waitForBackgroundRunToSettle(_0x479dcf[_0x1ee9d9(0x1c2)]);if(!_0x327183||_0x327183['status']===_0x1ee9d9(0x108))return;const _0x1878b4=await probeOwnProseSession({'sessionKey':_0x479dcf[_0x1ee9d9(0x1f7)]});_0x1878b4===!![]&&await cleanupOwnProseSession({'api':_0x479dcf[_0x1ee9d9(0x133)],'sessionKey':_0x479dcf[_0x1ee9d9(0x1f7)],'enabled':_0x479dcf[_0x1ee9d9(0x11f)],'deleteMode':_0x1ee9d9(0x1f6)});return;}await cleanupOwnProseSession({'api':_0x479dcf['api'],'sessionKey':_0x479dcf['supervisorSessionKey'],'enabled':_0x479dcf[_0x1ee9d9(0x11f)],'deleteMode':_0x1ee9d9(0x1f6)});const _0x44a370=await readRunState(_0x479dcf['runDir'])['catch'](()=>undefined);if(!_0x44a370||_0x44a370['status']!==_0x1ee9d9(0x108))return;const _0x143196=_0x1ee9d9(0x16e)+(_0x4513c8[_0x1ee9d9(0x18a)]??_0x479dcf['supervisorRunId']),_0x4f2220=new Date()[_0x1ee9d9(0x17b)]();_0x44a370[_0x1ee9d9(0x1d7)]={..._0x44a370[_0x1ee9d9(0x1d7)]??{'mode':_0x1ee9d9(0x1d7),'startedAt':_0x44a370[_0x1ee9d9(0x1bd)]},'mode':'background','status':_0x1ee9d9(0x1ed),'finishedAt':_0x4f2220,'supervisor':{..._0x44a370[_0x1ee9d9(0x1d7)]?.[_0x1ee9d9(0x1f1)]??{},'status':_0x1ee9d9(0x1ed),'sessionKey':_0x44a370['background']?.[_0x1ee9d9(0x1f1)]?.[_0x1ee9d9(0x164)]??_0x479dcf['supervisorSessionKey'],'runId':_0x44a370[_0x1ee9d9(0x1d7)]?.['supervisor']?.['runId']??_0x479dcf[_0x1ee9d9(0x134)],'finishedAt':_0x4f2220,'error':_0x4513c8[_0x1ee9d9(0x18a)]??_0x479dcf[_0x1ee9d9(0x134)]}},await failRun(_0x479dcf[_0x1ee9d9(0x1c2)],_0x44a370,_0x479dcf[_0x1ee9d9(0x19b)],{'reason':_0x143196});}async function waitForBackgroundRunToSettle(_0xdf98ea){const _0x1d3af8=_0x56e193;let _0x56aa70=await readRunState(_0xdf98ea)[_0x1d3af8(0x1c1)](()=>undefined);for(let _0x2e489c=0x0;_0x2e489c<BACKGROUND_STATE_SETTLE_RETRY_COUNT;_0x2e489c+=0x1){if(!_0x56aa70||_0x56aa70[_0x1d3af8(0x144)]!==_0x1d3af8(0x108))return _0x56aa70;await sleep(BACKGROUND_STATE_SETTLE_RETRY_DELAY_MS),_0x56aa70=await readRunState(_0xdf98ea)[_0x1d3af8(0x1c1)](()=>_0x56aa70);}return _0x56aa70;}async function runInBackground(_0x1405fc){const _0x5c269b=_0x56e193;let _0x362290=_0x1405fc[_0x5c269b(0x1d2)];try{return _0x1405fc[_0x5c269b(0x1d2)][_0x5c269b(0x1d7)]={..._0x1405fc[_0x5c269b(0x1d2)][_0x5c269b(0x1d7)]??{'mode':_0x5c269b(0x1d7),'startedAt':new Date()[_0x5c269b(0x17b)]()},'mode':_0x5c269b(0x1d7),'status':_0x5c269b(0x108)},_0x1405fc[_0x5c269b(0x1d2)][_0x5c269b(0x1d7)][_0x5c269b(0x1f1)]&&(_0x1405fc[_0x5c269b(0x1d2)][_0x5c269b(0x1d7)][_0x5c269b(0x1f1)]={..._0x1405fc[_0x5c269b(0x1d2)][_0x5c269b(0x1d7)]['supervisor'],'status':_0x5c269b(0x108),'startedAt':new Date()[_0x5c269b(0x17b)](),'error':undefined}),await writeRunState(_0x1405fc[_0x5c269b(0x1c2)],_0x1405fc['state']),await writeResumeFile(_0x1405fc[_0x5c269b(0x1c2)],_0x1405fc['state'],_0x1405fc[_0x5c269b(0x19b)]),_0x362290=await executePlan({..._0x1405fc}),await finalizeBackgroundState({'runDir':_0x1405fc['runDir'],'state':_0x362290,'plan':_0x1405fc[_0x5c269b(0x19b)]}),_0x362290[_0x5c269b(0x144)]!==_0x5c269b(0x117)&&await notifyBackgroundRunFinished({'runDir':_0x1405fc[_0x5c269b(0x1c2)],'state':_0x362290,'plan':_0x1405fc['plan']}),_0x362290;}finally{await cleanupOwnProseRunSessions({'api':_0x1405fc['api'],'state':_0x362290,'enabled':_0x1405fc[_0x5c269b(0x11f)],'includeSupervisor':![],'deleteMode':_0x5c269b(0x1f6)}),await cleanupOwnProseSession({'api':_0x1405fc[_0x5c269b(0x133)],'sessionKey':_0x362290['background']?.[_0x5c269b(0x1f1)]?.[_0x5c269b(0x164)]??'','enabled':_0x1405fc[_0x5c269b(0x11f)],'deleteMode':_0x5c269b(0x1f6)}),requestBackgroundSupervisorCleanupProcess({'state':_0x362290,'runDir':_0x1405fc[_0x5c269b(0x1c2)],'enabled':_0x1405fc[_0x5c269b(0x11f)]});}}async function notifyBackgroundRunFinished(_0x267c90){const _0x3177ca=_0x56e193,_0x17c239=_0x267c90[_0x3177ca(0x1d2)][_0x3177ca(0x1d7)];if(!_0x17c239)return;const _0x3413cf=new Date()[_0x3177ca(0x17b)](),_0x2d83dc=_0x17c239[_0x3177ca(0x14e)]?.['trim']();if(!_0x2d83dc){_0x17c239[_0x3177ca(0x1d8)]={'status':_0x3177ca(0x125),'attemptedAt':_0x3413cf},await writeRunState(_0x267c90['runDir'],_0x267c90['state']),await writeResumeFile(_0x267c90[_0x3177ca(0x1c2)],_0x267c90[_0x3177ca(0x1d2)],_0x267c90[_0x3177ca(0x19b)]),await appendTimeline(_0x267c90[_0x3177ca(0x1c2)],{'at':_0x3413cf,'type':'notification_skipped','runId':_0x267c90[_0x3177ca(0x1d2)]['runId'],'message':_0x3177ca(0x1c9)});return;}_0x17c239['notification']={'status':_0x3177ca(0x12b),'attemptedAt':_0x3413cf},await writeRunState(_0x267c90[_0x3177ca(0x1c2)],_0x267c90[_0x3177ca(0x1d2)]),await writeResumeFile(_0x267c90[_0x3177ca(0x1c2)],_0x267c90[_0x3177ca(0x1d2)],_0x267c90[_0x3177ca(0x19b)]);try{const _0x54db81=await notifyAgentSession({'sessionKey':_0x2d83dc,'message':await buildOwnProseNotificationMessage(_0x267c90[_0x3177ca(0x1c2)],_0x267c90[_0x3177ca(0x1d2)],_0x267c90[_0x3177ca(0x19b)])});_0x17c239[_0x3177ca(0x1d8)]={'status':_0x3177ca(0x14c),'attemptedAt':_0x3413cf,'queuedAt':new Date()[_0x3177ca(0x17b)](),'runId':_0x54db81[_0x3177ca(0x143)]};const _0xc2d604=_0x17c239['notification']['queuedAt']??new Date()[_0x3177ca(0x17b)]();await appendTimeline(_0x267c90[_0x3177ca(0x1c2)],{'at':_0xc2d604,'type':'notification_sent','runId':_0x267c90[_0x3177ca(0x1d2)][_0x3177ca(0x143)],'message':_0x3177ca(0x12d)+_0x2d83dc+_0x3177ca(0x159)+_0x54db81['runId']});}catch(_0x339567){const _0xbab661=_0x339567 instanceof Error?_0x339567[_0x3177ca(0x129)]:String(_0x339567);_0x17c239[_0x3177ca(0x1d8)]={'status':_0x3177ca(0x1ed),'attemptedAt':_0x3413cf,'error':_0xbab661},await appendTimeline(_0x267c90[_0x3177ca(0x1c2)],{'at':new Date()[_0x3177ca(0x17b)](),'type':'notification_failed','runId':_0x267c90['state'][_0x3177ca(0x143)],'message':_0xbab661});}await writeRunState(_0x267c90['runDir'],_0x267c90[_0x3177ca(0x1d2)]),await writeResumeFile(_0x267c90[_0x3177ca(0x1c2)],_0x267c90[_0x3177ca(0x1d2)],_0x267c90['plan']);}async function queueBackgroundSupervisorRun(_0x29a163){const _0x419f6f=_0x56e193,_0x14a2ed=scopeAgentSessionKey(_0x29a163[_0x419f6f(0x1ba)],_0x419f6f(0x132)+_0x29a163[_0x419f6f(0x143)]),_0x12e990=await runOwnProseSubagent({'api':_0x29a163[_0x419f6f(0x133)],'sessionKey':_0x14a2ed,'agentId':_0x29a163[_0x419f6f(0x1ba)]?.[_0x419f6f(0x1f2)]()||undefined,'message':[_0x419f6f(0x14a),'Run\x20the\x20`own_prose_background_run`\x20tool\x20with\x20runId\x20\x22'+_0x29a163[_0x419f6f(0x143)]+'\x22.',_0x419f6f(0x10e)+_0x29a163[_0x419f6f(0x1c2)]+'\x22.',_0x419f6f(0x1ca),_0x419f6f(0xf1)+NO_REPLY_TOKEN+'.'][_0x419f6f(0x165)]('\x0a'),'extraSystemPrompt':['This\x20is\x20an\x20internal\x20own-prose\x20background\x20worker\x20request.',_0x419f6f(0xfd),_0x419f6f(0x12e),_0x419f6f(0x168),'Do\x20not\x20call\x20any\x20other\x20own-prose\x20tool.',_0x419f6f(0x122)+NO_REPLY_TOKEN+'.']['join']('\x0a'),'label':_0x419f6f(0x19a)+_0x29a163[_0x419f6f(0x143)]});return{'runId':_0x12e990[_0x419f6f(0x143)],'sessionKey':_0x14a2ed,'carrier':_0x12e990[_0x419f6f(0x1e6)]};}function requestBackgroundSupervisorCleanupProcess(_0x4d3ff8){const _0x31e36c=_0x56e193;if(!_0x4d3ff8['enabled'])return;const _0x2936c7=_0x4d3ff8[_0x31e36c(0x1d2)][_0x31e36c(0x1d7)]?.['supervisor']?.[_0x31e36c(0x164)]?.[_0x31e36c(0x1f2)]();if(!_0x2936c7||_0x4d3ff8[_0x31e36c(0x1d2)][_0x31e36c(0x144)]===_0x31e36c(0x108))return;spawnOwnProseCleanupProcess(_0x4d3ff8[_0x31e36c(0x1c2)]);}async function runOwnProseSubagent(_0x5cfc5b){const _0x1746e9=_0x56e193,_0x379490=await queueAgentSessionRun({'sessionKey':_0x5cfc5b[_0x1746e9(0x164)],'message':_0x5cfc5b[_0x1746e9(0x129)],..._0x5cfc5b['agentId']?{'agentId':_0x5cfc5b['agentId']}:{},..._0x5cfc5b[_0x1746e9(0x1d6)]?{'extraSystemPrompt':_0x5cfc5b[_0x1746e9(0x1d6)]}:{},..._0x5cfc5b[_0x1746e9(0x1c0)]?{'label':_0x5cfc5b[_0x1746e9(0x1c0)]}:{},..._0x5cfc5b[_0x1746e9(0xed)]?{'timeoutMs':_0x5cfc5b[_0x1746e9(0xed)]}:{},..._0x5cfc5b[_0x1746e9(0x1e7)]?{'idempotencyKey':_0x5cfc5b[_0x1746e9(0x1e7)]}:{},..._0x5cfc5b['deliver']!=null?{'deliver':_0x5cfc5b[_0x1746e9(0x116)]}:{},..._0x5cfc5b[_0x1746e9(0x16b)]??_0x5cfc5b[_0x1746e9(0x137)]?{'provider':_0x5cfc5b['providerOverride']??_0x5cfc5b['inheritedProvider']}:{},..._0x5cfc5b[_0x1746e9(0x160)]??_0x5cfc5b[_0x1746e9(0x1c7)]?{'model':_0x5cfc5b[_0x1746e9(0x160)]??_0x5cfc5b['inheritedModel']}:{}});return{'runId':_0x379490[_0x1746e9(0x143)],'carrier':'gateway_session'};}async function waitForOwnProseSubagentRun(_0x20516b){const _0xe35ec8=_0x56e193,_0x2749df=await waitForAgentSessionRun({'runId':_0x20516b[_0xe35ec8(0x143)],'timeoutMs':_0x20516b['timeoutMs']});return{'status':_0x2749df[_0xe35ec8(0x144)]==='ok'||_0x2749df['status']===_0xe35ec8(0x18a)||_0x2749df[_0xe35ec8(0x144)]===_0xe35ec8(0x115)?_0x2749df[_0xe35ec8(0x144)]:_0xe35ec8(0x18a),..._0x2749df[_0xe35ec8(0x18a)]?{'error':_0x2749df[_0xe35ec8(0x18a)]}:{}};}async function getOwnProseSubagentMessages(_0x3b297d){const _0x18b910=_0x56e193;return getAgentSessionMessages({'sessionKey':_0x3b297d[_0x18b910(0x164)],'limit':_0x3b297d['limit']});}function collectOwnProseSessionKeys(_0x42501d,_0x25d5d7){const _0x502438=_0x56e193,_0x4d790a=new Set();for(const _0x27393e of Object[_0x502438(0x180)](_0x42501d[_0x502438(0x15c)])){const _0x130372=_0x27393e['taskSessionKey']?.[_0x502438(0x1f2)]();_0x130372&&_0x4d790a['add'](_0x130372);}if(_0x25d5d7[_0x502438(0x149)]){const _0x477ec2=_0x42501d[_0x502438(0x1d7)]?.[_0x502438(0x1f1)]?.[_0x502438(0x164)]?.[_0x502438(0x1f2)]();_0x477ec2&&_0x4d790a[_0x502438(0x112)](_0x477ec2);}return[..._0x4d790a];}async function buildOwnProseNotificationMessage(_0x1620ed,_0x3ba4b4,_0x43b9db){const _0x197c4c=_0x56e193,_0x5fc744=await readFinalOutputMaybe(_0x3ba4b4[_0x197c4c(0x175)]);return[_0x197c4c(0x1bb),_0x197c4c(0x18d)+_0x3ba4b4[_0x197c4c(0x143)],_0x197c4c(0x174)+_0x43b9db[_0x197c4c(0x1da)],_0x197c4c(0x1ea)+_0x3ba4b4['status'],_0x3ba4b4[_0x197c4c(0x147)]?'Current\x20node:\x20'+_0x3ba4b4['currentNodeId']:undefined,_0x3ba4b4['readyNodeIds']['length']>0x0?'Ready\x20nodes:\x20'+_0x3ba4b4['readyNodeIds'][_0x197c4c(0x165)](',\x20'):undefined,_0x3ba4b4['runningNodeIds'][_0x197c4c(0x1c4)]>0x0?_0x197c4c(0x104)+_0x3ba4b4[_0x197c4c(0x18e)]['join'](',\x20'):undefined,_0x3ba4b4['failure']?'Failure:\x20'+_0x3ba4b4[_0x197c4c(0xe7)]['reason']:undefined,_0x5fc744?'':undefined,_0x5fc744?'Final\x20output:':undefined,_0x5fc744]['filter'](_0x2b6320=>Boolean(_0x2b6320))['join']('\x0a');}async function readFinalOutputMaybe(_0x337397){const _0x39dad6=_0x56e193;if(!_0x337397)return undefined;const _0x1dc827=await _0x56f899['readFile'](_0x337397,_0x39dad6(0x1e3))[_0x39dad6(0x1c1)](()=>''),_0x125341=_0x1dc827[_0x39dad6(0x1f2)]();return _0x125341||undefined;}function summarizeText(_0x1ec615,_0x4bafd3=0xa0){const _0x2deb22=_0x56e193;return truncateText(_0x1ec615['replace'](/\s+/g,'\x20')[_0x2deb22(0x1f2)](),_0x4bafd3);}function truncateText(_0x289a44,_0x50e4a1){const _0x396bd1=_0x56e193;if(_0x289a44[_0x396bd1(0x1c4)]<=_0x50e4a1)return _0x289a44;return _0x289a44['slice'](0x0,_0x50e4a1-0x1)+_0x396bd1(0x196);}function sanitizeId(_0x23d097){const _0x37aa30=_0x56e193;return _0x23d097[_0x37aa30(0x1de)](/[^a-zA-Z0-9._-]+/g,'_');}function extractEmbeddedRunOutputText(_0x552983){const _0x2dc883=_0x56e193;if(!Array[_0x2dc883(0x1eb)](_0x552983))return undefined;for(let _0x4b4804=_0x552983[_0x2dc883(0x1c4)]-0x1;_0x4b4804>=0x0;_0x4b4804-=0x1){const _0x335205=_0x552983[_0x4b4804];if(_0x335205?.[_0x2dc883(0xe3)])continue;const _0x3b00cb=_0x335205?.[_0x2dc883(0x118)]?.[_0x2dc883(0x1f2)]();if(_0x3b00cb)return _0x3b00cb;}return undefined;}function extractSubagentOutputText(_0x519dc0){const _0x3a182a=_0x56e193;for(let _0x1017c6=_0x519dc0[_0x3a182a(0x1c4)]-0x1;_0x1017c6>=0x0;_0x1017c6-=0x1){const _0x506500=extractAssistantText(_0x519dc0[_0x1017c6]);if(_0x506500)return _0x506500;}throw new Error(_0x3a182a(0x15b));}function extractAssistantText(_0x448a57){const _0x4db12f=_0x56e193,_0xbb6128=readRecordMaybe(_0x448a57),_0x20b16d=readRecordMaybe(_0xbb6128?.['message'])??_0xbb6128;if(readStringMaybe(_0x20b16d?.['role'])!==_0x4db12f(0x103))return undefined;const _0xee9a60=_0x20b16d?.['content'];if(typeof _0xee9a60===_0x4db12f(0x1cf)&&_0xee9a60[_0x4db12f(0x1f2)]())return _0xee9a60['trim']();if(!Array[_0x4db12f(0x1eb)](_0xee9a60))return undefined;const _0x54b63a=_0xee9a60[_0x4db12f(0x184)](_0x3382b4=>{const _0x7369f9=_0x4db12f,_0x5364a5=readRecordMaybe(_0x3382b4);if(typeof _0x5364a5?.['text']===_0x7369f9(0x1cf)&&_0x5364a5[_0x7369f9(0x118)][_0x7369f9(0x1f2)]())return _0x5364a5[_0x7369f9(0x118)][_0x7369f9(0x1f2)]();return undefined;})[_0x4db12f(0x12f)](_0x4a026e=>Boolean(_0x4a026e));return _0x54b63a['length']>0x0?_0x54b63a['join']('\x0a')[_0x4db12f(0x1f2)]():undefined;}function extractJsonObject(_0xe06393){const _0x36e593=_0x56e193,_0x360b81=_0xe06393['trim']();if(_0x360b81[_0x36e593(0x186)]('{')&&_0x360b81[_0x36e593(0x194)]('}'))return _0x360b81;const _0x420390=/```(?:json)?\s*([\s\S]*?)```/i[_0x36e593(0x1dc)](_0x360b81);if(_0x420390?.[0x1]?.[_0x36e593(0x1f2)]())return _0x420390[0x1]['trim']();const _0x45e6ef=_0x360b81[_0x36e593(0x13a)]('{'),_0x2cdd39=_0x360b81['lastIndexOf']('}');if(_0x45e6ef>=0x0&&_0x2cdd39>_0x45e6ef)return _0x360b81[_0x36e593(0x1a5)](_0x45e6ef,_0x2cdd39+0x1);throw new Error(_0x36e593(0x1e8));}function readRecordMaybe(_0x3e3b88){const _0x2b443f=_0x56e193;return _0x3e3b88&&typeof _0x3e3b88===_0x2b443f(0x1cd)&&!Array[_0x2b443f(0x1eb)](_0x3e3b88)?_0x3e3b88:undefined;}function readStringMaybe(_0x130842){const _0x73e02a=_0x56e193;return typeof _0x130842===_0x73e02a(0x1cf)&&_0x130842[_0x73e02a(0x1f2)]()?_0x130842[_0x73e02a(0x1f2)]():undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x985bcd,_0x153f80){const _0x21214a=_0x5090,_0x476689=_0x985bcd();while(!![]){try{const _0x1d540f=parseInt(_0x21214a(0x89))/0x1+parseInt(_0x21214a(0x71))/0x2*(-parseInt(_0x21214a(0x80))/0x3)+parseInt(_0x21214a(0x82))/0x4+parseInt(_0x21214a(0x8c))/0x5*(parseInt(_0x21214a(0x7b))/0x6)+parseInt(_0x21214a(0x9e))/0x7*(parseInt(_0x21214a(0x83))/0x8)+parseInt(_0x21214a(0xa6))/0x9*(-parseInt(_0x21214a(0xd5))/0xa)+parseInt(_0x21214a(0xde))/0xb*(-parseInt(_0x21214a(0xdf))/0xc);if(_0x1d540f===_0x153f80)break;else _0x476689['push'](_0x476689['shift']());}catch(_0x485087){_0x476689['push'](_0x476689['shift']());}}}(_0x3a9a,0x47959));import{randomUUID}from'node:crypto';import _0x1f6fca from'node:path';const OWN_PROSE_EMBEDDED_LANE='nested';export async function compilePlan(_0x2a3bf1){const _0x3d52c0=_0x5090,_0x589558=buildCompilePrompt(_0x2a3bf1['program'],_0x2a3bf1[_0x3d52c0(0x8e)]),_0x1d9649=randomUUID(),_0x2c6e68=await runEmbeddedPrompt({'api':_0x2a3bf1['api'],'workspaceDir':_0x2a3bf1[_0x3d52c0(0xa9)],'runDir':_0x2a3bf1['runDir'],'sessionId':'own-prose:compile:'+_0x2a3bf1['program']['name']+':'+_0x1d9649,'runId':'own-prose-compile:'+_0x2a3bf1[_0x3d52c0(0x7e)]['name']+':'+_0x1d9649,'prompt':_0x589558,'provider':_0x2a3bf1['provider'],'model':_0x2a3bf1[_0x3d52c0(0x6d)],'timeoutMs':_0x2a3bf1[_0x3d52c0(0x8b)]});return parseCompiledPlan(_0x2c6e68,_0x2a3bf1['program'],_0x2a3bf1[_0x3d52c0(0x8e)]);}function buildCompilePrompt(_0xb59e6b,_0x556f8f){const _0x400b01=_0x5090,_0x5d095a=JSON[_0x400b01(0x78)](Object[_0x400b01(0xa5)](_0x556f8f)['map'](_0x2346ea=>({'id':_0x2346ea['id'],'role':_0x2346ea[_0x400b01(0xb7)],'instructions':_0x2346ea['instructions'],'doneWhen':_0x2346ea['doneWhen'],'permissions':_0x2346ea[_0x400b01(0x81)]})),null,0x2);return[_0x400b01(0xd2),_0x400b01(0x79),_0x400b01(0xc0),'',_0x400b01(0xdc),'-\x20Use\x20only\x20agents\x20listed\x20below.',_0x400b01(0x7a),'-\x20task\x20nodes\x20must\x20set:\x20id,\x20type,\x20title,\x20agentId,\x20goal,\x20instructions,\x20doneWhen.\x20Prefer\x20dependsOn/contextFrom/dependencyMode.\x20Legacy\x20next\x20is\x20accepted\x20and\x20will\x20be\x20normalized.',_0x400b01(0xc6),'-\x20finish\x20nodes\x20must\x20set:\x20id,\x20type,\x20title.\x20Prefer\x20dependsOn/dependencyMode.',_0x400b01(0x77),_0x400b01(0x97),'-\x20maxSteps\x20must\x20not\x20exceed\x20the\x20program\x20maxSteps.',_0x400b01(0x7d),'',_0x400b01(0xa1),JSON[_0x400b01(0x78)]({'name':_0xb59e6b[_0x400b01(0xb6)],'goal':_0xb59e6b[_0x400b01(0xe5)],'workflow':_0xb59e6b[_0x400b01(0xe1)],'constraints':_0xb59e6b['constraints'],'outputContract':_0xb59e6b[_0x400b01(0x73)]},null,0x2),'',_0x400b01(0xba),_0x5d095a,'',_0x400b01(0xb5),_0x400b01(0x98)][_0x400b01(0xe3)]('\x0a');}function parseCompiledPlan(_0x3626e7,_0x3bdcbc,_0x1f52fd){const _0x7331b0=_0x5090,_0x1b0868=extractJsonObject(_0x3626e7),_0x312639=JSON[_0x7331b0(0xb2)](_0x1b0868),_0x52cf65=Array[_0x7331b0(0xdd)](_0x312639[_0x7331b0(0xb0)])?_0x312639[_0x7331b0(0xb0)]:undefined;if(!_0x52cf65||_0x52cf65[_0x7331b0(0xb8)]===0x0)throw new Error(_0x7331b0(0x7c));const _0x3b0a04=normalizeNodes(_0x52cf65,_0x1f52fd),_0x2f2143=optionalString(_0x312639[_0x7331b0(0x8a)])??resolveEntryNodeId(_0x3b0a04),_0x36115c=normalizeMaxSteps(_0x312639['maxSteps'],_0x3bdcbc['constraints'][_0x7331b0(0x96)],computeRequiredMaxSteps(_0x3b0a04)),_0x4b6247=normalizeStringArray(_0x312639[_0x7331b0(0x93)]);return{'version':0x1,'planId':_0x3bdcbc['name']+':'+Date[_0x7331b0(0xcb)](),'programName':_0x3bdcbc['name'],'summary':requireString(_0x312639[_0x7331b0(0xd7)],_0x7331b0(0xd7)),'entryNodeId':_0x2f2143,'maxSteps':_0x36115c,'branchVocabulary':_0x4b6247,'nodes':_0x3b0a04};}function normalizeNodes(_0x422d2f,_0x16d07c){const _0x223565=_0x5090,_0x567717=_0x422d2f[_0x223565(0xa8)]((_0x30c649,_0x5bcb55)=>normalizeNode(_0x30c649,_0x5bcb55,_0x16d07c)),_0x5b06c5=new Map(_0x567717[_0x223565(0xa8)](_0x53c9c3=>[_0x53c9c3['id'],new Set(_0x53c9c3[_0x223565(0x75)])])),_0x52324d=new Set();for(const _0x507edd of _0x567717){if(_0x507edd['type']==='task'&&_0x507edd['next']){const _0x35179d=_0x5b06c5['get'](_0x507edd[_0x223565(0xaf)]);if(!_0x35179d)throw new Error('Compiled\x20task\x20node\x20\x22'+_0x507edd['id']+_0x223565(0x95)+_0x507edd[_0x223565(0xaf)]+'\x22');const _0x5b2d63=_0x35179d?.['size']??0x0;_0x35179d[_0x223565(0xb1)](_0x507edd['id']);const _0x5da9c2=_0x567717[_0x223565(0xaa)](_0x25c944=>_0x25c944['id']===_0x507edd[_0x223565(0xaf)]);_0x35179d['size']>0x1&&_0x5b2d63>0x0&&_0x5da9c2&&!_0x5da9c2['dependsOnWasExplicit']&&!_0x5da9c2[_0x223565(0xca)]&&_0x52324d['add'](_0x507edd[_0x223565(0xaf)]);continue;}if(_0x507edd[_0x223565(0x9b)]==='judge')for(const _0x3c3afa of Object[_0x223565(0xa5)](_0x507edd[_0x223565(0xab)])){const _0x3f385c=_0x5b06c5[_0x223565(0x7f)](_0x3c3afa);if(!_0x3f385c)throw new Error(_0x223565(0xbc)+_0x507edd['id']+'\x22\x20points\x20to\x20missing\x20node\x20\x22'+_0x3c3afa+'\x22');_0x3f385c['add'](_0x507edd['id']);}}return _0x567717['map'](_0x2eed26=>{const _0x153593=_0x223565,_0x5c305e=[..._0x5b06c5['get'](_0x2eed26['id'])??new Set()];if(_0x2eed26[_0x153593(0x9b)]===_0x153593(0x6f))return{'id':_0x2eed26['id'],'type':_0x153593(0x6f),'title':_0x2eed26[_0x153593(0x91)],'dependsOn':_0x5c305e,'dependencyMode':_0x2eed26[_0x153593(0x70)]===_0x153593(0xd8)&&_0x52324d[_0x153593(0xac)](_0x2eed26['id'])?_0x153593(0x6c):_0x2eed26[_0x153593(0x70)]};if(_0x2eed26[_0x153593(0x9b)]===_0x153593(0xcc))return{'id':_0x2eed26['id'],'type':'task','title':_0x2eed26[_0x153593(0x91)],'agentId':_0x2eed26[_0x153593(0xe4)],'goal':_0x2eed26[_0x153593(0xe5)],'instructions':_0x2eed26[_0x153593(0xc3)],'doneWhen':_0x2eed26[_0x153593(0xc8)],'dependsOn':_0x5c305e,'dependencyMode':_0x2eed26[_0x153593(0x70)]===_0x153593(0xd8)&&_0x52324d[_0x153593(0xac)](_0x2eed26['id'])?'any':_0x2eed26[_0x153593(0x70)],'contextFrom':_0x2eed26['contextFrom']['length']>0x0?_0x2eed26[_0x153593(0xa7)]:_0x5c305e,'permissions':_0x16d07c[_0x2eed26[_0x153593(0xe4)]]['permissions']};return{'id':_0x2eed26['id'],'type':_0x153593(0x86),'title':_0x2eed26['title'],'agentId':_0x2eed26['agentId'],'question':_0x2eed26['question'],'instructions':_0x2eed26[_0x153593(0xc3)],'dependsOn':_0x5c305e,'dependencyMode':_0x2eed26['dependencyMode']===_0x153593(0xd8)&&_0x52324d['has'](_0x2eed26['id'])?_0x153593(0x6c):_0x2eed26[_0x153593(0x70)],'contextFrom':_0x2eed26[_0x153593(0xa7)]['length']>0x0?_0x2eed26['contextFrom']:_0x5c305e,'allowedBranches':_0x2eed26[_0x153593(0x84)],'branches':_0x2eed26['branches'],'permissions':_0x16d07c[_0x2eed26[_0x153593(0xe4)]][_0x153593(0x81)]};});}function normalizeNode(_0x44975e,_0x577def,_0x591509){const _0x140343=_0x5090;if(!_0x44975e||typeof _0x44975e!==_0x140343(0xd4)||Array['isArray'](_0x44975e))throw new Error(_0x140343(0xcf)+(_0x577def+0x1)+_0x140343(0xe2));const _0x56106a=_0x44975e,_0x5a439c=requireString(_0x56106a['type'],'nodes['+_0x577def+_0x140343(0xd0)),_0x29d669=requireString(_0x56106a['id'],'nodes['+_0x577def+_0x140343(0x9c)),_0x51d33e=requireString(_0x56106a[_0x140343(0x91)],_0x140343(0xe0)+_0x577def+_0x140343(0x92));if(_0x5a439c===_0x140343(0x6f))return{'id':_0x29d669,'type':_0x140343(0x6f),'title':_0x51d33e,'dependsOn':normalizeStringArray(_0x56106a[_0x140343(0x75)]),'dependencyMode':normalizeDependencyMode(_0x56106a['dependencyMode']),'dependencyModeWasExplicit':Object[_0x140343(0xbf)](_0x56106a,'dependencyMode'),'dependsOnWasExplicit':Object[_0x140343(0xbf)](_0x56106a,_0x140343(0x75))};const _0x39b41a=requireString(_0x56106a[_0x140343(0xe4)],_0x140343(0xe0)+_0x577def+_0x140343(0xe8)),_0x14c61a=_0x591509[_0x39b41a];if(!_0x14c61a)throw new Error(_0x140343(0xcf)+(_0x577def+0x1)+'\x20references\x20unknown\x20agent\x20\x22'+_0x39b41a+'\x22');if(_0x5a439c===_0x140343(0xcc))return{'id':_0x29d669,'type':'task','title':_0x51d33e,'agentId':_0x39b41a,'goal':requireString(_0x56106a['goal'],'nodes['+_0x577def+_0x140343(0xa0)),'instructions':requireString(_0x56106a[_0x140343(0xc3)],_0x140343(0xe0)+_0x577def+_0x140343(0xa2)),'doneWhen':normalizeStringArray(_0x56106a['doneWhen']),'dependsOn':normalizeStringArray(_0x56106a[_0x140343(0x75)]),'dependencyMode':normalizeDependencyMode(_0x56106a[_0x140343(0x70)]),'dependencyModeWasExplicit':Object['hasOwn'](_0x56106a,_0x140343(0x70)),'contextFrom':normalizeStringArray(_0x56106a['contextFrom']),'dependsOnWasExplicit':Object[_0x140343(0xbf)](_0x56106a,_0x140343(0x75)),'next':normalizeNullableString(_0x56106a[_0x140343(0xaf)])};if(_0x5a439c===_0x140343(0x86)){const _0x4edd70=normalizeStringArray(_0x56106a[_0x140343(0x84)]),_0x380162=readRecord(_0x56106a[_0x140343(0xab)],_0x140343(0xe0)+_0x577def+_0x140343(0xbd)),_0x3b678e=Object[_0x140343(0xdb)](Object['entries'](_0x380162)[_0x140343(0xa8)](([_0x4cd79d,_0x3f8084])=>[_0x4cd79d,requireString(_0x3f8084,_0x140343(0xe0)+_0x577def+_0x140343(0xc1)+_0x4cd79d)]));return{'id':_0x29d669,'type':_0x140343(0x86),'title':_0x51d33e,'agentId':_0x39b41a,'question':requireString(_0x56106a[_0x140343(0xb9)],_0x140343(0xe0)+_0x577def+_0x140343(0xad)),'instructions':requireString(_0x56106a[_0x140343(0xc3)],_0x140343(0xe0)+_0x577def+_0x140343(0xa2)),'dependsOn':normalizeStringArray(_0x56106a[_0x140343(0x75)]),'dependencyMode':normalizeDependencyMode(_0x56106a[_0x140343(0x70)]),'dependencyModeWasExplicit':Object['hasOwn'](_0x56106a,_0x140343(0x70)),'contextFrom':normalizeStringArray(_0x56106a['contextFrom']),'dependsOnWasExplicit':Object['hasOwn'](_0x56106a,_0x140343(0x75)),'allowedBranches':_0x4edd70,'branches':_0x3b678e};}throw new Error(_0x140343(0xcf)+(_0x577def+0x1)+_0x140343(0x76)+_0x5a439c+'\x22');}async function runEmbeddedPrompt(_0x42756f){const _0x2caf9f=_0x5090,_0x38be29=await _0x42756f[_0x2caf9f(0x72)]['runtime']['agent']['runEmbeddedPiAgent']({'sessionId':_0x42756f['sessionId'],'runId':_0x42756f[_0x2caf9f(0xce)],'sessionFile':_0x1f6fca[_0x2caf9f(0xe3)](_0x42756f[_0x2caf9f(0xa4)],_0x2caf9f(0xc7),sanitizeId(_0x42756f[_0x2caf9f(0xe7)])+'.jsonl'),'workspaceDir':_0x42756f[_0x2caf9f(0xa9)],'config':_0x42756f[_0x2caf9f(0x72)][_0x2caf9f(0x6a)],'lane':OWN_PROSE_EMBEDDED_LANE,'prompt':_0x42756f[_0x2caf9f(0xae)],'timeoutMs':_0x42756f[_0x2caf9f(0x8b)],..._0x42756f[_0x2caf9f(0x6b)]?{'provider':_0x42756f['provider']}:{},..._0x42756f[_0x2caf9f(0x6d)]?{'model':_0x42756f[_0x2caf9f(0x6d)]}:{}}),_0x4a8660=extractEmbeddedRunOutputText(_0x38be29[_0x2caf9f(0x88)]);if(!_0x4a8660){const _0x3f9efc=_0x38be29[_0x2caf9f(0x90)]?.[_0x2caf9f(0x99)]?.[_0x2caf9f(0xd6)]?.[_0x2caf9f(0xa3)]();throw new Error(_0x3f9efc||_0x2caf9f(0x6e));}return _0x4a8660;}function _0x5090(_0x2c1f71,_0x40fa19){_0x2c1f71=_0x2c1f71-0x6a;const _0x3a9aea=_0x3a9a();let _0x509073=_0x3a9aea[_0x2c1f71];return _0x509073;}function extractEmbeddedRunOutputText(_0x4e65f8){const _0x2b1178=_0x5090;if(!Array['isArray'](_0x4e65f8))return undefined;for(let _0x11d1a5=_0x4e65f8['length']-0x1;_0x11d1a5>=0x0;_0x11d1a5-=0x1){const _0x9a02f2=_0x4e65f8[_0x11d1a5];if(_0x9a02f2?.[_0x2b1178(0xb4)])continue;const _0x1c78e1=_0x9a02f2?.[_0x2b1178(0xc9)]?.['trim']();if(_0x1c78e1)return _0x1c78e1;}return undefined;}function extractJsonObject(_0x290c7d){const _0x122d64=_0x5090,_0x57ce45=_0x290c7d[_0x122d64(0xa3)]();if(_0x57ce45[_0x122d64(0xb3)]('{')&&_0x57ce45['endsWith']('}'))return _0x57ce45;const _0x4ca061=/```(?:json)?\s*([\s\S]*?)```/i[_0x122d64(0xc5)](_0x57ce45);if(_0x4ca061?.[0x1]?.[_0x122d64(0xa3)]())return _0x4ca061[0x1]['trim']();const _0xdb7aa1=_0x57ce45[_0x122d64(0xbb)]('{'),_0x2f57d9=_0x57ce45[_0x122d64(0x8f)]('}');if(_0xdb7aa1>=0x0&&_0x2f57d9>_0xdb7aa1)return _0x57ce45[_0x122d64(0xd3)](_0xdb7aa1,_0x2f57d9+0x1);throw new Error(_0x122d64(0x85));}function normalizeMaxSteps(_0x378c64,_0x1c0da0,_0x12ad0b){const _0x4d6141=_0x5090;if(_0x12ad0b>_0x1c0da0)throw new Error(_0x4d6141(0x87)+_0x12ad0b+_0x4d6141(0xbe)+_0x1c0da0);const _0x44c317=typeof _0x378c64==='number'&&Number[_0x4d6141(0x94)](_0x378c64)&&_0x378c64>=0x1?Math[_0x4d6141(0xd1)](_0x378c64):_0x1c0da0;return Math[_0x4d6141(0xc2)](Math[_0x4d6141(0x74)](_0x44c317,_0x1c0da0),_0x12ad0b);}function computeRequiredMaxSteps(_0x2d187a){const _0x19871c=_0x5090,_0x4d5411=new Map();for(const _0x2e397e of _0x2d187a){_0x4d5411[_0x19871c(0x9f)](_0x2e397e['id'],[]);}for(const _0x51215b of _0x2d187a){for(const _0x4e7081 of _0x51215b[_0x19871c(0x75)]){_0x4d5411[_0x19871c(0x7f)](_0x4e7081)?.[_0x19871c(0xd9)](_0x51215b['id']);}}const _0x1e2fee=_0x2d187a[_0x19871c(0xcd)](_0x29adc8=>_0x29adc8[_0x19871c(0x75)][_0x19871c(0xb8)]===0x0)[_0x19871c(0xa8)](_0xf71f0=>_0xf71f0['id']),_0x21076a=new Set(),_0x75d55c=[..._0x1e2fee];while(_0x75d55c[_0x19871c(0xb8)]>0x0){const _0x55c80c=_0x75d55c[_0x19871c(0x9a)]();if(_0x21076a[_0x19871c(0xac)](_0x55c80c))continue;_0x21076a[_0x19871c(0xb1)](_0x55c80c);for(const _0x5d1800 of _0x4d5411['get'](_0x55c80c)??[]){_0x75d55c['push'](_0x5d1800);}}return _0x21076a[_0x19871c(0x8d)];}function _0x3a9a(){const _0x3a9972=['prompt','next','nodes','add','parse','startsWith','isError','Return\x20this\x20JSON\x20shape:','name','role','length','question','Available\x20agents:','indexOf','Compiled\x20judge\x20node\x20\x22','].branches','\x20maxSteps\x20but\x20program\x20allows\x20only\x20','hasOwn','Return\x20JSON\x20only.\x20Do\x20not\x20wrap\x20it\x20in\x20markdown\x20fences.','].branches.','max','instructions','Compiled\x20plan\x20must\x20contain\x20at\x20least\x20one\x20executable\x20root\x20node','exec','-\x20judge\x20nodes\x20must\x20set:\x20id,\x20type,\x20title,\x20agentId,\x20question,\x20instructions,\x20allowedBranches,\x20branches.\x20Prefer\x20dependsOn/contextFrom/dependencyMode.','sessions','doneWhen','text','dependencyModeWasExplicit','now','task','filter','runId','Compiled\x20node\x20','].type','trunc','You\x20are\x20the\x20own-prose\x20workflow\x20compiler.','slice','object','315830PVuKLW','message','summary','all','push','replace','fromEntries','Rules:','isArray','3620782URyADo','12LzXBcF','nodes[','workflow','\x20must\x20be\x20an\x20object','join','agentId','goal','string','sessionId','].agentId','config','provider','any','model','Embedded\x20compiler\x20run\x20returned\x20no\x20output','finish','dependencyMode','1048AhDWFb','api','outputContract','min','dependsOn','\x20has\x20unsupported\x20type\x20\x22','-\x20Do\x20not\x20include\x20permissions\x20in\x20the\x20output.','stringify','Convert\x20the\x20user\x27s\x20natural-language\x20workflow\x20into\x20a\x20strict\x20JSON\x20execution\x20plan.','-\x20Supported\x20node\x20types:\x20task,\x20judge,\x20finish.','30XaCedX','Compiled\x20plan\x20must\x20contain\x20a\x20non-empty\x20nodes\x20array','-\x20If\x20allowLoops\x20is\x20false,\x20do\x20not\x20create\x20loops.','program','get','1185yzAZlQ','permissions','422184mTFMEu','1284568XvMoDi','allowedBranches','Unable\x20to\x20locate\x20JSON\x20object\x20in\x20compiler\x20output','judge','Compiled\x20plan\x20requires\x20at\x20least\x20','payloads','114872LrvAxz','entryNodeId','timeoutMs','479945glmbvz','size','agents','lastIndexOf','meta','title','].title','branchVocabulary','isFinite','\x22\x20points\x20to\x20missing\x20next\x20node\x20\x22','maxSteps','-\x20entryNodeId\x20must\x20point\x20to\x20the\x20first\x20executable\x20node.','{\x22summary\x22:\x22...\x22,\x22entryNodeId\x22:\x22...\x22,\x22maxSteps\x22:12,\x22branchVocabulary\x22:[\x22...\x22],\x22nodes\x22:[{\x22id\x22:\x22...\x22,\x22type\x22:\x22task\x22,\x22title\x22:\x22...\x22,\x22agentId\x22:\x22...\x22,\x22goal\x22:\x22...\x22,\x22instructions\x22:\x22...\x22,\x22doneWhen\x22:[\x22...\x22],\x22dependsOn\x22:[\x22...\x22],\x22dependencyMode\x22:\x22all\x22,\x22contextFrom\x22:[\x22...\x22]},{\x22id\x22:\x22...\x22,\x22type\x22:\x22judge\x22,\x22title\x22:\x22...\x22,\x22agentId\x22:\x22...\x22,\x22question\x22:\x22...\x22,\x22instructions\x22:\x22...\x22,\x22dependsOn\x22:[\x22...\x22],\x22dependencyMode\x22:\x22all\x22,\x22contextFrom\x22:[\x22...\x22],\x22allowedBranches\x22:[\x22...\x22],\x22branches\x22:{\x22branch\x22:\x22target\x22}},{\x22id\x22:\x22finish\x22,\x22type\x22:\x22finish\x22,\x22title\x22:\x22Workflow\x20complete\x22,\x22dependsOn\x22:[\x22...\x22],\x22dependencyMode\x22:\x22any\x22}]}','error','pop','type','].id','\x20must\x20be\x20a\x20non-empty\x20string','7ImzUoF','set','].goal','Program:','].instructions','trim','runDir','values','9OziWCl','contextFrom','map','workspaceDir','find','branches','has','].question'];_0x3a9a=function(){return _0x3a9972;};return _0x3a9a();}function normalizeStringArray(_0x14786f){const _0x10e22a=_0x5090;if(!Array[_0x10e22a(0xdd)](_0x14786f))return[];return _0x14786f['map'](_0x5c1332=>typeof _0x5c1332==='string'?_0x5c1332[_0x10e22a(0xa3)]():undefined)[_0x10e22a(0xcd)](_0x45800e=>Boolean(_0x45800e));}function normalizeNullableString(_0x1749e9){if(_0x1749e9==null)return null;return requireString(_0x1749e9,'next');}function resolveEntryNodeId(_0x16acb4){const _0x595991=_0x5090,_0x13d20f=_0x16acb4[_0x595991(0xaa)](_0x5b4daf=>_0x5b4daf[_0x595991(0x75)]['length']===0x0&&_0x5b4daf[_0x595991(0x9b)]!==_0x595991(0x6f));if(!_0x13d20f)throw new Error(_0x595991(0xc4));return _0x13d20f['id'];}function optionalString(_0x5092c6){const _0x3fb8ba=_0x5090;return typeof _0x5092c6==='string'&&_0x5092c6[_0x3fb8ba(0xa3)]()?_0x5092c6['trim']():undefined;}function normalizeDependencyMode(_0x52b2cf){const _0x49f274=_0x5090;return _0x52b2cf===_0x49f274(0x6c)?_0x49f274(0x6c):_0x49f274(0xd8);}function requireString(_0x4c93ef,_0x3b778d){const _0x3a9be0=_0x5090;if(typeof _0x4c93ef!==_0x3a9be0(0xe6)||!_0x4c93ef[_0x3a9be0(0xa3)]())throw new Error(_0x3b778d+_0x3a9be0(0x9d));return _0x4c93ef[_0x3a9be0(0xa3)]();}function readRecord(_0x158bd5,_0x2c9686){const _0x58dcf9=_0x5090;if(!_0x158bd5||typeof _0x158bd5!==_0x58dcf9(0xd4)||Array[_0x58dcf9(0xdd)](_0x158bd5))throw new Error(_0x2c9686+_0x58dcf9(0xe2));return _0x158bd5;}function sanitizeId(_0x2d3344){const _0x40fbb3=_0x5090;return _0x2d3344[_0x40fbb3(0xda)](/[^a-zA-Z0-9._-]+/g,'_');}
|
|
1
|
+
function _0x1741(_0x56e6a5,_0x25e001){_0x56e6a5=_0x56e6a5-0x89;const _0xe4a95c=_0xe4a9();let _0x174104=_0xe4a95c[_0x56e6a5];return _0x174104;}(function(_0x249cdd,_0x3c684b){const _0x344e20=_0x1741,_0x1af0a3=_0x249cdd();while(!![]){try{const _0x326580=parseInt(_0x344e20(0xcb))/0x1*(parseInt(_0x344e20(0xdc))/0x2)+parseInt(_0x344e20(0x9f))/0x3*(-parseInt(_0x344e20(0xe8))/0x4)+-parseInt(_0x344e20(0x92))/0x5*(-parseInt(_0x344e20(0xc0))/0x6)+-parseInt(_0x344e20(0xd2))/0x7+-parseInt(_0x344e20(0xa9))/0x8+parseInt(_0x344e20(0x100))/0x9+-parseInt(_0x344e20(0xf7))/0xa*(parseInt(_0x344e20(0xd6))/0xb);if(_0x326580===_0x3c684b)break;else _0x1af0a3['push'](_0x1af0a3['shift']());}catch(_0x3ed3e4){_0x1af0a3['push'](_0x1af0a3['shift']());}}}(_0xe4a9,0xcd044));import{randomUUID}from'node:crypto';import _0x29081e from'node:path';const OWN_PROSE_EMBEDDED_LANE='nested';export async function compilePlan(_0x4cc497){const _0x9326bf=_0x1741,_0xa3a856=buildCompilePrompt(_0x4cc497[_0x9326bf(0xb5)],_0x4cc497['agents']),_0x3fd431=randomUUID(),_0x548d81=await runEmbeddedPrompt({'api':_0x4cc497[_0x9326bf(0xd0)],'workspaceDir':_0x4cc497['workspaceDir'],'runDir':_0x4cc497[_0x9326bf(0xa8)],'sessionId':_0x9326bf(0x108)+_0x4cc497[_0x9326bf(0xb5)][_0x9326bf(0xf9)]+':'+_0x3fd431,'runId':_0x9326bf(0x104)+_0x4cc497[_0x9326bf(0xb5)][_0x9326bf(0xf9)]+':'+_0x3fd431,'prompt':_0xa3a856,'provider':_0x4cc497[_0x9326bf(0xd4)],'model':_0x4cc497['model'],'timeoutMs':_0x4cc497[_0x9326bf(0xd9)]});return parseCompiledPlan(_0x548d81,_0x4cc497['program'],_0x4cc497[_0x9326bf(0xae)]);}function buildCompilePrompt(_0x1efc47,_0x58afad){const _0x3dc8b1=_0x1741,_0x4caffd=JSON['stringify'](Object[_0x3dc8b1(0xbc)](_0x58afad)[_0x3dc8b1(0x91)](_0x4a191f=>({'id':_0x4a191f['id'],'role':_0x4a191f[_0x3dc8b1(0xc3)],'instructions':_0x4a191f[_0x3dc8b1(0x10e)],'doneWhen':_0x4a191f[_0x3dc8b1(0xcf)],'permissions':_0x4a191f['permissions']})),null,0x2);return[_0x3dc8b1(0xc4),_0x3dc8b1(0x103),_0x3dc8b1(0xb9),'','Rules:',_0x3dc8b1(0x8a),'-\x20Supported\x20node\x20types:\x20task,\x20judge,\x20ask,\x20finish.',_0x3dc8b1(0x111),_0x3dc8b1(0xad),_0x3dc8b1(0xcd),_0x3dc8b1(0xe9),_0x3dc8b1(0x90),_0x3dc8b1(0x105),'-\x20maxSteps\x20must\x20not\x20exceed\x20the\x20program\x20maxSteps.',_0x3dc8b1(0xdf),_0x3dc8b1(0xb1),'',_0x3dc8b1(0x10a),JSON[_0x3dc8b1(0xf0)]({'name':_0x1efc47[_0x3dc8b1(0xf9)],'goal':_0x1efc47[_0x3dc8b1(0xe2)],'workflow':_0x1efc47[_0x3dc8b1(0x107)],'constraints':_0x1efc47[_0x3dc8b1(0x112)],'outputContract':_0x1efc47[_0x3dc8b1(0x98)]},null,0x2),'',_0x3dc8b1(0xdd),_0x4caffd,'','Return\x20this\x20JSON\x20shape:',_0x3dc8b1(0x9c)][_0x3dc8b1(0xec)]('\x0a');}function parseCompiledPlan(_0x42815b,_0x2868fd,_0x46d8b5){const _0x55e6ab=_0x1741,_0x5f2e1a=extractJsonObject(_0x42815b),_0x470723=JSON[_0x55e6ab(0xbd)](_0x5f2e1a),_0x2e0706=Array[_0x55e6ab(0xde)](_0x470723['nodes'])?_0x470723[_0x55e6ab(0xd7)]:undefined;if(!_0x2e0706||_0x2e0706['length']===0x0)throw new Error(_0x55e6ab(0xe7));const _0x242662=normalizeNodes(_0x2e0706,_0x46d8b5),_0x1ef825=optionalString(_0x470723['entryNodeId'])??resolveEntryNodeId(_0x242662),_0x39b981=normalizeMaxSteps(_0x470723[_0x55e6ab(0xaf)],_0x2868fd['constraints'][_0x55e6ab(0xaf)],computeRequiredMaxSteps(_0x242662)),_0x5bccd7=normalizeStringArray(_0x470723[_0x55e6ab(0xf1)]);return{'version':0x1,'planId':_0x2868fd[_0x55e6ab(0xf9)]+':'+Date[_0x55e6ab(0xa7)](),'programName':_0x2868fd['name'],'summary':requireString(_0x470723[_0x55e6ab(0xed)],_0x55e6ab(0xed)),'entryNodeId':_0x1ef825,'maxSteps':_0x39b981,'branchVocabulary':_0x5bccd7,'nodes':_0x242662};}function normalizeNodes(_0x18a2ef,_0x5e4b34){const _0x467a7d=_0x1741,_0x35e210=_0x18a2ef['map']((_0x2d9d8b,_0x323ded)=>normalizeNode(_0x2d9d8b,_0x323ded,_0x5e4b34)),_0x2a3954=new Map(_0x35e210[_0x467a7d(0x91)](_0x25ef23=>[_0x25ef23['id'],new Set(_0x25ef23[_0x467a7d(0xd8)])])),_0xa48cff=new Set();for(const _0x202e77 of _0x35e210){if(_0x202e77['type']===_0x467a7d(0xbf)&&_0x202e77[_0x467a7d(0x110)]){const _0x53bb33=_0x2a3954[_0x467a7d(0x8b)](_0x202e77[_0x467a7d(0x110)]);if(!_0x53bb33)throw new Error(_0x467a7d(0xfa)+_0x202e77['id']+_0x467a7d(0xb3)+_0x202e77[_0x467a7d(0x110)]+'\x22');const _0x29ff48=_0x53bb33?.[_0x467a7d(0xcc)]??0x0;_0x53bb33[_0x467a7d(0xe0)](_0x202e77['id']);const _0x2cc078=_0x35e210[_0x467a7d(0x10c)](_0xae918d=>_0xae918d['id']===_0x202e77['next']);_0x53bb33[_0x467a7d(0xcc)]>0x1&&_0x29ff48>0x0&&_0x2cc078&&!_0x2cc078[_0x467a7d(0xfc)]&&!_0x2cc078[_0x467a7d(0xe3)]&&_0xa48cff[_0x467a7d(0xe0)](_0x202e77[_0x467a7d(0x110)]);continue;}if(_0x202e77[_0x467a7d(0xb6)]==='judge')for(const _0x2f4b4e of Object['values'](_0x202e77[_0x467a7d(0xb7)])){const _0x414ebc=_0x2a3954[_0x467a7d(0x8b)](_0x2f4b4e);if(!_0x414ebc)throw new Error(_0x467a7d(0xbe)+_0x202e77['id']+_0x467a7d(0xc7)+_0x2f4b4e+'\x22');_0x414ebc[_0x467a7d(0xe0)](_0x202e77['id']);}}return _0x35e210[_0x467a7d(0x91)](_0x4b8a5f=>{const _0x3dfacb=_0x467a7d,_0x487d54=[..._0x2a3954[_0x3dfacb(0x8b)](_0x4b8a5f['id'])??new Set()];if(_0x4b8a5f[_0x3dfacb(0xb6)]===_0x3dfacb(0xaa))return{'id':_0x4b8a5f['id'],'type':'finish','title':_0x4b8a5f[_0x3dfacb(0x102)],'dependsOn':_0x487d54,'dependencyMode':_0x4b8a5f[_0x3dfacb(0xe1)]===_0x3dfacb(0xa2)&&_0xa48cff[_0x3dfacb(0xfd)](_0x4b8a5f['id'])?_0x3dfacb(0xda):_0x4b8a5f[_0x3dfacb(0xe1)]};if(_0x4b8a5f[_0x3dfacb(0xb6)]===_0x3dfacb(0xbf))return{'id':_0x4b8a5f['id'],'type':_0x3dfacb(0xbf),'title':_0x4b8a5f[_0x3dfacb(0x102)],'agentId':_0x4b8a5f[_0x3dfacb(0x106)],'goal':_0x4b8a5f[_0x3dfacb(0xe2)],'instructions':_0x4b8a5f[_0x3dfacb(0x10e)],'doneWhen':_0x4b8a5f[_0x3dfacb(0xcf)],'dependsOn':_0x487d54,'dependencyMode':_0x4b8a5f[_0x3dfacb(0xe1)]===_0x3dfacb(0xa2)&&_0xa48cff[_0x3dfacb(0xfd)](_0x4b8a5f['id'])?_0x3dfacb(0xda):_0x4b8a5f[_0x3dfacb(0xe1)],'contextFrom':_0x4b8a5f[_0x3dfacb(0xc1)][_0x3dfacb(0x94)]>0x0?_0x4b8a5f[_0x3dfacb(0xc1)]:_0x487d54,'permissions':_0x5e4b34[_0x4b8a5f[_0x3dfacb(0x106)]][_0x3dfacb(0x9e)]};if(_0x4b8a5f['type']==='ask')return{'id':_0x4b8a5f['id'],'type':_0x3dfacb(0x8e),'title':_0x4b8a5f[_0x3dfacb(0x102)],'question':_0x4b8a5f[_0x3dfacb(0xe5)],'inputKey':_0x4b8a5f[_0x3dfacb(0xc5)],'resumeNodeId':_0x4b8a5f[_0x3dfacb(0xca)],'maxAttempts':_0x4b8a5f[_0x3dfacb(0x10b)],'dependsOn':_0x487d54,'dependencyMode':_0x4b8a5f[_0x3dfacb(0xe1)]===_0x3dfacb(0xa2)&&_0xa48cff['has'](_0x4b8a5f['id'])?_0x3dfacb(0xda):_0x4b8a5f[_0x3dfacb(0xe1)],'contextFrom':_0x4b8a5f[_0x3dfacb(0xc1)][_0x3dfacb(0x94)]>0x0?_0x4b8a5f['contextFrom']:_0x487d54};return{'id':_0x4b8a5f['id'],'type':_0x3dfacb(0xa6),'title':_0x4b8a5f['title'],'agentId':_0x4b8a5f[_0x3dfacb(0x106)],'question':_0x4b8a5f[_0x3dfacb(0xe5)],'instructions':_0x4b8a5f['instructions'],'dependsOn':_0x487d54,'dependencyMode':_0x4b8a5f[_0x3dfacb(0xe1)]===_0x3dfacb(0xa2)&&_0xa48cff['has'](_0x4b8a5f['id'])?'any':_0x4b8a5f[_0x3dfacb(0xe1)],'contextFrom':_0x4b8a5f['contextFrom']['length']>0x0?_0x4b8a5f['contextFrom']:_0x487d54,'allowedBranches':_0x4b8a5f[_0x3dfacb(0xf2)],'branches':_0x4b8a5f[_0x3dfacb(0xb7)],'permissions':_0x5e4b34[_0x4b8a5f['agentId']][_0x3dfacb(0x9e)]};});}function normalizeNode(_0x57d661,_0x3ff8f7,_0x34569e){const _0xa64d5c=_0x1741;if(!_0x57d661||typeof _0x57d661!==_0xa64d5c(0xf4)||Array[_0xa64d5c(0xde)](_0x57d661))throw new Error(_0xa64d5c(0xe6)+(_0x3ff8f7+0x1)+'\x20must\x20be\x20an\x20object');const _0x575cca=_0x57d661,_0x2d1285=requireString(_0x575cca['type'],_0xa64d5c(0x8f)+_0x3ff8f7+_0xa64d5c(0xf6)),_0x160ea0=requireString(_0x575cca['id'],_0xa64d5c(0x8f)+_0x3ff8f7+'].id'),_0x356168=requireString(_0x575cca[_0xa64d5c(0x102)],_0xa64d5c(0x8f)+_0x3ff8f7+_0xa64d5c(0xc6));if(_0x2d1285===_0xa64d5c(0xaa))return{'id':_0x160ea0,'type':'finish','title':_0x356168,'dependsOn':normalizeStringArray(_0x575cca[_0xa64d5c(0xd8)]),'dependencyMode':normalizeDependencyMode(_0x575cca[_0xa64d5c(0xe1)]),'dependencyModeWasExplicit':Object['hasOwn'](_0x575cca,'dependencyMode'),'dependsOnWasExplicit':Object[_0xa64d5c(0xb2)](_0x575cca,_0xa64d5c(0xd8))};if(_0x2d1285===_0xa64d5c(0xbf)){const _0x493b26=requireString(_0x575cca[_0xa64d5c(0x106)],'nodes['+_0x3ff8f7+'].agentId'),_0x4daa08=_0x34569e[_0x493b26];if(!_0x4daa08)throw new Error('Compiled\x20node\x20'+(_0x3ff8f7+0x1)+_0xa64d5c(0xee)+_0x493b26+'\x22');return{'id':_0x160ea0,'type':_0xa64d5c(0xbf),'title':_0x356168,'agentId':_0x493b26,'goal':requireString(_0x575cca[_0xa64d5c(0xe2)],_0xa64d5c(0x8f)+_0x3ff8f7+_0xa64d5c(0xba)),'instructions':requireString(_0x575cca[_0xa64d5c(0x10e)],_0xa64d5c(0x8f)+_0x3ff8f7+_0xa64d5c(0xb0)),'doneWhen':normalizeStringArray(_0x575cca['doneWhen']),'dependsOn':normalizeStringArray(_0x575cca['dependsOn']),'dependencyMode':normalizeDependencyMode(_0x575cca[_0xa64d5c(0xe1)]),'dependencyModeWasExplicit':Object[_0xa64d5c(0xb2)](_0x575cca,'dependencyMode'),'contextFrom':normalizeStringArray(_0x575cca['contextFrom']),'dependsOnWasExplicit':Object[_0xa64d5c(0xb2)](_0x575cca,_0xa64d5c(0xd8)),'next':normalizeNullableString(_0x575cca[_0xa64d5c(0x110)])};}if(_0x2d1285===_0xa64d5c(0xa6)){const _0x2c6d35=requireString(_0x575cca[_0xa64d5c(0x106)],_0xa64d5c(0x8f)+_0x3ff8f7+_0xa64d5c(0xce)),_0x575fbc=_0x34569e[_0x2c6d35];if(!_0x575fbc)throw new Error(_0xa64d5c(0xe6)+(_0x3ff8f7+0x1)+'\x20references\x20unknown\x20agent\x20\x22'+_0x2c6d35+'\x22');const _0x60846c=normalizeStringArray(_0x575cca[_0xa64d5c(0xf2)]),_0x3386fb=readRecord(_0x575cca['branches'],_0xa64d5c(0x8f)+_0x3ff8f7+_0xa64d5c(0x109)),_0x28dc10=Object['fromEntries'](Object[_0xa64d5c(0xab)](_0x3386fb)[_0xa64d5c(0x91)](([_0x50e2b7,_0x32e7f1])=>[_0x50e2b7,requireString(_0x32e7f1,'nodes['+_0x3ff8f7+_0xa64d5c(0xfb)+_0x50e2b7)]));return{'id':_0x160ea0,'type':_0xa64d5c(0xa6),'title':_0x356168,'agentId':_0x2c6d35,'question':requireString(_0x575cca['question'],_0xa64d5c(0x8f)+_0x3ff8f7+'].question'),'instructions':requireString(_0x575cca[_0xa64d5c(0x10e)],'nodes['+_0x3ff8f7+'].instructions'),'dependsOn':normalizeStringArray(_0x575cca[_0xa64d5c(0xd8)]),'dependencyMode':normalizeDependencyMode(_0x575cca['dependencyMode']),'dependencyModeWasExplicit':Object[_0xa64d5c(0xb2)](_0x575cca,_0xa64d5c(0xe1)),'contextFrom':normalizeStringArray(_0x575cca[_0xa64d5c(0xc1)]),'dependsOnWasExplicit':Object[_0xa64d5c(0xb2)](_0x575cca,'dependsOn'),'allowedBranches':_0x60846c,'branches':_0x28dc10};}if(_0x2d1285===_0xa64d5c(0x8e))return{'id':_0x160ea0,'type':_0xa64d5c(0x8e),'title':_0x356168,'question':requireString(_0x575cca[_0xa64d5c(0xe5)],'nodes['+_0x3ff8f7+_0xa64d5c(0xd1)),'inputKey':requireString(_0x575cca[_0xa64d5c(0xc5)],_0xa64d5c(0x8f)+_0x3ff8f7+_0xa64d5c(0x9d)),'resumeNodeId':requireString(_0x575cca[_0xa64d5c(0xca)],_0xa64d5c(0x8f)+_0x3ff8f7+_0xa64d5c(0xff)),'maxAttempts':normalizePositiveInteger(_0x575cca[_0xa64d5c(0x10b)],0x1),'dependsOn':normalizeStringArray(_0x575cca[_0xa64d5c(0xd8)]),'dependencyMode':normalizeDependencyMode(_0x575cca[_0xa64d5c(0xe1)]),'dependencyModeWasExplicit':Object[_0xa64d5c(0xb2)](_0x575cca,_0xa64d5c(0xe1)),'contextFrom':normalizeStringArray(_0x575cca[_0xa64d5c(0xc1)]),'dependsOnWasExplicit':Object[_0xa64d5c(0xb2)](_0x575cca,_0xa64d5c(0xd8))};throw new Error('Compiled\x20node\x20'+(_0x3ff8f7+0x1)+_0xa64d5c(0xbb)+_0x2d1285+'\x22');}async function runEmbeddedPrompt(_0x33b722){const _0x102b31=_0x1741,_0x24d07d=await _0x33b722[_0x102b31(0xd0)][_0x102b31(0x10f)][_0x102b31(0xa3)]['runEmbeddedPiAgent']({'sessionId':_0x33b722[_0x102b31(0xb8)],'runId':_0x33b722[_0x102b31(0x99)],'sessionFile':_0x29081e[_0x102b31(0xec)](_0x33b722[_0x102b31(0xa8)],'sessions',sanitizeId(_0x33b722[_0x102b31(0xb8)])+_0x102b31(0x9b)),'workspaceDir':_0x33b722[_0x102b31(0xfe)],'config':_0x33b722['api'][_0x102b31(0xd3)],'lane':OWN_PROSE_EMBEDDED_LANE,'prompt':_0x33b722[_0x102b31(0xc9)],'timeoutMs':_0x33b722[_0x102b31(0xd9)],..._0x33b722[_0x102b31(0xd4)]?{'provider':_0x33b722[_0x102b31(0xd4)]}:{},..._0x33b722['model']?{'model':_0x33b722[_0x102b31(0xa4)]}:{}}),_0x18c273=extractEmbeddedRunOutputText(_0x24d07d[_0x102b31(0xe4)]);if(!_0x18c273){const _0x59f0bd=_0x24d07d[_0x102b31(0x95)]?.[_0x102b31(0xf8)]?.[_0x102b31(0x8d)]?.[_0x102b31(0xea)]();throw new Error(_0x59f0bd||_0x102b31(0x89));}return _0x18c273;}function extractEmbeddedRunOutputText(_0x4b58b8){const _0x7616f0=_0x1741;if(!Array[_0x7616f0(0xde)](_0x4b58b8))return undefined;for(let _0x4df83d=_0x4b58b8[_0x7616f0(0x94)]-0x1;_0x4df83d>=0x0;_0x4df83d-=0x1){const _0x5e4a45=_0x4b58b8[_0x4df83d];if(_0x5e4a45?.[_0x7616f0(0xeb)])continue;const _0x48b35a=_0x5e4a45?.['text']?.[_0x7616f0(0xea)]();if(_0x48b35a)return _0x48b35a;}return undefined;}function extractJsonObject(_0x2cc1db){const _0x48254e=_0x1741,_0x245bd6=_0x2cc1db[_0x48254e(0xea)]();if(_0x245bd6[_0x48254e(0xf3)]('{')&&_0x245bd6['endsWith']('}'))return _0x245bd6;const _0x4f930b=/```(?:json)?\s*([\s\S]*?)```/i[_0x48254e(0xa0)](_0x245bd6);if(_0x4f930b?.[0x1]?.[_0x48254e(0xea)]())return _0x4f930b[0x1][_0x48254e(0xea)]();const _0x4aa9c3=_0x245bd6[_0x48254e(0x101)]('{'),_0x28a25e=_0x245bd6['lastIndexOf']('}');if(_0x4aa9c3>=0x0&&_0x28a25e>_0x4aa9c3)return _0x245bd6[_0x48254e(0xc2)](_0x4aa9c3,_0x28a25e+0x1);throw new Error(_0x48254e(0x96));}function normalizeMaxSteps(_0x114fad,_0x169b75,_0x4d2817){const _0x19559a=_0x1741;if(_0x4d2817>_0x169b75)throw new Error(_0x19559a(0xef)+_0x4d2817+_0x19559a(0xb4)+_0x169b75);const _0x552ea5=typeof _0x114fad===_0x19559a(0x10d)&&Number[_0x19559a(0xd5)](_0x114fad)&&_0x114fad>=0x1?Math[_0x19559a(0x9a)](_0x114fad):_0x169b75;return Math[_0x19559a(0xf5)](Math[_0x19559a(0x93)](_0x552ea5,_0x169b75),_0x4d2817);}function computeRequiredMaxSteps(_0x5691e2){const _0x3c6077=_0x1741,_0xe814a5=new Map();for(const _0x3ace7b of _0x5691e2){_0xe814a5['set'](_0x3ace7b['id'],[]);}for(const _0x10daa5 of _0x5691e2){for(const _0x381a70 of _0x10daa5['dependsOn']){_0xe814a5['get'](_0x381a70)?.[_0x3c6077(0xac)](_0x10daa5['id']);}}const _0x2c99c3=_0x5691e2['filter'](_0x5ba32b=>_0x5ba32b[_0x3c6077(0xd8)][_0x3c6077(0x94)]===0x0)[_0x3c6077(0x91)](_0x372bce=>_0x372bce['id']),_0x27b0d4=new Set(),_0x59e0d7=[..._0x2c99c3];while(_0x59e0d7['length']>0x0){const _0x479c35=_0x59e0d7[_0x3c6077(0xa5)]();if(_0x27b0d4[_0x3c6077(0xfd)](_0x479c35))continue;_0x27b0d4[_0x3c6077(0xe0)](_0x479c35);for(const _0x478f7f of _0xe814a5['get'](_0x479c35)??[]){_0x59e0d7[_0x3c6077(0xac)](_0x478f7f);}}return _0x27b0d4[_0x3c6077(0xcc)];}function normalizeStringArray(_0x185a0b){const _0x3bc1c8=_0x1741;if(!Array['isArray'](_0x185a0b))return[];return _0x185a0b[_0x3bc1c8(0x91)](_0x876e98=>typeof _0x876e98===_0x3bc1c8(0xdb)?_0x876e98[_0x3bc1c8(0xea)]():undefined)['filter'](_0x99838f=>Boolean(_0x99838f));}function normalizeNullableString(_0x862bab){const _0x257414=_0x1741;if(_0x862bab==null)return null;return requireString(_0x862bab,_0x257414(0x110));}function normalizePositiveInteger(_0x3d9530,_0x30fc6f){const _0xce998d=_0x1741;if(_0x3d9530==null)return _0x30fc6f;if(typeof _0x3d9530!=='number'||!Number[_0xce998d(0xd5)](_0x3d9530)||_0x3d9530<0x1)throw new Error(_0xce998d(0x8c));return Math[_0xce998d(0x9a)](_0x3d9530);}function resolveEntryNodeId(_0x203c26){const _0x4722db=_0x1741,_0x282cab=_0x203c26['find'](_0xf62671=>_0xf62671[_0x4722db(0xd8)][_0x4722db(0x94)]===0x0&&_0xf62671[_0x4722db(0xb6)]!==_0x4722db(0xaa));if(!_0x282cab)throw new Error('Compiled\x20plan\x20must\x20contain\x20at\x20least\x20one\x20executable\x20root\x20node');return _0x282cab['id'];}function _0xe4a9(){const _0x1f0e1a=['agent','model','pop','judge','now','runDir','3702400YpqFZM','finish','entries','push','-\x20judge\x20nodes\x20must\x20set:\x20id,\x20type,\x20title,\x20agentId,\x20question,\x20instructions,\x20allowedBranches,\x20branches.\x20Prefer\x20dependsOn/contextFrom/dependencyMode.','agents','maxSteps','].instructions','-\x20ask\x20nodes\x20may\x20resume\x20an\x20earlier\x20node\x20via\x20resumeNodeId;\x20this\x20human-in-the-loop\x20retry\x20path\x20is\x20allowed\x20even\x20when\x20allowLoops\x20is\x20false.','hasOwn','\x22\x20points\x20to\x20missing\x20next\x20node\x20\x22','\x20maxSteps\x20but\x20program\x20allows\x20only\x20','program','type','branches','sessionId','Return\x20JSON\x20only.\x20Do\x20not\x20wrap\x20it\x20in\x20markdown\x20fences.','].goal','\x20has\x20unsupported\x20type\x20\x22','values','parse','Compiled\x20judge\x20node\x20\x22','task','1656YhaSWk','contextFrom','slice','role','You\x20are\x20the\x20own-prose\x20workflow\x20compiler.','inputKey','].title','\x22\x20points\x20to\x20missing\x20node\x20\x22','\x20must\x20be\x20an\x20object','prompt','resumeNodeId','379akMqjl','size','-\x20ask\x20nodes\x20must\x20set:\x20id,\x20type,\x20title,\x20question,\x20inputKey,\x20resumeNodeId.\x20Prefer\x20dependsOn/contextFrom/dependencyMode.\x20Optional\x20maxAttempts\x20defaults\x20to\x201.','].agentId','doneWhen','api','].question','7271194WniRaH','config','provider','isFinite','528JHUKMw','nodes','dependsOn','timeoutMs','any','string','8356mmYpBe','Available\x20agents:','isArray','-\x20If\x20allowLoops\x20is\x20false,\x20do\x20not\x20create\x20loops.','add','dependencyMode','goal','dependencyModeWasExplicit','payloads','question','Compiled\x20node\x20','Compiled\x20plan\x20must\x20contain\x20a\x20non-empty\x20nodes\x20array','2599228roKvOH','-\x20finish\x20nodes\x20must\x20set:\x20id,\x20type,\x20title.\x20Prefer\x20dependsOn/dependencyMode.','trim','isError','join','summary','\x20references\x20unknown\x20agent\x20\x22','Compiled\x20plan\x20requires\x20at\x20least\x20','stringify','branchVocabulary','allowedBranches','startsWith','object','max','].type','199820QtAIRQ','error','name','Compiled\x20task\x20node\x20\x22','].branches.','dependsOnWasExplicit','has','workspaceDir','].resumeNodeId','15108327DMhhBW','indexOf','title','Convert\x20the\x20user\x27s\x20natural-language\x20workflow\x20into\x20a\x20strict\x20JSON\x20execution\x20plan.','own-prose-compile:','-\x20entryNodeId\x20must\x20point\x20to\x20the\x20first\x20executable\x20node.','agentId','workflow','own-prose:compile:','].branches','Program:','maxAttempts','find','number','instructions','runtime','next','-\x20task\x20nodes\x20must\x20set:\x20id,\x20type,\x20title,\x20agentId,\x20goal,\x20instructions,\x20doneWhen.\x20Prefer\x20dependsOn/contextFrom/dependencyMode.\x20Legacy\x20next\x20is\x20accepted\x20and\x20will\x20be\x20normalized.','constraints','Embedded\x20compiler\x20run\x20returned\x20no\x20output','-\x20Use\x20only\x20agents\x20listed\x20below.','get','maxAttempts\x20must\x20be\x20a\x20positive\x20integer','message','ask','nodes[','-\x20Do\x20not\x20include\x20permissions\x20in\x20the\x20output.','map','12465uMUiOY','min','length','meta','Unable\x20to\x20locate\x20JSON\x20object\x20in\x20compiler\x20output','replace','outputContract','runId','trunc','.jsonl','{\x22summary\x22:\x22...\x22,\x22entryNodeId\x22:\x22...\x22,\x22maxSteps\x22:12,\x22branchVocabulary\x22:[\x22...\x22],\x22nodes\x22:[{\x22id\x22:\x22...\x22,\x22type\x22:\x22task\x22,\x22title\x22:\x22...\x22,\x22agentId\x22:\x22...\x22,\x22goal\x22:\x22...\x22,\x22instructions\x22:\x22...\x22,\x22doneWhen\x22:[\x22...\x22],\x22dependsOn\x22:[\x22...\x22],\x22dependencyMode\x22:\x22all\x22,\x22contextFrom\x22:[\x22...\x22]},{\x22id\x22:\x22...\x22,\x22type\x22:\x22judge\x22,\x22title\x22:\x22...\x22,\x22agentId\x22:\x22...\x22,\x22question\x22:\x22...\x22,\x22instructions\x22:\x22...\x22,\x22dependsOn\x22:[\x22...\x22],\x22dependencyMode\x22:\x22all\x22,\x22contextFrom\x22:[\x22...\x22],\x22allowedBranches\x22:[\x22...\x22],\x22branches\x22:{\x22branch\x22:\x22target\x22}},{\x22id\x22:\x22...\x22,\x22type\x22:\x22ask\x22,\x22title\x22:\x22...\x22,\x22question\x22:\x22...\x22,\x22inputKey\x22:\x22...\x22,\x22resumeNodeId\x22:\x22...\x22,\x22maxAttempts\x22:1,\x22dependsOn\x22:[\x22...\x22],\x22dependencyMode\x22:\x22all\x22,\x22contextFrom\x22:[\x22...\x22]},{\x22id\x22:\x22finish\x22,\x22type\x22:\x22finish\x22,\x22title\x22:\x22Workflow\x20complete\x22,\x22dependsOn\x22:[\x22...\x22],\x22dependencyMode\x22:\x22any\x22}]}','].inputKey','permissions','3EETxRL','exec','\x20must\x20be\x20a\x20non-empty\x20string','all'];_0xe4a9=function(){return _0x1f0e1a;};return _0xe4a9();}function optionalString(_0x17964b){const _0x14a077=_0x1741;return typeof _0x17964b===_0x14a077(0xdb)&&_0x17964b[_0x14a077(0xea)]()?_0x17964b[_0x14a077(0xea)]():undefined;}function normalizeDependencyMode(_0x278843){const _0x36a32a=_0x1741;return _0x278843===_0x36a32a(0xda)?_0x36a32a(0xda):_0x36a32a(0xa2);}function requireString(_0x9a374f,_0x2d452d){const _0xd4252d=_0x1741;if(typeof _0x9a374f!==_0xd4252d(0xdb)||!_0x9a374f[_0xd4252d(0xea)]())throw new Error(_0x2d452d+_0xd4252d(0xa1));return _0x9a374f[_0xd4252d(0xea)]();}function readRecord(_0x456159,_0x4f830b){const _0x29ec5e=_0x1741;if(!_0x456159||typeof _0x456159!==_0x29ec5e(0xf4)||Array[_0x29ec5e(0xde)](_0x456159))throw new Error(_0x4f830b+_0x29ec5e(0xc8));return _0x456159;}function sanitizeId(_0x423f4d){const _0x250847=_0x1741;return _0x423f4d[_0x250847(0x97)](/[^a-zA-Z0-9._-]+/g,'_');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x22676e,_0xbe4d7){const _0x9df5e=_0x3ad8,_0xcf1cbd=_0x22676e();while(!![]){try{const _0x4aed59=-parseInt(_0x9df5e(0x1f7))/0x1+-parseInt(_0x9df5e(0x20f))/0x2*(-parseInt(_0x9df5e(0x1ee))/0x3)+parseInt(_0x9df5e(0x1f1))/0x4*(-parseInt(_0x9df5e(0x1d8))/0x5)+parseInt(_0x9df5e(0x201))/0x6*(parseInt(_0x9df5e(0x1da))/0x7)+parseInt(_0x9df5e(0x1de))/0x8+parseInt(_0x9df5e(0x20d))/0x9*(-parseInt(_0x9df5e(0x1fb))/0xa)+parseInt(_0x9df5e(0x1e7))/0xb;if(_0x4aed59===_0xbe4d7)break;else _0xcf1cbd['push'](_0xcf1cbd['shift']());}catch(_0x39912f){_0xcf1cbd['push'](_0xcf1cbd['shift']());}}}(_0x1ebc,0xb8a13));export function validateCompiledPlan(_0x4470da,_0x102508,_0x47678a){const _0x1d1467=_0x3ad8;if(_0x4470da[_0x1d1467(0x1e4)]!==0x1)throw new Error(_0x1d1467(0x1fc));if(!_0x4470da[_0x1d1467(0x213)]['length'])throw new Error('Compiled\x20plan\x20must\x20include\x20at\x20least\x20one\x20node');const _0x194765=new Map(_0x4470da[_0x1d1467(0x213)][_0x1d1467(0x210)](_0x116a49=>[_0x116a49['id'],_0x116a49]));if(!_0x194765['has'](_0x4470da['entryNodeId']))throw new Error(_0x1d1467(0x208)+_0x4470da['entryNodeId']+'\x22\x20does\x20not\x20exist');const _0x3826b4=_0x194765['get'](_0x4470da[_0x1d1467(0x1dd)]);if(_0x3826b4[_0x1d1467(0x1e8)]===_0x1d1467(0x1f8)||_0x3826b4[_0x1d1467(0x1fe)][_0x1d1467(0x1f4)]>0x0)throw new Error(_0x1d1467(0x208)+_0x4470da[_0x1d1467(0x1dd)]+_0x1d1467(0x1f9));const _0x4183fa=findDuplicateIds(_0x4470da['nodes'][_0x1d1467(0x210)](_0x5a8bee=>_0x5a8bee['id']));if(_0x4183fa[_0x1d1467(0x1f4)]>0x0)throw new Error(_0x1d1467(0x1e9)+_0x4183fa[_0x1d1467(0x20e)](',\x20'));const _0x40048b=_0x4470da[_0x1d1467(0x213)][_0x1d1467(0x1ea)](_0x25aacd=>_0x25aacd[_0x1d1467(0x1e8)]===_0x1d1467(0x1f8));if(_0x40048b['length']===0x0)throw new Error(_0x1d1467(0x202));const _0x1fe67a=_0x4470da[_0x1d1467(0x213)]['filter'](_0x27b07d=>_0x27b07d[_0x1d1467(0x1fe)][_0x1d1467(0x1f4)]===0x0&&_0x27b07d[_0x1d1467(0x1e8)]!==_0x1d1467(0x1f8));if(_0x1fe67a[_0x1d1467(0x1f4)]===0x0)throw new Error(_0x1d1467(0x211));const _0x583868=new Map(),_0x3e8670=new Set(_0x102508[_0x1d1467(0x1f5)]),_0x272dfa=new Map();for(const _0x1eb182 of _0x4470da[_0x1d1467(0x213)]){_0x272dfa[_0x1d1467(0x207)](_0x1eb182['id'],[]);if(_0x1eb182[_0x1d1467(0x1e8)]==='finish')continue;if(_0x102508['constraints'][_0x1d1467(0x1fd)]&&!_0x3e8670[_0x1d1467(0x205)](_0x1eb182[_0x1d1467(0x1f2)]))throw new Error(_0x1d1467(0x1e1)+_0x1eb182['agentId']+'\x22');if(!_0x47678a[_0x1eb182[_0x1d1467(0x1f2)]])throw new Error(_0x1d1467(0x1f3)+_0x1eb182[_0x1d1467(0x1f2)]+'\x22');_0x583868['set'](_0x1eb182[_0x1d1467(0x1f2)],(_0x583868[_0x1d1467(0x212)](_0x1eb182[_0x1d1467(0x1f2)])??0x0)+0x1);for(const _0x30b3c7 of _0x1eb182['dependsOn']){if(!_0x194765['has'](_0x30b3c7))throw new Error('Compiled\x20plan\x20node\x20\x22'+_0x1eb182['id']+'\x22\x20depends\x20on\x20missing\x20node\x20\x22'+_0x30b3c7+'\x22');_0x272dfa['get'](_0x30b3c7)?.[_0x1d1467(0x1ed)](_0x1eb182['id']);}if(_0x1eb182['type']===_0x1d1467(0x1dc)){validateJudgeNode(_0x1eb182);for(const _0x34c750 of Object[_0x1d1467(0x20b)](_0x1eb182['branches'])){if(!_0x194765['has'](_0x34c750))throw new Error('Compiled\x20plan\x20node\x20\x22'+_0x1eb182['id']+_0x1d1467(0x209)+_0x34c750+'\x22');}for(const _0x4d4c7c of _0x1eb182[_0x1d1467(0x1e6)]){if(!_0x194765['has'](_0x4d4c7c))throw new Error(_0x1d1467(0x203)+_0x1eb182['id']+_0x1d1467(0x214)+_0x4d4c7c+'\x22');}continue;}for(const _0x2dbc0c of _0x1eb182[_0x1d1467(0x1e6)]){if(!_0x194765[_0x1d1467(0x205)](_0x2dbc0c))throw new Error(_0x1d1467(0x203)+_0x1eb182['id']+_0x1d1467(0x214)+_0x2dbc0c+'\x22');}}for(const _0x367b51 of _0x40048b){for(const _0x12d821 of _0x367b51['dependsOn']){if(!_0x194765[_0x1d1467(0x205)](_0x12d821))throw new Error(_0x1d1467(0x203)+_0x367b51['id']+_0x1d1467(0x206)+_0x12d821+'\x22');_0x272dfa[_0x1d1467(0x212)](_0x12d821)?.['push'](_0x367b51['id']);}}for(const [_0x1500d3,_0x1295a4]of Object[_0x1d1467(0x1d9)](_0x102508['constraints'][_0x1d1467(0x1e5)])){if((_0x583868['get'](_0x1500d3)??0x0)>_0x1295a4)throw new Error(_0x1d1467(0x1df)+_0x1500d3+'\x22');}const _0xf7c132=collectReachableNodes(_0x1fe67a[_0x1d1467(0x210)](_0x1ef749=>_0x1ef749['id']),_0x272dfa),_0x225fdb=_0x4470da[_0x1d1467(0x213)][_0x1d1467(0x210)](_0x3695cd=>_0x3695cd['id'])[_0x1d1467(0x1ea)](_0x2f2522=>!_0xf7c132['has'](_0x2f2522));if(_0x225fdb['length']>0x0)throw new Error(_0x1d1467(0x1ef)+_0x225fdb[_0x1d1467(0x20e)](',\x20'));if(!_0x102508[_0x1d1467(0x1db)][_0x1d1467(0x1e0)]&&hasCycle(_0x272dfa))throw new Error('Compiled\x20plan\x20contains\x20a\x20loop\x20but\x20allowLoops\x20is\x20false');if(_0x102508[_0x1d1467(0x1db)][_0x1d1467(0x1e0)]&&_0x102508['constraints'][_0x1d1467(0x200)]<0x0)throw new Error(_0x1d1467(0x1eb));}function validateJudgeNode(_0x183dd3){const _0x225dee=_0x3ad8,_0xef0489=Object[_0x225dee(0x204)](_0x183dd3[_0x225dee(0x20c)]);if(_0x183dd3[_0x225dee(0x1e2)][_0x225dee(0x1f4)]===0x0)throw new Error(_0x225dee(0x1ff)+_0x183dd3['id']+_0x225dee(0x215));const _0x586ec2=new Set(_0x183dd3[_0x225dee(0x1e2)]);if(_0x586ec2[_0x225dee(0x1e3)]!==_0x183dd3[_0x225dee(0x1e2)]['length'])throw new Error('Judge\x20node\x20\x22'+_0x183dd3['id']+_0x225dee(0x1f6));for(const _0x5f2afe of _0xef0489){if(!_0x586ec2['has'](_0x5f2afe))throw new Error(_0x225dee(0x1ff)+_0x183dd3['id']+_0x225dee(0x20a)+_0x5f2afe+'\x22');}for(const _0xb85f24 of _0x183dd3[_0x225dee(0x1e2)]){if(!_0x183dd3[_0x225dee(0x20c)][_0xb85f24])throw new Error(_0x225dee(0x1ff)+_0x183dd3['id']+_0x225dee(0x1fa)+_0xb85f24+'\x22');}}function _0x3ad8(_0x38fa73,_0x17cf1d){_0x38fa73=_0x38fa73-0x1d8;const _0x1ebcbe=_0x1ebc();let _0x3ad87d=_0x1ebcbe[_0x38fa73];return _0x3ad87d;}function _0x1ebc(){const _0x4abadd=['version','maxAgentCalls','contextFrom','19829931EpXdMZ','type','Compiled\x20plan\x20contains\x20duplicate\x20node\x20ids:\x20','filter','maxLoopCount\x20must\x20be\x20>=\x200','add','push','564qfcekJ','Compiled\x20plan\x20contains\x20unreachable\x20nodes:\x20','shift','1212872BcYypW','agentId','Compiled\x20plan\x20references\x20unknown\x20agent\x20\x22','length','agentIds','\x22\x20contains\x20duplicate\x20allowedBranches','1469201SmfJHJ','finish','\x22\x20must\x20be\x20an\x20executable\x20root\x20node','\x22\x20is\x20missing\x20target\x20for\x20branch\x20\x22','195800XjCxye','Compiled\x20plan\x20version\x20must\x20be\x201','allowedAgentsOnly','dependsOn','Judge\x20node\x20\x22','maxLoopCount','555006Vumwhx','Compiled\x20plan\x20must\x20include\x20at\x20least\x20one\x20finish\x20node','Compiled\x20plan\x20node\x20\x22','keys','has','\x22\x20depends\x20on\x20missing\x20node\x20\x22','set','Compiled\x20plan\x20entry\x20node\x20\x22','\x22\x20points\x20to\x20missing\x20node\x20\x22','\x22\x20contains\x20unexpected\x20branch\x20\x22','values','branches','639aRnpwF','join','6602lFIlxQ','map','Compiled\x20plan\x20must\x20include\x20at\x20least\x20one\x20executable\x20root\x20node','get','nodes','\x22\x20reads\x20missing\x20context\x20node\x20\x22','\x22\x20must\x20declare\x20at\x20least\x20one\x20branch','20KvauuO','entries','77sAMIPo','constraints','judge','entryNodeId','11101408Qbftkk','Compiled\x20plan\x20exceeds\x20maxAgentCalls\x20for\x20\x22','allowLoops','Compiled\x20plan\x20references\x20undeclared\x20agent\x20\x22','allowedBranches','size'];_0x1ebc=function(){return _0x4abadd;};return _0x1ebc();}function collectReachableNodes(_0x5ae8ea,_0x541918){const _0x415dbe=_0x3ad8,_0x4a15d9=new Set(),_0x42bd63=[..._0x5ae8ea];while(_0x42bd63[_0x415dbe(0x1f4)]>0x0){const _0x513581=_0x42bd63['pop']();if(_0x4a15d9[_0x415dbe(0x205)](_0x513581))continue;_0x4a15d9[_0x415dbe(0x1ec)](_0x513581);for(const _0x15dcca of _0x541918[_0x415dbe(0x212)](_0x513581)??[]){_0x42bd63[_0x415dbe(0x1ed)](_0x15dcca);}}return _0x4a15d9;}function hasCycle(_0x34956b){const _0x51945e=_0x3ad8,_0x4a4af9=new Map();for(const _0x7fc238 of _0x34956b[_0x51945e(0x204)]()){_0x4a4af9[_0x51945e(0x207)](_0x7fc238,0x0);}for(const _0x4424b9 of _0x34956b[_0x51945e(0x20b)]()){for(const _0x2d686a of _0x4424b9){_0x4a4af9[_0x51945e(0x207)](_0x2d686a,(_0x4a4af9[_0x51945e(0x212)](_0x2d686a)??0x0)+0x1);}}const _0x1871fc=[..._0x4a4af9['entries']()][_0x51945e(0x1ea)](([,_0x2f8c65])=>_0x2f8c65===0x0)['map'](([_0x4884d6])=>_0x4884d6);let _0x16f3d7=0x0;while(_0x1871fc['length']>0x0){const _0x15e393=_0x1871fc[_0x51945e(0x1f0)]();_0x16f3d7+=0x1;for(const _0x51bea2 of _0x34956b[_0x51945e(0x212)](_0x15e393)??[]){const _0x43c1b6=(_0x4a4af9[_0x51945e(0x212)](_0x51bea2)??0x0)-0x1;_0x4a4af9[_0x51945e(0x207)](_0x51bea2,_0x43c1b6),_0x43c1b6===0x0&&_0x1871fc['push'](_0x51bea2);}}return _0x16f3d7!==_0x4a4af9[_0x51945e(0x1e3)];}function findDuplicateIds(_0x22589c){const _0x35bd0f=_0x3ad8,_0x19606c=new Set(),_0x55bc43=new Set();for(const _0x40081b of _0x22589c){_0x19606c[_0x35bd0f(0x205)](_0x40081b)&&_0x55bc43[_0x35bd0f(0x1ec)](_0x40081b),_0x19606c[_0x35bd0f(0x1ec)](_0x40081b);}return[..._0x55bc43];}
|
|
1
|
+
function _0x1e33(){const _0x36468f=['maxAgentCalls','\x22\x20contains\x20unexpected\x20branch\x20\x22','inputKey','Compiled\x20plan\x20entry\x20node\x20\x22','filter','\x22\x20reads\x20missing\x20context\x20node\x20\x22','join','finish','values','trim','Compiled\x20plan\x20exceeds\x20maxAgentCalls\x20for\x20\x22','Compiled\x20plan\x20version\x20must\x20be\x201','map','\x22\x20must\x20declare\x20maxAttempts\x20>=\x201','length','get','Compiled\x20plan\x20references\x20undeclared\x20agent\x20\x22','entryNodeId','constraints','shift','8ScUjbD','entries','keys','maxAttempts','has','isInteger','\x22\x20points\x20to\x20missing\x20node\x20\x22','Compiled\x20plan\x20contains\x20duplicate\x20node\x20ids:\x20','maxLoopCount\x20must\x20be\x20>=\x200','\x22\x20cannot\x20resume\x20itself','875286zmRjwr','Compiled\x20plan\x20must\x20include\x20at\x20least\x20one\x20node','Ask\x20node\x20\x22','Compiled\x20plan\x20must\x20include\x20at\x20least\x20one\x20finish\x20node','Compiled\x20plan\x20contains\x20unreachable\x20nodes:\x20','allowedAgentsOnly','dependsOn','question','maxLoopCount','Judge\x20node\x20\x22','branches','121251EcrHFN','allowedBranches','\x22\x20depends\x20on\x20missing\x20node\x20\x22','allowLoops','resumeNodeId','\x22\x20must\x20declare\x20a\x20non-empty\x20resumeNodeId','\x22\x20is\x20missing\x20target\x20for\x20branch\x20\x22','agentId','nodes','2093015DLMUYq','2sSBzPA','Compiled\x20plan\x20node\x20\x22','37272uyERRB','\x22\x20must\x20declare\x20a\x20non-empty\x20question','type','push','size','\x22\x20resumes\x20missing\x20node\x20\x22','\x22\x20does\x20not\x20exist','version','Compiled\x20plan\x20references\x20unknown\x20agent\x20\x22','\x22\x20must\x20declare\x20a\x20non-empty\x20inputKey','set','604782NGoXss','10487493mKlxfH','Compiled\x20plan\x20must\x20include\x20at\x20least\x20one\x20executable\x20root\x20node','add','1099XGIqZB','5283420MmYJUJ'];_0x1e33=function(){return _0x36468f;};return _0x1e33();}(function(_0x4d7834,_0x43abde){const _0x3054b0=_0xa2d6,_0x535c56=_0x4d7834();while(!![]){try{const _0x134bad=parseInt(_0x3054b0(0x16d))/0x1+parseInt(_0x3054b0(0x160))/0x2*(-parseInt(_0x3054b0(0x19c))/0x3)+-parseInt(_0x3054b0(0x187))/0x4*(-parseInt(_0x3054b0(0x15f))/0x5)+parseInt(_0x3054b0(0x191))/0x6+parseInt(_0x3054b0(0x171))/0x7*(parseInt(_0x3054b0(0x162))/0x8)+-parseInt(_0x3054b0(0x16e))/0x9+-parseInt(_0x3054b0(0x172))/0xa;if(_0x134bad===_0x43abde)break;else _0x535c56['push'](_0x535c56['shift']());}catch(_0x4adf82){_0x535c56['push'](_0x535c56['shift']());}}}(_0x1e33,0x8ee50));export function validateCompiledPlan(_0x1b2b56,_0x288505,_0x12afb5){const _0x3e7dec=_0xa2d6;if(_0x1b2b56[_0x3e7dec(0x169)]!==0x1)throw new Error(_0x3e7dec(0x17e));if(!_0x1b2b56['nodes'][_0x3e7dec(0x181)])throw new Error(_0x3e7dec(0x192));const _0x47ef8f=new Map(_0x1b2b56[_0x3e7dec(0x15e)][_0x3e7dec(0x17f)](_0x25228a=>[_0x25228a['id'],_0x25228a]));if(!_0x47ef8f[_0x3e7dec(0x18b)](_0x1b2b56[_0x3e7dec(0x184)]))throw new Error(_0x3e7dec(0x176)+_0x1b2b56[_0x3e7dec(0x184)]+_0x3e7dec(0x168));const _0x6051f3=_0x47ef8f[_0x3e7dec(0x182)](_0x1b2b56['entryNodeId']);if(_0x6051f3['type']===_0x3e7dec(0x17a)||_0x6051f3['dependsOn'][_0x3e7dec(0x181)]>0x0)throw new Error(_0x3e7dec(0x176)+_0x1b2b56[_0x3e7dec(0x184)]+'\x22\x20must\x20be\x20an\x20executable\x20root\x20node');const _0x97d3ae=findDuplicateIds(_0x1b2b56[_0x3e7dec(0x15e)]['map'](_0x142d62=>_0x142d62['id']));if(_0x97d3ae[_0x3e7dec(0x181)]>0x0)throw new Error(_0x3e7dec(0x18e)+_0x97d3ae[_0x3e7dec(0x179)](',\x20'));const _0x7c79d5=_0x1b2b56[_0x3e7dec(0x15e)][_0x3e7dec(0x177)](_0x187ed3=>_0x187ed3['type']==='finish');if(_0x7c79d5['length']===0x0)throw new Error(_0x3e7dec(0x194));const _0x58badd=_0x1b2b56[_0x3e7dec(0x15e)]['filter'](_0x4f4ded=>_0x4f4ded[_0x3e7dec(0x197)][_0x3e7dec(0x181)]===0x0&&_0x4f4ded['type']!==_0x3e7dec(0x17a));if(_0x58badd[_0x3e7dec(0x181)]===0x0)throw new Error(_0x3e7dec(0x16f));const _0x25e771=new Map(),_0xc544f5=new Set(_0x288505['agentIds']),_0x34ea9a=new Map();for(const _0x5c151d of _0x1b2b56[_0x3e7dec(0x15e)]){_0x34ea9a[_0x3e7dec(0x16c)](_0x5c151d['id'],[]);if(_0x5c151d['type']===_0x3e7dec(0x17a))continue;for(const _0x423744 of _0x5c151d[_0x3e7dec(0x197)]){if(!_0x47ef8f[_0x3e7dec(0x18b)](_0x423744))throw new Error('Compiled\x20plan\x20node\x20\x22'+_0x5c151d['id']+_0x3e7dec(0x158)+_0x423744+'\x22');_0x34ea9a['get'](_0x423744)?.[_0x3e7dec(0x165)](_0x5c151d['id']);}if(_0x5c151d[_0x3e7dec(0x164)]==='judge'){if(_0x288505[_0x3e7dec(0x185)][_0x3e7dec(0x196)]&&!_0xc544f5[_0x3e7dec(0x18b)](_0x5c151d[_0x3e7dec(0x15d)]))throw new Error(_0x3e7dec(0x183)+_0x5c151d[_0x3e7dec(0x15d)]+'\x22');if(!_0x12afb5[_0x5c151d[_0x3e7dec(0x15d)]])throw new Error(_0x3e7dec(0x16a)+_0x5c151d[_0x3e7dec(0x15d)]+'\x22');_0x25e771[_0x3e7dec(0x16c)](_0x5c151d[_0x3e7dec(0x15d)],(_0x25e771[_0x3e7dec(0x182)](_0x5c151d[_0x3e7dec(0x15d)])??0x0)+0x1),validateJudgeNode(_0x5c151d);for(const _0x5d787e of Object[_0x3e7dec(0x17b)](_0x5c151d['branches'])){if(!_0x47ef8f[_0x3e7dec(0x18b)](_0x5d787e))throw new Error(_0x3e7dec(0x161)+_0x5c151d['id']+_0x3e7dec(0x18d)+_0x5d787e+'\x22');}for(const _0x4717e0 of _0x5c151d['contextFrom']){if(!_0x47ef8f[_0x3e7dec(0x18b)](_0x4717e0))throw new Error(_0x3e7dec(0x161)+_0x5c151d['id']+_0x3e7dec(0x178)+_0x4717e0+'\x22');}continue;}if(_0x5c151d[_0x3e7dec(0x164)]==='ask'){validateAskNode(_0x5c151d,_0x47ef8f);for(const _0x479877 of _0x5c151d['contextFrom']){if(!_0x47ef8f['has'](_0x479877))throw new Error(_0x3e7dec(0x161)+_0x5c151d['id']+_0x3e7dec(0x178)+_0x479877+'\x22');}continue;}if(_0x288505[_0x3e7dec(0x185)][_0x3e7dec(0x196)]&&!_0xc544f5[_0x3e7dec(0x18b)](_0x5c151d[_0x3e7dec(0x15d)]))throw new Error(_0x3e7dec(0x183)+_0x5c151d[_0x3e7dec(0x15d)]+'\x22');if(!_0x12afb5[_0x5c151d[_0x3e7dec(0x15d)]])throw new Error(_0x3e7dec(0x16a)+_0x5c151d[_0x3e7dec(0x15d)]+'\x22');_0x25e771['set'](_0x5c151d[_0x3e7dec(0x15d)],(_0x25e771[_0x3e7dec(0x182)](_0x5c151d[_0x3e7dec(0x15d)])??0x0)+0x1);for(const _0x1923ae of _0x5c151d['contextFrom']){if(!_0x47ef8f['has'](_0x1923ae))throw new Error(_0x3e7dec(0x161)+_0x5c151d['id']+_0x3e7dec(0x178)+_0x1923ae+'\x22');}}for(const _0x3148fe of _0x7c79d5){for(const _0x63989 of _0x3148fe['dependsOn']){if(!_0x47ef8f[_0x3e7dec(0x18b)](_0x63989))throw new Error(_0x3e7dec(0x161)+_0x3148fe['id']+_0x3e7dec(0x158)+_0x63989+'\x22');_0x34ea9a[_0x3e7dec(0x182)](_0x63989)?.[_0x3e7dec(0x165)](_0x3148fe['id']);}}for(const [_0x5cb244,_0x430c58]of Object[_0x3e7dec(0x188)](_0x288505[_0x3e7dec(0x185)][_0x3e7dec(0x173)])){if((_0x25e771[_0x3e7dec(0x182)](_0x5cb244)??0x0)>_0x430c58)throw new Error(_0x3e7dec(0x17d)+_0x5cb244+'\x22');}const _0xcfc9f8=collectReachableNodes(_0x58badd['map'](_0xbba277=>_0xbba277['id']),_0x34ea9a),_0x4d2471=_0x1b2b56[_0x3e7dec(0x15e)][_0x3e7dec(0x17f)](_0x457fa6=>_0x457fa6['id'])[_0x3e7dec(0x177)](_0x4eb2b3=>!_0xcfc9f8[_0x3e7dec(0x18b)](_0x4eb2b3));if(_0x4d2471[_0x3e7dec(0x181)]>0x0)throw new Error(_0x3e7dec(0x195)+_0x4d2471[_0x3e7dec(0x179)](',\x20'));if(!_0x288505[_0x3e7dec(0x185)][_0x3e7dec(0x159)]&&hasCycle(_0x34ea9a))throw new Error('Compiled\x20plan\x20contains\x20a\x20loop\x20but\x20allowLoops\x20is\x20false');if(_0x288505[_0x3e7dec(0x185)][_0x3e7dec(0x159)]&&_0x288505[_0x3e7dec(0x185)][_0x3e7dec(0x199)]<0x0)throw new Error(_0x3e7dec(0x18f));}function validateJudgeNode(_0x299352){const _0x3e48b8=_0xa2d6,_0x197328=Object[_0x3e48b8(0x189)](_0x299352[_0x3e48b8(0x19b)]);if(_0x299352['allowedBranches'][_0x3e48b8(0x181)]===0x0)throw new Error(_0x3e48b8(0x19a)+_0x299352['id']+'\x22\x20must\x20declare\x20at\x20least\x20one\x20branch');const _0x2ce3e7=new Set(_0x299352[_0x3e48b8(0x19d)]);if(_0x2ce3e7[_0x3e48b8(0x166)]!==_0x299352['allowedBranches'][_0x3e48b8(0x181)])throw new Error(_0x3e48b8(0x19a)+_0x299352['id']+'\x22\x20contains\x20duplicate\x20allowedBranches');for(const _0x3649cb of _0x197328){if(!_0x2ce3e7[_0x3e48b8(0x18b)](_0x3649cb))throw new Error('Judge\x20node\x20\x22'+_0x299352['id']+_0x3e48b8(0x174)+_0x3649cb+'\x22');}for(const _0x3837f1 of _0x299352[_0x3e48b8(0x19d)]){if(!_0x299352[_0x3e48b8(0x19b)][_0x3837f1])throw new Error(_0x3e48b8(0x19a)+_0x299352['id']+_0x3e48b8(0x15c)+_0x3837f1+'\x22');}}function _0xa2d6(_0xc7cd6e,_0x594214){_0xc7cd6e=_0xc7cd6e-0x158;const _0x1e33bb=_0x1e33();let _0xa2d60a=_0x1e33bb[_0xc7cd6e];return _0xa2d60a;}function validateAskNode(_0x4739f8,_0x4189a9){const _0x4d061a=_0xa2d6;if(!_0x4739f8[_0x4d061a(0x198)][_0x4d061a(0x17c)]())throw new Error(_0x4d061a(0x193)+_0x4739f8['id']+_0x4d061a(0x163));if(!_0x4739f8[_0x4d061a(0x175)][_0x4d061a(0x17c)]())throw new Error(_0x4d061a(0x193)+_0x4739f8['id']+_0x4d061a(0x16b));if(!_0x4739f8[_0x4d061a(0x15a)][_0x4d061a(0x17c)]())throw new Error(_0x4d061a(0x193)+_0x4739f8['id']+_0x4d061a(0x15b));if(!_0x4189a9[_0x4d061a(0x18b)](_0x4739f8[_0x4d061a(0x15a)]))throw new Error('Ask\x20node\x20\x22'+_0x4739f8['id']+_0x4d061a(0x167)+_0x4739f8[_0x4d061a(0x15a)]+'\x22');if(_0x4739f8['resumeNodeId']===_0x4739f8['id'])throw new Error(_0x4d061a(0x193)+_0x4739f8['id']+_0x4d061a(0x190));if(!Number[_0x4d061a(0x18c)](_0x4739f8['maxAttempts'])||_0x4739f8[_0x4d061a(0x18a)]<0x1)throw new Error(_0x4d061a(0x193)+_0x4739f8['id']+_0x4d061a(0x180));}function collectReachableNodes(_0x309306,_0x3c0aea){const _0x38b9b1=_0xa2d6,_0x50d74a=new Set(),_0x4b297c=[..._0x309306];while(_0x4b297c[_0x38b9b1(0x181)]>0x0){const _0x465c48=_0x4b297c['pop']();if(_0x50d74a['has'](_0x465c48))continue;_0x50d74a['add'](_0x465c48);for(const _0x1cfec2 of _0x3c0aea['get'](_0x465c48)??[]){_0x4b297c['push'](_0x1cfec2);}}return _0x50d74a;}function hasCycle(_0x51f4ec){const _0x42e160=_0xa2d6,_0x140383=new Map();for(const _0x1d8526 of _0x51f4ec[_0x42e160(0x189)]()){_0x140383[_0x42e160(0x16c)](_0x1d8526,0x0);}for(const _0x49e7a7 of _0x51f4ec[_0x42e160(0x17b)]()){for(const _0x30a285 of _0x49e7a7){_0x140383[_0x42e160(0x16c)](_0x30a285,(_0x140383[_0x42e160(0x182)](_0x30a285)??0x0)+0x1);}}const _0x1eacc4=[..._0x140383[_0x42e160(0x188)]()]['filter'](([,_0x2505bf])=>_0x2505bf===0x0)['map'](([_0x24d02e])=>_0x24d02e);let _0x582e3e=0x0;while(_0x1eacc4['length']>0x0){const _0x2cc658=_0x1eacc4[_0x42e160(0x186)]();_0x582e3e+=0x1;for(const _0x98c4d4 of _0x51f4ec['get'](_0x2cc658)??[]){const _0x46b510=(_0x140383[_0x42e160(0x182)](_0x98c4d4)??0x0)-0x1;_0x140383[_0x42e160(0x16c)](_0x98c4d4,_0x46b510),_0x46b510===0x0&&_0x1eacc4[_0x42e160(0x165)](_0x98c4d4);}}return _0x582e3e!==_0x140383[_0x42e160(0x166)];}function findDuplicateIds(_0x489acb){const _0x95e1fe=_0xa2d6,_0x209674=new Set(),_0x399a35=new Set();for(const _0x579d95 of _0x489acb){_0x209674['has'](_0x579d95)&&_0x399a35[_0x95e1fe(0x170)](_0x579d95),_0x209674[_0x95e1fe(0x170)](_0x579d95);}return[..._0x399a35];}
|