@sapienx/agentos 0.6.8 → 0.6.9

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 (203) hide show
  1. package/bundle/.next/BUILD_ID +1 -1
  2. package/bundle/.next/app-path-routes-manifest.json +17 -15
  3. package/bundle/.next/build-manifest.json +3 -3
  4. package/bundle/.next/prerender-manifest.json +3 -3
  5. package/bundle/.next/react-loadable-manifest.json +2 -2
  6. package/bundle/.next/required-server-files.json +1 -1
  7. package/bundle/.next/routes-manifest.json +12 -0
  8. package/bundle/.next/server/app/_global-error/page.js +2 -2
  9. package/bundle/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  10. package/bundle/.next/server/app/_global-error.html +1 -1
  11. package/bundle/.next/server/app/_global-error.rsc +1 -1
  12. package/bundle/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  13. package/bundle/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  14. package/bundle/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  15. package/bundle/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  16. package/bundle/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  17. package/bundle/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  18. package/bundle/.next/server/app/_not-found/page.js +2 -2
  19. package/bundle/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  20. package/bundle/.next/server/app/_not-found.html +2 -2
  21. package/bundle/.next/server/app/_not-found.rsc +2 -2
  22. package/bundle/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  23. package/bundle/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  24. package/bundle/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  25. package/bundle/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  26. package/bundle/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  27. package/bundle/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  28. package/bundle/.next/server/app/accounts/page.js +2 -2
  29. package/bundle/.next/server/app/accounts/page.js.nft.json +1 -1
  30. package/bundle/.next/server/app/accounts/page_client-reference-manifest.js +1 -1
  31. package/bundle/.next/server/app/agents/page.js +2 -2
  32. package/bundle/.next/server/app/agents/page.js.nft.json +1 -1
  33. package/bundle/.next/server/app/agents/page_client-reference-manifest.js +1 -1
  34. package/bundle/.next/server/app/api/accounts/access-rules/route.js +1 -1
  35. package/bundle/.next/server/app/api/accounts/access-rules/route.js.nft.json +1 -1
  36. package/bundle/.next/server/app/api/accounts/browser-profiles/route.js +1 -1
  37. package/bundle/.next/server/app/api/accounts/browser-profiles/route.js.nft.json +1 -1
  38. package/bundle/.next/server/app/api/accounts/login-targets/route.js +2 -2
  39. package/bundle/.next/server/app/api/accounts/login-targets/route.js.nft.json +1 -1
  40. package/bundle/.next/server/app/api/agents/[agentId]/chat/route.js +4 -4
  41. package/bundle/.next/server/app/api/agents/[agentId]/chat/route.js.nft.json +1 -1
  42. package/bundle/.next/server/app/api/agents/route.js +1 -1
  43. package/bundle/.next/server/app/api/agents/route.js.nft.json +1 -1
  44. package/bundle/.next/server/app/api/diagnostics/route.js +1 -1
  45. package/bundle/.next/server/app/api/diagnostics/route.js.nft.json +1 -1
  46. package/bundle/.next/server/app/api/files/reveal/route.js +1 -1
  47. package/bundle/.next/server/app/api/gateway/control/route.js +1 -1
  48. package/bundle/.next/server/app/api/gateway/control/route.js.nft.json +1 -1
  49. package/bundle/.next/server/app/api/integrations/[integrationId]/status/route.js +1 -1
  50. package/bundle/.next/server/app/api/integrations/[integrationId]/status/route.js.nft.json +1 -1
  51. package/bundle/.next/server/app/api/mission/route.js +3 -3
  52. package/bundle/.next/server/app/api/mission/route.js.nft.json +1 -1
  53. package/bundle/.next/server/app/api/models/catalog/route.js +1 -1
  54. package/bundle/.next/server/app/api/models/catalog/route.js.nft.json +1 -1
  55. package/bundle/.next/server/app/api/models/providers/route.js +1 -1
  56. package/bundle/.next/server/app/api/models/providers/route.js.nft.json +1 -1
  57. package/bundle/.next/server/app/api/onboarding/models/route.js +2 -2
  58. package/bundle/.next/server/app/api/onboarding/models/route.js.nft.json +1 -1
  59. package/bundle/.next/server/app/api/onboarding/route.js +2 -2
  60. package/bundle/.next/server/app/api/onboarding/route.js.nft.json +1 -1
  61. package/bundle/.next/server/app/api/openclaw/capabilities/route.js +1 -1
  62. package/bundle/.next/server/app/api/openclaw/capabilities/route.js.nft.json +1 -1
  63. package/bundle/.next/server/app/api/openclaw/compatibility-smoke/route.js +1 -1
  64. package/bundle/.next/server/app/api/openclaw/compatibility-smoke/route.js.nft.json +1 -1
  65. package/bundle/.next/server/app/api/planner/[planId]/deploy/route.js +2 -2
  66. package/bundle/.next/server/app/api/planner/[planId]/deploy/route.js.nft.json +1 -1
  67. package/bundle/.next/server/app/api/planner/[planId]/document-rewrite/route.js +1 -1
  68. package/bundle/.next/server/app/api/planner/[planId]/document-rewrite/route.js.nft.json +1 -1
  69. package/bundle/.next/server/app/api/planner/[planId]/route.js +1 -1
  70. package/bundle/.next/server/app/api/planner/[planId]/route.js.nft.json +1 -1
  71. package/bundle/.next/server/app/api/planner/[planId]/simulate/route.js +1 -1
  72. package/bundle/.next/server/app/api/planner/[planId]/simulate/route.js.nft.json +1 -1
  73. package/bundle/.next/server/app/api/planner/[planId]/turn/route.js +1 -1
  74. package/bundle/.next/server/app/api/planner/[planId]/turn/route.js.nft.json +1 -1
  75. package/bundle/.next/server/app/api/planner/route.js +1 -1
  76. package/bundle/.next/server/app/api/planner/route.js.nft.json +1 -1
  77. package/bundle/.next/server/app/api/reset/route.js +2 -2
  78. package/bundle/.next/server/app/api/reset/route.js.nft.json +1 -1
  79. package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js +1 -1
  80. package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js.nft.json +1 -1
  81. package/bundle/.next/server/app/api/settings/config-pacing/route.js +1 -1
  82. package/bundle/.next/server/app/api/settings/config-pacing/route.js.nft.json +1 -1
  83. package/bundle/.next/server/app/api/settings/gateway/route.js +1 -1
  84. package/bundle/.next/server/app/api/settings/gateway/route.js.nft.json +1 -1
  85. package/bundle/.next/server/app/api/settings/openclaw-binary/route.js +1 -1
  86. package/bundle/.next/server/app/api/settings/openclaw-binary/route.js.nft.json +1 -1
  87. package/bundle/.next/server/app/api/settings/workspace-root/route.js +1 -1
  88. package/bundle/.next/server/app/api/settings/workspace-root/route.js.nft.json +1 -1
  89. package/bundle/.next/server/app/api/snapshot/route.js +1 -1
  90. package/bundle/.next/server/app/api/snapshot/route.js.nft.json +1 -1
  91. package/bundle/.next/server/app/api/stream/route.js +2 -2
  92. package/bundle/.next/server/app/api/stream/route.js.nft.json +1 -1
  93. package/bundle/.next/server/app/api/system/open-terminal/route.js +1 -1
  94. package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js +1 -1
  95. package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js.nft.json +1 -1
  96. package/bundle/.next/server/app/api/tasks/[taskId]/control/route.js +1 -1
  97. package/bundle/.next/server/app/api/tasks/[taskId]/control/route.js.nft.json +1 -1
  98. package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js +2 -2
  99. package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js.nft.json +1 -1
  100. package/bundle/.next/server/app/api/update/route.js +2 -2
  101. package/bundle/.next/server/app/api/update/route.js.nft.json +1 -1
  102. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/discovered-groups/route.js +1 -1
  103. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/discovered-groups/route.js.nft.json +1 -1
  104. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/route.js +1 -1
  105. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/route.js.nft.json +1 -1
  106. package/bundle/.next/server/app/api/workspaces/[workspaceId]/edit-draft/route.js +1 -1
  107. package/bundle/.next/server/app/api/workspaces/[workspaceId]/edit-draft/route.js.nft.json +1 -1
  108. package/bundle/.next/server/app/api/workspaces/[workspaceId]/files/route.js +1 -1
  109. package/bundle/.next/server/app/api/workspaces/[workspaceId]/files/route.js.nft.json +1 -1
  110. package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/discovery/route.js +1 -1
  111. package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/discovery/route.js.nft.json +1 -1
  112. package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/reconcile/route.js +1 -1
  113. package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/reconcile/route.js.nft.json +1 -1
  114. package/bundle/.next/server/app/api/workspaces/route.js +2 -2
  115. package/bundle/.next/server/app/api/workspaces/route.js.nft.json +1 -1
  116. package/bundle/.next/server/app/dashboard/page.js +2 -0
  117. package/bundle/.next/server/app/dashboard/page.js.nft.json +1 -0
  118. package/bundle/.next/server/app/dashboard/page_client-reference-manifest.js +1 -0
  119. package/bundle/.next/server/app/files/page.js +2 -2
  120. package/bundle/.next/server/app/files/page.js.nft.json +1 -1
  121. package/bundle/.next/server/app/files/page_client-reference-manifest.js +1 -1
  122. package/bundle/.next/server/app/integrations/page.js +2 -2
  123. package/bundle/.next/server/app/integrations/page.js.nft.json +1 -1
  124. package/bundle/.next/server/app/integrations/page_client-reference-manifest.js +1 -1
  125. package/bundle/.next/server/app/mission-control/page.js +2 -0
  126. package/bundle/.next/server/app/mission-control/page.js.nft.json +1 -0
  127. package/bundle/.next/server/app/mission-control/page_client-reference-manifest.js +1 -0
  128. package/bundle/.next/server/app/models/page.js +2 -2
  129. package/bundle/.next/server/app/models/page.js.nft.json +1 -1
  130. package/bundle/.next/server/app/models/page_client-reference-manifest.js +1 -1
  131. package/bundle/.next/server/app/page.js +2 -2
  132. package/bundle/.next/server/app/page.js.nft.json +1 -1
  133. package/bundle/.next/server/app/page_client-reference-manifest.js +1 -1
  134. package/bundle/.next/server/app/settings/page.js +2 -2
  135. package/bundle/.next/server/app/settings/page.js.nft.json +1 -1
  136. package/bundle/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  137. package/bundle/.next/server/app/tasks/page.js +2 -2
  138. package/bundle/.next/server/app/tasks/page.js.nft.json +1 -1
  139. package/bundle/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
  140. package/bundle/.next/server/app-paths-manifest.json +17 -15
  141. package/bundle/.next/server/chunks/1089.js +7 -0
  142. package/bundle/.next/server/chunks/1718.js +4 -4
  143. package/bundle/.next/server/chunks/4020.js +182 -0
  144. package/bundle/.next/server/chunks/4391.js +13 -186
  145. package/bundle/.next/server/chunks/4669.js +9 -0
  146. package/bundle/.next/server/chunks/4767.js +3 -3
  147. package/bundle/.next/server/chunks/4983.js +2 -2
  148. package/bundle/.next/server/chunks/5010.js +2 -2
  149. package/bundle/.next/server/chunks/5086.js +185 -0
  150. package/bundle/.next/server/chunks/9632.js +1 -0
  151. package/bundle/.next/server/middleware-build-manifest.js +1 -1
  152. package/bundle/.next/server/middleware-react-loadable-manifest.js +1 -1
  153. package/bundle/.next/server/pages/404.html +2 -2
  154. package/bundle/.next/server/pages/500.html +1 -1
  155. package/bundle/.next/server/server-reference-manifest.json +1 -1
  156. package/bundle/.next/static/chunks/1541-0173f72615d06e6b.js +7 -0
  157. package/bundle/.next/static/chunks/2083-7ecb4068386ea635.js +1 -0
  158. package/bundle/.next/static/chunks/2125-d862b19ddebfd33a.js +3 -0
  159. package/bundle/.next/static/chunks/4522-dd68e4d9aa45e7ad.js +1 -0
  160. package/bundle/.next/static/chunks/5922-c50d9d6d73494e4a.js +174 -0
  161. package/bundle/.next/static/chunks/616-340cd4ffce07ad95.js +9 -0
  162. package/bundle/.next/static/chunks/7197.9a3977e98b2a1fe9.js +1 -0
  163. package/bundle/.next/static/chunks/7442-2b8d98ced8731710.js +25 -0
  164. package/bundle/.next/static/chunks/app/accounts/page-70d61db66c3fa8ff.js +1 -0
  165. package/bundle/.next/static/chunks/app/agents/page-bcd6692c103acc4b.js +1 -0
  166. package/bundle/.next/static/chunks/app/dashboard/page-3ddf5f111de57314.js +1 -0
  167. package/bundle/.next/static/chunks/app/files/page-5d16dd2ab89a7ef8.js +1 -0
  168. package/bundle/.next/static/chunks/app/integrations/page-c82fe844b92dcc3c.js +1 -0
  169. package/bundle/.next/static/chunks/app/mission-control/page-047cf8ddbc5eb449.js +1 -0
  170. package/bundle/.next/static/chunks/app/models/page-5a77bb7553c260a3.js +1 -0
  171. package/bundle/.next/static/chunks/app/page-3948952c415f5a8f.js +1 -0
  172. package/bundle/.next/static/chunks/app/settings/page-377344c48b7c3b7a.js +1 -0
  173. package/bundle/.next/static/chunks/app/tasks/page-5eebfe2b85dbe24d.js +1 -0
  174. package/bundle/.next/static/chunks/webpack-6bcec8d8f296d9ef.js +1 -0
  175. package/bundle/.next/static/css/1ec545644e12b517.css +3 -0
  176. package/bundle/.next/static/jgRmll3iX_XVNwRhKs8U9/_buildManifest.js +1 -0
  177. package/bundle/server.js +1 -1
  178. package/package.json +1 -1
  179. package/bundle/.next/server/chunks/1752.js +0 -12
  180. package/bundle/.next/server/chunks/5271.js +0 -7
  181. package/bundle/.next/server/chunks/6637.js +0 -1
  182. package/bundle/.next/server/chunks/8215.js +0 -9
  183. package/bundle/.next/server/chunks/8533.js +0 -182
  184. package/bundle/.next/static/chunks/2083-3f878fa838a1a0ca.js +0 -1
  185. package/bundle/.next/static/chunks/2125-162d48301a8f53b4.js +0 -3
  186. package/bundle/.next/static/chunks/2207-4f66fd1ddff2aba5.js +0 -1
  187. package/bundle/.next/static/chunks/2366-16384dc528c25ced.js +0 -7
  188. package/bundle/.next/static/chunks/7197.ddf4cc08de4fe3ee.js +0 -1
  189. package/bundle/.next/static/chunks/7442-2c0e6d9ebff0ac6a.js +0 -198
  190. package/bundle/.next/static/chunks/9069-70706bf0dcf0a557.js +0 -1
  191. package/bundle/.next/static/chunks/9679-b7f81b3d55f1ea2d.js +0 -9
  192. package/bundle/.next/static/chunks/app/accounts/page-28d2ce28785650e2.js +0 -1
  193. package/bundle/.next/static/chunks/app/agents/page-00e158069677f65e.js +0 -1
  194. package/bundle/.next/static/chunks/app/files/page-ad284ddbf86c04e5.js +0 -1
  195. package/bundle/.next/static/chunks/app/integrations/page-4f68bceee5abc789.js +0 -1
  196. package/bundle/.next/static/chunks/app/models/page-66e93f913af5e8e2.js +0 -1
  197. package/bundle/.next/static/chunks/app/page-caa416df80d1e4aa.js +0 -1
  198. package/bundle/.next/static/chunks/app/settings/page-87e643a9b8cbb811.js +0 -1
  199. package/bundle/.next/static/chunks/app/tasks/page-f3ff8c14f4e6516d.js +0 -1
  200. package/bundle/.next/static/chunks/webpack-4c600b16521adac0.js +0 -1
  201. package/bundle/.next/static/css/90ba0f48862473e6.css +0 -3
  202. package/bundle/.next/static/hXnwH-mOOsX_EiS-3twK3/_buildManifest.js +0 -1
  203. /package/bundle/.next/static/{hXnwH-mOOsX_EiS-3twK3 → jgRmll3iX_XVNwRhKs8U9}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";exports.id=1718,exports.ids=[1718],exports.modules={1718:(a,b,c)=>{c.d(b,{MG:()=>C,MQ:()=>D,PR:()=>A,Vg:()=>z,W6:()=>B,f5:()=>I});var d=c(77598),e=c(51455),f=c(48161),g=c(76760),h=c(58500),i=c(14805),j=c(39503),k=c(8533),l=c(35456),m=c(95141),n=c(7565),o=c(78446),p=c(96972);let q="gateway.remote.url",r=".env.local",s="AGENTOS_OPENCLAW_GATEWAY_TOKEN",t="AGENTOS_OPENCLAW_GATEWAY_PASSWORD",u="gateway.auth.mode",v="gateway.auth.token",w=[0,500,1e3,1500,2500,3500],x=["operator.admin","operator.read","operator.write","operator.approvals","operator.pairing","operator.talk.secrets"];function y(){(0,k.ZZ)(),(0,k.b7)()}async function z(a){let b=(0,l.Zm)(a.gatewayUrl);return b?await (0,j.rw)().setConfig(q,b):await (0,j.rw)().hasConfig(q)&&await (0,j.rw)().unsetConfig(q),y(),(0,k.GM)({force:!0})}async function A(a){let b=(0,l.FU)(a.workspaceRoot),c={...await (0,l.tl)(),...b?{workspaceRoot:b}:{}};return b||delete c.workspaceRoot,await (0,l.wi)(c),y(),(0,k.GM)({force:!0})}async function B(a={}){let b,c=a.env??process.env,d=a.cwd??process.cwd(),e=(a.now??(()=>new Date))().toISOString(),f=(0,j.rw)(),g=await K(f),h=g.snapshot,[i,k,l,n,o]=h?["string"==typeof(b=L(h,"gateway.auth.mode"))&&b.trim()?b.trim():null,R(L(h,"gateway.auth.token")),R(L(h,"gateway.auth.password")),R(L(h,"gateway.remote.token")),R(L(h,"gateway.remote.password"))]:g.invalidConfig?[null,"unknown","unknown","unknown","unknown"]:await Promise.all([y("gateway.auth.mode"),z("gateway.auth.token"),z("gateway.auth.password"),z("gateway.remote.token"),z("gateway.remote.password")]),q=(a.isNativeDisabled??m.JG)(),r=!!(c.AGENTOS_OPENCLAW_GATEWAY_TOKEN?.trim()||c.OPENCLAW_GATEWAY_TOKEN?.trim()),s=!!(c.AGENTOS_OPENCLAW_GATEWAY_PASSWORD?.trim()||c.OPENCLAW_GATEWAY_PASSWORD?.trim()),t={authToken:k,authPassword:l,remoteToken:n,remotePassword:o},u=await O(d);if(q)return{mode:i,env:{token:r,password:s},config:t,native:{ok:!1,checkedAt:e,kind:"disabled",issue:"Native OpenClaw Gateway WS is disabled by environment configuration.",disabledByEnv:!0},envFile:u,recommendation:"Unset AGENTOS_OPENCLAW_GATEWAY_CLIENT/OPENCLAW_GATEWAY_CLIENT=cli or AGENTOS_OPENCLAW_NATIVE_WS=0, then restart AgentOS."};try{return await (a.nativeProbe??(()=>new m.gH().callNative("status",{},{timeoutMs:2500})))(),{mode:i,env:{token:r,password:s},config:t,native:{ok:!0,checkedAt:e,kind:null,issue:null,disabledByEnv:!1},envFile:u,recommendation:"Native OpenClaw Gateway WS auth is ready."}}catch(g){var v,w,x;let a,b,c,d=(0,p.n3)(g,"Native Gateway auth check failed."),f=(v=g,w=d,"auth"===(a=v?.kind)||"malformed-response"===a||"rate-limited"===a||"scope-limited"===a||"timeout"===a||"unreachable"===a||"unknown"===a?a:/auth|token|password|unauthorized|forbidden/i.test(w)?"auth":/scope|permission|not allowed/i.test(w)?"scope-limited":/(^|[^a-z])rate limit(?:ed)?\b|retry after|too many requests/i.test(w)?"rate-limited":/invalid json|malformed|schema|payload/i.test(w)?"malformed-response":/timed out|timeout/i.test(w)?"timeout":/connect|closed|unreachable|websocket/i.test(w)?"unreachable":"unknown");return{mode:i,env:{token:r,password:s},config:t,native:{ok:!1,checkedAt:e,kind:f,issue:d,disabledByEnv:!1},envFile:u,recommendation:(b=Object.values((x={kind:f,envToken:r,envPassword:s,config:t}).config).includes("redacted"),c=x.envToken||x.envPassword,"auth"===x.kind&&b&&!c?"Set AGENTOS_OPENCLAW_GATEWAY_TOKEN/PASSWORD or OPENCLAW_GATEWAY_TOKEN/PASSWORD in the AgentOS process environment, then restart AgentOS.":"auth"===x.kind?"Verify the Gateway token/password exported to the AgentOS process, then restart AgentOS.":"unreachable"===x.kind||"timeout"===x.kind?"Start or restart the OpenClaw Gateway, then test native auth again.":"rate-limited"===x.kind?"Wait for the Gateway cooldown to expire, then test native auth again.":"scope-limited"===x.kind?"Repair the local AgentOS device access request so native Gateway WS can use operator scopes. No manual secret entry is required.":"malformed-response"===x.kind?"Update OpenClaw or continue using CLI fallback until the Gateway contract matches AgentOS.":"Review Gateway diagnostics and continue using CLI fallback until native WS can authenticate.")}}async function y(a){try{let b=await f.getConfig(a,{timeoutMs:2500});return"string"==typeof b&&b.trim()?b.trim():null}catch{return null}}async function z(a){try{let b=await f.getConfig(a,{timeoutMs:2500});return R(b)}catch{return"unknown"}}}async function C(a){let b=a.value.trim();if(!b)throw Error("Gateway token/password is required.");if(b.length>4096)throw Error("Gateway token/password is too long.");let c=i.fh;if((0,i.eG)()||process.env[i.tj]?.trim()?await (0,i.Wy)({kind:a.kind,value:b}):c=r,!(0,i.eG)()){let d=(0,g.join)(a.cwd??process.cwd(),r),f=function(a,b,c){let d="token"===b?s:t,e="token"===b?t:s,f=`${d}=${JSON.stringify(c)}`,g=a.split(/\r?\n/),h=[],i=!1;for(let a of g){if(!a.trim()){h.push(a);continue}let b=a.match(/^\s*([A-Za-z_][A-Za-z0-9_]*)\s*=/)?.[1];if(b===d){i||(h.push(f),i=!0);continue}b!==e&&h.push(a)}return i||(h.some(a=>a.trim())&&h.at(-1)?.trim()&&h.push(""),h.push("# OpenClaw Gateway native WebSocket auth for AgentOS"),h.push(f)),`${h.join("\n").replace(/\n+$/,"")}
2
- `}(await P(d),a.kind,b);await (0,e.writeFile)(d,f,{encoding:"utf8",mode:384}),await (0,e.chmod)(d,384),c=r}return"token"===a.kind?(process.env[s]=b,delete process.env[t]):(process.env[t]=b,delete process.env[s]),(0,n.QL)("gateway auth credential updated"),{envFile:c,activeEnvName:"token"===a.kind?s:t,restartRecommended:!0}}async function D(a={}){let b=(0,d.randomBytes)(32).toString("base64url"),c=await (0,j.rw)().setConfig(u,"token",{timeoutMs:2500}),e=await (0,j.rw)().setConfig(v,b,{timeoutMs:2500}),f=await C({kind:"token",value:b,cwd:a.cwd}),g=!1,h=null,i=!1,k=null,l=function(a){let b=!1;for(let[e,f]of a){var c,d;if((c=e)===u||c===v)return!0;let a=function(a){let b=a.metadata?.openClawConfig;if(b&&"object"==typeof b&&!Array.isArray(b)){let a=b.reloadKind;if("restart"===a||"hot"===a||"none"===a)return a}try{let b=JSON.parse(a.stdout||"{}"),c=b.configMutation?.reloadKind;if("restart"===c||"hot"===c||"none"===c)return c}catch{}return"unknown"}(f);if("restart"===a)return!0;"unknown"===a&&("gateway.mode"===(d=e)||/^gateway\./.test(d)&&!/^gateway\.remote\./.test(d))&&(b=!0)}return b}([[u,c],[v,e]]);if(l){let a=await E();g=a.restarted,h=a.issue}if((k=await H(b,a.verifyNativeAuth,a.verifyDelaysMs))&&l){let c=await F();g=g||c.restarted,h=G(h,c.issue),c.restarted&&(k=await H(b,a.verifyNativeAuth,a.verifyDelaysMs))}return i=!k,y(),{envFile:f.envFile,activeEnvName:f.activeEnvName,restartRequired:l,restarted:g,restartIssue:h,verified:i,verificationIssue:k}}async function E(){try{return await (0,j.rw)().controlGateway("restart",{timeoutMs:2e4,force:!0}),(0,n.QL)("gateway auth token rotated"),await (0,h.setTimeout)(1250),{restarted:!0,issue:null}}catch(a){return{restarted:!1,issue:(0,p.n3)(a,"Gateway forced restart failed.")}}}async function F(){let a=null;try{await (0,j.rw)().controlGateway("stop",{timeoutMs:2e4}),await (0,h.setTimeout)(750)}catch(b){a=(0,p.n3)(b,"Gateway stop after token rotation failed.")}try{return await (0,j.rw)().controlGateway("start",{timeoutMs:2e4}),(0,n.QL)("gateway auth token rotation stop/start completed"),await (0,h.setTimeout)(1250),{restarted:!0,issue:a}}catch(b){return{restarted:!1,issue:G(a,(0,p.n3)(b,"Gateway start after token rotation failed."))}}}function G(a,b){return b?.trim()?a?`${a}
3
- ${b}`:b:a}async function H(a,b,c=w){let d=null,e=b??(a=>new m.gH({token:a}).callNative("status",{},{timeoutMs:2500}));for(let b of c.length>0?c:[0]){b>0&&await (0,h.setTimeout)(b);try{return await e(a),null}catch(a){d=(0,p.n3)(a,"Gateway auth verification failed.")}}return d}async function I(a={}){let b,c=a.readDeviceAuthToken??S,d=(b=Y(a.requiredScopes).filter(a=>/^operator\./.test(a))).length>0?Array.from(new Set(b)).sort():x,e=!1;try{await (a.nativeProbe??(()=>new m.gH().callNative("status",{},{timeoutMs:2500})))(),e=!0}catch{}let f=null,g=null,h={approved:!1,requestId:null,deviceId:null,scopes:[],envSynced:!1,activeEnvName:null,approvalIssue:null};try{var i;let b,e;b=(i=await (a.approveLatest??J)(d))&&"object"==typeof i?i.device:null,e=Y(b?.approvedScopes).length?Y(b?.approvedScopes):Y(b?.scopes),h={approved:!!b,requestId:X(i?.requestId),deviceId:X(b?.deviceId),scopes:e,envSynced:!1,activeEnvName:null,approvalIssue:null},g=await T()??await c()}catch(a){if(f=(0,p.n3)(a,"OpenClaw device approval failed."),g=await T()??await c(),!g?.token||!W(g.scopes,d))throw a;h={...h,approved:!0,scopes:g.scopes}}if(!h.approved&&e&&W(g?.scopes??[],d)&&(h={...h,approved:!0,scopes:g?.scopes??h.scopes}),h.approved&&W(g?.scopes??[],d)&&(h={...h,scopes:g?.scopes??h.scopes}),h.approved&&!W(g?.scopes??h.scopes,d))throw Error("OpenClaw device access was approved, but the local CLI device token was not updated with the required operator scopes.");return(0,n.QL)("gateway device access repaired"),y(),{...h,envSynced:!1,activeEnvName:null,approvalIssue:f}}async function J(a){return(0,j.rw)().approveDeviceAccess({latest:!0,scopes:a},{timeoutMs:1e4})}async function K(a){try{let b=await a.call("config.get",{},{timeoutMs:2500});return{snapshot:function(a){if(!N(a))return null;let b=N(a.config)?a.config:null,c=N(a.resolved)?a.resolved:null;return b||c?{config:b??{},resolved:c??{}}:null}(b),invalidConfig:!1}}catch(a){return{snapshot:null,invalidConfig:(0,o.D)(a)}}}function L(a,b){let c=M(a.config,b)??M(a.resolved,b);return void 0===c?null:c}function M(a,b){if(Object.hasOwn(a,b))return a[b];let c=a;for(let a of b.split(".")){if(!N(c)||!Object.hasOwn(c,a))return;c=c[a]}return c}function N(a){return!!a&&"object"==typeof a&&!Array.isArray(a)}async function O(a){if((0,i.eG)()){let a=await (0,i.lk)();return{path:(0,i.kz)(),token:a?.kind==="token",password:a?.kind==="password",gitignored:!0}}let b=(0,g.join)(a,r),c=await P(b),d=await P((0,g.join)(a,".gitignore"));return{path:r,token:Q(c,s),password:Q(c,t),gitignored:/^\.env\*?\.local$/m.test(d)||/^\.env\.local$/m.test(d)}}async function P(a){try{return await (0,e.readFile)(a,"utf8")}catch{return""}}function Q(a,b){return RegExp(`^\\s*${b}\\s*=`,"m").test(a)}function R(a){if(null==a)return"missing";if("string"!=typeof a)return"present";let b=a.trim();return b?"__OPENCLAW_REDACTED__"===b?"redacted":"present":"missing"}async function S(){let a=await P((0,g.join)(V(),"identity","device-auth.json"));if(!a.trim())return null;try{let b=JSON.parse(a),c=X(b.tokens?.operator?.token);if(!c)return null;return{token:c,scopes:Y(b.tokens?.operator?.scopes)}}catch{return null}}async function T(){let a=V(),b=await U((0,g.join)(a,"identity","device.json")),c=X(b?.deviceId);if(!c)return null;let d=await U((0,g.join)(a,"devices","paired.json")),f=d?.[c]?.tokens?.operator,h=X(f?.token),i=Y(f?.scopes);if(!h)return null;let j=(0,g.join)(a,"identity","device-auth.json"),k=await U(j),l=k?.deviceId===c&&k.tokens&&"object"==typeof k.tokens?{...k.tokens}:{};return l.operator={token:h,role:X(f?.role)??"operator",scopes:i,updatedAtMs:Date.now()},await (0,e.mkdir)((0,g.dirname)(j),{recursive:!0}),await (0,e.writeFile)(j,`${JSON.stringify({version:1,deviceId:c,tokens:l},null,2)}
4
- `,{encoding:"utf8",mode:384}),await (0,e.chmod)(j,384),{token:h,scopes:i}}async function U(a){let b=await P(a);if(!b.trim())return null;try{return JSON.parse(b)}catch{return null}}function V(){let a=process.env.OPENCLAW_STATE_DIR?.trim();return a?a.startsWith("~")?(0,g.join)((0,f.homedir)(),a.slice(1)):a:(0,g.join)((0,f.homedir)(),".openclaw")}function W(a,b=x){let c=new Set(a);return b.every(a=>c.has(a))}function X(a){return"string"==typeof a&&a.trim()?a.trim():null}function Y(a){return Array.isArray(a)?a.filter(a=>"string"==typeof a&&!!a.trim()):[]}}};
1
+ "use strict";exports.id=1718,exports.ids=[1718],exports.modules={1718:(a,b,c)=>{c.d(b,{MG:()=>C,MQ:()=>D,PR:()=>A,Vg:()=>z,W6:()=>B,f5:()=>I});var d=c(77598),e=c(51455),f=c(48161),g=c(76760),h=c(58500),i=c(14805),j=c(39503),k=c(4020),l=c(35456),m=c(95141),n=c(7565),o=c(78446),p=c(96972);let q="gateway.remote.url",r=".env.local",s="AGENTOS_OPENCLAW_GATEWAY_TOKEN",t="AGENTOS_OPENCLAW_GATEWAY_PASSWORD",u="gateway.auth.mode",v="gateway.auth.token",w=[0,500,1e3,1500,2500,3500],x=["operator.admin","operator.read","operator.write","operator.approvals","operator.pairing","operator.talk.secrets"];function y(){(0,k.ZZ)(),(0,k.b7)()}async function z(a){let b=(0,l.Zm)(a.gatewayUrl);return b?await (0,j.rw)().setConfig(q,b):await (0,j.rw)().hasConfig(q)&&await (0,j.rw)().unsetConfig(q),y(),(0,k.GM)({force:!0})}async function A(a){let b=(0,l.FU)(a.workspaceRoot),c={...await (0,l.tl)(),...b?{workspaceRoot:b}:{}};return b||delete c.workspaceRoot,await (0,l.wi)(c),y(),(0,k.GM)({force:!0})}async function B(a={}){let b,c=a.env??process.env,d=a.cwd??process.cwd(),e=(a.now??(()=>new Date))().toISOString(),f=(0,j.rw)(),g=await L(f),h=g.snapshot,[i,k,l,n,o]=h?["string"==typeof(b=M(h,"gateway.auth.mode"))&&b.trim()?b.trim():null,S(M(h,"gateway.auth.token")),S(M(h,"gateway.auth.password")),S(M(h,"gateway.remote.token")),S(M(h,"gateway.remote.password"))]:g.invalidConfig?[null,"unknown","unknown","unknown","unknown"]:await Promise.all([y("gateway.auth.mode"),z("gateway.auth.token"),z("gateway.auth.password"),z("gateway.remote.token"),z("gateway.remote.password")]),q=(a.isNativeDisabled??m.JG)(),r=!!(c.AGENTOS_OPENCLAW_GATEWAY_TOKEN?.trim()||c.OPENCLAW_GATEWAY_TOKEN?.trim()),s=!!(c.AGENTOS_OPENCLAW_GATEWAY_PASSWORD?.trim()||c.OPENCLAW_GATEWAY_PASSWORD?.trim()),t={authToken:k,authPassword:l,remoteToken:n,remotePassword:o},u=await P(d);if(q)return{mode:i,env:{token:r,password:s},config:t,native:{ok:!1,checkedAt:e,kind:"disabled",issue:"Native OpenClaw Gateway WS is disabled by environment configuration.",disabledByEnv:!0},envFile:u,recommendation:"Unset AGENTOS_OPENCLAW_GATEWAY_CLIENT/OPENCLAW_GATEWAY_CLIENT=cli or AGENTOS_OPENCLAW_NATIVE_WS=0, then restart AgentOS."};try{return await (a.nativeProbe??(()=>new m.gH().callNative("status",{},{timeoutMs:2500})))(),{mode:i,env:{token:r,password:s},config:t,native:{ok:!0,checkedAt:e,kind:null,issue:null,disabledByEnv:!1},envFile:u,recommendation:"Native OpenClaw Gateway WS auth is ready."}}catch(g){var v,w,x;let a,b,c,d=(0,p.n3)(g,"Native Gateway auth check failed."),f=(v=g,w=d,"auth"===(a=v?.kind)||"malformed-response"===a||"rate-limited"===a||"scope-limited"===a||"timeout"===a||"unreachable"===a||"unknown"===a?a:/auth|token|password|unauthorized|forbidden/i.test(w)?"auth":/scope|permission|not allowed/i.test(w)?"scope-limited":/(^|[^a-z])rate limit(?:ed)?\b|retry after|too many requests/i.test(w)?"rate-limited":/invalid json|malformed|schema|payload/i.test(w)?"malformed-response":/timed out|timeout/i.test(w)?"timeout":/connect|closed|unreachable|websocket/i.test(w)?"unreachable":"unknown");return{mode:i,env:{token:r,password:s},config:t,native:{ok:!1,checkedAt:e,kind:f,issue:d,disabledByEnv:!1},envFile:u,recommendation:(b=Object.values((x={kind:f,envToken:r,envPassword:s,config:t}).config).includes("redacted"),c=x.envToken||x.envPassword,"auth"===x.kind&&b&&!c?"Set AGENTOS_OPENCLAW_GATEWAY_TOKEN/PASSWORD or OPENCLAW_GATEWAY_TOKEN/PASSWORD in the AgentOS process environment, then restart AgentOS.":"auth"===x.kind?"Verify the Gateway token/password exported to the AgentOS process, then restart AgentOS.":"unreachable"===x.kind||"timeout"===x.kind?"Start or restart the OpenClaw Gateway, then test native auth again.":"rate-limited"===x.kind?"Wait for the Gateway cooldown to expire, then test native auth again.":"scope-limited"===x.kind?"Repair the local AgentOS device access request so native Gateway WS can use operator scopes. No manual secret entry is required.":"malformed-response"===x.kind?"Update OpenClaw or continue using CLI fallback until the Gateway contract matches AgentOS.":"Review Gateway diagnostics and continue using CLI fallback until native WS can authenticate.")}}async function y(a){try{let b=await f.getConfig(a,{timeoutMs:2500});return"string"==typeof b&&b.trim()?b.trim():null}catch{return null}}async function z(a){try{let b=await f.getConfig(a,{timeoutMs:2500});return S(b)}catch{return"unknown"}}}async function C(a){let b=a.value.trim();if(!b)throw Error("Gateway token/password is required.");if(b.length>4096)throw Error("Gateway token/password is too long.");let c=i.fh;if((0,i.eG)()||process.env[i.tj]?.trim()?await (0,i.Wy)({kind:a.kind,value:b}):c=r,!(0,i.eG)()){let d=(0,g.join)(a.cwd??process.cwd(),r),f=function(a,b,c){let d="token"===b?s:t,e="token"===b?t:s,f=`${d}=${JSON.stringify(c)}`,g=a.split(/\r?\n/),h=[],i=!1;for(let a of g){if(!a.trim()){h.push(a);continue}let b=a.match(/^\s*([A-Za-z_][A-Za-z0-9_]*)\s*=/)?.[1];if(b===d){i||(h.push(f),i=!0);continue}b!==e&&h.push(a)}return i||(h.some(a=>a.trim())&&h.at(-1)?.trim()&&h.push(""),h.push("# OpenClaw Gateway native WebSocket auth for AgentOS"),h.push(f)),`${h.join("\n").replace(/\n+$/,"")}
2
+ `}(await Q(d),a.kind,b);await (0,e.writeFile)(d,f,{encoding:"utf8",mode:384}),await (0,e.chmod)(d,384),c=r}return"token"===a.kind?(process.env[s]=b,delete process.env[t]):(process.env[t]=b,delete process.env[s]),(0,n.QL)("gateway auth credential updated"),{envFile:c,activeEnvName:"token"===a.kind?s:t,restartRecommended:!0}}async function D(a={}){let b=(0,d.randomBytes)(32).toString("base64url"),c=await (0,j.rw)().setConfig(u,"token",{timeoutMs:2500}),e=await (0,j.rw)().setConfig(v,b,{timeoutMs:2500}),f=await C({kind:"token",value:b,cwd:a.cwd}),g=!1,h=null,i=!1,k=null,l=function(a){let b=!1;for(let[e,f]of a){var c,d;if((c=e)===u||c===v)return!0;let a=function(a){let b=a.metadata?.openClawConfig;if(b&&"object"==typeof b&&!Array.isArray(b)){let a=b.reloadKind;if("restart"===a||"hot"===a||"none"===a)return a}try{let b=JSON.parse(a.stdout||"{}"),c=b.configMutation?.reloadKind;if("restart"===c||"hot"===c||"none"===c)return c}catch{}return"unknown"}(f);if("restart"===a)return!0;"unknown"===a&&("gateway.mode"===(d=e)||/^gateway\./.test(d)&&!/^gateway\.remote\./.test(d))&&(b=!0)}return b}([[u,c],[v,e]]);if(l){let a=await E();g=a.restarted,h=a.issue}if((k=await H(b,a.verifyNativeAuth,a.verifyDelaysMs))&&l){let c=await F();g=g||c.restarted,h=G(h,c.issue),c.restarted&&(k=await H(b,a.verifyNativeAuth,a.verifyDelaysMs))}return i=!k,y(),{envFile:f.envFile,activeEnvName:f.activeEnvName,restartRequired:l,restarted:g,restartIssue:h,verified:i,verificationIssue:k}}async function E(){try{return await (0,j.rw)().controlGateway("restart",{timeoutMs:2e4,force:!0}),(0,n.QL)("gateway auth token rotated"),await (0,h.setTimeout)(1250),{restarted:!0,issue:null}}catch(a){return{restarted:!1,issue:(0,p.n3)(a,"Gateway forced restart failed.")}}}async function F(){let a=null;try{await (0,j.rw)().controlGateway("stop",{timeoutMs:2e4}),await (0,h.setTimeout)(750)}catch(b){a=(0,p.n3)(b,"Gateway stop after token rotation failed.")}try{return await (0,j.rw)().controlGateway("start",{timeoutMs:2e4}),(0,n.QL)("gateway auth token rotation stop/start completed"),await (0,h.setTimeout)(1250),{restarted:!0,issue:a}}catch(b){return{restarted:!1,issue:G(a,(0,p.n3)(b,"Gateway start after token rotation failed."))}}}function G(a,b){return b?.trim()?a?`${a}
3
+ ${b}`:b:a}async function H(a,b,c=w){let d=null,e=b??(a=>new m.gH({token:a}).callNative("status",{},{timeoutMs:2500}));for(let b of c.length>0?c:[0]){b>0&&await (0,h.setTimeout)(b);try{return await e(a),null}catch(a){d=(0,p.n3)(a,"Gateway auth verification failed.")}}return d}async function I(a={}){let b,c=a.readDeviceAuthToken??T,d=(b=Z(a.requiredScopes).filter(a=>/^operator\./.test(a))).length>0?Array.from(new Set(b)).sort():x,e=a.nativeProbe??K,f=!1;try{await e(),f=!0}catch{}let g=null,h=null,i={approved:!1,requestId:null,deviceId:null,scopes:[],envSynced:!1,activeEnvName:null,approvalIssue:null};try{var j;let b,e;b=(j=await (a.approveLatest??J)(d))&&"object"==typeof j?j.device:null,e=Z(b?.approvedScopes).length?Z(b?.approvedScopes):Z(b?.scopes),i={approved:!!b,requestId:Y(j?.requestId),deviceId:Y(b?.deviceId),scopes:e,envSynced:!1,activeEnvName:null,approvalIssue:null},h=await U()??await c()}catch(a){if(g=(0,p.n3)(a,"OpenClaw device approval failed."),h=await U()??await c(),h?.token&&X(h.scopes,d))i={...i,approved:!0,scopes:h.scopes};else{if(!f)throw a;i={...i,approved:!0,scopes:d}}}if(!i.approved&&f&&X(h?.scopes??[],d)&&(i={...i,approved:!0,scopes:h?.scopes??i.scopes}),i.approved&&X(h?.scopes??[],d)&&(i={...i,scopes:h?.scopes??i.scopes}),i.approved&&!X(h?.scopes??i.scopes,d)){let a=f;if(!a)try{await e(),a=!0}catch{a=!1}if(!a)throw Error("OpenClaw device access was approved, but the local CLI device token was not updated with the required operator scopes.");i={...i,scopes:d},g??="OpenClaw approved native Gateway access, but the local CLI device token has not reported every requested operator scope yet."}return(0,n.QL)("gateway device access repaired"),y(),{...i,envSynced:!1,activeEnvName:null,approvalIssue:g}}async function J(a){return(0,j.rw)().approveDeviceAccess({latest:!0,scopes:a},{timeoutMs:1e4})}async function K(){let a=new m.gH;try{return await a.callNative("status",{},{timeoutMs:2500})}finally{a.close("gateway device access repair probe completed")}}async function L(a){try{let b=await a.call("config.get",{},{timeoutMs:2500});return{snapshot:function(a){if(!O(a))return null;let b=O(a.config)?a.config:null,c=O(a.resolved)?a.resolved:null;return b||c?{config:b??{},resolved:c??{}}:null}(b),invalidConfig:!1}}catch(a){return{snapshot:null,invalidConfig:(0,o.D)(a)}}}function M(a,b){let c=N(a.config,b)??N(a.resolved,b);return void 0===c?null:c}function N(a,b){if(Object.hasOwn(a,b))return a[b];let c=a;for(let a of b.split(".")){if(!O(c)||!Object.hasOwn(c,a))return;c=c[a]}return c}function O(a){return!!a&&"object"==typeof a&&!Array.isArray(a)}async function P(a){if((0,i.eG)()){let a=await (0,i.lk)();return{path:(0,i.kz)(),token:a?.kind==="token",password:a?.kind==="password",gitignored:!0}}let b=(0,g.join)(a,r),c=await Q(b),d=await Q((0,g.join)(a,".gitignore"));return{path:r,token:R(c,s),password:R(c,t),gitignored:/^\.env\*?\.local$/m.test(d)||/^\.env\.local$/m.test(d)}}async function Q(a){try{return await (0,e.readFile)(a,"utf8")}catch{return""}}function R(a,b){return RegExp(`^\\s*${b}\\s*=`,"m").test(a)}function S(a){if(null==a)return"missing";if("string"!=typeof a)return"present";let b=a.trim();return b?"__OPENCLAW_REDACTED__"===b?"redacted":"present":"missing"}async function T(){let a=await Q((0,g.join)(W(),"identity","device-auth.json"));if(!a.trim())return null;try{let b=JSON.parse(a),c=Y(b.tokens?.operator?.token);if(!c)return null;return{token:c,scopes:Z(b.tokens?.operator?.scopes)}}catch{return null}}async function U(){let a=W(),b=await V((0,g.join)(a,"identity","device.json")),c=Y(b?.deviceId);if(!c)return null;let d=await V((0,g.join)(a,"devices","paired.json")),f=d?.[c]?.tokens?.operator,h=Y(f?.token),i=Z(f?.scopes);if(!h)return null;let j=(0,g.join)(a,"identity","device-auth.json"),k=await V(j),l=k?.deviceId===c&&k.tokens&&"object"==typeof k.tokens?{...k.tokens}:{};return l.operator={token:h,role:Y(f?.role)??"operator",scopes:i,updatedAtMs:Date.now()},await (0,e.mkdir)((0,g.dirname)(j),{recursive:!0}),await (0,e.writeFile)(j,`${JSON.stringify({version:1,deviceId:c,tokens:l},null,2)}
4
+ `,{encoding:"utf8",mode:384}),await (0,e.chmod)(j,384),{token:h,scopes:i}}async function V(a){let b=await Q(a);if(!b.trim())return null;try{return JSON.parse(b)}catch{return null}}function W(){let a=process.env.OPENCLAW_STATE_DIR?.trim();return a?a.startsWith("~")?(0,g.join)((0,f.homedir)(),a.slice(1)):a:(0,g.join)((0,f.homedir)(),".openclaw")}function X(a,b=x){let c=new Set(a);return b.every(a=>c.has(a))}function Y(a){return"string"==typeof a&&a.trim()?a.trim():null}function Z(a){return Array.isArray(a)?a.filter(a=>"string"==typeof a&&!!a.trim()):[]}}};