agentroam-runtime-darwin-arm64 0.2.0-preview.80 → 0.2.0-preview.81

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 (129) hide show
  1. package/manifest.json +1 -1
  2. package/package.json +1 -1
  3. package/runtime/.next/BUILD_ID +1 -1
  4. package/runtime/.next/app-build-manifest.json +8 -8
  5. package/runtime/.next/app-path-routes-manifest.json +1 -1
  6. package/runtime/.next/build-manifest.json +3 -3
  7. package/runtime/.next/prerender-manifest.json +1 -1
  8. package/runtime/.next/required-server-files.json +1 -1
  9. package/runtime/.next/server/app/_not-found/page.js +1 -1
  10. package/runtime/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  11. package/runtime/.next/server/app/_not-found.html +1 -1
  12. package/runtime/.next/server/app/_not-found.rsc +1 -1
  13. package/runtime/.next/server/app/api/agent/abort/route.js +1 -1
  14. package/runtime/.next/server/app/api/agent/answer/route.js +1 -1
  15. package/runtime/.next/server/app/api/agent/codex-sharing/route.js +1 -1
  16. package/runtime/.next/server/app/api/agent/harness/status/route.js +1 -1
  17. package/runtime/.next/server/app/api/agent/model/route.js +1 -1
  18. package/runtime/.next/server/app/api/agent/models/route.js +1 -1
  19. package/runtime/.next/server/app/api/agent/run/route.js +1 -1
  20. package/runtime/.next/server/app/api/agent/runtime-health/route.js +1 -1
  21. package/runtime/.next/server/app/api/agent/steer/route.js +1 -1
  22. package/runtime/.next/server/app/api/agent/stream/route.js +2 -2
  23. package/runtime/.next/server/app/api/agent-workspaces/[workspaceId]/sessions/route.js +1 -1
  24. package/runtime/.next/server/app/api/agent-workspaces/route.js +1 -1
  25. package/runtime/.next/server/app/api/auth/verify/route.js +1 -1
  26. package/runtime/.next/server/app/api/business/route.js +1 -1
  27. package/runtime/.next/server/app/api/calendar/route.js +2 -2
  28. package/runtime/.next/server/app/api/client-logs/route.js +1 -1
  29. package/runtime/.next/server/app/api/collaboration/route.js +2 -2
  30. package/runtime/.next/server/app/api/engine-threads/route.js +1 -1
  31. package/runtime/.next/server/app/api/engine-threads.body +1 -1
  32. package/runtime/.next/server/app/api/flow/v1/catalog/route.js +1 -1
  33. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/cancel/route.js +1 -1
  34. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/events/route.js +2 -2
  35. package/runtime/.next/server/app/api/flow/v1/runs/route.js +1 -1
  36. package/runtime/.next/server/app/api/flow-studio/config/route.js +1 -1
  37. package/runtime/.next/server/app/api/internal/todo-bootstrap/route.js +1 -1
  38. package/runtime/.next/server/app/api/internal/todo-mcp/route.js +1 -1
  39. package/runtime/.next/server/app/api/mcp/connect/route.js +1 -1
  40. package/runtime/.next/server/app/api/mcp/disconnect/route.js +1 -1
  41. package/runtime/.next/server/app/api/mcp/servers/route.js +1 -1
  42. package/runtime/.next/server/app/api/mcp/servers.body +1 -1
  43. package/runtime/.next/server/app/api/memory/[key]/route.js +1 -1
  44. package/runtime/.next/server/app/api/memory/route.js +1 -1
  45. package/runtime/.next/server/app/api/messaging/route.js +1 -1
  46. package/runtime/.next/server/app/api/notifications/[id]/ack/route.js +1 -1
  47. package/runtime/.next/server/app/api/notifications/[id]/route.js +1 -1
  48. package/runtime/.next/server/app/api/notifications/route.js +1 -1
  49. package/runtime/.next/server/app/api/notifications/stream/route.js +2 -2
  50. package/runtime/.next/server/app/api/plugins/load/route.js +1 -1
  51. package/runtime/.next/server/app/api/projects/[id]/route.js +1 -1
  52. package/runtime/.next/server/app/api/projects/check/route.js +1 -1
  53. package/runtime/.next/server/app/api/projects/directories/route.js +1 -1
  54. package/runtime/.next/server/app/api/projects/roots/route.js +1 -1
  55. package/runtime/.next/server/app/api/projects/route.js +1 -1
  56. package/runtime/.next/server/app/api/push/subscribe/route.js +2 -2
  57. package/runtime/.next/server/app/api/push/unsubscribe/route.js +2 -2
  58. package/runtime/.next/server/app/api/push/vapid/route.js +2 -2
  59. package/runtime/.next/server/app/api/push/vapid.body +1 -1
  60. package/runtime/.next/server/app/api/remote-tools/register/route.js +1 -1
  61. package/runtime/.next/server/app/api/session-images/[id]/route.js +1 -1
  62. package/runtime/.next/server/app/api/session-views/route.js +1 -1
  63. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/route.js +1 -1
  64. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/stop/route.js +1 -1
  65. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/route.js +1 -1
  66. package/runtime/.next/server/app/api/sessions/[id]/changes/route.js +2 -2
  67. package/runtime/.next/server/app/api/sessions/[id]/engine-switches/route.js +1 -1
  68. package/runtime/.next/server/app/api/sessions/[id]/fork/route.js +1 -1
  69. package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js +1 -1
  70. package/runtime/.next/server/app/api/sessions/[id]/goals/route.js +1 -1
  71. package/runtime/.next/server/app/api/sessions/[id]/handoff/route.js +1 -1
  72. package/runtime/.next/server/app/api/sessions/[id]/native-goal/route.js +1 -1
  73. package/runtime/.next/server/app/api/sessions/[id]/query-index/route.js +1 -1
  74. package/runtime/.next/server/app/api/sessions/[id]/release/route.js +1 -1
  75. package/runtime/.next/server/app/api/sessions/[id]/route.js +1 -1
  76. package/runtime/.next/server/app/api/sessions/[id]/switch-engine/route.js +1 -1
  77. package/runtime/.next/server/app/api/sessions/[id]/thread-goal/route.js +1 -1
  78. package/runtime/.next/server/app/api/sessions/[id]/thread-history/route.js +1 -1
  79. package/runtime/.next/server/app/api/sessions/[id]/tool-result/route.js +1 -1
  80. package/runtime/.next/server/app/api/sessions/parallel/route.js +1 -1
  81. package/runtime/.next/server/app/api/sessions/route.js +1 -1
  82. package/runtime/.next/server/app/api/settings/route.js +1 -1
  83. package/runtime/.next/server/app/api/skills/route.js +1 -1
  84. package/runtime/.next/server/app/api/todos/[id]/commands/route.js +1 -1
  85. package/runtime/.next/server/app/api/todos/[id]/executions/route.js +1 -1
  86. package/runtime/.next/server/app/api/todos/[id]/route.js +1 -1
  87. package/runtime/.next/server/app/api/todos/route.js +1 -1
  88. package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js +1 -1
  89. package/runtime/.next/server/app/api/tool-policies/route.js +1 -1
  90. package/runtime/.next/server/app/api/tools/route.js +1 -1
  91. package/runtime/.next/server/app/api/update/check/route.js +1 -1
  92. package/runtime/.next/server/app/api/update/install/route.js +1 -1
  93. package/runtime/.next/server/app/api/update/status/route.js +1 -1
  94. package/runtime/.next/server/app/api/web-auth/login/route.js +1 -1
  95. package/runtime/.next/server/app/api/web-auth/logout/route.js +1 -1
  96. package/runtime/.next/server/app/api/web-auth/revoke-all/route.js +1 -1
  97. package/runtime/.next/server/app/api/web-auth/setup/route.js +1 -1
  98. package/runtime/.next/server/app/api/web-auth/status/route.js +1 -1
  99. package/runtime/.next/server/app/api/web-console/bootstrap/route.js +1 -1
  100. package/runtime/.next/server/app/api/web-console/computer-settings/route.js +1 -1
  101. package/runtime/.next/server/app/api/web-console/computers/route.js +1 -1
  102. package/runtime/.next/server/app/api/web-console/device-state/route.js +1 -1
  103. package/runtime/.next/server/app/api/web-console/history/route.js +1 -1
  104. package/runtime/.next/server/app/api/web-console/preferences/route.js +1 -1
  105. package/runtime/.next/server/app/api/workspace-changes/route.js +1 -1
  106. package/runtime/.next/server/app/web/page.js +4 -4
  107. package/runtime/.next/server/app/web/page_client-reference-manifest.js +1 -1
  108. package/runtime/.next/server/app-paths-manifest.json +33 -33
  109. package/runtime/.next/server/chunks/1298.js +1 -1
  110. package/runtime/.next/server/chunks/5303.js +1 -1
  111. package/runtime/.next/server/chunks/6703.js +1 -1
  112. package/runtime/.next/server/chunks/9119.js +2 -2
  113. package/runtime/.next/server/chunks/9457.js +1 -1
  114. package/runtime/.next/server/middleware-build-manifest.js +1 -1
  115. package/runtime/.next/server/pages/404.html +1 -1
  116. package/runtime/.next/server/pages/500.html +1 -1
  117. package/runtime/.next/server/server-reference-manifest.json +1 -1
  118. package/runtime/.next/static/chunks/app/web/error-30cea9cffce0ebc2.js +1 -0
  119. package/runtime/.next/static/chunks/app/web/layout-d8a4f4131e7f2330.js +1 -0
  120. package/runtime/.next/static/chunks/app/web/{page-2e962377e57d3383.js → page-b0da5ef19349a66b.js} +1 -1
  121. package/runtime/.next/static/chunks/{main-app-ea4c5663714943e2.js → main-app-30a478479a347a9e.js} +1 -1
  122. package/runtime/lib/remote-control/helper-manager.mjs +36 -2
  123. package/runtime/lib/remote-control/macos-helper-app.mjs +85 -15
  124. package/runtime/lib/remote-control/macos-helper-permissions.mjs +113 -0
  125. package/runtime/server.js +1 -1
  126. package/runtime/.next/static/chunks/app/web/error-f313c4014e78cef5.js +0 -1
  127. package/runtime/.next/static/chunks/app/web/layout-80fa1b5f4c96b0b5.js +0 -1
  128. /package/runtime/.next/static/{57IUKkg-db8mOGDMma8be → 5rv6PMhU7yq1sI1ClFWRU}/_buildManifest.js +0 -0
  129. /package/runtime/.next/static/{57IUKkg-db8mOGDMma8be → 5rv6PMhU7yq1sI1ClFWRU}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=3097,e.ids=[3097],e.modules={8042:e=>{e.exports=require("@agent/computer-use")},1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},9426:(e,t,s)=>{s.r(t),s.d(t,{originalPathname:()=>y,patchFetch:()=>w,requestAsyncStorage:()=>x,routeModule:()=>g,serverHooks:()=>q,staticGenerationAsyncStorage:()=>S});var r={};s.r(r),s.d(r,{GET:()=>f});var n=s(7786),o=s(5042),i=s(2184),a=s(1890),l=s(1636),u=s(9119),c=s(5801),d=s(8274),p=s(2847),h=s(5762);let m=new l.SessionQueryIndexCache;async function f(e,{params:t}){if((0,c.V_)(t.id))try{let e=await (0,h.SU)(t.id);if(e)return a.NextResponse.json(e);return a.NextResponse.json(await (0,c.getNativeRuntimeService)().getQueryIndex(t.id))}catch(e){return a.NextResponse.json({error:e instanceof Error?e.message:"Internal error",...e instanceof p.RuntimeSessionError||e instanceof l.StaleSessionAnchorError?{code:e.code}:{}},{status:e instanceof l.StaleSessionAnchorError?409:(0,c.WW)(e)})}let s=await u.agentHost.getSessionStore().get(t.id);if(!s)return a.NextResponse.json({error:"Session not found"},{status:404});let r=(!s.messages?.length&&s.events?.length?d.Q(s.events):s.messages)?.filter(e=>!l.isInternalGoalMessage(e))??[];return a.NextResponse.json(m.getOrCreate(t.id,r))}let g=new n.AppRouteRouteModule({definition:{kind:o.x.APP_ROUTE,page:"/api/sessions/[id]/query-index/route",pathname:"/api/sessions/[id]/query-index",filename:"route",bundlePath:"app/api/sessions/[id]/query-index/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-preview80-20261125.e3ZzMB/source/packages/server/app/api/sessions/[id]/query-index/route.ts",nextConfigOutput:"standalone",userland:r}),{requestAsyncStorage:x,staticGenerationAsyncStorage:S,serverHooks:q}=g,y="/api/sessions/[id]/query-index/route";function w(){return(0,i.patchFetch)({serverHooks:q,staticGenerationAsyncStorage:S})}},8274:(e,t,s)=>{s.d(t,{Q:()=>r});function r(e,t={}){let s=[],r=null,n=0,o=()=>`${t.runId??"event-history"}:${n++}`;for(let n of e){if("text_chunk"===n.type){r||(r={id:o(),role:"assistant",content:"",isStreaming:t.isStreaming??!0,timestamp:Date.now()},s.push(r)),r.content=`${r.content??""}${n.text??""}`;continue}if("tool_call"===n.type&&n.toolCall){r?(r.toolCalls=[n.toolCall],r.isStreaming=!1):s.push({id:o(),role:"assistant",content:"",toolCalls:[n.toolCall],isStreaming:!1,timestamp:Date.now()}),r=null;continue}if("tool_result"===n.type&&n.result){let e=n.result;s.push({id:o(),role:"tool",content:e.content??"",toolCallId:e.toolCallId,timestamp:Date.now()});continue}if("ask_user"===n.type){s.push({id:o(),role:"assistant",content:"",askUser:{questionId:n.questionId,question:n.question??"",options:n.options,fields:n.fields,multiSelect:n.multiSelect},timestamp:Date.now()});continue}"done"===n.type&&"string"==typeof n.finalText&&(r?(r.content=n.finalText,r.isStreaming=!1):n.finalText.trim()&&s.push({id:o(),role:"assistant",content:n.finalText,timestamp:Date.now()}),r=null)}return s}},1489:(e,t,s)=>{s.d(t,{N:()=>l});var r=s(1636),n=s(2847),o=s(785);class i{constructor(){this.tasks=new r.CronTasks((0,o.kO)()),this.scheduler=new n.CronScheduler(this.tasks,e=>{this.fire(e).catch(e=>console.error("Scheduled Customer Agent run failed",e))},()=>{}),this.scheduler.start()}async fire(e){let{agentHost:t}=await Promise.all([s.e(1973),s.e(9119),s.e(535)]).then(s.bind(s,9119)),{getCustomerGoalCoordinator:r}=await Promise.all([s.e(1973),s.e(9119),s.e(2324)]).then(s.bind(s,6435)),n=e.sessionId;n&&await t.getSessionStore().get(n)||(n=(await t.createSession(e.label||"定时任务")).id,this.tasks.update(e.id,{sessionId:n})),await r().enqueue(n,e.prompt)}call(e,t){let s=String(t[0]||"");switch(e){case"cronList":return this.tasks.list();case"cronCreate":{if("string"!=typeof t[0]||"string"!=typeof t[1]||!t[1].trim())throw Error("cron and prompt required");let e=t[2]&&"object"==typeof t[2]?t[2]:{};return this.tasks.create({cron:t[0],prompt:t[1],recurring:!1!==e.recurring,enabled:!0,durable:!0,..."string"==typeof e.sessionId?{sessionId:e.sessionId}:{},..."string"==typeof e.label?{label:e.label}:{}})}case"cronPause":return this.tasks.pause(s);case"cronResume":return this.tasks.resume(s);case"cronDelete":return this.tasks.delete(s);case"cronDeleteAll":return this.tasks.deleteAll(),{ok:!0};default:throw Error("Unsupported schedule operation")}}}let a=globalThis;function l(){return a.__sharedCronService??=new i}}};var t=require("../../../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[8375,6703,1973,4621,5801,9119,5762],()=>s(9426));module.exports=r})();
1
+ "use strict";(()=>{var e={};e.id=3097,e.ids=[3097],e.modules={8042:e=>{e.exports=require("@agent/computer-use")},1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},9846:(e,t,s)=>{s.r(t),s.d(t,{originalPathname:()=>q,patchFetch:()=>w,requestAsyncStorage:()=>x,routeModule:()=>g,serverHooks:()=>y,staticGenerationAsyncStorage:()=>S});var r={};s.r(r),s.d(r,{GET:()=>f});var n=s(7786),o=s(5042),i=s(2184),a=s(1890),l=s(1636),u=s(9119),c=s(5801),d=s(8274),p=s(2847),h=s(5762);let m=new l.SessionQueryIndexCache;async function f(e,{params:t}){if((0,c.V_)(t.id))try{let e=await (0,h.SU)(t.id);if(e)return a.NextResponse.json(e);return a.NextResponse.json(await (0,c.getNativeRuntimeService)().getQueryIndex(t.id))}catch(e){return a.NextResponse.json({error:e instanceof Error?e.message:"Internal error",...e instanceof p.RuntimeSessionError||e instanceof l.StaleSessionAnchorError?{code:e.code}:{}},{status:e instanceof l.StaleSessionAnchorError?409:(0,c.WW)(e)})}let s=await u.agentHost.getSessionStore().get(t.id);if(!s)return a.NextResponse.json({error:"Session not found"},{status:404});let r=(!s.messages?.length&&s.events?.length?d.Q(s.events):s.messages)?.filter(e=>!l.isInternalGoalMessage(e))??[];return a.NextResponse.json(m.getOrCreate(t.id,r))}let g=new n.AppRouteRouteModule({definition:{kind:o.x.APP_ROUTE,page:"/api/sessions/[id]/query-index/route",pathname:"/api/sessions/[id]/query-index",filename:"route",bundlePath:"app/api/sessions/[id]/query-index/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-npm-remote-auth-20261125.yi_kd6wp/source/packages/server/app/api/sessions/[id]/query-index/route.ts",nextConfigOutput:"standalone",userland:r}),{requestAsyncStorage:x,staticGenerationAsyncStorage:S,serverHooks:y}=g,q="/api/sessions/[id]/query-index/route";function w(){return(0,i.patchFetch)({serverHooks:y,staticGenerationAsyncStorage:S})}},8274:(e,t,s)=>{s.d(t,{Q:()=>r});function r(e,t={}){let s=[],r=null,n=0,o=()=>`${t.runId??"event-history"}:${n++}`;for(let n of e){if("text_chunk"===n.type){r||(r={id:o(),role:"assistant",content:"",isStreaming:t.isStreaming??!0,timestamp:Date.now()},s.push(r)),r.content=`${r.content??""}${n.text??""}`;continue}if("tool_call"===n.type&&n.toolCall){r?(r.toolCalls=[n.toolCall],r.isStreaming=!1):s.push({id:o(),role:"assistant",content:"",toolCalls:[n.toolCall],isStreaming:!1,timestamp:Date.now()}),r=null;continue}if("tool_result"===n.type&&n.result){let e=n.result;s.push({id:o(),role:"tool",content:e.content??"",toolCallId:e.toolCallId,timestamp:Date.now()});continue}if("ask_user"===n.type){s.push({id:o(),role:"assistant",content:"",askUser:{questionId:n.questionId,question:n.question??"",options:n.options,fields:n.fields,multiSelect:n.multiSelect},timestamp:Date.now()});continue}"done"===n.type&&"string"==typeof n.finalText&&(r?(r.content=n.finalText,r.isStreaming=!1):n.finalText.trim()&&s.push({id:o(),role:"assistant",content:n.finalText,timestamp:Date.now()}),r=null)}return s}},1489:(e,t,s)=>{s.d(t,{N:()=>l});var r=s(1636),n=s(2847),o=s(785);class i{constructor(){this.tasks=new r.CronTasks((0,o.kO)()),this.scheduler=new n.CronScheduler(this.tasks,e=>{this.fire(e).catch(e=>console.error("Scheduled Customer Agent run failed",e))},()=>{}),this.scheduler.start()}async fire(e){let{agentHost:t}=await Promise.all([s.e(1973),s.e(9119),s.e(535)]).then(s.bind(s,9119)),{getCustomerGoalCoordinator:r}=await Promise.all([s.e(1973),s.e(9119),s.e(2324)]).then(s.bind(s,6435)),n=e.sessionId;n&&await t.getSessionStore().get(n)||(n=(await t.createSession(e.label||"定时任务")).id,this.tasks.update(e.id,{sessionId:n})),await r().enqueue(n,e.prompt)}call(e,t){let s=String(t[0]||"");switch(e){case"cronList":return this.tasks.list();case"cronCreate":{if("string"!=typeof t[0]||"string"!=typeof t[1]||!t[1].trim())throw Error("cron and prompt required");let e=t[2]&&"object"==typeof t[2]?t[2]:{};return this.tasks.create({cron:t[0],prompt:t[1],recurring:!1!==e.recurring,enabled:!0,durable:!0,..."string"==typeof e.sessionId?{sessionId:e.sessionId}:{},..."string"==typeof e.label?{label:e.label}:{}})}case"cronPause":return this.tasks.pause(s);case"cronResume":return this.tasks.resume(s);case"cronDelete":return this.tasks.delete(s);case"cronDeleteAll":return this.tasks.deleteAll(),{ok:!0};default:throw Error("Unsupported schedule operation")}}}let a=globalThis;function l(){return a.__sharedCronService??=new i}}};var t=require("../../../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[8375,6703,1973,4621,5801,9119,5762],()=>s(9846));module.exports=r})();
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=3610,e.ids=[3610],e.modules={1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},2882:(e,r,s)=>{s.r(r),s.d(r,{originalPathname:()=>x,patchFetch:()=>m,requestAsyncStorage:()=>c,routeModule:()=>d,serverHooks:()=>v,staticGenerationAsyncStorage:()=>l});var t={};s.r(t),s.d(t,{POST:()=>p});var o=s(7786),n=s(5042),i=s(2184),a=s(1890),u=s(5801);async function p(e,{params:r}){if(!(0,u.V_)(r.id)||!r.id.startsWith("runtime:codex:"))return a.NextResponse.json({error:"Only Codex sessions can be released"},{status:405});try{return await (0,u.getNativeRuntimeService)().release(r.id),a.NextResponse.json({status:"released"})}catch(e){return a.NextResponse.json({error:e instanceof Error?e.message:"Codex release failed"},{status:(0,u.WW)(e)})}}let d=new o.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/sessions/[id]/release/route",pathname:"/api/sessions/[id]/release",filename:"route",bundlePath:"app/api/sessions/[id]/release/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-preview80-20261125.e3ZzMB/source/packages/server/app/api/sessions/[id]/release/route.ts",nextConfigOutput:"standalone",userland:t}),{requestAsyncStorage:c,staticGenerationAsyncStorage:l,serverHooks:v}=d,x="/api/sessions/[id]/release/route";function m(){return(0,i.patchFetch)({serverHooks:v,staticGenerationAsyncStorage:l})}},785:(e,r,s)=>{s.d(r,{ME:()=>a,kO:()=>i,sr:()=>u});var t=s(9411);let o=function(){let e=process.argv[1];if(e){let r=(0,t.dirname)((0,t.resolve)(e)),s=`${t.sep}node_modules${t.sep}.bin`;return r.endsWith(s)?(0,t.resolve)(r,"..",".."):r}return(0,t.resolve)(process.cwd())}();function n(e=process.env,r=o){return(0,t.resolve)(e.AGENT_DATA_DIR?.trim()||r)}function i(){return n()}function a(e=process.env,r=n(e)){let s=e.AGENT_LOG_DIR?.trim();if(s)return(0,t.resolve)(s);let o=e.AGENTROAM_DATA_DIR?.trim();return o?(0,t.resolve)(o,"logs"):(0,t.join)(r,".agent-data","logs")}function u(){return function(e=process.env,r=o){return(0,t.resolve)(e.AGENT_WORKING_DIRECTORY?.trim()||r)}(process.env,i())}}};var r=require("../../../../../webpack-runtime.js");r.C(e);var s=e=>r(r.s=e),t=r.X(0,[8375,6703,5801],()=>s(2882));module.exports=t})();
1
+ "use strict";(()=>{var e={};e.id=3610,e.ids=[3610],e.modules={1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},5750:(e,r,s)=>{s.r(r),s.d(r,{originalPathname:()=>m,patchFetch:()=>x,requestAsyncStorage:()=>c,routeModule:()=>d,serverHooks:()=>v,staticGenerationAsyncStorage:()=>l});var t={};s.r(t),s.d(t,{POST:()=>p});var o=s(7786),n=s(5042),i=s(2184),a=s(1890),u=s(5801);async function p(e,{params:r}){if(!(0,u.V_)(r.id)||!r.id.startsWith("runtime:codex:"))return a.NextResponse.json({error:"Only Codex sessions can be released"},{status:405});try{return await (0,u.getNativeRuntimeService)().release(r.id),a.NextResponse.json({status:"released"})}catch(e){return a.NextResponse.json({error:e instanceof Error?e.message:"Codex release failed"},{status:(0,u.WW)(e)})}}let d=new o.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/sessions/[id]/release/route",pathname:"/api/sessions/[id]/release",filename:"route",bundlePath:"app/api/sessions/[id]/release/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-npm-remote-auth-20261125.yi_kd6wp/source/packages/server/app/api/sessions/[id]/release/route.ts",nextConfigOutput:"standalone",userland:t}),{requestAsyncStorage:c,staticGenerationAsyncStorage:l,serverHooks:v}=d,m="/api/sessions/[id]/release/route";function x(){return(0,i.patchFetch)({serverHooks:v,staticGenerationAsyncStorage:l})}},785:(e,r,s)=>{s.d(r,{ME:()=>a,kO:()=>i,sr:()=>u});var t=s(9411);let o=function(){let e=process.argv[1];if(e){let r=(0,t.dirname)((0,t.resolve)(e)),s=`${t.sep}node_modules${t.sep}.bin`;return r.endsWith(s)?(0,t.resolve)(r,"..",".."):r}return(0,t.resolve)(process.cwd())}();function n(e=process.env,r=o){return(0,t.resolve)(e.AGENT_DATA_DIR?.trim()||r)}function i(){return n()}function a(e=process.env,r=n(e)){let s=e.AGENT_LOG_DIR?.trim();if(s)return(0,t.resolve)(s);let o=e.AGENTROAM_DATA_DIR?.trim();return o?(0,t.resolve)(o,"logs"):(0,t.join)(r,".agent-data","logs")}function u(){return function(e=process.env,r=o){return(0,t.resolve)(e.AGENT_WORKING_DIRECTORY?.trim()||r)}(process.env,i())}}};var r=require("../../../../../webpack-runtime.js");r.C(e);var s=e=>r(r.s=e),t=r.X(0,[8375,6703,5801],()=>s(5750));module.exports=t})();
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=5241,e.ids=[5241],e.modules={8042:e=>{e.exports=require("@agent/computer-use")},1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},1364:(e,t,s)=>{s.r(t),s.d(t,{originalPathname:()=>b,patchFetch:()=>j,requestAsyncStorage:()=>y,routeModule:()=>w,serverHooks:()=>S,staticGenerationAsyncStorage:()=>x});var r={};s.r(r),s.d(r,{DELETE:()=>v,GET:()=>h,PATCH:()=>f});var i=s(7786),a=s(5042),n=s(2184),o=s(1890),l=s(1636),u=s(9119),d=s(5801),c=s(2847),m=s(8274),p=s(5762),g=s(6296);async function h(e,{params:t}){let s=new URL(e.url),r=s.searchParams.get("before"),i=s.searchParams.get("after"),a=s.searchParams.get("anchor"),n=s.searchParams.get("limit"),h=s.searchParams.get("view"),f=s.searchParams.get("revision"),v=s.searchParams.get("turnId"),w="core"===h||"trace"===h?h:void 0,y=null!==r||null!==i||null!==a||null!==n||w||f||v?{before:r||void 0,after:i||void 0,anchor:a||void 0,limit:function(e){if(null===e)return;let t=Number(e);return Number.isFinite(t)?t:void 0}(n),view:w,revision:f||void 0,turnId:v||void 0}:void 0;if((0,d.V_)(t.id))try{let e=y?.view==="core"?{...y,imageView:"source"}:y,s=await (0,p.dh)(t.id,e);if(s)return o.NextResponse.json(await (0,g.F)().project(s));let r=await (0,d.getNativeRuntimeService)().get(t.id,e);return o.NextResponse.json(await (0,g.F)().project(r))}catch(e){return o.NextResponse.json({error:e instanceof Error?e.message:"Internal error",...e instanceof c.RuntimeSessionError||e instanceof l.StaleSessionAnchorError?{code:e.code}:{}},{status:e instanceof l.StaleSessionAnchorError?409:(0,d.WW)(e)})}let x=await u.agentHost.getSessionStore().get(t.id);if(!x)return o.NextResponse.json({error:"Session not found"},{status:404});let S=u.agentHost.getRecoverableRun(x),b=[...(!x.messages?.length&&!S&&Array.isArray(x.events)&&x.events.length>0?m.Q(x.events):x.messages)?.filter(e=>!l.isInternalGoalMessage(e))??[]??[],...S?(0,m.Q)(x.events.slice(S.eventStart),{runId:S.runId,isStreaming:S.running}):[]],j=S?S.running?"active":"failed":x.status,P=S?{runId:S.runId,eventId:S.eventId,running:S.running}:void 0;try{let e=y?{...x,agentType:"customer-agent",status:j,permissionMode:(0,l.normalizeToolPermissionMode)(x.metadata.permissionMode),...P?{activeRun:P}:{},...(0,l.paginateSessionHistory)(b??[],x.events??[],y)}:{...x,agentType:"customer-agent",status:j,messages:b,permissionMode:(0,l.normalizeToolPermissionMode)(x.metadata.permissionMode),...P?{activeRun:P}:{}};return o.NextResponse.json(await (0,g.F)().project({...e,messageQueueVersion:1,goalState:(0,l.readSessionGoalState)(x.metadata)}))}catch(e){if(e instanceof l.StaleSessionAnchorError)return o.NextResponse.json({error:e.message,code:e.code},{status:409});throw e}}async function f(e,{params:t}){let s=await e.json();if(void 0!==s.nativeMode){if(!(0,d.V_)(t.id)||void 0!==s.permissionMode||void 0!==s.nativePermissionPreset||"string"!=typeof s.nativeMode||!s.nativeMode.trim()||s.nativeMode.length>128)return o.NextResponse.json({error:"Invalid native mode"},{status:400});try{return o.NextResponse.json(await (0,d.getNativeRuntimeService)().setNativeMode(t.id,s.nativeMode))}catch(e){return o.NextResponse.json({error:e instanceof Error?e.message:"Unable to update native mode"},{status:(0,d.WW)(e)})}}if(void 0!==s.nativePermissionPreset){if(!(0,d.V_)(t.id)||void 0!==s.permissionMode||"string"!=typeof s.nativePermissionPreset||!s.nativePermissionPreset.trim()||s.nativePermissionPreset.length>128)return o.NextResponse.json({error:"Invalid native permission preset"},{status:400});try{return o.NextResponse.json(await (0,d.getNativeRuntimeService)().setNativePermissionPreset(t.id,s.nativePermissionPreset))}catch(e){return o.NextResponse.json({error:e instanceof Error?e.message:"Unable to update native permissions"},{status:(0,d.WW)(e)})}}if(!(0,l.isToolPermissionMode)(s.permissionMode))return o.NextResponse.json({error:"Invalid permission mode"},{status:400});if((0,d.V_)(t.id))try{let e=await (0,d.getNativeRuntimeService)().setPermissionMode(t.id,s.permissionMode);return o.NextResponse.json(e)}catch(e){return o.NextResponse.json({error:e instanceof Error?e.message:"Unable to update permission mode"},{status:(0,d.WW)(e)})}try{let e=await u.agentHost.setSessionPermissionMode(t.id,s.permissionMode);return o.NextResponse.json({...e,permissionMode:(0,l.normalizeToolPermissionMode)(e.metadata.permissionMode)})}catch(s){let e=s instanceof Error?s.message:"Unable to update permission mode",t=e.startsWith("Session not found")?404:500;return o.NextResponse.json({error:e},{status:t})}}async function v(e,{params:t}){if((0,d.V_)(t.id))try{return await (0,d.getNativeRuntimeService)().delete(t.id),o.NextResponse.json({status:"deleted"})}catch(e){return o.NextResponse.json({error:e instanceof Error?e.message:"Unable to delete session"},{status:(0,d.WW)(e)})}return u.agentHost.isSessionRunning(t.id)?o.NextResponse.json({error:"Session is currently running"},{status:409}):(await u.agentHost.getSessionStore().delete(t.id),o.NextResponse.json({status:"deleted"}))}let w=new i.AppRouteRouteModule({definition:{kind:a.x.APP_ROUTE,page:"/api/sessions/[id]/route",pathname:"/api/sessions/[id]",filename:"route",bundlePath:"app/api/sessions/[id]/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-preview80-20261125.e3ZzMB/source/packages/server/app/api/sessions/[id]/route.ts",nextConfigOutput:"standalone",userland:r}),{requestAsyncStorage:y,staticGenerationAsyncStorage:x,serverHooks:S}=w,b="/api/sessions/[id]/route";function j(){return(0,n.patchFetch)({serverHooks:S,staticGenerationAsyncStorage:x})}},8274:(e,t,s)=>{s.d(t,{Q:()=>r});function r(e,t={}){let s=[],r=null,i=0,a=()=>`${t.runId??"event-history"}:${i++}`;for(let i of e){if("text_chunk"===i.type){r||(r={id:a(),role:"assistant",content:"",isStreaming:t.isStreaming??!0,timestamp:Date.now()},s.push(r)),r.content=`${r.content??""}${i.text??""}`;continue}if("tool_call"===i.type&&i.toolCall){r?(r.toolCalls=[i.toolCall],r.isStreaming=!1):s.push({id:a(),role:"assistant",content:"",toolCalls:[i.toolCall],isStreaming:!1,timestamp:Date.now()}),r=null;continue}if("tool_result"===i.type&&i.result){let e=i.result;s.push({id:a(),role:"tool",content:e.content??"",toolCallId:e.toolCallId,timestamp:Date.now()});continue}if("ask_user"===i.type){s.push({id:a(),role:"assistant",content:"",askUser:{questionId:i.questionId,question:i.question??"",options:i.options,fields:i.fields,multiSelect:i.multiSelect},timestamp:Date.now()});continue}"done"===i.type&&"string"==typeof i.finalText&&(r?(r.content=i.finalText,r.isStreaming=!1):i.finalText.trim()&&s.push({id:a(),role:"assistant",content:i.finalText,timestamp:Date.now()}),r=null)}return s}},6296:(e,t,s)=>{let r;s.d(t,{F:()=>c});var i=s(6005),a=s(3977),n=s(9411);let o=require("next/dist/server/image-optimizer");var l=s(785);let u={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".webp":"image/webp",".gif":"image/gif",".avif":"image/avif"};class d{constructor(e,t=e=>(0,o.optimizeImage)({buffer:e,contentType:"image/webp",width:384,quality:60})){this.directory=e,this.compress=t,this.pending=new Map}file(e,t){if(!/^[a-f0-9]{64}$/.test(e))throw Error("Invalid image identity");return(0,n.join)(this.directory,`${e}.${t}`)}async register(e){let{localImagePath:t,dataUrl:s,...r}=e;if(!t&&!s?.startsWith("data:image/"))return{...r,...s?{dataUrl:s}:{}};try{let e,o;if(t){let s=await (0,a.stat)(t),r=u[(0,n.extname)(t).toLowerCase()];if(!r||!s.isFile()||s.size>20971520)throw Error("Image unavailable");e={path:t,mime:r,stamp:`${s.size}:${s.mtimeMs}`}}else{let t=/^data:(image\/(?:png|jpeg|webp|gif|avif));base64,([A-Za-z0-9+/=\r\n]+)$/.exec(s);if(!t||t[2].length>27962030.666666668)throw Error("Invalid image");o=Buffer.from(t[2],"base64"),e={mime:t[1]}}let l=(0,i.createHash)("sha256").update(JSON.stringify(e)).update(o??"").digest("hex");return await (0,a.mkdir)(this.directory,{recursive:!0,mode:448}),o&&await this.writeOnce(this.file(l,"original"),o),await this.writeOnce(this.file(l,"json"),JSON.stringify(e)),{...r,imageId:l,unavailable:void 0,omitted:void 0}}catch{return{...r,unavailable:!0}}}async writeOnce(e,t){try{await (0,a.stat)(e);return}catch(e){if("ENOENT"!==e.code)throw e}let s=`${e}.${(0,i.randomUUID)()}.tmp`;try{await (0,a.writeFile)(s,t,{flag:"wx",mode:384}),await (0,a.rename)(s,e)}finally{await (0,a.unlink)(s).catch(()=>void 0)}}async read(e,t){let s=`${e}:${t}`,r=this.pending.get(s);if(r)return r;let i=this.load(e,t);this.pending.set(s,i);try{return await i}finally{this.pending.get(s)===i&&this.pending.delete(s)}}async load(e,t){if("preview"===t)try{return`data:image/webp;base64,${(await (0,a.readFile)(this.file(e,"webp"))).toString("base64")}`}catch(e){if("ENOENT"!==e.code)throw e}let s=JSON.parse(await (0,a.readFile)(this.file(e,"json"),"utf8")),r=s.path??this.file(e,"original"),i=await (0,a.stat)(r);if(!i.isFile()||i.size>20971520||s.stamp&&s.stamp!==`${i.size}:${i.mtimeMs}`)throw Error("Image unavailable");let n=await (0,a.readFile)(r);if(n.length>20971520)throw Error("Image unavailable");if("original"===t)return`data:${s.mime};base64,${n.toString("base64")}`;let o=await this.compress(n);return await this.writeOnce(this.file(e,"webp"),o),`data:image/webp;base64,${o.toString("base64")}`}async project(e){if(!e)return e;let t=async e=>{if(!e||"object"!=typeof e)return e;let t=e.presentation,s=Array.isArray(t?.attachments)?t.attachments:[],r=Array.isArray(e.images)?e.images.filter(e=>"string"==typeof e):[];if(!s.length&&!r.length)return e;let i=await Promise.all([...s,...r.map((e,t)=>({type:"image",name:`图片 ${t+1}`,dataUrl:e}))].map(e=>this.register(e)));return{...e,images:void 0,presentation:{...t,attachments:i}}};return{...e,...Array.isArray(e.messages)?{messages:await Promise.all(e.messages.map(t))}:{},...Array.isArray(e.events)?{events:await Promise.all(e.events.map(async e=>{let s=await t(e);return s&&"object"==typeof s&&s.message&&"object"==typeof s.message?{...s,message:await t(s.message)}:s}))}:{}}}}function c(){return r??=new d((0,n.join)((0,l.kO)(),".agent-data","cache","session-images"))}},1489:(e,t,s)=>{s.d(t,{N:()=>l});var r=s(1636),i=s(2847),a=s(785);class n{constructor(){this.tasks=new r.CronTasks((0,a.kO)()),this.scheduler=new i.CronScheduler(this.tasks,e=>{this.fire(e).catch(e=>console.error("Scheduled Customer Agent run failed",e))},()=>{}),this.scheduler.start()}async fire(e){let{agentHost:t}=await Promise.all([s.e(1973),s.e(9119),s.e(535)]).then(s.bind(s,9119)),{getCustomerGoalCoordinator:r}=await Promise.all([s.e(1973),s.e(9119),s.e(2324)]).then(s.bind(s,6435)),i=e.sessionId;i&&await t.getSessionStore().get(i)||(i=(await t.createSession(e.label||"定时任务")).id,this.tasks.update(e.id,{sessionId:i})),await r().enqueue(i,e.prompt)}call(e,t){let s=String(t[0]||"");switch(e){case"cronList":return this.tasks.list();case"cronCreate":{if("string"!=typeof t[0]||"string"!=typeof t[1]||!t[1].trim())throw Error("cron and prompt required");let e=t[2]&&"object"==typeof t[2]?t[2]:{};return this.tasks.create({cron:t[0],prompt:t[1],recurring:!1!==e.recurring,enabled:!0,durable:!0,..."string"==typeof e.sessionId?{sessionId:e.sessionId}:{},..."string"==typeof e.label?{label:e.label}:{}})}case"cronPause":return this.tasks.pause(s);case"cronResume":return this.tasks.resume(s);case"cronDelete":return this.tasks.delete(s);case"cronDeleteAll":return this.tasks.deleteAll(),{ok:!0};default:throw Error("Unsupported schedule operation")}}}let o=globalThis;function l(){return o.__sharedCronService??=new n}}};var t=require("../../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[8375,6703,1973,4621,5801,9119,5762],()=>s(1364));module.exports=r})();
1
+ "use strict";(()=>{var e={};e.id=5241,e.ids=[5241],e.modules={8042:e=>{e.exports=require("@agent/computer-use")},1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},6812:(e,t,s)=>{s.r(t),s.d(t,{originalPathname:()=>b,patchFetch:()=>j,requestAsyncStorage:()=>y,routeModule:()=>w,serverHooks:()=>S,staticGenerationAsyncStorage:()=>x});var r={};s.r(r),s.d(r,{DELETE:()=>v,GET:()=>h,PATCH:()=>f});var i=s(7786),a=s(5042),n=s(2184),o=s(1890),l=s(1636),u=s(9119),d=s(5801),m=s(2847),c=s(8274),p=s(5762),g=s(6296);async function h(e,{params:t}){let s=new URL(e.url),r=s.searchParams.get("before"),i=s.searchParams.get("after"),a=s.searchParams.get("anchor"),n=s.searchParams.get("limit"),h=s.searchParams.get("view"),f=s.searchParams.get("revision"),v=s.searchParams.get("turnId"),w="core"===h||"trace"===h?h:void 0,y=null!==r||null!==i||null!==a||null!==n||w||f||v?{before:r||void 0,after:i||void 0,anchor:a||void 0,limit:function(e){if(null===e)return;let t=Number(e);return Number.isFinite(t)?t:void 0}(n),view:w,revision:f||void 0,turnId:v||void 0}:void 0;if((0,d.V_)(t.id))try{let e=y?.view==="core"?{...y,imageView:"source"}:y,s=await (0,p.dh)(t.id,e);if(s)return o.NextResponse.json(await (0,g.F)().project(s));let r=await (0,d.getNativeRuntimeService)().get(t.id,e);return o.NextResponse.json(await (0,g.F)().project(r))}catch(e){return o.NextResponse.json({error:e instanceof Error?e.message:"Internal error",...e instanceof m.RuntimeSessionError||e instanceof l.StaleSessionAnchorError?{code:e.code}:{}},{status:e instanceof l.StaleSessionAnchorError?409:(0,d.WW)(e)})}let x=await u.agentHost.getSessionStore().get(t.id);if(!x)return o.NextResponse.json({error:"Session not found"},{status:404});let S=u.agentHost.getRecoverableRun(x),b=[...(!x.messages?.length&&!S&&Array.isArray(x.events)&&x.events.length>0?c.Q(x.events):x.messages)?.filter(e=>!l.isInternalGoalMessage(e))??[]??[],...S?(0,c.Q)(x.events.slice(S.eventStart),{runId:S.runId,isStreaming:S.running}):[]],j=S?S.running?"active":"failed":x.status,P=S?{runId:S.runId,eventId:S.eventId,running:S.running}:void 0;try{let e=y?{...x,agentType:"customer-agent",status:j,permissionMode:(0,l.normalizeToolPermissionMode)(x.metadata.permissionMode),...P?{activeRun:P}:{},...(0,l.paginateSessionHistory)(b??[],x.events??[],y)}:{...x,agentType:"customer-agent",status:j,messages:b,permissionMode:(0,l.normalizeToolPermissionMode)(x.metadata.permissionMode),...P?{activeRun:P}:{}};return o.NextResponse.json(await (0,g.F)().project({...e,messageQueueVersion:1,goalState:(0,l.readSessionGoalState)(x.metadata)}))}catch(e){if(e instanceof l.StaleSessionAnchorError)return o.NextResponse.json({error:e.message,code:e.code},{status:409});throw e}}async function f(e,{params:t}){let s=await e.json();if(void 0!==s.nativeMode){if(!(0,d.V_)(t.id)||void 0!==s.permissionMode||void 0!==s.nativePermissionPreset||"string"!=typeof s.nativeMode||!s.nativeMode.trim()||s.nativeMode.length>128)return o.NextResponse.json({error:"Invalid native mode"},{status:400});try{return o.NextResponse.json(await (0,d.getNativeRuntimeService)().setNativeMode(t.id,s.nativeMode))}catch(e){return o.NextResponse.json({error:e instanceof Error?e.message:"Unable to update native mode"},{status:(0,d.WW)(e)})}}if(void 0!==s.nativePermissionPreset){if(!(0,d.V_)(t.id)||void 0!==s.permissionMode||"string"!=typeof s.nativePermissionPreset||!s.nativePermissionPreset.trim()||s.nativePermissionPreset.length>128)return o.NextResponse.json({error:"Invalid native permission preset"},{status:400});try{return o.NextResponse.json(await (0,d.getNativeRuntimeService)().setNativePermissionPreset(t.id,s.nativePermissionPreset))}catch(e){return o.NextResponse.json({error:e instanceof Error?e.message:"Unable to update native permissions"},{status:(0,d.WW)(e)})}}if(!(0,l.isToolPermissionMode)(s.permissionMode))return o.NextResponse.json({error:"Invalid permission mode"},{status:400});if((0,d.V_)(t.id))try{let e=await (0,d.getNativeRuntimeService)().setPermissionMode(t.id,s.permissionMode);return o.NextResponse.json(e)}catch(e){return o.NextResponse.json({error:e instanceof Error?e.message:"Unable to update permission mode"},{status:(0,d.WW)(e)})}try{let e=await u.agentHost.setSessionPermissionMode(t.id,s.permissionMode);return o.NextResponse.json({...e,permissionMode:(0,l.normalizeToolPermissionMode)(e.metadata.permissionMode)})}catch(s){let e=s instanceof Error?s.message:"Unable to update permission mode",t=e.startsWith("Session not found")?404:500;return o.NextResponse.json({error:e},{status:t})}}async function v(e,{params:t}){if((0,d.V_)(t.id))try{return await (0,d.getNativeRuntimeService)().delete(t.id),o.NextResponse.json({status:"deleted"})}catch(e){return o.NextResponse.json({error:e instanceof Error?e.message:"Unable to delete session"},{status:(0,d.WW)(e)})}return u.agentHost.isSessionRunning(t.id)?o.NextResponse.json({error:"Session is currently running"},{status:409}):(await u.agentHost.getSessionStore().delete(t.id),o.NextResponse.json({status:"deleted"}))}let w=new i.AppRouteRouteModule({definition:{kind:a.x.APP_ROUTE,page:"/api/sessions/[id]/route",pathname:"/api/sessions/[id]",filename:"route",bundlePath:"app/api/sessions/[id]/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-npm-remote-auth-20261125.yi_kd6wp/source/packages/server/app/api/sessions/[id]/route.ts",nextConfigOutput:"standalone",userland:r}),{requestAsyncStorage:y,staticGenerationAsyncStorage:x,serverHooks:S}=w,b="/api/sessions/[id]/route";function j(){return(0,n.patchFetch)({serverHooks:S,staticGenerationAsyncStorage:x})}},8274:(e,t,s)=>{s.d(t,{Q:()=>r});function r(e,t={}){let s=[],r=null,i=0,a=()=>`${t.runId??"event-history"}:${i++}`;for(let i of e){if("text_chunk"===i.type){r||(r={id:a(),role:"assistant",content:"",isStreaming:t.isStreaming??!0,timestamp:Date.now()},s.push(r)),r.content=`${r.content??""}${i.text??""}`;continue}if("tool_call"===i.type&&i.toolCall){r?(r.toolCalls=[i.toolCall],r.isStreaming=!1):s.push({id:a(),role:"assistant",content:"",toolCalls:[i.toolCall],isStreaming:!1,timestamp:Date.now()}),r=null;continue}if("tool_result"===i.type&&i.result){let e=i.result;s.push({id:a(),role:"tool",content:e.content??"",toolCallId:e.toolCallId,timestamp:Date.now()});continue}if("ask_user"===i.type){s.push({id:a(),role:"assistant",content:"",askUser:{questionId:i.questionId,question:i.question??"",options:i.options,fields:i.fields,multiSelect:i.multiSelect},timestamp:Date.now()});continue}"done"===i.type&&"string"==typeof i.finalText&&(r?(r.content=i.finalText,r.isStreaming=!1):i.finalText.trim()&&s.push({id:a(),role:"assistant",content:i.finalText,timestamp:Date.now()}),r=null)}return s}},6296:(e,t,s)=>{let r;s.d(t,{F:()=>m});var i=s(6005),a=s(3977),n=s(9411);let o=require("next/dist/server/image-optimizer");var l=s(785);let u={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".webp":"image/webp",".gif":"image/gif",".avif":"image/avif"};class d{constructor(e,t=e=>(0,o.optimizeImage)({buffer:e,contentType:"image/webp",width:384,quality:60})){this.directory=e,this.compress=t,this.pending=new Map}file(e,t){if(!/^[a-f0-9]{64}$/.test(e))throw Error("Invalid image identity");return(0,n.join)(this.directory,`${e}.${t}`)}async register(e){let{localImagePath:t,dataUrl:s,...r}=e;if(!t&&!s?.startsWith("data:image/"))return{...r,...s?{dataUrl:s}:{}};try{let e,o;if(t){let s=await (0,a.stat)(t),r=u[(0,n.extname)(t).toLowerCase()];if(!r||!s.isFile()||s.size>20971520)throw Error("Image unavailable");e={path:t,mime:r,stamp:`${s.size}:${s.mtimeMs}`}}else{let t=/^data:(image\/(?:png|jpeg|webp|gif|avif));base64,([A-Za-z0-9+/=\r\n]+)$/.exec(s);if(!t||t[2].length>27962030.666666668)throw Error("Invalid image");o=Buffer.from(t[2],"base64"),e={mime:t[1]}}let l=(0,i.createHash)("sha256").update(JSON.stringify(e)).update(o??"").digest("hex");return await (0,a.mkdir)(this.directory,{recursive:!0,mode:448}),o&&await this.writeOnce(this.file(l,"original"),o),await this.writeOnce(this.file(l,"json"),JSON.stringify(e)),{...r,imageId:l,unavailable:void 0,omitted:void 0}}catch{return{...r,unavailable:!0}}}async writeOnce(e,t){try{await (0,a.stat)(e);return}catch(e){if("ENOENT"!==e.code)throw e}let s=`${e}.${(0,i.randomUUID)()}.tmp`;try{await (0,a.writeFile)(s,t,{flag:"wx",mode:384}),await (0,a.rename)(s,e)}finally{await (0,a.unlink)(s).catch(()=>void 0)}}async read(e,t){let s=`${e}:${t}`,r=this.pending.get(s);if(r)return r;let i=this.load(e,t);this.pending.set(s,i);try{return await i}finally{this.pending.get(s)===i&&this.pending.delete(s)}}async load(e,t){if("preview"===t)try{return`data:image/webp;base64,${(await (0,a.readFile)(this.file(e,"webp"))).toString("base64")}`}catch(e){if("ENOENT"!==e.code)throw e}let s=JSON.parse(await (0,a.readFile)(this.file(e,"json"),"utf8")),r=s.path??this.file(e,"original"),i=await (0,a.stat)(r);if(!i.isFile()||i.size>20971520||s.stamp&&s.stamp!==`${i.size}:${i.mtimeMs}`)throw Error("Image unavailable");let n=await (0,a.readFile)(r);if(n.length>20971520)throw Error("Image unavailable");if("original"===t)return`data:${s.mime};base64,${n.toString("base64")}`;let o=await this.compress(n);return await this.writeOnce(this.file(e,"webp"),o),`data:image/webp;base64,${o.toString("base64")}`}async project(e){if(!e)return e;let t=async e=>{if(!e||"object"!=typeof e)return e;let t=e.presentation,s=Array.isArray(t?.attachments)?t.attachments:[],r=Array.isArray(e.images)?e.images.filter(e=>"string"==typeof e):[];if(!s.length&&!r.length)return e;let i=await Promise.all([...s,...r.map((e,t)=>({type:"image",name:`图片 ${t+1}`,dataUrl:e}))].map(e=>this.register(e)));return{...e,images:void 0,presentation:{...t,attachments:i}}};return{...e,...Array.isArray(e.messages)?{messages:await Promise.all(e.messages.map(t))}:{},...Array.isArray(e.events)?{events:await Promise.all(e.events.map(async e=>{let s=await t(e);return s&&"object"==typeof s&&s.message&&"object"==typeof s.message?{...s,message:await t(s.message)}:s}))}:{}}}}function m(){return r??=new d((0,n.join)((0,l.kO)(),".agent-data","cache","session-images"))}},1489:(e,t,s)=>{s.d(t,{N:()=>l});var r=s(1636),i=s(2847),a=s(785);class n{constructor(){this.tasks=new r.CronTasks((0,a.kO)()),this.scheduler=new i.CronScheduler(this.tasks,e=>{this.fire(e).catch(e=>console.error("Scheduled Customer Agent run failed",e))},()=>{}),this.scheduler.start()}async fire(e){let{agentHost:t}=await Promise.all([s.e(1973),s.e(9119),s.e(535)]).then(s.bind(s,9119)),{getCustomerGoalCoordinator:r}=await Promise.all([s.e(1973),s.e(9119),s.e(2324)]).then(s.bind(s,6435)),i=e.sessionId;i&&await t.getSessionStore().get(i)||(i=(await t.createSession(e.label||"定时任务")).id,this.tasks.update(e.id,{sessionId:i})),await r().enqueue(i,e.prompt)}call(e,t){let s=String(t[0]||"");switch(e){case"cronList":return this.tasks.list();case"cronCreate":{if("string"!=typeof t[0]||"string"!=typeof t[1]||!t[1].trim())throw Error("cron and prompt required");let e=t[2]&&"object"==typeof t[2]?t[2]:{};return this.tasks.create({cron:t[0],prompt:t[1],recurring:!1!==e.recurring,enabled:!0,durable:!0,..."string"==typeof e.sessionId?{sessionId:e.sessionId}:{},..."string"==typeof e.label?{label:e.label}:{}})}case"cronPause":return this.tasks.pause(s);case"cronResume":return this.tasks.resume(s);case"cronDelete":return this.tasks.delete(s);case"cronDeleteAll":return this.tasks.deleteAll(),{ok:!0};default:throw Error("Unsupported schedule operation")}}}let o=globalThis;function l(){return o.__sharedCronService??=new n}}};var t=require("../../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[8375,6703,1973,4621,5801,9119,5762],()=>s(6812));module.exports=r})();
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=9067,e.ids=[9067],e.modules={1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},1740:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>m,patchFetch:()=>f,requestAsyncStorage:()=>h,routeModule:()=>g,serverHooks:()=>v,staticGenerationAsyncStorage:()=>y});var n={};r.r(n),r.d(n,{POST:()=>l});var s=r(7786),a=r(5042),i=r(2184),o=r(1890),c=r(1636),u=r(2133),d=r(1289),p=r(5801);async function l(e,{params:t}){try{let r=await e.json().catch(()=>null),n=r?.targetAgentType;if(!n||"string"!=typeof n)return o.NextResponse.json({error:"targetAgentType is required"},{status:400});if(!(0,c.isNativeAgentType)(n))return o.NextResponse.json({error:`Unknown native agent type: ${n}`},{status:400});if(r?.budgetTokens!==void 0&&(!Number.isInteger(r.budgetTokens)||r.budgetTokens<1024||r.budgetTokens>64e3))return o.NextResponse.json({error:"budgetTokens must be an integer between 1024 and 64000"},{status:400});if(r?.threadKey!==void 0&&"string"!=typeof r.threadKey)return o.NextResponse.json({error:"Invalid threadKey"},{status:400});let{useCase:s}=(0,u.v)(),a=await s.execute({sourceSessionId:t.id,targetAgentType:n,...r?.threadKey?{threadKey:r.threadKey}:{},...r?.clean?{clean:!0}:{},...r?.budgetTokens!==void 0?{budgetTokens:r.budgetTokens}:{}}),i=await (0,p.getNativeRuntimeService)().getSummary(a.targetSession.id).catch(()=>a.targetSession);return o.NextResponse.json({threadKey:a.thread.threadKey,strategy:a.strategy,record:(0,d.WX)(a.record),handoff:a.handoff?(0,d.E_)(a.handoff):null,targetSession:i},{status:202})}catch(e){return o.NextResponse.json({error:e instanceof Error?e.message:"Engine switch failed"},{status:function(e){if(e instanceof c.EngineSwitchError)switch(e.code){case"SOURCE_NOT_FOUND":return 404;case"SESSION_OCCUPIED":case"STALE_THREAD":return 409;case"RUNTIME_UNAVAILABLE":return 503;default:return 400}return 500}(e)})}}let g=new s.AppRouteRouteModule({definition:{kind:a.x.APP_ROUTE,page:"/api/sessions/[id]/switch-engine/route",pathname:"/api/sessions/[id]/switch-engine",filename:"route",bundlePath:"app/api/sessions/[id]/switch-engine/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-preview80-20261125.e3ZzMB/source/packages/server/app/api/sessions/[id]/switch-engine/route.ts",nextConfigOutput:"standalone",userland:n}),{requestAsyncStorage:h,staticGenerationAsyncStorage:y,serverHooks:v}=g,m="/api/sessions/[id]/switch-engine/route";function f(){return(0,i.patchFetch)({serverHooks:v,staticGenerationAsyncStorage:y})}},2133:(e,t,r)=>{let n;r.d(t,{v:()=>u});var s=r(1636),a=r(2847),i=r(785),o=r(5801);function c(e){return(0,a.materializeContextHistory)((0,a.resolveNativeRuntimeDirectory)(),e)}function u(){let e=globalThis;if(!e.__engineSwitchContainer){let t=function(){if(!n){let e=(0,s.getDatabase)((0,a.resolveNativeRuntimeDirectory)()).db,t=new s.SQLiteEngineSwitchRepository(e),r=(0,s.getDatabase)((0,i.kO)()).db;r!==e&&t.importLegacy(new s.SQLiteEngineSwitchRepository(r)),n=t}return n}(),r=function(){let e=()=>(0,o.getNativeRuntimeService)();return{materializeHistory:c,health:async()=>(await e().health()).map(e=>({agentType:e.agentType,available:e.available,label:e.label,...e.error?{error:e.error}:{}})),async getSession(t){let r=await e().get(t),n=await e().get(t,{limit:1,..."codex"===r.agentType?{view:"core"}:{}}),s=r.goalState,a=await e().listBackgroundJobs(t).catch(e=>{if(e?.code==="OPERATION_NOT_SUPPORTED")return[];throw e}),i=await e().getNativeGoal(t).catch(e=>{if(e?.code==="OPERATION_NOT_SUPPORTED")return null;throw e}),o=a.some(e=>"running"===e.status||"stopping"===e.status),c=s?.active||s?.queued.length?"会话还有未结束的目标或排队消息,请完成或取消后切换":o?"会话仍有后台任务运行,请结束后切换":i?.activation==="armed"&&"complete"!==i.phase?"原生目标仍在执行,请暂停后切换":void 0,u=[...r.events].reverse().find(e=>"todo_update"===e.type);return{id:r.id,agentType:r.agentType,title:r.title,cwd:r.cwd,...r.projectId?{projectId:r.projectId}:{},status:r.status,occupancy:String(r.occupancy),canResume:r.canResume,readOnly:r.readOnly,canDelete:r.canDelete,switchBlockReason:c,workStateText:JSON.stringify({cwd:r.cwd,todos:u?.type==="todo_update"?u.todos:[],nativeGoal:i,backgroundJobs:a.map(({id:e,label:t,status:r})=>({id:e,label:t,status:r}))}),messages:r.messages,historyItemCount:n.history?.totalItems,historyLastId:n.messages.filter(e=>"user"===e.role||"assistant"===e.role).at(-1)?.historyId}},async createSession(t){let r=await e().create({agentType:t.agentType,cwd:t.cwd,...t.projectId?{projectId:t.projectId}:{},title:t.title});return{id:r.id,agentType:r.agentType,title:r.title,cwd:r.cwd,status:r.status,occupancy:r.occupancy,canResume:r.canResume,readOnly:r.readOnly,canDelete:r.canDelete,...r.projectId?{projectId:r.projectId}:{}}}}}();e.__engineSwitchContainer={useCase:new s.SwitchEngineUseCase({runtime:r,repository:t}),ledger:new s.EngineSwitchLedger(t)}}return e.__engineSwitchContainer}},1289:(e,t,r)=>{function n(e){let{images:t,...r}=e;return{...r,omittedHistoryIds:e.omittedHistoryIds.slice(-20),omittedCount:e.omittedHistoryIds.length}}function s(e){let{sourceSnapshot:t,phaseMessages:r,...n}=e;return n}r.d(t,{E_:()=>n,WX:()=>s})},785:(e,t,r)=>{r.d(t,{ME:()=>o,kO:()=>i,sr:()=>c});var n=r(9411);let s=function(){let e=process.argv[1];if(e){let t=(0,n.dirname)((0,n.resolve)(e)),r=`${n.sep}node_modules${n.sep}.bin`;return t.endsWith(r)?(0,n.resolve)(t,"..",".."):t}return(0,n.resolve)(process.cwd())}();function a(e=process.env,t=s){return(0,n.resolve)(e.AGENT_DATA_DIR?.trim()||t)}function i(){return a()}function o(e=process.env,t=a(e)){let r=e.AGENT_LOG_DIR?.trim();if(r)return(0,n.resolve)(r);let s=e.AGENTROAM_DATA_DIR?.trim();return s?(0,n.resolve)(s,"logs"):(0,n.join)(t,".agent-data","logs")}function c(){return function(e=process.env,t=s){return(0,n.resolve)(e.AGENT_WORKING_DIRECTORY?.trim()||t)}(process.env,i())}}};var t=require("../../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),n=t.X(0,[8375,6703,5801],()=>r(1740));module.exports=n})();
1
+ "use strict";(()=>{var e={};e.id=9067,e.ids=[9067],e.modules={1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},5003:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>v,patchFetch:()=>f,requestAsyncStorage:()=>h,routeModule:()=>g,serverHooks:()=>m,staticGenerationAsyncStorage:()=>y});var n={};r.r(n),r.d(n,{POST:()=>l});var s=r(7786),a=r(5042),i=r(2184),o=r(1890),c=r(1636),u=r(2133),d=r(1289),p=r(5801);async function l(e,{params:t}){try{let r=await e.json().catch(()=>null),n=r?.targetAgentType;if(!n||"string"!=typeof n)return o.NextResponse.json({error:"targetAgentType is required"},{status:400});if(!(0,c.isNativeAgentType)(n))return o.NextResponse.json({error:`Unknown native agent type: ${n}`},{status:400});if(r?.budgetTokens!==void 0&&(!Number.isInteger(r.budgetTokens)||r.budgetTokens<1024||r.budgetTokens>64e3))return o.NextResponse.json({error:"budgetTokens must be an integer between 1024 and 64000"},{status:400});if(r?.threadKey!==void 0&&"string"!=typeof r.threadKey)return o.NextResponse.json({error:"Invalid threadKey"},{status:400});let{useCase:s}=(0,u.v)(),a=await s.execute({sourceSessionId:t.id,targetAgentType:n,...r?.threadKey?{threadKey:r.threadKey}:{},...r?.clean?{clean:!0}:{},...r?.budgetTokens!==void 0?{budgetTokens:r.budgetTokens}:{}}),i=await (0,p.getNativeRuntimeService)().getSummary(a.targetSession.id).catch(()=>a.targetSession);return o.NextResponse.json({threadKey:a.thread.threadKey,strategy:a.strategy,record:(0,d.WX)(a.record),handoff:a.handoff?(0,d.E_)(a.handoff):null,targetSession:i},{status:202})}catch(e){return o.NextResponse.json({error:e instanceof Error?e.message:"Engine switch failed"},{status:function(e){if(e instanceof c.EngineSwitchError)switch(e.code){case"SOURCE_NOT_FOUND":return 404;case"SESSION_OCCUPIED":case"STALE_THREAD":return 409;case"RUNTIME_UNAVAILABLE":return 503;default:return 400}return 500}(e)})}}let g=new s.AppRouteRouteModule({definition:{kind:a.x.APP_ROUTE,page:"/api/sessions/[id]/switch-engine/route",pathname:"/api/sessions/[id]/switch-engine",filename:"route",bundlePath:"app/api/sessions/[id]/switch-engine/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-npm-remote-auth-20261125.yi_kd6wp/source/packages/server/app/api/sessions/[id]/switch-engine/route.ts",nextConfigOutput:"standalone",userland:n}),{requestAsyncStorage:h,staticGenerationAsyncStorage:y,serverHooks:m}=g,v="/api/sessions/[id]/switch-engine/route";function f(){return(0,i.patchFetch)({serverHooks:m,staticGenerationAsyncStorage:y})}},2133:(e,t,r)=>{let n;r.d(t,{v:()=>u});var s=r(1636),a=r(2847),i=r(785),o=r(5801);function c(e){return(0,a.materializeContextHistory)((0,a.resolveNativeRuntimeDirectory)(),e)}function u(){let e=globalThis;if(!e.__engineSwitchContainer){let t=function(){if(!n){let e=(0,s.getDatabase)((0,a.resolveNativeRuntimeDirectory)()).db,t=new s.SQLiteEngineSwitchRepository(e),r=(0,s.getDatabase)((0,i.kO)()).db;r!==e&&t.importLegacy(new s.SQLiteEngineSwitchRepository(r)),n=t}return n}(),r=function(){let e=()=>(0,o.getNativeRuntimeService)();return{materializeHistory:c,health:async()=>(await e().health()).map(e=>({agentType:e.agentType,available:e.available,label:e.label,...e.error?{error:e.error}:{}})),async getSession(t){let r=await e().get(t),n=await e().get(t,{limit:1,..."codex"===r.agentType?{view:"core"}:{}}),s=r.goalState,a=await e().listBackgroundJobs(t).catch(e=>{if(e?.code==="OPERATION_NOT_SUPPORTED")return[];throw e}),i=await e().getNativeGoal(t).catch(e=>{if(e?.code==="OPERATION_NOT_SUPPORTED")return null;throw e}),o=a.some(e=>"running"===e.status||"stopping"===e.status),c=s?.active||s?.queued.length?"会话还有未结束的目标或排队消息,请完成或取消后切换":o?"会话仍有后台任务运行,请结束后切换":i?.activation==="armed"&&"complete"!==i.phase?"原生目标仍在执行,请暂停后切换":void 0,u=[...r.events].reverse().find(e=>"todo_update"===e.type);return{id:r.id,agentType:r.agentType,title:r.title,cwd:r.cwd,...r.projectId?{projectId:r.projectId}:{},status:r.status,occupancy:String(r.occupancy),canResume:r.canResume,readOnly:r.readOnly,canDelete:r.canDelete,switchBlockReason:c,workStateText:JSON.stringify({cwd:r.cwd,todos:u?.type==="todo_update"?u.todos:[],nativeGoal:i,backgroundJobs:a.map(({id:e,label:t,status:r})=>({id:e,label:t,status:r}))}),messages:r.messages,historyItemCount:n.history?.totalItems,historyLastId:n.messages.filter(e=>"user"===e.role||"assistant"===e.role).at(-1)?.historyId}},async createSession(t){let r=await e().create({agentType:t.agentType,cwd:t.cwd,...t.projectId?{projectId:t.projectId}:{},title:t.title});return{id:r.id,agentType:r.agentType,title:r.title,cwd:r.cwd,status:r.status,occupancy:r.occupancy,canResume:r.canResume,readOnly:r.readOnly,canDelete:r.canDelete,...r.projectId?{projectId:r.projectId}:{}}}}}();e.__engineSwitchContainer={useCase:new s.SwitchEngineUseCase({runtime:r,repository:t}),ledger:new s.EngineSwitchLedger(t)}}return e.__engineSwitchContainer}},1289:(e,t,r)=>{function n(e){let{images:t,...r}=e;return{...r,omittedHistoryIds:e.omittedHistoryIds.slice(-20),omittedCount:e.omittedHistoryIds.length}}function s(e){let{sourceSnapshot:t,phaseMessages:r,...n}=e;return n}r.d(t,{E_:()=>n,WX:()=>s})},785:(e,t,r)=>{r.d(t,{ME:()=>o,kO:()=>i,sr:()=>c});var n=r(9411);let s=function(){let e=process.argv[1];if(e){let t=(0,n.dirname)((0,n.resolve)(e)),r=`${n.sep}node_modules${n.sep}.bin`;return t.endsWith(r)?(0,n.resolve)(t,"..",".."):t}return(0,n.resolve)(process.cwd())}();function a(e=process.env,t=s){return(0,n.resolve)(e.AGENT_DATA_DIR?.trim()||t)}function i(){return a()}function o(e=process.env,t=a(e)){let r=e.AGENT_LOG_DIR?.trim();if(r)return(0,n.resolve)(r);let s=e.AGENTROAM_DATA_DIR?.trim();return s?(0,n.resolve)(s,"logs"):(0,n.join)(t,".agent-data","logs")}function c(){return function(e=process.env,t=s){return(0,n.resolve)(e.AGENT_WORKING_DIRECTORY?.trim()||t)}(process.env,i())}}};var t=require("../../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),n=t.X(0,[8375,6703,5801],()=>r(5003));module.exports=n})();
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=6248,e.ids=[6248],e.modules={8042:e=>{e.exports=require("@agent/computer-use")},1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},1905:(e,t,s)=>{s.r(t),s.d(t,{originalPathname:()=>b,patchFetch:()=>w,requestAsyncStorage:()=>f,routeModule:()=>m,serverHooks:()=>v,staticGenerationAsyncStorage:()=>x});var r={};s.r(r),s.d(r,{DELETE:()=>g,GET:()=>d,PATCH:()=>p,PUT:()=>c});var o=s(7786),n=s(5042),a=s(2184),i=s(1890),u=s(1366),l=s(5801);async function d(e,{params:t}){if((0,l.V_)(t.id))return i.NextResponse.json({error:"Thread goal is only available on customer-agent sessions"},{status:400});let s=await (0,u.C)().getGoal(t.id);return i.NextResponse.json({goal:s})}async function c(e,{params:t}){if((0,l.V_)(t.id))return i.NextResponse.json({error:"Thread goal is only available on customer-agent sessions"},{status:400});try{let s=await e.json();if("string"!=typeof s.objective||!s.objective.trim())return i.NextResponse.json({error:"objective is required"},{status:400});let r=null===s.tokenBudget||void 0===s.tokenBudget?void 0:Number(s.tokenBudget);if(void 0!==r&&(!Number.isFinite(r)||r<=0))return i.NextResponse.json({error:"tokenBudget must be a positive number or null"},{status:400});let o=await (0,u.C)().setGoal(t.id,s.objective,{tokenBudget:r??null});return i.NextResponse.json({goal:o})}catch(e){return i.NextResponse.json({error:e instanceof Error?e.message:"Failed to set thread goal"},{status:h(e)})}}async function p(e,{params:t}){if((0,l.V_)(t.id))return i.NextResponse.json({error:"Thread goal is only available on customer-agent sessions"},{status:400});try{let s=await e.json(),r=(0,u.C)();if("pause"===s.action)return i.NextResponse.json({goal:await r.pauseGoal(t.id)});if("resume"===s.action)return i.NextResponse.json({goal:await r.resumeGoal(t.id)});return i.NextResponse.json({error:"action must be 'pause' or 'resume'"},{status:400})}catch(e){return i.NextResponse.json({error:e instanceof Error?e.message:"Failed to update thread goal"},{status:h(e)})}}async function g(e,{params:t}){if((0,l.V_)(t.id))return i.NextResponse.json({error:"Thread goal is only available on customer-agent sessions"},{status:400});let s=await (0,u.C)().clearGoal(t.id);return i.NextResponse.json({cleared:s})}function h(e){let t=e instanceof Error?e.message:"";return/no thread goal|Cannot transition/.test(t)?409:(/required|must be|at most/i.test(t),400)}let m=new o.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/sessions/[id]/thread-goal/route",pathname:"/api/sessions/[id]/thread-goal",filename:"route",bundlePath:"app/api/sessions/[id]/thread-goal/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-preview80-20261125.e3ZzMB/source/packages/server/app/api/sessions/[id]/thread-goal/route.ts",nextConfigOutput:"standalone",userland:r}),{requestAsyncStorage:f,staticGenerationAsyncStorage:x,serverHooks:v}=m,b="/api/sessions/[id]/thread-goal/route";function w(){return(0,a.patchFetch)({serverHooks:v,staticGenerationAsyncStorage:x})}},1489:(e,t,s)=>{s.d(t,{N:()=>u});var r=s(1636),o=s(2847),n=s(785);class a{constructor(){this.tasks=new r.CronTasks((0,n.kO)()),this.scheduler=new o.CronScheduler(this.tasks,e=>{this.fire(e).catch(e=>console.error("Scheduled Customer Agent run failed",e))},()=>{}),this.scheduler.start()}async fire(e){let{agentHost:t}=await Promise.all([s.e(1973),s.e(9119),s.e(535)]).then(s.bind(s,9119)),{getCustomerGoalCoordinator:r}=await Promise.all([s.e(1973),s.e(9119),s.e(2324)]).then(s.bind(s,6435)),o=e.sessionId;o&&await t.getSessionStore().get(o)||(o=(await t.createSession(e.label||"定时任务")).id,this.tasks.update(e.id,{sessionId:o})),await r().enqueue(o,e.prompt)}call(e,t){let s=String(t[0]||"");switch(e){case"cronList":return this.tasks.list();case"cronCreate":{if("string"!=typeof t[0]||"string"!=typeof t[1]||!t[1].trim())throw Error("cron and prompt required");let e=t[2]&&"object"==typeof t[2]?t[2]:{};return this.tasks.create({cron:t[0],prompt:t[1],recurring:!1!==e.recurring,enabled:!0,durable:!0,..."string"==typeof e.sessionId?{sessionId:e.sessionId}:{},..."string"==typeof e.label?{label:e.label}:{}})}case"cronPause":return this.tasks.pause(s);case"cronResume":return this.tasks.resume(s);case"cronDelete":return this.tasks.delete(s);case"cronDeleteAll":return this.tasks.deleteAll(),{ok:!0};default:throw Error("Unsupported schedule operation")}}}let i=globalThis;function u(){return i.__sharedCronService??=new a}},1366:(e,t,s)=>{s.d(t,{C:()=>i,a:()=>u});var r=s(1636),o=s(9119),n=s(785);let a=globalThis;function i(){if(a.__threadGoalService)return a.__threadGoalService;let e=new r.ThreadGoalService(new r.SQLiteThreadGoalStore((0,n.kO)()),{isSessionRunning:e=>o.agentHost.isSessionRunning(e),startTurn:async(e,t)=>{if(o.agentHost.isSessionRunning(e))return!1;try{return o.agentHost.startRun(t,e,void 0,{source:"goal"}).completion.catch(()=>{}),!0}catch(e){if(e instanceof o.A)return!1;throw e}},steerHidden:(e,t)=>o.agentHost.steer(t,e,"__goal__"),sessionExists:async e=>!!await o.agentHost.getSessionStore().get(e)},{onUpdated:(e,t)=>o.agentHost.publishExternal(e,{type:"goal_updated",goal:t}),onCleared:e=>o.agentHost.publishExternal(e,{type:"goal_cleared",sessionId:e})});return o.agentHost.onRunSettled=t=>{e.onRunSettled({sessionId:t.sessionId,failed:t.failed,usageLimited:t.usageLimited,tokens:t.newTokens,seconds:t.durationMs/1e3}).catch(()=>{})},o.agentHost.threadGoalToolsProvider=t=>(0,r.createThreadGoalTools)(e,t),a.__threadGoalService=e,e}function u(){i().resumeInterrupted().catch(()=>{})}}};var t=require("../../../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[8375,6703,1973,4621,5801,9119],()=>s(1905));module.exports=r})();
1
+ "use strict";(()=>{var e={};e.id=6248,e.ids=[6248],e.modules={8042:e=>{e.exports=require("@agent/computer-use")},1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},8185:(e,t,s)=>{s.r(t),s.d(t,{originalPathname:()=>b,patchFetch:()=>w,requestAsyncStorage:()=>f,routeModule:()=>m,serverHooks:()=>v,staticGenerationAsyncStorage:()=>x});var r={};s.r(r),s.d(r,{DELETE:()=>g,GET:()=>d,PATCH:()=>p,PUT:()=>c});var o=s(7786),n=s(5042),a=s(2184),i=s(1890),u=s(1366),l=s(5801);async function d(e,{params:t}){if((0,l.V_)(t.id))return i.NextResponse.json({error:"Thread goal is only available on customer-agent sessions"},{status:400});let s=await (0,u.C)().getGoal(t.id);return i.NextResponse.json({goal:s})}async function c(e,{params:t}){if((0,l.V_)(t.id))return i.NextResponse.json({error:"Thread goal is only available on customer-agent sessions"},{status:400});try{let s=await e.json();if("string"!=typeof s.objective||!s.objective.trim())return i.NextResponse.json({error:"objective is required"},{status:400});let r=null===s.tokenBudget||void 0===s.tokenBudget?void 0:Number(s.tokenBudget);if(void 0!==r&&(!Number.isFinite(r)||r<=0))return i.NextResponse.json({error:"tokenBudget must be a positive number or null"},{status:400});let o=await (0,u.C)().setGoal(t.id,s.objective,{tokenBudget:r??null});return i.NextResponse.json({goal:o})}catch(e){return i.NextResponse.json({error:e instanceof Error?e.message:"Failed to set thread goal"},{status:h(e)})}}async function p(e,{params:t}){if((0,l.V_)(t.id))return i.NextResponse.json({error:"Thread goal is only available on customer-agent sessions"},{status:400});try{let s=await e.json(),r=(0,u.C)();if("pause"===s.action)return i.NextResponse.json({goal:await r.pauseGoal(t.id)});if("resume"===s.action)return i.NextResponse.json({goal:await r.resumeGoal(t.id)});return i.NextResponse.json({error:"action must be 'pause' or 'resume'"},{status:400})}catch(e){return i.NextResponse.json({error:e instanceof Error?e.message:"Failed to update thread goal"},{status:h(e)})}}async function g(e,{params:t}){if((0,l.V_)(t.id))return i.NextResponse.json({error:"Thread goal is only available on customer-agent sessions"},{status:400});let s=await (0,u.C)().clearGoal(t.id);return i.NextResponse.json({cleared:s})}function h(e){let t=e instanceof Error?e.message:"";return/no thread goal|Cannot transition/.test(t)?409:(/required|must be|at most/i.test(t),400)}let m=new o.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/sessions/[id]/thread-goal/route",pathname:"/api/sessions/[id]/thread-goal",filename:"route",bundlePath:"app/api/sessions/[id]/thread-goal/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-npm-remote-auth-20261125.yi_kd6wp/source/packages/server/app/api/sessions/[id]/thread-goal/route.ts",nextConfigOutput:"standalone",userland:r}),{requestAsyncStorage:f,staticGenerationAsyncStorage:x,serverHooks:v}=m,b="/api/sessions/[id]/thread-goal/route";function w(){return(0,a.patchFetch)({serverHooks:v,staticGenerationAsyncStorage:x})}},1489:(e,t,s)=>{s.d(t,{N:()=>u});var r=s(1636),o=s(2847),n=s(785);class a{constructor(){this.tasks=new r.CronTasks((0,n.kO)()),this.scheduler=new o.CronScheduler(this.tasks,e=>{this.fire(e).catch(e=>console.error("Scheduled Customer Agent run failed",e))},()=>{}),this.scheduler.start()}async fire(e){let{agentHost:t}=await Promise.all([s.e(1973),s.e(9119),s.e(535)]).then(s.bind(s,9119)),{getCustomerGoalCoordinator:r}=await Promise.all([s.e(1973),s.e(9119),s.e(2324)]).then(s.bind(s,6435)),o=e.sessionId;o&&await t.getSessionStore().get(o)||(o=(await t.createSession(e.label||"定时任务")).id,this.tasks.update(e.id,{sessionId:o})),await r().enqueue(o,e.prompt)}call(e,t){let s=String(t[0]||"");switch(e){case"cronList":return this.tasks.list();case"cronCreate":{if("string"!=typeof t[0]||"string"!=typeof t[1]||!t[1].trim())throw Error("cron and prompt required");let e=t[2]&&"object"==typeof t[2]?t[2]:{};return this.tasks.create({cron:t[0],prompt:t[1],recurring:!1!==e.recurring,enabled:!0,durable:!0,..."string"==typeof e.sessionId?{sessionId:e.sessionId}:{},..."string"==typeof e.label?{label:e.label}:{}})}case"cronPause":return this.tasks.pause(s);case"cronResume":return this.tasks.resume(s);case"cronDelete":return this.tasks.delete(s);case"cronDeleteAll":return this.tasks.deleteAll(),{ok:!0};default:throw Error("Unsupported schedule operation")}}}let i=globalThis;function u(){return i.__sharedCronService??=new a}},1366:(e,t,s)=>{s.d(t,{C:()=>i,a:()=>u});var r=s(1636),o=s(9119),n=s(785);let a=globalThis;function i(){if(a.__threadGoalService)return a.__threadGoalService;let e=new r.ThreadGoalService(new r.SQLiteThreadGoalStore((0,n.kO)()),{isSessionRunning:e=>o.agentHost.isSessionRunning(e),startTurn:async(e,t)=>{if(o.agentHost.isSessionRunning(e))return!1;try{return o.agentHost.startRun(t,e,void 0,{source:"goal"}).completion.catch(()=>{}),!0}catch(e){if(e instanceof o.A)return!1;throw e}},steerHidden:(e,t)=>o.agentHost.steer(t,e,"__goal__"),sessionExists:async e=>!!await o.agentHost.getSessionStore().get(e)},{onUpdated:(e,t)=>o.agentHost.publishExternal(e,{type:"goal_updated",goal:t}),onCleared:e=>o.agentHost.publishExternal(e,{type:"goal_cleared",sessionId:e})});return o.agentHost.onRunSettled=t=>{e.onRunSettled({sessionId:t.sessionId,failed:t.failed,usageLimited:t.usageLimited,tokens:t.newTokens,seconds:t.durationMs/1e3}).catch(()=>{})},o.agentHost.threadGoalToolsProvider=t=>(0,r.createThreadGoalTools)(e,t),a.__threadGoalService=e,e}function u(){i().resumeInterrupted().catch(()=>{})}}};var t=require("../../../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[8375,6703,1973,4621,5801,9119],()=>s(8185));module.exports=r})();
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=7553,e.ids=[7553],e.modules={1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},2015:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>f,patchFetch:()=>g,requestAsyncStorage:()=>h,routeModule:()=>p,serverHooks:()=>m,staticGenerationAsyncStorage:()=>l});var s={};t.r(s),t.d(s,{GET:()=>c});var o=t(7786),n=t(5042),a=t(2184),i=t(1890),u=t(1636),d=t(5762);async function c(e,{params:r}){try{let t=new URL(e.url),s=t.searchParams.get("itemId");if(s){let e=await (0,d.pz)(r.id,s);if(!e)return i.NextResponse.json({error:"History item not found"},{status:404});let o=Math.max(0,Math.floor(Number(t.searchParams.get("textOffset"))||0)),n=Math.max(1,Math.min(16e3,Math.floor(Number(t.searchParams.get("maxChars"))||4e3))),a=e.content.slice(o,o+n);return i.NextResponse.json({item:{...e,content:a},nextTextOffset:o+a.length<e.content.length?o+a.length:null})}let o=Number(t.searchParams.get("limit"))||100,n=await (0,d.dh)(r.id,{limit:o,before:t.searchParams.get("before")||void 0,after:t.searchParams.get("after")||void 0,anchor:t.searchParams.get("anchor")||void 0});if(!n)return i.NextResponse.json({threadKey:null,activeSessionId:r.id,messages:[],segments:[]});return i.NextResponse.json({...n,truncated:n.history?.hasMore===!0||!!n.history?.newerCursor,omitted:Math.max(0,(n.history?.totalItems??0)-(n.history?.pageSize??0))})}catch(e){return i.NextResponse.json({error:e instanceof Error?e.message:"Failed to read thread history",...e instanceof u.StaleSessionAnchorError?{code:e.code}:{}},{status:e instanceof u.StaleSessionAnchorError?409:500})}}let p=new o.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/sessions/[id]/thread-history/route",pathname:"/api/sessions/[id]/thread-history",filename:"route",bundlePath:"app/api/sessions/[id]/thread-history/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-preview80-20261125.e3ZzMB/source/packages/server/app/api/sessions/[id]/thread-history/route.ts",nextConfigOutput:"standalone",userland:s}),{requestAsyncStorage:h,staticGenerationAsyncStorage:l,serverHooks:m}=p,f="/api/sessions/[id]/thread-history/route";function g(){return(0,a.patchFetch)({serverHooks:m,staticGenerationAsyncStorage:l})}},785:(e,r,t)=>{t.d(r,{ME:()=>i,kO:()=>a,sr:()=>u});var s=t(9411);let o=function(){let e=process.argv[1];if(e){let r=(0,s.dirname)((0,s.resolve)(e)),t=`${s.sep}node_modules${s.sep}.bin`;return r.endsWith(t)?(0,s.resolve)(r,"..",".."):r}return(0,s.resolve)(process.cwd())}();function n(e=process.env,r=o){return(0,s.resolve)(e.AGENT_DATA_DIR?.trim()||r)}function a(){return n()}function i(e=process.env,r=n(e)){let t=e.AGENT_LOG_DIR?.trim();if(t)return(0,s.resolve)(t);let o=e.AGENTROAM_DATA_DIR?.trim();return o?(0,s.resolve)(o,"logs"):(0,s.join)(r,".agent-data","logs")}function u(){return function(e=process.env,r=o){return(0,s.resolve)(e.AGENT_WORKING_DIRECTORY?.trim()||r)}(process.env,a())}}};var r=require("../../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[8375,6703,5801,5762],()=>t(2015));module.exports=s})();
1
+ "use strict";(()=>{var e={};e.id=7553,e.ids=[7553],e.modules={1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},214:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>f,patchFetch:()=>g,requestAsyncStorage:()=>h,routeModule:()=>p,serverHooks:()=>m,staticGenerationAsyncStorage:()=>l});var s={};t.r(s),t.d(s,{GET:()=>c});var o=t(7786),n=t(5042),a=t(2184),i=t(1890),u=t(1636),d=t(5762);async function c(e,{params:r}){try{let t=new URL(e.url),s=t.searchParams.get("itemId");if(s){let e=await (0,d.pz)(r.id,s);if(!e)return i.NextResponse.json({error:"History item not found"},{status:404});let o=Math.max(0,Math.floor(Number(t.searchParams.get("textOffset"))||0)),n=Math.max(1,Math.min(16e3,Math.floor(Number(t.searchParams.get("maxChars"))||4e3))),a=e.content.slice(o,o+n);return i.NextResponse.json({item:{...e,content:a},nextTextOffset:o+a.length<e.content.length?o+a.length:null})}let o=Number(t.searchParams.get("limit"))||100,n=await (0,d.dh)(r.id,{limit:o,before:t.searchParams.get("before")||void 0,after:t.searchParams.get("after")||void 0,anchor:t.searchParams.get("anchor")||void 0});if(!n)return i.NextResponse.json({threadKey:null,activeSessionId:r.id,messages:[],segments:[]});return i.NextResponse.json({...n,truncated:n.history?.hasMore===!0||!!n.history?.newerCursor,omitted:Math.max(0,(n.history?.totalItems??0)-(n.history?.pageSize??0))})}catch(e){return i.NextResponse.json({error:e instanceof Error?e.message:"Failed to read thread history",...e instanceof u.StaleSessionAnchorError?{code:e.code}:{}},{status:e instanceof u.StaleSessionAnchorError?409:500})}}let p=new o.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/sessions/[id]/thread-history/route",pathname:"/api/sessions/[id]/thread-history",filename:"route",bundlePath:"app/api/sessions/[id]/thread-history/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-npm-remote-auth-20261125.yi_kd6wp/source/packages/server/app/api/sessions/[id]/thread-history/route.ts",nextConfigOutput:"standalone",userland:s}),{requestAsyncStorage:h,staticGenerationAsyncStorage:l,serverHooks:m}=p,f="/api/sessions/[id]/thread-history/route";function g(){return(0,a.patchFetch)({serverHooks:m,staticGenerationAsyncStorage:l})}},785:(e,r,t)=>{t.d(r,{ME:()=>i,kO:()=>a,sr:()=>u});var s=t(9411);let o=function(){let e=process.argv[1];if(e){let r=(0,s.dirname)((0,s.resolve)(e)),t=`${s.sep}node_modules${s.sep}.bin`;return r.endsWith(t)?(0,s.resolve)(r,"..",".."):r}return(0,s.resolve)(process.cwd())}();function n(e=process.env,r=o){return(0,s.resolve)(e.AGENT_DATA_DIR?.trim()||r)}function a(){return n()}function i(e=process.env,r=n(e)){let t=e.AGENT_LOG_DIR?.trim();if(t)return(0,s.resolve)(t);let o=e.AGENTROAM_DATA_DIR?.trim();return o?(0,s.resolve)(o,"logs"):(0,s.join)(r,".agent-data","logs")}function u(){return function(e=process.env,r=o){return(0,s.resolve)(e.AGENT_WORKING_DIRECTORY?.trim()||r)}(process.env,a())}}};var r=require("../../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[8375,6703,5801,5762],()=>t(214));module.exports=s})();
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=6787,e.ids=[6787],e.modules={1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},6910:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>g,patchFetch:()=>x,requestAsyncStorage:()=>v,routeModule:()=>c,serverHooks:()=>f,staticGenerationAsyncStorage:()=>m});var s={};t.r(s),t.d(s,{GET:()=>d});var o=t(7786),n=t(5042),i=t(2184),a=t(1890),u=t(5801),l=t(1636),p=t(5762);async function d(e,{params:r}){if(!(0,u.V_)(r.id))return a.NextResponse.json({error:"Session tool results are available only for native sessions",code:"OPERATION_NOT_SUPPORTED"},{status:405});let t=new URL(e.url),s=t.searchParams.get("turnId")?.trim(),o=t.searchParams.get("itemId")?.trim(),n=t.searchParams.get("revision")?.trim();if(!s||!o||!n)return a.NextResponse.json({error:"turnId, itemId, and revision are required",code:"INVALID_SESSION_ID"},{status:400});try{let e=await (0,p.tz)(r.id,{turnId:s,itemId:o,revision:n})??await (0,u.getNativeRuntimeService)().getSessionToolResult(r.id,{turnId:s,itemId:o,revision:n});return a.NextResponse.json(e)}catch(t){let e="object"==typeof t&&null!==t&&"string"==typeof t.code?t.code:void 0,r=t instanceof l.StaleSessionAnchorError?409:(0,u.WW)(t);return a.NextResponse.json({error:t instanceof Error?t.message:"Unable to load tool result",...e?{code:e}:{}},{status:r})}}let c=new o.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/sessions/[id]/tool-result/route",pathname:"/api/sessions/[id]/tool-result",filename:"route",bundlePath:"app/api/sessions/[id]/tool-result/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-preview80-20261125.e3ZzMB/source/packages/server/app/api/sessions/[id]/tool-result/route.ts",nextConfigOutput:"standalone",userland:s}),{requestAsyncStorage:v,staticGenerationAsyncStorage:m,serverHooks:f}=c,g="/api/sessions/[id]/tool-result/route";function x(){return(0,i.patchFetch)({serverHooks:f,staticGenerationAsyncStorage:m})}},785:(e,r,t)=>{t.d(r,{ME:()=>a,kO:()=>i,sr:()=>u});var s=t(9411);let o=function(){let e=process.argv[1];if(e){let r=(0,s.dirname)((0,s.resolve)(e)),t=`${s.sep}node_modules${s.sep}.bin`;return r.endsWith(t)?(0,s.resolve)(r,"..",".."):r}return(0,s.resolve)(process.cwd())}();function n(e=process.env,r=o){return(0,s.resolve)(e.AGENT_DATA_DIR?.trim()||r)}function i(){return n()}function a(e=process.env,r=n(e)){let t=e.AGENT_LOG_DIR?.trim();if(t)return(0,s.resolve)(t);let o=e.AGENTROAM_DATA_DIR?.trim();return o?(0,s.resolve)(o,"logs"):(0,s.join)(r,".agent-data","logs")}function u(){return function(e=process.env,r=o){return(0,s.resolve)(e.AGENT_WORKING_DIRECTORY?.trim()||r)}(process.env,i())}}};var r=require("../../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[8375,6703,5801,5762],()=>t(6910));module.exports=s})();
1
+ "use strict";(()=>{var e={};e.id=6787,e.ids=[6787],e.modules={1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},4067:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>g,patchFetch:()=>x,requestAsyncStorage:()=>v,routeModule:()=>c,serverHooks:()=>f,staticGenerationAsyncStorage:()=>m});var s={};t.r(s),t.d(s,{GET:()=>d});var o=t(7786),n=t(5042),i=t(2184),a=t(1890),u=t(5801),l=t(1636),p=t(5762);async function d(e,{params:r}){if(!(0,u.V_)(r.id))return a.NextResponse.json({error:"Session tool results are available only for native sessions",code:"OPERATION_NOT_SUPPORTED"},{status:405});let t=new URL(e.url),s=t.searchParams.get("turnId")?.trim(),o=t.searchParams.get("itemId")?.trim(),n=t.searchParams.get("revision")?.trim();if(!s||!o||!n)return a.NextResponse.json({error:"turnId, itemId, and revision are required",code:"INVALID_SESSION_ID"},{status:400});try{let e=await (0,p.tz)(r.id,{turnId:s,itemId:o,revision:n})??await (0,u.getNativeRuntimeService)().getSessionToolResult(r.id,{turnId:s,itemId:o,revision:n});return a.NextResponse.json(e)}catch(t){let e="object"==typeof t&&null!==t&&"string"==typeof t.code?t.code:void 0,r=t instanceof l.StaleSessionAnchorError?409:(0,u.WW)(t);return a.NextResponse.json({error:t instanceof Error?t.message:"Unable to load tool result",...e?{code:e}:{}},{status:r})}}let c=new o.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/sessions/[id]/tool-result/route",pathname:"/api/sessions/[id]/tool-result",filename:"route",bundlePath:"app/api/sessions/[id]/tool-result/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-npm-remote-auth-20261125.yi_kd6wp/source/packages/server/app/api/sessions/[id]/tool-result/route.ts",nextConfigOutput:"standalone",userland:s}),{requestAsyncStorage:v,staticGenerationAsyncStorage:m,serverHooks:f}=c,g="/api/sessions/[id]/tool-result/route";function x(){return(0,i.patchFetch)({serverHooks:f,staticGenerationAsyncStorage:m})}},785:(e,r,t)=>{t.d(r,{ME:()=>a,kO:()=>i,sr:()=>u});var s=t(9411);let o=function(){let e=process.argv[1];if(e){let r=(0,s.dirname)((0,s.resolve)(e)),t=`${s.sep}node_modules${s.sep}.bin`;return r.endsWith(t)?(0,s.resolve)(r,"..",".."):r}return(0,s.resolve)(process.cwd())}();function n(e=process.env,r=o){return(0,s.resolve)(e.AGENT_DATA_DIR?.trim()||r)}function i(){return n()}function a(e=process.env,r=n(e)){let t=e.AGENT_LOG_DIR?.trim();if(t)return(0,s.resolve)(t);let o=e.AGENTROAM_DATA_DIR?.trim();return o?(0,s.resolve)(o,"logs"):(0,s.join)(r,".agent-data","logs")}function u(){return function(e=process.env,r=o){return(0,s.resolve)(e.AGENT_WORKING_DIRECTORY?.trim()||r)}(process.env,i())}}};var r=require("../../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[8375,6703,5801,5762],()=>t(4067));module.exports=s})();
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=5809,e.ids=[5809],e.modules={8042:e=>{e.exports=require("@agent/computer-use")},1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},6536:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>P,patchFetch:()=>x,requestAsyncStorage:()=>v,routeModule:()=>w,serverHooks:()=>E,staticGenerationAsyncStorage:()=>S});var s={};r.r(s),r.d(s,{GET:()=>y,POST:()=>f});var a=r(7786),o=r(5042),i=r(2184),n=r(1890),c=r(1636),u=r(612),l=r(9119),d=r(9142),p=r(5801),h=r(785);function m(){return new c.SQLiteParallelSessionStore((0,h.kO)())}async function g(e){let t=c.HostPathPolicy.fromEnvironment(process.env.AGENT_WEB_ROOTS,(0,u.homedir)()).assertDirectory(e.cwd);return(0,c.createParallelSessions)({...e,cwd:t},{create:async(e,t,r)=>{if("customer-agent"!==e)return(0,p.getNativeRuntimeService)().create({agentType:e,title:t,cwd:r});let s=await d.a.create(r),a=await l.agentHost.createSession(t,s.id);return{id:a.id,agentType:e,nativeSessionId:a.id,title:a.title,cwd:r,projectId:s.id,created:a.created,updated:a.updated,status:"idle",occupancy:"available",sourceLabel:"Customer Agent",canResume:!0,canDelete:!0,messageQueueVersion:1}},remove:async e=>{e.startsWith("runtime:")?await (0,p.getNativeRuntimeService)().delete(e):await l.agentHost.getSessionStore().delete(e)},save:e=>m().create(e)})}async function y(e){let t=new URL(e.url).searchParams.get("sessionId");return t?n.NextResponse.json(m().getForSession(t)):n.NextResponse.json({error:"sessionId is required"},{status:400})}async function f(e){try{let t=await e.json(),r=(0,c.parallelAgentTypes)(t.agentTypes);if("string"!=typeof t.cwd||!t.cwd.trim())throw Error("请先选择会话目录");return n.NextResponse.json(await g({agentTypes:r,cwd:t.cwd,title:"string"==typeof t.title?t.title.slice(0,200):"新会话"}),{status:201})}catch(e){return n.NextResponse.json({error:e instanceof Error?e.message:"创建多 Agent 会话失败"},{status:400})}}let w=new a.AppRouteRouteModule({definition:{kind:o.x.APP_ROUTE,page:"/api/sessions/parallel/route",pathname:"/api/sessions/parallel",filename:"route",bundlePath:"app/api/sessions/parallel/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-preview80-20261125.e3ZzMB/source/packages/server/app/api/sessions/parallel/route.ts",nextConfigOutput:"standalone",userland:s}),{requestAsyncStorage:v,staticGenerationAsyncStorage:S,serverHooks:E}=w,P="/api/sessions/parallel/route";function x(){return(0,i.patchFetch)({serverHooks:E,staticGenerationAsyncStorage:S})}},9142:(e,t,r)=>{r.d(t,{r:()=>p,a:()=>d});var s=r(612),a=r(1636),o=r(785),i=r(7561),n=r(9411),c=r(6005);class u extends Error{constructor(e,t,r){super(e),this.code=t,this.status=r,this.name="WebProjectError"}}class l{constructor(e,t,r=t.roots[0]){this.store=e,this.paths=t,this.installationDirectory=r}list(){return this.store.list()}async get(e){let t=await this.store.get(e);if(!t)throw new u("项目不存在","PROJECT_NOT_FOUND",404);return t}async create(e,t){let r=this.paths.assertDirectory(e);for(let e of(await this.store.list()))if(!e.id.startsWith("collaboration-"))try{if(this.paths.assertDirectory(e.description)===r)return e}catch{}let s=new Date().toISOString();return this.store.create({id:(0,c.randomUUID)(),name:t?.trim()||(0,n.basename)(r)||r,description:r,created:s,updated:s})}async rename(e,t){await this.get(e);let r=t.trim();if(!r)throw new u("项目名称不能为空","PROJECT_NAME_REQUIRED",400);return this.store.update(e,{name:r})}async delete(e){await this.get(e),await this.store.delete(e)}roots(){return this.paths.roots}pickerLocation(){return{roots:this.paths.roots,initialPath:this.paths.assertDirectory(this.installationDirectory)}}directories(e){return this.paths.listDirectories(e)}check(e){try{return this.paths.assertDirectory(e),!0}catch{return!1}}canonicalDirectory(e){return this.paths.assertDirectory(e)}}let d=new l(new a.SQLiteProjectStore((0,o.kO)()),a.HostPathPolicy.fromEnvironment(process.env.AGENT_WEB_ROOTS,(0,s.homedir)()),function(e,t=process.env,r=(0,s.homedir)()){let a=t.AGENTROAM_DATA_DIR?.trim();if(a)return(0,n.resolve)(a);let o=(0,n.join)(r,".agentroam");try{if((0,i.statSync)(o).isDirectory())return o}catch{}return(0,n.resolve)(e)}((0,o.kO)()));function p(e){return e instanceof u?{status:e.status,body:{error:e.message,code:e.code}}:e instanceof a.HostPathError?{status:400,body:{error:e.message,code:e.code}}:{status:500,body:{error:e instanceof Error?e.message:"项目操作失败",code:"PROJECT_OPERATION_FAILED"}}}},1489:(e,t,r)=>{r.d(t,{N:()=>c});var s=r(1636),a=r(2847),o=r(785);class i{constructor(){this.tasks=new s.CronTasks((0,o.kO)()),this.scheduler=new a.CronScheduler(this.tasks,e=>{this.fire(e).catch(e=>console.error("Scheduled Customer Agent run failed",e))},()=>{}),this.scheduler.start()}async fire(e){let{agentHost:t}=await Promise.all([r.e(1973),r.e(9119),r.e(535)]).then(r.bind(r,9119)),{getCustomerGoalCoordinator:s}=await Promise.all([r.e(1973),r.e(9119),r.e(2324)]).then(r.bind(r,6435)),a=e.sessionId;a&&await t.getSessionStore().get(a)||(a=(await t.createSession(e.label||"定时任务")).id,this.tasks.update(e.id,{sessionId:a})),await s().enqueue(a,e.prompt)}call(e,t){let r=String(t[0]||"");switch(e){case"cronList":return this.tasks.list();case"cronCreate":{if("string"!=typeof t[0]||"string"!=typeof t[1]||!t[1].trim())throw Error("cron and prompt required");let e=t[2]&&"object"==typeof t[2]?t[2]:{};return this.tasks.create({cron:t[0],prompt:t[1],recurring:!1!==e.recurring,enabled:!0,durable:!0,..."string"==typeof e.sessionId?{sessionId:e.sessionId}:{},..."string"==typeof e.label?{label:e.label}:{}})}case"cronPause":return this.tasks.pause(r);case"cronResume":return this.tasks.resume(r);case"cronDelete":return this.tasks.delete(r);case"cronDeleteAll":return this.tasks.deleteAll(),{ok:!0};default:throw Error("Unsupported schedule operation")}}}let n=globalThis;function c(){return n.__sharedCronService??=new i}}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),s=t.X(0,[8375,6703,1973,4621,5801,9119],()=>r(6536));module.exports=s})();
1
+ "use strict";(()=>{var e={};e.id=5809,e.ids=[5809],e.modules={8042:e=>{e.exports=require("@agent/computer-use")},1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},608:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>P,patchFetch:()=>x,requestAsyncStorage:()=>v,routeModule:()=>w,serverHooks:()=>E,staticGenerationAsyncStorage:()=>S});var s={};r.r(s),r.d(s,{GET:()=>y,POST:()=>f});var a=r(7786),o=r(5042),i=r(2184),n=r(1890),c=r(1636),u=r(612),l=r(9119),d=r(9142),p=r(5801),h=r(785);function m(){return new c.SQLiteParallelSessionStore((0,h.kO)())}async function g(e){let t=c.HostPathPolicy.fromEnvironment(process.env.AGENT_WEB_ROOTS,(0,u.homedir)()).assertDirectory(e.cwd);return(0,c.createParallelSessions)({...e,cwd:t},{create:async(e,t,r)=>{if("customer-agent"!==e)return(0,p.getNativeRuntimeService)().create({agentType:e,title:t,cwd:r});let s=await d.a.create(r),a=await l.agentHost.createSession(t,s.id);return{id:a.id,agentType:e,nativeSessionId:a.id,title:a.title,cwd:r,projectId:s.id,created:a.created,updated:a.updated,status:"idle",occupancy:"available",sourceLabel:"Customer Agent",canResume:!0,canDelete:!0,messageQueueVersion:1}},remove:async e=>{e.startsWith("runtime:")?await (0,p.getNativeRuntimeService)().delete(e):await l.agentHost.getSessionStore().delete(e)},save:e=>m().create(e)})}async function y(e){let t=new URL(e.url).searchParams.get("sessionId");return t?n.NextResponse.json(m().getForSession(t)):n.NextResponse.json({error:"sessionId is required"},{status:400})}async function f(e){try{let t=await e.json(),r=(0,c.parallelAgentTypes)(t.agentTypes);if("string"!=typeof t.cwd||!t.cwd.trim())throw Error("请先选择会话目录");return n.NextResponse.json(await g({agentTypes:r,cwd:t.cwd,title:"string"==typeof t.title?t.title.slice(0,200):"新会话"}),{status:201})}catch(e){return n.NextResponse.json({error:e instanceof Error?e.message:"创建多 Agent 会话失败"},{status:400})}}let w=new a.AppRouteRouteModule({definition:{kind:o.x.APP_ROUTE,page:"/api/sessions/parallel/route",pathname:"/api/sessions/parallel",filename:"route",bundlePath:"app/api/sessions/parallel/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-npm-remote-auth-20261125.yi_kd6wp/source/packages/server/app/api/sessions/parallel/route.ts",nextConfigOutput:"standalone",userland:s}),{requestAsyncStorage:v,staticGenerationAsyncStorage:S,serverHooks:E}=w,P="/api/sessions/parallel/route";function x(){return(0,i.patchFetch)({serverHooks:E,staticGenerationAsyncStorage:S})}},9142:(e,t,r)=>{r.d(t,{r:()=>p,a:()=>d});var s=r(612),a=r(1636),o=r(785),i=r(7561),n=r(9411),c=r(6005);class u extends Error{constructor(e,t,r){super(e),this.code=t,this.status=r,this.name="WebProjectError"}}class l{constructor(e,t,r=t.roots[0]){this.store=e,this.paths=t,this.installationDirectory=r}list(){return this.store.list()}async get(e){let t=await this.store.get(e);if(!t)throw new u("项目不存在","PROJECT_NOT_FOUND",404);return t}async create(e,t){let r=this.paths.assertDirectory(e);for(let e of(await this.store.list()))if(!e.id.startsWith("collaboration-"))try{if(this.paths.assertDirectory(e.description)===r)return e}catch{}let s=new Date().toISOString();return this.store.create({id:(0,c.randomUUID)(),name:t?.trim()||(0,n.basename)(r)||r,description:r,created:s,updated:s})}async rename(e,t){await this.get(e);let r=t.trim();if(!r)throw new u("项目名称不能为空","PROJECT_NAME_REQUIRED",400);return this.store.update(e,{name:r})}async delete(e){await this.get(e),await this.store.delete(e)}roots(){return this.paths.roots}pickerLocation(){return{roots:this.paths.roots,initialPath:this.paths.assertDirectory(this.installationDirectory)}}directories(e){return this.paths.listDirectories(e)}check(e){try{return this.paths.assertDirectory(e),!0}catch{return!1}}canonicalDirectory(e){return this.paths.assertDirectory(e)}}let d=new l(new a.SQLiteProjectStore((0,o.kO)()),a.HostPathPolicy.fromEnvironment(process.env.AGENT_WEB_ROOTS,(0,s.homedir)()),function(e,t=process.env,r=(0,s.homedir)()){let a=t.AGENTROAM_DATA_DIR?.trim();if(a)return(0,n.resolve)(a);let o=(0,n.join)(r,".agentroam");try{if((0,i.statSync)(o).isDirectory())return o}catch{}return(0,n.resolve)(e)}((0,o.kO)()));function p(e){return e instanceof u?{status:e.status,body:{error:e.message,code:e.code}}:e instanceof a.HostPathError?{status:400,body:{error:e.message,code:e.code}}:{status:500,body:{error:e instanceof Error?e.message:"项目操作失败",code:"PROJECT_OPERATION_FAILED"}}}},1489:(e,t,r)=>{r.d(t,{N:()=>c});var s=r(1636),a=r(2847),o=r(785);class i{constructor(){this.tasks=new s.CronTasks((0,o.kO)()),this.scheduler=new a.CronScheduler(this.tasks,e=>{this.fire(e).catch(e=>console.error("Scheduled Customer Agent run failed",e))},()=>{}),this.scheduler.start()}async fire(e){let{agentHost:t}=await Promise.all([r.e(1973),r.e(9119),r.e(535)]).then(r.bind(r,9119)),{getCustomerGoalCoordinator:s}=await Promise.all([r.e(1973),r.e(9119),r.e(2324)]).then(r.bind(r,6435)),a=e.sessionId;a&&await t.getSessionStore().get(a)||(a=(await t.createSession(e.label||"定时任务")).id,this.tasks.update(e.id,{sessionId:a})),await s().enqueue(a,e.prompt)}call(e,t){let r=String(t[0]||"");switch(e){case"cronList":return this.tasks.list();case"cronCreate":{if("string"!=typeof t[0]||"string"!=typeof t[1]||!t[1].trim())throw Error("cron and prompt required");let e=t[2]&&"object"==typeof t[2]?t[2]:{};return this.tasks.create({cron:t[0],prompt:t[1],recurring:!1!==e.recurring,enabled:!0,durable:!0,..."string"==typeof e.sessionId?{sessionId:e.sessionId}:{},..."string"==typeof e.label?{label:e.label}:{}})}case"cronPause":return this.tasks.pause(r);case"cronResume":return this.tasks.resume(r);case"cronDelete":return this.tasks.delete(r);case"cronDeleteAll":return this.tasks.deleteAll(),{ok:!0};default:throw Error("Unsupported schedule operation")}}}let n=globalThis;function c(){return n.__sharedCronService??=new i}}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),s=t.X(0,[8375,6703,1973,4621,5801,9119],()=>r(608));module.exports=s})();
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=1772,e.ids=[1772],e.modules={8042:e=>{e.exports=require("@agent/computer-use")},1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},2793:(e,s,t)=>{t.r(s),t.d(s,{originalPathname:()=>w,patchFetch:()=>v,requestAsyncStorage:()=>m,routeModule:()=>g,serverHooks:()=>h,staticGenerationAsyncStorage:()=>f});var r={};t.r(r),t.d(r,{GET:()=>d,POST:()=>p});var n=t(7786),i=t(5042),o=t(2184),a=t(1890),l=t(9119),c=t(360),u=t(5801);async function d(e){let s=new URL(e.url),t=s.searchParams.get("projectId")||void 0,r="1"===s.searchParams.get("refresh");return a.NextResponse.json((await (0,c.Qm)(t,r)).sessions)}async function p(e){let s=await e.json(),t=s.agentType??"customer-agent";if("customer-agent"!==t)try{if(!s.projectId&&!s.cwd?.trim())throw new l.B("请选择宿主机项目","PROJECT_PATH_REQUIRED",400);let e=s.cwd?.trim()||(s.projectId?await l.agentHost.resolveProjectWorkingDirectory(s.projectId,!0):""),r=await (0,u.getNativeRuntimeService)().create({agentType:t,title:s.title??"新会话",cwd:e,...s.projectId?{projectId:s.projectId}:{}});return a.NextResponse.json(r,{status:201})}catch(e){if(e instanceof l.B)return a.NextResponse.json({error:{code:e.code,message:e.message}},{status:e.status});return a.NextResponse.json({error:e instanceof Error?e.message:"Internal error"},{status:(0,u.WW)(e)})}let r=await l.agentHost.createSession(s.title??"Untitled",s.projectId??"");return a.NextResponse.json({...r,agentType:"customer-agent",messageQueueVersion:1},{status:201})}let g=new n.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/sessions/route",pathname:"/api/sessions",filename:"route",bundlePath:"app/api/sessions/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-preview80-20261125.e3ZzMB/source/packages/server/app/api/sessions/route.ts",nextConfigOutput:"standalone",userland:r}),{requestAsyncStorage:m,staticGenerationAsyncStorage:f,serverHooks:h}=g,w="/api/sessions/route";function v(){return(0,o.patchFetch)({serverHooks:h,staticGenerationAsyncStorage:f})}},355:(e,s,t)=>{t.d(s,{v:()=>i});var r=t(1636),n=t(785);function i(){let e=new r.SQLiteCollaborationRepository((0,n.kO)()).memberSessionIds();for(let s of new r.SQLiteSupervisionRepository((0,n.kO)()).internalSessionIds())e.add(s);return e}},360:(e,s,t)=>{t.d(s,{Qm:()=>d,Rk:()=>f,jl:()=>p});var r=t(6005),n=t(1636),i=t(9119),o=t(5801),a=t(355);let l=globalThis;async function c(e){let s;if(e.sessions)return e.sessions;try{return await Promise.race([e.promise,new Promise(t=>{s=setTimeout(()=>t(e.sessions??[]),1e3)})])}finally{clearTimeout(s)}}function u(e){return(0,o.getNativeRuntimeService)().refresh().then(s=>(e.sessions=s,e.expiresAt=Date.now()+15e3,s),s=>{if(!e.sessions)throw e.failure={error:s},s;return e.expiresAt=Date.now()+15e3,console.warn("Native session catalog refresh failed; serving cached sessions:",s),e.sessions}).finally(()=>{e.pending=!1})}async function d(e,s=!1,t={}){let r=t.includeInternal?new Set:(0,a.v)(),d=i.agentHost.getSessionStore(),p=(d.listSummaries?await d.listSummaries(e):(await d.list(e)).map(({messages:e,events:s,...t})=>t)).filter(e=>!r.has(e.id)).map(e=>({...e,agentType:"customer-agent",messageQueueVersion:1,canDelete:!i.agentHost.isSessionRunning(e.id),permissionMode:(0,n.normalizeToolPermissionMode)(e.metadata.permissionMode)}));try{let n=(0,o.getNativeRuntimeService)(),i=t.live?await function(e=!1){let s=l.__liveNativeSessionCatalog;if(s?.sessions)return(!s.pending&&s.expiresAt<=Date.now()&&(s.pending=!0,s.promise=u(s)),e&&s.pending)?(s.promise.catch(()=>void 0),s.sessions):s.pending?s.promise:s.sessions;if(s)return e?c(s):s.promise;let t={promise:Promise.resolve([]),pending:!0,expiresAt:0};return t.promise=u(t),l.__liveNativeSessionCatalog=t,e?c(t):t.promise}(t.backgroundRefresh):s?await n.refresh(e):await n.list(e),a=i.filter(s=>(!e||s.projectId===e)&&!r.has(s.id)),d=l.__liveNativeSessionCatalog;return{sessions:[...p,...a],...t.backgroundRefresh&&d&&(d.pending||d.sessions!==i)?{refreshing:!0}:{}}}catch(s){let e=l.__liveNativeSessionCatalog;return t.live&&e?.failure&&e.failure.error===s&&delete l.__liveNativeSessionCatalog,console.error("Native session discovery failed:",s),{sessions:p,refreshing:!1,discoveryError:s instanceof Error?s.message:"原生会话发现失败"}}}async function p(e=!1,s=!1){let t=await d(void 0,!1,{includeInternal:e,live:!0,backgroundRefresh:s}),r=new Map((await i.agentHost.getProjectStore().list()).map(e=>[e.id,e.description]));return{discoveryError:t.discoveryError,...t.refreshing?{refreshing:!0}:{},sessions:t.sessions.map(e=>({id:e.id,agentType:e.agentType,title:e.title||"未命名会话",cwd:"cwd"in e?e.cwd:r.get(e.projectId)||"",projectId:e.projectId,updated:e.updated,..."completedAt"in e&&e.completedAt?{completedAt:e.completedAt}:{},...e.parentSessionId?{parentSessionId:e.parentSessionId}:{},status:"customer-agent"===e.agentType?i.agentHost.isSessionRunning(e.id)?"running":"failed"===e.status?"failed":"completed"===e.status?"completed":"idle":e.status,canResume:!("canResume"in e)||e.canResume,..."occupancy"in e?{occupancy:e.occupancy,readOnly:e.readOnly}:{}}))}}let g=globalThis,m=g.__sessionCatalogSnapshots??=new Map;async function f(e){let s=(e.query??"").trim().toLocaleLowerCase(),t=Math.min(100,Math.max(1,e.limit??20));for(let[e,s]of m)s.expiresAt<Date.now()&&m.delete(e);let n,i=0,o,a=!1;if(e.cursor){let t=/^catalog\.([a-f0-9-]+)\.(\d+)$/.exec(e.cursor);if(!t)throw Error("会话分页标记无效,请刷新");if(n=t[1],i=Number(t[2]),!(o=m.get(n))||o.query!==s||!Number.isSafeInteger(i)||i>o.sessions.length)throw Error("会话列表已更新,请刷新重新加载")}else{let t=await p(!1,e.backgroundRefresh),{sessions:i,discoveryError:l}=t;if(a=t.refreshing??!1,l)throw Error(`原生会话暂时不可用:${l}`);let c=i.filter(e=>`${e.title} ${e.cwd} ${e.agentType}`.toLocaleLowerCase().includes(s));c.sort((e,s)=>Number("running"===s.status)-Number("running"===e.status)||s.updated.localeCompare(e.updated)||e.id.localeCompare(s.id));let u=new Set(i.map(e=>e.parentSessionId));o={sessions:c,byId:new Map(i.filter(e=>u.has(e.id)).map(e=>[e.id,e])),query:s,expiresAt:Date.now()+3e5},n=(0,r.randomUUID)(),m.set(n,o),m.size>64&&m.delete(m.keys().next().value)}let l=o.sessions.slice(i,i+t),c=new Set(l.map(e=>e.id)),u=[];for(let e of l){let s=e.parentSessionId;for(;s&&!c.has(s);){let t=o.byId.get(s);if(!t||t.agentType!==e.agentType)break;c.add(s),u.push(t),s=t.parentSessionId}}return{data:l,nextCursor:i+l.length<o.sessions.length?`catalog.${n}.${i+l.length}`:null,total:o.sessions.length,...u.length?{ancestors:u}:{},...a?{refreshing:!0}:{}}}},1489:(e,s,t)=>{t.d(s,{N:()=>l});var r=t(1636),n=t(2847),i=t(785);class o{constructor(){this.tasks=new r.CronTasks((0,i.kO)()),this.scheduler=new n.CronScheduler(this.tasks,e=>{this.fire(e).catch(e=>console.error("Scheduled Customer Agent run failed",e))},()=>{}),this.scheduler.start()}async fire(e){let{agentHost:s}=await Promise.all([t.e(1973),t.e(9119),t.e(535)]).then(t.bind(t,9119)),{getCustomerGoalCoordinator:r}=await Promise.all([t.e(1973),t.e(9119),t.e(2324)]).then(t.bind(t,6435)),n=e.sessionId;n&&await s.getSessionStore().get(n)||(n=(await s.createSession(e.label||"定时任务")).id,this.tasks.update(e.id,{sessionId:n})),await r().enqueue(n,e.prompt)}call(e,s){let t=String(s[0]||"");switch(e){case"cronList":return this.tasks.list();case"cronCreate":{if("string"!=typeof s[0]||"string"!=typeof s[1]||!s[1].trim())throw Error("cron and prompt required");let e=s[2]&&"object"==typeof s[2]?s[2]:{};return this.tasks.create({cron:s[0],prompt:s[1],recurring:!1!==e.recurring,enabled:!0,durable:!0,..."string"==typeof e.sessionId?{sessionId:e.sessionId}:{},..."string"==typeof e.label?{label:e.label}:{}})}case"cronPause":return this.tasks.pause(t);case"cronResume":return this.tasks.resume(t);case"cronDelete":return this.tasks.delete(t);case"cronDeleteAll":return this.tasks.deleteAll(),{ok:!0};default:throw Error("Unsupported schedule operation")}}}let a=globalThis;function l(){return a.__sharedCronService??=new o}}};var s=require("../../../webpack-runtime.js");s.C(e);var t=e=>s(s.s=e),r=s.X(0,[8375,6703,1973,4621,5801,9119],()=>t(2793));module.exports=r})();
1
+ "use strict";(()=>{var e={};e.id=1772,e.ids=[1772],e.modules={8042:e=>{e.exports=require("@agent/computer-use")},1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},8499:(e,s,t)=>{t.r(s),t.d(s,{originalPathname:()=>w,patchFetch:()=>v,requestAsyncStorage:()=>m,routeModule:()=>g,serverHooks:()=>h,staticGenerationAsyncStorage:()=>f});var r={};t.r(r),t.d(r,{GET:()=>d,POST:()=>p});var n=t(7786),i=t(5042),o=t(2184),a=t(1890),l=t(9119),c=t(360),u=t(5801);async function d(e){let s=new URL(e.url),t=s.searchParams.get("projectId")||void 0,r="1"===s.searchParams.get("refresh");return a.NextResponse.json((await (0,c.Qm)(t,r)).sessions)}async function p(e){let s=await e.json(),t=s.agentType??"customer-agent";if("customer-agent"!==t)try{if(!s.projectId&&!s.cwd?.trim())throw new l.B("请选择宿主机项目","PROJECT_PATH_REQUIRED",400);let e=s.cwd?.trim()||(s.projectId?await l.agentHost.resolveProjectWorkingDirectory(s.projectId,!0):""),r=await (0,u.getNativeRuntimeService)().create({agentType:t,title:s.title??"新会话",cwd:e,...s.projectId?{projectId:s.projectId}:{}});return a.NextResponse.json(r,{status:201})}catch(e){if(e instanceof l.B)return a.NextResponse.json({error:{code:e.code,message:e.message}},{status:e.status});return a.NextResponse.json({error:e instanceof Error?e.message:"Internal error"},{status:(0,u.WW)(e)})}let r=await l.agentHost.createSession(s.title??"Untitled",s.projectId??"");return a.NextResponse.json({...r,agentType:"customer-agent",messageQueueVersion:1},{status:201})}let g=new n.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/sessions/route",pathname:"/api/sessions",filename:"route",bundlePath:"app/api/sessions/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-npm-remote-auth-20261125.yi_kd6wp/source/packages/server/app/api/sessions/route.ts",nextConfigOutput:"standalone",userland:r}),{requestAsyncStorage:m,staticGenerationAsyncStorage:f,serverHooks:h}=g,w="/api/sessions/route";function v(){return(0,o.patchFetch)({serverHooks:h,staticGenerationAsyncStorage:f})}},355:(e,s,t)=>{t.d(s,{v:()=>i});var r=t(1636),n=t(785);function i(){let e=new r.SQLiteCollaborationRepository((0,n.kO)()).memberSessionIds();for(let s of new r.SQLiteSupervisionRepository((0,n.kO)()).internalSessionIds())e.add(s);return e}},360:(e,s,t)=>{t.d(s,{Qm:()=>d,Rk:()=>f,jl:()=>p});var r=t(6005),n=t(1636),i=t(9119),o=t(5801),a=t(355);let l=globalThis;async function c(e){let s;if(e.sessions)return e.sessions;try{return await Promise.race([e.promise,new Promise(t=>{s=setTimeout(()=>t(e.sessions??[]),1e3)})])}finally{clearTimeout(s)}}function u(e){return(0,o.getNativeRuntimeService)().refresh().then(s=>(e.sessions=s,e.expiresAt=Date.now()+15e3,s),s=>{if(!e.sessions)throw e.failure={error:s},s;return e.expiresAt=Date.now()+15e3,console.warn("Native session catalog refresh failed; serving cached sessions:",s),e.sessions}).finally(()=>{e.pending=!1})}async function d(e,s=!1,t={}){let r=t.includeInternal?new Set:(0,a.v)(),d=i.agentHost.getSessionStore(),p=(d.listSummaries?await d.listSummaries(e):(await d.list(e)).map(({messages:e,events:s,...t})=>t)).filter(e=>!r.has(e.id)).map(e=>({...e,agentType:"customer-agent",messageQueueVersion:1,canDelete:!i.agentHost.isSessionRunning(e.id),permissionMode:(0,n.normalizeToolPermissionMode)(e.metadata.permissionMode)}));try{let n=(0,o.getNativeRuntimeService)(),i=t.live?await function(e=!1){let s=l.__liveNativeSessionCatalog;if(s?.sessions)return(!s.pending&&s.expiresAt<=Date.now()&&(s.pending=!0,s.promise=u(s)),e&&s.pending)?(s.promise.catch(()=>void 0),s.sessions):s.pending?s.promise:s.sessions;if(s)return e?c(s):s.promise;let t={promise:Promise.resolve([]),pending:!0,expiresAt:0};return t.promise=u(t),l.__liveNativeSessionCatalog=t,e?c(t):t.promise}(t.backgroundRefresh):s?await n.refresh(e):await n.list(e),a=i.filter(s=>(!e||s.projectId===e)&&!r.has(s.id)),d=l.__liveNativeSessionCatalog;return{sessions:[...p,...a],...t.backgroundRefresh&&d&&(d.pending||d.sessions!==i)?{refreshing:!0}:{}}}catch(s){let e=l.__liveNativeSessionCatalog;return t.live&&e?.failure&&e.failure.error===s&&delete l.__liveNativeSessionCatalog,console.error("Native session discovery failed:",s),{sessions:p,refreshing:!1,discoveryError:s instanceof Error?s.message:"原生会话发现失败"}}}async function p(e=!1,s=!1){let t=await d(void 0,!1,{includeInternal:e,live:!0,backgroundRefresh:s}),r=new Map((await i.agentHost.getProjectStore().list()).map(e=>[e.id,e.description]));return{discoveryError:t.discoveryError,...t.refreshing?{refreshing:!0}:{},sessions:t.sessions.map(e=>({id:e.id,agentType:e.agentType,title:e.title||"未命名会话",cwd:"cwd"in e?e.cwd:r.get(e.projectId)||"",projectId:e.projectId,updated:e.updated,..."completedAt"in e&&e.completedAt?{completedAt:e.completedAt}:{},...e.parentSessionId?{parentSessionId:e.parentSessionId}:{},status:"customer-agent"===e.agentType?i.agentHost.isSessionRunning(e.id)?"running":"failed"===e.status?"failed":"completed"===e.status?"completed":"idle":e.status,canResume:!("canResume"in e)||e.canResume,..."occupancy"in e?{occupancy:e.occupancy,readOnly:e.readOnly}:{}}))}}let g=globalThis,m=g.__sessionCatalogSnapshots??=new Map;async function f(e){let s=(e.query??"").trim().toLocaleLowerCase(),t=Math.min(100,Math.max(1,e.limit??20));for(let[e,s]of m)s.expiresAt<Date.now()&&m.delete(e);let n,i=0,o,a=!1;if(e.cursor){let t=/^catalog\.([a-f0-9-]+)\.(\d+)$/.exec(e.cursor);if(!t)throw Error("会话分页标记无效,请刷新");if(n=t[1],i=Number(t[2]),!(o=m.get(n))||o.query!==s||!Number.isSafeInteger(i)||i>o.sessions.length)throw Error("会话列表已更新,请刷新重新加载")}else{let t=await p(!1,e.backgroundRefresh),{sessions:i,discoveryError:l}=t;if(a=t.refreshing??!1,l)throw Error(`原生会话暂时不可用:${l}`);let c=i.filter(e=>`${e.title} ${e.cwd} ${e.agentType}`.toLocaleLowerCase().includes(s));c.sort((e,s)=>Number("running"===s.status)-Number("running"===e.status)||s.updated.localeCompare(e.updated)||e.id.localeCompare(s.id));let u=new Set(i.map(e=>e.parentSessionId));o={sessions:c,byId:new Map(i.filter(e=>u.has(e.id)).map(e=>[e.id,e])),query:s,expiresAt:Date.now()+3e5},n=(0,r.randomUUID)(),m.set(n,o),m.size>64&&m.delete(m.keys().next().value)}let l=o.sessions.slice(i,i+t),c=new Set(l.map(e=>e.id)),u=[];for(let e of l){let s=e.parentSessionId;for(;s&&!c.has(s);){let t=o.byId.get(s);if(!t||t.agentType!==e.agentType)break;c.add(s),u.push(t),s=t.parentSessionId}}return{data:l,nextCursor:i+l.length<o.sessions.length?`catalog.${n}.${i+l.length}`:null,total:o.sessions.length,...u.length?{ancestors:u}:{},...a?{refreshing:!0}:{}}}},1489:(e,s,t)=>{t.d(s,{N:()=>l});var r=t(1636),n=t(2847),i=t(785);class o{constructor(){this.tasks=new r.CronTasks((0,i.kO)()),this.scheduler=new n.CronScheduler(this.tasks,e=>{this.fire(e).catch(e=>console.error("Scheduled Customer Agent run failed",e))},()=>{}),this.scheduler.start()}async fire(e){let{agentHost:s}=await Promise.all([t.e(1973),t.e(9119),t.e(535)]).then(t.bind(t,9119)),{getCustomerGoalCoordinator:r}=await Promise.all([t.e(1973),t.e(9119),t.e(2324)]).then(t.bind(t,6435)),n=e.sessionId;n&&await s.getSessionStore().get(n)||(n=(await s.createSession(e.label||"定时任务")).id,this.tasks.update(e.id,{sessionId:n})),await r().enqueue(n,e.prompt)}call(e,s){let t=String(s[0]||"");switch(e){case"cronList":return this.tasks.list();case"cronCreate":{if("string"!=typeof s[0]||"string"!=typeof s[1]||!s[1].trim())throw Error("cron and prompt required");let e=s[2]&&"object"==typeof s[2]?s[2]:{};return this.tasks.create({cron:s[0],prompt:s[1],recurring:!1!==e.recurring,enabled:!0,durable:!0,..."string"==typeof e.sessionId?{sessionId:e.sessionId}:{},..."string"==typeof e.label?{label:e.label}:{}})}case"cronPause":return this.tasks.pause(t);case"cronResume":return this.tasks.resume(t);case"cronDelete":return this.tasks.delete(t);case"cronDeleteAll":return this.tasks.deleteAll(),{ok:!0};default:throw Error("Unsupported schedule operation")}}}let a=globalThis;function l(){return a.__sharedCronService??=new o}}};var s=require("../../../webpack-runtime.js");s.C(e);var t=e=>s(s.s=e),r=s.X(0,[8375,6703,1973,4621,5801,9119],()=>t(8499));module.exports=r})();
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=6668,e.ids=[6668],e.modules={1636:e=>{e.exports=require("@agent/core")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},6005:e=>{e.exports=require("node:crypto")},9411:e=>{e.exports=require("node:path")},9128:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>m,patchFetch:()=>v,requestAsyncStorage:()=>f,routeModule:()=>c,serverHooks:()=>g,staticGenerationAsyncStorage:()=>h});var i={};r.r(i),r.d(i,{GET:()=>l,POST:()=>u,dynamic:()=>p});var o=r(7786),s=r(5042),n=r(2184),a=r(1982),d=r(9001);let p="force-dynamic";async function l(){return Response.json((0,a.dp)().publicView(),{headers:{"cache-control":"no-store"}})}async function u(e){let t=(0,d.o)(e);if(t)return t;try{let t=await e.json();if(!t||"object"!=typeof t||Array.isArray(t))throw new a.kg("设置必须是对象");return Response.json((0,a.dp)().save(t),{headers:{"cache-control":"no-store"}})}catch(e){return Response.json({error:e instanceof Error?e.message:"保存失败"},{status:e instanceof a.kg?e.status:400})}}let c=new o.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/settings/route",pathname:"/api/settings",filename:"route",bundlePath:"app/api/settings/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-preview80-20261125.e3ZzMB/source/packages/server/app/api/settings/route.ts",nextConfigOutput:"standalone",userland:i}),{requestAsyncStorage:f,staticGenerationAsyncStorage:h,serverHooks:g}=c,m="/api/settings/route";function v(){return(0,n.patchFetch)({serverHooks:g,staticGenerationAsyncStorage:h})}},7786:(e,t,r)=>{e.exports=r(517)},785:(e,t,r)=>{r.d(t,{ME:()=>a,kO:()=>n,sr:()=>d});var i=r(9411);let o=function(){let e=process.argv[1];if(e){let t=(0,i.dirname)((0,i.resolve)(e)),r=`${i.sep}node_modules${i.sep}.bin`;return t.endsWith(r)?(0,i.resolve)(t,"..",".."):t}return(0,i.resolve)(process.cwd())}();function s(e=process.env,t=o){return(0,i.resolve)(e.AGENT_DATA_DIR?.trim()||t)}function n(){return s()}function a(e=process.env,t=s(e)){let r=e.AGENT_LOG_DIR?.trim();if(r)return(0,i.resolve)(r);let o=e.AGENTROAM_DATA_DIR?.trim();return o?(0,i.resolve)(o,"logs"):(0,i.join)(t,".agent-data","logs")}function d(){return function(e=process.env,t=o){return(0,i.resolve)(e.AGENT_WORKING_DIRECTORY?.trim()||t)}(process.env,n())}},1982:(e,t,r)=>{let i;r.d(t,{dp:()=>u,kg:()=>d});var o=r(1636),s=r(785),n=r(6005);let a="__agentroam_stored_secret__";class d extends Error{constructor(e,t=400){super(e),this.status=t}}class p{constructor(e,t=process.env){this.baseDir=e,this.store=new o.SQLiteSettingsStore(e),null===this.store.get("sharedSettingsInitialized")&&(0,o.getDatabase)(e).db.transaction(()=>{if(!this.store.get("profiles")&&!this.store.get("apiKey")&&t.AGENT_API_KEY){let e={id:"server-default",name:"服务端默认",provider:t.AGENT_MODEL_PROVIDER||"openai",modelId:t.AGENT_MODEL_ID||"gpt-4o",apiKey:t.AGENT_API_KEY,baseUrl:t.AGENT_BASE_URL||""};this.store.saveAll({...this.store.getAll(),profiles:[e],activeProfileId:e.id,modelProvider:e.provider,modelId:e.modelId,apiKey:e.apiKey,baseUrl:e.baseUrl,isConfigured:!0})}this.store.set("sharedSettingsInitialized","1")})()}read(){let e=[];try{e=JSON.parse(this.store.get("activeAgentIds")||"[]")}catch{}return{...this.store.getAll(),activeAgentIds:e,revision:Number(this.store.get("sharedSettingsRevision")||0)}}publicView(){let e=this.read();return{...e,settingsSpaceId:(0,n.createHash)("sha256").update(this.baseDir).digest("hex").slice(0,24),apiKey:e.apiKey?a:"",profiles:e.profiles.map(e=>({...e,apiKey:e.apiKey?a:""}))}}save(e){return(0,o.getDatabase)(this.baseDir).db.transaction(()=>{let t=this.read();if(void 0!==e.revision&&e.revision!==t.revision)throw new d("设置已被另一端修改,请重新加载后保存",409);let r={...t};for(let t of["modelProvider","modelId","baseUrl","workingDirectory","activeProfileId"])if(void 0!==e[t]){if("string"!=typeof e[t])throw new d(`${t} 必须是字符串`);r[t]=e[t]}if(void 0!==e.maxIterations){if("number"!=typeof e.maxIterations||!Number.isSafeInteger(e.maxIterations)||e.maxIterations<0)throw new d("maxIterations 必须是非负整数");r.maxIterations=e.maxIterations}if(void 0!==e.contextWindow){if("number"!=typeof e.contextWindow||!Number.isFinite(e.contextWindow)||e.contextWindow<8||e.contextWindow>2e3)throw new d("contextWindow 超出范围");r.contextWindow=e.contextWindow}if(void 0!==e.reasoningEffort){if(!["off","low","medium","high"].includes(String(e.reasoningEffort)))throw new d("reasoningEffort 无效");r.reasoningEffort=e.reasoningEffort}if(void 0!==e.taskNotifications){if(!e.taskNotifications||"object"!=typeof e.taskNotifications||Array.isArray(e.taskNotifications))throw new d("taskNotifications 必须是对象");let t=e.taskNotifications;for(let e of["completionEnabled","approvalEnabled","todoEnabled","soundEnabled","notifyWhileForeground"])if(void 0!==t[e]&&"boolean"!=typeof t[e])throw new d(`taskNotifications.${e} 必须是布尔值`);r.taskNotifications=(0,o.resolveTaskNotificationPreferences)({...r.taskNotifications,...t})}if(void 0!==e.apiKey&&(r.apiKey=l(e.apiKey,t.apiKey)),void 0!==e.profiles){if(!Array.isArray(e.profiles)||e.profiles.length>100)throw new d("profiles 必须是数组");let i=new Set;r.profiles=e.profiles.map(e=>{if(!e||"object"!=typeof e)throw new d("profile 无效");for(let t of["id","name","provider","modelId","baseUrl"])if("string"!=typeof e[t])throw new d(`profile.${t} 无效`);if(!e.id||i.has(e.id))throw new d("profile.id 重复或为空");if(i.add(e.id),!["openai","anthropic","deepseek","aihub"].includes(e.provider))throw new d("不支持的模型提供方");if(void 0!==e.maxOutputTokens&&("number"!=typeof e.maxOutputTokens||!Number.isInteger(e.maxOutputTokens)||e.maxOutputTokens<256||e.maxOutputTokens>131072))throw new d("profile.maxOutputTokens 超出范围");if(void 0!==e.requestTimeoutSeconds&&("number"!=typeof e.requestTimeoutSeconds||!Number.isInteger(e.requestTimeoutSeconds)||e.requestTimeoutSeconds<30||e.requestTimeoutSeconds>1800))throw new d("profile.requestTimeoutSeconds 超出范围");return{id:e.id,name:e.name,provider:e.provider,modelId:e.modelId,baseUrl:e.baseUrl,apiKey:l(e.apiKey,t.profiles.find(t=>t.id===e.id)?.apiKey||""),...void 0===e.maxOutputTokens?{}:{maxOutputTokens:e.maxOutputTokens},...void 0===e.requestTimeoutSeconds?{}:{requestTimeoutSeconds:e.requestTimeoutSeconds}}})}let i=r.profiles.find(e=>e.id===r.activeProfileId);if(r.activeProfileId&&!i)throw new d("找不到当前配置档案");if(i&&Object.assign(r,{modelProvider:i.provider,modelId:i.modelId,apiKey:i.apiKey,baseUrl:i.baseUrl}),void 0!==e.activeAgentIds){if(!Array.isArray(e.activeAgentIds)||!e.activeAgentIds.every(e=>"string"==typeof e))throw new d("activeAgentIds 无效");r.activeAgentIds=[...new Set(e.activeAgentIds)]}return r.isConfigured="aihub"===r.modelProvider?!!r.modelId:!!(r.apiKey&&r.modelId),this.store.saveAll(r),this.store.set("activeAgentIds",JSON.stringify(r.activeAgentIds)),this.store.set("sharedSettingsRevision",String(t.revision+1)),this.publicView()})()}}function l(e,t){if(void 0===e||""===e||e===a)return t;if("string"!=typeof e||e.length>16384)throw new d("apiKey 无效");return e}function u(){return i??=new p((0,s.kO)())}},9001:(e,t,r)=>{r.d(t,{o:()=>o});let i=new Set(["capacitor://localhost","ionic://localhost"]);function o(e){if(!e.headers.get("content-type")?.toLowerCase().startsWith("application/json"))return Response.json({error:"JSON required"},{status:415});let t=e.headers.get("origin");if(!t||i.has(t))return null;let r=new URL(e.url),o="1"===process.env.AGENT_TRUST_TUNNEL_PROXY,s=o?e.headers.get("x-forwarded-host")?.split(",")[0].trim()||e.headers.get("host")||r.host:e.headers.get("host")||r.host,n=o&&e.headers.get("x-forwarded-proto")?.split(",")[0].trim()||r.protocol.slice(0,-1);return t!==`${n}://${s}`?Response.json({error:"Cross-origin write denied"},{status:403}):null}}};var t=require("../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),i=t.X(0,[8375],()=>r(9128));module.exports=i})();
1
+ "use strict";(()=>{var e={};e.id=6668,e.ids=[6668],e.modules={1636:e=>{e.exports=require("@agent/core")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},6005:e=>{e.exports=require("node:crypto")},9411:e=>{e.exports=require("node:path")},7685:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>g,patchFetch:()=>v,requestAsyncStorage:()=>f,routeModule:()=>c,serverHooks:()=>m,staticGenerationAsyncStorage:()=>h});var i={};r.r(i),r.d(i,{GET:()=>l,POST:()=>u,dynamic:()=>p});var o=r(7786),s=r(5042),n=r(2184),a=r(1982),d=r(9001);let p="force-dynamic";async function l(){return Response.json((0,a.dp)().publicView(),{headers:{"cache-control":"no-store"}})}async function u(e){let t=(0,d.o)(e);if(t)return t;try{let t=await e.json();if(!t||"object"!=typeof t||Array.isArray(t))throw new a.kg("设置必须是对象");return Response.json((0,a.dp)().save(t),{headers:{"cache-control":"no-store"}})}catch(e){return Response.json({error:e instanceof Error?e.message:"保存失败"},{status:e instanceof a.kg?e.status:400})}}let c=new o.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/settings/route",pathname:"/api/settings",filename:"route",bundlePath:"app/api/settings/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-npm-remote-auth-20261125.yi_kd6wp/source/packages/server/app/api/settings/route.ts",nextConfigOutput:"standalone",userland:i}),{requestAsyncStorage:f,staticGenerationAsyncStorage:h,serverHooks:m}=c,g="/api/settings/route";function v(){return(0,n.patchFetch)({serverHooks:m,staticGenerationAsyncStorage:h})}},7786:(e,t,r)=>{e.exports=r(517)},785:(e,t,r)=>{r.d(t,{ME:()=>a,kO:()=>n,sr:()=>d});var i=r(9411);let o=function(){let e=process.argv[1];if(e){let t=(0,i.dirname)((0,i.resolve)(e)),r=`${i.sep}node_modules${i.sep}.bin`;return t.endsWith(r)?(0,i.resolve)(t,"..",".."):t}return(0,i.resolve)(process.cwd())}();function s(e=process.env,t=o){return(0,i.resolve)(e.AGENT_DATA_DIR?.trim()||t)}function n(){return s()}function a(e=process.env,t=s(e)){let r=e.AGENT_LOG_DIR?.trim();if(r)return(0,i.resolve)(r);let o=e.AGENTROAM_DATA_DIR?.trim();return o?(0,i.resolve)(o,"logs"):(0,i.join)(t,".agent-data","logs")}function d(){return function(e=process.env,t=o){return(0,i.resolve)(e.AGENT_WORKING_DIRECTORY?.trim()||t)}(process.env,n())}},1982:(e,t,r)=>{let i;r.d(t,{dp:()=>u,kg:()=>d});var o=r(1636),s=r(785),n=r(6005);let a="__agentroam_stored_secret__";class d extends Error{constructor(e,t=400){super(e),this.status=t}}class p{constructor(e,t=process.env){this.baseDir=e,this.store=new o.SQLiteSettingsStore(e),null===this.store.get("sharedSettingsInitialized")&&(0,o.getDatabase)(e).db.transaction(()=>{if(!this.store.get("profiles")&&!this.store.get("apiKey")&&t.AGENT_API_KEY){let e={id:"server-default",name:"服务端默认",provider:t.AGENT_MODEL_PROVIDER||"openai",modelId:t.AGENT_MODEL_ID||"gpt-4o",apiKey:t.AGENT_API_KEY,baseUrl:t.AGENT_BASE_URL||""};this.store.saveAll({...this.store.getAll(),profiles:[e],activeProfileId:e.id,modelProvider:e.provider,modelId:e.modelId,apiKey:e.apiKey,baseUrl:e.baseUrl,isConfigured:!0})}this.store.set("sharedSettingsInitialized","1")})()}read(){let e=[];try{e=JSON.parse(this.store.get("activeAgentIds")||"[]")}catch{}return{...this.store.getAll(),activeAgentIds:e,revision:Number(this.store.get("sharedSettingsRevision")||0)}}publicView(){let e=this.read();return{...e,settingsSpaceId:(0,n.createHash)("sha256").update(this.baseDir).digest("hex").slice(0,24),apiKey:e.apiKey?a:"",profiles:e.profiles.map(e=>({...e,apiKey:e.apiKey?a:""}))}}save(e){return(0,o.getDatabase)(this.baseDir).db.transaction(()=>{let t=this.read();if(void 0!==e.revision&&e.revision!==t.revision)throw new d("设置已被另一端修改,请重新加载后保存",409);let r={...t};for(let t of["modelProvider","modelId","baseUrl","workingDirectory","activeProfileId"])if(void 0!==e[t]){if("string"!=typeof e[t])throw new d(`${t} 必须是字符串`);r[t]=e[t]}if(void 0!==e.maxIterations){if("number"!=typeof e.maxIterations||!Number.isSafeInteger(e.maxIterations)||e.maxIterations<0)throw new d("maxIterations 必须是非负整数");r.maxIterations=e.maxIterations}if(void 0!==e.contextWindow){if("number"!=typeof e.contextWindow||!Number.isFinite(e.contextWindow)||e.contextWindow<8||e.contextWindow>2e3)throw new d("contextWindow 超出范围");r.contextWindow=e.contextWindow}if(void 0!==e.reasoningEffort){if(!["off","low","medium","high"].includes(String(e.reasoningEffort)))throw new d("reasoningEffort 无效");r.reasoningEffort=e.reasoningEffort}if(void 0!==e.taskNotifications){if(!e.taskNotifications||"object"!=typeof e.taskNotifications||Array.isArray(e.taskNotifications))throw new d("taskNotifications 必须是对象");let t=e.taskNotifications;for(let e of["completionEnabled","approvalEnabled","todoEnabled","soundEnabled","notifyWhileForeground"])if(void 0!==t[e]&&"boolean"!=typeof t[e])throw new d(`taskNotifications.${e} 必须是布尔值`);r.taskNotifications=(0,o.resolveTaskNotificationPreferences)({...r.taskNotifications,...t})}if(void 0!==e.apiKey&&(r.apiKey=l(e.apiKey,t.apiKey)),void 0!==e.profiles){if(!Array.isArray(e.profiles)||e.profiles.length>100)throw new d("profiles 必须是数组");let i=new Set;r.profiles=e.profiles.map(e=>{if(!e||"object"!=typeof e)throw new d("profile 无效");for(let t of["id","name","provider","modelId","baseUrl"])if("string"!=typeof e[t])throw new d(`profile.${t} 无效`);if(!e.id||i.has(e.id))throw new d("profile.id 重复或为空");if(i.add(e.id),!["openai","anthropic","deepseek","aihub"].includes(e.provider))throw new d("不支持的模型提供方");if(void 0!==e.maxOutputTokens&&("number"!=typeof e.maxOutputTokens||!Number.isInteger(e.maxOutputTokens)||e.maxOutputTokens<256||e.maxOutputTokens>131072))throw new d("profile.maxOutputTokens 超出范围");if(void 0!==e.requestTimeoutSeconds&&("number"!=typeof e.requestTimeoutSeconds||!Number.isInteger(e.requestTimeoutSeconds)||e.requestTimeoutSeconds<30||e.requestTimeoutSeconds>1800))throw new d("profile.requestTimeoutSeconds 超出范围");return{id:e.id,name:e.name,provider:e.provider,modelId:e.modelId,baseUrl:e.baseUrl,apiKey:l(e.apiKey,t.profiles.find(t=>t.id===e.id)?.apiKey||""),...void 0===e.maxOutputTokens?{}:{maxOutputTokens:e.maxOutputTokens},...void 0===e.requestTimeoutSeconds?{}:{requestTimeoutSeconds:e.requestTimeoutSeconds}}})}let i=r.profiles.find(e=>e.id===r.activeProfileId);if(r.activeProfileId&&!i)throw new d("找不到当前配置档案");if(i&&Object.assign(r,{modelProvider:i.provider,modelId:i.modelId,apiKey:i.apiKey,baseUrl:i.baseUrl}),void 0!==e.activeAgentIds){if(!Array.isArray(e.activeAgentIds)||!e.activeAgentIds.every(e=>"string"==typeof e))throw new d("activeAgentIds 无效");r.activeAgentIds=[...new Set(e.activeAgentIds)]}return r.isConfigured="aihub"===r.modelProvider?!!r.modelId:!!(r.apiKey&&r.modelId),this.store.saveAll(r),this.store.set("activeAgentIds",JSON.stringify(r.activeAgentIds)),this.store.set("sharedSettingsRevision",String(t.revision+1)),this.publicView()})()}}function l(e,t){if(void 0===e||""===e||e===a)return t;if("string"!=typeof e||e.length>16384)throw new d("apiKey 无效");return e}function u(){return i??=new p((0,s.kO)())}},9001:(e,t,r)=>{r.d(t,{o:()=>o});let i=new Set(["capacitor://localhost","ionic://localhost"]);function o(e){if(!e.headers.get("content-type")?.toLowerCase().startsWith("application/json"))return Response.json({error:"JSON required"},{status:415});let t=e.headers.get("origin");if(!t||i.has(t))return null;let r=new URL(e.url),o="1"===process.env.AGENT_TRUST_TUNNEL_PROXY,s=o?e.headers.get("x-forwarded-host")?.split(",")[0].trim()||e.headers.get("host")||r.host:e.headers.get("host")||r.host,n=o&&e.headers.get("x-forwarded-proto")?.split(",")[0].trim()||r.protocol.slice(0,-1);return t!==`${n}://${s}`?Response.json({error:"Cross-origin write denied"},{status:403}):null}}};var t=require("../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),i=t.X(0,[8375],()=>r(7685));module.exports=i})();
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=1731,e.ids=[1731],e.modules={8042:e=>{e.exports=require("@agent/computer-use")},1636:e=>{e.exports=require("@agent/core")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},9794:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>x,patchFetch:()=>g,requestAsyncStorage:()=>m,routeModule:()=>c,serverHooks:()=>f,staticGenerationAsyncStorage:()=>h});var s={};t.r(s),t.d(s,{GET:()=>u,POST:()=>d});var i=t(7786),a=t(5042),o=t(2184),n=t(1890),l=t(1636),p=t(4621);async function u(){let e=await (0,p.i)().call("listSkills",[]);return n.NextResponse.json(e.map(e=>({name:e.name,description:e.description,triggers:e.triggers,filePath:e.filePath})))}async function d(e){try{let r=await e.json(),t=new l.SkillLoader,s=(0,p.i)().skills,i=[];if(r.filePath){let e=await t.loadFromFile(r.filePath);await s.save(e),i.push({name:e.name,description:e.description})}else if(!r.dirPath)return n.NextResponse.json({error:"filePath or dirPath is required"},{status:400});else for(let e of(await t.loadFromDirectory(r.dirPath)))await s.save(await t.loadFromFile(e.filePath)),i.push({name:e.name,description:e.description});return n.NextResponse.json({status:"imported",count:i.length,skills:i})}catch(e){return n.NextResponse.json({error:e instanceof Error?e.message:"Skill import failed"},{status:500})}}let c=new i.AppRouteRouteModule({definition:{kind:a.x.APP_ROUTE,page:"/api/skills/route",pathname:"/api/skills",filename:"route",bundlePath:"app/api/skills/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-preview80-20261125.e3ZzMB/source/packages/server/app/api/skills/route.ts",nextConfigOutput:"standalone",userland:s}),{requestAsyncStorage:m,staticGenerationAsyncStorage:h,serverHooks:f}=c,x="/api/skills/route";function g(){return(0,o.patchFetch)({serverHooks:f,staticGenerationAsyncStorage:h})}}};var r=require("../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[8375,6703,4621],()=>t(9794));module.exports=s})();
1
+ "use strict";(()=>{var e={};e.id=1731,e.ids=[1731],e.modules={8042:e=>{e.exports=require("@agent/computer-use")},1636:e=>{e.exports=require("@agent/core")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},1510:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>x,patchFetch:()=>g,requestAsyncStorage:()=>m,routeModule:()=>c,serverHooks:()=>f,staticGenerationAsyncStorage:()=>h});var s={};t.r(s),t.d(s,{GET:()=>u,POST:()=>d});var i=t(7786),a=t(5042),o=t(2184),n=t(1890),p=t(1636),l=t(4621);async function u(){let e=await (0,l.i)().call("listSkills",[]);return n.NextResponse.json(e.map(e=>({name:e.name,description:e.description,triggers:e.triggers,filePath:e.filePath})))}async function d(e){try{let r=await e.json(),t=new p.SkillLoader,s=(0,l.i)().skills,i=[];if(r.filePath){let e=await t.loadFromFile(r.filePath);await s.save(e),i.push({name:e.name,description:e.description})}else if(!r.dirPath)return n.NextResponse.json({error:"filePath or dirPath is required"},{status:400});else for(let e of(await t.loadFromDirectory(r.dirPath)))await s.save(await t.loadFromFile(e.filePath)),i.push({name:e.name,description:e.description});return n.NextResponse.json({status:"imported",count:i.length,skills:i})}catch(e){return n.NextResponse.json({error:e instanceof Error?e.message:"Skill import failed"},{status:500})}}let c=new i.AppRouteRouteModule({definition:{kind:a.x.APP_ROUTE,page:"/api/skills/route",pathname:"/api/skills",filename:"route",bundlePath:"app/api/skills/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-npm-remote-auth-20261125.yi_kd6wp/source/packages/server/app/api/skills/route.ts",nextConfigOutput:"standalone",userland:s}),{requestAsyncStorage:m,staticGenerationAsyncStorage:h,serverHooks:f}=c,x="/api/skills/route";function g(){return(0,o.patchFetch)({serverHooks:f,staticGenerationAsyncStorage:h})}}};var r=require("../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[8375,6703,4621],()=>t(1510));module.exports=s})();
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=967,e.ids=[967],e.modules={1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},5745:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>m,patchFetch:()=>f,requestAsyncStorage:()=>l,routeModule:()=>u,serverHooks:()=>h,staticGenerationAsyncStorage:()=>p});var o={};r.r(o),r.d(o,{POST:()=>c,dynamic:()=>d});var n=r(7786),s=r(5042),i=r(2184),a=r(1781);let d="force-dynamic",c=(e,{params:t})=>(0,a.EB)(e,t.id),u=new n.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/todos/[id]/commands/route",pathname:"/api/todos/[id]/commands",filename:"route",bundlePath:"app/api/todos/[id]/commands/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-preview80-20261125.e3ZzMB/source/packages/server/app/api/todos/[id]/commands/route.ts",nextConfigOutput:"standalone",userland:o}),{requestAsyncStorage:l,staticGenerationAsyncStorage:p,serverHooks:h}=u,m="/api/todos/[id]/commands/route";function f(){return(0,i.patchFetch)({serverHooks:h,staticGenerationAsyncStorage:p})}},7786:(e,t,r)=>{e.exports=r(517)},785:(e,t,r)=>{r.d(t,{ME:()=>a,kO:()=>i,sr:()=>d});var o=r(9411);let n=function(){let e=process.argv[1];if(e){let t=(0,o.dirname)((0,o.resolve)(e)),r=`${o.sep}node_modules${o.sep}.bin`;return t.endsWith(r)?(0,o.resolve)(t,"..",".."):t}return(0,o.resolve)(process.cwd())}();function s(e=process.env,t=n){return(0,o.resolve)(e.AGENT_DATA_DIR?.trim()||t)}function i(){return s()}function a(e=process.env,t=s(e)){let r=e.AGENT_LOG_DIR?.trim();if(r)return(0,o.resolve)(r);let n=e.AGENTROAM_DATA_DIR?.trim();return n?(0,o.resolve)(n,"logs"):(0,o.join)(t,".agent-data","logs")}function d(){return function(e=process.env,t=n){return(0,o.resolve)(e.AGENT_WORKING_DIRECTORY?.trim()||t)}(process.env,i())}},9001:(e,t,r)=>{r.d(t,{o:()=>n});let o=new Set(["capacitor://localhost","ionic://localhost"]);function n(e){if(!e.headers.get("content-type")?.toLowerCase().startsWith("application/json"))return Response.json({error:"JSON required"},{status:415});let t=e.headers.get("origin");if(!t||o.has(t))return null;let r=new URL(e.url),n="1"===process.env.AGENT_TRUST_TUNNEL_PROXY,s=n?e.headers.get("x-forwarded-host")?.split(",")[0].trim()||e.headers.get("host")||r.host:e.headers.get("host")||r.host,i=n&&e.headers.get("x-forwarded-proto")?.split(",")[0].trim()||r.protocol.slice(0,-1);return t!==`${i}://${s}`?Response.json({error:"Cross-origin write denied"},{status:403}):null}},1781:(e,t,r)=>{r.d(t,{EB:()=>c,Hq:()=>d,a:()=>a});var o=r(1636),n=r(9001),s=r(2110),i=r(4558);function a(e){if(!e.headers.get("x-agentroam-device-id"))throw new o.TodoError("FORBIDDEN","需要设备授权");return(0,s.nQ)().userId}function d(e){let t=e instanceof o.TodoError?({INVALID_ARGUMENT:400,NOT_FOUND:404,FORBIDDEN:403,VERSION_CONFLICT:409,IDEMPOTENCY_CONFLICT:409,BUSY:409,UNAVAILABLE:503})[e.code]:e instanceof SyntaxError?400:500;return Response.json({error:500===t?"待办服务暂不可用":e.message,code:e instanceof o.TodoError?e.code:400===t?"INVALID_ARGUMENT":"INTERNAL_ERROR"},{status:t})}async function c(e,t){let s=(0,n.o)(e);if(s)return s;try{let n=a(e),s=await e.json();if(!s||"object"!=typeof s||!s.command||"object"!=typeof s.command)throw new o.TodoError("INVALID_ARGUMENT","缺少待办操作");let d={...s.command,...t?{taskId:t}:{}};if(!t&&"create"!==d.type)throw new o.TodoError("INVALID_ARGUMENT","此入口只支持创建");if("create"===d.type&&d.executionSchedule?.enabled!==!1&&d.executionSchedule){let{validateExecutionTarget:e}=await Promise.all([r.e(5801),r.e(9457)]).then(r.bind(r,9457));await e(d.executionSchedule.target)}if("schedule"===d.type&&d.enabled){let{validateExecutionTarget:e}=await Promise.all([r.e(5801),r.e(9457)]).then(r.bind(r,9457)),o=d.target??i.Y().todos.get(t,n).schedule?.target;await e(o)}return Response.json((0,i.Y)().todos.execute(d,{ownerId:n,requestId:s.requestId}))}catch(e){return d(e)}}},4558:(e,t,r)=>{r.d(t,{Y:()=>s});var o=r(1636),n=r(785);function s(){let e=globalThis;return e.__todoServices??=function(e){let t=(0,o.getDatabase)(e.baseDir).db,r=new o.SQLiteTodoUnitOfWork(t),n=e.clock??Date.now;return{db:t,uow:r,todos:new o.TodoApplicationService(r,n),scheduler:new o.TodoScheduler(r),executions:new o.TodoExecutionService(r,n),notifications:new o.PersistentNotificationService(r,n)}}({baseDir:(0,n.kO)()})}},2110:(e,t,r)=>{r.d(t,{hw:()=>s.hw,nQ:()=>a});var o=r(1636),n=r(785),s=r(3710);let i=new o.SQLiteAnonymousWebStore((0,n.kO)());function a(){return{userId:i.getOrCreatePrincipal().userId,username:"local",deviceId:"browser"}}},3710:(e,t,r)=>{r.d(t,{$U:()=>l,Ci:()=>h,VP:()=>s,Xd:()=>u,ZA:()=>a,ap:()=>p,hw:()=>d,ki:()=>i,yN:()=>m});var o=r(1636),n=r(785);let s="customer_agent_session",i="customer_agent_device",a=new o.WebAuthService(new o.SQLiteAuthStore((0,n.kO)())),d=new o.SQLiteWebConsoleStore((0,n.kO)());function c(e){let t={};for(let r of(e.headers.get("cookie")||"").split(";")){let e=r.indexOf("=");e>0&&(t[r.slice(0,e).trim()]=decodeURIComponent(r.slice(e+1).trim()))}return t}function u(e){return c(e)[s]||null}function l(e){let t=c(e);return{ip:e.headers.get("x-forwarded-for")?.split(",")[0].trim()||"unknown",userAgent:e.headers.get("user-agent")||"",deviceId:t[i],deviceName:e.headers.get("x-device-name")||""}}function p(e){let t=a.authenticateToken(u(e));return a.validateCsrf(t,e.headers.get("x-csrf-token")),t}function h(e,t,r){return{httpOnly:r,sameSite:"strict",secure:"https"===("1"===process.env.AGENT_TRUST_TUNNEL_PROXY?e.headers.get("x-forwarded-proto"):null)||"https:"===new URL(e.url).protocol,path:"/",maxAge:t}}function m(e){let t=e instanceof o.WebAuthError?e:new o.WebAuthError("UNAUTHENTICATED","认证失败",401);return Response.json({error:{code:t.code,message:t.message}},{status:t.status})}}};var t=require("../../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),o=t.X(0,[8375],()=>r(5745));module.exports=o})();
1
+ "use strict";(()=>{var e={};e.id=967,e.ids=[967],e.modules={1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},4269:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>m,patchFetch:()=>f,requestAsyncStorage:()=>l,routeModule:()=>u,serverHooks:()=>h,staticGenerationAsyncStorage:()=>p});var o={};r.r(o),r.d(o,{POST:()=>c,dynamic:()=>d});var n=r(7786),s=r(5042),i=r(2184),a=r(1781);let d="force-dynamic",c=(e,{params:t})=>(0,a.EB)(e,t.id),u=new n.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/todos/[id]/commands/route",pathname:"/api/todos/[id]/commands",filename:"route",bundlePath:"app/api/todos/[id]/commands/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-npm-remote-auth-20261125.yi_kd6wp/source/packages/server/app/api/todos/[id]/commands/route.ts",nextConfigOutput:"standalone",userland:o}),{requestAsyncStorage:l,staticGenerationAsyncStorage:p,serverHooks:h}=u,m="/api/todos/[id]/commands/route";function f(){return(0,i.patchFetch)({serverHooks:h,staticGenerationAsyncStorage:p})}},7786:(e,t,r)=>{e.exports=r(517)},785:(e,t,r)=>{r.d(t,{ME:()=>a,kO:()=>i,sr:()=>d});var o=r(9411);let n=function(){let e=process.argv[1];if(e){let t=(0,o.dirname)((0,o.resolve)(e)),r=`${o.sep}node_modules${o.sep}.bin`;return t.endsWith(r)?(0,o.resolve)(t,"..",".."):t}return(0,o.resolve)(process.cwd())}();function s(e=process.env,t=n){return(0,o.resolve)(e.AGENT_DATA_DIR?.trim()||t)}function i(){return s()}function a(e=process.env,t=s(e)){let r=e.AGENT_LOG_DIR?.trim();if(r)return(0,o.resolve)(r);let n=e.AGENTROAM_DATA_DIR?.trim();return n?(0,o.resolve)(n,"logs"):(0,o.join)(t,".agent-data","logs")}function d(){return function(e=process.env,t=n){return(0,o.resolve)(e.AGENT_WORKING_DIRECTORY?.trim()||t)}(process.env,i())}},9001:(e,t,r)=>{r.d(t,{o:()=>n});let o=new Set(["capacitor://localhost","ionic://localhost"]);function n(e){if(!e.headers.get("content-type")?.toLowerCase().startsWith("application/json"))return Response.json({error:"JSON required"},{status:415});let t=e.headers.get("origin");if(!t||o.has(t))return null;let r=new URL(e.url),n="1"===process.env.AGENT_TRUST_TUNNEL_PROXY,s=n?e.headers.get("x-forwarded-host")?.split(",")[0].trim()||e.headers.get("host")||r.host:e.headers.get("host")||r.host,i=n&&e.headers.get("x-forwarded-proto")?.split(",")[0].trim()||r.protocol.slice(0,-1);return t!==`${i}://${s}`?Response.json({error:"Cross-origin write denied"},{status:403}):null}},1781:(e,t,r)=>{r.d(t,{EB:()=>c,Hq:()=>d,a:()=>a});var o=r(1636),n=r(9001),s=r(2110),i=r(3151);function a(e){if(!e.headers.get("x-agentroam-device-id"))throw new o.TodoError("FORBIDDEN","需要设备授权");return(0,s.nQ)().userId}function d(e){let t=e instanceof o.TodoError?({INVALID_ARGUMENT:400,NOT_FOUND:404,FORBIDDEN:403,VERSION_CONFLICT:409,IDEMPOTENCY_CONFLICT:409,BUSY:409,UNAVAILABLE:503})[e.code]:e instanceof SyntaxError?400:500;return Response.json({error:500===t?"待办服务暂不可用":e.message,code:e instanceof o.TodoError?e.code:400===t?"INVALID_ARGUMENT":"INTERNAL_ERROR"},{status:t})}async function c(e,t){let s=(0,n.o)(e);if(s)return s;try{let n=a(e),s=await e.json();if(!s||"object"!=typeof s||!s.command||"object"!=typeof s.command)throw new o.TodoError("INVALID_ARGUMENT","缺少待办操作");let d={...s.command,...t?{taskId:t}:{}};if(!t&&"create"!==d.type)throw new o.TodoError("INVALID_ARGUMENT","此入口只支持创建");if("create"===d.type&&d.executionSchedule?.enabled!==!1&&d.executionSchedule){let{validateExecutionTarget:e}=await Promise.all([r.e(5801),r.e(9457)]).then(r.bind(r,9457));await e(d.executionSchedule.target)}if("schedule"===d.type&&d.enabled){let{validateExecutionTarget:e}=await Promise.all([r.e(5801),r.e(9457)]).then(r.bind(r,9457)),o=d.target??i.Y().todos.get(t,n).schedule?.target;await e(o)}return Response.json((0,i.Y)().todos.execute(d,{ownerId:n,requestId:s.requestId}))}catch(e){return d(e)}}},3151:(e,t,r)=>{r.d(t,{Y:()=>s});var o=r(1636),n=r(785);function s(){let e=globalThis;return e.__todoServices??=function(e){let t=(0,o.getDatabase)(e.baseDir).db,r=new o.SQLiteTodoUnitOfWork(t),n=e.clock??Date.now;return{db:t,uow:r,todos:new o.TodoApplicationService(r,n),scheduler:new o.TodoScheduler(r),executions:new o.TodoExecutionService(r,n),notifications:new o.PersistentNotificationService(r,n)}}({baseDir:(0,n.kO)()})}},2110:(e,t,r)=>{r.d(t,{hw:()=>s.hw,nQ:()=>a});var o=r(1636),n=r(785),s=r(3710);let i=new o.SQLiteAnonymousWebStore((0,n.kO)());function a(){return{userId:i.getOrCreatePrincipal().userId,username:"local",deviceId:"browser"}}},3710:(e,t,r)=>{r.d(t,{$U:()=>l,Ci:()=>h,VP:()=>s,Xd:()=>u,ZA:()=>a,ap:()=>p,hw:()=>d,ki:()=>i,yN:()=>m});var o=r(1636),n=r(785);let s="customer_agent_session",i="customer_agent_device",a=new o.WebAuthService(new o.SQLiteAuthStore((0,n.kO)())),d=new o.SQLiteWebConsoleStore((0,n.kO)());function c(e){let t={};for(let r of(e.headers.get("cookie")||"").split(";")){let e=r.indexOf("=");e>0&&(t[r.slice(0,e).trim()]=decodeURIComponent(r.slice(e+1).trim()))}return t}function u(e){return c(e)[s]||null}function l(e){let t=c(e);return{ip:e.headers.get("x-forwarded-for")?.split(",")[0].trim()||"unknown",userAgent:e.headers.get("user-agent")||"",deviceId:t[i],deviceName:e.headers.get("x-device-name")||""}}function p(e){let t=a.authenticateToken(u(e));return a.validateCsrf(t,e.headers.get("x-csrf-token")),t}function h(e,t,r){return{httpOnly:r,sameSite:"strict",secure:"https"===("1"===process.env.AGENT_TRUST_TUNNEL_PROXY?e.headers.get("x-forwarded-proto"):null)||"https:"===new URL(e.url).protocol,path:"/",maxAge:t}}function m(e){let t=e instanceof o.WebAuthError?e:new o.WebAuthError("UNAUTHENTICATED","认证失败",401);return Response.json({error:{code:t.code,message:t.message}},{status:t.status})}}};var t=require("../../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),o=t.X(0,[8375],()=>r(4269));module.exports=o})();
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=9872,e.ids=[9872],e.modules={1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},6307:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>m,patchFetch:()=>g,requestAsyncStorage:()=>p,routeModule:()=>l,serverHooks:()=>f,staticGenerationAsyncStorage:()=>h});var o={};r.r(o),r.d(o,{GET:()=>d,dynamic:()=>c});var n=r(7786),s=r(5042),i=r(2184),a=r(4558),u=r(1781);let c="force-dynamic";async function d(e,{params:t}){try{return Response.json((0,a.Y)().todos.executions(t.id,(0,u.a)(e),new URL(e.url).searchParams.get("cursor")??void 0))}catch(e){return(0,u.Hq)(e)}}let l=new n.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/todos/[id]/executions/route",pathname:"/api/todos/[id]/executions",filename:"route",bundlePath:"app/api/todos/[id]/executions/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-preview80-20261125.e3ZzMB/source/packages/server/app/api/todos/[id]/executions/route.ts",nextConfigOutput:"standalone",userland:o}),{requestAsyncStorage:p,staticGenerationAsyncStorage:h,serverHooks:f}=l,m="/api/todos/[id]/executions/route";function g(){return(0,i.patchFetch)({serverHooks:f,staticGenerationAsyncStorage:h})}},7786:(e,t,r)=>{e.exports=r(517)},785:(e,t,r)=>{r.d(t,{ME:()=>a,kO:()=>i,sr:()=>u});var o=r(9411);let n=function(){let e=process.argv[1];if(e){let t=(0,o.dirname)((0,o.resolve)(e)),r=`${o.sep}node_modules${o.sep}.bin`;return t.endsWith(r)?(0,o.resolve)(t,"..",".."):t}return(0,o.resolve)(process.cwd())}();function s(e=process.env,t=n){return(0,o.resolve)(e.AGENT_DATA_DIR?.trim()||t)}function i(){return s()}function a(e=process.env,t=s(e)){let r=e.AGENT_LOG_DIR?.trim();if(r)return(0,o.resolve)(r);let n=e.AGENTROAM_DATA_DIR?.trim();return n?(0,o.resolve)(n,"logs"):(0,o.join)(t,".agent-data","logs")}function u(){return function(e=process.env,t=n){return(0,o.resolve)(e.AGENT_WORKING_DIRECTORY?.trim()||t)}(process.env,i())}},9001:(e,t,r)=>{r.d(t,{o:()=>n});let o=new Set(["capacitor://localhost","ionic://localhost"]);function n(e){if(!e.headers.get("content-type")?.toLowerCase().startsWith("application/json"))return Response.json({error:"JSON required"},{status:415});let t=e.headers.get("origin");if(!t||o.has(t))return null;let r=new URL(e.url),n="1"===process.env.AGENT_TRUST_TUNNEL_PROXY,s=n?e.headers.get("x-forwarded-host")?.split(",")[0].trim()||e.headers.get("host")||r.host:e.headers.get("host")||r.host,i=n&&e.headers.get("x-forwarded-proto")?.split(",")[0].trim()||r.protocol.slice(0,-1);return t!==`${i}://${s}`?Response.json({error:"Cross-origin write denied"},{status:403}):null}},1781:(e,t,r)=>{r.d(t,{EB:()=>c,Hq:()=>u,a:()=>a});var o=r(1636),n=r(9001),s=r(2110),i=r(4558);function a(e){if(!e.headers.get("x-agentroam-device-id"))throw new o.TodoError("FORBIDDEN","需要设备授权");return(0,s.nQ)().userId}function u(e){let t=e instanceof o.TodoError?({INVALID_ARGUMENT:400,NOT_FOUND:404,FORBIDDEN:403,VERSION_CONFLICT:409,IDEMPOTENCY_CONFLICT:409,BUSY:409,UNAVAILABLE:503})[e.code]:e instanceof SyntaxError?400:500;return Response.json({error:500===t?"待办服务暂不可用":e.message,code:e instanceof o.TodoError?e.code:400===t?"INVALID_ARGUMENT":"INTERNAL_ERROR"},{status:t})}async function c(e,t){let s=(0,n.o)(e);if(s)return s;try{let n=a(e),s=await e.json();if(!s||"object"!=typeof s||!s.command||"object"!=typeof s.command)throw new o.TodoError("INVALID_ARGUMENT","缺少待办操作");let u={...s.command,...t?{taskId:t}:{}};if(!t&&"create"!==u.type)throw new o.TodoError("INVALID_ARGUMENT","此入口只支持创建");if("create"===u.type&&u.executionSchedule?.enabled!==!1&&u.executionSchedule){let{validateExecutionTarget:e}=await Promise.all([r.e(5801),r.e(9457)]).then(r.bind(r,9457));await e(u.executionSchedule.target)}if("schedule"===u.type&&u.enabled){let{validateExecutionTarget:e}=await Promise.all([r.e(5801),r.e(9457)]).then(r.bind(r,9457)),o=u.target??i.Y().todos.get(t,n).schedule?.target;await e(o)}return Response.json((0,i.Y)().todos.execute(u,{ownerId:n,requestId:s.requestId}))}catch(e){return u(e)}}},4558:(e,t,r)=>{r.d(t,{Y:()=>s});var o=r(1636),n=r(785);function s(){let e=globalThis;return e.__todoServices??=function(e){let t=(0,o.getDatabase)(e.baseDir).db,r=new o.SQLiteTodoUnitOfWork(t),n=e.clock??Date.now;return{db:t,uow:r,todos:new o.TodoApplicationService(r,n),scheduler:new o.TodoScheduler(r),executions:new o.TodoExecutionService(r,n),notifications:new o.PersistentNotificationService(r,n)}}({baseDir:(0,n.kO)()})}},2110:(e,t,r)=>{r.d(t,{hw:()=>s.hw,nQ:()=>a});var o=r(1636),n=r(785),s=r(3710);let i=new o.SQLiteAnonymousWebStore((0,n.kO)());function a(){return{userId:i.getOrCreatePrincipal().userId,username:"local",deviceId:"browser"}}},3710:(e,t,r)=>{r.d(t,{$U:()=>l,Ci:()=>h,VP:()=>s,Xd:()=>d,ZA:()=>a,ap:()=>p,hw:()=>u,ki:()=>i,yN:()=>f});var o=r(1636),n=r(785);let s="customer_agent_session",i="customer_agent_device",a=new o.WebAuthService(new o.SQLiteAuthStore((0,n.kO)())),u=new o.SQLiteWebConsoleStore((0,n.kO)());function c(e){let t={};for(let r of(e.headers.get("cookie")||"").split(";")){let e=r.indexOf("=");e>0&&(t[r.slice(0,e).trim()]=decodeURIComponent(r.slice(e+1).trim()))}return t}function d(e){return c(e)[s]||null}function l(e){let t=c(e);return{ip:e.headers.get("x-forwarded-for")?.split(",")[0].trim()||"unknown",userAgent:e.headers.get("user-agent")||"",deviceId:t[i],deviceName:e.headers.get("x-device-name")||""}}function p(e){let t=a.authenticateToken(d(e));return a.validateCsrf(t,e.headers.get("x-csrf-token")),t}function h(e,t,r){return{httpOnly:r,sameSite:"strict",secure:"https"===("1"===process.env.AGENT_TRUST_TUNNEL_PROXY?e.headers.get("x-forwarded-proto"):null)||"https:"===new URL(e.url).protocol,path:"/",maxAge:t}}function f(e){let t=e instanceof o.WebAuthError?e:new o.WebAuthError("UNAUTHENTICATED","认证失败",401);return Response.json({error:{code:t.code,message:t.message}},{status:t.status})}}};var t=require("../../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),o=t.X(0,[8375],()=>r(6307));module.exports=o})();
1
+ "use strict";(()=>{var e={};e.id=9872,e.ids=[9872],e.modules={1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},1352:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>m,patchFetch:()=>g,requestAsyncStorage:()=>p,routeModule:()=>l,serverHooks:()=>f,staticGenerationAsyncStorage:()=>h});var o={};r.r(o),r.d(o,{GET:()=>d,dynamic:()=>c});var n=r(7786),s=r(5042),i=r(2184),a=r(3151),u=r(1781);let c="force-dynamic";async function d(e,{params:t}){try{return Response.json((0,a.Y)().todos.executions(t.id,(0,u.a)(e),new URL(e.url).searchParams.get("cursor")??void 0))}catch(e){return(0,u.Hq)(e)}}let l=new n.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/todos/[id]/executions/route",pathname:"/api/todos/[id]/executions",filename:"route",bundlePath:"app/api/todos/[id]/executions/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-npm-remote-auth-20261125.yi_kd6wp/source/packages/server/app/api/todos/[id]/executions/route.ts",nextConfigOutput:"standalone",userland:o}),{requestAsyncStorage:p,staticGenerationAsyncStorage:h,serverHooks:f}=l,m="/api/todos/[id]/executions/route";function g(){return(0,i.patchFetch)({serverHooks:f,staticGenerationAsyncStorage:h})}},7786:(e,t,r)=>{e.exports=r(517)},785:(e,t,r)=>{r.d(t,{ME:()=>a,kO:()=>i,sr:()=>u});var o=r(9411);let n=function(){let e=process.argv[1];if(e){let t=(0,o.dirname)((0,o.resolve)(e)),r=`${o.sep}node_modules${o.sep}.bin`;return t.endsWith(r)?(0,o.resolve)(t,"..",".."):t}return(0,o.resolve)(process.cwd())}();function s(e=process.env,t=n){return(0,o.resolve)(e.AGENT_DATA_DIR?.trim()||t)}function i(){return s()}function a(e=process.env,t=s(e)){let r=e.AGENT_LOG_DIR?.trim();if(r)return(0,o.resolve)(r);let n=e.AGENTROAM_DATA_DIR?.trim();return n?(0,o.resolve)(n,"logs"):(0,o.join)(t,".agent-data","logs")}function u(){return function(e=process.env,t=n){return(0,o.resolve)(e.AGENT_WORKING_DIRECTORY?.trim()||t)}(process.env,i())}},9001:(e,t,r)=>{r.d(t,{o:()=>n});let o=new Set(["capacitor://localhost","ionic://localhost"]);function n(e){if(!e.headers.get("content-type")?.toLowerCase().startsWith("application/json"))return Response.json({error:"JSON required"},{status:415});let t=e.headers.get("origin");if(!t||o.has(t))return null;let r=new URL(e.url),n="1"===process.env.AGENT_TRUST_TUNNEL_PROXY,s=n?e.headers.get("x-forwarded-host")?.split(",")[0].trim()||e.headers.get("host")||r.host:e.headers.get("host")||r.host,i=n&&e.headers.get("x-forwarded-proto")?.split(",")[0].trim()||r.protocol.slice(0,-1);return t!==`${i}://${s}`?Response.json({error:"Cross-origin write denied"},{status:403}):null}},1781:(e,t,r)=>{r.d(t,{EB:()=>c,Hq:()=>u,a:()=>a});var o=r(1636),n=r(9001),s=r(2110),i=r(3151);function a(e){if(!e.headers.get("x-agentroam-device-id"))throw new o.TodoError("FORBIDDEN","需要设备授权");return(0,s.nQ)().userId}function u(e){let t=e instanceof o.TodoError?({INVALID_ARGUMENT:400,NOT_FOUND:404,FORBIDDEN:403,VERSION_CONFLICT:409,IDEMPOTENCY_CONFLICT:409,BUSY:409,UNAVAILABLE:503})[e.code]:e instanceof SyntaxError?400:500;return Response.json({error:500===t?"待办服务暂不可用":e.message,code:e instanceof o.TodoError?e.code:400===t?"INVALID_ARGUMENT":"INTERNAL_ERROR"},{status:t})}async function c(e,t){let s=(0,n.o)(e);if(s)return s;try{let n=a(e),s=await e.json();if(!s||"object"!=typeof s||!s.command||"object"!=typeof s.command)throw new o.TodoError("INVALID_ARGUMENT","缺少待办操作");let u={...s.command,...t?{taskId:t}:{}};if(!t&&"create"!==u.type)throw new o.TodoError("INVALID_ARGUMENT","此入口只支持创建");if("create"===u.type&&u.executionSchedule?.enabled!==!1&&u.executionSchedule){let{validateExecutionTarget:e}=await Promise.all([r.e(5801),r.e(9457)]).then(r.bind(r,9457));await e(u.executionSchedule.target)}if("schedule"===u.type&&u.enabled){let{validateExecutionTarget:e}=await Promise.all([r.e(5801),r.e(9457)]).then(r.bind(r,9457)),o=u.target??i.Y().todos.get(t,n).schedule?.target;await e(o)}return Response.json((0,i.Y)().todos.execute(u,{ownerId:n,requestId:s.requestId}))}catch(e){return u(e)}}},3151:(e,t,r)=>{r.d(t,{Y:()=>s});var o=r(1636),n=r(785);function s(){let e=globalThis;return e.__todoServices??=function(e){let t=(0,o.getDatabase)(e.baseDir).db,r=new o.SQLiteTodoUnitOfWork(t),n=e.clock??Date.now;return{db:t,uow:r,todos:new o.TodoApplicationService(r,n),scheduler:new o.TodoScheduler(r),executions:new o.TodoExecutionService(r,n),notifications:new o.PersistentNotificationService(r,n)}}({baseDir:(0,n.kO)()})}},2110:(e,t,r)=>{r.d(t,{hw:()=>s.hw,nQ:()=>a});var o=r(1636),n=r(785),s=r(3710);let i=new o.SQLiteAnonymousWebStore((0,n.kO)());function a(){return{userId:i.getOrCreatePrincipal().userId,username:"local",deviceId:"browser"}}},3710:(e,t,r)=>{r.d(t,{$U:()=>l,Ci:()=>h,VP:()=>s,Xd:()=>d,ZA:()=>a,ap:()=>p,hw:()=>u,ki:()=>i,yN:()=>f});var o=r(1636),n=r(785);let s="customer_agent_session",i="customer_agent_device",a=new o.WebAuthService(new o.SQLiteAuthStore((0,n.kO)())),u=new o.SQLiteWebConsoleStore((0,n.kO)());function c(e){let t={};for(let r of(e.headers.get("cookie")||"").split(";")){let e=r.indexOf("=");e>0&&(t[r.slice(0,e).trim()]=decodeURIComponent(r.slice(e+1).trim()))}return t}function d(e){return c(e)[s]||null}function l(e){let t=c(e);return{ip:e.headers.get("x-forwarded-for")?.split(",")[0].trim()||"unknown",userAgent:e.headers.get("user-agent")||"",deviceId:t[i],deviceName:e.headers.get("x-device-name")||""}}function p(e){let t=a.authenticateToken(d(e));return a.validateCsrf(t,e.headers.get("x-csrf-token")),t}function h(e,t,r){return{httpOnly:r,sameSite:"strict",secure:"https"===("1"===process.env.AGENT_TRUST_TUNNEL_PROXY?e.headers.get("x-forwarded-proto"):null)||"https:"===new URL(e.url).protocol,path:"/",maxAge:t}}function f(e){let t=e instanceof o.WebAuthError?e:new o.WebAuthError("UNAUTHENTICATED","认证失败",401);return Response.json({error:{code:t.code,message:t.message}},{status:t.status})}}};var t=require("../../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),o=t.X(0,[8375],()=>r(1352));module.exports=o})();
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=9110,e.ids=[9110],e.modules={1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},4697:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>g,patchFetch:()=>m,requestAsyncStorage:()=>p,routeModule:()=>l,serverHooks:()=>f,staticGenerationAsyncStorage:()=>h});var o={};r.r(o),r.d(o,{GET:()=>c,dynamic:()=>u});var n=r(7786),s=r(5042),i=r(2184),a=r(4558),d=r(1781);let u="force-dynamic";async function c(e,{params:t}){try{return Response.json((0,a.Y)().todos.get(t.id,(0,d.a)(e)))}catch(e){return(0,d.Hq)(e)}}let l=new n.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/todos/[id]/route",pathname:"/api/todos/[id]",filename:"route",bundlePath:"app/api/todos/[id]/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-preview80-20261125.e3ZzMB/source/packages/server/app/api/todos/[id]/route.ts",nextConfigOutput:"standalone",userland:o}),{requestAsyncStorage:p,staticGenerationAsyncStorage:h,serverHooks:f}=l,g="/api/todos/[id]/route";function m(){return(0,i.patchFetch)({serverHooks:f,staticGenerationAsyncStorage:h})}},7786:(e,t,r)=>{e.exports=r(517)},785:(e,t,r)=>{r.d(t,{ME:()=>a,kO:()=>i,sr:()=>d});var o=r(9411);let n=function(){let e=process.argv[1];if(e){let t=(0,o.dirname)((0,o.resolve)(e)),r=`${o.sep}node_modules${o.sep}.bin`;return t.endsWith(r)?(0,o.resolve)(t,"..",".."):t}return(0,o.resolve)(process.cwd())}();function s(e=process.env,t=n){return(0,o.resolve)(e.AGENT_DATA_DIR?.trim()||t)}function i(){return s()}function a(e=process.env,t=s(e)){let r=e.AGENT_LOG_DIR?.trim();if(r)return(0,o.resolve)(r);let n=e.AGENTROAM_DATA_DIR?.trim();return n?(0,o.resolve)(n,"logs"):(0,o.join)(t,".agent-data","logs")}function d(){return function(e=process.env,t=n){return(0,o.resolve)(e.AGENT_WORKING_DIRECTORY?.trim()||t)}(process.env,i())}},9001:(e,t,r)=>{r.d(t,{o:()=>n});let o=new Set(["capacitor://localhost","ionic://localhost"]);function n(e){if(!e.headers.get("content-type")?.toLowerCase().startsWith("application/json"))return Response.json({error:"JSON required"},{status:415});let t=e.headers.get("origin");if(!t||o.has(t))return null;let r=new URL(e.url),n="1"===process.env.AGENT_TRUST_TUNNEL_PROXY,s=n?e.headers.get("x-forwarded-host")?.split(",")[0].trim()||e.headers.get("host")||r.host:e.headers.get("host")||r.host,i=n&&e.headers.get("x-forwarded-proto")?.split(",")[0].trim()||r.protocol.slice(0,-1);return t!==`${i}://${s}`?Response.json({error:"Cross-origin write denied"},{status:403}):null}},1781:(e,t,r)=>{r.d(t,{EB:()=>u,Hq:()=>d,a:()=>a});var o=r(1636),n=r(9001),s=r(2110),i=r(4558);function a(e){if(!e.headers.get("x-agentroam-device-id"))throw new o.TodoError("FORBIDDEN","需要设备授权");return(0,s.nQ)().userId}function d(e){let t=e instanceof o.TodoError?({INVALID_ARGUMENT:400,NOT_FOUND:404,FORBIDDEN:403,VERSION_CONFLICT:409,IDEMPOTENCY_CONFLICT:409,BUSY:409,UNAVAILABLE:503})[e.code]:e instanceof SyntaxError?400:500;return Response.json({error:500===t?"待办服务暂不可用":e.message,code:e instanceof o.TodoError?e.code:400===t?"INVALID_ARGUMENT":"INTERNAL_ERROR"},{status:t})}async function u(e,t){let s=(0,n.o)(e);if(s)return s;try{let n=a(e),s=await e.json();if(!s||"object"!=typeof s||!s.command||"object"!=typeof s.command)throw new o.TodoError("INVALID_ARGUMENT","缺少待办操作");let d={...s.command,...t?{taskId:t}:{}};if(!t&&"create"!==d.type)throw new o.TodoError("INVALID_ARGUMENT","此入口只支持创建");if("create"===d.type&&d.executionSchedule?.enabled!==!1&&d.executionSchedule){let{validateExecutionTarget:e}=await Promise.all([r.e(5801),r.e(9457)]).then(r.bind(r,9457));await e(d.executionSchedule.target)}if("schedule"===d.type&&d.enabled){let{validateExecutionTarget:e}=await Promise.all([r.e(5801),r.e(9457)]).then(r.bind(r,9457)),o=d.target??i.Y().todos.get(t,n).schedule?.target;await e(o)}return Response.json((0,i.Y)().todos.execute(d,{ownerId:n,requestId:s.requestId}))}catch(e){return d(e)}}},4558:(e,t,r)=>{r.d(t,{Y:()=>s});var o=r(1636),n=r(785);function s(){let e=globalThis;return e.__todoServices??=function(e){let t=(0,o.getDatabase)(e.baseDir).db,r=new o.SQLiteTodoUnitOfWork(t),n=e.clock??Date.now;return{db:t,uow:r,todos:new o.TodoApplicationService(r,n),scheduler:new o.TodoScheduler(r),executions:new o.TodoExecutionService(r,n),notifications:new o.PersistentNotificationService(r,n)}}({baseDir:(0,n.kO)()})}},2110:(e,t,r)=>{r.d(t,{hw:()=>s.hw,nQ:()=>a});var o=r(1636),n=r(785),s=r(3710);let i=new o.SQLiteAnonymousWebStore((0,n.kO)());function a(){return{userId:i.getOrCreatePrincipal().userId,username:"local",deviceId:"browser"}}},3710:(e,t,r)=>{r.d(t,{$U:()=>l,Ci:()=>h,VP:()=>s,Xd:()=>c,ZA:()=>a,ap:()=>p,hw:()=>d,ki:()=>i,yN:()=>f});var o=r(1636),n=r(785);let s="customer_agent_session",i="customer_agent_device",a=new o.WebAuthService(new o.SQLiteAuthStore((0,n.kO)())),d=new o.SQLiteWebConsoleStore((0,n.kO)());function u(e){let t={};for(let r of(e.headers.get("cookie")||"").split(";")){let e=r.indexOf("=");e>0&&(t[r.slice(0,e).trim()]=decodeURIComponent(r.slice(e+1).trim()))}return t}function c(e){return u(e)[s]||null}function l(e){let t=u(e);return{ip:e.headers.get("x-forwarded-for")?.split(",")[0].trim()||"unknown",userAgent:e.headers.get("user-agent")||"",deviceId:t[i],deviceName:e.headers.get("x-device-name")||""}}function p(e){let t=a.authenticateToken(c(e));return a.validateCsrf(t,e.headers.get("x-csrf-token")),t}function h(e,t,r){return{httpOnly:r,sameSite:"strict",secure:"https"===("1"===process.env.AGENT_TRUST_TUNNEL_PROXY?e.headers.get("x-forwarded-proto"):null)||"https:"===new URL(e.url).protocol,path:"/",maxAge:t}}function f(e){let t=e instanceof o.WebAuthError?e:new o.WebAuthError("UNAUTHENTICATED","认证失败",401);return Response.json({error:{code:t.code,message:t.message}},{status:t.status})}}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),o=t.X(0,[8375],()=>r(4697));module.exports=o})();
1
+ "use strict";(()=>{var e={};e.id=9110,e.ids=[9110],e.modules={1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},179:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>m,patchFetch:()=>g,requestAsyncStorage:()=>p,routeModule:()=>l,serverHooks:()=>f,staticGenerationAsyncStorage:()=>h});var o={};r.r(o),r.d(o,{GET:()=>c,dynamic:()=>u});var n=r(7786),s=r(5042),i=r(2184),a=r(3151),d=r(1781);let u="force-dynamic";async function c(e,{params:t}){try{return Response.json((0,a.Y)().todos.get(t.id,(0,d.a)(e)))}catch(e){return(0,d.Hq)(e)}}let l=new n.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/todos/[id]/route",pathname:"/api/todos/[id]",filename:"route",bundlePath:"app/api/todos/[id]/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-npm-remote-auth-20261125.yi_kd6wp/source/packages/server/app/api/todos/[id]/route.ts",nextConfigOutput:"standalone",userland:o}),{requestAsyncStorage:p,staticGenerationAsyncStorage:h,serverHooks:f}=l,m="/api/todos/[id]/route";function g(){return(0,i.patchFetch)({serverHooks:f,staticGenerationAsyncStorage:h})}},7786:(e,t,r)=>{e.exports=r(517)},785:(e,t,r)=>{r.d(t,{ME:()=>a,kO:()=>i,sr:()=>d});var o=r(9411);let n=function(){let e=process.argv[1];if(e){let t=(0,o.dirname)((0,o.resolve)(e)),r=`${o.sep}node_modules${o.sep}.bin`;return t.endsWith(r)?(0,o.resolve)(t,"..",".."):t}return(0,o.resolve)(process.cwd())}();function s(e=process.env,t=n){return(0,o.resolve)(e.AGENT_DATA_DIR?.trim()||t)}function i(){return s()}function a(e=process.env,t=s(e)){let r=e.AGENT_LOG_DIR?.trim();if(r)return(0,o.resolve)(r);let n=e.AGENTROAM_DATA_DIR?.trim();return n?(0,o.resolve)(n,"logs"):(0,o.join)(t,".agent-data","logs")}function d(){return function(e=process.env,t=n){return(0,o.resolve)(e.AGENT_WORKING_DIRECTORY?.trim()||t)}(process.env,i())}},9001:(e,t,r)=>{r.d(t,{o:()=>n});let o=new Set(["capacitor://localhost","ionic://localhost"]);function n(e){if(!e.headers.get("content-type")?.toLowerCase().startsWith("application/json"))return Response.json({error:"JSON required"},{status:415});let t=e.headers.get("origin");if(!t||o.has(t))return null;let r=new URL(e.url),n="1"===process.env.AGENT_TRUST_TUNNEL_PROXY,s=n?e.headers.get("x-forwarded-host")?.split(",")[0].trim()||e.headers.get("host")||r.host:e.headers.get("host")||r.host,i=n&&e.headers.get("x-forwarded-proto")?.split(",")[0].trim()||r.protocol.slice(0,-1);return t!==`${i}://${s}`?Response.json({error:"Cross-origin write denied"},{status:403}):null}},1781:(e,t,r)=>{r.d(t,{EB:()=>u,Hq:()=>d,a:()=>a});var o=r(1636),n=r(9001),s=r(2110),i=r(3151);function a(e){if(!e.headers.get("x-agentroam-device-id"))throw new o.TodoError("FORBIDDEN","需要设备授权");return(0,s.nQ)().userId}function d(e){let t=e instanceof o.TodoError?({INVALID_ARGUMENT:400,NOT_FOUND:404,FORBIDDEN:403,VERSION_CONFLICT:409,IDEMPOTENCY_CONFLICT:409,BUSY:409,UNAVAILABLE:503})[e.code]:e instanceof SyntaxError?400:500;return Response.json({error:500===t?"待办服务暂不可用":e.message,code:e instanceof o.TodoError?e.code:400===t?"INVALID_ARGUMENT":"INTERNAL_ERROR"},{status:t})}async function u(e,t){let s=(0,n.o)(e);if(s)return s;try{let n=a(e),s=await e.json();if(!s||"object"!=typeof s||!s.command||"object"!=typeof s.command)throw new o.TodoError("INVALID_ARGUMENT","缺少待办操作");let d={...s.command,...t?{taskId:t}:{}};if(!t&&"create"!==d.type)throw new o.TodoError("INVALID_ARGUMENT","此入口只支持创建");if("create"===d.type&&d.executionSchedule?.enabled!==!1&&d.executionSchedule){let{validateExecutionTarget:e}=await Promise.all([r.e(5801),r.e(9457)]).then(r.bind(r,9457));await e(d.executionSchedule.target)}if("schedule"===d.type&&d.enabled){let{validateExecutionTarget:e}=await Promise.all([r.e(5801),r.e(9457)]).then(r.bind(r,9457)),o=d.target??i.Y().todos.get(t,n).schedule?.target;await e(o)}return Response.json((0,i.Y)().todos.execute(d,{ownerId:n,requestId:s.requestId}))}catch(e){return d(e)}}},3151:(e,t,r)=>{r.d(t,{Y:()=>s});var o=r(1636),n=r(785);function s(){let e=globalThis;return e.__todoServices??=function(e){let t=(0,o.getDatabase)(e.baseDir).db,r=new o.SQLiteTodoUnitOfWork(t),n=e.clock??Date.now;return{db:t,uow:r,todos:new o.TodoApplicationService(r,n),scheduler:new o.TodoScheduler(r),executions:new o.TodoExecutionService(r,n),notifications:new o.PersistentNotificationService(r,n)}}({baseDir:(0,n.kO)()})}},2110:(e,t,r)=>{r.d(t,{hw:()=>s.hw,nQ:()=>a});var o=r(1636),n=r(785),s=r(3710);let i=new o.SQLiteAnonymousWebStore((0,n.kO)());function a(){return{userId:i.getOrCreatePrincipal().userId,username:"local",deviceId:"browser"}}},3710:(e,t,r)=>{r.d(t,{$U:()=>l,Ci:()=>h,VP:()=>s,Xd:()=>c,ZA:()=>a,ap:()=>p,hw:()=>d,ki:()=>i,yN:()=>f});var o=r(1636),n=r(785);let s="customer_agent_session",i="customer_agent_device",a=new o.WebAuthService(new o.SQLiteAuthStore((0,n.kO)())),d=new o.SQLiteWebConsoleStore((0,n.kO)());function u(e){let t={};for(let r of(e.headers.get("cookie")||"").split(";")){let e=r.indexOf("=");e>0&&(t[r.slice(0,e).trim()]=decodeURIComponent(r.slice(e+1).trim()))}return t}function c(e){return u(e)[s]||null}function l(e){let t=u(e);return{ip:e.headers.get("x-forwarded-for")?.split(",")[0].trim()||"unknown",userAgent:e.headers.get("user-agent")||"",deviceId:t[i],deviceName:e.headers.get("x-device-name")||""}}function p(e){let t=a.authenticateToken(c(e));return a.validateCsrf(t,e.headers.get("x-csrf-token")),t}function h(e,t,r){return{httpOnly:r,sameSite:"strict",secure:"https"===("1"===process.env.AGENT_TRUST_TUNNEL_PROXY?e.headers.get("x-forwarded-proto"):null)||"https:"===new URL(e.url).protocol,path:"/",maxAge:t}}function f(e){let t=e instanceof o.WebAuthError?e:new o.WebAuthError("UNAUTHENTICATED","认证失败",401);return Response.json({error:{code:t.code,message:t.message}},{status:t.status})}}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),o=t.X(0,[8375],()=>r(179));module.exports=o})();
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=9603,e.ids=[9603],e.modules={1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},5450:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>g,patchFetch:()=>v,requestAsyncStorage:()=>h,routeModule:()=>p,serverHooks:()=>m,staticGenerationAsyncStorage:()=>f});var o={};r.r(o),r.d(o,{GET:()=>d,POST:()=>l,dynamic:()=>c});var n=r(7786),s=r(5042),i=r(2184),a=r(4558),u=r(1781);let c="force-dynamic";async function d(e){try{let t=Object.fromEntries(new URL(e.url).searchParams);return Response.json((0,a.Y)().todos.list(t,(0,u.a)(e)))}catch(e){return(0,u.Hq)(e)}}let l=e=>(0,u.EB)(e),p=new n.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/todos/route",pathname:"/api/todos",filename:"route",bundlePath:"app/api/todos/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-preview80-20261125.e3ZzMB/source/packages/server/app/api/todos/route.ts",nextConfigOutput:"standalone",userland:o}),{requestAsyncStorage:h,staticGenerationAsyncStorage:f,serverHooks:m}=p,g="/api/todos/route";function v(){return(0,i.patchFetch)({serverHooks:m,staticGenerationAsyncStorage:f})}},7786:(e,t,r)=>{e.exports=r(517)},785:(e,t,r)=>{r.d(t,{ME:()=>a,kO:()=>i,sr:()=>u});var o=r(9411);let n=function(){let e=process.argv[1];if(e){let t=(0,o.dirname)((0,o.resolve)(e)),r=`${o.sep}node_modules${o.sep}.bin`;return t.endsWith(r)?(0,o.resolve)(t,"..",".."):t}return(0,o.resolve)(process.cwd())}();function s(e=process.env,t=n){return(0,o.resolve)(e.AGENT_DATA_DIR?.trim()||t)}function i(){return s()}function a(e=process.env,t=s(e)){let r=e.AGENT_LOG_DIR?.trim();if(r)return(0,o.resolve)(r);let n=e.AGENTROAM_DATA_DIR?.trim();return n?(0,o.resolve)(n,"logs"):(0,o.join)(t,".agent-data","logs")}function u(){return function(e=process.env,t=n){return(0,o.resolve)(e.AGENT_WORKING_DIRECTORY?.trim()||t)}(process.env,i())}},9001:(e,t,r)=>{r.d(t,{o:()=>n});let o=new Set(["capacitor://localhost","ionic://localhost"]);function n(e){if(!e.headers.get("content-type")?.toLowerCase().startsWith("application/json"))return Response.json({error:"JSON required"},{status:415});let t=e.headers.get("origin");if(!t||o.has(t))return null;let r=new URL(e.url),n="1"===process.env.AGENT_TRUST_TUNNEL_PROXY,s=n?e.headers.get("x-forwarded-host")?.split(",")[0].trim()||e.headers.get("host")||r.host:e.headers.get("host")||r.host,i=n&&e.headers.get("x-forwarded-proto")?.split(",")[0].trim()||r.protocol.slice(0,-1);return t!==`${i}://${s}`?Response.json({error:"Cross-origin write denied"},{status:403}):null}},1781:(e,t,r)=>{r.d(t,{EB:()=>c,Hq:()=>u,a:()=>a});var o=r(1636),n=r(9001),s=r(2110),i=r(4558);function a(e){if(!e.headers.get("x-agentroam-device-id"))throw new o.TodoError("FORBIDDEN","需要设备授权");return(0,s.nQ)().userId}function u(e){let t=e instanceof o.TodoError?({INVALID_ARGUMENT:400,NOT_FOUND:404,FORBIDDEN:403,VERSION_CONFLICT:409,IDEMPOTENCY_CONFLICT:409,BUSY:409,UNAVAILABLE:503})[e.code]:e instanceof SyntaxError?400:500;return Response.json({error:500===t?"待办服务暂不可用":e.message,code:e instanceof o.TodoError?e.code:400===t?"INVALID_ARGUMENT":"INTERNAL_ERROR"},{status:t})}async function c(e,t){let s=(0,n.o)(e);if(s)return s;try{let n=a(e),s=await e.json();if(!s||"object"!=typeof s||!s.command||"object"!=typeof s.command)throw new o.TodoError("INVALID_ARGUMENT","缺少待办操作");let u={...s.command,...t?{taskId:t}:{}};if(!t&&"create"!==u.type)throw new o.TodoError("INVALID_ARGUMENT","此入口只支持创建");if("create"===u.type&&u.executionSchedule?.enabled!==!1&&u.executionSchedule){let{validateExecutionTarget:e}=await Promise.all([r.e(5801),r.e(9457)]).then(r.bind(r,9457));await e(u.executionSchedule.target)}if("schedule"===u.type&&u.enabled){let{validateExecutionTarget:e}=await Promise.all([r.e(5801),r.e(9457)]).then(r.bind(r,9457)),o=u.target??i.Y().todos.get(t,n).schedule?.target;await e(o)}return Response.json((0,i.Y)().todos.execute(u,{ownerId:n,requestId:s.requestId}))}catch(e){return u(e)}}},4558:(e,t,r)=>{r.d(t,{Y:()=>s});var o=r(1636),n=r(785);function s(){let e=globalThis;return e.__todoServices??=function(e){let t=(0,o.getDatabase)(e.baseDir).db,r=new o.SQLiteTodoUnitOfWork(t),n=e.clock??Date.now;return{db:t,uow:r,todos:new o.TodoApplicationService(r,n),scheduler:new o.TodoScheduler(r),executions:new o.TodoExecutionService(r,n),notifications:new o.PersistentNotificationService(r,n)}}({baseDir:(0,n.kO)()})}},2110:(e,t,r)=>{r.d(t,{hw:()=>s.hw,nQ:()=>a});var o=r(1636),n=r(785),s=r(3710);let i=new o.SQLiteAnonymousWebStore((0,n.kO)());function a(){return{userId:i.getOrCreatePrincipal().userId,username:"local",deviceId:"browser"}}},3710:(e,t,r)=>{r.d(t,{$U:()=>l,Ci:()=>h,VP:()=>s,Xd:()=>d,ZA:()=>a,ap:()=>p,hw:()=>u,ki:()=>i,yN:()=>f});var o=r(1636),n=r(785);let s="customer_agent_session",i="customer_agent_device",a=new o.WebAuthService(new o.SQLiteAuthStore((0,n.kO)())),u=new o.SQLiteWebConsoleStore((0,n.kO)());function c(e){let t={};for(let r of(e.headers.get("cookie")||"").split(";")){let e=r.indexOf("=");e>0&&(t[r.slice(0,e).trim()]=decodeURIComponent(r.slice(e+1).trim()))}return t}function d(e){return c(e)[s]||null}function l(e){let t=c(e);return{ip:e.headers.get("x-forwarded-for")?.split(",")[0].trim()||"unknown",userAgent:e.headers.get("user-agent")||"",deviceId:t[i],deviceName:e.headers.get("x-device-name")||""}}function p(e){let t=a.authenticateToken(d(e));return a.validateCsrf(t,e.headers.get("x-csrf-token")),t}function h(e,t,r){return{httpOnly:r,sameSite:"strict",secure:"https"===("1"===process.env.AGENT_TRUST_TUNNEL_PROXY?e.headers.get("x-forwarded-proto"):null)||"https:"===new URL(e.url).protocol,path:"/",maxAge:t}}function f(e){let t=e instanceof o.WebAuthError?e:new o.WebAuthError("UNAUTHENTICATED","认证失败",401);return Response.json({error:{code:t.code,message:t.message}},{status:t.status})}}};var t=require("../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),o=t.X(0,[8375],()=>r(5450));module.exports=o})();
1
+ "use strict";(()=>{var e={};e.id=9603,e.ids=[9603],e.modules={1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},3376:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>g,patchFetch:()=>v,requestAsyncStorage:()=>h,routeModule:()=>p,serverHooks:()=>m,staticGenerationAsyncStorage:()=>f});var o={};r.r(o),r.d(o,{GET:()=>d,POST:()=>l,dynamic:()=>c});var n=r(7786),s=r(5042),i=r(2184),a=r(3151),u=r(1781);let c="force-dynamic";async function d(e){try{let t=Object.fromEntries(new URL(e.url).searchParams);return Response.json((0,a.Y)().todos.list(t,(0,u.a)(e)))}catch(e){return(0,u.Hq)(e)}}let l=e=>(0,u.EB)(e),p=new n.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/todos/route",pathname:"/api/todos",filename:"route",bundlePath:"app/api/todos/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-npm-remote-auth-20261125.yi_kd6wp/source/packages/server/app/api/todos/route.ts",nextConfigOutput:"standalone",userland:o}),{requestAsyncStorage:h,staticGenerationAsyncStorage:f,serverHooks:m}=p,g="/api/todos/route";function v(){return(0,i.patchFetch)({serverHooks:m,staticGenerationAsyncStorage:f})}},7786:(e,t,r)=>{e.exports=r(517)},785:(e,t,r)=>{r.d(t,{ME:()=>a,kO:()=>i,sr:()=>u});var o=r(9411);let n=function(){let e=process.argv[1];if(e){let t=(0,o.dirname)((0,o.resolve)(e)),r=`${o.sep}node_modules${o.sep}.bin`;return t.endsWith(r)?(0,o.resolve)(t,"..",".."):t}return(0,o.resolve)(process.cwd())}();function s(e=process.env,t=n){return(0,o.resolve)(e.AGENT_DATA_DIR?.trim()||t)}function i(){return s()}function a(e=process.env,t=s(e)){let r=e.AGENT_LOG_DIR?.trim();if(r)return(0,o.resolve)(r);let n=e.AGENTROAM_DATA_DIR?.trim();return n?(0,o.resolve)(n,"logs"):(0,o.join)(t,".agent-data","logs")}function u(){return function(e=process.env,t=n){return(0,o.resolve)(e.AGENT_WORKING_DIRECTORY?.trim()||t)}(process.env,i())}},9001:(e,t,r)=>{r.d(t,{o:()=>n});let o=new Set(["capacitor://localhost","ionic://localhost"]);function n(e){if(!e.headers.get("content-type")?.toLowerCase().startsWith("application/json"))return Response.json({error:"JSON required"},{status:415});let t=e.headers.get("origin");if(!t||o.has(t))return null;let r=new URL(e.url),n="1"===process.env.AGENT_TRUST_TUNNEL_PROXY,s=n?e.headers.get("x-forwarded-host")?.split(",")[0].trim()||e.headers.get("host")||r.host:e.headers.get("host")||r.host,i=n&&e.headers.get("x-forwarded-proto")?.split(",")[0].trim()||r.protocol.slice(0,-1);return t!==`${i}://${s}`?Response.json({error:"Cross-origin write denied"},{status:403}):null}},1781:(e,t,r)=>{r.d(t,{EB:()=>c,Hq:()=>u,a:()=>a});var o=r(1636),n=r(9001),s=r(2110),i=r(3151);function a(e){if(!e.headers.get("x-agentroam-device-id"))throw new o.TodoError("FORBIDDEN","需要设备授权");return(0,s.nQ)().userId}function u(e){let t=e instanceof o.TodoError?({INVALID_ARGUMENT:400,NOT_FOUND:404,FORBIDDEN:403,VERSION_CONFLICT:409,IDEMPOTENCY_CONFLICT:409,BUSY:409,UNAVAILABLE:503})[e.code]:e instanceof SyntaxError?400:500;return Response.json({error:500===t?"待办服务暂不可用":e.message,code:e instanceof o.TodoError?e.code:400===t?"INVALID_ARGUMENT":"INTERNAL_ERROR"},{status:t})}async function c(e,t){let s=(0,n.o)(e);if(s)return s;try{let n=a(e),s=await e.json();if(!s||"object"!=typeof s||!s.command||"object"!=typeof s.command)throw new o.TodoError("INVALID_ARGUMENT","缺少待办操作");let u={...s.command,...t?{taskId:t}:{}};if(!t&&"create"!==u.type)throw new o.TodoError("INVALID_ARGUMENT","此入口只支持创建");if("create"===u.type&&u.executionSchedule?.enabled!==!1&&u.executionSchedule){let{validateExecutionTarget:e}=await Promise.all([r.e(5801),r.e(9457)]).then(r.bind(r,9457));await e(u.executionSchedule.target)}if("schedule"===u.type&&u.enabled){let{validateExecutionTarget:e}=await Promise.all([r.e(5801),r.e(9457)]).then(r.bind(r,9457)),o=u.target??i.Y().todos.get(t,n).schedule?.target;await e(o)}return Response.json((0,i.Y)().todos.execute(u,{ownerId:n,requestId:s.requestId}))}catch(e){return u(e)}}},3151:(e,t,r)=>{r.d(t,{Y:()=>s});var o=r(1636),n=r(785);function s(){let e=globalThis;return e.__todoServices??=function(e){let t=(0,o.getDatabase)(e.baseDir).db,r=new o.SQLiteTodoUnitOfWork(t),n=e.clock??Date.now;return{db:t,uow:r,todos:new o.TodoApplicationService(r,n),scheduler:new o.TodoScheduler(r),executions:new o.TodoExecutionService(r,n),notifications:new o.PersistentNotificationService(r,n)}}({baseDir:(0,n.kO)()})}},2110:(e,t,r)=>{r.d(t,{hw:()=>s.hw,nQ:()=>a});var o=r(1636),n=r(785),s=r(3710);let i=new o.SQLiteAnonymousWebStore((0,n.kO)());function a(){return{userId:i.getOrCreatePrincipal().userId,username:"local",deviceId:"browser"}}},3710:(e,t,r)=>{r.d(t,{$U:()=>l,Ci:()=>h,VP:()=>s,Xd:()=>d,ZA:()=>a,ap:()=>p,hw:()=>u,ki:()=>i,yN:()=>f});var o=r(1636),n=r(785);let s="customer_agent_session",i="customer_agent_device",a=new o.WebAuthService(new o.SQLiteAuthStore((0,n.kO)())),u=new o.SQLiteWebConsoleStore((0,n.kO)());function c(e){let t={};for(let r of(e.headers.get("cookie")||"").split(";")){let e=r.indexOf("=");e>0&&(t[r.slice(0,e).trim()]=decodeURIComponent(r.slice(e+1).trim()))}return t}function d(e){return c(e)[s]||null}function l(e){let t=c(e);return{ip:e.headers.get("x-forwarded-for")?.split(",")[0].trim()||"unknown",userAgent:e.headers.get("user-agent")||"",deviceId:t[i],deviceName:e.headers.get("x-device-name")||""}}function p(e){let t=a.authenticateToken(d(e));return a.validateCsrf(t,e.headers.get("x-csrf-token")),t}function h(e,t,r){return{httpOnly:r,sameSite:"strict",secure:"https"===("1"===process.env.AGENT_TRUST_TUNNEL_PROXY?e.headers.get("x-forwarded-proto"):null)||"https:"===new URL(e.url).protocol,path:"/",maxAge:t}}function f(e){let t=e instanceof o.WebAuthError?e:new o.WebAuthError("UNAUTHENTICATED","认证失败",401);return Response.json({error:{code:t.code,message:t.message}},{status:t.status})}}};var t=require("../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),o=t.X(0,[8375],()=>r(3376));module.exports=o})();
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=2489,e.ids=[2489,535],e.modules={8042:e=>{e.exports=require("@agent/computer-use")},1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},829:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>f,patchFetch:()=>y,requestAsyncStorage:()=>p,routeModule:()=>d,serverHooks:()=>h,staticGenerationAsyncStorage:()=>g});var o={};r.r(o),r.d(o,{DELETE:()=>u,PUT:()=>c});var s=r(7786),i=r(5042),n=r(2184),a=r(9001),l=r(8615);async function c(e,{params:t}){let r=(0,a.o)(e);if(r)return r;try{if(!await (0,l.cm)().get(t.policyId))return Response.json({error:"Tool policy not found",code:"TOOL_POLICY_NOT_FOUND"},{status:404});let r=await e.json();if(!r||"object"!=typeof r||Array.isArray(r))return Response.json({error:"Tool policy must be an object",code:"INVALID_TOOL_POLICY"},{status:422});if("id"in r&&r.id!==t.policyId)return Response.json({error:"Tool policy ID cannot be changed",code:"INVALID_TOOL_POLICY"},{status:422});return Response.json(await (0,l.cm)().save({...r,id:t.policyId},(0,l.jw)()))}catch(e){return(0,l.H5)(e)}}async function u(e,{params:t}){return(0,a.o)(e)||(await (0,l.cm)().delete(t.policyId)?Response.json({deleted:!0,policyId:t.policyId}):Response.json({error:"Tool policy not found",code:"TOOL_POLICY_NOT_FOUND"},{status:404}))}let d=new s.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/tool-policies/[policyId]/route",pathname:"/api/tool-policies/[policyId]",filename:"route",bundlePath:"app/api/tool-policies/[policyId]/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-preview80-20261125.e3ZzMB/source/packages/server/app/api/tool-policies/[policyId]/route.ts",nextConfigOutput:"standalone",userland:o}),{requestAsyncStorage:p,staticGenerationAsyncStorage:g,serverHooks:h}=d,f="/api/tool-policies/[policyId]/route";function y(){return(0,n.patchFetch)({serverHooks:h,staticGenerationAsyncStorage:g})}},7786:(e,t,r)=>{e.exports=r(517)},535:(e,t,r)=>{r.d(t,{L:()=>n});var o=r(1636),s=r(785);let i=!1;function n(){let e=(0,o.getGlobalLogger)();if(e)return e;let t=(0,o.installGlobalLogging)({dir:(0,s.ME)(),source:"server",minLevel:"info",handlers:{exitOnUncaughtException:!1}});return i||(i=!0,t.info("server logger attached",{dir:t.dir,pid:process.pid})),t}},6361:(e,t,r)=>{r.d(t,{Q:()=>n,e:()=>i});var o=r(1636),s=r(9119);function i(){let e=new o.ToolRegistry;(0,o.registerBuiltinTools)(e);let t=new o.SkillRegistry;for(let r of(e.register(new o.SkillDiscoverTool(t,null)),e.register(new o.SkillLoadTool(t,null)),s.agentHost.getBuilder().getToolRegistry().getAll()))e.register(r);return e.register(new o.DispatchAgentTool(async()=>({status:"failed",agentName:"",subSessionId:"",error:"catalog listing only; dispatch runs inside a Customer Agent session"}))),e.register(new o.SpawnAgentTool(async()=>({status:"failed",agentName:"",subSessionId:"",error:"catalog listing only; spawning runs inside a dynamic Customer Agent session"}))),e.register(new o.WaitAgentTool(async()=>({status:"failed",agentName:"",subSessionId:"",error:"catalog listing only; dispatch runs inside a Customer Agent session"}))),e}function n(){return i().getAll().map(e=>e.name).sort()}},1489:(e,t,r)=>{r.d(t,{N:()=>l});var o=r(1636),s=r(2847),i=r(785);class n{constructor(){this.tasks=new o.CronTasks((0,i.kO)()),this.scheduler=new s.CronScheduler(this.tasks,e=>{this.fire(e).catch(e=>console.error("Scheduled Customer Agent run failed",e))},()=>{}),this.scheduler.start()}async fire(e){let{agentHost:t}=await Promise.all([r.e(1973),r.e(9119),r.e(535)]).then(r.bind(r,9119)),{getCustomerGoalCoordinator:o}=await Promise.all([r.e(1973),r.e(9119),r.e(2324)]).then(r.bind(r,6435)),s=e.sessionId;s&&await t.getSessionStore().get(s)||(s=(await t.createSession(e.label||"定时任务")).id,this.tasks.update(e.id,{sessionId:s})),await o().enqueue(s,e.prompt)}call(e,t){let r=String(t[0]||"");switch(e){case"cronList":return this.tasks.list();case"cronCreate":{if("string"!=typeof t[0]||"string"!=typeof t[1]||!t[1].trim())throw Error("cron and prompt required");let e=t[2]&&"object"==typeof t[2]?t[2]:{};return this.tasks.create({cron:t[0],prompt:t[1],recurring:!1!==e.recurring,enabled:!0,durable:!0,..."string"==typeof e.sessionId?{sessionId:e.sessionId}:{},..."string"==typeof e.label?{label:e.label}:{}})}case"cronPause":return this.tasks.pause(r);case"cronResume":return this.tasks.resume(r);case"cronDelete":return this.tasks.delete(r);case"cronDeleteAll":return this.tasks.deleteAll(),{ok:!0};default:throw Error("Unsupported schedule operation")}}}let a=globalThis;function l(){return a.__sharedCronService??=new n}},9001:(e,t,r)=>{r.d(t,{o:()=>s});let o=new Set(["capacitor://localhost","ionic://localhost"]);function s(e){if(!e.headers.get("content-type")?.toLowerCase().startsWith("application/json"))return Response.json({error:"JSON required"},{status:415});let t=e.headers.get("origin");if(!t||o.has(t))return null;let r=new URL(e.url),s="1"===process.env.AGENT_TRUST_TUNNEL_PROXY,i=s?e.headers.get("x-forwarded-host")?.split(",")[0].trim()||e.headers.get("host")||r.host:e.headers.get("host")||r.host,n=s&&e.headers.get("x-forwarded-proto")?.split(",")[0].trim()||r.protocol.slice(0,-1);return t!==`${n}://${i}`?Response.json({error:"Cross-origin write denied"},{status:403}):null}},8615:(e,t,r)=>{let o;r.d(t,{H5:()=>d,cm:()=>c,jw:()=>u});var s=r(7561),i=r(1636),n=r(785),a=r(6361);class l{constructor(e=(0,n.kO)()){this.store=new i.SQLiteToolExecutionPolicyStore(e)}list(){return this.store.list()}get(e){return this.store.get(e)}async summaries(){return(await this.store.list()).filter(e=>e.enabled).map(i.toolExecutionPolicySummary)}save(e,t){let r=(0,i.validateToolExecutionPolicy)(e,{knownTools:t,executableExists:s.existsSync});return this.store.save(r)}delete(e){return this.store.delete(e)}}function c(){return o??=new l}function u(){return(0,a.Q)()}function d(e){let t=e instanceof i.ToolExecutionPolicyError?422:400;return Response.json({error:e instanceof Error?e.message:"Tool policy request failed",code:e instanceof i.ToolExecutionPolicyError?e.code:"INVALID_TOOL_POLICY"},{status:t})}}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),o=t.X(0,[8375,1973,4621,9119],()=>r(829));module.exports=o})();
1
+ "use strict";(()=>{var e={};e.id=2489,e.ids=[2489,535],e.modules={8042:e=>{e.exports=require("@agent/computer-use")},1636:e=>{e.exports=require("@agent/core")},2847:e=>{e.exports=require("@agent/native-runtime")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},4455:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>f,patchFetch:()=>y,requestAsyncStorage:()=>p,routeModule:()=>d,serverHooks:()=>h,staticGenerationAsyncStorage:()=>g});var o={};r.r(o),r.d(o,{DELETE:()=>u,PUT:()=>c});var s=r(7786),i=r(5042),n=r(2184),a=r(9001),l=r(8615);async function c(e,{params:t}){let r=(0,a.o)(e);if(r)return r;try{if(!await (0,l.cm)().get(t.policyId))return Response.json({error:"Tool policy not found",code:"TOOL_POLICY_NOT_FOUND"},{status:404});let r=await e.json();if(!r||"object"!=typeof r||Array.isArray(r))return Response.json({error:"Tool policy must be an object",code:"INVALID_TOOL_POLICY"},{status:422});if("id"in r&&r.id!==t.policyId)return Response.json({error:"Tool policy ID cannot be changed",code:"INVALID_TOOL_POLICY"},{status:422});return Response.json(await (0,l.cm)().save({...r,id:t.policyId},(0,l.jw)()))}catch(e){return(0,l.H5)(e)}}async function u(e,{params:t}){return(0,a.o)(e)||(await (0,l.cm)().delete(t.policyId)?Response.json({deleted:!0,policyId:t.policyId}):Response.json({error:"Tool policy not found",code:"TOOL_POLICY_NOT_FOUND"},{status:404}))}let d=new s.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/tool-policies/[policyId]/route",pathname:"/api/tool-policies/[policyId]",filename:"route",bundlePath:"app/api/tool-policies/[policyId]/route"},resolvedPagePath:"/Users/caoqu/.codex/artifacts/agentroam-npm-remote-auth-20261125.yi_kd6wp/source/packages/server/app/api/tool-policies/[policyId]/route.ts",nextConfigOutput:"standalone",userland:o}),{requestAsyncStorage:p,staticGenerationAsyncStorage:g,serverHooks:h}=d,f="/api/tool-policies/[policyId]/route";function y(){return(0,n.patchFetch)({serverHooks:h,staticGenerationAsyncStorage:g})}},7786:(e,t,r)=>{e.exports=r(517)},535:(e,t,r)=>{r.d(t,{L:()=>n});var o=r(1636),s=r(785);let i=!1;function n(){let e=(0,o.getGlobalLogger)();if(e)return e;let t=(0,o.installGlobalLogging)({dir:(0,s.ME)(),source:"server",minLevel:"info",handlers:{exitOnUncaughtException:!1}});return i||(i=!0,t.info("server logger attached",{dir:t.dir,pid:process.pid})),t}},6361:(e,t,r)=>{r.d(t,{Q:()=>n,e:()=>i});var o=r(1636),s=r(9119);function i(){let e=new o.ToolRegistry;(0,o.registerBuiltinTools)(e);let t=new o.SkillRegistry;for(let r of(e.register(new o.SkillDiscoverTool(t,null)),e.register(new o.SkillLoadTool(t,null)),s.agentHost.getBuilder().getToolRegistry().getAll()))e.register(r);return e.register(new o.DispatchAgentTool(async()=>({status:"failed",agentName:"",subSessionId:"",error:"catalog listing only; dispatch runs inside a Customer Agent session"}))),e.register(new o.SpawnAgentTool(async()=>({status:"failed",agentName:"",subSessionId:"",error:"catalog listing only; spawning runs inside a dynamic Customer Agent session"}))),e.register(new o.WaitAgentTool(async()=>({status:"failed",agentName:"",subSessionId:"",error:"catalog listing only; dispatch runs inside a Customer Agent session"}))),e}function n(){return i().getAll().map(e=>e.name).sort()}},1489:(e,t,r)=>{r.d(t,{N:()=>l});var o=r(1636),s=r(2847),i=r(785);class n{constructor(){this.tasks=new o.CronTasks((0,i.kO)()),this.scheduler=new s.CronScheduler(this.tasks,e=>{this.fire(e).catch(e=>console.error("Scheduled Customer Agent run failed",e))},()=>{}),this.scheduler.start()}async fire(e){let{agentHost:t}=await Promise.all([r.e(1973),r.e(9119),r.e(535)]).then(r.bind(r,9119)),{getCustomerGoalCoordinator:o}=await Promise.all([r.e(1973),r.e(9119),r.e(2324)]).then(r.bind(r,6435)),s=e.sessionId;s&&await t.getSessionStore().get(s)||(s=(await t.createSession(e.label||"定时任务")).id,this.tasks.update(e.id,{sessionId:s})),await o().enqueue(s,e.prompt)}call(e,t){let r=String(t[0]||"");switch(e){case"cronList":return this.tasks.list();case"cronCreate":{if("string"!=typeof t[0]||"string"!=typeof t[1]||!t[1].trim())throw Error("cron and prompt required");let e=t[2]&&"object"==typeof t[2]?t[2]:{};return this.tasks.create({cron:t[0],prompt:t[1],recurring:!1!==e.recurring,enabled:!0,durable:!0,..."string"==typeof e.sessionId?{sessionId:e.sessionId}:{},..."string"==typeof e.label?{label:e.label}:{}})}case"cronPause":return this.tasks.pause(r);case"cronResume":return this.tasks.resume(r);case"cronDelete":return this.tasks.delete(r);case"cronDeleteAll":return this.tasks.deleteAll(),{ok:!0};default:throw Error("Unsupported schedule operation")}}}let a=globalThis;function l(){return a.__sharedCronService??=new n}},9001:(e,t,r)=>{r.d(t,{o:()=>s});let o=new Set(["capacitor://localhost","ionic://localhost"]);function s(e){if(!e.headers.get("content-type")?.toLowerCase().startsWith("application/json"))return Response.json({error:"JSON required"},{status:415});let t=e.headers.get("origin");if(!t||o.has(t))return null;let r=new URL(e.url),s="1"===process.env.AGENT_TRUST_TUNNEL_PROXY,i=s?e.headers.get("x-forwarded-host")?.split(",")[0].trim()||e.headers.get("host")||r.host:e.headers.get("host")||r.host,n=s&&e.headers.get("x-forwarded-proto")?.split(",")[0].trim()||r.protocol.slice(0,-1);return t!==`${n}://${i}`?Response.json({error:"Cross-origin write denied"},{status:403}):null}},8615:(e,t,r)=>{let o;r.d(t,{H5:()=>d,cm:()=>c,jw:()=>u});var s=r(7561),i=r(1636),n=r(785),a=r(6361);class l{constructor(e=(0,n.kO)()){this.store=new i.SQLiteToolExecutionPolicyStore(e)}list(){return this.store.list()}get(e){return this.store.get(e)}async summaries(){return(await this.store.list()).filter(e=>e.enabled).map(i.toolExecutionPolicySummary)}save(e,t){let r=(0,i.validateToolExecutionPolicy)(e,{knownTools:t,executableExists:s.existsSync});return this.store.save(r)}delete(e){return this.store.delete(e)}}function c(){return o??=new l}function u(){return(0,a.Q)()}function d(e){let t=e instanceof i.ToolExecutionPolicyError?422:400;return Response.json({error:e instanceof Error?e.message:"Tool policy request failed",code:e instanceof i.ToolExecutionPolicyError?e.code:"INVALID_TOOL_POLICY"},{status:t})}}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),o=t.X(0,[8375,1973,4621,9119],()=>r(4455));module.exports=o})();