cuelo 0.10.0 → 0.10.2

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.
Files changed (101) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +9 -9
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/required-server-files.js +2 -2
  6. package/.next/required-server-files.json +2 -2
  7. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/.next/server/app/_global-error.html +1 -1
  9. package/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  16. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  17. package/.next/server/app/_not-found.html +1 -1
  18. package/.next/server/app/_not-found.rsc +2 -2
  19. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  20. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  21. package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  22. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  23. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  24. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  25. package/.next/server/app/api/updates/route.js +1 -1
  26. package/.next/server/app/index.html +1 -1
  27. package/.next/server/app/index.rsc +4 -4
  28. package/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  29. package/.next/server/app/index.segments/_full.segment.rsc +4 -4
  30. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  31. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  32. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  33. package/.next/server/app/office/page_client-reference-manifest.js +1 -1
  34. package/.next/server/app/office-preview/page_client-reference-manifest.js +1 -1
  35. package/.next/server/app/office-preview.html +1 -1
  36. package/.next/server/app/office-preview.rsc +2 -2
  37. package/.next/server/app/office-preview.segments/_full.segment.rsc +2 -2
  38. package/.next/server/app/office-preview.segments/_head.segment.rsc +1 -1
  39. package/.next/server/app/office-preview.segments/_index.segment.rsc +2 -2
  40. package/.next/server/app/office-preview.segments/_tree.segment.rsc +1 -1
  41. package/.next/server/app/office-preview.segments/office-preview/__PAGE__.segment.rsc +1 -1
  42. package/.next/server/app/office-preview.segments/office-preview.segment.rsc +1 -1
  43. package/.next/server/app/office.html +1 -1
  44. package/.next/server/app/office.rsc +4 -4
  45. package/.next/server/app/office.segments/_full.segment.rsc +4 -4
  46. package/.next/server/app/office.segments/_head.segment.rsc +1 -1
  47. package/.next/server/app/office.segments/_index.segment.rsc +2 -2
  48. package/.next/server/app/office.segments/_tree.segment.rsc +1 -1
  49. package/.next/server/app/office.segments/office/__PAGE__.segment.rsc +3 -3
  50. package/.next/server/app/office.segments/office.segment.rsc +1 -1
  51. package/.next/server/app/page_client-reference-manifest.js +1 -1
  52. package/.next/server/app/recover/page_client-reference-manifest.js +1 -1
  53. package/.next/server/app/recover.html +1 -1
  54. package/.next/server/app/recover.rsc +2 -2
  55. package/.next/server/app/recover.segments/_full.segment.rsc +2 -2
  56. package/.next/server/app/recover.segments/_head.segment.rsc +1 -1
  57. package/.next/server/app/recover.segments/_index.segment.rsc +2 -2
  58. package/.next/server/app/recover.segments/_tree.segment.rsc +1 -1
  59. package/.next/server/app/recover.segments/recover/__PAGE__.segment.rsc +1 -1
  60. package/.next/server/app/recover.segments/recover.segment.rsc +1 -1
  61. package/.next/server/app-paths-manifest.json +9 -9
  62. package/.next/server/chunks/1008.js +1 -1
  63. package/.next/server/chunks/5489.js +2 -2
  64. package/.next/server/chunks/6429.js +1 -1
  65. package/.next/server/middleware-build-manifest.js +1 -1
  66. package/.next/server/pages/404.html +1 -1
  67. package/.next/server/pages/500.html +1 -1
  68. package/.next/server/server-reference-manifest.json +1 -1
  69. package/.next/static/chunks/{9575-6f450839544bc6b3.js → 9575-9196474bb9e5c752.js} +2 -2
  70. package/.next/static/chunks/app/{layout-d8c1b10303bcd958.js → layout-713017c65de14601.js} +1 -1
  71. package/.next/trace +108 -108
  72. package/.next/trace-build +1 -1
  73. package/README.md +4 -1
  74. package/Tools/CUELO_Setup/files/native-runtime-patch.js +3 -3
  75. package/Tools/OMP_Global_Config/agent/RULES.md +4 -0
  76. package/Tools/OMP_Global_Config/agent/agents/maker.md +12 -6
  77. package/Tools/OMP_Global_Config/agent/extensions/character-voice.ts +3 -3
  78. package/Tools/OMP_Global_Config/agent/extensions/command-guard/index.ts +16 -1
  79. package/Tools/OMP_Global_Config/agent/extensions/command-guard/powershell-syntax.ts +5 -4
  80. package/Tools/OMP_Global_Config/agent/extensions/draft/markdown.ts +226 -0
  81. package/Tools/OMP_Global_Config/agent/extensions/draft/ooxml.ts +222 -0
  82. package/Tools/OMP_Global_Config/agent/extensions/draft/pdf.ts +63 -0
  83. package/Tools/OMP_Global_Config/agent/extensions/draft/zip.ts +73 -0
  84. package/Tools/OMP_Global_Config/agent/extensions/draft.ts +211 -0
  85. package/Tools/OMP_Global_Config/agent/extensions/jev-runtime.ts +1 -1
  86. package/Tools/OMP_Global_Config/agent/extensions/lib/maker-routing.ts +16 -47
  87. package/Tools/OMP_Global_Config/agent/extensions/mcp-selection.ts +32 -8
  88. package/Tools/OMP_Global_Config/agent/extensions/skim.ts +75 -43
  89. package/Tools/OMP_Global_Config/agent/prompt-copies/RULES.en.md +2 -1
  90. package/Tools/OMP_Global_Config/agent/rules/harness-policy.json +5 -6
  91. package/Tools/OMP_Global_Config/agent/rules/omp-harness.md +1 -1
  92. package/Tools/OMP_Global_Config/agent/rules/subagent.md +18 -14
  93. package/Tools/OMP_Global_Config/agent/sop/_common.md +4 -4
  94. package/Tools/OMP_Global_Config/agent/sop/_writer.md +6 -0
  95. package/Tools/OMP_Global_Config/agent/sop/maker.md +1 -1
  96. package/Tools/OMP_Global_Config/agent/tools/git-finalizer/index.ts +46 -3
  97. package/Tools/OMP_Global_Config/patches/apply-core-patch.mjs +182 -0
  98. package/bin/cuelo.js +5 -0
  99. package/package.json +7 -7
  100. /package/.next/static/{MYIe6QFbh4yP3_wc_Fetr → S8tJkE71e2D0DgH4X1s0S}/_buildManifest.js +0 -0
  101. /package/.next/static/{MYIe6QFbh4yP3_wc_Fetr → S8tJkE71e2D0DgH4X1s0S}/_ssgManifest.js +0 -0
@@ -8,7 +8,7 @@ ${j}`:"",`Update the plan file, then write ${e} to xd://propose again when ready
8
8
  Status: ${g.status}${g.enabled?"":" (paused)"}
9
9
  Tokens: ${f}
10
10
  Time spent: ${a=g.timeUsedSeconds,b=Math.max(0,Math.round(a)),c=Math.floor(b/3600),d=Math.floor(b%3600/60),c>0?`${c}h ${d}m`:d>0?`${d}m ${b%60}s`:`${b}s`}`),status:g}}async #w(a){if(!a)return this.#q("Usage: /goal set <objective>");if(!this.enabled&&this.#x())return this.#q("Resume the current goal first, or drop it before setting a new objective.");if(!this.enabled)return await this.#y(a);let b=await this.#a.goalRuntime.replaceGoal({objective:a});return this.#a.setGoalModeState?.(b),this.#g=!1,this.#h=!1,this.#a.isStreaming&&await this.#a.sendGoalModeContext({deliverAs:"steer"}),{message:"Goal replaced.",prompt:a,status:this.getStatus()}}async #y(a){let b=this.#a.getEnabledToolNames().filter(a=>"goal"!==a),c=await this.#a.goalRuntime.createGoal({objective:a});return this.#c=b,await this.#a.setActiveToolsByName([...new Set([...b,"goal"])]),this.#a.setGoalModeState?.(c),this.#g=!1,this.#h=!1,this.#a.isStreaming&&await this.#a.sendGoalModeContext({deliverAs:"steer"}),this.#p(),{message:"Goal mode enabled.",prompt:a,status:this.getStatus()}}async #s(){return this.enabled?(await this.#a.goalRuntime.pauseGoal(),await this.#z({reason:"paused"}),{message:"Goal mode paused.",status:this.getStatus()}):this.#q("No active goal to pause.")}async #t(){if(!this.#x())return this.#q("No paused goal to resume.");let a=this.#a.getEnabledToolNames().filter(a=>"goal"!==a),b=await this.#a.goalRuntime.resumeGoal();return this.#c=a,await this.#a.setActiveToolsByName([...new Set([...a,"goal"])]),this.#a.setGoalModeState?.(b),this.#g=!1,this.#h=!1,this.#p(),this.#A(),{message:"Goal mode resumed.",status:this.getStatus()}}async #u(){return this.enabled||this.#x()?(await this.#a.goalRuntime.dropGoal(),await this.#z({reason:"dropped"}),{message:"Goal dropped.",status:this.getStatus()}):this.#q("No goal to drop.")}async #v(a){let b=this.#a.getGoalModeState?.();if(!this.enabled||!b?.enabled)return this.#q(this.#x()?"Resume the goal before adjusting the budget.":"No active goal.");if("complete"===b.goal.status)return this.#q("Goal is already complete.");if(!a)return this.#q("Usage: /goal budget <N|off>");let{budget:c,error:d}=function(a){let b=a.trim().toLowerCase();if("off"===b)return{};let c=Number.parseInt(b,10);return!Number.isInteger(c)||c<=0||String(c)!==b?{error:"Goal budget must be a positive integer or `off`."}:{budget:c}}(a);return d?this.#q(d):(await this.#a.goalRuntime.onBudgetMutated(c),this.#g=!1,this.#p(),this.#A(),{message:void 0===c?"Goal budget cleared.":`Goal budget set to ${c.toLocaleString()}.`,status:this.getStatus()})}async #z(a){let b=this.#c;if(b&&await this.#a.setActiveToolsByName(b),"completed"===a.reason){let a=this.#a.getGoalModeState?.()?.goal;this.#a.setGoalModeState?.(void 0),this.#a.sessionManager.appendModeChange("none"),this.#a.sessionManager.appendCustomEntry("goal-completed",{objective:a?.objective,tokensUsed:a?.tokensUsed,tokenBudget:a?.tokenBudget,timeUsedSeconds:a?.timeUsedSeconds})}this.#c=void 0,this.#e=!1,this.#k(),this.#p()}async #o(){let a=this.#a.getEnabledToolNames().filter(a=>"goal"!==a);this.#c=a,await this.#a.setActiveToolsByName([...new Set([...a,"goal"])])}#A(){var a;if(this.#k(),this.#i||this.#h||(a=e.cfgGoalContinuationModes.get(this.#a.settings),!(Array.isArray(a)&&h.some(b=>a.includes(b)))||this.#a.getPlanModeState?.()?.enabled||this.#g))return;let b=this.#a.getGoalModeState?.();!b?.enabled||"active"!==b.goal.status||this.#a.goalRuntime.buildContinuationPrompt()&&(this.#d=setTimeout(()=>{this.#d=void 0,this.#B()},this.#b.continuationDelayMs??800))}async #B(){if(this.#i||this.#h||this.#g||this.#b.isBusy())return;let a=this.#a.getGoalModeState?.();if(!a?.enabled||"active"!==a.goal.status)return;let b=this.#a.goalRuntime.buildContinuationPrompt();if(b){this.#e=!0;try{await this.#b.runContinuation(b)}catch{this.#e=!1}}}#k(){this.#d&&(clearTimeout(this.#d),this.#d=void 0)}#q(a){return{error:a,status:this.getStatus()}}#n(){return!1!==e.cfgGoalEnabled.get(this.#a.settings)}#x(){let a=this.#a.getGoalModeState?.();if(a?.goal&&!a.enabled&&"paused"===a.goal.status)return a}#m(){let a=this.#a.sessionManager.getEntries();for(let b=a.length-1;b>=0;b-=1)if(a[b]?.type==="mode_change")return a[b]}#p(){this.#b.onStatusChange?.(this.getStatus())}}d()}catch(a){d(a)}})},57856:(a,b,c)=>{c.d(b,{TQ:()=>e,p1:()=>d});let d=92;function e(a,b=d,c=40){return Object.freeze({terminal:Object.freeze({columns:b,rows:c,kittyProtocolActive:!1}),requestRender:a})}},61024:(a,b,c)=>{c.d(b,{Ef:()=>o,Q4:()=>k,W4:()=>p,p8:()=>m});var d=c(31421);c(77598);var e=c(73024),f=c(48161),g=c(76760);function h(){let a=process.env.CUELO_EXTERNAL_UPDATE_ROOT?.trim();return(0,g.resolve)(a||(0,g.join)((0,f.homedir)(),".omp","external-update"))}function i(a){try{let b=JSON.parse((0,e.readFileSync)(a,"utf8").replace(/^\uFEFF/,""));return b&&"object"==typeof b&&!Array.isArray(b)?b:null}catch{return null}}function j(a,b){(0,e.mkdirSync)((0,g.dirname)(a),{recursive:!0});let c=`${a}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`;(0,e.writeFileSync)(c,`${JSON.stringify(b,null,2)}
11
- `,"utf8"),(0,e.renameSync)(c,a)}function k(a){return globalThis.__cueloRuntimeServer??={origin:a,startedAtMs:Math.round(Date.now()-1e3*process.uptime())},globalThis.__cueloRuntimeServer}function l(a){return[...new Set(a.filter(a=>"string"==typeof a&&a.trim()).map(a=>a.trim()))].sort()}function m(a,b=[]){let c=l(a),d=globalThis.__cueloRuntimeServer;j((0,g.join)(h(),"runtime-activity",`${process.pid}.json`),{schemaVersion:2,processId:process.pid,processStartedAtUtc:new Date(Date.now()-1e3*process.uptime()).toISOString(),updatedAtUtc:new Date().toISOString(),runningSessionIds:c,...d?{recovery:{eligible:!0,origin:d.origin,startedAtMs:d.startedAtMs,waitingSessionIds:l(b).filter(a=>c.includes(a))}}:{}})}function n(a){if(!Number.isInteger(a)||a<=0)return{state:"unknown"};try{process.kill(a,0)}catch(a){if("ESRCH"===a.code)return{state:"dead"}}if("win32"!==process.platform)return{state:"unknown"};let b=`$p = Get-CimInstance Win32_Process -Filter "ProcessId=${a}"; if ($p) { $p.CreationDate.ToUniversalTime().ToString('o') }`,c=(0,d.spawnSync)("powershell.exe",["-NoProfile","-NonInteractive","-Command",b],{encoding:"utf8",timeout:15e3,windowsHide:!0});if(c.error||0!==c.status)return{state:"unknown"};let e=String(c.stdout??"").trim();if(""===e)return{state:"dead"};let f=Date.parse(e);return Number.isFinite(f)?{state:"alive",startedAtMs:f}:{state:"unknown"}}function o(a,b,c=n){let d=(0,g.join)(h(),"runtime-activity");if(!(0,e.existsSync)(d))return null;let f=null;for(let c of(0,e.readdirSync)(d)){if(!c.endsWith(".json"))continue;let e=i((0,g.join)(d,c)),h=e&&"object"==typeof e.recovery&&e.recovery?e.recovery:null;if(!e||!h||!0!==h.eligible||h.origin!==a)continue;let j=Number(h.startedAtMs);if(!Number.isFinite(j)||j>=b||f&&j<=f.startedAtMs)continue;let k=a=>Array.isArray(a)?l(a.filter(a=>"string"==typeof a)):[];f={processId:Number(e.processId),startedAtMs:j,runningSessionIds:k(e.runningSessionIds),waitingSessionIds:k(h.waitingSessionIds),consumed:"string"==typeof h.consumedAtUtc}}if(!f)return null;let{consumed:j,...k}=f;if(j)return null;if(0===k.runningSessionIds.length)return k;let m=c(k.processId);return"dead"===m.state||"alive"===m.state&&Math.abs(m.startedAtMs-k.startedAtMs)>2e3?k:null}function p(a,b){let c=(0,g.join)(h(),"runtime-activity",`${a.processId}.json`),d=i(c),e=d&&"object"==typeof d.recovery&&d.recovery?d.recovery:null;return!!d&&!!e&&Number(e.startedAtMs)===a.startedAtMs&&(j(c,{...d,recovery:{...e,consumedAtUtc:new Date().toISOString(),consumedByStartedAtMs:b}}),!0)}},69453:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{DK:()=>D,O8:()=>C,Uv:()=>E,mD:()=>y,os:()=>B});var e=c(92582),f=c(48331),g=c(5969),h=c(29021),i=c(33873),j=c(25132),k=c(53739),l=c(40575),m=c(84240),n=c(95602),o=c(7561),p=c(36862),q=c(15395),r=c(6539),s=c(21392),t=c(74407),u=a([e,f,g,k,l,m]);async function v(a){let b=[...new Set(a.map(a=>a.cwd).filter(Boolean))],c=new Map;return await Promise.all(b.map(async a=>{c.set(a,await (0,p.KI)(a))})),a.map(a=>{let b=a.cwd?c.get(a.cwd):void 0;return{...a,projectRoot:b?.projectRoot??a.cwd,...b?.isWorktree&&b.branch?{worktreeBranch:b.branch}:{}}})}[e,f,g,k,l,m]=u.then?(await u)():u;let I="(no messages)";async function w(){let a=await e.SessionManager.listAll(),b=new Map;for(let c of a)b.set((0,o.$)(c.path),c.id);let c=a.map(a=>{C(a.id,a.path);let c=function(a){if(a.firstMessage&&a.firstMessage!==I)return a.firstMessage;if(!(a.size>4096))return null;let b=a.modified instanceof Date?a.modified:new Date(String(a.modified)),c=globalThis.__ompSessionFirstMessageCache??=new Map,d=(0,o.$)(a.path),e=c.get(d);if(e&&e.mtimeMs===b.getTime()&&e.size===a.size)return e.text;let f=function(a){let b;try{b=(0,h.openSync)(a,"r");let d=new TextDecoder,e=Buffer.alloc(65536),f="",g=0;for(;g<1048576;){let a=(0,h.readSync)(b,e,0,e.length,g);if(a<=0)break;g+=a;let i=(f+=d.decode(e.subarray(0,a),{stream:!0})).split("\n");for(let a of(f=i.pop()??"",i)){var c;let b;if(!a.includes('"role":"user"'))continue;try{b=JSON.parse(a)}catch{continue}if(!b||"object"!=typeof b||!("type"in b)||"message"!==b.type||!("message"in b))continue;let d=b.message;if(!d||"object"!=typeof d||!("role"in d)||"user"!==d.role)continue;let e=(c="content"in d?d.content:void 0,"string"==typeof c?c.trim():Array.isArray(c)?c.map(a=>a&&"object"==typeof a&&"type"in a&&"text"===a.type&&"text"in a&&"string"==typeof a.text?a.text:"").filter(Boolean).join(" ").trim():"");if(e)return e}}return null}catch{return null}finally{void 0!==b&&(0,h.closeSync)(b)}}(a.path);return c.set(d,{mtimeMs:b.getTime(),size:a.size,text:f}),f}(a);return{path:a.path,id:a.id,cwd:a.cwd,name:a.title,created:a.created instanceof Date?a.created.toISOString():String(a.created),modified:function(a){let b=a.modified instanceof Date?a.modified:new Date(String(a.modified)),c=Number.isFinite(b.getTime())?b.toISOString():String(a.modified),d=globalThis.__ompSessionActivityCache??=new Map,e=(0,o.$)(a.path),f=d.get(e);if(f&&f.mtimeMs===b.getTime()&&f.size===a.size)return f.at??c;let g=function(a){let b;try{b=(0,h.openSync)(a,"r");let c=(0,h.fstatSync)(b).size,d=Buffer.alloc(0),e=0,f=!1;for(;;){let a=e>0?d.lastIndexOf(10,e-1):-1;if(a<0&&c>0){if(!f&&d.length>=65536||d.length>=8388608)return null;let a=Math.min(65536,c),g=Buffer.alloc(a);c-=a,(0,h.readSync)(b,g,0,a,c),d=Buffer.concat([g,d]),e+=a;continue}let g=d.toString("utf8",a+1,e).trim();if(e=Math.max(a,0),g){if(!f&&!g.includes(k.SESSION_EXIT_CUSTOM_TYPE))return null;let a=JSON.parse(g);if(!a||"object"!=typeof a)return null;if("type"in a&&"custom"===a.type&&"customType"in a&&a.customType===k.SESSION_EXIT_CUSTOM_TYPE)f=!0;else{if(!f)return null;let b="timestamp"in a?a.timestamp:void 0;return"string"==typeof b&&Number.isFinite(Date.parse(b))?new Date(b).toISOString():null}}if(a<0)return null}}catch{return null}finally{void 0!==b&&(0,h.closeSync)(b)}}(a.path);return d.set(e,{mtimeMs:b.getTime(),size:a.size,at:g}),g??c}(a),messageCount:c?Math.max(a.messageCount,1):a.messageCount,firstMessage:(0,q.we)(c??"")||I,parentSessionId:a.parentSessionPath?b.get((0,o.$)(a.parentSessionPath)):void 0,transient:!1}});return v(c)}async function x(a={}){a.force&&y();let b=globalThis.__ompSessionListGeneration??0;if(globalThis.__ompSessionListCache&&Date.now()-globalThis.__ompSessionListCache.ts<J)return globalThis.__ompSessionListCache.data;if(globalThis.__ompSessionListPromise&&globalThis.__ompSessionListPromiseGeneration===b)return globalThis.__ompSessionListPromise;let c=w().then(a=>(globalThis.__ompSessionListGeneration??0)!==b?x():(globalThis.__ompSessionListCache={data:a,ts:Date.now()},a)).finally(()=>{globalThis.__ompSessionListPromise===c&&(globalThis.__ompSessionListPromise=void 0,globalThis.__ompSessionListPromiseGeneration=void 0)});return globalThis.__ompSessionListPromise=c,globalThis.__ompSessionListPromiseGeneration=b,c}let J=3e4;function y(){globalThis.__ompSessionListGeneration=(globalThis.__ompSessionListGeneration??0)+1,globalThis.__ompSessionListCache=void 0}function z(){return globalThis.__ompSessionPathCache||(globalThis.__ompSessionPathCache=new Map),globalThis.__ompSessionPathCache}function A(){return globalThis.__ompPathToSessionIdCache||(globalThis.__ompPathToSessionIdCache=new Map),globalThis.__ompPathToSessionIdCache}async function B(a){var b;let c,d,e,f,g=z().get(a);return g&&(0,h.existsSync)(g)?g:(g&&(b=a,c=z(),d=A(),e=c.get(b),c.delete(b),(f=e?(0,o.$)(e):void 0)&&d.get(f)===b&&d.delete(f)),await x(),z().get(a)??null)}function C(a,b){let c=(0,i.normalize)(b),d=(0,o.$)(c),e=z(),f=A(),g=e.get(a),h=g?(0,o.$)(g):void 0,j=f.get(d),k=j?e.get(j):void 0;h&&h!==d&&f.get(h)===a&&f.delete(h),j&&j!==a&&k&&(0,o.$)(k)===d&&e.delete(j),e.set(a,c),f.set(d,a)}async function D(a){return(await e.SessionManager.open(a)).getEntries()}function E(a,b,c={}){let d=new Map;for(let b of a)d.set(b.id,b);let f=(0,e.buildSessionContext)(a,b,d,{transcript:!0,collapseCompactedHistory:!0}),g=function(a,b,c){if(null===c)return[];let d=(c?b.get(c):void 0)??a[a.length-1];if(!d)return[];let e=[],f=new Set,g=d;for(;g&&!f.has(g.id);)f.add(g.id),e.push(g),g=g.parentId?b.get(g.parentId):void 0;return e.reverse()}(a,d,b),{displayed:h,hidden:i}=function(a){let b=-1;for(let c=a.length-1;c>=0;c--)if("compaction"===a[c].type){b=c;break}if(-1===b)return{displayed:a,hidden:[]};let c=a[b],d=[],e=[],f=!1;for(let g=0;g<b;g++)a[g].id===c.firstKeptEntryId&&(f=!0),(f?d:e).push(a[g]);return{displayed:[...d,c,...a.slice(b+1)],hidden:e}}(g),k=[],m=[];for(let a of h){let b=H(a,c);b&&(k.push(b),m.push(a.id))}return{messages:k,entryIds:m,thinkingLevel:f.thinkingLevel??"off",configuredThinkingLevel:f.configuredThinkingLevel??f.thinkingLevel??"off",thinkingCeiling:(0,t.hi)(g),model:function(a){let b=a.default;if(!b)return null;let c=b.indexOf("/");return c<=0?null:{provider:b.slice(0,c),modelId:b.slice(c+1)}}(f.models),compactedWork:function(a){let b=[],c=!1;for(let d of a){let a=H(d,{}),e=a?(0,j.sh)(a):null;e&&("user"!==e.role||b.at(-1)?.role!=="user")&&("user"!==e.role&&(c=!0),b.push(e))}let d=(0,l.getLatestTodoSnapshotIdentity)(a)?(0,l.getLatestTodoPhasesFromEntries)(a):null;return c||d?{messages:c?b:[],todoPhases:d}:null}(i)}}function F(a){let b=Date.parse(a);return Number.isNaN(b)?void 0:b}function G(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function H(a,b){switch(a.type){case"message":{let c=b.deferToolResultImages?function(a){if("toolResult"!==a.role)return a;let b=0,c=0,d=new Set,e=a.content.filter(a=>{let e=function(a){let b,c;if(!G(a)||"image"!==a.type||("string"==typeof a.data?(b=a.data,c="string"==typeof a.mimeType?a.mimeType:void 0):G(a.source)&&"base64"===a.source.type&&"string"==typeof a.source.data&&(b=a.source.data,c="string"==typeof a.source.media_type?a.source.media_type:void 0),!b))return null;let d=b.endsWith("==")?2:+!!b.endsWith("=");return{bytes:Math.max(0,Math.floor(3*b.length/4)-d),mime:c}}(a);return!e||(b+=1,c+=e.bytes,e.mime&&d.add(e.mime),!1)});if(0===b)return a;let f=d.size>0?`: ${[...d].join(", ")}`:"";return e.push({type:"text",text:`[${b} tool result image${1===b?"":"s"} omitted from initial history payload${f}, ~${c} bytes]`}),{...a,content:e}}((0,n.B)(a.message)):(0,n.B)(a.message);if(!b.deferThinking||"assistant"!==c.role)return c;return{...c,content:c.content.map(a=>"thinking"===a.type&&""!==a.thinking.trim()?{...a,thinking:"",deferred:!0}:a)}}case"compaction":return{role:"custom",customType:"compaction",content:a.summary,display:!0,details:{tokensBefore:a.tokensBefore,firstKeptEntryId:a.firstKeptEntryId},timestamp:F(a.timestamp)};case"branch_summary":if(!a.summary)return null;return{role:"user",content:`*The conversation briefly explored another branch and returned with this summary:*
11
+ `,"utf8"),(0,e.renameSync)(c,a)}function k(a){return globalThis.__cueloRuntimeServer??={origin:a,startedAtMs:Math.round(Date.now()-1e3*process.uptime())},globalThis.__cueloRuntimeServer}function l(a){return[...new Set(a.filter(a=>"string"==typeof a&&a.trim()).map(a=>a.trim()))].sort()}function m(a,b=[]){let c=l(a),d=globalThis.__cueloRuntimeServer,f=function(){if(void 0!==globalThis.__cueloRuntimeLinuxIdentity)return globalThis.__cueloRuntimeLinuxIdentity;if(globalThis.__cueloRuntimeLinuxIdentity=null,"linux"===process.platform)try{let a=(0,e.readFileSync)(`/proc/${process.pid}/stat`,"utf8");globalThis.__cueloRuntimeLinuxIdentity={bootId:(0,e.readFileSync)("/proc/sys/kernel/random/boot_id","utf8").trim(),startTicks:Number(a.slice(a.lastIndexOf(")")+2).split(" ")[19])}}catch{}return globalThis.__cueloRuntimeLinuxIdentity}();j((0,g.join)(h(),"runtime-activity",`${process.pid}.json`),{schemaVersion:2,processId:process.pid,processStartedAtUtc:new Date(Date.now()-1e3*process.uptime()).toISOString(),...f?{linuxProcessIdentity:f}:{},updatedAtUtc:new Date().toISOString(),runningSessionIds:c,...d?{recovery:{eligible:!0,origin:d.origin,startedAtMs:d.startedAtMs,waitingSessionIds:l(b).filter(a=>c.includes(a))}}:{}})}function n(a){if(!Number.isInteger(a)||a<=0)return{state:"unknown"};try{process.kill(a,0)}catch(a){if("ESRCH"===a.code)return{state:"dead"}}if("win32"!==process.platform)return{state:"unknown"};let b=`$p = Get-CimInstance Win32_Process -Filter "ProcessId=${a}"; if ($p) { $p.CreationDate.ToUniversalTime().ToString('o') }`,c=(0,d.spawnSync)("powershell.exe",["-NoProfile","-NonInteractive","-Command",b],{encoding:"utf8",timeout:15e3,windowsHide:!0});if(c.error||0!==c.status)return{state:"unknown"};let e=String(c.stdout??"").trim();if(""===e)return{state:"dead"};let f=Date.parse(e);return Number.isFinite(f)?{state:"alive",startedAtMs:f}:{state:"unknown"}}function o(a,b,c=n){let d=(0,g.join)(h(),"runtime-activity");if(!(0,e.existsSync)(d))return null;let f=null;for(let c of(0,e.readdirSync)(d)){if(!c.endsWith(".json"))continue;let e=i((0,g.join)(d,c)),h=e&&"object"==typeof e.recovery&&e.recovery?e.recovery:null;if(!e||!h||!0!==h.eligible||h.origin!==a)continue;let j=Number(h.startedAtMs);if(!Number.isFinite(j)||j>=b||f&&j<=f.startedAtMs)continue;let k=a=>Array.isArray(a)?l(a.filter(a=>"string"==typeof a)):[];f={processId:Number(e.processId),startedAtMs:j,runningSessionIds:k(e.runningSessionIds),waitingSessionIds:k(h.waitingSessionIds),consumed:"string"==typeof h.consumedAtUtc}}if(!f)return null;let{consumed:j,...k}=f;if(j)return null;if(0===k.runningSessionIds.length)return k;let m=c(k.processId);return"dead"===m.state||"alive"===m.state&&Math.abs(m.startedAtMs-k.startedAtMs)>2e3?k:null}function p(a,b){let c=(0,g.join)(h(),"runtime-activity",`${a.processId}.json`),d=i(c),e=d&&"object"==typeof d.recovery&&d.recovery?d.recovery:null;return!!d&&!!e&&Number(e.startedAtMs)===a.startedAtMs&&(j(c,{...d,recovery:{...e,consumedAtUtc:new Date().toISOString(),consumedByStartedAtMs:b}}),!0)}},69453:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{DK:()=>D,O8:()=>C,Uv:()=>E,mD:()=>y,os:()=>B});var e=c(92582),f=c(48331),g=c(5969),h=c(29021),i=c(33873),j=c(25132),k=c(53739),l=c(40575),m=c(84240),n=c(95602),o=c(7561),p=c(36862),q=c(15395),r=c(6539),s=c(21392),t=c(74407),u=a([e,f,g,k,l,m]);async function v(a){let b=[...new Set(a.map(a=>a.cwd).filter(Boolean))],c=new Map;return await Promise.all(b.map(async a=>{c.set(a,await (0,p.KI)(a))})),a.map(a=>{let b=a.cwd?c.get(a.cwd):void 0;return{...a,projectRoot:b?.projectRoot??a.cwd,...b?.isWorktree&&b.branch?{worktreeBranch:b.branch}:{}}})}[e,f,g,k,l,m]=u.then?(await u)():u;let I="(no messages)";async function w(){let a=await e.SessionManager.listAll(),b=new Map;for(let c of a)b.set((0,o.$)(c.path),c.id);let c=a.map(a=>{C(a.id,a.path);let c=function(a){if(a.firstMessage&&a.firstMessage!==I)return a.firstMessage;if(!(a.size>4096))return null;let b=a.modified instanceof Date?a.modified:new Date(String(a.modified)),c=globalThis.__ompSessionFirstMessageCache??=new Map,d=(0,o.$)(a.path),e=c.get(d);if(e&&e.mtimeMs===b.getTime()&&e.size===a.size)return e.text;let f=function(a){let b;try{b=(0,h.openSync)(a,"r");let d=new TextDecoder,e=Buffer.alloc(65536),f="",g=0;for(;g<1048576;){let a=(0,h.readSync)(b,e,0,e.length,g);if(a<=0)break;g+=a;let i=(f+=d.decode(e.subarray(0,a),{stream:!0})).split("\n");for(let a of(f=i.pop()??"",i)){var c;let b;if(!a.includes('"role":"user"'))continue;try{b=JSON.parse(a)}catch{continue}if(!b||"object"!=typeof b||!("type"in b)||"message"!==b.type||!("message"in b))continue;let d=b.message;if(!d||"object"!=typeof d||!("role"in d)||"user"!==d.role)continue;let e=(c="content"in d?d.content:void 0,"string"==typeof c?c.trim():Array.isArray(c)?c.map(a=>a&&"object"==typeof a&&"type"in a&&"text"===a.type&&"text"in a&&"string"==typeof a.text?a.text:"").filter(Boolean).join(" ").trim():"");if(e)return e}}return null}catch{return null}finally{void 0!==b&&(0,h.closeSync)(b)}}(a.path);return c.set(d,{mtimeMs:b.getTime(),size:a.size,text:f}),f}(a);return{path:a.path,id:a.id,cwd:a.cwd,name:a.title,created:a.created instanceof Date?a.created.toISOString():String(a.created),modified:function(a){let b=a.modified instanceof Date?a.modified:new Date(String(a.modified)),c=Number.isFinite(b.getTime())?b.toISOString():String(a.modified),d=globalThis.__ompSessionActivityCache??=new Map,e=(0,o.$)(a.path),f=d.get(e);if(f&&f.mtimeMs===b.getTime()&&f.size===a.size)return f.at??c;let g=function(a){let b;try{b=(0,h.openSync)(a,"r");let c=(0,h.fstatSync)(b).size,d=Buffer.alloc(0),e=0,f=!1;for(;;){let a=e>0?d.lastIndexOf(10,e-1):-1;if(a<0&&c>0){if(!f&&d.length>=65536||d.length>=8388608)return null;let a=Math.min(65536,c),g=Buffer.alloc(a);c-=a,(0,h.readSync)(b,g,0,a,c),d=Buffer.concat([g,d]),e+=a;continue}let g=d.toString("utf8",a+1,e).trim();if(e=Math.max(a,0),g){if(!f&&!g.includes(k.SESSION_EXIT_CUSTOM_TYPE))return null;let a=JSON.parse(g);if(!a||"object"!=typeof a)return null;if("type"in a&&"custom"===a.type&&"customType"in a&&a.customType===k.SESSION_EXIT_CUSTOM_TYPE)f=!0;else{if(!f)return null;let b="timestamp"in a?a.timestamp:void 0;return"string"==typeof b&&Number.isFinite(Date.parse(b))?new Date(b).toISOString():null}}if(a<0)return null}}catch{return null}finally{void 0!==b&&(0,h.closeSync)(b)}}(a.path);return d.set(e,{mtimeMs:b.getTime(),size:a.size,at:g}),g??c}(a),messageCount:c?Math.max(a.messageCount,1):a.messageCount,firstMessage:(0,q.we)(c??"")||I,parentSessionId:a.parentSessionPath?b.get((0,o.$)(a.parentSessionPath)):void 0,transient:!1}});return v(c)}async function x(a={}){a.force&&y();let b=globalThis.__ompSessionListGeneration??0;if(globalThis.__ompSessionListCache&&Date.now()-globalThis.__ompSessionListCache.ts<J)return globalThis.__ompSessionListCache.data;if(globalThis.__ompSessionListPromise&&globalThis.__ompSessionListPromiseGeneration===b)return globalThis.__ompSessionListPromise;let c=w().then(a=>(globalThis.__ompSessionListGeneration??0)!==b?x():(globalThis.__ompSessionListCache={data:a,ts:Date.now()},a)).finally(()=>{globalThis.__ompSessionListPromise===c&&(globalThis.__ompSessionListPromise=void 0,globalThis.__ompSessionListPromiseGeneration=void 0)});return globalThis.__ompSessionListPromise=c,globalThis.__ompSessionListPromiseGeneration=b,c}let J=3e4;function y(){globalThis.__ompSessionListGeneration=(globalThis.__ompSessionListGeneration??0)+1,globalThis.__ompSessionListCache=void 0}function z(){return globalThis.__ompSessionPathCache||(globalThis.__ompSessionPathCache=new Map),globalThis.__ompSessionPathCache}function A(){return globalThis.__ompPathToSessionIdCache||(globalThis.__ompPathToSessionIdCache=new Map),globalThis.__ompPathToSessionIdCache}async function B(a){var b;let c,d,e,f,g=z().get(a);return g&&(0,h.existsSync)(g)?g:(g&&(b=a,c=z(),d=A(),e=c.get(b),c.delete(b),(f=e?(0,o.$)(e):void 0)&&d.get(f)===b&&d.delete(f)),await x(),z().get(a)??null)}function C(a,b){let c=(0,i.normalize)(b),d=(0,o.$)(c),e=z(),f=A(),g=e.get(a),h=g?(0,o.$)(g):void 0,j=f.get(d),k=j?e.get(j):void 0;h&&h!==d&&f.get(h)===a&&f.delete(h),j&&j!==a&&k&&(0,o.$)(k)===d&&e.delete(j),e.set(a,c),f.set(d,a)}async function D(a){return(await e.SessionManager.open(a)).getEntries()}function E(a,b,c={}){let d=new Map;for(let b of a)d.set(b.id,b);let f=(0,e.buildSessionContext)(a,b,d,{transcript:!0,collapseCompactedHistory:!0}),g=function(a,b,c){if(null===c)return[];let d=(c?b.get(c):void 0)??a[a.length-1];if(!d)return[];let e=[],f=new Set,g=d;for(;g&&!f.has(g.id);)f.add(g.id),e.push(g),g=g.parentId?b.get(g.parentId):void 0;return e.reverse()}(a,d,b),{displayed:h,hidden:i}=function(a){let b=-1;for(let c=a.length-1;c>=0;c--)if("compaction"===a[c].type){b=c;break}if(-1===b)return{displayed:a,hidden:[]};let c=a[b],d=[],e=[],f=!1;for(let g=0;g<b;g++)a[g].id===c.firstKeptEntryId&&(f=!0),(f?d:e).push(a[g]);return{displayed:[...d,c,...a.slice(b+1)],hidden:e}}(g),k=[],m=[];for(let a of h){let b=H(a,c);b&&(k.push(b),m.push(a.id))}return{messages:k,entryIds:m,thinkingLevel:f.thinkingLevel??"off",configuredThinkingLevel:f.configuredThinkingLevel??f.thinkingLevel??"off",thinkingCeiling:(0,t.hi)(g),model:function(a){let b=a.default;if(!b)return null;let c=b.indexOf("/");return c<=0?null:{provider:b.slice(0,c),modelId:b.slice(c+1)}}(f.models),compactedWork:function(a){let b=[],c=!1;for(let d of a){let a=H(d,{}),e=a?(0,j.sh)(a):null;e&&("user"!==e.role||b.at(-1)?.role!=="user")&&("user"!==e.role&&(c=!0),b.push(e))}let d=(0,l.getLatestTodoSnapshotIdentity)(a)?(0,l.getLatestTodoPhasesFromEntries)(a):null;return c||d?{messages:c?b:[],todoPhases:d}:null}(i)}}function F(a){let b=Date.parse(a);return Number.isNaN(b)?void 0:b}function G(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function H(a,b){switch(a.type){case"message":{let c=b.deferToolResultImages?function(a){if("toolResult"!==a.role)return a;let b=0,c=0,d=new Set,e=a.content.filter(a=>{let e=function(a){let b,c;if(!G(a)||"image"!==a.type||("string"==typeof a.data?(b=a.data,c="string"==typeof a.mimeType?a.mimeType:void 0):G(a.source)&&"base64"===a.source.type&&"string"==typeof a.source.data&&(b=a.source.data,c="string"==typeof a.source.media_type?a.source.media_type:void 0),!b))return null;let d=b.endsWith("==")?2:+!!b.endsWith("=");return{bytes:Math.max(0,Math.floor(3*b.length/4)-d),mime:c}}(a);return!e||(b+=1,c+=e.bytes,e.mime&&d.add(e.mime),!1)});if(0===b)return a;let f=d.size>0?`: ${[...d].join(", ")}`:"";return e.push({type:"text",text:`[${b} tool result image${1===b?"":"s"} omitted from initial history payload${f}, ~${c} bytes]`}),{...a,content:e}}((0,n.B)(a.message)):(0,n.B)(a.message);if(!b.deferThinking||"assistant"!==c.role)return c;return{...c,content:c.content.map(a=>"thinking"===a.type&&""!==a.thinking.trim()?{...a,thinking:"",deferred:!0}:a)}}case"compaction":return{role:"custom",customType:"compaction",content:a.summary,display:!0,details:{tokensBefore:a.tokensBefore,firstKeptEntryId:a.firstKeptEntryId},timestamp:F(a.timestamp)};case"branch_summary":if(!a.summary)return null;return{role:"user",content:`*The conversation briefly explored another branch and returned with this summary:*
12
12
 
13
13
  ${a.summary}`,timestamp:F(a.timestamp)};case"custom_message":if(a.customType===r.BD){let b=(0,r.hw)(a.content,a.details);if(b?.role==="user")return{role:"user",content:b.text,timestamp:F(a.timestamp)};if(b?.role==="assistant"){let c=(0,r.p8)(a.details);return{role:"assistant",content:[{type:"text",text:b.text}],model:"Codex Live",provider:"openai-codex",...c?{liveSpeaker:c}:{},stopReason:"stop",timestamp:F(a.timestamp)}}}if(a.customType===s.gt){let b="string"==typeof a.content?a.content:a.content.map(a=>"text"===a.type?a.text:"").join("\n");if(b.trim())return{role:"assistant",content:[{type:"text",text:b}],model:s.$f,provider:"web6",stopReason:"stop",timestamp:F(a.timestamp)}}return{role:"custom",customType:a.customType,content:a.content,display:a.display,details:a.details,timestamp:F(a.timestamp)};default:return null}}d()}catch(a){d(a)}})},72107:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{Ex:()=>j,Ff:()=>i});var e=c(73079),f=c(88692),g=c(96282),h=a([e,f,g]);function i(a){let b=(0,g.parseModelString)(a.getModelRole("default")??"");if(!b)return;let c=void 0===b.thinkingLevel||"auto"===b.thinkingLevel?void 0:b.thinkingLevel;return{provider:b.provider,modelId:b.id,...c?{thinkingLevel:c}:{}}}function j(a){let b=new Set,c=[];for(let d of(0,e.getKnownRoleIds)(a)){let e=function(a){if(!a)return;let b=a.indexOf("/");if(b<=0)return;let c=a.slice(b+1).split(":")[0];if(c)return{provider:a.slice(0,b),modelId:c}}(a.getModelRole(d));if(!e)continue;let f=`${e.provider}/${e.modelId}`;b.has(f)||(b.add(f),c.push(e))}return c}[e,f,g]=h.then?(await h)():h,d()}catch(a){d(a)}})},74407:(a,b,c)=>{c.d(b,{FR:()=>d,KE:()=>f,hi:()=>g});let d="cuelo-thinking-ceiling",e=["minimal","low","medium","high","xhigh","max"];function f(a){return"string"==typeof a&&e.includes(a)}function g(a){for(let b=a.length-1;b>=0;b--){let c=a[b];if(c?.type!=="custom"||c.customType!==d)continue;let e=c.data?.ceiling;return f(e)?e:null}return null}},79055:(a,b,c)=>{function d(a,b={}){let c=b.intervalMs??6e4,e=b.now??Date.now,f=new Map,g=new Map;return{recover:(b,d={})=>{let h=g.get(b);if(h)return h.then(a=>({...a,shared:!0}));let i=e(),j=f.get(b);if(!d.force&&void 0!==j&&i-j<c)return Promise.resolve({outcome:"throttled",shared:!1});f.set(b,i);let k=a.refreshProvider(b,"online").then(()=>({outcome:"refreshed",shared:!1})).catch(a=>({outcome:"failed",shared:!1,error:function(a){let b=[],c=a;for(let a=0;a<3&&void 0!==c;a+=1){if(c instanceof Error){b.push(c.message),c=c.cause;continue}if("object"==typeof c&&null!==c){let a=c;"string"==typeof a.message&&b.push(a.message),"string"==typeof a.code&&b.push(a.code),"number"==typeof a.status&&b.push(`HTTP ${a.status}`),c=a.cause;continue}b.push(String(c));break}let d=b.join(" "),e=d.match(/\b(?:HTTP\s*)?([45]\d{2})\b/i)?.[1];if("401"===e||"403"===e||/\b(?:api[- ]?key|credential|authentication|unauthorized|forbidden)\b/i.test(d))return e?`provider authentication failed (HTTP ${e})`:"provider authentication failed";let f=d.match(/\b(EAI_AGAIN|ECONNREFUSED|ECONNRESET|ENETUNREACH|ENOTFOUND|ETIMEDOUT|UND_ERR_CONNECT_TIMEOUT|UND_ERR_HEADERS_TIMEOUT|UND_ERR_BODY_TIMEOUT)\b/i)?.[1];return f?f.toUpperCase():/\b(?:timed?\s*out|timeout)\b/i.test(d)?"request timed out":e?`HTTP ${e}`:"discovery request failed"}(a)})).finally(()=>{g.get(b)===k&&g.delete(b)});return g.set(b,k),k}}}function e(a){return a.providerKnown?"failed"===a.recovery.outcome?`Model ${a.selector} is not in the model list and the discovery refresh for provider "${a.provider}" failed: ${a.recovery.error??"unknown error"}.`:"throttled"===a.recovery.outcome?`Model ${a.selector} is not in the model list. Discovery for provider "${a.provider}" was refreshed recently, so this lookup did not fetch again.`:`Model ${a.selector} is not in the model list after refreshing discovery for provider "${a.provider}".`:`Unknown model provider "${a.provider}" for ${a.selector}: the provider is not registered.`}c.d(b,{fw:()=>d,zX:()=>e})},81008:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{ABRUPT_RESUME_MESSAGE:()=>C,INTERRUPT_RESUME_MESSAGE:()=>B,effectiveServerOrigin:()=>w,ensureInterruptWatcher:()=>v,handleInterruptRequest:()=>s,recoverAbruptStop:()=>y,resumeInterruptedSessions:()=>t});var e=c(73024),f=c(48161),g=c(76760),h=c(12144),i=c(69453),j=c(14e3),k=c(61024),l=a([h,i]);[h,i]=l.then?(await l)():l;let z=/^[A-Za-z0-9_.-]{1,80}$/,A=/^[0-9a-f-]{36}$/,B="[자동 재개] CUELO 업데이트\xb7재시작 때문에 이 세션의 진행 중 작업이 중단(abort)됐다. 서버가 새 버전으로 다시 떴다. 중단 직전에 돌던 명령\xb7도구 결과는 사라졌을 수 있으니 파일\xb7프로세스 상태를 먼저 확인하고, 하던 작업을 이어서 진행한다. 그때 돌던 SubAgent(task child)도 멈췄지만 기록은 남아 있다. 결과를 받지 못한 child에는 먼저 `write agent://<id>`로 이어서 하라고 보내 되살리고, 되살아나지 않으면(isolated 작업 공간 등) 남은 파일 상태를 확인한 뒤 새로 맡긴다.",C="[자동 재개] CUELO 서버가 예기치 않게 종료돼 이 세션의 진행 중 작업이 중간에 끊겼다. 서버가 다시 떴다. 끊기기 직전에 돌던 명령\xb7도구 결과는 사라졌을 수 있다. 그 명령을 그대로 다시 실행하지 말고, 파일\xb7프로세스 상태를 먼저 확인한 뒤 하던 작업을 이어서 진행한다. 그때 돌던 SubAgent(task child)도 멈췄지만 기록은 남아 있다. 결과를 받지 못한 child에는 먼저 `write agent://<id>`로 이어서 하라고 보내 되살리고, 되살아나지 않으면 남은 파일 상태를 확인한 뒤 새로 맡긴다.";function m(){let a=process.env.CUELO_EXTERNAL_UPDATE_ROOT?.trim();return(0,g.join)((0,g.resolve)(a||(0,g.join)((0,f.homedir)(),".omp","external-update")),"interrupts")}function n(){return(0,g.join)(m(),"pending-resume.json")}function o(a){try{let b=JSON.parse((0,e.readFileSync)(a,"utf8").replace(/^\uFEFF/,""));return b&&"object"==typeof b?b:null}catch{return null}}function p(a,b){(0,e.mkdirSync)((0,g.dirname)(a),{recursive:!0});let c=`${a}.${process.pid}.${Date.now()}.tmp`;try{(0,e.writeFileSync)(c,`${JSON.stringify(b,null,2)}
14
14
  `,"utf8"),(0,e.renameSync)(c,a)}catch(a){try{(0,e.rmSync)(c,{force:!0})}catch{}throw a}}function q(a){return(a instanceof Error?a.message:String(a)).replace(/\s+/g," ").trim().slice(0,200)}function r(){let a=o(n());if(!a||1!==a.schemaVersion||!Array.isArray(a.sessionIds))return null;let b=a.sessionIds.filter(a=>"string"==typeof a&&A.test(a)),c=[];if(Array.isArray(a.failures))for(let b of a.failures){if(!b||"object"!=typeof b)continue;let a="string"==typeof b.sessionId?b.sessionId:"";A.test(a)&&c.push({sessionId:a,error:String(b.error??""),atUtc:String(b.atUtc??"")})}let d="string"==typeof a.requestId&&z.test(a.requestId)?a.requestId:void 0,e=Array.isArray(a.abruptSessionIds)?a.abruptSessionIds.filter(a=>"string"==typeof a&&A.test(a)&&b.includes(a)):[];return{schemaVersion:1,writerPid:Number(a.writerPid),...d?{requestId:d}:{},sessionIds:b,updatedAtUtc:String(a.updatedAtUtc??""),...c.length>0?{failures:c}:{},...e.length>0?{abruptSessionIds:e}:{}}}async function s(a,b){let c=m(),d=o((0,g.join)(c,"request.json")),f="string"==typeof d?.id?d.id:"";if(!z.test(f)||a.has(f)||b.has(f)||(0,e.existsSync)((0,g.join)(c,`${f}.ack.json`)))return!1;b.add(f);try{let b=Date.parse(String(d?.atUtc??"")),e=Date.now()-1e3*process.uptime();if(!Number.isFinite(b)||b<e)return!1;let i=new Set(Array.isArray(d?.excludeSessionIds)?d.excludeSessionIds.map(a=>String(a).toLowerCase()):[]),j=(0,h.HG)().filter(a=>A.test(a)&&!i.has(a)),k=r(),l=[...new Set([...k?.sessionIds??[],...j])].sort(),m=(k?.failures??[]).filter(a=>l.includes(a.sessionId)),o=(k?.abruptSessionIds??[]).filter(a=>l.includes(a));p(n(),{schemaVersion:1,writerPid:process.pid,requestId:f,sessionIds:l,updatedAtUtc:new Date().toISOString(),...m.length>0?{failures:m}:{},...o.length>0?{abruptSessionIds:o}:{}});let s=[],t=[];for(let a of j)try{await (0,h.A4)(a)?.send({type:"abort"}),s.push(a)}catch(b){t.push({sessionId:a,error:q(b)})}let u=[];return await Promise.all(j.map(async a=>{try{(await (0,h.A4)(a)?.stopBackgroundWorkForDrain(5e3)??!0)||u.push(a)}catch(b){u.push(a),t.push({sessionId:a,error:q(b)})}})),p((0,g.join)(c,`${f}.ack.json`),{schemaVersion:1,id:f,processId:process.pid,aborted:s,failed:t,unsettled:u.sort(),atUtc:new Date().toISOString()}),a.add(f),!0}finally{b.delete(f)}}let D=new Set,E="",F=null;async function t(){if(F)return F;let a=u().finally(()=>{F=null});return F=a,a}async function u(){let a=r();if(!a||a.writerPid===process.pid)return[];let b=a.requestId??`pid:${a.writerPid}`;b!==E&&(E=b,D=new Set);let c=[],d=new Map,f=()=>{try{!function(a,b){let c=r();if(!c||c.writerPid!==a.writerPid||c.requestId!==a.requestId)return;let d=c.sessionIds.filter(a=>!D.has(a));if(0===d.length)return(0,e.rmSync)(n(),{force:!0});let f=new Map;for(let a of c.failures??[])d.includes(a.sessionId)&&f.set(a.sessionId,a);for(let[a,c]of b)d.includes(a)&&f.set(a,c);let g={schemaVersion:1,writerPid:c.writerPid,...c.requestId?{requestId:c.requestId}:{},sessionIds:d,updatedAtUtc:new Date().toISOString()};f.size>0&&(g.failures=[...f.values()]);let h=(c.abruptSessionIds??[]).filter(a=>d.includes(a));h.length>0&&(g.abruptSessionIds=h),p(n(),g)}(a,d)}catch(a){console.error("[update-interrupt] pending save failed:",a)}};for(let b of a.sessionIds)if(!D.has(b))try{let d=(0,h.A4)(b),e=d?.isAlive()?d:await (async()=>{let a=await (0,i.os)(b);if(!a)throw Error(`session record not found: ${b}`);return(await (0,h.OF)(b,a,void 0)).session})();if(e.isRunning()){D.add(b),f();continue}let g=a.abruptSessionIds?.includes(b)===!0;if(g&&!(0,j.w)(e.inner.messages)){D.add(b),f();continue}await e.sendInternalPrompt(g?C:B),c.push(b),D.add(b),f()}catch(a){d.set(b,{sessionId:b,error:q(a),atUtc:new Date().toISOString()}),console.error(`[update-interrupt] resume failed ${b}:`,a)}return f(),c}function v(){let a=globalThis;if(a.__ompwebInterruptWatcher)return;a.__ompwebInterruptWatcher=!0;let b=new Set,c=new Set,d=!1,e=Date.now(),f=async()=>{e=Date.now(),await t()},g=async()=>{if(!d){d=!0;try{try{await s(b,c)}catch(a){console.error("[update-interrupt] request failed:",a)}if(Date.now()-e>=3e3)try{await f()}catch(a){console.error("[update-interrupt] resume failed:",a)}}finally{d=!1}}};setInterval(()=>void g(),1e3).unref?.(),setTimeout(()=>void g(),3e3).unref?.()}function w(){let a=Number(process.env.PORT);return!Number.isInteger(a)||a<=0?null:`port:${a}`}async function x(a){let b=await (0,i.os)(a);return!!b&&(0,j.w)((0,i.Uv)(await (0,i.DK)(b)).messages)}async function y(a={}){let b,c,d,e,f,g=void 0===a.origin?w():a.origin;if(!g)return{queued:[],skipped:[]};let h=(0,k.Q4)(g),i=(0,k.Ef)(g,h.startedAtMs,a.probe);if(!i)return{queued:[],skipped:[]};let j=a.isInterrupted??x,l=[],m=[];for(let a of i.runningSessionIds){if(!A.test(a)||i.waitingSessionIds.includes(a)){m.push(a);continue}try{(await j(a)?l:m).push(a)}catch(b){m.push(a),console.error(`[update-interrupt] abrupt-stop check failed ${a}:`,b)}}return l.length>0&&(b=r(),c=new Set(b?.sessionIds??[]),d=[...new Set([...c,...l])].sort(),e=[...new Set([...b?.abruptSessionIds??[],...l.filter(a=>!c.has(a))])].sort(),f=(b?.failures??[]).filter(a=>d.includes(a.sessionId)),p(n(),{schemaVersion:1,writerPid:b?.writerPid??(i.processId===process.pid?0:i.processId),requestId:b?.requestId??`abrupt-${i.startedAtMs}`,sessionIds:d,updatedAtUtc:new Date().toISOString(),...f.length>0?{failures:f}:{},abruptSessionIds:e})),(0,k.W4)(i,h.startedAtMs),l.length>0&&v(),{queued:l,skipped:m}}d()}catch(a){d(a)}})},82368:(a,b,c)=>{let{createHash:d,randomBytes:e,randomUUID:f,scryptSync:g,timingSafeEqual:h}=c(77598),{mkdirSync:i,readFileSync:j,renameSync:k,statSync:l,unlinkSync:m,writeFileSync:n}=c(73024),{homedir:o}=c(48161),{basename:p,dirname:q,join:r,resolve:s}=c(76760),t="cuelo-auth.json",u={algorithm:"scrypt",cost:16384,blockSize:8,parallelization:1,keyLength:64},v="0123456789ABCDEFGHJKMNPQRSTVWXYZ",w=/^[a-z0-9][a-z0-9._-]{0,63}$/;function x(a=process.env){if(a.PI_CODING_AGENT_DIR)return s(a.PI_CODING_AGENT_DIR);let b=r(o(),a.PI_CONFIG_DIR||".omp"),c=function(a){let b="string"==typeof a?a.trim():"";if(b&&"default"!==b)return w.test(b)&&!b.endsWith(".")?b:void 0}(void 0!==a.OMP_PROFILE?a.OMP_PROFILE:a.PI_PROFILE);return c?r(b,"profiles",c,"agent"):r(b,"agent")}function y(a=process.env){return a.CUELO_AUTH_FILE?s(a.CUELO_AUTH_FILE):r(x(a),t)}function z(a){return"string"!=typeof a?"A password is required.":a.length<8?"The password must be at least 8 characters long.":a.length>256?"The password must be at most 256 characters long.":0===a.trim().length?"The password cannot be only whitespace.":null}function A(a){let b=128*a.cost*a.blockSize*a.parallelization;return{N:a.cost,r:a.blockSize,p:a.parallelization,maxmem:Math.max(2*b,0x2000000)}}function B(a){var b;return!!a&&"object"==typeof a&&"scrypt"===a.algorithm&&"string"==typeof a.salt&&a.salt.length>0&&"string"==typeof a.hash&&a.hash.length>0&&Number.isInteger(b=a.cost)&&b>1&&(b&b-1)==0&&a.cost<=1048576&&Number.isInteger(a.blockSize)&&a.blockSize>=1&&a.blockSize<=32&&Number.isInteger(a.parallelization)&&a.parallelization>=1&&a.parallelization<=8&&Number.isInteger(a.keyLength)&&a.keyLength>=16&&a.keyLength<=128}function C(a,b=u){let c={...u,...b,algorithm:"scrypt"},d=e(16),f=g(a,d,c.keyLength,A(c));return{...c,salt:d.toString("base64"),hash:f.toString("base64")}}function D(a,b){if("string"!=typeof a||!B(b))return!1;try{let c=Buffer.from(b.salt,"base64"),d=Buffer.from(b.hash,"base64");if(0===c.length||d.length!==b.keyLength)return!1;let e=g(a,c,b.keyLength,A(b));return h(e,d)}catch{return!1}}function E(a){try{return l(a),"present"}catch(a){if(a&&"ENOENT"===a.code)return"missing";throw a}}function F(a,b){if("present"===E(a))return;let c=r(q(a),b);if("missing"!==E(c))try{k(c,a)}catch(b){if("present"===E(a))return;throw b}}function G(a=y()){let b;if(p(a)===t)try{F(a,"omp-web-auth.json")}catch{return{status:"unreadable",config:null}}try{b=j(a,"utf8")}catch(a){if(a&&"ENOENT"===a.code)return{status:"missing",config:null};return{status:"unreadable",config:null}}try{let a=JSON.parse(b);if(!a||"object"!=typeof a||Array.isArray(a))return{status:"unreadable",config:null};return{status:"ok",config:a}}catch{return{status:"unreadable",config:null}}}function H(a,b=y()){let c=q(b);i(c,{recursive:!0,mode:448});let d=r(c,`.${p(b)}-${f()}.tmp`);try{n(d,`${JSON.stringify(a,null,2)}