@vibe-lark/larkpal 0.1.88 → 0.1.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-id-BM1T6029-BzQ_cMoi.mjs → account-id-BM1T6029-BvcZ99G0.mjs} +1 -1
- package/dist/{activation-context--5yu1dPF-XV0Y0pTy.mjs → activation-context--5yu1dPF-DHM2x52-.mjs} +1 -1
- package/dist/{anthropic-CFZUCb1w.mjs → anthropic-gnoZ_QRy.mjs} +1 -1
- package/dist/{assistant-visible-text-DuFWokAt-BOJV_zwc.mjs → assistant-visible-text-DuFWokAt-GbRm46te.mjs} +1 -1
- package/dist/{azure-openai-responses-BEuiMaF-.mjs → azure-openai-responses-DbHzq7dt.mjs} +1 -1
- package/dist/{boundary-file-read-BSd9MXPy-gnNVhPKT.mjs → boundary-file-read-BSd9MXPy-Tpd4W7aA.mjs} +1 -1
- package/dist/{browser-lifecycle-cleanup-BdNsMhMD-BM97qA_M.mjs → browser-lifecycle-cleanup-BdNsMhMD-Bjf5GI3L.mjs} +1 -1
- package/dist/{bundled-compat-BpaDaAAu-DJtrIX6i.mjs → bundled-compat-BpaDaAAu-DElY7pj-.mjs} +1 -1
- package/dist/{bundled-dir-U738ay4K-BxbzrJOo.mjs → bundled-dir-U738ay4K-DxHVp4u1.mjs} +1 -1
- package/dist/{call-DimWbpgJ-B4pv55RH.mjs → call-DimWbpgJ-BnglLl-j.mjs} +1 -1
- package/dist/channel-bootstrap.runtime-BVclcGv1-BH-3XviM.mjs +1 -0
- package/dist/{channel-bootstrap.runtime-Cwcr38m2-Dt6QlQkX.mjs → channel-bootstrap.runtime-Cwcr38m2-K7QN0kxA.mjs} +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/{command-format-LSnUCVVF-Dn4h9IOh.mjs → command-format-LSnUCVVF-Ck0yuZRk.mjs} +1 -1
- package/dist/config-Bim2pi8a-xbw-saVR.mjs +1 -0
- package/dist/config-CtxZK_ZE.mjs +2 -0
- package/dist/{delivery-context.shared-j5hC5qb1-BSLQG47q.mjs → delivery-context.shared-j5hC5qb1-DIY5v1oC.mjs} +1 -1
- package/dist/{diagnostic-ClMwNnUA-BMKvPQJT.mjs → diagnostic-ClMwNnUA-BLmizo4w.mjs} +1 -1
- package/dist/{dist-coestTs9.mjs → dist-BUE_cxIa.mjs} +1 -1
- package/dist/{dist-J5UB83Ws.mjs → dist-Drhg3yZT.mjs} +1 -1
- package/dist/{facade-loader-DFzIYYt_-4bzFvy-b.mjs → facade-loader-DFzIYYt_--SN2-DQM.mjs} +1 -1
- package/dist/{google-ABo-1guT.mjs → google-BdoIr_xq.mjs} +1 -1
- package/dist/{google-gemini-cli-CGlN1zUA.mjs → google-gemini-cli-H9jO3Mvn.mjs} +1 -1
- package/dist/{google-shared-C60sNhwd.mjs → google-shared-DDK4NMAJ.mjs} +2 -2
- package/dist/{google-vertex-De0nAItu.mjs → google-vertex-B_OTGKnl.mjs} +1 -1
- package/dist/{ids-BPsM98Uu-CJBJAeVC.mjs → ids-BPsM98Uu-DGJB5aAM.mjs} +1 -1
- package/dist/{image-2w3cApg7-CrpUMCvm.mjs → image-2w3cApg7-B_-Jsk_m.mjs} +1 -1
- package/dist/interactive-init-CzbT0dDB.mjs +8 -0
- package/dist/{io-CH2g3vsv-JJtUIa_U.mjs → io-CH2g3vsv-BevbMdi6.mjs} +1 -1
- package/dist/{jiti-loader-cache-Bat69wam-DNIteTtO.mjs → jiti-loader-cache-Bat69wam-Cq2EONsH.mjs} +1 -1
- package/dist/{live-smoke-DpURW676.mjs → live-smoke-Be7Fzqj0.mjs} +18 -18
- package/dist/load-context-mb7uvLSn-C6DFwEWN.mjs +1 -0
- package/dist/{loader-708jrx4Y-BbJRXNlQ.mjs → loader-708jrx4Y-eFvaGnCt.mjs} +1 -1
- package/dist/main.mjs +86 -86
- package/dist/{manifest-registry-_hxKCS2K-OL8KK_o4.mjs → manifest-registry-_hxKCS2K-ezh_x2Cu.mjs} +1 -1
- package/dist/{message-channel-Bk_YHfQg-n2Hw2Y0L.mjs → message-channel-Bk_YHfQg-BGBJVvRK.mjs} +1 -1
- package/dist/{message-channel-core-DTA--Gjh-CIh10vfo.mjs → message-channel-core-DTA--Gjh-DeWCDZu1.mjs} +1 -1
- package/dist/message.config.runtime-K-k4XOyq-JWPtRES_.mjs +1 -0
- package/dist/message.gateway.runtime-DqHOHRTQ-BeYUdgSg.mjs +1 -0
- package/dist/{mistral-DyL3Zo1b.mjs → mistral-zWGv0zHS.mjs} +1 -1
- package/dist/{model-auth-env-oyg2Hexc-DJbt9J3o.mjs → model-auth-env-oyg2Hexc-B5WQGZqf.mjs} +1 -1
- package/dist/{models-config-BmpSQJQF-BL6S5qAo.mjs → models-config-BmpSQJQF-Bwnt6IgA.mjs} +1 -1
- package/dist/models-config.runtime-DkQfNKqN.mjs +1 -0
- package/dist/{multipart-parser-B9dwXBqu.mjs → multipart-parser-D_0C82Yv.mjs} +1 -1
- package/dist/{oauth-25y2wc7K.mjs → oauth-TYJ7I-Cs.mjs} +1 -1
- package/dist/{openai-codex-responses-BbyAPsP1.mjs → openai-codex-responses-CJA9360v.mjs} +1 -1
- package/dist/{openai-completions-Bu5qvQzb.mjs → openai-completions-BfXo7VuS.mjs} +1 -1
- package/dist/{openai-responses-pIdwQBc4.mjs → openai-responses-BH-GaE-g.mjs} +1 -1
- package/dist/{openai-responses-shared-DqW1JSux.mjs → openai-responses-shared-DHm7pNQU.mjs} +1 -1
- package/dist/{paths-D6msg0S1-BO4XgM1u.mjs → paths-D6msg0S1-C3GtW9t2.mjs} +1 -1
- package/dist/{paths-D92DjaZ--DdtJ-zYp.mjs → paths-D92DjaZ--CKAvIWoZ.mjs} +1 -1
- package/dist/{pi-model-discovery-Bd0TWzo8-DvSM0eWu.mjs → pi-model-discovery-Bd0TWzo8-DcalEcic.mjs} +1 -1
- package/dist/{pi-model-discovery-runtime-PrjWOmsV.mjs → pi-model-discovery-runtime-DnW_CaR2.mjs} +1 -1
- package/dist/{pi-tools.before-tool-call.runtime-Bn7uqKie-WPxU5oNX.mjs → pi-tools.before-tool-call.runtime-Bn7uqKie-CitpH_Lv.mjs} +1 -1
- package/dist/{plugin-auto-enable-DdH3n9V8-Dr_bUXkG.mjs → plugin-auto-enable-DdH3n9V8-Dd9H4luQ.mjs} +1 -1
- package/dist/{provider-discovery.runtime-DY0VWQ81.mjs → provider-discovery.runtime-CVft4TR0.mjs} +1 -1
- package/dist/{provider-model-compat-CFqcq0it-BUwZENrz.mjs → provider-model-compat-CFqcq0it-W6mE-T-j.mjs} +1 -1
- package/dist/{provider-runtime-C8rljsNs-BDvu6FW3.mjs → provider-runtime-C8rljsNs-BGpzSHUk.mjs} +1 -1
- package/dist/{provider-runtime-CT50mNIX-DImw7ZZu.mjs → provider-runtime-CT50mNIX-CC3WVtfL.mjs} +1 -1
- package/dist/{provider-stream-COLujAAo-Dpq1DSIk.mjs → provider-stream-COLujAAo-BtNcIBP4.mjs} +1 -1
- package/dist/{providers.runtime-Ba7tOlq7-B4t6ywCr.mjs → providers.runtime-Ba7tOlq7-CX4GoaJL.mjs} +1 -1
- package/dist/{public-surface-loader-BVl0NQAE-TfJ3izj1.mjs → public-surface-loader-BVl0NQAE-CTXfgfHE.mjs} +1 -1
- package/dist/{resolve-C33B7eeu-DZM_z6Wr.mjs → resolve-C33B7eeu-DhMVJCKm.mjs} +1 -1
- package/dist/{runtime-Cym-fqI8-1GOIuRRQ.mjs → runtime-Cym-fqI8-BuiEWXF-.mjs} +1 -1
- package/dist/{runtime-snapshot-C54O1-gI-DxusscPf.mjs → runtime-snapshot-C54O1-gI-0r2omPvJ.mjs} +1 -1
- package/dist/{runtime-web-tools-fallback.runtime-Ca-qn1mj-BsYE2gOd.mjs → runtime-web-tools-fallback.runtime-Ca-qn1mj-C5hD_aI-.mjs} +1 -1
- package/dist/runtime-web-tools-manifest.runtime-BgxQTjmq-BTi3YQxK.mjs +1 -0
- package/dist/runtime-web-tools-public-artifacts.runtime-D9qcoWIX-DNaDY4zG.mjs +1 -0
- package/dist/{session-archive.runtime-B52_5vs4-cU2tYbBz.mjs → session-archive.runtime-B52_5vs4-CUKEEsvr.mjs} +1 -1
- package/dist/{session-key-Cn2QoOyX-QZeYmbxd.mjs → session-key-Cn2QoOyX-BIh-9Y77.mjs} +1 -1
- package/dist/{session-transcript-files.fs-DEeFXruQ-CXIAFSsr.mjs → session-transcript-files.fs-DEeFXruQ-Dh_OJado.mjs} +1 -1
- package/dist/{src-CCDx_C-U.mjs → src-C9CsRdwI.mjs} +1 -1
- package/dist/{subagent-announce-L5WsQatW--rMn240x.mjs → subagent-announce-L5WsQatW-DyZFJvpK.mjs} +1 -1
- package/dist/{subagent-announce.registry.runtime-DiqZyeTs-DNfNHsls.mjs → subagent-announce.registry.runtime-DiqZyeTs-WCL-itg8.mjs} +1 -1
- package/dist/{subagent-registry-steer-runtime-DFgZFC0j-XYS1_qwl.mjs → subagent-registry-steer-runtime-DFgZFC0j-BlxUMPcM.mjs} +1 -1
- package/dist/{subagent-system-prompt-C1qnN--K-CsU4f97T.mjs → subagent-system-prompt-C1qnN--K-bhNPmt0u.mjs} +1 -1
- package/dist/{target-parsing-loaded-DKkb6jJY-B830OA1a.mjs → target-parsing-loaded-DKkb6jJY-Bx7-SykE.mjs} +1 -1
- package/dist/{task-registry-delivery-runtime-Dd1CUkZF-B2Hj2k8C.mjs → task-registry-delivery-runtime-Dd1CUkZF-xNioBd-k.mjs} +2 -2
- package/dist/task-registry-delivery-runtime-ragbeVx5-BXczubuw.mjs +1 -0
- package/dist/{transcript-E_-ISOkD-VTwb782D.mjs → transcript-E_-ISOkD-STFNoSGx.mjs} +2 -2
- package/dist/transcript.runtime-BqhvZZdl-BLeKq_RO.mjs +1 -0
- package/dist/{web-provider-public-artifacts-BlpRwIUS-DbVhDOrY.mjs → web-provider-public-artifacts-BlpRwIUS-CjacPoGF.mjs} +1 -1
- package/dist/{web-search-providers.runtime--0aUtC3b-Bjh4Bmrz.mjs → web-search-providers.runtime--0aUtC3b-EcJfEKJo.mjs} +1 -1
- package/package.json +1 -1
- package/dist/channel-bootstrap.runtime-BVclcGv1-CEZ0-JP9.mjs +0 -1
- package/dist/config-Bim2pi8a-03N-28sw.mjs +0 -1
- package/dist/interactive-init-C5MFL5MW.mjs +0 -8
- package/dist/load-context-mb7uvLSn-3xYwSnOZ.mjs +0 -1
- package/dist/message.config.runtime-K-k4XOyq-F_h0Cgkl.mjs +0 -1
- package/dist/message.gateway.runtime-DqHOHRTQ-ge4c5p4s.mjs +0 -1
- package/dist/models-config.runtime-SOhLEw-f.mjs +0 -1
- package/dist/runtime-web-tools-manifest.runtime-BgxQTjmq-P6MKP9gQ.mjs +0 -1
- package/dist/runtime-web-tools-public-artifacts.runtime-D9qcoWIX-5VoyjouO.mjs +0 -1
- package/dist/task-registry-delivery-runtime-ragbeVx5-Bdvo2Q5u.mjs +0 -1
- package/dist/transcript.runtime-BqhvZZdl-B4E0TiX5.mjs +0 -1
- /package/dist/{build-Bkj0hOS2.mjs → build-DSSm_dj2.mjs} +0 -0
- /package/dist/{env-api-keys-Cuz5irWW.mjs → env-api-keys-qlOAYu08.mjs} +0 -0
- /package/dist/{event-stream-B7Ei41Bu.mjs → event-stream-JP51qlT7.mjs} +0 -0
- /package/dist/{from-Ba69_5cR.mjs → from-BmSefSMV.mjs} +0 -0
- /package/dist/{gateway-method-policy-C7rf0SeV-CTJcMQCE.mjs → gateway-method-policy-C7rf0SeV-DXbYlbpG.mjs} +0 -0
- /package/dist/{github-copilot-headers-BfhryVuU.mjs → github-copilot-headers-BQ2T2OVX.mjs} +0 -0
- /package/dist/{hash-Dw-N8Y9l.mjs → hash-DtceYjXb.mjs} +0 -0
- /package/dist/{headers-Bpsp70B9.mjs → headers-KsIWdB9S.mjs} +0 -0
- /package/dist/{home-dir-C44RaPME-B5iLWwCq.mjs → home-dir-C44RaPME-BqOMy1pu.mjs} +0 -0
- /package/dist/{json-file-BQRNuxmK-hRjIgOXI.mjs → json-file-BQRNuxmK-DQHpAzI5.mjs} +0 -0
- /package/dist/{json-parse-BESd8UAM.mjs → json-parse-BJPqxncf.mjs} +0 -0
- /package/dist/{jws-YaZ38F_i.mjs → jws-EKtyH_je.mjs} +0 -0
- /package/dist/{lark-cli-provider-BLMxH6CN.mjs → lark-cli-provider-DrGmcwiB.mjs} +0 -0
- /package/dist/{openai-C-rgGb7X.mjs → openai-D-MIrxrj.mjs} +0 -0
- /package/dist/{process-scoped-map-B2cWkYET-Co-i-MXA.mjs → process-scoped-map-B2cWkYET-Bc7DvrUZ.mjs} +0 -0
- /package/dist/{runtime-channel-state-CohMybAh-BBzhl07Q.mjs → runtime-channel-state-CohMybAh-DfCjeyJq.mjs} +0 -0
- /package/dist/{runtime-state-IBOIXKOx-Cw1GA1td.mjs → runtime-state-IBOIXKOx-Cr97WVOr.mjs} +0 -0
- /package/dist/{src-DACmA9V6.mjs → src-5lm1WxWm.mjs} +0 -0
- /package/dist/{thinking-Bh-7MqXz-uApNUe6g.mjs → thinking-Bh-7MqXz-BB7ZJReA.mjs} +0 -0
- /package/dist/{transform-messages-BTA3xbAI.mjs → transform-messages-B6RF0Czv.mjs} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./home-dir-C44RaPME-
|
|
1
|
+
import{o as e}from"./home-dir-C44RaPME-BqOMy1pu.mjs";import{s as t}from"./paths-D92DjaZ--CKAvIWoZ.mjs";const n=`default`,r=/^[a-z0-9][a-z0-9_-]{0,63}$/i,i=/[^a-z0-9_-]+/g,a=/^-+/,o=/-+$/,s=new Map,c=new Map;function l(t){let n=e(t);return r.test(t)?n:n.replace(i,`-`).replace(a,``).replace(o,``).slice(0,64)}function u(e){let n=l(e);if(!(!n||t(n)))return n}function d(e){let t=(e??``).trim();if(!t)return n;let r=s.get(t);if(r)return r;let i=u(t)||`default`;return p(s,t,i),i}function f(e){let t=(e??``).trim();if(!t)return;if(c.has(t))return c.get(t);let n=u(t)||void 0;return p(c,t,n),n}function p(e,t,n){if(e.set(t,n),e.size<=512)return;let r=e.keys().next();r.done||e.delete(r.value)}export{d as n,f as r,n as t};
|
package/dist/{activation-context--5yu1dPF-XV0Y0pTy.mjs → activation-context--5yu1dPF-DHM2x52-.mjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e,n as t,r as n,t as r,x as i}from"./bundled-compat-BpaDaAAu-
|
|
1
|
+
import{S as e,n as t,r as n,t as r,x as i}from"./bundled-compat-BpaDaAAu-DElY7pj-.mjs";import{t as a}from"./plugin-auto-enable-DdH3n9V8-Dd9H4luQ.mjs";function o(e){if(e.pluginIds.length===0)return e.config;let t=new Set(e.config?.plugins?.allow??[]),n={...e.config?.plugins?.entries};for(let r of e.pluginIds){let i=r.trim();if(!i)continue;t.add(i);let a=n[i];n[i]={...a,enabled:a?.enabled!==!1||e.overrideExplicitDisable===!0}}let r=e.overrideGlobalDisable===!0&&e.config?.plugins?.enabled===!1;return{...e.config,plugins:{...e.config?.plugins,...r?{enabled:!0}:{},...t.size>0?{allow:[...t]}:{},entries:n}}}function s(e){let i=e.compat?.allowlistPluginIds?.length?r({config:e.config,pluginIds:e.compat.allowlistPluginIds}):e.config,a=e.compat?.enablementPluginIds?.length?t({config:i,pluginIds:e.compat.enablementPluginIds}):i;return e.compat?.vitestPluginIds?.length?n({config:a,pluginIds:e.compat.vitestPluginIds,env:e.env}):a}function c(e){return e.allowlistCompatEnabled||e.compatMode.enablement===`always`||e.compatMode.enablement===`allowlist`&&e.allowlistCompatEnabled||e.compatMode.vitest===!0}function l(e){return{allowlistPluginIds:e.allowlistCompatEnabled?e.compatPluginIds:void 0,enablementPluginIds:e.compatMode.enablement===`always`||e.compatMode.enablement===`allowlist`&&e.allowlistCompatEnabled?e.compatPluginIds:void 0,vitestPluginIds:e.compatMode.vitest?e.compatPluginIds:void 0}}function u(t){let n=t.env??process.env,r=t.rawConfig??t.resolvedConfig,o=t.resolvedConfig??t.rawConfig,s=t.autoEnabledReasons;if(t.applyAutoEnable&&r!==void 0){let e=a({config:r,env:n});o=e.config,s=e.autoEnabledReasons}return{rawConfig:r,config:o,normalized:e(o?.plugins),activationSourceConfig:r,activationSource:i({config:r}),autoEnabledReasons:s??{}}}function d(t){let n=t.env??process.env,r=u({rawConfig:t.rawConfig,resolvedConfig:t.resolvedConfig,autoEnabledReasons:t.autoEnabledReasons,env:n,applyAutoEnable:t.applyAutoEnable}),i=s({config:r.config,compat:t.compat,env:n});return{rawConfig:r.rawConfig,config:i,normalized:e(i?.plugins),activationSourceConfig:r.activationSourceConfig,activationSource:r.activationSource,autoEnabledReasons:r.autoEnabledReasons}}function f(e){let t=u({rawConfig:e.rawConfig,resolvedConfig:e.resolvedConfig,autoEnabledReasons:e.autoEnabledReasons,env:e.env,applyAutoEnable:e.applyAutoEnable}),n=e.compatMode.allowlist===!0,r=c({compatMode:e.compatMode,allowlistCompatEnabled:n})?e.resolveCompatPluginIds({config:t.config,workspaceDir:e.workspaceDir,env:e.env,onlyPluginIds:e.onlyPluginIds}):[];return{...d({rawConfig:t.rawConfig,resolvedConfig:t.config,autoEnabledReasons:t.autoEnabledReasons,env:e.env,compat:l({compatMode:e.compatMode,allowlistCompatEnabled:n,compatPluginIds:r})}),compatPluginIds:r}}function p(e){let t=e.env??process.env,n=e.rawConfig??e.resolvedConfig,r=e.resolvedConfig??e.rawConfig,i=e.autoEnabledReasons??{};if(e.applyAutoEnable&&n!==void 0){let e=a({config:n,env:t});r=e.config,i=e.autoEnabledReasons}let o=e.compatMode.allowlist===!0,u=c({compatMode:e.compatMode,allowlistCompatEnabled:o})?e.resolveCompatPluginIds({config:r,workspaceDir:e.workspaceDir,env:t,onlyPluginIds:e.onlyPluginIds}):[];return{rawConfig:n,config:s({config:r,compat:l({compatMode:e.compatMode,allowlistCompatEnabled:o,compatPluginIds:u}),env:t}),activationSourceConfig:n,autoEnabledReasons:i,compatPluginIds:u}}export{p as n,o as r,f as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./env-api-keys-
|
|
1
|
+
import{t as e}from"./env-api-keys-qlOAYu08.mjs";import{r as t,t as n}from"./event-stream-JP51qlT7.mjs";import{n as r,t as i}from"./json-parse-BJPqxncf.mjs";import{t as a}from"./headers-KsIWdB9S.mjs";import{a as o,n as s,r as c,t as l}from"./transform-messages-B6RF0Czv.mjs";import{n as u,t as ee}from"./github-copilot-headers-BQ2T2OVX.mjs";function d(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function f(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}let p=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return p=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^n()&15>>e/4).toString(16))};function m(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}const h=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)};var g=class extends Error{},_=class e extends g{constructor(t,n,r,i,a){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`request-id`),this.error=n,this.type=a??null}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new te({message:r,cause:h(n)});let a=n,o=a?.error?.type;return t===400?new re(t,a,r,i,o):t===401?new ie(t,a,r,i,o):t===403?new ae(t,a,r,i,o):t===404?new oe(t,a,r,i,o):t===409?new se(t,a,r,i,o):t===422?new ce(t,a,r,i,o):t===429?new le(t,a,r,i,o):t>=500?new ue(t,a,r,i,o):new e(t,a,r,i,o)}},v=class extends _{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},te=class extends _{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},ne=class extends te{constructor({message:e}={}){super({message:e??`Request timed out.`})}},re=class extends _{},ie=class extends _{},ae=class extends _{},oe=class extends _{},se=class extends _{},ce=class extends _{},le=class extends _{},ue=class extends _{};const de=/^[a-z][a-z0-9+.-]*:/i,fe=e=>de.test(e);let pe=e=>(pe=Array.isArray,pe(e)),me=pe;function he(e){return typeof e==`object`?e??{}:{}}function ge(e){if(!e)return!0;for(let t in e)return!1;return!0}function _e(e,t){return Object.prototype.hasOwnProperty.call(e,t)}const ve=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new g(`${e} must be an integer`);if(t<0)throw new g(`${e} must be a positive integer`);return t},ye=e=>{try{return JSON.parse(e)}catch{return}},be=e=>new Promise(t=>setTimeout(t,e)),y=`0.90.0`,xe=()=>typeof window<`u`&&window.document!==void 0&&typeof navigator<`u`;function Se(){return typeof Deno<`u`&&Deno.build!=null?`deno`:typeof EdgeRuntime<`u`?`edge`:Object.prototype.toString.call(globalThis.process===void 0?0:globalThis.process)===`[object process]`?`node`:`unknown`}const Ce=()=>{let e=Se();if(e===`deno`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":y,"X-Stainless-OS":Ee(Deno.build.os),"X-Stainless-Arch":Te(Deno.build.arch),"X-Stainless-Runtime":`deno`,"X-Stainless-Runtime-Version":typeof Deno.version==`string`?Deno.version:Deno.version?.deno??`unknown`};if(typeof EdgeRuntime<`u`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":y,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":`edge`,"X-Stainless-Runtime-Version":globalThis.process.version};if(e===`node`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":y,"X-Stainless-OS":Ee(globalThis.process.platform??`unknown`),"X-Stainless-Arch":Te(globalThis.process.arch??`unknown`),"X-Stainless-Runtime":`node`,"X-Stainless-Runtime-Version":globalThis.process.version??`unknown`};let t=we();return t?{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":y,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":y,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`unknown`,"X-Stainless-Runtime-Version":`unknown`}};function we(){if(typeof navigator>`u`||!navigator)return null;for(let{key:e,pattern:t}of[{key:`edge`,pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`chrome`,pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`firefox`,pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`safari`,pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}]){let n=t.exec(navigator.userAgent);if(n)return{browser:e,version:`${n[1]||0}.${n[2]||0}.${n[3]||0}`}}return null}const Te=e=>e===`x32`?`x32`:e===`x86_64`||e===`x64`?`x64`:e===`arm`?`arm`:e===`aarch64`||e===`arm64`?`arm64`:e?`other:${e}`:`unknown`,Ee=e=>(e=e.toLowerCase(),e.includes(`ios`)?`iOS`:e===`android`?`Android`:e===`darwin`?`MacOS`:e===`win32`?`Windows`:e===`freebsd`?`FreeBSD`:e===`openbsd`?`OpenBSD`:e===`linux`?`Linux`:e?`Other:${e}`:`Unknown`);let De;const Oe=()=>De??=Ce();function ke(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function Ae(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function je(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return Ae({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function Me(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function Ne(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}const Pe=({headers:e,body:t})=>({bodyHeaders:{"content-type":`application/json`},body:JSON.stringify(t)});function Fe(e){return Object.entries(e).filter(([e,t])=>t!==void 0).map(([e,t])=>{if(typeof t==`string`||typeof t==`number`||typeof t==`boolean`)return`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(t===null)return`${encodeURIComponent(e)}=`;throw new g(`Cannot stringify type ${typeof t}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join(`&`)}function Ie(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}let Le;function Re(e){let t;return(Le??=(t=new globalThis.TextEncoder,t.encode.bind(t)))(e)}let ze;function Be(e){let t;return(ze??=(t=new globalThis.TextDecoder,t.decode.bind(t)))(e)}var b,x,S=class{constructor(){b.set(this,void 0),x.set(this,void 0),d(this,b,new Uint8Array,`f`),d(this,x,null,`f`)}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?Re(e):e;d(this,b,Ie([f(this,b,`f`),t]),`f`);let n=[],r;for(;(r=Ve(f(this,b,`f`),f(this,x,`f`)))!=null;){if(r.carriage&&f(this,x,`f`)==null){d(this,x,r.index,`f`);continue}if(f(this,x,`f`)!=null&&(r.index!==f(this,x,`f`)+1||r.carriage)){n.push(Be(f(this,b,`f`).subarray(0,f(this,x,`f`)-1))),d(this,b,f(this,b,`f`).subarray(f(this,x,`f`)),`f`),d(this,x,null,`f`);continue}let e=f(this,x,`f`)===null?r.preceding:r.preceding-1,t=Be(f(this,b,`f`).subarray(0,e));n.push(t),d(this,b,f(this,b,`f`).subarray(r.index),`f`),d(this,x,null,`f`)}return n}flush(){return f(this,b,`f`).length?this.decode(`
|
|
2
2
|
`):[]}};b=new WeakMap,x=new WeakMap,S.NEWLINE_CHARS=new Set([`
|
|
3
3
|
`,`\r`]),S.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function Ve(e,t){for(let n=t??0;n<e.length;n++){if(e[n]===10)return{preceding:n,index:n+1,carriage:!1};if(e[n]===13)return{preceding:n,index:n+1,carriage:!0}}return null}function He(e){for(let t=0;t<e.length-1;t++){if(e[t]===10&&e[t+1]===10||e[t]===13&&e[t+1]===13)return t+2;if(e[t]===13&&e[t+1]===10&&t+3<e.length&&e[t+2]===13&&e[t+3]===10)return t+4}return-1}const Ue={off:0,error:200,warn:300,info:400,debug:500},We=(e,t,n)=>{if(e){if(_e(Ue,e))return e;C(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Ue))}`)}};function Ge(){}function Ke(e,t,n){return!t||Ue[e]>Ue[n]?Ge:t[e].bind(t)}const qe={error:Ge,warn:Ge,info:Ge,debug:Ge};let Je=new WeakMap;function C(e){let t=e.logger,n=e.logLevel??`off`;if(!t)return qe;let r=Je.get(t);if(r&&r[0]===n)return r[1];let i={error:Ke(`error`,t,n),warn:Ke(`warn`,t,n),info:Ke(`info`,t,n),debug:Ke(`debug`,t,n)};return Je.set(t,[n,i]),i}const w=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,e.toLowerCase()===`x-api-key`||e.toLowerCase()===`authorization`||e.toLowerCase()===`cookie`||e.toLowerCase()===`set-cookie`?`***`:t])),`retryOfRequestLogID`in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e);var Ye,Xe=class e{constructor(e,t,n){this.iterator=e,Ye.set(this,void 0),this.controller=t,d(this,Ye,n,`f`)}static fromSSEResponse(t,n,r){let i=!1,a=r?C(r):console;async function*o(){if(i)throw new g("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let e of Ze(t,n)){if(e.event===`completion`)try{yield JSON.parse(e.data)}catch(t){throw a.error(`Could not parse message into JSON:`,e.data),a.error(`From chunk:`,e.raw),t}if(e.event===`message_start`||e.event===`message_delta`||e.event===`message_stop`||e.event===`content_block_start`||e.event===`content_block_delta`||e.event===`content_block_stop`||e.event===`message`||e.event===`user.message`||e.event===`user.interrupt`||e.event===`user.tool_confirmation`||e.event===`user.custom_tool_result`||e.event===`agent.message`||e.event===`agent.thinking`||e.event===`agent.tool_use`||e.event===`agent.tool_result`||e.event===`agent.mcp_tool_use`||e.event===`agent.mcp_tool_result`||e.event===`agent.custom_tool_use`||e.event===`agent.thread_context_compacted`||e.event===`session.status_running`||e.event===`session.status_idle`||e.event===`session.status_rescheduled`||e.event===`session.status_terminated`||e.event===`session.error`||e.event===`session.deleted`||e.event===`span.model_request_start`||e.event===`span.model_request_end`)try{yield JSON.parse(e.data)}catch(t){throw a.error(`Could not parse message into JSON:`,e.data),a.error(`From chunk:`,e.raw),t}if(e.event!==`ping`&&e.event===`error`){let n=ye(e.data)??e.data,r=n?.error?.type;throw new _(void 0,n,void 0,t.headers,r)}}e=!0}catch(e){if(m(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}static fromReadableStream(t,n,r){let i=!1;async function*a(){let e=new S,n=Me(t);for await(let t of n)for(let n of e.decode(t))yield n;for(let t of e.flush())yield t}async function*o(){if(i)throw new g("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let t of a())e||t&&(yield JSON.parse(t));e=!0}catch(e){if(m(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}[(Ye=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let t=[],n=[],r=this.iterator(),i=e=>({next:()=>{if(e.length===0){let e=r.next();t.push(e),n.push(e)}return e.shift()}});return[new e(()=>i(t),this.controller,f(this,Ye,`f`)),new e(()=>i(n),this.controller,f(this,Ye,`f`))]}toReadableStream(){let e=this,t;return Ae({async start(){t=e[Symbol.asyncIterator]()},async pull(e){try{let{value:n,done:r}=await t.next();if(r)return e.close();let i=Re(JSON.stringify(n)+`
|
|
4
4
|
`);e.enqueue(i)}catch(t){e.error(t)}},async cancel(){await t.return?.()}})}};async function*Ze(e,t){if(!e.body)throw t.abort(),globalThis.navigator!==void 0&&globalThis.navigator.product===`ReactNative`?new g(`The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`):new g(`Attempted to iterate over a response with no body`);let n=new $e,r=new S,i=Me(e.body);for await(let e of Qe(i))for(let t of r.decode(e)){let e=n.decode(t);e&&(yield e)}for(let e of r.flush()){let t=n.decode(e);t&&(yield t)}}async function*Qe(e){let t=new Uint8Array;for await(let n of e){if(n==null)continue;let e=n instanceof ArrayBuffer?new Uint8Array(n):typeof n==`string`?Re(n):n,r=new Uint8Array(t.length+e.length);r.set(t),r.set(e,t.length),t=r;let i;for(;(i=He(t))!==-1;)yield t.slice(0,i),t=t.slice(i)}t.length>0&&(yield t)}var $e=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith(`\r`)&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let e={event:this.event,data:this.data.join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./home-dir-C44RaPME-
|
|
1
|
+
import{o as e}from"./home-dir-C44RaPME-BqOMy1pu.mjs";import{createRequire as t}from"node:module";const n=Object.freeze({allowH2:!1});function r(e){return typeof e==`object`&&!!e&&typeof e.Agent==`function`&&typeof e.EnvHttpProxyAgent==`function`&&typeof e.ProxyAgent==`function`&&typeof e.fetch==`function`}function i(){let e=globalThis.__OPENCLAW_TEST_UNDICI_RUNTIME_DEPS__;if(r(e))return e;let n=t(import.meta.url)(`undici`);return{Agent:n.Agent,EnvHttpProxyAgent:n.EnvHttpProxyAgent,FormData:n.FormData,ProxyAgent:n.ProxyAgent,fetch:n.fetch}}function a(e){return e?{...e,...n}:{...n}}function o(e){let{Agent:t}=i();return new t(a(e))}function s(e){let{EnvHttpProxyAgent:t}=i();return new t(a(e))}function c(e){let{ProxyAgent:t}=i();return typeof e==`string`||e instanceof URL?new t(a({uri:e.toString()})):new t(a(e))}function l(e){return e===`commentary`||e===`final_answer`?e:void 0}function u(e){if(typeof e!=`string`||e.trim().length===0)return null;if(!e.startsWith(`{`))return{id:e};try{let t=JSON.parse(e);return t.v===1?{...typeof t.id==`string`?{id:t.id}:{},...l(t.phase)?{phase:l(t.phase)}:{}}:null}catch{return null}}function d(e,t){if(!e||typeof e!=`object`)return;let n=e,r=l(n.phase),i=t?.phase,a=e=>i?e===i:e===void 0,o=t?.sanitizeText,s=t?.joinWith??`
|
|
2
2
|
`,c=e=>o?o(e):e,d=e=>e.trim()||void 0;if(typeof n.text==`string`)return a(r)?d(c(n.text)):void 0;if(typeof n.content==`string`)return a(r)?d(c(n.content)):void 0;if(!Array.isArray(n.content))return;let f=n.content.some(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`text`?!!u(t.textSignature)?.phase:!1});if(!i&&f)return;let p=n.content.map(e=>{if(!e||typeof e!=`object`)return null;let t=e;if(t.type!==`text`||typeof t.text!=`string`||!a(u(t.textSignature)?.phase??(f?void 0:r)))return null;let n=c(t.text);return n.trim()?n:null}).filter(e=>typeof e==`string`);if(p.length!==0)return d(p.join(s))}function f(e){let t=[];for(let n of e.matchAll(/(^|\n)(```|~~~)[^\n]*\n[\s\S]*?(?:\n\2|$)/g)){let e=(n.index??0)+n[1].length;t.push({start:e,end:e+n[0].length-n[1].length})}for(let n of e.matchAll(/`+[^`]+`+/g)){let e=n.index??0,r=e+n[0].length;t.some(t=>e>=t.start&&r<=t.end)||t.push({start:e,end:r})}return t.sort((e,t)=>e.start-t.start),t}function p(e,t){return t.some(t=>e>=t.start&&e<t.end)}const m=/<[||][^||]*[||]>/g;function h(e,t,n){return n.some(n=>e<n.end&&t>n.start)}function g(e,t){return!!(e&&t&&!/\s/.test(e)&&!/\s/.test(t))}function _(e){if(!e||(m.lastIndex=0,!m.test(e)))return e;m.lastIndex=0;let t=f(e),n=``,r=0;for(let i of e.matchAll(m)){let a=i[0],o=i.index??0,s=o+a.length;n+=e.slice(r,o),p(o,t)||h(o,s,t)?n+=a:g(e[o-1],e[s])&&(n+=` `),r=s}return n+=e.slice(r),n}const v=/<\s*\/?\s*(?:(?:antml:)?(?:think(?:ing)?|thought)|antthinking|final)\b/i,y=/<\s*\/?\s*final\b[^<>]*>/gi,b=/<\s*(\/?)\s*(?:(?:antml:)?(?:think(?:ing)?|thought)|antthinking)\b[^<>]*>/gi;function x(e,t){return t===`none`?e:t===`start`?e.trimStart():e.trim()}function S(e,t){if(!e||!v.test(e))return e;let n=t?.mode??`strict`,r=t?.trim??`both`,i=e;if(y.test(i)){y.lastIndex=0;let e=[],t=f(i);for(let n of i.matchAll(y)){let r=n.index??0;e.push({start:r,length:n[0].length,inCode:p(r,t)})}for(let t=e.length-1;t>=0;t--){let n=e[t];n.inCode||(i=i.slice(0,n.start)+i.slice(n.start+n.length))}}else y.lastIndex=0;let a=f(i);b.lastIndex=0;let o=``,s=0,c=!1;for(let e of i.matchAll(b)){let t=e.index??0,n=e[1]===`/`;p(t,a)||(c?n&&(c=!1):(o+=i.slice(s,t),n||(c=!0)),s=t+e[0].length)}return(!c||n===`preserve`)&&(o+=i.slice(s)),x(o,r)}const C=/<\s*(\/?)\s*relevant[-_]memories\b[^<>]*>/gi,w=/<\s*\/?\s*relevant[-_]memories\b/i,T=/<\s*\/?\s*(?:tool_call|tool_result|function_calls?|function|tool_calls)\b/i,E=new Set([`tool_call`,`tool_result`,`function_call`,`function_calls`,`function`,`tool_calls`]),D=/^(?:\s+[A-Za-z_:][-A-Za-z0-9_:.]*\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))*\s*(?:\r?\n\s*)?[[{]/,O=/^\s*(?:\r?\n\s*)?<(?:function|invoke|parameters?|arguments?)\b/i;function k(e,t,n){let r=null,i=!1;for(let a=t;a<n;a+=1){let t=e[a];if(r===null){(t===`"`||t===`'`)&&(r=t);continue}if(i){i=!1;continue}if(t===`\\`){i=!0;continue}t===r&&(r=null)}return r!==null}function A(e){return!e||/\s/.test(e)||e===`/`||e===`>`}function j(e,t){let n=null,r=!1;for(let i=t;i<e.length;i+=1){let t=e[i];if(n!==null){if(r){r=!1;continue}if(t===`\\`){r=!0;continue}t===n&&(n=null);continue}if(t===`"`||t===`'`){n=t;continue}if(t===`<`)return-1;if(t===`>`)return i}return-1}function M(e,t){let n=e.slice(t);return D.test(n)?`json`:O.test(n)?`xml`:null}function N(e,t,n){if(n.tagName!==`function`||n.isClose||n.isSelfClosing||n.isTruncated||!/\bname\s*=/.test(e.slice(n.contentStart,n.end)))return!1;let r=t-1;for(;r>=0&&(e[r]===` `||e[r]===` `);)--r;return r<0||e[r]===`
|
|
3
3
|
`||e[r]===`\r`||/[.!?:]/.test(e[r])}function P(t,n){if(t[n]!==`<`)return null;let r=n+1;for(;r<t.length&&/\s/.test(t[r]);)r+=1;let i=!1;if(t[r]===`/`)for(i=!0,r+=1;r<t.length&&/\s/.test(t[r]);)r+=1;let a=r;for(;r<t.length&&/[A-Za-z_]/.test(t[r]);)r+=1;let o=e(t.slice(a,r));if(!E.has(o)||!A(t[r]))return null;let s=r,c=j(t,r);return c===-1?{contentStart:s,end:t.length,isClose:i,isSelfClosing:!1,tagName:o,isTruncated:!0}:{contentStart:s,end:c+1,isClose:i,isSelfClosing:!i&&/\/\s*$/.test(t.slice(r,c)),tagName:o,isTruncated:!1}}function F(e){if(!e||!T.test(e))return e;let t=f(e),n=``,r=0,i=!1,a=0,o=!1,s=0,c=null,l=new Map;for(let u=0;u<e.length;u+=1){if(e[u]!==`<`||!i&&p(u,t))continue;let d=P(e,u);if(d){if(i)d.isClose&&(d.tagName===c||c===`tool_result`&&d.tagName===`tool_call`)&&(!o||!k(e,a,u))&&(i=!1,o=!1,c=null);else{if(n+=e.slice(r,u),d.isClose){if(d.isTruncated){let t=d.contentStart;n+=e.slice(u,t),r=t,u=Math.max(u,t-1);continue}let t=l.get(d.tagName)??0;t>0&&(n+=e.slice(u,d.end),l.set(d.tagName,t-1)),r=d.end,u=Math.max(u,d.end-1);continue}if(d.isSelfClosing){r=d.end,u=Math.max(u,d.end-1);continue}let t=d.isTruncated?d.contentStart:d.end,f=d.tagName===`tool_call`||d.tagName===`function`?M(e,t):D.test(e.slice(t))?`json`:null,p=d.tagName!==`function`||N(e,u,d);if(!d.isClose&&f&&p){if(i=!0,a=d.end,o=f===`json`,s=u,c=d.tagName,d.isTruncated){r=e.length;break}}else{let t=d.isTruncated?d.contentStart:d.end;n+=e.slice(u,t),d.isTruncated||l.set(d.tagName,(l.get(d.tagName)??0)+1),r=t,u=Math.max(u,t-1);continue}}r=d.end,u=Math.max(u,d.end-1)}}return i?c===`function`&&(n+=e.slice(s)):n+=e.slice(r),n}function I(e){if(!e||!/minimax:tool_call/i.test(e))return e;let t=e.replace(/<invoke\b[^>]*>[\s\S]*?<\/invoke>/gi,``);return t=t.replace(/<\/?minimax:tool_call>/gi,``),t}function L(t){if(!t||!/\[Tool (?:Call|Result)/i.test(t)&&!/\[Historical context/i.test(t))return t;let n=(e,t,n)=>{let{allowLeadingNewlines:r=!1}=n??{},i=t;for(;i<e.length;){let t=e[i];if(t===` `||t===` `){i+=1;continue}if(r&&(t===`
|
|
4
4
|
`||t===`\r`)){i+=1;continue}break}if(i>=e.length)return null;let a=e[i];if(a===`{`||a===`[`){let t=0,n=!1,r=!1;for(let a=i;a<e.length;a+=1){let i=e[a];if(n){r?r=!1:i===`\\`?r=!0:i===`"`&&(n=!1);continue}if(i===`"`){n=!0;continue}if(i===`{`||i===`[`)t+=1;else if((i===`}`||i===`]`)&&(--t,t===0))return a+1}return null}if(a===`"`){let t=!1;for(let n=i+1;n<e.length;n+=1){let r=e[n];if(t){t=!1;continue}if(r===`\\`){t=!0;continue}if(r===`"`)return n+1}return null}let o=i;for(;o<e.length&&e[o]!==`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./env-api-keys-
|
|
1
|
+
import{t as e}from"./env-api-keys-qlOAYu08.mjs";import{o as t,t as n}from"./event-stream-JP51qlT7.mjs";import{t as r}from"./openai-D-MIrxrj.mjs";import{t as i}from"./headers-KsIWdB9S.mjs";import{i as a,r as o}from"./transform-messages-B6RF0Czv.mjs";import{n as s,r as c,t as l}from"./openai-responses-shared-DHm7pNQU.mjs";const u=new Set([`openai`,`openai-codex`,`opencode`,`azure-openai-responses`]);function d(e){let t=new Map;if(!e)return t;for(let n of e.split(`,`)){let e=n.trim();if(!e)continue;let[r,i]=e.split(`=`,2);!r||!i||t.set(r.trim(),i.trim())}return t}function f(e,t){return t?.azureDeploymentName?t.azureDeploymentName:d(process.env.AZURE_OPENAI_DEPLOYMENT_NAME_MAP).get(e.id)||e.id}const p=(t,r,a)=>{let o=new n;return(async()=>{let n=f(t,a),s={role:`assistant`,content:[],api:`azure-openai-responses`,provider:t.provider,model:t.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`stop`,timestamp:Date.now()};try{let l=v(t,a?.apiKey||e(t.provider)||``,a),u=y(t,r,a,n),d=await a?.onPayload?.(u,t);d!==void 0&&(u=d);let{data:f,response:p}=await l.responses.create(u,a?.signal?{signal:a.signal}:void 0).withResponse();if(await a?.onResponse?.({status:p.status,headers:i(p.headers)},t),o.push({type:`start`,partial:s}),await c(f,s,o,t),a?.signal?.aborted)throw Error(`Request was aborted`);if(s.stopReason===`aborted`||s.stopReason===`error`)throw Error(`An unknown error occurred`);o.push({type:`done`,reason:s.stopReason,message:s}),o.end()}catch(e){for(let e of s.content)delete e.index,delete e.partialJson;s.stopReason=a?.signal?.aborted?`aborted`:`error`,s.errorMessage=e instanceof Error?e.message:JSON.stringify(e),o.push({type:`error`,reason:s.stopReason,error:s}),o.end()}})(),o},m=(n,r,i)=>{let s=i?.apiKey||e(n.provider);if(!s)throw Error(`No API key for provider: ${n.provider}`);let c=o(n,i,s),l=t(n)?i?.reasoning:a(i?.reasoning);return p(n,r,{...c,reasoningEffort:l})};function h(e){return e.replace(/\/+$/,``)}function g(e){return`https://${e}.openai.azure.com/openai/v1`}function _(e,t){let n=t?.azureApiVersion||process.env.AZURE_OPENAI_API_VERSION||`v1`,r=t?.azureBaseUrl?.trim()||process.env.AZURE_OPENAI_BASE_URL?.trim()||void 0,i=t?.azureResourceName||process.env.AZURE_OPENAI_RESOURCE_NAME,a=r;if(!a&&i&&(a=g(i)),!a&&e.baseUrl&&(a=e.baseUrl),!a)throw Error(`Azure OpenAI base URL is required. Set AZURE_OPENAI_BASE_URL or AZURE_OPENAI_RESOURCE_NAME, or pass azureBaseUrl, azureResourceName, or model.baseUrl.`);return{baseUrl:h(a),apiVersion:n}}function v(e,t,n){if(!t){if(!process.env.AZURE_OPENAI_API_KEY)throw Error(`Azure OpenAI API key is required. Set AZURE_OPENAI_API_KEY environment variable or pass it as an argument.`);t=process.env.AZURE_OPENAI_API_KEY}let i={...e.headers};n?.headers&&Object.assign(i,n.headers);let{baseUrl:a,apiVersion:o}=_(e,n);return new r({apiKey:t,apiVersion:o,dangerouslyAllowBrowser:!0,defaultHeaders:i,baseURL:a})}function y(e,t,n,r){let i={model:r,input:l(e,t,u),stream:!0,prompt_cache_key:n?.sessionId};return n?.maxTokens&&(i.max_output_tokens=n?.maxTokens),n?.temperature!==void 0&&(i.temperature=n?.temperature),t.tools&&(i.tools=s(t.tools)),e.reasoning&&(n?.reasoningEffort||n?.reasoningSummary?(i.reasoning={effort:n?.reasoningEffort||`medium`,summary:n?.reasoningSummary||`auto`},i.include=[`reasoning.encrypted_content`]):i.reasoning={effort:`none`}),i}export{p as streamAzureOpenAIResponses,m as streamSimpleAzureOpenAIResponses};
|
package/dist/{boundary-file-read-BSd9MXPy-gnNVhPKT.mjs → boundary-file-read-BSd9MXPy-Tpd4W7aA.mjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./home-dir-C44RaPME-B5iLWwCq.mjs";import t from"node:fs";import n from"node:path";import"node:fs/promises";import r from"node:os";const i=new Set([`ENOENT`,`ENOTDIR`]),a=new Set([`ELOOP`,`EINVAL`,`ENOTSUP`]),o=/^\.\.(?:[\\/]|$)/u;function s(t){let r=n.win32.normalize(t);return r.startsWith(`\\\\?\\`)&&(r=r.slice(4),r.toUpperCase().startsWith(`UNC\\`)&&(r=`\\\\${r.slice(4)}`)),e(r.replaceAll(`/`,`\\`))}function c(e){return!!(e&&typeof e==`object`&&`code`in e)}function l(e,t){return c(e)&&e.code===t}function u(e){return c(e)&&typeof e.code==`string`&&i.has(e.code)}function d(e){return c(e)&&typeof e.code==`string`&&a.has(e.code)}function f(e,t){if(process.platform===`win32`){let r=s(n.win32.resolve(e)),i=s(n.win32.resolve(t)),a=n.win32.relative(r,i);return a===``||!o.test(a)&&!n.win32.isAbsolute(a)}let r=n.resolve(e),i=n.resolve(t),a=n.relative(r,i);return a===``||!o.test(a)&&!n.isAbsolute(a)}Object.freeze({allowFinalSymlinkForUnlink:!1,allowFinalHardlinkForUnlink:!1}),Object.freeze({allowFinalSymlinkForUnlink:!0,allowFinalHardlinkForUnlink:!0});function p(e){let t=n.resolve(e.rootPath),r=n.resolve(e.absolutePath),i=te({resolveParams:e,rootPath:t,absolutePath:r,rootCanonicalPath:e.rootCanonicalPath?n.resolve(e.rootCanonicalPath):N(t),outsideLexicalCanonicalPath:k({rootPath:t,absolutePath:r})});return D({boundaryLabel:e.boundaryLabel,context:i})||E({params:e,absolutePath:i.absolutePath,rootPath:i.rootPath,rootCanonicalPath:i.rootCanonicalPath})}function m(e){return!!(e&&(typeof e==`object`||typeof e==`function`)&&`then`in e&&typeof e.then==`function`)}function h(e){return{segments:n.relative(e.rootPath,e.absolutePath).split(n.sep).filter(Boolean),allowFinalSymlink:e.params.policy?.allowFinalSymlinkForUnlink===!0,canonicalCursor:e.rootCanonicalPath,lexicalCursor:e.rootPath,preserveFinalSymlink:!1}}function g(e){L({boundaryLabel:e.params.boundaryLabel,rootCanonicalPath:e.rootCanonicalPath,candidatePath:e.candidatePath,absolutePath:e.absolutePath})}function _(e){let t=e.state.segments.slice(e.missingFromIndex);e.state.canonicalCursor=n.resolve(e.state.canonicalCursor,...t),g({params:e.params,rootCanonicalPath:e.rootCanonicalPath,candidatePath:e.state.canonicalCursor,absolutePath:e.absolutePath})}function v(e){e.state.canonicalCursor=n.resolve(e.state.canonicalCursor,e.segment),g({params:e.params,rootCanonicalPath:e.rootCanonicalPath,candidatePath:e.state.canonicalCursor,absolutePath:e.absolutePath})}function y(e){return g({params:e.params,rootCanonicalPath:e.rootCanonicalPath,candidatePath:e.state.canonicalCursor,absolutePath:e.absolutePath}),M({absolutePath:e.absolutePath,canonicalPath:e.state.canonicalCursor,rootPath:e.rootPath,rootCanonicalPath:e.rootCanonicalPath,kind:e.kind})}function b(e){return u(e.error)?(_({state:e.state,missingFromIndex:e.missingFromIndex,rootCanonicalPath:e.rootCanonicalPath,params:e.resolveParams,absolutePath:e.absolutePath}),!0):!1}function x(e){if(b({error:e.error,state:e.state,missingFromIndex:e.missingFromIndex,rootCanonicalPath:e.rootCanonicalPath,resolveParams:e.resolveParams,absolutePath:e.absolutePath}))return null;throw e.error}function S(e){return e.isSymbolicLink?e.state.allowFinalSymlink&&e.isLast?(e.state.preserveFinalSymlink=!0,v({state:e.state,segment:e.segment,rootCanonicalPath:e.rootCanonicalPath,params:e.resolveParams,absolutePath:e.absolutePath}),`break`):`resolve-link`:(v({state:e.state,segment:e.segment,rootCanonicalPath:e.rootCanonicalPath,params:e.resolveParams,absolutePath:e.absolutePath}),`continue`)}function C(e){if(!f(e.rootCanonicalPath,e.linkCanonical))throw z({boundaryLabel:e.boundaryLabel,rootCanonicalPath:e.rootCanonicalPath,symlinkPath:e.state.lexicalCursor});e.state.canonicalCursor=e.linkCanonical,e.state.lexicalCursor=e.linkCanonical}function w(e){try{let t=e.read(e.state.lexicalCursor);return m(t)?Promise.resolve(t).catch(t=>x({...e,error:t})):t}catch(t){return x({...e,error:t})}}function T(e){let t=e.resolveLinkCanonical(e.state.lexicalCursor);if(m(t))return Promise.resolve(t).then(t=>C({state:e.state,linkCanonical:t,rootCanonicalPath:e.rootCanonicalPath,boundaryLabel:e.boundaryLabel}));C({state:e.state,linkCanonical:t,rootCanonicalPath:e.rootCanonicalPath,boundaryLabel:e.boundaryLabel})}function E(e){let r=h(e);for(let i=0;i<r.segments.length;i+=1){let a=r.segments[i]??``,o=i===r.segments.length-1;r.lexicalCursor=n.join(r.lexicalCursor,a);let s=w({state:r,missingFromIndex:i,rootCanonicalPath:e.rootCanonicalPath,resolveParams:e.params,absolutePath:e.absolutePath,read:e=>t.lstatSync(e)});if(m(s))throw Error(`Unexpected async lexical stat`);let c=s;if(!c)break;let l=S({state:r,isSymbolicLink:c.isSymbolicLink(),segment:a,isLast:o,rootCanonicalPath:e.rootCanonicalPath,resolveParams:e.params,absolutePath:e.absolutePath});if(l!==`continue`){if(l===`break`)break;if(m(T({state:r,rootCanonicalPath:e.rootCanonicalPath,boundaryLabel:e.params.boundaryLabel,resolveLinkCanonical:e=>H(e)})))throw Error(`Unexpected async symlink resolution`)}}let i=P(e.absolutePath,r.preserveFinalSymlink);return y({...e,state:r,kind:i})}function ee(e){return e.outsideLexicalCanonicalPath??e.absolutePath}function te(e){let t=f(e.rootPath,e.absolutePath),n=ee({absolutePath:e.absolutePath,outsideLexicalCanonicalPath:e.outsideLexicalCanonicalPath});return j({skipLexicalRootCheck:e.resolveParams.skipLexicalRootCheck,lexicalInside:t,canonicalOutsideLexicalPath:n,rootCanonicalPath:e.rootCanonicalPath,boundaryLabel:e.resolveParams.boundaryLabel,rootPath:e.rootPath,absolutePath:e.absolutePath}),{rootPath:e.rootPath,absolutePath:e.absolutePath,rootCanonicalPath:e.rootCanonicalPath,lexicalInside:t,canonicalOutsideLexicalPath:n}}function D(e){if(e.context.lexicalInside)return null;let t=P(e.context.absolutePath,!1);return O({boundaryLabel:e.boundaryLabel,context:e.context,kind:t})}function O(e){return A({boundaryLabel:e.boundaryLabel,rootCanonicalPath:e.context.rootCanonicalPath,absolutePath:e.context.absolutePath,canonicalOutsideLexicalPath:e.context.canonicalOutsideLexicalPath,rootPath:e.context.rootPath,kind:e.kind})}function k(e){if(!f(e.rootPath,e.absolutePath))return N(e.absolutePath)}function A(e){return L({boundaryLabel:e.boundaryLabel,rootCanonicalPath:e.rootCanonicalPath,candidatePath:e.canonicalOutsideLexicalPath,absolutePath:e.absolutePath}),M({absolutePath:e.absolutePath,canonicalPath:e.canonicalOutsideLexicalPath,rootPath:e.rootPath,rootCanonicalPath:e.rootCanonicalPath,kind:e.kind})}function j(e){if(!(e.skipLexicalRootCheck||e.lexicalInside)&&!f(e.rootCanonicalPath,e.canonicalOutsideLexicalPath))throw R({boundaryLabel:e.boundaryLabel,rootPath:e.rootPath,absolutePath:e.absolutePath})}function M(e){return{absolutePath:e.absolutePath,canonicalPath:e.canonicalPath,rootPath:e.rootPath,rootCanonicalPath:e.rootCanonicalPath,relativePath:I(e.rootCanonicalPath,e.canonicalPath),exists:e.kind.exists,kind:e.kind.kind}}function N(e){let r=n.resolve(e),i=r,a=[];for(;!V(i)&&!t.existsSync(i);){a.unshift(n.basename(i));let e=n.dirname(i);if(e===i)break;i=e}if(!t.existsSync(i))return r;try{let e=n.resolve(t.realpathSync(i));return a.length===0?e:n.resolve(e,...a)}catch{return r}}function P(e,n){try{return{exists:!0,kind:F(n?t.lstatSync(e):t.statSync(e))}}catch(e){if(u(e))return{exists:!1,kind:`missing`};throw e}}function F(e){return e.isFile()?`file`:e.isDirectory()?`directory`:e.isSymbolicLink()?`symlink`:`other`}function I(e,t){let r=n.relative(n.resolve(e),n.resolve(t));return!r||r===`.`||r.startsWith(`..`)||n.isAbsolute(r)?``:r}function L(e){if(!f(e.rootCanonicalPath,e.candidatePath))throw Error(`Path resolves outside ${e.boundaryLabel} (${B(e.rootCanonicalPath)}): ${B(e.absolutePath)}`)}function R(e){return Error(`Path escapes ${e.boundaryLabel} (${B(e.rootPath)}): ${B(e.absolutePath)}`)}function z(e){return Error(`Symlink escapes ${e.boundaryLabel} (${B(e.rootCanonicalPath)}): ${B(e.symlinkPath)}`)}function B(e){let t=r.homedir();return e.startsWith(t)?`~${e.slice(t.length)}`:e}function V(e){return n.parse(e).root===e}function H(e){try{return n.resolve(t.realpathSync(e))}catch(r){if(!u(r))throw r;let i=t.readlinkSync(e);return N(n.resolve(n.dirname(e),i))}}function U(e){return e===0||e===0n}function W(e,t,n=process.platform){return e.ino===t.ino?e.dev===t.dev?!0:n===`win32`&&(U(e.dev)||U(t.dev)):!1}function G(e){let t=typeof e==`object`&&e&&`code`in e?String(e.code):``;return t===`ENOENT`||t===`ENOTDIR`||t===`ELOOP`}function K(e,t){return W(e,t)}function q(e){let n=e.ioFs??t,r=e.allowedType??`file`,i=n.constants.O_RDONLY|(typeof n.constants.O_NOFOLLOW==`number`?n.constants.O_NOFOLLOW:0),a=null;try{if(e.rejectPathSymlink&&n.lstatSync(e.filePath).isSymbolicLink())return{ok:!1,reason:`validation`};let t=e.resolvedPath??n.realpathSync(e.filePath),o=n.lstatSync(t);if(!J(o,r)||e.rejectHardlinks&&o.isFile()&&o.nlink>1||e.maxBytes!==void 0&&o.isFile()&&o.size>e.maxBytes)return{ok:!1,reason:`validation`};a=n.openSync(t,i);let s=n.fstatSync(a);if(!J(s,r)||e.rejectHardlinks&&s.isFile()&&s.nlink>1||e.maxBytes!==void 0&&s.isFile()&&s.size>e.maxBytes||!K(o,s))return{ok:!1,reason:`validation`};let c={ok:!0,path:t,fd:a,stat:s};return a=null,c}catch(e){return G(e)?{ok:!1,reason:`path`,error:e}:{ok:!1,reason:`io`,error:e}}finally{a!==null&&n.closeSync(a)}}function J(e,t){return t===`directory`?e.isDirectory():e.isFile()}function Y(e){return typeof e.openSync==`function`&&typeof e.closeSync==`function`&&typeof e.fstatSync==`function`&&typeof e.lstatSync==`function`&&typeof e.realpathSync==`function`&&typeof e.readFileSync==`function`&&typeof e.constants==`object`&&e.constants!==null}function X(e){let n=e.ioFs??t,r=ie({absolutePath:e.absolutePath,resolve:t=>p({absolutePath:t,rootPath:e.rootPath,rootCanonicalPath:e.rootRealPath,boundaryLabel:e.boundaryLabel,skipLexicalRootCheck:e.skipLexicalRootCheck})});return r instanceof Promise?Q(Error(`Unexpected async boundary resolution`)):re({resolved:r,maxBytes:e.maxBytes,rejectHardlinks:e.rejectHardlinks,allowedType:e.allowedType,ioFs:n})}function Z(e,t){switch(e.reason){case`path`:return t.path?t.path(e):t.fallback(e);case`validation`:return t.validation?t.validation(e):t.fallback(e);case`io`:return t.io?t.io(e):t.fallback(e)}return t.fallback(e)}function ne(e){let t=q({filePath:e.absolutePath,resolvedPath:e.resolvedPath,rejectHardlinks:e.rejectHardlinks??!0,maxBytes:e.maxBytes,allowedType:e.allowedType,ioFs:e.ioFs});return t.ok?{ok:!0,path:t.path,fd:t.fd,stat:t.stat,rootRealPath:e.rootRealPath}:t}function re(e){return`ok`in e.resolved?e.resolved:ne({absolutePath:e.resolved.absolutePath,resolvedPath:e.resolved.resolvedPath,rootRealPath:e.resolved.rootRealPath,maxBytes:e.maxBytes,rejectHardlinks:e.rejectHardlinks,allowedType:e.allowedType,ioFs:e.ioFs})}function Q(e){return{ok:!1,reason:`validation`,error:e}}function $(e,t){return{absolutePath:e,resolvedPath:t.canonicalPath,rootRealPath:t.rootCanonicalPath}}function ie(e){let t=n.resolve(e.absolutePath);try{let n=e.resolve(t);return n instanceof Promise?n.then(e=>$(t,e)).catch(e=>Q(e)):$(t,n)}catch(e){return Q(e)}}export{l as a,d as c,W as i,p as l,Z as n,u as o,X as r,f as s,Y as t};
|
|
1
|
+
import{o as e}from"./home-dir-C44RaPME-BqOMy1pu.mjs";import t from"node:fs";import n from"node:path";import"node:fs/promises";import r from"node:os";const i=new Set([`ENOENT`,`ENOTDIR`]),a=new Set([`ELOOP`,`EINVAL`,`ENOTSUP`]),o=/^\.\.(?:[\\/]|$)/u;function s(t){let r=n.win32.normalize(t);return r.startsWith(`\\\\?\\`)&&(r=r.slice(4),r.toUpperCase().startsWith(`UNC\\`)&&(r=`\\\\${r.slice(4)}`)),e(r.replaceAll(`/`,`\\`))}function c(e){return!!(e&&typeof e==`object`&&`code`in e)}function l(e,t){return c(e)&&e.code===t}function u(e){return c(e)&&typeof e.code==`string`&&i.has(e.code)}function d(e){return c(e)&&typeof e.code==`string`&&a.has(e.code)}function f(e,t){if(process.platform===`win32`){let r=s(n.win32.resolve(e)),i=s(n.win32.resolve(t)),a=n.win32.relative(r,i);return a===``||!o.test(a)&&!n.win32.isAbsolute(a)}let r=n.resolve(e),i=n.resolve(t),a=n.relative(r,i);return a===``||!o.test(a)&&!n.isAbsolute(a)}Object.freeze({allowFinalSymlinkForUnlink:!1,allowFinalHardlinkForUnlink:!1}),Object.freeze({allowFinalSymlinkForUnlink:!0,allowFinalHardlinkForUnlink:!0});function p(e){let t=n.resolve(e.rootPath),r=n.resolve(e.absolutePath),i=te({resolveParams:e,rootPath:t,absolutePath:r,rootCanonicalPath:e.rootCanonicalPath?n.resolve(e.rootCanonicalPath):N(t),outsideLexicalCanonicalPath:k({rootPath:t,absolutePath:r})});return D({boundaryLabel:e.boundaryLabel,context:i})||E({params:e,absolutePath:i.absolutePath,rootPath:i.rootPath,rootCanonicalPath:i.rootCanonicalPath})}function m(e){return!!(e&&(typeof e==`object`||typeof e==`function`)&&`then`in e&&typeof e.then==`function`)}function h(e){return{segments:n.relative(e.rootPath,e.absolutePath).split(n.sep).filter(Boolean),allowFinalSymlink:e.params.policy?.allowFinalSymlinkForUnlink===!0,canonicalCursor:e.rootCanonicalPath,lexicalCursor:e.rootPath,preserveFinalSymlink:!1}}function g(e){L({boundaryLabel:e.params.boundaryLabel,rootCanonicalPath:e.rootCanonicalPath,candidatePath:e.candidatePath,absolutePath:e.absolutePath})}function _(e){let t=e.state.segments.slice(e.missingFromIndex);e.state.canonicalCursor=n.resolve(e.state.canonicalCursor,...t),g({params:e.params,rootCanonicalPath:e.rootCanonicalPath,candidatePath:e.state.canonicalCursor,absolutePath:e.absolutePath})}function v(e){e.state.canonicalCursor=n.resolve(e.state.canonicalCursor,e.segment),g({params:e.params,rootCanonicalPath:e.rootCanonicalPath,candidatePath:e.state.canonicalCursor,absolutePath:e.absolutePath})}function y(e){return g({params:e.params,rootCanonicalPath:e.rootCanonicalPath,candidatePath:e.state.canonicalCursor,absolutePath:e.absolutePath}),M({absolutePath:e.absolutePath,canonicalPath:e.state.canonicalCursor,rootPath:e.rootPath,rootCanonicalPath:e.rootCanonicalPath,kind:e.kind})}function b(e){return u(e.error)?(_({state:e.state,missingFromIndex:e.missingFromIndex,rootCanonicalPath:e.rootCanonicalPath,params:e.resolveParams,absolutePath:e.absolutePath}),!0):!1}function x(e){if(b({error:e.error,state:e.state,missingFromIndex:e.missingFromIndex,rootCanonicalPath:e.rootCanonicalPath,resolveParams:e.resolveParams,absolutePath:e.absolutePath}))return null;throw e.error}function S(e){return e.isSymbolicLink?e.state.allowFinalSymlink&&e.isLast?(e.state.preserveFinalSymlink=!0,v({state:e.state,segment:e.segment,rootCanonicalPath:e.rootCanonicalPath,params:e.resolveParams,absolutePath:e.absolutePath}),`break`):`resolve-link`:(v({state:e.state,segment:e.segment,rootCanonicalPath:e.rootCanonicalPath,params:e.resolveParams,absolutePath:e.absolutePath}),`continue`)}function C(e){if(!f(e.rootCanonicalPath,e.linkCanonical))throw z({boundaryLabel:e.boundaryLabel,rootCanonicalPath:e.rootCanonicalPath,symlinkPath:e.state.lexicalCursor});e.state.canonicalCursor=e.linkCanonical,e.state.lexicalCursor=e.linkCanonical}function w(e){try{let t=e.read(e.state.lexicalCursor);return m(t)?Promise.resolve(t).catch(t=>x({...e,error:t})):t}catch(t){return x({...e,error:t})}}function T(e){let t=e.resolveLinkCanonical(e.state.lexicalCursor);if(m(t))return Promise.resolve(t).then(t=>C({state:e.state,linkCanonical:t,rootCanonicalPath:e.rootCanonicalPath,boundaryLabel:e.boundaryLabel}));C({state:e.state,linkCanonical:t,rootCanonicalPath:e.rootCanonicalPath,boundaryLabel:e.boundaryLabel})}function E(e){let r=h(e);for(let i=0;i<r.segments.length;i+=1){let a=r.segments[i]??``,o=i===r.segments.length-1;r.lexicalCursor=n.join(r.lexicalCursor,a);let s=w({state:r,missingFromIndex:i,rootCanonicalPath:e.rootCanonicalPath,resolveParams:e.params,absolutePath:e.absolutePath,read:e=>t.lstatSync(e)});if(m(s))throw Error(`Unexpected async lexical stat`);let c=s;if(!c)break;let l=S({state:r,isSymbolicLink:c.isSymbolicLink(),segment:a,isLast:o,rootCanonicalPath:e.rootCanonicalPath,resolveParams:e.params,absolutePath:e.absolutePath});if(l!==`continue`){if(l===`break`)break;if(m(T({state:r,rootCanonicalPath:e.rootCanonicalPath,boundaryLabel:e.params.boundaryLabel,resolveLinkCanonical:e=>H(e)})))throw Error(`Unexpected async symlink resolution`)}}let i=P(e.absolutePath,r.preserveFinalSymlink);return y({...e,state:r,kind:i})}function ee(e){return e.outsideLexicalCanonicalPath??e.absolutePath}function te(e){let t=f(e.rootPath,e.absolutePath),n=ee({absolutePath:e.absolutePath,outsideLexicalCanonicalPath:e.outsideLexicalCanonicalPath});return j({skipLexicalRootCheck:e.resolveParams.skipLexicalRootCheck,lexicalInside:t,canonicalOutsideLexicalPath:n,rootCanonicalPath:e.rootCanonicalPath,boundaryLabel:e.resolveParams.boundaryLabel,rootPath:e.rootPath,absolutePath:e.absolutePath}),{rootPath:e.rootPath,absolutePath:e.absolutePath,rootCanonicalPath:e.rootCanonicalPath,lexicalInside:t,canonicalOutsideLexicalPath:n}}function D(e){if(e.context.lexicalInside)return null;let t=P(e.context.absolutePath,!1);return O({boundaryLabel:e.boundaryLabel,context:e.context,kind:t})}function O(e){return A({boundaryLabel:e.boundaryLabel,rootCanonicalPath:e.context.rootCanonicalPath,absolutePath:e.context.absolutePath,canonicalOutsideLexicalPath:e.context.canonicalOutsideLexicalPath,rootPath:e.context.rootPath,kind:e.kind})}function k(e){if(!f(e.rootPath,e.absolutePath))return N(e.absolutePath)}function A(e){return L({boundaryLabel:e.boundaryLabel,rootCanonicalPath:e.rootCanonicalPath,candidatePath:e.canonicalOutsideLexicalPath,absolutePath:e.absolutePath}),M({absolutePath:e.absolutePath,canonicalPath:e.canonicalOutsideLexicalPath,rootPath:e.rootPath,rootCanonicalPath:e.rootCanonicalPath,kind:e.kind})}function j(e){if(!(e.skipLexicalRootCheck||e.lexicalInside)&&!f(e.rootCanonicalPath,e.canonicalOutsideLexicalPath))throw R({boundaryLabel:e.boundaryLabel,rootPath:e.rootPath,absolutePath:e.absolutePath})}function M(e){return{absolutePath:e.absolutePath,canonicalPath:e.canonicalPath,rootPath:e.rootPath,rootCanonicalPath:e.rootCanonicalPath,relativePath:I(e.rootCanonicalPath,e.canonicalPath),exists:e.kind.exists,kind:e.kind.kind}}function N(e){let r=n.resolve(e),i=r,a=[];for(;!V(i)&&!t.existsSync(i);){a.unshift(n.basename(i));let e=n.dirname(i);if(e===i)break;i=e}if(!t.existsSync(i))return r;try{let e=n.resolve(t.realpathSync(i));return a.length===0?e:n.resolve(e,...a)}catch{return r}}function P(e,n){try{return{exists:!0,kind:F(n?t.lstatSync(e):t.statSync(e))}}catch(e){if(u(e))return{exists:!1,kind:`missing`};throw e}}function F(e){return e.isFile()?`file`:e.isDirectory()?`directory`:e.isSymbolicLink()?`symlink`:`other`}function I(e,t){let r=n.relative(n.resolve(e),n.resolve(t));return!r||r===`.`||r.startsWith(`..`)||n.isAbsolute(r)?``:r}function L(e){if(!f(e.rootCanonicalPath,e.candidatePath))throw Error(`Path resolves outside ${e.boundaryLabel} (${B(e.rootCanonicalPath)}): ${B(e.absolutePath)}`)}function R(e){return Error(`Path escapes ${e.boundaryLabel} (${B(e.rootPath)}): ${B(e.absolutePath)}`)}function z(e){return Error(`Symlink escapes ${e.boundaryLabel} (${B(e.rootCanonicalPath)}): ${B(e.symlinkPath)}`)}function B(e){let t=r.homedir();return e.startsWith(t)?`~${e.slice(t.length)}`:e}function V(e){return n.parse(e).root===e}function H(e){try{return n.resolve(t.realpathSync(e))}catch(r){if(!u(r))throw r;let i=t.readlinkSync(e);return N(n.resolve(n.dirname(e),i))}}function U(e){return e===0||e===0n}function W(e,t,n=process.platform){return e.ino===t.ino?e.dev===t.dev?!0:n===`win32`&&(U(e.dev)||U(t.dev)):!1}function G(e){let t=typeof e==`object`&&e&&`code`in e?String(e.code):``;return t===`ENOENT`||t===`ENOTDIR`||t===`ELOOP`}function K(e,t){return W(e,t)}function q(e){let n=e.ioFs??t,r=e.allowedType??`file`,i=n.constants.O_RDONLY|(typeof n.constants.O_NOFOLLOW==`number`?n.constants.O_NOFOLLOW:0),a=null;try{if(e.rejectPathSymlink&&n.lstatSync(e.filePath).isSymbolicLink())return{ok:!1,reason:`validation`};let t=e.resolvedPath??n.realpathSync(e.filePath),o=n.lstatSync(t);if(!J(o,r)||e.rejectHardlinks&&o.isFile()&&o.nlink>1||e.maxBytes!==void 0&&o.isFile()&&o.size>e.maxBytes)return{ok:!1,reason:`validation`};a=n.openSync(t,i);let s=n.fstatSync(a);if(!J(s,r)||e.rejectHardlinks&&s.isFile()&&s.nlink>1||e.maxBytes!==void 0&&s.isFile()&&s.size>e.maxBytes||!K(o,s))return{ok:!1,reason:`validation`};let c={ok:!0,path:t,fd:a,stat:s};return a=null,c}catch(e){return G(e)?{ok:!1,reason:`path`,error:e}:{ok:!1,reason:`io`,error:e}}finally{a!==null&&n.closeSync(a)}}function J(e,t){return t===`directory`?e.isDirectory():e.isFile()}function Y(e){return typeof e.openSync==`function`&&typeof e.closeSync==`function`&&typeof e.fstatSync==`function`&&typeof e.lstatSync==`function`&&typeof e.realpathSync==`function`&&typeof e.readFileSync==`function`&&typeof e.constants==`object`&&e.constants!==null}function X(e){let n=e.ioFs??t,r=ie({absolutePath:e.absolutePath,resolve:t=>p({absolutePath:t,rootPath:e.rootPath,rootCanonicalPath:e.rootRealPath,boundaryLabel:e.boundaryLabel,skipLexicalRootCheck:e.skipLexicalRootCheck})});return r instanceof Promise?Q(Error(`Unexpected async boundary resolution`)):re({resolved:r,maxBytes:e.maxBytes,rejectHardlinks:e.rejectHardlinks,allowedType:e.allowedType,ioFs:n})}function Z(e,t){switch(e.reason){case`path`:return t.path?t.path(e):t.fallback(e);case`validation`:return t.validation?t.validation(e):t.fallback(e);case`io`:return t.io?t.io(e):t.fallback(e)}return t.fallback(e)}function ne(e){let t=q({filePath:e.absolutePath,resolvedPath:e.resolvedPath,rejectHardlinks:e.rejectHardlinks??!0,maxBytes:e.maxBytes,allowedType:e.allowedType,ioFs:e.ioFs});return t.ok?{ok:!0,path:t.path,fd:t.fd,stat:t.stat,rootRealPath:e.rootRealPath}:t}function re(e){return`ok`in e.resolved?e.resolved:ne({absolutePath:e.resolved.absolutePath,resolvedPath:e.resolved.resolvedPath,rootRealPath:e.resolved.rootRealPath,maxBytes:e.maxBytes,rejectHardlinks:e.rejectHardlinks,allowedType:e.allowedType,ioFs:e.ioFs})}function Q(e){return{ok:!1,reason:`validation`,error:e}}function $(e,t){return{absolutePath:e,resolvedPath:t.canonicalPath,rootRealPath:t.rootCanonicalPath}}function ie(e){let t=n.resolve(e.absolutePath);try{let n=e.resolve(t);return n instanceof Promise?n.then(e=>$(t,e)).catch(e=>Q(e)):$(t,n)}catch(e){return Q(e)}}export{l as a,d as c,W as i,p as l,Z as n,u as o,X as r,f as s,Y as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./facade-loader-DFzIYYt_-
|
|
1
|
+
import{n as e}from"./facade-loader-DFzIYYt_--SN2-DQM.mjs";import"node:fs";import"node:path";import"node:os";let t;function n(e){return e.some(e=>!!e?.trim())}function r(){return t??=e({dirName:`browser`,artifactBasename:`browser-maintenance.js`}),t}async function i(e){if(!n(e.sessionKeys))return 0;let t;try{t=r()}catch(t){return e.onWarn?.(`browser cleanup unavailable: ${String(t)}`),0}return await t.closeTrackedBrowserTabsForSessions(e)}async function a(e){try{return await e.cleanup()}catch(t){e.onError?.(t);return}}function o(e){let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}async function s(e){let t=o(e.sessionKeys);t.length!==0&&await a({cleanup:async()=>{await i({sessionKeys:t,onWarn:e.onWarn})},onError:e.onError})}export{s as cleanupBrowserSessionsForLifecycleEnd};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as e,o as t,r as n,s as r}from"./home-dir-C44RaPME-B5iLWwCq.mjs";import{o as i}from"./paths-D92DjaZ--DdtJ-zYp.mjs";import{n as a,s as o,t as s}from"./bundled-dir-U738ay4K-BxbzrJOo.mjs";import{i as c,n as l,r as u}from"./ids-BPsM98Uu-CJBJAeVC.mjs";import{t as d}from"./runtime-channel-state-CohMybAh-BBzhl07Q.mjs";import{F as f,M as p,N as m,O as h,_ as g,a as _,d as v,f as ee,i as te,k as ne,m as re,n as ie,o as ae,p as y,r as oe,s as se,t as ce}from"./manifest-registry-_hxKCS2K-OL8KK_o4.mjs";import{r as le}from"./boundary-file-read-BSd9MXPy-gnNVhPKT.mjs";import{r as ue,s as de,t as fe}from"./jiti-loader-cache-Bat69wam-DNIteTtO.mjs";import{createRequire as pe}from"node:module";import b from"node:fs";import x from"node:path";import{fileURLToPath as me}from"node:url";import he,{tmpdir as ge}from"node:os";import{spawnSync as _e}from"node:child_process";import{createHash as ve}from"node:crypto";import ye from"node:process";import be from"node:tty";import{z as S}from"zod";function xe(e){return{configured:e.exposure?.configured??e.showConfigured??!0,setup:e.exposure?.setup??e.showInSetup??!0,docs:e.exposure?.docs??!0}}function Se(e){let t=t=>e.arrayFieldMode===`defined`?t!==void 0:!!t?.length,n=e.selectionDocsPrefixMode===`defined`?e.channel.selectionDocsPrefix!==void 0:!!e.channel.selectionDocsPrefix;return{id:e.id,label:e.label,selectionLabel:e.selectionLabel,docsPath:e.docsPath,docsLabel:e.docsLabel,blurb:e.blurb,...t(e.channel.aliases)?{aliases:e.channel.aliases}:{},...e.channel.order===void 0?{}:{order:e.channel.order},...n?{selectionDocsPrefix:e.channel.selectionDocsPrefix}:{},...e.channel.selectionDocsOmitLabel===void 0?{}:{selectionDocsOmitLabel:e.channel.selectionDocsOmitLabel},...t(e.channel.selectionExtras)?{selectionExtras:e.channel.selectionExtras}:{},...e.detailLabel?{detailLabel:e.detailLabel}:{},...e.systemImage?{systemImage:e.systemImage}:{},...e.channel.markdownCapable===void 0?{}:{markdownCapable:e.channel.markdownCapable},exposure:xe(e.channel),...e.channel.quickstartAllowFrom===void 0?{}:{quickstartAllowFrom:e.channel.quickstartAllowFrom},...e.channel.forceAccountBinding===void 0?{}:{forceAccountBinding:e.channel.forceAccountBinding},...e.channel.preferSessionLookupForAnnounceTarget===void 0?{}:{preferSessionLookupForAnnounceTarget:e.channel.preferSessionLookupForAnnounceTarget},...t(e.channel.preferOver)?{preferOver:e.channel.preferOver}:{}}}const Ce=new Set(l);function we(t){let n=e(t.channel.label);if(!n)throw Error(`Missing label for bundled chat channel "${t.id}"`);return Se({id:t.id,channel:t.channel,label:n,selectionLabel:e(t.channel.selectionLabel)||n,docsPath:e(t.channel.docsPath)||`/channels/${t.id}`,docsLabel:e(t.channel.docsLabel),blurb:e(t.channel.blurb)||``,detailLabel:e(t.channel.detailLabel),systemImage:e(t.channel.systemImage),arrayFieldMode:`non-empty`,selectionDocsPrefixMode:`defined`})}function Te(){let t=new Map;for(let n of u()){let r=e(n.id);if(!r||!Ce.has(r))continue;let i=r;t.set(i,we({id:i,channel:n.channel}))}return Object.freeze(Object.fromEntries(t))}const Ee=Te();function De(){return l.map(e=>Ee[e])}function Oe(e){return Ee[e]}function ke(){let e=d();return e&&e.channels&&e.channels.length>0?e.channels:[]}function Ae(e){return ke().find(t=>{let n=r(t.plugin.id??``)??``;return n&&n===e?!0:(t.plugin.meta?.aliases??[]).some(t=>r(t)===e)})}function je(e){return c(e)}function Me(e){let t=r(e);return t?Ae(t)?.plugin.id??null:null}function Ne(){return ke().flatMap(t=>{let n=e(t.plugin.id);return n?[n]:[]})}const C=new Map;function Pe(){return{lastToken:null,containsRepetition:!1,hasAlternation:!1,branchMinLength:0,branchMaxLength:0,altMinLength:null,altMaxLength:null}}function Fe(e,t){return!Number.isFinite(e)||!Number.isFinite(t)?1/0:e+t}function Ie(e,t){return Number.isFinite(e)?e*t:t===0?0:1/0}function Le(e){if(e.altMinLength===null||e.altMaxLength===null){e.altMinLength=e.branchMinLength,e.altMaxLength=e.branchMaxLength;return}e.altMinLength=Math.min(e.altMinLength,e.branchMinLength),e.altMaxLength=Math.max(e.altMaxLength,e.branchMaxLength)}function Re(e,t){let n=e[t],r=e[t+1]===`?`?2:1;if(n===`*`)return{consumed:r,minRepeat:0,maxRepeat:null};if(n===`+`)return{consumed:r,minRepeat:1,maxRepeat:null};if(n===`?`)return{consumed:r,minRepeat:0,maxRepeat:1};if(n!==`{`)return null;let i=t+1;for(;i<e.length&&/\d/.test(e[i]);)i+=1;if(i===t+1)return null;let a=Number.parseInt(e.slice(t+1,i),10),o=a;if(e[i]===`,`){i+=1;let t=i;for(;i<e.length&&/\d/.test(e[i]);)i+=1;o=i===t?null:Number.parseInt(e.slice(t,i),10)}return e[i]!==`}`||(i+=1,e[i]===`?`&&(i+=1),o!==null&&o<a)?null:{consumed:i-t,minRepeat:a,maxRepeat:o}}function ze(e){let t=[],n=!1;for(let r=0;r<e.length;r+=1){let i=e[r];if(i===`\\`){r+=1,t.push({kind:`simple-token`});continue}if(n){i===`]`&&(n=!1);continue}if(i===`[`){n=!0,t.push({kind:`simple-token`});continue}if(i===`(`){t.push({kind:`group-open`});continue}if(i===`)`){t.push({kind:`group-close`});continue}if(i===`|`){t.push({kind:`alternation`});continue}let a=Re(e,r);if(a){t.push({kind:`quantifier`,quantifier:a}),r+=a.consumed-1;continue}t.push({kind:`simple-token`})}return t}function Be(e){let t=[Pe()],n=e=>{let n=t[t.length-1];n.lastToken=e,e.containsRepetition&&(n.containsRepetition=!0),n.branchMinLength=Fe(n.branchMinLength,e.minLength),n.branchMaxLength=Fe(n.branchMaxLength,e.maxLength)},r=()=>{n({containsRepetition:!1,hasAmbiguousAlternation:!1,minLength:1,maxLength:1})};for(let i of e){if(i.kind===`simple-token`){r();continue}if(i.kind===`group-open`){t.push(Pe());continue}if(i.kind===`group-close`){if(t.length>1){let e=t.pop();e.hasAlternation&&Le(e);let r=e.hasAlternation?e.altMinLength??0:e.branchMinLength,i=e.hasAlternation?e.altMaxLength??0:e.branchMaxLength;n({containsRepetition:e.containsRepetition,hasAmbiguousAlternation:e.hasAlternation&&e.altMinLength!==null&&e.altMaxLength!==null&&e.altMinLength!==e.altMaxLength,minLength:r,maxLength:i})}continue}if(i.kind===`alternation`){let e=t[t.length-1];e.hasAlternation=!0,Le(e),e.branchMinLength=0,e.branchMaxLength=0,e.lastToken=null;continue}let e=t[t.length-1],a=e.lastToken;if(!a)continue;if(a.containsRepetition||a.hasAmbiguousAlternation&&i.quantifier.maxRepeat===null)return!0;let o=a.minLength,s=a.maxLength;a.minLength=Ie(a.minLength,i.quantifier.minRepeat),a.maxLength=i.quantifier.maxRepeat===null?1/0:Ie(a.maxLength,i.quantifier.maxRepeat),a.containsRepetition=!0,e.containsRepetition=!0,e.branchMinLength=e.branchMinLength-o+a.minLength,e.branchMaxLength=Fe(Number.isFinite(e.branchMaxLength)&&Number.isFinite(s)?e.branchMaxLength-s:1/0,a.maxLength)}return!1}function Ve(e){return Be(ze(e))}function He(e,t=``){let n=e.trim();if(!n)return{regex:null,source:n,flags:t,reason:`empty`};let r=`${t}::${n}`;if(C.has(r))return C.get(r)??{regex:null,source:n,flags:t,reason:`invalid-regex`};let i;if(Ve(n))i={regex:null,source:n,flags:t,reason:`unsafe-nested-repetition`};else try{i={regex:new RegExp(n,t),source:n,flags:t,reason:null}}catch{i={regex:null,source:n,flags:t,reason:`invalid-regex`}}if(C.set(r,i),C.size>256){let e=C.keys().next().value;e&&C.delete(e)}return i}function Ue(e){return e.reason===null||e.reason===`empty`?null:e.reason}function We(e,t=``){let n=He(e,t);return n.reason===`empty`?null:{regex:n.regex,pattern:n.source,flags:n.flags,reason:Ue(n)}}function w(e){let t=process.getBuiltinModule;if(typeof t!=`function`)return null;try{let n=t(`module`),r=typeof n.createRequire==`function`?n.createRequire:null;return r?r(e):null}catch{return null}}function Ge(e,t,n,r){let i=r?.chunkThreshold??32768,a=r?.chunkSize??16384;if(i<=0||a<=0||e.length<=i)return e.replace(t,n);let o=``;for(let r=0;r<e.length;r+=a)o+=e.slice(r,r+a).replace(t,n);return o}const Ke=w(import.meta.url),qe=[String.raw`\b[A-Z0-9_]*(?:KEY|TOKEN|SECRET|PASSWORD|PASSWD)\b\s*[=:]\s*(["']?)([^\s"'\\]+)\1`,String.raw`"(?:apiKey|token|secret|password|passwd|accessToken|refreshToken)"\s*:\s*"([^"]+)"`,String.raw`--(?:api[-_]?key|hook[-_]?token|token|secret|password|passwd)\s+(["']?)([^\s"']+)\1`,String.raw`Authorization\s*[:=]\s*Bearer\s+([A-Za-z0-9._\-+=]+)`,String.raw`\bBearer\s+([A-Za-z0-9._\-+=]{18,})\b`,String.raw`-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]+?-----END [A-Z ]*PRIVATE KEY-----`,String.raw`\b(sk-[A-Za-z0-9_-]{8,})\b`,String.raw`\b(ghp_[A-Za-z0-9]{20,})\b`,String.raw`\b(github_pat_[A-Za-z0-9_]{20,})\b`,String.raw`\b(xox[baprs]-[A-Za-z0-9-]{10,})\b`,String.raw`\b(xapp-[A-Za-z0-9-]{10,})\b`,String.raw`\b(gsk_[A-Za-z0-9_-]{10,})\b`,String.raw`\b(AIza[0-9A-Za-z\-_]{20,})\b`,String.raw`\b(pplx-[A-Za-z0-9_-]{10,})\b`,String.raw`\b(npm_[A-Za-z0-9]{10,})\b`,String.raw`\bbot(\d{6,}:[A-Za-z0-9_-]{20,})\b`,String.raw`\b(\d{6,}:[A-Za-z0-9_-]{20,})\b`];function Je(e){return e===`off`?`off`:`tools`}function Ye(e){if(e instanceof RegExp)return e.flags.includes(`g`)?e:new RegExp(e.source,`${e.flags}g`);if(!e.trim())return null;let t=e.match(/^\/(.+)\/([gimsuy]*)$/);if(t){let e=t[2].includes(`g`)?t[2]:`${t[2]}g`;return We(t[1],e)?.regex??null}return We(e,`gi`)?.regex??null}function Xe(e){return(e?.length?e:qe).map(Ye).filter(e=>!!e)}function Ze(e){return e.length<18?`***`:`${e.slice(0,6)}…${e.slice(-4)}`}function Qe(e){let t=e.split(/\r?\n/).filter(Boolean);return t.length<2?`***`:`${t[0]}\n…redacted…\n${t[t.length-1]}`}function $e(e,t){if(e.includes(`PRIVATE KEY-----`))return Qe(e);let n=t.findLast(e=>typeof e==`string`&&e.length>0)??e,r=Ze(n);return n===e?r:e.replace(n,r)}function et(e,t){let n=e;for(let e of t)n=Ge(n,e,(...e)=>$e(e[0],e.slice(1,-2)));return n}function tt(){let e;try{e=(Ke?.(`../config/config.js`))?.loadConfig?.().logging}catch{e=void 0}return{mode:Je(e?.redactSensitive),patterns:e?.redactPatterns}}function nt(e){let t=e??tt(),n=Je(t.mode);return n===`off`?{mode:n,patterns:[]}:{mode:n,patterns:Xe(t.patterns)}}function rt(e,t){if(!e)return e;let n=nt(t);return n.mode===`off`||!n.patterns.length?e:et(e,n.patterns)}function it(e){if(!e||typeof e!=`object`)return``;let t=e.name;return typeof t==`string`?t:``}function T(e){let t;if(e instanceof Error){t=e.message||e.name||`Error`;let n=e.cause,r=new Set([e]);for(;n&&!r.has(n);)if(r.add(n),n instanceof Error)n.message&&(t+=` | ${n.message}`),n=n.cause;else if(typeof n==`string`){t+=` | ${n}`;break}else break}else if(typeof e==`string`)t=e;else if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)t=String(e);else try{t=JSON.stringify(e)}catch{t=Object.prototype.toString.call(e)}return rt(t)}const E=`/tmp/openclaw`,at=b.constants.W_OK|b.constants.X_OK;function ot(e,t){return typeof e==`object`&&!!e&&`code`in e&&e.code===t}function st(e={}){let t=e.accessSync??b.accessSync,n=e.chmodSync??b.chmodSync,r=e.lstatSync??b.lstatSync,i=e.mkdirSync??b.mkdirSync,a=e.warn??(e=>console.warn(e)),o=e.getuid??(()=>{try{return typeof process.getuid==`function`?process.getuid():void 0}catch{return}}),s=typeof e.tmpdir==`function`?e.tmpdir:ge,c=o(),l=e=>c===void 0?!0:!(typeof e.uid==`number`&&e.uid!==c||typeof e.mode==`number`&&e.mode&18),u=()=>{let e=s(),t=c===void 0?`openclaw`:`openclaw-${c}`;return x.join(e,t)},d=e=>e.isDirectory()&&!e.isSymbolicLink()&&l(e),f=e=>{try{return d(r(e))?(t(e,at),`available`):`invalid`}catch(e){return ot(e,`ENOENT`)?`missing`:`invalid`}},p=e=>{try{let t=r(e);return!t.isDirectory()||t.isSymbolicLink()||c!==void 0&&typeof t.uid==`number`&&t.uid!==c||typeof t.mode!=`number`||!(t.mode&18)?!1:(n(e,448),a(`[openclaw] tightened permissions on temp dir: ${e}`),f(e)===`available`)}catch{return!1}},m=()=>{let e=u(),t=f(e);if(t===`available`)return e;if(t===`invalid`){if(p(e))return e;throw Error(`Unsafe fallback OpenClaw temp dir: ${e}`)}try{i(e,{recursive:!0,mode:448}),n(e,448)}catch{throw Error(`Unable to create fallback OpenClaw temp dir: ${e}`)}if(f(e)!==`available`&&!p(e))throw Error(`Unsafe fallback OpenClaw temp dir: ${e}`);return e},h=f(E);if(h===`available`)return E;if(h===`invalid`)return p(`/tmp/openclaw`)?E:m();try{return t(`/tmp`,at),i(E,{recursive:!0,mode:448}),n(E,448),f(`/tmp/openclaw`)!==`available`&&!p(`/tmp/openclaw`)?m():E}catch{return m()}}function ct(e){return{href:e.href,protocol:e.protocol,username:e.username,password:e.password,host:e.host,hostname:e.hostname,port:e.port,pathname:e.pathname,search:e.search,searchParams:[...e.searchParams].map(([e,t])=>({key:e,value:t})),hash:e.hash,origin:e.origin}}const lt={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]};function ut(e,t,n,r=!1){let i=String(t),a=(e,t)=>`\u001b[${t[0]}m${e}\u001b[${t[1]}m`,o=(e,t)=>t!=null&&typeof t==`string`?a(e,lt[t]):t!=null&&Array.isArray(t)?t.reduce((e,t)=>o(e,t),e):t!=null&&t[e.trim()]!=null?o(e,t[e.trim()]):t!=null&&t[`*`]!=null?o(e,t[`*`]):e;return i.replace(/{{(.+?)}}/g,(t,i)=>{let s=n[i]==null?r?``:t:String(n[i]);return e.stylePrettyLogs?o(s,e?.prettyLogStyles?.[i]??null)+a(``,lt.reset):s})}function D(e,t=2,n=0){return e!=null&&isNaN(e)?``:(e=e==null?e:e+n,t===2?e==null?`--`:e<10?`0`+e:e.toString():e==null?`---`:e<10?`00`+e:e<100?`0`+e:e.toString())}function dt(e,t){if(t==null)return{text:``,template:e.prettyLogTemplate,placeholders:{}};let n=e.prettyLogTemplate,r={};n.includes(`{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}`)?n=n.replace(`{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}`,`{{dateIsoStr}}`):e.prettyLogTimeZone===`UTC`?(r.yyyy=t.date?.getUTCFullYear()??`----`,r.mm=D(t.date?.getUTCMonth(),2,1),r.dd=D(t.date?.getUTCDate(),2),r.hh=D(t.date?.getUTCHours(),2),r.MM=D(t.date?.getUTCMinutes(),2),r.ss=D(t.date?.getUTCSeconds(),2),r.ms=D(t.date?.getUTCMilliseconds(),3)):(r.yyyy=t.date?.getFullYear()??`----`,r.mm=D(t.date?.getMonth(),2,1),r.dd=D(t.date?.getDate(),2),r.hh=D(t.date?.getHours(),2),r.MM=D(t.date?.getMinutes(),2),r.ss=D(t.date?.getSeconds(),2),r.ms=D(t.date?.getMilliseconds(),3));let i=e.prettyLogTimeZone===`UTC`?t.date:t.date==null?void 0:new Date(t.date.getTime()-t.date.getTimezoneOffset()*6e4);r.rawIsoStr=i?.toISOString()??``,r.dateIsoStr=i?.toISOString().replace(`T`,` `).replace(`Z`,``)??``,r.logLevelName=t.logLevelName,r.fileNameWithLine=t.path?.fileNameWithLine??``,r.filePathWithLine=t.path?.filePathWithLine??``,r.fullFilePath=t.path?.fullFilePath??``;let a=e.parentNames?.join(e.prettyErrorParentNamesSeparator);a=a!=null&&t.name!=null?a+e.prettyErrorParentNamesSeparator:void 0;let o=t.name!=null||a!=null?`${a??``}${t.name??``}`:``;return r.name=o,r.nameWithDelimiterPrefix=o.length>0?e.prettyErrorLoggerNameDelimiter+o:``,r.nameWithDelimiterSuffix=o.length>0?o+e.prettyErrorLoggerNameDelimiter:``,e.overwrite?.addPlaceholders!=null&&e.overwrite.addPlaceholders(t,r),{text:ut(e,n,r),template:n,placeholders:r}}const ft=[/(?:^|[\\/])node_modules[\\/].*tslog/i,/(?:^|[\\/])deps[\\/].*tslog/i,/tslog[\\/]+src[\\/]+internal[\\/]/i,/tslog[\\/]+src[\\/]BaseLogger/i,/tslog[\\/]+src[\\/]index/i];function pt(e){let t=typeof e?.stack==`string`?e.stack:void 0;return t==null||t.length===0?[]:t.split(`
|
|
1
|
+
import{c as e,o as t,r as n,s as r}from"./home-dir-C44RaPME-BqOMy1pu.mjs";import{o as i}from"./paths-D92DjaZ--CKAvIWoZ.mjs";import{n as a,s as o,t as s}from"./bundled-dir-U738ay4K-DxHVp4u1.mjs";import{i as c,n as l,r as u}from"./ids-BPsM98Uu-DGJB5aAM.mjs";import{t as d}from"./runtime-channel-state-CohMybAh-DfCjeyJq.mjs";import{F as f,M as p,N as m,O as h,_ as g,a as _,d as v,f as ee,i as te,k as ne,m as re,n as ie,o as ae,p as y,r as oe,s as se,t as ce}from"./manifest-registry-_hxKCS2K-ezh_x2Cu.mjs";import{r as le}from"./boundary-file-read-BSd9MXPy-Tpd4W7aA.mjs";import{r as ue,s as de,t as fe}from"./jiti-loader-cache-Bat69wam-Cq2EONsH.mjs";import{createRequire as pe}from"node:module";import b from"node:fs";import x from"node:path";import{fileURLToPath as me}from"node:url";import he,{tmpdir as ge}from"node:os";import{spawnSync as _e}from"node:child_process";import{createHash as ve}from"node:crypto";import ye from"node:process";import be from"node:tty";import{z as S}from"zod";function xe(e){return{configured:e.exposure?.configured??e.showConfigured??!0,setup:e.exposure?.setup??e.showInSetup??!0,docs:e.exposure?.docs??!0}}function Se(e){let t=t=>e.arrayFieldMode===`defined`?t!==void 0:!!t?.length,n=e.selectionDocsPrefixMode===`defined`?e.channel.selectionDocsPrefix!==void 0:!!e.channel.selectionDocsPrefix;return{id:e.id,label:e.label,selectionLabel:e.selectionLabel,docsPath:e.docsPath,docsLabel:e.docsLabel,blurb:e.blurb,...t(e.channel.aliases)?{aliases:e.channel.aliases}:{},...e.channel.order===void 0?{}:{order:e.channel.order},...n?{selectionDocsPrefix:e.channel.selectionDocsPrefix}:{},...e.channel.selectionDocsOmitLabel===void 0?{}:{selectionDocsOmitLabel:e.channel.selectionDocsOmitLabel},...t(e.channel.selectionExtras)?{selectionExtras:e.channel.selectionExtras}:{},...e.detailLabel?{detailLabel:e.detailLabel}:{},...e.systemImage?{systemImage:e.systemImage}:{},...e.channel.markdownCapable===void 0?{}:{markdownCapable:e.channel.markdownCapable},exposure:xe(e.channel),...e.channel.quickstartAllowFrom===void 0?{}:{quickstartAllowFrom:e.channel.quickstartAllowFrom},...e.channel.forceAccountBinding===void 0?{}:{forceAccountBinding:e.channel.forceAccountBinding},...e.channel.preferSessionLookupForAnnounceTarget===void 0?{}:{preferSessionLookupForAnnounceTarget:e.channel.preferSessionLookupForAnnounceTarget},...t(e.channel.preferOver)?{preferOver:e.channel.preferOver}:{}}}const Ce=new Set(l);function we(t){let n=e(t.channel.label);if(!n)throw Error(`Missing label for bundled chat channel "${t.id}"`);return Se({id:t.id,channel:t.channel,label:n,selectionLabel:e(t.channel.selectionLabel)||n,docsPath:e(t.channel.docsPath)||`/channels/${t.id}`,docsLabel:e(t.channel.docsLabel),blurb:e(t.channel.blurb)||``,detailLabel:e(t.channel.detailLabel),systemImage:e(t.channel.systemImage),arrayFieldMode:`non-empty`,selectionDocsPrefixMode:`defined`})}function Te(){let t=new Map;for(let n of u()){let r=e(n.id);if(!r||!Ce.has(r))continue;let i=r;t.set(i,we({id:i,channel:n.channel}))}return Object.freeze(Object.fromEntries(t))}const Ee=Te();function De(){return l.map(e=>Ee[e])}function Oe(e){return Ee[e]}function ke(){let e=d();return e&&e.channels&&e.channels.length>0?e.channels:[]}function Ae(e){return ke().find(t=>{let n=r(t.plugin.id??``)??``;return n&&n===e?!0:(t.plugin.meta?.aliases??[]).some(t=>r(t)===e)})}function je(e){return c(e)}function Me(e){let t=r(e);return t?Ae(t)?.plugin.id??null:null}function Ne(){return ke().flatMap(t=>{let n=e(t.plugin.id);return n?[n]:[]})}const C=new Map;function Pe(){return{lastToken:null,containsRepetition:!1,hasAlternation:!1,branchMinLength:0,branchMaxLength:0,altMinLength:null,altMaxLength:null}}function Fe(e,t){return!Number.isFinite(e)||!Number.isFinite(t)?1/0:e+t}function Ie(e,t){return Number.isFinite(e)?e*t:t===0?0:1/0}function Le(e){if(e.altMinLength===null||e.altMaxLength===null){e.altMinLength=e.branchMinLength,e.altMaxLength=e.branchMaxLength;return}e.altMinLength=Math.min(e.altMinLength,e.branchMinLength),e.altMaxLength=Math.max(e.altMaxLength,e.branchMaxLength)}function Re(e,t){let n=e[t],r=e[t+1]===`?`?2:1;if(n===`*`)return{consumed:r,minRepeat:0,maxRepeat:null};if(n===`+`)return{consumed:r,minRepeat:1,maxRepeat:null};if(n===`?`)return{consumed:r,minRepeat:0,maxRepeat:1};if(n!==`{`)return null;let i=t+1;for(;i<e.length&&/\d/.test(e[i]);)i+=1;if(i===t+1)return null;let a=Number.parseInt(e.slice(t+1,i),10),o=a;if(e[i]===`,`){i+=1;let t=i;for(;i<e.length&&/\d/.test(e[i]);)i+=1;o=i===t?null:Number.parseInt(e.slice(t,i),10)}return e[i]!==`}`||(i+=1,e[i]===`?`&&(i+=1),o!==null&&o<a)?null:{consumed:i-t,minRepeat:a,maxRepeat:o}}function ze(e){let t=[],n=!1;for(let r=0;r<e.length;r+=1){let i=e[r];if(i===`\\`){r+=1,t.push({kind:`simple-token`});continue}if(n){i===`]`&&(n=!1);continue}if(i===`[`){n=!0,t.push({kind:`simple-token`});continue}if(i===`(`){t.push({kind:`group-open`});continue}if(i===`)`){t.push({kind:`group-close`});continue}if(i===`|`){t.push({kind:`alternation`});continue}let a=Re(e,r);if(a){t.push({kind:`quantifier`,quantifier:a}),r+=a.consumed-1;continue}t.push({kind:`simple-token`})}return t}function Be(e){let t=[Pe()],n=e=>{let n=t[t.length-1];n.lastToken=e,e.containsRepetition&&(n.containsRepetition=!0),n.branchMinLength=Fe(n.branchMinLength,e.minLength),n.branchMaxLength=Fe(n.branchMaxLength,e.maxLength)},r=()=>{n({containsRepetition:!1,hasAmbiguousAlternation:!1,minLength:1,maxLength:1})};for(let i of e){if(i.kind===`simple-token`){r();continue}if(i.kind===`group-open`){t.push(Pe());continue}if(i.kind===`group-close`){if(t.length>1){let e=t.pop();e.hasAlternation&&Le(e);let r=e.hasAlternation?e.altMinLength??0:e.branchMinLength,i=e.hasAlternation?e.altMaxLength??0:e.branchMaxLength;n({containsRepetition:e.containsRepetition,hasAmbiguousAlternation:e.hasAlternation&&e.altMinLength!==null&&e.altMaxLength!==null&&e.altMinLength!==e.altMaxLength,minLength:r,maxLength:i})}continue}if(i.kind===`alternation`){let e=t[t.length-1];e.hasAlternation=!0,Le(e),e.branchMinLength=0,e.branchMaxLength=0,e.lastToken=null;continue}let e=t[t.length-1],a=e.lastToken;if(!a)continue;if(a.containsRepetition||a.hasAmbiguousAlternation&&i.quantifier.maxRepeat===null)return!0;let o=a.minLength,s=a.maxLength;a.minLength=Ie(a.minLength,i.quantifier.minRepeat),a.maxLength=i.quantifier.maxRepeat===null?1/0:Ie(a.maxLength,i.quantifier.maxRepeat),a.containsRepetition=!0,e.containsRepetition=!0,e.branchMinLength=e.branchMinLength-o+a.minLength,e.branchMaxLength=Fe(Number.isFinite(e.branchMaxLength)&&Number.isFinite(s)?e.branchMaxLength-s:1/0,a.maxLength)}return!1}function Ve(e){return Be(ze(e))}function He(e,t=``){let n=e.trim();if(!n)return{regex:null,source:n,flags:t,reason:`empty`};let r=`${t}::${n}`;if(C.has(r))return C.get(r)??{regex:null,source:n,flags:t,reason:`invalid-regex`};let i;if(Ve(n))i={regex:null,source:n,flags:t,reason:`unsafe-nested-repetition`};else try{i={regex:new RegExp(n,t),source:n,flags:t,reason:null}}catch{i={regex:null,source:n,flags:t,reason:`invalid-regex`}}if(C.set(r,i),C.size>256){let e=C.keys().next().value;e&&C.delete(e)}return i}function Ue(e){return e.reason===null||e.reason===`empty`?null:e.reason}function We(e,t=``){let n=He(e,t);return n.reason===`empty`?null:{regex:n.regex,pattern:n.source,flags:n.flags,reason:Ue(n)}}function w(e){let t=process.getBuiltinModule;if(typeof t!=`function`)return null;try{let n=t(`module`),r=typeof n.createRequire==`function`?n.createRequire:null;return r?r(e):null}catch{return null}}function Ge(e,t,n,r){let i=r?.chunkThreshold??32768,a=r?.chunkSize??16384;if(i<=0||a<=0||e.length<=i)return e.replace(t,n);let o=``;for(let r=0;r<e.length;r+=a)o+=e.slice(r,r+a).replace(t,n);return o}const Ke=w(import.meta.url),qe=[String.raw`\b[A-Z0-9_]*(?:KEY|TOKEN|SECRET|PASSWORD|PASSWD)\b\s*[=:]\s*(["']?)([^\s"'\\]+)\1`,String.raw`"(?:apiKey|token|secret|password|passwd|accessToken|refreshToken)"\s*:\s*"([^"]+)"`,String.raw`--(?:api[-_]?key|hook[-_]?token|token|secret|password|passwd)\s+(["']?)([^\s"']+)\1`,String.raw`Authorization\s*[:=]\s*Bearer\s+([A-Za-z0-9._\-+=]+)`,String.raw`\bBearer\s+([A-Za-z0-9._\-+=]{18,})\b`,String.raw`-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]+?-----END [A-Z ]*PRIVATE KEY-----`,String.raw`\b(sk-[A-Za-z0-9_-]{8,})\b`,String.raw`\b(ghp_[A-Za-z0-9]{20,})\b`,String.raw`\b(github_pat_[A-Za-z0-9_]{20,})\b`,String.raw`\b(xox[baprs]-[A-Za-z0-9-]{10,})\b`,String.raw`\b(xapp-[A-Za-z0-9-]{10,})\b`,String.raw`\b(gsk_[A-Za-z0-9_-]{10,})\b`,String.raw`\b(AIza[0-9A-Za-z\-_]{20,})\b`,String.raw`\b(pplx-[A-Za-z0-9_-]{10,})\b`,String.raw`\b(npm_[A-Za-z0-9]{10,})\b`,String.raw`\bbot(\d{6,}:[A-Za-z0-9_-]{20,})\b`,String.raw`\b(\d{6,}:[A-Za-z0-9_-]{20,})\b`];function Je(e){return e===`off`?`off`:`tools`}function Ye(e){if(e instanceof RegExp)return e.flags.includes(`g`)?e:new RegExp(e.source,`${e.flags}g`);if(!e.trim())return null;let t=e.match(/^\/(.+)\/([gimsuy]*)$/);if(t){let e=t[2].includes(`g`)?t[2]:`${t[2]}g`;return We(t[1],e)?.regex??null}return We(e,`gi`)?.regex??null}function Xe(e){return(e?.length?e:qe).map(Ye).filter(e=>!!e)}function Ze(e){return e.length<18?`***`:`${e.slice(0,6)}…${e.slice(-4)}`}function Qe(e){let t=e.split(/\r?\n/).filter(Boolean);return t.length<2?`***`:`${t[0]}\n…redacted…\n${t[t.length-1]}`}function $e(e,t){if(e.includes(`PRIVATE KEY-----`))return Qe(e);let n=t.findLast(e=>typeof e==`string`&&e.length>0)??e,r=Ze(n);return n===e?r:e.replace(n,r)}function et(e,t){let n=e;for(let e of t)n=Ge(n,e,(...e)=>$e(e[0],e.slice(1,-2)));return n}function tt(){let e;try{e=(Ke?.(`../config/config.js`))?.loadConfig?.().logging}catch{e=void 0}return{mode:Je(e?.redactSensitive),patterns:e?.redactPatterns}}function nt(e){let t=e??tt(),n=Je(t.mode);return n===`off`?{mode:n,patterns:[]}:{mode:n,patterns:Xe(t.patterns)}}function rt(e,t){if(!e)return e;let n=nt(t);return n.mode===`off`||!n.patterns.length?e:et(e,n.patterns)}function it(e){if(!e||typeof e!=`object`)return``;let t=e.name;return typeof t==`string`?t:``}function T(e){let t;if(e instanceof Error){t=e.message||e.name||`Error`;let n=e.cause,r=new Set([e]);for(;n&&!r.has(n);)if(r.add(n),n instanceof Error)n.message&&(t+=` | ${n.message}`),n=n.cause;else if(typeof n==`string`){t+=` | ${n}`;break}else break}else if(typeof e==`string`)t=e;else if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)t=String(e);else try{t=JSON.stringify(e)}catch{t=Object.prototype.toString.call(e)}return rt(t)}const E=`/tmp/openclaw`,at=b.constants.W_OK|b.constants.X_OK;function ot(e,t){return typeof e==`object`&&!!e&&`code`in e&&e.code===t}function st(e={}){let t=e.accessSync??b.accessSync,n=e.chmodSync??b.chmodSync,r=e.lstatSync??b.lstatSync,i=e.mkdirSync??b.mkdirSync,a=e.warn??(e=>console.warn(e)),o=e.getuid??(()=>{try{return typeof process.getuid==`function`?process.getuid():void 0}catch{return}}),s=typeof e.tmpdir==`function`?e.tmpdir:ge,c=o(),l=e=>c===void 0?!0:!(typeof e.uid==`number`&&e.uid!==c||typeof e.mode==`number`&&e.mode&18),u=()=>{let e=s(),t=c===void 0?`openclaw`:`openclaw-${c}`;return x.join(e,t)},d=e=>e.isDirectory()&&!e.isSymbolicLink()&&l(e),f=e=>{try{return d(r(e))?(t(e,at),`available`):`invalid`}catch(e){return ot(e,`ENOENT`)?`missing`:`invalid`}},p=e=>{try{let t=r(e);return!t.isDirectory()||t.isSymbolicLink()||c!==void 0&&typeof t.uid==`number`&&t.uid!==c||typeof t.mode!=`number`||!(t.mode&18)?!1:(n(e,448),a(`[openclaw] tightened permissions on temp dir: ${e}`),f(e)===`available`)}catch{return!1}},m=()=>{let e=u(),t=f(e);if(t===`available`)return e;if(t===`invalid`){if(p(e))return e;throw Error(`Unsafe fallback OpenClaw temp dir: ${e}`)}try{i(e,{recursive:!0,mode:448}),n(e,448)}catch{throw Error(`Unable to create fallback OpenClaw temp dir: ${e}`)}if(f(e)!==`available`&&!p(e))throw Error(`Unsafe fallback OpenClaw temp dir: ${e}`);return e},h=f(E);if(h===`available`)return E;if(h===`invalid`)return p(`/tmp/openclaw`)?E:m();try{return t(`/tmp`,at),i(E,{recursive:!0,mode:448}),n(E,448),f(`/tmp/openclaw`)!==`available`&&!p(`/tmp/openclaw`)?m():E}catch{return m()}}function ct(e){return{href:e.href,protocol:e.protocol,username:e.username,password:e.password,host:e.host,hostname:e.hostname,port:e.port,pathname:e.pathname,search:e.search,searchParams:[...e.searchParams].map(([e,t])=>({key:e,value:t})),hash:e.hash,origin:e.origin}}const lt={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]};function ut(e,t,n,r=!1){let i=String(t),a=(e,t)=>`\u001b[${t[0]}m${e}\u001b[${t[1]}m`,o=(e,t)=>t!=null&&typeof t==`string`?a(e,lt[t]):t!=null&&Array.isArray(t)?t.reduce((e,t)=>o(e,t),e):t!=null&&t[e.trim()]!=null?o(e,t[e.trim()]):t!=null&&t[`*`]!=null?o(e,t[`*`]):e;return i.replace(/{{(.+?)}}/g,(t,i)=>{let s=n[i]==null?r?``:t:String(n[i]);return e.stylePrettyLogs?o(s,e?.prettyLogStyles?.[i]??null)+a(``,lt.reset):s})}function D(e,t=2,n=0){return e!=null&&isNaN(e)?``:(e=e==null?e:e+n,t===2?e==null?`--`:e<10?`0`+e:e.toString():e==null?`---`:e<10?`00`+e:e<100?`0`+e:e.toString())}function dt(e,t){if(t==null)return{text:``,template:e.prettyLogTemplate,placeholders:{}};let n=e.prettyLogTemplate,r={};n.includes(`{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}`)?n=n.replace(`{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}`,`{{dateIsoStr}}`):e.prettyLogTimeZone===`UTC`?(r.yyyy=t.date?.getUTCFullYear()??`----`,r.mm=D(t.date?.getUTCMonth(),2,1),r.dd=D(t.date?.getUTCDate(),2),r.hh=D(t.date?.getUTCHours(),2),r.MM=D(t.date?.getUTCMinutes(),2),r.ss=D(t.date?.getUTCSeconds(),2),r.ms=D(t.date?.getUTCMilliseconds(),3)):(r.yyyy=t.date?.getFullYear()??`----`,r.mm=D(t.date?.getMonth(),2,1),r.dd=D(t.date?.getDate(),2),r.hh=D(t.date?.getHours(),2),r.MM=D(t.date?.getMinutes(),2),r.ss=D(t.date?.getSeconds(),2),r.ms=D(t.date?.getMilliseconds(),3));let i=e.prettyLogTimeZone===`UTC`?t.date:t.date==null?void 0:new Date(t.date.getTime()-t.date.getTimezoneOffset()*6e4);r.rawIsoStr=i?.toISOString()??``,r.dateIsoStr=i?.toISOString().replace(`T`,` `).replace(`Z`,``)??``,r.logLevelName=t.logLevelName,r.fileNameWithLine=t.path?.fileNameWithLine??``,r.filePathWithLine=t.path?.filePathWithLine??``,r.fullFilePath=t.path?.fullFilePath??``;let a=e.parentNames?.join(e.prettyErrorParentNamesSeparator);a=a!=null&&t.name!=null?a+e.prettyErrorParentNamesSeparator:void 0;let o=t.name!=null||a!=null?`${a??``}${t.name??``}`:``;return r.name=o,r.nameWithDelimiterPrefix=o.length>0?e.prettyErrorLoggerNameDelimiter+o:``,r.nameWithDelimiterSuffix=o.length>0?o+e.prettyErrorLoggerNameDelimiter:``,e.overwrite?.addPlaceholders!=null&&e.overwrite.addPlaceholders(t,r),{text:ut(e,n,r),template:n,placeholders:r}}const ft=[/(?:^|[\\/])node_modules[\\/].*tslog/i,/(?:^|[\\/])deps[\\/].*tslog/i,/tslog[\\/]+src[\\/]+internal[\\/]/i,/tslog[\\/]+src[\\/]BaseLogger/i,/tslog[\\/]+src[\\/]index/i];function pt(e){let t=typeof e?.stack==`string`?e.stack:void 0;return t==null||t.length===0?[]:t.split(`
|
|
2
2
|
`).map(e=>e.trimEnd())}function mt(e){return e.filter(e=>e.length>0&&!/^\s*Error\b/.test(e))}function ht(e,t){let n=[];for(let r of e){let e=t(r);e!=null&&n.push(e)}return n}function gt(e,t=ft){for(let n=0;n<e.length;n+=1){let r=e[n],i=r.filePath??``,a=r.fullFilePath??``;if(!t.some(e=>e.test(i)||e.test(a)))return n}return 0}function _t(e){return mt(pt(e))}function vt(e,t){return ht(_t(e),t)}function yt(e,t){return e<0?0:e>=t?Math.max(0,t-1):e}function bt(){return[...ft]}function xt(e,t={}){let n=t.maxDepth??5,r=[],i=new Set,a=e,o=0;for(;a!=null&&o<n;){let e=a?.cause;if(e==null||i.has(e))break;i.add(e),r.push(St(e)),a=e,o+=1}return r}function St(e){if(e instanceof Error)return e;let t=Error(typeof e==`string`?e:JSON.stringify(e));return typeof e==`object`&&e&&Object.assign(t,e),t}function Ct(e){let t=new Set;return JSON.stringify(e,(e,n)=>{if(typeof n==`object`&&n){if(t.has(n))return`[Circular]`;t.add(n)}return typeof n==`bigint`?`${n}`:n===void 0?`[undefined]`:n})}function O(e,t){let n={seen:[],stylize:Tt};return t!=null&&Ut(n,t),k(n.showHidden)&&(n.showHidden=!1),k(n.depth)&&(n.depth=2),k(n.colors)&&(n.colors=!0),k(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=Et),Bt(n,e,n.depth)}O.colors=lt,O.styles={special:`cyan`,number:`yellow`,boolean:`yellow`,undefined:`grey`,null:`bold`,string:`green`,date:`magenta`,regexp:`red`};function wt(e){return typeof e==`boolean`}function k(e){return e===void 0}function Tt(e){return e}function Et(e,t){let n=O.styles[t];return n!=null&&O?.colors?.[n]?.[0]!=null&&O?.colors?.[n]?.[1]!=null?`\x1B[`+O.colors[n][0]+`m`+e+`\x1B[`+O.colors[n][1]+`m`:e}function Dt(e){return typeof e==`function`}function Ot(e){return typeof e==`string`}function kt(e){return typeof e==`number`}function At(e){return e===null}function jt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Mt(e){return Nt(e)&&It(e)===`[object RegExp]`}function Nt(e){return typeof e==`object`&&!!e}function Pt(e){return Nt(e)&&(It(e)===`[object Error]`||e instanceof Error)}function Ft(e){return Nt(e)&&It(e)===`[object Date]`}function It(e){return Object.prototype.toString.call(e)}function Lt(e){let t={};return e.forEach(e=>{t[e]=!0}),t}function Rt(e,t,n,r,i){let a=[];for(let i=0,o=t.length;i<o;++i)jt(t,String(i))?a.push(Vt(e,t,n,r,String(i),!0)):a.push(``);return i.forEach(i=>{i.match(/^\d+$/)||a.push(Vt(e,t,n,r,i,!0))}),a}function zt(e){return`[`+Error.prototype.toString.call(e)+`]`}function Bt(e,t,n=0){if(e.customInspect&&t!=null&&Dt(t)&&t?.inspect!==O&&!(t?.constructor&&t?.constructor.prototype===t)){if(typeof t.inspect!=`function`&&t.toString!=null)return t.toString();let r=t?.inspect(n,e);return Ot(r)||(r=Bt(e,r,n)),r}let r=A(e,t);if(r)return r;let i=Object.keys(t),a=Lt(i);try{e.showHidden&&Object.getOwnPropertyNames&&(i=Object.getOwnPropertyNames(t))}catch{}if(Pt(t)&&(i.indexOf(`message`)>=0||i.indexOf(`description`)>=0))return zt(t);if(i.length===0)if(Dt(e.stylize)){if(Dt(t)){let n=t.name?`: `+t.name:``;return e.stylize(`[Function`+n+`]`,`special`)}if(Mt(t))return e.stylize(RegExp.prototype.toString.call(t),`regexp`);if(Ft(t))return e.stylize(Date.prototype.toISOString.call(t),`date`);if(Pt(t))return zt(t)}else return t;let o=``,s=!1,c=[`{
|
|
3
3
|
`,`
|
|
4
4
|
}`];if(Array.isArray(t)&&(s=!0,c=[`[
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t,r as n,s as r}from"./home-dir-C44RaPME-
|
|
1
|
+
import{i as e,n as t,r as n,s as r}from"./home-dir-C44RaPME-BqOMy1pu.mjs";import i from"node:fs";import a from"node:path";import{fileURLToPath as o}from"node:url";import"node:fs/promises";import s from"node:os";function c(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.prototype.toString.call(e)===`[object Object]`}async function l(e){await i.promises.mkdir(e,{recursive:!0})}function u(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function d(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function f(e){return e>=55296&&e<=56319}function p(e){return e>=56320&&e<=57343}function m(e,t,n){let r=e.length,i=t<0?Math.max(r+t,0):Math.min(t,r),a=n===void 0?r:n<0?Math.max(r+n,0):Math.min(n,r);if(a<i){let e=i;i=a,a=e}return i>0&&i<r&&p(e.charCodeAt(i))&&f(e.charCodeAt(i-1))&&(i+=1),a>0&&a<r&&f(e.charCodeAt(a-1))&&p(e.charCodeAt(a))&&--a,e.slice(i,a)}function h(e,t){let n=Math.max(0,Math.floor(t));return e.length<=n?e:m(e,0,n)}function g(e,t=process.env,r=s.homedir){return e?n(e,{env:t,homedir:r}):``}function _(t=process.env,n=s.homedir){let r=t.OPENCLAW_STATE_DIR?.trim();if(r)return g(r,t,n);let o=t.OPENCLAW_CONFIG_PATH?.trim();if(o)return a.dirname(g(o,t,n));let c=a.join(e(t,n),`.openclaw`);try{if(i.existsSync(c))return c}catch{}return c}function v(){return t(process.env,s.homedir)}function y(){let e=v();if(e)return process.env.OPENCLAW_HOME?.trim()?{home:e,prefix:`$OPENCLAW_HOME`}:{home:e,prefix:`~`}}function b(e){if(!e)return e;let t=y();return t?e.split(t.home).join(t.prefix):e}const x=_(),S=new Set([`openclaw`]);function C(e){let t=JSON.parse(e);return typeof t.name==`string`?t.name:null}function w(e){try{return C(i.readFileSync(a.join(e,`package.json`),`utf-8`))}catch{return null}}function T(e,t=12){for(let n of E(e,t)){let e=w(n);if(e&&S.has(e))return n}return null}function*E(e,t){let n=a.resolve(e);for(let e=0;e<t;e+=1){yield n;let e=a.dirname(n);if(e===n)break;n=e}}function D(e){let t=a.resolve(e),n=[a.dirname(t)];try{let e=i.realpathSync(t);e!==t&&n.push(a.dirname(e))}catch{}let r=t.split(a.sep),o=r.lastIndexOf(`.bin`);if(o>0&&r[o-1]===`node_modules`){let e=a.basename(t),i=r.slice(0,o).join(a.sep);n.push(a.join(i,e))}return n}function O(e){for(let t of k(e)){let e=T(t);if(e)return e}return null}function k(e){let t=[];if(e.moduleUrl)try{t.push(a.dirname(o(e.moduleUrl)))}catch{}return e.argv1&&t.push(...D(e.argv1)),e.cwd&&t.push(e.cwd),t}const A=a.join(s.tmpdir(),`openclaw-empty-bundled-plugins`);function j(e){let t=r(e.OPENCLAW_DISABLE_BUNDLED_PLUGINS);return t===`1`||t===`true`}function M(){return i.mkdirSync(A,{recursive:!0}),A}function N(e){return i.existsSync(a.join(e,`.git`))&&i.existsSync(a.join(e,`src`))&&i.existsSync(a.join(e,`extensions`))}function P(e){if(!i.existsSync(e))return!1;try{return i.readdirSync(e,{withFileTypes:!0}).some(t=>{if(!t.isDirectory())return!1;let n=a.join(e,t.name);return i.existsSync(a.join(n,`package.json`))||i.existsSync(a.join(n,`openclaw.plugin.json`))})}catch{return!1}}function F(){let e=process.argv[1]?.toLowerCase();if(e?.endsWith(`.ts`)||e?.endsWith(`.tsx`)||e?.endsWith(`.mts`)||e?.endsWith(`.cts`))return!0;for(let e=0;e<process.execArgv.length;e+=1){let t=process.execArgv[e]?.toLowerCase();if(t){if(t===`tsx`||t.includes(`tsx/register`))return!0;if((t===`--import`||t===`--loader`)&&process.execArgv[e+1]){let t=process.execArgv[e+1].toLowerCase();if(t===`tsx`||t.includes(`tsx/`))return!0}}}return!1}function I(e,t){let n=a.join(e,`extensions`),r=a.join(e,`dist`,`extensions`),o=N(e);if(t&&i.existsSync(n))return n;let s=a.join(e,`dist-runtime`,`extensions`),c=o?P(s):i.existsSync(s),l=o?P(r):i.existsSync(r);if(c&&l)return s;if(l)return r;if(o&&i.existsSync(n))return n}function L(e=process.env){if(j(e))return M();let t=e.OPENCLAW_BUNDLED_PLUGINS_DIR?.trim();if(t){let n=g(t,e);if(i.existsSync(n))return n;try{let e=O({argv1:process.argv[1]});if(e&&!N(e)){let t=I(e,!1);if(t)return t}}catch{}return n}let n=!!e.VITEST||F();try{let e=[O({argv1:process.argv[1]}),O({cwd:process.cwd()}),O({moduleUrl:import.meta.url})].filter((e,t,n)=>!!e&&n.indexOf(e)===t);for(let t of e){let e=I(t,n);if(e)return e}}catch{}try{let e=a.dirname(process.execPath),t=a.join(e,`dist`,`extensions`);if(i.existsSync(t))return t;let n=a.join(e,`extensions`);if(i.existsSync(n))return n}catch{}try{let e=a.dirname(o(import.meta.url));for(let t=0;t<6;t+=1){let t=a.join(e,`extensions`);if(i.existsSync(t))return t;let n=a.dirname(e);if(n===e)break;e=n}}catch{}}export{u as a,_ as c,h as d,l as i,g as l,O as n,c as o,x as r,d as s,L as t,b as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,t}from"./chunk-DHbaKqs-.mjs";import{c as n,o as r}from"./home-dir-C44RaPME-
|
|
1
|
+
import{a as e,t}from"./chunk-DHbaKqs-.mjs";import{c as n,o as r}from"./home-dir-C44RaPME-BqOMy1pu.mjs";import{i,o as a,r as o}from"./paths-D92DjaZ--CKAvIWoZ.mjs";import{i as s,l as c,r as l,u}from"./bundled-dir-U738ay4K-DxHVp4u1.mjs";import{T as d,b as f,n as p,x as m,y as h}from"./io-CH2g3vsv-BevbMdi6.mjs";import{_t as g,bt as _,dt as v,lt as y,ut as b,xt as x,yt as S}from"./bundled-compat-BpaDaAAu-DElY7pj-.mjs";import{n as C,r as w,t as T}from"./message-channel-Bk_YHfQg-BGBJVvRK.mjs";import{E}from"./manifest-registry-_hxKCS2K-ezh_x2Cu.mjs";import{g as D,h as O}from"./runtime-snapshot-C54O1-gI-0r2omPvJ.mjs";import{r as k}from"./runtime-state-IBOIXKOx-Cr97WVOr.mjs";import{n as ee}from"./gateway-method-policy-C7rf0SeV-DXbYlbpG.mjs";import{C as A,J as j,K as M,N,V as te,W as P,X as ne,d as F,j as I,k as L,nt as R,r as re,st as z,v as B,x as V}from"./build-DSSm_dj2.mjs";import{t as ie}from"./resolve-C33B7eeu-DhMVJCKm.mjs";import H from"node:fs";import U from"node:path";import ae from"node:fs/promises";import"node:os";import{execFile as oe,execFileSync as se}from"node:child_process";import ce,{X509Certificate as le,randomUUID as ue}from"node:crypto";import{promisify as de}from"node:util";import{z as fe}from"zod";import pe from"node:net";import{Buffer as me}from"node:buffer";import{WebSocket as he}from"ws";const ge=[`external_user`,`inter_session`,`internal_system`],W={AUTH_REQUIRED:`AUTH_REQUIRED`,AUTH_UNAUTHORIZED:`AUTH_UNAUTHORIZED`,AUTH_TOKEN_MISSING:`AUTH_TOKEN_MISSING`,AUTH_TOKEN_MISMATCH:`AUTH_TOKEN_MISMATCH`,AUTH_TOKEN_NOT_CONFIGURED:`AUTH_TOKEN_NOT_CONFIGURED`,AUTH_PASSWORD_MISSING:`AUTH_PASSWORD_MISSING`,AUTH_PASSWORD_MISMATCH:`AUTH_PASSWORD_MISMATCH`,AUTH_PASSWORD_NOT_CONFIGURED:`AUTH_PASSWORD_NOT_CONFIGURED`,AUTH_BOOTSTRAP_TOKEN_INVALID:`AUTH_BOOTSTRAP_TOKEN_INVALID`,AUTH_DEVICE_TOKEN_MISMATCH:`AUTH_DEVICE_TOKEN_MISMATCH`,AUTH_RATE_LIMITED:`AUTH_RATE_LIMITED`,AUTH_TAILSCALE_IDENTITY_MISSING:`AUTH_TAILSCALE_IDENTITY_MISSING`,AUTH_TAILSCALE_PROXY_MISSING:`AUTH_TAILSCALE_PROXY_MISSING`,AUTH_TAILSCALE_WHOIS_FAILED:`AUTH_TAILSCALE_WHOIS_FAILED`,AUTH_TAILSCALE_IDENTITY_MISMATCH:`AUTH_TAILSCALE_IDENTITY_MISMATCH`,CONTROL_UI_ORIGIN_NOT_ALLOWED:`CONTROL_UI_ORIGIN_NOT_ALLOWED`,CONTROL_UI_DEVICE_IDENTITY_REQUIRED:`CONTROL_UI_DEVICE_IDENTITY_REQUIRED`,DEVICE_IDENTITY_REQUIRED:`DEVICE_IDENTITY_REQUIRED`,DEVICE_AUTH_INVALID:`DEVICE_AUTH_INVALID`,DEVICE_AUTH_DEVICE_ID_MISMATCH:`DEVICE_AUTH_DEVICE_ID_MISMATCH`,DEVICE_AUTH_SIGNATURE_EXPIRED:`DEVICE_AUTH_SIGNATURE_EXPIRED`,DEVICE_AUTH_NONCE_REQUIRED:`DEVICE_AUTH_NONCE_REQUIRED`,DEVICE_AUTH_NONCE_MISMATCH:`DEVICE_AUTH_NONCE_MISMATCH`,DEVICE_AUTH_SIGNATURE_INVALID:`DEVICE_AUTH_SIGNATURE_INVALID`,DEVICE_AUTH_PUBLIC_KEY_INVALID:`DEVICE_AUTH_PUBLIC_KEY_INVALID`,PAIRING_REQUIRED:`PAIRING_REQUIRED`},_e={NOT_PAIRED:`not-paired`,ROLE_UPGRADE:`role-upgrade`,SCOPE_UPGRADE:`scope-upgrade`,METADATA_UPGRADE:`metadata-upgrade`},ve=new Set([`retry_with_device_token`,`update_auth_configuration`,`update_auth_credentials`,`wait_then_retry`,`review_auth_configuration`]),ye=new Set([`not-paired`,`role-upgrade`,`scope-upgrade`,`metadata-upgrade`]),be=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/,xe={"not-paired":{requirement:`device is not approved yet`,remediationHint:`Approve this device from the pending pairing requests.`,recoveryTitle:`Gateway pairing approval required.`},"role-upgrade":{requirement:`device is asking for a higher role than currently approved`,remediationHint:`Review the requested role upgrade, then approve the pending request.`,recoveryTitle:`Gateway role upgrade approval required.`},"scope-upgrade":{requirement:`device is asking for more scopes than currently approved`,remediationHint:`Review the requested scopes, then approve the pending upgrade.`,recoveryTitle:`Gateway scope upgrade approval required.`},"metadata-upgrade":{requirement:`device identity changed and must be re-approved`,remediationHint:`Review the refreshed device details, then approve the pending request.`,recoveryTitle:`Gateway device refresh approval required.`}},Se={"not-paired":`device pairing required`,"role-upgrade":`role upgrade pending approval`,"scope-upgrade":`scope upgrade pending approval`,"metadata-upgrade":`device metadata change pending approval`};function Ce(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.code;return typeof t==`string`&&t.trim().length>0?t:null}function we(e){if(!e||typeof e!=`object`||Array.isArray(e))return{};let t=e,r=typeof t.canRetryWithDeviceToken==`boolean`?t.canRetryWithDeviceToken:void 0,i=n(t.recommendedNextStep)??``;return{canRetryWithDeviceToken:r,recommendedNextStep:ve.has(i)?i:void 0}}function Te(e){let t=n(e)??``;return ye.has(t)?t:void 0}function Ee(e){let t=n(e);return t&&be.test(t)?t:void 0}function De(e){if(!Array.isArray(e))return;let t=e.map(e=>n(e)).filter(e=>!!e);return t.length>0?t:[]}function Oe(e){return{code:W.PAIRING_REQUIRED,...e.reason?{reason:e.reason}:{},...e.requestId?{requestId:e.requestId}:{},...e.remediationHint?{remediationHint:e.remediationHint}:{},...e.deviceId?{deviceId:e.deviceId}:{},...e.requestedRole?{requestedRole:e.requestedRole}:{},...e.requestedScopes?{requestedScopes:e.requestedScopes}:{},...e.approvedRoles?{approvedRoles:e.approvedRoles}:{},...e.approvedScopes?{approvedScopes:e.approvedScopes}:{}}}function ke(e){return e?xe[e].remediationHint:`Approve the pending device request before retrying.`}function Ae(e){if(Ce(e)!==W.PAIRING_REQUIRED||!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,r=Te(t.reason);return Oe({reason:r,requestId:Ee(t.requestId),remediationHint:n(t.remediationHint)??ke(r),deviceId:n(t.deviceId),requestedRole:n(t.requestedRole),requestedScopes:De(t.requestedScopes),approvedRoles:De(t.approvedRoles),approvedScopes:De(t.approvedScopes)})}function je(e){let t=Ae(e),n=Se[t?.reason??_e.NOT_PAIRED];return t?.requestId?`${n} (requestId: ${t.requestId})`:n}function Me(e){return Ce(e.details)===W.PAIRING_REQUIRED?je(e.details):n(e.message)??`gateway request failed`}const G=n;function Ne(e){let t=G(e);if(!(t&&d(t)))return t}function Pe(e){let t=x({value:e.value,defaults:e.defaults}).ref;return{path:e.path,configured:S(e.value,e.defaults),value:t?void 0:G(e.value),refPath:t?e.path:void 0,hasSecretRef:t!==null}}function Fe(e){let t=e.env??process.env,n=e.config.gateway,r=n?.remote,i=e.defaults??e.config.secrets?.defaults,a=n?.auth?.mode,o=G(t.OPENCLAW_GATEWAY_TOKEN),s=G(t.OPENCLAW_GATEWAY_PASSWORD),c=Pe({value:n?.auth?.token,defaults:i,path:`gateway.auth.token`}),l=Pe({value:n?.auth?.password,defaults:i,path:`gateway.auth.password`}),u=Pe({value:r?.token,defaults:i,path:`gateway.remote.token`}),d=Pe({value:r?.password,defaults:i,path:`gateway.remote.password`}),f=a!==`password`&&a!==`none`&&a!==`trusted-proxy`,p=!!(o||c.configured||u.configured),m=a===`password`||a!==`token`&&a!==`none`&&a!==`trusted-proxy`&&!p,h=f&&!o&&(a===`token`||a===void 0&&!(s||l.configured)),g=n?.mode===`remote`,_=!!G(r?.url),v=n?.tailscale?.mode===`serve`||n?.tailscale?.mode===`funnel`,y=g||_||v,b=f&&!o&&!c.configured,x=!s&&!l.configured&&m;return{configuredMode:n?.mode===`remote`?`remote`:`local`,authMode:a,envToken:o,envPassword:s,localToken:c,localPassword:l,remoteToken:u,remotePassword:d,localTokenCanWin:f,localPasswordCanWin:m,localTokenSurfaceActive:h,tokenCanWin:p,passwordCanWin:m,remoteMode:g,remoteUrlConfigured:_,tailscaleRemoteExposure:v,remoteConfiguredSurface:y,remoteTokenFallbackActive:b,remoteTokenActive:y||b,remotePasswordFallbackActive:x,remotePasswordActive:y||x}}var Ie=class extends Error{constructor(e){super([`${e} is configured as a secret reference but is unavailable in this command path.`,`Fix: set OPENCLAW_GATEWAY_TOKEN/OPENCLAW_GATEWAY_PASSWORD, pass explicit --token/--password,`,`or run a gateway command path that resolves secret references before credential selection.`].join(`
|
|
2
2
|
`)),this.code=`GATEWAY_SECRET_REF_UNAVAILABLE`,this.name=`GatewaySecretRefUnavailableError`,this.path=e}};function Le(e){for(let t of e)if(t)return t}function Re(e){throw new Ie(e)}function ze(e){let t=e.env??process.env,n=G(t.OPENCLAW_GATEWAY_TOKEN),r=G(t.OPENCLAW_GATEWAY_PASSWORD),i=Ne(e.configToken),a=Ne(e.configPassword),o=e.tokenPrecedence??`env-first`,s=e.passwordPrecedence??`env-first`;return{token:Le(o===`config-first`?[i,n]:[n,i]),password:Le(s===`config-first`?[a,r]:[r,a])}}function Be(e){let t=ze({configToken:e.plan.localToken.configured?e.plan.localToken.value:e.plan.remoteToken.value,configPassword:e.plan.localPassword.configured?e.plan.localPassword.value:e.plan.remotePassword.value,env:e.env,tokenPrecedence:e.localTokenPrecedence,passwordPrecedence:e.localPasswordPrecedence}),n=e.plan.authMode===`password`||e.plan.authMode!==`token`&&e.plan.authMode!==`none`&&e.plan.authMode!==`trusted-proxy`&&!t.token,r=e.plan.authMode===`token`||e.plan.authMode!==`password`&&e.plan.authMode!==`none`&&e.plan.authMode!==`trusted-proxy`&&!t.password;return e.plan.localToken.refPath&&e.localTokenPrecedence===`config-first`&&!e.plan.localToken.value&&e.plan.envToken&&r&&Re(e.plan.localToken.refPath),e.plan.localPassword.refPath&&e.localPasswordPrecedence===`config-first`&&!e.plan.localPassword.value&&e.plan.envPassword&&n&&Re(e.plan.localPassword.refPath),e.plan.localToken.refPath&&!t.token&&!e.plan.envToken&&r&&Re(e.plan.localToken.refPath),e.plan.localPassword.refPath&&!t.password&&!e.plan.envPassword&&n&&Re(e.plan.localPassword.refPath),t}function Ve(e){let t=e.remoteTokenFallback===`remote-only`?e.plan.remoteToken.value:e.remoteTokenPrecedence===`env-first`?Le([e.plan.envToken,e.plan.remoteToken.value,e.plan.localToken.value]):Le([e.plan.remoteToken.value,e.plan.envToken,e.plan.localToken.value]),n=e.remotePasswordFallback===`remote-only`?e.plan.remotePassword.value:e.remotePasswordPrecedence===`env-first`?Le([e.plan.envPassword,e.plan.remotePassword.value,e.plan.localPassword.value]):Le([e.plan.remotePassword.value,e.plan.envPassword,e.plan.localPassword.value]),r=e.remoteTokenFallback!==`remote-only`,i=e.remoteTokenFallback===`remote-only`?void 0:e.plan.localToken.value,a=e.remotePasswordFallback===`remote-only`?void 0:e.plan.localPassword.value;return e.plan.remoteToken.refPath&&!t&&!e.plan.envToken&&!i&&!n&&Re(e.plan.remoteToken.refPath),e.plan.remotePassword.refPath&&!n&&!e.plan.envPassword&&!a&&!t&&Re(e.plan.remotePassword.refPath),e.plan.localToken.refPath&&r&&!t&&!n&&!e.plan.envToken&&!e.plan.remoteToken.value&&e.plan.localTokenCanWin&&Re(e.plan.localToken.refPath),{token:t,password:n}}function He(e){let t=e.env??process.env,n=G(e.explicitAuth?.token),r=G(e.explicitAuth?.password);if(n||r)return{token:n,password:r};if(G(e.urlOverride)&&e.urlOverrideSource!==`env`)return{};if(G(e.urlOverride)&&e.urlOverrideSource===`env`)return ze({configToken:void 0,configPassword:void 0,env:t,tokenPrecedence:`env-first`,passwordPrecedence:`env-first`});let i=Fe({config:e.cfg,env:t}),a=e.modeOverride??i.configuredMode,o=e.localTokenPrecedence??(t.OPENCLAW_SERVICE_KIND===`gateway`?`config-first`:`env-first`),s=e.localPasswordPrecedence??`env-first`;if(a===`local`)return Be({plan:i,env:t,localTokenPrecedence:o,localPasswordPrecedence:s});let c=e.remoteTokenFallback??`remote-env-local`,l=e.remotePasswordFallback??`remote-env-local`;return Ve({plan:i,remoteTokenPrecedence:e.remoteTokenPrecedence??`remote-first`,remotePasswordPrecedence:e.remotePasswordPrecedence??`env-first`,remoteTokenFallback:c,remotePasswordFallback:l})}function Ue(e){return h(e)}function We(e){return f(e)}function Ge(e){return m(e)}function Ke(e){let t=Je(e);return t?t.isLocalhost?!0:Ue(t.unbracketedHost):!1}function qe(e){let t=Je(e);if(!t)return!1;if(t.isLocalhost)return!0;let n=Ge(t.unbracketedHost);return!(!n||!We(n)||pe.isIP(n)===6&&(n.startsWith(`ff`)||n===`::`))}function Je(e){if(!e)return null;let t=r(e),n=t.replace(/\.+$/,``);return n===`localhost`?{isLocalhost:!0,unbracketedHost:n}:{isLocalhost:!1,unbracketedHost:t.startsWith(`[`)&&t.endsWith(`]`)?t.slice(1,-1):t}}function Ye(e,t){let n;try{n=new URL(e)}catch{return!1}let r=n.protocol===`https:`?`wss:`:n.protocol===`http:`?`ws:`:n.protocol;if(r===`wss:`)return!0;if(r!==`ws:`)return!1;if(Ke(n.hostname))return!0;if(t?.allowPrivateWs){if(qe(n.hostname))return!0;let e=n.hostname.startsWith(`[`)&&n.hostname.endsWith(`]`)?n.hostname.slice(1,-1):n.hostname;return pe.isIP(e)===0}return!1}function Xe(e){return e.trim()}function Ze(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return t.has(`operator.admin`)?(t.add(`operator.read`),t.add(`operator.write`)):t.has(`operator.write`)&&t.add(`operator.read`),[...t].toSorted()}function Qe(e,t){let n=e.safeParse(t);return n.success?n.data:null}function $e(e,t){try{return Qe(e,JSON.parse(t))}catch{return null}}function et(){return U.join(a(),`identity`,`device.json`)}function tt(e){H.mkdirSync(U.dirname(e),{recursive:!0})}const nt=Buffer.from(`302a300506032b6570032100`,`hex`);function rt(e){return e.toString(`base64`).replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/g,``)}function it(e){let t=ce.createPublicKey(e).export({type:`spki`,format:`der`});return t.length===nt.length+32&&t.subarray(0,nt.length).equals(nt)?t.subarray(nt.length):t}function at(e){let t=it(e);return ce.createHash(`sha256`).update(t).digest(`hex`)}function ot(){let{publicKey:e,privateKey:t}=ce.generateKeyPairSync(`ed25519`),n=e.export({type:`spki`,format:`pem`}),r=t.export({type:`pkcs8`,format:`pem`});return{deviceId:at(n),publicKeyPem:n,privateKeyPem:r}}function st(e=et()){try{if(H.existsSync(e)){let t=H.readFileSync(e,`utf8`),n=JSON.parse(t);if(n?.version===1&&typeof n.deviceId==`string`&&typeof n.publicKeyPem==`string`&&typeof n.privateKeyPem==`string`){let t=at(n.publicKeyPem);if(t&&t!==n.deviceId){let r={...n,deviceId:t};H.writeFileSync(e,`${JSON.stringify(r,null,2)}\n`,{mode:384});try{H.chmodSync(e,384)}catch{}return{deviceId:t,publicKeyPem:n.publicKeyPem,privateKeyPem:n.privateKeyPem}}return{deviceId:n.deviceId,publicKeyPem:n.publicKeyPem,privateKeyPem:n.privateKeyPem}}}}catch{}let t=ot();tt(e);let n={version:1,deviceId:t.deviceId,publicKeyPem:t.publicKeyPem,privateKeyPem:t.privateKeyPem,createdAtMs:Date.now()};H.writeFileSync(e,`${JSON.stringify(n,null,2)}\n`,{mode:384});try{H.chmodSync(e,384)}catch{}return t}function ct(e,t){let n=ce.createPrivateKey(e);return rt(ce.sign(null,Buffer.from(t,`utf8`),n))}function lt(e){return rt(it(e))}function ut(e){return r(e.trim().replace(/^sha-?256\s*:?\s*/i,``).replace(/[^a-fA-F0-9]/g,``))}function dt(e,t=`utf8`){return typeof e==`string`?e:me.isBuffer(e)?e.toString(t):Array.isArray(e)?me.concat(e).toString(t):e instanceof ArrayBuffer?me.from(e).toString(t):me.from(String(e)).toString(t)}function ft(e){return typeof e==`string`&&e.trim()||``}function pt(e){return e.replace(/[A-Z]/g,e=>String.fromCharCode(e.charCodeAt(0)+32))}function mt(e){let t=ft(e);return t?pt(t):``}var ht=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;let a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),gt=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=ht();var n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;let o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),K=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=ht(),n=gt();var r=ht();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,`strConcat`,{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,`getProperty`,{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,`regexpCode`,{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return r.Name}});var i=gt();Object.defineProperty(e,`Scope`,{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,`ValueScope`,{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,`ValueScopeName`,{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,`varKinds`,{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=k(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=k(this.rhs,e,n),this}get names(){return O(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=k(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(ee(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>D(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(A(t),n instanceof e?[n]:n.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=k(this.condition,e,t),this}get names(){let e=super.names;return O(e,this.condition),this.else&&D(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=k(this.iteration,e,t),this}get names(){return D(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return O(O(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=k(this.iterable,e,t),this}get names(){return D(super.names,this.iterable.names)}},S=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};S.kind=`func`;var C=class extends p{render(e){return`return `+super.render(e)}};C.kind=`return`;var w=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&D(e,this.catch.names),this.finally&&D(e,this.finally.names),e}},T=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};T.kind=`catch`;var E=class extends m{render(e){return`finally`+super.render(e)}};E.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
3
3
|
`:``},this._extScope=e,this._scope=new n.Scope({parent:e}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let i=this._scope.toName(t);return n!==void 0&&r&&(this._constants[i.str]=n),this._leafNode(new o(e,i,n)),i}const(e,t,r){return this._def(n.varKinds.const,e,t,r)}let(e,t,r){return this._def(n.varKinds.let,e,t,r)}var(e,t,r){return this._def(n.varKinds.var,e,t,r)}assign(e,t,n){return this._leafNode(new s(e,t,n))}add(t,n){return this._leafNode(new c(t,e.operators.ADD,n))}code(e){return typeof e==`function`?e():e!==t.nil&&this._leafNode(new f(e)),this}object(...e){let n=[`{`];for(let[r,i]of e)n.length>1&&n.push(`,`),n.push(r),(r!==i||this.opts.es5)&&(n.push(`:`),(0,t.addCodeArg)(n,i));return n.push(`}`),new t._Code(n)}if(e,t,n){if(this._blockNode(new _(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error(`CodeGen: "else" body without "then" body`);return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(_,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new y(e),t)}forRange(e,t,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.let){let o=this._scope.toName(e);return this._for(new b(a,o,t,r),()=>i(o))}forOf(e,r,i,a=n.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=r instanceof t.Name?r:this.var(`_arr`,r);return this.forRange(`_i`,0,(0,t._)`${e}.length`,n=>{this.var(o,(0,t._)`${e}[${n}]`),i(o)})}return this._for(new x(`of`,a,o,r),()=>i(o))}forIn(e,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${r})`,i);let o=this._scope.toName(e);return this._for(new x(`in`,a,o,r),()=>i(o))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new C;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error(`CodeGen: "return" should have one node`);return this._endBlockNode(C)}try(e,t,n){if(!t&&!n)throw Error(`CodeGen: "try" without "catch" and "finally"`);let r=new w;if(this._blockNode(r),this.code(e),t){let e=this.name(`e`);this._currNode=r.catch=new T(e),t(e)}return n&&(this._currNode=r.finally=new E,this.code(n)),this._endBlockNode(T,E)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error(`CodeGen: not in self-balancing block`);let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,n=t.nil,r,i){return this._blockNode(new S(e,n,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(S)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error(`CodeGen: "else" without "if"`);return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function D(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function O(e,n){return n instanceof t._CodeOrName?D(e,n.names):e}function k(e,n,r){if(e instanceof t.Name)return i(e);if(!a(e))return e;return new t._Code(e._items.reduce((e,n)=>(n instanceof t.Name&&(n=i(n)),n instanceof t._Code?e.push(...n._items):e.push(n),e),[]));function i(e){let t=r[e.str];return t===void 0||n[e.str]!==1?e:(delete n[e.str],t)}function a(e){return e instanceof t._Code&&e._items.some(e=>e instanceof t.Name&&n[e.str]===1&&r[e.str]!==void 0)}}function ee(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function A(e){return typeof e==`boolean`||typeof e==`number`||e===null?!e:(0,t._)`!${ne(e)}`}e.not=A;let j=P(e.operators.AND);function M(...e){return e.reduce(j)}e.and=M;let N=P(e.operators.OR);function te(...e){return e.reduce(N)}e.or=te;function P(e){return(n,r)=>n===t.nil?r:r===t.nil?n:(0,t._)`${ne(n)} ${e} ${ne(r)}`}function ne(e){return e instanceof t.Name?e:(0,t._)`(${e})`}})),q=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let t=K(),n=ht();function r(e){let t={};for(let n of e)t[n]=!0;return t}e.toHash=r;function i(e,t){return typeof t==`boolean`?t:Object.keys(t).length===0?!0:(a(e,t),!o(t,e.self.RULES.all))}e.alwaysValidSchema=i;function a(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema||typeof t==`boolean`)return;let i=r.RULES.keywords;for(let n in t)i[n]||x(e,`unknown keyword: "${n}"`)}e.checkUnknownRules=a;function o(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(t[n])return!0;return!1}e.schemaHasRules=o;function s(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(n!==`$ref`&&t.all[n])return!0;return!1}e.schemaHasRulesButRef=s;function c({topSchemaRef:e,schemaPath:n},r,i,a){if(!a){if(typeof r==`number`||typeof r==`boolean`)return r;if(typeof r==`string`)return(0,t._)`${r}`}return(0,t._)`${e}${n}${(0,t.getProperty)(i)}`}e.schemaRefOrVal=c;function l(e){return f(decodeURIComponent(e))}e.unescapeFragment=l;function u(e){return encodeURIComponent(d(e))}e.escapeFragment=u;function d(e){return typeof e==`number`?`${e}`:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.escapeJsonPointer=d;function f(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}e.unescapeJsonPointer=f;function p(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}e.eachItem=p;function m({mergeNames:e,mergeToName:n,mergeValues:r,resultToName:i}){return(a,o,s,c)=>{let l=s===void 0?o:s instanceof t.Name?(o instanceof t.Name?e(a,o,s):n(a,o,s),s):o instanceof t.Name?(n(a,s,o),o):r(o,s);return c===t.Name&&!(l instanceof t.Name)?i(a,l):l}}e.mergeEvaluated={props:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>{e.if((0,t._)`${n} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,t._)`${r} || {}`).code((0,t._)`Object.assign(${r}, ${n})`))}),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>{n===!0?e.assign(r,!0):(e.assign(r,(0,t._)`${r} || {}`),g(e,r,n))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:h}),items:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>e.assign(r,(0,t._)`${n} === true ? true : ${r} > ${n} ? ${r} : ${n}`)),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>e.assign(r,n===!0?!0:(0,t._)`${r} > ${n} ? ${r} : ${n}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var(`items`,t)})};function h(e,n){if(n===!0)return e.var(`props`,!0);let r=e.var(`props`,(0,t._)`{}`);return n!==void 0&&g(e,r,n),r}e.evaluatedPropsToName=h;function g(e,n,r){Object.keys(r).forEach(r=>e.assign((0,t._)`${n}${(0,t.getProperty)(r)}`,!0))}e.setEvaluated=g;let _={};function v(e,t){return e.scopeValue(`func`,{ref:t,code:_[t.code]||(_[t.code]=new n._Code(t.code))})}e.useFunc=v;var y;(function(e){e[e.Num=0]=`Num`,e[e.Str=1]=`Str`})(y||(e.Type=y={}));function b(e,n,r){if(e instanceof t.Name){let i=n===y.Num;return r?i?(0,t._)`"[" + ${e} + "]"`:(0,t._)`"['" + ${e} + "']"`:i?(0,t._)`"/" + ${e}`:(0,t._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,t.getProperty)(e).toString():`/`+d(e)}e.getErrorPath=b;function x(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}}e.checkStrictMode=x})),J=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=K();e.default={data:new t.Name(`data`),valCxt:new t.Name(`valCxt`),instancePath:new t.Name(`instancePath`),parentData:new t.Name(`parentData`),parentDataProperty:new t.Name(`parentDataProperty`),rootData:new t.Name(`rootData`),dynamicAnchors:new t.Name(`dynamicAnchors`),vErrors:new t.Name(`vErrors`),errors:new t.Name(`errors`),this:new t.Name(`this`),self:new t.Name(`self`),scope:new t.Name(`scope`),json:new t.Name(`json`),jsonPos:new t.Name(`jsonPos`),jsonLen:new t.Name(`jsonLen`),jsonPart:new t.Name(`jsonPart`)}})),_t=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=K(),n=q(),r=J();e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,t.str)`"${e}" keyword must be ${n} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`};function i(n,r=e.keywordError,i,a){let{it:o}=n,{gen:s,compositeRule:u,allErrors:f}=o,p=d(n,r,i);a??(u||f)?c(s,p):l(o,(0,t._)`[${p}]`)}e.reportError=i;function a(t,n=e.keywordError,i){let{it:a}=t,{gen:o,compositeRule:s,allErrors:u}=a;c(o,d(t,n,i)),s||u||l(a,r.default.vErrors)}e.reportExtraError=a;function o(e,n){e.assign(r.default.errors,n),e.if((0,t._)`${r.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,t._)`${r.default.vErrors}.length`,n),()=>e.assign(r.default.vErrors,null)))}e.resetErrorsCount=o;function s({gen:e,keyword:n,schemaValue:i,data:a,errsCount:o,it:s}){if(o===void 0)throw Error(`ajv implementation error`);let c=e.name(`err`);e.forRange(`i`,o,r.default.errors,o=>{e.const(c,(0,t._)`${r.default.vErrors}[${o}]`),e.if((0,t._)`${c}.instancePath === undefined`,()=>e.assign((0,t._)`${c}.instancePath`,(0,t.strConcat)(r.default.instancePath,s.errorPath))),e.assign((0,t._)`${c}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${n}`),s.opts.verbose&&(e.assign((0,t._)`${c}.schema`,i),e.assign((0,t._)`${c}.data`,a))})}e.extendErrors=s;function c(e,n){let i=e.const(`err`,n);e.if((0,t._)`${r.default.vErrors} === null`,()=>e.assign(r.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${r.default.vErrors}.push(${i})`),e.code((0,t._)`${r.default.errors}++`)}function l(e,n){let{gen:r,validateName:i,schemaEnv:a}=e;a.$async?r.throw((0,t._)`new ${e.ValidationError}(${n})`):(r.assign((0,t._)`${i}.errors`,n),r.return(!1))}let u={keyword:new t.Name(`keyword`),schemaPath:new t.Name(`schemaPath`),params:new t.Name(`params`),propertyName:new t.Name(`propertyName`),message:new t.Name(`message`),schema:new t.Name(`schema`),parentSchema:new t.Name(`parentSchema`)};function d(e,n,r){let{createErrors:i}=e.it;return i===!1?(0,t._)`{}`:f(e,n,r)}function f(e,t,n={}){let{gen:r,it:i}=e,a=[p(i,n),m(e,n)];return h(e,t,a),r.object(...a)}function p({errorPath:e},{instancePath:i}){let a=i?(0,t.str)`${e}${(0,n.getErrorPath)(i,n.Type.Str)}`:e;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,a)]}function m({keyword:e,it:{errSchemaPath:r}},{schemaPath:i,parentSchema:a}){let o=a?r:(0,t.str)`${r}/${e}`;return i&&(o=(0,t.str)`${o}${(0,n.getErrorPath)(i,n.Type.Str)}`),[u.schemaPath,o]}function h(e,{params:n,message:i},a){let{keyword:o,data:s,schemaValue:c,it:l}=e,{opts:d,propertyName:f,topSchemaRef:p,schemaPath:m}=l;a.push([u.keyword,o],[u.params,typeof n==`function`?n(e):n||(0,t._)`{}`]),d.messages&&a.push([u.message,typeof i==`function`?i(e):i]),d.verbose&&a.push([u.schema,c],[u.parentSchema,(0,t._)`${p}${m}`],[r.default.data,s]),f&&a.push([u.propertyName,f])}})),vt=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=_t(),n=K(),r=J(),i={message:`boolean schema is false`};function a(e){let{gen:t,schema:i,validateName:a}=e;i===!1?s(e,!1):typeof i==`object`&&i.$async===!0?t.return(r.default.data):(t.assign((0,n._)`${a}.errors`,null),t.return(!0))}e.topBoolOrEmptySchema=a;function o(e,t){let{gen:n,schema:r}=e;r===!1?(n.var(t,!1),s(e)):n.var(t,!0)}e.boolOrEmptySchema=o;function s(e,n){let{gen:r,data:a}=e,o={gen:r,keyword:`false schema`,data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,t.reportError)(o,i,void 0,n)}})),yt=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set([`string`,`number`,`integer`,`boolean`,`null`,`object`,`array`]);function n(e){return typeof e==`string`&&t.has(e)}e.isJSONType=n;function r(){let e={number:{type:`number`,rules:[]},string:{type:`string`,rules:[]},array:{type:`array`,rules:[]},object:{type:`object`,rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=r})),bt=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&n(e,i)}e.schemaHasRulesForType=t;function n(e,t){return t.rules.some(t=>r(e,t))}e.shouldUseGroup=n;function r(e,t){return e[t.keyword]!==void 0||t.definition.implements?.some(t=>e[t]!==void 0)}e.shouldUseRule=r})),xt=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let t=yt(),n=bt(),r=_t(),i=K(),a=q();var o;(function(e){e[e.Correct=0]=`Correct`,e[e.Wrong=1]=`Wrong`})(o||(e.DataType=o={}));function s(e){let t=c(e.type);if(t.includes(`null`)){if(e.nullable===!1)throw Error(`type: null contradicts nullable: false`)}else{if(!t.length&&e.nullable!==void 0)throw Error(`"nullable" cannot be used without "type"`);e.nullable===!0&&t.push(`null`)}return t}e.getSchemaTypes=s;function c(e){let n=Array.isArray(e)?e:e?[e]:[];if(n.every(t.isJSONType))return n;throw Error(`type must be JSONType or JSONType[]: `+n.join(`,`))}e.getJSONTypes=c;function l(e,t){let{gen:r,data:i,opts:a}=e,s=d(t,a.coerceTypes),c=t.length>0&&!(s.length===0&&t.length===1&&(0,n.schemaHasRulesForType)(e,t[0]));if(c){let n=h(t,i,a.strictNumbers,o.Wrong);r.if(n,()=>{s.length?f(e,t,s):_(e)})}return c}e.coerceAndCheckDataType=l;let u=new Set([`string`,`number`,`integer`,`boolean`,`null`]);function d(e,t){return t?e.filter(e=>u.has(e)||t===`array`&&e===`array`):[]}function f(e,t,n){let{gen:r,data:a,opts:o}=e,s=r.let(`dataType`,(0,i._)`typeof ${a}`),c=r.let(`coerced`,(0,i._)`undefined`);o.coerceTypes===`array`&&r.if((0,i._)`${s} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>r.assign(a,(0,i._)`${a}[0]`).assign(s,(0,i._)`typeof ${a}`).if(h(t,a,o.strictNumbers),()=>r.assign(c,a))),r.if((0,i._)`${c} !== undefined`);for(let e of n)(u.has(e)||e===`array`&&o.coerceTypes===`array`)&&l(e);r.else(),_(e),r.endIf(),r.if((0,i._)`${c} !== undefined`,()=>{r.assign(a,c),p(e,c)});function l(e){switch(e){case`string`:r.elseIf((0,i._)`${s} == "number" || ${s} == "boolean"`).assign(c,(0,i._)`"" + ${a}`).elseIf((0,i._)`${a} === null`).assign(c,(0,i._)`""`);return;case`number`:r.elseIf((0,i._)`${s} == "boolean" || ${a} === null
|
|
4
4
|
|| (${s} == "string" && ${a} && ${a} == +${a})`).assign(c,(0,i._)`+${a}`);return;case`integer`:r.elseIf((0,i._)`${s} === "boolean" || ${a} === null
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./channel-bootstrap.runtime-Cwcr38m2-K7QN0kxA.mjs";export{t as bootstrapOutboundChannelPlugin,e as resetOutboundChannelBootstrapStateForTests};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as e,f as t}from"./runtime-snapshot-C54O1-gI-
|
|
1
|
+
import{d as e,f as t}from"./runtime-snapshot-C54O1-gI-0r2omPvJ.mjs";import{n,t as r}from"./runtime-Cym-fqI8-BuiEWXF-.mjs";import{i}from"./loader-708jrx4Y-eFvaGnCt.mjs";import{t as a}from"./plugin-auto-enable-DdH3n9V8-Dd9H4luQ.mjs";const o=new Set;function s(){o.clear()}function c(s){let c=s.cfg;if(!c||r()?.channels?.some(e=>e?.plugin?.id===s.channel))return;let l=`${n()}:${s.channel}`;if(o.has(l))return;o.add(l);let u=a({config:c}),d=t(u.config),f=e(u.config,d);try{i({config:u.config,activationSourceConfig:c,autoEnabledReasons:u.autoEnabledReasons,workspaceDir:f,runtimeOptions:{allowGatewaySubagentBinding:!0}})}catch{o.delete(l)}}export{s as n,c as t};
|
package/dist/cli.mjs
CHANGED
|
@@ -24,5 +24,5 @@ ${a}环境变量:${s}
|
|
|
24
24
|
CLAUDE_MODEL Claude 模型名称(如 ark-code-latest)
|
|
25
25
|
|
|
26
26
|
${i}首次使用?运行 [36mlarkpal init${i} 开始配置。${s}
|
|
27
|
-
`)}async function u(){let e=process.argv.slice(2),t=e[0];if(t===`--version`||t===`-v`){console.log(c());return}if(t===`--help`||t===`-h`){l();return}if(t===`init`){let{runInteractiveInit:e}=await import(`./interactive-init-
|
|
28
|
-
`);let{runInteractiveInit:e}=await import(`./interactive-init-
|
|
27
|
+
`)}async function u(){let e=process.argv.slice(2),t=e[0];if(t===`--version`||t===`-v`){console.log(c());return}if(t===`--help`||t===`-h`){l();return}if(t===`init`){let{runInteractiveInit:e}=await import(`./interactive-init-CzbT0dDB.mjs`),t=await e();process.exit(t)}if(t===`meeting-live-smoke`){let{runMeetingLiveSmokeCli:t}=await import(`./live-smoke-Be7Fzqj0.mjs`).then(e=>e.t);await t(e.slice(1));return}if(t===`meeting-live-teammate`){let{runMeetingLiveTeammateCli:t}=await import(`./live-smoke-Be7Fzqj0.mjs`).then(e=>e.t);await t(e.slice(1));return}if(t===`meeting-live-check`){let{runMeetingLiveCheckCli:t}=await import(`./live-smoke-Be7Fzqj0.mjs`).then(e=>e.t),n=await t(e.slice(1));process.exit(n)}if(t&&!t.startsWith(`-`)&&(console.log(`${o}未知命令: ${t}${s}\n`),l(),process.exit(1)),!(process.env.LARKPAL_HEADLESS===`1`||process.env.LARKPAL_HEADLESS===`true`)){let{LarkCliCredentialProvider:e}=await import(`./lark-cli-provider-DrGmcwiB.mjs`).then(e=>e.n);if(!e.isConfigured()){console.log(`\n${o}⚠️ 飞书应用凭证未配置${s}\n`),console.log(` LarkPal 需要飞书应用凭证才能启动。正在进入初始化向导...
|
|
28
|
+
`);let{runInteractiveInit:e}=await import(`./interactive-init-CzbT0dDB.mjs`),t=await e();t!==0&&process.exit(t),console.log(`${i}凭证配置完成,正在启动服务...${s}\n`)}}await import(`./main.mjs`)}u().catch(e=>{console.error(`LarkPal CLI 启动失败:`,e),process.exit(1)});export{};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e,s as t}from"./home-dir-C44RaPME-
|
|
1
|
+
import{o as e,s as t}from"./home-dir-C44RaPME-BqOMy1pu.mjs";import n from"node:path";const r=/^(?:error|(?:[a-z][\w-]*\s+)?api\s*error|apierror|openai\s*error|anthropic\s*error|gateway\s*error|codex\s*error)(?:\s+\d{3})?[:\s-]+/i,i=/(?:\s*:\s*|\s+)/,a=RegExp(`^(?:http\\s*)?(\\d{3})${i.source}(.+)$`,`i`),o=RegExp(`^(?:http\\s*)?(\\d{3})(?:${i.source}([\\s\\S]+))?$`,`i`),s=/^\s*(?:<!doctype\s+html\b|<html\b)/i,c=/<\/html>/i,l=new Set([521,522,523,524,525,526,530]),u=/\bcloudflare\b|cdn-cgi\/challenge-platform|challenge-error-text|enable javascript and cookies to continue|access denied|forbidden|service unavailable|bad gateway|web server is down|captcha|attention required/i;function d(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(t.type===`error`||typeof t.request_id==`string`||typeof t.requestId==`string`)return!0;if(`error`in t){let e=t.error;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e;if(typeof t.message==`string`||typeof t.type==`string`||typeof t.code==`string`)return!0}}return!1}function f(e){if(!e)return null;let t=e.trim();if(!t)return null;let n=[t];r.test(t)&&n.push(t.replace(r,``).trim());for(let e of n)if(!(!e.startsWith(`{`)||!e.endsWith(`}`)))try{let t=JSON.parse(e);if(d(t))return t}catch{}return null}function p(e){let t=e.match(o);if(!t)return null;let n=Number(t[1]);return Number.isFinite(n)?{code:n,rest:(t[2]??``).trim()}:null}function m(e){let t=e.trim();if(!t)return!1;if(s.test(t)&&c.test(t)&&u.test(t))return!0;let n=p(t);return!n||n.code<500?!1:l.has(n.code)?!0:n.code<600&&s.test(n.rest)&&c.test(n.rest)}function h(e){if(!e)return null;let t=e.trim();if(!t)return null;let n,r=t,i=r.match(/^(\d{3})\s+(.+)$/s);i&&(n=i[1],r=i[2].trim());let a=f(r);if(!a)return null;let o=typeof a.request_id==`string`?a.request_id:typeof a.requestId==`string`?a.requestId:void 0,s=typeof a.type==`string`?a.type:void 0,c=typeof a.message==`string`?a.message:void 0,l,u;if(a.error&&typeof a.error==`object`&&!Array.isArray(a.error)){let e=a.error;typeof e.type==`string`&&(l=e.type),typeof e.code==`string`&&!l&&(l=e.code),typeof e.message==`string`&&(u=e.message)}return{httpCode:n,type:l??s,message:u??c,requestId:o}}function g(e){let t=(e??``).trim();if(!t)return`LLM request failed with an unknown error.`;let n=p(t),r=m(t);if(n&&r)return`The AI service is temporarily unavailable (HTTP ${n.code}). Please try again in a moment.`;if(r)return`The provider returned an HTML error page instead of an API response. This usually means a CDN or gateway (e.g. Cloudflare) blocked the request. Retry in a moment or check provider status.`;let i=t.match(a);if(i){let e=i[2].trim();if(!e.startsWith(`{`))return`HTTP ${i[1]}: ${e}`}let o=h(t);return o?.message?`${o.httpCode?`HTTP ${o.httpCode}`:`LLM error`}${o.type?` ${o.type}`:``}: ${o.message}`:t.length>600?`${t.slice(0,600)}…`:t}const _=/^exec denied \(([^)]*)\):(?:\s*([\s\S]*))?$/i,ee=/^exec finished \(([^)]*)\)(?:\n([\s\S]*))?$/i,te=/^exec completed:\s*([\s\S]*)$/i;function v(e){let t=e.trim();if(!t)return{kind:`other`,raw:t};let n=_.exec(t);if(n)return{kind:`denied`,raw:t,metadata:n[1]?.trim()??``,body:n[2]?.trim()??``};let r=ee.exec(t);if(r)return{kind:`finished`,raw:t,metadata:r[1]?.trim()??``,body:r[2]?.trim()??``};let i=te.exec(t);return i?{kind:`completed`,raw:t,body:i[1]?.trim()??``}:{kind:`other`,raw:t}}function y(t){let n=v(t);if(n.kind!==`denied`)return null;let r=e(n.metadata);return r.includes(`approval-timeout`)?`Command did not run: approval timed out.`:r.includes(`user-denied`)?`Command did not run: approval was denied.`:r.includes(`allowlist-miss`)?`Command did not run: approval is required.`:r.includes(`approval-request-failed`)?`Command did not run: approval request failed.`:(r.includes(`spawn-failed`)||r.includes(`invoke-failed`),`Command did not run.`)}const b=[/api[_ ]?key[_ ]?(?:revoked|deactivated|deleted)/i,`key has been disabled`,`key has been revoked`,`account has been deactivated`,`not allowed for this organization`],x=[/invalid[_ ]?api[_ ]?key/,/could not (?:authenticate|validate).*(?:api[_ ]?key|credentials)/i,`permission_error`],S=[`incorrect api key`,`invalid token`,`authentication`,`re-authenticate`,`oauth token refresh failed`,`unauthorized`,`forbidden`,`access denied`,`insufficient permissions`,`insufficient permission`,/missing scopes?:/i,`expired`,`token has expired`,/\b401\b/,/\b403\b/,`no credentials found`,`no api key found`,/\bfailed to (?:extract|parse|validate|decode)\b.*\btoken\b/],C=/"code"\s*:\s*1311\b/,w=[/"code"\s*:\s*1113\b/],T={rateLimit:[/rate[_ ]limit|too many requests|429/,/too many (?:concurrent )?requests/i,/throttling(?:exception)?/i,`model_cooldown`,`exceeded your current quota`,`resource has been exhausted`,`quota exceeded`,`resource_exhausted`,`throttlingexception`,`throttling_exception`,`throttled`,`throttling`,`usage limit`,/\btpm\b/i,`tokens per minute`,`tokens per day`],overloaded:[/overloaded_error|"type"\s*:\s*"overloaded_error"/i,`overloaded`,/service[_ ]unavailable.*(?:overload|capacity|high[_ ]demand)|(?:overload|capacity|high[_ ]demand).*service[_ ]unavailable/i,`high demand`],serverError:[`an error occurred while processing`,`internal server error`,`internal_error`,`server_error`,`service temporarily unavailable`,`service_unavailable`,`bad gateway`,`gateway timeout`,`upstream error`,`upstream connect error`,`connection reset`],timeout:[`timeout`,`timed out`,`service unavailable`,`deadline exceeded`,`context deadline exceeded`,/^(?=[\s\S]*\bgot status:\s*internal\b)(?=[\s\S]*\bcode["']?\s*[:=]\s*500\b)/i,/^(?=[\s\S]*["']status["']\s*:\s*["']internal["'])(?=[\s\S]*["']code["']\s*:\s*500\b)/i,`connection error`,`network error`,`network request failed`,`fetch failed`,`socket hang up`,/\beconn(?:refused|reset|aborted)\b/i,/\benetunreach\b/i,/\behostunreach\b/i,/\behostdown\b/i,/\benetreset\b/i,/\betimedout\b/i,/\besockettimedout\b/i,/\bepipe\b/i,/\benotfound\b/i,/\beai_again\b/i,/without sending (?:any )?chunks?/i,/\bstop reason:\s*(?:abort|error|malformed_response|network_error)\b/i,/\breason:\s*(?:abort|error|malformed_response|network_error)\b/i,/\bunhandled stop reason:\s*(?:abort|error|malformed_response|network_error)\b/i,/\bfinish_reason:\s*(?:abort|error|malformed_response|network_error)\b/i,/\boperation was aborted\b/i,/\bstream (?:was )?(?:closed|aborted)\b/i],billing:[/["']?(?:status|code)["']?\s*[:=]\s*402\b|\bhttp\s*402\b|\berror(?:\s+code)?\s*[:=]?\s*402\b|\b(?:got|returned|received)\s+(?:a\s+)?402\b|^\s*402\s+payment/i,`payment required`,`insufficient credits`,/insufficient[_ ]quota/i,`credit balance`,`plans & billing`,`insufficient balance`,`insufficient usd or diem balance`,/requires?\s+more\s+credits/i,/out of extra usage/i,/draw from your extra usage/i,/extra usage is required(?: for long context requests)?/i,C],authPermanent:b,auth:[...x,...S,...w],format:[`string should match pattern`,`tool_use.id`,`tool_use_id`,`messages.1.content.1.tool_use.id`,`invalid request format`,/tool call id was.*must be/i]},E=/^(?:error[:\s-]+)?billing(?:\s+error)?(?:[:\s-]+|$)|^(?:error[:\s-]+)?(?:credit balance|insufficient credits?|payment required|http\s*402\b)/i,ne=/["']?(?:status|code)["']?\s*[:=]\s*402\b|\bhttp\s*402\b|\berror(?:\s+code)?\s*[:=]?\s*402\b|^\s*402\s+payment/i;function D(t,n){if(!t)return!1;let r=e(t);return n.some(e=>e instanceof RegExp?e.test(r):r.includes(e))}function re(e){return D(e,T.rateLimit)}function ie(e){return D(e,T.timeout)}function ae(t){let n=e(t);return n?t.length>512?ne.test(n)||C.test(n):D(n,T.billing)?!0:E.test(t)?n.includes(`upgrade`)||n.includes(`credits`)||n.includes(`payment`)||n.includes(`purchase`)||n.includes(`subscription`)||n.includes(`plan`):!1:!1}function oe(e){return D(e,T.overloaded)}function O(e){if(typeof e==`string`)return e;if(e==null)return``;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`||typeof e==`symbol`)return String(e);if(typeof e==`object`)try{return JSON.stringify(e)??``}catch{return``}return``}function se(e,t){let n=t?.normalizeText??(e=>e.replace(/\s+/g,` `).trim()),r=t?.joinWith??` `,i=e=>{let n=O(e);return O(t?.sanitizeText?t.sanitizeText(n):n)},a=e=>O(n(O(e)));if(typeof e==`string`)return a(i(e))||null;if(!Array.isArray(e))return null;let o=[];for(let t of e){if(!t||typeof t!=`object`||t.type!==`text`)continue;let e=t.text,n=i(e);n.trim()&&o.push(n)}return a(o.join(r))||null}const k=`<<<BEGIN_OPENCLAW_INTERNAL_CONTEXT>>>`,A=`<<<END_OPENCLAW_INTERNAL_CONTEXT>>>`,j=[`OpenClaw runtime context (internal):`,`This context is runtime-generated, not user-authored. Keep internal details private.`,``].join(`
|
|
2
2
|
`)+`
|
|
3
3
|
`,M=`[Internal task completion event]`,N=`
|
|
4
4
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./paths-D92DjaZ--CKAvIWoZ.mjs";import"./bundled-dir-U738ay4K-DxHVp4u1.mjs";import"./io-CH2g3vsv-BevbMdi6.mjs";import"./bundled-compat-BpaDaAAu-DElY7pj-.mjs";import"node:path";import"node:fs/promises";import"node:crypto";import"node:util";export{};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{existsSync as e,mkdirSync as t,readFileSync as n,writeFileSync as r}from"node:fs";import{dirname as i,join as a}from"node:path";import{homedir as o}from"node:os";function s(){return process.env.LARKPAL_CONFIG_PATH||a(o(),`.larkpal`,`config.json`)}function c(e){return e===`claude-code`||e===`codex-app-server`||e===`larkpal-agent`}function l(t=s()){if(e(t))try{let e=n(t,`utf-8`),r=JSON.parse(e);return c(r.runtime)?r.runtime:void 0}catch{return}}function u(e={}){let t=e.env??process.env,n=e.defaultRuntime??`claude-code`;return c(t.LARKPAL_RUNTIME)?t.LARKPAL_RUNTIME:l(e.configPath)??n}function d(a,o=s()){let c={};if(e(o))try{let e=n(o,`utf-8`),t=JSON.parse(e);t&&typeof t==`object`&&!Array.isArray(t)&&(c=t)}catch{c={}}let l={...c,runtime:a};t(i(o),{recursive:!0}),r(o,JSON.stringify(l,null,2)+`
|
|
2
|
+
`,{encoding:`utf-8`,mode:384})}export{d as n,u as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"./home-dir-C44RaPME-
|
|
1
|
+
import{c as e}from"./home-dir-C44RaPME-BqOMy1pu.mjs";import{r as t}from"./account-id-BM1T6029-BvcZ99G0.mjs";import{n}from"./message-channel-core-DTA--Gjh-DeWCDZu1.mjs";function r(e){return t(e)}function i(t){if(!t)return;let i=typeof t.channel==`string`?n(t.channel)??t.channel.trim():void 0,a=e(t.to),o=r(t.accountId),s=typeof t.threadId==`number`&&Number.isFinite(t.threadId)?Math.trunc(t.threadId):typeof t.threadId==`string`?e(t.threadId):void 0,c=typeof s==`string`?s||void 0:s;if(!i&&!a&&!o&&c==null)return;let l={channel:i||void 0,to:a||void 0,accountId:o};return c!=null&&(l.threadId=c),l}function a(e){if(!e)return{deliveryContext:void 0,lastChannel:void 0,lastTo:void 0,lastAccountId:void 0,lastThreadId:void 0};let t=o(i({channel:e.lastChannel??e.channel,to:e.lastTo,accountId:e.lastAccountId,threadId:e.lastThreadId}),i(e.deliveryContext));return t?{deliveryContext:t,lastChannel:t.channel,lastTo:t.to,lastAccountId:t.accountId,lastThreadId:t.threadId}:{deliveryContext:void 0,lastChannel:void 0,lastTo:void 0,lastAccountId:void 0,lastThreadId:void 0}}function o(e,t){let n=i(e),r=i(t);if(!n&&!r)return;let a=n?.channel&&r?.channel&&n.channel!==r.channel;return i({channel:n?.channel??r?.channel,to:a?n?.to:n?.to??r?.to,accountId:a?n?.accountId:n?.accountId??r?.accountId,threadId:a?n?.threadId:n?.threadId??r?.threadId})}function s(e){let t=i(e);if(!t?.channel||!t?.to)return;let n=t.threadId!=null&&t.threadId!==``?String(t.threadId):``;return`${t.channel}|${t.to}|${t.accountId??``}|${n}`}export{a as i,o as n,i as r,s as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./paths-D92DjaZ--
|
|
1
|
+
import"./paths-D92DjaZ--CKAvIWoZ.mjs";import"./io-CH2g3vsv-BevbMdi6.mjs";import{St as e}from"./bundled-compat-BpaDaAAu-DElY7pj-.mjs";import"./config-Bim2pi8a-xbw-saVR.mjs";import"node:fs";import"node:path";import"node:process";function t(){let e=globalThis;return e.__openclawDiagnosticEventsState||={enabled:!0,seq:0,listeners:new Set,dispatchDepth:0},e.__openclawDiagnosticEventsState}function n(){return t().enabled}function r(e){let n=t();if(!n.enabled)return;if(n.dispatchDepth>100){console.error(`[diagnostic-events] recursion guard tripped at depth=${n.dispatchDepth}, dropping type=${e.type}`);return}let r={...e,seq:n.seq+=1,ts:Date.now()};n.dispatchDepth+=1;for(let e of n.listeners)try{e(r)}catch(e){let t=e instanceof Error?e.stack??e.message:typeof e==`string`?e:String(e);console.error(`[diagnostic-events] listener error type=${r.type} seq=${r.seq}: ${t}`)}--n.dispatchDepth}const i=e(`diagnostic`),a=new Map,o=2e3;let s=0;function c(e=Date.now(),t=!1){let n=a.size>o;if(!t&&!n&&e-s<6e4)return;s=e;for(let[t,n]of a.entries()){let r=e-n.lastActivity;n.state===`idle`&&n.queueDepth<=0&&r>18e5&&a.delete(t)}if(a.size<=o)return;let r=a.size-o,i=Array.from(a.entries()).toSorted((e,t)=>e[1].lastActivity-t[1].lastActivity);for(let e=0;e<r;e+=1){let t=i[e]?.[0];if(!t)break;a.delete(t)}}function l({sessionKey:e,sessionId:t}){return e??t??`unknown`}function u(e){for(let t of a.values())if(t.sessionId===e)return t}function d(e){c();let t=l(e),n=a.get(t)??(e.sessionId&&u(e.sessionId));if(n)return e.sessionId&&(n.sessionId=e.sessionId),e.sessionKey&&(n.sessionKey=e.sessionKey),n;let r={sessionId:e.sessionId,sessionKey:e.sessionKey,lastActivity:Date.now(),state:`idle`,queueDepth:0};return a.set(t,r),c(Date.now(),!0),r}const f=1024*1024;1536*f,3072*f,1024*f,2048*f,512*f,1024*f;function p(e){if(!n())return;let t=d(e);t.queueDepth+=1,t.lastActivity=Date.now(),i.isEnabled(`debug`)&&i.debug(`message queued: sessionId=${t.sessionId??`unknown`} sessionKey=${t.sessionKey??`unknown`} source=${e.source} queueDepth=${t.queueDepth} sessionState=${t.state}`),r({type:`message.queued`,sessionId:t.sessionId,sessionKey:t.sessionKey,channel:e.channel,source:e.source,queueDepth:t.queueDepth})}function m(e){if(!n())return;let t=`tool loop: sessionId=${e.sessionId??`unknown`} sessionKey=${e.sessionKey??`unknown`} tool=${e.toolName} level=${e.level} action=${e.action} detector=${e.detector} count=${e.count}${e.pairedToolName?` pairedTool=${e.pairedToolName}`:``} message="${e.message}"`;e.level===`critical`?i.error(t):i.warn(t),r({type:`tool.loop`,sessionId:e.sessionId,sessionKey:e.sessionKey,toolName:e.toolName,level:e.level,action:e.action,detector:e.detector,count:e.count,message:e.message,pairedToolName:e.pairedToolName})}export{i,m as n,d as r,p as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,t}from"./chunk-DHbaKqs-.mjs";import{t as n}from"./src-
|
|
1
|
+
import{i as e,t}from"./chunk-DHbaKqs-.mjs";import{t as n}from"./src-5lm1WxWm.mjs";var r=t((t=>{var n=t&&t.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),r=t&&t.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),i=t&&t.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var i in e)i!==`default`&&Object.prototype.hasOwnProperty.call(e,i)&&n(t,e,i);return r(t,e),t};Object.defineProperty(t,`__esModule`,{value:!0}),t.req=t.json=t.toBuffer=void 0;let a=i(e(`http`)),o=i(e(`https`));async function s(e){let t=0,n=[];for await(let r of e)t+=r.length,n.push(r);return Buffer.concat(n,t)}t.toBuffer=s;async function c(e){let t=(await s(e)).toString(`utf8`);try{return JSON.parse(t)}catch(e){let n=e;throw n.message+=` (input: ${t})`,n}}t.json=c;function l(e,t={}){let n=((typeof e==`string`?e:e.href).startsWith(`https:`)?o:a).request(e,t),r=new Promise((e,t)=>{n.once(`response`,e).once(`error`,t).end()});return n.then=r.then.bind(r),n}t.req=l})),i=t((t=>{var n=t&&t.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),i=t&&t.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),a=t&&t.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!==`default`&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},o=t&&t.__exportStar||function(e,t){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(t,r)&&n(t,e,r)};Object.defineProperty(t,`__esModule`,{value:!0}),t.Agent=void 0;let s=a(e(`net`)),c=a(e(`http`)),l=e(`https`);o(r(),t);let u=Symbol(`AgentBaseInternalState`);t.Agent=class extends c.Agent{constructor(e){super(e),this[u]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint==`boolean`)return e.secureEndpoint;if(typeof e.protocol==`string`)return e.protocol===`https:`}let{stack:t}=Error();return typeof t==`string`?t.split(`
|
|
2
2
|
`).some(e=>e.indexOf(`(https.js:`)!==-1||e.indexOf(`node:https:`)!==-1):!1}incrementSockets(e){if(this.maxSockets===1/0&&this.maxTotalSockets===1/0)return null;this.sockets[e]||(this.sockets[e]=[]);let t=new s.Socket({writable:!1});return this.sockets[e].push(t),this.totalSocketCount++,t}decrementSockets(e,t){if(!this.sockets[e]||t===null)return;let n=this.sockets[e],r=n.indexOf(t);r!==-1&&(n.splice(r,1),this.totalSocketCount--,n.length===0&&delete this.sockets[e])}getName(e){return this.isSecureEndpoint(e)?l.Agent.prototype.getName.call(this,e):super.getName(e)}createSocket(e,t,n){let r={...t,secureEndpoint:this.isSecureEndpoint(t)},i=this.getName(r),a=this.incrementSockets(i);Promise.resolve().then(()=>this.connect(e,r)).then(o=>{if(this.decrementSockets(i,a),o instanceof c.Agent)try{return o.addRequest(e,r)}catch(e){return n(e)}this[u].currentSocket=o,super.createSocket(e,t,n)},e=>{this.decrementSockets(i,a),n(e)})}createConnection(){let e=this[u].currentSocket;if(this[u].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[u].defaultPort??(this.protocol===`https:`?443:80)}set defaultPort(e){this[u]&&(this[u].defaultPort=e)}get protocol(){return this[u].protocol??(this.isSecureEndpoint()?`https:`:`http:`)}set protocol(e){this[u]&&(this[u].protocol=e)}}})),a=t((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.parseProxyResponse=void 0;let r=(0,t(n()).default)(`https-proxy-agent:parse-proxy-response`);function i(e){return new Promise((t,n)=>{let i=0,a=[];function o(){let t=e.read();t?u(t):e.once(`readable`,o)}function s(){e.removeListener(`end`,c),e.removeListener(`error`,l),e.removeListener(`readable`,o)}function c(){s(),r(`onend`),n(Error(`Proxy connection ended before receiving CONNECT response`))}function l(e){s(),r(`onerror %o`,e),n(e)}function u(c){a.push(c),i+=c.length;let l=Buffer.concat(a,i),u=l.indexOf(`\r
|
|
3
3
|
\r
|
|
4
4
|
`);if(u===-1){r(`have not received end of HTTP headers yet...`),o();return}let d=l.slice(0,u).toString(`ascii`).split(`\r
|