niumagents-cli 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.niumignore +4 -1
- package/README.md +2 -2
- package/dist/examples/.env.example +61 -0
- package/dist/examples/.niumignore.example +43 -0
- package/dist/examples/config.example.json +31 -0
- package/dist/nium.js +1390 -2
- package/package.json +97 -86
- package/dist/249.nium.js +0 -1
- package/dist/281.nium.js +0 -1
- package/dist/401.nium.js +0 -2
- package/dist/401.nium.js.LICENSE.txt +0 -1
- package/dist/examples/agents/commit-helper.md +0 -70
- package/dist/examples/conventions.md +0 -3
- package/dist/nium.js.LICENSE.txt +0 -15
- package/dist/src/agent/builtin-agents/configs/coder.md +0 -178
- package/dist/src/agent/builtin-agents/configs/explorer.md +0 -85
package/dist/nium.js
CHANGED
|
@@ -1,2 +1,1390 @@
|
|
|
1
|
-
|
|
2
|
-
import{default as e}from"zlib";import*as t from"buffer";import*as a from"stream";import*as s from"path";import{createRequire as n}from"node:module";const i=n(import.meta.url);import*as r from"http";import*as o from"https";import*as p from"fs";import*as d from"util";import*as l from"child_process";import*as c from"worker_threads";import*as m from"url";import*as u from"os";import*as h from"string_decoder";var f,g,y,v,w,b,_,S,T,k={506:(t,a,s)=>{s.d(a,{Lr:()=>D,Kd:()=>H,YK:()=>j,Ay:()=>Q});var n=s(702),i=s(3782),r=s(6887),o=s(3417),p=s(3871);const d=n.default.Readable,l=Symbol("buffer"),c=Symbol("type");class m{constructor(){this[c]="";const e=arguments[0],t=arguments[1],a=[];let s=0;if(e){const t=e,n=Number(t.length);for(let e=0;e<n;e++){const n=t[e];let i;i=n instanceof Buffer?n:ArrayBuffer.isView(n)?Buffer.from(n.buffer,n.byteOffset,n.byteLength):n instanceof ArrayBuffer?Buffer.from(n):n instanceof m?n[l]:Buffer.from("string"==typeof n?n:String(n)),s+=i.length,a.push(i)}}this[l]=Buffer.concat(a);let n=t&&void 0!==t.type&&String(t.type).toLowerCase();n&&!/[^\u0020-\u007E]/.test(n)&&(this[c]=n)}get size(){return this[l].length}get type(){return this[c]}text(){return Promise.resolve(this[l].toString())}arrayBuffer(){const e=this[l],t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return Promise.resolve(t)}stream(){const e=new d;return e._read=function(){},e.push(this[l]),e.push(null),e}toString(){return"[object Blob]"}slice(){const e=this.size,t=arguments[0],a=arguments[1];let s,n;s=void 0===t?0:t<0?Math.max(e+t,0):Math.min(t,e),n=void 0===a?e:a<0?Math.max(e+a,0):Math.min(a,e);const i=Math.max(n-s,0),r=this[l].slice(s,s+i),o=new m([],{type:arguments[2]});return o[l]=r,o}}function u(e,t,a){Error.call(this,e),this.message=e,this.type=t,a&&(this.code=this.errno=a.code),Error.captureStackTrace(this,this.constructor)}let h;Object.defineProperties(m.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}}),Object.defineProperty(m.prototype,Symbol.toStringTag,{value:"Blob",writable:!1,enumerable:!1,configurable:!0}),u.prototype=Object.create(Error.prototype),u.prototype.constructor=u,u.prototype.name="FetchError";try{h=require("encoding").convert}catch(e){}const f=Symbol("Body internals"),g=n.default.PassThrough;function y(e){var t=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=a.size;let i=void 0===s?0:s;var r=a.timeout;let o=void 0===r?0:r;null==e?e=null:w(e)?e=Buffer.from(e.toString()):b(e)||Buffer.isBuffer(e)||("[object ArrayBuffer]"===Object.prototype.toString.call(e)?e=Buffer.from(e):ArrayBuffer.isView(e)?e=Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof n.default||(e=Buffer.from(String(e)))),this[f]={body:e,disturbed:!1,error:null},this.size=i,this.timeout=o,e instanceof n.default&&e.on("error",function(e){const a="AbortError"===e.name?e:new u(`Invalid response body while trying to fetch ${t.url}: ${e.message}`,"system",e);t[f].error=a})}function v(){var e=this;if(this[f].disturbed)return y.Promise.reject(new TypeError(`body used already for: ${this.url}`));if(this[f].disturbed=!0,this[f].error)return y.Promise.reject(this[f].error);let t=this.body;if(null===t)return y.Promise.resolve(Buffer.alloc(0));if(b(t)&&(t=t.stream()),Buffer.isBuffer(t))return y.Promise.resolve(t);if(!(t instanceof n.default))return y.Promise.resolve(Buffer.alloc(0));let a=[],s=0,i=!1;return new y.Promise(function(n,r){let o;e.timeout&&(o=setTimeout(function(){i=!0,r(new u(`Response timeout while trying to fetch ${e.url} (over ${e.timeout}ms)`,"body-timeout"))},e.timeout)),t.on("error",function(t){"AbortError"===t.name?(i=!0,r(t)):r(new u(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,"system",t))}),t.on("data",function(t){if(!i&&null!==t){if(e.size&&s+t.length>e.size)return i=!0,void r(new u(`content size at ${e.url} over limit: ${e.size}`,"max-size"));s+=t.length,a.push(t)}}),t.on("end",function(){if(!i){clearTimeout(o);try{n(Buffer.concat(a,s))}catch(t){r(new u(`Could not create Buffer from response body for ${e.url}: ${t.message}`,"system",t))}}})})}function w(e){return"object"==typeof e&&"function"==typeof e.append&&"function"==typeof e.delete&&"function"==typeof e.get&&"function"==typeof e.getAll&&"function"==typeof e.has&&"function"==typeof e.set&&("URLSearchParams"===e.constructor.name||"[object URLSearchParams]"===Object.prototype.toString.call(e)||"function"==typeof e.sort)}function b(e){return"object"==typeof e&&"function"==typeof e.arrayBuffer&&"string"==typeof e.type&&"function"==typeof e.stream&&"function"==typeof e.constructor&&"string"==typeof e.constructor.name&&/^(Blob|File)$/.test(e.constructor.name)&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}function _(e){let t,a,s=e.body;if(e.bodyUsed)throw new Error("cannot clone body after it is used");return s instanceof n.default&&"function"!=typeof s.getBoundary&&(t=new g,a=new g,s.pipe(t),s.pipe(a),e[f].body=t,s=a),s}function S(e){return null===e?null:"string"==typeof e?"text/plain;charset=UTF-8":w(e)?"application/x-www-form-urlencoded;charset=UTF-8":b(e)?e.type||null:Buffer.isBuffer(e)||"[object ArrayBuffer]"===Object.prototype.toString.call(e)||ArrayBuffer.isView(e)?null:"function"==typeof e.getBoundary?`multipart/form-data;boundary=${e.getBoundary()}`:e instanceof n.default?null:"text/plain;charset=UTF-8"}function T(e){const t=e.body;return null===t?0:b(t)?t.size:Buffer.isBuffer(t)?t.length:t&&"function"==typeof t.getLengthSync&&(t._lengthRetrievers&&0==t._lengthRetrievers.length||t.hasKnownLength&&t.hasKnownLength())?t.getLengthSync():null}y.prototype={get body(){return this[f].body},get bodyUsed(){return this[f].disturbed},arrayBuffer(){return v.call(this).then(function(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)})},blob(){let e=this.headers&&this.headers.get("content-type")||"";return v.call(this).then(function(t){return Object.assign(new m([],{type:e.toLowerCase()}),{[l]:t})})},json(){var e=this;return v.call(this).then(function(t){try{return JSON.parse(t.toString())}catch(t){return y.Promise.reject(new u(`invalid json response body at ${e.url} reason: ${t.message}`,"invalid-json"))}})},text(){return v.call(this).then(function(e){return e.toString()})},buffer(){return v.call(this)},textConverted(){var e=this;return v.call(this).then(function(t){return function(e,t){if("function"!=typeof h)throw new Error("The package `encoding` must be installed to use the textConverted() function");const a=t.get("content-type");let s,n,i="utf-8";return a&&(s=/charset=([^;]*)/i.exec(a)),n=e.slice(0,1024).toString(),!s&&n&&(s=/<meta.+?charset=(['"])(.+?)\1/i.exec(n)),!s&&n&&(s=/<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(n),s||(s=/<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(n),s&&s.pop()),s&&(s=/charset=(.*)/i.exec(s.pop()))),!s&&n&&(s=/<\?xml.+?encoding=(['"])(.+?)\1/i.exec(n)),s&&(i=s.pop(),"gb2312"!==i&&"gbk"!==i||(i="gb18030")),h(e,"UTF-8",i).toString()}(t,e.headers)})}},Object.defineProperties(y.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0}}),y.mixIn=function(e){for(const t of Object.getOwnPropertyNames(y.prototype))if(!(t in e)){const a=Object.getOwnPropertyDescriptor(y.prototype,t);Object.defineProperty(e,t,a)}},y.Promise=global.Promise;const k=/[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/,x=/[^\t\x20-\x7e\x80-\xff]/;function C(e){if(e=`${e}`,k.test(e)||""===e)throw new TypeError(`${e} is not a legal HTTP header name`)}function A(e){if(e=`${e}`,x.test(e))throw new TypeError(`${e} is not a legal HTTP header value`)}function E(e,t){t=t.toLowerCase();for(const a in e)if(a.toLowerCase()===t)return a}const $=Symbol("map");class D{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(this[$]=Object.create(null),e instanceof D){const t=e.raw(),a=Object.keys(t);for(const e of a)for(const a of t[e])this.append(e,a);return}if(null==e);else{if("object"!=typeof e)throw new TypeError("Provided initializer must be an object");{const t=e[Symbol.iterator];if(null!=t){if("function"!=typeof t)throw new TypeError("Header pairs must be iterable");const a=[];for(const t of e){if("object"!=typeof t||"function"!=typeof t[Symbol.iterator])throw new TypeError("Each header pair must be iterable");a.push(Array.from(t))}for(const e of a){if(2!==e.length)throw new TypeError("Each header pair must be a name/value tuple");this.append(e[0],e[1])}}else for(const t of Object.keys(e)){const a=e[t];this.append(t,a)}}}}get(e){C(e=`${e}`);const t=E(this[$],e);return void 0===t?null:this[$][t].join(", ")}forEach(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,a=N(this),s=0;for(;s<a.length;){var n=a[s];const i=n[0],r=n[1];e.call(t,r,i,this),a=N(this),s++}}set(e,t){t=`${t}`,C(e=`${e}`),A(t);const a=E(this[$],e);this[$][void 0!==a?a:e]=[t]}append(e,t){t=`${t}`,C(e=`${e}`),A(t);const a=E(this[$],e);void 0!==a?this[$][a].push(t):this[$][e]=[t]}has(e){return C(e=`${e}`),void 0!==E(this[$],e)}delete(e){C(e=`${e}`);const t=E(this[$],e);void 0!==t&&delete this[$][t]}raw(){return this[$]}keys(){return P(this,"key")}values(){return P(this,"value")}[Symbol.iterator](){return P(this,"key+value")}}function N(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key+value";return Object.keys(e[$]).sort().map("key"===t?function(e){return e.toLowerCase()}:"value"===t?function(t){return e[$][t].join(", ")}:function(t){return[t.toLowerCase(),e[$][t].join(", ")]})}D.prototype.entries=D.prototype[Symbol.iterator],Object.defineProperty(D.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(D.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});const R=Symbol("internal");function P(e,t){const a=Object.create(O);return a[R]={target:e,kind:t,index:0},a}const O=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==O)throw new TypeError("Value of `this` is not a HeadersIterator");var e=this[R];const t=e.target,a=e.kind,s=e.index,n=N(t,a);return s>=n.length?{value:void 0,done:!0}:(this[R].index=s+1,{value:n[s],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));function M(e){const t=Object.assign({__proto__:null},e[$]),a=E(e[$],"Host");return void 0!==a&&(t[a]=t[a][0]),t}Object.defineProperty(O,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});const L=Symbol("Response internals"),I=i.default.STATUS_CODES;class j{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};y.call(this,e,t);const a=t.status||200,s=new D(t.headers);if(null!=e&&!s.has("Content-Type")){const t=S(e);t&&s.append("Content-Type",t)}this[L]={url:t.url,status:a,statusText:t.statusText||I[a],headers:s,counter:t.counter}}get url(){return this[L].url||""}get status(){return this[L].status}get ok(){return this[L].status>=200&&this[L].status<300}get redirected(){return this[L].counter>0}get statusText(){return this[L].statusText}get headers(){return this[L].headers}clone(){return new j(_(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}}y.mixIn(j.prototype),Object.defineProperties(j.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}}),Object.defineProperty(j.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});const F=Symbol("Request internals"),V=r.default.URL||o.URL,B=r.default.parse,q=r.default.format;function W(e){return/^[a-zA-Z][a-zA-Z\d+\-.]*:/.exec(e)&&(e=new V(e).toString()),B(e)}const U="destroy"in n.default.Readable.prototype;function z(e){return"object"==typeof e&&"object"==typeof e[F]}class H{constructor(e){let t,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};z(e)?t=W(e.url):(t=e&&e.href?W(e.href):W(`${e}`),e={});let s=a.method||e.method||"GET";if(s=s.toUpperCase(),(null!=a.body||z(e)&&null!==e.body)&&("GET"===s||"HEAD"===s))throw new TypeError("Request with GET/HEAD method cannot have body");let n=null!=a.body?a.body:z(e)&&null!==e.body?_(e):null;y.call(this,n,{timeout:a.timeout||e.timeout||0,size:a.size||e.size||0});const i=new D(a.headers||e.headers||{});if(null!=n&&!i.has("Content-Type")){const e=S(n);e&&i.append("Content-Type",e)}let r=z(e)?e.signal:null;if("signal"in a&&(r=a.signal),null!=r&&!function(e){const t=e&&"object"==typeof e&&Object.getPrototypeOf(e);return!(!t||"AbortSignal"!==t.constructor.name)}(r))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[F]={method:s,redirect:a.redirect||e.redirect||"follow",headers:i,parsedURL:t,signal:r},this.follow=void 0!==a.follow?a.follow:void 0!==e.follow?e.follow:20,this.compress=void 0!==a.compress?a.compress:void 0===e.compress||e.compress,this.counter=a.counter||e.counter||0,this.agent=a.agent||e.agent}get method(){return this[F].method}get url(){return q(this[F].parsedURL)}get headers(){return this[F].headers}get redirect(){return this[F].redirect}get signal(){return this[F].signal}clone(){return new H(this)}}function J(e){Error.call(this,e),this.type="aborted",this.message=e,Error.captureStackTrace(this,this.constructor)}y.mixIn(H.prototype),Object.defineProperty(H.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(H.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}}),J.prototype=Object.create(Error.prototype),J.prototype.constructor=J,J.prototype.name="AbortError";const G=r.default.URL||o.URL,Y=n.default.PassThrough;function K(t,a){if(!K.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return y.Promise=K.Promise,new K.Promise(function(s,r){const o=new H(t,a),d=function(e){const t=e[F].parsedURL,a=new D(e[F].headers);if(a.has("Accept")||a.set("Accept","*/*"),!t.protocol||!t.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(t.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(e.signal&&e.body instanceof n.default.Readable&&!U)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let s=null;if(null==e.body&&/^(POST|PUT)$/i.test(e.method)&&(s="0"),null!=e.body){const t=T(e);"number"==typeof t&&(s=String(t))}s&&a.set("Content-Length",s),a.has("User-Agent")||a.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),e.compress&&!a.has("Accept-Encoding")&&a.set("Accept-Encoding","gzip,deflate");let i=e.agent;return"function"==typeof i&&(i=i(t)),Object.assign({},t,{method:e.method,headers:M(a),agent:i})}(o),l=("https:"===d.protocol?p.default:i.default).request,c=o.signal;let m=null;const h=function(){let e=new J("The user aborted a request.");r(e),o.body&&o.body instanceof n.default.Readable&&X(o.body,e),m&&m.body&&m.body.emit("error",e)};if(c&&c.aborted)return void h();const f=function(){h(),v()},g=l(d);let y;function v(){g.abort(),c&&c.removeEventListener("abort",f),clearTimeout(y)}c&&c.addEventListener("abort",f),o.timeout&&g.once("socket",function(e){y=setTimeout(function(){r(new u(`network timeout at: ${o.url}`,"request-timeout")),v()},o.timeout)}),g.on("error",function(e){r(new u(`request to ${o.url} failed, reason: ${e.message}`,"system",e)),m&&m.body&&X(m.body,e),v()}),function(e,t){let a;e.on("socket",function(e){a=e}),e.on("response",function(e){const s=e.headers;"chunked"!==s["transfer-encoding"]||s["content-length"]||e.once("close",function(e){if(a&&a.listenerCount("data")>0&&!e){const e=new Error("Premature close");e.code="ERR_STREAM_PREMATURE_CLOSE",t(e)}})})}(g,function(e){c&&c.aborted||m&&m.body&&X(m.body,e)}),parseInt(process.version.substring(1))<14&&g.on("socket",function(e){e.addListener("close",function(t){const a=e.listenerCount("data")>0;if(m&&a&&!t&&(!c||!c.aborted)){const e=new Error("Premature close");e.code="ERR_STREAM_PREMATURE_CLOSE",m.body.emit("error",e)}})}),g.on("response",function(t){clearTimeout(y);const a=function(e){const t=new D;for(const a of Object.keys(e))if(!k.test(a))if(Array.isArray(e[a]))for(const s of e[a])x.test(s)||(void 0===t[$][a]?t[$][a]=[s]:t[$][a].push(s));else x.test(e[a])||(t[$][a]=[e[a]]);return t}(t.headers);if(K.isRedirect(t.statusCode)){const e=a.get("Location");let i=null;try{i=null===e?null:new G(e,o.url).toString()}catch(t){if("manual"!==o.redirect)return r(new u(`uri requested responds with an invalid redirect URL: ${e}`,"invalid-redirect")),void v()}switch(o.redirect){case"error":return r(new u(`uri requested responds with a redirect, redirect mode is set to error: ${o.url}`,"no-redirect")),void v();case"manual":if(null!==i)try{a.set("Location",i)}catch(e){r(e)}break;case"follow":if(null===i)break;if(o.counter>=o.follow)return r(new u(`maximum redirect reached at: ${o.url}`,"max-redirect")),void v();const e={headers:new D(o.headers),follow:o.follow,counter:o.counter+1,agent:o.agent,compress:o.compress,method:o.method,body:o.body,signal:o.signal,timeout:o.timeout,size:o.size};if(!function(e,t){const a=new G(t).hostname,s=new G(e).hostname;return a===s||"."===a[a.length-s.length-1]&&a.endsWith(s)}(o.url,i)||(n=o.url,new G(i).protocol!==new G(n).protocol))for(const t of["authorization","www-authenticate","cookie","cookie2"])e.headers.delete(t);return 303!==t.statusCode&&o.body&&null===T(o)?(r(new u("Cannot follow redirect with body being a readable stream","unsupported-redirect")),void v()):(303!==t.statusCode&&(301!==t.statusCode&&302!==t.statusCode||"POST"!==o.method)||(e.method="GET",e.body=void 0,e.headers.delete("content-length")),s(K(new H(i,e))),void v())}}var n;t.once("end",function(){c&&c.removeEventListener("abort",f)});let i=t.pipe(new Y);const p={url:o.url,status:t.statusCode,statusText:t.statusMessage,headers:a,size:o.size,timeout:o.timeout,counter:o.counter},d=a.get("Content-Encoding");if(!o.compress||"HEAD"===o.method||null===d||204===t.statusCode||304===t.statusCode)return m=new j(i,p),void s(m);const l={flush:e.Z_SYNC_FLUSH,finishFlush:e.Z_SYNC_FLUSH};if("gzip"==d||"x-gzip"==d)return i=i.pipe(e.createGunzip(l)),m=new j(i,p),void s(m);if("deflate"==d||"x-deflate"==d){const a=t.pipe(new Y);return a.once("data",function(t){i=8==(15&t[0])?i.pipe(e.createInflate()):i.pipe(e.createInflateRaw()),m=new j(i,p),s(m)}),void a.on("end",function(){m||(m=new j(i,p),s(m))})}if("br"==d&&"function"==typeof e.createBrotliDecompress)return i=i.pipe(e.createBrotliDecompress()),m=new j(i,p),void s(m);m=new j(i,p),s(m)}),function(e,t){const a=t.body;null===a?e.end():b(a)?a.stream().pipe(e):Buffer.isBuffer(a)?(e.write(a),e.end()):a.pipe(e)}(g,o)})}function X(e,t){e.destroy?e.destroy(t):(e.emit("error",t),e.end())}K.isRedirect=function(e){return 301===e||302===e||303===e||307===e||308===e},K.Promise=global.Promise;const Q=K},604:e=>{e.exports=t},648:(e,t,a)=>{a.d(t,{H6:()=>g,IP:()=>h,Is:()=>l,PH:()=>c,VH:()=>p,il:()=>u,lW:()=>d,s1:()=>f,wq:()=>m});var s=a(4086),n=a(971);const i={maxCommitHistory:50,enableGitIntegration:!0,trackSessionChanges:!0,autoDetectChanges:!0,excludePatterns:["node_modules",".git","dist","build","*.log",".DS_Store","*.tmp","*.temp"],maxFileSize:1048576,enableFileHashing:!0,gitStatusCheckInterval:5e3,maxContentLength:1e3,maxHistoryEntries:100,enableRealTimeMonitoring:!1,sessionTimeoutMinutes:60,enableChangeNotifications:!1,logLevel:"info"};class r{config;sessionChanges=new Map;commitHistory=[];gitStatusCache=new Map;changeCallbacks=[];isWatching=!1;gitStatusTimer;constructor(e){this.config={...i,...e}}async detectFileChanges(e){try{const e=[];if(this.config.enableGitIntegration){const t=await this.detectGitChanges();e.push(...t)}const t=await this.detectFilesystemChanges();e.push(...t);const a={hasChanges:e.length>0,changes:e,summary:this.generateChangeSummary(e)};return e.length>0&&this.triggerChangeCallbacks(e),a}catch(e){return console.error("检测文件变更时出错:",e),{hasChanges:!1,changes:[],summary:{totalFiles:0,addedFiles:0,modifiedFiles:0,deletedFiles:0,renamedFiles:0,totalSize:0}}}}async detectGitChanges(){const e=[];try{if(!(0,n.BX)())return e;const t=(0,n.$G)(),a=(0,n.Wz)(),i=this.parseGitStatus(t),r=this.getCurrentGitHash(),o=this.getCurrentBranch(),p=(new Date).toISOString();for(const t of i){let n;switch(t.status){case"A":n="added";break;case"M":n="modified";break;case"D":n="deleted";break;case"R":n="renamed";break;default:continue}const i={id:(0,s.lk)(),filePath:t.filePath,changeType:n,timestamp:p,source:"git-status",diff:this.config.enableFileHashing?a:void 0,commitHash:r,branch:o,checksum:this.config.enableFileHashing?await this.generateFileChecksum(t.filePath):void 0};e.push(i),this.gitStatusCache.set(t.filePath,t.status)}}catch(e){console.error("检测Git变更时出错:",e)}return e}parseGitStatus(e){const t=[];try{const{execSync:e}=a(5814),s=e("git status --porcelain",{encoding:"utf-8"});for(const e of s.trim().split("\n"))if(e.length>=3){const a=e.substring(0,2).trim(),s=e.substring(3).trim();t.push({filePath:s,status:a})}}catch(e){console.warn("解析Git状态失败:",e)}return t}getCurrentGitHash(){try{const{execSync:e}=a(5814);return e("git rev-parse HEAD",{encoding:"utf-8"}).trim()}catch(e){return"unknown"}}getCurrentBranch(){try{const{execSync:e}=a(5814);return e("git rev-parse --abbrev-ref HEAD",{encoding:"utf-8"}).trim()}catch(e){return"unknown"}}async detectFilesystemChanges(){return[]}generateChangeSummary(e){const t={totalFiles:e.length,addedFiles:0,modifiedFiles:0,deletedFiles:0,renamedFiles:0,totalSize:0};for(const a of e){switch(a.changeType){case"added":t.addedFiles++;break;case"modified":t.modifiedFiles++;break;case"deleted":t.deletedFiles++;break;case"renamed":t.renamedFiles++}a.size&&(t.totalSize+=a.size)}return t}async generateFileChecksum(e){try{return`sha256:${e}:${Date.now()}`}catch(e){return console.error("生成文件校验和时出错:",e),""}}triggerChangeCallbacks(e){for(const t of this.changeCallbacks)try{t(e)}catch(e){console.error("执行变更回调时出错:",e)}}trackSessionFileChange(e,t,a){if(!this.config.trackSessionChanges)return;const s=this.sessionChanges.get(e),n=(new Date).toISOString();if(s){const e=[...s.changes];for(const t of a){const a=e.findIndex(e=>e.filePath===t.filePath&&e.changeType===t.changeType);a>=0?e[a]=t:e.push(t)}s.changes=e,s.updatedAt=n,s.totalFiles=e.length,s.totalSize=e.reduce((e,t)=>e+(t.size||0),0)}else this.sessionChanges.set(e,{sessionId:e,taskId:t,changes:[...a],committed:!1,createdAt:n,updatedAt:n,totalFiles:a.length,totalSize:a.reduce((e,t)=>e+(t.size||0),0)})}getSessionFileChanges(e){return this.sessionChanges.get(e)}getAllSessionFileChanges(){return new Map(this.sessionChanges)}getCurrentSessionFileChanges(){let e,t="";for(const a of this.sessionChanges.values())a.updatedAt>t&&(t=a.updatedAt,e=a);return e}async handleGitCommit(e){if(!this.config.enableGitIntegration)return null;try{const t={hash:e.hash||this.getCurrentGitHash(),message:e.commitMessage,author:e.author||"Unknown",timestamp:(new Date).toISOString(),branch:e.branch||this.getCurrentBranch(),files:[]};return this.commitHistory.unshift(t),this.commitHistory.length>this.config.maxCommitHistory&&(this.commitHistory=this.commitHistory.slice(0,this.config.maxCommitHistory)),this.markSessionChangesAsCommitted(t),t}catch(e){return console.error("处理Git提交事件时出错:",e),null}}markSessionChangesAsCommitted(e){for(const t of this.sessionChanges.values())!t.committed&&t.updatedAt>e.timestamp&&(t.committed=!0)}onChange(e){this.changeCallbacks.push(e)}removeChangeCallback(e){const t=this.changeCallbacks.indexOf(e);t>=0&&this.changeCallbacks.splice(t,1)}startWatching(){this.isWatching||(this.isWatching=!0,this.config.enableGitIntegration&&(this.gitStatusTimer=setInterval(async()=>{try{await this.detectFileChanges()}catch(e){console.error("监控Git状态时出错:",e)}},this.config.gitStatusCheckInterval)))}stopWatching(){this.isWatching&&(this.isWatching=!1,this.gitStatusTimer&&(clearInterval(this.gitStatusTimer),this.gitStatusTimer=void 0))}getCommitHistory(){return[...this.commitHistory]}cleanup(e=30){const t=new Date;t.setDate(t.getDate()-e);const a=t.toISOString();for(const[e,t]of this.sessionChanges.entries())t.updatedAt<a&&t.committed&&this.sessionChanges.delete(e);this.commitHistory=this.commitHistory.filter(e=>e.timestamp>a)}getConfig(){return{...this.config}}updateConfig(e){this.config={...this.config,...e}}generateChangeSummaryText(e="text"){const t=[];for(const e of this.sessionChanges.values())t.push(...e.changes);if("json"===e)return JSON.stringify(this.generateChangeSummary(t),null,2);const a=this.generateChangeSummary(t);let s="📊 文件变动摘要\n\n";return s+=`📁 总文件数: ${a.totalFiles}\n`,s+=`➕ 新增文件: ${a.addedFiles}\n`,s+=`✏️ 修改文件: ${a.modifiedFiles}\n`,s+=`🗑️ 删除文件: ${a.deletedFiles}\n`,s+=`🔄 重命名文件: ${a.renamedFiles}\n`,s+=`📦 总大小: ${(a.totalSize/1024).toFixed(2)} KB\n`,s+=`\n🕐 生成时间: ${(new Date).toLocaleString()}`,s}}let o=null;function p(e){return o||(o=new r(e)),o}function d(e){return new r(e)}function l(){o&&(o.stopWatching(),o=null)}async function c(e,t){return p(t).detectFileChanges(e)}function m(e="text"){return p().generateChangeSummaryText(e)}function u(e){const t={id:(0,s.lk)(),filePath:e.filePath,changeType:e.changeType,timestamp:(new Date).toISOString(),source:e.source||"manual",content:e.content,size:e.size};return p().trackSessionFileChange("default-session",void 0,[t]),t}async function h(e){return p().handleGitCommit(e)}function f(e){return p().getSessionFileChanges(e)}function g(){return p().getCurrentSessionFileChanges()}},699:(e,t,a)=>{a.d(t,{f:()=>n});var s=a(1831);const n=e=>e instanceof s.Z},702:e=>{e.exports=a},748:(e,t,a)=>{a.a(e,async(e,s)=>{try{a.d(t,{Kq:()=>k,RS:()=>T,initializeDynamicCommands:()=>C,o_:()=>x});var n=a(4237),i=a(9440),r=a(9033),o=a(7543),p=a(8743),d=a(971),l=a(8736),c=e([o,p,l]);async function m(e,t){if(e){t.log(),t.info("开始处理任务..."),t.log();try{const{executeMasterAgent:a,config:s}=await(0,o.RL)();await a(e,!1,t,s),t.log(),t.success("任务处理完成"),i.Ck.sessionId&&(t.log(n.Ay.gray(`当前会话 ID: ${i.Ck.sessionId.substring(0,8)}`)),i.Ck.tasks&&i.Ck.tasks.length>0&&t.log(n.Ay.gray(`当前会话任务数: ${i.Ck.tasks.length}`)),t.log())}catch(e){throw t.error(`任务处理失败: ${e.message}`),e}}else t.warning("请提供任务请求内容")}async function u(e){if(i.Ck.messages&&i.Ck.messages.length>0&&i.Ck.currentTask){e.log(),e.info(`正在恢复会话 [ID:${i.Ck.sessionId?i.Ck.sessionId.substring(0,8):"unknown"}]...`),e.log();try{const{executeMasterAgent:t,config:a}=await(0,o.RL)();await t(null,!0,e,a),e.log(),e.success("会话恢复完成"),i.Ck.sessionId&&(e.log(n.Ay.gray(`会话 ID: ${i.Ck.sessionId.substring(0,8)}`)),i.Ck.tasks&&i.Ck.tasks.length>0&&e.log(n.Ay.gray(`会话任务数: ${i.Ck.tasks.length}`)),e.log())}catch(t){throw e.error(`会话恢复失败: ${t.message}`),t}}else e.warning("没有可恢复的会话。使用 /chat <请求> 开始新任务。")}function h(e){(0,i.JZ)(),e.success("会话已归档并清空"),e.log()}function f(e){const t=(0,r.iW)();e.log(t)}function g(e){e.exit()}function y(e){e.printHelp&&e.printHelp()}function v(e){e.log(),e.log(n.Ay.cyan("═══════════════════════════════════════════════════════")),e.log(n.Ay.cyan(" 📦 Available Tools ")),e.log(n.Ay.cyan("═══════════════════════════════════════════════════════")),e.log();const t=(0,p.KG)(),a=(0,p.kX)();if(0===Object.keys(t).length)return e.warning("No tools loaded yet. Tools will be available after starting a task."),void e.log();if(e.log(n.Ay.bold("📊 Summary:")),e.log(n.Ay.gray(` Total Tools: ${a.total}`)),e.log(n.Ay.gray(` Local Tools: ${a.local}`)),e.log(n.Ay.gray(` MCP Tools: ${a.mcp}`)),e.log(),a.local>0){e.log(n.Ay.bold.green("🔧 Local Tools:")),e.log();const{localTools:s}=a;for(const a of s){const s=t[a];if(s&&s.getDefinition){const t=s.getDefinition();e.log(n.Ay.green(` • ${t.name}`)),e.log(n.Ay.gray(` ${t.description}`)),e.log()}}}if(a.mcp>0){e.log(n.Ay.bold.magenta("🌐 MCP Tools:")),e.log();const{mcpTools:s}=a;for(const a of s){const s=t[a];if(s&&s.getDefinition){const t=s.getDefinition(),a=t.description.match(/\[MCP:([^\]]+)\]/),i=a?a[1]:"unknown",r=t.description.replace(/\[MCP:[^\]]+\]\s*/,"");e.log(n.Ay.magenta(` • ${t.name}`)),e.log(n.Ay.gray(` ${r}`)),e.log(n.Ay.gray(` (from MCP server: ${i})`)),e.log()}}}e.log(n.Ay.cyan("═══════════════════════════════════════════════════════")),e.log()}async function w(e){e.log(),e.info("正在检查git变更...");try{if(!(0,d.BX)())return e.warning("没有未提交的变更"),void e.log();const t=(0,d.$G)(),a=(0,d.Wz)();e.log(),e.info("当前git状态:"),e.log(n.Ay.gray(t)),e.log();const s=a.length>500?a.substring(0,500)+"\n...(truncated)":a;e.info("变更内容预览:"),e.log(n.Ay.gray(s)),e.log(),e.info("正在使用lite模型生成commit message...");const i=[{role:"system",content:"你是一个专业的git commit message生成助手。\n请根据提供的git diff内容,生成一个简洁明了的commit message。\n\n要求:\n1. 使用中文\n2. 第一行为简短摘要(不超过50字符)\n3. 如果需要详细说明,空一行后添加详细描述\n4. 遵循常见的commit message规范\n5. 只输出commit message,不要有其他说明文字\n\n示例格式:\nfeat: 添加用户认证功能\n\n- 实现JWT token验证\n- 添加登录和注册接口\n- 更新用户模型"},{role:"user",content:`请为以下git变更生成commit message:\n\n${a}`}],r=await(0,l.callModelAPI)({messages:i,temperature:.3,useCompression:!0,tools:[]});let o="";if(r.choices&&r.choices.length>0){const{message:e}=r.choices[0];e.content&&(o=e.content.trim())}if(!o)return e.error("生成commit message失败"),void e.log();e.log();const p=o+"\n\n[Generated by niumagents]";e.success("生成的commit message:"),e.log(n.Ay.cyan("─".repeat(50))),e.log(n.Ay.white(p)),e.log(n.Ay.cyan("─".repeat(50))),e.log(),e.info("正在执行 git add ."),(0,d.Xr)(),e.success("已暂存所有变更"),e.info("正在执行 git commit..."),(0,d.om)(p),e.success("提交成功!"),e.log()}catch(t){throw e.error(`执行commit命令失败: ${t.message}`),e.log(),t}}function b(e,t){e.warning(`未知命令: /${t}`);const a=_.map(e=>`/${e.name}`).join(", ");e.log(n.Ay.gray(`可用命令: ${a}`))}[o,p,l]=c.then?(await c)():c;const _=[{name:"chat",description:"开始新任务",handler:m,requiresArg:!0},{name:"resume",description:"恢复中断的会话",handler:u,requiresArg:!1},{name:"commit",description:"使用AI总结变更并提交git commit",handler:w,requiresArg:!1},{name:"clear",description:"归档并清空当前会话",handler:h,requiresArg:!1},{name:"history",description:"查看归档会话",handler:f,requiresArg:!1},{name:"list_tools",description:"列出所有可用工具",handler:v,requiresArg:!1},{name:"exit",description:"退出应用",handler:g,requiresArg:!1},{name:"quit",description:"退出应用",handler:g,requiresArg:!1},{name:"help",description:"显示帮助信息",handler:y,requiresArg:!1}];function S(e){return _.find(t=>t.name===e)||null}async function T(e,t,a=""){const s=S(t);if(s)if(!s.requiresArg||a||"chat"===t)try{s.requiresArg?await s.handler(a,e):await s.handler(e)}catch(a){throw e.error(`执行命令 /${t} 时出错: ${a.message}`),a}else e.warning(`命令 /${t} 需要参数`);else b(e,t)}function k(){return[..._]}function x(e){e.log(n.Ay.cyan("可用命令:")),_.forEach(t=>{const a=t.requiresArg?`/${t.name} <参数>`:`/${t.name}`;e.log(` ${n.Ay.white(a)} - ${n.Ay.gray(t.description)}`)}),e.log(),e.log(n.Ay.gray("提示: 直接输入内容将作为任务请求发送")),e.log()}async function C(){try{const{isGitAvailable:e}=await Promise.resolve().then(a.bind(a,971)),t=e();console.log(n.Ay.gray("Git环境检查: "+(t?"可用":"不可用"))),t?console.log(n.Ay.green("✓ /commit 命令可用")):console.log(n.Ay.yellow("⚠ Git不可用,/commit 命令将不可用"))}catch(e){console.log(n.Ay.gray(`初始化动态命令时出错: ${e.message}`))}}s()}catch(A){s(A)}})},971:(e,t,a)=>{a.d(t,{$G:()=>d,BX:()=>u,Wz:()=>l,Xr:()=>c,isGitAvailable:()=>p,om:()=>m});var s=a(5814),n=a(4421),i=a(2521),r=a(8116),o=a(9187);function p(){try{const e=(0,i.join)(process.cwd(),".git");return(0,n.existsSync)(e)?((0,s.execSync)("git --version",{stdio:"ignore"}),(0,o.MD)("Git is available"),!0):((0,o.MD)("Git not available: .git directory not found"),!1)}catch(e){return(0,o.MD)(`Git not available: ${e.message}`),!1}}function d(){try{return(0,s.execSync)("git status",{encoding:"utf-8"})}catch(e){return(0,o.JE)(`Failed to get git status: ${e.message}`),""}}function l(){try{const e=(0,s.execSync)("git diff --cached",{encoding:"utf-8"}),t=(0,s.execSync)("git diff",{encoding:"utf-8"});let a="";return e&&(a+="=== Staged Changes ===\n"+e+"\n"),t&&(a+="=== Unstaged Changes ===\n"+t),a||"No changes detected"}catch(e){return(0,o.JE)(`Failed to get git diff: ${e.message}`),""}}function c(){try{(0,s.execSync)("git add .",{stdio:"inherit"})}catch(e){throw new Error(`Failed to stage changes: ${e.message}`)}}function m(e){const t=(0,i.join)((0,r.tmpdir)(),`git-commit-${Date.now()}.txt`);try{(0,n.writeFileSync)(t,e,"utf-8"),(0,s.execSync)(`git commit -F "${t}"`,{stdio:"inherit"})}catch(e){throw new Error(`Failed to commit: ${e.message}`)}finally{try{(0,n.existsSync)(t)&&(0,n.unlinkSync)(t)}catch(e){(0,o.JE)(`Failed to cleanup temporary file: ${e.message}`)}}}function u(){try{return(0,s.execSync)("git status --porcelain",{encoding:"utf-8"}).trim().length>0}catch(e){return(0,o.JE)(`Failed to check for uncommitted changes: ${e.message}`),!1}}},1024:(e,t,a)=>{a.a(e,async(e,s)=>{try{a.d(t,{a$:()=>m,jW:()=>c});var n=a(3596),i=a(1967),r=a(5401),o=a(9187),p=e([r]),d=p.then?(await p)():p;r=d[0];class l extends i.oS{mcpTool;constructor(e){super(),this.mcpTool=e}getDefinition(){return{name:this.mcpTool.name,description:`[MCP:${this.mcpTool.serverName}] ${this.mcpTool.description}`,input_schema:{type:"object",properties:this.mcpTool.inputSchema.properties||{},required:this.mcpTool.inputSchema.required}}}async execute(...e){(0,o.MD)(`Executing MCP tool: ${this.mcpTool.name}`);const t=this.argsToParams(e),a=(0,n.s)(),s=await a.callTool(this.mcpTool.name,t);if(!s.success)throw new Error(s.error||"MCP tool execution failed");const i=this.formatMCPResult(s.content);return(0,r.sG)(i,i,!0)}argsToParams(e){if(1===e.length&&"object"==typeof e[0]&&!Array.isArray(e[0]))return e[0];const t=this.mcpTool.inputSchema.properties||{},a=Object.keys(t),s={};return e.forEach((e,t)=>{t<a.length&&(s[a[t]]=e)}),s}formatMCPResult(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>this.formatContentItem(e)).join("\n\n"):JSON.stringify(e,null,2)}formatContentItem(e){return"string"==typeof e?e:"text"===e.type?e.text||"":"image"===e.type?`[Image: ${e.data?.substring(0,50)}...]`:"resource"===e.type?`[Resource: ${e.uri||"unknown"}]`:JSON.stringify(e)}formatAction(e){const t="object"==typeof e?Object.entries(e).map(([e,t])=>`${e}=${JSON.stringify(t)}`).join(", "):JSON.stringify(e);return`${this.mcpTool.name}(${t}) [MCP:${this.mcpTool.serverName}]`}formatObservation(e){return e&&e.__tool_result?String(e.display||e.result):String(e)}shouldPrintObservation(e){return!0}}function c(e){const t={};for(const a of e)t[a.name]=new l(a);return t}function m(e){const t={};for(const a of e){const e=new l(a);t[a.name]=async(...t)=>e.execute(...t)}return t}s()}catch(u){s(u)}})},1327:(e,t,a)=>{a.a(e,async(e,s)=>{try{a.d(t,{Ai:()=>m,SYSTEM_PROMPT:()=>p,c3:()=>d,qA:()=>c,xo:()=>l});var n=a(4239),i=e([n]),r=i.then?(await i)():i;function o(e=(0,n.JA)()){return`You are an expert code assistant that follows the ReAct (Reasoning + Acting) pattern with enhanced thinking capabilities. Your primary goal is to solve coding tasks accurately, efficiently, and with high code quality.\n\n<instructions>\nYou have access to a comprehensive set of tools, with the 'think' tool being specially designed for observable reasoning.\n\n<workflow>\nYou must follow this strict thinking pattern for EVERY response:\n\n1. FIRST: Call the 'think' tool to analyze the situation\n - Examine the user request and available context thoroughly\n - Identify knowledge gaps and needed information\n - Plan a clear sequence of actions to accomplish the task\n - Explain your reasoning with specific details\n\n2. THEN: Execute your planned action\n - Call the appropriate tool with correct parameters (based on the available tools list)\n - Ensure parameter values are properly formatted\n - If task is complete, provide a comprehensive final answer\n\n3. AFTER receiving an Observation: Call 'think' again to reflect\n - Analyze the tool result critically\n - Verify if the expected outcome was achieved\n - Adjust your plan if necessary\n - Decide on the next appropriate action\n\nThis cycle continues: think → act → observe → think → act → ... until task completion.\n</workflow>\n\n<available_tools>\nYou have access to the following tools (detailed schemas are provided separately):\n\n${e.map(e=>`- ${e.name}: ${e.description}`).join("\n")}\n\nThe system will provide you with the exact parameter schemas for each tool. When using tools, pay special attention to required parameters and their formats.\nUse the tool definitions to understand what parameters each tool requires.\n</available_tools>\n\n<critical_rules>\n1. ALWAYS call 'think' tool FIRST before taking any action\n2. ALWAYS call 'think' tool AFTER receiving an Observation to reflect\n3. The 'think' tool is zero-side-effect - it only makes your reasoning observable\n4. NEVER write "Observation:" yourself - the system provides it\n5. When you decide the task is complete, you can directly respond with your final answer (no tool call needed)\n6. Think deeply and systematically: analyze context, plan actions, reflect on results\n7. If you encounter errors or unexpected results, use 'think' to analyze the problem and determine the best next step\n8. ALWAYS maintain high code quality standards - follow project conventions, add appropriate comments, and write clean code\n</critical_rules>\n\n<code_modification_workflow>\nWhen modifying existing code:\n1. Call think() to plan your approach and identify risks\n2. Call read() to get the CURRENT file content\n3. After Observation, call think() to analyze and prepare the COMPLETE NEW version with all changes\n4. Choose the appropriate tool:\n - Use merge() for comprehensive changes (adds complete new file content with intelligent conflict detection)\n - Use search_replace() for targeted replacements (rename variables, update patterns, batch replace)\n5. If conflicts occur, call think() to decide whether to fix or use write() to overwrite\n\nWhen creating new files:\n1. Call think() to plan the file structure and design\n2. Call write() with BOTH path AND the complete file content\n3. After Observation, call think() to confirm success and verify the file was created correctly\n\nWhen renaming or doing batch replacements:\n1. Call think() to identify all occurrences and plan the replacement strategy\n2. Use search_replace() with appropriate search pattern and replacement text\n - For simple text: provide literal strings\n - For patterns: use regex patterns\n - Can target single file or multiple files with glob patterns\n3. After Observation, call think() to verify the replacements were successful\n\nCRITICAL FILE OPERATION RULES:\n- merge() and write() REQUIRE the complete file content, not just changes\n- search_replace() is ideal for renaming identifiers, updating imports, or pattern-based replacements\n- Read the file first, prepare the full new version, then call merge() or write()\n- NEVER skip the thinking steps - they make your reasoning observable and debuggable\n- NEVER modify files without first reading their current content\n\nFILE PATH SAFETY CONSTRAINTS:\n- ONLY write files within the current working directory (project root)\n- NEVER write to system directories (/, /usr, /etc, /System, C:Windows, etc.)\n- NEVER write to parent directories using ../ paths\n- NEVER write to absolute paths outside the project (e.g., /tmp, /var, C:Users...)\n- Use relative paths from project root (e.g., "src/utils/helper.js", "config/app.json")\n- If user requests writing outside project directory, politely refuse and explain the security constraint\n- Valid paths: "src/...", "lib/...", "config/...", "tests/...", "docs/...", etc.\n- Invalid paths: "/etc/...", "../../../...", "C:Windows...", "/usr/local/..."\n</code_modification_workflow>\n\n<language_constraints>\n- ALWAYS analyze the project's primary programming language and file context before generating code\n- Check .nium/docs/PROJECT_STRUCTURE.md for language documentation\n- Apply LAYERED language constraints based on file purpose and location:\n * BUSINESS CODE (src/, lib/, app/): STRICTLY use project's primary programming language\n * TOOL CONFIG (config/, .nium/, build scripts): Allow tool-appropriate languages (TypeScript, JSON, YAML, Shell)\n * DOCUMENTATION (docs/, README, .md files): Allow documentation languages (Markdown, HTML, text)\n * TEST FILES (test/, tests/, spec/, __tests__/): Allow test-specific languages and frameworks\n * BUILD/DEPLOY (Dockerfile, docker-compose.yml, CI/CD configs): Allow infrastructure languages\n- For multi-language projects, follow the specific context of the file layer you're modifying\n- When unsure, use glob() to explore file extensions and project structure first\n- Maintain consistent code style within each language layer\n</language_constraints>\n\n<specialized_task_routing>\nFor coding tasks that involve:\n- Implementing new features or functions\n- Creating new files with code\n- Modifying existing code files\n- Adding methods, classes, or modules\n- Refactoring code\n- Writing APIs or interfaces\n\nConsider using the 'plan' tool to leverage specialized sub-agents (especially 'coder' agent) that are optimized for code development tasks. The coder agent is a specialized expert that:\n- Understands multi-language projects (JavaScript, TypeScript, Java, Python, Go, Rust, C#, Ruby, PHP, etc.)\n- Automatically detects project language and follows conventions\n- Performs comprehensive dependency checking\n- Maintains code quality and consistency with existing codebase\n- Follows language-specific best practices and naming conventions\n\nExample routing:\n- User: "实现用户登录功能" → Call plan() to route to coder agent\n- User: "添加一个工具函数计算日期差" → Call plan() to route to coder agent\n- User: "重构这个模块提高性能" → Call plan() to route to coder agent\n\nFor simple tasks that don't involve code generation (reading files, exploring structure, running commands), you can handle them directly.\n</specialized_task_routing>\n\n<project_exploration_guidelines>\nIMPORTANT: Avoid redundant project exploration in plan mode\n\nWhen working within a plan/task context:\n1. **Check for existing documentation FIRST**:\n - ALWAYS try to read '.nium/docs/PROJECT_STRUCTURE.md' before exploring\n - This document is automatically generated at the start of plan tasks\n - It contains comprehensive project structure, language info, and conventions\n\n2. **When to use explore tools (quickProjectScan, enhanceProjectStructure)**:\n - ✅ When explicitly asked by the user to "explore" or "scan" the project\n - ✅ When PROJECT_STRUCTURE.md does not exist or is empty\n - ❌ NEVER call explore tools in plan mode if PROJECT_STRUCTURE.md already exists\n - ❌ NEVER call explore tools multiple times within the same task\n\n3. **Best practice workflow**:\n - Step 1: Call read('.nium/docs/PROJECT_STRUCTURE.md')\n - Step 2: If file exists and has content → Use it directly\n - Step 3: If file doesn't exist → The master agent has already handled this, so just read again or ask user\n\n4. **Rationale**:\n - Explore operations are expensive (time, tokens, I/O)\n - In plan mode, project structure is scanned once at the beginning\n - Repeated exploration wastes resources and produces identical results\n - All necessary project info is already in PROJECT_STRUCTURE.md\n\nExample:\n❌ Bad: Call quickProjectScan() in every step of a plan task\n✅ Good: Call read('.nium/docs/PROJECT_STRUCTURE.md') to get project info\n</project_exploration_guidelines>\n\n<project_type_detection>\nIMPORTANT: Identify project build system before making assumptions\n\nWhen working with dependency management or build configurations:\n1. **NEVER assume the build tool** - Always detect first:\n - Java projects: Check for pom.xml (Maven) OR build.gradle/settings.gradle (Gradle)\n - JavaScript/Node.js: Check for package.json (npm/yarn/pnpm)\n - Python: Check for requirements.txt, setup.py, pyproject.toml, Pipfile\n - Rust: Check for Cargo.toml\n - Go: Check for go.mod\n - .NET: Check for *.csproj, *.sln\n - Ruby: Check for Gemfile\n - PHP: Check for composer.json\n\n2. **Quick detection workflow**:\n - Step 1: Use glob() to search for build files: glob(pattern="**/pom.xml") || glob(pattern="**/*.gradle")\n - Step 2: Based on results, determine the build system\n - Step 3: Then read the appropriate configuration file\n\n3. **Common patterns to avoid**:\n ❌ Bad: Assuming "Spring Boot = Maven" → directly reading pom.xml\n ✅ Good: First check glob("**/pom.xml") and glob("**/*.gradle"), then read the found file\n\n ❌ Bad: Reading package.json without checking if it exists\n ✅ Good: Call glob("package.json") first, handle the case if it doesn't exist\n\n4. **Examples**:\nExample 1 - Java project dependency check:\nCall glob(pattern="**/pom.xml")\n→ If found: This is a Maven project, read pom.xml\n→ If not found: Call glob(pattern="**/*.gradle")\n → If found: This is a Gradle project, read build.gradle\n → If not found: Unknown build system, ask user or explore further\n\nExample 2 - Adding a dependency:\n❌ Bad approach: Directly try to read pom.xml\n✅ Good approach:\n 1. Call glob to detect build file\n 2. Call think to plan based on detected build system\n 3. Read the appropriate file\n 4. Add dependency using correct syntax for that build system\n</project_type_detection>\n\n<best_practices>\n- Write modular, reusable code where appropriate\n- Add clear comments explaining complex logic or non-obvious implementation details\n- Handle edge cases and potential errors gracefully\n- Follow language-specific coding standards and conventions\n- When modifying existing code, preserve the original author's intent while making improvements\n- Test your solutions conceptually before implementation\n</best_practices>\n\n<examples>\n<example>\n<scenario>User asks: Create a config.json file</scenario>\n<correct_response>\nStep 1 - Think first:\nCall think: "The user wants a config.json file. I should create a new file with write() since it doesn't exist yet. Let me prepare a default JSON structure with common configuration options that would be useful."\n\nStep 2 - Execute action:\nCall write to create the file with path and content\n\n[System provides: Observation: done]\n\nStep 3 - Think again to reflect:\nCall think: "Write operation successful. The config.json file has been created with default settings. Task is complete."\n\nStep 4 - Provide final answer:\n"Created config.json with default configuration that includes common settings."\n</correct_response>\n</example>\n\n<example>\n<scenario>User asks: Add a new function to utils.js</scenario>\n<correct_response>\nStep 1 - Think:\nCall think: "Need to add a function to utils.js. First I should read the existing file to understand its structure, coding style, and existing functions to ensure consistency."\n\nStep 2 - Read file:\nCall read to get the current file content\n\n[System provides: Observation: <file content>]\n\nStep 3 - Think about the content:\nCall think: "I can see the current structure. The file has 3 existing utility functions with JSDoc comments and follows a specific naming convention. I'll add the new function at the end, following the same style pattern, and use merge() to safely integrate it."\n\nStep 4 - Merge changes:\nCall merge with the complete new version of the file\n\n[System provides: Observation: merge successful]\n\nStep 5 - Think about result:\nCall think: "Merge completed successfully without conflicts. The new function is now integrated into utils.js following the project's coding style."\n\nStep 6 - Final answer:\n"Successfully added the new function to utils.js using safe merge, maintaining consistency with existing code style."\n</correct_response>\n</example>\n</examples>\n\n<final_note>\nThe key difference from traditional tool calling:\n- OLD: You called tools directly and reasoned implicitly\n- NEW: You call think() to make reasoning explicit, THEN call tools\n\nThis makes your decision-making process transparent, debuggable, and more reliable. Always prioritize clarity and thoroughness in your thinking process.\n</final_note>\n</instructions>`}n=r[0];const p=o();function d(e,t=[]){return`你是一个任务规划专家。请为以下任务生成详细、可执行的计划。\n\n任务描述:\n${e}\n${t.length>0?`\n\n可用的子智能体:\n${t.map(e=>`- ${e.name}: ${e.description}`).join("\n")}`:""}\n\n重要规则:\n- 执行步骤应该是大颗粒度的任务拆分,聚焦于主要阶段目标,不要过于细化\n- 任务必须拆分为2-4个逻辑步骤,确保步骤数适中且涵盖所有必要工作\n- 步骤之间必须有明确的依赖关系和顺序逻辑,确保前序步骤完成后才能进行后续步骤\n- 各个步骤内容应该相互独立且互补,避免重复或冗余操作\n- 每个步骤应该目标明确、可量化,描述完整的一个主要阶段或工作单元\n- 对于每个步骤,请分析并推荐最适合的子智能体,考虑其专长与步骤需求的匹配度\n- 如果有明显适合的子智能体,优先推荐使用\n- 如果没有合适的子智能体,使用"default"表示使用默认的react-agent\n\n请使用 create_task_plan 工具返回结构化的任务规划。`}function l(e,t=[]){return`你是一个任务规划专家。请为以下任务生成详细、结构化的执行计划。\n\n任务描述:\n${e}\n${t.length>0?`\n可用的子智能体:\n${t.map(e=>`- ${e.name}: ${e.description}`).join("\n")}`:""}\n\n请按照以下Markdown格式输出任务规划:\n\n# 任务规划\n\n## 任务概述\n[简要描述任务目标,包括输入、处理和预期输出]\n\n## 执行步骤\n1. [步骤1描述 - 清晰说明要完成的工作和目标] (推荐子智能体: [子智能体名称或"default"])\n2. [步骤2描述 - 清晰说明要完成的工作和目标] (推荐子智能体: [子智能体名称或"default"])\n3. [步骤3描述 - 清晰说明要完成的工作和目标] (推荐子智能体: [子智能体名称或"default"])\n...\n\n## 预期结果\n[详细描述完成后的预期结果,包括具体交付物、功能特性或代码变更]\n\n## 注意事项\n[列出执行过程中需要特别注意的事项、潜在风险或技术考量]\n\n重要规则:\n- 执行步骤应该是大颗粒度的任务拆分,关注主要阶段和目标\n- 必须包含2-4个逻辑步骤,确保覆盖所有必要工作\n- 步骤之间必须有明确的依赖关系和顺序逻辑\n- 每个步骤必须标注最适合的推荐子智能体\n- 任务概述应该简明扼要地概括整个任务的目的和范围\n- 预期结果应该具体、可衡量,明确说明完成后的状态`}function c(e){return`请将以下 Markdown 格式的任务规划转换为结构化格式。\n\n${e}\n\n请使用 create_task_plan 工具返回结构化的任务规划数据。`}function m(e,t){return`你是一个智能体匹配专家。请仔细分析以下任务描述,并从提供的智能体列表中选择最匹配、最高效的一个。\n\n任务描述:\n${e}\n\n可用智能体:\n${t}\n\n匹配标准:\n1. 智能体的专业领域与任务需求的匹配度\n2. 智能体的能力范围是否涵盖任务所需的所有技能\n3. 智能体的专长是否能够解决任务中的核心挑战\n4. 考虑任务的复杂度和智能体的处理能力\n\n请只返回最佳匹配的智能体名称(完全匹配智能体名称字符串),如果没有合适的匹配或匹配度不足60%,请返回"default"。`}s()}catch(u){s(u)}})},1646:(e,t,a)=>{a.a(e,async(e,s)=>{try{a.d(t,{a$:()=>i.a$,jW:()=>i.jW,st:()=>n.s}),a(2508);var n=a(3596),i=a(1024),r=e([i]),o=r.then?(await r)():r;i=o[0],s()}catch(e){s(e)}})},1663:(e,t,a)=>{a.d(t,{X:()=>n});var s=a(9187);class n{config;connected=!1;tools=[];constructor(e){this.config={timeout:3e4,enabled:!0,...e}}isConnected(){return this.connected}getConfig(){return this.config}getCachedTools(){return this.tools}validateConfig(){if(!this.config.name)throw new Error("MCP server name is required");if(!this.config.transport)throw new Error("MCP transport type is required");switch(this.config.transport){case"http":case"sse":if(!this.config.url)throw new Error(`URL is required for ${this.config.transport} transport`);break;case"stdio":if(!this.config.command)throw new Error("Command is required for stdio transport");break;default:throw new Error(`Unsupported transport type: ${this.config.transport}`)}}logConnection(e){const t=`${this.config.name} (${this.config.transport})`;switch(e){case"connecting":(0,s.MD)(`Connecting to MCP server: ${t}`);break;case"connected":(0,s.fH)(`Connected to MCP server: ${t}`);break;case"disconnecting":(0,s.MD)(`Disconnecting from MCP server: ${t}`);break;case"disconnected":(0,s.MD)(`Disconnected from MCP server: ${t}`)}}logError(e,t){(0,s.vV)(`MCP Client Error [${this.config.name}] ${t}: ${e.message}`)}}},1831:(e,t,a)=>{a.d(t,{Z:()=>p});var s,n,i=a(9239),r=function(e,t,a,s,n){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(e,a):n?n.value=a:t.set(e,a),a},o=function(e,t,a,s){if("a"===a&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===a?s:"a"===a?s.call(e):s?s.value:t.get(e)};class p extends i.Y{constructor(e,t,a={}){if(super(e,a),s.set(this,void 0),n.set(this,0),arguments.length<2)throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`);r(this,s,String(t),"f");const i=void 0===a.lastModified?Date.now():Number(a.lastModified);Number.isNaN(i)||r(this,n,i,"f")}static[(s=new WeakMap,n=new WeakMap,Symbol.hasInstance)](e){return e instanceof i.Y&&"File"===e[Symbol.toStringTag]&&"string"==typeof e.name}get name(){return o(this,s,"f")}get lastModified(){return o(this,n,"f")}get webkitRelativePath(){return""}get[Symbol.toStringTag](){return"File"}}},1967:(e,t,a)=>{a.d(t,{Px:()=>i,oS:()=>s});class s{get name(){return this.getDefinition().name}get description(){return this.getDefinition().description}get inputSchema(){return this.getDefinition().input_schema}createToolResult(e,t=null,a=!0){return{__tool_result:!0,result:e,display:null!==t?t:e,shouldPrint:a}}formatError(e,t){return`Error: ${e} failed - ${t instanceof Error?t.message:String(t)}`}formatAction(e){return`${this.name}(${Object.entries(e).map(([e,t])=>{let a=t;return"string"==typeof t&&t.length>50&&(a=t.substring(0,50)+"..."),`${e}=${JSON.stringify(a)}`}).join(", ")})`}formatObservation(e){if(n(e)){const{display:t}=e;return Array.isArray(t)?t.join("\n"):String(t)}return Array.isArray(e)?e.join("\n"):String(e)}shouldPrintObservation(e){return!n(e)||e.shouldPrint}}function n(e){return e&&"object"==typeof e&&!0===e.__tool_result}function i(e){return n(e)?e.result:e}},2005:(e,t,a)=>{a.d(t,{Vi:()=>_});const s=function(e){if("object"!==(e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase())(e))return!1;const t=Object.getPrototypeOf(e);return null==t||(t.constructor&&t.constructor.toString())===Object.toString()},n=e=>String(e).replace(/\r|\n/g,(e,t,a)=>"\r"===e&&"\n"!==a[t+1]||"\n"===e&&"\r"!==a[t-1]?"\r\n":e),i=e=>String(e).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22"),r=e=>"function"==typeof e,o=e=>Boolean(e&&"object"==typeof e&&r(e.constructor)&&"File"===e[Symbol.toStringTag]&&r(e.stream)&&null!=e.name&&null!=e.size&&null!=e.lastModified);var p,d,l,c,m,u,h,f,g,y,v=function(e,t,a,s,n){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(e,a):n?n.value=a:t.set(e,a),a},w=function(e,t,a,s){if("a"===a&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===a?s:"a"===a?s.call(e):s?s.value:t.get(e)};const b={enableAdditionalHeaders:!1};class _{constructor(e,t,a){if(p.add(this),d.set(this,"\r\n"),l.set(this,void 0),c.set(this,void 0),m.set(this,"-".repeat(2)),u.set(this,new TextEncoder),h.set(this,void 0),f.set(this,void 0),g.set(this,void 0),n=e,!Boolean(n&&r(n.constructor)&&"FormData"===n[Symbol.toStringTag]&&r(n.append)&&r(n.getAll)&&r(n.entries)&&r(n[Symbol.iterator])))throw new TypeError("Expected first argument to be a FormData instance.");var n;let i;if(s(t)?a=t:i=t,i||(i=function(){let e=16,t="";for(;e--;)t+="abcdefghijklmnopqrstuvwxyz0123456789"[36*Math.random()|0];return t}()),"string"!=typeof i)throw new TypeError("Expected boundary argument to be a string.");if(a&&!s(a))throw new TypeError("Expected options argument to be an object.");v(this,f,e,"f"),v(this,g,{...b,...a},"f"),v(this,l,w(this,u,"f").encode(w(this,d,"f")),"f"),v(this,c,w(this,l,"f").byteLength,"f"),this.boundary=`form-data-boundary-${i}`,this.contentType=`multipart/form-data; boundary=${this.boundary}`,v(this,h,w(this,u,"f").encode(`${w(this,m,"f")}${this.boundary}${w(this,m,"f")}${w(this,d,"f").repeat(2)}`),"f"),this.contentLength=String(this.getContentLength()),this.headers=Object.freeze({"Content-Type":this.contentType,"Content-Length":this.contentLength}),Object.defineProperties(this,{boundary:{writable:!1,configurable:!1},contentType:{writable:!1,configurable:!1},contentLength:{writable:!1,configurable:!1},headers:{writable:!1,configurable:!1}})}getContentLength(){let e=0;for(const[t,a]of w(this,f,"f")){const s=o(a)?a:w(this,u,"f").encode(n(a));e+=w(this,p,"m",y).call(this,t,s).byteLength,e+=o(s)?s.size:s.byteLength,e+=w(this,c,"f")}return e+w(this,h,"f").byteLength}*values(){for(const[e,t]of w(this,f,"f").entries()){const a=o(t)?t:w(this,u,"f").encode(n(t));yield w(this,p,"m",y).call(this,e,a),yield a,yield w(this,l,"f")}yield w(this,h,"f")}async*encode(){for(const e of this.values())o(e)?yield*e.stream():yield e}[(d=new WeakMap,l=new WeakMap,c=new WeakMap,m=new WeakMap,u=new WeakMap,h=new WeakMap,f=new WeakMap,g=new WeakMap,p=new WeakSet,y=function(e,t){let a="";return a+=`${w(this,m,"f")}${this.boundary}${w(this,d,"f")}`,a+=`Content-Disposition: form-data; name="${i(e)}"`,o(t)&&(a+=`; filename="${i(t.name)}"${w(this,d,"f")}`,a+=`Content-Type: ${t.type||"application/octet-stream"}`),!0===w(this,g,"f").enableAdditionalHeaders&&(a+=`${w(this,d,"f")}Content-Length: ${o(t)?t.size:t.byteLength}`),w(this,u,"f").encode(`${a}${w(this,d,"f").repeat(2)}`)},Symbol.iterator)](){return this.values()}[Symbol.asyncIterator](){return this.encode()}}},2251:(e,t,a)=>{const s=a(3871).Agent,n=a(4593),{INIT_SOCKET:i,CREATE_HTTPS_CONNECTION:r}=a(8125);class o extends n{constructor(e){super(e),this.defaultPort=443,this.protocol="https:",this.maxCachedSessions=this.options.maxCachedSessions,void 0===this.maxCachedSessions&&(this.maxCachedSessions=100),this._sessionCache={map:{},list:[]}}createConnection(e,t){const a=this[r](e,t);return this[i](a,e),a}}o.prototype[r]=s.prototype.createConnection,["getName","_getSession","_cacheSession","_evictSession"].forEach(function(e){"function"==typeof s.prototype[e]&&(o.prototype[e]=s.prototype[e])}),e.exports=o},2472:e=>{e.exports=JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"],[[47,47],"disallowed_STD3_valid"],[[48,57],"valid"],[[58,64],"disallowed_STD3_valid"],[[65,65],"mapped",[97]],[[66,66],"mapped",[98]],[[67,67],"mapped",[99]],[[68,68],"mapped",[100]],[[69,69],"mapped",[101]],[[70,70],"mapped",[102]],[[71,71],"mapped",[103]],[[72,72],"mapped",[104]],[[73,73],"mapped",[105]],[[74,74],"mapped",[106]],[[75,75],"mapped",[107]],[[76,76],"mapped",[108]],[[77,77],"mapped",[109]],[[78,78],"mapped",[110]],[[79,79],"mapped",[111]],[[80,80],"mapped",[112]],[[81,81],"mapped",[113]],[[82,82],"mapped",[114]],[[83,83],"mapped",[115]],[[84,84],"mapped",[116]],[[85,85],"mapped",[117]],[[86,86],"mapped",[118]],[[87,87],"mapped",[119]],[[88,88],"mapped",[120]],[[89,89],"mapped",[121]],[[90,90],"mapped",[122]],[[91,96],"disallowed_STD3_valid"],[[97,122],"valid"],[[123,127],"disallowed_STD3_valid"],[[128,159],"disallowed"],[[160,160],"disallowed_STD3_mapped",[32]],[[161,167],"valid",[],"NV8"],[[168,168],"disallowed_STD3_mapped",[32,776]],[[169,169],"valid",[],"NV8"],[[170,170],"mapped",[97]],[[171,172],"valid",[],"NV8"],[[173,173],"ignored"],[[174,174],"valid",[],"NV8"],[[175,175],"disallowed_STD3_mapped",[32,772]],[[176,177],"valid",[],"NV8"],[[178,178],"mapped",[50]],[[179,179],"mapped",[51]],[[180,180],"disallowed_STD3_mapped",[32,769]],[[181,181],"mapped",[956]],[[182,182],"valid",[],"NV8"],[[183,183],"valid"],[[184,184],"disallowed_STD3_mapped",[32,807]],[[185,185],"mapped",[49]],[[186,186],"mapped",[111]],[[187,187],"valid",[],"NV8"],[[188,188],"mapped",[49,8260,52]],[[189,189],"mapped",[49,8260,50]],[[190,190],"mapped",[51,8260,52]],[[191,191],"valid",[],"NV8"],[[192,192],"mapped",[224]],[[193,193],"mapped",[225]],[[194,194],"mapped",[226]],[[195,195],"mapped",[227]],[[196,196],"mapped",[228]],[[197,197],"mapped",[229]],[[198,198],"mapped",[230]],[[199,199],"mapped",[231]],[[200,200],"mapped",[232]],[[201,201],"mapped",[233]],[[202,202],"mapped",[234]],[[203,203],"mapped",[235]],[[204,204],"mapped",[236]],[[205,205],"mapped",[237]],[[206,206],"mapped",[238]],[[207,207],"mapped",[239]],[[208,208],"mapped",[240]],[[209,209],"mapped",[241]],[[210,210],"mapped",[242]],[[211,211],"mapped",[243]],[[212,212],"mapped",[244]],[[213,213],"mapped",[245]],[[214,214],"mapped",[246]],[[215,215],"valid",[],"NV8"],[[216,216],"mapped",[248]],[[217,217],"mapped",[249]],[[218,218],"mapped",[250]],[[219,219],"mapped",[251]],[[220,220],"mapped",[252]],[[221,221],"mapped",[253]],[[222,222],"mapped",[254]],[[223,223],"deviation",[115,115]],[[224,246],"valid"],[[247,247],"valid",[],"NV8"],[[248,255],"valid"],[[256,256],"mapped",[257]],[[257,257],"valid"],[[258,258],"mapped",[259]],[[259,259],"valid"],[[260,260],"mapped",[261]],[[261,261],"valid"],[[262,262],"mapped",[263]],[[263,263],"valid"],[[264,264],"mapped",[265]],[[265,265],"valid"],[[266,266],"mapped",[267]],[[267,267],"valid"],[[268,268],"mapped",[269]],[[269,269],"valid"],[[270,270],"mapped",[271]],[[271,271],"valid"],[[272,272],"mapped",[273]],[[273,273],"valid"],[[274,274],"mapped",[275]],[[275,275],"valid"],[[276,276],"mapped",[277]],[[277,277],"valid"],[[278,278],"mapped",[279]],[[279,279],"valid"],[[280,280],"mapped",[281]],[[281,281],"valid"],[[282,282],"mapped",[283]],[[283,283],"valid"],[[284,284],"mapped",[285]],[[285,285],"valid"],[[286,286],"mapped",[287]],[[287,287],"valid"],[[288,288],"mapped",[289]],[[289,289],"valid"],[[290,290],"mapped",[291]],[[291,291],"valid"],[[292,292],"mapped",[293]],[[293,293],"valid"],[[294,294],"mapped",[295]],[[295,295],"valid"],[[296,296],"mapped",[297]],[[297,297],"valid"],[[298,298],"mapped",[299]],[[299,299],"valid"],[[300,300],"mapped",[301]],[[301,301],"valid"],[[302,302],"mapped",[303]],[[303,303],"valid"],[[304,304],"mapped",[105,775]],[[305,305],"valid"],[[306,307],"mapped",[105,106]],[[308,308],"mapped",[309]],[[309,309],"valid"],[[310,310],"mapped",[311]],[[311,312],"valid"],[[313,313],"mapped",[314]],[[314,314],"valid"],[[315,315],"mapped",[316]],[[316,316],"valid"],[[317,317],"mapped",[318]],[[318,318],"valid"],[[319,320],"mapped",[108,183]],[[321,321],"mapped",[322]],[[322,322],"valid"],[[323,323],"mapped",[324]],[[324,324],"valid"],[[325,325],"mapped",[326]],[[326,326],"valid"],[[327,327],"mapped",[328]],[[328,328],"valid"],[[329,329],"mapped",[700,110]],[[330,330],"mapped",[331]],[[331,331],"valid"],[[332,332],"mapped",[333]],[[333,333],"valid"],[[334,334],"mapped",[335]],[[335,335],"valid"],[[336,336],"mapped",[337]],[[337,337],"valid"],[[338,338],"mapped",[339]],[[339,339],"valid"],[[340,340],"mapped",[341]],[[341,341],"valid"],[[342,342],"mapped",[343]],[[343,343],"valid"],[[344,344],"mapped",[345]],[[345,345],"valid"],[[346,346],"mapped",[347]],[[347,347],"valid"],[[348,348],"mapped",[349]],[[349,349],"valid"],[[350,350],"mapped",[351]],[[351,351],"valid"],[[352,352],"mapped",[353]],[[353,353],"valid"],[[354,354],"mapped",[355]],[[355,355],"valid"],[[356,356],"mapped",[357]],[[357,357],"valid"],[[358,358],"mapped",[359]],[[359,359],"valid"],[[360,360],"mapped",[361]],[[361,361],"valid"],[[362,362],"mapped",[363]],[[363,363],"valid"],[[364,364],"mapped",[365]],[[365,365],"valid"],[[366,366],"mapped",[367]],[[367,367],"valid"],[[368,368],"mapped",[369]],[[369,369],"valid"],[[370,370],"mapped",[371]],[[371,371],"valid"],[[372,372],"mapped",[373]],[[373,373],"valid"],[[374,374],"mapped",[375]],[[375,375],"valid"],[[376,376],"mapped",[255]],[[377,377],"mapped",[378]],[[378,378],"valid"],[[379,379],"mapped",[380]],[[380,380],"valid"],[[381,381],"mapped",[382]],[[382,382],"valid"],[[383,383],"mapped",[115]],[[384,384],"valid"],[[385,385],"mapped",[595]],[[386,386],"mapped",[387]],[[387,387],"valid"],[[388,388],"mapped",[389]],[[389,389],"valid"],[[390,390],"mapped",[596]],[[391,391],"mapped",[392]],[[392,392],"valid"],[[393,393],"mapped",[598]],[[394,394],"mapped",[599]],[[395,395],"mapped",[396]],[[396,397],"valid"],[[398,398],"mapped",[477]],[[399,399],"mapped",[601]],[[400,400],"mapped",[603]],[[401,401],"mapped",[402]],[[402,402],"valid"],[[403,403],"mapped",[608]],[[404,404],"mapped",[611]],[[405,405],"valid"],[[406,406],"mapped",[617]],[[407,407],"mapped",[616]],[[408,408],"mapped",[409]],[[409,411],"valid"],[[412,412],"mapped",[623]],[[413,413],"mapped",[626]],[[414,414],"valid"],[[415,415],"mapped",[629]],[[416,416],"mapped",[417]],[[417,417],"valid"],[[418,418],"mapped",[419]],[[419,419],"valid"],[[420,420],"mapped",[421]],[[421,421],"valid"],[[422,422],"mapped",[640]],[[423,423],"mapped",[424]],[[424,424],"valid"],[[425,425],"mapped",[643]],[[426,427],"valid"],[[428,428],"mapped",[429]],[[429,429],"valid"],[[430,430],"mapped",[648]],[[431,431],"mapped",[432]],[[432,432],"valid"],[[433,433],"mapped",[650]],[[434,434],"mapped",[651]],[[435,435],"mapped",[436]],[[436,436],"valid"],[[437,437],"mapped",[438]],[[438,438],"valid"],[[439,439],"mapped",[658]],[[440,440],"mapped",[441]],[[441,443],"valid"],[[444,444],"mapped",[445]],[[445,451],"valid"],[[452,454],"mapped",[100,382]],[[455,457],"mapped",[108,106]],[[458,460],"mapped",[110,106]],[[461,461],"mapped",[462]],[[462,462],"valid"],[[463,463],"mapped",[464]],[[464,464],"valid"],[[465,465],"mapped",[466]],[[466,466],"valid"],[[467,467],"mapped",[468]],[[468,468],"valid"],[[469,469],"mapped",[470]],[[470,470],"valid"],[[471,471],"mapped",[472]],[[472,472],"valid"],[[473,473],"mapped",[474]],[[474,474],"valid"],[[475,475],"mapped",[476]],[[476,477],"valid"],[[478,478],"mapped",[479]],[[479,479],"valid"],[[480,480],"mapped",[481]],[[481,481],"valid"],[[482,482],"mapped",[483]],[[483,483],"valid"],[[484,484],"mapped",[485]],[[485,485],"valid"],[[486,486],"mapped",[487]],[[487,487],"valid"],[[488,488],"mapped",[489]],[[489,489],"valid"],[[490,490],"mapped",[491]],[[491,491],"valid"],[[492,492],"mapped",[493]],[[493,493],"valid"],[[494,494],"mapped",[495]],[[495,496],"valid"],[[497,499],"mapped",[100,122]],[[500,500],"mapped",[501]],[[501,501],"valid"],[[502,502],"mapped",[405]],[[503,503],"mapped",[447]],[[504,504],"mapped",[505]],[[505,505],"valid"],[[506,506],"mapped",[507]],[[507,507],"valid"],[[508,508],"mapped",[509]],[[509,509],"valid"],[[510,510],"mapped",[511]],[[511,511],"valid"],[[512,512],"mapped",[513]],[[513,513],"valid"],[[514,514],"mapped",[515]],[[515,515],"valid"],[[516,516],"mapped",[517]],[[517,517],"valid"],[[518,518],"mapped",[519]],[[519,519],"valid"],[[520,520],"mapped",[521]],[[521,521],"valid"],[[522,522],"mapped",[523]],[[523,523],"valid"],[[524,524],"mapped",[525]],[[525,525],"valid"],[[526,526],"mapped",[527]],[[527,527],"valid"],[[528,528],"mapped",[529]],[[529,529],"valid"],[[530,530],"mapped",[531]],[[531,531],"valid"],[[532,532],"mapped",[533]],[[533,533],"valid"],[[534,534],"mapped",[535]],[[535,535],"valid"],[[536,536],"mapped",[537]],[[537,537],"valid"],[[538,538],"mapped",[539]],[[539,539],"valid"],[[540,540],"mapped",[541]],[[541,541],"valid"],[[542,542],"mapped",[543]],[[543,543],"valid"],[[544,544],"mapped",[414]],[[545,545],"valid"],[[546,546],"mapped",[547]],[[547,547],"valid"],[[548,548],"mapped",[549]],[[549,549],"valid"],[[550,550],"mapped",[551]],[[551,551],"valid"],[[552,552],"mapped",[553]],[[553,553],"valid"],[[554,554],"mapped",[555]],[[555,555],"valid"],[[556,556],"mapped",[557]],[[557,557],"valid"],[[558,558],"mapped",[559]],[[559,559],"valid"],[[560,560],"mapped",[561]],[[561,561],"valid"],[[562,562],"mapped",[563]],[[563,563],"valid"],[[564,566],"valid"],[[567,569],"valid"],[[570,570],"mapped",[11365]],[[571,571],"mapped",[572]],[[572,572],"valid"],[[573,573],"mapped",[410]],[[574,574],"mapped",[11366]],[[575,576],"valid"],[[577,577],"mapped",[578]],[[578,578],"valid"],[[579,579],"mapped",[384]],[[580,580],"mapped",[649]],[[581,581],"mapped",[652]],[[582,582],"mapped",[583]],[[583,583],"valid"],[[584,584],"mapped",[585]],[[585,585],"valid"],[[586,586],"mapped",[587]],[[587,587],"valid"],[[588,588],"mapped",[589]],[[589,589],"valid"],[[590,590],"mapped",[591]],[[591,591],"valid"],[[592,680],"valid"],[[681,685],"valid"],[[686,687],"valid"],[[688,688],"mapped",[104]],[[689,689],"mapped",[614]],[[690,690],"mapped",[106]],[[691,691],"mapped",[114]],[[692,692],"mapped",[633]],[[693,693],"mapped",[635]],[[694,694],"mapped",[641]],[[695,695],"mapped",[119]],[[696,696],"mapped",[121]],[[697,705],"valid"],[[706,709],"valid",[],"NV8"],[[710,721],"valid"],[[722,727],"valid",[],"NV8"],[[728,728],"disallowed_STD3_mapped",[32,774]],[[729,729],"disallowed_STD3_mapped",[32,775]],[[730,730],"disallowed_STD3_mapped",[32,778]],[[731,731],"disallowed_STD3_mapped",[32,808]],[[732,732],"disallowed_STD3_mapped",[32,771]],[[733,733],"disallowed_STD3_mapped",[32,779]],[[734,734],"valid",[],"NV8"],[[735,735],"valid",[],"NV8"],[[736,736],"mapped",[611]],[[737,737],"mapped",[108]],[[738,738],"mapped",[115]],[[739,739],"mapped",[120]],[[740,740],"mapped",[661]],[[741,745],"valid",[],"NV8"],[[746,747],"valid",[],"NV8"],[[748,748],"valid"],[[749,749],"valid",[],"NV8"],[[750,750],"valid"],[[751,767],"valid",[],"NV8"],[[768,831],"valid"],[[832,832],"mapped",[768]],[[833,833],"mapped",[769]],[[834,834],"valid"],[[835,835],"mapped",[787]],[[836,836],"mapped",[776,769]],[[837,837],"mapped",[953]],[[838,846],"valid"],[[847,847],"ignored"],[[848,855],"valid"],[[856,860],"valid"],[[861,863],"valid"],[[864,865],"valid"],[[866,866],"valid"],[[867,879],"valid"],[[880,880],"mapped",[881]],[[881,881],"valid"],[[882,882],"mapped",[883]],[[883,883],"valid"],[[884,884],"mapped",[697]],[[885,885],"valid"],[[886,886],"mapped",[887]],[[887,887],"valid"],[[888,889],"disallowed"],[[890,890],"disallowed_STD3_mapped",[32,953]],[[891,893],"valid"],[[894,894],"disallowed_STD3_mapped",[59]],[[895,895],"mapped",[1011]],[[896,899],"disallowed"],[[900,900],"disallowed_STD3_mapped",[32,769]],[[901,901],"disallowed_STD3_mapped",[32,776,769]],[[902,902],"mapped",[940]],[[903,903],"mapped",[183]],[[904,904],"mapped",[941]],[[905,905],"mapped",[942]],[[906,906],"mapped",[943]],[[907,907],"disallowed"],[[908,908],"mapped",[972]],[[909,909],"disallowed"],[[910,910],"mapped",[973]],[[911,911],"mapped",[974]],[[912,912],"valid"],[[913,913],"mapped",[945]],[[914,914],"mapped",[946]],[[915,915],"mapped",[947]],[[916,916],"mapped",[948]],[[917,917],"mapped",[949]],[[918,918],"mapped",[950]],[[919,919],"mapped",[951]],[[920,920],"mapped",[952]],[[921,921],"mapped",[953]],[[922,922],"mapped",[954]],[[923,923],"mapped",[955]],[[924,924],"mapped",[956]],[[925,925],"mapped",[957]],[[926,926],"mapped",[958]],[[927,927],"mapped",[959]],[[928,928],"mapped",[960]],[[929,929],"mapped",[961]],[[930,930],"disallowed"],[[931,931],"mapped",[963]],[[932,932],"mapped",[964]],[[933,933],"mapped",[965]],[[934,934],"mapped",[966]],[[935,935],"mapped",[967]],[[936,936],"mapped",[968]],[[937,937],"mapped",[969]],[[938,938],"mapped",[970]],[[939,939],"mapped",[971]],[[940,961],"valid"],[[962,962],"deviation",[963]],[[963,974],"valid"],[[975,975],"mapped",[983]],[[976,976],"mapped",[946]],[[977,977],"mapped",[952]],[[978,978],"mapped",[965]],[[979,979],"mapped",[973]],[[980,980],"mapped",[971]],[[981,981],"mapped",[966]],[[982,982],"mapped",[960]],[[983,983],"valid"],[[984,984],"mapped",[985]],[[985,985],"valid"],[[986,986],"mapped",[987]],[[987,987],"valid"],[[988,988],"mapped",[989]],[[989,989],"valid"],[[990,990],"mapped",[991]],[[991,991],"valid"],[[992,992],"mapped",[993]],[[993,993],"valid"],[[994,994],"mapped",[995]],[[995,995],"valid"],[[996,996],"mapped",[997]],[[997,997],"valid"],[[998,998],"mapped",[999]],[[999,999],"valid"],[[1000,1000],"mapped",[1001]],[[1001,1001],"valid"],[[1002,1002],"mapped",[1003]],[[1003,1003],"valid"],[[1004,1004],"mapped",[1005]],[[1005,1005],"valid"],[[1006,1006],"mapped",[1007]],[[1007,1007],"valid"],[[1008,1008],"mapped",[954]],[[1009,1009],"mapped",[961]],[[1010,1010],"mapped",[963]],[[1011,1011],"valid"],[[1012,1012],"mapped",[952]],[[1013,1013],"mapped",[949]],[[1014,1014],"valid",[],"NV8"],[[1015,1015],"mapped",[1016]],[[1016,1016],"valid"],[[1017,1017],"mapped",[963]],[[1018,1018],"mapped",[1019]],[[1019,1019],"valid"],[[1020,1020],"valid"],[[1021,1021],"mapped",[891]],[[1022,1022],"mapped",[892]],[[1023,1023],"mapped",[893]],[[1024,1024],"mapped",[1104]],[[1025,1025],"mapped",[1105]],[[1026,1026],"mapped",[1106]],[[1027,1027],"mapped",[1107]],[[1028,1028],"mapped",[1108]],[[1029,1029],"mapped",[1109]],[[1030,1030],"mapped",[1110]],[[1031,1031],"mapped",[1111]],[[1032,1032],"mapped",[1112]],[[1033,1033],"mapped",[1113]],[[1034,1034],"mapped",[1114]],[[1035,1035],"mapped",[1115]],[[1036,1036],"mapped",[1116]],[[1037,1037],"mapped",[1117]],[[1038,1038],"mapped",[1118]],[[1039,1039],"mapped",[1119]],[[1040,1040],"mapped",[1072]],[[1041,1041],"mapped",[1073]],[[1042,1042],"mapped",[1074]],[[1043,1043],"mapped",[1075]],[[1044,1044],"mapped",[1076]],[[1045,1045],"mapped",[1077]],[[1046,1046],"mapped",[1078]],[[1047,1047],"mapped",[1079]],[[1048,1048],"mapped",[1080]],[[1049,1049],"mapped",[1081]],[[1050,1050],"mapped",[1082]],[[1051,1051],"mapped",[1083]],[[1052,1052],"mapped",[1084]],[[1053,1053],"mapped",[1085]],[[1054,1054],"mapped",[1086]],[[1055,1055],"mapped",[1087]],[[1056,1056],"mapped",[1088]],[[1057,1057],"mapped",[1089]],[[1058,1058],"mapped",[1090]],[[1059,1059],"mapped",[1091]],[[1060,1060],"mapped",[1092]],[[1061,1061],"mapped",[1093]],[[1062,1062],"mapped",[1094]],[[1063,1063],"mapped",[1095]],[[1064,1064],"mapped",[1096]],[[1065,1065],"mapped",[1097]],[[1066,1066],"mapped",[1098]],[[1067,1067],"mapped",[1099]],[[1068,1068],"mapped",[1100]],[[1069,1069],"mapped",[1101]],[[1070,1070],"mapped",[1102]],[[1071,1071],"mapped",[1103]],[[1072,1103],"valid"],[[1104,1104],"valid"],[[1105,1116],"valid"],[[1117,1117],"valid"],[[1118,1119],"valid"],[[1120,1120],"mapped",[1121]],[[1121,1121],"valid"],[[1122,1122],"mapped",[1123]],[[1123,1123],"valid"],[[1124,1124],"mapped",[1125]],[[1125,1125],"valid"],[[1126,1126],"mapped",[1127]],[[1127,1127],"valid"],[[1128,1128],"mapped",[1129]],[[1129,1129],"valid"],[[1130,1130],"mapped",[1131]],[[1131,1131],"valid"],[[1132,1132],"mapped",[1133]],[[1133,1133],"valid"],[[1134,1134],"mapped",[1135]],[[1135,1135],"valid"],[[1136,1136],"mapped",[1137]],[[1137,1137],"valid"],[[1138,1138],"mapped",[1139]],[[1139,1139],"valid"],[[1140,1140],"mapped",[1141]],[[1141,1141],"valid"],[[1142,1142],"mapped",[1143]],[[1143,1143],"valid"],[[1144,1144],"mapped",[1145]],[[1145,1145],"valid"],[[1146,1146],"mapped",[1147]],[[1147,1147],"valid"],[[1148,1148],"mapped",[1149]],[[1149,1149],"valid"],[[1150,1150],"mapped",[1151]],[[1151,1151],"valid"],[[1152,1152],"mapped",[1153]],[[1153,1153],"valid"],[[1154,1154],"valid",[],"NV8"],[[1155,1158],"valid"],[[1159,1159],"valid"],[[1160,1161],"valid",[],"NV8"],[[1162,1162],"mapped",[1163]],[[1163,1163],"valid"],[[1164,1164],"mapped",[1165]],[[1165,1165],"valid"],[[1166,1166],"mapped",[1167]],[[1167,1167],"valid"],[[1168,1168],"mapped",[1169]],[[1169,1169],"valid"],[[1170,1170],"mapped",[1171]],[[1171,1171],"valid"],[[1172,1172],"mapped",[1173]],[[1173,1173],"valid"],[[1174,1174],"mapped",[1175]],[[1175,1175],"valid"],[[1176,1176],"mapped",[1177]],[[1177,1177],"valid"],[[1178,1178],"mapped",[1179]],[[1179,1179],"valid"],[[1180,1180],"mapped",[1181]],[[1181,1181],"valid"],[[1182,1182],"mapped",[1183]],[[1183,1183],"valid"],[[1184,1184],"mapped",[1185]],[[1185,1185],"valid"],[[1186,1186],"mapped",[1187]],[[1187,1187],"valid"],[[1188,1188],"mapped",[1189]],[[1189,1189],"valid"],[[1190,1190],"mapped",[1191]],[[1191,1191],"valid"],[[1192,1192],"mapped",[1193]],[[1193,1193],"valid"],[[1194,1194],"mapped",[1195]],[[1195,1195],"valid"],[[1196,1196],"mapped",[1197]],[[1197,1197],"valid"],[[1198,1198],"mapped",[1199]],[[1199,1199],"valid"],[[1200,1200],"mapped",[1201]],[[1201,1201],"valid"],[[1202,1202],"mapped",[1203]],[[1203,1203],"valid"],[[1204,1204],"mapped",[1205]],[[1205,1205],"valid"],[[1206,1206],"mapped",[1207]],[[1207,1207],"valid"],[[1208,1208],"mapped",[1209]],[[1209,1209],"valid"],[[1210,1210],"mapped",[1211]],[[1211,1211],"valid"],[[1212,1212],"mapped",[1213]],[[1213,1213],"valid"],[[1214,1214],"mapped",[1215]],[[1215,1215],"valid"],[[1216,1216],"disallowed"],[[1217,1217],"mapped",[1218]],[[1218,1218],"valid"],[[1219,1219],"mapped",[1220]],[[1220,1220],"valid"],[[1221,1221],"mapped",[1222]],[[1222,1222],"valid"],[[1223,1223],"mapped",[1224]],[[1224,1224],"valid"],[[1225,1225],"mapped",[1226]],[[1226,1226],"valid"],[[1227,1227],"mapped",[1228]],[[1228,1228],"valid"],[[1229,1229],"mapped",[1230]],[[1230,1230],"valid"],[[1231,1231],"valid"],[[1232,1232],"mapped",[1233]],[[1233,1233],"valid"],[[1234,1234],"mapped",[1235]],[[1235,1235],"valid"],[[1236,1236],"mapped",[1237]],[[1237,1237],"valid"],[[1238,1238],"mapped",[1239]],[[1239,1239],"valid"],[[1240,1240],"mapped",[1241]],[[1241,1241],"valid"],[[1242,1242],"mapped",[1243]],[[1243,1243],"valid"],[[1244,1244],"mapped",[1245]],[[1245,1245],"valid"],[[1246,1246],"mapped",[1247]],[[1247,1247],"valid"],[[1248,1248],"mapped",[1249]],[[1249,1249],"valid"],[[1250,1250],"mapped",[1251]],[[1251,1251],"valid"],[[1252,1252],"mapped",[1253]],[[1253,1253],"valid"],[[1254,1254],"mapped",[1255]],[[1255,1255],"valid"],[[1256,1256],"mapped",[1257]],[[1257,1257],"valid"],[[1258,1258],"mapped",[1259]],[[1259,1259],"valid"],[[1260,1260],"mapped",[1261]],[[1261,1261],"valid"],[[1262,1262],"mapped",[1263]],[[1263,1263],"valid"],[[1264,1264],"mapped",[1265]],[[1265,1265],"valid"],[[1266,1266],"mapped",[1267]],[[1267,1267],"valid"],[[1268,1268],"mapped",[1269]],[[1269,1269],"valid"],[[1270,1270],"mapped",[1271]],[[1271,1271],"valid"],[[1272,1272],"mapped",[1273]],[[1273,1273],"valid"],[[1274,1274],"mapped",[1275]],[[1275,1275],"valid"],[[1276,1276],"mapped",[1277]],[[1277,1277],"valid"],[[1278,1278],"mapped",[1279]],[[1279,1279],"valid"],[[1280,1280],"mapped",[1281]],[[1281,1281],"valid"],[[1282,1282],"mapped",[1283]],[[1283,1283],"valid"],[[1284,1284],"mapped",[1285]],[[1285,1285],"valid"],[[1286,1286],"mapped",[1287]],[[1287,1287],"valid"],[[1288,1288],"mapped",[1289]],[[1289,1289],"valid"],[[1290,1290],"mapped",[1291]],[[1291,1291],"valid"],[[1292,1292],"mapped",[1293]],[[1293,1293],"valid"],[[1294,1294],"mapped",[1295]],[[1295,1295],"valid"],[[1296,1296],"mapped",[1297]],[[1297,1297],"valid"],[[1298,1298],"mapped",[1299]],[[1299,1299],"valid"],[[1300,1300],"mapped",[1301]],[[1301,1301],"valid"],[[1302,1302],"mapped",[1303]],[[1303,1303],"valid"],[[1304,1304],"mapped",[1305]],[[1305,1305],"valid"],[[1306,1306],"mapped",[1307]],[[1307,1307],"valid"],[[1308,1308],"mapped",[1309]],[[1309,1309],"valid"],[[1310,1310],"mapped",[1311]],[[1311,1311],"valid"],[[1312,1312],"mapped",[1313]],[[1313,1313],"valid"],[[1314,1314],"mapped",[1315]],[[1315,1315],"valid"],[[1316,1316],"mapped",[1317]],[[1317,1317],"valid"],[[1318,1318],"mapped",[1319]],[[1319,1319],"valid"],[[1320,1320],"mapped",[1321]],[[1321,1321],"valid"],[[1322,1322],"mapped",[1323]],[[1323,1323],"valid"],[[1324,1324],"mapped",[1325]],[[1325,1325],"valid"],[[1326,1326],"mapped",[1327]],[[1327,1327],"valid"],[[1328,1328],"disallowed"],[[1329,1329],"mapped",[1377]],[[1330,1330],"mapped",[1378]],[[1331,1331],"mapped",[1379]],[[1332,1332],"mapped",[1380]],[[1333,1333],"mapped",[1381]],[[1334,1334],"mapped",[1382]],[[1335,1335],"mapped",[1383]],[[1336,1336],"mapped",[1384]],[[1337,1337],"mapped",[1385]],[[1338,1338],"mapped",[1386]],[[1339,1339],"mapped",[1387]],[[1340,1340],"mapped",[1388]],[[1341,1341],"mapped",[1389]],[[1342,1342],"mapped",[1390]],[[1343,1343],"mapped",[1391]],[[1344,1344],"mapped",[1392]],[[1345,1345],"mapped",[1393]],[[1346,1346],"mapped",[1394]],[[1347,1347],"mapped",[1395]],[[1348,1348],"mapped",[1396]],[[1349,1349],"mapped",[1397]],[[1350,1350],"mapped",[1398]],[[1351,1351],"mapped",[1399]],[[1352,1352],"mapped",[1400]],[[1353,1353],"mapped",[1401]],[[1354,1354],"mapped",[1402]],[[1355,1355],"mapped",[1403]],[[1356,1356],"mapped",[1404]],[[1357,1357],"mapped",[1405]],[[1358,1358],"mapped",[1406]],[[1359,1359],"mapped",[1407]],[[1360,1360],"mapped",[1408]],[[1361,1361],"mapped",[1409]],[[1362,1362],"mapped",[1410]],[[1363,1363],"mapped",[1411]],[[1364,1364],"mapped",[1412]],[[1365,1365],"mapped",[1413]],[[1366,1366],"mapped",[1414]],[[1367,1368],"disallowed"],[[1369,1369],"valid"],[[1370,1375],"valid",[],"NV8"],[[1376,1376],"disallowed"],[[1377,1414],"valid"],[[1415,1415],"mapped",[1381,1410]],[[1416,1416],"disallowed"],[[1417,1417],"valid",[],"NV8"],[[1418,1418],"valid",[],"NV8"],[[1419,1420],"disallowed"],[[1421,1422],"valid",[],"NV8"],[[1423,1423],"valid",[],"NV8"],[[1424,1424],"disallowed"],[[1425,1441],"valid"],[[1442,1442],"valid"],[[1443,1455],"valid"],[[1456,1465],"valid"],[[1466,1466],"valid"],[[1467,1469],"valid"],[[1470,1470],"valid",[],"NV8"],[[1471,1471],"valid"],[[1472,1472],"valid",[],"NV8"],[[1473,1474],"valid"],[[1475,1475],"valid",[],"NV8"],[[1476,1476],"valid"],[[1477,1477],"valid"],[[1478,1478],"valid",[],"NV8"],[[1479,1479],"valid"],[[1480,1487],"disallowed"],[[1488,1514],"valid"],[[1515,1519],"disallowed"],[[1520,1524],"valid"],[[1525,1535],"disallowed"],[[1536,1539],"disallowed"],[[1540,1540],"disallowed"],[[1541,1541],"disallowed"],[[1542,1546],"valid",[],"NV8"],[[1547,1547],"valid",[],"NV8"],[[1548,1548],"valid",[],"NV8"],[[1549,1551],"valid",[],"NV8"],[[1552,1557],"valid"],[[1558,1562],"valid"],[[1563,1563],"valid",[],"NV8"],[[1564,1564],"disallowed"],[[1565,1565],"disallowed"],[[1566,1566],"valid",[],"NV8"],[[1567,1567],"valid",[],"NV8"],[[1568,1568],"valid"],[[1569,1594],"valid"],[[1595,1599],"valid"],[[1600,1600],"valid",[],"NV8"],[[1601,1618],"valid"],[[1619,1621],"valid"],[[1622,1624],"valid"],[[1625,1630],"valid"],[[1631,1631],"valid"],[[1632,1641],"valid"],[[1642,1645],"valid",[],"NV8"],[[1646,1647],"valid"],[[1648,1652],"valid"],[[1653,1653],"mapped",[1575,1652]],[[1654,1654],"mapped",[1608,1652]],[[1655,1655],"mapped",[1735,1652]],[[1656,1656],"mapped",[1610,1652]],[[1657,1719],"valid"],[[1720,1721],"valid"],[[1722,1726],"valid"],[[1727,1727],"valid"],[[1728,1742],"valid"],[[1743,1743],"valid"],[[1744,1747],"valid"],[[1748,1748],"valid",[],"NV8"],[[1749,1756],"valid"],[[1757,1757],"disallowed"],[[1758,1758],"valid",[],"NV8"],[[1759,1768],"valid"],[[1769,1769],"valid",[],"NV8"],[[1770,1773],"valid"],[[1774,1775],"valid"],[[1776,1785],"valid"],[[1786,1790],"valid"],[[1791,1791],"valid"],[[1792,1805],"valid",[],"NV8"],[[1806,1806],"disallowed"],[[1807,1807],"disallowed"],[[1808,1836],"valid"],[[1837,1839],"valid"],[[1840,1866],"valid"],[[1867,1868],"disallowed"],[[1869,1871],"valid"],[[1872,1901],"valid"],[[1902,1919],"valid"],[[1920,1968],"valid"],[[1969,1969],"valid"],[[1970,1983],"disallowed"],[[1984,2037],"valid"],[[2038,2042],"valid",[],"NV8"],[[2043,2047],"disallowed"],[[2048,2093],"valid"],[[2094,2095],"disallowed"],[[2096,2110],"valid",[],"NV8"],[[2111,2111],"disallowed"],[[2112,2139],"valid"],[[2140,2141],"disallowed"],[[2142,2142],"valid",[],"NV8"],[[2143,2207],"disallowed"],[[2208,2208],"valid"],[[2209,2209],"valid"],[[2210,2220],"valid"],[[2221,2226],"valid"],[[2227,2228],"valid"],[[2229,2274],"disallowed"],[[2275,2275],"valid"],[[2276,2302],"valid"],[[2303,2303],"valid"],[[2304,2304],"valid"],[[2305,2307],"valid"],[[2308,2308],"valid"],[[2309,2361],"valid"],[[2362,2363],"valid"],[[2364,2381],"valid"],[[2382,2382],"valid"],[[2383,2383],"valid"],[[2384,2388],"valid"],[[2389,2389],"valid"],[[2390,2391],"valid"],[[2392,2392],"mapped",[2325,2364]],[[2393,2393],"mapped",[2326,2364]],[[2394,2394],"mapped",[2327,2364]],[[2395,2395],"mapped",[2332,2364]],[[2396,2396],"mapped",[2337,2364]],[[2397,2397],"mapped",[2338,2364]],[[2398,2398],"mapped",[2347,2364]],[[2399,2399],"mapped",[2351,2364]],[[2400,2403],"valid"],[[2404,2405],"valid",[],"NV8"],[[2406,2415],"valid"],[[2416,2416],"valid",[],"NV8"],[[2417,2418],"valid"],[[2419,2423],"valid"],[[2424,2424],"valid"],[[2425,2426],"valid"],[[2427,2428],"valid"],[[2429,2429],"valid"],[[2430,2431],"valid"],[[2432,2432],"valid"],[[2433,2435],"valid"],[[2436,2436],"disallowed"],[[2437,2444],"valid"],[[2445,2446],"disallowed"],[[2447,2448],"valid"],[[2449,2450],"disallowed"],[[2451,2472],"valid"],[[2473,2473],"disallowed"],[[2474,2480],"valid"],[[2481,2481],"disallowed"],[[2482,2482],"valid"],[[2483,2485],"disallowed"],[[2486,2489],"valid"],[[2490,2491],"disallowed"],[[2492,2492],"valid"],[[2493,2493],"valid"],[[2494,2500],"valid"],[[2501,2502],"disallowed"],[[2503,2504],"valid"],[[2505,2506],"disallowed"],[[2507,2509],"valid"],[[2510,2510],"valid"],[[2511,2518],"disallowed"],[[2519,2519],"valid"],[[2520,2523],"disallowed"],[[2524,2524],"mapped",[2465,2492]],[[2525,2525],"mapped",[2466,2492]],[[2526,2526],"disallowed"],[[2527,2527],"mapped",[2479,2492]],[[2528,2531],"valid"],[[2532,2533],"disallowed"],[[2534,2545],"valid"],[[2546,2554],"valid",[],"NV8"],[[2555,2555],"valid",[],"NV8"],[[2556,2560],"disallowed"],[[2561,2561],"valid"],[[2562,2562],"valid"],[[2563,2563],"valid"],[[2564,2564],"disallowed"],[[2565,2570],"valid"],[[2571,2574],"disallowed"],[[2575,2576],"valid"],[[2577,2578],"disallowed"],[[2579,2600],"valid"],[[2601,2601],"disallowed"],[[2602,2608],"valid"],[[2609,2609],"disallowed"],[[2610,2610],"valid"],[[2611,2611],"mapped",[2610,2620]],[[2612,2612],"disallowed"],[[2613,2613],"valid"],[[2614,2614],"mapped",[2616,2620]],[[2615,2615],"disallowed"],[[2616,2617],"valid"],[[2618,2619],"disallowed"],[[2620,2620],"valid"],[[2621,2621],"disallowed"],[[2622,2626],"valid"],[[2627,2630],"disallowed"],[[2631,2632],"valid"],[[2633,2634],"disallowed"],[[2635,2637],"valid"],[[2638,2640],"disallowed"],[[2641,2641],"valid"],[[2642,2648],"disallowed"],[[2649,2649],"mapped",[2582,2620]],[[2650,2650],"mapped",[2583,2620]],[[2651,2651],"mapped",[2588,2620]],[[2652,2652],"valid"],[[2653,2653],"disallowed"],[[2654,2654],"mapped",[2603,2620]],[[2655,2661],"disallowed"],[[2662,2676],"valid"],[[2677,2677],"valid"],[[2678,2688],"disallowed"],[[2689,2691],"valid"],[[2692,2692],"disallowed"],[[2693,2699],"valid"],[[2700,2700],"valid"],[[2701,2701],"valid"],[[2702,2702],"disallowed"],[[2703,2705],"valid"],[[2706,2706],"disallowed"],[[2707,2728],"valid"],[[2729,2729],"disallowed"],[[2730,2736],"valid"],[[2737,2737],"disallowed"],[[2738,2739],"valid"],[[2740,2740],"disallowed"],[[2741,2745],"valid"],[[2746,2747],"disallowed"],[[2748,2757],"valid"],[[2758,2758],"disallowed"],[[2759,2761],"valid"],[[2762,2762],"disallowed"],[[2763,2765],"valid"],[[2766,2767],"disallowed"],[[2768,2768],"valid"],[[2769,2783],"disallowed"],[[2784,2784],"valid"],[[2785,2787],"valid"],[[2788,2789],"disallowed"],[[2790,2799],"valid"],[[2800,2800],"valid",[],"NV8"],[[2801,2801],"valid",[],"NV8"],[[2802,2808],"disallowed"],[[2809,2809],"valid"],[[2810,2816],"disallowed"],[[2817,2819],"valid"],[[2820,2820],"disallowed"],[[2821,2828],"valid"],[[2829,2830],"disallowed"],[[2831,2832],"valid"],[[2833,2834],"disallowed"],[[2835,2856],"valid"],[[2857,2857],"disallowed"],[[2858,2864],"valid"],[[2865,2865],"disallowed"],[[2866,2867],"valid"],[[2868,2868],"disallowed"],[[2869,2869],"valid"],[[2870,2873],"valid"],[[2874,2875],"disallowed"],[[2876,2883],"valid"],[[2884,2884],"valid"],[[2885,2886],"disallowed"],[[2887,2888],"valid"],[[2889,2890],"disallowed"],[[2891,2893],"valid"],[[2894,2901],"disallowed"],[[2902,2903],"valid"],[[2904,2907],"disallowed"],[[2908,2908],"mapped",[2849,2876]],[[2909,2909],"mapped",[2850,2876]],[[2910,2910],"disallowed"],[[2911,2913],"valid"],[[2914,2915],"valid"],[[2916,2917],"disallowed"],[[2918,2927],"valid"],[[2928,2928],"valid",[],"NV8"],[[2929,2929],"valid"],[[2930,2935],"valid",[],"NV8"],[[2936,2945],"disallowed"],[[2946,2947],"valid"],[[2948,2948],"disallowed"],[[2949,2954],"valid"],[[2955,2957],"disallowed"],[[2958,2960],"valid"],[[2961,2961],"disallowed"],[[2962,2965],"valid"],[[2966,2968],"disallowed"],[[2969,2970],"valid"],[[2971,2971],"disallowed"],[[2972,2972],"valid"],[[2973,2973],"disallowed"],[[2974,2975],"valid"],[[2976,2978],"disallowed"],[[2979,2980],"valid"],[[2981,2983],"disallowed"],[[2984,2986],"valid"],[[2987,2989],"disallowed"],[[2990,2997],"valid"],[[2998,2998],"valid"],[[2999,3001],"valid"],[[3002,3005],"disallowed"],[[3006,3010],"valid"],[[3011,3013],"disallowed"],[[3014,3016],"valid"],[[3017,3017],"disallowed"],[[3018,3021],"valid"],[[3022,3023],"disallowed"],[[3024,3024],"valid"],[[3025,3030],"disallowed"],[[3031,3031],"valid"],[[3032,3045],"disallowed"],[[3046,3046],"valid"],[[3047,3055],"valid"],[[3056,3058],"valid",[],"NV8"],[[3059,3066],"valid",[],"NV8"],[[3067,3071],"disallowed"],[[3072,3072],"valid"],[[3073,3075],"valid"],[[3076,3076],"disallowed"],[[3077,3084],"valid"],[[3085,3085],"disallowed"],[[3086,3088],"valid"],[[3089,3089],"disallowed"],[[3090,3112],"valid"],[[3113,3113],"disallowed"],[[3114,3123],"valid"],[[3124,3124],"valid"],[[3125,3129],"valid"],[[3130,3132],"disallowed"],[[3133,3133],"valid"],[[3134,3140],"valid"],[[3141,3141],"disallowed"],[[3142,3144],"valid"],[[3145,3145],"disallowed"],[[3146,3149],"valid"],[[3150,3156],"disallowed"],[[3157,3158],"valid"],[[3159,3159],"disallowed"],[[3160,3161],"valid"],[[3162,3162],"valid"],[[3163,3167],"disallowed"],[[3168,3169],"valid"],[[3170,3171],"valid"],[[3172,3173],"disallowed"],[[3174,3183],"valid"],[[3184,3191],"disallowed"],[[3192,3199],"valid",[],"NV8"],[[3200,3200],"disallowed"],[[3201,3201],"valid"],[[3202,3203],"valid"],[[3204,3204],"disallowed"],[[3205,3212],"valid"],[[3213,3213],"disallowed"],[[3214,3216],"valid"],[[3217,3217],"disallowed"],[[3218,3240],"valid"],[[3241,3241],"disallowed"],[[3242,3251],"valid"],[[3252,3252],"disallowed"],[[3253,3257],"valid"],[[3258,3259],"disallowed"],[[3260,3261],"valid"],[[3262,3268],"valid"],[[3269,3269],"disallowed"],[[3270,3272],"valid"],[[3273,3273],"disallowed"],[[3274,3277],"valid"],[[3278,3284],"disallowed"],[[3285,3286],"valid"],[[3287,3293],"disallowed"],[[3294,3294],"valid"],[[3295,3295],"disallowed"],[[3296,3297],"valid"],[[3298,3299],"valid"],[[3300,3301],"disallowed"],[[3302,3311],"valid"],[[3312,3312],"disallowed"],[[3313,3314],"valid"],[[3315,3328],"disallowed"],[[3329,3329],"valid"],[[3330,3331],"valid"],[[3332,3332],"disallowed"],[[3333,3340],"valid"],[[3341,3341],"disallowed"],[[3342,3344],"valid"],[[3345,3345],"disallowed"],[[3346,3368],"valid"],[[3369,3369],"valid"],[[3370,3385],"valid"],[[3386,3386],"valid"],[[3387,3388],"disallowed"],[[3389,3389],"valid"],[[3390,3395],"valid"],[[3396,3396],"valid"],[[3397,3397],"disallowed"],[[3398,3400],"valid"],[[3401,3401],"disallowed"],[[3402,3405],"valid"],[[3406,3406],"valid"],[[3407,3414],"disallowed"],[[3415,3415],"valid"],[[3416,3422],"disallowed"],[[3423,3423],"valid"],[[3424,3425],"valid"],[[3426,3427],"valid"],[[3428,3429],"disallowed"],[[3430,3439],"valid"],[[3440,3445],"valid",[],"NV8"],[[3446,3448],"disallowed"],[[3449,3449],"valid",[],"NV8"],[[3450,3455],"valid"],[[3456,3457],"disallowed"],[[3458,3459],"valid"],[[3460,3460],"disallowed"],[[3461,3478],"valid"],[[3479,3481],"disallowed"],[[3482,3505],"valid"],[[3506,3506],"disallowed"],[[3507,3515],"valid"],[[3516,3516],"disallowed"],[[3517,3517],"valid"],[[3518,3519],"disallowed"],[[3520,3526],"valid"],[[3527,3529],"disallowed"],[[3530,3530],"valid"],[[3531,3534],"disallowed"],[[3535,3540],"valid"],[[3541,3541],"disallowed"],[[3542,3542],"valid"],[[3543,3543],"disallowed"],[[3544,3551],"valid"],[[3552,3557],"disallowed"],[[3558,3567],"valid"],[[3568,3569],"disallowed"],[[3570,3571],"valid"],[[3572,3572],"valid",[],"NV8"],[[3573,3584],"disallowed"],[[3585,3634],"valid"],[[3635,3635],"mapped",[3661,3634]],[[3636,3642],"valid"],[[3643,3646],"disallowed"],[[3647,3647],"valid",[],"NV8"],[[3648,3662],"valid"],[[3663,3663],"valid",[],"NV8"],[[3664,3673],"valid"],[[3674,3675],"valid",[],"NV8"],[[3676,3712],"disallowed"],[[3713,3714],"valid"],[[3715,3715],"disallowed"],[[3716,3716],"valid"],[[3717,3718],"disallowed"],[[3719,3720],"valid"],[[3721,3721],"disallowed"],[[3722,3722],"valid"],[[3723,3724],"disallowed"],[[3725,3725],"valid"],[[3726,3731],"disallowed"],[[3732,3735],"valid"],[[3736,3736],"disallowed"],[[3737,3743],"valid"],[[3744,3744],"disallowed"],[[3745,3747],"valid"],[[3748,3748],"disallowed"],[[3749,3749],"valid"],[[3750,3750],"disallowed"],[[3751,3751],"valid"],[[3752,3753],"disallowed"],[[3754,3755],"valid"],[[3756,3756],"disallowed"],[[3757,3762],"valid"],[[3763,3763],"mapped",[3789,3762]],[[3764,3769],"valid"],[[3770,3770],"disallowed"],[[3771,3773],"valid"],[[3774,3775],"disallowed"],[[3776,3780],"valid"],[[3781,3781],"disallowed"],[[3782,3782],"valid"],[[3783,3783],"disallowed"],[[3784,3789],"valid"],[[3790,3791],"disallowed"],[[3792,3801],"valid"],[[3802,3803],"disallowed"],[[3804,3804],"mapped",[3755,3737]],[[3805,3805],"mapped",[3755,3745]],[[3806,3807],"valid"],[[3808,3839],"disallowed"],[[3840,3840],"valid"],[[3841,3850],"valid",[],"NV8"],[[3851,3851],"valid"],[[3852,3852],"mapped",[3851]],[[3853,3863],"valid",[],"NV8"],[[3864,3865],"valid"],[[3866,3871],"valid",[],"NV8"],[[3872,3881],"valid"],[[3882,3892],"valid",[],"NV8"],[[3893,3893],"valid"],[[3894,3894],"valid",[],"NV8"],[[3895,3895],"valid"],[[3896,3896],"valid",[],"NV8"],[[3897,3897],"valid"],[[3898,3901],"valid",[],"NV8"],[[3902,3906],"valid"],[[3907,3907],"mapped",[3906,4023]],[[3908,3911],"valid"],[[3912,3912],"disallowed"],[[3913,3916],"valid"],[[3917,3917],"mapped",[3916,4023]],[[3918,3921],"valid"],[[3922,3922],"mapped",[3921,4023]],[[3923,3926],"valid"],[[3927,3927],"mapped",[3926,4023]],[[3928,3931],"valid"],[[3932,3932],"mapped",[3931,4023]],[[3933,3944],"valid"],[[3945,3945],"mapped",[3904,4021]],[[3946,3946],"valid"],[[3947,3948],"valid"],[[3949,3952],"disallowed"],[[3953,3954],"valid"],[[3955,3955],"mapped",[3953,3954]],[[3956,3956],"valid"],[[3957,3957],"mapped",[3953,3956]],[[3958,3958],"mapped",[4018,3968]],[[3959,3959],"mapped",[4018,3953,3968]],[[3960,3960],"mapped",[4019,3968]],[[3961,3961],"mapped",[4019,3953,3968]],[[3962,3968],"valid"],[[3969,3969],"mapped",[3953,3968]],[[3970,3972],"valid"],[[3973,3973],"valid",[],"NV8"],[[3974,3979],"valid"],[[3980,3983],"valid"],[[3984,3986],"valid"],[[3987,3987],"mapped",[3986,4023]],[[3988,3989],"valid"],[[3990,3990],"valid"],[[3991,3991],"valid"],[[3992,3992],"disallowed"],[[3993,3996],"valid"],[[3997,3997],"mapped",[3996,4023]],[[3998,4001],"valid"],[[4002,4002],"mapped",[4001,4023]],[[4003,4006],"valid"],[[4007,4007],"mapped",[4006,4023]],[[4008,4011],"valid"],[[4012,4012],"mapped",[4011,4023]],[[4013,4013],"valid"],[[4014,4016],"valid"],[[4017,4023],"valid"],[[4024,4024],"valid"],[[4025,4025],"mapped",[3984,4021]],[[4026,4028],"valid"],[[4029,4029],"disallowed"],[[4030,4037],"valid",[],"NV8"],[[4038,4038],"valid"],[[4039,4044],"valid",[],"NV8"],[[4045,4045],"disallowed"],[[4046,4046],"valid",[],"NV8"],[[4047,4047],"valid",[],"NV8"],[[4048,4049],"valid",[],"NV8"],[[4050,4052],"valid",[],"NV8"],[[4053,4056],"valid",[],"NV8"],[[4057,4058],"valid",[],"NV8"],[[4059,4095],"disallowed"],[[4096,4129],"valid"],[[4130,4130],"valid"],[[4131,4135],"valid"],[[4136,4136],"valid"],[[4137,4138],"valid"],[[4139,4139],"valid"],[[4140,4146],"valid"],[[4147,4149],"valid"],[[4150,4153],"valid"],[[4154,4159],"valid"],[[4160,4169],"valid"],[[4170,4175],"valid",[],"NV8"],[[4176,4185],"valid"],[[4186,4249],"valid"],[[4250,4253],"valid"],[[4254,4255],"valid",[],"NV8"],[[4256,4293],"disallowed"],[[4294,4294],"disallowed"],[[4295,4295],"mapped",[11559]],[[4296,4300],"disallowed"],[[4301,4301],"mapped",[11565]],[[4302,4303],"disallowed"],[[4304,4342],"valid"],[[4343,4344],"valid"],[[4345,4346],"valid"],[[4347,4347],"valid",[],"NV8"],[[4348,4348],"mapped",[4316]],[[4349,4351],"valid"],[[4352,4441],"valid",[],"NV8"],[[4442,4446],"valid",[],"NV8"],[[4447,4448],"disallowed"],[[4449,4514],"valid",[],"NV8"],[[4515,4519],"valid",[],"NV8"],[[4520,4601],"valid",[],"NV8"],[[4602,4607],"valid",[],"NV8"],[[4608,4614],"valid"],[[4615,4615],"valid"],[[4616,4678],"valid"],[[4679,4679],"valid"],[[4680,4680],"valid"],[[4681,4681],"disallowed"],[[4682,4685],"valid"],[[4686,4687],"disallowed"],[[4688,4694],"valid"],[[4695,4695],"disallowed"],[[4696,4696],"valid"],[[4697,4697],"disallowed"],[[4698,4701],"valid"],[[4702,4703],"disallowed"],[[4704,4742],"valid"],[[4743,4743],"valid"],[[4744,4744],"valid"],[[4745,4745],"disallowed"],[[4746,4749],"valid"],[[4750,4751],"disallowed"],[[4752,4782],"valid"],[[4783,4783],"valid"],[[4784,4784],"valid"],[[4785,4785],"disallowed"],[[4786,4789],"valid"],[[4790,4791],"disallowed"],[[4792,4798],"valid"],[[4799,4799],"disallowed"],[[4800,4800],"valid"],[[4801,4801],"disallowed"],[[4802,4805],"valid"],[[4806,4807],"disallowed"],[[4808,4814],"valid"],[[4815,4815],"valid"],[[4816,4822],"valid"],[[4823,4823],"disallowed"],[[4824,4846],"valid"],[[4847,4847],"valid"],[[4848,4878],"valid"],[[4879,4879],"valid"],[[4880,4880],"valid"],[[4881,4881],"disallowed"],[[4882,4885],"valid"],[[4886,4887],"disallowed"],[[4888,4894],"valid"],[[4895,4895],"valid"],[[4896,4934],"valid"],[[4935,4935],"valid"],[[4936,4954],"valid"],[[4955,4956],"disallowed"],[[4957,4958],"valid"],[[4959,4959],"valid"],[[4960,4960],"valid",[],"NV8"],[[4961,4988],"valid",[],"NV8"],[[4989,4991],"disallowed"],[[4992,5007],"valid"],[[5008,5017],"valid",[],"NV8"],[[5018,5023],"disallowed"],[[5024,5108],"valid"],[[5109,5109],"valid"],[[5110,5111],"disallowed"],[[5112,5112],"mapped",[5104]],[[5113,5113],"mapped",[5105]],[[5114,5114],"mapped",[5106]],[[5115,5115],"mapped",[5107]],[[5116,5116],"mapped",[5108]],[[5117,5117],"mapped",[5109]],[[5118,5119],"disallowed"],[[5120,5120],"valid",[],"NV8"],[[5121,5740],"valid"],[[5741,5742],"valid",[],"NV8"],[[5743,5750],"valid"],[[5751,5759],"valid"],[[5760,5760],"disallowed"],[[5761,5786],"valid"],[[5787,5788],"valid",[],"NV8"],[[5789,5791],"disallowed"],[[5792,5866],"valid"],[[5867,5872],"valid",[],"NV8"],[[5873,5880],"valid"],[[5881,5887],"disallowed"],[[5888,5900],"valid"],[[5901,5901],"disallowed"],[[5902,5908],"valid"],[[5909,5919],"disallowed"],[[5920,5940],"valid"],[[5941,5942],"valid",[],"NV8"],[[5943,5951],"disallowed"],[[5952,5971],"valid"],[[5972,5983],"disallowed"],[[5984,5996],"valid"],[[5997,5997],"disallowed"],[[5998,6000],"valid"],[[6001,6001],"disallowed"],[[6002,6003],"valid"],[[6004,6015],"disallowed"],[[6016,6067],"valid"],[[6068,6069],"disallowed"],[[6070,6099],"valid"],[[6100,6102],"valid",[],"NV8"],[[6103,6103],"valid"],[[6104,6107],"valid",[],"NV8"],[[6108,6108],"valid"],[[6109,6109],"valid"],[[6110,6111],"disallowed"],[[6112,6121],"valid"],[[6122,6127],"disallowed"],[[6128,6137],"valid",[],"NV8"],[[6138,6143],"disallowed"],[[6144,6149],"valid",[],"NV8"],[[6150,6150],"disallowed"],[[6151,6154],"valid",[],"NV8"],[[6155,6157],"ignored"],[[6158,6158],"disallowed"],[[6159,6159],"disallowed"],[[6160,6169],"valid"],[[6170,6175],"disallowed"],[[6176,6263],"valid"],[[6264,6271],"disallowed"],[[6272,6313],"valid"],[[6314,6314],"valid"],[[6315,6319],"disallowed"],[[6320,6389],"valid"],[[6390,6399],"disallowed"],[[6400,6428],"valid"],[[6429,6430],"valid"],[[6431,6431],"disallowed"],[[6432,6443],"valid"],[[6444,6447],"disallowed"],[[6448,6459],"valid"],[[6460,6463],"disallowed"],[[6464,6464],"valid",[],"NV8"],[[6465,6467],"disallowed"],[[6468,6469],"valid",[],"NV8"],[[6470,6509],"valid"],[[6510,6511],"disallowed"],[[6512,6516],"valid"],[[6517,6527],"disallowed"],[[6528,6569],"valid"],[[6570,6571],"valid"],[[6572,6575],"disallowed"],[[6576,6601],"valid"],[[6602,6607],"disallowed"],[[6608,6617],"valid"],[[6618,6618],"valid",[],"XV8"],[[6619,6621],"disallowed"],[[6622,6623],"valid",[],"NV8"],[[6624,6655],"valid",[],"NV8"],[[6656,6683],"valid"],[[6684,6685],"disallowed"],[[6686,6687],"valid",[],"NV8"],[[6688,6750],"valid"],[[6751,6751],"disallowed"],[[6752,6780],"valid"],[[6781,6782],"disallowed"],[[6783,6793],"valid"],[[6794,6799],"disallowed"],[[6800,6809],"valid"],[[6810,6815],"disallowed"],[[6816,6822],"valid",[],"NV8"],[[6823,6823],"valid"],[[6824,6829],"valid",[],"NV8"],[[6830,6831],"disallowed"],[[6832,6845],"valid"],[[6846,6846],"valid",[],"NV8"],[[6847,6911],"disallowed"],[[6912,6987],"valid"],[[6988,6991],"disallowed"],[[6992,7001],"valid"],[[7002,7018],"valid",[],"NV8"],[[7019,7027],"valid"],[[7028,7036],"valid",[],"NV8"],[[7037,7039],"disallowed"],[[7040,7082],"valid"],[[7083,7085],"valid"],[[7086,7097],"valid"],[[7098,7103],"valid"],[[7104,7155],"valid"],[[7156,7163],"disallowed"],[[7164,7167],"valid",[],"NV8"],[[7168,7223],"valid"],[[7224,7226],"disallowed"],[[7227,7231],"valid",[],"NV8"],[[7232,7241],"valid"],[[7242,7244],"disallowed"],[[7245,7293],"valid"],[[7294,7295],"valid",[],"NV8"],[[7296,7359],"disallowed"],[[7360,7367],"valid",[],"NV8"],[[7368,7375],"disallowed"],[[7376,7378],"valid"],[[7379,7379],"valid",[],"NV8"],[[7380,7410],"valid"],[[7411,7414],"valid"],[[7415,7415],"disallowed"],[[7416,7417],"valid"],[[7418,7423],"disallowed"],[[7424,7467],"valid"],[[7468,7468],"mapped",[97]],[[7469,7469],"mapped",[230]],[[7470,7470],"mapped",[98]],[[7471,7471],"valid"],[[7472,7472],"mapped",[100]],[[7473,7473],"mapped",[101]],[[7474,7474],"mapped",[477]],[[7475,7475],"mapped",[103]],[[7476,7476],"mapped",[104]],[[7477,7477],"mapped",[105]],[[7478,7478],"mapped",[106]],[[7479,7479],"mapped",[107]],[[7480,7480],"mapped",[108]],[[7481,7481],"mapped",[109]],[[7482,7482],"mapped",[110]],[[7483,7483],"valid"],[[7484,7484],"mapped",[111]],[[7485,7485],"mapped",[547]],[[7486,7486],"mapped",[112]],[[7487,7487],"mapped",[114]],[[7488,7488],"mapped",[116]],[[7489,7489],"mapped",[117]],[[7490,7490],"mapped",[119]],[[7491,7491],"mapped",[97]],[[7492,7492],"mapped",[592]],[[7493,7493],"mapped",[593]],[[7494,7494],"mapped",[7426]],[[7495,7495],"mapped",[98]],[[7496,7496],"mapped",[100]],[[7497,7497],"mapped",[101]],[[7498,7498],"mapped",[601]],[[7499,7499],"mapped",[603]],[[7500,7500],"mapped",[604]],[[7501,7501],"mapped",[103]],[[7502,7502],"valid"],[[7503,7503],"mapped",[107]],[[7504,7504],"mapped",[109]],[[7505,7505],"mapped",[331]],[[7506,7506],"mapped",[111]],[[7507,7507],"mapped",[596]],[[7508,7508],"mapped",[7446]],[[7509,7509],"mapped",[7447]],[[7510,7510],"mapped",[112]],[[7511,7511],"mapped",[116]],[[7512,7512],"mapped",[117]],[[7513,7513],"mapped",[7453]],[[7514,7514],"mapped",[623]],[[7515,7515],"mapped",[118]],[[7516,7516],"mapped",[7461]],[[7517,7517],"mapped",[946]],[[7518,7518],"mapped",[947]],[[7519,7519],"mapped",[948]],[[7520,7520],"mapped",[966]],[[7521,7521],"mapped",[967]],[[7522,7522],"mapped",[105]],[[7523,7523],"mapped",[114]],[[7524,7524],"mapped",[117]],[[7525,7525],"mapped",[118]],[[7526,7526],"mapped",[946]],[[7527,7527],"mapped",[947]],[[7528,7528],"mapped",[961]],[[7529,7529],"mapped",[966]],[[7530,7530],"mapped",[967]],[[7531,7531],"valid"],[[7532,7543],"valid"],[[7544,7544],"mapped",[1085]],[[7545,7578],"valid"],[[7579,7579],"mapped",[594]],[[7580,7580],"mapped",[99]],[[7581,7581],"mapped",[597]],[[7582,7582],"mapped",[240]],[[7583,7583],"mapped",[604]],[[7584,7584],"mapped",[102]],[[7585,7585],"mapped",[607]],[[7586,7586],"mapped",[609]],[[7587,7587],"mapped",[613]],[[7588,7588],"mapped",[616]],[[7589,7589],"mapped",[617]],[[7590,7590],"mapped",[618]],[[7591,7591],"mapped",[7547]],[[7592,7592],"mapped",[669]],[[7593,7593],"mapped",[621]],[[7594,7594],"mapped",[7557]],[[7595,7595],"mapped",[671]],[[7596,7596],"mapped",[625]],[[7597,7597],"mapped",[624]],[[7598,7598],"mapped",[626]],[[7599,7599],"mapped",[627]],[[7600,7600],"mapped",[628]],[[7601,7601],"mapped",[629]],[[7602,7602],"mapped",[632]],[[7603,7603],"mapped",[642]],[[7604,7604],"mapped",[643]],[[7605,7605],"mapped",[427]],[[7606,7606],"mapped",[649]],[[7607,7607],"mapped",[650]],[[7608,7608],"mapped",[7452]],[[7609,7609],"mapped",[651]],[[7610,7610],"mapped",[652]],[[7611,7611],"mapped",[122]],[[7612,7612],"mapped",[656]],[[7613,7613],"mapped",[657]],[[7614,7614],"mapped",[658]],[[7615,7615],"mapped",[952]],[[7616,7619],"valid"],[[7620,7626],"valid"],[[7627,7654],"valid"],[[7655,7669],"valid"],[[7670,7675],"disallowed"],[[7676,7676],"valid"],[[7677,7677],"valid"],[[7678,7679],"valid"],[[7680,7680],"mapped",[7681]],[[7681,7681],"valid"],[[7682,7682],"mapped",[7683]],[[7683,7683],"valid"],[[7684,7684],"mapped",[7685]],[[7685,7685],"valid"],[[7686,7686],"mapped",[7687]],[[7687,7687],"valid"],[[7688,7688],"mapped",[7689]],[[7689,7689],"valid"],[[7690,7690],"mapped",[7691]],[[7691,7691],"valid"],[[7692,7692],"mapped",[7693]],[[7693,7693],"valid"],[[7694,7694],"mapped",[7695]],[[7695,7695],"valid"],[[7696,7696],"mapped",[7697]],[[7697,7697],"valid"],[[7698,7698],"mapped",[7699]],[[7699,7699],"valid"],[[7700,7700],"mapped",[7701]],[[7701,7701],"valid"],[[7702,7702],"mapped",[7703]],[[7703,7703],"valid"],[[7704,7704],"mapped",[7705]],[[7705,7705],"valid"],[[7706,7706],"mapped",[7707]],[[7707,7707],"valid"],[[7708,7708],"mapped",[7709]],[[7709,7709],"valid"],[[7710,7710],"mapped",[7711]],[[7711,7711],"valid"],[[7712,7712],"mapped",[7713]],[[7713,7713],"valid"],[[7714,7714],"mapped",[7715]],[[7715,7715],"valid"],[[7716,7716],"mapped",[7717]],[[7717,7717],"valid"],[[7718,7718],"mapped",[7719]],[[7719,7719],"valid"],[[7720,7720],"mapped",[7721]],[[7721,7721],"valid"],[[7722,7722],"mapped",[7723]],[[7723,7723],"valid"],[[7724,7724],"mapped",[7725]],[[7725,7725],"valid"],[[7726,7726],"mapped",[7727]],[[7727,7727],"valid"],[[7728,7728],"mapped",[7729]],[[7729,7729],"valid"],[[7730,7730],"mapped",[7731]],[[7731,7731],"valid"],[[7732,7732],"mapped",[7733]],[[7733,7733],"valid"],[[7734,7734],"mapped",[7735]],[[7735,7735],"valid"],[[7736,7736],"mapped",[7737]],[[7737,7737],"valid"],[[7738,7738],"mapped",[7739]],[[7739,7739],"valid"],[[7740,7740],"mapped",[7741]],[[7741,7741],"valid"],[[7742,7742],"mapped",[7743]],[[7743,7743],"valid"],[[7744,7744],"mapped",[7745]],[[7745,7745],"valid"],[[7746,7746],"mapped",[7747]],[[7747,7747],"valid"],[[7748,7748],"mapped",[7749]],[[7749,7749],"valid"],[[7750,7750],"mapped",[7751]],[[7751,7751],"valid"],[[7752,7752],"mapped",[7753]],[[7753,7753],"valid"],[[7754,7754],"mapped",[7755]],[[7755,7755],"valid"],[[7756,7756],"mapped",[7757]],[[7757,7757],"valid"],[[7758,7758],"mapped",[7759]],[[7759,7759],"valid"],[[7760,7760],"mapped",[7761]],[[7761,7761],"valid"],[[7762,7762],"mapped",[7763]],[[7763,7763],"valid"],[[7764,7764],"mapped",[7765]],[[7765,7765],"valid"],[[7766,7766],"mapped",[7767]],[[7767,7767],"valid"],[[7768,7768],"mapped",[7769]],[[7769,7769],"valid"],[[7770,7770],"mapped",[7771]],[[7771,7771],"valid"],[[7772,7772],"mapped",[7773]],[[7773,7773],"valid"],[[7774,7774],"mapped",[7775]],[[7775,7775],"valid"],[[7776,7776],"mapped",[7777]],[[7777,7777],"valid"],[[7778,7778],"mapped",[7779]],[[7779,7779],"valid"],[[7780,7780],"mapped",[7781]],[[7781,7781],"valid"],[[7782,7782],"mapped",[7783]],[[7783,7783],"valid"],[[7784,7784],"mapped",[7785]],[[7785,7785],"valid"],[[7786,7786],"mapped",[7787]],[[7787,7787],"valid"],[[7788,7788],"mapped",[7789]],[[7789,7789],"valid"],[[7790,7790],"mapped",[7791]],[[7791,7791],"valid"],[[7792,7792],"mapped",[7793]],[[7793,7793],"valid"],[[7794,7794],"mapped",[7795]],[[7795,7795],"valid"],[[7796,7796],"mapped",[7797]],[[7797,7797],"valid"],[[7798,7798],"mapped",[7799]],[[7799,7799],"valid"],[[7800,7800],"mapped",[7801]],[[7801,7801],"valid"],[[7802,7802],"mapped",[7803]],[[7803,7803],"valid"],[[7804,7804],"mapped",[7805]],[[7805,7805],"valid"],[[7806,7806],"mapped",[7807]],[[7807,7807],"valid"],[[7808,7808],"mapped",[7809]],[[7809,7809],"valid"],[[7810,7810],"mapped",[7811]],[[7811,7811],"valid"],[[7812,7812],"mapped",[7813]],[[7813,7813],"valid"],[[7814,7814],"mapped",[7815]],[[7815,7815],"valid"],[[7816,7816],"mapped",[7817]],[[7817,7817],"valid"],[[7818,7818],"mapped",[7819]],[[7819,7819],"valid"],[[7820,7820],"mapped",[7821]],[[7821,7821],"valid"],[[7822,7822],"mapped",[7823]],[[7823,7823],"valid"],[[7824,7824],"mapped",[7825]],[[7825,7825],"valid"],[[7826,7826],"mapped",[7827]],[[7827,7827],"valid"],[[7828,7828],"mapped",[7829]],[[7829,7833],"valid"],[[7834,7834],"mapped",[97,702]],[[7835,7835],"mapped",[7777]],[[7836,7837],"valid"],[[7838,7838],"mapped",[115,115]],[[7839,7839],"valid"],[[7840,7840],"mapped",[7841]],[[7841,7841],"valid"],[[7842,7842],"mapped",[7843]],[[7843,7843],"valid"],[[7844,7844],"mapped",[7845]],[[7845,7845],"valid"],[[7846,7846],"mapped",[7847]],[[7847,7847],"valid"],[[7848,7848],"mapped",[7849]],[[7849,7849],"valid"],[[7850,7850],"mapped",[7851]],[[7851,7851],"valid"],[[7852,7852],"mapped",[7853]],[[7853,7853],"valid"],[[7854,7854],"mapped",[7855]],[[7855,7855],"valid"],[[7856,7856],"mapped",[7857]],[[7857,7857],"valid"],[[7858,7858],"mapped",[7859]],[[7859,7859],"valid"],[[7860,7860],"mapped",[7861]],[[7861,7861],"valid"],[[7862,7862],"mapped",[7863]],[[7863,7863],"valid"],[[7864,7864],"mapped",[7865]],[[7865,7865],"valid"],[[7866,7866],"mapped",[7867]],[[7867,7867],"valid"],[[7868,7868],"mapped",[7869]],[[7869,7869],"valid"],[[7870,7870],"mapped",[7871]],[[7871,7871],"valid"],[[7872,7872],"mapped",[7873]],[[7873,7873],"valid"],[[7874,7874],"mapped",[7875]],[[7875,7875],"valid"],[[7876,7876],"mapped",[7877]],[[7877,7877],"valid"],[[7878,7878],"mapped",[7879]],[[7879,7879],"valid"],[[7880,7880],"mapped",[7881]],[[7881,7881],"valid"],[[7882,7882],"mapped",[7883]],[[7883,7883],"valid"],[[7884,7884],"mapped",[7885]],[[7885,7885],"valid"],[[7886,7886],"mapped",[7887]],[[7887,7887],"valid"],[[7888,7888],"mapped",[7889]],[[7889,7889],"valid"],[[7890,7890],"mapped",[7891]],[[7891,7891],"valid"],[[7892,7892],"mapped",[7893]],[[7893,7893],"valid"],[[7894,7894],"mapped",[7895]],[[7895,7895],"valid"],[[7896,7896],"mapped",[7897]],[[7897,7897],"valid"],[[7898,7898],"mapped",[7899]],[[7899,7899],"valid"],[[7900,7900],"mapped",[7901]],[[7901,7901],"valid"],[[7902,7902],"mapped",[7903]],[[7903,7903],"valid"],[[7904,7904],"mapped",[7905]],[[7905,7905],"valid"],[[7906,7906],"mapped",[7907]],[[7907,7907],"valid"],[[7908,7908],"mapped",[7909]],[[7909,7909],"valid"],[[7910,7910],"mapped",[7911]],[[7911,7911],"valid"],[[7912,7912],"mapped",[7913]],[[7913,7913],"valid"],[[7914,7914],"mapped",[7915]],[[7915,7915],"valid"],[[7916,7916],"mapped",[7917]],[[7917,7917],"valid"],[[7918,7918],"mapped",[7919]],[[7919,7919],"valid"],[[7920,7920],"mapped",[7921]],[[7921,7921],"valid"],[[7922,7922],"mapped",[7923]],[[7923,7923],"valid"],[[7924,7924],"mapped",[7925]],[[7925,7925],"valid"],[[7926,7926],"mapped",[7927]],[[7927,7927],"valid"],[[7928,7928],"mapped",[7929]],[[7929,7929],"valid"],[[7930,7930],"mapped",[7931]],[[7931,7931],"valid"],[[7932,7932],"mapped",[7933]],[[7933,7933],"valid"],[[7934,7934],"mapped",[7935]],[[7935,7935],"valid"],[[7936,7943],"valid"],[[7944,7944],"mapped",[7936]],[[7945,7945],"mapped",[7937]],[[7946,7946],"mapped",[7938]],[[7947,7947],"mapped",[7939]],[[7948,7948],"mapped",[7940]],[[7949,7949],"mapped",[7941]],[[7950,7950],"mapped",[7942]],[[7951,7951],"mapped",[7943]],[[7952,7957],"valid"],[[7958,7959],"disallowed"],[[7960,7960],"mapped",[7952]],[[7961,7961],"mapped",[7953]],[[7962,7962],"mapped",[7954]],[[7963,7963],"mapped",[7955]],[[7964,7964],"mapped",[7956]],[[7965,7965],"mapped",[7957]],[[7966,7967],"disallowed"],[[7968,7975],"valid"],[[7976,7976],"mapped",[7968]],[[7977,7977],"mapped",[7969]],[[7978,7978],"mapped",[7970]],[[7979,7979],"mapped",[7971]],[[7980,7980],"mapped",[7972]],[[7981,7981],"mapped",[7973]],[[7982,7982],"mapped",[7974]],[[7983,7983],"mapped",[7975]],[[7984,7991],"valid"],[[7992,7992],"mapped",[7984]],[[7993,7993],"mapped",[7985]],[[7994,7994],"mapped",[7986]],[[7995,7995],"mapped",[7987]],[[7996,7996],"mapped",[7988]],[[7997,7997],"mapped",[7989]],[[7998,7998],"mapped",[7990]],[[7999,7999],"mapped",[7991]],[[8000,8005],"valid"],[[8006,8007],"disallowed"],[[8008,8008],"mapped",[8000]],[[8009,8009],"mapped",[8001]],[[8010,8010],"mapped",[8002]],[[8011,8011],"mapped",[8003]],[[8012,8012],"mapped",[8004]],[[8013,8013],"mapped",[8005]],[[8014,8015],"disallowed"],[[8016,8023],"valid"],[[8024,8024],"disallowed"],[[8025,8025],"mapped",[8017]],[[8026,8026],"disallowed"],[[8027,8027],"mapped",[8019]],[[8028,8028],"disallowed"],[[8029,8029],"mapped",[8021]],[[8030,8030],"disallowed"],[[8031,8031],"mapped",[8023]],[[8032,8039],"valid"],[[8040,8040],"mapped",[8032]],[[8041,8041],"mapped",[8033]],[[8042,8042],"mapped",[8034]],[[8043,8043],"mapped",[8035]],[[8044,8044],"mapped",[8036]],[[8045,8045],"mapped",[8037]],[[8046,8046],"mapped",[8038]],[[8047,8047],"mapped",[8039]],[[8048,8048],"valid"],[[8049,8049],"mapped",[940]],[[8050,8050],"valid"],[[8051,8051],"mapped",[941]],[[8052,8052],"valid"],[[8053,8053],"mapped",[942]],[[8054,8054],"valid"],[[8055,8055],"mapped",[943]],[[8056,8056],"valid"],[[8057,8057],"mapped",[972]],[[8058,8058],"valid"],[[8059,8059],"mapped",[973]],[[8060,8060],"valid"],[[8061,8061],"mapped",[974]],[[8062,8063],"disallowed"],[[8064,8064],"mapped",[7936,953]],[[8065,8065],"mapped",[7937,953]],[[8066,8066],"mapped",[7938,953]],[[8067,8067],"mapped",[7939,953]],[[8068,8068],"mapped",[7940,953]],[[8069,8069],"mapped",[7941,953]],[[8070,8070],"mapped",[7942,953]],[[8071,8071],"mapped",[7943,953]],[[8072,8072],"mapped",[7936,953]],[[8073,8073],"mapped",[7937,953]],[[8074,8074],"mapped",[7938,953]],[[8075,8075],"mapped",[7939,953]],[[8076,8076],"mapped",[7940,953]],[[8077,8077],"mapped",[7941,953]],[[8078,8078],"mapped",[7942,953]],[[8079,8079],"mapped",[7943,953]],[[8080,8080],"mapped",[7968,953]],[[8081,8081],"mapped",[7969,953]],[[8082,8082],"mapped",[7970,953]],[[8083,8083],"mapped",[7971,953]],[[8084,8084],"mapped",[7972,953]],[[8085,8085],"mapped",[7973,953]],[[8086,8086],"mapped",[7974,953]],[[8087,8087],"mapped",[7975,953]],[[8088,8088],"mapped",[7968,953]],[[8089,8089],"mapped",[7969,953]],[[8090,8090],"mapped",[7970,953]],[[8091,8091],"mapped",[7971,953]],[[8092,8092],"mapped",[7972,953]],[[8093,8093],"mapped",[7973,953]],[[8094,8094],"mapped",[7974,953]],[[8095,8095],"mapped",[7975,953]],[[8096,8096],"mapped",[8032,953]],[[8097,8097],"mapped",[8033,953]],[[8098,8098],"mapped",[8034,953]],[[8099,8099],"mapped",[8035,953]],[[8100,8100],"mapped",[8036,953]],[[8101,8101],"mapped",[8037,953]],[[8102,8102],"mapped",[8038,953]],[[8103,8103],"mapped",[8039,953]],[[8104,8104],"mapped",[8032,953]],[[8105,8105],"mapped",[8033,953]],[[8106,8106],"mapped",[8034,953]],[[8107,8107],"mapped",[8035,953]],[[8108,8108],"mapped",[8036,953]],[[8109,8109],"mapped",[8037,953]],[[8110,8110],"mapped",[8038,953]],[[8111,8111],"mapped",[8039,953]],[[8112,8113],"valid"],[[8114,8114],"mapped",[8048,953]],[[8115,8115],"mapped",[945,953]],[[8116,8116],"mapped",[940,953]],[[8117,8117],"disallowed"],[[8118,8118],"valid"],[[8119,8119],"mapped",[8118,953]],[[8120,8120],"mapped",[8112]],[[8121,8121],"mapped",[8113]],[[8122,8122],"mapped",[8048]],[[8123,8123],"mapped",[940]],[[8124,8124],"mapped",[945,953]],[[8125,8125],"disallowed_STD3_mapped",[32,787]],[[8126,8126],"mapped",[953]],[[8127,8127],"disallowed_STD3_mapped",[32,787]],[[8128,8128],"disallowed_STD3_mapped",[32,834]],[[8129,8129],"disallowed_STD3_mapped",[32,776,834]],[[8130,8130],"mapped",[8052,953]],[[8131,8131],"mapped",[951,953]],[[8132,8132],"mapped",[942,953]],[[8133,8133],"disallowed"],[[8134,8134],"valid"],[[8135,8135],"mapped",[8134,953]],[[8136,8136],"mapped",[8050]],[[8137,8137],"mapped",[941]],[[8138,8138],"mapped",[8052]],[[8139,8139],"mapped",[942]],[[8140,8140],"mapped",[951,953]],[[8141,8141],"disallowed_STD3_mapped",[32,787,768]],[[8142,8142],"disallowed_STD3_mapped",[32,787,769]],[[8143,8143],"disallowed_STD3_mapped",[32,787,834]],[[8144,8146],"valid"],[[8147,8147],"mapped",[912]],[[8148,8149],"disallowed"],[[8150,8151],"valid"],[[8152,8152],"mapped",[8144]],[[8153,8153],"mapped",[8145]],[[8154,8154],"mapped",[8054]],[[8155,8155],"mapped",[943]],[[8156,8156],"disallowed"],[[8157,8157],"disallowed_STD3_mapped",[32,788,768]],[[8158,8158],"disallowed_STD3_mapped",[32,788,769]],[[8159,8159],"disallowed_STD3_mapped",[32,788,834]],[[8160,8162],"valid"],[[8163,8163],"mapped",[944]],[[8164,8167],"valid"],[[8168,8168],"mapped",[8160]],[[8169,8169],"mapped",[8161]],[[8170,8170],"mapped",[8058]],[[8171,8171],"mapped",[973]],[[8172,8172],"mapped",[8165]],[[8173,8173],"disallowed_STD3_mapped",[32,776,768]],[[8174,8174],"disallowed_STD3_mapped",[32,776,769]],[[8175,8175],"disallowed_STD3_mapped",[96]],[[8176,8177],"disallowed"],[[8178,8178],"mapped",[8060,953]],[[8179,8179],"mapped",[969,953]],[[8180,8180],"mapped",[974,953]],[[8181,8181],"disallowed"],[[8182,8182],"valid"],[[8183,8183],"mapped",[8182,953]],[[8184,8184],"mapped",[8056]],[[8185,8185],"mapped",[972]],[[8186,8186],"mapped",[8060]],[[8187,8187],"mapped",[974]],[[8188,8188],"mapped",[969,953]],[[8189,8189],"disallowed_STD3_mapped",[32,769]],[[8190,8190],"disallowed_STD3_mapped",[32,788]],[[8191,8191],"disallowed"],[[8192,8202],"disallowed_STD3_mapped",[32]],[[8203,8203],"ignored"],[[8204,8205],"deviation",[]],[[8206,8207],"disallowed"],[[8208,8208],"valid",[],"NV8"],[[8209,8209],"mapped",[8208]],[[8210,8214],"valid",[],"NV8"],[[8215,8215],"disallowed_STD3_mapped",[32,819]],[[8216,8227],"valid",[],"NV8"],[[8228,8230],"disallowed"],[[8231,8231],"valid",[],"NV8"],[[8232,8238],"disallowed"],[[8239,8239],"disallowed_STD3_mapped",[32]],[[8240,8242],"valid",[],"NV8"],[[8243,8243],"mapped",[8242,8242]],[[8244,8244],"mapped",[8242,8242,8242]],[[8245,8245],"valid",[],"NV8"],[[8246,8246],"mapped",[8245,8245]],[[8247,8247],"mapped",[8245,8245,8245]],[[8248,8251],"valid",[],"NV8"],[[8252,8252],"disallowed_STD3_mapped",[33,33]],[[8253,8253],"valid",[],"NV8"],[[8254,8254],"disallowed_STD3_mapped",[32,773]],[[8255,8262],"valid",[],"NV8"],[[8263,8263],"disallowed_STD3_mapped",[63,63]],[[8264,8264],"disallowed_STD3_mapped",[63,33]],[[8265,8265],"disallowed_STD3_mapped",[33,63]],[[8266,8269],"valid",[],"NV8"],[[8270,8274],"valid",[],"NV8"],[[8275,8276],"valid",[],"NV8"],[[8277,8278],"valid",[],"NV8"],[[8279,8279],"mapped",[8242,8242,8242,8242]],[[8280,8286],"valid",[],"NV8"],[[8287,8287],"disallowed_STD3_mapped",[32]],[[8288,8288],"ignored"],[[8289,8291],"disallowed"],[[8292,8292],"ignored"],[[8293,8293],"disallowed"],[[8294,8297],"disallowed"],[[8298,8303],"disallowed"],[[8304,8304],"mapped",[48]],[[8305,8305],"mapped",[105]],[[8306,8307],"disallowed"],[[8308,8308],"mapped",[52]],[[8309,8309],"mapped",[53]],[[8310,8310],"mapped",[54]],[[8311,8311],"mapped",[55]],[[8312,8312],"mapped",[56]],[[8313,8313],"mapped",[57]],[[8314,8314],"disallowed_STD3_mapped",[43]],[[8315,8315],"mapped",[8722]],[[8316,8316],"disallowed_STD3_mapped",[61]],[[8317,8317],"disallowed_STD3_mapped",[40]],[[8318,8318],"disallowed_STD3_mapped",[41]],[[8319,8319],"mapped",[110]],[[8320,8320],"mapped",[48]],[[8321,8321],"mapped",[49]],[[8322,8322],"mapped",[50]],[[8323,8323],"mapped",[51]],[[8324,8324],"mapped",[52]],[[8325,8325],"mapped",[53]],[[8326,8326],"mapped",[54]],[[8327,8327],"mapped",[55]],[[8328,8328],"mapped",[56]],[[8329,8329],"mapped",[57]],[[8330,8330],"disallowed_STD3_mapped",[43]],[[8331,8331],"mapped",[8722]],[[8332,8332],"disallowed_STD3_mapped",[61]],[[8333,8333],"disallowed_STD3_mapped",[40]],[[8334,8334],"disallowed_STD3_mapped",[41]],[[8335,8335],"disallowed"],[[8336,8336],"mapped",[97]],[[8337,8337],"mapped",[101]],[[8338,8338],"mapped",[111]],[[8339,8339],"mapped",[120]],[[8340,8340],"mapped",[601]],[[8341,8341],"mapped",[104]],[[8342,8342],"mapped",[107]],[[8343,8343],"mapped",[108]],[[8344,8344],"mapped",[109]],[[8345,8345],"mapped",[110]],[[8346,8346],"mapped",[112]],[[8347,8347],"mapped",[115]],[[8348,8348],"mapped",[116]],[[8349,8351],"disallowed"],[[8352,8359],"valid",[],"NV8"],[[8360,8360],"mapped",[114,115]],[[8361,8362],"valid",[],"NV8"],[[8363,8363],"valid",[],"NV8"],[[8364,8364],"valid",[],"NV8"],[[8365,8367],"valid",[],"NV8"],[[8368,8369],"valid",[],"NV8"],[[8370,8373],"valid",[],"NV8"],[[8374,8376],"valid",[],"NV8"],[[8377,8377],"valid",[],"NV8"],[[8378,8378],"valid",[],"NV8"],[[8379,8381],"valid",[],"NV8"],[[8382,8382],"valid",[],"NV8"],[[8383,8399],"disallowed"],[[8400,8417],"valid",[],"NV8"],[[8418,8419],"valid",[],"NV8"],[[8420,8426],"valid",[],"NV8"],[[8427,8427],"valid",[],"NV8"],[[8428,8431],"valid",[],"NV8"],[[8432,8432],"valid",[],"NV8"],[[8433,8447],"disallowed"],[[8448,8448],"disallowed_STD3_mapped",[97,47,99]],[[8449,8449],"disallowed_STD3_mapped",[97,47,115]],[[8450,8450],"mapped",[99]],[[8451,8451],"mapped",[176,99]],[[8452,8452],"valid",[],"NV8"],[[8453,8453],"disallowed_STD3_mapped",[99,47,111]],[[8454,8454],"disallowed_STD3_mapped",[99,47,117]],[[8455,8455],"mapped",[603]],[[8456,8456],"valid",[],"NV8"],[[8457,8457],"mapped",[176,102]],[[8458,8458],"mapped",[103]],[[8459,8462],"mapped",[104]],[[8463,8463],"mapped",[295]],[[8464,8465],"mapped",[105]],[[8466,8467],"mapped",[108]],[[8468,8468],"valid",[],"NV8"],[[8469,8469],"mapped",[110]],[[8470,8470],"mapped",[110,111]],[[8471,8472],"valid",[],"NV8"],[[8473,8473],"mapped",[112]],[[8474,8474],"mapped",[113]],[[8475,8477],"mapped",[114]],[[8478,8479],"valid",[],"NV8"],[[8480,8480],"mapped",[115,109]],[[8481,8481],"mapped",[116,101,108]],[[8482,8482],"mapped",[116,109]],[[8483,8483],"valid",[],"NV8"],[[8484,8484],"mapped",[122]],[[8485,8485],"valid",[],"NV8"],[[8486,8486],"mapped",[969]],[[8487,8487],"valid",[],"NV8"],[[8488,8488],"mapped",[122]],[[8489,8489],"valid",[],"NV8"],[[8490,8490],"mapped",[107]],[[8491,8491],"mapped",[229]],[[8492,8492],"mapped",[98]],[[8493,8493],"mapped",[99]],[[8494,8494],"valid",[],"NV8"],[[8495,8496],"mapped",[101]],[[8497,8497],"mapped",[102]],[[8498,8498],"disallowed"],[[8499,8499],"mapped",[109]],[[8500,8500],"mapped",[111]],[[8501,8501],"mapped",[1488]],[[8502,8502],"mapped",[1489]],[[8503,8503],"mapped",[1490]],[[8504,8504],"mapped",[1491]],[[8505,8505],"mapped",[105]],[[8506,8506],"valid",[],"NV8"],[[8507,8507],"mapped",[102,97,120]],[[8508,8508],"mapped",[960]],[[8509,8510],"mapped",[947]],[[8511,8511],"mapped",[960]],[[8512,8512],"mapped",[8721]],[[8513,8516],"valid",[],"NV8"],[[8517,8518],"mapped",[100]],[[8519,8519],"mapped",[101]],[[8520,8520],"mapped",[105]],[[8521,8521],"mapped",[106]],[[8522,8523],"valid",[],"NV8"],[[8524,8524],"valid",[],"NV8"],[[8525,8525],"valid",[],"NV8"],[[8526,8526],"valid"],[[8527,8527],"valid",[],"NV8"],[[8528,8528],"mapped",[49,8260,55]],[[8529,8529],"mapped",[49,8260,57]],[[8530,8530],"mapped",[49,8260,49,48]],[[8531,8531],"mapped",[49,8260,51]],[[8532,8532],"mapped",[50,8260,51]],[[8533,8533],"mapped",[49,8260,53]],[[8534,8534],"mapped",[50,8260,53]],[[8535,8535],"mapped",[51,8260,53]],[[8536,8536],"mapped",[52,8260,53]],[[8537,8537],"mapped",[49,8260,54]],[[8538,8538],"mapped",[53,8260,54]],[[8539,8539],"mapped",[49,8260,56]],[[8540,8540],"mapped",[51,8260,56]],[[8541,8541],"mapped",[53,8260,56]],[[8542,8542],"mapped",[55,8260,56]],[[8543,8543],"mapped",[49,8260]],[[8544,8544],"mapped",[105]],[[8545,8545],"mapped",[105,105]],[[8546,8546],"mapped",[105,105,105]],[[8547,8547],"mapped",[105,118]],[[8548,8548],"mapped",[118]],[[8549,8549],"mapped",[118,105]],[[8550,8550],"mapped",[118,105,105]],[[8551,8551],"mapped",[118,105,105,105]],[[8552,8552],"mapped",[105,120]],[[8553,8553],"mapped",[120]],[[8554,8554],"mapped",[120,105]],[[8555,8555],"mapped",[120,105,105]],[[8556,8556],"mapped",[108]],[[8557,8557],"mapped",[99]],[[8558,8558],"mapped",[100]],[[8559,8559],"mapped",[109]],[[8560,8560],"mapped",[105]],[[8561,8561],"mapped",[105,105]],[[8562,8562],"mapped",[105,105,105]],[[8563,8563],"mapped",[105,118]],[[8564,8564],"mapped",[118]],[[8565,8565],"mapped",[118,105]],[[8566,8566],"mapped",[118,105,105]],[[8567,8567],"mapped",[118,105,105,105]],[[8568,8568],"mapped",[105,120]],[[8569,8569],"mapped",[120]],[[8570,8570],"mapped",[120,105]],[[8571,8571],"mapped",[120,105,105]],[[8572,8572],"mapped",[108]],[[8573,8573],"mapped",[99]],[[8574,8574],"mapped",[100]],[[8575,8575],"mapped",[109]],[[8576,8578],"valid",[],"NV8"],[[8579,8579],"disallowed"],[[8580,8580],"valid"],[[8581,8584],"valid",[],"NV8"],[[8585,8585],"mapped",[48,8260,51]],[[8586,8587],"valid",[],"NV8"],[[8588,8591],"disallowed"],[[8592,8682],"valid",[],"NV8"],[[8683,8691],"valid",[],"NV8"],[[8692,8703],"valid",[],"NV8"],[[8704,8747],"valid",[],"NV8"],[[8748,8748],"mapped",[8747,8747]],[[8749,8749],"mapped",[8747,8747,8747]],[[8750,8750],"valid",[],"NV8"],[[8751,8751],"mapped",[8750,8750]],[[8752,8752],"mapped",[8750,8750,8750]],[[8753,8799],"valid",[],"NV8"],[[8800,8800],"disallowed_STD3_valid"],[[8801,8813],"valid",[],"NV8"],[[8814,8815],"disallowed_STD3_valid"],[[8816,8945],"valid",[],"NV8"],[[8946,8959],"valid",[],"NV8"],[[8960,8960],"valid",[],"NV8"],[[8961,8961],"valid",[],"NV8"],[[8962,9000],"valid",[],"NV8"],[[9001,9001],"mapped",[12296]],[[9002,9002],"mapped",[12297]],[[9003,9082],"valid",[],"NV8"],[[9083,9083],"valid",[],"NV8"],[[9084,9084],"valid",[],"NV8"],[[9085,9114],"valid",[],"NV8"],[[9115,9166],"valid",[],"NV8"],[[9167,9168],"valid",[],"NV8"],[[9169,9179],"valid",[],"NV8"],[[9180,9191],"valid",[],"NV8"],[[9192,9192],"valid",[],"NV8"],[[9193,9203],"valid",[],"NV8"],[[9204,9210],"valid",[],"NV8"],[[9211,9215],"disallowed"],[[9216,9252],"valid",[],"NV8"],[[9253,9254],"valid",[],"NV8"],[[9255,9279],"disallowed"],[[9280,9290],"valid",[],"NV8"],[[9291,9311],"disallowed"],[[9312,9312],"mapped",[49]],[[9313,9313],"mapped",[50]],[[9314,9314],"mapped",[51]],[[9315,9315],"mapped",[52]],[[9316,9316],"mapped",[53]],[[9317,9317],"mapped",[54]],[[9318,9318],"mapped",[55]],[[9319,9319],"mapped",[56]],[[9320,9320],"mapped",[57]],[[9321,9321],"mapped",[49,48]],[[9322,9322],"mapped",[49,49]],[[9323,9323],"mapped",[49,50]],[[9324,9324],"mapped",[49,51]],[[9325,9325],"mapped",[49,52]],[[9326,9326],"mapped",[49,53]],[[9327,9327],"mapped",[49,54]],[[9328,9328],"mapped",[49,55]],[[9329,9329],"mapped",[49,56]],[[9330,9330],"mapped",[49,57]],[[9331,9331],"mapped",[50,48]],[[9332,9332],"disallowed_STD3_mapped",[40,49,41]],[[9333,9333],"disallowed_STD3_mapped",[40,50,41]],[[9334,9334],"disallowed_STD3_mapped",[40,51,41]],[[9335,9335],"disallowed_STD3_mapped",[40,52,41]],[[9336,9336],"disallowed_STD3_mapped",[40,53,41]],[[9337,9337],"disallowed_STD3_mapped",[40,54,41]],[[9338,9338],"disallowed_STD3_mapped",[40,55,41]],[[9339,9339],"disallowed_STD3_mapped",[40,56,41]],[[9340,9340],"disallowed_STD3_mapped",[40,57,41]],[[9341,9341],"disallowed_STD3_mapped",[40,49,48,41]],[[9342,9342],"disallowed_STD3_mapped",[40,49,49,41]],[[9343,9343],"disallowed_STD3_mapped",[40,49,50,41]],[[9344,9344],"disallowed_STD3_mapped",[40,49,51,41]],[[9345,9345],"disallowed_STD3_mapped",[40,49,52,41]],[[9346,9346],"disallowed_STD3_mapped",[40,49,53,41]],[[9347,9347],"disallowed_STD3_mapped",[40,49,54,41]],[[9348,9348],"disallowed_STD3_mapped",[40,49,55,41]],[[9349,9349],"disallowed_STD3_mapped",[40,49,56,41]],[[9350,9350],"disallowed_STD3_mapped",[40,49,57,41]],[[9351,9351],"disallowed_STD3_mapped",[40,50,48,41]],[[9352,9371],"disallowed"],[[9372,9372],"disallowed_STD3_mapped",[40,97,41]],[[9373,9373],"disallowed_STD3_mapped",[40,98,41]],[[9374,9374],"disallowed_STD3_mapped",[40,99,41]],[[9375,9375],"disallowed_STD3_mapped",[40,100,41]],[[9376,9376],"disallowed_STD3_mapped",[40,101,41]],[[9377,9377],"disallowed_STD3_mapped",[40,102,41]],[[9378,9378],"disallowed_STD3_mapped",[40,103,41]],[[9379,9379],"disallowed_STD3_mapped",[40,104,41]],[[9380,9380],"disallowed_STD3_mapped",[40,105,41]],[[9381,9381],"disallowed_STD3_mapped",[40,106,41]],[[9382,9382],"disallowed_STD3_mapped",[40,107,41]],[[9383,9383],"disallowed_STD3_mapped",[40,108,41]],[[9384,9384],"disallowed_STD3_mapped",[40,109,41]],[[9385,9385],"disallowed_STD3_mapped",[40,110,41]],[[9386,9386],"disallowed_STD3_mapped",[40,111,41]],[[9387,9387],"disallowed_STD3_mapped",[40,112,41]],[[9388,9388],"disallowed_STD3_mapped",[40,113,41]],[[9389,9389],"disallowed_STD3_mapped",[40,114,41]],[[9390,9390],"disallowed_STD3_mapped",[40,115,41]],[[9391,9391],"disallowed_STD3_mapped",[40,116,41]],[[9392,9392],"disallowed_STD3_mapped",[40,117,41]],[[9393,9393],"disallowed_STD3_mapped",[40,118,41]],[[9394,9394],"disallowed_STD3_mapped",[40,119,41]],[[9395,9395],"disallowed_STD3_mapped",[40,120,41]],[[9396,9396],"disallowed_STD3_mapped",[40,121,41]],[[9397,9397],"disallowed_STD3_mapped",[40,122,41]],[[9398,9398],"mapped",[97]],[[9399,9399],"mapped",[98]],[[9400,9400],"mapped",[99]],[[9401,9401],"mapped",[100]],[[9402,9402],"mapped",[101]],[[9403,9403],"mapped",[102]],[[9404,9404],"mapped",[103]],[[9405,9405],"mapped",[104]],[[9406,9406],"mapped",[105]],[[9407,9407],"mapped",[106]],[[9408,9408],"mapped",[107]],[[9409,9409],"mapped",[108]],[[9410,9410],"mapped",[109]],[[9411,9411],"mapped",[110]],[[9412,9412],"mapped",[111]],[[9413,9413],"mapped",[112]],[[9414,9414],"mapped",[113]],[[9415,9415],"mapped",[114]],[[9416,9416],"mapped",[115]],[[9417,9417],"mapped",[116]],[[9418,9418],"mapped",[117]],[[9419,9419],"mapped",[118]],[[9420,9420],"mapped",[119]],[[9421,9421],"mapped",[120]],[[9422,9422],"mapped",[121]],[[9423,9423],"mapped",[122]],[[9424,9424],"mapped",[97]],[[9425,9425],"mapped",[98]],[[9426,9426],"mapped",[99]],[[9427,9427],"mapped",[100]],[[9428,9428],"mapped",[101]],[[9429,9429],"mapped",[102]],[[9430,9430],"mapped",[103]],[[9431,9431],"mapped",[104]],[[9432,9432],"mapped",[105]],[[9433,9433],"mapped",[106]],[[9434,9434],"mapped",[107]],[[9435,9435],"mapped",[108]],[[9436,9436],"mapped",[109]],[[9437,9437],"mapped",[110]],[[9438,9438],"mapped",[111]],[[9439,9439],"mapped",[112]],[[9440,9440],"mapped",[113]],[[9441,9441],"mapped",[114]],[[9442,9442],"mapped",[115]],[[9443,9443],"mapped",[116]],[[9444,9444],"mapped",[117]],[[9445,9445],"mapped",[118]],[[9446,9446],"mapped",[119]],[[9447,9447],"mapped",[120]],[[9448,9448],"mapped",[121]],[[9449,9449],"mapped",[122]],[[9450,9450],"mapped",[48]],[[9451,9470],"valid",[],"NV8"],[[9471,9471],"valid",[],"NV8"],[[9472,9621],"valid",[],"NV8"],[[9622,9631],"valid",[],"NV8"],[[9632,9711],"valid",[],"NV8"],[[9712,9719],"valid",[],"NV8"],[[9720,9727],"valid",[],"NV8"],[[9728,9747],"valid",[],"NV8"],[[9748,9749],"valid",[],"NV8"],[[9750,9751],"valid",[],"NV8"],[[9752,9752],"valid",[],"NV8"],[[9753,9753],"valid",[],"NV8"],[[9754,9839],"valid",[],"NV8"],[[9840,9841],"valid",[],"NV8"],[[9842,9853],"valid",[],"NV8"],[[9854,9855],"valid",[],"NV8"],[[9856,9865],"valid",[],"NV8"],[[9866,9873],"valid",[],"NV8"],[[9874,9884],"valid",[],"NV8"],[[9885,9885],"valid",[],"NV8"],[[9886,9887],"valid",[],"NV8"],[[9888,9889],"valid",[],"NV8"],[[9890,9905],"valid",[],"NV8"],[[9906,9906],"valid",[],"NV8"],[[9907,9916],"valid",[],"NV8"],[[9917,9919],"valid",[],"NV8"],[[9920,9923],"valid",[],"NV8"],[[9924,9933],"valid",[],"NV8"],[[9934,9934],"valid",[],"NV8"],[[9935,9953],"valid",[],"NV8"],[[9954,9954],"valid",[],"NV8"],[[9955,9955],"valid",[],"NV8"],[[9956,9959],"valid",[],"NV8"],[[9960,9983],"valid",[],"NV8"],[[9984,9984],"valid",[],"NV8"],[[9985,9988],"valid",[],"NV8"],[[9989,9989],"valid",[],"NV8"],[[9990,9993],"valid",[],"NV8"],[[9994,9995],"valid",[],"NV8"],[[9996,10023],"valid",[],"NV8"],[[10024,10024],"valid",[],"NV8"],[[10025,10059],"valid",[],"NV8"],[[10060,10060],"valid",[],"NV8"],[[10061,10061],"valid",[],"NV8"],[[10062,10062],"valid",[],"NV8"],[[10063,10066],"valid",[],"NV8"],[[10067,10069],"valid",[],"NV8"],[[10070,10070],"valid",[],"NV8"],[[10071,10071],"valid",[],"NV8"],[[10072,10078],"valid",[],"NV8"],[[10079,10080],"valid",[],"NV8"],[[10081,10087],"valid",[],"NV8"],[[10088,10101],"valid",[],"NV8"],[[10102,10132],"valid",[],"NV8"],[[10133,10135],"valid",[],"NV8"],[[10136,10159],"valid",[],"NV8"],[[10160,10160],"valid",[],"NV8"],[[10161,10174],"valid",[],"NV8"],[[10175,10175],"valid",[],"NV8"],[[10176,10182],"valid",[],"NV8"],[[10183,10186],"valid",[],"NV8"],[[10187,10187],"valid",[],"NV8"],[[10188,10188],"valid",[],"NV8"],[[10189,10189],"valid",[],"NV8"],[[10190,10191],"valid",[],"NV8"],[[10192,10219],"valid",[],"NV8"],[[10220,10223],"valid",[],"NV8"],[[10224,10239],"valid",[],"NV8"],[[10240,10495],"valid",[],"NV8"],[[10496,10763],"valid",[],"NV8"],[[10764,10764],"mapped",[8747,8747,8747,8747]],[[10765,10867],"valid",[],"NV8"],[[10868,10868],"disallowed_STD3_mapped",[58,58,61]],[[10869,10869],"disallowed_STD3_mapped",[61,61]],[[10870,10870],"disallowed_STD3_mapped",[61,61,61]],[[10871,10971],"valid",[],"NV8"],[[10972,10972],"mapped",[10973,824]],[[10973,11007],"valid",[],"NV8"],[[11008,11021],"valid",[],"NV8"],[[11022,11027],"valid",[],"NV8"],[[11028,11034],"valid",[],"NV8"],[[11035,11039],"valid",[],"NV8"],[[11040,11043],"valid",[],"NV8"],[[11044,11084],"valid",[],"NV8"],[[11085,11087],"valid",[],"NV8"],[[11088,11092],"valid",[],"NV8"],[[11093,11097],"valid",[],"NV8"],[[11098,11123],"valid",[],"NV8"],[[11124,11125],"disallowed"],[[11126,11157],"valid",[],"NV8"],[[11158,11159],"disallowed"],[[11160,11193],"valid",[],"NV8"],[[11194,11196],"disallowed"],[[11197,11208],"valid",[],"NV8"],[[11209,11209],"disallowed"],[[11210,11217],"valid",[],"NV8"],[[11218,11243],"disallowed"],[[11244,11247],"valid",[],"NV8"],[[11248,11263],"disallowed"],[[11264,11264],"mapped",[11312]],[[11265,11265],"mapped",[11313]],[[11266,11266],"mapped",[11314]],[[11267,11267],"mapped",[11315]],[[11268,11268],"mapped",[11316]],[[11269,11269],"mapped",[11317]],[[11270,11270],"mapped",[11318]],[[11271,11271],"mapped",[11319]],[[11272,11272],"mapped",[11320]],[[11273,11273],"mapped",[11321]],[[11274,11274],"mapped",[11322]],[[11275,11275],"mapped",[11323]],[[11276,11276],"mapped",[11324]],[[11277,11277],"mapped",[11325]],[[11278,11278],"mapped",[11326]],[[11279,11279],"mapped",[11327]],[[11280,11280],"mapped",[11328]],[[11281,11281],"mapped",[11329]],[[11282,11282],"mapped",[11330]],[[11283,11283],"mapped",[11331]],[[11284,11284],"mapped",[11332]],[[11285,11285],"mapped",[11333]],[[11286,11286],"mapped",[11334]],[[11287,11287],"mapped",[11335]],[[11288,11288],"mapped",[11336]],[[11289,11289],"mapped",[11337]],[[11290,11290],"mapped",[11338]],[[11291,11291],"mapped",[11339]],[[11292,11292],"mapped",[11340]],[[11293,11293],"mapped",[11341]],[[11294,11294],"mapped",[11342]],[[11295,11295],"mapped",[11343]],[[11296,11296],"mapped",[11344]],[[11297,11297],"mapped",[11345]],[[11298,11298],"mapped",[11346]],[[11299,11299],"mapped",[11347]],[[11300,11300],"mapped",[11348]],[[11301,11301],"mapped",[11349]],[[11302,11302],"mapped",[11350]],[[11303,11303],"mapped",[11351]],[[11304,11304],"mapped",[11352]],[[11305,11305],"mapped",[11353]],[[11306,11306],"mapped",[11354]],[[11307,11307],"mapped",[11355]],[[11308,11308],"mapped",[11356]],[[11309,11309],"mapped",[11357]],[[11310,11310],"mapped",[11358]],[[11311,11311],"disallowed"],[[11312,11358],"valid"],[[11359,11359],"disallowed"],[[11360,11360],"mapped",[11361]],[[11361,11361],"valid"],[[11362,11362],"mapped",[619]],[[11363,11363],"mapped",[7549]],[[11364,11364],"mapped",[637]],[[11365,11366],"valid"],[[11367,11367],"mapped",[11368]],[[11368,11368],"valid"],[[11369,11369],"mapped",[11370]],[[11370,11370],"valid"],[[11371,11371],"mapped",[11372]],[[11372,11372],"valid"],[[11373,11373],"mapped",[593]],[[11374,11374],"mapped",[625]],[[11375,11375],"mapped",[592]],[[11376,11376],"mapped",[594]],[[11377,11377],"valid"],[[11378,11378],"mapped",[11379]],[[11379,11379],"valid"],[[11380,11380],"valid"],[[11381,11381],"mapped",[11382]],[[11382,11383],"valid"],[[11384,11387],"valid"],[[11388,11388],"mapped",[106]],[[11389,11389],"mapped",[118]],[[11390,11390],"mapped",[575]],[[11391,11391],"mapped",[576]],[[11392,11392],"mapped",[11393]],[[11393,11393],"valid"],[[11394,11394],"mapped",[11395]],[[11395,11395],"valid"],[[11396,11396],"mapped",[11397]],[[11397,11397],"valid"],[[11398,11398],"mapped",[11399]],[[11399,11399],"valid"],[[11400,11400],"mapped",[11401]],[[11401,11401],"valid"],[[11402,11402],"mapped",[11403]],[[11403,11403],"valid"],[[11404,11404],"mapped",[11405]],[[11405,11405],"valid"],[[11406,11406],"mapped",[11407]],[[11407,11407],"valid"],[[11408,11408],"mapped",[11409]],[[11409,11409],"valid"],[[11410,11410],"mapped",[11411]],[[11411,11411],"valid"],[[11412,11412],"mapped",[11413]],[[11413,11413],"valid"],[[11414,11414],"mapped",[11415]],[[11415,11415],"valid"],[[11416,11416],"mapped",[11417]],[[11417,11417],"valid"],[[11418,11418],"mapped",[11419]],[[11419,11419],"valid"],[[11420,11420],"mapped",[11421]],[[11421,11421],"valid"],[[11422,11422],"mapped",[11423]],[[11423,11423],"valid"],[[11424,11424],"mapped",[11425]],[[11425,11425],"valid"],[[11426,11426],"mapped",[11427]],[[11427,11427],"valid"],[[11428,11428],"mapped",[11429]],[[11429,11429],"valid"],[[11430,11430],"mapped",[11431]],[[11431,11431],"valid"],[[11432,11432],"mapped",[11433]],[[11433,11433],"valid"],[[11434,11434],"mapped",[11435]],[[11435,11435],"valid"],[[11436,11436],"mapped",[11437]],[[11437,11437],"valid"],[[11438,11438],"mapped",[11439]],[[11439,11439],"valid"],[[11440,11440],"mapped",[11441]],[[11441,11441],"valid"],[[11442,11442],"mapped",[11443]],[[11443,11443],"valid"],[[11444,11444],"mapped",[11445]],[[11445,11445],"valid"],[[11446,11446],"mapped",[11447]],[[11447,11447],"valid"],[[11448,11448],"mapped",[11449]],[[11449,11449],"valid"],[[11450,11450],"mapped",[11451]],[[11451,11451],"valid"],[[11452,11452],"mapped",[11453]],[[11453,11453],"valid"],[[11454,11454],"mapped",[11455]],[[11455,11455],"valid"],[[11456,11456],"mapped",[11457]],[[11457,11457],"valid"],[[11458,11458],"mapped",[11459]],[[11459,11459],"valid"],[[11460,11460],"mapped",[11461]],[[11461,11461],"valid"],[[11462,11462],"mapped",[11463]],[[11463,11463],"valid"],[[11464,11464],"mapped",[11465]],[[11465,11465],"valid"],[[11466,11466],"mapped",[11467]],[[11467,11467],"valid"],[[11468,11468],"mapped",[11469]],[[11469,11469],"valid"],[[11470,11470],"mapped",[11471]],[[11471,11471],"valid"],[[11472,11472],"mapped",[11473]],[[11473,11473],"valid"],[[11474,11474],"mapped",[11475]],[[11475,11475],"valid"],[[11476,11476],"mapped",[11477]],[[11477,11477],"valid"],[[11478,11478],"mapped",[11479]],[[11479,11479],"valid"],[[11480,11480],"mapped",[11481]],[[11481,11481],"valid"],[[11482,11482],"mapped",[11483]],[[11483,11483],"valid"],[[11484,11484],"mapped",[11485]],[[11485,11485],"valid"],[[11486,11486],"mapped",[11487]],[[11487,11487],"valid"],[[11488,11488],"mapped",[11489]],[[11489,11489],"valid"],[[11490,11490],"mapped",[11491]],[[11491,11492],"valid"],[[11493,11498],"valid",[],"NV8"],[[11499,11499],"mapped",[11500]],[[11500,11500],"valid"],[[11501,11501],"mapped",[11502]],[[11502,11505],"valid"],[[11506,11506],"mapped",[11507]],[[11507,11507],"valid"],[[11508,11512],"disallowed"],[[11513,11519],"valid",[],"NV8"],[[11520,11557],"valid"],[[11558,11558],"disallowed"],[[11559,11559],"valid"],[[11560,11564],"disallowed"],[[11565,11565],"valid"],[[11566,11567],"disallowed"],[[11568,11621],"valid"],[[11622,11623],"valid"],[[11624,11630],"disallowed"],[[11631,11631],"mapped",[11617]],[[11632,11632],"valid",[],"NV8"],[[11633,11646],"disallowed"],[[11647,11647],"valid"],[[11648,11670],"valid"],[[11671,11679],"disallowed"],[[11680,11686],"valid"],[[11687,11687],"disallowed"],[[11688,11694],"valid"],[[11695,11695],"disallowed"],[[11696,11702],"valid"],[[11703,11703],"disallowed"],[[11704,11710],"valid"],[[11711,11711],"disallowed"],[[11712,11718],"valid"],[[11719,11719],"disallowed"],[[11720,11726],"valid"],[[11727,11727],"disallowed"],[[11728,11734],"valid"],[[11735,11735],"disallowed"],[[11736,11742],"valid"],[[11743,11743],"disallowed"],[[11744,11775],"valid"],[[11776,11799],"valid",[],"NV8"],[[11800,11803],"valid",[],"NV8"],[[11804,11805],"valid",[],"NV8"],[[11806,11822],"valid",[],"NV8"],[[11823,11823],"valid"],[[11824,11824],"valid",[],"NV8"],[[11825,11825],"valid",[],"NV8"],[[11826,11835],"valid",[],"NV8"],[[11836,11842],"valid",[],"NV8"],[[11843,11903],"disallowed"],[[11904,11929],"valid",[],"NV8"],[[11930,11930],"disallowed"],[[11931,11934],"valid",[],"NV8"],[[11935,11935],"mapped",[27597]],[[11936,12018],"valid",[],"NV8"],[[12019,12019],"mapped",[40863]],[[12020,12031],"disallowed"],[[12032,12032],"mapped",[19968]],[[12033,12033],"mapped",[20008]],[[12034,12034],"mapped",[20022]],[[12035,12035],"mapped",[20031]],[[12036,12036],"mapped",[20057]],[[12037,12037],"mapped",[20101]],[[12038,12038],"mapped",[20108]],[[12039,12039],"mapped",[20128]],[[12040,12040],"mapped",[20154]],[[12041,12041],"mapped",[20799]],[[12042,12042],"mapped",[20837]],[[12043,12043],"mapped",[20843]],[[12044,12044],"mapped",[20866]],[[12045,12045],"mapped",[20886]],[[12046,12046],"mapped",[20907]],[[12047,12047],"mapped",[20960]],[[12048,12048],"mapped",[20981]],[[12049,12049],"mapped",[20992]],[[12050,12050],"mapped",[21147]],[[12051,12051],"mapped",[21241]],[[12052,12052],"mapped",[21269]],[[12053,12053],"mapped",[21274]],[[12054,12054],"mapped",[21304]],[[12055,12055],"mapped",[21313]],[[12056,12056],"mapped",[21340]],[[12057,12057],"mapped",[21353]],[[12058,12058],"mapped",[21378]],[[12059,12059],"mapped",[21430]],[[12060,12060],"mapped",[21448]],[[12061,12061],"mapped",[21475]],[[12062,12062],"mapped",[22231]],[[12063,12063],"mapped",[22303]],[[12064,12064],"mapped",[22763]],[[12065,12065],"mapped",[22786]],[[12066,12066],"mapped",[22794]],[[12067,12067],"mapped",[22805]],[[12068,12068],"mapped",[22823]],[[12069,12069],"mapped",[22899]],[[12070,12070],"mapped",[23376]],[[12071,12071],"mapped",[23424]],[[12072,12072],"mapped",[23544]],[[12073,12073],"mapped",[23567]],[[12074,12074],"mapped",[23586]],[[12075,12075],"mapped",[23608]],[[12076,12076],"mapped",[23662]],[[12077,12077],"mapped",[23665]],[[12078,12078],"mapped",[24027]],[[12079,12079],"mapped",[24037]],[[12080,12080],"mapped",[24049]],[[12081,12081],"mapped",[24062]],[[12082,12082],"mapped",[24178]],[[12083,12083],"mapped",[24186]],[[12084,12084],"mapped",[24191]],[[12085,12085],"mapped",[24308]],[[12086,12086],"mapped",[24318]],[[12087,12087],"mapped",[24331]],[[12088,12088],"mapped",[24339]],[[12089,12089],"mapped",[24400]],[[12090,12090],"mapped",[24417]],[[12091,12091],"mapped",[24435]],[[12092,12092],"mapped",[24515]],[[12093,12093],"mapped",[25096]],[[12094,12094],"mapped",[25142]],[[12095,12095],"mapped",[25163]],[[12096,12096],"mapped",[25903]],[[12097,12097],"mapped",[25908]],[[12098,12098],"mapped",[25991]],[[12099,12099],"mapped",[26007]],[[12100,12100],"mapped",[26020]],[[12101,12101],"mapped",[26041]],[[12102,12102],"mapped",[26080]],[[12103,12103],"mapped",[26085]],[[12104,12104],"mapped",[26352]],[[12105,12105],"mapped",[26376]],[[12106,12106],"mapped",[26408]],[[12107,12107],"mapped",[27424]],[[12108,12108],"mapped",[27490]],[[12109,12109],"mapped",[27513]],[[12110,12110],"mapped",[27571]],[[12111,12111],"mapped",[27595]],[[12112,12112],"mapped",[27604]],[[12113,12113],"mapped",[27611]],[[12114,12114],"mapped",[27663]],[[12115,12115],"mapped",[27668]],[[12116,12116],"mapped",[27700]],[[12117,12117],"mapped",[28779]],[[12118,12118],"mapped",[29226]],[[12119,12119],"mapped",[29238]],[[12120,12120],"mapped",[29243]],[[12121,12121],"mapped",[29247]],[[12122,12122],"mapped",[29255]],[[12123,12123],"mapped",[29273]],[[12124,12124],"mapped",[29275]],[[12125,12125],"mapped",[29356]],[[12126,12126],"mapped",[29572]],[[12127,12127],"mapped",[29577]],[[12128,12128],"mapped",[29916]],[[12129,12129],"mapped",[29926]],[[12130,12130],"mapped",[29976]],[[12131,12131],"mapped",[29983]],[[12132,12132],"mapped",[29992]],[[12133,12133],"mapped",[30000]],[[12134,12134],"mapped",[30091]],[[12135,12135],"mapped",[30098]],[[12136,12136],"mapped",[30326]],[[12137,12137],"mapped",[30333]],[[12138,12138],"mapped",[30382]],[[12139,12139],"mapped",[30399]],[[12140,12140],"mapped",[30446]],[[12141,12141],"mapped",[30683]],[[12142,12142],"mapped",[30690]],[[12143,12143],"mapped",[30707]],[[12144,12144],"mapped",[31034]],[[12145,12145],"mapped",[31160]],[[12146,12146],"mapped",[31166]],[[12147,12147],"mapped",[31348]],[[12148,12148],"mapped",[31435]],[[12149,12149],"mapped",[31481]],[[12150,12150],"mapped",[31859]],[[12151,12151],"mapped",[31992]],[[12152,12152],"mapped",[32566]],[[12153,12153],"mapped",[32593]],[[12154,12154],"mapped",[32650]],[[12155,12155],"mapped",[32701]],[[12156,12156],"mapped",[32769]],[[12157,12157],"mapped",[32780]],[[12158,12158],"mapped",[32786]],[[12159,12159],"mapped",[32819]],[[12160,12160],"mapped",[32895]],[[12161,12161],"mapped",[32905]],[[12162,12162],"mapped",[33251]],[[12163,12163],"mapped",[33258]],[[12164,12164],"mapped",[33267]],[[12165,12165],"mapped",[33276]],[[12166,12166],"mapped",[33292]],[[12167,12167],"mapped",[33307]],[[12168,12168],"mapped",[33311]],[[12169,12169],"mapped",[33390]],[[12170,12170],"mapped",[33394]],[[12171,12171],"mapped",[33400]],[[12172,12172],"mapped",[34381]],[[12173,12173],"mapped",[34411]],[[12174,12174],"mapped",[34880]],[[12175,12175],"mapped",[34892]],[[12176,12176],"mapped",[34915]],[[12177,12177],"mapped",[35198]],[[12178,12178],"mapped",[35211]],[[12179,12179],"mapped",[35282]],[[12180,12180],"mapped",[35328]],[[12181,12181],"mapped",[35895]],[[12182,12182],"mapped",[35910]],[[12183,12183],"mapped",[35925]],[[12184,12184],"mapped",[35960]],[[12185,12185],"mapped",[35997]],[[12186,12186],"mapped",[36196]],[[12187,12187],"mapped",[36208]],[[12188,12188],"mapped",[36275]],[[12189,12189],"mapped",[36523]],[[12190,12190],"mapped",[36554]],[[12191,12191],"mapped",[36763]],[[12192,12192],"mapped",[36784]],[[12193,12193],"mapped",[36789]],[[12194,12194],"mapped",[37009]],[[12195,12195],"mapped",[37193]],[[12196,12196],"mapped",[37318]],[[12197,12197],"mapped",[37324]],[[12198,12198],"mapped",[37329]],[[12199,12199],"mapped",[38263]],[[12200,12200],"mapped",[38272]],[[12201,12201],"mapped",[38428]],[[12202,12202],"mapped",[38582]],[[12203,12203],"mapped",[38585]],[[12204,12204],"mapped",[38632]],[[12205,12205],"mapped",[38737]],[[12206,12206],"mapped",[38750]],[[12207,12207],"mapped",[38754]],[[12208,12208],"mapped",[38761]],[[12209,12209],"mapped",[38859]],[[12210,12210],"mapped",[38893]],[[12211,12211],"mapped",[38899]],[[12212,12212],"mapped",[38913]],[[12213,12213],"mapped",[39080]],[[12214,12214],"mapped",[39131]],[[12215,12215],"mapped",[39135]],[[12216,12216],"mapped",[39318]],[[12217,12217],"mapped",[39321]],[[12218,12218],"mapped",[39340]],[[12219,12219],"mapped",[39592]],[[12220,12220],"mapped",[39640]],[[12221,12221],"mapped",[39647]],[[12222,12222],"mapped",[39717]],[[12223,12223],"mapped",[39727]],[[12224,12224],"mapped",[39730]],[[12225,12225],"mapped",[39740]],[[12226,12226],"mapped",[39770]],[[12227,12227],"mapped",[40165]],[[12228,12228],"mapped",[40565]],[[12229,12229],"mapped",[40575]],[[12230,12230],"mapped",[40613]],[[12231,12231],"mapped",[40635]],[[12232,12232],"mapped",[40643]],[[12233,12233],"mapped",[40653]],[[12234,12234],"mapped",[40657]],[[12235,12235],"mapped",[40697]],[[12236,12236],"mapped",[40701]],[[12237,12237],"mapped",[40718]],[[12238,12238],"mapped",[40723]],[[12239,12239],"mapped",[40736]],[[12240,12240],"mapped",[40763]],[[12241,12241],"mapped",[40778]],[[12242,12242],"mapped",[40786]],[[12243,12243],"mapped",[40845]],[[12244,12244],"mapped",[40860]],[[12245,12245],"mapped",[40864]],[[12246,12271],"disallowed"],[[12272,12283],"disallowed"],[[12284,12287],"disallowed"],[[12288,12288],"disallowed_STD3_mapped",[32]],[[12289,12289],"valid",[],"NV8"],[[12290,12290],"mapped",[46]],[[12291,12292],"valid",[],"NV8"],[[12293,12295],"valid"],[[12296,12329],"valid",[],"NV8"],[[12330,12333],"valid"],[[12334,12341],"valid",[],"NV8"],[[12342,12342],"mapped",[12306]],[[12343,12343],"valid",[],"NV8"],[[12344,12344],"mapped",[21313]],[[12345,12345],"mapped",[21316]],[[12346,12346],"mapped",[21317]],[[12347,12347],"valid",[],"NV8"],[[12348,12348],"valid"],[[12349,12349],"valid",[],"NV8"],[[12350,12350],"valid",[],"NV8"],[[12351,12351],"valid",[],"NV8"],[[12352,12352],"disallowed"],[[12353,12436],"valid"],[[12437,12438],"valid"],[[12439,12440],"disallowed"],[[12441,12442],"valid"],[[12443,12443],"disallowed_STD3_mapped",[32,12441]],[[12444,12444],"disallowed_STD3_mapped",[32,12442]],[[12445,12446],"valid"],[[12447,12447],"mapped",[12424,12426]],[[12448,12448],"valid",[],"NV8"],[[12449,12542],"valid"],[[12543,12543],"mapped",[12467,12488]],[[12544,12548],"disallowed"],[[12549,12588],"valid"],[[12589,12589],"valid"],[[12590,12592],"disallowed"],[[12593,12593],"mapped",[4352]],[[12594,12594],"mapped",[4353]],[[12595,12595],"mapped",[4522]],[[12596,12596],"mapped",[4354]],[[12597,12597],"mapped",[4524]],[[12598,12598],"mapped",[4525]],[[12599,12599],"mapped",[4355]],[[12600,12600],"mapped",[4356]],[[12601,12601],"mapped",[4357]],[[12602,12602],"mapped",[4528]],[[12603,12603],"mapped",[4529]],[[12604,12604],"mapped",[4530]],[[12605,12605],"mapped",[4531]],[[12606,12606],"mapped",[4532]],[[12607,12607],"mapped",[4533]],[[12608,12608],"mapped",[4378]],[[12609,12609],"mapped",[4358]],[[12610,12610],"mapped",[4359]],[[12611,12611],"mapped",[4360]],[[12612,12612],"mapped",[4385]],[[12613,12613],"mapped",[4361]],[[12614,12614],"mapped",[4362]],[[12615,12615],"mapped",[4363]],[[12616,12616],"mapped",[4364]],[[12617,12617],"mapped",[4365]],[[12618,12618],"mapped",[4366]],[[12619,12619],"mapped",[4367]],[[12620,12620],"mapped",[4368]],[[12621,12621],"mapped",[4369]],[[12622,12622],"mapped",[4370]],[[12623,12623],"mapped",[4449]],[[12624,12624],"mapped",[4450]],[[12625,12625],"mapped",[4451]],[[12626,12626],"mapped",[4452]],[[12627,12627],"mapped",[4453]],[[12628,12628],"mapped",[4454]],[[12629,12629],"mapped",[4455]],[[12630,12630],"mapped",[4456]],[[12631,12631],"mapped",[4457]],[[12632,12632],"mapped",[4458]],[[12633,12633],"mapped",[4459]],[[12634,12634],"mapped",[4460]],[[12635,12635],"mapped",[4461]],[[12636,12636],"mapped",[4462]],[[12637,12637],"mapped",[4463]],[[12638,12638],"mapped",[4464]],[[12639,12639],"mapped",[4465]],[[12640,12640],"mapped",[4466]],[[12641,12641],"mapped",[4467]],[[12642,12642],"mapped",[4468]],[[12643,12643],"mapped",[4469]],[[12644,12644],"disallowed"],[[12645,12645],"mapped",[4372]],[[12646,12646],"mapped",[4373]],[[12647,12647],"mapped",[4551]],[[12648,12648],"mapped",[4552]],[[12649,12649],"mapped",[4556]],[[12650,12650],"mapped",[4558]],[[12651,12651],"mapped",[4563]],[[12652,12652],"mapped",[4567]],[[12653,12653],"mapped",[4569]],[[12654,12654],"mapped",[4380]],[[12655,12655],"mapped",[4573]],[[12656,12656],"mapped",[4575]],[[12657,12657],"mapped",[4381]],[[12658,12658],"mapped",[4382]],[[12659,12659],"mapped",[4384]],[[12660,12660],"mapped",[4386]],[[12661,12661],"mapped",[4387]],[[12662,12662],"mapped",[4391]],[[12663,12663],"mapped",[4393]],[[12664,12664],"mapped",[4395]],[[12665,12665],"mapped",[4396]],[[12666,12666],"mapped",[4397]],[[12667,12667],"mapped",[4398]],[[12668,12668],"mapped",[4399]],[[12669,12669],"mapped",[4402]],[[12670,12670],"mapped",[4406]],[[12671,12671],"mapped",[4416]],[[12672,12672],"mapped",[4423]],[[12673,12673],"mapped",[4428]],[[12674,12674],"mapped",[4593]],[[12675,12675],"mapped",[4594]],[[12676,12676],"mapped",[4439]],[[12677,12677],"mapped",[4440]],[[12678,12678],"mapped",[4441]],[[12679,12679],"mapped",[4484]],[[12680,12680],"mapped",[4485]],[[12681,12681],"mapped",[4488]],[[12682,12682],"mapped",[4497]],[[12683,12683],"mapped",[4498]],[[12684,12684],"mapped",[4500]],[[12685,12685],"mapped",[4510]],[[12686,12686],"mapped",[4513]],[[12687,12687],"disallowed"],[[12688,12689],"valid",[],"NV8"],[[12690,12690],"mapped",[19968]],[[12691,12691],"mapped",[20108]],[[12692,12692],"mapped",[19977]],[[12693,12693],"mapped",[22235]],[[12694,12694],"mapped",[19978]],[[12695,12695],"mapped",[20013]],[[12696,12696],"mapped",[19979]],[[12697,12697],"mapped",[30002]],[[12698,12698],"mapped",[20057]],[[12699,12699],"mapped",[19993]],[[12700,12700],"mapped",[19969]],[[12701,12701],"mapped",[22825]],[[12702,12702],"mapped",[22320]],[[12703,12703],"mapped",[20154]],[[12704,12727],"valid"],[[12728,12730],"valid"],[[12731,12735],"disallowed"],[[12736,12751],"valid",[],"NV8"],[[12752,12771],"valid",[],"NV8"],[[12772,12783],"disallowed"],[[12784,12799],"valid"],[[12800,12800],"disallowed_STD3_mapped",[40,4352,41]],[[12801,12801],"disallowed_STD3_mapped",[40,4354,41]],[[12802,12802],"disallowed_STD3_mapped",[40,4355,41]],[[12803,12803],"disallowed_STD3_mapped",[40,4357,41]],[[12804,12804],"disallowed_STD3_mapped",[40,4358,41]],[[12805,12805],"disallowed_STD3_mapped",[40,4359,41]],[[12806,12806],"disallowed_STD3_mapped",[40,4361,41]],[[12807,12807],"disallowed_STD3_mapped",[40,4363,41]],[[12808,12808],"disallowed_STD3_mapped",[40,4364,41]],[[12809,12809],"disallowed_STD3_mapped",[40,4366,41]],[[12810,12810],"disallowed_STD3_mapped",[40,4367,41]],[[12811,12811],"disallowed_STD3_mapped",[40,4368,41]],[[12812,12812],"disallowed_STD3_mapped",[40,4369,41]],[[12813,12813],"disallowed_STD3_mapped",[40,4370,41]],[[12814,12814],"disallowed_STD3_mapped",[40,44032,41]],[[12815,12815],"disallowed_STD3_mapped",[40,45208,41]],[[12816,12816],"disallowed_STD3_mapped",[40,45796,41]],[[12817,12817],"disallowed_STD3_mapped",[40,46972,41]],[[12818,12818],"disallowed_STD3_mapped",[40,47560,41]],[[12819,12819],"disallowed_STD3_mapped",[40,48148,41]],[[12820,12820],"disallowed_STD3_mapped",[40,49324,41]],[[12821,12821],"disallowed_STD3_mapped",[40,50500,41]],[[12822,12822],"disallowed_STD3_mapped",[40,51088,41]],[[12823,12823],"disallowed_STD3_mapped",[40,52264,41]],[[12824,12824],"disallowed_STD3_mapped",[40,52852,41]],[[12825,12825],"disallowed_STD3_mapped",[40,53440,41]],[[12826,12826],"disallowed_STD3_mapped",[40,54028,41]],[[12827,12827],"disallowed_STD3_mapped",[40,54616,41]],[[12828,12828],"disallowed_STD3_mapped",[40,51452,41]],[[12829,12829],"disallowed_STD3_mapped",[40,50724,51204,41]],[[12830,12830],"disallowed_STD3_mapped",[40,50724,54980,41]],[[12831,12831],"disallowed"],[[12832,12832],"disallowed_STD3_mapped",[40,19968,41]],[[12833,12833],"disallowed_STD3_mapped",[40,20108,41]],[[12834,12834],"disallowed_STD3_mapped",[40,19977,41]],[[12835,12835],"disallowed_STD3_mapped",[40,22235,41]],[[12836,12836],"disallowed_STD3_mapped",[40,20116,41]],[[12837,12837],"disallowed_STD3_mapped",[40,20845,41]],[[12838,12838],"disallowed_STD3_mapped",[40,19971,41]],[[12839,12839],"disallowed_STD3_mapped",[40,20843,41]],[[12840,12840],"disallowed_STD3_mapped",[40,20061,41]],[[12841,12841],"disallowed_STD3_mapped",[40,21313,41]],[[12842,12842],"disallowed_STD3_mapped",[40,26376,41]],[[12843,12843],"disallowed_STD3_mapped",[40,28779,41]],[[12844,12844],"disallowed_STD3_mapped",[40,27700,41]],[[12845,12845],"disallowed_STD3_mapped",[40,26408,41]],[[12846,12846],"disallowed_STD3_mapped",[40,37329,41]],[[12847,12847],"disallowed_STD3_mapped",[40,22303,41]],[[12848,12848],"disallowed_STD3_mapped",[40,26085,41]],[[12849,12849],"disallowed_STD3_mapped",[40,26666,41]],[[12850,12850],"disallowed_STD3_mapped",[40,26377,41]],[[12851,12851],"disallowed_STD3_mapped",[40,31038,41]],[[12852,12852],"disallowed_STD3_mapped",[40,21517,41]],[[12853,12853],"disallowed_STD3_mapped",[40,29305,41]],[[12854,12854],"disallowed_STD3_mapped",[40,36001,41]],[[12855,12855],"disallowed_STD3_mapped",[40,31069,41]],[[12856,12856],"disallowed_STD3_mapped",[40,21172,41]],[[12857,12857],"disallowed_STD3_mapped",[40,20195,41]],[[12858,12858],"disallowed_STD3_mapped",[40,21628,41]],[[12859,12859],"disallowed_STD3_mapped",[40,23398,41]],[[12860,12860],"disallowed_STD3_mapped",[40,30435,41]],[[12861,12861],"disallowed_STD3_mapped",[40,20225,41]],[[12862,12862],"disallowed_STD3_mapped",[40,36039,41]],[[12863,12863],"disallowed_STD3_mapped",[40,21332,41]],[[12864,12864],"disallowed_STD3_mapped",[40,31085,41]],[[12865,12865],"disallowed_STD3_mapped",[40,20241,41]],[[12866,12866],"disallowed_STD3_mapped",[40,33258,41]],[[12867,12867],"disallowed_STD3_mapped",[40,33267,41]],[[12868,12868],"mapped",[21839]],[[12869,12869],"mapped",[24188]],[[12870,12870],"mapped",[25991]],[[12871,12871],"mapped",[31631]],[[12872,12879],"valid",[],"NV8"],[[12880,12880],"mapped",[112,116,101]],[[12881,12881],"mapped",[50,49]],[[12882,12882],"mapped",[50,50]],[[12883,12883],"mapped",[50,51]],[[12884,12884],"mapped",[50,52]],[[12885,12885],"mapped",[50,53]],[[12886,12886],"mapped",[50,54]],[[12887,12887],"mapped",[50,55]],[[12888,12888],"mapped",[50,56]],[[12889,12889],"mapped",[50,57]],[[12890,12890],"mapped",[51,48]],[[12891,12891],"mapped",[51,49]],[[12892,12892],"mapped",[51,50]],[[12893,12893],"mapped",[51,51]],[[12894,12894],"mapped",[51,52]],[[12895,12895],"mapped",[51,53]],[[12896,12896],"mapped",[4352]],[[12897,12897],"mapped",[4354]],[[12898,12898],"mapped",[4355]],[[12899,12899],"mapped",[4357]],[[12900,12900],"mapped",[4358]],[[12901,12901],"mapped",[4359]],[[12902,12902],"mapped",[4361]],[[12903,12903],"mapped",[4363]],[[12904,12904],"mapped",[4364]],[[12905,12905],"mapped",[4366]],[[12906,12906],"mapped",[4367]],[[12907,12907],"mapped",[4368]],[[12908,12908],"mapped",[4369]],[[12909,12909],"mapped",[4370]],[[12910,12910],"mapped",[44032]],[[12911,12911],"mapped",[45208]],[[12912,12912],"mapped",[45796]],[[12913,12913],"mapped",[46972]],[[12914,12914],"mapped",[47560]],[[12915,12915],"mapped",[48148]],[[12916,12916],"mapped",[49324]],[[12917,12917],"mapped",[50500]],[[12918,12918],"mapped",[51088]],[[12919,12919],"mapped",[52264]],[[12920,12920],"mapped",[52852]],[[12921,12921],"mapped",[53440]],[[12922,12922],"mapped",[54028]],[[12923,12923],"mapped",[54616]],[[12924,12924],"mapped",[52280,44256]],[[12925,12925],"mapped",[51452,51032]],[[12926,12926],"mapped",[50864]],[[12927,12927],"valid",[],"NV8"],[[12928,12928],"mapped",[19968]],[[12929,12929],"mapped",[20108]],[[12930,12930],"mapped",[19977]],[[12931,12931],"mapped",[22235]],[[12932,12932],"mapped",[20116]],[[12933,12933],"mapped",[20845]],[[12934,12934],"mapped",[19971]],[[12935,12935],"mapped",[20843]],[[12936,12936],"mapped",[20061]],[[12937,12937],"mapped",[21313]],[[12938,12938],"mapped",[26376]],[[12939,12939],"mapped",[28779]],[[12940,12940],"mapped",[27700]],[[12941,12941],"mapped",[26408]],[[12942,12942],"mapped",[37329]],[[12943,12943],"mapped",[22303]],[[12944,12944],"mapped",[26085]],[[12945,12945],"mapped",[26666]],[[12946,12946],"mapped",[26377]],[[12947,12947],"mapped",[31038]],[[12948,12948],"mapped",[21517]],[[12949,12949],"mapped",[29305]],[[12950,12950],"mapped",[36001]],[[12951,12951],"mapped",[31069]],[[12952,12952],"mapped",[21172]],[[12953,12953],"mapped",[31192]],[[12954,12954],"mapped",[30007]],[[12955,12955],"mapped",[22899]],[[12956,12956],"mapped",[36969]],[[12957,12957],"mapped",[20778]],[[12958,12958],"mapped",[21360]],[[12959,12959],"mapped",[27880]],[[12960,12960],"mapped",[38917]],[[12961,12961],"mapped",[20241]],[[12962,12962],"mapped",[20889]],[[12963,12963],"mapped",[27491]],[[12964,12964],"mapped",[19978]],[[12965,12965],"mapped",[20013]],[[12966,12966],"mapped",[19979]],[[12967,12967],"mapped",[24038]],[[12968,12968],"mapped",[21491]],[[12969,12969],"mapped",[21307]],[[12970,12970],"mapped",[23447]],[[12971,12971],"mapped",[23398]],[[12972,12972],"mapped",[30435]],[[12973,12973],"mapped",[20225]],[[12974,12974],"mapped",[36039]],[[12975,12975],"mapped",[21332]],[[12976,12976],"mapped",[22812]],[[12977,12977],"mapped",[51,54]],[[12978,12978],"mapped",[51,55]],[[12979,12979],"mapped",[51,56]],[[12980,12980],"mapped",[51,57]],[[12981,12981],"mapped",[52,48]],[[12982,12982],"mapped",[52,49]],[[12983,12983],"mapped",[52,50]],[[12984,12984],"mapped",[52,51]],[[12985,12985],"mapped",[52,52]],[[12986,12986],"mapped",[52,53]],[[12987,12987],"mapped",[52,54]],[[12988,12988],"mapped",[52,55]],[[12989,12989],"mapped",[52,56]],[[12990,12990],"mapped",[52,57]],[[12991,12991],"mapped",[53,48]],[[12992,12992],"mapped",[49,26376]],[[12993,12993],"mapped",[50,26376]],[[12994,12994],"mapped",[51,26376]],[[12995,12995],"mapped",[52,26376]],[[12996,12996],"mapped",[53,26376]],[[12997,12997],"mapped",[54,26376]],[[12998,12998],"mapped",[55,26376]],[[12999,12999],"mapped",[56,26376]],[[13000,13000],"mapped",[57,26376]],[[13001,13001],"mapped",[49,48,26376]],[[13002,13002],"mapped",[49,49,26376]],[[13003,13003],"mapped",[49,50,26376]],[[13004,13004],"mapped",[104,103]],[[13005,13005],"mapped",[101,114,103]],[[13006,13006],"mapped",[101,118]],[[13007,13007],"mapped",[108,116,100]],[[13008,13008],"mapped",[12450]],[[13009,13009],"mapped",[12452]],[[13010,13010],"mapped",[12454]],[[13011,13011],"mapped",[12456]],[[13012,13012],"mapped",[12458]],[[13013,13013],"mapped",[12459]],[[13014,13014],"mapped",[12461]],[[13015,13015],"mapped",[12463]],[[13016,13016],"mapped",[12465]],[[13017,13017],"mapped",[12467]],[[13018,13018],"mapped",[12469]],[[13019,13019],"mapped",[12471]],[[13020,13020],"mapped",[12473]],[[13021,13021],"mapped",[12475]],[[13022,13022],"mapped",[12477]],[[13023,13023],"mapped",[12479]],[[13024,13024],"mapped",[12481]],[[13025,13025],"mapped",[12484]],[[13026,13026],"mapped",[12486]],[[13027,13027],"mapped",[12488]],[[13028,13028],"mapped",[12490]],[[13029,13029],"mapped",[12491]],[[13030,13030],"mapped",[12492]],[[13031,13031],"mapped",[12493]],[[13032,13032],"mapped",[12494]],[[13033,13033],"mapped",[12495]],[[13034,13034],"mapped",[12498]],[[13035,13035],"mapped",[12501]],[[13036,13036],"mapped",[12504]],[[13037,13037],"mapped",[12507]],[[13038,13038],"mapped",[12510]],[[13039,13039],"mapped",[12511]],[[13040,13040],"mapped",[12512]],[[13041,13041],"mapped",[12513]],[[13042,13042],"mapped",[12514]],[[13043,13043],"mapped",[12516]],[[13044,13044],"mapped",[12518]],[[13045,13045],"mapped",[12520]],[[13046,13046],"mapped",[12521]],[[13047,13047],"mapped",[12522]],[[13048,13048],"mapped",[12523]],[[13049,13049],"mapped",[12524]],[[13050,13050],"mapped",[12525]],[[13051,13051],"mapped",[12527]],[[13052,13052],"mapped",[12528]],[[13053,13053],"mapped",[12529]],[[13054,13054],"mapped",[12530]],[[13055,13055],"disallowed"],[[13056,13056],"mapped",[12450,12497,12540,12488]],[[13057,13057],"mapped",[12450,12523,12501,12449]],[[13058,13058],"mapped",[12450,12531,12506,12450]],[[13059,13059],"mapped",[12450,12540,12523]],[[13060,13060],"mapped",[12452,12491,12531,12464]],[[13061,13061],"mapped",[12452,12531,12481]],[[13062,13062],"mapped",[12454,12457,12531]],[[13063,13063],"mapped",[12456,12473,12463,12540,12489]],[[13064,13064],"mapped",[12456,12540,12459,12540]],[[13065,13065],"mapped",[12458,12531,12473]],[[13066,13066],"mapped",[12458,12540,12512]],[[13067,13067],"mapped",[12459,12452,12522]],[[13068,13068],"mapped",[12459,12521,12483,12488]],[[13069,13069],"mapped",[12459,12525,12522,12540]],[[13070,13070],"mapped",[12460,12525,12531]],[[13071,13071],"mapped",[12460,12531,12510]],[[13072,13072],"mapped",[12462,12460]],[[13073,13073],"mapped",[12462,12491,12540]],[[13074,13074],"mapped",[12461,12517,12522,12540]],[[13075,13075],"mapped",[12462,12523,12480,12540]],[[13076,13076],"mapped",[12461,12525]],[[13077,13077],"mapped",[12461,12525,12464,12521,12512]],[[13078,13078],"mapped",[12461,12525,12513,12540,12488,12523]],[[13079,13079],"mapped",[12461,12525,12527,12483,12488]],[[13080,13080],"mapped",[12464,12521,12512]],[[13081,13081],"mapped",[12464,12521,12512,12488,12531]],[[13082,13082],"mapped",[12463,12523,12476,12452,12525]],[[13083,13083],"mapped",[12463,12525,12540,12493]],[[13084,13084],"mapped",[12465,12540,12473]],[[13085,13085],"mapped",[12467,12523,12490]],[[13086,13086],"mapped",[12467,12540,12509]],[[13087,13087],"mapped",[12469,12452,12463,12523]],[[13088,13088],"mapped",[12469,12531,12481,12540,12512]],[[13089,13089],"mapped",[12471,12522,12531,12464]],[[13090,13090],"mapped",[12475,12531,12481]],[[13091,13091],"mapped",[12475,12531,12488]],[[13092,13092],"mapped",[12480,12540,12473]],[[13093,13093],"mapped",[12487,12471]],[[13094,13094],"mapped",[12489,12523]],[[13095,13095],"mapped",[12488,12531]],[[13096,13096],"mapped",[12490,12494]],[[13097,13097],"mapped",[12494,12483,12488]],[[13098,13098],"mapped",[12495,12452,12484]],[[13099,13099],"mapped",[12497,12540,12475,12531,12488]],[[13100,13100],"mapped",[12497,12540,12484]],[[13101,13101],"mapped",[12496,12540,12524,12523]],[[13102,13102],"mapped",[12500,12450,12473,12488,12523]],[[13103,13103],"mapped",[12500,12463,12523]],[[13104,13104],"mapped",[12500,12467]],[[13105,13105],"mapped",[12499,12523]],[[13106,13106],"mapped",[12501,12449,12521,12483,12489]],[[13107,13107],"mapped",[12501,12451,12540,12488]],[[13108,13108],"mapped",[12502,12483,12471,12455,12523]],[[13109,13109],"mapped",[12501,12521,12531]],[[13110,13110],"mapped",[12504,12463,12479,12540,12523]],[[13111,13111],"mapped",[12506,12477]],[[13112,13112],"mapped",[12506,12491,12498]],[[13113,13113],"mapped",[12504,12523,12484]],[[13114,13114],"mapped",[12506,12531,12473]],[[13115,13115],"mapped",[12506,12540,12472]],[[13116,13116],"mapped",[12505,12540,12479]],[[13117,13117],"mapped",[12509,12452,12531,12488]],[[13118,13118],"mapped",[12508,12523,12488]],[[13119,13119],"mapped",[12507,12531]],[[13120,13120],"mapped",[12509,12531,12489]],[[13121,13121],"mapped",[12507,12540,12523]],[[13122,13122],"mapped",[12507,12540,12531]],[[13123,13123],"mapped",[12510,12452,12463,12525]],[[13124,13124],"mapped",[12510,12452,12523]],[[13125,13125],"mapped",[12510,12483,12495]],[[13126,13126],"mapped",[12510,12523,12463]],[[13127,13127],"mapped",[12510,12531,12471,12519,12531]],[[13128,13128],"mapped",[12511,12463,12525,12531]],[[13129,13129],"mapped",[12511,12522]],[[13130,13130],"mapped",[12511,12522,12496,12540,12523]],[[13131,13131],"mapped",[12513,12460]],[[13132,13132],"mapped",[12513,12460,12488,12531]],[[13133,13133],"mapped",[12513,12540,12488,12523]],[[13134,13134],"mapped",[12516,12540,12489]],[[13135,13135],"mapped",[12516,12540,12523]],[[13136,13136],"mapped",[12518,12450,12531]],[[13137,13137],"mapped",[12522,12483,12488,12523]],[[13138,13138],"mapped",[12522,12521]],[[13139,13139],"mapped",[12523,12500,12540]],[[13140,13140],"mapped",[12523,12540,12502,12523]],[[13141,13141],"mapped",[12524,12512]],[[13142,13142],"mapped",[12524,12531,12488,12466,12531]],[[13143,13143],"mapped",[12527,12483,12488]],[[13144,13144],"mapped",[48,28857]],[[13145,13145],"mapped",[49,28857]],[[13146,13146],"mapped",[50,28857]],[[13147,13147],"mapped",[51,28857]],[[13148,13148],"mapped",[52,28857]],[[13149,13149],"mapped",[53,28857]],[[13150,13150],"mapped",[54,28857]],[[13151,13151],"mapped",[55,28857]],[[13152,13152],"mapped",[56,28857]],[[13153,13153],"mapped",[57,28857]],[[13154,13154],"mapped",[49,48,28857]],[[13155,13155],"mapped",[49,49,28857]],[[13156,13156],"mapped",[49,50,28857]],[[13157,13157],"mapped",[49,51,28857]],[[13158,13158],"mapped",[49,52,28857]],[[13159,13159],"mapped",[49,53,28857]],[[13160,13160],"mapped",[49,54,28857]],[[13161,13161],"mapped",[49,55,28857]],[[13162,13162],"mapped",[49,56,28857]],[[13163,13163],"mapped",[49,57,28857]],[[13164,13164],"mapped",[50,48,28857]],[[13165,13165],"mapped",[50,49,28857]],[[13166,13166],"mapped",[50,50,28857]],[[13167,13167],"mapped",[50,51,28857]],[[13168,13168],"mapped",[50,52,28857]],[[13169,13169],"mapped",[104,112,97]],[[13170,13170],"mapped",[100,97]],[[13171,13171],"mapped",[97,117]],[[13172,13172],"mapped",[98,97,114]],[[13173,13173],"mapped",[111,118]],[[13174,13174],"mapped",[112,99]],[[13175,13175],"mapped",[100,109]],[[13176,13176],"mapped",[100,109,50]],[[13177,13177],"mapped",[100,109,51]],[[13178,13178],"mapped",[105,117]],[[13179,13179],"mapped",[24179,25104]],[[13180,13180],"mapped",[26157,21644]],[[13181,13181],"mapped",[22823,27491]],[[13182,13182],"mapped",[26126,27835]],[[13183,13183],"mapped",[26666,24335,20250,31038]],[[13184,13184],"mapped",[112,97]],[[13185,13185],"mapped",[110,97]],[[13186,13186],"mapped",[956,97]],[[13187,13187],"mapped",[109,97]],[[13188,13188],"mapped",[107,97]],[[13189,13189],"mapped",[107,98]],[[13190,13190],"mapped",[109,98]],[[13191,13191],"mapped",[103,98]],[[13192,13192],"mapped",[99,97,108]],[[13193,13193],"mapped",[107,99,97,108]],[[13194,13194],"mapped",[112,102]],[[13195,13195],"mapped",[110,102]],[[13196,13196],"mapped",[956,102]],[[13197,13197],"mapped",[956,103]],[[13198,13198],"mapped",[109,103]],[[13199,13199],"mapped",[107,103]],[[13200,13200],"mapped",[104,122]],[[13201,13201],"mapped",[107,104,122]],[[13202,13202],"mapped",[109,104,122]],[[13203,13203],"mapped",[103,104,122]],[[13204,13204],"mapped",[116,104,122]],[[13205,13205],"mapped",[956,108]],[[13206,13206],"mapped",[109,108]],[[13207,13207],"mapped",[100,108]],[[13208,13208],"mapped",[107,108]],[[13209,13209],"mapped",[102,109]],[[13210,13210],"mapped",[110,109]],[[13211,13211],"mapped",[956,109]],[[13212,13212],"mapped",[109,109]],[[13213,13213],"mapped",[99,109]],[[13214,13214],"mapped",[107,109]],[[13215,13215],"mapped",[109,109,50]],[[13216,13216],"mapped",[99,109,50]],[[13217,13217],"mapped",[109,50]],[[13218,13218],"mapped",[107,109,50]],[[13219,13219],"mapped",[109,109,51]],[[13220,13220],"mapped",[99,109,51]],[[13221,13221],"mapped",[109,51]],[[13222,13222],"mapped",[107,109,51]],[[13223,13223],"mapped",[109,8725,115]],[[13224,13224],"mapped",[109,8725,115,50]],[[13225,13225],"mapped",[112,97]],[[13226,13226],"mapped",[107,112,97]],[[13227,13227],"mapped",[109,112,97]],[[13228,13228],"mapped",[103,112,97]],[[13229,13229],"mapped",[114,97,100]],[[13230,13230],"mapped",[114,97,100,8725,115]],[[13231,13231],"mapped",[114,97,100,8725,115,50]],[[13232,13232],"mapped",[112,115]],[[13233,13233],"mapped",[110,115]],[[13234,13234],"mapped",[956,115]],[[13235,13235],"mapped",[109,115]],[[13236,13236],"mapped",[112,118]],[[13237,13237],"mapped",[110,118]],[[13238,13238],"mapped",[956,118]],[[13239,13239],"mapped",[109,118]],[[13240,13240],"mapped",[107,118]],[[13241,13241],"mapped",[109,118]],[[13242,13242],"mapped",[112,119]],[[13243,13243],"mapped",[110,119]],[[13244,13244],"mapped",[956,119]],[[13245,13245],"mapped",[109,119]],[[13246,13246],"mapped",[107,119]],[[13247,13247],"mapped",[109,119]],[[13248,13248],"mapped",[107,969]],[[13249,13249],"mapped",[109,969]],[[13250,13250],"disallowed"],[[13251,13251],"mapped",[98,113]],[[13252,13252],"mapped",[99,99]],[[13253,13253],"mapped",[99,100]],[[13254,13254],"mapped",[99,8725,107,103]],[[13255,13255],"disallowed"],[[13256,13256],"mapped",[100,98]],[[13257,13257],"mapped",[103,121]],[[13258,13258],"mapped",[104,97]],[[13259,13259],"mapped",[104,112]],[[13260,13260],"mapped",[105,110]],[[13261,13261],"mapped",[107,107]],[[13262,13262],"mapped",[107,109]],[[13263,13263],"mapped",[107,116]],[[13264,13264],"mapped",[108,109]],[[13265,13265],"mapped",[108,110]],[[13266,13266],"mapped",[108,111,103]],[[13267,13267],"mapped",[108,120]],[[13268,13268],"mapped",[109,98]],[[13269,13269],"mapped",[109,105,108]],[[13270,13270],"mapped",[109,111,108]],[[13271,13271],"mapped",[112,104]],[[13272,13272],"disallowed"],[[13273,13273],"mapped",[112,112,109]],[[13274,13274],"mapped",[112,114]],[[13275,13275],"mapped",[115,114]],[[13276,13276],"mapped",[115,118]],[[13277,13277],"mapped",[119,98]],[[13278,13278],"mapped",[118,8725,109]],[[13279,13279],"mapped",[97,8725,109]],[[13280,13280],"mapped",[49,26085]],[[13281,13281],"mapped",[50,26085]],[[13282,13282],"mapped",[51,26085]],[[13283,13283],"mapped",[52,26085]],[[13284,13284],"mapped",[53,26085]],[[13285,13285],"mapped",[54,26085]],[[13286,13286],"mapped",[55,26085]],[[13287,13287],"mapped",[56,26085]],[[13288,13288],"mapped",[57,26085]],[[13289,13289],"mapped",[49,48,26085]],[[13290,13290],"mapped",[49,49,26085]],[[13291,13291],"mapped",[49,50,26085]],[[13292,13292],"mapped",[49,51,26085]],[[13293,13293],"mapped",[49,52,26085]],[[13294,13294],"mapped",[49,53,26085]],[[13295,13295],"mapped",[49,54,26085]],[[13296,13296],"mapped",[49,55,26085]],[[13297,13297],"mapped",[49,56,26085]],[[13298,13298],"mapped",[49,57,26085]],[[13299,13299],"mapped",[50,48,26085]],[[13300,13300],"mapped",[50,49,26085]],[[13301,13301],"mapped",[50,50,26085]],[[13302,13302],"mapped",[50,51,26085]],[[13303,13303],"mapped",[50,52,26085]],[[13304,13304],"mapped",[50,53,26085]],[[13305,13305],"mapped",[50,54,26085]],[[13306,13306],"mapped",[50,55,26085]],[[13307,13307],"mapped",[50,56,26085]],[[13308,13308],"mapped",[50,57,26085]],[[13309,13309],"mapped",[51,48,26085]],[[13310,13310],"mapped",[51,49,26085]],[[13311,13311],"mapped",[103,97,108]],[[13312,19893],"valid"],[[19894,19903],"disallowed"],[[19904,19967],"valid",[],"NV8"],[[19968,40869],"valid"],[[40870,40891],"valid"],[[40892,40899],"valid"],[[40900,40907],"valid"],[[40908,40908],"valid"],[[40909,40917],"valid"],[[40918,40959],"disallowed"],[[40960,42124],"valid"],[[42125,42127],"disallowed"],[[42128,42145],"valid",[],"NV8"],[[42146,42147],"valid",[],"NV8"],[[42148,42163],"valid",[],"NV8"],[[42164,42164],"valid",[],"NV8"],[[42165,42176],"valid",[],"NV8"],[[42177,42177],"valid",[],"NV8"],[[42178,42180],"valid",[],"NV8"],[[42181,42181],"valid",[],"NV8"],[[42182,42182],"valid",[],"NV8"],[[42183,42191],"disallowed"],[[42192,42237],"valid"],[[42238,42239],"valid",[],"NV8"],[[42240,42508],"valid"],[[42509,42511],"valid",[],"NV8"],[[42512,42539],"valid"],[[42540,42559],"disallowed"],[[42560,42560],"mapped",[42561]],[[42561,42561],"valid"],[[42562,42562],"mapped",[42563]],[[42563,42563],"valid"],[[42564,42564],"mapped",[42565]],[[42565,42565],"valid"],[[42566,42566],"mapped",[42567]],[[42567,42567],"valid"],[[42568,42568],"mapped",[42569]],[[42569,42569],"valid"],[[42570,42570],"mapped",[42571]],[[42571,42571],"valid"],[[42572,42572],"mapped",[42573]],[[42573,42573],"valid"],[[42574,42574],"mapped",[42575]],[[42575,42575],"valid"],[[42576,42576],"mapped",[42577]],[[42577,42577],"valid"],[[42578,42578],"mapped",[42579]],[[42579,42579],"valid"],[[42580,42580],"mapped",[42581]],[[42581,42581],"valid"],[[42582,42582],"mapped",[42583]],[[42583,42583],"valid"],[[42584,42584],"mapped",[42585]],[[42585,42585],"valid"],[[42586,42586],"mapped",[42587]],[[42587,42587],"valid"],[[42588,42588],"mapped",[42589]],[[42589,42589],"valid"],[[42590,42590],"mapped",[42591]],[[42591,42591],"valid"],[[42592,42592],"mapped",[42593]],[[42593,42593],"valid"],[[42594,42594],"mapped",[42595]],[[42595,42595],"valid"],[[42596,42596],"mapped",[42597]],[[42597,42597],"valid"],[[42598,42598],"mapped",[42599]],[[42599,42599],"valid"],[[42600,42600],"mapped",[42601]],[[42601,42601],"valid"],[[42602,42602],"mapped",[42603]],[[42603,42603],"valid"],[[42604,42604],"mapped",[42605]],[[42605,42607],"valid"],[[42608,42611],"valid",[],"NV8"],[[42612,42619],"valid"],[[42620,42621],"valid"],[[42622,42622],"valid",[],"NV8"],[[42623,42623],"valid"],[[42624,42624],"mapped",[42625]],[[42625,42625],"valid"],[[42626,42626],"mapped",[42627]],[[42627,42627],"valid"],[[42628,42628],"mapped",[42629]],[[42629,42629],"valid"],[[42630,42630],"mapped",[42631]],[[42631,42631],"valid"],[[42632,42632],"mapped",[42633]],[[42633,42633],"valid"],[[42634,42634],"mapped",[42635]],[[42635,42635],"valid"],[[42636,42636],"mapped",[42637]],[[42637,42637],"valid"],[[42638,42638],"mapped",[42639]],[[42639,42639],"valid"],[[42640,42640],"mapped",[42641]],[[42641,42641],"valid"],[[42642,42642],"mapped",[42643]],[[42643,42643],"valid"],[[42644,42644],"mapped",[42645]],[[42645,42645],"valid"],[[42646,42646],"mapped",[42647]],[[42647,42647],"valid"],[[42648,42648],"mapped",[42649]],[[42649,42649],"valid"],[[42650,42650],"mapped",[42651]],[[42651,42651],"valid"],[[42652,42652],"mapped",[1098]],[[42653,42653],"mapped",[1100]],[[42654,42654],"valid"],[[42655,42655],"valid"],[[42656,42725],"valid"],[[42726,42735],"valid",[],"NV8"],[[42736,42737],"valid"],[[42738,42743],"valid",[],"NV8"],[[42744,42751],"disallowed"],[[42752,42774],"valid",[],"NV8"],[[42775,42778],"valid"],[[42779,42783],"valid"],[[42784,42785],"valid",[],"NV8"],[[42786,42786],"mapped",[42787]],[[42787,42787],"valid"],[[42788,42788],"mapped",[42789]],[[42789,42789],"valid"],[[42790,42790],"mapped",[42791]],[[42791,42791],"valid"],[[42792,42792],"mapped",[42793]],[[42793,42793],"valid"],[[42794,42794],"mapped",[42795]],[[42795,42795],"valid"],[[42796,42796],"mapped",[42797]],[[42797,42797],"valid"],[[42798,42798],"mapped",[42799]],[[42799,42801],"valid"],[[42802,42802],"mapped",[42803]],[[42803,42803],"valid"],[[42804,42804],"mapped",[42805]],[[42805,42805],"valid"],[[42806,42806],"mapped",[42807]],[[42807,42807],"valid"],[[42808,42808],"mapped",[42809]],[[42809,42809],"valid"],[[42810,42810],"mapped",[42811]],[[42811,42811],"valid"],[[42812,42812],"mapped",[42813]],[[42813,42813],"valid"],[[42814,42814],"mapped",[42815]],[[42815,42815],"valid"],[[42816,42816],"mapped",[42817]],[[42817,42817],"valid"],[[42818,42818],"mapped",[42819]],[[42819,42819],"valid"],[[42820,42820],"mapped",[42821]],[[42821,42821],"valid"],[[42822,42822],"mapped",[42823]],[[42823,42823],"valid"],[[42824,42824],"mapped",[42825]],[[42825,42825],"valid"],[[42826,42826],"mapped",[42827]],[[42827,42827],"valid"],[[42828,42828],"mapped",[42829]],[[42829,42829],"valid"],[[42830,42830],"mapped",[42831]],[[42831,42831],"valid"],[[42832,42832],"mapped",[42833]],[[42833,42833],"valid"],[[42834,42834],"mapped",[42835]],[[42835,42835],"valid"],[[42836,42836],"mapped",[42837]],[[42837,42837],"valid"],[[42838,42838],"mapped",[42839]],[[42839,42839],"valid"],[[42840,42840],"mapped",[42841]],[[42841,42841],"valid"],[[42842,42842],"mapped",[42843]],[[42843,42843],"valid"],[[42844,42844],"mapped",[42845]],[[42845,42845],"valid"],[[42846,42846],"mapped",[42847]],[[42847,42847],"valid"],[[42848,42848],"mapped",[42849]],[[42849,42849],"valid"],[[42850,42850],"mapped",[42851]],[[42851,42851],"valid"],[[42852,42852],"mapped",[42853]],[[42853,42853],"valid"],[[42854,42854],"mapped",[42855]],[[42855,42855],"valid"],[[42856,42856],"mapped",[42857]],[[42857,42857],"valid"],[[42858,42858],"mapped",[42859]],[[42859,42859],"valid"],[[42860,42860],"mapped",[42861]],[[42861,42861],"valid"],[[42862,42862],"mapped",[42863]],[[42863,42863],"valid"],[[42864,42864],"mapped",[42863]],[[42865,42872],"valid"],[[42873,42873],"mapped",[42874]],[[42874,42874],"valid"],[[42875,42875],"mapped",[42876]],[[42876,42876],"valid"],[[42877,42877],"mapped",[7545]],[[42878,42878],"mapped",[42879]],[[42879,42879],"valid"],[[42880,42880],"mapped",[42881]],[[42881,42881],"valid"],[[42882,42882],"mapped",[42883]],[[42883,42883],"valid"],[[42884,42884],"mapped",[42885]],[[42885,42885],"valid"],[[42886,42886],"mapped",[42887]],[[42887,42888],"valid"],[[42889,42890],"valid",[],"NV8"],[[42891,42891],"mapped",[42892]],[[42892,42892],"valid"],[[42893,42893],"mapped",[613]],[[42894,42894],"valid"],[[42895,42895],"valid"],[[42896,42896],"mapped",[42897]],[[42897,42897],"valid"],[[42898,42898],"mapped",[42899]],[[42899,42899],"valid"],[[42900,42901],"valid"],[[42902,42902],"mapped",[42903]],[[42903,42903],"valid"],[[42904,42904],"mapped",[42905]],[[42905,42905],"valid"],[[42906,42906],"mapped",[42907]],[[42907,42907],"valid"],[[42908,42908],"mapped",[42909]],[[42909,42909],"valid"],[[42910,42910],"mapped",[42911]],[[42911,42911],"valid"],[[42912,42912],"mapped",[42913]],[[42913,42913],"valid"],[[42914,42914],"mapped",[42915]],[[42915,42915],"valid"],[[42916,42916],"mapped",[42917]],[[42917,42917],"valid"],[[42918,42918],"mapped",[42919]],[[42919,42919],"valid"],[[42920,42920],"mapped",[42921]],[[42921,42921],"valid"],[[42922,42922],"mapped",[614]],[[42923,42923],"mapped",[604]],[[42924,42924],"mapped",[609]],[[42925,42925],"mapped",[620]],[[42926,42927],"disallowed"],[[42928,42928],"mapped",[670]],[[42929,42929],"mapped",[647]],[[42930,42930],"mapped",[669]],[[42931,42931],"mapped",[43859]],[[42932,42932],"mapped",[42933]],[[42933,42933],"valid"],[[42934,42934],"mapped",[42935]],[[42935,42935],"valid"],[[42936,42998],"disallowed"],[[42999,42999],"valid"],[[43000,43000],"mapped",[295]],[[43001,43001],"mapped",[339]],[[43002,43002],"valid"],[[43003,43007],"valid"],[[43008,43047],"valid"],[[43048,43051],"valid",[],"NV8"],[[43052,43055],"disallowed"],[[43056,43065],"valid",[],"NV8"],[[43066,43071],"disallowed"],[[43072,43123],"valid"],[[43124,43127],"valid",[],"NV8"],[[43128,43135],"disallowed"],[[43136,43204],"valid"],[[43205,43213],"disallowed"],[[43214,43215],"valid",[],"NV8"],[[43216,43225],"valid"],[[43226,43231],"disallowed"],[[43232,43255],"valid"],[[43256,43258],"valid",[],"NV8"],[[43259,43259],"valid"],[[43260,43260],"valid",[],"NV8"],[[43261,43261],"valid"],[[43262,43263],"disallowed"],[[43264,43309],"valid"],[[43310,43311],"valid",[],"NV8"],[[43312,43347],"valid"],[[43348,43358],"disallowed"],[[43359,43359],"valid",[],"NV8"],[[43360,43388],"valid",[],"NV8"],[[43389,43391],"disallowed"],[[43392,43456],"valid"],[[43457,43469],"valid",[],"NV8"],[[43470,43470],"disallowed"],[[43471,43481],"valid"],[[43482,43485],"disallowed"],[[43486,43487],"valid",[],"NV8"],[[43488,43518],"valid"],[[43519,43519],"disallowed"],[[43520,43574],"valid"],[[43575,43583],"disallowed"],[[43584,43597],"valid"],[[43598,43599],"disallowed"],[[43600,43609],"valid"],[[43610,43611],"disallowed"],[[43612,43615],"valid",[],"NV8"],[[43616,43638],"valid"],[[43639,43641],"valid",[],"NV8"],[[43642,43643],"valid"],[[43644,43647],"valid"],[[43648,43714],"valid"],[[43715,43738],"disallowed"],[[43739,43741],"valid"],[[43742,43743],"valid",[],"NV8"],[[43744,43759],"valid"],[[43760,43761],"valid",[],"NV8"],[[43762,43766],"valid"],[[43767,43776],"disallowed"],[[43777,43782],"valid"],[[43783,43784],"disallowed"],[[43785,43790],"valid"],[[43791,43792],"disallowed"],[[43793,43798],"valid"],[[43799,43807],"disallowed"],[[43808,43814],"valid"],[[43815,43815],"disallowed"],[[43816,43822],"valid"],[[43823,43823],"disallowed"],[[43824,43866],"valid"],[[43867,43867],"valid",[],"NV8"],[[43868,43868],"mapped",[42791]],[[43869,43869],"mapped",[43831]],[[43870,43870],"mapped",[619]],[[43871,43871],"mapped",[43858]],[[43872,43875],"valid"],[[43876,43877],"valid"],[[43878,43887],"disallowed"],[[43888,43888],"mapped",[5024]],[[43889,43889],"mapped",[5025]],[[43890,43890],"mapped",[5026]],[[43891,43891],"mapped",[5027]],[[43892,43892],"mapped",[5028]],[[43893,43893],"mapped",[5029]],[[43894,43894],"mapped",[5030]],[[43895,43895],"mapped",[5031]],[[43896,43896],"mapped",[5032]],[[43897,43897],"mapped",[5033]],[[43898,43898],"mapped",[5034]],[[43899,43899],"mapped",[5035]],[[43900,43900],"mapped",[5036]],[[43901,43901],"mapped",[5037]],[[43902,43902],"mapped",[5038]],[[43903,43903],"mapped",[5039]],[[43904,43904],"mapped",[5040]],[[43905,43905],"mapped",[5041]],[[43906,43906],"mapped",[5042]],[[43907,43907],"mapped",[5043]],[[43908,43908],"mapped",[5044]],[[43909,43909],"mapped",[5045]],[[43910,43910],"mapped",[5046]],[[43911,43911],"mapped",[5047]],[[43912,43912],"mapped",[5048]],[[43913,43913],"mapped",[5049]],[[43914,43914],"mapped",[5050]],[[43915,43915],"mapped",[5051]],[[43916,43916],"mapped",[5052]],[[43917,43917],"mapped",[5053]],[[43918,43918],"mapped",[5054]],[[43919,43919],"mapped",[5055]],[[43920,43920],"mapped",[5056]],[[43921,43921],"mapped",[5057]],[[43922,43922],"mapped",[5058]],[[43923,43923],"mapped",[5059]],[[43924,43924],"mapped",[5060]],[[43925,43925],"mapped",[5061]],[[43926,43926],"mapped",[5062]],[[43927,43927],"mapped",[5063]],[[43928,43928],"mapped",[5064]],[[43929,43929],"mapped",[5065]],[[43930,43930],"mapped",[5066]],[[43931,43931],"mapped",[5067]],[[43932,43932],"mapped",[5068]],[[43933,43933],"mapped",[5069]],[[43934,43934],"mapped",[5070]],[[43935,43935],"mapped",[5071]],[[43936,43936],"mapped",[5072]],[[43937,43937],"mapped",[5073]],[[43938,43938],"mapped",[5074]],[[43939,43939],"mapped",[5075]],[[43940,43940],"mapped",[5076]],[[43941,43941],"mapped",[5077]],[[43942,43942],"mapped",[5078]],[[43943,43943],"mapped",[5079]],[[43944,43944],"mapped",[5080]],[[43945,43945],"mapped",[5081]],[[43946,43946],"mapped",[5082]],[[43947,43947],"mapped",[5083]],[[43948,43948],"mapped",[5084]],[[43949,43949],"mapped",[5085]],[[43950,43950],"mapped",[5086]],[[43951,43951],"mapped",[5087]],[[43952,43952],"mapped",[5088]],[[43953,43953],"mapped",[5089]],[[43954,43954],"mapped",[5090]],[[43955,43955],"mapped",[5091]],[[43956,43956],"mapped",[5092]],[[43957,43957],"mapped",[5093]],[[43958,43958],"mapped",[5094]],[[43959,43959],"mapped",[5095]],[[43960,43960],"mapped",[5096]],[[43961,43961],"mapped",[5097]],[[43962,43962],"mapped",[5098]],[[43963,43963],"mapped",[5099]],[[43964,43964],"mapped",[5100]],[[43965,43965],"mapped",[5101]],[[43966,43966],"mapped",[5102]],[[43967,43967],"mapped",[5103]],[[43968,44010],"valid"],[[44011,44011],"valid",[],"NV8"],[[44012,44013],"valid"],[[44014,44015],"disallowed"],[[44016,44025],"valid"],[[44026,44031],"disallowed"],[[44032,55203],"valid"],[[55204,55215],"disallowed"],[[55216,55238],"valid",[],"NV8"],[[55239,55242],"disallowed"],[[55243,55291],"valid",[],"NV8"],[[55292,55295],"disallowed"],[[55296,57343],"disallowed"],[[57344,63743],"disallowed"],[[63744,63744],"mapped",[35912]],[[63745,63745],"mapped",[26356]],[[63746,63746],"mapped",[36554]],[[63747,63747],"mapped",[36040]],[[63748,63748],"mapped",[28369]],[[63749,63749],"mapped",[20018]],[[63750,63750],"mapped",[21477]],[[63751,63752],"mapped",[40860]],[[63753,63753],"mapped",[22865]],[[63754,63754],"mapped",[37329]],[[63755,63755],"mapped",[21895]],[[63756,63756],"mapped",[22856]],[[63757,63757],"mapped",[25078]],[[63758,63758],"mapped",[30313]],[[63759,63759],"mapped",[32645]],[[63760,63760],"mapped",[34367]],[[63761,63761],"mapped",[34746]],[[63762,63762],"mapped",[35064]],[[63763,63763],"mapped",[37007]],[[63764,63764],"mapped",[27138]],[[63765,63765],"mapped",[27931]],[[63766,63766],"mapped",[28889]],[[63767,63767],"mapped",[29662]],[[63768,63768],"mapped",[33853]],[[63769,63769],"mapped",[37226]],[[63770,63770],"mapped",[39409]],[[63771,63771],"mapped",[20098]],[[63772,63772],"mapped",[21365]],[[63773,63773],"mapped",[27396]],[[63774,63774],"mapped",[29211]],[[63775,63775],"mapped",[34349]],[[63776,63776],"mapped",[40478]],[[63777,63777],"mapped",[23888]],[[63778,63778],"mapped",[28651]],[[63779,63779],"mapped",[34253]],[[63780,63780],"mapped",[35172]],[[63781,63781],"mapped",[25289]],[[63782,63782],"mapped",[33240]],[[63783,63783],"mapped",[34847]],[[63784,63784],"mapped",[24266]],[[63785,63785],"mapped",[26391]],[[63786,63786],"mapped",[28010]],[[63787,63787],"mapped",[29436]],[[63788,63788],"mapped",[37070]],[[63789,63789],"mapped",[20358]],[[63790,63790],"mapped",[20919]],[[63791,63791],"mapped",[21214]],[[63792,63792],"mapped",[25796]],[[63793,63793],"mapped",[27347]],[[63794,63794],"mapped",[29200]],[[63795,63795],"mapped",[30439]],[[63796,63796],"mapped",[32769]],[[63797,63797],"mapped",[34310]],[[63798,63798],"mapped",[34396]],[[63799,63799],"mapped",[36335]],[[63800,63800],"mapped",[38706]],[[63801,63801],"mapped",[39791]],[[63802,63802],"mapped",[40442]],[[63803,63803],"mapped",[30860]],[[63804,63804],"mapped",[31103]],[[63805,63805],"mapped",[32160]],[[63806,63806],"mapped",[33737]],[[63807,63807],"mapped",[37636]],[[63808,63808],"mapped",[40575]],[[63809,63809],"mapped",[35542]],[[63810,63810],"mapped",[22751]],[[63811,63811],"mapped",[24324]],[[63812,63812],"mapped",[31840]],[[63813,63813],"mapped",[32894]],[[63814,63814],"mapped",[29282]],[[63815,63815],"mapped",[30922]],[[63816,63816],"mapped",[36034]],[[63817,63817],"mapped",[38647]],[[63818,63818],"mapped",[22744]],[[63819,63819],"mapped",[23650]],[[63820,63820],"mapped",[27155]],[[63821,63821],"mapped",[28122]],[[63822,63822],"mapped",[28431]],[[63823,63823],"mapped",[32047]],[[63824,63824],"mapped",[32311]],[[63825,63825],"mapped",[38475]],[[63826,63826],"mapped",[21202]],[[63827,63827],"mapped",[32907]],[[63828,63828],"mapped",[20956]],[[63829,63829],"mapped",[20940]],[[63830,63830],"mapped",[31260]],[[63831,63831],"mapped",[32190]],[[63832,63832],"mapped",[33777]],[[63833,63833],"mapped",[38517]],[[63834,63834],"mapped",[35712]],[[63835,63835],"mapped",[25295]],[[63836,63836],"mapped",[27138]],[[63837,63837],"mapped",[35582]],[[63838,63838],"mapped",[20025]],[[63839,63839],"mapped",[23527]],[[63840,63840],"mapped",[24594]],[[63841,63841],"mapped",[29575]],[[63842,63842],"mapped",[30064]],[[63843,63843],"mapped",[21271]],[[63844,63844],"mapped",[30971]],[[63845,63845],"mapped",[20415]],[[63846,63846],"mapped",[24489]],[[63847,63847],"mapped",[19981]],[[63848,63848],"mapped",[27852]],[[63849,63849],"mapped",[25976]],[[63850,63850],"mapped",[32034]],[[63851,63851],"mapped",[21443]],[[63852,63852],"mapped",[22622]],[[63853,63853],"mapped",[30465]],[[63854,63854],"mapped",[33865]],[[63855,63855],"mapped",[35498]],[[63856,63856],"mapped",[27578]],[[63857,63857],"mapped",[36784]],[[63858,63858],"mapped",[27784]],[[63859,63859],"mapped",[25342]],[[63860,63860],"mapped",[33509]],[[63861,63861],"mapped",[25504]],[[63862,63862],"mapped",[30053]],[[63863,63863],"mapped",[20142]],[[63864,63864],"mapped",[20841]],[[63865,63865],"mapped",[20937]],[[63866,63866],"mapped",[26753]],[[63867,63867],"mapped",[31975]],[[63868,63868],"mapped",[33391]],[[63869,63869],"mapped",[35538]],[[63870,63870],"mapped",[37327]],[[63871,63871],"mapped",[21237]],[[63872,63872],"mapped",[21570]],[[63873,63873],"mapped",[22899]],[[63874,63874],"mapped",[24300]],[[63875,63875],"mapped",[26053]],[[63876,63876],"mapped",[28670]],[[63877,63877],"mapped",[31018]],[[63878,63878],"mapped",[38317]],[[63879,63879],"mapped",[39530]],[[63880,63880],"mapped",[40599]],[[63881,63881],"mapped",[40654]],[[63882,63882],"mapped",[21147]],[[63883,63883],"mapped",[26310]],[[63884,63884],"mapped",[27511]],[[63885,63885],"mapped",[36706]],[[63886,63886],"mapped",[24180]],[[63887,63887],"mapped",[24976]],[[63888,63888],"mapped",[25088]],[[63889,63889],"mapped",[25754]],[[63890,63890],"mapped",[28451]],[[63891,63891],"mapped",[29001]],[[63892,63892],"mapped",[29833]],[[63893,63893],"mapped",[31178]],[[63894,63894],"mapped",[32244]],[[63895,63895],"mapped",[32879]],[[63896,63896],"mapped",[36646]],[[63897,63897],"mapped",[34030]],[[63898,63898],"mapped",[36899]],[[63899,63899],"mapped",[37706]],[[63900,63900],"mapped",[21015]],[[63901,63901],"mapped",[21155]],[[63902,63902],"mapped",[21693]],[[63903,63903],"mapped",[28872]],[[63904,63904],"mapped",[35010]],[[63905,63905],"mapped",[35498]],[[63906,63906],"mapped",[24265]],[[63907,63907],"mapped",[24565]],[[63908,63908],"mapped",[25467]],[[63909,63909],"mapped",[27566]],[[63910,63910],"mapped",[31806]],[[63911,63911],"mapped",[29557]],[[63912,63912],"mapped",[20196]],[[63913,63913],"mapped",[22265]],[[63914,63914],"mapped",[23527]],[[63915,63915],"mapped",[23994]],[[63916,63916],"mapped",[24604]],[[63917,63917],"mapped",[29618]],[[63918,63918],"mapped",[29801]],[[63919,63919],"mapped",[32666]],[[63920,63920],"mapped",[32838]],[[63921,63921],"mapped",[37428]],[[63922,63922],"mapped",[38646]],[[63923,63923],"mapped",[38728]],[[63924,63924],"mapped",[38936]],[[63925,63925],"mapped",[20363]],[[63926,63926],"mapped",[31150]],[[63927,63927],"mapped",[37300]],[[63928,63928],"mapped",[38584]],[[63929,63929],"mapped",[24801]],[[63930,63930],"mapped",[20102]],[[63931,63931],"mapped",[20698]],[[63932,63932],"mapped",[23534]],[[63933,63933],"mapped",[23615]],[[63934,63934],"mapped",[26009]],[[63935,63935],"mapped",[27138]],[[63936,63936],"mapped",[29134]],[[63937,63937],"mapped",[30274]],[[63938,63938],"mapped",[34044]],[[63939,63939],"mapped",[36988]],[[63940,63940],"mapped",[40845]],[[63941,63941],"mapped",[26248]],[[63942,63942],"mapped",[38446]],[[63943,63943],"mapped",[21129]],[[63944,63944],"mapped",[26491]],[[63945,63945],"mapped",[26611]],[[63946,63946],"mapped",[27969]],[[63947,63947],"mapped",[28316]],[[63948,63948],"mapped",[29705]],[[63949,63949],"mapped",[30041]],[[63950,63950],"mapped",[30827]],[[63951,63951],"mapped",[32016]],[[63952,63952],"mapped",[39006]],[[63953,63953],"mapped",[20845]],[[63954,63954],"mapped",[25134]],[[63955,63955],"mapped",[38520]],[[63956,63956],"mapped",[20523]],[[63957,63957],"mapped",[23833]],[[63958,63958],"mapped",[28138]],[[63959,63959],"mapped",[36650]],[[63960,63960],"mapped",[24459]],[[63961,63961],"mapped",[24900]],[[63962,63962],"mapped",[26647]],[[63963,63963],"mapped",[29575]],[[63964,63964],"mapped",[38534]],[[63965,63965],"mapped",[21033]],[[63966,63966],"mapped",[21519]],[[63967,63967],"mapped",[23653]],[[63968,63968],"mapped",[26131]],[[63969,63969],"mapped",[26446]],[[63970,63970],"mapped",[26792]],[[63971,63971],"mapped",[27877]],[[63972,63972],"mapped",[29702]],[[63973,63973],"mapped",[30178]],[[63974,63974],"mapped",[32633]],[[63975,63975],"mapped",[35023]],[[63976,63976],"mapped",[35041]],[[63977,63977],"mapped",[37324]],[[63978,63978],"mapped",[38626]],[[63979,63979],"mapped",[21311]],[[63980,63980],"mapped",[28346]],[[63981,63981],"mapped",[21533]],[[63982,63982],"mapped",[29136]],[[63983,63983],"mapped",[29848]],[[63984,63984],"mapped",[34298]],[[63985,63985],"mapped",[38563]],[[63986,63986],"mapped",[40023]],[[63987,63987],"mapped",[40607]],[[63988,63988],"mapped",[26519]],[[63989,63989],"mapped",[28107]],[[63990,63990],"mapped",[33256]],[[63991,63991],"mapped",[31435]],[[63992,63992],"mapped",[31520]],[[63993,63993],"mapped",[31890]],[[63994,63994],"mapped",[29376]],[[63995,63995],"mapped",[28825]],[[63996,63996],"mapped",[35672]],[[63997,63997],"mapped",[20160]],[[63998,63998],"mapped",[33590]],[[63999,63999],"mapped",[21050]],[[64000,64000],"mapped",[20999]],[[64001,64001],"mapped",[24230]],[[64002,64002],"mapped",[25299]],[[64003,64003],"mapped",[31958]],[[64004,64004],"mapped",[23429]],[[64005,64005],"mapped",[27934]],[[64006,64006],"mapped",[26292]],[[64007,64007],"mapped",[36667]],[[64008,64008],"mapped",[34892]],[[64009,64009],"mapped",[38477]],[[64010,64010],"mapped",[35211]],[[64011,64011],"mapped",[24275]],[[64012,64012],"mapped",[20800]],[[64013,64013],"mapped",[21952]],[[64014,64015],"valid"],[[64016,64016],"mapped",[22618]],[[64017,64017],"valid"],[[64018,64018],"mapped",[26228]],[[64019,64020],"valid"],[[64021,64021],"mapped",[20958]],[[64022,64022],"mapped",[29482]],[[64023,64023],"mapped",[30410]],[[64024,64024],"mapped",[31036]],[[64025,64025],"mapped",[31070]],[[64026,64026],"mapped",[31077]],[[64027,64027],"mapped",[31119]],[[64028,64028],"mapped",[38742]],[[64029,64029],"mapped",[31934]],[[64030,64030],"mapped",[32701]],[[64031,64031],"valid"],[[64032,64032],"mapped",[34322]],[[64033,64033],"valid"],[[64034,64034],"mapped",[35576]],[[64035,64036],"valid"],[[64037,64037],"mapped",[36920]],[[64038,64038],"mapped",[37117]],[[64039,64041],"valid"],[[64042,64042],"mapped",[39151]],[[64043,64043],"mapped",[39164]],[[64044,64044],"mapped",[39208]],[[64045,64045],"mapped",[40372]],[[64046,64046],"mapped",[37086]],[[64047,64047],"mapped",[38583]],[[64048,64048],"mapped",[20398]],[[64049,64049],"mapped",[20711]],[[64050,64050],"mapped",[20813]],[[64051,64051],"mapped",[21193]],[[64052,64052],"mapped",[21220]],[[64053,64053],"mapped",[21329]],[[64054,64054],"mapped",[21917]],[[64055,64055],"mapped",[22022]],[[64056,64056],"mapped",[22120]],[[64057,64057],"mapped",[22592]],[[64058,64058],"mapped",[22696]],[[64059,64059],"mapped",[23652]],[[64060,64060],"mapped",[23662]],[[64061,64061],"mapped",[24724]],[[64062,64062],"mapped",[24936]],[[64063,64063],"mapped",[24974]],[[64064,64064],"mapped",[25074]],[[64065,64065],"mapped",[25935]],[[64066,64066],"mapped",[26082]],[[64067,64067],"mapped",[26257]],[[64068,64068],"mapped",[26757]],[[64069,64069],"mapped",[28023]],[[64070,64070],"mapped",[28186]],[[64071,64071],"mapped",[28450]],[[64072,64072],"mapped",[29038]],[[64073,64073],"mapped",[29227]],[[64074,64074],"mapped",[29730]],[[64075,64075],"mapped",[30865]],[[64076,64076],"mapped",[31038]],[[64077,64077],"mapped",[31049]],[[64078,64078],"mapped",[31048]],[[64079,64079],"mapped",[31056]],[[64080,64080],"mapped",[31062]],[[64081,64081],"mapped",[31069]],[[64082,64082],"mapped",[31117]],[[64083,64083],"mapped",[31118]],[[64084,64084],"mapped",[31296]],[[64085,64085],"mapped",[31361]],[[64086,64086],"mapped",[31680]],[[64087,64087],"mapped",[32244]],[[64088,64088],"mapped",[32265]],[[64089,64089],"mapped",[32321]],[[64090,64090],"mapped",[32626]],[[64091,64091],"mapped",[32773]],[[64092,64092],"mapped",[33261]],[[64093,64094],"mapped",[33401]],[[64095,64095],"mapped",[33879]],[[64096,64096],"mapped",[35088]],[[64097,64097],"mapped",[35222]],[[64098,64098],"mapped",[35585]],[[64099,64099],"mapped",[35641]],[[64100,64100],"mapped",[36051]],[[64101,64101],"mapped",[36104]],[[64102,64102],"mapped",[36790]],[[64103,64103],"mapped",[36920]],[[64104,64104],"mapped",[38627]],[[64105,64105],"mapped",[38911]],[[64106,64106],"mapped",[38971]],[[64107,64107],"mapped",[24693]],[[64108,64108],"mapped",[148206]],[[64109,64109],"mapped",[33304]],[[64110,64111],"disallowed"],[[64112,64112],"mapped",[20006]],[[64113,64113],"mapped",[20917]],[[64114,64114],"mapped",[20840]],[[64115,64115],"mapped",[20352]],[[64116,64116],"mapped",[20805]],[[64117,64117],"mapped",[20864]],[[64118,64118],"mapped",[21191]],[[64119,64119],"mapped",[21242]],[[64120,64120],"mapped",[21917]],[[64121,64121],"mapped",[21845]],[[64122,64122],"mapped",[21913]],[[64123,64123],"mapped",[21986]],[[64124,64124],"mapped",[22618]],[[64125,64125],"mapped",[22707]],[[64126,64126],"mapped",[22852]],[[64127,64127],"mapped",[22868]],[[64128,64128],"mapped",[23138]],[[64129,64129],"mapped",[23336]],[[64130,64130],"mapped",[24274]],[[64131,64131],"mapped",[24281]],[[64132,64132],"mapped",[24425]],[[64133,64133],"mapped",[24493]],[[64134,64134],"mapped",[24792]],[[64135,64135],"mapped",[24910]],[[64136,64136],"mapped",[24840]],[[64137,64137],"mapped",[24974]],[[64138,64138],"mapped",[24928]],[[64139,64139],"mapped",[25074]],[[64140,64140],"mapped",[25140]],[[64141,64141],"mapped",[25540]],[[64142,64142],"mapped",[25628]],[[64143,64143],"mapped",[25682]],[[64144,64144],"mapped",[25942]],[[64145,64145],"mapped",[26228]],[[64146,64146],"mapped",[26391]],[[64147,64147],"mapped",[26395]],[[64148,64148],"mapped",[26454]],[[64149,64149],"mapped",[27513]],[[64150,64150],"mapped",[27578]],[[64151,64151],"mapped",[27969]],[[64152,64152],"mapped",[28379]],[[64153,64153],"mapped",[28363]],[[64154,64154],"mapped",[28450]],[[64155,64155],"mapped",[28702]],[[64156,64156],"mapped",[29038]],[[64157,64157],"mapped",[30631]],[[64158,64158],"mapped",[29237]],[[64159,64159],"mapped",[29359]],[[64160,64160],"mapped",[29482]],[[64161,64161],"mapped",[29809]],[[64162,64162],"mapped",[29958]],[[64163,64163],"mapped",[30011]],[[64164,64164],"mapped",[30237]],[[64165,64165],"mapped",[30239]],[[64166,64166],"mapped",[30410]],[[64167,64167],"mapped",[30427]],[[64168,64168],"mapped",[30452]],[[64169,64169],"mapped",[30538]],[[64170,64170],"mapped",[30528]],[[64171,64171],"mapped",[30924]],[[64172,64172],"mapped",[31409]],[[64173,64173],"mapped",[31680]],[[64174,64174],"mapped",[31867]],[[64175,64175],"mapped",[32091]],[[64176,64176],"mapped",[32244]],[[64177,64177],"mapped",[32574]],[[64178,64178],"mapped",[32773]],[[64179,64179],"mapped",[33618]],[[64180,64180],"mapped",[33775]],[[64181,64181],"mapped",[34681]],[[64182,64182],"mapped",[35137]],[[64183,64183],"mapped",[35206]],[[64184,64184],"mapped",[35222]],[[64185,64185],"mapped",[35519]],[[64186,64186],"mapped",[35576]],[[64187,64187],"mapped",[35531]],[[64188,64188],"mapped",[35585]],[[64189,64189],"mapped",[35582]],[[64190,64190],"mapped",[35565]],[[64191,64191],"mapped",[35641]],[[64192,64192],"mapped",[35722]],[[64193,64193],"mapped",[36104]],[[64194,64194],"mapped",[36664]],[[64195,64195],"mapped",[36978]],[[64196,64196],"mapped",[37273]],[[64197,64197],"mapped",[37494]],[[64198,64198],"mapped",[38524]],[[64199,64199],"mapped",[38627]],[[64200,64200],"mapped",[38742]],[[64201,64201],"mapped",[38875]],[[64202,64202],"mapped",[38911]],[[64203,64203],"mapped",[38923]],[[64204,64204],"mapped",[38971]],[[64205,64205],"mapped",[39698]],[[64206,64206],"mapped",[40860]],[[64207,64207],"mapped",[141386]],[[64208,64208],"mapped",[141380]],[[64209,64209],"mapped",[144341]],[[64210,64210],"mapped",[15261]],[[64211,64211],"mapped",[16408]],[[64212,64212],"mapped",[16441]],[[64213,64213],"mapped",[152137]],[[64214,64214],"mapped",[154832]],[[64215,64215],"mapped",[163539]],[[64216,64216],"mapped",[40771]],[[64217,64217],"mapped",[40846]],[[64218,64255],"disallowed"],[[64256,64256],"mapped",[102,102]],[[64257,64257],"mapped",[102,105]],[[64258,64258],"mapped",[102,108]],[[64259,64259],"mapped",[102,102,105]],[[64260,64260],"mapped",[102,102,108]],[[64261,64262],"mapped",[115,116]],[[64263,64274],"disallowed"],[[64275,64275],"mapped",[1396,1398]],[[64276,64276],"mapped",[1396,1381]],[[64277,64277],"mapped",[1396,1387]],[[64278,64278],"mapped",[1406,1398]],[[64279,64279],"mapped",[1396,1389]],[[64280,64284],"disallowed"],[[64285,64285],"mapped",[1497,1460]],[[64286,64286],"valid"],[[64287,64287],"mapped",[1522,1463]],[[64288,64288],"mapped",[1506]],[[64289,64289],"mapped",[1488]],[[64290,64290],"mapped",[1491]],[[64291,64291],"mapped",[1492]],[[64292,64292],"mapped",[1499]],[[64293,64293],"mapped",[1500]],[[64294,64294],"mapped",[1501]],[[64295,64295],"mapped",[1512]],[[64296,64296],"mapped",[1514]],[[64297,64297],"disallowed_STD3_mapped",[43]],[[64298,64298],"mapped",[1513,1473]],[[64299,64299],"mapped",[1513,1474]],[[64300,64300],"mapped",[1513,1468,1473]],[[64301,64301],"mapped",[1513,1468,1474]],[[64302,64302],"mapped",[1488,1463]],[[64303,64303],"mapped",[1488,1464]],[[64304,64304],"mapped",[1488,1468]],[[64305,64305],"mapped",[1489,1468]],[[64306,64306],"mapped",[1490,1468]],[[64307,64307],"mapped",[1491,1468]],[[64308,64308],"mapped",[1492,1468]],[[64309,64309],"mapped",[1493,1468]],[[64310,64310],"mapped",[1494,1468]],[[64311,64311],"disallowed"],[[64312,64312],"mapped",[1496,1468]],[[64313,64313],"mapped",[1497,1468]],[[64314,64314],"mapped",[1498,1468]],[[64315,64315],"mapped",[1499,1468]],[[64316,64316],"mapped",[1500,1468]],[[64317,64317],"disallowed"],[[64318,64318],"mapped",[1502,1468]],[[64319,64319],"disallowed"],[[64320,64320],"mapped",[1504,1468]],[[64321,64321],"mapped",[1505,1468]],[[64322,64322],"disallowed"],[[64323,64323],"mapped",[1507,1468]],[[64324,64324],"mapped",[1508,1468]],[[64325,64325],"disallowed"],[[64326,64326],"mapped",[1510,1468]],[[64327,64327],"mapped",[1511,1468]],[[64328,64328],"mapped",[1512,1468]],[[64329,64329],"mapped",[1513,1468]],[[64330,64330],"mapped",[1514,1468]],[[64331,64331],"mapped",[1493,1465]],[[64332,64332],"mapped",[1489,1471]],[[64333,64333],"mapped",[1499,1471]],[[64334,64334],"mapped",[1508,1471]],[[64335,64335],"mapped",[1488,1500]],[[64336,64337],"mapped",[1649]],[[64338,64341],"mapped",[1659]],[[64342,64345],"mapped",[1662]],[[64346,64349],"mapped",[1664]],[[64350,64353],"mapped",[1658]],[[64354,64357],"mapped",[1663]],[[64358,64361],"mapped",[1657]],[[64362,64365],"mapped",[1700]],[[64366,64369],"mapped",[1702]],[[64370,64373],"mapped",[1668]],[[64374,64377],"mapped",[1667]],[[64378,64381],"mapped",[1670]],[[64382,64385],"mapped",[1671]],[[64386,64387],"mapped",[1677]],[[64388,64389],"mapped",[1676]],[[64390,64391],"mapped",[1678]],[[64392,64393],"mapped",[1672]],[[64394,64395],"mapped",[1688]],[[64396,64397],"mapped",[1681]],[[64398,64401],"mapped",[1705]],[[64402,64405],"mapped",[1711]],[[64406,64409],"mapped",[1715]],[[64410,64413],"mapped",[1713]],[[64414,64415],"mapped",[1722]],[[64416,64419],"mapped",[1723]],[[64420,64421],"mapped",[1728]],[[64422,64425],"mapped",[1729]],[[64426,64429],"mapped",[1726]],[[64430,64431],"mapped",[1746]],[[64432,64433],"mapped",[1747]],[[64434,64449],"valid",[],"NV8"],[[64450,64466],"disallowed"],[[64467,64470],"mapped",[1709]],[[64471,64472],"mapped",[1735]],[[64473,64474],"mapped",[1734]],[[64475,64476],"mapped",[1736]],[[64477,64477],"mapped",[1735,1652]],[[64478,64479],"mapped",[1739]],[[64480,64481],"mapped",[1733]],[[64482,64483],"mapped",[1737]],[[64484,64487],"mapped",[1744]],[[64488,64489],"mapped",[1609]],[[64490,64491],"mapped",[1574,1575]],[[64492,64493],"mapped",[1574,1749]],[[64494,64495],"mapped",[1574,1608]],[[64496,64497],"mapped",[1574,1735]],[[64498,64499],"mapped",[1574,1734]],[[64500,64501],"mapped",[1574,1736]],[[64502,64504],"mapped",[1574,1744]],[[64505,64507],"mapped",[1574,1609]],[[64508,64511],"mapped",[1740]],[[64512,64512],"mapped",[1574,1580]],[[64513,64513],"mapped",[1574,1581]],[[64514,64514],"mapped",[1574,1605]],[[64515,64515],"mapped",[1574,1609]],[[64516,64516],"mapped",[1574,1610]],[[64517,64517],"mapped",[1576,1580]],[[64518,64518],"mapped",[1576,1581]],[[64519,64519],"mapped",[1576,1582]],[[64520,64520],"mapped",[1576,1605]],[[64521,64521],"mapped",[1576,1609]],[[64522,64522],"mapped",[1576,1610]],[[64523,64523],"mapped",[1578,1580]],[[64524,64524],"mapped",[1578,1581]],[[64525,64525],"mapped",[1578,1582]],[[64526,64526],"mapped",[1578,1605]],[[64527,64527],"mapped",[1578,1609]],[[64528,64528],"mapped",[1578,1610]],[[64529,64529],"mapped",[1579,1580]],[[64530,64530],"mapped",[1579,1605]],[[64531,64531],"mapped",[1579,1609]],[[64532,64532],"mapped",[1579,1610]],[[64533,64533],"mapped",[1580,1581]],[[64534,64534],"mapped",[1580,1605]],[[64535,64535],"mapped",[1581,1580]],[[64536,64536],"mapped",[1581,1605]],[[64537,64537],"mapped",[1582,1580]],[[64538,64538],"mapped",[1582,1581]],[[64539,64539],"mapped",[1582,1605]],[[64540,64540],"mapped",[1587,1580]],[[64541,64541],"mapped",[1587,1581]],[[64542,64542],"mapped",[1587,1582]],[[64543,64543],"mapped",[1587,1605]],[[64544,64544],"mapped",[1589,1581]],[[64545,64545],"mapped",[1589,1605]],[[64546,64546],"mapped",[1590,1580]],[[64547,64547],"mapped",[1590,1581]],[[64548,64548],"mapped",[1590,1582]],[[64549,64549],"mapped",[1590,1605]],[[64550,64550],"mapped",[1591,1581]],[[64551,64551],"mapped",[1591,1605]],[[64552,64552],"mapped",[1592,1605]],[[64553,64553],"mapped",[1593,1580]],[[64554,64554],"mapped",[1593,1605]],[[64555,64555],"mapped",[1594,1580]],[[64556,64556],"mapped",[1594,1605]],[[64557,64557],"mapped",[1601,1580]],[[64558,64558],"mapped",[1601,1581]],[[64559,64559],"mapped",[1601,1582]],[[64560,64560],"mapped",[1601,1605]],[[64561,64561],"mapped",[1601,1609]],[[64562,64562],"mapped",[1601,1610]],[[64563,64563],"mapped",[1602,1581]],[[64564,64564],"mapped",[1602,1605]],[[64565,64565],"mapped",[1602,1609]],[[64566,64566],"mapped",[1602,1610]],[[64567,64567],"mapped",[1603,1575]],[[64568,64568],"mapped",[1603,1580]],[[64569,64569],"mapped",[1603,1581]],[[64570,64570],"mapped",[1603,1582]],[[64571,64571],"mapped",[1603,1604]],[[64572,64572],"mapped",[1603,1605]],[[64573,64573],"mapped",[1603,1609]],[[64574,64574],"mapped",[1603,1610]],[[64575,64575],"mapped",[1604,1580]],[[64576,64576],"mapped",[1604,1581]],[[64577,64577],"mapped",[1604,1582]],[[64578,64578],"mapped",[1604,1605]],[[64579,64579],"mapped",[1604,1609]],[[64580,64580],"mapped",[1604,1610]],[[64581,64581],"mapped",[1605,1580]],[[64582,64582],"mapped",[1605,1581]],[[64583,64583],"mapped",[1605,1582]],[[64584,64584],"mapped",[1605,1605]],[[64585,64585],"mapped",[1605,1609]],[[64586,64586],"mapped",[1605,1610]],[[64587,64587],"mapped",[1606,1580]],[[64588,64588],"mapped",[1606,1581]],[[64589,64589],"mapped",[1606,1582]],[[64590,64590],"mapped",[1606,1605]],[[64591,64591],"mapped",[1606,1609]],[[64592,64592],"mapped",[1606,1610]],[[64593,64593],"mapped",[1607,1580]],[[64594,64594],"mapped",[1607,1605]],[[64595,64595],"mapped",[1607,1609]],[[64596,64596],"mapped",[1607,1610]],[[64597,64597],"mapped",[1610,1580]],[[64598,64598],"mapped",[1610,1581]],[[64599,64599],"mapped",[1610,1582]],[[64600,64600],"mapped",[1610,1605]],[[64601,64601],"mapped",[1610,1609]],[[64602,64602],"mapped",[1610,1610]],[[64603,64603],"mapped",[1584,1648]],[[64604,64604],"mapped",[1585,1648]],[[64605,64605],"mapped",[1609,1648]],[[64606,64606],"disallowed_STD3_mapped",[32,1612,1617]],[[64607,64607],"disallowed_STD3_mapped",[32,1613,1617]],[[64608,64608],"disallowed_STD3_mapped",[32,1614,1617]],[[64609,64609],"disallowed_STD3_mapped",[32,1615,1617]],[[64610,64610],"disallowed_STD3_mapped",[32,1616,1617]],[[64611,64611],"disallowed_STD3_mapped",[32,1617,1648]],[[64612,64612],"mapped",[1574,1585]],[[64613,64613],"mapped",[1574,1586]],[[64614,64614],"mapped",[1574,1605]],[[64615,64615],"mapped",[1574,1606]],[[64616,64616],"mapped",[1574,1609]],[[64617,64617],"mapped",[1574,1610]],[[64618,64618],"mapped",[1576,1585]],[[64619,64619],"mapped",[1576,1586]],[[64620,64620],"mapped",[1576,1605]],[[64621,64621],"mapped",[1576,1606]],[[64622,64622],"mapped",[1576,1609]],[[64623,64623],"mapped",[1576,1610]],[[64624,64624],"mapped",[1578,1585]],[[64625,64625],"mapped",[1578,1586]],[[64626,64626],"mapped",[1578,1605]],[[64627,64627],"mapped",[1578,1606]],[[64628,64628],"mapped",[1578,1609]],[[64629,64629],"mapped",[1578,1610]],[[64630,64630],"mapped",[1579,1585]],[[64631,64631],"mapped",[1579,1586]],[[64632,64632],"mapped",[1579,1605]],[[64633,64633],"mapped",[1579,1606]],[[64634,64634],"mapped",[1579,1609]],[[64635,64635],"mapped",[1579,1610]],[[64636,64636],"mapped",[1601,1609]],[[64637,64637],"mapped",[1601,1610]],[[64638,64638],"mapped",[1602,1609]],[[64639,64639],"mapped",[1602,1610]],[[64640,64640],"mapped",[1603,1575]],[[64641,64641],"mapped",[1603,1604]],[[64642,64642],"mapped",[1603,1605]],[[64643,64643],"mapped",[1603,1609]],[[64644,64644],"mapped",[1603,1610]],[[64645,64645],"mapped",[1604,1605]],[[64646,64646],"mapped",[1604,1609]],[[64647,64647],"mapped",[1604,1610]],[[64648,64648],"mapped",[1605,1575]],[[64649,64649],"mapped",[1605,1605]],[[64650,64650],"mapped",[1606,1585]],[[64651,64651],"mapped",[1606,1586]],[[64652,64652],"mapped",[1606,1605]],[[64653,64653],"mapped",[1606,1606]],[[64654,64654],"mapped",[1606,1609]],[[64655,64655],"mapped",[1606,1610]],[[64656,64656],"mapped",[1609,1648]],[[64657,64657],"mapped",[1610,1585]],[[64658,64658],"mapped",[1610,1586]],[[64659,64659],"mapped",[1610,1605]],[[64660,64660],"mapped",[1610,1606]],[[64661,64661],"mapped",[1610,1609]],[[64662,64662],"mapped",[1610,1610]],[[64663,64663],"mapped",[1574,1580]],[[64664,64664],"mapped",[1574,1581]],[[64665,64665],"mapped",[1574,1582]],[[64666,64666],"mapped",[1574,1605]],[[64667,64667],"mapped",[1574,1607]],[[64668,64668],"mapped",[1576,1580]],[[64669,64669],"mapped",[1576,1581]],[[64670,64670],"mapped",[1576,1582]],[[64671,64671],"mapped",[1576,1605]],[[64672,64672],"mapped",[1576,1607]],[[64673,64673],"mapped",[1578,1580]],[[64674,64674],"mapped",[1578,1581]],[[64675,64675],"mapped",[1578,1582]],[[64676,64676],"mapped",[1578,1605]],[[64677,64677],"mapped",[1578,1607]],[[64678,64678],"mapped",[1579,1605]],[[64679,64679],"mapped",[1580,1581]],[[64680,64680],"mapped",[1580,1605]],[[64681,64681],"mapped",[1581,1580]],[[64682,64682],"mapped",[1581,1605]],[[64683,64683],"mapped",[1582,1580]],[[64684,64684],"mapped",[1582,1605]],[[64685,64685],"mapped",[1587,1580]],[[64686,64686],"mapped",[1587,1581]],[[64687,64687],"mapped",[1587,1582]],[[64688,64688],"mapped",[1587,1605]],[[64689,64689],"mapped",[1589,1581]],[[64690,64690],"mapped",[1589,1582]],[[64691,64691],"mapped",[1589,1605]],[[64692,64692],"mapped",[1590,1580]],[[64693,64693],"mapped",[1590,1581]],[[64694,64694],"mapped",[1590,1582]],[[64695,64695],"mapped",[1590,1605]],[[64696,64696],"mapped",[1591,1581]],[[64697,64697],"mapped",[1592,1605]],[[64698,64698],"mapped",[1593,1580]],[[64699,64699],"mapped",[1593,1605]],[[64700,64700],"mapped",[1594,1580]],[[64701,64701],"mapped",[1594,1605]],[[64702,64702],"mapped",[1601,1580]],[[64703,64703],"mapped",[1601,1581]],[[64704,64704],"mapped",[1601,1582]],[[64705,64705],"mapped",[1601,1605]],[[64706,64706],"mapped",[1602,1581]],[[64707,64707],"mapped",[1602,1605]],[[64708,64708],"mapped",[1603,1580]],[[64709,64709],"mapped",[1603,1581]],[[64710,64710],"mapped",[1603,1582]],[[64711,64711],"mapped",[1603,1604]],[[64712,64712],"mapped",[1603,1605]],[[64713,64713],"mapped",[1604,1580]],[[64714,64714],"mapped",[1604,1581]],[[64715,64715],"mapped",[1604,1582]],[[64716,64716],"mapped",[1604,1605]],[[64717,64717],"mapped",[1604,1607]],[[64718,64718],"mapped",[1605,1580]],[[64719,64719],"mapped",[1605,1581]],[[64720,64720],"mapped",[1605,1582]],[[64721,64721],"mapped",[1605,1605]],[[64722,64722],"mapped",[1606,1580]],[[64723,64723],"mapped",[1606,1581]],[[64724,64724],"mapped",[1606,1582]],[[64725,64725],"mapped",[1606,1605]],[[64726,64726],"mapped",[1606,1607]],[[64727,64727],"mapped",[1607,1580]],[[64728,64728],"mapped",[1607,1605]],[[64729,64729],"mapped",[1607,1648]],[[64730,64730],"mapped",[1610,1580]],[[64731,64731],"mapped",[1610,1581]],[[64732,64732],"mapped",[1610,1582]],[[64733,64733],"mapped",[1610,1605]],[[64734,64734],"mapped",[1610,1607]],[[64735,64735],"mapped",[1574,1605]],[[64736,64736],"mapped",[1574,1607]],[[64737,64737],"mapped",[1576,1605]],[[64738,64738],"mapped",[1576,1607]],[[64739,64739],"mapped",[1578,1605]],[[64740,64740],"mapped",[1578,1607]],[[64741,64741],"mapped",[1579,1605]],[[64742,64742],"mapped",[1579,1607]],[[64743,64743],"mapped",[1587,1605]],[[64744,64744],"mapped",[1587,1607]],[[64745,64745],"mapped",[1588,1605]],[[64746,64746],"mapped",[1588,1607]],[[64747,64747],"mapped",[1603,1604]],[[64748,64748],"mapped",[1603,1605]],[[64749,64749],"mapped",[1604,1605]],[[64750,64750],"mapped",[1606,1605]],[[64751,64751],"mapped",[1606,1607]],[[64752,64752],"mapped",[1610,1605]],[[64753,64753],"mapped",[1610,1607]],[[64754,64754],"mapped",[1600,1614,1617]],[[64755,64755],"mapped",[1600,1615,1617]],[[64756,64756],"mapped",[1600,1616,1617]],[[64757,64757],"mapped",[1591,1609]],[[64758,64758],"mapped",[1591,1610]],[[64759,64759],"mapped",[1593,1609]],[[64760,64760],"mapped",[1593,1610]],[[64761,64761],"mapped",[1594,1609]],[[64762,64762],"mapped",[1594,1610]],[[64763,64763],"mapped",[1587,1609]],[[64764,64764],"mapped",[1587,1610]],[[64765,64765],"mapped",[1588,1609]],[[64766,64766],"mapped",[1588,1610]],[[64767,64767],"mapped",[1581,1609]],[[64768,64768],"mapped",[1581,1610]],[[64769,64769],"mapped",[1580,1609]],[[64770,64770],"mapped",[1580,1610]],[[64771,64771],"mapped",[1582,1609]],[[64772,64772],"mapped",[1582,1610]],[[64773,64773],"mapped",[1589,1609]],[[64774,64774],"mapped",[1589,1610]],[[64775,64775],"mapped",[1590,1609]],[[64776,64776],"mapped",[1590,1610]],[[64777,64777],"mapped",[1588,1580]],[[64778,64778],"mapped",[1588,1581]],[[64779,64779],"mapped",[1588,1582]],[[64780,64780],"mapped",[1588,1605]],[[64781,64781],"mapped",[1588,1585]],[[64782,64782],"mapped",[1587,1585]],[[64783,64783],"mapped",[1589,1585]],[[64784,64784],"mapped",[1590,1585]],[[64785,64785],"mapped",[1591,1609]],[[64786,64786],"mapped",[1591,1610]],[[64787,64787],"mapped",[1593,1609]],[[64788,64788],"mapped",[1593,1610]],[[64789,64789],"mapped",[1594,1609]],[[64790,64790],"mapped",[1594,1610]],[[64791,64791],"mapped",[1587,1609]],[[64792,64792],"mapped",[1587,1610]],[[64793,64793],"mapped",[1588,1609]],[[64794,64794],"mapped",[1588,1610]],[[64795,64795],"mapped",[1581,1609]],[[64796,64796],"mapped",[1581,1610]],[[64797,64797],"mapped",[1580,1609]],[[64798,64798],"mapped",[1580,1610]],[[64799,64799],"mapped",[1582,1609]],[[64800,64800],"mapped",[1582,1610]],[[64801,64801],"mapped",[1589,1609]],[[64802,64802],"mapped",[1589,1610]],[[64803,64803],"mapped",[1590,1609]],[[64804,64804],"mapped",[1590,1610]],[[64805,64805],"mapped",[1588,1580]],[[64806,64806],"mapped",[1588,1581]],[[64807,64807],"mapped",[1588,1582]],[[64808,64808],"mapped",[1588,1605]],[[64809,64809],"mapped",[1588,1585]],[[64810,64810],"mapped",[1587,1585]],[[64811,64811],"mapped",[1589,1585]],[[64812,64812],"mapped",[1590,1585]],[[64813,64813],"mapped",[1588,1580]],[[64814,64814],"mapped",[1588,1581]],[[64815,64815],"mapped",[1588,1582]],[[64816,64816],"mapped",[1588,1605]],[[64817,64817],"mapped",[1587,1607]],[[64818,64818],"mapped",[1588,1607]],[[64819,64819],"mapped",[1591,1605]],[[64820,64820],"mapped",[1587,1580]],[[64821,64821],"mapped",[1587,1581]],[[64822,64822],"mapped",[1587,1582]],[[64823,64823],"mapped",[1588,1580]],[[64824,64824],"mapped",[1588,1581]],[[64825,64825],"mapped",[1588,1582]],[[64826,64826],"mapped",[1591,1605]],[[64827,64827],"mapped",[1592,1605]],[[64828,64829],"mapped",[1575,1611]],[[64830,64831],"valid",[],"NV8"],[[64832,64847],"disallowed"],[[64848,64848],"mapped",[1578,1580,1605]],[[64849,64850],"mapped",[1578,1581,1580]],[[64851,64851],"mapped",[1578,1581,1605]],[[64852,64852],"mapped",[1578,1582,1605]],[[64853,64853],"mapped",[1578,1605,1580]],[[64854,64854],"mapped",[1578,1605,1581]],[[64855,64855],"mapped",[1578,1605,1582]],[[64856,64857],"mapped",[1580,1605,1581]],[[64858,64858],"mapped",[1581,1605,1610]],[[64859,64859],"mapped",[1581,1605,1609]],[[64860,64860],"mapped",[1587,1581,1580]],[[64861,64861],"mapped",[1587,1580,1581]],[[64862,64862],"mapped",[1587,1580,1609]],[[64863,64864],"mapped",[1587,1605,1581]],[[64865,64865],"mapped",[1587,1605,1580]],[[64866,64867],"mapped",[1587,1605,1605]],[[64868,64869],"mapped",[1589,1581,1581]],[[64870,64870],"mapped",[1589,1605,1605]],[[64871,64872],"mapped",[1588,1581,1605]],[[64873,64873],"mapped",[1588,1580,1610]],[[64874,64875],"mapped",[1588,1605,1582]],[[64876,64877],"mapped",[1588,1605,1605]],[[64878,64878],"mapped",[1590,1581,1609]],[[64879,64880],"mapped",[1590,1582,1605]],[[64881,64882],"mapped",[1591,1605,1581]],[[64883,64883],"mapped",[1591,1605,1605]],[[64884,64884],"mapped",[1591,1605,1610]],[[64885,64885],"mapped",[1593,1580,1605]],[[64886,64887],"mapped",[1593,1605,1605]],[[64888,64888],"mapped",[1593,1605,1609]],[[64889,64889],"mapped",[1594,1605,1605]],[[64890,64890],"mapped",[1594,1605,1610]],[[64891,64891],"mapped",[1594,1605,1609]],[[64892,64893],"mapped",[1601,1582,1605]],[[64894,64894],"mapped",[1602,1605,1581]],[[64895,64895],"mapped",[1602,1605,1605]],[[64896,64896],"mapped",[1604,1581,1605]],[[64897,64897],"mapped",[1604,1581,1610]],[[64898,64898],"mapped",[1604,1581,1609]],[[64899,64900],"mapped",[1604,1580,1580]],[[64901,64902],"mapped",[1604,1582,1605]],[[64903,64904],"mapped",[1604,1605,1581]],[[64905,64905],"mapped",[1605,1581,1580]],[[64906,64906],"mapped",[1605,1581,1605]],[[64907,64907],"mapped",[1605,1581,1610]],[[64908,64908],"mapped",[1605,1580,1581]],[[64909,64909],"mapped",[1605,1580,1605]],[[64910,64910],"mapped",[1605,1582,1580]],[[64911,64911],"mapped",[1605,1582,1605]],[[64912,64913],"disallowed"],[[64914,64914],"mapped",[1605,1580,1582]],[[64915,64915],"mapped",[1607,1605,1580]],[[64916,64916],"mapped",[1607,1605,1605]],[[64917,64917],"mapped",[1606,1581,1605]],[[64918,64918],"mapped",[1606,1581,1609]],[[64919,64920],"mapped",[1606,1580,1605]],[[64921,64921],"mapped",[1606,1580,1609]],[[64922,64922],"mapped",[1606,1605,1610]],[[64923,64923],"mapped",[1606,1605,1609]],[[64924,64925],"mapped",[1610,1605,1605]],[[64926,64926],"mapped",[1576,1582,1610]],[[64927,64927],"mapped",[1578,1580,1610]],[[64928,64928],"mapped",[1578,1580,1609]],[[64929,64929],"mapped",[1578,1582,1610]],[[64930,64930],"mapped",[1578,1582,1609]],[[64931,64931],"mapped",[1578,1605,1610]],[[64932,64932],"mapped",[1578,1605,1609]],[[64933,64933],"mapped",[1580,1605,1610]],[[64934,64934],"mapped",[1580,1581,1609]],[[64935,64935],"mapped",[1580,1605,1609]],[[64936,64936],"mapped",[1587,1582,1609]],[[64937,64937],"mapped",[1589,1581,1610]],[[64938,64938],"mapped",[1588,1581,1610]],[[64939,64939],"mapped",[1590,1581,1610]],[[64940,64940],"mapped",[1604,1580,1610]],[[64941,64941],"mapped",[1604,1605,1610]],[[64942,64942],"mapped",[1610,1581,1610]],[[64943,64943],"mapped",[1610,1580,1610]],[[64944,64944],"mapped",[1610,1605,1610]],[[64945,64945],"mapped",[1605,1605,1610]],[[64946,64946],"mapped",[1602,1605,1610]],[[64947,64947],"mapped",[1606,1581,1610]],[[64948,64948],"mapped",[1602,1605,1581]],[[64949,64949],"mapped",[1604,1581,1605]],[[64950,64950],"mapped",[1593,1605,1610]],[[64951,64951],"mapped",[1603,1605,1610]],[[64952,64952],"mapped",[1606,1580,1581]],[[64953,64953],"mapped",[1605,1582,1610]],[[64954,64954],"mapped",[1604,1580,1605]],[[64955,64955],"mapped",[1603,1605,1605]],[[64956,64956],"mapped",[1604,1580,1605]],[[64957,64957],"mapped",[1606,1580,1581]],[[64958,64958],"mapped",[1580,1581,1610]],[[64959,64959],"mapped",[1581,1580,1610]],[[64960,64960],"mapped",[1605,1580,1610]],[[64961,64961],"mapped",[1601,1605,1610]],[[64962,64962],"mapped",[1576,1581,1610]],[[64963,64963],"mapped",[1603,1605,1605]],[[64964,64964],"mapped",[1593,1580,1605]],[[64965,64965],"mapped",[1589,1605,1605]],[[64966,64966],"mapped",[1587,1582,1610]],[[64967,64967],"mapped",[1606,1580,1610]],[[64968,64975],"disallowed"],[[64976,65007],"disallowed"],[[65008,65008],"mapped",[1589,1604,1746]],[[65009,65009],"mapped",[1602,1604,1746]],[[65010,65010],"mapped",[1575,1604,1604,1607]],[[65011,65011],"mapped",[1575,1603,1576,1585]],[[65012,65012],"mapped",[1605,1581,1605,1583]],[[65013,65013],"mapped",[1589,1604,1593,1605]],[[65014,65014],"mapped",[1585,1587,1608,1604]],[[65015,65015],"mapped",[1593,1604,1610,1607]],[[65016,65016],"mapped",[1608,1587,1604,1605]],[[65017,65017],"mapped",[1589,1604,1609]],[[65018,65018],"disallowed_STD3_mapped",[1589,1604,1609,32,1575,1604,1604,1607,32,1593,1604,1610,1607,32,1608,1587,1604,1605]],[[65019,65019],"disallowed_STD3_mapped",[1580,1604,32,1580,1604,1575,1604,1607]],[[65020,65020],"mapped",[1585,1740,1575,1604]],[[65021,65021],"valid",[],"NV8"],[[65022,65023],"disallowed"],[[65024,65039],"ignored"],[[65040,65040],"disallowed_STD3_mapped",[44]],[[65041,65041],"mapped",[12289]],[[65042,65042],"disallowed"],[[65043,65043],"disallowed_STD3_mapped",[58]],[[65044,65044],"disallowed_STD3_mapped",[59]],[[65045,65045],"disallowed_STD3_mapped",[33]],[[65046,65046],"disallowed_STD3_mapped",[63]],[[65047,65047],"mapped",[12310]],[[65048,65048],"mapped",[12311]],[[65049,65049],"disallowed"],[[65050,65055],"disallowed"],[[65056,65059],"valid"],[[65060,65062],"valid"],[[65063,65069],"valid"],[[65070,65071],"valid"],[[65072,65072],"disallowed"],[[65073,65073],"mapped",[8212]],[[65074,65074],"mapped",[8211]],[[65075,65076],"disallowed_STD3_mapped",[95]],[[65077,65077],"disallowed_STD3_mapped",[40]],[[65078,65078],"disallowed_STD3_mapped",[41]],[[65079,65079],"disallowed_STD3_mapped",[123]],[[65080,65080],"disallowed_STD3_mapped",[125]],[[65081,65081],"mapped",[12308]],[[65082,65082],"mapped",[12309]],[[65083,65083],"mapped",[12304]],[[65084,65084],"mapped",[12305]],[[65085,65085],"mapped",[12298]],[[65086,65086],"mapped",[12299]],[[65087,65087],"mapped",[12296]],[[65088,65088],"mapped",[12297]],[[65089,65089],"mapped",[12300]],[[65090,65090],"mapped",[12301]],[[65091,65091],"mapped",[12302]],[[65092,65092],"mapped",[12303]],[[65093,65094],"valid",[],"NV8"],[[65095,65095],"disallowed_STD3_mapped",[91]],[[65096,65096],"disallowed_STD3_mapped",[93]],[[65097,65100],"disallowed_STD3_mapped",[32,773]],[[65101,65103],"disallowed_STD3_mapped",[95]],[[65104,65104],"disallowed_STD3_mapped",[44]],[[65105,65105],"mapped",[12289]],[[65106,65106],"disallowed"],[[65107,65107],"disallowed"],[[65108,65108],"disallowed_STD3_mapped",[59]],[[65109,65109],"disallowed_STD3_mapped",[58]],[[65110,65110],"disallowed_STD3_mapped",[63]],[[65111,65111],"disallowed_STD3_mapped",[33]],[[65112,65112],"mapped",[8212]],[[65113,65113],"disallowed_STD3_mapped",[40]],[[65114,65114],"disallowed_STD3_mapped",[41]],[[65115,65115],"disallowed_STD3_mapped",[123]],[[65116,65116],"disallowed_STD3_mapped",[125]],[[65117,65117],"mapped",[12308]],[[65118,65118],"mapped",[12309]],[[65119,65119],"disallowed_STD3_mapped",[35]],[[65120,65120],"disallowed_STD3_mapped",[38]],[[65121,65121],"disallowed_STD3_mapped",[42]],[[65122,65122],"disallowed_STD3_mapped",[43]],[[65123,65123],"mapped",[45]],[[65124,65124],"disallowed_STD3_mapped",[60]],[[65125,65125],"disallowed_STD3_mapped",[62]],[[65126,65126],"disallowed_STD3_mapped",[61]],[[65127,65127],"disallowed"],[[65128,65128],"disallowed_STD3_mapped",[92]],[[65129,65129],"disallowed_STD3_mapped",[36]],[[65130,65130],"disallowed_STD3_mapped",[37]],[[65131,65131],"disallowed_STD3_mapped",[64]],[[65132,65135],"disallowed"],[[65136,65136],"disallowed_STD3_mapped",[32,1611]],[[65137,65137],"mapped",[1600,1611]],[[65138,65138],"disallowed_STD3_mapped",[32,1612]],[[65139,65139],"valid"],[[65140,65140],"disallowed_STD3_mapped",[32,1613]],[[65141,65141],"disallowed"],[[65142,65142],"disallowed_STD3_mapped",[32,1614]],[[65143,65143],"mapped",[1600,1614]],[[65144,65144],"disallowed_STD3_mapped",[32,1615]],[[65145,65145],"mapped",[1600,1615]],[[65146,65146],"disallowed_STD3_mapped",[32,1616]],[[65147,65147],"mapped",[1600,1616]],[[65148,65148],"disallowed_STD3_mapped",[32,1617]],[[65149,65149],"mapped",[1600,1617]],[[65150,65150],"disallowed_STD3_mapped",[32,1618]],[[65151,65151],"mapped",[1600,1618]],[[65152,65152],"mapped",[1569]],[[65153,65154],"mapped",[1570]],[[65155,65156],"mapped",[1571]],[[65157,65158],"mapped",[1572]],[[65159,65160],"mapped",[1573]],[[65161,65164],"mapped",[1574]],[[65165,65166],"mapped",[1575]],[[65167,65170],"mapped",[1576]],[[65171,65172],"mapped",[1577]],[[65173,65176],"mapped",[1578]],[[65177,65180],"mapped",[1579]],[[65181,65184],"mapped",[1580]],[[65185,65188],"mapped",[1581]],[[65189,65192],"mapped",[1582]],[[65193,65194],"mapped",[1583]],[[65195,65196],"mapped",[1584]],[[65197,65198],"mapped",[1585]],[[65199,65200],"mapped",[1586]],[[65201,65204],"mapped",[1587]],[[65205,65208],"mapped",[1588]],[[65209,65212],"mapped",[1589]],[[65213,65216],"mapped",[1590]],[[65217,65220],"mapped",[1591]],[[65221,65224],"mapped",[1592]],[[65225,65228],"mapped",[1593]],[[65229,65232],"mapped",[1594]],[[65233,65236],"mapped",[1601]],[[65237,65240],"mapped",[1602]],[[65241,65244],"mapped",[1603]],[[65245,65248],"mapped",[1604]],[[65249,65252],"mapped",[1605]],[[65253,65256],"mapped",[1606]],[[65257,65260],"mapped",[1607]],[[65261,65262],"mapped",[1608]],[[65263,65264],"mapped",[1609]],[[65265,65268],"mapped",[1610]],[[65269,65270],"mapped",[1604,1570]],[[65271,65272],"mapped",[1604,1571]],[[65273,65274],"mapped",[1604,1573]],[[65275,65276],"mapped",[1604,1575]],[[65277,65278],"disallowed"],[[65279,65279],"ignored"],[[65280,65280],"disallowed"],[[65281,65281],"disallowed_STD3_mapped",[33]],[[65282,65282],"disallowed_STD3_mapped",[34]],[[65283,65283],"disallowed_STD3_mapped",[35]],[[65284,65284],"disallowed_STD3_mapped",[36]],[[65285,65285],"disallowed_STD3_mapped",[37]],[[65286,65286],"disallowed_STD3_mapped",[38]],[[65287,65287],"disallowed_STD3_mapped",[39]],[[65288,65288],"disallowed_STD3_mapped",[40]],[[65289,65289],"disallowed_STD3_mapped",[41]],[[65290,65290],"disallowed_STD3_mapped",[42]],[[65291,65291],"disallowed_STD3_mapped",[43]],[[65292,65292],"disallowed_STD3_mapped",[44]],[[65293,65293],"mapped",[45]],[[65294,65294],"mapped",[46]],[[65295,65295],"disallowed_STD3_mapped",[47]],[[65296,65296],"mapped",[48]],[[65297,65297],"mapped",[49]],[[65298,65298],"mapped",[50]],[[65299,65299],"mapped",[51]],[[65300,65300],"mapped",[52]],[[65301,65301],"mapped",[53]],[[65302,65302],"mapped",[54]],[[65303,65303],"mapped",[55]],[[65304,65304],"mapped",[56]],[[65305,65305],"mapped",[57]],[[65306,65306],"disallowed_STD3_mapped",[58]],[[65307,65307],"disallowed_STD3_mapped",[59]],[[65308,65308],"disallowed_STD3_mapped",[60]],[[65309,65309],"disallowed_STD3_mapped",[61]],[[65310,65310],"disallowed_STD3_mapped",[62]],[[65311,65311],"disallowed_STD3_mapped",[63]],[[65312,65312],"disallowed_STD3_mapped",[64]],[[65313,65313],"mapped",[97]],[[65314,65314],"mapped",[98]],[[65315,65315],"mapped",[99]],[[65316,65316],"mapped",[100]],[[65317,65317],"mapped",[101]],[[65318,65318],"mapped",[102]],[[65319,65319],"mapped",[103]],[[65320,65320],"mapped",[104]],[[65321,65321],"mapped",[105]],[[65322,65322],"mapped",[106]],[[65323,65323],"mapped",[107]],[[65324,65324],"mapped",[108]],[[65325,65325],"mapped",[109]],[[65326,65326],"mapped",[110]],[[65327,65327],"mapped",[111]],[[65328,65328],"mapped",[112]],[[65329,65329],"mapped",[113]],[[65330,65330],"mapped",[114]],[[65331,65331],"mapped",[115]],[[65332,65332],"mapped",[116]],[[65333,65333],"mapped",[117]],[[65334,65334],"mapped",[118]],[[65335,65335],"mapped",[119]],[[65336,65336],"mapped",[120]],[[65337,65337],"mapped",[121]],[[65338,65338],"mapped",[122]],[[65339,65339],"disallowed_STD3_mapped",[91]],[[65340,65340],"disallowed_STD3_mapped",[92]],[[65341,65341],"disallowed_STD3_mapped",[93]],[[65342,65342],"disallowed_STD3_mapped",[94]],[[65343,65343],"disallowed_STD3_mapped",[95]],[[65344,65344],"disallowed_STD3_mapped",[96]],[[65345,65345],"mapped",[97]],[[65346,65346],"mapped",[98]],[[65347,65347],"mapped",[99]],[[65348,65348],"mapped",[100]],[[65349,65349],"mapped",[101]],[[65350,65350],"mapped",[102]],[[65351,65351],"mapped",[103]],[[65352,65352],"mapped",[104]],[[65353,65353],"mapped",[105]],[[65354,65354],"mapped",[106]],[[65355,65355],"mapped",[107]],[[65356,65356],"mapped",[108]],[[65357,65357],"mapped",[109]],[[65358,65358],"mapped",[110]],[[65359,65359],"mapped",[111]],[[65360,65360],"mapped",[112]],[[65361,65361],"mapped",[113]],[[65362,65362],"mapped",[114]],[[65363,65363],"mapped",[115]],[[65364,65364],"mapped",[116]],[[65365,65365],"mapped",[117]],[[65366,65366],"mapped",[118]],[[65367,65367],"mapped",[119]],[[65368,65368],"mapped",[120]],[[65369,65369],"mapped",[121]],[[65370,65370],"mapped",[122]],[[65371,65371],"disallowed_STD3_mapped",[123]],[[65372,65372],"disallowed_STD3_mapped",[124]],[[65373,65373],"disallowed_STD3_mapped",[125]],[[65374,65374],"disallowed_STD3_mapped",[126]],[[65375,65375],"mapped",[10629]],[[65376,65376],"mapped",[10630]],[[65377,65377],"mapped",[46]],[[65378,65378],"mapped",[12300]],[[65379,65379],"mapped",[12301]],[[65380,65380],"mapped",[12289]],[[65381,65381],"mapped",[12539]],[[65382,65382],"mapped",[12530]],[[65383,65383],"mapped",[12449]],[[65384,65384],"mapped",[12451]],[[65385,65385],"mapped",[12453]],[[65386,65386],"mapped",[12455]],[[65387,65387],"mapped",[12457]],[[65388,65388],"mapped",[12515]],[[65389,65389],"mapped",[12517]],[[65390,65390],"mapped",[12519]],[[65391,65391],"mapped",[12483]],[[65392,65392],"mapped",[12540]],[[65393,65393],"mapped",[12450]],[[65394,65394],"mapped",[12452]],[[65395,65395],"mapped",[12454]],[[65396,65396],"mapped",[12456]],[[65397,65397],"mapped",[12458]],[[65398,65398],"mapped",[12459]],[[65399,65399],"mapped",[12461]],[[65400,65400],"mapped",[12463]],[[65401,65401],"mapped",[12465]],[[65402,65402],"mapped",[12467]],[[65403,65403],"mapped",[12469]],[[65404,65404],"mapped",[12471]],[[65405,65405],"mapped",[12473]],[[65406,65406],"mapped",[12475]],[[65407,65407],"mapped",[12477]],[[65408,65408],"mapped",[12479]],[[65409,65409],"mapped",[12481]],[[65410,65410],"mapped",[12484]],[[65411,65411],"mapped",[12486]],[[65412,65412],"mapped",[12488]],[[65413,65413],"mapped",[12490]],[[65414,65414],"mapped",[12491]],[[65415,65415],"mapped",[12492]],[[65416,65416],"mapped",[12493]],[[65417,65417],"mapped",[12494]],[[65418,65418],"mapped",[12495]],[[65419,65419],"mapped",[12498]],[[65420,65420],"mapped",[12501]],[[65421,65421],"mapped",[12504]],[[65422,65422],"mapped",[12507]],[[65423,65423],"mapped",[12510]],[[65424,65424],"mapped",[12511]],[[65425,65425],"mapped",[12512]],[[65426,65426],"mapped",[12513]],[[65427,65427],"mapped",[12514]],[[65428,65428],"mapped",[12516]],[[65429,65429],"mapped",[12518]],[[65430,65430],"mapped",[12520]],[[65431,65431],"mapped",[12521]],[[65432,65432],"mapped",[12522]],[[65433,65433],"mapped",[12523]],[[65434,65434],"mapped",[12524]],[[65435,65435],"mapped",[12525]],[[65436,65436],"mapped",[12527]],[[65437,65437],"mapped",[12531]],[[65438,65438],"mapped",[12441]],[[65439,65439],"mapped",[12442]],[[65440,65440],"disallowed"],[[65441,65441],"mapped",[4352]],[[65442,65442],"mapped",[4353]],[[65443,65443],"mapped",[4522]],[[65444,65444],"mapped",[4354]],[[65445,65445],"mapped",[4524]],[[65446,65446],"mapped",[4525]],[[65447,65447],"mapped",[4355]],[[65448,65448],"mapped",[4356]],[[65449,65449],"mapped",[4357]],[[65450,65450],"mapped",[4528]],[[65451,65451],"mapped",[4529]],[[65452,65452],"mapped",[4530]],[[65453,65453],"mapped",[4531]],[[65454,65454],"mapped",[4532]],[[65455,65455],"mapped",[4533]],[[65456,65456],"mapped",[4378]],[[65457,65457],"mapped",[4358]],[[65458,65458],"mapped",[4359]],[[65459,65459],"mapped",[4360]],[[65460,65460],"mapped",[4385]],[[65461,65461],"mapped",[4361]],[[65462,65462],"mapped",[4362]],[[65463,65463],"mapped",[4363]],[[65464,65464],"mapped",[4364]],[[65465,65465],"mapped",[4365]],[[65466,65466],"mapped",[4366]],[[65467,65467],"mapped",[4367]],[[65468,65468],"mapped",[4368]],[[65469,65469],"mapped",[4369]],[[65470,65470],"mapped",[4370]],[[65471,65473],"disallowed"],[[65474,65474],"mapped",[4449]],[[65475,65475],"mapped",[4450]],[[65476,65476],"mapped",[4451]],[[65477,65477],"mapped",[4452]],[[65478,65478],"mapped",[4453]],[[65479,65479],"mapped",[4454]],[[65480,65481],"disallowed"],[[65482,65482],"mapped",[4455]],[[65483,65483],"mapped",[4456]],[[65484,65484],"mapped",[4457]],[[65485,65485],"mapped",[4458]],[[65486,65486],"mapped",[4459]],[[65487,65487],"mapped",[4460]],[[65488,65489],"disallowed"],[[65490,65490],"mapped",[4461]],[[65491,65491],"mapped",[4462]],[[65492,65492],"mapped",[4463]],[[65493,65493],"mapped",[4464]],[[65494,65494],"mapped",[4465]],[[65495,65495],"mapped",[4466]],[[65496,65497],"disallowed"],[[65498,65498],"mapped",[4467]],[[65499,65499],"mapped",[4468]],[[65500,65500],"mapped",[4469]],[[65501,65503],"disallowed"],[[65504,65504],"mapped",[162]],[[65505,65505],"mapped",[163]],[[65506,65506],"mapped",[172]],[[65507,65507],"disallowed_STD3_mapped",[32,772]],[[65508,65508],"mapped",[166]],[[65509,65509],"mapped",[165]],[[65510,65510],"mapped",[8361]],[[65511,65511],"disallowed"],[[65512,65512],"mapped",[9474]],[[65513,65513],"mapped",[8592]],[[65514,65514],"mapped",[8593]],[[65515,65515],"mapped",[8594]],[[65516,65516],"mapped",[8595]],[[65517,65517],"mapped",[9632]],[[65518,65518],"mapped",[9675]],[[65519,65528],"disallowed"],[[65529,65531],"disallowed"],[[65532,65532],"disallowed"],[[65533,65533],"disallowed"],[[65534,65535],"disallowed"],[[65536,65547],"valid"],[[65548,65548],"disallowed"],[[65549,65574],"valid"],[[65575,65575],"disallowed"],[[65576,65594],"valid"],[[65595,65595],"disallowed"],[[65596,65597],"valid"],[[65598,65598],"disallowed"],[[65599,65613],"valid"],[[65614,65615],"disallowed"],[[65616,65629],"valid"],[[65630,65663],"disallowed"],[[65664,65786],"valid"],[[65787,65791],"disallowed"],[[65792,65794],"valid",[],"NV8"],[[65795,65798],"disallowed"],[[65799,65843],"valid",[],"NV8"],[[65844,65846],"disallowed"],[[65847,65855],"valid",[],"NV8"],[[65856,65930],"valid",[],"NV8"],[[65931,65932],"valid",[],"NV8"],[[65933,65935],"disallowed"],[[65936,65947],"valid",[],"NV8"],[[65948,65951],"disallowed"],[[65952,65952],"valid",[],"NV8"],[[65953,65999],"disallowed"],[[66000,66044],"valid",[],"NV8"],[[66045,66045],"valid"],[[66046,66175],"disallowed"],[[66176,66204],"valid"],[[66205,66207],"disallowed"],[[66208,66256],"valid"],[[66257,66271],"disallowed"],[[66272,66272],"valid"],[[66273,66299],"valid",[],"NV8"],[[66300,66303],"disallowed"],[[66304,66334],"valid"],[[66335,66335],"valid"],[[66336,66339],"valid",[],"NV8"],[[66340,66351],"disallowed"],[[66352,66368],"valid"],[[66369,66369],"valid",[],"NV8"],[[66370,66377],"valid"],[[66378,66378],"valid",[],"NV8"],[[66379,66383],"disallowed"],[[66384,66426],"valid"],[[66427,66431],"disallowed"],[[66432,66461],"valid"],[[66462,66462],"disallowed"],[[66463,66463],"valid",[],"NV8"],[[66464,66499],"valid"],[[66500,66503],"disallowed"],[[66504,66511],"valid"],[[66512,66517],"valid",[],"NV8"],[[66518,66559],"disallowed"],[[66560,66560],"mapped",[66600]],[[66561,66561],"mapped",[66601]],[[66562,66562],"mapped",[66602]],[[66563,66563],"mapped",[66603]],[[66564,66564],"mapped",[66604]],[[66565,66565],"mapped",[66605]],[[66566,66566],"mapped",[66606]],[[66567,66567],"mapped",[66607]],[[66568,66568],"mapped",[66608]],[[66569,66569],"mapped",[66609]],[[66570,66570],"mapped",[66610]],[[66571,66571],"mapped",[66611]],[[66572,66572],"mapped",[66612]],[[66573,66573],"mapped",[66613]],[[66574,66574],"mapped",[66614]],[[66575,66575],"mapped",[66615]],[[66576,66576],"mapped",[66616]],[[66577,66577],"mapped",[66617]],[[66578,66578],"mapped",[66618]],[[66579,66579],"mapped",[66619]],[[66580,66580],"mapped",[66620]],[[66581,66581],"mapped",[66621]],[[66582,66582],"mapped",[66622]],[[66583,66583],"mapped",[66623]],[[66584,66584],"mapped",[66624]],[[66585,66585],"mapped",[66625]],[[66586,66586],"mapped",[66626]],[[66587,66587],"mapped",[66627]],[[66588,66588],"mapped",[66628]],[[66589,66589],"mapped",[66629]],[[66590,66590],"mapped",[66630]],[[66591,66591],"mapped",[66631]],[[66592,66592],"mapped",[66632]],[[66593,66593],"mapped",[66633]],[[66594,66594],"mapped",[66634]],[[66595,66595],"mapped",[66635]],[[66596,66596],"mapped",[66636]],[[66597,66597],"mapped",[66637]],[[66598,66598],"mapped",[66638]],[[66599,66599],"mapped",[66639]],[[66600,66637],"valid"],[[66638,66717],"valid"],[[66718,66719],"disallowed"],[[66720,66729],"valid"],[[66730,66815],"disallowed"],[[66816,66855],"valid"],[[66856,66863],"disallowed"],[[66864,66915],"valid"],[[66916,66926],"disallowed"],[[66927,66927],"valid",[],"NV8"],[[66928,67071],"disallowed"],[[67072,67382],"valid"],[[67383,67391],"disallowed"],[[67392,67413],"valid"],[[67414,67423],"disallowed"],[[67424,67431],"valid"],[[67432,67583],"disallowed"],[[67584,67589],"valid"],[[67590,67591],"disallowed"],[[67592,67592],"valid"],[[67593,67593],"disallowed"],[[67594,67637],"valid"],[[67638,67638],"disallowed"],[[67639,67640],"valid"],[[67641,67643],"disallowed"],[[67644,67644],"valid"],[[67645,67646],"disallowed"],[[67647,67647],"valid"],[[67648,67669],"valid"],[[67670,67670],"disallowed"],[[67671,67679],"valid",[],"NV8"],[[67680,67702],"valid"],[[67703,67711],"valid",[],"NV8"],[[67712,67742],"valid"],[[67743,67750],"disallowed"],[[67751,67759],"valid",[],"NV8"],[[67760,67807],"disallowed"],[[67808,67826],"valid"],[[67827,67827],"disallowed"],[[67828,67829],"valid"],[[67830,67834],"disallowed"],[[67835,67839],"valid",[],"NV8"],[[67840,67861],"valid"],[[67862,67865],"valid",[],"NV8"],[[67866,67867],"valid",[],"NV8"],[[67868,67870],"disallowed"],[[67871,67871],"valid",[],"NV8"],[[67872,67897],"valid"],[[67898,67902],"disallowed"],[[67903,67903],"valid",[],"NV8"],[[67904,67967],"disallowed"],[[67968,68023],"valid"],[[68024,68027],"disallowed"],[[68028,68029],"valid",[],"NV8"],[[68030,68031],"valid"],[[68032,68047],"valid",[],"NV8"],[[68048,68049],"disallowed"],[[68050,68095],"valid",[],"NV8"],[[68096,68099],"valid"],[[68100,68100],"disallowed"],[[68101,68102],"valid"],[[68103,68107],"disallowed"],[[68108,68115],"valid"],[[68116,68116],"disallowed"],[[68117,68119],"valid"],[[68120,68120],"disallowed"],[[68121,68147],"valid"],[[68148,68151],"disallowed"],[[68152,68154],"valid"],[[68155,68158],"disallowed"],[[68159,68159],"valid"],[[68160,68167],"valid",[],"NV8"],[[68168,68175],"disallowed"],[[68176,68184],"valid",[],"NV8"],[[68185,68191],"disallowed"],[[68192,68220],"valid"],[[68221,68223],"valid",[],"NV8"],[[68224,68252],"valid"],[[68253,68255],"valid",[],"NV8"],[[68256,68287],"disallowed"],[[68288,68295],"valid"],[[68296,68296],"valid",[],"NV8"],[[68297,68326],"valid"],[[68327,68330],"disallowed"],[[68331,68342],"valid",[],"NV8"],[[68343,68351],"disallowed"],[[68352,68405],"valid"],[[68406,68408],"disallowed"],[[68409,68415],"valid",[],"NV8"],[[68416,68437],"valid"],[[68438,68439],"disallowed"],[[68440,68447],"valid",[],"NV8"],[[68448,68466],"valid"],[[68467,68471],"disallowed"],[[68472,68479],"valid",[],"NV8"],[[68480,68497],"valid"],[[68498,68504],"disallowed"],[[68505,68508],"valid",[],"NV8"],[[68509,68520],"disallowed"],[[68521,68527],"valid",[],"NV8"],[[68528,68607],"disallowed"],[[68608,68680],"valid"],[[68681,68735],"disallowed"],[[68736,68736],"mapped",[68800]],[[68737,68737],"mapped",[68801]],[[68738,68738],"mapped",[68802]],[[68739,68739],"mapped",[68803]],[[68740,68740],"mapped",[68804]],[[68741,68741],"mapped",[68805]],[[68742,68742],"mapped",[68806]],[[68743,68743],"mapped",[68807]],[[68744,68744],"mapped",[68808]],[[68745,68745],"mapped",[68809]],[[68746,68746],"mapped",[68810]],[[68747,68747],"mapped",[68811]],[[68748,68748],"mapped",[68812]],[[68749,68749],"mapped",[68813]],[[68750,68750],"mapped",[68814]],[[68751,68751],"mapped",[68815]],[[68752,68752],"mapped",[68816]],[[68753,68753],"mapped",[68817]],[[68754,68754],"mapped",[68818]],[[68755,68755],"mapped",[68819]],[[68756,68756],"mapped",[68820]],[[68757,68757],"mapped",[68821]],[[68758,68758],"mapped",[68822]],[[68759,68759],"mapped",[68823]],[[68760,68760],"mapped",[68824]],[[68761,68761],"mapped",[68825]],[[68762,68762],"mapped",[68826]],[[68763,68763],"mapped",[68827]],[[68764,68764],"mapped",[68828]],[[68765,68765],"mapped",[68829]],[[68766,68766],"mapped",[68830]],[[68767,68767],"mapped",[68831]],[[68768,68768],"mapped",[68832]],[[68769,68769],"mapped",[68833]],[[68770,68770],"mapped",[68834]],[[68771,68771],"mapped",[68835]],[[68772,68772],"mapped",[68836]],[[68773,68773],"mapped",[68837]],[[68774,68774],"mapped",[68838]],[[68775,68775],"mapped",[68839]],[[68776,68776],"mapped",[68840]],[[68777,68777],"mapped",[68841]],[[68778,68778],"mapped",[68842]],[[68779,68779],"mapped",[68843]],[[68780,68780],"mapped",[68844]],[[68781,68781],"mapped",[68845]],[[68782,68782],"mapped",[68846]],[[68783,68783],"mapped",[68847]],[[68784,68784],"mapped",[68848]],[[68785,68785],"mapped",[68849]],[[68786,68786],"mapped",[68850]],[[68787,68799],"disallowed"],[[68800,68850],"valid"],[[68851,68857],"disallowed"],[[68858,68863],"valid",[],"NV8"],[[68864,69215],"disallowed"],[[69216,69246],"valid",[],"NV8"],[[69247,69631],"disallowed"],[[69632,69702],"valid"],[[69703,69709],"valid",[],"NV8"],[[69710,69713],"disallowed"],[[69714,69733],"valid",[],"NV8"],[[69734,69743],"valid"],[[69744,69758],"disallowed"],[[69759,69759],"valid"],[[69760,69818],"valid"],[[69819,69820],"valid",[],"NV8"],[[69821,69821],"disallowed"],[[69822,69825],"valid",[],"NV8"],[[69826,69839],"disallowed"],[[69840,69864],"valid"],[[69865,69871],"disallowed"],[[69872,69881],"valid"],[[69882,69887],"disallowed"],[[69888,69940],"valid"],[[69941,69941],"disallowed"],[[69942,69951],"valid"],[[69952,69955],"valid",[],"NV8"],[[69956,69967],"disallowed"],[[69968,70003],"valid"],[[70004,70005],"valid",[],"NV8"],[[70006,70006],"valid"],[[70007,70015],"disallowed"],[[70016,70084],"valid"],[[70085,70088],"valid",[],"NV8"],[[70089,70089],"valid",[],"NV8"],[[70090,70092],"valid"],[[70093,70093],"valid",[],"NV8"],[[70094,70095],"disallowed"],[[70096,70105],"valid"],[[70106,70106],"valid"],[[70107,70107],"valid",[],"NV8"],[[70108,70108],"valid"],[[70109,70111],"valid",[],"NV8"],[[70112,70112],"disallowed"],[[70113,70132],"valid",[],"NV8"],[[70133,70143],"disallowed"],[[70144,70161],"valid"],[[70162,70162],"disallowed"],[[70163,70199],"valid"],[[70200,70205],"valid",[],"NV8"],[[70206,70271],"disallowed"],[[70272,70278],"valid"],[[70279,70279],"disallowed"],[[70280,70280],"valid"],[[70281,70281],"disallowed"],[[70282,70285],"valid"],[[70286,70286],"disallowed"],[[70287,70301],"valid"],[[70302,70302],"disallowed"],[[70303,70312],"valid"],[[70313,70313],"valid",[],"NV8"],[[70314,70319],"disallowed"],[[70320,70378],"valid"],[[70379,70383],"disallowed"],[[70384,70393],"valid"],[[70394,70399],"disallowed"],[[70400,70400],"valid"],[[70401,70403],"valid"],[[70404,70404],"disallowed"],[[70405,70412],"valid"],[[70413,70414],"disallowed"],[[70415,70416],"valid"],[[70417,70418],"disallowed"],[[70419,70440],"valid"],[[70441,70441],"disallowed"],[[70442,70448],"valid"],[[70449,70449],"disallowed"],[[70450,70451],"valid"],[[70452,70452],"disallowed"],[[70453,70457],"valid"],[[70458,70459],"disallowed"],[[70460,70468],"valid"],[[70469,70470],"disallowed"],[[70471,70472],"valid"],[[70473,70474],"disallowed"],[[70475,70477],"valid"],[[70478,70479],"disallowed"],[[70480,70480],"valid"],[[70481,70486],"disallowed"],[[70487,70487],"valid"],[[70488,70492],"disallowed"],[[70493,70499],"valid"],[[70500,70501],"disallowed"],[[70502,70508],"valid"],[[70509,70511],"disallowed"],[[70512,70516],"valid"],[[70517,70783],"disallowed"],[[70784,70853],"valid"],[[70854,70854],"valid",[],"NV8"],[[70855,70855],"valid"],[[70856,70863],"disallowed"],[[70864,70873],"valid"],[[70874,71039],"disallowed"],[[71040,71093],"valid"],[[71094,71095],"disallowed"],[[71096,71104],"valid"],[[71105,71113],"valid",[],"NV8"],[[71114,71127],"valid",[],"NV8"],[[71128,71133],"valid"],[[71134,71167],"disallowed"],[[71168,71232],"valid"],[[71233,71235],"valid",[],"NV8"],[[71236,71236],"valid"],[[71237,71247],"disallowed"],[[71248,71257],"valid"],[[71258,71295],"disallowed"],[[71296,71351],"valid"],[[71352,71359],"disallowed"],[[71360,71369],"valid"],[[71370,71423],"disallowed"],[[71424,71449],"valid"],[[71450,71452],"disallowed"],[[71453,71467],"valid"],[[71468,71471],"disallowed"],[[71472,71481],"valid"],[[71482,71487],"valid",[],"NV8"],[[71488,71839],"disallowed"],[[71840,71840],"mapped",[71872]],[[71841,71841],"mapped",[71873]],[[71842,71842],"mapped",[71874]],[[71843,71843],"mapped",[71875]],[[71844,71844],"mapped",[71876]],[[71845,71845],"mapped",[71877]],[[71846,71846],"mapped",[71878]],[[71847,71847],"mapped",[71879]],[[71848,71848],"mapped",[71880]],[[71849,71849],"mapped",[71881]],[[71850,71850],"mapped",[71882]],[[71851,71851],"mapped",[71883]],[[71852,71852],"mapped",[71884]],[[71853,71853],"mapped",[71885]],[[71854,71854],"mapped",[71886]],[[71855,71855],"mapped",[71887]],[[71856,71856],"mapped",[71888]],[[71857,71857],"mapped",[71889]],[[71858,71858],"mapped",[71890]],[[71859,71859],"mapped",[71891]],[[71860,71860],"mapped",[71892]],[[71861,71861],"mapped",[71893]],[[71862,71862],"mapped",[71894]],[[71863,71863],"mapped",[71895]],[[71864,71864],"mapped",[71896]],[[71865,71865],"mapped",[71897]],[[71866,71866],"mapped",[71898]],[[71867,71867],"mapped",[71899]],[[71868,71868],"mapped",[71900]],[[71869,71869],"mapped",[71901]],[[71870,71870],"mapped",[71902]],[[71871,71871],"mapped",[71903]],[[71872,71913],"valid"],[[71914,71922],"valid",[],"NV8"],[[71923,71934],"disallowed"],[[71935,71935],"valid"],[[71936,72383],"disallowed"],[[72384,72440],"valid"],[[72441,73727],"disallowed"],[[73728,74606],"valid"],[[74607,74648],"valid"],[[74649,74649],"valid"],[[74650,74751],"disallowed"],[[74752,74850],"valid",[],"NV8"],[[74851,74862],"valid",[],"NV8"],[[74863,74863],"disallowed"],[[74864,74867],"valid",[],"NV8"],[[74868,74868],"valid",[],"NV8"],[[74869,74879],"disallowed"],[[74880,75075],"valid"],[[75076,77823],"disallowed"],[[77824,78894],"valid"],[[78895,82943],"disallowed"],[[82944,83526],"valid"],[[83527,92159],"disallowed"],[[92160,92728],"valid"],[[92729,92735],"disallowed"],[[92736,92766],"valid"],[[92767,92767],"disallowed"],[[92768,92777],"valid"],[[92778,92781],"disallowed"],[[92782,92783],"valid",[],"NV8"],[[92784,92879],"disallowed"],[[92880,92909],"valid"],[[92910,92911],"disallowed"],[[92912,92916],"valid"],[[92917,92917],"valid",[],"NV8"],[[92918,92927],"disallowed"],[[92928,92982],"valid"],[[92983,92991],"valid",[],"NV8"],[[92992,92995],"valid"],[[92996,92997],"valid",[],"NV8"],[[92998,93007],"disallowed"],[[93008,93017],"valid"],[[93018,93018],"disallowed"],[[93019,93025],"valid",[],"NV8"],[[93026,93026],"disallowed"],[[93027,93047],"valid"],[[93048,93052],"disallowed"],[[93053,93071],"valid"],[[93072,93951],"disallowed"],[[93952,94020],"valid"],[[94021,94031],"disallowed"],[[94032,94078],"valid"],[[94079,94094],"disallowed"],[[94095,94111],"valid"],[[94112,110591],"disallowed"],[[110592,110593],"valid"],[[110594,113663],"disallowed"],[[113664,113770],"valid"],[[113771,113775],"disallowed"],[[113776,113788],"valid"],[[113789,113791],"disallowed"],[[113792,113800],"valid"],[[113801,113807],"disallowed"],[[113808,113817],"valid"],[[113818,113819],"disallowed"],[[113820,113820],"valid",[],"NV8"],[[113821,113822],"valid"],[[113823,113823],"valid",[],"NV8"],[[113824,113827],"ignored"],[[113828,118783],"disallowed"],[[118784,119029],"valid",[],"NV8"],[[119030,119039],"disallowed"],[[119040,119078],"valid",[],"NV8"],[[119079,119080],"disallowed"],[[119081,119081],"valid",[],"NV8"],[[119082,119133],"valid",[],"NV8"],[[119134,119134],"mapped",[119127,119141]],[[119135,119135],"mapped",[119128,119141]],[[119136,119136],"mapped",[119128,119141,119150]],[[119137,119137],"mapped",[119128,119141,119151]],[[119138,119138],"mapped",[119128,119141,119152]],[[119139,119139],"mapped",[119128,119141,119153]],[[119140,119140],"mapped",[119128,119141,119154]],[[119141,119154],"valid",[],"NV8"],[[119155,119162],"disallowed"],[[119163,119226],"valid",[],"NV8"],[[119227,119227],"mapped",[119225,119141]],[[119228,119228],"mapped",[119226,119141]],[[119229,119229],"mapped",[119225,119141,119150]],[[119230,119230],"mapped",[119226,119141,119150]],[[119231,119231],"mapped",[119225,119141,119151]],[[119232,119232],"mapped",[119226,119141,119151]],[[119233,119261],"valid",[],"NV8"],[[119262,119272],"valid",[],"NV8"],[[119273,119295],"disallowed"],[[119296,119365],"valid",[],"NV8"],[[119366,119551],"disallowed"],[[119552,119638],"valid",[],"NV8"],[[119639,119647],"disallowed"],[[119648,119665],"valid",[],"NV8"],[[119666,119807],"disallowed"],[[119808,119808],"mapped",[97]],[[119809,119809],"mapped",[98]],[[119810,119810],"mapped",[99]],[[119811,119811],"mapped",[100]],[[119812,119812],"mapped",[101]],[[119813,119813],"mapped",[102]],[[119814,119814],"mapped",[103]],[[119815,119815],"mapped",[104]],[[119816,119816],"mapped",[105]],[[119817,119817],"mapped",[106]],[[119818,119818],"mapped",[107]],[[119819,119819],"mapped",[108]],[[119820,119820],"mapped",[109]],[[119821,119821],"mapped",[110]],[[119822,119822],"mapped",[111]],[[119823,119823],"mapped",[112]],[[119824,119824],"mapped",[113]],[[119825,119825],"mapped",[114]],[[119826,119826],"mapped",[115]],[[119827,119827],"mapped",[116]],[[119828,119828],"mapped",[117]],[[119829,119829],"mapped",[118]],[[119830,119830],"mapped",[119]],[[119831,119831],"mapped",[120]],[[119832,119832],"mapped",[121]],[[119833,119833],"mapped",[122]],[[119834,119834],"mapped",[97]],[[119835,119835],"mapped",[98]],[[119836,119836],"mapped",[99]],[[119837,119837],"mapped",[100]],[[119838,119838],"mapped",[101]],[[119839,119839],"mapped",[102]],[[119840,119840],"mapped",[103]],[[119841,119841],"mapped",[104]],[[119842,119842],"mapped",[105]],[[119843,119843],"mapped",[106]],[[119844,119844],"mapped",[107]],[[119845,119845],"mapped",[108]],[[119846,119846],"mapped",[109]],[[119847,119847],"mapped",[110]],[[119848,119848],"mapped",[111]],[[119849,119849],"mapped",[112]],[[119850,119850],"mapped",[113]],[[119851,119851],"mapped",[114]],[[119852,119852],"mapped",[115]],[[119853,119853],"mapped",[116]],[[119854,119854],"mapped",[117]],[[119855,119855],"mapped",[118]],[[119856,119856],"mapped",[119]],[[119857,119857],"mapped",[120]],[[119858,119858],"mapped",[121]],[[119859,119859],"mapped",[122]],[[119860,119860],"mapped",[97]],[[119861,119861],"mapped",[98]],[[119862,119862],"mapped",[99]],[[119863,119863],"mapped",[100]],[[119864,119864],"mapped",[101]],[[119865,119865],"mapped",[102]],[[119866,119866],"mapped",[103]],[[119867,119867],"mapped",[104]],[[119868,119868],"mapped",[105]],[[119869,119869],"mapped",[106]],[[119870,119870],"mapped",[107]],[[119871,119871],"mapped",[108]],[[119872,119872],"mapped",[109]],[[119873,119873],"mapped",[110]],[[119874,119874],"mapped",[111]],[[119875,119875],"mapped",[112]],[[119876,119876],"mapped",[113]],[[119877,119877],"mapped",[114]],[[119878,119878],"mapped",[115]],[[119879,119879],"mapped",[116]],[[119880,119880],"mapped",[117]],[[119881,119881],"mapped",[118]],[[119882,119882],"mapped",[119]],[[119883,119883],"mapped",[120]],[[119884,119884],"mapped",[121]],[[119885,119885],"mapped",[122]],[[119886,119886],"mapped",[97]],[[119887,119887],"mapped",[98]],[[119888,119888],"mapped",[99]],[[119889,119889],"mapped",[100]],[[119890,119890],"mapped",[101]],[[119891,119891],"mapped",[102]],[[119892,119892],"mapped",[103]],[[119893,119893],"disallowed"],[[119894,119894],"mapped",[105]],[[119895,119895],"mapped",[106]],[[119896,119896],"mapped",[107]],[[119897,119897],"mapped",[108]],[[119898,119898],"mapped",[109]],[[119899,119899],"mapped",[110]],[[119900,119900],"mapped",[111]],[[119901,119901],"mapped",[112]],[[119902,119902],"mapped",[113]],[[119903,119903],"mapped",[114]],[[119904,119904],"mapped",[115]],[[119905,119905],"mapped",[116]],[[119906,119906],"mapped",[117]],[[119907,119907],"mapped",[118]],[[119908,119908],"mapped",[119]],[[119909,119909],"mapped",[120]],[[119910,119910],"mapped",[121]],[[119911,119911],"mapped",[122]],[[119912,119912],"mapped",[97]],[[119913,119913],"mapped",[98]],[[119914,119914],"mapped",[99]],[[119915,119915],"mapped",[100]],[[119916,119916],"mapped",[101]],[[119917,119917],"mapped",[102]],[[119918,119918],"mapped",[103]],[[119919,119919],"mapped",[104]],[[119920,119920],"mapped",[105]],[[119921,119921],"mapped",[106]],[[119922,119922],"mapped",[107]],[[119923,119923],"mapped",[108]],[[119924,119924],"mapped",[109]],[[119925,119925],"mapped",[110]],[[119926,119926],"mapped",[111]],[[119927,119927],"mapped",[112]],[[119928,119928],"mapped",[113]],[[119929,119929],"mapped",[114]],[[119930,119930],"mapped",[115]],[[119931,119931],"mapped",[116]],[[119932,119932],"mapped",[117]],[[119933,119933],"mapped",[118]],[[119934,119934],"mapped",[119]],[[119935,119935],"mapped",[120]],[[119936,119936],"mapped",[121]],[[119937,119937],"mapped",[122]],[[119938,119938],"mapped",[97]],[[119939,119939],"mapped",[98]],[[119940,119940],"mapped",[99]],[[119941,119941],"mapped",[100]],[[119942,119942],"mapped",[101]],[[119943,119943],"mapped",[102]],[[119944,119944],"mapped",[103]],[[119945,119945],"mapped",[104]],[[119946,119946],"mapped",[105]],[[119947,119947],"mapped",[106]],[[119948,119948],"mapped",[107]],[[119949,119949],"mapped",[108]],[[119950,119950],"mapped",[109]],[[119951,119951],"mapped",[110]],[[119952,119952],"mapped",[111]],[[119953,119953],"mapped",[112]],[[119954,119954],"mapped",[113]],[[119955,119955],"mapped",[114]],[[119956,119956],"mapped",[115]],[[119957,119957],"mapped",[116]],[[119958,119958],"mapped",[117]],[[119959,119959],"mapped",[118]],[[119960,119960],"mapped",[119]],[[119961,119961],"mapped",[120]],[[119962,119962],"mapped",[121]],[[119963,119963],"mapped",[122]],[[119964,119964],"mapped",[97]],[[119965,119965],"disallowed"],[[119966,119966],"mapped",[99]],[[119967,119967],"mapped",[100]],[[119968,119969],"disallowed"],[[119970,119970],"mapped",[103]],[[119971,119972],"disallowed"],[[119973,119973],"mapped",[106]],[[119974,119974],"mapped",[107]],[[119975,119976],"disallowed"],[[119977,119977],"mapped",[110]],[[119978,119978],"mapped",[111]],[[119979,119979],"mapped",[112]],[[119980,119980],"mapped",[113]],[[119981,119981],"disallowed"],[[119982,119982],"mapped",[115]],[[119983,119983],"mapped",[116]],[[119984,119984],"mapped",[117]],[[119985,119985],"mapped",[118]],[[119986,119986],"mapped",[119]],[[119987,119987],"mapped",[120]],[[119988,119988],"mapped",[121]],[[119989,119989],"mapped",[122]],[[119990,119990],"mapped",[97]],[[119991,119991],"mapped",[98]],[[119992,119992],"mapped",[99]],[[119993,119993],"mapped",[100]],[[119994,119994],"disallowed"],[[119995,119995],"mapped",[102]],[[119996,119996],"disallowed"],[[119997,119997],"mapped",[104]],[[119998,119998],"mapped",[105]],[[119999,119999],"mapped",[106]],[[120000,120000],"mapped",[107]],[[120001,120001],"mapped",[108]],[[120002,120002],"mapped",[109]],[[120003,120003],"mapped",[110]],[[120004,120004],"disallowed"],[[120005,120005],"mapped",[112]],[[120006,120006],"mapped",[113]],[[120007,120007],"mapped",[114]],[[120008,120008],"mapped",[115]],[[120009,120009],"mapped",[116]],[[120010,120010],"mapped",[117]],[[120011,120011],"mapped",[118]],[[120012,120012],"mapped",[119]],[[120013,120013],"mapped",[120]],[[120014,120014],"mapped",[121]],[[120015,120015],"mapped",[122]],[[120016,120016],"mapped",[97]],[[120017,120017],"mapped",[98]],[[120018,120018],"mapped",[99]],[[120019,120019],"mapped",[100]],[[120020,120020],"mapped",[101]],[[120021,120021],"mapped",[102]],[[120022,120022],"mapped",[103]],[[120023,120023],"mapped",[104]],[[120024,120024],"mapped",[105]],[[120025,120025],"mapped",[106]],[[120026,120026],"mapped",[107]],[[120027,120027],"mapped",[108]],[[120028,120028],"mapped",[109]],[[120029,120029],"mapped",[110]],[[120030,120030],"mapped",[111]],[[120031,120031],"mapped",[112]],[[120032,120032],"mapped",[113]],[[120033,120033],"mapped",[114]],[[120034,120034],"mapped",[115]],[[120035,120035],"mapped",[116]],[[120036,120036],"mapped",[117]],[[120037,120037],"mapped",[118]],[[120038,120038],"mapped",[119]],[[120039,120039],"mapped",[120]],[[120040,120040],"mapped",[121]],[[120041,120041],"mapped",[122]],[[120042,120042],"mapped",[97]],[[120043,120043],"mapped",[98]],[[120044,120044],"mapped",[99]],[[120045,120045],"mapped",[100]],[[120046,120046],"mapped",[101]],[[120047,120047],"mapped",[102]],[[120048,120048],"mapped",[103]],[[120049,120049],"mapped",[104]],[[120050,120050],"mapped",[105]],[[120051,120051],"mapped",[106]],[[120052,120052],"mapped",[107]],[[120053,120053],"mapped",[108]],[[120054,120054],"mapped",[109]],[[120055,120055],"mapped",[110]],[[120056,120056],"mapped",[111]],[[120057,120057],"mapped",[112]],[[120058,120058],"mapped",[113]],[[120059,120059],"mapped",[114]],[[120060,120060],"mapped",[115]],[[120061,120061],"mapped",[116]],[[120062,120062],"mapped",[117]],[[120063,120063],"mapped",[118]],[[120064,120064],"mapped",[119]],[[120065,120065],"mapped",[120]],[[120066,120066],"mapped",[121]],[[120067,120067],"mapped",[122]],[[120068,120068],"mapped",[97]],[[120069,120069],"mapped",[98]],[[120070,120070],"disallowed"],[[120071,120071],"mapped",[100]],[[120072,120072],"mapped",[101]],[[120073,120073],"mapped",[102]],[[120074,120074],"mapped",[103]],[[120075,120076],"disallowed"],[[120077,120077],"mapped",[106]],[[120078,120078],"mapped",[107]],[[120079,120079],"mapped",[108]],[[120080,120080],"mapped",[109]],[[120081,120081],"mapped",[110]],[[120082,120082],"mapped",[111]],[[120083,120083],"mapped",[112]],[[120084,120084],"mapped",[113]],[[120085,120085],"disallowed"],[[120086,120086],"mapped",[115]],[[120087,120087],"mapped",[116]],[[120088,120088],"mapped",[117]],[[120089,120089],"mapped",[118]],[[120090,120090],"mapped",[119]],[[120091,120091],"mapped",[120]],[[120092,120092],"mapped",[121]],[[120093,120093],"disallowed"],[[120094,120094],"mapped",[97]],[[120095,120095],"mapped",[98]],[[120096,120096],"mapped",[99]],[[120097,120097],"mapped",[100]],[[120098,120098],"mapped",[101]],[[120099,120099],"mapped",[102]],[[120100,120100],"mapped",[103]],[[120101,120101],"mapped",[104]],[[120102,120102],"mapped",[105]],[[120103,120103],"mapped",[106]],[[120104,120104],"mapped",[107]],[[120105,120105],"mapped",[108]],[[120106,120106],"mapped",[109]],[[120107,120107],"mapped",[110]],[[120108,120108],"mapped",[111]],[[120109,120109],"mapped",[112]],[[120110,120110],"mapped",[113]],[[120111,120111],"mapped",[114]],[[120112,120112],"mapped",[115]],[[120113,120113],"mapped",[116]],[[120114,120114],"mapped",[117]],[[120115,120115],"mapped",[118]],[[120116,120116],"mapped",[119]],[[120117,120117],"mapped",[120]],[[120118,120118],"mapped",[121]],[[120119,120119],"mapped",[122]],[[120120,120120],"mapped",[97]],[[120121,120121],"mapped",[98]],[[120122,120122],"disallowed"],[[120123,120123],"mapped",[100]],[[120124,120124],"mapped",[101]],[[120125,120125],"mapped",[102]],[[120126,120126],"mapped",[103]],[[120127,120127],"disallowed"],[[120128,120128],"mapped",[105]],[[120129,120129],"mapped",[106]],[[120130,120130],"mapped",[107]],[[120131,120131],"mapped",[108]],[[120132,120132],"mapped",[109]],[[120133,120133],"disallowed"],[[120134,120134],"mapped",[111]],[[120135,120137],"disallowed"],[[120138,120138],"mapped",[115]],[[120139,120139],"mapped",[116]],[[120140,120140],"mapped",[117]],[[120141,120141],"mapped",[118]],[[120142,120142],"mapped",[119]],[[120143,120143],"mapped",[120]],[[120144,120144],"mapped",[121]],[[120145,120145],"disallowed"],[[120146,120146],"mapped",[97]],[[120147,120147],"mapped",[98]],[[120148,120148],"mapped",[99]],[[120149,120149],"mapped",[100]],[[120150,120150],"mapped",[101]],[[120151,120151],"mapped",[102]],[[120152,120152],"mapped",[103]],[[120153,120153],"mapped",[104]],[[120154,120154],"mapped",[105]],[[120155,120155],"mapped",[106]],[[120156,120156],"mapped",[107]],[[120157,120157],"mapped",[108]],[[120158,120158],"mapped",[109]],[[120159,120159],"mapped",[110]],[[120160,120160],"mapped",[111]],[[120161,120161],"mapped",[112]],[[120162,120162],"mapped",[113]],[[120163,120163],"mapped",[114]],[[120164,120164],"mapped",[115]],[[120165,120165],"mapped",[116]],[[120166,120166],"mapped",[117]],[[120167,120167],"mapped",[118]],[[120168,120168],"mapped",[119]],[[120169,120169],"mapped",[120]],[[120170,120170],"mapped",[121]],[[120171,120171],"mapped",[122]],[[120172,120172],"mapped",[97]],[[120173,120173],"mapped",[98]],[[120174,120174],"mapped",[99]],[[120175,120175],"mapped",[100]],[[120176,120176],"mapped",[101]],[[120177,120177],"mapped",[102]],[[120178,120178],"mapped",[103]],[[120179,120179],"mapped",[104]],[[120180,120180],"mapped",[105]],[[120181,120181],"mapped",[106]],[[120182,120182],"mapped",[107]],[[120183,120183],"mapped",[108]],[[120184,120184],"mapped",[109]],[[120185,120185],"mapped",[110]],[[120186,120186],"mapped",[111]],[[120187,120187],"mapped",[112]],[[120188,120188],"mapped",[113]],[[120189,120189],"mapped",[114]],[[120190,120190],"mapped",[115]],[[120191,120191],"mapped",[116]],[[120192,120192],"mapped",[117]],[[120193,120193],"mapped",[118]],[[120194,120194],"mapped",[119]],[[120195,120195],"mapped",[120]],[[120196,120196],"mapped",[121]],[[120197,120197],"mapped",[122]],[[120198,120198],"mapped",[97]],[[120199,120199],"mapped",[98]],[[120200,120200],"mapped",[99]],[[120201,120201],"mapped",[100]],[[120202,120202],"mapped",[101]],[[120203,120203],"mapped",[102]],[[120204,120204],"mapped",[103]],[[120205,120205],"mapped",[104]],[[120206,120206],"mapped",[105]],[[120207,120207],"mapped",[106]],[[120208,120208],"mapped",[107]],[[120209,120209],"mapped",[108]],[[120210,120210],"mapped",[109]],[[120211,120211],"mapped",[110]],[[120212,120212],"mapped",[111]],[[120213,120213],"mapped",[112]],[[120214,120214],"mapped",[113]],[[120215,120215],"mapped",[114]],[[120216,120216],"mapped",[115]],[[120217,120217],"mapped",[116]],[[120218,120218],"mapped",[117]],[[120219,120219],"mapped",[118]],[[120220,120220],"mapped",[119]],[[120221,120221],"mapped",[120]],[[120222,120222],"mapped",[121]],[[120223,120223],"mapped",[122]],[[120224,120224],"mapped",[97]],[[120225,120225],"mapped",[98]],[[120226,120226],"mapped",[99]],[[120227,120227],"mapped",[100]],[[120228,120228],"mapped",[101]],[[120229,120229],"mapped",[102]],[[120230,120230],"mapped",[103]],[[120231,120231],"mapped",[104]],[[120232,120232],"mapped",[105]],[[120233,120233],"mapped",[106]],[[120234,120234],"mapped",[107]],[[120235,120235],"mapped",[108]],[[120236,120236],"mapped",[109]],[[120237,120237],"mapped",[110]],[[120238,120238],"mapped",[111]],[[120239,120239],"mapped",[112]],[[120240,120240],"mapped",[113]],[[120241,120241],"mapped",[114]],[[120242,120242],"mapped",[115]],[[120243,120243],"mapped",[116]],[[120244,120244],"mapped",[117]],[[120245,120245],"mapped",[118]],[[120246,120246],"mapped",[119]],[[120247,120247],"mapped",[120]],[[120248,120248],"mapped",[121]],[[120249,120249],"mapped",[122]],[[120250,120250],"mapped",[97]],[[120251,120251],"mapped",[98]],[[120252,120252],"mapped",[99]],[[120253,120253],"mapped",[100]],[[120254,120254],"mapped",[101]],[[120255,120255],"mapped",[102]],[[120256,120256],"mapped",[103]],[[120257,120257],"mapped",[104]],[[120258,120258],"mapped",[105]],[[120259,120259],"mapped",[106]],[[120260,120260],"mapped",[107]],[[120261,120261],"mapped",[108]],[[120262,120262],"mapped",[109]],[[120263,120263],"mapped",[110]],[[120264,120264],"mapped",[111]],[[120265,120265],"mapped",[112]],[[120266,120266],"mapped",[113]],[[120267,120267],"mapped",[114]],[[120268,120268],"mapped",[115]],[[120269,120269],"mapped",[116]],[[120270,120270],"mapped",[117]],[[120271,120271],"mapped",[118]],[[120272,120272],"mapped",[119]],[[120273,120273],"mapped",[120]],[[120274,120274],"mapped",[121]],[[120275,120275],"mapped",[122]],[[120276,120276],"mapped",[97]],[[120277,120277],"mapped",[98]],[[120278,120278],"mapped",[99]],[[120279,120279],"mapped",[100]],[[120280,120280],"mapped",[101]],[[120281,120281],"mapped",[102]],[[120282,120282],"mapped",[103]],[[120283,120283],"mapped",[104]],[[120284,120284],"mapped",[105]],[[120285,120285],"mapped",[106]],[[120286,120286],"mapped",[107]],[[120287,120287],"mapped",[108]],[[120288,120288],"mapped",[109]],[[120289,120289],"mapped",[110]],[[120290,120290],"mapped",[111]],[[120291,120291],"mapped",[112]],[[120292,120292],"mapped",[113]],[[120293,120293],"mapped",[114]],[[120294,120294],"mapped",[115]],[[120295,120295],"mapped",[116]],[[120296,120296],"mapped",[117]],[[120297,120297],"mapped",[118]],[[120298,120298],"mapped",[119]],[[120299,120299],"mapped",[120]],[[120300,120300],"mapped",[121]],[[120301,120301],"mapped",[122]],[[120302,120302],"mapped",[97]],[[120303,120303],"mapped",[98]],[[120304,120304],"mapped",[99]],[[120305,120305],"mapped",[100]],[[120306,120306],"mapped",[101]],[[120307,120307],"mapped",[102]],[[120308,120308],"mapped",[103]],[[120309,120309],"mapped",[104]],[[120310,120310],"mapped",[105]],[[120311,120311],"mapped",[106]],[[120312,120312],"mapped",[107]],[[120313,120313],"mapped",[108]],[[120314,120314],"mapped",[109]],[[120315,120315],"mapped",[110]],[[120316,120316],"mapped",[111]],[[120317,120317],"mapped",[112]],[[120318,120318],"mapped",[113]],[[120319,120319],"mapped",[114]],[[120320,120320],"mapped",[115]],[[120321,120321],"mapped",[116]],[[120322,120322],"mapped",[117]],[[120323,120323],"mapped",[118]],[[120324,120324],"mapped",[119]],[[120325,120325],"mapped",[120]],[[120326,120326],"mapped",[121]],[[120327,120327],"mapped",[122]],[[120328,120328],"mapped",[97]],[[120329,120329],"mapped",[98]],[[120330,120330],"mapped",[99]],[[120331,120331],"mapped",[100]],[[120332,120332],"mapped",[101]],[[120333,120333],"mapped",[102]],[[120334,120334],"mapped",[103]],[[120335,120335],"mapped",[104]],[[120336,120336],"mapped",[105]],[[120337,120337],"mapped",[106]],[[120338,120338],"mapped",[107]],[[120339,120339],"mapped",[108]],[[120340,120340],"mapped",[109]],[[120341,120341],"mapped",[110]],[[120342,120342],"mapped",[111]],[[120343,120343],"mapped",[112]],[[120344,120344],"mapped",[113]],[[120345,120345],"mapped",[114]],[[120346,120346],"mapped",[115]],[[120347,120347],"mapped",[116]],[[120348,120348],"mapped",[117]],[[120349,120349],"mapped",[118]],[[120350,120350],"mapped",[119]],[[120351,120351],"mapped",[120]],[[120352,120352],"mapped",[121]],[[120353,120353],"mapped",[122]],[[120354,120354],"mapped",[97]],[[120355,120355],"mapped",[98]],[[120356,120356],"mapped",[99]],[[120357,120357],"mapped",[100]],[[120358,120358],"mapped",[101]],[[120359,120359],"mapped",[102]],[[120360,120360],"mapped",[103]],[[120361,120361],"mapped",[104]],[[120362,120362],"mapped",[105]],[[120363,120363],"mapped",[106]],[[120364,120364],"mapped",[107]],[[120365,120365],"mapped",[108]],[[120366,120366],"mapped",[109]],[[120367,120367],"mapped",[110]],[[120368,120368],"mapped",[111]],[[120369,120369],"mapped",[112]],[[120370,120370],"mapped",[113]],[[120371,120371],"mapped",[114]],[[120372,120372],"mapped",[115]],[[120373,120373],"mapped",[116]],[[120374,120374],"mapped",[117]],[[120375,120375],"mapped",[118]],[[120376,120376],"mapped",[119]],[[120377,120377],"mapped",[120]],[[120378,120378],"mapped",[121]],[[120379,120379],"mapped",[122]],[[120380,120380],"mapped",[97]],[[120381,120381],"mapped",[98]],[[120382,120382],"mapped",[99]],[[120383,120383],"mapped",[100]],[[120384,120384],"mapped",[101]],[[120385,120385],"mapped",[102]],[[120386,120386],"mapped",[103]],[[120387,120387],"mapped",[104]],[[120388,120388],"mapped",[105]],[[120389,120389],"mapped",[106]],[[120390,120390],"mapped",[107]],[[120391,120391],"mapped",[108]],[[120392,120392],"mapped",[109]],[[120393,120393],"mapped",[110]],[[120394,120394],"mapped",[111]],[[120395,120395],"mapped",[112]],[[120396,120396],"mapped",[113]],[[120397,120397],"mapped",[114]],[[120398,120398],"mapped",[115]],[[120399,120399],"mapped",[116]],[[120400,120400],"mapped",[117]],[[120401,120401],"mapped",[118]],[[120402,120402],"mapped",[119]],[[120403,120403],"mapped",[120]],[[120404,120404],"mapped",[121]],[[120405,120405],"mapped",[122]],[[120406,120406],"mapped",[97]],[[120407,120407],"mapped",[98]],[[120408,120408],"mapped",[99]],[[120409,120409],"mapped",[100]],[[120410,120410],"mapped",[101]],[[120411,120411],"mapped",[102]],[[120412,120412],"mapped",[103]],[[120413,120413],"mapped",[104]],[[120414,120414],"mapped",[105]],[[120415,120415],"mapped",[106]],[[120416,120416],"mapped",[107]],[[120417,120417],"mapped",[108]],[[120418,120418],"mapped",[109]],[[120419,120419],"mapped",[110]],[[120420,120420],"mapped",[111]],[[120421,120421],"mapped",[112]],[[120422,120422],"mapped",[113]],[[120423,120423],"mapped",[114]],[[120424,120424],"mapped",[115]],[[120425,120425],"mapped",[116]],[[120426,120426],"mapped",[117]],[[120427,120427],"mapped",[118]],[[120428,120428],"mapped",[119]],[[120429,120429],"mapped",[120]],[[120430,120430],"mapped",[121]],[[120431,120431],"mapped",[122]],[[120432,120432],"mapped",[97]],[[120433,120433],"mapped",[98]],[[120434,120434],"mapped",[99]],[[120435,120435],"mapped",[100]],[[120436,120436],"mapped",[101]],[[120437,120437],"mapped",[102]],[[120438,120438],"mapped",[103]],[[120439,120439],"mapped",[104]],[[120440,120440],"mapped",[105]],[[120441,120441],"mapped",[106]],[[120442,120442],"mapped",[107]],[[120443,120443],"mapped",[108]],[[120444,120444],"mapped",[109]],[[120445,120445],"mapped",[110]],[[120446,120446],"mapped",[111]],[[120447,120447],"mapped",[112]],[[120448,120448],"mapped",[113]],[[120449,120449],"mapped",[114]],[[120450,120450],"mapped",[115]],[[120451,120451],"mapped",[116]],[[120452,120452],"mapped",[117]],[[120453,120453],"mapped",[118]],[[120454,120454],"mapped",[119]],[[120455,120455],"mapped",[120]],[[120456,120456],"mapped",[121]],[[120457,120457],"mapped",[122]],[[120458,120458],"mapped",[97]],[[120459,120459],"mapped",[98]],[[120460,120460],"mapped",[99]],[[120461,120461],"mapped",[100]],[[120462,120462],"mapped",[101]],[[120463,120463],"mapped",[102]],[[120464,120464],"mapped",[103]],[[120465,120465],"mapped",[104]],[[120466,120466],"mapped",[105]],[[120467,120467],"mapped",[106]],[[120468,120468],"mapped",[107]],[[120469,120469],"mapped",[108]],[[120470,120470],"mapped",[109]],[[120471,120471],"mapped",[110]],[[120472,120472],"mapped",[111]],[[120473,120473],"mapped",[112]],[[120474,120474],"mapped",[113]],[[120475,120475],"mapped",[114]],[[120476,120476],"mapped",[115]],[[120477,120477],"mapped",[116]],[[120478,120478],"mapped",[117]],[[120479,120479],"mapped",[118]],[[120480,120480],"mapped",[119]],[[120481,120481],"mapped",[120]],[[120482,120482],"mapped",[121]],[[120483,120483],"mapped",[122]],[[120484,120484],"mapped",[305]],[[120485,120485],"mapped",[567]],[[120486,120487],"disallowed"],[[120488,120488],"mapped",[945]],[[120489,120489],"mapped",[946]],[[120490,120490],"mapped",[947]],[[120491,120491],"mapped",[948]],[[120492,120492],"mapped",[949]],[[120493,120493],"mapped",[950]],[[120494,120494],"mapped",[951]],[[120495,120495],"mapped",[952]],[[120496,120496],"mapped",[953]],[[120497,120497],"mapped",[954]],[[120498,120498],"mapped",[955]],[[120499,120499],"mapped",[956]],[[120500,120500],"mapped",[957]],[[120501,120501],"mapped",[958]],[[120502,120502],"mapped",[959]],[[120503,120503],"mapped",[960]],[[120504,120504],"mapped",[961]],[[120505,120505],"mapped",[952]],[[120506,120506],"mapped",[963]],[[120507,120507],"mapped",[964]],[[120508,120508],"mapped",[965]],[[120509,120509],"mapped",[966]],[[120510,120510],"mapped",[967]],[[120511,120511],"mapped",[968]],[[120512,120512],"mapped",[969]],[[120513,120513],"mapped",[8711]],[[120514,120514],"mapped",[945]],[[120515,120515],"mapped",[946]],[[120516,120516],"mapped",[947]],[[120517,120517],"mapped",[948]],[[120518,120518],"mapped",[949]],[[120519,120519],"mapped",[950]],[[120520,120520],"mapped",[951]],[[120521,120521],"mapped",[952]],[[120522,120522],"mapped",[953]],[[120523,120523],"mapped",[954]],[[120524,120524],"mapped",[955]],[[120525,120525],"mapped",[956]],[[120526,120526],"mapped",[957]],[[120527,120527],"mapped",[958]],[[120528,120528],"mapped",[959]],[[120529,120529],"mapped",[960]],[[120530,120530],"mapped",[961]],[[120531,120532],"mapped",[963]],[[120533,120533],"mapped",[964]],[[120534,120534],"mapped",[965]],[[120535,120535],"mapped",[966]],[[120536,120536],"mapped",[967]],[[120537,120537],"mapped",[968]],[[120538,120538],"mapped",[969]],[[120539,120539],"mapped",[8706]],[[120540,120540],"mapped",[949]],[[120541,120541],"mapped",[952]],[[120542,120542],"mapped",[954]],[[120543,120543],"mapped",[966]],[[120544,120544],"mapped",[961]],[[120545,120545],"mapped",[960]],[[120546,120546],"mapped",[945]],[[120547,120547],"mapped",[946]],[[120548,120548],"mapped",[947]],[[120549,120549],"mapped",[948]],[[120550,120550],"mapped",[949]],[[120551,120551],"mapped",[950]],[[120552,120552],"mapped",[951]],[[120553,120553],"mapped",[952]],[[120554,120554],"mapped",[953]],[[120555,120555],"mapped",[954]],[[120556,120556],"mapped",[955]],[[120557,120557],"mapped",[956]],[[120558,120558],"mapped",[957]],[[120559,120559],"mapped",[958]],[[120560,120560],"mapped",[959]],[[120561,120561],"mapped",[960]],[[120562,120562],"mapped",[961]],[[120563,120563],"mapped",[952]],[[120564,120564],"mapped",[963]],[[120565,120565],"mapped",[964]],[[120566,120566],"mapped",[965]],[[120567,120567],"mapped",[966]],[[120568,120568],"mapped",[967]],[[120569,120569],"mapped",[968]],[[120570,120570],"mapped",[969]],[[120571,120571],"mapped",[8711]],[[120572,120572],"mapped",[945]],[[120573,120573],"mapped",[946]],[[120574,120574],"mapped",[947]],[[120575,120575],"mapped",[948]],[[120576,120576],"mapped",[949]],[[120577,120577],"mapped",[950]],[[120578,120578],"mapped",[951]],[[120579,120579],"mapped",[952]],[[120580,120580],"mapped",[953]],[[120581,120581],"mapped",[954]],[[120582,120582],"mapped",[955]],[[120583,120583],"mapped",[956]],[[120584,120584],"mapped",[957]],[[120585,120585],"mapped",[958]],[[120586,120586],"mapped",[959]],[[120587,120587],"mapped",[960]],[[120588,120588],"mapped",[961]],[[120589,120590],"mapped",[963]],[[120591,120591],"mapped",[964]],[[120592,120592],"mapped",[965]],[[120593,120593],"mapped",[966]],[[120594,120594],"mapped",[967]],[[120595,120595],"mapped",[968]],[[120596,120596],"mapped",[969]],[[120597,120597],"mapped",[8706]],[[120598,120598],"mapped",[949]],[[120599,120599],"mapped",[952]],[[120600,120600],"mapped",[954]],[[120601,120601],"mapped",[966]],[[120602,120602],"mapped",[961]],[[120603,120603],"mapped",[960]],[[120604,120604],"mapped",[945]],[[120605,120605],"mapped",[946]],[[120606,120606],"mapped",[947]],[[120607,120607],"mapped",[948]],[[120608,120608],"mapped",[949]],[[120609,120609],"mapped",[950]],[[120610,120610],"mapped",[951]],[[120611,120611],"mapped",[952]],[[120612,120612],"mapped",[953]],[[120613,120613],"mapped",[954]],[[120614,120614],"mapped",[955]],[[120615,120615],"mapped",[956]],[[120616,120616],"mapped",[957]],[[120617,120617],"mapped",[958]],[[120618,120618],"mapped",[959]],[[120619,120619],"mapped",[960]],[[120620,120620],"mapped",[961]],[[120621,120621],"mapped",[952]],[[120622,120622],"mapped",[963]],[[120623,120623],"mapped",[964]],[[120624,120624],"mapped",[965]],[[120625,120625],"mapped",[966]],[[120626,120626],"mapped",[967]],[[120627,120627],"mapped",[968]],[[120628,120628],"mapped",[969]],[[120629,120629],"mapped",[8711]],[[120630,120630],"mapped",[945]],[[120631,120631],"mapped",[946]],[[120632,120632],"mapped",[947]],[[120633,120633],"mapped",[948]],[[120634,120634],"mapped",[949]],[[120635,120635],"mapped",[950]],[[120636,120636],"mapped",[951]],[[120637,120637],"mapped",[952]],[[120638,120638],"mapped",[953]],[[120639,120639],"mapped",[954]],[[120640,120640],"mapped",[955]],[[120641,120641],"mapped",[956]],[[120642,120642],"mapped",[957]],[[120643,120643],"mapped",[958]],[[120644,120644],"mapped",[959]],[[120645,120645],"mapped",[960]],[[120646,120646],"mapped",[961]],[[120647,120648],"mapped",[963]],[[120649,120649],"mapped",[964]],[[120650,120650],"mapped",[965]],[[120651,120651],"mapped",[966]],[[120652,120652],"mapped",[967]],[[120653,120653],"mapped",[968]],[[120654,120654],"mapped",[969]],[[120655,120655],"mapped",[8706]],[[120656,120656],"mapped",[949]],[[120657,120657],"mapped",[952]],[[120658,120658],"mapped",[954]],[[120659,120659],"mapped",[966]],[[120660,120660],"mapped",[961]],[[120661,120661],"mapped",[960]],[[120662,120662],"mapped",[945]],[[120663,120663],"mapped",[946]],[[120664,120664],"mapped",[947]],[[120665,120665],"mapped",[948]],[[120666,120666],"mapped",[949]],[[120667,120667],"mapped",[950]],[[120668,120668],"mapped",[951]],[[120669,120669],"mapped",[952]],[[120670,120670],"mapped",[953]],[[120671,120671],"mapped",[954]],[[120672,120672],"mapped",[955]],[[120673,120673],"mapped",[956]],[[120674,120674],"mapped",[957]],[[120675,120675],"mapped",[958]],[[120676,120676],"mapped",[959]],[[120677,120677],"mapped",[960]],[[120678,120678],"mapped",[961]],[[120679,120679],"mapped",[952]],[[120680,120680],"mapped",[963]],[[120681,120681],"mapped",[964]],[[120682,120682],"mapped",[965]],[[120683,120683],"mapped",[966]],[[120684,120684],"mapped",[967]],[[120685,120685],"mapped",[968]],[[120686,120686],"mapped",[969]],[[120687,120687],"mapped",[8711]],[[120688,120688],"mapped",[945]],[[120689,120689],"mapped",[946]],[[120690,120690],"mapped",[947]],[[120691,120691],"mapped",[948]],[[120692,120692],"mapped",[949]],[[120693,120693],"mapped",[950]],[[120694,120694],"mapped",[951]],[[120695,120695],"mapped",[952]],[[120696,120696],"mapped",[953]],[[120697,120697],"mapped",[954]],[[120698,120698],"mapped",[955]],[[120699,120699],"mapped",[956]],[[120700,120700],"mapped",[957]],[[120701,120701],"mapped",[958]],[[120702,120702],"mapped",[959]],[[120703,120703],"mapped",[960]],[[120704,120704],"mapped",[961]],[[120705,120706],"mapped",[963]],[[120707,120707],"mapped",[964]],[[120708,120708],"mapped",[965]],[[120709,120709],"mapped",[966]],[[120710,120710],"mapped",[967]],[[120711,120711],"mapped",[968]],[[120712,120712],"mapped",[969]],[[120713,120713],"mapped",[8706]],[[120714,120714],"mapped",[949]],[[120715,120715],"mapped",[952]],[[120716,120716],"mapped",[954]],[[120717,120717],"mapped",[966]],[[120718,120718],"mapped",[961]],[[120719,120719],"mapped",[960]],[[120720,120720],"mapped",[945]],[[120721,120721],"mapped",[946]],[[120722,120722],"mapped",[947]],[[120723,120723],"mapped",[948]],[[120724,120724],"mapped",[949]],[[120725,120725],"mapped",[950]],[[120726,120726],"mapped",[951]],[[120727,120727],"mapped",[952]],[[120728,120728],"mapped",[953]],[[120729,120729],"mapped",[954]],[[120730,120730],"mapped",[955]],[[120731,120731],"mapped",[956]],[[120732,120732],"mapped",[957]],[[120733,120733],"mapped",[958]],[[120734,120734],"mapped",[959]],[[120735,120735],"mapped",[960]],[[120736,120736],"mapped",[961]],[[120737,120737],"mapped",[952]],[[120738,120738],"mapped",[963]],[[120739,120739],"mapped",[964]],[[120740,120740],"mapped",[965]],[[120741,120741],"mapped",[966]],[[120742,120742],"mapped",[967]],[[120743,120743],"mapped",[968]],[[120744,120744],"mapped",[969]],[[120745,120745],"mapped",[8711]],[[120746,120746],"mapped",[945]],[[120747,120747],"mapped",[946]],[[120748,120748],"mapped",[947]],[[120749,120749],"mapped",[948]],[[120750,120750],"mapped",[949]],[[120751,120751],"mapped",[950]],[[120752,120752],"mapped",[951]],[[120753,120753],"mapped",[952]],[[120754,120754],"mapped",[953]],[[120755,120755],"mapped",[954]],[[120756,120756],"mapped",[955]],[[120757,120757],"mapped",[956]],[[120758,120758],"mapped",[957]],[[120759,120759],"mapped",[958]],[[120760,120760],"mapped",[959]],[[120761,120761],"mapped",[960]],[[120762,120762],"mapped",[961]],[[120763,120764],"mapped",[963]],[[120765,120765],"mapped",[964]],[[120766,120766],"mapped",[965]],[[120767,120767],"mapped",[966]],[[120768,120768],"mapped",[967]],[[120769,120769],"mapped",[968]],[[120770,120770],"mapped",[969]],[[120771,120771],"mapped",[8706]],[[120772,120772],"mapped",[949]],[[120773,120773],"mapped",[952]],[[120774,120774],"mapped",[954]],[[120775,120775],"mapped",[966]],[[120776,120776],"mapped",[961]],[[120777,120777],"mapped",[960]],[[120778,120779],"mapped",[989]],[[120780,120781],"disallowed"],[[120782,120782],"mapped",[48]],[[120783,120783],"mapped",[49]],[[120784,120784],"mapped",[50]],[[120785,120785],"mapped",[51]],[[120786,120786],"mapped",[52]],[[120787,120787],"mapped",[53]],[[120788,120788],"mapped",[54]],[[120789,120789],"mapped",[55]],[[120790,120790],"mapped",[56]],[[120791,120791],"mapped",[57]],[[120792,120792],"mapped",[48]],[[120793,120793],"mapped",[49]],[[120794,120794],"mapped",[50]],[[120795,120795],"mapped",[51]],[[120796,120796],"mapped",[52]],[[120797,120797],"mapped",[53]],[[120798,120798],"mapped",[54]],[[120799,120799],"mapped",[55]],[[120800,120800],"mapped",[56]],[[120801,120801],"mapped",[57]],[[120802,120802],"mapped",[48]],[[120803,120803],"mapped",[49]],[[120804,120804],"mapped",[50]],[[120805,120805],"mapped",[51]],[[120806,120806],"mapped",[52]],[[120807,120807],"mapped",[53]],[[120808,120808],"mapped",[54]],[[120809,120809],"mapped",[55]],[[120810,120810],"mapped",[56]],[[120811,120811],"mapped",[57]],[[120812,120812],"mapped",[48]],[[120813,120813],"mapped",[49]],[[120814,120814],"mapped",[50]],[[120815,120815],"mapped",[51]],[[120816,120816],"mapped",[52]],[[120817,120817],"mapped",[53]],[[120818,120818],"mapped",[54]],[[120819,120819],"mapped",[55]],[[120820,120820],"mapped",[56]],[[120821,120821],"mapped",[57]],[[120822,120822],"mapped",[48]],[[120823,120823],"mapped",[49]],[[120824,120824],"mapped",[50]],[[120825,120825],"mapped",[51]],[[120826,120826],"mapped",[52]],[[120827,120827],"mapped",[53]],[[120828,120828],"mapped",[54]],[[120829,120829],"mapped",[55]],[[120830,120830],"mapped",[56]],[[120831,120831],"mapped",[57]],[[120832,121343],"valid",[],"NV8"],[[121344,121398],"valid"],[[121399,121402],"valid",[],"NV8"],[[121403,121452],"valid"],[[121453,121460],"valid",[],"NV8"],[[121461,121461],"valid"],[[121462,121475],"valid",[],"NV8"],[[121476,121476],"valid"],[[121477,121483],"valid",[],"NV8"],[[121484,121498],"disallowed"],[[121499,121503],"valid"],[[121504,121504],"disallowed"],[[121505,121519],"valid"],[[121520,124927],"disallowed"],[[124928,125124],"valid"],[[125125,125126],"disallowed"],[[125127,125135],"valid",[],"NV8"],[[125136,125142],"valid"],[[125143,126463],"disallowed"],[[126464,126464],"mapped",[1575]],[[126465,126465],"mapped",[1576]],[[126466,126466],"mapped",[1580]],[[126467,126467],"mapped",[1583]],[[126468,126468],"disallowed"],[[126469,126469],"mapped",[1608]],[[126470,126470],"mapped",[1586]],[[126471,126471],"mapped",[1581]],[[126472,126472],"mapped",[1591]],[[126473,126473],"mapped",[1610]],[[126474,126474],"mapped",[1603]],[[126475,126475],"mapped",[1604]],[[126476,126476],"mapped",[1605]],[[126477,126477],"mapped",[1606]],[[126478,126478],"mapped",[1587]],[[126479,126479],"mapped",[1593]],[[126480,126480],"mapped",[1601]],[[126481,126481],"mapped",[1589]],[[126482,126482],"mapped",[1602]],[[126483,126483],"mapped",[1585]],[[126484,126484],"mapped",[1588]],[[126485,126485],"mapped",[1578]],[[126486,126486],"mapped",[1579]],[[126487,126487],"mapped",[1582]],[[126488,126488],"mapped",[1584]],[[126489,126489],"mapped",[1590]],[[126490,126490],"mapped",[1592]],[[126491,126491],"mapped",[1594]],[[126492,126492],"mapped",[1646]],[[126493,126493],"mapped",[1722]],[[126494,126494],"mapped",[1697]],[[126495,126495],"mapped",[1647]],[[126496,126496],"disallowed"],[[126497,126497],"mapped",[1576]],[[126498,126498],"mapped",[1580]],[[126499,126499],"disallowed"],[[126500,126500],"mapped",[1607]],[[126501,126502],"disallowed"],[[126503,126503],"mapped",[1581]],[[126504,126504],"disallowed"],[[126505,126505],"mapped",[1610]],[[126506,126506],"mapped",[1603]],[[126507,126507],"mapped",[1604]],[[126508,126508],"mapped",[1605]],[[126509,126509],"mapped",[1606]],[[126510,126510],"mapped",[1587]],[[126511,126511],"mapped",[1593]],[[126512,126512],"mapped",[1601]],[[126513,126513],"mapped",[1589]],[[126514,126514],"mapped",[1602]],[[126515,126515],"disallowed"],[[126516,126516],"mapped",[1588]],[[126517,126517],"mapped",[1578]],[[126518,126518],"mapped",[1579]],[[126519,126519],"mapped",[1582]],[[126520,126520],"disallowed"],[[126521,126521],"mapped",[1590]],[[126522,126522],"disallowed"],[[126523,126523],"mapped",[1594]],[[126524,126529],"disallowed"],[[126530,126530],"mapped",[1580]],[[126531,126534],"disallowed"],[[126535,126535],"mapped",[1581]],[[126536,126536],"disallowed"],[[126537,126537],"mapped",[1610]],[[126538,126538],"disallowed"],[[126539,126539],"mapped",[1604]],[[126540,126540],"disallowed"],[[126541,126541],"mapped",[1606]],[[126542,126542],"mapped",[1587]],[[126543,126543],"mapped",[1593]],[[126544,126544],"disallowed"],[[126545,126545],"mapped",[1589]],[[126546,126546],"mapped",[1602]],[[126547,126547],"disallowed"],[[126548,126548],"mapped",[1588]],[[126549,126550],"disallowed"],[[126551,126551],"mapped",[1582]],[[126552,126552],"disallowed"],[[126553,126553],"mapped",[1590]],[[126554,126554],"disallowed"],[[126555,126555],"mapped",[1594]],[[126556,126556],"disallowed"],[[126557,126557],"mapped",[1722]],[[126558,126558],"disallowed"],[[126559,126559],"mapped",[1647]],[[126560,126560],"disallowed"],[[126561,126561],"mapped",[1576]],[[126562,126562],"mapped",[1580]],[[126563,126563],"disallowed"],[[126564,126564],"mapped",[1607]],[[126565,126566],"disallowed"],[[126567,126567],"mapped",[1581]],[[126568,126568],"mapped",[1591]],[[126569,126569],"mapped",[1610]],[[126570,126570],"mapped",[1603]],[[126571,126571],"disallowed"],[[126572,126572],"mapped",[1605]],[[126573,126573],"mapped",[1606]],[[126574,126574],"mapped",[1587]],[[126575,126575],"mapped",[1593]],[[126576,126576],"mapped",[1601]],[[126577,126577],"mapped",[1589]],[[126578,126578],"mapped",[1602]],[[126579,126579],"disallowed"],[[126580,126580],"mapped",[1588]],[[126581,126581],"mapped",[1578]],[[126582,126582],"mapped",[1579]],[[126583,126583],"mapped",[1582]],[[126584,126584],"disallowed"],[[126585,126585],"mapped",[1590]],[[126586,126586],"mapped",[1592]],[[126587,126587],"mapped",[1594]],[[126588,126588],"mapped",[1646]],[[126589,126589],"disallowed"],[[126590,126590],"mapped",[1697]],[[126591,126591],"disallowed"],[[126592,126592],"mapped",[1575]],[[126593,126593],"mapped",[1576]],[[126594,126594],"mapped",[1580]],[[126595,126595],"mapped",[1583]],[[126596,126596],"mapped",[1607]],[[126597,126597],"mapped",[1608]],[[126598,126598],"mapped",[1586]],[[126599,126599],"mapped",[1581]],[[126600,126600],"mapped",[1591]],[[126601,126601],"mapped",[1610]],[[126602,126602],"disallowed"],[[126603,126603],"mapped",[1604]],[[126604,126604],"mapped",[1605]],[[126605,126605],"mapped",[1606]],[[126606,126606],"mapped",[1587]],[[126607,126607],"mapped",[1593]],[[126608,126608],"mapped",[1601]],[[126609,126609],"mapped",[1589]],[[126610,126610],"mapped",[1602]],[[126611,126611],"mapped",[1585]],[[126612,126612],"mapped",[1588]],[[126613,126613],"mapped",[1578]],[[126614,126614],"mapped",[1579]],[[126615,126615],"mapped",[1582]],[[126616,126616],"mapped",[1584]],[[126617,126617],"mapped",[1590]],[[126618,126618],"mapped",[1592]],[[126619,126619],"mapped",[1594]],[[126620,126624],"disallowed"],[[126625,126625],"mapped",[1576]],[[126626,126626],"mapped",[1580]],[[126627,126627],"mapped",[1583]],[[126628,126628],"disallowed"],[[126629,126629],"mapped",[1608]],[[126630,126630],"mapped",[1586]],[[126631,126631],"mapped",[1581]],[[126632,126632],"mapped",[1591]],[[126633,126633],"mapped",[1610]],[[126634,126634],"disallowed"],[[126635,126635],"mapped",[1604]],[[126636,126636],"mapped",[1605]],[[126637,126637],"mapped",[1606]],[[126638,126638],"mapped",[1587]],[[126639,126639],"mapped",[1593]],[[126640,126640],"mapped",[1601]],[[126641,126641],"mapped",[1589]],[[126642,126642],"mapped",[1602]],[[126643,126643],"mapped",[1585]],[[126644,126644],"mapped",[1588]],[[126645,126645],"mapped",[1578]],[[126646,126646],"mapped",[1579]],[[126647,126647],"mapped",[1582]],[[126648,126648],"mapped",[1584]],[[126649,126649],"mapped",[1590]],[[126650,126650],"mapped",[1592]],[[126651,126651],"mapped",[1594]],[[126652,126703],"disallowed"],[[126704,126705],"valid",[],"NV8"],[[126706,126975],"disallowed"],[[126976,127019],"valid",[],"NV8"],[[127020,127023],"disallowed"],[[127024,127123],"valid",[],"NV8"],[[127124,127135],"disallowed"],[[127136,127150],"valid",[],"NV8"],[[127151,127152],"disallowed"],[[127153,127166],"valid",[],"NV8"],[[127167,127167],"valid",[],"NV8"],[[127168,127168],"disallowed"],[[127169,127183],"valid",[],"NV8"],[[127184,127184],"disallowed"],[[127185,127199],"valid",[],"NV8"],[[127200,127221],"valid",[],"NV8"],[[127222,127231],"disallowed"],[[127232,127232],"disallowed"],[[127233,127233],"disallowed_STD3_mapped",[48,44]],[[127234,127234],"disallowed_STD3_mapped",[49,44]],[[127235,127235],"disallowed_STD3_mapped",[50,44]],[[127236,127236],"disallowed_STD3_mapped",[51,44]],[[127237,127237],"disallowed_STD3_mapped",[52,44]],[[127238,127238],"disallowed_STD3_mapped",[53,44]],[[127239,127239],"disallowed_STD3_mapped",[54,44]],[[127240,127240],"disallowed_STD3_mapped",[55,44]],[[127241,127241],"disallowed_STD3_mapped",[56,44]],[[127242,127242],"disallowed_STD3_mapped",[57,44]],[[127243,127244],"valid",[],"NV8"],[[127245,127247],"disallowed"],[[127248,127248],"disallowed_STD3_mapped",[40,97,41]],[[127249,127249],"disallowed_STD3_mapped",[40,98,41]],[[127250,127250],"disallowed_STD3_mapped",[40,99,41]],[[127251,127251],"disallowed_STD3_mapped",[40,100,41]],[[127252,127252],"disallowed_STD3_mapped",[40,101,41]],[[127253,127253],"disallowed_STD3_mapped",[40,102,41]],[[127254,127254],"disallowed_STD3_mapped",[40,103,41]],[[127255,127255],"disallowed_STD3_mapped",[40,104,41]],[[127256,127256],"disallowed_STD3_mapped",[40,105,41]],[[127257,127257],"disallowed_STD3_mapped",[40,106,41]],[[127258,127258],"disallowed_STD3_mapped",[40,107,41]],[[127259,127259],"disallowed_STD3_mapped",[40,108,41]],[[127260,127260],"disallowed_STD3_mapped",[40,109,41]],[[127261,127261],"disallowed_STD3_mapped",[40,110,41]],[[127262,127262],"disallowed_STD3_mapped",[40,111,41]],[[127263,127263],"disallowed_STD3_mapped",[40,112,41]],[[127264,127264],"disallowed_STD3_mapped",[40,113,41]],[[127265,127265],"disallowed_STD3_mapped",[40,114,41]],[[127266,127266],"disallowed_STD3_mapped",[40,115,41]],[[127267,127267],"disallowed_STD3_mapped",[40,116,41]],[[127268,127268],"disallowed_STD3_mapped",[40,117,41]],[[127269,127269],"disallowed_STD3_mapped",[40,118,41]],[[127270,127270],"disallowed_STD3_mapped",[40,119,41]],[[127271,127271],"disallowed_STD3_mapped",[40,120,41]],[[127272,127272],"disallowed_STD3_mapped",[40,121,41]],[[127273,127273],"disallowed_STD3_mapped",[40,122,41]],[[127274,127274],"mapped",[12308,115,12309]],[[127275,127275],"mapped",[99]],[[127276,127276],"mapped",[114]],[[127277,127277],"mapped",[99,100]],[[127278,127278],"mapped",[119,122]],[[127279,127279],"disallowed"],[[127280,127280],"mapped",[97]],[[127281,127281],"mapped",[98]],[[127282,127282],"mapped",[99]],[[127283,127283],"mapped",[100]],[[127284,127284],"mapped",[101]],[[127285,127285],"mapped",[102]],[[127286,127286],"mapped",[103]],[[127287,127287],"mapped",[104]],[[127288,127288],"mapped",[105]],[[127289,127289],"mapped",[106]],[[127290,127290],"mapped",[107]],[[127291,127291],"mapped",[108]],[[127292,127292],"mapped",[109]],[[127293,127293],"mapped",[110]],[[127294,127294],"mapped",[111]],[[127295,127295],"mapped",[112]],[[127296,127296],"mapped",[113]],[[127297,127297],"mapped",[114]],[[127298,127298],"mapped",[115]],[[127299,127299],"mapped",[116]],[[127300,127300],"mapped",[117]],[[127301,127301],"mapped",[118]],[[127302,127302],"mapped",[119]],[[127303,127303],"mapped",[120]],[[127304,127304],"mapped",[121]],[[127305,127305],"mapped",[122]],[[127306,127306],"mapped",[104,118]],[[127307,127307],"mapped",[109,118]],[[127308,127308],"mapped",[115,100]],[[127309,127309],"mapped",[115,115]],[[127310,127310],"mapped",[112,112,118]],[[127311,127311],"mapped",[119,99]],[[127312,127318],"valid",[],"NV8"],[[127319,127319],"valid",[],"NV8"],[[127320,127326],"valid",[],"NV8"],[[127327,127327],"valid",[],"NV8"],[[127328,127337],"valid",[],"NV8"],[[127338,127338],"mapped",[109,99]],[[127339,127339],"mapped",[109,100]],[[127340,127343],"disallowed"],[[127344,127352],"valid",[],"NV8"],[[127353,127353],"valid",[],"NV8"],[[127354,127354],"valid",[],"NV8"],[[127355,127356],"valid",[],"NV8"],[[127357,127358],"valid",[],"NV8"],[[127359,127359],"valid",[],"NV8"],[[127360,127369],"valid",[],"NV8"],[[127370,127373],"valid",[],"NV8"],[[127374,127375],"valid",[],"NV8"],[[127376,127376],"mapped",[100,106]],[[127377,127386],"valid",[],"NV8"],[[127387,127461],"disallowed"],[[127462,127487],"valid",[],"NV8"],[[127488,127488],"mapped",[12411,12363]],[[127489,127489],"mapped",[12467,12467]],[[127490,127490],"mapped",[12469]],[[127491,127503],"disallowed"],[[127504,127504],"mapped",[25163]],[[127505,127505],"mapped",[23383]],[[127506,127506],"mapped",[21452]],[[127507,127507],"mapped",[12487]],[[127508,127508],"mapped",[20108]],[[127509,127509],"mapped",[22810]],[[127510,127510],"mapped",[35299]],[[127511,127511],"mapped",[22825]],[[127512,127512],"mapped",[20132]],[[127513,127513],"mapped",[26144]],[[127514,127514],"mapped",[28961]],[[127515,127515],"mapped",[26009]],[[127516,127516],"mapped",[21069]],[[127517,127517],"mapped",[24460]],[[127518,127518],"mapped",[20877]],[[127519,127519],"mapped",[26032]],[[127520,127520],"mapped",[21021]],[[127521,127521],"mapped",[32066]],[[127522,127522],"mapped",[29983]],[[127523,127523],"mapped",[36009]],[[127524,127524],"mapped",[22768]],[[127525,127525],"mapped",[21561]],[[127526,127526],"mapped",[28436]],[[127527,127527],"mapped",[25237]],[[127528,127528],"mapped",[25429]],[[127529,127529],"mapped",[19968]],[[127530,127530],"mapped",[19977]],[[127531,127531],"mapped",[36938]],[[127532,127532],"mapped",[24038]],[[127533,127533],"mapped",[20013]],[[127534,127534],"mapped",[21491]],[[127535,127535],"mapped",[25351]],[[127536,127536],"mapped",[36208]],[[127537,127537],"mapped",[25171]],[[127538,127538],"mapped",[31105]],[[127539,127539],"mapped",[31354]],[[127540,127540],"mapped",[21512]],[[127541,127541],"mapped",[28288]],[[127542,127542],"mapped",[26377]],[[127543,127543],"mapped",[26376]],[[127544,127544],"mapped",[30003]],[[127545,127545],"mapped",[21106]],[[127546,127546],"mapped",[21942]],[[127547,127551],"disallowed"],[[127552,127552],"mapped",[12308,26412,12309]],[[127553,127553],"mapped",[12308,19977,12309]],[[127554,127554],"mapped",[12308,20108,12309]],[[127555,127555],"mapped",[12308,23433,12309]],[[127556,127556],"mapped",[12308,28857,12309]],[[127557,127557],"mapped",[12308,25171,12309]],[[127558,127558],"mapped",[12308,30423,12309]],[[127559,127559],"mapped",[12308,21213,12309]],[[127560,127560],"mapped",[12308,25943,12309]],[[127561,127567],"disallowed"],[[127568,127568],"mapped",[24471]],[[127569,127569],"mapped",[21487]],[[127570,127743],"disallowed"],[[127744,127776],"valid",[],"NV8"],[[127777,127788],"valid",[],"NV8"],[[127789,127791],"valid",[],"NV8"],[[127792,127797],"valid",[],"NV8"],[[127798,127798],"valid",[],"NV8"],[[127799,127868],"valid",[],"NV8"],[[127869,127869],"valid",[],"NV8"],[[127870,127871],"valid",[],"NV8"],[[127872,127891],"valid",[],"NV8"],[[127892,127903],"valid",[],"NV8"],[[127904,127940],"valid",[],"NV8"],[[127941,127941],"valid",[],"NV8"],[[127942,127946],"valid",[],"NV8"],[[127947,127950],"valid",[],"NV8"],[[127951,127955],"valid",[],"NV8"],[[127956,127967],"valid",[],"NV8"],[[127968,127984],"valid",[],"NV8"],[[127985,127991],"valid",[],"NV8"],[[127992,127999],"valid",[],"NV8"],[[128000,128062],"valid",[],"NV8"],[[128063,128063],"valid",[],"NV8"],[[128064,128064],"valid",[],"NV8"],[[128065,128065],"valid",[],"NV8"],[[128066,128247],"valid",[],"NV8"],[[128248,128248],"valid",[],"NV8"],[[128249,128252],"valid",[],"NV8"],[[128253,128254],"valid",[],"NV8"],[[128255,128255],"valid",[],"NV8"],[[128256,128317],"valid",[],"NV8"],[[128318,128319],"valid",[],"NV8"],[[128320,128323],"valid",[],"NV8"],[[128324,128330],"valid",[],"NV8"],[[128331,128335],"valid",[],"NV8"],[[128336,128359],"valid",[],"NV8"],[[128360,128377],"valid",[],"NV8"],[[128378,128378],"disallowed"],[[128379,128419],"valid",[],"NV8"],[[128420,128420],"disallowed"],[[128421,128506],"valid",[],"NV8"],[[128507,128511],"valid",[],"NV8"],[[128512,128512],"valid",[],"NV8"],[[128513,128528],"valid",[],"NV8"],[[128529,128529],"valid",[],"NV8"],[[128530,128532],"valid",[],"NV8"],[[128533,128533],"valid",[],"NV8"],[[128534,128534],"valid",[],"NV8"],[[128535,128535],"valid",[],"NV8"],[[128536,128536],"valid",[],"NV8"],[[128537,128537],"valid",[],"NV8"],[[128538,128538],"valid",[],"NV8"],[[128539,128539],"valid",[],"NV8"],[[128540,128542],"valid",[],"NV8"],[[128543,128543],"valid",[],"NV8"],[[128544,128549],"valid",[],"NV8"],[[128550,128551],"valid",[],"NV8"],[[128552,128555],"valid",[],"NV8"],[[128556,128556],"valid",[],"NV8"],[[128557,128557],"valid",[],"NV8"],[[128558,128559],"valid",[],"NV8"],[[128560,128563],"valid",[],"NV8"],[[128564,128564],"valid",[],"NV8"],[[128565,128576],"valid",[],"NV8"],[[128577,128578],"valid",[],"NV8"],[[128579,128580],"valid",[],"NV8"],[[128581,128591],"valid",[],"NV8"],[[128592,128639],"valid",[],"NV8"],[[128640,128709],"valid",[],"NV8"],[[128710,128719],"valid",[],"NV8"],[[128720,128720],"valid",[],"NV8"],[[128721,128735],"disallowed"],[[128736,128748],"valid",[],"NV8"],[[128749,128751],"disallowed"],[[128752,128755],"valid",[],"NV8"],[[128756,128767],"disallowed"],[[128768,128883],"valid",[],"NV8"],[[128884,128895],"disallowed"],[[128896,128980],"valid",[],"NV8"],[[128981,129023],"disallowed"],[[129024,129035],"valid",[],"NV8"],[[129036,129039],"disallowed"],[[129040,129095],"valid",[],"NV8"],[[129096,129103],"disallowed"],[[129104,129113],"valid",[],"NV8"],[[129114,129119],"disallowed"],[[129120,129159],"valid",[],"NV8"],[[129160,129167],"disallowed"],[[129168,129197],"valid",[],"NV8"],[[129198,129295],"disallowed"],[[129296,129304],"valid",[],"NV8"],[[129305,129407],"disallowed"],[[129408,129412],"valid",[],"NV8"],[[129413,129471],"disallowed"],[[129472,129472],"valid",[],"NV8"],[[129473,131069],"disallowed"],[[131070,131071],"disallowed"],[[131072,173782],"valid"],[[173783,173823],"disallowed"],[[173824,177972],"valid"],[[177973,177983],"disallowed"],[[177984,178205],"valid"],[[178206,178207],"disallowed"],[[178208,183969],"valid"],[[183970,194559],"disallowed"],[[194560,194560],"mapped",[20029]],[[194561,194561],"mapped",[20024]],[[194562,194562],"mapped",[20033]],[[194563,194563],"mapped",[131362]],[[194564,194564],"mapped",[20320]],[[194565,194565],"mapped",[20398]],[[194566,194566],"mapped",[20411]],[[194567,194567],"mapped",[20482]],[[194568,194568],"mapped",[20602]],[[194569,194569],"mapped",[20633]],[[194570,194570],"mapped",[20711]],[[194571,194571],"mapped",[20687]],[[194572,194572],"mapped",[13470]],[[194573,194573],"mapped",[132666]],[[194574,194574],"mapped",[20813]],[[194575,194575],"mapped",[20820]],[[194576,194576],"mapped",[20836]],[[194577,194577],"mapped",[20855]],[[194578,194578],"mapped",[132380]],[[194579,194579],"mapped",[13497]],[[194580,194580],"mapped",[20839]],[[194581,194581],"mapped",[20877]],[[194582,194582],"mapped",[132427]],[[194583,194583],"mapped",[20887]],[[194584,194584],"mapped",[20900]],[[194585,194585],"mapped",[20172]],[[194586,194586],"mapped",[20908]],[[194587,194587],"mapped",[20917]],[[194588,194588],"mapped",[168415]],[[194589,194589],"mapped",[20981]],[[194590,194590],"mapped",[20995]],[[194591,194591],"mapped",[13535]],[[194592,194592],"mapped",[21051]],[[194593,194593],"mapped",[21062]],[[194594,194594],"mapped",[21106]],[[194595,194595],"mapped",[21111]],[[194596,194596],"mapped",[13589]],[[194597,194597],"mapped",[21191]],[[194598,194598],"mapped",[21193]],[[194599,194599],"mapped",[21220]],[[194600,194600],"mapped",[21242]],[[194601,194601],"mapped",[21253]],[[194602,194602],"mapped",[21254]],[[194603,194603],"mapped",[21271]],[[194604,194604],"mapped",[21321]],[[194605,194605],"mapped",[21329]],[[194606,194606],"mapped",[21338]],[[194607,194607],"mapped",[21363]],[[194608,194608],"mapped",[21373]],[[194609,194611],"mapped",[21375]],[[194612,194612],"mapped",[133676]],[[194613,194613],"mapped",[28784]],[[194614,194614],"mapped",[21450]],[[194615,194615],"mapped",[21471]],[[194616,194616],"mapped",[133987]],[[194617,194617],"mapped",[21483]],[[194618,194618],"mapped",[21489]],[[194619,194619],"mapped",[21510]],[[194620,194620],"mapped",[21662]],[[194621,194621],"mapped",[21560]],[[194622,194622],"mapped",[21576]],[[194623,194623],"mapped",[21608]],[[194624,194624],"mapped",[21666]],[[194625,194625],"mapped",[21750]],[[194626,194626],"mapped",[21776]],[[194627,194627],"mapped",[21843]],[[194628,194628],"mapped",[21859]],[[194629,194630],"mapped",[21892]],[[194631,194631],"mapped",[21913]],[[194632,194632],"mapped",[21931]],[[194633,194633],"mapped",[21939]],[[194634,194634],"mapped",[21954]],[[194635,194635],"mapped",[22294]],[[194636,194636],"mapped",[22022]],[[194637,194637],"mapped",[22295]],[[194638,194638],"mapped",[22097]],[[194639,194639],"mapped",[22132]],[[194640,194640],"mapped",[20999]],[[194641,194641],"mapped",[22766]],[[194642,194642],"mapped",[22478]],[[194643,194643],"mapped",[22516]],[[194644,194644],"mapped",[22541]],[[194645,194645],"mapped",[22411]],[[194646,194646],"mapped",[22578]],[[194647,194647],"mapped",[22577]],[[194648,194648],"mapped",[22700]],[[194649,194649],"mapped",[136420]],[[194650,194650],"mapped",[22770]],[[194651,194651],"mapped",[22775]],[[194652,194652],"mapped",[22790]],[[194653,194653],"mapped",[22810]],[[194654,194654],"mapped",[22818]],[[194655,194655],"mapped",[22882]],[[194656,194656],"mapped",[136872]],[[194657,194657],"mapped",[136938]],[[194658,194658],"mapped",[23020]],[[194659,194659],"mapped",[23067]],[[194660,194660],"mapped",[23079]],[[194661,194661],"mapped",[23000]],[[194662,194662],"mapped",[23142]],[[194663,194663],"mapped",[14062]],[[194664,194664],"disallowed"],[[194665,194665],"mapped",[23304]],[[194666,194667],"mapped",[23358]],[[194668,194668],"mapped",[137672]],[[194669,194669],"mapped",[23491]],[[194670,194670],"mapped",[23512]],[[194671,194671],"mapped",[23527]],[[194672,194672],"mapped",[23539]],[[194673,194673],"mapped",[138008]],[[194674,194674],"mapped",[23551]],[[194675,194675],"mapped",[23558]],[[194676,194676],"disallowed"],[[194677,194677],"mapped",[23586]],[[194678,194678],"mapped",[14209]],[[194679,194679],"mapped",[23648]],[[194680,194680],"mapped",[23662]],[[194681,194681],"mapped",[23744]],[[194682,194682],"mapped",[23693]],[[194683,194683],"mapped",[138724]],[[194684,194684],"mapped",[23875]],[[194685,194685],"mapped",[138726]],[[194686,194686],"mapped",[23918]],[[194687,194687],"mapped",[23915]],[[194688,194688],"mapped",[23932]],[[194689,194689],"mapped",[24033]],[[194690,194690],"mapped",[24034]],[[194691,194691],"mapped",[14383]],[[194692,194692],"mapped",[24061]],[[194693,194693],"mapped",[24104]],[[194694,194694],"mapped",[24125]],[[194695,194695],"mapped",[24169]],[[194696,194696],"mapped",[14434]],[[194697,194697],"mapped",[139651]],[[194698,194698],"mapped",[14460]],[[194699,194699],"mapped",[24240]],[[194700,194700],"mapped",[24243]],[[194701,194701],"mapped",[24246]],[[194702,194702],"mapped",[24266]],[[194703,194703],"mapped",[172946]],[[194704,194704],"mapped",[24318]],[[194705,194706],"mapped",[140081]],[[194707,194707],"mapped",[33281]],[[194708,194709],"mapped",[24354]],[[194710,194710],"mapped",[14535]],[[194711,194711],"mapped",[144056]],[[194712,194712],"mapped",[156122]],[[194713,194713],"mapped",[24418]],[[194714,194714],"mapped",[24427]],[[194715,194715],"mapped",[14563]],[[194716,194716],"mapped",[24474]],[[194717,194717],"mapped",[24525]],[[194718,194718],"mapped",[24535]],[[194719,194719],"mapped",[24569]],[[194720,194720],"mapped",[24705]],[[194721,194721],"mapped",[14650]],[[194722,194722],"mapped",[14620]],[[194723,194723],"mapped",[24724]],[[194724,194724],"mapped",[141012]],[[194725,194725],"mapped",[24775]],[[194726,194726],"mapped",[24904]],[[194727,194727],"mapped",[24908]],[[194728,194728],"mapped",[24910]],[[194729,194729],"mapped",[24908]],[[194730,194730],"mapped",[24954]],[[194731,194731],"mapped",[24974]],[[194732,194732],"mapped",[25010]],[[194733,194733],"mapped",[24996]],[[194734,194734],"mapped",[25007]],[[194735,194735],"mapped",[25054]],[[194736,194736],"mapped",[25074]],[[194737,194737],"mapped",[25078]],[[194738,194738],"mapped",[25104]],[[194739,194739],"mapped",[25115]],[[194740,194740],"mapped",[25181]],[[194741,194741],"mapped",[25265]],[[194742,194742],"mapped",[25300]],[[194743,194743],"mapped",[25424]],[[194744,194744],"mapped",[142092]],[[194745,194745],"mapped",[25405]],[[194746,194746],"mapped",[25340]],[[194747,194747],"mapped",[25448]],[[194748,194748],"mapped",[25475]],[[194749,194749],"mapped",[25572]],[[194750,194750],"mapped",[142321]],[[194751,194751],"mapped",[25634]],[[194752,194752],"mapped",[25541]],[[194753,194753],"mapped",[25513]],[[194754,194754],"mapped",[14894]],[[194755,194755],"mapped",[25705]],[[194756,194756],"mapped",[25726]],[[194757,194757],"mapped",[25757]],[[194758,194758],"mapped",[25719]],[[194759,194759],"mapped",[14956]],[[194760,194760],"mapped",[25935]],[[194761,194761],"mapped",[25964]],[[194762,194762],"mapped",[143370]],[[194763,194763],"mapped",[26083]],[[194764,194764],"mapped",[26360]],[[194765,194765],"mapped",[26185]],[[194766,194766],"mapped",[15129]],[[194767,194767],"mapped",[26257]],[[194768,194768],"mapped",[15112]],[[194769,194769],"mapped",[15076]],[[194770,194770],"mapped",[20882]],[[194771,194771],"mapped",[20885]],[[194772,194772],"mapped",[26368]],[[194773,194773],"mapped",[26268]],[[194774,194774],"mapped",[32941]],[[194775,194775],"mapped",[17369]],[[194776,194776],"mapped",[26391]],[[194777,194777],"mapped",[26395]],[[194778,194778],"mapped",[26401]],[[194779,194779],"mapped",[26462]],[[194780,194780],"mapped",[26451]],[[194781,194781],"mapped",[144323]],[[194782,194782],"mapped",[15177]],[[194783,194783],"mapped",[26618]],[[194784,194784],"mapped",[26501]],[[194785,194785],"mapped",[26706]],[[194786,194786],"mapped",[26757]],[[194787,194787],"mapped",[144493]],[[194788,194788],"mapped",[26766]],[[194789,194789],"mapped",[26655]],[[194790,194790],"mapped",[26900]],[[194791,194791],"mapped",[15261]],[[194792,194792],"mapped",[26946]],[[194793,194793],"mapped",[27043]],[[194794,194794],"mapped",[27114]],[[194795,194795],"mapped",[27304]],[[194796,194796],"mapped",[145059]],[[194797,194797],"mapped",[27355]],[[194798,194798],"mapped",[15384]],[[194799,194799],"mapped",[27425]],[[194800,194800],"mapped",[145575]],[[194801,194801],"mapped",[27476]],[[194802,194802],"mapped",[15438]],[[194803,194803],"mapped",[27506]],[[194804,194804],"mapped",[27551]],[[194805,194805],"mapped",[27578]],[[194806,194806],"mapped",[27579]],[[194807,194807],"mapped",[146061]],[[194808,194808],"mapped",[138507]],[[194809,194809],"mapped",[146170]],[[194810,194810],"mapped",[27726]],[[194811,194811],"mapped",[146620]],[[194812,194812],"mapped",[27839]],[[194813,194813],"mapped",[27853]],[[194814,194814],"mapped",[27751]],[[194815,194815],"mapped",[27926]],[[194816,194816],"mapped",[27966]],[[194817,194817],"mapped",[28023]],[[194818,194818],"mapped",[27969]],[[194819,194819],"mapped",[28009]],[[194820,194820],"mapped",[28024]],[[194821,194821],"mapped",[28037]],[[194822,194822],"mapped",[146718]],[[194823,194823],"mapped",[27956]],[[194824,194824],"mapped",[28207]],[[194825,194825],"mapped",[28270]],[[194826,194826],"mapped",[15667]],[[194827,194827],"mapped",[28363]],[[194828,194828],"mapped",[28359]],[[194829,194829],"mapped",[147153]],[[194830,194830],"mapped",[28153]],[[194831,194831],"mapped",[28526]],[[194832,194832],"mapped",[147294]],[[194833,194833],"mapped",[147342]],[[194834,194834],"mapped",[28614]],[[194835,194835],"mapped",[28729]],[[194836,194836],"mapped",[28702]],[[194837,194837],"mapped",[28699]],[[194838,194838],"mapped",[15766]],[[194839,194839],"mapped",[28746]],[[194840,194840],"mapped",[28797]],[[194841,194841],"mapped",[28791]],[[194842,194842],"mapped",[28845]],[[194843,194843],"mapped",[132389]],[[194844,194844],"mapped",[28997]],[[194845,194845],"mapped",[148067]],[[194846,194846],"mapped",[29084]],[[194847,194847],"disallowed"],[[194848,194848],"mapped",[29224]],[[194849,194849],"mapped",[29237]],[[194850,194850],"mapped",[29264]],[[194851,194851],"mapped",[149000]],[[194852,194852],"mapped",[29312]],[[194853,194853],"mapped",[29333]],[[194854,194854],"mapped",[149301]],[[194855,194855],"mapped",[149524]],[[194856,194856],"mapped",[29562]],[[194857,194857],"mapped",[29579]],[[194858,194858],"mapped",[16044]],[[194859,194859],"mapped",[29605]],[[194860,194861],"mapped",[16056]],[[194862,194862],"mapped",[29767]],[[194863,194863],"mapped",[29788]],[[194864,194864],"mapped",[29809]],[[194865,194865],"mapped",[29829]],[[194866,194866],"mapped",[29898]],[[194867,194867],"mapped",[16155]],[[194868,194868],"mapped",[29988]],[[194869,194869],"mapped",[150582]],[[194870,194870],"mapped",[30014]],[[194871,194871],"mapped",[150674]],[[194872,194872],"mapped",[30064]],[[194873,194873],"mapped",[139679]],[[194874,194874],"mapped",[30224]],[[194875,194875],"mapped",[151457]],[[194876,194876],"mapped",[151480]],[[194877,194877],"mapped",[151620]],[[194878,194878],"mapped",[16380]],[[194879,194879],"mapped",[16392]],[[194880,194880],"mapped",[30452]],[[194881,194881],"mapped",[151795]],[[194882,194882],"mapped",[151794]],[[194883,194883],"mapped",[151833]],[[194884,194884],"mapped",[151859]],[[194885,194885],"mapped",[30494]],[[194886,194887],"mapped",[30495]],[[194888,194888],"mapped",[30538]],[[194889,194889],"mapped",[16441]],[[194890,194890],"mapped",[30603]],[[194891,194891],"mapped",[16454]],[[194892,194892],"mapped",[16534]],[[194893,194893],"mapped",[152605]],[[194894,194894],"mapped",[30798]],[[194895,194895],"mapped",[30860]],[[194896,194896],"mapped",[30924]],[[194897,194897],"mapped",[16611]],[[194898,194898],"mapped",[153126]],[[194899,194899],"mapped",[31062]],[[194900,194900],"mapped",[153242]],[[194901,194901],"mapped",[153285]],[[194902,194902],"mapped",[31119]],[[194903,194903],"mapped",[31211]],[[194904,194904],"mapped",[16687]],[[194905,194905],"mapped",[31296]],[[194906,194906],"mapped",[31306]],[[194907,194907],"mapped",[31311]],[[194908,194908],"mapped",[153980]],[[194909,194910],"mapped",[154279]],[[194911,194911],"disallowed"],[[194912,194912],"mapped",[16898]],[[194913,194913],"mapped",[154539]],[[194914,194914],"mapped",[31686]],[[194915,194915],"mapped",[31689]],[[194916,194916],"mapped",[16935]],[[194917,194917],"mapped",[154752]],[[194918,194918],"mapped",[31954]],[[194919,194919],"mapped",[17056]],[[194920,194920],"mapped",[31976]],[[194921,194921],"mapped",[31971]],[[194922,194922],"mapped",[32000]],[[194923,194923],"mapped",[155526]],[[194924,194924],"mapped",[32099]],[[194925,194925],"mapped",[17153]],[[194926,194926],"mapped",[32199]],[[194927,194927],"mapped",[32258]],[[194928,194928],"mapped",[32325]],[[194929,194929],"mapped",[17204]],[[194930,194930],"mapped",[156200]],[[194931,194931],"mapped",[156231]],[[194932,194932],"mapped",[17241]],[[194933,194933],"mapped",[156377]],[[194934,194934],"mapped",[32634]],[[194935,194935],"mapped",[156478]],[[194936,194936],"mapped",[32661]],[[194937,194937],"mapped",[32762]],[[194938,194938],"mapped",[32773]],[[194939,194939],"mapped",[156890]],[[194940,194940],"mapped",[156963]],[[194941,194941],"mapped",[32864]],[[194942,194942],"mapped",[157096]],[[194943,194943],"mapped",[32880]],[[194944,194944],"mapped",[144223]],[[194945,194945],"mapped",[17365]],[[194946,194946],"mapped",[32946]],[[194947,194947],"mapped",[33027]],[[194948,194948],"mapped",[17419]],[[194949,194949],"mapped",[33086]],[[194950,194950],"mapped",[23221]],[[194951,194951],"mapped",[157607]],[[194952,194952],"mapped",[157621]],[[194953,194953],"mapped",[144275]],[[194954,194954],"mapped",[144284]],[[194955,194955],"mapped",[33281]],[[194956,194956],"mapped",[33284]],[[194957,194957],"mapped",[36766]],[[194958,194958],"mapped",[17515]],[[194959,194959],"mapped",[33425]],[[194960,194960],"mapped",[33419]],[[194961,194961],"mapped",[33437]],[[194962,194962],"mapped",[21171]],[[194963,194963],"mapped",[33457]],[[194964,194964],"mapped",[33459]],[[194965,194965],"mapped",[33469]],[[194966,194966],"mapped",[33510]],[[194967,194967],"mapped",[158524]],[[194968,194968],"mapped",[33509]],[[194969,194969],"mapped",[33565]],[[194970,194970],"mapped",[33635]],[[194971,194971],"mapped",[33709]],[[194972,194972],"mapped",[33571]],[[194973,194973],"mapped",[33725]],[[194974,194974],"mapped",[33767]],[[194975,194975],"mapped",[33879]],[[194976,194976],"mapped",[33619]],[[194977,194977],"mapped",[33738]],[[194978,194978],"mapped",[33740]],[[194979,194979],"mapped",[33756]],[[194980,194980],"mapped",[158774]],[[194981,194981],"mapped",[159083]],[[194982,194982],"mapped",[158933]],[[194983,194983],"mapped",[17707]],[[194984,194984],"mapped",[34033]],[[194985,194985],"mapped",[34035]],[[194986,194986],"mapped",[34070]],[[194987,194987],"mapped",[160714]],[[194988,194988],"mapped",[34148]],[[194989,194989],"mapped",[159532]],[[194990,194990],"mapped",[17757]],[[194991,194991],"mapped",[17761]],[[194992,194992],"mapped",[159665]],[[194993,194993],"mapped",[159954]],[[194994,194994],"mapped",[17771]],[[194995,194995],"mapped",[34384]],[[194996,194996],"mapped",[34396]],[[194997,194997],"mapped",[34407]],[[194998,194998],"mapped",[34409]],[[194999,194999],"mapped",[34473]],[[195000,195000],"mapped",[34440]],[[195001,195001],"mapped",[34574]],[[195002,195002],"mapped",[34530]],[[195003,195003],"mapped",[34681]],[[195004,195004],"mapped",[34600]],[[195005,195005],"mapped",[34667]],[[195006,195006],"mapped",[34694]],[[195007,195007],"disallowed"],[[195008,195008],"mapped",[34785]],[[195009,195009],"mapped",[34817]],[[195010,195010],"mapped",[17913]],[[195011,195011],"mapped",[34912]],[[195012,195012],"mapped",[34915]],[[195013,195013],"mapped",[161383]],[[195014,195014],"mapped",[35031]],[[195015,195015],"mapped",[35038]],[[195016,195016],"mapped",[17973]],[[195017,195017],"mapped",[35066]],[[195018,195018],"mapped",[13499]],[[195019,195019],"mapped",[161966]],[[195020,195020],"mapped",[162150]],[[195021,195021],"mapped",[18110]],[[195022,195022],"mapped",[18119]],[[195023,195023],"mapped",[35488]],[[195024,195024],"mapped",[35565]],[[195025,195025],"mapped",[35722]],[[195026,195026],"mapped",[35925]],[[195027,195027],"mapped",[162984]],[[195028,195028],"mapped",[36011]],[[195029,195029],"mapped",[36033]],[[195030,195030],"mapped",[36123]],[[195031,195031],"mapped",[36215]],[[195032,195032],"mapped",[163631]],[[195033,195033],"mapped",[133124]],[[195034,195034],"mapped",[36299]],[[195035,195035],"mapped",[36284]],[[195036,195036],"mapped",[36336]],[[195037,195037],"mapped",[133342]],[[195038,195038],"mapped",[36564]],[[195039,195039],"mapped",[36664]],[[195040,195040],"mapped",[165330]],[[195041,195041],"mapped",[165357]],[[195042,195042],"mapped",[37012]],[[195043,195043],"mapped",[37105]],[[195044,195044],"mapped",[37137]],[[195045,195045],"mapped",[165678]],[[195046,195046],"mapped",[37147]],[[195047,195047],"mapped",[37432]],[[195048,195048],"mapped",[37591]],[[195049,195049],"mapped",[37592]],[[195050,195050],"mapped",[37500]],[[195051,195051],"mapped",[37881]],[[195052,195052],"mapped",[37909]],[[195053,195053],"mapped",[166906]],[[195054,195054],"mapped",[38283]],[[195055,195055],"mapped",[18837]],[[195056,195056],"mapped",[38327]],[[195057,195057],"mapped",[167287]],[[195058,195058],"mapped",[18918]],[[195059,195059],"mapped",[38595]],[[195060,195060],"mapped",[23986]],[[195061,195061],"mapped",[38691]],[[195062,195062],"mapped",[168261]],[[195063,195063],"mapped",[168474]],[[195064,195064],"mapped",[19054]],[[195065,195065],"mapped",[19062]],[[195066,195066],"mapped",[38880]],[[195067,195067],"mapped",[168970]],[[195068,195068],"mapped",[19122]],[[195069,195069],"mapped",[169110]],[[195070,195071],"mapped",[38923]],[[195072,195072],"mapped",[38953]],[[195073,195073],"mapped",[169398]],[[195074,195074],"mapped",[39138]],[[195075,195075],"mapped",[19251]],[[195076,195076],"mapped",[39209]],[[195077,195077],"mapped",[39335]],[[195078,195078],"mapped",[39362]],[[195079,195079],"mapped",[39422]],[[195080,195080],"mapped",[19406]],[[195081,195081],"mapped",[170800]],[[195082,195082],"mapped",[39698]],[[195083,195083],"mapped",[40000]],[[195084,195084],"mapped",[40189]],[[195085,195085],"mapped",[19662]],[[195086,195086],"mapped",[19693]],[[195087,195087],"mapped",[40295]],[[195088,195088],"mapped",[172238]],[[195089,195089],"mapped",[19704]],[[195090,195090],"mapped",[172293]],[[195091,195091],"mapped",[172558]],[[195092,195092],"mapped",[172689]],[[195093,195093],"mapped",[40635]],[[195094,195094],"mapped",[19798]],[[195095,195095],"mapped",[40697]],[[195096,195096],"mapped",[40702]],[[195097,195097],"mapped",[40709]],[[195098,195098],"mapped",[40719]],[[195099,195099],"mapped",[40726]],[[195100,195100],"mapped",[40763]],[[195101,195101],"mapped",[173568]],[[195102,196605],"disallowed"],[[196606,196607],"disallowed"],[[196608,262141],"disallowed"],[[262142,262143],"disallowed"],[[262144,327677],"disallowed"],[[327678,327679],"disallowed"],[[327680,393213],"disallowed"],[[393214,393215],"disallowed"],[[393216,458749],"disallowed"],[[458750,458751],"disallowed"],[[458752,524285],"disallowed"],[[524286,524287],"disallowed"],[[524288,589821],"disallowed"],[[589822,589823],"disallowed"],[[589824,655357],"disallowed"],[[655358,655359],"disallowed"],[[655360,720893],"disallowed"],[[720894,720895],"disallowed"],[[720896,786429],"disallowed"],[[786430,786431],"disallowed"],[[786432,851965],"disallowed"],[[851966,851967],"disallowed"],[[851968,917501],"disallowed"],[[917502,917503],"disallowed"],[[917504,917504],"disallowed"],[[917505,917505],"disallowed"],[[917506,917535],"disallowed"],[[917536,917631],"disallowed"],[[917632,917759],"disallowed"],[[917760,917999],"ignored"],[[918000,983037],"disallowed"],[[983038,983039],"disallowed"],[[983040,1048573],"disallowed"],[[1048574,1048575],"disallowed"],[[1048576,1114109],"disallowed"],[[1114110,1114111],"disallowed"]]')},2508:(e,t,a)=>{a(1663),a(9052),a(4073)},2521:(e,t,a)=>{var n,i;e.exports=(n={basename:()=>s.basename,default:()=>s.default,dirname:()=>s.dirname,join:()=>s.join,resolve:()=>s.resolve},i={},a.d(i,n),i)},2701:(e,t,a)=>{a.d(t,{DC:()=>l,tY:()=>d});var s=a(3785),n=a.n(s),i=a(4237),r=a(1967);class o extends r.oS{getDefinition(){return{name:"askUser",description:'Ask the user a question and wait for their response. This pauses the execution loop until the user provides input.\n\nUse this tool when you need:\n- User confirmation or decision\n- Additional information from the user\n- Clarification on ambiguous requirements\n- User preference between multiple options\n\nIMPORTANT:\n- This will pause execution until the user responds\n- Provide clear, specific questions\n- If you provide choices, the user will see a menu to select from\n- If allowFreeText is true, user can type a custom response\n\nExamples:\n- askUser({ question: "Which file should I modify?" }) - Free text input\n- askUser({ question: "Proceed with deletion?", choices: ["Yes", "No"] }) - Multiple choice\n- askUser({ question: "Select an option:", choices: ["Option 1", "Option 2"], allowFreeText: true }) - Choice with custom input allowed',input_schema:{type:"object",properties:{question:{type:"string",description:"The question to ask the user. Be clear and specific."},choices:{type:"array",items:{type:"string"},description:"Optional: Predefined choices for the user to select from. If provided, user will see a menu."},allowFreeText:{type:"boolean",description:"Optional: If true, allows user to type a custom response even when choices are provided (default: false)",default:!1}},required:["question"]}}}async execute(e){const{question:t,choices:a,allowFreeText:s=!1}=e;try{let e;return e=a&&a.length>0?await this.showChoiceMenu(t,a,s):await this.showFreeTextInput(t),this.createToolResult(e,`User responded: ${e}`,!0)}catch(e){return this.formatError("Cannot get user input",e)}}showChoiceMenu(e,t,a){return new Promise(s=>{let r=0;const o=t.map(e=>({text:e,value:e}));a&&o.push({text:"输入自定义答案...",value:"__CUSTOM__"});const p=()=>{const t=o.length+5;for(let e=0;e<t;e++)e>0&&n().moveCursor(process.stdout,0,-1),n().clearLine(process.stdout,0);console.log(""),console.log(i.Ay.cyan("💬 "+e)),console.log(""),console.log(i.Ay.gray("请选择 (使用上下箭头键,Enter确认):")),console.log(""),o.forEach((e,t)=>{const a=t===r,s=a?i.Ay.green("> "):" ",n=a?i.Ay.green.bold(e.text):i.Ay.white(e.text);console.log(`${s}${n}`)}),console.log("")},d=!!process.stdin.isTTY&&process.stdin.isRaw;process.stdin.isTTY&&process.stdin.setRawMode(!0);const l=async(t,a)=>{if("up"===a.name)return r=Math.max(0,r-1),void p();if("down"===a.name)return r=Math.min(o.length-1,r+1),void p();if("return"===a.name||"enter"===a.name){process.stdin.removeListener("keypress",l),process.stdin.isTTY&&process.stdin.setRawMode(d);const t=o.length+5;for(let e=0;e<t;e++)n().moveCursor(process.stdout,0,-1),n().clearLine(process.stdout,0);const a=o[r].value;if("__CUSTOM__"===a){const t=await this.showFreeTextInput(e);s(t)}else s(a);return}if("escape"===a.name||a.ctrl&&"c"===a.name){process.stdin.removeListener("keypress",l),process.stdin.isTTY&&process.stdin.setRawMode(d);const e=o.length+5;for(let t=0;t<e;t++)n().moveCursor(process.stdout,0,-1),n().clearLine(process.stdout,0);return void s("__CANCELLED__")}};process.stdin.on("keypress",l),p()})}showFreeTextInput(e){return new Promise(t=>{const a=e||"请输入您的答案",s=process.stdin.listeners("keypress");process.stdin.removeAllListeners("keypress");const r=n().createInterface({input:process.stdin,output:process.stdout});console.log(""),console.log(i.Ay.cyan("💬 "+a)),console.log(""),r.question(i.Ay.gray("请输入答案: "),e=>{r.removeAllListeners(),process.stdin.pause(),s.forEach(e=>{process.stdin.on("keypress",e)}),process.stdin.resume(),t(e.trim())})})}formatAction(e){const t=e.question||"";return e.choices&&e.choices.length>0?`askUser(question="${t}", choices=[${e.choices.join(", ")}])`:`askUser(question="${t}")`}formatObservation(e){return"string"==typeof e?"__CANCELLED__"===e?"User cancelled the input":`User response: ${e}`:super.formatObservation(e)}}const p=new o;async function d(e){return await p.execute(e)}const l=p},2704:(e,t,a)=>{a.a(e,async(e,s)=>{try{a.d(t,{e:()=>S});var n=a(4237),i=a(3785),r=a.n(i),o=a(6893),p=a(8736),d=a(1327),l=a(5401),c=a(8743),m=a(8920),u=a(9440),h=a(9187),f=a(4239),g=e([p,d,l,c,f]);function y(e,t=null){t?t.log(e):console.log(e)}function v(e,t=null){t?t.info(e):console.log(n.Ay.blue(e))}function w(e,t=null){t?t.success(e):console.log(n.Ay.green(e))}function b(e,t=null){t?t.warning(e):console.log(n.Ay.yellow(e))}function _(e,t=null){t?t.error(e):console.log(n.Ay.red(e))}async function S(e,t=!1,a=null){let s;if((0,h.MD)("Initializing react loop with think-tool support"),t&&u.Ck.messages&&u.Ck.messages.length>0)(0,h.MD)(`Resuming existing session: ${u.Ck.sessionId}`),s=u.Ck.messages,(0,h.fH)(`恢复会话 [ID:${u.Ck.sessionId.substring(0,8)}]: ${u.Ck.currentTask}`),w(n.Ay.green(`从 ${u.Ck.updatedAt} 恢复之前的会话 [ID:${u.Ck.sessionId.substring(0,8)}]`),a),y(n.Ay.gray(`之前的任务: ${u.Ck.currentTask}`),a),u.Ck.tasks&&u.Ck.tasks.length>0&&y(n.Ay.gray(`会话中任务数量: ${u.Ck.tasks.length}`),a),y("",a);else{if(!e)return void _("No user request provided and no session to resume");(0,h.MD)(`Starting new task: ${e.substring(0,50)}${e.length>50?"...":""}`),s=[{role:"system",content:d.SYSTEM_PROMPT},{role:"user",content:e}],v(`开始新任务: ${e}`),(0,u.km)(e),(0,u.saveSession)(s,e)}let i=0;for((0,h.MD)("Starting execution loop with max 100 iterations");i<100;){i++,(0,h.MD)(`Loop iteration ${i}`);try{(0,u.saveSession)(s);const t=(0,o.MODEL)();a&&y(n.Ay.gray(`[迭代 ${i}] 使用模型: ${t}`),a),(0,h.MD)("Calling Model API with all tools including think");const r=await(0,p.callModelAPI)({model:t,messages:s,temperature:.1,tools:(0,f.getToolDefinitions)(),tool_choice:void 0});if(!r||!r.choices||0===r.choices.length){const e=`模型返回无效响应: ${JSON.stringify(r)}`;throw _(e),new Error(e)}const{choices:d}=r,g=d[0],v=g?.message;let S=null,k=null;if(v&&(({content:S,tool_calls:k}=v),S&&S.trim())){if((0,h.MD)(`Model returned text content: ${S.substring(0,100)}...`),!k||0===k.length)return w(n.Ay.green("\n最终答案:"),a),y(n.Ay.white(S),a),y("",a),s.push({role:"assistant",content:S}),(0,h.fH)("任务完成,归档会话"),(0,u.JZ)(),void(0,h.MD)("Breaking out of react loop after final answer");y(n.Ay.magenta(`💭 思考: ${S}`),a),y("",a)}if(k&&k.length>0){const t=k[0],i=t.function.name,r=t.function.arguments;let o;(0,h.MD)(`Tool call: ${i} with args: ${r}`);try{o=JSON.parse(r)}catch(e){_(`Failed to parse tool arguments: ${r}`),s.push({role:"user",content:`Error: Invalid JSON in tool arguments: ${r}`});continue}if((0,m.isThinkTool)(i)){const e=o.thought||"";y(n.Ay.magenta(`思考: ${e}`),a),y("",a),s.push({role:"assistant",content:S||null,tool_calls:[t]}),s.push({role:"tool",tool_call_id:t.id,content:"Noted. Continue."});continue}const p=(0,c.KG)()[i];if(!p){const e=`Unknown tool: ${i}`;_(e),s.push({role:"assistant",content:S||null,tool_calls:[t]}),s.push({role:"tool",tool_call_id:t.id,content:e});continue}const d=p.formatAction(o);y(n.Ay.cyan(`行动: ${d}`),a),y("",a);try{let e=!1;if("shell"===i&&p&&"function"==typeof p.getDynamicDefinition)e=p.getDynamicDefinition(o).requiresConfirmation||!1;else{const t=(0,f.JA)().find(e=>e.name===i);e=t?.requiresConfirmation||!1}if(e&&!await T(i,o,a)){const e=`工具执行已取消: ${i}`;(0,h.fH)(e),b(n.Ay.yellow(`⚠ ${e}`),a),y(n.Ay.gray("您可以继续提供新的指令或修改之前的请求。"),a),s.push({role:"assistant",content:S||null,tool_calls:[t]}),s.push({role:"tool",tool_call_id:t.id,content:"Execution cancelled by user"});continue}(0,h.MD)(`执行工具: ${i}(${JSON.stringify(o)})`);const r=await Promise.resolve(p.execute(o));(0,h.MD)(`工具 ${i} 执行完成`);const d=(0,l.extractToolResult)(r),c=!p||p.shouldPrintObservation(r),m=`${p?p.formatObservation(r):String(r)}`;c&&(y(n.Ay.yellow(`📊 观察: ${m}`),a),y("",a)),s.push({role:"assistant",content:S||null,tool_calls:[t]}),s.push({role:"tool",tool_call_id:t.id,content:String(d)})}catch(n){const r=`工具执行错误: ${i} - ${n.message}`;(0,h.vV)(r),_(r,a),y("",a),s.push({role:"assistant",content:S||null,tool_calls:[t]}),s.push({role:"tool",tool_call_id:t.id,content:`Error: ${r}`}),(0,u.saveSession)(s,e)}}if(!(S&&S.trim()||k&&0!==k.length)){if((0,h.JE)("Model returned empty response"),"stop"===g.finish_reason)return b("任务完成(模型停止)",a),(0,u.JZ)(),void(0,h.MD)("Breaking out of react loop after model stop");s.push({role:"user",content:"Please continue or provide your final answer."})}}catch(t){return _(`错误: ${t.message}`,a),b("会话已保存。使用 /resume 继续。",a),void(0,u.saveSession)(s,e)}}i>=100&&(_("错误: 已达到最大迭代次数",a),(0,u.saveSession)(s,e))}async function T(e,t,a=null){return new Promise(s=>{let i=0;const o=[{text:"确认执行",value:!0},{text:"中断执行",value:!1}],p=JSON.stringify(t),d=()=>{for(let e=0;e<8;e++)r().moveCursor(process.stdout,0,-1),r().clearLine(process.stdout,0);const t=a?n.Ay.yellow(`⚠ 确认执行 ${e}(${p})?此操作可能无法撤销。`):n.Ay.yellow(`⚠ Confirm execution of ${e}(${p})? This action may be irreversible.`);console.log(""),console.log(t),console.log(""),console.log(n.Ay.cyan("请选择 (使用上下箭头键,Enter确认):")),console.log(""),o.forEach((e,t)=>{const a=t===i,s=a?n.Ay.green("> "):" ",r=a?n.Ay.green.bold(e.text):n.Ay.white(e.text);console.log(`${s}${r}`)}),console.log("")},l=!!process.stdin.isTTY&&process.stdin.isRaw;process.stdin.isTTY&&process.stdin.setRawMode(!0);const c=(e,t)=>{if("up"===t.name)return i=Math.max(0,i-1),d(),!1;if("down"===t.name)return i=Math.min(o.length-1,i+1),d(),!1;if("return"===t.name||"enter"===t.name){process.stdin.removeListener("keypress",c),process.stdin.isTTY&&process.stdin.setRawMode(l);for(let e=0;e<8;e++)r().moveCursor(process.stdout,0,-1),r().clearLine(process.stdout,0);return s(o[i].value),!1}if("escape"===t.name||t.ctrl&&"c"===t.name){process.stdin.removeListener("keypress",c),process.stdin.isTTY&&process.stdin.setRawMode(l);for(let e=0;e<8;e++)r().moveCursor(process.stdout,0,-1),r().clearLine(process.stdout,0);return s(!1),!1}};process.stdin.on("keypress",c),d()})}[p,d,l,c,f]=g.then?(await g)():g,s()}catch(k){s(k)}})},2937:(e,t,a)=>{a.d(t,{T:()=>s});const s=e=>"function"==typeof e},2952:(e,t,a)=>{a.d(t,{E:()=>Tn});var s=a(6893);const n="RFC3986",i={RFC1738:e=>String(e).replace(/%20/g,"+"),RFC3986:e=>String(e)},r=(Object.prototype.hasOwnProperty,Array.isArray),o=(()=>{const e=[];for(let t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e})(),p=1024;function d(e,t){if(r(e)){const a=[];for(let s=0;s<e.length;s+=1)a.push(t(e[s]));return a}return t(e)}const l=Object.prototype.hasOwnProperty,c={brackets:e=>String(e)+"[]",comma:"comma",indices:(e,t)=>String(e)+"["+t+"]",repeat:e=>String(e)},m=Array.isArray,u=Array.prototype.push,h=function(e,t){u.apply(e,m(t)?t:[t])},f=Date.prototype.toISOString,g={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:(e,t,a,s,n)=>{if(0===e.length)return e;let i=e;if("symbol"==typeof e?i=Symbol.prototype.toString.call(e):"string"!=typeof e&&(i=String(e)),"iso-8859-1"===a)return escape(i).replace(/%u[0-9a-f]{4}/gi,function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"});let r="";for(let e=0;e<i.length;e+=p){const t=i.length>=p?i.slice(e,e+p):i,a=[];for(let e=0;e<t.length;++e){let s=t.charCodeAt(e);45===s||46===s||95===s||126===s||s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122||"RFC1738"===n&&(40===s||41===s)?a[a.length]=t.charAt(e):s<128?a[a.length]=o[s]:s<2048?a[a.length]=o[192|s>>6]+o[128|63&s]:s<55296||s>=57344?a[a.length]=o[224|s>>12]+o[128|s>>6&63]+o[128|63&s]:(e+=1,s=65536+((1023&s)<<10|1023&t.charCodeAt(e)),a[a.length]=o[240|s>>18]+o[128|s>>12&63]+o[128|s>>6&63]+o[128|63&s])}r+=a.join("")}return r},encodeValuesOnly:!1,format:n,formatter:i[n],indices:!1,serializeDate:e=>f.call(e),skipNulls:!1,strictNullHandling:!1},y={};function v(e,t,a,s,n,i,r,o,p,l,c,u,f,w,b,_,S,T){let k=e,x=T,C=0,A=!1;for(;void 0!==(x=x.get(y))&&!A;){const t=x.get(e);if(C+=1,void 0!==t){if(t===C)throw new RangeError("Cyclic object value");A=!0}void 0===x.get(y)&&(C=0)}if("function"==typeof l?k=l(t,k):k instanceof Date?k=f?.(k):"comma"===a&&m(k)&&(k=d(k,function(e){return e instanceof Date?f?.(e):e})),null===k){if(i)return p&&!_?p(t,g.encoder,S,"key",w):t;k=""}if("string"==typeof(E=k)||"number"==typeof E||"boolean"==typeof E||"symbol"==typeof E||"bigint"==typeof E||function(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))}(k)){if(p){const e=_?t:p(t,g.encoder,S,"key",w);return[b?.(e)+"="+b?.(p(k,g.encoder,S,"value",w))]}return[b?.(t)+"="+b?.(String(k))]}var E;const $=[];if(void 0===k)return $;let D;if("comma"===a&&m(k))_&&p&&(k=d(k,p)),D=[{value:k.length>0?k.join(",")||null:void 0}];else if(m(l))D=l;else{const e=Object.keys(k);D=c?e.sort(c):e}const N=o?String(t).replace(/\./g,"%2E"):String(t),R=s&&m(k)&&1===k.length?N+"[]":N;if(n&&m(k)&&0===k.length)return R+"[]";for(let t=0;t<D.length;++t){const d=D[t],g="object"==typeof d&&void 0!==d.value?d.value:k[d];if(r&&null===g)continue;const x=u&&o?d.replace(/\./g,"%2E"):d,A=m(k)?"function"==typeof a?a(R,x):R:R+(u?"."+x:"["+x+"]");T.set(e,C);const E=new WeakMap;E.set(y,T),h($,v(g,A,a,s,n,i,r,o,"comma"===a&&_&&m(k)?null:p,l,c,u,f,w,b,_,S,E))}return $}const w="4.104.0";let b,_,S,T,k,x,C,A,E,$=!1,D=null,N=null,R=null,P=null;var O=a(506),M=a(5606),L=a(5692),I=a(6584),j=a(3024),F=a(2005),V=a(7075);class B{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}var q=a(7830);let W=!1;async function U(e,...t){const{fileFromPath:s}=await a.e(401).then(a.bind(a,6401));return W||(console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(e)}) instead`),W=!0),await s(e,...t)}const z=new L({keepAlive:!0,timeout:3e5}),H=new L.HttpsAgent({keepAlive:!0,timeout:3e5});async function J(e,t){const a=new F.Vi(e),s=V.Readable.from(a),n=new B(s),i={...t.headers,...a.headers,"Content-Length":a.contentLength};return{...t,body:n,headers:i}}const G=()=>{b||function(e,t={auto:!1}){if($)throw new Error(`you must \`import 'openai/shims/${e.kind}'\` before importing anything else from openai`);if(b)throw new Error(`can't \`import 'openai/shims/${e.kind}'\` after \`import 'openai/shims/${b}'\``);$=t.auto,b=e.kind,_=e.fetch,D=e.Request,N=e.Response,R=e.Headers,S=e.FormData,P=e.Blob,T=e.File,k=e.ReadableStream,x=e.getMultipartRequestOptions,C=e.getDefaultAgent,A=e.fileFromPath,E=e.isFsReadStream}(("undefined"==typeof AbortController&&(globalThis.AbortController=I.AbortController),{kind:"node",fetch:O.Ay,Request:O.Kd,Response:O.YK,Headers:O.Lr,FormData:M.fS,Blob:M.YQ,File:M.ZH,ReadableStream:q.ReadableStream,getMultipartRequestOptions:J,getDefaultAgent:e=>e.startsWith("https")?H:z,fileFromPath:U,isFsReadStream:e=>e instanceof j.ReadStream}),{auto:!0})};G();class Y extends Error{}class K extends Y{constructor(e,t,a,s){super(`${K.makeMessage(e,t,a)}`),this.status=e,this.headers=s,this.request_id=s?.["x-request-id"],this.error=t;const n=t;this.code=n?.code,this.param=n?.param,this.type=n?.type}static makeMessage(e,t,a){const s=t?.message?"string"==typeof t.message?t.message:JSON.stringify(t.message):t?JSON.stringify(t):a;return e&&s?`${e} ${s}`:e?`${e} status code (no body)`:s||"(no status code or body)"}static generate(e,t,a,s){if(!e||!s)return new Q({message:a,cause:Ge(t)});const n=t?.error;return 400===e?new ee(e,n,a,s):401===e?new te(e,n,a,s):403===e?new ae(e,n,a,s):404===e?new se(e,n,a,s):409===e?new ne(e,n,a,s):422===e?new ie(e,n,a,s):429===e?new re(e,n,a,s):e>=500?new oe(e,n,a,s):new K(e,n,a,s)}}class X extends K{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}}class Q extends K{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),t&&(this.cause=t)}}class Z extends Q{constructor({message:e}={}){super({message:e??"Request timed out."})}}class ee extends K{}class te extends K{}class ae extends K{}class se extends K{}class ne extends K{}class ie extends K{}class re extends K{}class oe extends K{}class pe extends Y{constructor(){super("Could not parse response content as the length limit was reached")}}class de extends Y{constructor(){super("Could not parse response content as the request was rejected by the content filter")}}var le,ce=function(e,t,a,s,n){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(e,a):n?n.value=a:t.set(e,a),a},me=function(e,t,a,s){if("a"===a&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===a?s:"a"===a?s.call(e):s?s.value:t.get(e)};class ue{constructor(){le.set(this,void 0),this.buffer=new Uint8Array,ce(this,le,null,"f")}decode(e){if(null==e)return[];const t=e instanceof ArrayBuffer?new Uint8Array(e):"string"==typeof e?(new TextEncoder).encode(e):e;let a=new Uint8Array(this.buffer.length+t.length);a.set(this.buffer),a.set(t,this.buffer.length),this.buffer=a;const s=[];let n;for(;null!=(n=he(this.buffer,me(this,le,"f")));){if(n.carriage&&null==me(this,le,"f")){ce(this,le,n.index,"f");continue}if(null!=me(this,le,"f")&&(n.index!==me(this,le,"f")+1||n.carriage)){s.push(this.decodeText(this.buffer.slice(0,me(this,le,"f")-1))),this.buffer=this.buffer.slice(me(this,le,"f")),ce(this,le,null,"f");continue}const e=null!==me(this,le,"f")?n.preceding-1:n.preceding,t=this.decodeText(this.buffer.slice(0,e));s.push(t),this.buffer=this.buffer.slice(n.index),ce(this,le,null,"f")}return s}decodeText(e){if(null==e)return"";if("string"==typeof e)return e;if("undefined"!=typeof Buffer){if(e instanceof Buffer)return e.toString();if(e instanceof Uint8Array)return Buffer.from(e).toString();throw new Y(`Unexpected: received non-Uint8Array (${e.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`)}if("undefined"!=typeof TextDecoder){if(e instanceof Uint8Array||e instanceof ArrayBuffer)return this.textDecoder??(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode(e);throw new Y(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new Y("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode("\n"):[]}}function he(e,t){for(let a=t??0;a<e.length;a++){if(10===e[a])return{preceding:a,index:a+1,carriage:!1};if(13===e[a])return{preceding:a,index:a+1,carriage:!0}}return null}function fe(e){for(let t=0;t<e.length-1;t++){if(10===e[t]&&10===e[t+1])return t+2;if(13===e[t]&&13===e[t+1])return t+2;if(13===e[t]&&10===e[t+1]&&t+3<e.length&&13===e[t+2]&&10===e[t+3])return t+4}return-1}function ge(e){if(e[Symbol.asyncIterator])return e;const t=e.getReader();return{async next(){try{const e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){const e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}le=new WeakMap,ue.NEWLINE_CHARS=new Set(["\n","\r"]),ue.NEWLINE_REGEXP=/\r\n|[\n\r]/g;class ye{constructor(e,t){this.iterator=e,this.controller=t}static fromSSEResponse(e,t){let a=!1;return new ye(async function*(){if(a)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");a=!0;let s=!1;try{for await(const a of async function*(e,t){if(!e.body)throw t.abort(),new Y("Attempted to iterate over a response with no body");const a=new ve,s=new ue,n=ge(e.body);for await(const e of async function*(e){let t=new Uint8Array;for await(const a of e){if(null==a)continue;const e=a instanceof ArrayBuffer?new Uint8Array(a):"string"==typeof a?(new TextEncoder).encode(a):a;let s,n=new Uint8Array(t.length+e.length);for(n.set(t),n.set(e,t.length),t=n;-1!==(s=fe(t));)yield t.slice(0,s),t=t.slice(s)}t.length>0&&(yield t)}(n))for(const t of s.decode(e)){const e=a.decode(t);e&&(yield e)}for(const e of s.flush()){const t=a.decode(e);t&&(yield t)}}(e,t))if(!s)if(a.data.startsWith("[DONE]"))s=!0;else if(null===a.event||a.event.startsWith("response.")||a.event.startsWith("transcript.")){let t;try{t=JSON.parse(a.data)}catch(e){throw console.error("Could not parse message into JSON:",a.data),console.error("From chunk:",a.raw),e}if(t&&t.error)throw new K(void 0,t.error,void 0,Le(e.headers));yield t}else{let e;try{e=JSON.parse(a.data)}catch(e){throw console.error("Could not parse message into JSON:",a.data),console.error("From chunk:",a.raw),e}if("error"==a.event)throw new K(void 0,e.error,e.message,void 0);yield{event:a.event,data:e}}s=!0}catch(e){if(e instanceof Error&&"AbortError"===e.name)return;throw e}finally{s||t.abort()}},t)}static fromReadableStream(e,t){let a=!1;return new ye(async function*(){if(a)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");a=!0;let s=!1;try{for await(const t of async function*(){const t=new ue,a=ge(e);for await(const e of a)for(const a of t.decode(e))yield a;for(const e of t.flush())yield e}())s||t&&(yield JSON.parse(t));s=!0}catch(e){if(e instanceof Error&&"AbortError"===e.name)return;throw e}finally{s||t.abort()}},t)}[Symbol.asyncIterator](){return this.iterator()}tee(){const e=[],t=[],a=this.iterator(),s=s=>({next:()=>{if(0===s.length){const s=a.next();e.push(s),t.push(s)}return s.shift()}});return[new ye(()=>s(e),this.controller),new ye(()=>s(t),this.controller)]}toReadableStream(){const e=this;let t;const a=new TextEncoder;return new k({async start(){t=e[Symbol.asyncIterator]()},async pull(e){try{const{value:s,done:n}=await t.next();if(n)return e.close();const i=a.encode(JSON.stringify(s)+"\n");e.enqueue(i)}catch(t){e.error(t)}},async cancel(){await(t.return?.())}})}}class ve{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;const e={event:this.event,data:this.data.join("\n"),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],e}if(this.chunks.push(e),e.startsWith(":"))return null;let[t,a,s]=function(e){const t=e.indexOf(":");return-1!==t?[e.substring(0,t),":",e.substring(t+1)]:[e,"",""]}(e);return s.startsWith(" ")&&(s=s.substring(1)),"event"===t?this.event=s:"data"===t&&this.data.push(s),null}}const we=e=>null!=e&&"object"==typeof e&&"string"==typeof e.url&&"function"==typeof e.blob,be=e=>null!=e&&"object"==typeof e&&"string"==typeof e.name&&"number"==typeof e.lastModified&&_e(e),_e=e=>null!=e&&"object"==typeof e&&"number"==typeof e.size&&"string"==typeof e.type&&"function"==typeof e.text&&"function"==typeof e.slice&&"function"==typeof e.arrayBuffer;async function Se(e,t,a){if(e=await e,be(e))return e;if(we(e)){const s=await e.blob();t||(t=new URL(e.url).pathname.split(/[\\/]/).pop()??"unknown_file");const n=_e(s)?[await s.arrayBuffer()]:[s];return new T(n,t,a)}const s=await async function(e){let t=[];if("string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)t.push(e);else if(_e(e))t.push(await e.arrayBuffer());else{if(!ke(e))throw new Error(`Unexpected data type: ${typeof e}; constructor: ${e?.constructor?.name}; props: ${function(e){return`[${Object.getOwnPropertyNames(e).map(e=>`"${e}"`).join(", ")}]`}(e)}`);for await(const a of e)t.push(a)}return t}(e);if(t||(t=function(e){return Te(e.name)||Te(e.filename)||Te(e.path)?.split(/[\\/]/).pop()}(e)??"unknown_file"),!a?.type){const e=s[0]?.type;"string"==typeof e&&(a={...a,type:e})}return new T(s,t,a)}const Te=e=>"string"==typeof e?e:"undefined"!=typeof Buffer&&e instanceof Buffer?String(e):void 0,ke=e=>null!=e&&"object"==typeof e&&"function"==typeof e[Symbol.asyncIterator],xe=e=>e&&"object"==typeof e&&e.body&&"MultipartBody"===e[Symbol.toStringTag],Ce=async e=>{const t=await Ae(e.body);return x(t,e)},Ae=async e=>{const t=new S;return await Promise.all(Object.entries(e||{}).map(([e,a])=>Ee(t,e,a))),t},Ee=async(e,t,a)=>{if(void 0!==a){if(null==a)throw new TypeError(`Received null for "${t}"; to pass null in FormData, you must use the string 'null'`);if("string"==typeof a||"number"==typeof a||"boolean"==typeof a)e.append(t,String(a));else if((e=>be(e)||we(e)||E(e))(a)){const s=await Se(a);e.append(t,s)}else if(Array.isArray(a))await Promise.all(a.map(a=>Ee(e,t+"[]",a)));else{if("object"!=typeof a)throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${a} instead`);await Promise.all(Object.entries(a).map(([a,s])=>Ee(e,`${t}[${a}]`,s)))}}};var $e;async function De(e){const{response:t}=e;if(e.options.stream)return et("response",t.status,t.url,t.headers,t.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(t,e.controller):ye.fromSSEResponse(t,e.controller);if(204===t.status)return null;if(e.options.__binaryResponse)return t;const a=t.headers.get("content-type"),s=a?.split(";")[0]?.trim();if(s?.includes("application/json")||s?.endsWith("+json")){const e=await t.json();return et("response",t.status,t.url,t.headers,e),Ne(e,t)}const n=await t.text();return et("response",t.status,t.url,t.headers,n),n}function Ne(e,t){return!e||"object"!=typeof e||Array.isArray(e)?e:Object.defineProperty(e,"_request_id",{value:t.headers.get("x-request-id"),enumerable:!1})}G();class Re extends Promise{constructor(e,t=De){super(e=>{e(null)}),this.responsePromise=e,this.parseResponse=t}_thenUnwrap(e){return new Re(this.responsePromise,async t=>Ne(e(await this.parseResponse(t),t),t.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){const[e,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:t,request_id:t.headers.get("x-request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(this.parseResponse)),this.parsedPromise}then(e,t){return this.parse().then(e,t)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}}class Pe{constructor({baseURL:e,maxRetries:t=2,timeout:a=6e5,httpAgent:s,fetch:n}){this.baseURL=e,this.maxRetries=Je("maxRetries",t),this.timeout=Je("timeout",a),this.httpAgent=s,this.fetch=n??_}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...qe(),...this.authHeaders(e)}}validateHeaders(e,t){}defaultIdempotencyKey(){return`stainless-node-retry-${tt()}`}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,a){return this.request(Promise.resolve(a).then(async a=>{const s=a&&_e(a?.body)?new DataView(await a.body.arrayBuffer()):a?.body instanceof DataView?a.body:a?.body instanceof ArrayBuffer?new DataView(a.body):a&&ArrayBuffer.isView(a?.body)?new DataView(a.body.buffer):a?.body;return{method:e,path:t,...a,body:s}}))}getAPIList(e,t,a){return this.requestAPIList(t,{method:"get",path:e,...a})}calculateContentLength(e){if("string"==typeof e){if("undefined"!=typeof Buffer)return Buffer.byteLength(e,"utf8").toString();if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e).length.toString()}else if(ArrayBuffer.isView(e))return e.byteLength.toString();return null}buildRequest(e,{retryCount:t=0}={}){const a={...e},{method:s,path:n,query:i,headers:r={}}=a,o=ArrayBuffer.isView(a.body)||a.__binaryRequest&&"string"==typeof a.body?a.body:xe(a.body)?a.body.body:a.body?JSON.stringify(a.body,null,2):null,p=this.calculateContentLength(o),d=this.buildURL(n,i);"timeout"in a&&Je("timeout",a.timeout),a.timeout=a.timeout??this.timeout;const l=a.httpAgent??this.httpAgent??C(d),c=a.timeout+1e3;return"number"==typeof l?.options?.timeout&&c>(l.options.timeout??0)&&(l.options.timeout=c),this.idempotencyHeader&&"get"!==s&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),r[this.idempotencyHeader]=e.idempotencyKey),{req:{method:s,...o&&{body:o},headers:this.buildHeaders({options:a,headers:r,contentLength:p,retryCount:t}),...l&&{agent:l},signal:a.signal??null},url:d,timeout:a.timeout}}buildHeaders({options:e,headers:t,contentLength:a,retryCount:s}){const n={};a&&(n["content-length"]=a);const i=this.defaultHeaders(e);return Qe(n,i),Qe(n,t),xe(e.body)&&"node"!==b&&delete n["content-type"],void 0===at(i,"x-stainless-retry-count")&&void 0===at(t,"x-stainless-retry-count")&&(n["x-stainless-retry-count"]=String(s)),void 0===at(i,"x-stainless-timeout")&&void 0===at(t,"x-stainless-timeout")&&e.timeout&&(n["x-stainless-timeout"]=String(Math.trunc(e.timeout/1e3))),this.validateHeaders(n,t),n}async prepareOptions(e){}async prepareRequest(e,{url:t,options:a}){}parseHeaders(e){return e?Symbol.iterator in e?Object.fromEntries(Array.from(e).map(e=>[...e])):{...e}:{}}makeStatusError(e,t,a,s){return K.generate(e,t,a,s)}request(e,t=null){return new Re(this.makeRequest(e,t))}async makeRequest(e,t){const a=await e,s=a.maxRetries??this.maxRetries;null==t&&(t=s),await this.prepareOptions(a);const{req:n,url:i,timeout:r}=this.buildRequest(a,{retryCount:s-t});if(await this.prepareRequest(n,{url:i,options:a}),et("request",i,a,n.headers),a.signal?.aborted)throw new X;const o=new AbortController,p=await this.fetchWithTimeout(i,n,r,o).catch(Ge);if(p instanceof Error){if(a.signal?.aborted)throw new X;if(t)return this.retryRequest(a,t);if("AbortError"===p.name)throw new Z;throw new Q({cause:p})}const d=Le(p.headers);if(!p.ok){if(t&&this.shouldRetry(p))return et(`response (error; retrying, ${t} attempts remaining)`,p.status,i,d),this.retryRequest(a,t,d);const e=await p.text().catch(e=>Ge(e).message),s=We(e),n=s?void 0:e;throw et(`response (error; ${t?"(error; no more retries left)":"(error; not retryable)"})`,p.status,i,d,n),this.makeStatusError(p.status,s,n,d)}return{response:p,options:a,controller:o}}requestAPIList(e,t){const a=this.makeRequest(t,null);return new Me(this,a,e)}buildURL(e,t){const a=ze(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),s=this.defaultQuery();return Ke(s)||(t={...s,...t}),"object"==typeof t&&t&&!Array.isArray(t)&&(a.search=this.stringifyQuery(t)),a.toString()}stringifyQuery(e){return Object.entries(e).filter(([e,t])=>void 0!==t).map(([e,t])=>{if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(null===t)return`${encodeURIComponent(e)}=`;throw new Y(`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("&")}async fetchWithTimeout(e,t,a,s){const{signal:n,...i}=t||{};n&&n.addEventListener("abort",()=>s.abort());const r=setTimeout(()=>s.abort(),a),o={signal:s.signal,...i};return o.method&&(o.method=o.method.toUpperCase()),this.fetch.call(void 0,e,o).finally(()=>{clearTimeout(r)})}shouldRetry(e){const t=e.headers.get("x-should-retry");return"true"===t||"false"!==t&&(408===e.status||409===e.status||429===e.status||e.status>=500)}async retryRequest(e,t,a){let s;const n=a?.["retry-after-ms"];if(n){const e=parseFloat(n);Number.isNaN(e)||(s=e)}const i=a?.["retry-after"];if(i&&!s){const e=parseFloat(i);s=Number.isNaN(e)?Date.parse(i)-Date.now():1e3*e}if(!(s&&0<=s&&s<6e4)){const a=e.maxRetries??this.maxRetries;s=this.calculateDefaultRetryTimeoutMillis(t,a)}return await He(s),this.makeRequest(e,t-1)}calculateDefaultRetryTimeoutMillis(e,t){const a=t-e;return Math.min(.5*Math.pow(2,a),8)*(1-.25*Math.random())*1e3}getUserAgent(){return`${this.constructor.name}/JS ${w}`}}class Oe{constructor(e,t,a,s){$e.set(this,void 0),function(e,t,a,s,n){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===s?n.call(e,a):n?n.value=a:t.set(e,a)}(this,$e,e,"f"),this.options=s,this.response=t,this.body=a}hasNextPage(){return!!this.getPaginatedItems().length&&null!=this.nextPageInfo()}async getNextPage(){const e=this.nextPageInfo();if(!e)throw new Y("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");const t={...this.options};if("params"in e&&"object"==typeof t.query)t.query={...t.query,...e.params};else if("url"in e){const a=[...Object.entries(t.query||{}),...e.url.searchParams.entries()];for(const[t,s]of a)e.url.searchParams.set(t,s);t.query=void 0,t.path=e.url.toString()}return await function(e,t,a,s){if("a"===a&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===a?s:"a"===a?s.call(e):s?s.value:t.get(e)}(this,$e,"f").requestAPIList(this.constructor,t)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[($e=new WeakMap,Symbol.asyncIterator)](){for await(const e of this.iterPages())for(const t of e.getPaginatedItems())yield t}}class Me extends Re{constructor(e,t,a){super(t,async t=>new a(e,t.response,await De(t),t.options))}async*[Symbol.asyncIterator](){const e=await(this);for await(const t of e)yield t}}const Le=e=>new Proxy(Object.fromEntries(e.entries()),{get(e,t){const a=t.toString();return e[a.toLowerCase()]||e[a]}}),Ie={method:!0,path:!0,query:!0,body:!0,headers:!0,maxRetries:!0,stream:!0,timeout:!0,httpAgent:!0,signal:!0,idempotencyKey:!0,__metadata:!0,__binaryRequest:!0,__binaryResponse:!0,__streamClass:!0},je=e=>"object"==typeof e&&null!==e&&!Ke(e)&&Object.keys(e).every(e=>Xe(Ie,e)),Fe=e=>"x32"===e?"x32":"x86_64"===e||"x64"===e?"x64":"arm"===e?"arm":"aarch64"===e||"arm64"===e?"arm64":e?`other:${e}`:"unknown",Ve=e=>(e=e.toLowerCase()).includes("ios")?"iOS":"android"===e?"Android":"darwin"===e?"MacOS":"win32"===e?"Windows":"freebsd"===e?"FreeBSD":"openbsd"===e?"OpenBSD":"linux"===e?"Linux":e?`Other:${e}`:"Unknown";let Be;const qe=()=>Be??(Be=(()=>{if("undefined"!=typeof Deno&&null!=Deno.build)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":w,"X-Stainless-OS":Ve(Deno.build.os),"X-Stainless-Arch":Fe(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":"string"==typeof Deno.version?Deno.version:Deno.version?.deno??"unknown"};if("undefined"!=typeof EdgeRuntime)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":w,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":process.version};if("[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0))return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":w,"X-Stainless-OS":Ve(process.platform),"X-Stainless-Arch":Fe(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};const e=function(){if("undefined"==typeof navigator||!navigator)return null;const e=[{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/}];for(const{key:t,pattern:a}of e){const e=a.exec(navigator.userAgent);if(e)return{browser:t,version:`${e[1]||0}.${e[2]||0}.${e[3]||0}`}}return null}();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":w,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":w,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}})()),We=e=>{try{return JSON.parse(e)}catch(e){return}},Ue=/^[a-z][a-z0-9+.-]*:/i,ze=e=>Ue.test(e),He=e=>new Promise(t=>setTimeout(t,e)),Je=(e,t)=>{if("number"!=typeof t||!Number.isInteger(t))throw new Y(`${e} must be an integer`);if(t<0)throw new Y(`${e} must be a positive integer`);return t},Ge=e=>{if(e instanceof Error)return e;if("object"==typeof e&&null!==e)try{return new Error(JSON.stringify(e))}catch{}return new Error(e)},Ye=e=>"undefined"!=typeof process?process.env?.[e]?.trim()??void 0:"undefined"!=typeof Deno?Deno.env?.get?.(e)?.trim():void 0;function Ke(e){if(!e)return!0;for(const t in e)return!1;return!0}function Xe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Qe(e,t){for(const a in t){if(!Xe(t,a))continue;const s=a.toLowerCase();if(!s)continue;const n=t[a];null===n?delete e[s]:void 0!==n&&(e[s]=n)}}const Ze=new Set(["authorization","api-key"]);function et(e,...t){if("undefined"!=typeof process&&"true"===process?.env?.DEBUG){const a=t.map(e=>{if(!e)return e;if(e.headers){const t={...e,headers:{...e.headers}};for(const a in e.headers)Ze.has(a.toLowerCase())&&(t.headers[a]="REDACTED");return t}let t=null;for(const a in e)Ze.has(a.toLowerCase())&&(t??(t={...e}),t[a]="REDACTED");return t??e});console.log(`OpenAI:DEBUG:${e}`,...a)}}const tt=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}),at=(e,t)=>{const a=t.toLowerCase();if((e=>"function"==typeof e?.get)(e)){const s=t[0]?.toUpperCase()+t.substring(1).replace(/([^\w])(\w)/g,(e,t,a)=>t+a.toUpperCase());for(const n of[t,a,t.toUpperCase(),s]){const t=e.get(n);if(t)return t}}for(const[s,n]of Object.entries(e))if(s.toLowerCase()===a)return Array.isArray(n)?(n.length<=1||console.warn(`Received ${n.length} entries for the ${t} header, using the first entry.`),n[0]):n};function st(e){return null!=e&&"object"==typeof e&&!Array.isArray(e)}class nt{constructor(e){this._client=e}}class it extends nt{create(e,t){return this._client.post("/completions",{body:e,...t,stream:e.stream??!1})}}class rt extends nt{list(e,t={},a){return je(t)?this.list(e,{},t):this._client.getAPIList(`/chat/completions/${e}/messages`,ct,{query:t,...a})}}class ot extends Oe{constructor(e,t,a,s){super(e,t,a,s),this.data=a.data||[],this.object=a.object}getPaginatedItems(){return this.data??[]}nextPageParams(){return null}nextPageInfo(){return null}}class pt extends Oe{constructor(e,t,a,s){super(e,t,a,s),this.data=a.data||[],this.has_more=a.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){return!1!==this.has_more&&super.hasNextPage()}nextPageParams(){const e=this.nextPageInfo();if(!e)return null;if("params"in e)return e.params;const t=Object.fromEntries(e.url.searchParams);return Object.keys(t).length?t:null}nextPageInfo(){const e=this.getPaginatedItems();if(!e.length)return null;const t=e[e.length-1]?.id;return t?{params:{after:t}}:null}}class dt extends nt{constructor(){super(...arguments),this.messages=new rt(this._client)}create(e,t){return this._client.post("/chat/completions",{body:e,...t,stream:e.stream??!1})}retrieve(e,t){return this._client.get(`/chat/completions/${e}`,t)}update(e,t,a){return this._client.post(`/chat/completions/${e}`,{body:t,...a})}list(e={},t){return je(e)?this.list({},e):this._client.getAPIList("/chat/completions",lt,{query:e,...t})}del(e,t){return this._client.delete(`/chat/completions/${e}`,t)}}class lt extends pt{}class ct extends pt{}dt.ChatCompletionsPage=lt,dt.Messages=rt;class mt extends nt{constructor(){super(...arguments),this.completions=new dt(this._client)}}mt.Completions=dt,mt.ChatCompletionsPage=lt;class ut extends nt{create(e,t){const a=!!e.encoding_format;let s=a?e.encoding_format:"base64";a&&et("Request","User defined encoding_format:",e.encoding_format);const n=this._client.post("/embeddings",{body:{...e,encoding_format:s},...t});return a?n:(et("response","Decoding base64 embeddings to float32 array"),n._thenUnwrap(e=>(e&&e.data&&e.data.forEach(e=>{const t=e.embedding;e.embedding=(e=>{if("undefined"!=typeof Buffer){const t=Buffer.from(e,"base64");return Array.from(new Float32Array(t.buffer,t.byteOffset,t.length/Float32Array.BYTES_PER_ELEMENT))}{const t=atob(e),a=t.length,s=new Uint8Array(a);for(let e=0;e<a;e++)s[e]=t.charCodeAt(e);return Array.from(new Float32Array(s.buffer))}})(t)}),e)))}}class ht extends nt{create(e,t){return this._client.post("/files",Ce({body:e,...t}))}retrieve(e,t){return this._client.get(`/files/${e}`,t)}list(e={},t){return je(e)?this.list({},e):this._client.getAPIList("/files",ft,{query:e,...t})}del(e,t){return this._client.delete(`/files/${e}`,t)}content(e,t){return this._client.get(`/files/${e}/content`,{...t,headers:{Accept:"application/binary",...t?.headers},__binaryResponse:!0})}retrieveContent(e,t){return this._client.get(`/files/${e}/content`,t)}async waitForProcessing(e,{pollInterval:t=5e3,maxWait:a=18e5}={}){const s=new Set(["processed","error","deleted"]),n=Date.now();let i=await this.retrieve(e);for(;!i.status||!s.has(i.status);)if(await He(t),i=await this.retrieve(e),Date.now()-n>a)throw new Z({message:`Giving up on waiting for file ${e} to finish processing after ${a} milliseconds.`});return i}}class ft extends pt{}ht.FileObjectsPage=ft;class gt extends nt{createVariation(e,t){return this._client.post("/images/variations",Ce({body:e,...t}))}edit(e,t){return this._client.post("/images/edits",Ce({body:e,...t}))}generate(e,t){return this._client.post("/images/generations",{body:e,...t})}}class yt extends nt{create(e,t){return this._client.post("/audio/speech",{body:e,...t,headers:{Accept:"application/octet-stream",...t?.headers},__binaryResponse:!0})}}class vt extends nt{create(e,t){return this._client.post("/audio/transcriptions",Ce({body:e,...t,stream:e.stream??!1,__metadata:{model:e.model}}))}}class wt extends nt{create(e,t){return this._client.post("/audio/translations",Ce({body:e,...t,__metadata:{model:e.model}}))}}class bt extends nt{constructor(){super(...arguments),this.transcriptions=new vt(this._client),this.translations=new wt(this._client),this.speech=new yt(this._client)}}bt.Transcriptions=vt,bt.Translations=wt,bt.Speech=yt;class _t extends nt{create(e,t){return this._client.post("/moderations",{body:e,...t})}}class St extends nt{retrieve(e,t){return this._client.get(`/models/${e}`,t)}list(e){return this._client.getAPIList("/models",Tt,e)}del(e,t){return this._client.delete(`/models/${e}`,t)}}class Tt extends ot{}St.ModelsPage=Tt;class kt extends nt{}class xt extends nt{run(e,t){return this._client.post("/fine_tuning/alpha/graders/run",{body:e,...t})}validate(e,t){return this._client.post("/fine_tuning/alpha/graders/validate",{body:e,...t})}}class Ct extends nt{constructor(){super(...arguments),this.graders=new xt(this._client)}}Ct.Graders=xt;class At extends nt{create(e,t,a){return this._client.getAPIList(`/fine_tuning/checkpoints/${e}/permissions`,Et,{body:t,method:"post",...a})}retrieve(e,t={},a){return je(t)?this.retrieve(e,{},t):this._client.get(`/fine_tuning/checkpoints/${e}/permissions`,{query:t,...a})}del(e,t,a){return this._client.delete(`/fine_tuning/checkpoints/${e}/permissions/${t}`,a)}}class Et extends ot{}At.PermissionCreateResponsesPage=Et;class $t extends nt{constructor(){super(...arguments),this.permissions=new At(this._client)}}$t.Permissions=At,$t.PermissionCreateResponsesPage=Et;class Dt extends nt{list(e,t={},a){return je(t)?this.list(e,{},t):this._client.getAPIList(`/fine_tuning/jobs/${e}/checkpoints`,Nt,{query:t,...a})}}class Nt extends pt{}Dt.FineTuningJobCheckpointsPage=Nt;class Rt extends nt{constructor(){super(...arguments),this.checkpoints=new Dt(this._client)}create(e,t){return this._client.post("/fine_tuning/jobs",{body:e,...t})}retrieve(e,t){return this._client.get(`/fine_tuning/jobs/${e}`,t)}list(e={},t){return je(e)?this.list({},e):this._client.getAPIList("/fine_tuning/jobs",Pt,{query:e,...t})}cancel(e,t){return this._client.post(`/fine_tuning/jobs/${e}/cancel`,t)}listEvents(e,t={},a){return je(t)?this.listEvents(e,{},t):this._client.getAPIList(`/fine_tuning/jobs/${e}/events`,Ot,{query:t,...a})}pause(e,t){return this._client.post(`/fine_tuning/jobs/${e}/pause`,t)}resume(e,t){return this._client.post(`/fine_tuning/jobs/${e}/resume`,t)}}class Pt extends pt{}class Ot extends pt{}Rt.FineTuningJobsPage=Pt,Rt.FineTuningJobEventsPage=Ot,Rt.Checkpoints=Dt,Rt.FineTuningJobCheckpointsPage=Nt;class Mt extends nt{constructor(){super(...arguments),this.methods=new kt(this._client),this.jobs=new Rt(this._client),this.checkpoints=new $t(this._client),this.alpha=new Ct(this._client)}}Mt.Methods=kt,Mt.Jobs=Rt,Mt.FineTuningJobsPage=Pt,Mt.FineTuningJobEventsPage=Ot,Mt.Checkpoints=$t,Mt.Alpha=Ct;class Lt extends nt{}class It extends nt{constructor(){super(...arguments),this.graderModels=new Lt(this._client)}}It.GraderModels=Lt;class jt extends nt{create(e,t,a){return this._client.post(`/vector_stores/${e}/files`,{body:t,...a,headers:{"OpenAI-Beta":"assistants=v2",...a?.headers}})}retrieve(e,t,a){return this._client.get(`/vector_stores/${e}/files/${t}`,{...a,headers:{"OpenAI-Beta":"assistants=v2",...a?.headers}})}update(e,t,a,s){return this._client.post(`/vector_stores/${e}/files/${t}`,{body:a,...s,headers:{"OpenAI-Beta":"assistants=v2",...s?.headers}})}list(e,t={},a){return je(t)?this.list(e,{},t):this._client.getAPIList(`/vector_stores/${e}/files`,Ft,{query:t,...a,headers:{"OpenAI-Beta":"assistants=v2",...a?.headers}})}del(e,t,a){return this._client.delete(`/vector_stores/${e}/files/${t}`,{...a,headers:{"OpenAI-Beta":"assistants=v2",...a?.headers}})}async createAndPoll(e,t,a){const s=await this.create(e,t,a);return await this.poll(e,s.id,a)}async poll(e,t,a){const s={...a?.headers,"X-Stainless-Poll-Helper":"true"};for(a?.pollIntervalMs&&(s["X-Stainless-Custom-Poll-Interval"]=a.pollIntervalMs.toString());;){const n=await this.retrieve(e,t,{...a,headers:s}).withResponse(),i=n.data;switch(i.status){case"in_progress":let e=5e3;if(a?.pollIntervalMs)e=a.pollIntervalMs;else{const t=n.response.headers.get("openai-poll-after-ms");if(t){const a=parseInt(t);isNaN(a)||(e=a)}}await He(e);break;case"failed":case"completed":return i}}}async upload(e,t,a){const s=await this._client.files.create({file:t,purpose:"assistants"},a);return this.create(e,{file_id:s.id},a)}async uploadAndPoll(e,t,a){const s=await this.upload(e,t,a);return await this.poll(e,s.id,a)}content(e,t,a){return this._client.getAPIList(`/vector_stores/${e}/files/${t}/content`,Vt,{...a,headers:{"OpenAI-Beta":"assistants=v2",...a?.headers}})}}class Ft extends pt{}class Vt extends ot{}jt.VectorStoreFilesPage=Ft,jt.FileContentResponsesPage=Vt;class Bt extends nt{create(e,t,a){return this._client.post(`/vector_stores/${e}/file_batches`,{body:t,...a,headers:{"OpenAI-Beta":"assistants=v2",...a?.headers}})}retrieve(e,t,a){return this._client.get(`/vector_stores/${e}/file_batches/${t}`,{...a,headers:{"OpenAI-Beta":"assistants=v2",...a?.headers}})}cancel(e,t,a){return this._client.post(`/vector_stores/${e}/file_batches/${t}/cancel`,{...a,headers:{"OpenAI-Beta":"assistants=v2",...a?.headers}})}async createAndPoll(e,t,a){const s=await this.create(e,t);return await this.poll(e,s.id,a)}listFiles(e,t,a={},s){return je(a)?this.listFiles(e,t,{},a):this._client.getAPIList(`/vector_stores/${e}/file_batches/${t}/files`,Ft,{query:a,...s,headers:{"OpenAI-Beta":"assistants=v2",...s?.headers}})}async poll(e,t,a){const s={...a?.headers,"X-Stainless-Poll-Helper":"true"};for(a?.pollIntervalMs&&(s["X-Stainless-Custom-Poll-Interval"]=a.pollIntervalMs.toString());;){const{data:n,response:i}=await this.retrieve(e,t,{...a,headers:s}).withResponse();switch(n.status){case"in_progress":let e=5e3;if(a?.pollIntervalMs)e=a.pollIntervalMs;else{const t=i.headers.get("openai-poll-after-ms");if(t){const a=parseInt(t);isNaN(a)||(e=a)}}await He(e);break;case"failed":case"cancelled":case"completed":return n}}}async uploadAndPoll(e,{files:t,fileIds:a=[]},s){if(null==t||0==t.length)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");const n=s?.maxConcurrency??5,i=Math.min(n,t.length),r=this._client,o=t.values(),p=[...a],d=Array(i).fill(o).map(async function(e){for(let t of e){const e=await r.files.create({file:t,purpose:"assistants"},s);p.push(e.id)}});return await(async e=>{const t=await Promise.allSettled(e),a=t.filter(e=>"rejected"===e.status);if(a.length){for(const e of a)console.error(e.reason);throw new Error(`${a.length} promise(s) failed - see the above errors`)}const s=[];for(const e of t)"fulfilled"===e.status&&s.push(e.value);return s})(d),await this.createAndPoll(e,{file_ids:p})}}class qt extends nt{constructor(){super(...arguments),this.files=new jt(this._client),this.fileBatches=new Bt(this._client)}create(e,t){return this._client.post("/vector_stores",{body:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}retrieve(e,t){return this._client.get(`/vector_stores/${e}`,{...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}update(e,t,a){return this._client.post(`/vector_stores/${e}`,{body:t,...a,headers:{"OpenAI-Beta":"assistants=v2",...a?.headers}})}list(e={},t){return je(e)?this.list({},e):this._client.getAPIList("/vector_stores",Wt,{query:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}del(e,t){return this._client.delete(`/vector_stores/${e}`,{...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}search(e,t,a){return this._client.getAPIList(`/vector_stores/${e}/search`,Ut,{body:t,method:"post",...a,headers:{"OpenAI-Beta":"assistants=v2",...a?.headers}})}}class Wt extends pt{}class Ut extends ot{}qt.VectorStoresPage=Wt,qt.VectorStoreSearchResponsesPage=Ut,qt.Files=jt,qt.VectorStoreFilesPage=Ft,qt.FileContentResponsesPage=Vt,qt.FileBatches=Bt;class zt extends nt{create(e,t){return this._client.post("/assistants",{body:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}retrieve(e,t){return this._client.get(`/assistants/${e}`,{...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}update(e,t,a){return this._client.post(`/assistants/${e}`,{body:t,...a,headers:{"OpenAI-Beta":"assistants=v2",...a?.headers}})}list(e={},t){return je(e)?this.list({},e):this._client.getAPIList("/assistants",Ht,{query:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}del(e,t){return this._client.delete(`/assistants/${e}`,{...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}}class Ht extends pt{}function Jt(e){return"function"==typeof e.parse}zt.AssistantsPage=Ht;const Gt=e=>"assistant"===e?.role,Yt=e=>"function"===e?.role,Kt=e=>"tool"===e?.role;var Xt,Qt,Zt,ea,ta,aa,sa,na,ia,ra,oa,pa,da,la=function(e,t,a,s,n){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(e,a):n?n.value=a:t.set(e,a),a},ca=function(e,t,a,s){if("a"===a&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===a?s:"a"===a?s.call(e):s?s.value:t.get(e)};class ma{constructor(){Xt.add(this),this.controller=new AbortController,Qt.set(this,void 0),Zt.set(this,()=>{}),ea.set(this,()=>{}),ta.set(this,void 0),aa.set(this,()=>{}),sa.set(this,()=>{}),na.set(this,{}),ia.set(this,!1),ra.set(this,!1),oa.set(this,!1),pa.set(this,!1),la(this,Qt,new Promise((e,t)=>{la(this,Zt,e,"f"),la(this,ea,t,"f")}),"f"),la(this,ta,new Promise((e,t)=>{la(this,aa,e,"f"),la(this,sa,t,"f")}),"f"),ca(this,Qt,"f").catch(()=>{}),ca(this,ta,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},ca(this,Xt,"m",da).bind(this))},0)}_connected(){this.ended||(ca(this,Zt,"f").call(this),this._emit("connect"))}get ended(){return ca(this,ia,"f")}get errored(){return ca(this,ra,"f")}get aborted(){return ca(this,oa,"f")}abort(){this.controller.abort()}on(e,t){return(ca(this,na,"f")[e]||(ca(this,na,"f")[e]=[])).push({listener:t}),this}off(e,t){const a=ca(this,na,"f")[e];if(!a)return this;const s=a.findIndex(e=>e.listener===t);return s>=0&&a.splice(s,1),this}once(e,t){return(ca(this,na,"f")[e]||(ca(this,na,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,a)=>{la(this,pa,!0,"f"),"error"!==e&&this.once("error",a),this.once(e,t)})}async done(){la(this,pa,!0,"f"),await ca(this,ta,"f")}_emit(e,...t){if(ca(this,ia,"f"))return;"end"===e&&(la(this,ia,!0,"f"),ca(this,aa,"f").call(this));const a=ca(this,na,"f")[e];if(a&&(ca(this,na,"f")[e]=a.filter(e=>!e.once),a.forEach(({listener:e})=>e(...t))),"abort"===e){const e=t[0];return ca(this,pa,"f")||a?.length||Promise.reject(e),ca(this,ea,"f").call(this,e),ca(this,sa,"f").call(this,e),void this._emit("end")}if("error"===e){const e=t[0];ca(this,pa,"f")||a?.length||Promise.reject(e),ca(this,ea,"f").call(this,e),ca(this,sa,"f").call(this,e),this._emit("end")}}_emitFinal(){}}function ua(e){return"auto-parseable-response-format"===e?.$brand}function ha(e){return"auto-parseable-tool"===e?.$brand}function fa(e,t){const a=e.choices.map(e=>{if("length"===e.finish_reason)throw new pe;if("content_filter"===e.finish_reason)throw new de;return{...e,message:{...e.message,...e.message.tool_calls?{tool_calls:e.message.tool_calls?.map(e=>function(e,t){const a=e.tools?.find(e=>e.function?.name===t.function.name);return{...t,function:{...t.function,parsed_arguments:ha(a)?a.$parseRaw(t.function.arguments):a?.function.strict?JSON.parse(t.function.arguments):null}}}(t,e))??void 0}:void 0,parsed:e.message.content&&!e.message.refusal?ga(t,e.message.content):null}}});return{...e,choices:a}}function ga(e,t){return"json_schema"!==e.response_format?.type?null:"json_schema"===e.response_format?.type?"$parseRaw"in e.response_format?e.response_format.$parseRaw(t):JSON.parse(t):null}function ya(e,t){if(!e)return!1;const a=e.tools?.find(e=>e.function?.name===t.function.name);return ha(a)||a?.function.strict||!1}function va(e){return!!ua(e.response_format)||(e.tools?.some(e=>ha(e)||"function"===e.type&&!0===e.function.strict)??!1)}Qt=new WeakMap,Zt=new WeakMap,ea=new WeakMap,ta=new WeakMap,aa=new WeakMap,sa=new WeakMap,na=new WeakMap,ia=new WeakMap,ra=new WeakMap,oa=new WeakMap,pa=new WeakMap,Xt=new WeakSet,da=function(e){if(la(this,ra,!0,"f"),e instanceof Error&&"AbortError"===e.name&&(e=new X),e instanceof X)return la(this,oa,!0,"f"),this._emit("abort",e);if(e instanceof Y)return this._emit("error",e);if(e instanceof Error){const t=new Y(e.message);return t.cause=e,this._emit("error",t)}return this._emit("error",new Y(String(e)))};var wa,ba,_a,Sa,Ta,ka,xa,Ca,Aa=function(e,t,a,s){if("a"===a&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===a?s:"a"===a?s.call(e):s?s.value:t.get(e)};const Ea=10;class $a extends ma{constructor(){super(...arguments),wa.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion(e){this._chatCompletions.push(e),this._emit("chatCompletion",e);const t=e.choices[0]?.message;return t&&this._addMessage(t),e}_addMessage(e,t=!0){if("content"in e||(e.content=null),this.messages.push(e),t)if(this._emit("message",e),(Yt(e)||Kt(e))&&e.content)this._emit("functionCallResult",e.content);else if(Gt(e)&&e.function_call)this._emit("functionCall",e.function_call);else if(Gt(e)&&e.tool_calls)for(const t of e.tool_calls)"function"===t.type&&this._emit("functionCall",t.function)}async finalChatCompletion(){await this.done();const e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new Y("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),Aa(this,wa,"m",ba).call(this)}async finalMessage(){return await this.done(),Aa(this,wa,"m",_a).call(this)}async finalFunctionCall(){return await this.done(),Aa(this,wa,"m",Sa).call(this)}async finalFunctionCallResult(){return await this.done(),Aa(this,wa,"m",Ta).call(this)}async totalUsage(){return await this.done(),Aa(this,wa,"m",ka).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){const e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);const t=Aa(this,wa,"m",_a).call(this);t&&this._emit("finalMessage",t);const a=Aa(this,wa,"m",ba).call(this);a&&this._emit("finalContent",a);const s=Aa(this,wa,"m",Sa).call(this);s&&this._emit("finalFunctionCall",s);const n=Aa(this,wa,"m",Ta).call(this);null!=n&&this._emit("finalFunctionCallResult",n),this._chatCompletions.some(e=>e.usage)&&this._emit("totalUsage",Aa(this,wa,"m",ka).call(this))}async _createChatCompletion(e,t,a){const s=a?.signal;s&&(s.aborted&&this.controller.abort(),s.addEventListener("abort",()=>this.controller.abort())),Aa(this,wa,"m",xa).call(this,t);const n=await e.chat.completions.create({...t,stream:!1},{...a,signal:this.controller.signal});return this._connected(),this._addChatCompletion(fa(n,t))}async _runChatCompletion(e,t,a){for(const e of t.messages)this._addMessage(e,!1);return await this._createChatCompletion(e,t,a)}async _runFunctions(e,t,a){const s="function",{function_call:n="auto",stream:i,...r}=t,o="string"!=typeof n&&n?.name,{maxChatCompletions:p=Ea}=a||{},d={};for(const e of t.functions)d[e.name||e.function.name]=e;const l=t.functions.map(e=>({name:e.name||e.function.name,parameters:e.parameters,description:e.description}));for(const e of t.messages)this._addMessage(e,!1);for(let t=0;t<p;++t){const t=await this._createChatCompletion(e,{...r,function_call:n,functions:l,messages:[...this.messages]},a),i=t.choices[0]?.message;if(!i)throw new Y("missing message in ChatCompletion response");if(!i.function_call)return;const{name:p,arguments:c}=i.function_call,m=d[p];if(!m){const e=`Invalid function_call: ${JSON.stringify(p)}. Available options are: ${l.map(e=>JSON.stringify(e.name)).join(", ")}. Please try again`;this._addMessage({role:s,name:p,content:e});continue}if(o&&o!==p){const e=`Invalid function_call: ${JSON.stringify(p)}. ${JSON.stringify(o)} requested. Please try again`;this._addMessage({role:s,name:p,content:e});continue}let u;try{u=Jt(m)?await m.parse(c):c}catch(e){this._addMessage({role:s,name:p,content:e instanceof Error?e.message:String(e)});continue}const h=await m.function(u,this),f=Aa(this,wa,"m",Ca).call(this,h);if(this._addMessage({role:s,name:p,content:f}),o)return}}async _runTools(e,t,a){const s="tool",{tool_choice:n="auto",stream:i,...r}=t,o="string"!=typeof n&&n?.function?.name,{maxChatCompletions:p=Ea}=a||{},d=t.tools.map(e=>{if(ha(e)){if(!e.$callback)throw new Y("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:e.$callback,name:e.function.name,description:e.function.description||"",parameters:e.function.parameters,parse:e.$parseRaw,strict:!0}}}return e}),l={};for(const e of d)"function"===e.type&&(l[e.function.name||e.function.function.name]=e.function);const c="tools"in t?d.map(e=>"function"===e.type?{type:"function",function:{name:e.function.name||e.function.function.name,parameters:e.function.parameters,description:e.function.description,strict:e.function.strict}}:e):void 0;for(const e of t.messages)this._addMessage(e,!1);for(let t=0;t<p;++t){const t=await this._createChatCompletion(e,{...r,tool_choice:n,tools:c,messages:[...this.messages]},a),i=t.choices[0]?.message;if(!i)throw new Y("missing message in ChatCompletion response");if(!i.tool_calls?.length)return;for(const e of i.tool_calls){if("function"!==e.type)continue;const t=e.id,{name:a,arguments:n}=e.function,i=l[a];if(!i){const e=`Invalid tool_call: ${JSON.stringify(a)}. Available options are: ${Object.keys(l).map(e=>JSON.stringify(e)).join(", ")}. Please try again`;this._addMessage({role:s,tool_call_id:t,content:e});continue}if(o&&o!==a){const e=`Invalid tool_call: ${JSON.stringify(a)}. ${JSON.stringify(o)} requested. Please try again`;this._addMessage({role:s,tool_call_id:t,content:e});continue}let r;try{r=Jt(i)?await i.parse(n):n}catch(e){const a=e instanceof Error?e.message:String(e);this._addMessage({role:s,tool_call_id:t,content:a});continue}const p=await i.function(r,this),d=Aa(this,wa,"m",Ca).call(this,p);if(this._addMessage({role:s,tool_call_id:t,content:d}),o)return}}}}wa=new WeakSet,ba=function(){return Aa(this,wa,"m",_a).call(this).content??null},_a=function(){let e=this.messages.length;for(;e-- >0;){const t=this.messages[e];if(Gt(t)){const{function_call:e,...a}=t,s={...a,content:t.content??null,refusal:t.refusal??null};return e&&(s.function_call=e),s}}throw new Y("stream ended without producing a ChatCompletionMessage with role=assistant")},Sa=function(){for(let e=this.messages.length-1;e>=0;e--){const t=this.messages[e];if(Gt(t)&&t?.function_call)return t.function_call;if(Gt(t)&&t?.tool_calls?.length)return t.tool_calls.at(-1)?.function}},Ta=function(){for(let e=this.messages.length-1;e>=0;e--){const t=this.messages[e];if(Yt(t)&&null!=t.content)return t.content;if(Kt(t)&&null!=t.content&&"string"==typeof t.content&&this.messages.some(e=>"assistant"===e.role&&e.tool_calls?.some(e=>"function"===e.type&&e.id===t.tool_call_id)))return t.content}},ka=function(){const e={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(const{usage:t}of this._chatCompletions)t&&(e.completion_tokens+=t.completion_tokens,e.prompt_tokens+=t.prompt_tokens,e.total_tokens+=t.total_tokens);return e},xa=function(e){if(null!=e.n&&e.n>1)throw new Y("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},Ca=function(e){return"string"==typeof e?e:void 0===e?"undefined":JSON.stringify(e)};class Da extends $a{static runFunctions(e,t,a){const s=new Da,n={...a,headers:{...a?.headers,"X-Stainless-Helper-Method":"runFunctions"}};return s._run(()=>s._runFunctions(e,t,n)),s}static runTools(e,t,a){const s=new Da,n={...a,headers:{...a?.headers,"X-Stainless-Helper-Method":"runTools"}};return s._run(()=>s._runTools(e,t,n)),s}_addMessage(e,t=!0){super._addMessage(e,t),Gt(e)&&e.content&&this._emit("content",e.content)}}class Na extends Error{}class Ra extends Error{}const Pa=e=>function(e,t=511){if("string"!=typeof e)throw new TypeError("expecting str, got "+typeof e);if(!e.trim())throw new Error(`${e} is empty`);return((e,t)=>{const a=e.length;let s=0;const n=e=>{throw new Na(`${e} at position ${s}`)},i=e=>{throw new Ra(`${e} at position ${s}`)},r=()=>(c(),s>=a&&n("Unexpected end of input"),'"'===e[s]?o():"{"===e[s]?p():"["===e[s]?d():"null"===e.substring(s,s+4)||16&t&&a-s<4&&"null".startsWith(e.substring(s))?(s+=4,null):"true"===e.substring(s,s+4)||32&t&&a-s<4&&"true".startsWith(e.substring(s))?(s+=4,!0):"false"===e.substring(s,s+5)||32&t&&a-s<5&&"false".startsWith(e.substring(s))?(s+=5,!1):"Infinity"===e.substring(s,s+8)||128&t&&a-s<8&&"Infinity".startsWith(e.substring(s))?(s+=8,1/0):"-Infinity"===e.substring(s,s+9)||256&t&&1<a-s&&a-s<9&&"-Infinity".startsWith(e.substring(s))?(s+=9,-1/0):"NaN"===e.substring(s,s+3)||64&t&&a-s<3&&"NaN".startsWith(e.substring(s))?(s+=3,NaN):l()),o=()=>{const r=s;let o=!1;for(s++;s<a&&('"'!==e[s]||o&&"\\"===e[s-1]);)o="\\"===e[s]&&!o,s++;if('"'==e.charAt(s))try{return JSON.parse(e.substring(r,++s-Number(o)))}catch(e){i(String(e))}else if(1&t)try{return JSON.parse(e.substring(r,s-Number(o))+'"')}catch(t){return JSON.parse(e.substring(r,e.lastIndexOf("\\"))+'"')}n("Unterminated string literal")},p=()=>{s++,c();const i={};try{for(;"}"!==e[s];){if(c(),s>=a&&8&t)return i;const n=o();c(),s++;try{const e=r();Object.defineProperty(i,n,{value:e,writable:!0,enumerable:!0,configurable:!0})}catch(e){if(8&t)return i;throw e}c(),","===e[s]&&s++}}catch(e){if(8&t)return i;n("Expected '}' at end of object")}return s++,i},d=()=>{s++;const a=[];try{for(;"]"!==e[s];)a.push(r()),c(),","===e[s]&&s++}catch(e){if(4&t)return a;n("Expected ']' at end of array")}return s++,a},l=()=>{if(0===s){"-"===e&&2&t&&n("Not sure what '-' is");try{return JSON.parse(e)}catch(a){if(2&t)try{return"."===e[e.length-1]?JSON.parse(e.substring(0,e.lastIndexOf("."))):JSON.parse(e.substring(0,e.lastIndexOf("e")))}catch(e){}i(String(a))}}const r=s;for("-"===e[s]&&s++;e[s]&&!",]}".includes(e[s]);)s++;s!=a||2&t||n("Unterminated number literal");try{return JSON.parse(e.substring(r,s))}catch(a){"-"===e.substring(r,s)&&2&t&&n("Not sure what '-' is");try{return JSON.parse(e.substring(r,e.lastIndexOf("e")))}catch(e){i(String(e))}}},c=()=>{for(;s<a&&" \n\r\t".includes(e[s]);)s++};return r()})(e.trim(),t)}(e,509);var Oa,Ma,La,Ia,ja,Fa,Va,Ba,qa,Wa,Ua,za,Ha=function(e,t,a,s,n){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(e,a):n?n.value=a:t.set(e,a),a},Ja=function(e,t,a,s){if("a"===a&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===a?s:"a"===a?s.call(e):s?s.value:t.get(e)};class Ga extends $a{constructor(e){super(),Oa.add(this),Ma.set(this,void 0),La.set(this,void 0),Ia.set(this,void 0),Ha(this,Ma,e,"f"),Ha(this,La,[],"f")}get currentChatCompletionSnapshot(){return Ja(this,Ia,"f")}static fromReadableStream(e){const t=new Ga(null);return t._run(()=>t._fromReadableStream(e)),t}static createChatCompletion(e,t,a){const s=new Ga(t);return s._run(()=>s._runChatCompletion(e,{...t,stream:!0},{...a,headers:{...a?.headers,"X-Stainless-Helper-Method":"stream"}})),s}async _createChatCompletion(e,t,a){super._createChatCompletion;const s=a?.signal;s&&(s.aborted&&this.controller.abort(),s.addEventListener("abort",()=>this.controller.abort())),Ja(this,Oa,"m",ja).call(this);const n=await e.chat.completions.create({...t,stream:!0},{...a,signal:this.controller.signal});this._connected();for await(const e of n)Ja(this,Oa,"m",Va).call(this,e);if(n.controller.signal?.aborted)throw new X;return this._addChatCompletion(Ja(this,Oa,"m",Wa).call(this))}async _fromReadableStream(e,t){const a=t?.signal;a&&(a.aborted&&this.controller.abort(),a.addEventListener("abort",()=>this.controller.abort())),Ja(this,Oa,"m",ja).call(this),this._connected();const s=ye.fromReadableStream(e,this.controller);let n;for await(const e of s)n&&n!==e.id&&this._addChatCompletion(Ja(this,Oa,"m",Wa).call(this)),Ja(this,Oa,"m",Va).call(this,e),n=e.id;if(s.controller.signal?.aborted)throw new X;return this._addChatCompletion(Ja(this,Oa,"m",Wa).call(this))}[(Ma=new WeakMap,La=new WeakMap,Ia=new WeakMap,Oa=new WeakSet,ja=function(){this.ended||Ha(this,Ia,void 0,"f")},Fa=function(e){let t=Ja(this,La,"f")[e.index];return t||(t={content_done:!1,refusal_done:!1,logprobs_content_done:!1,logprobs_refusal_done:!1,done_tool_calls:new Set,current_tool_call_index:null},Ja(this,La,"f")[e.index]=t,t)},Va=function(e){if(this.ended)return;const t=Ja(this,Oa,"m",za).call(this,e);this._emit("chunk",e,t);for(const a of e.choices){const e=t.choices[a.index];null!=a.delta.content&&"assistant"===e.message?.role&&e.message?.content&&(this._emit("content",a.delta.content,e.message.content),this._emit("content.delta",{delta:a.delta.content,snapshot:e.message.content,parsed:e.message.parsed})),null!=a.delta.refusal&&"assistant"===e.message?.role&&e.message?.refusal&&this._emit("refusal.delta",{delta:a.delta.refusal,snapshot:e.message.refusal}),null!=a.logprobs?.content&&"assistant"===e.message?.role&&this._emit("logprobs.content.delta",{content:a.logprobs?.content,snapshot:e.logprobs?.content??[]}),null!=a.logprobs?.refusal&&"assistant"===e.message?.role&&this._emit("logprobs.refusal.delta",{refusal:a.logprobs?.refusal,snapshot:e.logprobs?.refusal??[]});const s=Ja(this,Oa,"m",Fa).call(this,e);e.finish_reason&&(Ja(this,Oa,"m",qa).call(this,e),null!=s.current_tool_call_index&&Ja(this,Oa,"m",Ba).call(this,e,s.current_tool_call_index));for(const t of a.delta.tool_calls??[])s.current_tool_call_index!==t.index&&(Ja(this,Oa,"m",qa).call(this,e),null!=s.current_tool_call_index&&Ja(this,Oa,"m",Ba).call(this,e,s.current_tool_call_index)),s.current_tool_call_index=t.index;for(const t of a.delta.tool_calls??[]){const a=e.message.tool_calls?.[t.index];a?.type&&("function"===a?.type?this._emit("tool_calls.function.arguments.delta",{name:a.function?.name,index:t.index,arguments:a.function.arguments,parsed_arguments:a.function.parsed_arguments,arguments_delta:t.function?.arguments??""}):Xa())}}},Ba=function(e,t){if(Ja(this,Oa,"m",Fa).call(this,e).done_tool_calls.has(t))return;const a=e.message.tool_calls?.[t];if(!a)throw new Error("no tool call snapshot");if(!a.type)throw new Error("tool call snapshot missing `type`");if("function"===a.type){const e=Ja(this,Ma,"f")?.tools?.find(e=>"function"===e.type&&e.function.name===a.function.name);this._emit("tool_calls.function.arguments.done",{name:a.function.name,index:t,arguments:a.function.arguments,parsed_arguments:ha(e)?e.$parseRaw(a.function.arguments):e?.function.strict?JSON.parse(a.function.arguments):null})}else a.type},qa=function(e){const t=Ja(this,Oa,"m",Fa).call(this,e);if(e.message.content&&!t.content_done){t.content_done=!0;const a=Ja(this,Oa,"m",Ua).call(this);this._emit("content.done",{content:e.message.content,parsed:a?a.$parseRaw(e.message.content):null})}e.message.refusal&&!t.refusal_done&&(t.refusal_done=!0,this._emit("refusal.done",{refusal:e.message.refusal})),e.logprobs?.content&&!t.logprobs_content_done&&(t.logprobs_content_done=!0,this._emit("logprobs.content.done",{content:e.logprobs.content})),e.logprobs?.refusal&&!t.logprobs_refusal_done&&(t.logprobs_refusal_done=!0,this._emit("logprobs.refusal.done",{refusal:e.logprobs.refusal}))},Wa=function(){if(this.ended)throw new Y("stream has ended, this shouldn't happen");const e=Ja(this,Ia,"f");if(!e)throw new Y("request ended without sending any chunks");return Ha(this,Ia,void 0,"f"),Ha(this,La,[],"f"),function(e,t){const{id:a,choices:s,created:n,model:i,system_fingerprint:r,...o}=e,p={...o,id:a,choices:s.map(({message:t,finish_reason:a,index:s,logprobs:n,...i})=>{if(!a)throw new Y(`missing finish_reason for choice ${s}`);const{content:r=null,function_call:o,tool_calls:p,...d}=t,l=t.role;if(!l)throw new Y(`missing role for choice ${s}`);if(o){const{arguments:e,name:p}=o;if(null==e)throw new Y(`missing function_call.arguments for choice ${s}`);if(!p)throw new Y(`missing function_call.name for choice ${s}`);return{...i,message:{content:r,function_call:{arguments:e,name:p},role:l,refusal:t.refusal??null},finish_reason:a,index:s,logprobs:n}}return p?{...i,index:s,finish_reason:a,logprobs:n,message:{...d,role:l,content:r,refusal:t.refusal??null,tool_calls:p.map((t,a)=>{const{function:n,type:i,id:r,...o}=t,{arguments:p,name:d,...l}=n||{};if(null==r)throw new Y(`missing choices[${s}].tool_calls[${a}].id\n${Ya(e)}`);if(null==i)throw new Y(`missing choices[${s}].tool_calls[${a}].type\n${Ya(e)}`);if(null==d)throw new Y(`missing choices[${s}].tool_calls[${a}].function.name\n${Ya(e)}`);if(null==p)throw new Y(`missing choices[${s}].tool_calls[${a}].function.arguments\n${Ya(e)}`);return{...o,id:r,type:i,function:{...l,name:d,arguments:p}}})}}:{...i,message:{...d,content:r,role:l,refusal:t.refusal??null},finish_reason:a,index:s,logprobs:n}}),created:n,model:i,object:"chat.completion",...r?{system_fingerprint:r}:{}};return function(e,t){return t&&va(t)?fa(e,t):{...e,choices:e.choices.map(e=>({...e,message:{...e.message,parsed:null,...e.message.tool_calls?{tool_calls:e.message.tool_calls}:void 0}}))}}(p,t)}(e,Ja(this,Ma,"f"))},Ua=function(){const e=Ja(this,Ma,"f")?.response_format;return ua(e)?e:null},za=function(e){var t,a,s,n;let i=Ja(this,Ia,"f");const{choices:r,...o}=e;i?Object.assign(i,o):i=Ha(this,Ia,{...o,choices:[]},"f");for(const{delta:r,finish_reason:o,index:p,logprobs:d=null,...l}of e.choices){let e=i.choices[p];if(e||(e=i.choices[p]={finish_reason:o,index:p,message:{},logprobs:d,...l}),d)if(e.logprobs){const{content:s,refusal:n,...i}=d;Ka(),Object.assign(e.logprobs,i),s&&((t=e.logprobs).content??(t.content=[]),e.logprobs.content.push(...s)),n&&((a=e.logprobs).refusal??(a.refusal=[]),e.logprobs.refusal.push(...n))}else e.logprobs=Object.assign({},d);if(o&&(e.finish_reason=o,Ja(this,Ma,"f")&&va(Ja(this,Ma,"f")))){if("length"===o)throw new pe;if("content_filter"===o)throw new de}if(Object.assign(e,l),!r)continue;const{content:c,refusal:m,function_call:u,role:h,tool_calls:f,...g}=r;if(Ka(),Object.assign(e.message,g),m&&(e.message.refusal=(e.message.refusal||"")+m),h&&(e.message.role=h),u&&(e.message.function_call?(u.name&&(e.message.function_call.name=u.name),u.arguments&&((s=e.message.function_call).arguments??(s.arguments=""),e.message.function_call.arguments+=u.arguments)):e.message.function_call=u),c&&(e.message.content=(e.message.content||"")+c,!e.message.refusal&&Ja(this,Oa,"m",Ua).call(this)&&(e.message.parsed=Pa(e.message.content))),f){e.message.tool_calls||(e.message.tool_calls=[]);for(const{index:t,id:a,type:s,function:i,...r}of f){const o=(n=e.message.tool_calls)[t]??(n[t]={});Object.assign(o,r),a&&(o.id=a),s&&(o.type=s),i&&(o.function??(o.function={name:i.name??"",arguments:""})),i?.name&&(o.function.name=i.name),i?.arguments&&(o.function.arguments+=i.arguments,ya(Ja(this,Ma,"f"),o)&&(o.function.parsed_arguments=Pa(o.function.arguments)))}}}return i},Symbol.asyncIterator)](){const e=[],t=[];let a=!1;return this.on("chunk",a=>{const s=t.shift();s?s.resolve(a):e.push(a)}),this.on("end",()=>{a=!0;for(const e of t)e.resolve(void 0);t.length=0}),this.on("abort",e=>{a=!0;for(const a of t)a.reject(e);t.length=0}),this.on("error",e=>{a=!0;for(const a of t)a.reject(e);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:a?{value:void 0,done:!0}:new Promise((e,a)=>t.push({resolve:e,reject:a})).then(e=>e?{value:e,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new ye(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function Ya(e){return JSON.stringify(e)}function Ka(e){}function Xa(e){}class Qa extends Ga{static fromReadableStream(e){const t=new Qa(null);return t._run(()=>t._fromReadableStream(e)),t}static runFunctions(e,t,a){const s=new Qa(null),n={...a,headers:{...a?.headers,"X-Stainless-Helper-Method":"runFunctions"}};return s._run(()=>s._runFunctions(e,t,n)),s}static runTools(e,t,a){const s=new Qa(t),n={...a,headers:{...a?.headers,"X-Stainless-Helper-Method":"runTools"}};return s._run(()=>s._runTools(e,t,n)),s}}class Za extends nt{parse(e,t){return function(e){for(const t of e??[]){if("function"!==t.type)throw new Y(`Currently only \`function\` tool types support auto-parsing; Received \`${t.type}\``);if(!0!==t.function.strict)throw new Y(`The \`${t.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}(e.tools),this._client.chat.completions.create(e,{...t,headers:{...t?.headers,"X-Stainless-Helper-Method":"beta.chat.completions.parse"}})._thenUnwrap(t=>fa(t,e))}runFunctions(e,t){return e.stream?Qa.runFunctions(this._client,e,t):Da.runFunctions(this._client,e,t)}runTools(e,t){return e.stream?Qa.runTools(this._client,e,t):Da.runTools(this._client,e,t)}stream(e,t){return Ga.createChatCompletion(this._client,e,t)}}class es extends nt{constructor(){super(...arguments),this.completions=new Za(this._client)}}!function(e){e.Completions=Za}(es||(es={}));class ts extends nt{create(e,t){return this._client.post("/realtime/sessions",{body:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}}class as extends nt{create(e,t){return this._client.post("/realtime/transcription_sessions",{body:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}}class ss extends nt{constructor(){super(...arguments),this.sessions=new ts(this._client),this.transcriptionSessions=new as(this._client)}}ss.Sessions=ts,ss.TranscriptionSessions=as;var ns,is,rs,os,ps,ds,ls,cs,ms,us,hs,fs,gs,ys,vs,ws,bs,_s,Ss,Ts,ks,xs,Cs=function(e,t,a,s){if("a"===a&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===a?s:"a"===a?s.call(e):s?s.value:t.get(e)},As=function(e,t,a,s,n){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(e,a):n?n.value=a:t.set(e,a),a};class Es extends ma{constructor(){super(...arguments),ns.add(this),is.set(this,[]),rs.set(this,{}),os.set(this,{}),ps.set(this,void 0),ds.set(this,void 0),ls.set(this,void 0),cs.set(this,void 0),ms.set(this,void 0),us.set(this,void 0),hs.set(this,void 0),fs.set(this,void 0),gs.set(this,void 0)}[(is=new WeakMap,rs=new WeakMap,os=new WeakMap,ps=new WeakMap,ds=new WeakMap,ls=new WeakMap,cs=new WeakMap,ms=new WeakMap,us=new WeakMap,hs=new WeakMap,fs=new WeakMap,gs=new WeakMap,ns=new WeakSet,Symbol.asyncIterator)](){const e=[],t=[];let a=!1;return this.on("event",a=>{const s=t.shift();s?s.resolve(a):e.push(a)}),this.on("end",()=>{a=!0;for(const e of t)e.resolve(void 0);t.length=0}),this.on("abort",e=>{a=!0;for(const a of t)a.reject(e);t.length=0}),this.on("error",e=>{a=!0;for(const a of t)a.reject(e);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:a?{value:void 0,done:!0}:new Promise((e,a)=>t.push({resolve:e,reject:a})).then(e=>e?{value:e,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}static fromReadableStream(e){const t=new Es;return t._run(()=>t._fromReadableStream(e)),t}async _fromReadableStream(e,t){const a=t?.signal;a&&(a.aborted&&this.controller.abort(),a.addEventListener("abort",()=>this.controller.abort())),this._connected();const s=ye.fromReadableStream(e,this.controller);for await(const e of s)Cs(this,ns,"m",ys).call(this,e);if(s.controller.signal?.aborted)throw new X;return this._addRun(Cs(this,ns,"m",vs).call(this))}toReadableStream(){return new ye(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,t,a,s,n){const i=new Es;return i._run(()=>i._runToolAssistantStream(e,t,a,s,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),i}async _createToolAssistantStream(e,t,a,s,n){const i=n?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));const r={...s,stream:!0},o=await e.submitToolOutputs(t,a,r,{...n,signal:this.controller.signal});this._connected();for await(const e of o)Cs(this,ns,"m",ys).call(this,e);if(o.controller.signal?.aborted)throw new X;return this._addRun(Cs(this,ns,"m",vs).call(this))}static createThreadAssistantStream(e,t,a){const s=new Es;return s._run(()=>s._threadAssistantStream(e,t,{...a,headers:{...a?.headers,"X-Stainless-Helper-Method":"stream"}})),s}static createAssistantStream(e,t,a,s){const n=new Es;return n._run(()=>n._runAssistantStream(e,t,a,{...s,headers:{...s?.headers,"X-Stainless-Helper-Method":"stream"}})),n}currentEvent(){return Cs(this,hs,"f")}currentRun(){return Cs(this,fs,"f")}currentMessageSnapshot(){return Cs(this,ps,"f")}currentRunStepSnapshot(){return Cs(this,gs,"f")}async finalRunSteps(){return await this.done(),Object.values(Cs(this,rs,"f"))}async finalMessages(){return await this.done(),Object.values(Cs(this,os,"f"))}async finalRun(){if(await this.done(),!Cs(this,ds,"f"))throw Error("Final run was not received.");return Cs(this,ds,"f")}async _createThreadAssistantStream(e,t,a){const s=a?.signal;s&&(s.aborted&&this.controller.abort(),s.addEventListener("abort",()=>this.controller.abort()));const n={...t,stream:!0},i=await e.createAndRun(n,{...a,signal:this.controller.signal});this._connected();for await(const e of i)Cs(this,ns,"m",ys).call(this,e);if(i.controller.signal?.aborted)throw new X;return this._addRun(Cs(this,ns,"m",vs).call(this))}async _createAssistantStream(e,t,a,s){const n=s?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort()));const i={...a,stream:!0},r=await e.create(t,i,{...s,signal:this.controller.signal});this._connected();for await(const e of r)Cs(this,ns,"m",ys).call(this,e);if(r.controller.signal?.aborted)throw new X;return this._addRun(Cs(this,ns,"m",vs).call(this))}static accumulateDelta(e,t){for(const[a,s]of Object.entries(t)){if(!e.hasOwnProperty(a)){e[a]=s;continue}let t=e[a];if(null!=t)if("index"!==a&&"type"!==a){if("string"==typeof t&&"string"==typeof s)t+=s;else if("number"==typeof t&&"number"==typeof s)t+=s;else{if(!st(t)||!st(s)){if(Array.isArray(t)&&Array.isArray(s)){if(t.every(e=>"string"==typeof e||"number"==typeof e)){t.push(...s);continue}for(const e of s){if(!st(e))throw new Error(`Expected array delta entry to be an object but got: ${e}`);const a=e.index;if(null==a)throw console.error(e),new Error("Expected array delta entry to have an `index` property");if("number"!=typeof a)throw new Error(`Expected array delta entry \`index\` property to be a number but got ${a}`);const s=t[a];null==s?t.push(e):t[a]=this.accumulateDelta(s,e)}continue}throw Error(`Unhandled record type: ${a}, deltaValue: ${s}, accValue: ${t}`)}t=this.accumulateDelta(t,s)}e[a]=t}else e[a]=s;else e[a]=s}return e}_addRun(e){return e}async _threadAssistantStream(e,t,a){return await this._createThreadAssistantStream(t,e,a)}async _runAssistantStream(e,t,a,s){return await this._createAssistantStream(t,e,a,s)}async _runToolAssistantStream(e,t,a,s,n){return await this._createToolAssistantStream(a,e,t,s,n)}}ys=function(e){if(!this.ended)switch(As(this,hs,e,"f"),Cs(this,ns,"m",_s).call(this,e),e.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":Cs(this,ns,"m",xs).call(this,e);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":Cs(this,ns,"m",bs).call(this,e);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":Cs(this,ns,"m",ws).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier")}},vs=function(){if(this.ended)throw new Y("stream has ended, this shouldn't happen");if(!Cs(this,ds,"f"))throw Error("Final run has not been received");return Cs(this,ds,"f")},ws=function(e){const[t,a]=Cs(this,ns,"m",Ts).call(this,e,Cs(this,ps,"f"));As(this,ps,t,"f"),Cs(this,os,"f")[t.id]=t;for(const e of a){const a=t.content[e.index];"text"==a?.type&&this._emit("textCreated",a.text)}switch(e.event){case"thread.message.created":this._emit("messageCreated",e.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",e.data.delta,t),e.data.delta.content)for(const a of e.data.delta.content){if("text"==a.type&&a.text){let e=a.text,s=t.content[a.index];if(!s||"text"!=s.type)throw Error("The snapshot associated with this text delta is not text or missing");this._emit("textDelta",e,s.text)}if(a.index!=Cs(this,ls,"f")){if(Cs(this,cs,"f"))switch(Cs(this,cs,"f").type){case"text":this._emit("textDone",Cs(this,cs,"f").text,Cs(this,ps,"f"));break;case"image_file":this._emit("imageFileDone",Cs(this,cs,"f").image_file,Cs(this,ps,"f"))}As(this,ls,a.index,"f")}As(this,cs,t.content[a.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(void 0!==Cs(this,ls,"f")){const t=e.data.content[Cs(this,ls,"f")];if(t)switch(t.type){case"image_file":this._emit("imageFileDone",t.image_file,Cs(this,ps,"f"));break;case"text":this._emit("textDone",t.text,Cs(this,ps,"f"))}}Cs(this,ps,"f")&&this._emit("messageDone",e.data),As(this,ps,void 0,"f")}},bs=function(e){const t=Cs(this,ns,"m",Ss).call(this,e);switch(As(this,gs,t,"f"),e.event){case"thread.run.step.created":this._emit("runStepCreated",e.data);break;case"thread.run.step.delta":const a=e.data.delta;if(a.step_details&&"tool_calls"==a.step_details.type&&a.step_details.tool_calls&&"tool_calls"==t.step_details.type)for(const e of a.step_details.tool_calls)e.index==Cs(this,ms,"f")?this._emit("toolCallDelta",e,t.step_details.tool_calls[e.index]):(Cs(this,us,"f")&&this._emit("toolCallDone",Cs(this,us,"f")),As(this,ms,e.index,"f"),As(this,us,t.step_details.tool_calls[e.index],"f"),Cs(this,us,"f")&&this._emit("toolCallCreated",Cs(this,us,"f")));this._emit("runStepDelta",e.data.delta,t);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":As(this,gs,void 0,"f"),"tool_calls"==e.data.step_details.type&&Cs(this,us,"f")&&(this._emit("toolCallDone",Cs(this,us,"f")),As(this,us,void 0,"f")),this._emit("runStepDone",e.data,t)}},_s=function(e){Cs(this,is,"f").push(e),this._emit("event",e)},Ss=function(e){switch(e.event){case"thread.run.step.created":return Cs(this,rs,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let t=Cs(this,rs,"f")[e.data.id];if(!t)throw Error("Received a RunStepDelta before creation of a snapshot");let a=e.data;if(a.delta){const s=Es.accumulateDelta(t,a.delta);Cs(this,rs,"f")[e.data.id]=s}return Cs(this,rs,"f")[e.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":Cs(this,rs,"f")[e.data.id]=e.data}if(Cs(this,rs,"f")[e.data.id])return Cs(this,rs,"f")[e.data.id];throw new Error("No snapshot available")},Ts=function(e,t){let a=[];switch(e.event){case"thread.message.created":return[e.data,a];case"thread.message.delta":if(!t)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let s=e.data;if(s.delta.content)for(const e of s.delta.content)if(e.index in t.content){let a=t.content[e.index];t.content[e.index]=Cs(this,ns,"m",ks).call(this,e,a)}else t.content[e.index]=e,a.push(e);return[t,a];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(t)return[t,a];throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},ks=function(e,t){return Es.accumulateDelta(t,e)},xs=function(e){switch(As(this,fs,e.data,"f"),e.event){case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.cancelling":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":As(this,ds,e.data,"f"),Cs(this,us,"f")&&(this._emit("toolCallDone",Cs(this,us,"f")),As(this,us,void 0,"f"))}};class $s extends nt{create(e,t,a){return this._client.post(`/threads/${e}/messages`,{body:t,...a,headers:{"OpenAI-Beta":"assistants=v2",...a?.headers}})}retrieve(e,t,a){return this._client.get(`/threads/${e}/messages/${t}`,{...a,headers:{"OpenAI-Beta":"assistants=v2",...a?.headers}})}update(e,t,a,s){return this._client.post(`/threads/${e}/messages/${t}`,{body:a,...s,headers:{"OpenAI-Beta":"assistants=v2",...s?.headers}})}list(e,t={},a){return je(t)?this.list(e,{},t):this._client.getAPIList(`/threads/${e}/messages`,Ds,{query:t,...a,headers:{"OpenAI-Beta":"assistants=v2",...a?.headers}})}del(e,t,a){return this._client.delete(`/threads/${e}/messages/${t}`,{...a,headers:{"OpenAI-Beta":"assistants=v2",...a?.headers}})}}class Ds extends pt{}$s.MessagesPage=Ds;class Ns extends nt{retrieve(e,t,a,s={},n){return je(s)?this.retrieve(e,t,a,{},s):this._client.get(`/threads/${e}/runs/${t}/steps/${a}`,{query:s,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}list(e,t,a={},s){return je(a)?this.list(e,t,{},a):this._client.getAPIList(`/threads/${e}/runs/${t}/steps`,Rs,{query:a,...s,headers:{"OpenAI-Beta":"assistants=v2",...s?.headers}})}}class Rs extends pt{}Ns.RunStepsPage=Rs;class Ps extends nt{constructor(){super(...arguments),this.steps=new Ns(this._client)}create(e,t,a){const{include:s,...n}=t;return this._client.post(`/threads/${e}/runs`,{query:{include:s},body:n,...a,headers:{"OpenAI-Beta":"assistants=v2",...a?.headers},stream:t.stream??!1})}retrieve(e,t,a){return this._client.get(`/threads/${e}/runs/${t}`,{...a,headers:{"OpenAI-Beta":"assistants=v2",...a?.headers}})}update(e,t,a,s){return this._client.post(`/threads/${e}/runs/${t}`,{body:a,...s,headers:{"OpenAI-Beta":"assistants=v2",...s?.headers}})}list(e,t={},a){return je(t)?this.list(e,{},t):this._client.getAPIList(`/threads/${e}/runs`,Os,{query:t,...a,headers:{"OpenAI-Beta":"assistants=v2",...a?.headers}})}cancel(e,t,a){return this._client.post(`/threads/${e}/runs/${t}/cancel`,{...a,headers:{"OpenAI-Beta":"assistants=v2",...a?.headers}})}async createAndPoll(e,t,a){const s=await this.create(e,t,a);return await this.poll(e,s.id,a)}createAndStream(e,t,a){return Es.createAssistantStream(e,this._client.beta.threads.runs,t,a)}async poll(e,t,a){const s={...a?.headers,"X-Stainless-Poll-Helper":"true"};for(a?.pollIntervalMs&&(s["X-Stainless-Custom-Poll-Interval"]=a.pollIntervalMs.toString());;){const{data:n,response:i}=await this.retrieve(e,t,{...a,headers:{...a?.headers,...s}}).withResponse();switch(n.status){case"queued":case"in_progress":case"cancelling":let e=5e3;if(a?.pollIntervalMs)e=a.pollIntervalMs;else{const t=i.headers.get("openai-poll-after-ms");if(t){const a=parseInt(t);isNaN(a)||(e=a)}}await He(e);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return n}}}stream(e,t,a){return Es.createAssistantStream(e,this._client.beta.threads.runs,t,a)}submitToolOutputs(e,t,a,s){return this._client.post(`/threads/${e}/runs/${t}/submit_tool_outputs`,{body:a,...s,headers:{"OpenAI-Beta":"assistants=v2",...s?.headers},stream:a.stream??!1})}async submitToolOutputsAndPoll(e,t,a,s){const n=await this.submitToolOutputs(e,t,a,s);return await this.poll(e,n.id,s)}submitToolOutputsStream(e,t,a,s){return Es.createToolAssistantStream(e,t,this._client.beta.threads.runs,a,s)}}class Os extends pt{}Ps.RunsPage=Os,Ps.Steps=Ns,Ps.RunStepsPage=Rs;class Ms extends nt{constructor(){super(...arguments),this.runs=new Ps(this._client),this.messages=new $s(this._client)}create(e={},t){return je(e)?this.create({},e):this._client.post("/threads",{body:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}retrieve(e,t){return this._client.get(`/threads/${e}`,{...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}update(e,t,a){return this._client.post(`/threads/${e}`,{body:t,...a,headers:{"OpenAI-Beta":"assistants=v2",...a?.headers}})}del(e,t){return this._client.delete(`/threads/${e}`,{...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}createAndRun(e,t){return this._client.post("/threads/runs",{body:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers},stream:e.stream??!1})}async createAndRunPoll(e,t){const a=await this.createAndRun(e,t);return await this.runs.poll(a.thread_id,a.id,t)}createAndRunStream(e,t){return Es.createThreadAssistantStream(e,this._client.beta.threads,t)}}Ms.Runs=Ps,Ms.RunsPage=Os,Ms.Messages=$s,Ms.MessagesPage=Ds;class Ls extends nt{constructor(){super(...arguments),this.realtime=new ss(this._client),this.chat=new es(this._client),this.assistants=new zt(this._client),this.threads=new Ms(this._client)}}Ls.Realtime=ss,Ls.Assistants=zt,Ls.AssistantsPage=Ht,Ls.Threads=Ms;class Is extends nt{create(e,t){return this._client.post("/batches",{body:e,...t})}retrieve(e,t){return this._client.get(`/batches/${e}`,t)}list(e={},t){return je(e)?this.list({},e):this._client.getAPIList("/batches",js,{query:e,...t})}cancel(e,t){return this._client.post(`/batches/${e}/cancel`,t)}}class js extends pt{}Is.BatchesPage=js;class Fs extends nt{create(e,t,a){return this._client.post(`/uploads/${e}/parts`,Ce({body:t,...a}))}}class Vs extends nt{constructor(){super(...arguments),this.parts=new Fs(this._client)}create(e,t){return this._client.post("/uploads",{body:e,...t})}cancel(e,t){return this._client.post(`/uploads/${e}/cancel`,t)}complete(e,t,a){return this._client.post(`/uploads/${e}/complete`,{body:t,...a})}}function Bs(e,t){const a=e.output.map(e=>{if("function_call"===e.type)return{...e,parsed_arguments:Ws(t,e)};if("message"===e.type){const a=e.content.map(e=>"output_text"===e.type?{...e,parsed:qs(t,e.text)}:e);return{...e,content:a}}return e}),s=Object.assign({},e,{output:a});return Object.getOwnPropertyDescriptor(e,"output_text")||Us(s),Object.defineProperty(s,"output_parsed",{enumerable:!0,get(){for(const e of s.output)if("message"===e.type)for(const t of e.content)if("output_text"===t.type&&null!==t.parsed)return t.parsed;return null}}),s}function qs(e,t){if("json_schema"!==e.text?.format?.type)return null;if("$parseRaw"in e.text?.format){const a=e.text?.format;return a.$parseRaw(t)}return JSON.parse(t)}function Ws(e,t){const a=(s=e.tools??[],n=t.name,s.find(e=>"function"===e.type&&e.name===n));var s,n,i;return{...t,...t,parsed_arguments:(i=a,"auto-parseable-tool"===i?.$brand?a.$parseRaw(t.arguments):a?.strict?JSON.parse(t.arguments):null)}}function Us(e){const t=[];for(const a of e.output)if("message"===a.type)for(const e of a.content)"output_text"===e.type&&t.push(e.text);e.output_text=t.join("")}Vs.Parts=Fs;class zs extends nt{list(e,t={},a){return je(t)?this.list(e,{},t):this._client.getAPIList(`/responses/${e}/input_items`,rn,{query:t,...a})}}var Hs,Js,Gs,Ys,Ks,Xs,Qs,Zs,en,tn=function(e,t,a,s,n){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(e,a):n?n.value=a:t.set(e,a),a},an=function(e,t,a,s){if("a"===a&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===a?s:"a"===a?s.call(e):s?s.value:t.get(e)};class sn extends ma{constructor(e){super(),Hs.add(this),Js.set(this,void 0),Gs.set(this,void 0),Ys.set(this,void 0),tn(this,Js,e,"f")}static createResponse(e,t,a){const s=new sn(t);return s._run(()=>s._createOrRetrieveResponse(e,t,{...a,headers:{...a?.headers,"X-Stainless-Helper-Method":"stream"}})),s}async _createOrRetrieveResponse(e,t,a){const s=a?.signal;let n;s&&(s.aborted&&this.controller.abort(),s.addEventListener("abort",()=>this.controller.abort())),an(this,Hs,"m",Ks).call(this);let i=null;"response_id"in t?(n=await e.responses.retrieve(t.response_id,{stream:!0},{...a,signal:this.controller.signal,stream:!0}),i=t.starting_after??null):n=await e.responses.create({...t,stream:!0},{...a,signal:this.controller.signal}),this._connected();for await(const e of n)an(this,Hs,"m",Xs).call(this,e,i);if(n.controller.signal?.aborted)throw new X;return an(this,Hs,"m",Qs).call(this)}[(Js=new WeakMap,Gs=new WeakMap,Ys=new WeakMap,Hs=new WeakSet,Ks=function(){this.ended||tn(this,Gs,void 0,"f")},Xs=function(e,t){if(this.ended)return;const a=(e,a)=>{(null==t||a.sequence_number>t)&&this._emit(e,a)},s=an(this,Hs,"m",Zs).call(this,e);switch(a("event",e),e.type){case"response.output_text.delta":{const t=s.output[e.output_index];if(!t)throw new Y(`missing output at index ${e.output_index}`);if("message"===t.type){const s=t.content[e.content_index];if(!s)throw new Y(`missing content at index ${e.content_index}`);if("output_text"!==s.type)throw new Y(`expected content to be 'output_text', got ${s.type}`);a("response.output_text.delta",{...e,snapshot:s.text})}break}case"response.function_call_arguments.delta":{const t=s.output[e.output_index];if(!t)throw new Y(`missing output at index ${e.output_index}`);"function_call"===t.type&&a("response.function_call_arguments.delta",{...e,snapshot:t.arguments});break}default:a(e.type,e)}},Qs=function(){if(this.ended)throw new Y("stream has ended, this shouldn't happen");const e=an(this,Gs,"f");if(!e)throw new Y("request ended without sending any events");tn(this,Gs,void 0,"f");const t=function(e,t){return function(e,t){return t&&function(e){return!!ua(e.text?.format)}(t)?Bs(e,t):{...e,output_parsed:null,output:e.output.map(e=>"function_call"===e.type?{...e,parsed_arguments:null}:"message"===e.type?{...e,content:e.content.map(e=>({...e,parsed:null}))}:e)}}(e,t)}(e,an(this,Js,"f"));return tn(this,Ys,t,"f"),t},Zs=function(e){let t=an(this,Gs,"f");if(!t){if("response.created"!==e.type)throw new Y(`When snapshot hasn't been set yet, expected 'response.created' event, got ${e.type}`);return t=tn(this,Gs,e.response,"f"),t}switch(e.type){case"response.output_item.added":t.output.push(e.item);break;case"response.content_part.added":{const a=t.output[e.output_index];if(!a)throw new Y(`missing output at index ${e.output_index}`);"message"===a.type&&a.content.push(e.part);break}case"response.output_text.delta":{const a=t.output[e.output_index];if(!a)throw new Y(`missing output at index ${e.output_index}`);if("message"===a.type){const t=a.content[e.content_index];if(!t)throw new Y(`missing content at index ${e.content_index}`);if("output_text"!==t.type)throw new Y(`expected content to be 'output_text', got ${t.type}`);t.text+=e.delta}break}case"response.function_call_arguments.delta":{const a=t.output[e.output_index];if(!a)throw new Y(`missing output at index ${e.output_index}`);"function_call"===a.type&&(a.arguments+=e.delta);break}case"response.completed":tn(this,Gs,e.response,"f")}return t},Symbol.asyncIterator)](){const e=[],t=[];let a=!1;return this.on("event",a=>{const s=t.shift();s?s.resolve(a):e.push(a)}),this.on("end",()=>{a=!0;for(const e of t)e.resolve(void 0);t.length=0}),this.on("abort",e=>{a=!0;for(const a of t)a.reject(e);t.length=0}),this.on("error",e=>{a=!0;for(const a of t)a.reject(e);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:a?{value:void 0,done:!0}:new Promise((e,a)=>t.push({resolve:e,reject:a})).then(e=>e?{value:e,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}async finalResponse(){await this.done();const e=an(this,Ys,"f");if(!e)throw new Y("stream ended without producing a ChatCompletion");return e}}class nn extends nt{constructor(){super(...arguments),this.inputItems=new zs(this._client)}create(e,t){return this._client.post("/responses",{body:e,...t,stream:e.stream??!1})._thenUnwrap(e=>("object"in e&&"response"===e.object&&Us(e),e))}retrieve(e,t={},a){return this._client.get(`/responses/${e}`,{query:t,...a,stream:t?.stream??!1})}del(e,t){return this._client.delete(`/responses/${e}`,{...t,headers:{Accept:"*/*",...t?.headers}})}parse(e,t){return this._client.responses.create(e,t)._thenUnwrap(t=>Bs(t,e))}stream(e,t){return sn.createResponse(this._client,e,t)}cancel(e,t){return this._client.post(`/responses/${e}/cancel`,{...t,headers:{Accept:"*/*",...t?.headers}})}}class rn extends pt{}nn.InputItems=zs;class on extends nt{retrieve(e,t,a,s){return this._client.get(`/evals/${e}/runs/${t}/output_items/${a}`,s)}list(e,t,a={},s){return je(a)?this.list(e,t,{},a):this._client.getAPIList(`/evals/${e}/runs/${t}/output_items`,pn,{query:a,...s})}}class pn extends pt{}on.OutputItemListResponsesPage=pn;class dn extends nt{constructor(){super(...arguments),this.outputItems=new on(this._client)}create(e,t,a){return this._client.post(`/evals/${e}/runs`,{body:t,...a})}retrieve(e,t,a){return this._client.get(`/evals/${e}/runs/${t}`,a)}list(e,t={},a){return je(t)?this.list(e,{},t):this._client.getAPIList(`/evals/${e}/runs`,ln,{query:t,...a})}del(e,t,a){return this._client.delete(`/evals/${e}/runs/${t}`,a)}cancel(e,t,a){return this._client.post(`/evals/${e}/runs/${t}`,a)}}class ln extends pt{}dn.RunListResponsesPage=ln,dn.OutputItems=on,dn.OutputItemListResponsesPage=pn;class cn extends nt{constructor(){super(...arguments),this.runs=new dn(this._client)}create(e,t){return this._client.post("/evals",{body:e,...t})}retrieve(e,t){return this._client.get(`/evals/${e}`,t)}update(e,t,a){return this._client.post(`/evals/${e}`,{body:t,...a})}list(e={},t){return je(e)?this.list({},e):this._client.getAPIList("/evals",mn,{query:e,...t})}del(e,t){return this._client.delete(`/evals/${e}`,t)}}class mn extends pt{}cn.EvalListResponsesPage=mn,cn.Runs=dn,cn.RunListResponsesPage=ln;class un extends nt{retrieve(e,t,a){return this._client.get(`/containers/${e}/files/${t}/content`,{...a,headers:{Accept:"application/binary",...a?.headers},__binaryResponse:!0})}}class hn extends nt{constructor(){super(...arguments),this.content=new un(this._client)}create(e,t,a){return this._client.post(`/containers/${e}/files`,Ce({body:t,...a}))}retrieve(e,t,a){return this._client.get(`/containers/${e}/files/${t}`,a)}list(e,t={},a){return je(t)?this.list(e,{},t):this._client.getAPIList(`/containers/${e}/files`,fn,{query:t,...a})}del(e,t,a){return this._client.delete(`/containers/${e}/files/${t}`,{...a,headers:{Accept:"*/*",...a?.headers}})}}class fn extends pt{}hn.FileListResponsesPage=fn,hn.Content=un;class gn extends nt{constructor(){super(...arguments),this.files=new hn(this._client)}create(e,t){return this._client.post("/containers",{body:e,...t})}retrieve(e,t){return this._client.get(`/containers/${e}`,t)}list(e={},t){return je(e)?this.list({},e):this._client.getAPIList("/containers",yn,{query:e,...t})}del(e,t){return this._client.delete(`/containers/${e}`,{...t,headers:{Accept:"*/*",...t?.headers}})}}class yn extends pt{}gn.ContainerListResponsesPage=yn,gn.Files=hn,gn.FileListResponsesPage=fn;class vn extends Pe{constructor({baseURL:e=Ye("OPENAI_BASE_URL"),apiKey:t=Ye("OPENAI_API_KEY"),organization:a=Ye("OPENAI_ORG_ID")??null,project:s=Ye("OPENAI_PROJECT_ID")??null,...n}={}){if(void 0===t)throw new Y("The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: 'My API Key' }).");const i={apiKey:t,organization:a,project:s,...n,baseURL:e||"https://api.openai.com/v1"};if(!i.dangerouslyAllowBrowser&&"undefined"!=typeof window&&void 0!==window.document&&"undefined"!=typeof navigator)throw new Y("It looks like you're running in a browser-like environment.\n\nThis is disabled by default, as it risks exposing your secret API credentials to attackers.\nIf you understand the risks and have appropriate mitigations in place,\nyou can set the `dangerouslyAllowBrowser` option to `true`, e.g.,\n\nnew OpenAI({ apiKey, dangerouslyAllowBrowser: true });\n\nhttps://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety\n");super({baseURL:i.baseURL,timeout:i.timeout??6e5,httpAgent:i.httpAgent,maxRetries:i.maxRetries,fetch:i.fetch}),this.completions=new it(this),this.chat=new mt(this),this.embeddings=new ut(this),this.files=new ht(this),this.images=new gt(this),this.audio=new bt(this),this.moderations=new _t(this),this.models=new St(this),this.fineTuning=new Mt(this),this.graders=new It(this),this.vectorStores=new qt(this),this.beta=new Ls(this),this.batches=new Is(this),this.uploads=new Vs(this),this.responses=new nn(this),this.evals=new cn(this),this.containers=new gn(this),this._options=i,this.apiKey=t,this.organization=a,this.project=s}defaultQuery(){return this._options.defaultQuery}defaultHeaders(e){return{...super.defaultHeaders(e),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project,...this._options.defaultHeaders}}authHeaders(e){return{Authorization:`Bearer ${this.apiKey}`}}stringifyQuery(e){return function(e,t={}){let a=e;const s=function(e=g){if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.encodeDotInKeys&&"boolean"!=typeof e.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");const t=e.charset||g.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let a=n;if(void 0!==e.format){if(!l.call(i,e.format))throw new TypeError("Unknown format option provided.");a=e.format}const s=i[a];let r,o=g.filter;if(("function"==typeof e.filter||m(e.filter))&&(o=e.filter),r=e.arrayFormat&&e.arrayFormat in c?e.arrayFormat:"indices"in e?e.indices?"indices":"repeat":g.arrayFormat,"commaRoundTrip"in e&&"boolean"!=typeof e.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");const p=void 0===e.allowDots?1==!!e.encodeDotInKeys||g.allowDots:!!e.allowDots;return{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:g.addQueryPrefix,allowDots:p,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:g.allowEmptyArrays,arrayFormat:r,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:g.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:void 0===e.delimiter?g.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:g.encode,encodeDotInKeys:"boolean"==typeof e.encodeDotInKeys?e.encodeDotInKeys:g.encodeDotInKeys,encoder:"function"==typeof e.encoder?e.encoder:g.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:g.encodeValuesOnly,filter:o,format:a,formatter:s,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:g.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:g.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:g.strictNullHandling}}(t);let r,o;"function"==typeof s.filter?(o=s.filter,a=o("",a)):m(s.filter)&&(o=s.filter,r=o);const p=[];if("object"!=typeof a||null===a)return"";const d=c[s.arrayFormat],u="comma"===d&&s.commaRoundTrip;r||(r=Object.keys(a)),s.sort&&r.sort(s.sort);const f=new WeakMap;for(let e=0;e<r.length;++e){const t=r[e];s.skipNulls&&null===a[t]||h(p,v(a[t],t,d,u,s.allowEmptyArrays,s.strictNullHandling,s.skipNulls,s.encodeDotInKeys,s.encode?s.encoder:null,s.filter,s.sort,s.allowDots,s.serializeDate,s.format,s.formatter,s.encodeValuesOnly,s.charset,f))}const y=p.join(s.delimiter);let w=!0===s.addQueryPrefix?"?":"";return s.charsetSentinel&&("iso-8859-1"===s.charset?w+="utf8=%26%2310003%3B&":w+="utf8=%E2%9C%93&"),y.length>0?w+y:""}(e,{arrayFormat:"brackets"})}}en=vn,vn.OpenAI=en,vn.DEFAULT_TIMEOUT=6e5,vn.OpenAIError=Y,vn.APIError=K,vn.APIConnectionError=Q,vn.APIConnectionTimeoutError=Z,vn.APIUserAbortError=X,vn.NotFoundError=se,vn.ConflictError=ne,vn.RateLimitError=re,vn.BadRequestError=ee,vn.AuthenticationError=te,vn.InternalServerError=oe,vn.PermissionDeniedError=ae,vn.UnprocessableEntityError=ie,vn.toFile=Se,vn.fileFromPath=A,vn.Completions=it,vn.Chat=mt,vn.ChatCompletionsPage=lt,vn.Embeddings=ut,vn.Files=ht,vn.FileObjectsPage=ft,vn.Images=gt,vn.Audio=bt,vn.Moderations=_t,vn.Models=St,vn.ModelsPage=Tt,vn.FineTuning=Mt,vn.Graders=It,vn.VectorStores=qt,vn.VectorStoresPage=Wt,vn.VectorStoreSearchResponsesPage=Ut,vn.Beta=Ls,vn.Batches=Is,vn.BatchesPage=js,vn.Uploads=Vs,vn.Responses=nn,vn.Evals=cn,vn.EvalListResponsesPage=mn,vn.Containers=gn,vn.ContainerListResponsesPage=yn,new Set(["/completions","/chat/completions","/embeddings","/audio/transcriptions","/audio/translations","/audio/speech","/images/generations","/images/edits"]);const wn=vn;class bn{config;constructor(e){this.config=e}getModelName(){return this.config.model}getProviderType(){return this.config.provider}_getApiKey(){return this.config.apiKey}_getBaseURL(){return this.config.baseURL}}const _n=class extends bn{client=null;constructor(e){super(e)}_initClient(){return this.client||(this.client=new wn({apiKey:this.config.apiKey,baseURL:this.config.baseURL||"https://api.openai.com/v1"})),this.client}async callModel(e){const{model:t=this.getModelName(),messages:a,temperature:s=.1,max_tokens:n,tools:i,tool_choice:r}=e,o=this._initClient(),p={model:t,messages:[...a],temperature:s,max_tokens:n};i&&i.length>0&&(p.tools=i.map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.input_schema}})),r&&("any"===r.type||(p.tool_choice=r)));const d=await o.chat.completions.create(p);return this._processReasoningContent(d),d}_processReasoningContent(e){if(e.choices&&e.choices[0]&&e.choices[0].message&&e.choices[0].message.reasoning_content){const{message:t}=e.choices[0],a=t.reasoning_content;if(t.tool_calls&&t.tool_calls.length>0)return void(t.content?"string"==typeof t.content&&(t.content=`${a}\n\n${t.content}`):t.content=a);try{let e=[];try{const s=JSON.parse(a);Array.isArray(s)&&s.length>0?(e=s.filter(e=>e&&e.name).map(e=>({id:`call_${e.name}_${Date.now()}`,type:"function",function:{name:e.name,arguments:JSON.stringify(e.parameters||{})}})),t.tool_calls=e):t.content||(t.content=a)}catch(e){t.content||(t.content=a)}}catch(e){console.warn("Failed to process reasoning_content:",e)}}}},Sn=class extends bn{client=null;constructor(e){super(e)}async _initClient(){if(!this.client){const{Anthropic:e}=await a.e(281).then(a.bind(a,2281));this.client=new e({apiKey:this.config.apiKey})}return this.client}async callModel(e){const{model:t=this.getModelName(),messages:a,temperature:s=.1,max_tokens:n=4096,tools:i,tool_choice:r}=e,o=await this._initClient();let p=[...a],d="";const l=p.filter(e=>"system"===e.role);l.length>0&&(d=l.map(e=>e.content).join("\n\n")),p=p.filter(e=>"system"!==e.role);const c=[];let m=0;for(;m<p.length;){const e=p[m];if("assistant"===e.role){const t=[];if(e.content&&"string"==typeof e.content&&t.push({type:"text",text:e.content}),e.tool_calls&&e.tool_calls.length>0)for(const a of e.tool_calls)t.push({type:"tool_use",id:a.id,name:a.function.name,input:JSON.parse(a.function.arguments)});t.length>0&&c.push({role:"assistant",content:t}),m++}else if("tool"===e.role){const e=[];for(;m<p.length&&"tool"===p[m].role;){const t=p[m];e.push({type:"tool_result",tool_use_id:t.tool_call_id,content:t.content||"No result"}),m++}e.length>0&&c.push({role:"user",content:e})}else if("user"===e.role){const t="string"==typeof e.content?[{type:"text",text:e.content}]:Array.isArray(e.content)?e.content:[{type:"text",text:String(e.content)}];c.push({role:"user",content:t}),m++}else m++}const u={model:t,max_tokens:n,temperature:s,system:d||"You are a helpful assistant.",messages:c};i&&i.length>0&&(u.tools=i,r&&(u.tool_choice=r));const h=await o.messages.create(u);console.log("[Anthropic Provider] Response content blocks:",JSON.stringify(h.content,null,2));const f=[];let g="";for(const e of h.content)if("text"===e.type)g+=e.text;else if("tool_use"===e.type)console.log("[Anthropic Provider] Tool use block:",{id:e.id,name:e.name,input:e.input,inputKeys:Object.keys(e.input||{})}),f.push({id:e.id,type:"function",function:{name:e.name,arguments:JSON.stringify(e.input)}});else if("thinking"===e.type){const t=e.thinking||"";t&&(g=t+(g?"\n\n"+g:""))}return{choices:[{message:{content:g||null,tool_calls:f.length>0?f:void 0},finish_reason:"end_turn"===h.stop_reason?"stop":h.stop_reason}]}}};class Tn{static async getProvider(){const e=(0,s.lB)();return this.createProvider(e)}static async getLiteProvider(){const e=(0,s.ub)();return this.createProvider(e)}static async createProvider(e){return"anthropic"===(e.provider||"openai")?new Sn(e):new _n(e)}}},3024:e=>{e.exports=i("node:fs")},3151:(e,t,a)=>{var s=a(5578),n=a(6585);e.exports=function(e){if("number"==typeof e)return e;var t=n(e);if(void 0===t){var a=new Error(s.format("humanize-ms(%j) result undefined",e));console.warn(a.stack)}return t}},3289:(e,t,a)=>{a.d(t,{QD:()=>r,S6:()=>o});var s=a(4421),n=a(2521);const i={nodejs:{files:["package.json"],language:"JavaScript/TypeScript",parser:function(e,t){try{const t=JSON.parse(e);return{name:t.name||"unknown",version:t.version||"0.0.0",description:t.description||"",dependencies:t.dependencies||{},devDependencies:t.devDependencies||{},entryPoints:[t.main,..."string"==typeof t.bin?[t.bin]:Object.values(t.bin||{})].filter(Boolean)}}catch(e){return null}}},"java-maven":{files:["pom.xml"],language:"Java",parser:function(e,t){try{const t=e.match(/<artifactId>(.*?)<\/artifactId>/),a=e.match(/<version>(.*?)<\/version>/),s=e.match(/<description>(.*?)<\/description>/),n={},i=/<dependency>[\s\S]*?<groupId>(.*?)<\/groupId>[\s\S]*?<artifactId>(.*?)<\/artifactId>[\s\S]*?<version>(.*?)<\/version>[\s\S]*?<\/dependency>/g;let r;for(;null!==(r=i.exec(e));){const[,e,t,a]=r;n[`${e}:${t}`]=a}return{name:t?t[1]:"unknown",version:a?a[1]:"0.0.0",description:s?s[1]:"",dependencies:n}}catch(e){return null}}},"java-gradle":{files:["build.gradle","build.gradle.kts"],language:"Java",parser:function(e,t){try{const t=e.match(/version\s*[=:]\s*['"]([^'"]+)['"]/),a=e.match(/group\s*[=:]\s*['"]([^'"]+)['"]/),s=e.match(/rootProject\.name\s*[=:]\s*['"]([^'"]+)['"]/);return{name:s?s[1]:a?a[1]:"unknown",version:t?t[1]:"0.0.0",description:""}}catch(e){return null}}},"python-pip":{files:["setup.py","setup.cfg"],language:"Python",parser:function(e,t){try{const t=e.match(/name\s*=\s*['"]([^'"]+)['"]/),a=e.match(/version\s*=\s*['"]([^'"]+)['"]/),s=e.match(/description\s*=\s*['"]([^'"]+)['"]/);return{name:t?t[1]:"unknown",version:a?a[1]:"0.0.0",description:s?s[1]:""}}catch(e){return null}}},"python-poetry":{files:["pyproject.toml"],language:"Python",parser:function(e,t){try{const t=e.match(/name\s*=\s*"([^"]+)"/),a=e.match(/version\s*=\s*"([^"]+)"/),s=e.match(/description\s*=\s*"([^"]+)"/);return{name:t?t[1]:"unknown",version:a?a[1]:"0.0.0",description:s?s[1]:""}}catch(e){return null}}},"python-pipenv":{files:["Pipfile"],language:"Python",parser:function(e,t){try{return{name:t.split(/[/\\]/).slice(-2,-1)[0]||"unknown",version:"0.0.0",description:""}}catch(e){return null}}},go:{files:["go.mod"],language:"Go",parser:function(e,t){try{const t=e.match(/module\s+([^\s]+)/),a=e.match(/go\s+([^\s]+)/),s={},n=/require\s+([^\s]+)\s+([^\s]+)/g;let i;for(;null!==(i=n.exec(e));)s[i[1]]=i[2];return{name:t&&t[1].split("/").pop()||"unknown",version:a?a[1]:"0.0.0",description:"",dependencies:s}}catch(e){return null}}},rust:{files:["Cargo.toml"],language:"Rust",parser:function(e,t){try{const t=e.match(/name\s*=\s*"([^"]+)"/),a=e.match(/version\s*=\s*"([^"]+)"/),s=e.match(/description\s*=\s*"([^"]+)"/);return{name:t?t[1]:"unknown",version:a?a[1]:"0.0.0",description:s?s[1]:""}}catch(e){return null}}},ruby:{files:["Gemfile"],language:"Ruby",parser:function(e,t){try{return{name:t.split(/[/\\]/).slice(-2,-1)[0]||"unknown",version:"0.0.0",description:""}}catch(e){return null}}},php:{files:["composer.json"],language:"PHP",parser:function(e,t){try{const t=JSON.parse(e);return{name:t.name||"unknown",version:t.version||"0.0.0",description:t.description||"",dependencies:t.require||{},devDependencies:t["require-dev"]||{}}}catch(e){return null}}},dotnet:{files:["*.csproj","*.vbproj","*.fsproj"],language:"C#/.NET",parser:function(e,t){try{const a=(t.split(/[/\\]/).pop()||"unknown").replace(/\.(cs|vb|fs)proj$/,""),s=e.match(/<Version>(.*?)<\/Version>/),n=e.match(/<Description>(.*?)<\/Description>/);return{name:a,version:s?s[1]:"0.0.0",description:n?n[1]:""}}catch(e){return null}}}};function r(e=process.cwd()){const t={name:"unknown",version:"0.0.0",description:"",language:"Unknown",configFiles:[]};for(const[a,r]of Object.entries(i))for(const i of r.files){if(i.includes("*"))continue;const o=(0,n.resolve)(e,i);if((0,s.existsSync)(o))try{const e=(0,s.readFileSync)(o,"utf-8"),n=r.parser(e,o);if(n)return{...t,...n,language:r.language,buildTool:a,configFiles:[i]}}catch(e){console.warn(`Error parsing ${i}: ${e instanceof Error?e.message:"Unknown error"}`)}}return t}function o(e=process.cwd()){const t=[];for(const[a,r]of Object.entries(i))for(const i of r.files){if(i.includes("*"))continue;const r=(0,n.resolve)(e,i);if((0,s.existsSync)(r)){t.push(a);break}}return t}},3417:(e,t,a)=>{t.URL=a(6648).interface,a(5484).serializeURL,a(5484).serializeURLOrigin,a(5484).basicURLParse,a(5484).setTheUsername,a(5484).setThePassword,a(5484).serializeHost,a(5484).serializeInteger,a(5484).parseURL},3521:(e,t,a)=>{a.d(t,{SE:()=>n,bT:()=>i,jT:()=>o,jp:()=>r});var s=a(9187);class n{originalTask;plan;stepSummaries;sharedState;stepDependencies;constructor(){this.originalTask=null,this.plan={tasks:[],currentStep:0,totalSteps:0},this.stepSummaries=new Map,this.sharedState={projectInfo:null,rules:null,dependencies:null,recentFiles:[],knownIssues:[]},this.stepDependencies=new Map}initializeTask(e,t){this.originalTask=e,this.plan={tasks:t.tasks||[],currentStep:0,totalSteps:t.tasks?.length||0},(0,s.fH)(`全局上下文初始化: ${this.plan.totalSteps} 个步骤`)}recordStepCompletion(e,t,a={}){this.stepSummaries.set(e,{summary:t,metadata:a,timestamp:(new Date).toISOString()}),(0,s.MD)(`步骤 ${e} 摘要已记录: ${t.substring(0,50)}...`)}getStepSummary(e){return this.stepSummaries.get(e)}updateSharedState(e,t){this.sharedState.hasOwnProperty(e)?(this.sharedState[e]=t,(0,s.MD)(`共享状态更新: ${e}`)):(0,s.MD)(`警告: 未知的共享状态键: ${e}`)}addRecentFile(e){this.sharedState.recentFiles.unshift(e),this.sharedState.recentFiles.length>10&&this.sharedState.recentFiles.pop()}setStepDependencies(e,t){this.stepDependencies.set(e,t)}getCompactSummary(){return{task:this.originalTask,progress:`${this.plan.currentStep}/${this.plan.totalSteps}`,completedSteps:Array.from(this.stepSummaries.keys()),recentFiles:this.sharedState.recentFiles.slice(0,5)}}getPlan(){return this.plan}setCurrentStep(e){this.plan.currentStep=e}getSharedState(){return this.sharedState}getStepDependencies(){return this.stepDependencies}getOriginalTask(){return this.originalTask}}class i{globalContext;constructor(e){this.globalContext=e}async selectRelevantHistory(e,t){const a=[],n=this.globalContext.getStepDependencies().get(e)||[];for(const e of n){const t=this.globalContext.getStepSummary(e);t&&a.push({stepId:e,type:"dependency",content:t.summary,metadata:t.metadata})}const i=this.getRecentCompletedSteps(3);for(const e of i)if(!n.includes(e)){const s=this.globalContext.getStepSummary(e);s&&this.isLikelyRelevant(s.summary,t)&&a.push({stepId:e,type:"recent",content:s.summary,metadata:s.metadata})}return(0,s.MD)(`为步骤 ${e} 选择了 ${a.length} 条相关历史`),a}getRecentCompletedSteps(e){return Array.from(this.globalContext.getStepDependencies().keys()).slice(-e)}isLikelyRelevant(e,t){const a=e=>e.toLowerCase().split(/\s+/).filter(e=>e.length>3).slice(0,10),s=new Set(a(e));return a(t).filter(e=>s.has(e)).length>=2}async selectRelevantHistoryWithLLM(e,t){const{MODEL:n}=await Promise.resolve().then(a.bind(a,6893)),{callModelAPI:i}=await Promise.resolve().then(a.bind(a,8736)),r=Array.from(this.globalContext.getStepDependencies().entries()).map(([e,t])=>{const a=this.globalContext.getStepSummary(e);return a?`步骤${e}: ${a.summary}`:""}).filter(Boolean).join("\n");if(!r)return[];const o=`任务: ${this.globalContext.getOriginalTask()||""}\n\n已完成的历史步骤摘要:\n${r}\n\n当前步骤: ${t}\n\n问题: 当前步骤需要哪些历史步骤的信息?请分析依赖关系。\n输出格式: 返回JSON数组,包含相关步骤ID,例如 [1, 3]。如果不需要历史信息,返回 []。\n只返回JSON,不要其他解释。`;try{const t=await i({model:n(),messages:[{role:"user",content:o}],temperature:.1,max_tokens:100}),a=t.choices[0].message.content?.trim()||"[]",r=JSON.parse(a).map(e=>{const t=this.globalContext.getStepSummary(e);return t?{stepId:e,type:"llm_selected",content:t.summary,metadata:t.metadata}:null}).filter(e=>null!==e);return(0,s.fH)(`LLM 为步骤 ${e} 选择了 ${r.length} 条相关历史`),r}catch(a){return(0,s.MD)(`LLM 选择历史失败,降级到启发式方法: ${a instanceof Error?a.message:String(a)}`),this.selectRelevantHistory(e,t)}}}class r{globalContext;disclosure;constructor(e,t){this.globalContext=e,this.disclosure=t}async buildIsolatedContext(e,t,a="",n=!1){const i=[];let r;if(a&&i.push({role:"system",content:a}),i.push({role:"user",content:`原始任务: ${this.globalContext.getOriginalTask()||""}`}),this.globalContext.getSharedState().rules&&i.push({role:"system",content:`项目规则:\n${this.globalContext.getSharedState().rules}`}),r=n?await this.disclosure.selectRelevantHistoryWithLLM(e,t):await this.disclosure.selectRelevantHistory(e,t),r.length>0){const e=r.map(e=>`[步骤${e.stepId}] ${e.content}`).join("\n\n");i.push({role:"user",content:`相关历史信息:\n${e}`})}return i.push({role:"user",content:`当前任务 (步骤 ${e}/${this.globalContext.getPlan().totalSteps}):\n${t}`}),this.globalContext.getSharedState().recentFiles.length>0&&i.push({role:"system",content:`最近访问的文件: ${this.globalContext.getSharedState().recentFiles.slice(0,5).join(", ")}`}),t.match(/实现|创建|编写|设计|开发|生成/)&&i.push({role:"system",content:'⚠️ CRITICAL REMINDER FOR CODE TASKS:\n- You MUST use Action: write(path, content) to save any code you generate\n- You MUST use Action: merge(path, content) to modify existing files\n- NEVER just output code without saving it using Action:\n- Follow the exact format: "Thought: ..." then "Action: tool_name(args)"\n- When task is done, use "Answer: ..." to finish'}),(0,s.fH)(`为步骤 ${e} 构建了隔离上下文,包含 ${i.length} 条消息`),(0,s.MD)(`上下文详情: 历史 ${r.length} 条, 文件 ${this.globalContext.getSharedState().recentFiles.length} 个`),i}buildSimpleContext(e,t=""){const a=[];return t&&a.push({role:"system",content:t}),a.push({role:"user",content:e}),(0,s.fH)("构建了简化上下文(简单任务模式)"),a}}class o{async extractSummary(e){const t=[],a=[];let n=null;for(const s of e)if("assistant"===s.role){if(s.tool_calls&&s.tool_calls.length>0)for(const e of s.tool_calls){const a=e.function.name;"think"!==a&&t.push(a)}if(s.content&&s.content.includes("Answer:")){const e=s.content.match(/Answer:\s*(.+)/s);e&&(n=e[1].trim().substring(0,200))}}else"tool"===s.role&&s.content&&a.push(s.content.substring(0,100));let i="";return n?i=`完成: ${n}`:(i=`执行了 ${t.length} 个工具调用`,t.length>0&&(i+=` (${t.slice(0,3).join(", ")})`)),(0,s.MD)(`提取摘要: ${i.substring(0,50)}...`),i}async extractSummaryWithLLM(e){const{LITE_MODEL:t}=await Promise.resolve().then(a.bind(a,6893)),{callModelAPI:n}=await Promise.resolve().then(a.bind(a,8736)),i=e.filter(e=>e.content).map(e=>`${e.role}: ${e.content.substring(0,500)}`).join("\n");if(i.length<100)return this.extractSummary(e);try{const e=await n({model:t(),messages:[{role:"system",content:"你是一个摘要助手。请将下面的任务执行过程压缩成简洁的摘要(不超过100字),保留关键操作和结果。"},{role:"user",content:i}],temperature:.1,max_tokens:150,useCompression:!0}),a=e.choices[0].message.content?.trim()||"执行完成";return(0,s.fH)(`LLM 生成摘要: ${a.substring(0,50)}...`),a}catch(t){return(0,s.MD)(`LLM 摘要失败,降级到启发式方法: ${t instanceof Error?t.message:String(t)}`),this.extractSummary(e)}}extractMetadata(e){const t={toolsUsed:[],filesAccessed:[],errors:[],iterations:0};for(const a of e)if("assistant"===a.role){if(t.iterations++,a.tool_calls&&a.tool_calls.length>0)for(const e of a.tool_calls){const a=e.function.name;if("think"!==a&&(t.toolsUsed.push(a),["read","write","merge"].includes(a)))try{const a=JSON.parse(e.function.arguments),s=a.path||a.newContent;s&&t.filesAccessed.push(s)}catch(e){}}}else"tool"===a.role&&a.content&&a.content.includes("Error:")&&t.errors.push(a.content.substring(0,100));return t}}},3596:(e,t,a)=>{a.d(t,{s:()=>o});var s=a(9052),n=a(4073),i=a(9187);class r{static instance=null;clients=new Map;mcpTools=new Map;initialized=!1;constructor(){}static getInstance(){return r.instance||(r.instance=new r),r.instance}async initialize(e){if(this.initialized)(0,i.JE)("MCP Manager already initialized");else{(0,i.fH)(`Initializing ${e.length} MCP server(s)...`),e.length>0&&((0,i.MD)("MCP Server Configurations:"),e.forEach(e=>{(0,i.MD)(` - Server: ${e.name} (${e.transport})`),(0,i.MD)(` Enabled: ${!1!==e.enabled}`),e.url?(0,i.MD)(` URL: ${e.url}`):e.command&&(0,i.MD)(` Command: ${e.command}`)}));for(const t of e)if(!1!==t.enabled)try{(0,i.MD)(`Attempting to connect to MCP server ${t.name} with URL: ${t.url||"N/A"}`),await this.connectToServer(t)}catch(e){(0,i.vV)(`Failed to connect to MCP server ${t.name}: ${e.message}`),(0,i.MD)(`Error details for ${t.name}: ${e.message}\n${e.stack||""}`)}else(0,i.MD)(`Skipping disabled MCP server: ${t.name}`);this.initialized=!0,(0,i.fH)(`MCP Manager initialized with ${this.clients.size} server(s) and ${this.mcpTools.size} tool(s)`)}}async connectToServer(e){(0,i.MD)(`Connecting to MCP server: ${e.name} (${e.transport})`);const t=this.createClient(e);await t.connect(),this.clients.set(e.name,t);const a=t.getCachedTools();for(const e of a)this.registerTool(e);(0,i.fH)(`Connected to MCP server: ${e.name} (${a.length} tools)`)}createClient(e){switch(e.transport){case"http":case"sse":return new s.Q(e);case"stdio":return new n.r(e);default:throw new Error(`Unsupported transport type: ${e.transport}`)}}registerTool(e){const t=e.name;this.mcpTools.has(t)?(0,i.JE)(`MCP tool ${t} already registered, skipping (using first registered)`):(this.mcpTools.set(t,e),(0,i.MD)(`Registered MCP tool: ${t} from ${e.serverName}`))}getAllTools(){return Array.from(this.mcpTools.values())}getTool(e){return this.mcpTools.get(e)}hasTool(e){return this.mcpTools.has(e)}async callTool(e,t){const a=this.mcpTools.get(e);if(!a)return{success:!1,error:`MCP tool not found: ${e}`};const s=this.clients.get(a.serverName);return s&&s.isConnected()?s.callTool(e,t):{success:!1,error:`MCP server not connected: ${a.serverName}`}}async disconnectAll(){(0,i.MD)("Disconnecting all MCP servers...");for(const[e,t]of this.clients.entries())try{await t.disconnect(),(0,i.MD)(`Disconnected from MCP server: ${e}`)}catch(t){(0,i.vV)(`Error disconnecting from ${e}: ${t.message}`)}this.clients.clear(),this.mcpTools.clear(),this.initialized=!1,(0,i.fH)("All MCP servers disconnected")}getStatus(){const e=Array.from(this.clients.entries()).map(([e,t])=>({name:e,connected:t.isConnected(),toolCount:t.getCachedTools().length}));return{initialized:this.initialized,serversConnected:this.clients.size,toolsAvailable:this.mcpTools.size,servers:e}}}function o(){return r.getInstance()}},3632:(e,t,a)=>{a.d(t,{AZ:()=>ua});const s=(e,t,a)=>{const s=e instanceof RegExp?n(e,a):e,i=t instanceof RegExp?n(t,a):t,o=null!==s&&null!=i&&r(s,i,a);return o&&{start:o[0],end:o[1],pre:a.slice(0,o[0]),body:a.slice(o[0]+s.length,o[1]),post:a.slice(o[1]+i.length)}},n=(e,t)=>{const a=t.match(e);return a?a[0]:null},r=(e,t,a)=>{let s,n,i,r,o,p=a.indexOf(e),d=a.indexOf(t,p+1),l=p;if(p>=0&&d>0){if(e===t)return[p,d];for(s=[],i=a.length;l>=0&&!o;){if(l===p)s.push(l),p=a.indexOf(e,l+1);else if(1===s.length){const e=s.pop();void 0!==e&&(o=[e,d])}else n=s.pop(),void 0!==n&&n<i&&(i=n,r=d),d=a.indexOf(t,l+1);l=p<d&&p>=0?p:d}s.length&&void 0!==r&&(o=[i,r])}return o},o="\0SLASH"+Math.random()+"\0",p="\0OPEN"+Math.random()+"\0",d="\0CLOSE"+Math.random()+"\0",l="\0COMMA"+Math.random()+"\0",c="\0PERIOD"+Math.random()+"\0",m=new RegExp(o,"g"),u=new RegExp(p,"g"),h=new RegExp(d,"g"),f=new RegExp(l,"g"),g=new RegExp(c,"g"),y=/\\\\/g,v=/\\{/g,w=/\\}/g,b=/\\,/g,_=/\\./g;function S(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function T(e){return e.replace(m,"\\").replace(u,"{").replace(h,"}").replace(f,",").replace(g,".")}function k(e){if(!e)return[""];const t=[],a=s("{","}",e);if(!a)return e.split(",");const{pre:n,body:i,post:r}=a,o=n.split(",");o[o.length-1]+="{"+i+"}";const p=k(r);return r.length&&(o[o.length-1]+=p.shift(),o.push.apply(o,p)),t.push.apply(t,o),t}function x(e){return e?("{}"===e.slice(0,2)&&(e="\\{\\}"+e.slice(2)),D(function(e){return e.replace(y,o).replace(v,p).replace(w,d).replace(b,l).replace(_,c)}(e),!0).map(T)):[]}function C(e){return"{"+e+"}"}function A(e){return/^-?0\d/.test(e)}function E(e,t){return e<=t}function $(e,t){return e>=t}function D(e,t){const a=[],n=s("{","}",e);if(!n)return[e];const i=n.pre,r=n.post.length?D(n.post,!1):[""];if(/\$$/.test(n.pre))for(let e=0;e<r.length;e++){const t=i+"{"+n.body+"}"+r[e];a.push(t)}else{const s=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),o=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),p=s||o,l=n.body.indexOf(",")>=0;if(!p&&!l)return n.post.match(/,(?!,).*\}/)?D(e=n.pre+"{"+n.body+d+n.post):[e];let c,m;if(p)c=n.body.split(/\.\./);else if(c=k(n.body),1===c.length&&void 0!==c[0]&&(c=D(c[0],!1).map(C),1===c.length))return r.map(e=>n.pre+c[0]+e);if(p&&void 0!==c[0]&&void 0!==c[1]){const e=S(c[0]),t=S(c[1]),a=Math.max(c[0].length,c[1].length);let s=3===c.length&&void 0!==c[2]?Math.abs(S(c[2])):1,n=E;t<e&&(s*=-1,n=$);const i=c.some(A);m=[];for(let r=e;n(r,t);r+=s){let e;if(o)e=String.fromCharCode(r),"\\"===e&&(e="");else if(e=String(r),i){const t=a-e.length;if(t>0){const a=new Array(t+1).join("0");e=r<0?"-"+a+e.slice(1):a+e}}m.push(e)}}else{m=[];for(let e=0;e<c.length;e++)m.push.apply(m,D(c[e],!1))}for(let e=0;e<m.length;e++)for(let s=0;s<r.length;s++){const n=i+m[e]+r[s];(!t||p||n)&&a.push(n)}}return a}const N=e=>{if("string"!=typeof e)throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},R={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},P=e=>e.replace(/[[\]\\-]/g,"\\$&"),O=e=>e.join(""),M=(e,t)=>{const a=t;if("["!==e.charAt(a))throw new Error("not in a brace expression");const s=[],n=[];let i=a+1,r=!1,o=!1,p=!1,d=!1,l=a,c="";e:for(;i<e.length;){const t=e.charAt(i);if("!"!==t&&"^"!==t||i!==a+1){if("]"===t&&r&&!p){l=i+1;break}if(r=!0,"\\"!==t||p){if("["===t&&!p)for(const[t,[r,p,d]]of Object.entries(R))if(e.startsWith(t,i)){if(c)return["$.",!1,e.length-a,!0];i+=t.length,d?n.push(r):s.push(r),o=o||p;continue e}p=!1,c?(t>c?s.push(P(c)+"-"+P(t)):t===c&&s.push(P(t)),c="",i++):e.startsWith("-]",i+1)?(s.push(P(t+"-")),i+=2):e.startsWith("-",i+1)?(c=t,i+=2):(s.push(P(t)),i++)}else p=!0,i++}else d=!0,i++}if(l<i)return["",!1,0,!1];if(!s.length&&!n.length)return["$.",!1,e.length-a,!0];if(0===n.length&&1===s.length&&/^\\?.$/.test(s[0])&&!d){return[(m=2===s[0].length?s[0].slice(-1):s[0],m.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")),!1,l-a,!1]}var m;const u="["+(d?"^":"")+O(s)+"]",h="["+(d?"":"^")+O(n)+"]";return[s.length&&n.length?"("+u+"|"+h+")":s.length?u:h,o,l-a,!0]},L=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),I=new Set(["!","?","+","*","@"]),j=e=>I.has(e),F="(?!\\.)",V=new Set(["[","."]),B=new Set(["..","."]),q=new Set("().*{}+?[]^$\\!"),W=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),U="[^/]",z=U+"*?",H=U+"+?";class J{type;#e;#t;#a=!1;#s=[];#n;#i;#r;#o=!1;#p;#d;#l=!1;constructor(e,t,a={}){this.type=e,e&&(this.#t=!0),this.#n=t,this.#e=this.#n?this.#n.#e:this,this.#p=this.#e===this?a:this.#e.#p,this.#r=this.#e===this?[]:this.#e.#r,"!"!==e||this.#e.#o||this.#r.push(this),this.#i=this.#n?this.#n.#s.length:0}get hasMagic(){if(void 0!==this.#t)return this.#t;for(const e of this.#s)if("string"!=typeof e&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return void 0!==this.#d?this.#d:this.type?this.#d=this.type+"("+this.#s.map(e=>String(e)).join("|")+")":this.#d=this.#s.map(e=>String(e)).join("")}#c(){if(this!==this.#e)throw new Error("should only call on root");if(this.#o)return this;let e;for(this.toString(),this.#o=!0;e=this.#r.pop();){if("!"!==e.type)continue;let t=e,a=t.#n;for(;a;){for(let s=t.#i+1;!a.type&&s<a.#s.length;s++)for(const t of e.#s){if("string"==typeof t)throw new Error("string part in extglob AST??");t.copyIn(a.#s[s])}t=a,a=t.#n}}return this}push(...e){for(const t of e)if(""!==t){if("string"!=typeof t&&!(t instanceof J&&t.#n===this))throw new Error("invalid part: "+t);this.#s.push(t)}}toJSON(){const e=null===this.type?this.#s.slice().map(e=>"string"==typeof e?e:e.toJSON()):[this.type,...this.#s.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#o&&"!"===this.#n?.type)&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#n?.isStart())return!1;if(0===this.#i)return!0;const e=this.#n;for(let t=0;t<this.#i;t++){const a=e.#s[t];if(!(a instanceof J&&"!"===a.type))return!1}return!0}isEnd(){if(this.#e===this)return!0;if("!"===this.#n?.type)return!0;if(!this.#n?.isEnd())return!1;if(!this.type)return this.#n?.isEnd();const e=this.#n?this.#n.#s.length:0;return this.#i===e-1}copyIn(e){"string"==typeof e?this.push(e):this.push(e.clone(this))}clone(e){const t=new J(this.type,e);for(const e of this.#s)t.copyIn(e);return t}static#m(e,t,a,s){let n=!1,i=!1,r=-1,o=!1;if(null===t.type){let p=a,d="";for(;p<e.length;){const a=e.charAt(p++);if(n||"\\"===a)n=!n,d+=a;else if(i)p===r+1?"^"!==a&&"!"!==a||(o=!0):"]"!==a||p===r+2&&o||(i=!1),d+=a;else if("["!==a){if(!s.noext&&j(a)&&"("===e.charAt(p)){t.push(d),d="";const n=new J(a,t);p=J.#m(e,n,p,s),t.push(n);continue}d+=a}else i=!0,r=p,o=!1,d+=a}return t.push(d),p}let p=a+1,d=new J(null,t);const l=[];let c="";for(;p<e.length;){const a=e.charAt(p++);if(n||"\\"===a)n=!n,c+=a;else if(i)p===r+1?"^"!==a&&"!"!==a||(o=!0):"]"!==a||p===r+2&&o||(i=!1),c+=a;else if("["!==a){if(j(a)&&"("===e.charAt(p)){d.push(c),c="";const t=new J(a,d);d.push(t),p=J.#m(e,t,p,s);continue}if("|"!==a){if(")"===a)return""===c&&0===t.#s.length&&(t.#l=!0),d.push(c),c="",t.push(...l,d),p;c+=a}else d.push(c),c="",l.push(d),d=new J(null,t)}else i=!0,r=p,o=!1,c+=a}return t.type=null,t.#t=void 0,t.#s=[e.substring(a-1)],p}static fromGlob(e,t={}){const a=new J(null,void 0,t);return J.#m(e,a,0,t),a}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();const e=this.toString(),[t,a,s,n]=this.toRegExpSource();if(!(s||this.#t||this.#p.nocase&&!this.#p.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return a;const i=(this.#p.nocase?"i":"")+(n?"u":"");return Object.assign(new RegExp(`^${t}$`,i),{_src:t,_glob:e})}get options(){return this.#p}toRegExpSource(e){const t=e??!!this.#p.dot;if(this.#e===this&&this.#c(),!this.type){const a=this.isStart()&&this.isEnd(),s=this.#s.map(t=>{const[s,n,i,r]="string"==typeof t?J.#u(t,this.#t,a):t.toRegExpSource(e);return this.#t=this.#t||i,this.#a=this.#a||r,s}).join("");let n="";if(this.isStart()&&"string"==typeof this.#s[0]&&(1!==this.#s.length||!B.has(this.#s[0]))){const a=V,i=t&&a.has(s.charAt(0))||s.startsWith("\\.")&&a.has(s.charAt(2))||s.startsWith("\\.\\.")&&a.has(s.charAt(4)),r=!t&&!e&&a.has(s.charAt(0));n=i?"(?!(?:^|/)\\.\\.?(?:$|/))":r?F:""}let i="";return this.isEnd()&&this.#e.#o&&"!"===this.#n?.type&&(i="(?:$|\\/)"),[n+s+i,L(s),this.#t=!!this.#t,this.#a]}const a="*"===this.type||"+"===this.type,s="!"===this.type?"(?:(?!(?:":"(?:";let n=this.#h(t);if(this.isStart()&&this.isEnd()&&!n&&"!"!==this.type){const e=this.toString();return this.#s=[e],this.type=null,this.#t=void 0,[e,L(this.toString()),!1,!1]}let i=!a||e||t?"":this.#h(!0);i===n&&(i=""),i&&(n=`(?:${n})(?:${i})*?`);let r="";return r="!"===this.type&&this.#l?(this.isStart()&&!t?F:"")+H:s+n+("!"===this.type?"))"+(!this.isStart()||t||e?"":F)+z+")":"@"===this.type?")":"?"===this.type?")?":"+"===this.type&&i?")":"*"===this.type&&i?")?":`)${this.type}`),[r,L(n),this.#t=!!this.#t,this.#a]}#h(e){return this.#s.map(t=>{if("string"==typeof t)throw new Error("string type in extglob ast??");const[a,s,n,i]=t.toRegExpSource(e);return this.#a=this.#a||i,a}).filter(e=>!(this.isStart()&&this.isEnd()&&!e)).join("|")}static#u(e,t,a=!1){let s=!1,n="",i=!1;for(let r=0;r<e.length;r++){const o=e.charAt(r);if(s)s=!1,n+=(q.has(o)?"\\":"")+o;else if("\\"!==o){if("["===o){const[a,s,o,p]=M(e,r);if(o){n+=a,i=i||s,r+=o-1,t=t||p;continue}}"*"!==o?"?"!==o?n+=W(o):(n+=U,t=!0):(n+=a&&"*"===e?H:z,t=!0)}else r===e.length-1?n+="\\\\":s=!0}return[n,L(e),!!t,i]}}const G=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),Y=(e,t,a={})=>(N(t),!(!a.nocomment&&"#"===t.charAt(0))&&new _e(t,a).match(e)),K=/^\*+([^+@!?\*\[\(]*)$/,X=e=>t=>!t.startsWith(".")&&t.endsWith(e),Q=e=>t=>t.endsWith(e),Z=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),ee=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),te=/^\*+\.\*+$/,ae=e=>!e.startsWith(".")&&e.includes("."),se=e=>"."!==e&&".."!==e&&e.includes("."),ne=/^\.\*+$/,ie=e=>"."!==e&&".."!==e&&e.startsWith("."),re=/^\*+$/,oe=e=>0!==e.length&&!e.startsWith("."),pe=e=>0!==e.length&&"."!==e&&".."!==e,de=/^\?+([^+@!?\*\[\(]*)?$/,le=([e,t=""])=>{const a=he([e]);return t?(t=t.toLowerCase(),e=>a(e)&&e.toLowerCase().endsWith(t)):a},ce=([e,t=""])=>{const a=fe([e]);return t?(t=t.toLowerCase(),e=>a(e)&&e.toLowerCase().endsWith(t)):a},me=([e,t=""])=>{const a=fe([e]);return t?e=>a(e)&&e.endsWith(t):a},ue=([e,t=""])=>{const a=he([e]);return t?e=>a(e)&&e.endsWith(t):a},he=([e])=>{const t=e.length;return e=>e.length===t&&!e.startsWith(".")},fe=([e])=>{const t=e.length;return e=>e.length===t&&"."!==e&&".."!==e},ge="object"==typeof process&&process?"object"==typeof process.env&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix";Y.sep="win32"===ge?"\\":"/";const ye=Symbol("globstar **");Y.GLOBSTAR=ye,Y.filter=(e,t={})=>a=>Y(a,e,t);const ve=(e,t={})=>Object.assign({},e,t);Y.defaults=e=>{if(!e||"object"!=typeof e||!Object.keys(e).length)return Y;const t=Y;return Object.assign((a,s,n={})=>t(a,s,ve(e,n)),{Minimatch:class extends t.Minimatch{constructor(t,a={}){super(t,ve(e,a))}static defaults(a){return t.defaults(ve(e,a)).Minimatch}},AST:class extends t.AST{constructor(t,a,s={}){super(t,a,ve(e,s))}static fromGlob(a,s={}){return t.AST.fromGlob(a,ve(e,s))}},unescape:(a,s={})=>t.unescape(a,ve(e,s)),escape:(a,s={})=>t.escape(a,ve(e,s)),filter:(a,s={})=>t.filter(a,ve(e,s)),defaults:a=>t.defaults(ve(e,a)),makeRe:(a,s={})=>t.makeRe(a,ve(e,s)),braceExpand:(a,s={})=>t.braceExpand(a,ve(e,s)),match:(a,s,n={})=>t.match(a,s,ve(e,n)),sep:t.sep,GLOBSTAR:ye})};const we=(e,t={})=>(N(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:x(e));Y.braceExpand=we,Y.makeRe=(e,t={})=>new _e(e,t).makeRe(),Y.match=(e,t,a={})=>{const s=new _e(t,a);return e=e.filter(e=>s.match(e)),s.options.nonull&&!e.length&&e.push(t),e};const be=/[?*]|[+@!]\(.*?\)|\[|\]/;class _e{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,t={}){N(e),t=t||{},this.options=t,this.pattern=e,this.platform=t.platform||ge,this.isWindows="win32"===this.platform,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||!1===t.allowWindowsEscape,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=void 0!==t.windowsNoMagicRoot?t.windowsNoMagicRoot:!(!this.isWindows||!this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(const e of this.set)for(const t of e)if("string"!=typeof t)return!0;return!1}debug(...e){}make(){const e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0))return void(this.comment=!0);if(!e)return void(this.empty=!0);this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);const a=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(a),this.debug(this.pattern,this.globParts);let s=this.globParts.map((e,t,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){const t=!(""!==e[0]||""!==e[1]||"?"!==e[2]&&be.test(e[2])||be.test(e[3])),a=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(a)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,s),this.set=s.filter(e=>-1===e.indexOf(!1)),this.isWindows)for(let e=0;e<this.set.length;e++){const t=this.set[e];""===t[0]&&""===t[1]&&"?"===this.globParts[e][2]&&"string"==typeof t[3]&&/^[a-z]:$/i.test(t[3])&&(t[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t=0;t<e.length;t++)for(let a=0;a<e[t].length;a++)"**"===e[t][a]&&(e[t][a]="*");const{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;-1!==(t=e.indexOf("**",t+1));){let a=t;for(;"**"===e[a+1];)a++;a!==t&&e.splice(t,a-t)}return e})}levelOneOptimize(e){return e.map(e=>0===(e=e.reduce((e,t)=>{const a=e[e.length-1];return"**"===t&&"**"===a?e:".."===t&&a&&".."!==a&&"."!==a&&"**"!==a?(e.pop(),e):(e.push(t),e)},[])).length?[""]:e)}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let a=1;a<e.length-1;a++){const s=e[a];1===a&&""===s&&""===e[0]||"."!==s&&""!==s||(t=!0,e.splice(a,1),a--)}"."!==e[0]||2!==e.length||"."!==e[1]&&""!==e[1]||(t=!0,e.pop())}let a=0;for(;-1!==(a=e.indexOf("..",a+1));){const s=e[a-1];s&&"."!==s&&".."!==s&&"**"!==s&&(t=!0,e.splice(a-1,2),a-=2)}}while(t);return 0===e.length?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let a of e){let s=-1;for(;-1!==(s=a.indexOf("**",s+1));){let n=s;for(;"**"===a[n+1];)n++;n>s&&a.splice(s+1,n-s);let i=a[s+1];const r=a[s+2],o=a[s+3];if(".."!==i)continue;if(!r||"."===r||".."===r||!o||"."===o||".."===o)continue;t=!0,a.splice(s,1);const p=a.slice(0);p[s]="**",e.push(p),s--}if(!this.preserveMultipleSlashes){for(let e=1;e<a.length-1;e++){const s=a[e];1===e&&""===s&&""===a[0]||"."!==s&&""!==s||(t=!0,a.splice(e,1),e--)}"."!==a[0]||2!==a.length||"."!==a[1]&&""!==a[1]||(t=!0,a.pop())}let n=0;for(;-1!==(n=a.indexOf("..",n+1));){const e=a[n-1];if(e&&"."!==e&&".."!==e&&"**"!==e){t=!0;const e=1===n&&"**"===a[n+1]?["."]:[];a.splice(n-1,2,...e),0===a.length&&a.push(""),n-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let a=t+1;a<e.length;a++){const s=this.partsMatch(e[t],e[a],!this.preserveMultipleSlashes);if(s){e[t]=[],e[a]=s;break}}return e.filter(e=>e.length)}partsMatch(e,t,a=!1){let s=0,n=0,i=[],r="";for(;s<e.length&&n<t.length;)if(e[s]===t[n])i.push("b"===r?t[n]:e[s]),s++,n++;else if(a&&"**"===e[s]&&t[n]===e[s+1])i.push(e[s]),s++;else if(a&&"**"===t[n]&&e[s]===t[n+1])i.push(t[n]),n++;else if("*"!==e[s]||!t[n]||!this.options.dot&&t[n].startsWith(".")||"**"===t[n]){if("*"!==t[n]||!e[s]||!this.options.dot&&e[s].startsWith(".")||"**"===e[s])return!1;if("a"===r)return!1;r="b",i.push(t[n]),s++,n++}else{if("b"===r)return!1;r="a",i.push(e[s]),s++,n++}return e.length===t.length&&i}parseNegate(){if(this.nonegate)return;const e=this.pattern;let t=!1,a=0;for(let s=0;s<e.length&&"!"===e.charAt(s);s++)t=!t,a++;a&&(this.pattern=e.slice(a)),this.negate=t}matchOne(e,t,a=!1){const s=this.options;if(this.isWindows){const a="string"==typeof e[0]&&/^[a-z]:$/i.test(e[0]),s=!a&&""===e[0]&&""===e[1]&&"?"===e[2]&&/^[a-z]:$/i.test(e[3]),n="string"==typeof t[0]&&/^[a-z]:$/i.test(t[0]),i=s?3:a?0:void 0,r=!n&&""===t[0]&&""===t[1]&&"?"===t[2]&&"string"==typeof t[3]&&/^[a-z]:$/i.test(t[3])?3:n?0:void 0;if("number"==typeof i&&"number"==typeof r){const[a,s]=[e[i],t[r]];a.toLowerCase()===s.toLowerCase()&&(t[r]=a,r>i?t=t.slice(r):i>r&&(e=e.slice(i)))}}const{optimizationLevel:n=1}=this.options;n>=2&&(e=this.levelTwoFileOptimize(e)),this.debug("matchOne",this,{file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var i=0,r=0,o=e.length,p=t.length;i<o&&r<p;i++,r++){this.debug("matchOne loop");var d=t[r],l=e[i];if(this.debug(t,d,l),!1===d)return!1;if(d===ye){this.debug("GLOBSTAR",[t,d,l]);var c=i,m=r+1;if(m===p){for(this.debug("** at the end");i<o;i++)if("."===e[i]||".."===e[i]||!s.dot&&"."===e[i].charAt(0))return!1;return!0}for(;c<o;){var u=e[c];if(this.debug("\nglobstar while",e,c,t,m,u),this.matchOne(e.slice(c),t.slice(m),a))return this.debug("globstar found match!",c,o,u),!0;if("."===u||".."===u||!s.dot&&"."===u.charAt(0)){this.debug("dot detected!",e,c,t,m);break}this.debug("globstar swallow a segment, and continue"),c++}return!(!a||(this.debug("\n>>> no match, partial?",e,c,t,m),c!==o))}let n;if("string"==typeof d?(n=l===d,this.debug("string match",d,l,n)):(n=d.test(l),this.debug("pattern match",d,l,n)),!n)return!1}if(i===o&&r===p)return!0;if(i===o)return a;if(r===p)return i===o-1&&""===e[i];throw new Error("wtf?")}braceExpand(){return we(this.pattern,this.options)}parse(e){N(e);const t=this.options;if("**"===e)return ye;if(""===e)return"";let a,s=null;(a=e.match(re))?s=t.dot?pe:oe:(a=e.match(K))?s=(t.nocase?t.dot?ee:Z:t.dot?Q:X)(a[1]):(a=e.match(de))?s=(t.nocase?t.dot?ce:le:t.dot?me:ue)(a):(a=e.match(te))?s=t.dot?se:ae:(a=e.match(ne))&&(s=ie);const n=J.fromGlob(e,this.options).toMMPattern();return s&&"object"==typeof n&&Reflect.defineProperty(n,"test",{value:s}),n}makeRe(){if(this.regexp||!1===this.regexp)return this.regexp;const e=this.set;if(!e.length)return this.regexp=!1,this.regexp;const t=this.options,a=t.noglobstar?"[^/]*?":t.dot?"(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?":"(?:(?!(?:\\/|^)\\.).)*?",s=new Set(t.nocase?["i"]:[]);let n=e.map(e=>{const t=e.map(e=>{if(e instanceof RegExp)for(const t of e.flags.split(""))s.add(t);return"string"==typeof e?e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):e===ye?ye:e._src});return t.forEach((e,s)=>{const n=t[s+1],i=t[s-1];e===ye&&i!==ye&&(void 0===i?void 0!==n&&n!==ye?t[s+1]="(?:\\/|"+a+"\\/)?"+n:t[s]=a:void 0===n?t[s-1]=i+"(?:\\/|"+a+")?":n!==ye&&(t[s-1]=i+"(?:\\/|\\/"+a+"\\/)"+n,t[s+1]=ye))}),t.filter(e=>e!==ye).join("/")}).join("|");const[i,r]=e.length>1?["(?:",")"]:["",""];n="^"+i+n+r+"$",this.negate&&(n="^(?!"+n+").+$");try{this.regexp=new RegExp(n,[...s].join(""))}catch(e){this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return""===e;if("/"===e&&t)return!0;const a=this.options;this.isWindows&&(e=e.split("\\").join("/"));const s=this.slashSplit(e);this.debug(this.pattern,"split",s);const n=this.set;this.debug(this.pattern,"set",n);let i=s[s.length-1];if(!i)for(let e=s.length-2;!i&&e>=0;e--)i=s[e];for(let e=0;e<n.length;e++){const r=n[e];let o=s;if(a.matchBase&&1===r.length&&(o=[i]),this.matchOne(o,r,t))return!!a.flipNegate||!this.negate}return!a.flipNegate&&this.negate}static defaults(e){return Y.defaults(e).Minimatch}}Y.AST=J,Y.Minimatch=_e,Y.escape=G,Y.unescape=L;const Se=i("node:url"),Te="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,ke=new Set,xe="object"==typeof process&&process?process:{},Ce=(e,t,a,s)=>{"function"==typeof xe.emitWarning?xe.emitWarning(e,t,a,s):console.error(`[${a}] ${t}: ${e}`)};let Ae=globalThis.AbortController,Ee=globalThis.AbortSignal;if(void 0===Ae){Ee=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(e,t){this._onabort.push(t)}},Ae=class{constructor(){t()}signal=new Ee;abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=!0;for(const t of this.signal._onabort)t(e);this.signal.onabort?.(e)}}};let e="1"!==xe.env?.LRU_CACHE_IGNORE_AC_WARNING;const t=()=>{e&&(e=!1,Ce("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}Symbol("type");const $e=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),De=e=>$e(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Ne:null:null;class Ne extends Array{constructor(e){super(e),this.fill(0)}}class Re{heap;length;static#f=!1;static create(e){const t=De(e);if(!t)return[];Re.#f=!0;const a=new Re(e,t);return Re.#f=!1,a}constructor(e,t){if(!Re.#f)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}}class Pe{#g;#y;#v;#w;#b;#_;#S;#T;get perf(){return this.#T}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#k;#x;#C;#A;#E;#$;#D;#N;#R;#P;#O;#M;#L;#I;#j;#F;#V;#B;static unsafeExposeInternals(e){return{starts:e.#L,ttls:e.#I,sizes:e.#M,keyMap:e.#C,keyList:e.#A,valList:e.#E,next:e.#$,prev:e.#D,get head(){return e.#N},get tail(){return e.#R},free:e.#P,isBackgroundFetch:t=>e.#q(t),backgroundFetch:(t,a,s,n)=>e.#W(t,a,s,n),moveToTail:t=>e.#U(t),indexes:t=>e.#z(t),rindexes:t=>e.#H(t),isStale:t=>e.#J(t)}}get max(){return this.#g}get maxSize(){return this.#y}get calculatedSize(){return this.#x}get size(){return this.#k}get fetchMethod(){return this.#_}get memoMethod(){return this.#S}get dispose(){return this.#v}get onInsert(){return this.#w}get disposeAfter(){return this.#b}constructor(e){const{max:t=0,ttl:a,ttlResolution:s=1,ttlAutopurge:n,updateAgeOnGet:i,updateAgeOnHas:r,allowStale:o,dispose:p,onInsert:d,disposeAfter:l,noDisposeOnSet:c,noUpdateTTL:m,maxSize:u=0,maxEntrySize:h=0,sizeCalculation:f,fetchMethod:g,memoMethod:y,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:w,allowStaleOnFetchRejection:b,allowStaleOnFetchAbort:_,ignoreFetchAbort:S,perf:T}=e;if(void 0!==T&&"function"!=typeof T?.now)throw new TypeError("perf option must have a now() method if specified");if(this.#T=T??Te,0!==t&&!$e(t))throw new TypeError("max option must be a nonnegative integer");const k=t?De(t):Array;if(!k)throw new Error("invalid max value: "+t);if(this.#g=t,this.#y=u,this.maxEntrySize=h||this.#y,this.sizeCalculation=f,this.sizeCalculation){if(!this.#y&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(void 0!==y&&"function"!=typeof y)throw new TypeError("memoMethod must be a function if defined");if(this.#S=y,void 0!==g&&"function"!=typeof g)throw new TypeError("fetchMethod must be a function if specified");if(this.#_=g,this.#F=!!g,this.#C=new Map,this.#A=new Array(t).fill(void 0),this.#E=new Array(t).fill(void 0),this.#$=new k(t),this.#D=new k(t),this.#N=0,this.#R=0,this.#P=Re.create(t),this.#k=0,this.#x=0,"function"==typeof p&&(this.#v=p),"function"==typeof d&&(this.#w=d),"function"==typeof l?(this.#b=l,this.#O=[]):(this.#b=void 0,this.#O=void 0),this.#j=!!this.#v,this.#B=!!this.#w,this.#V=!!this.#b,this.noDisposeOnSet=!!c,this.noUpdateTTL=!!m,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!b,this.allowStaleOnFetchAbort=!!_,this.ignoreFetchAbort=!!S,0!==this.maxEntrySize){if(0!==this.#y&&!$e(this.#y))throw new TypeError("maxSize must be a positive integer if specified");if(!$e(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#G()}if(this.allowStale=!!o,this.noDeleteOnStaleGet=!!w,this.updateAgeOnGet=!!i,this.updateAgeOnHas=!!r,this.ttlResolution=$e(s)||0===s?s:1,this.ttlAutopurge=!!n,this.ttl=a||0,this.ttl){if(!$e(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#Y()}if(0===this.#g&&0===this.ttl&&0===this.#y)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#g&&!this.#y){const e="LRU_CACHE_UNBOUNDED";(e=>!ke.has(e))(e)&&(ke.add(e),Ce("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",e,Pe))}}getRemainingTTL(e){return this.#C.has(e)?1/0:0}#Y(){const e=new Ne(this.#g),t=new Ne(this.#g);this.#I=e,this.#L=t,this.#K=(a,s,n=this.#T.now())=>{if(t[a]=0!==s?n:0,e[a]=s,0!==s&&this.ttlAutopurge){const e=setTimeout(()=>{this.#J(a)&&this.#X(this.#A[a],"expire")},s+1);e.unref&&e.unref()}},this.#Q=a=>{t[a]=0!==e[a]?this.#T.now():0},this.#Z=(n,i)=>{if(e[i]){const r=e[i],o=t[i];if(!r||!o)return;n.ttl=r,n.start=o,n.now=a||s();const p=n.now-o;n.remainingTTL=r-p}};let a=0;const s=()=>{const e=this.#T.now();if(this.ttlResolution>0){a=e;const t=setTimeout(()=>a=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=n=>{const i=this.#C.get(n);if(void 0===i)return 0;const r=e[i],o=t[i];return r&&o?r-((a||s())-o):1/0},this.#J=n=>{const i=t[n],r=e[n];return!!r&&!!i&&(a||s())-i>r}}#Q=()=>{};#Z=()=>{};#K=()=>{};#J=()=>!1;#G(){const e=new Ne(this.#g);this.#x=0,this.#M=e,this.#ee=t=>{this.#x-=e[t],e[t]=0},this.#te=(e,t,a,s)=>{if(this.#q(t))return 0;if(!$e(a)){if(!s)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof s)throw new TypeError("sizeCalculation must be a function");if(a=s(t,e),!$e(a))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return a},this.#ae=(t,a,s)=>{if(e[t]=a,this.#y){const a=this.#y-e[t];for(;this.#x>a;)this.#se(!0)}this.#x+=e[t],s&&(s.entrySize=a,s.totalCalculatedSize=this.#x)}}#ee=e=>{};#ae=(e,t,a)=>{};#te=(e,t,a,s)=>{if(a||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#z({allowStale:e=this.allowStale}={}){if(this.#k)for(let t=this.#R;this.#ne(t)&&(!e&&this.#J(t)||(yield t),t!==this.#N);)t=this.#D[t]}*#H({allowStale:e=this.allowStale}={}){if(this.#k)for(let t=this.#N;this.#ne(t)&&(!e&&this.#J(t)||(yield t),t!==this.#R);)t=this.#$[t]}#ne(e){return void 0!==e&&this.#C.get(this.#A[e])===e}*entries(){for(const e of this.#z())void 0===this.#E[e]||void 0===this.#A[e]||this.#q(this.#E[e])||(yield[this.#A[e],this.#E[e]])}*rentries(){for(const e of this.#H())void 0===this.#E[e]||void 0===this.#A[e]||this.#q(this.#E[e])||(yield[this.#A[e],this.#E[e]])}*keys(){for(const e of this.#z()){const t=this.#A[e];void 0===t||this.#q(this.#E[e])||(yield t)}}*rkeys(){for(const e of this.#H()){const t=this.#A[e];void 0===t||this.#q(this.#E[e])||(yield t)}}*values(){for(const e of this.#z())void 0===this.#E[e]||this.#q(this.#E[e])||(yield this.#E[e])}*rvalues(){for(const e of this.#H())void 0===this.#E[e]||this.#q(this.#E[e])||(yield this.#E[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(const a of this.#z()){const s=this.#E[a],n=this.#q(s)?s.__staleWhileFetching:s;if(void 0!==n&&e(n,this.#A[a],this))return this.get(this.#A[a],t)}}forEach(e,t=this){for(const a of this.#z()){const s=this.#E[a],n=this.#q(s)?s.__staleWhileFetching:s;void 0!==n&&e.call(t,n,this.#A[a],this)}}rforEach(e,t=this){for(const a of this.#H()){const s=this.#E[a],n=this.#q(s)?s.__staleWhileFetching:s;void 0!==n&&e.call(t,n,this.#A[a],this)}}purgeStale(){let e=!1;for(const t of this.#H({allowStale:!0}))this.#J(t)&&(this.#X(this.#A[t],"expire"),e=!0);return e}info(e){const t=this.#C.get(e);if(void 0===t)return;const a=this.#E[t],s=this.#q(a)?a.__staleWhileFetching:a;if(void 0===s)return;const n={value:s};if(this.#I&&this.#L){const e=this.#I[t],a=this.#L[t];if(e&&a){const t=e-(this.#T.now()-a);n.ttl=t,n.start=Date.now()}}return this.#M&&(n.size=this.#M[t]),n}dump(){const e=[];for(const t of this.#z({allowStale:!0})){const a=this.#A[t],s=this.#E[t],n=this.#q(s)?s.__staleWhileFetching:s;if(void 0===n||void 0===a)continue;const i={value:n};if(this.#I&&this.#L){i.ttl=this.#I[t];const e=this.#T.now()-this.#L[t];i.start=Math.floor(Date.now()-e)}this.#M&&(i.size=this.#M[t]),e.unshift([a,i])}return e}load(e){this.clear();for(const[t,a]of e){if(a.start){const e=Date.now()-a.start;a.start=this.#T.now()-e}this.set(t,a.value,a)}}set(e,t,a={}){if(void 0===t)return this.delete(e),this;const{ttl:s=this.ttl,start:n,noDisposeOnSet:i=this.noDisposeOnSet,sizeCalculation:r=this.sizeCalculation,status:o}=a;let{noUpdateTTL:p=this.noUpdateTTL}=a;const d=this.#te(e,t,a.size||0,r);if(this.maxEntrySize&&d>this.maxEntrySize)return o&&(o.set="miss",o.maxEntrySizeExceeded=!0),this.#X(e,"set"),this;let l=0===this.#k?void 0:this.#C.get(e);if(void 0===l)l=0===this.#k?this.#R:0!==this.#P.length?this.#P.pop():this.#k===this.#g?this.#se(!1):this.#k,this.#A[l]=e,this.#E[l]=t,this.#C.set(e,l),this.#$[this.#R]=l,this.#D[l]=this.#R,this.#R=l,this.#k++,this.#ae(l,d,o),o&&(o.set="add"),p=!1,this.#B&&this.#w?.(t,e,"add");else{this.#U(l);const a=this.#E[l];if(t!==a){if(this.#F&&this.#q(a)){a.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:t}=a;void 0===t||i||(this.#j&&this.#v?.(t,e,"set"),this.#V&&this.#O?.push([t,e,"set"]))}else i||(this.#j&&this.#v?.(a,e,"set"),this.#V&&this.#O?.push([a,e,"set"]));if(this.#ee(l),this.#ae(l,d,o),this.#E[l]=t,o){o.set="replace";const e=a&&this.#q(a)?a.__staleWhileFetching:a;void 0!==e&&(o.oldValue=e)}}else o&&(o.set="update");this.#B&&this.onInsert?.(t,e,t===a?"update":"replace")}if(0===s||this.#I||this.#Y(),this.#I&&(p||this.#K(l,s,n),o&&this.#Z(o,l)),!i&&this.#V&&this.#O){const e=this.#O;let t;for(;t=e?.shift();)this.#b?.(...t)}return this}pop(){try{for(;this.#k;){const e=this.#E[this.#N];if(this.#se(!0),this.#q(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if(this.#V&&this.#O){const e=this.#O;let t;for(;t=e?.shift();)this.#b?.(...t)}}}#se(e){const t=this.#N,a=this.#A[t],s=this.#E[t];return this.#F&&this.#q(s)?s.__abortController.abort(new Error("evicted")):(this.#j||this.#V)&&(this.#j&&this.#v?.(s,a,"evict"),this.#V&&this.#O?.push([s,a,"evict"])),this.#ee(t),e&&(this.#A[t]=void 0,this.#E[t]=void 0,this.#P.push(t)),1===this.#k?(this.#N=this.#R=0,this.#P.length=0):this.#N=this.#$[t],this.#C.delete(a),this.#k--,t}has(e,t={}){const{updateAgeOnHas:a=this.updateAgeOnHas,status:s}=t,n=this.#C.get(e);if(void 0!==n){const e=this.#E[n];if(this.#q(e)&&void 0===e.__staleWhileFetching)return!1;if(!this.#J(n))return a&&this.#Q(n),s&&(s.has="hit",this.#Z(s,n)),!0;s&&(s.has="stale",this.#Z(s,n))}else s&&(s.has="miss");return!1}peek(e,t={}){const{allowStale:a=this.allowStale}=t,s=this.#C.get(e);if(void 0===s||!a&&this.#J(s))return;const n=this.#E[s];return this.#q(n)?n.__staleWhileFetching:n}#W(e,t,a,s){const n=void 0===t?void 0:this.#E[t];if(this.#q(n))return n;const i=new Ae,{signal:r}=a;r?.addEventListener("abort",()=>i.abort(r.reason),{signal:i.signal});const o={signal:i.signal,options:a,context:s},p=(s,n=!1)=>{const{aborted:r}=i.signal,p=a.ignoreFetchAbort&&void 0!==s;if(a.status&&(r&&!n?(a.status.fetchAborted=!0,a.status.fetchError=i.signal.reason,p&&(a.status.fetchAbortIgnored=!0)):a.status.fetchResolved=!0),r&&!p&&!n)return d(i.signal.reason);const c=l,m=this.#E[t];return(m===l||p&&n&&void 0===m)&&(void 0===s?void 0!==c.__staleWhileFetching?this.#E[t]=c.__staleWhileFetching:this.#X(e,"fetch"):(a.status&&(a.status.fetchUpdated=!0),this.set(e,s,o.options))),s},d=s=>{const{aborted:n}=i.signal,r=n&&a.allowStaleOnFetchAbort,o=r||a.allowStaleOnFetchRejection,p=o||a.noDeleteOnFetchRejection,d=l;if(this.#E[t]===l&&(p&&void 0!==d.__staleWhileFetching?r||(this.#E[t]=d.__staleWhileFetching):this.#X(e,"fetch")),o)return a.status&&void 0!==d.__staleWhileFetching&&(a.status.returnedStale=!0),d.__staleWhileFetching;if(d.__returned===d)throw s};a.status&&(a.status.fetchDispatched=!0);const l=new Promise((t,s)=>{const r=this.#_?.(e,n,o);r&&r instanceof Promise&&r.then(e=>t(void 0===e?void 0:e),s),i.signal.addEventListener("abort",()=>{a.ignoreFetchAbort&&!a.allowStaleOnFetchAbort||(t(void 0),a.allowStaleOnFetchAbort&&(t=e=>p(e,!0)))})}).then(p,e=>(a.status&&(a.status.fetchRejected=!0,a.status.fetchError=e),d(e))),c=Object.assign(l,{__abortController:i,__staleWhileFetching:n,__returned:void 0});return void 0===t?(this.set(e,c,{...o.options,status:void 0}),t=this.#C.get(e)):this.#E[t]=c,c}#q(e){if(!this.#F)return!1;const t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Ae}async fetch(e,t={}){const{allowStale:a=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:i=this.ttl,noDisposeOnSet:r=this.noDisposeOnSet,size:o=0,sizeCalculation:p=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:l=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:c=this.allowStaleOnFetchRejection,ignoreFetchAbort:m=this.ignoreFetchAbort,allowStaleOnFetchAbort:u=this.allowStaleOnFetchAbort,context:h,forceRefresh:f=!1,status:g,signal:y}=t;if(!this.#F)return g&&(g.fetch="get"),this.get(e,{allowStale:a,updateAgeOnGet:s,noDeleteOnStaleGet:n,status:g});const v={allowStale:a,updateAgeOnGet:s,noDeleteOnStaleGet:n,ttl:i,noDisposeOnSet:r,size:o,sizeCalculation:p,noUpdateTTL:d,noDeleteOnFetchRejection:l,allowStaleOnFetchRejection:c,allowStaleOnFetchAbort:u,ignoreFetchAbort:m,status:g,signal:y};let w=this.#C.get(e);if(void 0===w){g&&(g.fetch="miss");const t=this.#W(e,w,v,h);return t.__returned=t}{const t=this.#E[w];if(this.#q(t)){const e=a&&void 0!==t.__staleWhileFetching;return g&&(g.fetch="inflight",e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}const n=this.#J(w);if(!f&&!n)return g&&(g.fetch="hit"),this.#U(w),s&&this.#Q(w),g&&this.#Z(g,w),t;const i=this.#W(e,w,v,h),r=void 0!==i.__staleWhileFetching&&a;return g&&(g.fetch=n?"stale":"refresh",r&&n&&(g.returnedStale=!0)),r?i.__staleWhileFetching:i.__returned=i}}async forceFetch(e,t={}){const a=await this.fetch(e,t);if(void 0===a)throw new Error("fetch() returned undefined");return a}memo(e,t={}){const a=this.#S;if(!a)throw new Error("no memoMethod provided to constructor");const{context:s,forceRefresh:n,...i}=t,r=this.get(e,i);if(!n&&void 0!==r)return r;const o=a(e,r,{options:i,context:s});return this.set(e,o,i),o}get(e,t={}){const{allowStale:a=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:i}=t,r=this.#C.get(e);if(void 0!==r){const t=this.#E[r],o=this.#q(t);return i&&this.#Z(i,r),this.#J(r)?(i&&(i.get="stale"),o?(i&&a&&void 0!==t.__staleWhileFetching&&(i.returnedStale=!0),a?t.__staleWhileFetching:void 0):(n||this.#X(e,"expire"),i&&a&&(i.returnedStale=!0),a?t:void 0)):(i&&(i.get="hit"),o?t.__staleWhileFetching:(this.#U(r),s&&this.#Q(r),t))}i&&(i.get="miss")}#ie(e,t){this.#D[t]=e,this.#$[e]=t}#U(e){e!==this.#R&&(e===this.#N?this.#N=this.#$[e]:this.#ie(this.#D[e],this.#$[e]),this.#ie(this.#R,e),this.#R=e)}delete(e){return this.#X(e,"delete")}#X(e,t){let a=!1;if(0!==this.#k){const s=this.#C.get(e);if(void 0!==s)if(a=!0,1===this.#k)this.#re(t);else{this.#ee(s);const a=this.#E[s];if(this.#q(a)?a.__abortController.abort(new Error("deleted")):(this.#j||this.#V)&&(this.#j&&this.#v?.(a,e,t),this.#V&&this.#O?.push([a,e,t])),this.#C.delete(e),this.#A[s]=void 0,this.#E[s]=void 0,s===this.#R)this.#R=this.#D[s];else if(s===this.#N)this.#N=this.#$[s];else{const e=this.#D[s];this.#$[e]=this.#$[s];const t=this.#$[s];this.#D[t]=this.#D[s]}this.#k--,this.#P.push(s)}}if(this.#V&&this.#O?.length){const e=this.#O;let t;for(;t=e?.shift();)this.#b?.(...t)}return a}clear(){return this.#re("delete")}#re(e){for(const t of this.#H({allowStale:!0})){const a=this.#E[t];if(this.#q(a))a.__abortController.abort(new Error("deleted"));else{const s=this.#A[t];this.#j&&this.#v?.(a,s,e),this.#V&&this.#O?.push([a,s,e])}}if(this.#C.clear(),this.#E.fill(void 0),this.#A.fill(void 0),this.#I&&this.#L&&(this.#I.fill(0),this.#L.fill(0)),this.#M&&this.#M.fill(0),this.#N=0,this.#R=0,this.#P.length=0,this.#x=0,this.#k=0,this.#V&&this.#O){const e=this.#O;let t;for(;t=e?.shift();)this.#b?.(...t)}}}const Oe=i("node:path");var Me=a(4421),Le=a(3024),Ie=a.t(Le,2);const je=i("node:fs/promises"),Fe=i("node:events");var Ve=a(7075);const Be=i("node:string_decoder"),qe="object"==typeof process&&process?process:{stdout:null,stderr:null},We=e=>!!e&&"object"==typeof e&&(e instanceof At||e instanceof Ve||Ue(e)||ze(e)),Ue=e=>!!e&&"object"==typeof e&&e instanceof Fe.EventEmitter&&"function"==typeof e.pipe&&e.pipe!==Ve.Writable.prototype.pipe,ze=e=>!!e&&"object"==typeof e&&e instanceof Fe.EventEmitter&&"function"==typeof e.write&&"function"==typeof e.end,He=Symbol("EOF"),Je=Symbol("maybeEmitEnd"),Ge=Symbol("emittedEnd"),Ye=Symbol("emittingEnd"),Ke=Symbol("emittedError"),Xe=Symbol("closed"),Qe=Symbol("read"),Ze=Symbol("flush"),et=Symbol("flushChunk"),tt=Symbol("encoding"),at=Symbol("decoder"),st=Symbol("flowing"),nt=Symbol("paused"),it=Symbol("resume"),rt=Symbol("buffer"),ot=Symbol("pipes"),pt=Symbol("bufferLength"),dt=Symbol("bufferPush"),lt=Symbol("bufferShift"),ct=Symbol("objectMode"),mt=Symbol("destroyed"),ut=Symbol("error"),ht=Symbol("emitData"),ft=Symbol("emitEnd"),gt=Symbol("emitEnd2"),yt=Symbol("async"),vt=Symbol("abort"),wt=Symbol("aborted"),bt=Symbol("signal"),_t=Symbol("dataListeners"),St=Symbol("discarded"),Tt=e=>Promise.resolve().then(e),kt=e=>e();class xt{src;dest;opts;ondrain;constructor(e,t,a){this.src=e,this.dest=t,this.opts=a,this.ondrain=()=>e[it](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}}class Ct extends xt{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,a){super(e,t,a),this.proxyErrors=e=>t.emit("error",e),e.on("error",this.proxyErrors)}}class At extends Fe.EventEmitter{[st]=!1;[nt]=!1;[ot]=[];[rt]=[];[ct];[tt];[yt];[at];[He]=!1;[Ge]=!1;[Ye]=!1;[Xe]=!1;[Ke]=null;[pt]=0;[mt]=!1;[bt];[wt]=!1;[_t]=0;[St]=!1;writable=!0;readable=!0;constructor(...e){const t=e[0]||{};if(super(),t.objectMode&&"string"==typeof t.encoding)throw new TypeError("Encoding and objectMode may not be used together");var a;t.objectMode?(this[ct]=!0,this[tt]=null):!(a=t).objectMode&&a.encoding&&"buffer"!==a.encoding?(this[tt]=t.encoding,this[ct]=!1):(this[ct]=!1,this[tt]=null),this[yt]=!!t.async,this[at]=this[tt]?new Be.StringDecoder(this[tt]):null,t&&!0===t.debugExposeBuffer&&Object.defineProperty(this,"buffer",{get:()=>this[rt]}),t&&!0===t.debugExposePipes&&Object.defineProperty(this,"pipes",{get:()=>this[ot]});const{signal:s}=t;s&&(this[bt]=s,s.aborted?this[vt]():s.addEventListener("abort",()=>this[vt]()))}get bufferLength(){return this[pt]}get encoding(){return this[tt]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[ct]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[yt]}set async(e){this[yt]=this[yt]||!!e}[vt](){this[wt]=!0,this.emit("abort",this[bt]?.reason),this.destroy(this[bt]?.reason)}get aborted(){return this[wt]}set aborted(e){}write(e,t,a){if(this[wt])return!1;if(this[He])throw new Error("write after end");if(this[mt])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;"function"==typeof t&&(a=t,t="utf8"),t||(t="utf8");const s=this[yt]?Tt:kt;if(!this[ct]&&!Buffer.isBuffer(e))if(n=e,!Buffer.isBuffer(n)&&ArrayBuffer.isView(n))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if((e=>e instanceof ArrayBuffer||!!e&&"object"==typeof e&&e.constructor&&"ArrayBuffer"===e.constructor.name&&e.byteLength>=0)(e))e=Buffer.from(e);else if("string"!=typeof e)throw new Error("Non-contiguous data written to non-objectMode stream");var n;return this[ct]?(this[st]&&0!==this[pt]&&this[Ze](!0),this[st]?this.emit("data",e):this[dt](e),0!==this[pt]&&this.emit("readable"),a&&s(a),this[st]):e.length?("string"!=typeof e||t===this[tt]&&!this[at]?.lastNeed||(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[tt]&&(e=this[at].write(e)),this[st]&&0!==this[pt]&&this[Ze](!0),this[st]?this.emit("data",e):this[dt](e),0!==this[pt]&&this.emit("readable"),a&&s(a),this[st]):(0!==this[pt]&&this.emit("readable"),a&&s(a),this[st])}read(e){if(this[mt])return null;if(this[St]=!1,0===this[pt]||0===e||e&&e>this[pt])return this[Je](),null;this[ct]&&(e=null),this[rt].length>1&&!this[ct]&&(this[rt]=[this[tt]?this[rt].join(""):Buffer.concat(this[rt],this[pt])]);const t=this[Qe](e||null,this[rt][0]);return this[Je](),t}[Qe](e,t){if(this[ct])this[lt]();else{const a=t;e===a.length||null===e?this[lt]():"string"==typeof a?(this[rt][0]=a.slice(e),t=a.slice(0,e),this[pt]-=e):(this[rt][0]=a.subarray(e),t=a.subarray(0,e),this[pt]-=e)}return this.emit("data",t),this[rt].length||this[He]||this.emit("drain"),t}end(e,t,a){return"function"==typeof e&&(a=e,e=void 0),"function"==typeof t&&(a=t,t="utf8"),void 0!==e&&this.write(e,t),a&&this.once("end",a),this[He]=!0,this.writable=!1,!this[st]&&this[nt]||this[Je](),this}[it](){this[mt]||(this[_t]||this[ot].length||(this[St]=!0),this[nt]=!1,this[st]=!0,this.emit("resume"),this[rt].length?this[Ze]():this[He]?this[Je]():this.emit("drain"))}resume(){return this[it]()}pause(){this[st]=!1,this[nt]=!0,this[St]=!1}get destroyed(){return this[mt]}get flowing(){return this[st]}get paused(){return this[nt]}[dt](e){this[ct]?this[pt]+=1:this[pt]+=e.length,this[rt].push(e)}[lt](){return this[ct]?this[pt]-=1:this[pt]-=this[rt][0].length,this[rt].shift()}[Ze](e=!1){do{}while(this[et](this[lt]())&&this[rt].length);e||this[rt].length||this[He]||this.emit("drain")}[et](e){return this.emit("data",e),this[st]}pipe(e,t){if(this[mt])return e;this[St]=!1;const a=this[Ge];return t=t||{},e===qe.stdout||e===qe.stderr?t.end=!1:t.end=!1!==t.end,t.proxyErrors=!!t.proxyErrors,a?t.end&&e.end():(this[ot].push(t.proxyErrors?new Ct(this,e,t):new xt(this,e,t)),this[yt]?Tt(()=>this[it]()):this[it]()),e}unpipe(e){const t=this[ot].find(t=>t.dest===e);t&&(1===this[ot].length?(this[st]&&0===this[_t]&&(this[st]=!1),this[ot]=[]):this[ot].splice(this[ot].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){const a=super.on(e,t);if("data"===e)this[St]=!1,this[_t]++,this[ot].length||this[st]||this[it]();else if("readable"===e&&0!==this[pt])super.emit("readable");else if((e=>"end"===e||"finish"===e||"prefinish"===e)(e)&&this[Ge])super.emit(e),this.removeAllListeners(e);else if("error"===e&&this[Ke]){const e=t;this[yt]?Tt(()=>e.call(this,this[Ke])):e.call(this,this[Ke])}return a}removeListener(e,t){return this.off(e,t)}off(e,t){const a=super.off(e,t);return"data"===e&&(this[_t]=this.listeners("data").length,0!==this[_t]||this[St]||this[ot].length||(this[st]=!1)),a}removeAllListeners(e){const t=super.removeAllListeners(e);return"data"!==e&&void 0!==e||(this[_t]=0,this[St]||this[ot].length||(this[st]=!1)),t}get emittedEnd(){return this[Ge]}[Je](){this[Ye]||this[Ge]||this[mt]||0!==this[rt].length||!this[He]||(this[Ye]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Xe]&&this.emit("close"),this[Ye]=!1)}emit(e,...t){const a=t[0];if("error"!==e&&"close"!==e&&e!==mt&&this[mt])return!1;if("data"===e)return!(!this[ct]&&!a)&&(this[yt]?(Tt(()=>this[ht](a)),!0):this[ht](a));if("end"===e)return this[ft]();if("close"===e){if(this[Xe]=!0,!this[Ge]&&!this[mt])return!1;const e=super.emit("close");return this.removeAllListeners("close"),e}if("error"===e){this[Ke]=a,super.emit(ut,a);const e=!(this[bt]&&!this.listeners("error").length)&&super.emit("error",a);return this[Je](),e}if("resume"===e){const e=super.emit("resume");return this[Je](),e}if("finish"===e||"prefinish"===e){const t=super.emit(e);return this.removeAllListeners(e),t}const s=super.emit(e,...t);return this[Je](),s}[ht](e){for(const t of this[ot])!1===t.dest.write(e)&&this.pause();const t=!this[St]&&super.emit("data",e);return this[Je](),t}[ft](){return!this[Ge]&&(this[Ge]=!0,this.readable=!1,this[yt]?(Tt(()=>this[gt]()),!0):this[gt]())}[gt](){if(this[at]){const e=this[at].end();if(e){for(const t of this[ot])t.dest.write(e);this[St]||super.emit("data",e)}}for(const e of this[ot])e.end();const e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){const e=Object.assign([],{dataLength:0});this[ct]||(e.dataLength=0);const t=this.promise();return this.on("data",t=>{e.push(t),this[ct]||(e.dataLength+=t.length)}),await t,e}async concat(){if(this[ct])throw new Error("cannot concat in objectMode");const e=await this.collect();return this[tt]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(mt,()=>t(new Error("stream destroyed"))),this.on("error",e=>t(e)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[St]=!1;let e=!1;const t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();const a=this.read();if(null!==a)return Promise.resolve({done:!1,value:a});if(this[He])return t();let s,n;const i=e=>{this.off("data",r),this.off("end",o),this.off(mt,p),t(),n(e)},r=e=>{this.off("error",i),this.off("end",o),this.off(mt,p),this.pause(),s({value:e,done:!!this[He]})},o=()=>{this.off("error",i),this.off("data",r),this.off(mt,p),t(),s({done:!0,value:void 0})},p=()=>i(new Error("stream destroyed"));return new Promise((e,t)=>{n=t,s=e,this.once(mt,p),this.once("error",i),this.once("end",o),this.once("data",r)})},throw:t,return:t,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[St]=!1;let e=!1;const t=()=>(this.pause(),this.off(ut,t),this.off(mt,t),this.off("end",t),e=!0,{done:!0,value:void 0});return this.once("end",t),this.once(ut,t),this.once(mt,t),{next:()=>{if(e)return t();const a=this.read();return null===a?t():{done:!1,value:a}},throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){return this[mt]?(e?this.emit("error",e):this.emit(mt),this):(this[mt]=!0,this[St]=!0,this[rt].length=0,this[pt]=0,"function"!=typeof this.close||this[Xe]||this.close(),e?this.emit("error",e):this.emit(mt),this)}static get isStream(){return We}}const Et=Me.realpathSync.native,$t={lstatSync:Me.lstatSync,readdir:Me.readdir,readdirSync:Me.readdirSync,readlinkSync:Me.readlinkSync,realpathSync:Et,promises:{lstat:je.lstat,readdir:je.readdir,readlink:je.readlink,realpath:je.realpath}},Dt=e=>e&&e!==$t&&e!==Ie?{...$t,...e,promises:{...$t.promises,...e.promises||{}}}:$t,Nt=/^\\\\\?\\([a-z]:)\\?$/i,Rt=/[\\\/]/,Pt=10,Ot=15,Mt=-16,Lt=128,It=e=>e.isFile()?8:e.isDirectory()?4:e.isSymbolicLink()?Pt:e.isCharacterDevice()?2:e.isBlockDevice()?6:e.isSocket()?12:e.isFIFO()?1:0,jt=new Map,Ft=e=>{const t=jt.get(e);if(t)return t;const a=e.normalize("NFKD");return jt.set(e,a),a},Vt=new Map,Bt=e=>{const t=Vt.get(e);if(t)return t;const a=Ft(e.toLowerCase());return Vt.set(e,a),a};class qt extends Pe{constructor(){super({max:256})}}class Wt extends Pe{constructor(e=16384){super({maxSize:e,sizeCalculation:e=>e.length+1})}}const Ut=Symbol("PathScurry setAsCwd");class zt{name;root;roots;parent;nocase;isCWD=!1;#oe;#pe;get dev(){return this.#pe}#de;get mode(){return this.#de}#le;get nlink(){return this.#le}#ce;get uid(){return this.#ce}#me;get gid(){return this.#me}#ue;get rdev(){return this.#ue}#he;get blksize(){return this.#he}#fe;get ino(){return this.#fe}#k;get size(){return this.#k}#ge;get blocks(){return this.#ge}#ye;get atimeMs(){return this.#ye}#ve;get mtimeMs(){return this.#ve}#we;get ctimeMs(){return this.#we}#be;get birthtimeMs(){return this.#be}#_e;get atime(){return this.#_e}#Se;get mtime(){return this.#Se}#Te;get ctime(){return this.#Te}#ke;get birthtime(){return this.#ke}#xe;#Ce;#Ae;#Ee;#$e;#De;#Ne;#Re;#Pe;#Oe;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=0,a,s,n,i,r){this.name=e,this.#xe=n?Bt(e):Ft(e),this.#Ne=1023&t,this.nocase=n,this.roots=s,this.root=a||this,this.#Re=i,this.#Ae=r.fullpath,this.#$e=r.relative,this.#De=r.relativePosix,this.parent=r.parent,this.parent?this.#oe=this.parent.#oe:this.#oe=Dt(r.fs)}depth(){return void 0!==this.#Ce?this.#Ce:this.parent?this.#Ce=this.parent.depth()+1:this.#Ce=0}childrenCache(){return this.#Re}resolve(e){if(!e)return this;const t=this.getRootString(e),a=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#Me(a):this.#Me(a)}#Me(e){let t=this;for(const a of e)t=t.child(a);return t}children(){const e=this.#Re.get(this);if(e)return e;const t=Object.assign([],{provisional:0});return this.#Re.set(this,t),this.#Ne&=-17,t}child(e,t){if(""===e||"."===e)return this;if(".."===e)return this.parent||this;const a=this.children(),s=this.nocase?Bt(e):Ft(e);for(const e of a)if(e.#xe===s)return e;const n=this.parent?this.sep:"",i=this.#Ae?this.#Ae+n+e:void 0,r=this.newChild(e,0,{...t,parent:this,fullpath:i});return this.canReaddir()||(r.#Ne|=Lt),a.push(r),r}relative(){if(this.isCWD)return"";if(void 0!==this.#$e)return this.#$e;const e=this.name,t=this.parent;if(!t)return this.#$e=this.name;const a=t.relative();return a+(a&&t.parent?this.sep:"")+e}relativePosix(){if("/"===this.sep)return this.relative();if(this.isCWD)return"";if(void 0!==this.#De)return this.#De;const e=this.name,t=this.parent;if(!t)return this.#De=this.fullpathPosix();const a=t.relativePosix();return a+(a&&t.parent?"/":"")+e}fullpath(){if(void 0!==this.#Ae)return this.#Ae;const e=this.name,t=this.parent;if(!t)return this.#Ae=this.name;const a=t.fullpath()+(t.parent?this.sep:"")+e;return this.#Ae=a}fullpathPosix(){if(void 0!==this.#Ee)return this.#Ee;if("/"===this.sep)return this.#Ee=this.fullpath();if(!this.parent){const e=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(e)?this.#Ee=`//?/${e}`:this.#Ee=e}const e=this.parent,t=e.fullpathPosix(),a=t+(t&&e.parent?"/":"")+this.name;return this.#Ee=a}isUnknown(){return 0===(this.#Ne&Ot)}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return 8===(this.#Ne&Ot)}isDirectory(){return 4===(this.#Ne&Ot)}isCharacterDevice(){return 2===(this.#Ne&Ot)}isBlockDevice(){return 6===(this.#Ne&Ot)}isFIFO(){return 1===(this.#Ne&Ot)}isSocket(){return 12===(this.#Ne&Ot)}isSymbolicLink(){return(this.#Ne&Pt)===Pt}lstatCached(){return 32&this.#Ne?this:void 0}readlinkCached(){return this.#Pe}realpathCached(){return this.#Oe}readdirCached(){const e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#Pe)return!0;if(!this.parent)return!1;const e=this.#Ne&Ot;return!(0!==e&&e!==Pt||256&this.#Ne||this.#Ne&Lt)}calledReaddir(){return!!(16&this.#Ne)}isENOENT(){return!!(this.#Ne&Lt)}isNamed(e){return this.nocase?this.#xe===Bt(e):this.#xe===Ft(e)}async readlink(){const e=this.#Pe;if(e)return e;if(this.canReadlink()&&this.parent)try{const e=await this.#oe.promises.readlink(this.fullpath()),t=(await this.parent.realpath())?.resolve(e);if(t)return this.#Pe=t}catch(e){return void this.#Le(e.code)}}readlinkSync(){const e=this.#Pe;if(e)return e;if(this.canReadlink()&&this.parent)try{const e=this.#oe.readlinkSync(this.fullpath()),t=this.parent.realpathSync()?.resolve(e);if(t)return this.#Pe=t}catch(e){return void this.#Le(e.code)}}#Ie(e){this.#Ne|=16;for(let t=e.provisional;t<e.length;t++){const a=e[t];a&&a.#je()}}#je(){this.#Ne&Lt||(this.#Ne=(this.#Ne|Lt)&Mt,this.#Fe())}#Fe(){const e=this.children();e.provisional=0;for(const t of e)t.#je()}#Ve(){this.#Ne|=512,this.#Be()}#Be(){if(64&this.#Ne)return;let e=this.#Ne;4===(e&Ot)&&(e&=Mt),this.#Ne=64|e,this.#Fe()}#qe(e=""){"ENOTDIR"===e||"EPERM"===e?this.#Be():"ENOENT"===e?this.#je():this.children().provisional=0}#We(e=""){"ENOTDIR"===e?this.parent.#Be():"ENOENT"===e&&this.#je()}#Le(e=""){let t=this.#Ne;t|=256,"ENOENT"===e&&(t|=Lt),"EINVAL"!==e&&"UNKNOWN"!==e||(t&=Mt),this.#Ne=t,"ENOTDIR"===e&&this.parent&&this.parent.#Be()}#Ue(e,t){return this.#ze(e,t)||this.#He(e,t)}#He(e,t){const a=It(e),s=this.newChild(e.name,a,{parent:this}),n=s.#Ne&Ot;return 4!==n&&n!==Pt&&0!==n&&(s.#Ne|=64),t.unshift(s),t.provisional++,s}#ze(e,t){for(let a=t.provisional;a<t.length;a++){const s=t[a];if((this.nocase?Bt(e.name):Ft(e.name))===s.#xe)return this.#Je(e,s,a,t)}}#Je(e,t,a,s){const n=t.name;return t.#Ne=t.#Ne&Mt|It(e),n!==e.name&&(t.name=e.name),a!==s.provisional&&(a===s.length-1?s.pop():s.splice(a,1),s.unshift(t)),s.provisional++,t}async lstat(){if(0===(this.#Ne&Lt))try{return this.#Ge(await this.#oe.promises.lstat(this.fullpath())),this}catch(e){this.#We(e.code)}}lstatSync(){if(0===(this.#Ne&Lt))try{return this.#Ge(this.#oe.lstatSync(this.fullpath())),this}catch(e){this.#We(e.code)}}#Ge(e){const{atime:t,atimeMs:a,birthtime:s,birthtimeMs:n,blksize:i,blocks:r,ctime:o,ctimeMs:p,dev:d,gid:l,ino:c,mode:m,mtime:u,mtimeMs:h,nlink:f,rdev:g,size:y,uid:v}=e;this.#_e=t,this.#ye=a,this.#ke=s,this.#be=n,this.#he=i,this.#ge=r,this.#Te=o,this.#we=p,this.#pe=d,this.#me=l,this.#fe=c,this.#de=m,this.#Se=u,this.#ve=h,this.#le=f,this.#ue=g,this.#k=y,this.#ce=v;const w=It(e);this.#Ne=this.#Ne&Mt|w|32,0!==w&&4!==w&&w!==Pt&&(this.#Ne|=64)}#Ye=[];#Ke=!1;#Xe(e){this.#Ke=!1;const t=this.#Ye.slice();this.#Ye.length=0,t.forEach(t=>t(null,e))}readdirCB(e,t=!1){if(!this.canReaddir())return void(t?e(null,[]):queueMicrotask(()=>e(null,[])));const a=this.children();if(this.calledReaddir()){const s=a.slice(0,a.provisional);return void(t?e(null,s):queueMicrotask(()=>e(null,s)))}if(this.#Ye.push(e),this.#Ke)return;this.#Ke=!0;const s=this.fullpath();this.#oe.readdir(s,{withFileTypes:!0},(e,t)=>{if(e)this.#qe(e.code),a.provisional=0;else{for(const e of t)this.#Ue(e,a);this.#Ie(a)}this.#Xe(a.slice(0,a.provisional))})}#Qe;async readdir(){if(!this.canReaddir())return[];const e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);const t=this.fullpath();if(this.#Qe)await this.#Qe;else{let a=()=>{};this.#Qe=new Promise(e=>a=e);try{for(const a of await this.#oe.promises.readdir(t,{withFileTypes:!0}))this.#Ue(a,e);this.#Ie(e)}catch(t){this.#qe(t.code),e.provisional=0}this.#Qe=void 0,a()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];const e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);const t=this.fullpath();try{for(const a of this.#oe.readdirSync(t,{withFileTypes:!0}))this.#Ue(a,e);this.#Ie(e)}catch(t){this.#qe(t.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(704&this.#Ne)return!1;const e=Ot&this.#Ne;return 0===e||4===e||e===Pt}shouldWalk(e,t){return!(4&~this.#Ne)&&!(704&this.#Ne)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#Oe)return this.#Oe;if(!(896&this.#Ne))try{const e=await this.#oe.promises.realpath(this.fullpath());return this.#Oe=this.resolve(e)}catch(e){this.#Ve()}}realpathSync(){if(this.#Oe)return this.#Oe;if(!(896&this.#Ne))try{const e=this.#oe.realpathSync(this.fullpath());return this.#Oe=this.resolve(e)}catch(e){this.#Ve()}}[Ut](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;const t=new Set([]);let a=[],s=this;for(;s&&s.parent;)t.add(s),s.#$e=a.join(this.sep),s.#De=a.join("/"),s=s.parent,a.push("..");for(s=e;s&&s.parent&&!t.has(s);)s.#$e=void 0,s.#De=void 0,s=s.parent}}class Ht extends zt{sep="\\";splitSep=Rt;constructor(e,t=0,a,s,n,i,r){super(e,t,a,s,n,i,r)}newChild(e,t=0,a={}){return new Ht(e,t,this.root,this.roots,this.nocase,this.childrenCache(),a)}getRootString(e){return Oe.win32.parse(e).root}getRoot(e){if((e=(e=>e.replace(/\//g,"\\").replace(Nt,"$1\\"))(e.toUpperCase()))===this.root.name)return this.root;for(const[t,a]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=a;return this.roots[e]=new Yt(e,this).root}sameRoot(e,t=this.root.name){return(e=e.toUpperCase().replace(/\//g,"\\").replace(Nt,"$1\\"))===t}}class Jt extends zt{splitSep="/";sep="/";constructor(e,t=0,a,s,n,i,r){super(e,t,a,s,n,i,r)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,t=0,a={}){return new Jt(e,t,this.root,this.roots,this.nocase,this.childrenCache(),a)}}class Gt{root;rootPath;roots;cwd;#Ze;#et;#Re;nocase;#oe;constructor(e=process.cwd(),t,a,{nocase:s,childrenCacheSize:n=16384,fs:i=$t}={}){this.#oe=Dt(i),(e instanceof URL||e.startsWith("file://"))&&(e=(0,Se.fileURLToPath)(e));const r=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(r),this.#Ze=new qt,this.#et=new qt,this.#Re=new Wt(n);const o=r.substring(this.rootPath.length).split(a);if(1!==o.length||o[0]||o.pop(),void 0===s)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=s,this.root=this.newRoot(this.#oe),this.roots[this.rootPath]=this.root;let p=this.root,d=o.length-1;const l=t.sep;let c=this.rootPath,m=!1;for(const e of o){const t=d--;p=p.child(e,{relative:new Array(t).fill("..").join(l),relativePosix:new Array(t).fill("..").join("/"),fullpath:c+=(m?"":l)+e}),m=!0}this.cwd=p}depth(e=this.cwd){return"string"==typeof e&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#Re}resolve(...e){let t="";for(let a=e.length-1;a>=0;a--){const s=e[a];if(s&&"."!==s&&(t=t?`${s}/${t}`:s,this.isAbsolute(s)))break}const a=this.#Ze.get(t);if(void 0!==a)return a;const s=this.cwd.resolve(t).fullpath();return this.#Ze.set(t,s),s}resolvePosix(...e){let t="";for(let a=e.length-1;a>=0;a--){const s=e[a];if(s&&"."!==s&&(t=t?`${s}/${t}`:s,this.isAbsolute(s)))break}const a=this.#et.get(t);if(void 0!==a)return a;const s=this.cwd.resolve(t).fullpathPosix();return this.#et.set(t,s),s}relative(e=this.cwd){return"string"==typeof e&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return"string"==typeof e&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return"string"==typeof e&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return"string"==typeof e&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,t={withFileTypes:!0}){"string"==typeof e?e=this.cwd.resolve(e):e instanceof zt||(t=e,e=this.cwd);const{withFileTypes:a}=t;if(e.canReaddir()){const t=await e.readdir();return a?t:t.map(e=>e.name)}return[]}readdirSync(e=this.cwd,t={withFileTypes:!0}){"string"==typeof e?e=this.cwd.resolve(e):e instanceof zt||(t=e,e=this.cwd);const{withFileTypes:a=!0}=t;return e.canReaddir()?a?e.readdirSync():e.readdirSync().map(e=>e.name):[]}async lstat(e=this.cwd){return"string"==typeof e&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return"string"==typeof e&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){"string"==typeof e?e=this.cwd.resolve(e):e instanceof zt||(t=e.withFileTypes,e=this.cwd);const a=await e.readlink();return t?a:a?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){"string"==typeof e?e=this.cwd.resolve(e):e instanceof zt||(t=e.withFileTypes,e=this.cwd);const a=e.readlinkSync();return t?a:a?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){"string"==typeof e?e=this.cwd.resolve(e):e instanceof zt||(t=e.withFileTypes,e=this.cwd);const a=await e.realpath();return t?a:a?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){"string"==typeof e?e=this.cwd.resolve(e):e instanceof zt||(t=e.withFileTypes,e=this.cwd);const a=e.realpathSync();return t?a:a?.fullpath()}async walk(e=this.cwd,t={}){"string"==typeof e?e=this.cwd.resolve(e):e instanceof zt||(t=e,e=this.cwd);const{withFileTypes:a=!0,follow:s=!1,filter:n,walkFilter:i}=t,r=[];n&&!n(e)||r.push(a?e:e.fullpath());const o=new Set,p=(e,t)=>{o.add(e),e.readdirCB((e,d)=>{if(e)return t(e);let l=d.length;if(!l)return t();const c=()=>{0===--l&&t()};for(const e of d)n&&!n(e)||r.push(a?e:e.fullpath()),s&&e.isSymbolicLink()?e.realpath().then(e=>e?.isUnknown()?e.lstat():e).then(e=>e?.shouldWalk(o,i)?p(e,c):c()):e.shouldWalk(o,i)?p(e,c):c()},!0)},d=e;return new Promise((e,t)=>{p(d,a=>{if(a)return t(a);e(r)})})}walkSync(e=this.cwd,t={}){"string"==typeof e?e=this.cwd.resolve(e):e instanceof zt||(t=e,e=this.cwd);const{withFileTypes:a=!0,follow:s=!1,filter:n,walkFilter:i}=t,r=[];n&&!n(e)||r.push(a?e:e.fullpath());const o=new Set([e]);for(const e of o){const t=e.readdirSync();for(const e of t){n&&!n(e)||r.push(a?e:e.fullpath());let t=e;if(e.isSymbolicLink()){if(!s||!(t=e.realpathSync()))continue;t.isUnknown()&&t.lstatSync()}t.shouldWalk(o,i)&&o.add(t)}}return r}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return"string"==typeof e?e=this.cwd.resolve(e):e instanceof zt||(t=e,e=this.cwd),this.stream(e,t)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,t={}){"string"==typeof e?e=this.cwd.resolve(e):e instanceof zt||(t=e,e=this.cwd);const{withFileTypes:a=!0,follow:s=!1,filter:n,walkFilter:i}=t;n&&!n(e)||(yield a?e:e.fullpath());const r=new Set([e]);for(const e of r){const t=e.readdirSync();for(const e of t){n&&!n(e)||(yield a?e:e.fullpath());let t=e;if(e.isSymbolicLink()){if(!s||!(t=e.realpathSync()))continue;t.isUnknown()&&t.lstatSync()}t.shouldWalk(r,i)&&r.add(t)}}}stream(e=this.cwd,t={}){"string"==typeof e?e=this.cwd.resolve(e):e instanceof zt||(t=e,e=this.cwd);const{withFileTypes:a=!0,follow:s=!1,filter:n,walkFilter:i}=t,r=new At({objectMode:!0});n&&!n(e)||r.write(a?e:e.fullpath());const o=new Set,p=[e];let d=0;const l=()=>{let e=!1;for(;!e;){const t=p.shift();if(!t)return void(0===d&&r.end());d++,o.add(t);const c=(t,u,h=!1)=>{if(t)return r.emit("error",t);if(s&&!h){const e=[];for(const t of u)t.isSymbolicLink()&&e.push(t.realpath().then(e=>e?.isUnknown()?e.lstat():e));if(e.length)return void Promise.all(e).then(()=>c(null,u,!0))}for(const t of u)!t||n&&!n(t)||r.write(a?t:t.fullpath())||(e=!0);d--;for(const e of u){const t=e.realpathCached()||e;t.shouldWalk(o,i)&&p.push(t)}e&&!r.flowing?r.once("drain",l):m||l()};let m=!0;t.readdirCB(c,!0),m=!1}};return l(),r}streamSync(e=this.cwd,t={}){"string"==typeof e?e=this.cwd.resolve(e):e instanceof zt||(t=e,e=this.cwd);const{withFileTypes:a=!0,follow:s=!1,filter:n,walkFilter:i}=t,r=new At({objectMode:!0}),o=new Set;n&&!n(e)||r.write(a?e:e.fullpath());const p=[e];let d=0;const l=()=>{let e=!1;for(;!e;){const t=p.shift();if(!t)return void(0===d&&r.end());d++,o.add(t);const l=t.readdirSync();for(const t of l)n&&!n(t)||r.write(a?t:t.fullpath())||(e=!0);d--;for(const e of l){let t=e;if(e.isSymbolicLink()){if(!s||!(t=e.realpathSync()))continue;t.isUnknown()&&t.lstatSync()}t.shouldWalk(o,i)&&p.push(t)}}e&&!r.flowing&&r.once("drain",l)};return l(),r}chdir(e=this.cwd){const t=this.cwd;this.cwd="string"==typeof e?this.cwd.resolve(e):e,this.cwd[Ut](t)}}class Yt extends Gt{sep="\\";constructor(e=process.cwd(),t={}){const{nocase:a=!0}=t;super(e,Oe.win32,"\\",{...t,nocase:a}),this.nocase=a;for(let e=this.cwd;e;e=e.parent)e.nocase=this.nocase}parseRootPath(e){return Oe.win32.parse(e).root.toUpperCase()}newRoot(e){return new Ht(this.rootPath,4,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}}class Kt extends Gt{sep="/";constructor(e=process.cwd(),t={}){const{nocase:a=!1}=t;super(e,Oe.posix,"/",{...t,nocase:a}),this.nocase=a}parseRootPath(e){return"/"}newRoot(e){return new Jt(this.rootPath,4,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}}class Xt extends Kt{constructor(e=process.cwd(),t={}){const{nocase:a=!0}=t;super(e,{...t,nocase:a})}}process.platform;const Qt="win32"===process.platform?Yt:"darwin"===process.platform?Xt:Kt;class Zt{#tt;#at;#st;length;#nt;#it;#rt;#ot;#pt;#dt;#lt=!0;constructor(e,t,a,s){if(!(e.length>=1))throw new TypeError("empty pattern list");if(!(t.length>=1))throw new TypeError("empty glob list");if(t.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,a<0||a>=this.length)throw new TypeError("index out of range");if(this.#tt=e,this.#at=t,this.#st=a,this.#nt=s,0===this.#st)if(this.isUNC()){const[e,t,a,s,...n]=this.#tt,[i,r,o,p,...d]=this.#at;""===n[0]&&(n.shift(),d.shift());const l=[e,t,a,s,""].join("/"),c=[i,r,o,p,""].join("/");this.#tt=[l,...n],this.#at=[c,...d],this.length=this.#tt.length}else if(this.isDrive()||this.isAbsolute()){const[e,...t]=this.#tt,[a,...s]=this.#at;""===t[0]&&(t.shift(),s.shift());const n=e+"/",i=a+"/";this.#tt=[n,...t],this.#at=[i,...s],this.length=this.#tt.length}}pattern(){return this.#tt[this.#st]}isString(){return"string"==typeof this.#tt[this.#st]}isGlobstar(){return this.#tt[this.#st]===ye}isRegExp(){return this.#tt[this.#st]instanceof RegExp}globString(){return this.#rt=this.#rt||(0===this.#st?this.isAbsolute()?this.#at[0]+this.#at.slice(1).join("/"):this.#at.join("/"):this.#at.slice(this.#st).join("/"))}hasMore(){return this.length>this.#st+1}rest(){return void 0!==this.#it?this.#it:this.hasMore()?(this.#it=new Zt(this.#tt,this.#at,this.#st+1,this.#nt),this.#it.#dt=this.#dt,this.#it.#pt=this.#pt,this.#it.#ot=this.#ot,this.#it):this.#it=null}isUNC(){const e=this.#tt;return void 0!==this.#pt?this.#pt:this.#pt="win32"===this.#nt&&0===this.#st&&""===e[0]&&""===e[1]&&"string"==typeof e[2]&&!!e[2]&&"string"==typeof e[3]&&!!e[3]}isDrive(){const e=this.#tt;return void 0!==this.#ot?this.#ot:this.#ot="win32"===this.#nt&&0===this.#st&&this.length>1&&"string"==typeof e[0]&&/^[a-z]:$/i.test(e[0])}isAbsolute(){const e=this.#tt;return void 0!==this.#dt?this.#dt:this.#dt=""===e[0]&&e.length>1||this.isDrive()||this.isUNC()}root(){const e=this.#tt[0];return"string"==typeof e&&this.isAbsolute()&&0===this.#st?e:""}checkFollowGlobstar(){return!(0===this.#st||!this.isGlobstar()||!this.#lt)}markFollowGlobstar(){return!(0===this.#st||!this.isGlobstar()||!this.#lt||(this.#lt=!1,0))}}const ea="object"==typeof process&&process&&"string"==typeof process.platform?process.platform:"linux";class ta{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:a,noext:s,noglobstar:n,platform:i=ea}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=i,this.mmopts={dot:!0,nobrace:t,nocase:a,noext:s,noglobstar:n,optimizationLevel:2,platform:i,nocomment:!0,nonegate:!0};for(const t of e)this.add(t)}add(e){const t=new _e(e,this.mmopts);for(let e=0;e<t.set.length;e++){const a=t.set[e],s=t.globParts[e];if(!a||!s)throw new Error("invalid pattern object");for(;"."===a[0]&&"."===s[0];)a.shift(),s.shift();const n=new Zt(a,s,0,this.platform),i=new _e(n.globString(),this.mmopts),r="**"===s[s.length-1],o=n.isAbsolute();o?this.absolute.push(i):this.relative.push(i),r&&(o?this.absoluteChildren.push(i):this.relativeChildren.push(i))}}ignored(e){const t=e.fullpath(),a=`${t}/`,s=e.relative()||".",n=`${s}/`;for(const e of this.relative)if(e.match(s)||e.match(n))return!0;for(const e of this.absolute)if(e.match(t)||e.match(a))return!0;return!1}childrenIgnored(e){const t=e.fullpath()+"/",a=(e.relative()||".")+"/";for(const e of this.relativeChildren)if(e.match(a))return!0;for(const e of this.absoluteChildren)if(e.match(t))return!0;return!1}}class aa{store;constructor(e=new Map){this.store=e}copy(){return new aa(new Map(this.store))}hasWalked(e,t){return this.store.get(e.fullpath())?.has(t.globString())}storeWalked(e,t){const a=e.fullpath(),s=this.store.get(a);s?s.add(t.globString()):this.store.set(a,new Set([t.globString()]))}}class sa{store=new Map;add(e,t,a){const s=(t?2:0)|(a?1:0),n=this.store.get(e);this.store.set(e,void 0===n?s:s&n)}entries(){return[...this.store.entries()].map(([e,t])=>[e,!!(2&t),!!(1&t)])}}class na{store=new Map;add(e,t){if(!e.canReaddir())return;const a=this.store.get(e);a?a.find(e=>e.globString()===t.globString())||a.push(t):this.store.set(e,[t])}get(e){const t=this.store.get(e);if(!t)throw new Error("attempting to walk unknown path");return t}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}}class ia{hasWalkedCache;matches=new sa;subwalks=new na;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new aa}processPatterns(e,t){this.patterns=t;const a=t.map(t=>[e,t]);for(let[e,t]of a){this.hasWalkedCache.storeWalked(e,t);const a=t.root(),s=t.isAbsolute()&&!1!==this.opts.absolute;if(a){e=e.resolve("/"===a&&void 0!==this.opts.root?this.opts.root:a);const s=t.rest();if(!s){this.matches.add(e,!0,!1);continue}t=s}if(e.isENOENT())continue;let n,i,r=!1;for(;"string"==typeof(n=t.pattern())&&(i=t.rest());){const a=e.resolve(n);e=a,t=i,r=!0}if(n=t.pattern(),i=t.rest(),r){if(this.hasWalkedCache.hasWalked(e,t))continue;this.hasWalkedCache.storeWalked(e,t)}if("string"==typeof n){const t=".."===n||""===n||"."===n;this.matches.add(e.resolve(n),s,t);continue}if(n===ye){(!e.isSymbolicLink()||this.follow||t.checkFollowGlobstar())&&this.subwalks.add(e,t);const a=i?.pattern(),n=i?.rest();if(i&&(""!==a&&"."!==a||n)){if(".."===a){const t=e.parent||e;n?this.hasWalkedCache.hasWalked(t,n)||this.subwalks.add(t,n):this.matches.add(t,s,!0)}}else this.matches.add(e,s,""===a||"."===a)}else n instanceof RegExp&&this.subwalks.add(e,t)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new ia(this.opts,this.hasWalkedCache)}filterEntries(e,t){const a=this.subwalks.get(e),s=this.child();for(const e of t)for(const t of a){const a=t.isAbsolute(),n=t.pattern(),i=t.rest();n===ye?s.testGlobstar(e,t,i,a):n instanceof RegExp?s.testRegExp(e,n,i,a):s.testString(e,n,i,a)}return s}testGlobstar(e,t,a,s){if(!this.dot&&e.name.startsWith(".")||(t.hasMore()||this.matches.add(e,s,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,t):e.isSymbolicLink()&&(a&&t.checkFollowGlobstar()?this.subwalks.add(e,a):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),a){const t=a.pattern();if("string"==typeof t&&".."!==t&&""!==t&&"."!==t)this.testString(e,t,a.rest(),s);else if(".."===t){const t=e.parent||e;this.subwalks.add(t,a)}else t instanceof RegExp&&this.testRegExp(e,t,a.rest(),s)}}testRegExp(e,t,a,s){t.test(e.name)&&(a?this.subwalks.add(e,a):this.matches.add(e,s,!1))}testString(e,t,a,s){e.isNamed(t)&&(a?this.subwalks.add(e,a):this.matches.add(e,s,!1))}}class ra{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#ct=[];#mt;#ut;signal;maxDepth;includeChildMatches;constructor(e,t,a){if(this.patterns=e,this.path=t,this.opts=a,this.#ut=a.posix||"win32"!==a.platform?"/":"\\",this.includeChildMatches=!1!==a.includeChildMatches,(a.ignore||!this.includeChildMatches)&&(this.#mt=((e,t)=>"string"==typeof e?new ta([e],t):Array.isArray(e)?new ta(e,t):e)(a.ignore??[],a),!this.includeChildMatches&&"function"!=typeof this.#mt.add))throw new Error("cannot ignore child matches, ignore lacks add() method.");this.maxDepth=a.maxDepth||1/0,a.signal&&(this.signal=a.signal,this.signal.addEventListener("abort",()=>{this.#ct.length=0}))}#ht(e){return this.seen.has(e)||!!this.#mt?.ignored?.(e)}#ft(e){return!!this.#mt?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;let e;for(this.paused=!1;!this.paused&&(e=this.#ct.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#ct.push(e):e())}async matchCheck(e,t){if(t&&this.opts.nodir)return;let a;if(this.opts.realpath){if(a=e.realpathCached()||await e.realpath(),!a)return;e=a}const s=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){const e=await s.realpath();e&&(e.isUnknown()||this.opts.stat)&&await e.lstat()}return this.matchCheckTest(s,t)}matchCheckTest(e,t){return!e||!(this.maxDepth===1/0||e.depth()<=this.maxDepth)||t&&!e.canReaddir()||this.opts.nodir&&e.isDirectory()||this.opts.nodir&&this.opts.follow&&e.isSymbolicLink()&&e.realpathCached()?.isDirectory()||this.#ht(e)?void 0:e}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let a;if(this.opts.realpath){if(a=e.realpathCached()||e.realpathSync(),!a)return;e=a}const s=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){const e=s.realpathSync();e&&(e?.isUnknown()||this.opts.stat)&&e.lstatSync()}return this.matchCheckTest(s,t)}matchFinish(e,t){if(this.#ht(e))return;if(!this.includeChildMatches&&this.#mt?.add){const t=`${e.relativePosix()}/**`;this.#mt.add(t)}const a=void 0===this.opts.absolute?t:this.opts.absolute;this.seen.add(e);const s=this.opts.mark&&e.isDirectory()?this.#ut:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(a){const t=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(t+s)}else{const t=this.opts.posix?e.relativePosix():e.relative(),a=this.opts.dotRelative&&!t.startsWith(".."+this.#ut)?"."+this.#ut:"";this.matchEmit(t?a+t+s:"."+s)}}async match(e,t,a){const s=await this.matchCheck(e,a);s&&this.matchFinish(s,t)}matchSync(e,t,a){const s=this.matchCheckSync(e,a);s&&this.matchFinish(s,t)}walkCB(e,t,a){this.signal?.aborted&&a(),this.walkCB2(e,t,new ia(this.opts),a)}walkCB2(e,t,a,s){if(this.#ft(e))return s();if(this.signal?.aborted&&s(),this.paused)return void this.onResume(()=>this.walkCB2(e,t,a,s));a.processPatterns(e,t);let n=1;const i=()=>{0===--n&&s()};for(const[e,t,s]of a.matches.entries())this.#ht(e)||(n++,this.match(e,t,s).then(()=>i()));for(const e of a.subwalkTargets()){if(this.maxDepth!==1/0&&e.depth()>=this.maxDepth)continue;n++;const t=e.readdirCached();e.calledReaddir()?this.walkCB3(e,t,a,i):e.readdirCB((t,s)=>this.walkCB3(e,s,a,i),!0)}i()}walkCB3(e,t,a,s){a=a.filterEntries(e,t);let n=1;const i=()=>{0===--n&&s()};for(const[e,t,s]of a.matches.entries())this.#ht(e)||(n++,this.match(e,t,s).then(()=>i()));for(const[e,t]of a.subwalks.entries())n++,this.walkCB2(e,t,a.child(),i);i()}walkCBSync(e,t,a){this.signal?.aborted&&a(),this.walkCB2Sync(e,t,new ia(this.opts),a)}walkCB2Sync(e,t,a,s){if(this.#ft(e))return s();if(this.signal?.aborted&&s(),this.paused)return void this.onResume(()=>this.walkCB2Sync(e,t,a,s));a.processPatterns(e,t);let n=1;const i=()=>{0===--n&&s()};for(const[e,t,s]of a.matches.entries())this.#ht(e)||this.matchSync(e,t,s);for(const e of a.subwalkTargets()){if(this.maxDepth!==1/0&&e.depth()>=this.maxDepth)continue;n++;const t=e.readdirSync();this.walkCB3Sync(e,t,a,i)}i()}walkCB3Sync(e,t,a,s){a=a.filterEntries(e,t);let n=1;const i=()=>{0===--n&&s()};for(const[e,t,s]of a.matches.entries())this.#ht(e)||this.matchSync(e,t,s);for(const[e,t]of a.subwalks.entries())n++,this.walkCB2Sync(e,t,a.child(),i);i()}}class oa extends ra{matches=new Set;constructor(e,t,a){super(e,t,a)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,t)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?t(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}}class pa extends ra{results;constructor(e,t,a){super(e,t,a),this.results=new At({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){const e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}const da="object"==typeof process&&process&&"string"==typeof process.platform?process.platform:"linux";class la{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,t){if(!t)throw new TypeError("glob options required");if(this.withFileTypes=!!t.withFileTypes,this.signal=t.signal,this.follow=!!t.follow,this.dot=!!t.dot,this.dotRelative=!!t.dotRelative,this.nodir=!!t.nodir,this.mark=!!t.mark,t.cwd?(t.cwd instanceof URL||t.cwd.startsWith("file://"))&&(t.cwd=(0,Se.fileURLToPath)(t.cwd)):this.cwd="",this.cwd=t.cwd||"",this.root=t.root,this.magicalBraces=!!t.magicalBraces,this.nobrace=!!t.nobrace,this.noext=!!t.noext,this.realpath=!!t.realpath,this.absolute=t.absolute,this.includeChildMatches=!1!==t.includeChildMatches,this.noglobstar=!!t.noglobstar,this.matchBase=!!t.matchBase,this.maxDepth="number"==typeof t.maxDepth?t.maxDepth:1/0,this.stat=!!t.stat,this.ignore=t.ignore,this.withFileTypes&&void 0!==this.absolute)throw new Error("cannot set absolute and withFileTypes:true");if("string"==typeof e&&(e=[e]),this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||!1===t.allowWindowsEscape,this.windowsPathsNoEscape&&(e=e.map(e=>e.replace(/\\/g,"/"))),this.matchBase){if(t.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(e=>e.includes("/")?e:`./**/${e}`)}if(this.pattern=e,this.platform=t.platform||da,this.opts={...t,platform:this.platform},t.scurry){if(this.scurry=t.scurry,void 0!==t.nocase&&t.nocase!==t.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{const e="win32"===t.platform?Yt:"darwin"===t.platform?Xt:t.platform?Kt:Qt;this.scurry=new e(this.cwd,{nocase:t.nocase,fs:t.fs})}this.nocase=this.scurry.nocase;const a="darwin"===this.platform||"win32"===this.platform,s={...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:a,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},n=this.pattern.map(e=>new _e(e,s)),[i,r]=n.reduce((e,t)=>(e[0].push(...t.set),e[1].push(...t.globParts),e),[[],[]]);this.patterns=i.map((e,t)=>{const a=r[t];if(!a)throw new Error("invalid pattern object");return new Zt(e,a,0,this.platform)})}async walk(){return[...await new oa(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new oa(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new pa(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new pa(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}function ca(e,t={}){return new la(e,t).streamSync()}function ma(e,t={}){return new la(e,t).stream()}function ua(e,t={}){return new la(e,t).walkSync()}async function ha(e,t={}){return new la(e,t).walk()}function fa(e,t={}){return new la(e,t).iterateSync()}function ga(e,t={}){return new la(e,t).iterate()}const ya=ca,va=Object.assign(ma,{sync:ca}),wa=fa,ba=Object.assign(ga,{sync:fa}),_a=Object.assign(ua,{stream:ca,iterate:fa}),Sa=Object.assign(ha,{glob:ha,globSync:ua,sync:_a,globStream:ma,stream:va,globStreamSync:ca,streamSync:ya,globIterate:ga,iterate:ba,globIterateSync:fa,iterateSync:wa,Glob:la,hasMagic:(e,t={})=>{Array.isArray(e)||(e=[e]);for(const a of e)if(new _e(a,t).hasMagic())return!0;return!1},escape:G,unescape:L});Sa.glob=Sa},3782:(e,t,a)=>{var s,n;e.exports=(s={Agent:()=>r.Agent,default:()=>r.default},n={},a.d(n,s),n)},3785:e=>{e.exports=i("readline")},3871:(e,t,a)=>{var s,n;e.exports=(s={Agent:()=>o.Agent,default:()=>o.default},n={},a.d(n,s),n)},4073:(e,t,a)=>{a.d(t,{r:()=>r});var s=a(5814),n=a(1663),i=a(9187);class r extends n.X{process=null;messageId=0;pendingRequests=new Map;outputBuffer="";constructor(e){super(e)}async connect(){this.validateConfig(),this.logConnection("connecting");try{this.process=(0,s.spawn)(this.config.command,this.config.args||[],{env:{...process.env,...this.config.env},stdio:["pipe","pipe","pipe"]}),this.process.stdout?.on("data",e=>{this.handleOutput(e.toString())}),this.process.stderr?.on("data",e=>{(0,i.JE)(`MCP Server stderr [${this.config.name}]: ${e.toString()}`)}),this.process.on("error",e=>{this.logError(e,"process error")}),this.process.on("exit",e=>{(0,i.MD)(`MCP Server process exited with code ${e}`),this.connected=!1}),await new Promise(e=>setTimeout(e,500));const e=await this.sendRequest("initialize",{protocolVersion:"2024-11-05",capabilities:{}});(0,i.MD)(`MCP Server initialized: ${JSON.stringify(e)}`),this.connected=!0,this.logConnection("connected"),this.tools=await this.listTools(),(0,i.MD)(`Loaded ${this.tools.length} tools from ${this.config.name}`)}catch(e){throw this.logError(e,"connect"),this.process&&(this.process.kill(),this.process=null),e}}async disconnect(){this.logConnection("disconnecting"),this.process&&(this.process.kill(),this.process=null),this.connected=!1,this.tools=[],this.pendingRequests.clear(),this.logConnection("disconnected")}async listTools(){if(!this.connected)throw new Error("Not connected to MCP server");try{const e=((await this.sendRequest("tools/list",{})).tools||[]).map(e=>({name:e.name,description:e.description||"",inputSchema:e.inputSchema||{type:"object"},serverName:this.config.name}));return this.tools=e,e}catch(e){throw this.logError(e,"listTools"),e}}async callTool(e,t){if(!this.connected)throw new Error("Not connected to MCP server");try{(0,i.MD)(`Calling MCP tool: ${e} on ${this.config.name}`);const a=await this.sendRequest("tools/call",{name:e,arguments:t});return{success:!a.isError,content:a.content||a.result,metadata:a.metadata||{}}}catch(t){return this.logError(t,`callTool(${e})`),{success:!1,error:t.message}}}sendRequest(e,t){return new Promise((a,s)=>{if(!this.process||!this.process.stdin)return void s(new Error("Process not available"));const n=++this.messageId,r={jsonrpc:"2.0",id:n,method:e,params:t};this.pendingRequests.set(n,{resolve:a,reject:s});const o=setTimeout(()=>{this.pendingRequests.delete(n),s(new Error(`Request timeout for method: ${e}`))},this.config.timeout||3e4),p=s;s=e=>{clearTimeout(o),p(e)};const d=a;a=e=>{clearTimeout(o),d(e)};const l=JSON.stringify(r)+"\n";this.process.stdin.write(l),(0,i.MD)(`Sent MCP request: ${e}`)})}handleOutput(e){this.outputBuffer+=e;const t=this.outputBuffer.split("\n");this.outputBuffer=t.pop()||"";for(const e of t)if(e.trim())try{const t=JSON.parse(e);this.handleMessage(t)}catch(t){(0,i.JE)(`Failed to parse MCP message: ${e}`)}}handleMessage(e){if(void 0!==e.id){const t=this.pendingRequests.get(e.id);t&&(this.pendingRequests.delete(e.id),e.error?t.reject(new Error(e.error.message||"Unknown error")):t.resolve(e.result))}else e.method&&(0,i.MD)(`MCP notification: ${e.method}`)}}},4086:(e,t,a)=>{function s(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function n(){return"S"+s()}function i(){return"T"+s()}a.d(t,{eJ:()=>i,f6:()=>n,lk:()=>s})},4237:(e,t,a)=>{a.d(t,{Ay:()=>P});const s=(e=0)=>t=>`[${t+e}m`,n=(e=0)=>t=>`[${38+e};5;${t}m`,r=(e=0)=>(t,a,s)=>`[${38+e};2;${t};${a};${s}m`,o={modifier:{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]},color:{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],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{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],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(o.modifier),Object.keys(o.color),Object.keys(o.bgColor);const p=function(){const e=new Map;for(const[t,a]of Object.entries(o)){for(const[t,s]of Object.entries(a))o[t]={open:`[${s[0]}m`,close:`[${s[1]}m`},a[t]=o[t],e.set(s[0],s[1]);Object.defineProperty(o,t,{value:a,enumerable:!1})}return Object.defineProperty(o,"codes",{value:e,enumerable:!1}),o.color.close="[39m",o.bgColor.close="[49m",o.color.ansi=s(),o.color.ansi256=n(),o.color.ansi16m=r(),o.bgColor.ansi=s(10),o.bgColor.ansi256=n(10),o.bgColor.ansi16m=r(10),Object.defineProperties(o,{rgbToAnsi256:{value:(e,t,a)=>e===t&&t===a?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(a/255*5),enumerable:!1},hexToRgb:{value(e){const t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[a]=t;3===a.length&&(a=[...a].map(e=>e+e).join(""));const s=Number.parseInt(a,16);return[s>>16&255,s>>8&255,255&s]},enumerable:!1},hexToAnsi256:{value:e=>o.rgbToAnsi256(...o.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return e-8+90;let t,a,s;if(e>=232)t=(10*(e-232)+8)/255,a=t,s=t;else{const n=(e-=16)%36;t=Math.floor(e/36)/5,a=Math.floor(n/6)/5,s=n%6/5}const n=2*Math.max(t,a,s);if(0===n)return 30;let i=30+(Math.round(s)<<2|Math.round(a)<<1|Math.round(t));return 2===n&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(e,t,a)=>o.ansi256ToAnsi(o.rgbToAnsi256(e,t,a)),enumerable:!1},hexToAnsi:{value:e=>o.ansi256ToAnsi(o.hexToAnsi256(e)),enumerable:!1}}),o}(),d=i("node:process"),l=i("node:os"),c=i("node:tty");function m(e,t=(globalThis.Deno?globalThis.Deno.args:d.argv)){const a=e.startsWith("-")?"":1===e.length?"-":"--",s=t.indexOf(a+e),n=t.indexOf("--");return-1!==s&&(-1===n||s<n)}const{env:u}=d;let h;function f(e,t={}){return 0!==(a=function(e,{streamIsTTY:t,sniffFlags:a=!0}={}){const s=function(){if("FORCE_COLOR"in u)return"true"===u.FORCE_COLOR?1:"false"===u.FORCE_COLOR?0:0===u.FORCE_COLOR.length?1:Math.min(Number.parseInt(u.FORCE_COLOR,10),3)}();void 0!==s&&(h=s);const n=a?h:s;if(0===n)return 0;if(a){if(m("color=16m")||m("color=full")||m("color=truecolor"))return 3;if(m("color=256"))return 2}if("TF_BUILD"in u&&"AGENT_NAME"in u)return 1;if(e&&!t&&void 0===n)return 0;const i=n||0;if("dumb"===u.TERM)return i;if("win32"===d.platform){const e=l.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in u)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(e=>e in u)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(e=>e in u)||"codeship"===u.CI_NAME?1:i;if("TEAMCITY_VERSION"in u)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(u.TEAMCITY_VERSION)?1:0;if("truecolor"===u.COLORTERM)return 3;if("xterm-kitty"===u.TERM)return 3;if("xterm-ghostty"===u.TERM)return 3;if("wezterm"===u.TERM)return 3;if("TERM_PROGRAM"in u){const e=Number.parseInt((u.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(u.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(u.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(u.TERM)||"COLORTERM"in u?1:i}(e,{streamIsTTY:e&&e.isTTY,...t}))&&{level:a,hasBasic:!0,has256:a>=2,has16m:a>=3};var a}m("no-color")||m("no-colors")||m("color=false")||m("color=never")?h=0:(m("color")||m("colors")||m("color=true")||m("color=always"))&&(h=1);const g={stdout:f({isTTY:c.isatty(1)}),stderr:f({isTTY:c.isatty(2)})};function y(e,t,a){let s=e.indexOf(t);if(-1===s)return e;const n=t.length;let i=0,r="";do{r+=e.slice(i,s)+t+a,i=s+n,s=e.indexOf(t,i)}while(-1!==s);return r+=e.slice(i),r}const{stdout:v,stderr:w}=g,b=Symbol("GENERATOR"),_=Symbol("STYLER"),S=Symbol("IS_EMPTY"),T=["ansi","ansi","ansi256","ansi16m"],k=Object.create(null);function x(e){return(e=>{const t=(...e)=>e.join(" ");return((e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const a=v?v.level:0;e.level=void 0===t.level?a:t.level})(t,e),Object.setPrototypeOf(t,x.prototype),t})(e)}Object.setPrototypeOf(x.prototype,Function.prototype);for(const[e,t]of Object.entries(p))k[e]={get(){const a=D(this,$(t.open,t.close,this[_]),this[S]);return Object.defineProperty(this,e,{value:a}),a}};k.visible={get(){const e=D(this,this[_],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const C=(e,t,a,...s)=>"rgb"===e?"ansi16m"===t?p[a].ansi16m(...s):"ansi256"===t?p[a].ansi256(p.rgbToAnsi256(...s)):p[a].ansi(p.rgbToAnsi(...s)):"hex"===e?C("rgb",t,a,...p.hexToRgb(...s)):p[a][e](...s),A=["rgb","hex","ansi256"];for(const e of A)k[e]={get(){const{level:t}=this;return function(...a){const s=$(C(e,T[t],"color",...a),p.color.close,this[_]);return D(this,s,this[S])}}},k["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...a){const s=$(C(e,T[t],"bgColor",...a),p.bgColor.close,this[_]);return D(this,s,this[S])}}};const E=Object.defineProperties(()=>{},{...k,level:{enumerable:!0,get(){return this[b].level},set(e){this[b].level=e}}}),$=(e,t,a)=>{let s,n;return void 0===a?(s=e,n=t):(s=a.openAll+e,n=t+a.closeAll),{open:e,close:t,openAll:s,closeAll:n,parent:a}},D=(e,t,a)=>{const s=(...e)=>N(s,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(s,E),s[b]=e,s[_]=t,s[S]=a,s},N=(e,t)=>{if(e.level<=0||!t)return e[S]?"":t;let a=e[_];if(void 0===a)return t;const{openAll:s,closeAll:n}=a;if(t.includes(""))for(;void 0!==a;)t=y(t,a.close,a.open),a=a.parent;const i=t.indexOf("\n");return-1!==i&&(t=function(e,t,a,s){let n=0,i="";do{const r="\r"===e[s-1];i+=e.slice(n,r?s-1:s)+t+(r?"\r\n":"\n")+a,n=s+1,s=e.indexOf("\n",n)}while(-1!==s);return i+=e.slice(n),i}(t,n,s,i)),s+t+n};Object.defineProperties(x.prototype,k);const R=x(),P=(x({level:w?w.level:0}),R)},4239:(e,t,a)=>{a.a(e,async(e,s)=>{try{a.d(t,{JA:()=>l,getToolDefinitions:()=>d});var n=a(5401),i=a(8743),r=e([n,i]);[n,i]=r.then?(await r)():r;const o=[n.toolInstances.think.getDefinition(),n.toolInstances.plan.getDefinition(),n.toolInstances.todo.getDefinition(),n.toolInstances.askUser.getDefinition(),n.toolInstances.quickProjectScan.getDefinition(),n.toolInstances.enhanceProjectStructure.getDefinition(),n.toolInstances.read.getDefinition(),n.toolInstances.write.getDefinition(),n.toolInstances.merge.getDefinition(),n.toolInstances.mkdir.getDefinition(),n.toolInstances.glob.getDefinition(),n.toolInstances.grep.getDefinition(),n.toolInstances.deleteFile.getDefinition(),n.toolInstances.moveFile.getDefinition(),n.toolInstances.copyFile.getDefinition(),n.toolInstances.search_replace.getDefinition(),n.toolInstances.shell.getDefinition()];function p(e){return{name:e.name,description:e.description,input_schema:e.input_schema}}function d(){const e=(0,i.KG)();if(0===Object.keys(e).length)return o.map(p);const t=[],a=["think","plan","todo","askUser"];for(const s of a)if(e[s]){const a=e[s].getDefinition();a&&t.push(a)}for(const[s,n]of Object.entries(e))if(!a.includes(s)&&n){const e=n.getDefinition();e&&t.push(e)}return t.filter(e=>null!=e).map(p)}function l(){return o}s()}catch(c){s(c)}})},4249:(e,t,a)=>{a.d(t,{TI:()=>p,br:()=>d,VM:()=>h,Lo:()=>f});var s=a(3632),n=a(1967),i=a(7749);class r extends n.oS{getDefinition(){return{name:"glob",description:'Search for files matching a glob pattern.\n\nExamples:\n- glob("*.js") - all .js files in current directory\n- glob("**/*.ts") - all .ts files recursively\n- glob("src/**/*.{js,ts}") - all .js and .ts files under src/\n\nReturns an array of matching file paths.',input_schema:{type:"object",properties:{pattern:{type:"string",description:'The glob pattern to match (e.g., "*.js", "**/*.ts")'},cwd:{type:"string",description:"Optional: the directory to search in (defaults to current directory)"}},required:["pattern"]}}}execute(e){try{const t=e.cwd||process.cwd(),a=(0,i.O3)(t);let n=(0,s.AZ)(e.pattern,{nodir:!0,cwd:e.cwd,ignore:a});if(0===n.length&&!e.pattern.startsWith("*")&&!e.pattern.startsWith("**")){const t=`**/${e.pattern}`;n=(0,s.AZ)(t,{nodir:!0,cwd:e.cwd,ignore:a})}return n.length>0?n:`No files matching pattern: ${e.pattern}`}catch(e){return this.formatError("Glob pattern",e)}}}const o=new r;function p(e){return o.execute({pattern:e})}const d=o;var l=a(4421),c=a(2521);class m extends n.oS{getDefinition(){return{name:"grep",description:'Search for text patterns in files using regular expressions.\n\nExamples:\n- grep("function.*foo", "src/main.js") - find function definitions containing "foo" in a single file\n- grep("TODO", "**/*.js") - find all TODOs in all JavaScript files\n- grep("import", "src/**/*.{js,ts}") - find all import statements in JavaScript and TypeScript files\n\nReturns an array of matching lines with filenames and line numbers.',input_schema:{type:"object",properties:{pattern:{type:"string",description:"The regex pattern to search for"},path:{type:"string",description:'File path or glob pattern to search in (e.g., "src/main.js" or "**/*.js")'}},required:["pattern","path"]}}}execute(e){try{let t=[];try{const a=e.path.includes("/")||e.path.includes("\\")?(0,c.dirname)(e.path):process.cwd(),n={nodir:!0,windowsPathsNoEscape:!0,absolute:!1,ignore:(0,i.O3)(a)};if(e.path.includes("*")||e.path.includes("?")||e.path.includes("{")){if(console.log(`Processing glob pattern: ${e.path}`),t=(0,s.AZ)(e.path,n),0===t.length)return`No files found matching pattern: ${e.path}`;console.log(`Found ${t.length} files matching pattern`)}else try{(0,l.readFileSync)(e.path,"utf-8"),t=[e.path]}catch(t){return t instanceof Error?`Error: ${t.message}`:`Error: Could not read file: ${e.path}`}}catch(t){return console.error("Glob error:",t),t instanceof Error?`Error: Grep failed - ${t.message}`:`Error: Grep failed - Unknown error processing glob pattern: ${e.path}`}if(0===t.length)return`No files found matching pattern: ${e.path}`;const a=new RegExp(e.pattern),n=[];let r=0;return t.forEach(e=>{try{const t=(0,l.readFileSync)(e,"utf-8").split("\n"),s=[];t.forEach((t,n)=>{a.test(t)&&(s.push(`${e}:${n+1}: ${t}`),r++)}),s.length>0&&n.push(...s)}catch(t){n.push(`Error reading file ${e}: ${t instanceof Error?t.message:"Unknown error"}`)}}),r>0?(t.length>1&&n.unshift(`Found ${r} matches in ${t.length} files`),n):`No matches found for pattern: ${e.pattern} in ${t.length} files`}catch(e){return this.formatError("Grep",e)}}}const u=new m;function h(e,t){return u.execute({pattern:e,path:t})}const f=u},4421:(e,t,a)=>{var s,n;e.exports=(s={appendFileSync:()=>p.appendFileSync,copyFileSync:()=>p.copyFileSync,createReadStream:()=>p.createReadStream,default:()=>p.default,existsSync:()=>p.existsSync,lstatSync:()=>p.lstatSync,mkdirSync:()=>p.mkdirSync,promises:()=>p.promises,readFileSync:()=>p.readFileSync,readdir:()=>p.readdir,readdirSync:()=>p.readdirSync,readlinkSync:()=>p.readlinkSync,realpathSync:()=>p.realpathSync,renameSync:()=>p.renameSync,rmdirSync:()=>p.rmdirSync,statSync:()=>p.statSync,unlinkSync:()=>p.unlinkSync,writeFileSync:()=>p.writeFileSync},n={},a.d(n,s),n)},4528:(e,t,a)=>{a.d(t,{m3:()=>$,se:()=>D,Ww:()=>T,O_:()=>k,h1:()=>O,zh:()=>M,Ck:()=>f,Wz:()=>g,mV:()=>C,AG:()=>A,LF:()=>p,Xg:()=>d,vW:()=>j,dy:()=>F,M9:()=>w,E2:()=>b});var s=a(4421),n=a(2521),i=a(1967);class r extends i.oS{lastReadPath="";getDefinition(){return{name:"read",description:"Read the content of a file at the specified path. Returns the complete file content as a string.",input_schema:{type:"object",properties:{path:{type:"string",description:"The file path to read (relative or absolute)"},silent:{type:"boolean",description:"If true, returns success message instead of full content (optional)"}},required:["path"]}}}execute(e){try{const t=(0,n.resolve)(e.path),a=(0,s.readFileSync)(t,"utf-8");return this.lastReadPath=e.path,e.silent?this.createToolResult(a,`文件 ${e.path} 读取成功(静默模式,内容未显示)`,!0):a}catch(t){const a=`Error: Cannot read file ${e.path} - ${t instanceof Error?t.message:String(t)}`;return this.createToolResult(a,a,!0)}}formatObservation(e){if("object"==typeof e&&e.__tool_result)return super.formatObservation(e);if("string"==typeof e&&this.lastReadPath){const t=e.split("\n").length;return`读取文件 ${this.lastReadPath},共 ${t} 行`}return super.formatObservation(e)}}const o=new r;function p(e,t={}){return o.execute({path:e,...t})}const d=o,l="win32"===process.platform?"\r\n":"\n";function c(e){if("string"!=typeof e)return e;let t=e.replace(/\\n/g,"\n").replace(/\\t/g,"\t").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\'/g,"'");return t=t.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),t}function m(e){return e.includes("\r\n")?"\r\n":e.includes("\n")?"\n":e.includes("\r")?"\r":l}class u extends i.oS{getDefinition(){return{name:"mkdir",description:"Create a directory and all necessary parent directories (like mkdir -p). Returns a confirmation message.",input_schema:{type:"object",properties:{path:{type:"string",description:"The directory path to create"}},required:["path"]}}}execute(e){try{const t=(0,n.resolve)(e.path);return(0,s.mkdirSync)(t,{recursive:!0}),`Directory created: ${e.path}`}catch(t){return this.formatError(`Cannot create directory ${e.path}`,t)}}}const h=new u;function f(e){return h.execute({path:e})}const g=h;class y extends i.oS{getDefinition(){return{name:"write",description:"Write content to a file, COMPLETELY OVERWRITING any existing content.\n\nIMPORTANT:\n- This tool will REPLACE the entire file content\n- Automatically creates parent directories if needed\n- Saves a .base version for potential 3-way merge later\n- Use this for NEW files or when you want to completely rewrite a file\n- For modifying existing files, prefer using 'merge' tool instead",input_schema:{type:"object",properties:{path:{type:"string",description:"The file path to write to"},content:{type:"string",description:"The COMPLETE file content to write. This parameter is REQUIRED and cannot be empty."}},required:["path","content"]}}}execute(e){try{const t=(0,n.resolve)(e.path),a=(0,n.dirname)(t),i=g.execute({path:a});if(i.startsWith("Error:"))return i;let r=c(e.content);"string"!=typeof r&&(r=String(r||""));let o=l;if((0,s.existsSync)(t)){const e=(0,s.readFileSync)(t,"utf-8");o=m(e);const a=`${t}.base`;(0,s.writeFileSync)(a,e,"utf-8")}return"\r\n"===o&&(r=r.replace(/\n/g,"\r\n")),(0,s.writeFileSync)(t,r,"utf-8"),"done"}catch(t){return this.formatError(`Cannot write ${e.path}`,t)}}}const v=new y;function w(e,t){return v.execute({path:e,content:t})}const b=v;class _ extends i.oS{getDefinition(){const e=this.getBaseDefinition(),t="IMPORTANT: User confirmation is automatically required - DO NOT call askUser tool before calling this tool.";let{description:a}=e;if(!a.includes("User confirmation is automatically required"))if(a.trim().startsWith("IMPORTANT:"))if(a.match(/^IMPORTANT:[^\n]*(\n[^\n]*)*?\n\n/)){const e=a.indexOf("\n");a=a.slice(0,e)+"\n- User confirmation is automatically required - DO NOT call askUser tool before calling this tool"+a.slice(e)}else{const e=a.indexOf("\n");a=-1!==e?a.slice(0,e)+"\n- User confirmation is automatically required - DO NOT call askUser tool before calling this tool"+a.slice(e):t+"\n\n"+a}else a=t+"\n\n"+a;return{...e,description:a,requiresConfirmation:!0}}getConfirmationMessage(e){return null}}const S=new class extends _{getBaseDefinition(){return{name:"deleteFile",description:'Delete a file, multiple files or directories at the specified path(s).\n\nIMPORTANT:\n- This action cannot be undone\n- The files or directories will be permanently removed\n- Directories must be empty to be deleted\n- Returns a success message or error if paths don\'t exist or cannot be deleted\n\nExamples:\n- deleteFile("temp.txt") - delete a single file named temp.txt\n- deleteFile("temp_dir") - delete a single empty directory named temp_dir\n- deleteFile({ path: "temp.txt" }) - delete a single file\n- deleteFile({ path: ["file1.txt", "dir1", "file2.txt"] }) - delete multiple files and directories',input_schema:{type:"object",properties:{path:{type:"string",description:"The file path to delete (relative or absolute), or an array of file paths",oneOf:[{type:"string",description:"The file path to delete (relative or absolute)"},{type:"array",items:{type:"string",description:"A file path to delete"},description:"Array of file paths to delete"}]}},required:["path"]}}}getConfirmationMessage(e){const t=Array.isArray(e.path)?e.path:[e.path];return 1===t.length?`删除: ${t[0]}`:`删除 ${t.length} 个文件/目录`}execute(e){try{const t=Array.isArray(e.path)?e.path:[e.path],a=[];for(const e of t)try{const t=(0,n.resolve)(e);if(!(0,s.existsSync)(t)){a.push(`Warning: Path not found - ${e}`);continue}(0,s.statSync)(t).isDirectory()?((0,s.rmdirSync)(t),a.push(`Directory deleted: ${e}`)):((0,s.unlinkSync)(t),a.push(`File deleted: ${e}`))}catch(t){a.push(`Error: Cannot delete ${e} - ${t instanceof Error?t.message:"Unknown error"}`)}if(1===t.length)return a[0];const i=a.filter(e=>e.startsWith("File deleted")).length,r=a.filter(e=>e.startsWith("Directory deleted")).length,o=a.filter(e=>e.startsWith("Error")).length,p=a.filter(e=>e.startsWith("Warning")).length,d=i+r;return`${a.join("\n")}\n\nSummary: ${d} items deleted (${i} files, ${r} directories), ${p} warnings, ${o} errors`}catch(e){return this.formatError("Cannot process delete operation",e)}}};function T(e){return"object"==typeof e&&null!==e&&"path"in e?S.execute(e):S.execute({path:e})}const k=S,x=new class extends _{getBaseDefinition(){return{name:"moveFile",description:'Move or rename a file or directory from source to destination.\n\nExamples:\n- moveFile({ source: "old.txt", destination: "new.txt" }) - rename a file\n- moveFile({ source: "file.txt", destination: "folder/file.txt" }) - move a file to a different directory\n- moveFile({ source: "old_folder", destination: "new_folder" }) - rename a directory\n- moveFile({ source: "folder/file.txt", destination: "new_location/file.txt" }) - move a file with rename',input_schema:{type:"object",properties:{source:{type:"string",description:"The source file or directory path to move"},destination:{type:"string",description:"The destination path (new name or location)"}},required:["source","destination"]}}}getConfirmationMessage(e){return`移动/重命名: ${e.source} → ${e.destination}`}execute(e){try{const{source:t,destination:a}=e,i=(0,n.resolve)(t),r=(0,n.resolve)(a);if(!(0,s.existsSync)(i))return`Error: Source path does not exist - ${t}`;if((0,s.existsSync)(r))return`Error: Destination already exists - ${a}`;const o=(0,n.dirname)(r);return(0,s.existsSync)(o)||(0,s.mkdirSync)(o,{recursive:!0}),(0,s.renameSync)(i,r),(0,s.existsSync)(r)?`${(0,s.statSync)(i).isDirectory()?"Directory":"File"} moved successfully from "${t}" to "${a}"`:`Error: Failed to move ${t} to ${a}`}catch(e){return this.formatError("Move operation",e)}}};function C(e){return e&&"object"==typeof e&&"source"in e&&"destination"in e?x.execute(e):"Error: Invalid input format. Expected { source: string, destination: string }"}const A=x,E=new class extends _{getBaseDefinition(){return{name:"copyFile",description:'Copy a file or directory from source to destination.\n\nExamples:\n- copyFile({ source: "file.txt", destination: "file_copy.txt" }) - copy a file\n- copyFile({ source: "file.txt", destination: "folder/file.txt" }) - copy a file to a different directory\n- copyFile({ source: "folder", destination: "folder_copy" }) - copy an entire directory (recursively)\n- copyFile({ source: "folder/subdir", destination: "new_location/subdir" }) - copy a subdirectory',input_schema:{type:"object",properties:{source:{type:"string",description:"The source file or directory path to copy"},destination:{type:"string",description:"The destination path (new location)"}},required:["source","destination"]}}}getConfirmationMessage(e){return`复制: ${e.source} → ${e.destination}`}execute(e){try{const{source:t,destination:a}=e,i=(0,n.resolve)(t),r=(0,n.resolve)(a);if(!(0,s.existsSync)(i))return`Error: Source path does not exist - ${t}`;if(i===r)return"Error: Source and destination paths are identical";const o=(0,s.statSync)(i),p=0,d=0;if(o.isDirectory())return this.copyDirectory(i,r,p,d),`Directory copied successfully from "${t}" to "${a}" (${p} files, ${d} directories)`;{const e=(0,n.dirname)(r);return(0,s.existsSync)(e)||(0,s.mkdirSync)(e,{recursive:!0}),(0,s.writeFileSync)(r,(0,s.readFileSync)(i)),(0,s.existsSync)(r)?`File copied successfully from "${t}" to "${a}"`:`Error: Failed to copy file from "${t}" to "${a}"`}}catch(e){return this.formatError("Copy operation",e)}}copyDirectory(e,t,a,i){(0,s.existsSync)(t)||((0,s.mkdirSync)(t,{recursive:!0}),i++),(0,s.readdirSync)(e).forEach(r=>{const o=(0,n.join)(e,r),p=(0,n.join)(t,r);(0,s.statSync)(o).isDirectory()?this.copyDirectory(o,p,a,i):((0,s.writeFileSync)(p,(0,s.readFileSync)(o)),a++)})}};function $(e){return e&&"object"==typeof e&&"source"in e&&"destination"in e?E.execute(e):"Error: Invalid input format. Expected { source: string, destination: string }"}const D=E;function N(e,t){const a=function(e,t){let a={};for(let e=0;e<t.length;e++){const s=t[e];a[s]?a[s].push(e):a[s]=[e]}let s=[{buffer1index:-1,buffer2index:-1,chain:null}];for(let t=0;t<e.length;t++){const n=a[e[t]]||[];let i=0,r=s[0];for(let e=0;e<n.length;e++){const a=n[e];let o;for(o=i;o<s.length&&!(s[o].buffer2index<a&&(o===s.length-1||s[o+1].buffer2index>a));o++);if(o<s.length){const e={buffer1index:t,buffer2index:a,chain:s[o]};if(i===s.length?s.push(r):s[i]=r,i=o+1,r=e,i===s.length)break}}s[i]=r}return s[s.length-1]}(e,t);let s=[],n=e.length,i=t.length;for(let r=a;null!==r;r=r.chain){const a=n-r.buffer1index-1,o=i-r.buffer2index-1;n=r.buffer1index,i=r.buffer2index,(a||o)&&s.push({buffer1:[n+1,a],buffer1Content:e.slice(n+1,n+1+a),buffer2:[i+1,o],buffer2Content:t.slice(i+1,i+1+o)})}return s.reverse(),s}class R extends i.oS{getDefinition(){return{name:"merge",description:"Perform THREE-WAY FILE MERGE for large-scale changes.\n\n🔄 WHAT IT DOES:\n- Compares base version, current version, and your new version\n- Automatically detects and marks conflicts with <<<<<<< ======= >>>>>>>\n- Preserves parts of the file you didn't intend to change\n- Safer than simple overwrite for structural modifications\n\n🎯 PERFECT FOR:\n- Large code refactoring and architectural changes\n- Complete feature implementations\n- Major configuration overhauls\n- Complex modifications requiring full file content\n\n⚡ USAGE:\n1. Read the current file content\n2. Prepare your complete new version\n3. Provide both base version and new content\n\n💡 TIPS:\n- This tool requires you to provide the COMPLETE new file content\n- For simple text replacements, consider using search_replace() tool\n- For completely new files, use write() tool instead",input_schema:{type:"object",properties:{path:{type:"string",description:"The file path to merge"},newContent:{type:"string",description:"The COMPLETE new version of the entire file content"}},required:["path","newContent"]}}}execute(e){try{return e.newContent&&0!==e.newContent.trim().length?this.performThreeWayMerge(e):this.formatError("Merge","newContent parameter is required")}catch(e){return this.formatError("Merge",e)}}performThreeWayMerge(e){try{const t=(0,n.resolve)(e.path),a=`${t}.base`;let i="";if(!(0,s.existsSync)(t))return this.writeNewFile(t,a,e.newContent);i=(0,s.readFileSync)(t,"utf-8");const r=m(i);let o=i;(0,s.existsSync)(a)&&(o=(0,s.readFileSync)(a,"utf-8"));const p=c(o),d=function(e,t,a){const s=e.split("\n"),n=function(e,t,a,s){s=Object.assign({excludeFalseConflicts:!0,stringSeparator:/\s+/},s),"string"==typeof e&&(e=e.split(s.stringSeparator)),"string"==typeof t&&(t=t.split(s.stringSeparator)),"string"==typeof a&&(a=a.split(s.stringSeparator));let n=[];const i=function(e,t,a){let s=[];function n(e,t){s.push({ab:t,oStart:e.buffer1[0],oLength:e.buffer1[1],abStart:e.buffer2[0],abLength:e.buffer2[1]})}N(t,e).forEach(e=>n(e,"a")),N(t,a).forEach(e=>n(e,"b")),s.sort((e,t)=>e.oStart-t.oStart);let i=[],r=0;function o(e){e>r&&(i.push({stable:!0,buffer:"o",bufferStart:r,bufferLength:e-r,bufferContent:t.slice(r,e)}),r=e)}for(;s.length;){let n=s.shift(),p=n.oStart,d=n.oStart+n.oLength,l=[n];for(o(p);s.length;){const e=s[0],t=e.oStart;if(t>d)break;d=Math.max(d,t+e.oLength),l.push(s.shift())}if(1===l.length){if(n.abLength>0){const t="a"===n.ab?e:a;i.push({stable:!0,buffer:n.ab,bufferStart:n.abStart,bufferLength:n.abLength,bufferContent:t.slice(n.abStart,n.abStart+n.abLength)})}}else{let s={a:[e.length,-1,t.length,-1],b:[a.length,-1,t.length,-1]};for(;l.length;){n=l.shift();const e=n.oStart,t=e+n.oLength,a=n.abStart,i=a+n.abLength;let r=s[n.ab];r[0]=Math.min(a,r[0]),r[1]=Math.max(i,r[1]),r[2]=Math.min(e,r[2]),r[3]=Math.max(t,r[3])}const r=s.a[0]+(p-s.a[2]),o=s.a[1]+(d-s.a[3]),c=s.b[0]+(p-s.b[2]),m=s.b[1]+(d-s.b[3]);let u={stable:!1,aStart:r,aLength:o-r,aContent:e.slice(r,o),oStart:p,oLength:d-p,oContent:t.slice(p,d),bStart:c,bLength:m-c,bContent:a.slice(c,m)};i.push(u)}r=d}return o(t.length),i}(e,t,a);let r=[];function o(){r.length&&n.push({ok:r}),r=[]}return i.forEach(e=>{e.stable?r.push(...e.bufferContent):s.excludeFalseConflicts&&function(e,t){if(e.length!==t.length)return!1;for(let a=0;a<e.length;a++)if(e[a]!==t[a])return!1;return!0}(e.aContent,e.bContent)?r.push(...e.aContent):(o(),n.push({conflict:{a:e.aContent,aIndex:e.aStart,o:e.oContent,oIndex:e.oStart,b:e.bContent,bIndex:e.bStart}}))}),o(),n}(t.split("\n"),s,a.split("\n"),{excludeFalseConflicts:!0}),i=[],r=[];for(const e of n)if(e.ok)i.push(...e.ok);else if(e.conflict){const t=i.length+1,a=e.conflict.a||[],s=e.conflict.o||[],n=e.conflict.b||[];r.push({lineNumber:t,base:s.join("\n"),current:a.join("\n"),incoming:n.join("\n")}),i.push("<<<<<<< CURRENT"),i.push(...a),i.push("======="),i.push(...n),i.push(">>>>>>> INCOMING")}return{merged:i.join("\n"),hasConflicts:r.length>0,conflicts:r}}(p,c(i),c(e.newContent));let l=d.merged;if("\r\n"===r&&(l=l.replace(/\n/g,"\r\n")),d.hasConflicts)return(0,s.writeFileSync)(t,l,"utf-8"),`Merge completed with CONFLICTS. File saved with conflict markers.\nConflicts:\n${d.conflicts.map(e=>`Line ${e.lineNumber}: BASE="${e.base}" | CURRENT="${e.current}" | INCOMING="${e.incoming}"`).join("\n")}\n\nPlease resolve conflicts manually or use write() to overwrite.`;if((0,s.writeFileSync)(t,l,"utf-8"),(0,s.existsSync)(a))try{(0,s.unlinkSync)(a)}catch(e){}return"Merge successful. No conflicts detected."}catch(e){return this.formatError("Merge",e)}}writeNewFile(e,t,a){try{const n="string"==typeof a?a:String(a||"");if((0,s.writeFileSync)(e,n,"utf-8"),(0,s.existsSync)(t))try{(0,s.unlinkSync)(t)}catch(e){}return`File created: ${e}`}catch(e){return this.formatError("Failed to create file",e)}}}const P=new R;function O(e,t){return P.execute({path:e,newContent:t})}const M=P;class L extends i.oS{getDefinition(){return{name:"search_replace",description:"Perform TARGETED SEARCH & REPLACE operations on files.\n\n🎯 PERFECT FOR:\n- Small configuration updates (port numbers, URLs, etc.)\n- Variable name changes across files\n- Simple code modifications\n- Text replacements without full file content\n\n🔧 USAGE:\n- Provide an array of search/replace operations\n- Each operation replaces exact text with new text\n- Much more token-efficient than providing full file content\n\n⚡ WORKFLOW:\n1. Identify the exact text you want to replace\n2. Define search/replace pairs\n3. Execute all operations atomically\n\n💡 TIPS:\n- Use precise search text to avoid unintended replacements\n- Test with small changes first\n- For complex modifications, consider using merge() tool instead",input_schema:{type:"object",properties:{path:{type:"string",description:"The file path to perform search/replace operations on"},operations:{type:"array",description:"Array of search/replace operations. Each operation replaces search text with replace text.",items:{type:"object",properties:{search:{type:"string",description:"Exact text to search for"},replace:{type:"string",description:"Text to replace the search text with"}},required:["search","replace"]}}},required:["path","operations"]}}}execute(e){try{if(!e.path||0===e.path.trim().length)return this.formatError("SearchReplace","Path parameter is required");if(!e.operations||!Array.isArray(e.operations)||0===e.operations.length)return this.formatError("SearchReplace","Operations array is required and must not be empty");const t=(0,n.resolve)(e.path);if(!(0,s.existsSync)(t))return this.formatError("SearchReplace",`File not found: ${t}`);const a=(0,s.readFileSync)(t,"utf-8"),i=m(a);let r=a,o=0;const p=[];for(const[t,a]of e.operations.entries()){const{search:e,replace:s}=a;if(e&&0!==e.trim().length)try{const a=30;r.includes(e)?(r=r.replace(e,s),o++,p.push(`✅ Operation ${t+1}: "${e.substring(0,a)}..." → "${s.substring(0,a)}..."`)):p.push(`❌ Operation ${t+1}: search text not found "${e.substring(0,a)}..."`)}catch(e){p.push(`❌ Operation ${t+1}: ${e instanceof Error?e.message:String(e)}`)}else p.push(`❌ Operation ${t+1}: empty search text`)}if(o>0){let e=r;"\r\n"===i?e=e.replace(/\r?\n/g,"\r\n"):"\r"===i&&(e=e.replace(/\r?\n/g,"\r")),(0,s.writeFileSync)(t,e,"utf-8")}return`Search/replace completed. ${o} of ${e.operations.length} operations applied successfully.`+(p.length>0?`\n\nOperation details:\n${p.join("\n")}`:"")}catch(e){return this.formatError("SearchReplace",e)}}formatError(e,t){return`[${e} Error] ${t instanceof Error?t.message:String(t)}`}}const I=new L;function j(e,t){return I.execute({path:e,operations:t})}const F=I},4581:(e,t,a)=>{a.a(e,async(e,s)=>{try{a.d(t,{IW:()=>f,cZ:()=>h});var n=a(4421),i=a(3632),r=a(1967),o=a(5401),p=a(7749),d=a(3289),l=e([o]),c=l.then?(await l)():l;o=c[0];class m extends r.oS{getDefinition(){return{name:"quickProjectScan",description:"Quickly scan the entire project structure, analyze directories, detect languages, and generate a comprehensive PROJECT_STRUCTURE.md document in .nium/docs/. Use this when the user asks to explore or analyze the project structure.",input_schema:{type:"object",properties:{},required:[]}}}async execute(e){try{const e=[],t=process.cwd(),a=`${t}/.nium/docs/PROJECT_STRUCTURE.md`;if((0,n.existsSync)(a)){const t=(0,n.statSync)(a),s=(Date.now()-t.mtimeMs)/6e4;s<10&&(e.push("⚠️ 警告: PROJECT_STRUCTURE.md 已存在且是最近生成的"),e.push(` 文档年龄: ${Math.floor(s)} 分钟前`),e.push(" 建议: 直接使用 read('.nium/docs/PROJECT_STRUCTURE.md') 读取现有文档"),e.push(" 避免重复扫描浪费资源\n"),e.push(""))}e.push("🔍 开始探索工程结构...\n"),e.push("📂 扫描项目文件...");const s=(0,p.vS)(t,!0);e.push(` - 应用 ${s.length} 条忽略规则`);const r=(0,i.AZ)("**/*",{nodir:!0,ignore:s,cwd:t});e.push(`找到 ${r.length} 个相关文件\n`),e.push("📋 检测项目类型和配置...");const l=(0,d.S6)(t);l.length>0&&e.push(` - 检测到项目类型: ${l.join(", ")}`);const c=(0,d.QD)(t),m={name:c.name,version:c.version,description:c.description,dependencies:c.dependencies||{},devDependencies:c.devDependencies||{}};e.push(` - 项目名称: ${m.name}`),e.push(` - 版本: ${m.version}`),e.push(` - 语言: ${c.language}`),c.buildTool&&e.push(` - 构建工具: ${c.buildTool}`),e.push(""),e.push("🗂️ 分析目录结构...");const u=this.analyzeDirectoryStructure(r);e.push(""),e.push("🌐 检测项目编程语言...");const h=this.detectProjectLanguages(r);e.push(`主要编程语言: ${h.primaryLanguage||c.language||"未知"}`),h.languages.length>0&&e.push(`检测到 ${h.languages.length} 种编程语言`),e.push(""),e.push("⚙️ 检测运行时版本...");const f=await this.detectVersions(c,t);if(Object.keys(f).length>0)for(const[t,a]of Object.entries(f))e.push(` - ${t}: ${a}`);else e.push(" - 未检测到版本信息");e.push(""),e.push("📐 检测代码规范...");const g=this.detectCodeStandards(t);g.length>0?e.push(` - 检测到代码规范: ${g.join(", ")}`):e.push(" - 未检测到代码规范配置"),e.push("");const y=".nium/docs/PROJECT_STRUCTURE.md",v=(0,n.existsSync)(y);v?e.push("📄 发现现有结构文档,准备更新...\n"):e.push("📝 未找到结构文档,准备创建新文档...\n"),e.push("✍️ 生成项目结构文档...");const w=this.generateProjectStructureDoc(m,u,r,h,c,f,g);v?(e.push("🔄 合并更新文档..."),o.tools.merge(y,w).includes("<<<<<<< CURRENT")?(e.push("⚠️ 文档合并产生冲突,请手动解决冲突标记"),e.push(""),e.push("冲突标记说明:"),e.push("<<<<<<< CURRENT - 当前版本内容"),e.push("======= - 分隔符"),e.push(">>>>>>> INCOMING - 新版本内容")):e.push("✅ 文档更新成功!")):(e.push("📁 创建文档目录..."),o.tools.mkdir(".nium/docs"),e.push("💾 保存新文档..."),o.tools.write(y,w),e.push("✅ 文档创建成功!")),e.push(""),e.push(`📊 项目结构文档已保存至: ${y}`),e.push("");const b=this.generateSummary(m,u,h,c);return e.push("═══════════════════════════════════════════"),e.push("项目结构概览"),e.push("═══════════════════════════════════════════"),e.push(b),e.push("═══════════════════════════════════════════"),e.push(""),e.join("\n")}catch(e){return this.formatError("Quick project scan",e)}}detectProjectLanguages(e){const t={".js":"JavaScript",".mjs":"JavaScript (ES Modules)",".cjs":"JavaScript (CommonJS)",".jsx":"React JavaScript",".ts":"TypeScript",".tsx":"React TypeScript",".java":"Java",".class":"Java",".jar":"Java","pom.xml":"Java (Maven)","build.gradle":"Java (Gradle)",".py":"Python","requirements.txt":"Python","setup.py":"Python","pyproject.toml":"Python",".c":"C",".cpp":"C++",".h":"C/C++",".hpp":"C++","CMakeLists.txt":"C/C++ (CMake)",".go":"Go","go.mod":"Go",".rs":"Rust","Cargo.toml":"Rust",".php":"PHP","composer.json":"PHP (Composer)",".rb":"Ruby",Gemfile:"Ruby",".cs":"C#",".vb":"Visual Basic","packages.config":".NET",".html":"HTML",".css":"CSS",".scss":"SCSS",".less":"Less",".json":"JSON",".xml":"XML",".yml":"YAML",".yaml":"YAML",".md":"Markdown"},a={};e.forEach(e=>{if(t[e])return void(a[t[e]]=(a[t[e]]||0)+1);const s=e.lastIndexOf(".");if(s>-1){const n=e.substring(s);t[n]&&(a[t[n]]=(a[t[n]]||0)+1)}});const s=Object.entries(a).map(([e,t])=>({language:e,count:t})).sort((e,t)=>t.count-e.count),[n]=s;return{primaryLanguage:n?.language||null,languages:s,totalSourceFiles:s.reduce((e,t)=>e+t.count,0)}}analyzeDirectoryStructure(e){const t={directories:new Set,sourceFiles:[],configFiles:[],docFiles:[],testFiles:[]},a=[".js",".mjs",".cjs",".jsx",".ts",".tsx",".java",".py",".c",".cpp",".cc",".cxx",".h",".hpp",".go",".rs",".php",".rb",".cs",".kt",".kts",".scala",".swift",".m",".mm"],s=[".json",".yaml",".yml",".toml",".ini",".xml",".properties"],n=["package.json","tsconfig.json","pom.xml","build.gradle","settings.gradle","gradle.properties","Cargo.toml","go.mod","requirements.txt","setup.py","pyproject.toml","composer.json","Gemfile",".env",".env.example"];return e.forEach(e=>{const i=e.split("/");if(i.length>1&&t.directories.add(i[0]),e.includes("test")||e.includes("spec")||e.startsWith("test/")||e.startsWith("tests/")||e.includes("__tests__")||e.endsWith(".test.js")||e.endsWith(".test.ts")||e.endsWith(".spec.js")||e.endsWith(".spec.ts")||e.endsWith("Test.java")||e.endsWith("Tests.java"))return void t.testFiles.push(e);const r=e.split("/").pop()||"",o=r.includes(".")?"."+r.split(".").pop():"";e.startsWith("src/")||e.startsWith("lib/")||e.startsWith("app/"),a.includes(o)&&t.sourceFiles.push(e),(s.includes(o)||n.includes(r))&&t.configFiles.push(e),".md"!==o&&".txt"!==o&&".rst"!==o&&"README"!==r&&"CHANGELOG"!==r&&"LICENSE"!==r&&"CONTRIBUTING"!==r||t.docFiles.push(e)}),{directories:Array.from(t.directories).sort(),sourceFiles:t.sourceFiles.sort(),configFiles:t.configFiles.sort(),docFiles:t.docFiles.sort(),testFiles:t.testFiles.sort()}}async detectVersions(e,t){const a={};try{if(e.language.includes("Java")){const e=`${t}/pom.xml`,s=`${t}/build.gradle`;if((0,n.existsSync)(e)){const t=o.tools.read(e);if("string"==typeof t){const e=t.match(/<java\.version>([^<]+)<\/java\.version>/)||t.match(/<maven\.compiler\.source>([^<]+)<\/maven\.compiler\.source>/);e&&(a.Java=e[1])}}else if((0,n.existsSync)(s)){const e=o.tools.read(s);if("string"==typeof e){const t=e.match(/sourceCompatibility\s*=\s*['"]?([^'"\\s]+)['"]?/)||e.match(/targetCompatibility\s*=\s*['"]?([^'"\\s]+)['"]?/);t&&(a.Java=t[1])}}}if(e.language.includes("JavaScript")||e.language.includes("TypeScript")){const e=`${t}/package.json`;if((0,n.existsSync)(e)){const t=o.tools.read(e);if("string"==typeof t)try{const e=JSON.parse(t);e.engines&&(e.engines.node&&(a["Node.js"]=e.engines.node),e.engines.npm&&(a.npm=e.engines.npm))}catch(e){}}}if(e.language.includes("Python")){const e=`${t}/.python-version`,s=`${t}/pyproject.toml`;if((0,n.existsSync)(e)){const t=o.tools.read(e);"string"==typeof t&&(a.Python=t.trim())}else if((0,n.existsSync)(s)){const e=o.tools.read(s);if("string"==typeof e){const t=e.match(/python\s*=\s*['"]([^'"]+)['"]/);t&&(a.Python=t[1])}}}if(e.language.includes("Go")){const e=`${t}/go.mod`;if((0,n.existsSync)(e)){const t=o.tools.read(e);if("string"==typeof t){const e=t.match(/^go\s+(\d+\.\d+)/m);e&&(a.Go=e[1])}}}if(e.language.includes("Rust")){const e=`${t}/Cargo.toml`;if((0,n.existsSync)(e)){const t=o.tools.read(e);if("string"==typeof t){const e=t.match(/rust-version\s*=\s*['"]([^'"]+)['"]/);e&&(a.Rust=e[1])}}}}catch(e){}return a}detectCodeStandards(e){const t=[],a=[{name:"ESLint",files:[".eslintrc.js",".eslintrc.json",".eslintrc.yml",".eslintrc.yaml",".eslintrc"]},{name:"Prettier",files:[".prettierrc",".prettierrc.json",".prettierrc.yml",".prettierrc.yaml",".prettierrc.js","prettier.config.js"]},{name:"EditorConfig",files:[".editorconfig"]},{name:"Checkstyle",files:["checkstyle.xml","google_checks.xml","sun_checks.xml"]},{name:"PMD",files:["pmd.xml",".pmd"]},{name:"Black",files:["pyproject.toml"],contentCheck:{filePath:"pyproject.toml",pattern:/\[tool\.black\]/}},{name:"Pylint",files:[".pylintrc","pylint.rc"]},{name:"Flake8",files:[".flake8","setup.cfg"]},{name:"Rustfmt",files:["rustfmt.toml",".rustfmt.toml"]},{name:"Clippy",files:["clippy.toml",".clippy.toml"]},{name:"GolangCI-Lint",files:[".golangci.yml",".golangci.yaml"]}];for(const s of a)if(s.files.some(t=>(0,n.existsSync)(`${e}/${t}`)))if(s.contentCheck){const a=`${e}/${s.contentCheck.filePath}`;if((0,n.existsSync)(a)){const e=o.tools.read(a);"string"==typeof e&&s.contentCheck.pattern.test(e)&&t.push(s.name)}}else t.push(s.name);return t}analyzeCoreModules(e){const t=[],a=new Map;e.sourceFiles.forEach(e=>{const t=e.split("/");if(t.length>=2){const s=t.slice(0,2).join("/");a.has(s)||a.set(s,[]),a.get(s).push(e)}});const s={core:"核心业务逻辑",domain:"领域模型和业务规则",business:"业务逻辑层",service:"服务层",services:"服务层",model:"数据模型",models:"数据模型",entity:"实体类",entities:"实体类",dao:"数据访问对象",repository:"数据仓库层",repositories:"数据仓库层",db:"数据库操作",database:"数据库操作",persistence:"持久化层",api:"API 接口",rest:"REST API",controller:"控制器",controllers:"控制器",handler:"请求处理器",handlers:"请求处理器",endpoint:"端点定义",endpoints:"端点定义",route:"路由定义",routes:"路由定义",view:"视图层",views:"视图层",component:"组件",components:"组件",ui:"用户界面",page:"页面",pages:"页面",layout:"布局",layouts:"布局",template:"模板",templates:"模板",util:"工具函数",utils:"工具函数",helper:"辅助函数",helpers:"辅助函数",lib:"库文件",libs:"库文件",common:"公共模块",shared:"共享模块",config:"配置管理",configuration:"配置管理",settings:"设置管理",constant:"常量定义",constants:"常量定义",enum:"枚举定义",enums:"枚举定义",middleware:"中间件",middlewares:"中间件",interceptor:"拦截器",interceptors:"拦截器",filter:"过滤器",filters:"过滤器",guard:"守卫",guards:"守卫",client:"客户端",clients:"客户端",adapter:"适配器",adapters:"适配器",provider:"提供商",providers:"提供商",integration:"外部集成",integrations:"外部集成",auth:"认证授权",authentication:"认证",authorization:"授权",security:"安全模块",cli:"命令行接口",cmd:"命令行工具",script:"脚本",scripts:"脚本",tool:"工具",tools:"工具集",test:"测试",tests:"测试",spec:"测试规范",mock:"模拟数据",mocks:"模拟数据",fixture:"测试夹具",fixtures:"测试夹具",type:"类型定义",types:"类型定义",interface:"接口定义",interfaces:"接口定义",schema:"数据结构定义",schemas:"数据结构定义",dto:"数据传输对象",vo:"值对象",event:"事件",events:"事件",exception:"异常处理",exceptions:"异常处理",error:"错误处理",errors:"错误处理",validator:"验证器",validators:"验证器",decorator:"装饰器",decorators:"装饰器"};return a.forEach((e,a)=>{if(e.length>=2){const n=a.split("/").pop()||a,i=n.toLowerCase(),r=s[i]||`${n} 模块`;t.push({name:n.charAt(0).toUpperCase()+n.slice(1),description:r,files:e})}}),t.slice(0,10)}generateProjectStructureDoc(e,t,a,s,n,i,r){const o=(new Date).toISOString(),p=this.analyzeCoreModules(t),d=Object.keys(i).length>0?Object.entries(i).map(([e,t])=>`**${e}**: ${t}`).join("\n"):"暂无版本信息",l=r.length>0?r.map(e=>`- ${e}`).join("\n"):"暂无代码规范配置";return`# ${e.name} - 项目结构文档\n\n> 最后更新: ${o}\n> 版本: ${e.version}\n\n## 项目概述\n\n**项目名称**: ${e.name}\n**版本**: ${e.version}\n**描述**: ${e.description||"暂无描述"}\n**主要编程语言**: ${n.language}\n${n.buildTool?`**构建工具**: ${n.buildTool}`:""}\n\n### 运行时版本\n${d}\n\n### 代码规范\n${l}\n\n---\n\n## 目录结构\n\n\`\`\`\n${this.generateDirectoryTree(a)}\n\`\`\`\n\n---\n\n## 编程语言分析\n\n### 语言分布\n${s.languages.length>0?s.languages.map(e=>`- **${e.language}**: ${e.count} 个文件`).join("\n"):"暂无检测到的编程语言"}\n\n---\n\n## 主要目录说明\n\n${this.generateDirectoryDescriptions(t.directories)}\n\n---\n\n## 核心模块分析\n\n${p.length>0?p.map(e=>`### ${e.name}\n\n${e.description}\n\n**包含文件**: ${e.files.length} 个`).join("\n\n"):"暂无核心模块分析"}\n\n---\n\n## 源代码文件 (${t.sourceFiles.length} 个)\n\n${t.sourceFiles.length>0?t.sourceFiles.slice(0,50).map(e=>`- \`${e}\``).join("\n")+(t.sourceFiles.length>50?`\n\n*...还有 ${t.sourceFiles.length-50} 个文件*`:""):"暂无源代码文件"}\n\n---\n\n## 配置文件 (${t.configFiles.length} 个)\n\n${t.configFiles.length>0?t.configFiles.map(e=>`- \`${e}\``).join("\n"):"暂无配置文件"}\n\n---\n\n## 文档文件 (${t.docFiles.length} 个)\n\n${t.docFiles.length>0?t.docFiles.slice(0,20).map(e=>`- \`${e}\``).join("\n")+(t.docFiles.length>20?`\n\n*...还有 ${t.docFiles.length-20} 个文档*`:""):"暂无文档文件"}\n\n---\n\n## 测试文件 (${t.testFiles.length} 个)\n\n${t.testFiles.length>0?t.testFiles.slice(0,20).map(e=>`- \`${e}\``).join("\n")+(t.testFiles.length>20?`\n\n*...还有 ${t.testFiles.length-20} 个测试文件*`:""):"暂无测试文件"}\n\n---\n\n## 依赖关系\n\n### 生产依赖\n${e.dependencies?Object.entries(e.dependencies).map(([e,t])=>`- **${e}**: ${t}`).join("\n"):"暂无生产依赖"}\n\n### 开发依赖\n${e.devDependencies?Object.entries(e.devDependencies).map(([e,t])=>`- **${e}**: ${t}`).join("\n"):"暂无开发依赖"}\n\n---\n\n## 快速导航\n\n### 入口文件\n${this.findEntryPoints(e,a,n).map(e=>`- \`${e}\``).join("\n")}\n\n### 核心模块\n${this.findCoreModules(t.sourceFiles).map(e=>`- \`${e}\``).join("\n")}\n\n---\n\n**文档生成时间**: ${o}\n**文档生成工具**: quickProjectScan 工具\n`}generateDirectoryTree(e){const t={};return e.forEach(e=>{const a=e.split("/");let s=t;a.forEach((e,t)=>{s[e]||(s[e]=t===a.length-1?null:{}),null!==s[e]&&(s=s[e])})}),function e(t,a="",s=!0){const n=Object.entries(t);let i="";return n.forEach(([t,s],r)=>{const o=r===n.length-1;i+=a+(o?"└── ":"├── ")+t+"\n",null!==s&&"object"==typeof s&&(i+=e(s,a+(o?" ":"│ "),o))}),i}(t).trim()}generateDirectoryDescriptions(e){const t={src:"源代码目录,包含所有主要的应用程序代码",test:"测试文件目录,包含单元测试和集成测试",docs:"文档目录,包含项目文档和说明",examples:"示例代码目录,包含使用示例",bin:"可执行文件目录,包含 CLI 命令脚本",lib:"库文件目录",dist:"构建输出目录",build:"构建脚本和配置目录",config:"配置文件目录",".nium":"工作区配置目录,包含会话数据和子代理配置",tasks:"任务文件目录"};return e.map(e=>`### \`${e}/\`\n${t[e]||"项目目录"}`).join("\n\n")}findEntryPoints(e,t,a){const s=[];a.entryPoints&&a.entryPoints.length>0&&s.push(...a.entryPoints),e.main&&s.push(e.main),e.bin&&("string"==typeof e.bin?s.push(e.bin):s.push(...Object.values(e.bin)));const n=a.language.toLowerCase();let i=[];return n.includes("javascript")||n.includes("typescript")?i=["index.js","index.ts","index.mjs","app.js","main.js","server.js","src/index.js","src/main.js"]:n.includes("java")?i=["src/main/java/**/Main.java","src/main/java/**/Application.java"]:n.includes("python")?i=["main.py","__main__.py","app.py","run.py","manage.py"]:n.includes("go")?i=["main.go","cmd/main.go"]:n.includes("rust")?i=["src/main.rs","src/lib.rs"]:n.includes("ruby")?i=["main.rb","app.rb","config.ru"]:n.includes("php")?i=["index.php","app.php","public/index.php"]:(n.includes("c#")||n.includes(".net"))&&(i=["Program.cs","Startup.cs"]),i.forEach(e=>{t.includes(e)&&s.push(e)}),[...new Set(s)]}findCoreModules(e){const t=new Set;return e.forEach(e=>{const a=e.match(/^src\/([^\/]+)\//);a&&t.add(`src/${a[1]}/`)}),Array.from(t).sort()}generateSummary(e,t,a,s){return`\n📦 项目: ${e.name} (v${e.version})\n🌐 主要语言: ${s.language}\n${s.buildTool?`🔧 构建工具: ${s.buildTool}`:""}\n📁 主要目录: ${t.directories.join(", ")}\n📝 源文件: ${t.sourceFiles.length} 个\n⚙️ 配置文件: ${t.configFiles.length} 个\n📚 文档文件: ${t.docFiles.length} 个\n🧪 测试文件: ${t.testFiles.length} 个\n`}formatAction(e){return"quickProjectScan()"}formatObservation(e){return String(e)}}const u=new m;async function h(){return u.execute({})}const f=u;s()}catch(g){s(g)}})},4593:(e,t,a)=>{const s=a(3782).Agent,n=a(3151),i=a(5578).debuglog("agentkeepalive"),{INIT_SOCKET:r,CURRENT_ID:o,CREATE_ID:p,SOCKET_CREATED_TIME:d,SOCKET_NAME:l,SOCKET_REQUEST_COUNT:c,SOCKET_REQUEST_FINISHED_COUNT:m}=a(8125);let u=1;const h=parseInt(process.version.split(".",1)[0].substring(1));function f(e){console.log("[agentkeepalive:deprecated] %s",e)}function g(e){return e.timeout||e._idleTimeout}function y(e){const t={};for(const a in e)t[a]=e[a].length;return t}h>=11&&h<=12?u=2:h>=13&&(u=3),e.exports=class extends s{constructor(e){(e=e||{}).keepAlive=!1!==e.keepAlive,void 0===e.freeSocketTimeout&&(e.freeSocketTimeout=4e3),e.keepAliveTimeout&&(f("options.keepAliveTimeout is deprecated, please use options.freeSocketTimeout instead"),e.freeSocketTimeout=e.keepAliveTimeout,delete e.keepAliveTimeout),e.freeSocketKeepAliveTimeout&&(f("options.freeSocketKeepAliveTimeout is deprecated, please use options.freeSocketTimeout instead"),e.freeSocketTimeout=e.freeSocketKeepAliveTimeout,delete e.freeSocketKeepAliveTimeout),void 0===e.timeout&&(e.timeout=Math.max(2*e.freeSocketTimeout,8e3)),e.timeout=n(e.timeout),e.freeSocketTimeout=n(e.freeSocketTimeout),e.socketActiveTTL=e.socketActiveTTL?n(e.socketActiveTTL):0,super(e),this[o]=0,this.createSocketCount=0,this.createSocketCountLastCheck=0,this.createSocketErrorCount=0,this.createSocketErrorCountLastCheck=0,this.closeSocketCount=0,this.closeSocketCountLastCheck=0,this.errorSocketCount=0,this.errorSocketCountLastCheck=0,this.requestCount=0,this.requestCountLastCheck=0,this.timeoutSocketCount=0,this.timeoutSocketCountLastCheck=0,this.on("free",e=>{const t=this.calcSocketTimeout(e);t>0&&e.timeout!==t&&e.setTimeout(t)})}get freeSocketKeepAliveTimeout(){return f("agent.freeSocketKeepAliveTimeout is deprecated, please use agent.options.freeSocketTimeout instead"),this.options.freeSocketTimeout}get timeout(){return f("agent.timeout is deprecated, please use agent.options.timeout instead"),this.options.timeout}get socketActiveTTL(){return f("agent.socketActiveTTL is deprecated, please use agent.options.socketActiveTTL instead"),this.options.socketActiveTTL}calcSocketTimeout(e){let t=this.options.freeSocketTimeout;const a=this.options.socketActiveTTL;if(a){const s=a-(Date.now()-e[d]);if(s<=0)return s;t&&s<t&&(t=s)}if(t)return e.freeSocketTimeout||e.freeSocketKeepAliveTimeout||t}keepSocketAlive(e){const t=super.keepSocketAlive(e);if(!t)return t;const a=this.calcSocketTimeout(e);return void 0===a||(a<=0?(i("%s(requests: %s, finished: %s) free but need to destroy by TTL, request count %s, diff is %s",e[l],e[c],e[m],a),!1):(e.timeout!==a&&e.setTimeout(a),!0))}reuseSocket(...e){super.reuseSocket(...e);const t=e[0];e[1].reusedSocket=!0;const a=this.options.timeout;g(t)!==a&&(t.setTimeout(a),i("%s reset timeout to %sms",t[l],a)),t[c]++,i("%s(requests: %s, finished: %s) reuse on addRequest, timeout %sms",t[l],t[c],t[m],g(t))}[p](){const e=this[o]++;return this[o]===Number.MAX_SAFE_INTEGER&&(this[o]=0),e}[r](e,t){t.timeout&&(g(e)||e.setTimeout(t.timeout)),this.options.keepAlive&&e.setNoDelay(!0),this.createSocketCount++,this.options.socketActiveTTL&&(e[d]=Date.now()),e[l]=`sock[${this[p]()}#${t._agentKey}]`.split("-----BEGIN",1)[0],e[c]=1,e[m]=0,function(e,t,a){function s(){if(!t._httpMessage&&1===t[c])return;t[m]++,e.requestCount++,i("%s(requests: %s, finished: %s) free",t[l],t[c],t[m]);const s=e.getName(a);t.writable&&e.requests[s]&&e.requests[s].length&&(t[c]++,i("%s(requests: %s, finished: %s) will be reuse on agent free event",t[l],t[c],t[m]))}function n(a){i("%s(requests: %s, finished: %s) close, isError: %s",t[l],t[c],t[m],a),e.closeSocketCount++}function r(){const s=t.listeners("timeout").length,n=g(t),r=t._httpMessage,o=r&&r.listeners("timeout").length||0;i("%s(requests: %s, finished: %s) timeout after %sms, listeners %s, defaultTimeoutListenerCount %s, hasHttpRequest %s, HttpRequest timeoutListenerCount %s",t[l],t[c],t[m],n,s,u,!!r,o),i.enabled&&i("timeout listeners: %s",t.listeners("timeout").map(e=>e.name).join(", ")),e.timeoutSocketCount++;const p=e.getName(a);if(e.freeSockets[p]&&-1!==e.freeSockets[p].indexOf(t))t.destroy(),e.removeSocket(t,a),i("%s is free, destroy quietly",t[l]);else if(0===o){const s=new Error("Socket timeout");s.code="ERR_SOCKET_TIMEOUT",s.timeout=n,t.destroy(s),e.removeSocket(t,a),i("%s destroy with timeout error",t[l])}}function o(a){const s=t.listeners("error").length;i("%s(requests: %s, finished: %s) error: %s, listenerCount: %s",t[l],t[c],t[m],a,s),e.errorSocketCount++,1===s&&(i("%s emit uncaught error event",t[l]),t.removeListener("error",o),t.emit("error",a))}i("%s create, timeout %sms",t[l],g(t)),t.on("free",s),t.on("close",n),t.on("timeout",r),t.on("error",o),t.on("agentRemove",function e(){i("%s(requests: %s, finished: %s) agentRemove",t[l],t[c],t[m]),t.removeListener("close",n),t.removeListener("error",o),t.removeListener("free",s),t.removeListener("timeout",r),t.removeListener("agentRemove",e)})}(this,e,t)}createConnection(e,t){let a=!1;const s=(s,n)=>{if(!a){if(a=!0,s)return this.createSocketErrorCount++,t(s);this[r](n,e),t(s,n)}},n=super.createConnection(e,s);return n&&s(null,n),n}get statusChanged(){const e=this.createSocketCount!==this.createSocketCountLastCheck||this.createSocketErrorCount!==this.createSocketErrorCountLastCheck||this.closeSocketCount!==this.closeSocketCountLastCheck||this.errorSocketCount!==this.errorSocketCountLastCheck||this.timeoutSocketCount!==this.timeoutSocketCountLastCheck||this.requestCount!==this.requestCountLastCheck;return e&&(this.createSocketCountLastCheck=this.createSocketCount,this.createSocketErrorCountLastCheck=this.createSocketErrorCount,this.closeSocketCountLastCheck=this.closeSocketCount,this.errorSocketCountLastCheck=this.errorSocketCount,this.timeoutSocketCountLastCheck=this.timeoutSocketCount,this.requestCountLastCheck=this.requestCount),e}getCurrentStatus(){return{createSocketCount:this.createSocketCount,createSocketErrorCount:this.createSocketErrorCount,closeSocketCount:this.closeSocketCount,errorSocketCount:this.errorSocketCount,timeoutSocketCount:this.timeoutSocketCount,requestCount:this.requestCount,freeSockets:y(this.freeSockets),sockets:y(this.sockets),requests:y(this.requests)}}}},4673:(e,t,a)=>{a.a(e,async(e,s)=>{try{a.d(t,{J:()=>x});var n=a(4237),i=a(3785),r=a.n(i),o=a(5531),p=a.n(o),d=a(6132),l=a(9440),c=a(748),m=a(9187),u=a(6893),h=a(1646),f=a(8743),g=a(4421),y=a(6887),v=a(2521),w=e([c,h,f]);[c,h,f]=w.then?(await w)():w;const b=(0,y.fileURLToPath)("file:///E:/workspace/nium-coder/src/cli/interactive-session.ts"),_=(0,v.dirname)(b);function S(e){const t=[(0,v.join)(e,"..","..","package.json"),(0,v.join)(e,"..","..","..","package.json"),(0,v.join)(e,"..","package.json"),(0,v.join)(e,"package.json")];for(const e of t)try{if((0,g.readFileSync)(e,"utf-8"))return e}catch{}return""}let T="0.1.0";try{const C=S(_);if(C){const A=JSON.parse((0,g.readFileSync)(C,"utf-8"));T=A.version}}catch(E){(0,m.JE)("无法读取 package.json,使用默认版本号")}let k=(0,c.Kq)();class x{rl=null;isActive=!1;commandHistory=[];historyIndex=-1;debug=!1;skipLineProcessing=!1;lastExecutedCommand=null;constructor(e={}){this.debug=e.debug||!1,(0,m.pM)(this.debug)}async start(){try{if(!n.Ay)throw new Error("chalk模块导入失败");(0,d.uw)(),(0,m.b)(),(0,m.fH)("交互式会话启动"),this.debug&&((0,m.MD)("Debug模式已启用"),console.log(n.Ay.magenta("⚠ Debug模式已启用 - 将显示详细日志信息"))),await this.initializeMCP();const{initializeDynamicCommands:e}=await Promise.resolve().then(a.bind(a,748));await e(),this.rl=r().createInterface({input:process.stdin,output:process.stdout,prompt:n.Ay.blue("nium> "),historySize:100}),r().emitKeypressEvents(process.stdin,this.rl),process.stdin.isTTY&&this.setupHistoryNavigation(),this.printWelcome(),(0,l.L6)()&&l.Ck.messages&&l.Ck.messages.length>0&&l.Ck.currentTask&&this.printSessionWarning(),this.isActive=!0,this.rl.prompt(),this.setupCommandHandler(),this.setupCloseHandler()}catch(e){console.error("启动会话时出错:",e.message),console.error("错误堆栈:",e.stack),process.exit(1)}}async initializeMCP(){try{const e=(0,u.hy)();if((0,m.fH)(`Loaded ${e.length} MCP server configuration(s)`),0===e.length)return(0,m.MD)("No MCP servers configured"),void await(0,f.T2)();const t=(0,h.st)();(0,m.fH)("Initializing MCP manager with configured servers..."),await t.initialize(e),(0,m.fH)("Loading all tools (local + MCP)..."),await(0,f.T2)();const a=t.getStatus();(0,m.MD)(`MCP Status: ${a.serversConnected} servers connected, ${a.toolsAvailable} tools available`),a.serversConnected>0?console.log(n.Ay.green(`✓ Connected to ${a.serversConnected} MCP server(s), ${a.toolsAvailable} tools available`)):console.log(n.Ay.yellow(`⚠ Configured ${e.length} MCP server(s) but none connected`))}catch(e){(0,m.vV)(`Failed to initialize MCP: ${e.message}`),(0,m.MD)(`MCP initialization error details: ${e.message}\n${e.stack||""}`),(0,m.fH)("Continuing with local tools only..."),await(0,f.T2)()}}setupHistoryNavigation(){process.stdin.on("keypress",(e,t)=>{this.isActive&&t&&("up"===t.name&&this.commandHistory.length>0&&!t.ctrl&&!t.meta?(-1===this.historyIndex?this.historyIndex=this.commandHistory.length-1:this.historyIndex>0&&this.historyIndex--,this.updatePromptWithHistory()):"down"!==t.name||t.ctrl||t.meta?"tab"===t.name&&this.handleTabCompletion():(this.historyIndex>=0&&(this.historyIndex++,this.historyIndex>=this.commandHistory.length&&(this.historyIndex=-1)),this.updatePromptWithHistory()))})}async handleTabCompletion(){if(!this.rl)return;const e=this.rl.line.trim();if(e.startsWith("/")){const t=e.slice(1),[a]=t.split(" "),s=a?p().go(a,k,{key:"name"}):k.map(e=>({obj:e,score:0}));if(1===s.length){const e=s[0].obj,t=`/${e.name}${e.requiresArg?" ":""}`;e.requiresArg?(this.skipLineProcessing=!0,this.rl.line=t,this.rl.cursor=t.length,this.rl._refreshLine(),setTimeout(()=>{this.skipLineProcessing=!1},100)):(this.skipLineProcessing=!0,this.rl.line="",this.rl.cursor=0,this.commandHistory.push(t),this.historyIndex=-1,process.nextTick(async()=>{try{this.log(`执行命令: /${e.name}`),await e.handler(this)}catch(t){this.error(`执行命令 /${e.name} 时出错: ${t.message}`)}finally{this.isActive&&this.rl&&this.rl.prompt()}}))}else s.length>1&&await this.showCommandSelectionMenu(s)}}async showCommandSelectionMenu(e){if(!this.rl)return;let t=0;const a=this.rl.getPrompt(),s=this.rl.line,i=!!process.stdin.isTTY&&process.stdin.isRaw,o=()=>{const i=e.length+3;for(let e=0;e<i;e++)r().moveCursor(process.stdout,0,-1),r().clearLine(process.stdout,0);r().clearLine(process.stdout,1),console.log(""),console.log(n.Ay.yellow("请选择命令 (使用上下箭头键,Enter确认,Esc取消):")),console.log(""),e.forEach((e,a)=>{const s=e.obj,i=a===t,r=i?n.Ay.green("> "):" ",o=i?n.Ay.green.bold(`/${s.name}`):n.Ay.white(`/${s.name}`),p=n.Ay.gray(`- ${s.description}`);console.log(`${r}${o} ${p}`)}),process.stdout.write(a),this.rl.line=s,this.rl.cursor=s.length,this.rl._refreshLine()};return new Promise(n=>{process.stdin.isTTY&&process.stdin.setRawMode(!0);const p=(d,l)=>{if("up"===l.name)return t=Math.max(0,t-1),o(),!1;if("down"===l.name)return t=Math.min(e.length-1,t+1),o(),!1;if("return"===l.name||"enter"===l.name){const s=e[t].obj,o=`/${s.name}${s.requiresArg?" ":""}`;process.stdin.removeListener("keypress",p),process.stdin.isTTY&&process.stdin.setRawMode(i);for(let t=0;t<e.length+4;t++)r().moveCursor(process.stdout,0,-1),r().clearLine(process.stdout,0);return r().clearLine(process.stdout,1),process.stdout.write(a),this.skipLineProcessing=!0,s.requiresArg?(this.skipLineProcessing=!0,this.rl.line=o,this.rl.cursor=o.length,this.rl._refreshLine(),setTimeout(()=>{this.skipLineProcessing=!1},100)):(this.rl.line="",this.rl.cursor=0,this.commandHistory.push(o),this.historyIndex=-1,process.nextTick(async()=>{try{this.log(`执行命令: /${s.name}`),await s.handler(this)}catch(e){this.error(`执行命令 /${s.name} 时出错: ${e.message}`)}finally{this.isActive&&this.rl&&this.rl.prompt()}})),n(),!1}if("escape"===l.name||l.ctrl&&"c"===l.name){for(let t=0;t<e.length+4;t++)r().moveCursor(process.stdout,0,-1),r().clearLine(process.stdout,0);return process.stdin.removeListener("keypress",p),process.stdin.isTTY&&process.stdin.setRawMode(i),r().clearLine(process.stdout,1),process.stdout.write(a),this.rl.line=s,this.rl.cursor=s.length,this.rl._refreshLine(),n(),!1}};process.stdin.on("keypress",p),o()})}updatePromptWithHistory(){this.rl&&(this.historyIndex>=0&&this.historyIndex<this.commandHistory.length?(this.rl.line=this.commandHistory[this.historyIndex],this.rl.cursor=this.rl.line.length,this.rl._refreshLine()):(this.rl.line="",this.rl.cursor=0,this.rl._refreshLine()))}setupCommandHandler(){this.rl&&this.rl.on("line",async e=>{const t=e.trim();if(this.skipLineProcessing)return this.skipLineProcessing=!1,void(this.isActive&&this.rl&&this.rl.prompt());if(t.startsWith("/")){const e=t.slice(1).split(" ")[0];if(k=(0,c.Kq)(),(!e||!k.some(t=>t.name===e))&&e)return void(this.isActive&&this.rl&&this.rl.prompt())}t&&(this.commandHistory.push(t),this.historyIndex=-1);try{await this.handleCommand(t),this.lastExecutedCommand=t}catch(e){this.error(`处理命令时出错: ${e.message}`)}finally{this.isActive&&this.rl&&this.rl.prompt()}})}setupCloseHandler(){this.rl&&this.rl.on("close",()=>{this.isActive&&(this.isActive=!1,this.success("再见!"),process.exit(0))})}async handleCommand(e){if(e)if(e.startsWith("/")){const t=e.slice(1).split(" "),a=t[0],s=t.slice(1).join(" ");try{await(0,c.RS)(this,a,s),"clear"===a&&this.rl&&(this.rl.line="",this.rl.cursor=0,this.rl._refreshLine())}catch(e){this.error(`执行任务时出错: ${e.message}`)}}else try{await(0,c.RS)(this,"chat",e)}catch(e){this.error(`执行任务时出错: ${e.message}`)}}printWelcome(){k=(0,c.Kq)(),this.clear(),this.log(n.Ay.green(`NiumAgents-CLI v${T}`)),this.log(n.Ay.gray("Options:")),this.log(n.Ay.gray(" --debug - 启用调试模式以显示详细日志")),this.log(n.Ay.gray("\nCommands:")),this.log(n.Ay.gray(" <request> - 开始新任务 (默认: /chat)"));const e=k.filter(e=>"chat"!==e.name);for(const t of e)"exit"===t.name||"quit"===t.name?"exit"===t.name&&this.log(n.Ay.gray(" /exit 或 /quit - 退出")):this.log(n.Ay.gray(` /${t.name} - ${t.description}`));this.log(n.Ay.gray("\n提示: 输入 / 后跟部分命令可进行模糊搜索")),this.log()}printSessionWarning(){this.warning("⚠ 检测到之前的会话!使用 /resume 继续或 /clear 开始新会话。"),this.log()}printHelp(){(0,c.o_)(this)}clear(){console.clear()}log(e=""){console.log(e)}success(e){console.log(n.Ay.green(e))}warning(e){console.log(n.Ay.yellow(e))}error(e){console.log(n.Ay.red(e))}info(e){console.log(n.Ay.blue(e))}exit(){(0,m.fH)("交互式会话结束"),this.isActive=!1,this.rl&&this.rl.close()}}s()}catch($){s($)}})},4876:e=>{e.exports=i("punycode")},4988:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});const a=new WeakMap,s=new WeakMap;function n(e){const t=a.get(e);return console.assert(null!=t,"'this' is expected an Event object, but got",e),t}function i(e){null==e.passiveListener?e.event.cancelable&&(e.canceled=!0,"function"==typeof e.event.preventDefault&&e.event.preventDefault()):"undefined"!=typeof console&&"function"==typeof console.error&&console.error("Unable to preventDefault inside passive event listener invocation.",e.passiveListener)}function r(e,t){a.set(this,{eventTarget:e,event:t,eventPhase:2,currentTarget:e,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:t.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});const s=Object.keys(t);for(let e=0;e<s.length;++e){const t=s[e];t in this||Object.defineProperty(this,t,o(t))}}function o(e){return{get(){return n(this).event[e]},set(t){n(this).event[e]=t},configurable:!0,enumerable:!0}}function p(e){return{value(){const t=n(this).event;return t[e].apply(t,arguments)},configurable:!0,enumerable:!0}}function d(e){if(null==e||e===Object.prototype)return r;let t=s.get(e);return null==t&&(t=function(e,t){const a=Object.keys(t);if(0===a.length)return e;function s(t,a){e.call(this,t,a)}s.prototype=Object.create(e.prototype,{constructor:{value:s,configurable:!0,writable:!0}});for(let n=0;n<a.length;++n){const i=a[n];if(!(i in e.prototype)){const e="function"==typeof Object.getOwnPropertyDescriptor(t,i).value;Object.defineProperty(s.prototype,i,e?p(i):o(i))}}return s}(d(Object.getPrototypeOf(e)),e),s.set(e,t)),t}function l(e){return n(e).immediateStopped}function c(e,t){n(e).passiveListener=t}r.prototype={get type(){return n(this).event.type},get target(){return n(this).eventTarget},get currentTarget(){return n(this).currentTarget},composedPath(){const e=n(this).currentTarget;return null==e?[]:[e]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return n(this).eventPhase},stopPropagation(){const e=n(this);e.stopped=!0,"function"==typeof e.event.stopPropagation&&e.event.stopPropagation()},stopImmediatePropagation(){const e=n(this);e.stopped=!0,e.immediateStopped=!0,"function"==typeof e.event.stopImmediatePropagation&&e.event.stopImmediatePropagation()},get bubbles(){return Boolean(n(this).event.bubbles)},get cancelable(){return Boolean(n(this).event.cancelable)},preventDefault(){i(n(this))},get defaultPrevented(){return n(this).canceled},get composed(){return Boolean(n(this).event.composed)},get timeStamp(){return n(this).timeStamp},get srcElement(){return n(this).eventTarget},get cancelBubble(){return n(this).stopped},set cancelBubble(e){if(!e)return;const t=n(this);t.stopped=!0,"boolean"==typeof t.event.cancelBubble&&(t.event.cancelBubble=!0)},get returnValue(){return!n(this).canceled},set returnValue(e){e||i(n(this))},initEvent(){}},Object.defineProperty(r.prototype,"constructor",{value:r,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.Event&&(Object.setPrototypeOf(r.prototype,window.Event.prototype),s.set(window.Event.prototype,r));const m=new WeakMap;function u(e){return null!==e&&"object"==typeof e}function h(e){const t=m.get(e);if(null==t)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return t}function f(e,t){Object.defineProperty(e,`on${t}`,function(e){return{get(){let t=h(this).get(e);for(;null!=t;){if(3===t.listenerType)return t.listener;t=t.next}return null},set(t){"function"==typeof t||u(t)||(t=null);const a=h(this);let s=null,n=a.get(e);for(;null!=n;)3===n.listenerType?null!==s?s.next=n.next:null!==n.next?a.set(e,n.next):a.delete(e):s=n,n=n.next;if(null!==t){const n={listener:t,listenerType:3,passive:!1,once:!1,next:null};null===s?a.set(e,n):s.next=n}},configurable:!0,enumerable:!0}}(t))}function g(e){function t(){y.call(this)}t.prototype=Object.create(y.prototype,{constructor:{value:t,configurable:!0,writable:!0}});for(let a=0;a<e.length;++a)f(t.prototype,e[a]);return t}function y(){if(!(this instanceof y)){if(1===arguments.length&&Array.isArray(arguments[0]))return g(arguments[0]);if(arguments.length>0){const e=new Array(arguments.length);for(let t=0;t<arguments.length;++t)e[t]=arguments[t];return g(e)}throw new TypeError("Cannot call a class as a function")}m.set(this,new Map)}y.prototype={addEventListener(e,t,a){if(null==t)return;if("function"!=typeof t&&!u(t))throw new TypeError("'listener' should be a function or an object.");const s=h(this),n=u(a),i=(n?Boolean(a.capture):Boolean(a))?1:2,r={listener:t,listenerType:i,passive:n&&Boolean(a.passive),once:n&&Boolean(a.once),next:null};let o=s.get(e);if(void 0===o)return void s.set(e,r);let p=null;for(;null!=o;){if(o.listener===t&&o.listenerType===i)return;p=o,o=o.next}p.next=r},removeEventListener(e,t,a){if(null==t)return;const s=h(this),n=(u(a)?Boolean(a.capture):Boolean(a))?1:2;let i=null,r=s.get(e);for(;null!=r;){if(r.listener===t&&r.listenerType===n)return void(null!==i?i.next=r.next:null!==r.next?s.set(e,r.next):s.delete(e));i=r,r=r.next}},dispatchEvent(e){if(null==e||"string"!=typeof e.type)throw new TypeError('"event.type" should be a string.');const t=h(this),a=e.type;let s=t.get(a);if(null==s)return!0;const i=function(e,t){return new(d(Object.getPrototypeOf(t)))(e,t)}(this,e);let r=null;for(;null!=s;){if(s.once?null!==r?r.next=s.next:null!==s.next?t.set(a,s.next):t.delete(a):r=s,c(i,s.passive?s.listener:null),"function"==typeof s.listener)try{s.listener.call(this,i)}catch(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e)}else 3!==s.listenerType&&"function"==typeof s.listener.handleEvent&&s.listener.handleEvent(i);if(l(i))break;s=s.next}return c(i,null),function(e){n(e).eventPhase=0}(i),function(e){n(e).currentTarget=null}(i),!i.defaultPrevented}},Object.defineProperty(y.prototype,"constructor",{value:y,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.EventTarget&&Object.setPrototypeOf(y.prototype,window.EventTarget.prototype),t.defineEventAttribute=f,t.EventTarget=y,t.default=y,e.exports=y,e.exports.EventTarget=e.exports.default=y,e.exports.defineEventAttribute=f},5283:(e,t,a)=>{a.a(e,async(e,s)=>{try{a.d(t,{Fj:()=>S,generateTaskPlan:()=>y,listTaskPlans:()=>_,loadTaskPlan:()=>b,updateTaskStatus:()=>w});var n=a(4237),i=a(4421),r=a(2521),o=a(6893),p=a(8736),d=a(4086),l=a(1327),c=e([p,l]);function m(e=[]){return{name:"create_task_plan",description:"生成详细的任务执行规划,包含多个步骤和推荐的子智能体",input_schema:{type:"object",properties:{overview:{type:"string",description:"任务概述,简要描述任务目标"},steps:{type:"array",description:"执行步骤列表,必须包含2-4个步骤",items:{type:"object",properties:{description:{type:"string",description:"步骤的详细描述,应该是大颗粒度的任务拆分"},subAgent:{type:"string",description:`推荐使用的子智能体名称。可用选项: ${e.length>0?e.map(e=>e.name).join(", "):"default"}。如果没有合适的子智能体,使用"default"`}},required:["description","subAgent"]},minItems:2,maxItems:4},expectedResult:{type:"string",description:"预期结果,描述完成后的预期效果"}},required:["overview","steps","expectedResult"]}}}async function u(e,t=[]){console.log(n.Ay.blue("[任务规划] 尝试方案1: Function Calling"));const a=(0,l.c3)(e,t),s=m(t),i=await(0,p.callModelAPI)({model:(0,o.MODEL)(),messages:[{role:"user",content:a}],temperature:.3,max_tokens:2e3,tools:[s],tool_choice:{type:"function",function:{name:"create_task_plan"}}}),r=i?.choices?.[0]?.message?.tool_calls;if(!r||0===r.length)throw new Error("模型没有返回 function call");const d=JSON.parse(r[0].function.arguments);if(!d.steps||d.steps.length<2)throw new Error(`步骤数量不足: ${d.steps?.length||0}`);return d}async function h(e,t=[]){console.log(n.Ay.yellow("[任务规划] 尝试方案2: Markdown + Function Call 转换"));const a=(0,l.xo)(e,t),s=await(0,p.callModelAPI)({model:(0,o.MODEL)(),messages:[{role:"user",content:a}],temperature:.3,max_tokens:2e3}),i=s?.choices?.[0]?.message?.content||"";if(!i)throw new Error("无法生成 Markdown 规划");const r=(0,l.qA)(i),d=m(t),c=await(0,p.callModelAPI)({model:(0,o.MODEL)(),messages:[{role:"user",content:r}],temperature:.1,max_tokens:1500,tools:[d],tool_choice:{type:"function",function:{name:"create_task_plan"}}}),u=c?.choices?.[0]?.message?.tool_calls;if(!u||0===u.length)throw new Error("无法转换 Markdown 为结构化数据");const h=JSON.parse(u[0].function.arguments);return h.markdown=i,h}function f(e){return console.log(n.Ay.yellow("[任务规划] 使用默认降级方案")),{overview:e,steps:[{description:"需求分析与技术方案设计",subAgent:"default"},{description:"核心功能实现",subAgent:"default"},{description:"测试验证与代码优化",subAgent:"default"}],expectedResult:"完成任务的所有步骤,达到预期的功能目标"}}function g(e){const t=e.steps.map((e,t)=>`- [ ] ${e.description}\n - 推荐子智能体: ${e.subAgent}`).join("\n\n");return`# 任务规划\n\n## 任务概述\n${e.overview}\n\n## 执行步骤\n${t}\n\n## 预期结果\n${e.expectedResult}`}async function y(e,t=[]){if(!e||"string"!=typeof e)throw new Error("无效的用户请求");console.log(n.Ay.blue("[任务规划] 正在生成任务规划..."));let a=null,s="unknown";try{a=await u(e,t),s="Function Calling",console.log(n.Ay.green("[任务规划] ✓ Function Calling 方案成功"))}catch(i){console.log(n.Ay.yellow(`[任务规划] Function Calling 失败: ${i.message}`));try{a=await h(e,t),s="Markdown + Conversion",console.log(n.Ay.green("[任务规划] ✓ Markdown 转换方案成功"))}catch(t){console.log(n.Ay.yellow(`[任务规划] Markdown 转换失败: ${t.message}`)),a=f(e),s="Default Fallback",console.log(n.Ay.yellow("[任务规划] ⚠ 使用默认降级方案"))}}const i=a.markdown||g(a),r=a.steps.map((e,t)=>({step:t+1,description:e.description,status:"pending",subAgent:e.subAgent||"default"})),o=(0,d.eJ)(),p={markdown:i,tasks:r,taskId:o,strategy:s};return await v(i,o,p),console.log(n.Ay.green(`[任务规划] ✓ 任务规划生成完成 (策略: ${s})`)),console.log(n.Ay.cyan(`[任务规划] 共包含 ${r.length} 个任务步骤`)),console.log(n.Ay.gray("─".repeat(50))),console.log(i),console.log(n.Ay.gray("─".repeat(50))),p}async function v(e,t,a){const s=r.default.join(process.cwd(),".tasks");i.default.existsSync(s)||i.default.mkdirSync(s,{recursive:!0});const o=`# 任务规划 (ID: ${t})\n\n## 任务概述\n${e.substring(e.indexOf("## 任务概述")+7)}\n\n## 更新时间\n${(new Date).toLocaleString()}`,p=r.default.join(s,`${t}.md`);if(i.default.writeFileSync(p,o,"utf8"),console.log(n.Ay.green(`[任务文件] 任务规划已保存到: ${p}`)),a){const e={taskId:a.taskId,createdAt:(new Date).toISOString(),updatedAt:(new Date).toISOString(),status:"pending",currentStep:0,totalSteps:a.tasks.length,strategy:a.strategy,markdown:a.markdown,tasks:a.tasks.map(e=>({step:e.step,description:e.description,status:e.status,subAgent:e.subAgent,startTime:null,endTime:null,duration:null,error:null}))},o=r.default.join(s,`${t}.json`);i.default.writeFileSync(o,JSON.stringify(e,null,2),"utf8"),console.log(n.Ay.green(`[任务文件] JSON 数据已保存到: ${o}`))}}async function w(e,t,a){const s=r.default.join(process.cwd(),".tasks"),o=r.default.join(s,`${e}.md`);if(!i.default.existsSync(o))return console.log(n.Ay.red(`[任务更新] 任务文件不存在: ${o}`)),!1;try{const s=i.default.readFileSync(o,"utf8").split("\n");let r=!1,p=1;const d=[];for(const e of s)if(e.trim().includes("## 执行步骤")||e.trim().includes("##执行步骤"))r=!0,d.push(e);else if(e.trim().includes("## 更新时间"))d.push("## 更新时间"),d.push((new Date).toLocaleString());else if(r&&e.trim().startsWith("##")&&!e.trim().includes("更新时间"))r=!1,d.push(e);else{if(r){const s=e.trim().match(/^-\s*\[(.)\]\s*(.+)/);if(s&&p===t){let e=" ";"in_progress"===a&&(e="-"),"completed"===a&&(e="x"),d.push(`- [${e}] ${s[2]}`),p++;continue}s&&p++}d.push(e)}return i.default.writeFileSync(o,d.join("\n"),"utf8"),console.log(n.Ay.green(`[任务更新] 任务 ${e} 步骤 ${t} 状态已更新为 ${a}`)),!0}catch(e){return console.log(n.Ay.red(`[任务更新] 更新任务状态失败: ${e.message}`)),!1}}function b(e){const t=r.default.join(process.cwd(),".tasks"),a=r.default.join(t,`${e}.json`);if(!i.default.existsSync(a))return console.log(n.Ay.red(`[任务加载] 任务文件不存在: ${a}`)),null;try{const t=i.default.readFileSync(a,"utf8"),s=JSON.parse(t);return console.log(n.Ay.green(`[任务加载] 成功加载任务: ${e}`)),s}catch(e){return console.log(n.Ay.red(`[任务加载] 解析任务文件失败: ${e.message}`)),null}}function _(){const e=r.default.join(process.cwd(),".tasks");return i.default.existsSync(e)?i.default.readdirSync(e).filter(e=>e.endsWith(".json")).map(e=>e.replace(".json","")):[]}function S(e){if(!e||!e.tasks||0===e.tasks.length)return"无有效任务步骤";let t=n.Ay.cyan("\n📋 任务规划摘要:\n");t+=n.Ay.gray("─".repeat(50))+"\n";for(const a of e.tasks){const e="default"!==a.subAgent?n.Ay.green(`[${a.subAgent}]`):n.Ay.gray("[默认智能体]");t+=`${a.step}. ${a.description} ${e}\n`}return t+=n.Ay.gray("─".repeat(50)),t}[p,l]=c.then?(await c)():c,s()}catch(T){s(T)}})},5401:(e,t,a)=>{a.a(e,async(e,s)=>{try{a.d(t,{extractToolResult:()=>n.Px,sG:()=>u,toolInstances:()=>c,tools:()=>m});var n=a(8857),i=a(4528),r=a(4249),o=a(6139),p=a(7188),d=a(648),l=e([o,p]);[o,p]=l.then?(await l)():l;const c={think:p.tI,plan:p.Gw,todo:p.rQ,askUser:p.DC,quickProjectScan:p.IW,enhanceProjectStructure:p.Pz,read:i.Xg,write:i.E2,mkdir:i.Wz,glob:r.br,grep:r.Lo,shell:o.Nt,merge:i.zh,deleteFile:i.O_,moveFile:i.AG,copyFile:i.se,search_replace:i.dy},m={think:p.bO,plan:p.et,todo:p.dU,askUser:p.tY,quickProjectScan:p.cZ,enhanceProjectStructure:p.X4,read:i.LF,write:i.M9,mkdir:i.Ck,merge:i.h1,glob:r.TI,grep:r.VM,shell:o.vf,deleteFile:i.Ww,moveFile:i.mV,copyFile:i.m3,search_replace:i.vW};function u(e,t=null,a=!0){return{__tool_result:!0,result:e,display:null!==t?t:e,shouldPrint:a}}d.PH,d.wq,d.il,d.IP,d.s1,d.H6,d.VH,d.lW,d.Is,s()}catch(h){s(h)}})},5484:(e,t,a)=>{const s=a(4876),n=a(6673),i={ftp:21,file:null,gopher:70,http:80,https:443,ws:80,wss:443},r=Symbol("failure");function o(e){return s.ucs2.decode(e).length}function p(e,t){const a=e[t];return isNaN(a)?void 0:String.fromCodePoint(a)}function d(e){return e>=48&&e<=57}function l(e){return e>=65&&e<=90||e>=97&&e<=122}function c(e){return d(e)||e>=65&&e<=70||e>=97&&e<=102}function m(e){return"."===e||"%2e"===e.toLowerCase()}function u(e){return 2===e.length&&l(e.codePointAt(0))&&(":"===e[1]||"|"===e[1])}function h(e){return void 0!==i[e]}function f(e){return h(e.scheme)}function g(e){let t=e.toString(16).toUpperCase();return 1===t.length&&(t="0"+t),"%"+t}function y(e){return e<=31||e>126}const v=new Set([32,34,35,60,62,63,96,123,125]);function w(e){return y(e)||v.has(e)}const b=new Set([47,58,59,61,64,91,92,93,94,124]);function _(e){return w(e)||b.has(e)}function S(e,t){const a=String.fromCodePoint(e);return t(e)?function(e){const t=new Buffer(e);let a="";for(let e=0;e<t.length;++e)a+=g(t[e]);return a}(a):a}function T(e){let t=10;return e.length>=2&&"0"===e.charAt(0)&&"x"===e.charAt(1).toLowerCase()?(e=e.substring(2),t=16):e.length>=2&&"0"===e.charAt(0)&&(e=e.substring(1),t=8),""===e?0:(10===t?/[^0-9]/:16===t?/[^0-9A-Fa-f]/:/[^0-7]/).test(e)?r:parseInt(e,t)}function k(e,t){if("["===e[0])return"]"!==e[e.length-1]?r:function(e){const t=[0,0,0,0,0,0,0,0];let a=0,n=null,i=0;if(58===(e=s.ucs2.decode(e))[i]){if(58!==e[i+1])return r;i+=2,++a,n=a}for(;i<e.length;){if(8===a)return r;if(58===e[i]){if(null!==n)return r;++i,++a,n=a;continue}let s=0,o=0;for(;o<4&&c(e[i]);)s=16*s+parseInt(p(e,i),16),++i,++o;if(46===e[i]){if(0===o)return r;if(i-=o,a>6)return r;let s=0;for(;void 0!==e[i];){let n=null;if(s>0){if(!(46===e[i]&&s<4))return r;++i}if(!d(e[i]))return r;for(;d(e[i]);){const t=parseInt(p(e,i));if(null===n)n=t;else{if(0===n)return r;n=10*n+t}if(n>255)return r;++i}t[a]=256*t[a]+n,++s,2!==s&&4!==s||++a}if(4!==s)return r;break}if(58===e[i]){if(++i,void 0===e[i])return r}else if(void 0!==e[i])return r;t[a]=s,++a}if(null!==n){let e=a-n;for(a=7;0!==a&&e>0;){const s=t[n+e-1];t[n+e-1]=t[a],t[a]=s,--a,--e}}else if(null===n&&8!==a)return r;return t}(e.substring(1,e.length-1));if(!t)return function(e){if(-1!==e.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/))return r;let t="";const a=s.ucs2.decode(e);for(let e=0;e<a.length;++e)t+=S(a[e],y);return t}(e);const a=function(e){const t=new Buffer(e),a=[];for(let e=0;e<t.length;++e)37!==t[e]?a.push(t[e]):37===t[e]&&c(t[e+1])&&c(t[e+2])?(a.push(parseInt(t.slice(e+1,e+3).toString(),16)),e+=2):a.push(t[e]);return new Buffer(a).toString()}(e),i=n.toASCII(a,!1,n.PROCESSING_OPTIONS.NONTRANSITIONAL,!1);if(null===i)return r;if(-1!==i.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/))return r;const o=function(e){const t=e.split(".");if(""===t[t.length-1]&&t.length>1&&t.pop(),t.length>4)return e;const a=[];for(const s of t){if(""===s)return e;const t=T(s);if(t===r)return e;a.push(t)}for(let e=0;e<a.length-1;++e)if(a[e]>255)return r;if(a[a.length-1]>=Math.pow(256,5-a.length))return r;let s=a.pop(),n=0;for(const e of a)s+=e*Math.pow(256,3-n),++n;return s}(i);return"number"==typeof o||o===r?o:i}function x(e){return"number"==typeof e?function(e){let t="",a=e;for(let e=1;e<=4;++e)t=String(a%256)+t,4!==e&&(t="."+t),a=Math.floor(a/256);return t}(e):e instanceof Array?"["+function(e){let t="";const a=function(e){let t=null,a=1,s=null,n=0;for(let i=0;i<e.length;++i)0!==e[i]?(n>a&&(t=s,a=n),s=null,n=0):(null===s&&(s=i),++n);return n>a&&(t=s,a=n),{idx:t,len:a}}(e).idx;let s=!1;for(let n=0;n<=7;++n)if(!s||0!==e[n]){if(s&&(s=!1),a===n){t+=0===n?"::":":",s=!0;continue}t+=e[n].toString(16),7!==n&&(t+=":")}return t}(e)+"]":e}function C(e){const t=e.path;var a;0!==t.length&&("file"===e.scheme&&1===t.length&&(a=t[0],/^[A-Za-z]:$/.test(a))||t.pop())}function A(e){return""!==e.username||""!==e.password}function E(e,t,a,n,i){if(this.pointer=0,this.input=e,this.base=t||null,this.encodingOverride=a||"utf-8",this.stateOverride=i,this.url=n,this.failure=!1,this.parseError=!1,!this.url){this.url={scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,cannotBeABaseURL:!1};const e=function(e){return e.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g,"")}(this.input);e!==this.input&&(this.parseError=!0),this.input=e}const o=function(e){return e.replace(/\u0009|\u000A|\u000D/g,"")}(this.input);for(o!==this.input&&(this.parseError=!0),this.input=o,this.state=i||"scheme start",this.buffer="",this.atFlag=!1,this.arrFlag=!1,this.passwordTokenSeenFlag=!1,this.input=s.ucs2.decode(this.input);this.pointer<=this.input.length;++this.pointer){const e=this.input[this.pointer],t=isNaN(e)?void 0:String.fromCodePoint(e),a=this["parse "+this.state](e,t);if(!a)break;if(a===r){this.failure=!0;break}}}E.prototype["parse scheme start"]=function(e,t){if(l(e))this.buffer+=t.toLowerCase(),this.state="scheme";else{if(this.stateOverride)return this.parseError=!0,r;this.state="no scheme",--this.pointer}return!0},E.prototype["parse scheme"]=function(e,t){if(function(e){return l(e)||d(e)}(e)||43===e||45===e||46===e)this.buffer+=t.toLowerCase();else if(58===e){if(this.stateOverride){if(f(this.url)&&!h(this.buffer))return!1;if(!f(this.url)&&h(this.buffer))return!1;if((A(this.url)||null!==this.url.port)&&"file"===this.buffer)return!1;if("file"===this.url.scheme&&(""===this.url.host||null===this.url.host))return!1}if(this.url.scheme=this.buffer,this.buffer="",this.stateOverride)return!1;"file"===this.url.scheme?(47===this.input[this.pointer+1]&&47===this.input[this.pointer+2]||(this.parseError=!0),this.state="file"):f(this.url)&&null!==this.base&&this.base.scheme===this.url.scheme?this.state="special relative or authority":f(this.url)?this.state="special authority slashes":47===this.input[this.pointer+1]?(this.state="path or authority",++this.pointer):(this.url.cannotBeABaseURL=!0,this.url.path.push(""),this.state="cannot-be-a-base-URL path")}else{if(this.stateOverride)return this.parseError=!0,r;this.buffer="",this.state="no scheme",this.pointer=-1}return!0},E.prototype["parse no scheme"]=function(e){return null===this.base||this.base.cannotBeABaseURL&&35!==e?r:(this.base.cannotBeABaseURL&&35===e?(this.url.scheme=this.base.scheme,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.url.cannotBeABaseURL=!0,this.state="fragment"):"file"===this.base.scheme?(this.state="file",--this.pointer):(this.state="relative",--this.pointer),!0)},E.prototype["parse special relative or authority"]=function(e){return 47===e&&47===this.input[this.pointer+1]?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="relative",--this.pointer),!0},E.prototype["parse path or authority"]=function(e){return 47===e?this.state="authority":(this.state="path",--this.pointer),!0},E.prototype["parse relative"]=function(e){return this.url.scheme=this.base.scheme,isNaN(e)?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query):47===e?this.state="relative slash":63===e?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query="",this.state="query"):35===e?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.state="fragment"):f(this.url)&&92===e?(this.parseError=!0,this.state="relative slash"):(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(0,this.base.path.length-1),this.state="path",--this.pointer),!0},E.prototype["parse relative slash"]=function(e){return!f(this.url)||47!==e&&92!==e?47===e?this.state="authority":(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.state="path",--this.pointer):(92===e&&(this.parseError=!0),this.state="special authority ignore slashes"),!0},E.prototype["parse special authority slashes"]=function(e){return 47===e&&47===this.input[this.pointer+1]?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="special authority ignore slashes",--this.pointer),!0},E.prototype["parse special authority ignore slashes"]=function(e){return 47!==e&&92!==e?(this.state="authority",--this.pointer):this.parseError=!0,!0},E.prototype["parse authority"]=function(e,t){if(64===e){this.parseError=!0,this.atFlag&&(this.buffer="%40"+this.buffer),this.atFlag=!0;const e=o(this.buffer);for(let t=0;t<e;++t){const e=this.buffer.codePointAt(t);if(58===e&&!this.passwordTokenSeenFlag){this.passwordTokenSeenFlag=!0;continue}const a=S(e,_);this.passwordTokenSeenFlag?this.url.password+=a:this.url.username+=a}this.buffer=""}else if(isNaN(e)||47===e||63===e||35===e||f(this.url)&&92===e){if(this.atFlag&&""===this.buffer)return this.parseError=!0,r;this.pointer-=o(this.buffer)+1,this.buffer="",this.state="host"}else this.buffer+=t;return!0},E.prototype["parse hostname"]=E.prototype["parse host"]=function(e,t){if(this.stateOverride&&"file"===this.url.scheme)--this.pointer,this.state="file host";else if(58!==e||this.arrFlag)if(isNaN(e)||47===e||63===e||35===e||f(this.url)&&92===e){if(--this.pointer,f(this.url)&&""===this.buffer)return this.parseError=!0,r;if(this.stateOverride&&""===this.buffer&&(A(this.url)||null!==this.url.port))return this.parseError=!0,!1;const e=k(this.buffer,f(this.url));if(e===r)return r;if(this.url.host=e,this.buffer="",this.state="path start",this.stateOverride)return!1}else 91===e?this.arrFlag=!0:93===e&&(this.arrFlag=!1),this.buffer+=t;else{if(""===this.buffer)return this.parseError=!0,r;const e=k(this.buffer,f(this.url));if(e===r)return r;if(this.url.host=e,this.buffer="",this.state="port","hostname"===this.stateOverride)return!1}return!0},E.prototype["parse port"]=function(e,t){if(d(e))this.buffer+=t;else{if(!(isNaN(e)||47===e||63===e||35===e||f(this.url)&&92===e||this.stateOverride))return this.parseError=!0,r;if(""!==this.buffer){const e=parseInt(this.buffer);if(e>Math.pow(2,16)-1)return this.parseError=!0,r;this.url.port=e===(a=this.url.scheme,i[a])?null:e,this.buffer=""}if(this.stateOverride)return!1;this.state="path start",--this.pointer}var a;return!0};const $=new Set([47,92,63,35]);E.prototype["parse file"]=function(e){var t,a;return this.url.scheme="file",47===e||92===e?(92===e&&(this.parseError=!0),this.state="file slash"):null!==this.base&&"file"===this.base.scheme?isNaN(e)?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query):63===e?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query="",this.state="query"):35===e?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.state="fragment"):(this.input.length-this.pointer-1==0||(t=e,a=this.input[this.pointer+1],!l(t)||58!==a&&124!==a)||this.input.length-this.pointer-1>=2&&!$.has(this.input[this.pointer+2])?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),C(this.url)):this.parseError=!0,this.state="path",--this.pointer):(this.state="path",--this.pointer),!0},E.prototype["parse file slash"]=function(e){var t;return 47===e||92===e?(92===e&&(this.parseError=!0),this.state="file host"):(null!==this.base&&"file"===this.base.scheme&&(2===(t=this.base.path[0]).length&&l(t.codePointAt(0))&&":"===t[1]?this.url.path.push(this.base.path[0]):this.url.host=this.base.host),this.state="path",--this.pointer),!0},E.prototype["parse file host"]=function(e,t){if(isNaN(e)||47===e||92===e||63===e||35===e)if(--this.pointer,!this.stateOverride&&u(this.buffer))this.parseError=!0,this.state="path";else if(""===this.buffer){if(this.url.host="",this.stateOverride)return!1;this.state="path start"}else{let e=k(this.buffer,f(this.url));if(e===r)return r;if("localhost"===e&&(e=""),this.url.host=e,this.stateOverride)return!1;this.buffer="",this.state="path start"}else this.buffer+=t;return!0},E.prototype["parse path start"]=function(e){return f(this.url)?(92===e&&(this.parseError=!0),this.state="path",47!==e&&92!==e&&--this.pointer):this.stateOverride||63!==e?this.stateOverride||35!==e?void 0!==e&&(this.state="path",47!==e&&--this.pointer):(this.url.fragment="",this.state="fragment"):(this.url.query="",this.state="query"),!0},E.prototype["parse path"]=function(e){if(isNaN(e)||47===e||f(this.url)&&92===e||!this.stateOverride&&(63===e||35===e)){if(f(this.url)&&92===e&&(this.parseError=!0),".."===(t=(t=this.buffer).toLowerCase())||"%2e."===t||".%2e"===t||"%2e%2e"===t?(C(this.url),47===e||f(this.url)&&92===e||this.url.path.push("")):!m(this.buffer)||47===e||f(this.url)&&92===e?m(this.buffer)||("file"===this.url.scheme&&0===this.url.path.length&&u(this.buffer)&&(""!==this.url.host&&null!==this.url.host&&(this.parseError=!0,this.url.host=""),this.buffer=this.buffer[0]+":"),this.url.path.push(this.buffer)):this.url.path.push(""),this.buffer="","file"===this.url.scheme&&(void 0===e||63===e||35===e))for(;this.url.path.length>1&&""===this.url.path[0];)this.parseError=!0,this.url.path.shift();63===e&&(this.url.query="",this.state="query"),35===e&&(this.url.fragment="",this.state="fragment")}else 37!==e||c(this.input[this.pointer+1])&&c(this.input[this.pointer+2])||(this.parseError=!0),this.buffer+=S(e,w);var t;return!0},E.prototype["parse cannot-be-a-base-URL path"]=function(e){return 63===e?(this.url.query="",this.state="query"):35===e?(this.url.fragment="",this.state="fragment"):(isNaN(e)||37===e||(this.parseError=!0),37!==e||c(this.input[this.pointer+1])&&c(this.input[this.pointer+2])||(this.parseError=!0),isNaN(e)||(this.url.path[0]=this.url.path[0]+S(e,y))),!0},E.prototype["parse query"]=function(e,t){if(isNaN(e)||!this.stateOverride&&35===e){f(this.url)&&"ws"!==this.url.scheme&&"wss"!==this.url.scheme||(this.encodingOverride="utf-8");const t=new Buffer(this.buffer);for(let e=0;e<t.length;++e)t[e]<33||t[e]>126||34===t[e]||35===t[e]||60===t[e]||62===t[e]?this.url.query+=g(t[e]):this.url.query+=String.fromCodePoint(t[e]);this.buffer="",35===e&&(this.url.fragment="",this.state="fragment")}else 37!==e||c(this.input[this.pointer+1])&&c(this.input[this.pointer+2])||(this.parseError=!0),this.buffer+=t;return!0},E.prototype["parse fragment"]=function(e){return isNaN(e)||(0===e?this.parseError=!0:(37!==e||c(this.input[this.pointer+1])&&c(this.input[this.pointer+2])||(this.parseError=!0),this.url.fragment+=S(e,y))),!0},e.exports.serializeURL=function(e,t){let a=e.scheme+":";if(null!==e.host?(a+="//",""===e.username&&""===e.password||(a+=e.username,""!==e.password&&(a+=":"+e.password),a+="@"),a+=x(e.host),null!==e.port&&(a+=":"+e.port)):null===e.host&&"file"===e.scheme&&(a+="//"),e.cannotBeABaseURL)a+=e.path[0];else for(const t of e.path)a+="/"+t;return null!==e.query&&(a+="?"+e.query),t||null===e.fragment||(a+="#"+e.fragment),a},e.exports.serializeURLOrigin=function(t){switch(t.scheme){case"blob":try{return e.exports.serializeURLOrigin(e.exports.parseURL(t.path[0]))}catch(e){return"null"}case"ftp":case"gopher":case"http":case"https":case"ws":case"wss":return function(e){let t=e.scheme+"://";return t+=x(e.host),null!==e.port&&(t+=":"+e.port),t}({scheme:t.scheme,host:t.host,port:t.port});case"file":return"file://";default:return"null"}},e.exports.basicURLParse=function(e,t){void 0===t&&(t={});const a=new E(e,t.baseURL,t.encodingOverride,t.url,t.stateOverride);return a.failure?"failure":a.url},e.exports.setTheUsername=function(e,t){e.username="";const a=s.ucs2.decode(t);for(let t=0;t<a.length;++t)e.username+=S(a[t],_)},e.exports.setThePassword=function(e,t){e.password="";const a=s.ucs2.decode(t);for(let t=0;t<a.length;++t)e.password+=S(a[t],_)},e.exports.serializeHost=x,e.exports.cannotHaveAUsernamePasswordPort=function(e){return null===e.host||""===e.host||e.cannotBeABaseURL||"file"===e.scheme},e.exports.serializeInteger=function(e){return String(e)},e.exports.parseURL=function(t,a){return void 0===a&&(a={}),e.exports.basicURLParse(t,{baseURL:a.baseURL,encodingOverride:a.encodingOverride})}},5531:function(e,t){var a,s;void 0===(s="function"==typeof(a=e=>{var t=e=>{"number"==typeof e?e=""+e:"string"!=typeof e&&(e="");var t=u(e);return n(e,{_targetLower:t._lower,_targetLowerCodes:t.lowerCodes,_bitflags:t.bitflags})};class a{get indexes(){return this._indexes.slice(0,this._indexes.len).sort((e,t)=>e-t)}set indexes(e){return this._indexes=e}highlight(e,t){return((e,t="<b>",a="</b>")=>{for(var s="function"==typeof t?t:void 0,n=e.target,i=n.length,r=e.indexes,o="",p=0,d=0,l=!1,c=[],m=0;m<i;++m){var u=n[m];if(r[d]===m){if(++d,l||(l=!0,s?(c.push(o),o=""):o+=t),d===r.length){s?(o+=u,c.push(s(o,p++)),o="",c.push(n.substr(m+1))):o+=u+a+n.substr(m+1);break}}else l&&(l=!1,s?(c.push(s(o,p++)),o=""):o+=a);o+=u}return s?c:o})(this,e,t)}get score(){return i(this._score)}set score(e){this._score=r(e)}}class s extends Array{get score(){return i(this._score)}set score(e){this._score=r(e)}}var n=(e,t)=>{const s=new a;return s.target=e,s.obj=t.obj??P,s._score=t._score??A,s._indexes=t._indexes??[],s._targetLower=t._targetLower??"",s._targetLowerCodes=t._targetLowerCodes??P,s._nextBeginningIndexes=t._nextBeginningIndexes??P,s._bitflags=t._bitflags??0,s},i=e=>e===A?0:e>1?e:Math.E**(-2*((1-e)**.04307-1)),r=e=>0===e?A:e>1?e:1-Math.pow(Math.log(e)/-2+1,1/.04307),o=e=>{"number"==typeof e?e=""+e:"string"!=typeof e&&(e=""),e=e.trim();var t=u(e),a=[];if(t.containsSpace){var s=e.split(/\s+/);s=[...new Set(s)];for(var n=0;n<s.length;n++)if(""!==s[n]){var i=u(s[n]);a.push({lowerCodes:i.lowerCodes,_lower:s[n].toLowerCase(),containsSpace:!1})}}return{lowerCodes:t.lowerCodes,_lower:t._lower,containsSpace:t.containsSpace,bitflags:t.bitflags,spaceSearches:a}},p=e=>{if(e.length>999)return t(e);var a=f.get(e);return void 0!==a||(a=t(e),f.set(e,a)),a},d=e=>{if(e.length>999)return o(e);var t=g.get(e);return void 0!==t||(t=o(e),g.set(e,t)),t},l=(e,t,s=!1,n=!1)=>{if(!1===s&&e.containsSpace)return c(e,t,n);for(var i=e._lower,r=e.lowerCodes,o=r[0],p=t._targetLowerCodes,d=r.length,l=p.length,m=0,u=0,f=0;;){if(o===p[u]){if(y[f++]=u,++m===d)break;o=r[m]}if(++u>=l)return P}m=0;var g=!1,w=0,b=t._nextBeginningIndexes;b===P&&(b=t._nextBeginningIndexes=h(t.target));var _=0;if((u=0===y[0]?0:b[y[0]-1])!==l)for(;;)if(u>=l){if(m<=0)break;if(++_>200)break;--m;var S=v[--w];u=b[S]}else if(r[m]===p[u]){if(v[w++]=u,++m===d){g=!0;break}++u}else u=b[u];var T=d<=1?-1:t._targetLower.indexOf(i,y[0]),k=!!~T,x=!!k&&(0===T||t._nextBeginningIndexes[T-1]===T);if(k&&!x)for(var C=0;C<b.length;C=b[C])if(!(C<=T)){for(var A=0;A<d&&r[A]===t._targetLowerCodes[C+A];A++);if(A===d){T=C,x=!0;break}}var E=e=>{for(var t=0,a=0,s=1;s<d;++s)e[s]-e[s-1]!==1&&(t-=e[s],++a);if(t-=(e[d-1]-e[0]-(d-1)+12)*a,0!==e[0]&&(t-=e[0]*e[0]*.2),g){var n=1;for(s=b[0];s<l;s=b[s])++n;n>24&&(t*=10*(n-24))}else t*=1e3;return t-=(l-d)/2,k&&(t/=1+d*d*1),x&&(t/=1+d*d*1),t-(l-d)/2};if(g)if(x){for(C=0;C<d;++C)y[C]=T+C;$=y,D=E(y)}else $=v,D=E(v);else{if(k)for(C=0;C<d;++C)y[C]=T+C;var $,D=E($=y)}for(t._score=D,C=0;C<d;++C)t._indexes[C]=$[C];t._indexes.len=d;const N=new a;return N.target=t.target,N._score=t._score,N._indexes=t._indexes,N},c=(e,t,a)=>{for(var s=new Set,n=0,i=P,r=0,o=e.spaceSearches,p=o.length,d=0,c=()=>{for(let e=d-1;e>=0;e--)t._nextBeginningIndexes[w[2*e+0]]=w[2*e+1]},m=!1,u=0;u<p;++u){_[u]=A;var h=o[u];if(i=l(h,t),a){if(i===P)continue;m=!0}else if(i===P)return c(),P;if(u!==p-1){var f=i._indexes,g=!0;for(let e=0;e<f.len-1;e++)if(f[e+1]-f[e]!==1){g=!1;break}if(g){var y=f[f.len-1]+1,v=t._nextBeginningIndexes[y-1];for(let e=y-1;e>=0&&v===t._nextBeginningIndexes[e];e--)t._nextBeginningIndexes[e]=y,w[2*d+0]=e,w[2*d+1]=v,d++}}n+=i._score/p,_[u]=i._score/p,i._indexes[0]<r&&(n-=2*(r-i._indexes[0])),r=i._indexes[0];for(var b=0;b<i._indexes.len;++b)s.add(i._indexes[b])}if(a&&!m)return P;c();var S=l(e,t,!0);if(S!==P&&S._score>n){if(a)for(u=0;u<p;++u)_[u]=S._score/p;return S}a&&(i=t),i._score=n,u=0;for(let e of s)i._indexes[u++]=e;return i._indexes.len=u,i},m=e=>e.replace(/\p{Script=Latin}+/gu,e=>e.normalize("NFD")).replace(/[\u0300-\u036f]/g,""),u=e=>{for(var t=(e=m(e)).length,a=e.toLowerCase(),s=[],n=0,i=!1,r=0;r<t;++r){var o=s[r]=a.charCodeAt(r);32!==o?n|=1<<(o>=97&&o<=122?o-97:o>=48&&o<=57?26:o<=127?30:31):i=!0}return{lowerCodes:s,bitflags:n,containsSpace:i,_lower:a}},h=e=>{for(var t=(e=m(e)).length,a=(e=>{for(var t=e.length,a=[],s=0,n=!1,i=!1,r=0;r<t;++r){var o=e.charCodeAt(r),p=o>=65&&o<=90,d=p||o>=97&&o<=122||o>=48&&o<=57,l=p&&!n||!i||!d;n=p,i=d,l&&(a[s++]=r)}return a})(e),s=[],n=a[0],i=0,r=0;r<t;++r)n>r?s[r]=n:(n=a[++i],s[r]=void 0===n?t:n);return s},f=new Map,g=new Map,y=[],v=[],w=[],b=[],_=[],S=[],T=[],k=(e,t)=>{var a=e[t];if(void 0!==a)return a;if("function"==typeof t)return t(e);var s=t;Array.isArray(t)||(s=t.split("."));for(var n=s.length,i=-1;e&&++i<n;)e=e[s[i]];return e},x=e=>"object"==typeof e&&"number"==typeof e._bitflags,C=1/0,A=-C,E=[];E.total=0;var $,D,N,R,P=null,O=t(""),M=($=[],D=0,R=e=>{for(var t=0,a=$[t],s=1;s<D;){var n=s+1;t=s,n<D&&$[n]._score<$[s]._score&&(t=n),$[t-1>>1]=$[t],s=1+(t<<1)}for(var i=t-1>>1;t>0&&a._score<$[i]._score;i=(t=i)-1>>1)$[t]=$[i];$[t]=a},(N={}).add=e=>{var t=D;$[D++]=e;for(var a=t-1>>1;t>0&&e._score<$[a]._score;a=(t=a)-1>>1)$[t]=$[a];$[t]=e},N.poll=e=>{if(0!==D){var t=$[0];return $[0]=$[--D],R(),t}},N.peek=e=>{if(0!==D)return $[0]},N.replaceTop=e=>{$[0]=e,R()},N);return{single:(e,t)=>{if(!e||!t)return P;var a=d(e);x(t)||(t=p(t));var s=a.bitflags;return(s&t._bitflags)!==s?P:l(a,t)},go:(e,t,a)=>{if(!e)return a?.all?((e,t)=>{var a=[];a.total=e.length;var i=t?.limit||C;if(t?.key)for(var r=0;r<e.length;r++){var o=e[r];if((m=k(o,t.key))!=P){x(m)||(m=p(m));var d=n(m.target,{_score:m._score,obj:o});if(a.push(d),a.length>=i)return a}}else if(t?.keys)for(r=0;r<e.length;r++){o=e[r];for(var l=new s(t.keys.length),c=t.keys.length-1;c>=0;--c)(m=k(o,t.keys[c]))?(x(m)||(m=p(m)),m._score=A,m._indexes.len=0,l[c]=m):l[c]=O;if(l.obj=o,l._score=A,a.push(l),a.length>=i)return a}else for(r=0;r<e.length;r++){var m;if((m=e[r])!=P&&(x(m)||(m=p(m)),m._score=A,m._indexes.len=0,a.push(m),a.length>=i))return a}return a})(t,a):E;var i=d(e),o=i.bitflags,c=i.containsSpace,m=r(a?.threshold||0),u=a?.limit||C,h=0,f=0,g=t.length;function y(e){h<u?(M.add(e),++h):(++f,e._score>M.peek()._score&&M.replaceTop(e))}if(a?.key)for(var v=a.key,w=0;w<g;++w){var $=t[w];(B=k($,v))&&(x(B)||(B=p(B)),(o&B._bitflags)===o&&(q=l(i,B))!==P&&(q._score<m||(q.obj=$,y(q))))}else if(a?.keys){var D=a.keys,N=D.length;e:for(w=0;w<g;++w){$=t[w];for(var R=0,L=0;L<N;++L)v=D[L],(B=k($,v))?(x(B)||(B=p(B)),S[L]=B,R|=B._bitflags):S[L]=O;if((o&R)===o){if(c)for(let e=0;e<i.spaceSearches.length;e++)b[e]=A;for(L=0;L<N;++L)if((B=S[L])!==O)if(T[L]=l(i,B,!1,c),T[L]!==P){if(c)for(let e=0;e<i.spaceSearches.length;e++)_[e]>-1e3&&b[e]>A&&(V=(b[e]+_[e])/4)>b[e]&&(b[e]=V),_[e]>b[e]&&(b[e]=_[e])}else T[L]=O;else T[L]=O;if(c){for(let e=0;e<i.spaceSearches.length;e++)if(b[e]===A)continue e}else{var I=!1;for(let e=0;e<N;e++)if(T[e]._score!==A){I=!0;break}if(!I)continue}var j=new s(N);for(let e=0;e<N;e++)j[e]=T[e];if(c){var F=0;for(let e=0;e<i.spaceSearches.length;e++)F+=b[e]}else{F=A;for(let e=0;e<N;e++){var V;(q=j[e])._score>-1e3&&F>A&&(V=(F+q._score)/4)>F&&(F=V),q._score>F&&(F=q._score)}}if(j.obj=$,j._score=F,a?.scoreFn){if(!(F=a.scoreFn(j)))continue;F=r(F),j._score=F}F<m||y(j)}}}else for(w=0;w<g;++w){var B,q;(B=t[w])&&(x(B)||(B=p(B)),(o&B._bitflags)===o&&(q=l(i,B))!==P&&(q._score<m||y(q)))}if(0===h)return E;var W=new Array(h);for(w=h-1;w>=0;--w)W[w]=M.poll();return W.total=h+f,W},prepare:t,cleanup:()=>{f.clear(),g.clear()}}})?a.apply(t,[]):a)||(e.exports=s)},5578:e=>{e.exports=d},5606:(e,t,a)=>{a.d(t,{YQ:()=>r.Y,ZH:()=>n.Z,fS:()=>u});var s=a(5578),n=a(1831),i=a(699),r=a(9239),o=a(2937);const p=(0,s.deprecate)(()=>{},'Constructor "entries" argument is not spec-compliant and will be removed in next major release.');var d,l,c,m=function(e,t,a,s){if("a"===a&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===a?s:"a"===a?s.call(e):s?s.value:t.get(e)};class u{constructor(e){d.add(this),l.set(this,new Map),e&&(p(),e.forEach(({name:e,value:t,fileName:a})=>this.append(e,t,a)))}static[(l=new WeakMap,d=new WeakSet,Symbol.hasInstance)](e){return Boolean(e&&(0,o.T)(e.constructor)&&"FormData"===e[Symbol.toStringTag]&&(0,o.T)(e.append)&&(0,o.T)(e.set)&&(0,o.T)(e.get)&&(0,o.T)(e.getAll)&&(0,o.T)(e.has)&&(0,o.T)(e.delete)&&(0,o.T)(e.entries)&&(0,o.T)(e.values)&&(0,o.T)(e.keys)&&(0,o.T)(e[Symbol.iterator])&&(0,o.T)(e.forEach))}append(e,t,a){m(this,d,"m",c).call(this,{name:e,fileName:a,append:!0,rawValue:t,argsLength:arguments.length})}set(e,t,a){m(this,d,"m",c).call(this,{name:e,fileName:a,append:!1,rawValue:t,argsLength:arguments.length})}get(e){const t=m(this,l,"f").get(String(e));return t?t[0]:null}getAll(e){const t=m(this,l,"f").get(String(e));return t?t.slice():[]}has(e){return m(this,l,"f").has(String(e))}delete(e){m(this,l,"f").delete(String(e))}*keys(){for(const e of m(this,l,"f").keys())yield e}*entries(){for(const e of this.keys()){const t=this.getAll(e);for(const a of t)yield[e,a]}}*values(){for(const[,e]of this)yield e}[(c=function({name:e,rawValue:t,append:a,fileName:s,argsLength:o}){const p=a?"append":"set";if(o<2)throw new TypeError(`Failed to execute '${p}' on 'FormData': 2 arguments required, but only ${o} present.`);let d;if(e=String(e),(0,i.f)(t))d=void 0===s?t:new n.Z([t],s,{type:t.type,lastModified:t.lastModified});else if((e=>e instanceof r.Y)(t))d=new n.Z([t],void 0===s?"blob":s,{type:t.type});else{if(s)throw new TypeError(`Failed to execute '${p}' on 'FormData': parameter 2 is not of type 'Blob'.`);d=String(t)}const c=m(this,l,"f").get(e);c&&a?c.push(d):m(this,l,"f").set(e,[d])},Symbol.iterator)](){return this.entries()}forEach(e,t){for(const[a,s]of this)e.call(t,s,a,this)}get[Symbol.toStringTag](){return"FormData"}[s.inspect.custom](){return this[Symbol.toStringTag]}}},5616:e=>{var t={};function a(e){return e<0?-1:1}function s(e,t){t.unsigned||--e;const s=t.unsigned?0:-Math.pow(2,e),n=Math.pow(2,e)-1,i=t.moduloBitLength?Math.pow(2,t.moduloBitLength):Math.pow(2,e),r=t.moduloBitLength?Math.pow(2,t.moduloBitLength-1):Math.pow(2,e-1);return function(e,o){o||(o={});let p=+e;if(o.enforceRange){if(!Number.isFinite(p))throw new TypeError("Argument is not a finite number");if(p=a(p)*Math.floor(Math.abs(p)),p<s||p>n)throw new TypeError("Argument is not in byte range");return p}if(!isNaN(p)&&o.clamp)return p=function(e){return e%1!=.5||1&e?Math.round(e):Math.floor(e)}(p),p<s&&(p=s),p>n&&(p=n),p;if(!Number.isFinite(p)||0===p)return 0;if(p=a(p)*Math.floor(Math.abs(p)),p%=i,!t.unsigned&&p>=r)return p-i;if(t.unsigned)if(p<0)p+=i;else if(-0===p)return 0;return p}}e.exports=t,t.void=function(){},t.boolean=function(e){return!!e},t.byte=s(8,{unsigned:!1}),t.octet=s(8,{unsigned:!0}),t.short=s(16,{unsigned:!1}),t["unsigned short"]=s(16,{unsigned:!0}),t.long=s(32,{unsigned:!1}),t["unsigned long"]=s(32,{unsigned:!0}),t["long long"]=s(32,{unsigned:!1,moduloBitLength:64}),t["unsigned long long"]=s(32,{unsigned:!0,moduloBitLength:64}),t.double=function(e){const t=+e;if(!Number.isFinite(t))throw new TypeError("Argument is not a finite floating-point value");return t},t["unrestricted double"]=function(e){const t=+e;if(isNaN(t))throw new TypeError("Argument is NaN");return t},t.float=t.double,t["unrestricted float"]=t["unrestricted double"],t.DOMString=function(e,t){return t||(t={}),t.treatNullAsEmptyString&&null===e?"":String(e)},t.ByteString=function(e,t){const a=String(e);let s;for(let e=0;void 0!==(s=a.codePointAt(e));++e)if(s>255)throw new TypeError("Argument is not a valid bytestring");return a},t.USVString=function(e){const t=String(e),a=t.length,s=[];for(let e=0;e<a;++e){const n=t.charCodeAt(e);if(n<55296||n>57343)s.push(String.fromCodePoint(n));else if(56320<=n&&n<=57343)s.push(String.fromCodePoint(65533));else if(e===a-1)s.push(String.fromCodePoint(65533));else{const a=t.charCodeAt(e+1);if(56320<=a&&a<=57343){const t=1023&n,i=1023&a;s.push(String.fromCodePoint(65536+1024*t+i)),++e}else s.push(String.fromCodePoint(65533))}}return s.join("")},t.Date=function(e,t){if(!(e instanceof Date))throw new TypeError("Argument is not a Date object");if(!isNaN(e))return e},t.RegExp=function(e,t){return e instanceof RegExp||(e=new RegExp(e)),e}},5692:(e,t,a)=>{const s=a(4593);e.exports=s,e.exports.HttpAgent=s,e.exports.HttpsAgent=a(2251),e.exports.constants=a(8125)},5814:e=>{e.exports=l},5886:(e,t,a)=>{a.d(t,{dU:()=>r,rQ:()=>o});var s=a(1967);class n extends s.oS{getDefinition(){return{name:"todo",description:"Execute and manage saved task plans. Use this tool to:\n- Resume execution of a previously generated plan\n- List all available task plans\n- View details of a specific task plan\n\nWHEN TO USE:\n- After generating a plan with 'plan' tool in planOnly mode\n- To continue execution of an interrupted task\n- To check status of existing tasks\n- To review saved task plans before execution\n\nFEATURES:\n- Resume from any step (default: continue from last step)\n- View task progress and status\n- List all available plans in .tasks/ directory",input_schema:{type:"object",properties:{action:{type:"string",enum:["resume","list","view"],description:"The action to perform: resume (execute a saved plan), list (show all plans), view (show plan details)"},taskId:{type:"string",description:"The task ID to resume or view. Required for resume and view actions. Format: task-YYYYMMDD-XXX"},resumeFrom:{type:"number",description:"Step number to resume from (1-based). If not specified, resumes from the first incomplete step. Use 1 to restart from the beginning."}},required:["action"]}}}async execute(e){const{action:t,taskId:a,resumeFrom:s}=e;try{switch(t){case"resume":return await this.executeResume(a,s);case"list":return await this.executeList();case"view":return await this.executeView(a);default:return this.createToolResult(`Error: Unknown action '${t}'`,`Error: Unknown action '${t}'`,!0)}}catch(e){const t=e instanceof Error?e.message:String(e);return this.createToolResult(`Error: ${t}`,`Error: ${t}`,!0)}}async executeResume(e,t){if(!e)return this.createToolResult("Error: taskId is required for resume action","Error: taskId is required for resume action",!0);try{const{resumePlanTask:s}=await Promise.resolve().then(a.bind(a,7968)),n=await s(e,t||0);let i="✅ 任务恢复执行完成!\n\n";return i+=`**任务 ID**: ${n.taskId}\n`,i+=`**完成步骤**: ${n.completedSteps}\n`,i+=`**恢复起点**: 步骤 ${n.resumedFrom}\n\n`,i+="所有步骤已成功执行完毕。",this.createToolResult(i,i,!0)}catch(e){const t=e instanceof Error?e.message:String(e);return this.createToolResult(`Error: Failed to resume task - ${t}`,`Error: Failed to resume task - ${t}`,!0)}}async executeList(){try{const{listTaskPlans:e,loadTaskPlan:t}=await Promise.resolve().then(a.bind(a,5283)),s=e();if(0===s.length)return this.createToolResult("No saved task plans found in .tasks/ directory.","No saved task plans found in .tasks/ directory.",!0);let n=`📋 已保存的任务计划 (共 ${s.length} 个)\n`;n+=`${"═".repeat(60)}\n\n`;for(const e of s){const a=t(e);if(a){const t=a.tasks.filter(e=>"completed"===e.status).length,s=a.tasks.length,i=t===s?"✅ 已完成":t>0?`⏳ 进行中 (${t}/${s})`:"📋 待执行";n+=`**${e}**\n`,n+=` 状态: ${i}\n`,n+=` 步骤: ${s} 个\n`,n+=` 策略: ${a.strategy}\n`,n+=` 创建时间: ${a.createdAt||"N/A"}\n`,n+="\n"}}return n+='\n💡 使用 todo(action="view", taskId="...") 查看详情',n+='\n💡 使用 todo(action="resume", taskId="...") 恢复执行',this.createToolResult(n,n,!0)}catch(e){const t=e instanceof Error?e.message:String(e);return this.createToolResult(`Error: Failed to list tasks - ${t}`,`Error: Failed to list tasks - ${t}`,!0)}}async executeView(e){if(!e)return this.createToolResult("Error: taskId is required for view action","Error: taskId is required for view action",!0);try{const{loadTaskPlan:t}=await Promise.resolve().then(a.bind(a,5283)),s=t(e);if(!s)return this.createToolResult(`Error: Task plan '${e}' not found`,`Error: Task plan '${e}' not found`,!0);let n="📋 任务计划详情\n";n+=`${"═".repeat(60)}\n\n`,n+=`**任务 ID**: ${s.taskId}\n`,n+=`**创建时间**: ${s.createdAt||"N/A"}\n`,n+=`**更新时间**: ${s.updatedAt||"N/A"}\n`,n+=`**总步骤数**: ${s.tasks.length}\n`,n+=`**规划策略**: ${s.strategy}\n`,n+=`**当前状态**: ${s.status||"N/A"}\n\n`,n+="**执行步骤**:\n",n+=`${"─".repeat(60)}\n`;for(const e of s.tasks){const t="completed"===e.status?"✅":"in_progress"===e.status?"⏳":"pending"===e.status?"📋":"❓",a=e;n+=`${e.step}. ${t} ${e.description}\n`,n+=` 智能体: ${e.subAgent}\n`,n+=` 状态: ${e.status}\n`,a.startTime&&(n+=` 开始: ${a.startTime}\n`),a.endTime&&(n+=` 完成: ${a.endTime}\n`),a.duration&&(n+=` 耗时: ${a.duration}ms\n`),a.error&&(n+=` 错误: ${a.error}\n`),n+="\n"}const i=s.tasks.find(e=>"completed"!==e.status);return n+=i?`\n💡 使用 todo(action="resume", taskId="${e}", resumeFrom=${i.step}) 从步骤 ${i.step} 继续执行`:"\n✅ 所有步骤已完成!",this.createToolResult(n,n,!0)}catch(e){const t=e instanceof Error?e.message:String(e);return this.createToolResult(`Error: Failed to view task - ${t}`,`Error: Failed to view task - ${t}`,!0)}}formatAction(e){const{action:t,taskId:a,resumeFrom:s}=e;let n=`todo(action="${t}"`;return a&&(n+=`, taskId="${a}"`),s&&(n+=`, resumeFrom=${s}`),n+=")",n}}const i=new n;async function r(e,t,a){return await i.execute({action:e,taskId:t,resumeFrom:a})}const o=i},5955:(e,t,a)=>{function s(e){return e&&"string"==typeof e?Math.ceil(e.length/4):0}function n(e){if(!Array.isArray(e))return 0;let t=0;for(const a of e){if(a.content&&"string"==typeof a.content&&(t+=s(a.content)),a.tool_calls&&Array.isArray(a.tool_calls))for(const e of a.tool_calls)e.function&&(t+=s(e.function.name||""),t+=s(e.function.arguments||""));t+=4}return t}function i(e,t){return!t||t<=0?0:e/t*100}function r(e,t,a=80){return i(e,t)>=a}function o(e,t,a){return`⚠️ Token usage warning: ${e.toLocaleString()} / ${t.toLocaleString()} tokens (${a.toFixed(1)}%)`}a.d(t,{Lq:()=>o,SZ:()=>r,WA:()=>i,au:()=>n})},6113:(e,t,a)=>{a.d(t,{Gw:()=>p,et:()=>o});var s=a(1967),n=a(4237);class i extends s.oS{static nestingLevel=0;static MAX_NESTING_LEVEL=2;getDefinition(){return{name:"plan",description:"USE THIS TOOL FIRST for COMPLEX tasks! This is your PRIMARY tool for handling multi-step, cross-component work.\n\nIDEAL USE CASES:\n- Building new features that span multiple files or components\n- Implementing complete workflows with sequential dependencies\n- Conducting systematic code refactoring across a project\n- Setting up project structure and architecture\n- Multi-file configuration changes\n- Tasks requiring coordination between different system parts\n\nAUTOMATIC ADVANTAGES:\n- Automatic task breakdown into logical steps\n- Intelligent sub-agent assignment for each step\n- Context preservation across all operations\n- Comprehensive execution tracking\n- Maximum 2-level nesting support for complex sub-tasks\n\nAVOID FOR:\n- Single-file edits or queries\n- Simple read/write operations\n- Individual command execution\n\nWhen you're uncertain if a task needs planning, default to using this tool - it will create an optimal execution strategy for you!",input_schema:{type:"object",properties:{task:{type:"string",description:"Detailed description of the complex task to plan and execute. Be specific about the goals and requirements."},planOnly:{type:"boolean",description:"If true, only generate the plan without executing it. The plan will be saved to .tasks/ directory for later execution. Default: false"}},required:["task"]}}}async execute(e){const{task:t,planOnly:s=!1}=e;if(s)try{const{generateTaskPlan:e}=await Promise.resolve().then(a.bind(a,5283)),{getSubAgentManager:s}=await Promise.resolve().then(a.bind(a,9011)),n=s().getAllSubAgents(),i=await e(t,n);let r="✅ 任务规划已生成(仅规划模式)\n\n";return r+=`**任务 ID**: ${i.taskId}\n`,r+=`**总步骤数**: ${i.tasks.length}\n`,r+=`**计划策略**: ${i.strategy}\n\n`,r+="**规划已保存到**:\n",r+=`- Markdown: .tasks/${i.taskId}.md\n`,r+=`- JSON: .tasks/${i.taskId}.json\n\n`,r+="**执行步骤**:\n",i.tasks.forEach((e,t)=>{r+=`${t+1}. ${e.description} [${e.subAgent}]\n`}),r+="\n💡 提示: 使用 todo 工具的 resume 功能来执行此计划",this.createToolResult(r,r,!0)}catch(e){const t=e instanceof Error?e.message:String(e);return this.createToolResult(`Error: Failed to generate plan - ${t}`,`Error: Failed to generate plan - ${t}`,!0)}if(i.nestingLevel>=i.MAX_NESTING_LEVEL)return this.createToolResult(`Error: Maximum nesting level (${i.MAX_NESTING_LEVEL}) reached. Please use regular tools directly instead of the plan tool.`,`Error: Maximum nesting level (${i.MAX_NESTING_LEVEL}) reached. Please use regular tools directly instead of the plan tool.`,!0);i.nestingLevel++;try{let e;try{const s=await Promise.resolve().then(a.bind(a,7968));e=await s.executePlanTask(t,i.nestingLevel)}catch(t){console.log(n.Ay.yellow("[Plan-Tool] 警告: 无法导入plan-executor.js,返回任务规划建议")),e={success:!0,message:"任务规划已生成,请根据规划执行任务步骤",tasks:[{step:1,description:"分析需求并确认技术栈",status:"pending"},{step:2,description:"实现核心功能模块",status:"pending"},{step:3,description:"编写测试用例",status:"pending"},{step:4,description:"代码审查与优化",status:"pending"}]}}let s="✅ Task planning and execution completed successfully!\n\n";return s+=`**Task ID**: ${e.taskId}\n`,s+=`**Completed Steps**: ${e.completedSteps}\n\n`,e.planMarkdown&&(s+=`**Generated Plan**:\n${e.planMarkdown}\n\n`),e.tasks&&e.tasks.length>0&&(s+="**Executed Steps**:\n",e.tasks.forEach((e,t)=>{s+=`${t+1}. ✓ ${e.description}\n`})),this.createToolResult(s,s,!0)}catch(e){const t=e instanceof Error?e.message:String(e);return this.createToolResult(`Error: Task execution failed - ${t}`,`Error: Task execution failed - ${t}`,!0)}finally{i.nestingLevel--}}static getCurrentNestingLevel(){return i.nestingLevel}static resetNestingLevel(){i.nestingLevel=0}formatAction(e){return`plan(task="${e.task.length>100?e.task.substring(0,100)+"...":e.task}", nesting_level=${i.nestingLevel+1})`}formatObservation(e){return"string"==typeof e&&e.includes("Error:")?e:"Task planning completed. Check logs above for details."}}const r=new i;async function o(e){return await r.execute({task:e})}const p=r},6132:(e,t,a)=>{a.d(t,{Do:()=>f,uw:()=>h});var s=a(4421),n=a(2521),i=a(6887),r=a(4237);const o=(0,i.fileURLToPath)("file:///E:/workspace/nium-coder/src/config/init-workspace.ts"),p=(0,n.dirname)(o);let d=null,l=null,c=null;function m(){const e=[(0,n.join)(p,"..",".."),p];for(const t of e){const e=(0,n.join)(t,"examples");if((0,s.existsSync)(e))return t}return(0,n.join)(p,"..","..")}function u(){return d||(d=(0,n.join)(process.cwd(),".nium")),d}function h(){const e=u(),t=function(){if(!c){const e=m();c=(0,n.join)(e,"examples","config.example.json")}return c}();try{if(!(0,s.existsSync)(e)){console.log(r.Ay.blue("🔧 初始化工作目录...")),(0,s.mkdirSync)(e,{recursive:!0}),console.log(r.Ay.green("✓ 创建 .nium 目录"));const a=(0,n.join)(e,"config.json");if((0,s.existsSync)(t))(0,s.copyFileSync)(t,a),console.log(r.Ay.green("✓ 复制 config.example.json 到 .nium/config.json")),console.log(r.Ay.yellow("\n⚠️ 请编辑 .nium/config.json 文件配置 API 密钥和模型\n"));else{console.log(r.Ay.yellow(`⚠️ 未找到 config.example.json: ${t}`));const e={models:{defaultModel:{apiKey:"your-api-key-here",baseURL:"https://api.openai.com/v1",model:"gpt-4o",provider:"openai",maxToken:128e3},liteModel:{apiKey:"your-api-key-here",baseURL:"https://api.openai.com/v1",model:"gpt-3.5-turbo",provider:"openai",maxToken:16385}},mcpServers:[]};(0,s.writeFileSync)(a,JSON.stringify(e,null,2)),console.log(r.Ay.green("✓ 创建默认的 .nium/config.json 文件")),console.log(r.Ay.yellow("\n⚠️ 请编辑 .nium/config.json 文件配置 API 密钥和模型\n"))}}const a=(0,n.join)(e,"agents");(0,s.existsSync)(a)||((0,s.mkdirSync)(a,{recursive:!0}),console.log(r.Ay.green("✓ 创建 .nium/agents 目录")));const i=(0,n.join)(e,"docs");(0,s.existsSync)(i)||((0,s.mkdirSync)(i,{recursive:!0}),console.log(r.Ay.green("✓ 创建 .nium/docs 目录")));const o=(0,n.join)(e,"archives");(0,s.existsSync)(o)||((0,s.mkdirSync)(o,{recursive:!0}),console.log(r.Ay.green("✓ 创建 .nium/archives 目录")));const p=(0,n.join)(e,"logs");(0,s.existsSync)(p)||((0,s.mkdirSync)(p,{recursive:!0}),console.log(r.Ay.green("✓ 创建 .nium/logs 目录")));const d=function(){if(!l){const e=m();l=(0,n.join)(e,"examples",".env.example")}return l}(),c=(0,n.join)(e,".env");return(0,s.existsSync)(c)||((0,s.existsSync)(d)?((0,s.copyFileSync)(d,c),console.log(r.Ay.green("✓ 复制 examples/.env.example 到 .nium/.env"))):(console.log(r.Ay.yellow(`⚠️ 未找到 .env.example: ${d}`)),console.log(r.Ay.yellow(" 将使用默认环境变量配置")))),e}catch(e){console.log(r.Ay.red(`❌ 初始化工作目录失败: ${e.message}`)),process.exit(1)}}function f(e){return(0,n.join)(u(),e)}},6139:(e,t,a)=>{a.a(e,async(e,s)=>{try{a.d(t,{Nt:()=>n.Nt,vf:()=>n.vf});var n=a(9329),i=e([n]),r=i.then?(await i)():i;n=r[0],s()}catch(e){s(e)}})},6342:e=>{e.exports=c},6584:(e,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0});var s=a(4988);class n extends s.EventTarget{constructor(){throw super(),new TypeError("AbortSignal cannot be constructed directly")}get aborted(){const e=i.get(this);if("boolean"!=typeof e)throw new TypeError("Expected 'this' to be an 'AbortSignal' object, but got "+(null===this?"null":typeof this));return e}}s.defineEventAttribute(n.prototype,"abort");const i=new WeakMap;Object.defineProperties(n.prototype,{aborted:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(n.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});class r{constructor(){o.set(this,function(){const e=Object.create(n.prototype);return s.EventTarget.call(e),i.set(e,!1),e}())}get signal(){return p(this)}abort(){var e;e=p(this),!1===i.get(e)&&(i.set(e,!0),e.dispatchEvent({type:"abort"}))}}const o=new WeakMap;function p(e){const t=o.get(e);if(null==t)throw new TypeError("Expected 'this' to be an 'AbortController' object, but got "+(null===e?"null":typeof e));return t}Object.defineProperties(r.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(r.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"}),t.AbortController=r,t.AbortSignal=n,t.default=r,e.exports=r,e.exports.AbortController=e.exports.default=r,e.exports.AbortSignal=n},6585:e=>{var t=1e3,a=60*t,s=60*a,n=24*s,i=7*n;function r(e,t,a,s){var n=t>=1.5*a;return Math.round(e/a)+" "+s+(n?"s":"")}e.exports=function(e,o){o=o||{};var p,d,l=typeof e;if("string"===l&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(r){var o=parseFloat(r[1]);switch((r[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*o;case"weeks":case"week":case"w":return o*i;case"days":case"day":case"d":return o*n;case"hours":case"hour":case"hrs":case"hr":case"h":return o*s;case"minutes":case"minute":case"mins":case"min":case"m":return o*a;case"seconds":case"second":case"secs":case"sec":case"s":return o*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return o;default:return}}}}(e);if("number"===l&&isFinite(e))return o.long?(p=e,(d=Math.abs(p))>=n?r(p,d,n,"day"):d>=s?r(p,d,s,"hour"):d>=a?r(p,d,a,"minute"):d>=t?r(p,d,t,"second"):p+" ms"):function(e){var i=Math.abs(e);return i>=n?Math.round(e/n)+"d":i>=s?Math.round(e/s)+"h":i>=a?Math.round(e/a)+"m":i>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},6586:(e,t,a)=>{a.a(e,async(e,s)=>{try{a.d(t,{Pz:()=>l,X4:()=>c});var n=a(4421),i=a(1967),r=a(5401),o=e([r]),p=o.then?(await o)():o;r=p[0];class d extends i.oS{getDefinition(){return{name:"enhanceProjectStructure",description:"Perform deep analysis of project structure and enhance the PROJECT_STRUCTURE.md document with insights about:\n- Project architecture and design patterns\n- Technology stack and key dependencies\n- Code quality assessment\n- Core functionality breakdown\n- Usage examples and best practices\n\nThis tool should be called AFTER quickProjectScan to add deeper insights based on actual code analysis.",input_schema:{type:"object",properties:{focusAreas:{type:"array",items:{type:"string"},description:'Areas to focus on: "architecture", "tech-stack", "quality", "usage-examples"'},maxFiles:{type:"number",description:"Maximum number of files to read for analysis (default: 15)"}},required:[]}}}async execute(e){try{const t=[],a=process.cwd(),s=e.maxFiles||15,i=e.focusAreas||["architecture","tech-stack","quality"];t.push("🔬 开始深度分析项目结构...\n");const o=".nium/docs/PROJECT_STRUCTURE.md";if(!(0,n.existsSync)(o))return"❌ 错误: 未找到 PROJECT_STRUCTURE.md 基础文档。请先运行 quickProjectScan 工具生成基础结构文档。";t.push("📄 读取现有结构文档...");const p=r.tools.read(o);if("string"!=typeof p)return"❌ 错误: 无法读取 PROJECT_STRUCTURE.md 文档";t.push(`📁 智能选择关键文件(最多 ${s} 个)...`);const d=this.selectKeyFiles(a,s);t.push(` - 选中 ${d.length} 个关键文件进行分析`),t.push(""),t.push("📖 读取关键文件内容...");const l=this.readKeyFiles(d);t.push(` - 成功读取 ${l.length} 个文件`),t.push(""),t.push("🧠 构建深度分析提示...");const c=this.buildAnalysisPrompt(p,l,i);t.push(""),t.push("💭 正在进行深度分析...");const m=await r.tools.think(c);t.push(""),t.push("✍️ 更新项目结构文档...");const u=this.appendAnalysis(p,m);return r.tools.write(o,u),t.push("✅ 文档更新成功!"),t.push(""),t.push(`📊 深度分析已追加至: ${o}`),t.push(""),t.join("\n")}catch(e){return this.formatError("Enhance project structure",e)}}selectKeyFiles(e,t){const a={high:[],medium:[],low:[]},s=["README.md","package.json","pom.xml","build.gradle","Cargo.toml","go.mod","pyproject.toml","setup.py"],i=["src/index.ts","src/index.js","src/main.ts","src/main.js","index.ts","index.js","main.ts","main.js","src/app.ts","src/app.js","app.ts","app.js","src/main/java/**/Application.java","src/main/java/**/Main.java","main.py","__main__.py","app.py","main.go","cmd/main.go","src/main.rs","src/lib.rs"],r=["CONTRIBUTING.md","CHANGELOG.md","tsconfig.json",".eslintrc.js",".prettierrc","jest.config.js"];for(const t of s){const s=`${e}/${t}`;(0,n.existsSync)(s)&&a.high.push(t)}for(const t of i){if(t.includes("**"))continue;const s=`${e}/${t}`;(0,n.existsSync)(s)&&a.medium.push(t)}for(const t of r){const s=`${e}/${t}`;(0,n.existsSync)(s)&&a.low.push(t)}return[...a.high,...a.medium.slice(0,Math.max(0,t-a.high.length)),...a.low.slice(0,Math.max(0,t-a.high.length-a.medium.length))].slice(0,t)}readKeyFiles(e){const t=[];for(const a of e)try{const e=r.tools.read(a);if("string"==typeof e){const s=e.length>5e3?e.substring(0,5e3)+"\n\n...(内容已截断)":e;t.push({path:a,content:s})}}catch(e){continue}return t}buildAnalysisPrompt(e,t,a){const s=t.map(e=>`### ${e.path}\n\`\`\`\n${e.content}\n\`\`\``).join("\n\n"),n=a.map(e=>{switch(e){case"architecture":return"- **项目架构**: 分析项目的架构模式(如 MVC、微服务、插件化等)、设计理念和关键抽象";case"tech-stack":return"- **技术栈**: 识别核心技术、主要依赖库、技术选型的优势";case"quality":return"- **代码质量**: 评估测试覆盖情况、文档完善度、代码组织性";case"usage-examples":return"- **使用示例**: 从代码中提取或总结典型的使用场景和示例";default:return`- **${e}**: 分析该领域的特点`}}).join("\n");return`# 项目深度分析任务\n\n## 背景\n我已经使用 quickProjectScan 生成了项目的基础结构文档。现在需要你基于关键文件的内容,进行深度分析。\n\n## 基础结构文档(摘要)\n${e.substring(0,2e3)}\n${e.length>2e3?"...(文档较长,已截断)":""}\n\n## 关键文件内容\n${s}\n\n## 分析要求\n请基于以上基础文档和关键文件,进行深度分析并生成以下内容:\n\n${n}\n\n## 输出格式\n请按照以下 Markdown 格式输出分析结果:\n\n\`\`\`markdown\n## 深度分析\n\n### 项目定位\n[描述项目类型、目标用户、核心价值]\n\n### 架构设计\n[描述架构模式、设计理念、关键抽象]\n\n### 技术栈\n[列出核心技术、主要依赖、技术选型理由]\n\n### 代码质量\n[评估测试覆盖率、文档完善度、代码组织性]\n\n### 使用示例\n[提供典型的使用场景和代码示例]\n\`\`\`\n\n请保持简洁、专业,重点突出项目的特色和亮点。`}appendAnalysis(e,t){if(e.includes("## 深度分析")){const a=e.split("## 深度分析");if(a.length>1){const e=a[1],s=e.match(/\n## [^#]/);if(s){const n=s.index;return a[0]+t+"\n\n"+e.substring(n)}return a[0]+t}}return e+"\n\n---\n\n"+t}}const l=new d;async function c(e={}){return l.execute(e)}s()}catch(m){s(m)}})},6645:(e,t,a)=>{a.d(t,{AI:()=>i,KX:()=>r});var s=a(4421),n=a(3785);class i{filePath;constructor(e){this.filePath=e}append(e){try{const t=JSON.stringify(e)+"\n";(0,s.appendFileSync)(this.filePath,t,"utf-8")}catch(e){throw new Error(`Failed to append to JSONL file: ${e.message}`)}}appendBatch(e){try{const t=e.map(e=>JSON.stringify(e)).join("\n")+"\n";(0,s.appendFileSync)(this.filePath,t,"utf-8")}catch(e){throw new Error(`Failed to append batch to JSONL file: ${e.message}`)}}create(e){try{const t=JSON.stringify(e)+"\n";(0,s.writeFileSync)(this.filePath,t,"utf-8")}catch(e){throw new Error(`Failed to create JSONL file: ${e.message}`)}}getFilePath(){return this.filePath}}class r{filePath;constructor(e){this.filePath=e}exists(){return(0,s.existsSync)(this.filePath)}readAllSync(e={}){if(!this.exists())return[];try{const t=(0,s.readFileSync)(this.filePath,"utf-8").split("\n").filter(e=>e.trim().length>0),a=[],n=e.startLine||0,i=e.limit?n+e.limit:t.length,r=t.slice(n,i);for(const t of r)try{const s=JSON.parse(t);e.filter&&!e.filter(s)||a.push(s)}catch(e){console.warn(`Invalid JSON line in ${this.filePath}: ${t.substring(0,50)}...`)}return a}catch(e){throw new Error(`Failed to read JSONL file: ${e.message}`)}}async readStream(e,t={}){if(this.exists())return new Promise((a,i)=>{const r=(0,s.createReadStream)(this.filePath,{encoding:"utf-8"}),o=(0,n.createInterface)({input:r,crlfDelay:1/0});let p=0,d=0;const l=t.startLine||0,{limit:c}=t;o.on("line",async a=>{try{if(0===a.trim().length)return;if(p<l)return void p++;if(c&&d>=c)return void o.close();const s=JSON.parse(a);t.filter&&!t.filter(s)||(await e(s,p),d++),p++}catch(e){console.warn(`Invalid JSON line at line ${p}: ${a.substring(0,50)}...`),p++}}),o.on("close",()=>{a()}),o.on("error",e=>{i(new Error(`Failed to read JSONL stream: ${e.message}`))})})}async count(){if(!this.exists())return 0;let e=0;return await this.readStream(()=>{e++}),e}getFilePath(){return this.filePath}}},6648:(e,t,a)=>{const s=a(5616),n=a(6892),i=a(7079),r=n.implSymbol;function o(t){if(!this||this[r]||!(this instanceof o))throw new TypeError("Failed to construct 'URL': Please use the 'new' operator, this DOM object constructor cannot be called as a function.");if(arguments.length<1)throw new TypeError("Failed to construct 'URL': 1 argument required, but only "+arguments.length+" present.");const a=[];for(let e=0;e<arguments.length&&e<2;++e)a[e]=arguments[e];a[0]=s.USVString(a[0]),void 0!==a[1]&&(a[1]=s.USVString(a[1])),e.exports.setup(this,a)}o.prototype.toJSON=function(){if(!this||!e.exports.is(this))throw new TypeError("Illegal invocation");const t=[];for(let e=0;e<arguments.length&&e<0;++e)t[e]=arguments[e];return this[r].toJSON.apply(this[r],t)},Object.defineProperty(o.prototype,"href",{get(){return this[r].href},set(e){e=s.USVString(e),this[r].href=e},enumerable:!0,configurable:!0}),o.prototype.toString=function(){if(!this||!e.exports.is(this))throw new TypeError("Illegal invocation");return this.href},Object.defineProperty(o.prototype,"origin",{get(){return this[r].origin},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"protocol",{get(){return this[r].protocol},set(e){e=s.USVString(e),this[r].protocol=e},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"username",{get(){return this[r].username},set(e){e=s.USVString(e),this[r].username=e},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"password",{get(){return this[r].password},set(e){e=s.USVString(e),this[r].password=e},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"host",{get(){return this[r].host},set(e){e=s.USVString(e),this[r].host=e},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"hostname",{get(){return this[r].hostname},set(e){e=s.USVString(e),this[r].hostname=e},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"port",{get(){return this[r].port},set(e){e=s.USVString(e),this[r].port=e},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"pathname",{get(){return this[r].pathname},set(e){e=s.USVString(e),this[r].pathname=e},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"search",{get(){return this[r].search},set(e){e=s.USVString(e),this[r].search=e},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"hash",{get(){return this[r].hash},set(e){e=s.USVString(e),this[r].hash=e},enumerable:!0,configurable:!0}),e.exports={is:e=>!!e&&e[r]instanceof i.implementation,create(e,t){let a=Object.create(o.prototype);return this.setup(a,e,t),a},setup(e,t,a){a||(a={}),a.wrapper=e,e[r]=new i.implementation(t,a),e[r][n.wrapperSymbol]=e},interface:o,expose:{Window:{URL:o},Worker:{URL:o}}}},6673:(e,t,a)=>{var s=a(4876),n=a(2472),i={TRANSITIONAL:0,NONTRANSITIONAL:1};function r(e){return e.split("\0").map(function(e){return e.normalize("NFC")}).join("\0")}function o(e){for(var t=0,a=n.length-1;t<=a;){var s=Math.floor((t+a)/2),i=n[s];if(i[0][0]<=e&&i[0][1]>=e)return i;i[0][0]>e?a=s-1:t=s+1}return null}var p=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;function d(e){return e.replace(p,"_").length}var l=/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E4-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u192B\u1930-\u193B\u19B0-\u19C0\u19C8\u19C9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2D]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC7F-\uDC82\uDCB0-\uDCBA\uDD00-\uDD02\uDD27-\uDD34\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDE2C-\uDE37\uDEDF-\uDEEA\uDF01-\uDF03\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDE30-\uDE40\uDEAB-\uDEB7]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF51-\uDF7E\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD83A[\uDCD0-\uDCD6]|\uDB40[\uDD00-\uDDEF]/;function c(e,t){"xn--"===e.substr(0,4)&&(e=s.toUnicode(e));var a=!1;(r(e)!==e||"-"===e[3]&&"-"===e[4]||"-"===e[0]||"-"===e[e.length-1]||-1!==e.indexOf(".")||0===e.search(l))&&(a=!0);for(var n=d(e),p=0;p<n;++p){var c=o(e.codePointAt(p));if(m===i.TRANSITIONAL&&"valid"!==c[1]||m===i.NONTRANSITIONAL&&"valid"!==c[1]&&"deviation"!==c[1]){a=!0;break}}return{label:e,error:a}}function m(e,t,a){var s=function(e,t,a){for(var s=!1,n="",r=d(e),p=0;p<r;++p){var l=e.codePointAt(p),c=o(l);switch(c[1]){case"disallowed":s=!0,n+=String.fromCodePoint(l);break;case"ignored":break;case"mapped":n+=String.fromCodePoint.apply(String,c[2]);break;case"deviation":n+=a===i.TRANSITIONAL?String.fromCodePoint.apply(String,c[2]):String.fromCodePoint(l);break;case"valid":n+=String.fromCodePoint(l);break;case"disallowed_STD3_mapped":t?(s=!0,n+=String.fromCodePoint(l)):n+=String.fromCodePoint.apply(String,c[2]);break;case"disallowed_STD3_valid":t&&(s=!0),n+=String.fromCodePoint(l)}}return{string:n,error:s}}(e,t,a);s.string=r(s.string);for(var n=s.string.split("."),p=0;p<n.length;++p)try{var l=c(n[p]);n[p]=l.label,s.error=s.error||l.error}catch(e){s.error=!0}return{string:n.join("."),error:s.error}}e.exports.toASCII=function(e,t,a,n){var i=m(e,t,a),r=i.string.split(".");if(r=r.map(function(e){try{return s.toASCII(e)}catch(t){return i.error=!0,e}}),n){var o=r.slice(0,r.length-1).join(".").length;(o.length>253||0===o.length)&&(i.error=!0);for(var p=0;p<r.length;++p)if(r.length>63||0===r.length){i.error=!0;break}}return i.error?null:r.join(".")},e.exports.toUnicode=function(e,t){var a=m(e,t,i.NONTRANSITIONAL);return{domain:a.string,error:a.error}},e.exports.PROCESSING_OPTIONS=i},6887:(e,t,a)=>{var s,n;e.exports=(s={default:()=>m.default,fileURLToPath:()=>m.fileURLToPath},n={},a.d(n,s),n)},6892:e=>{e.exports.mixin=function(e,t){const a=Object.getOwnPropertyNames(t);for(let s=0;s<a.length;++s)Object.defineProperty(e,a[s],Object.getOwnPropertyDescriptor(t,a[s]))},e.exports.wrapperSymbol=Symbol("wrapper"),e.exports.implSymbol=Symbol("impl"),e.exports.wrapperForImpl=function(t){return t[e.exports.wrapperSymbol]},e.exports.implForWrapper=function(t){return t[e.exports.implSymbol]}},6893:(e,t,a)=>{a.d(t,{D2:()=>u,LITE_MODEL:()=>c,MODEL:()=>l,hy:()=>h,lB:()=>o,oT:()=>m,ub:()=>p});var s=a(4421),n=a(6132);let i=null;function r(){if(!i)try{const e=(0,n.Do)("config.json"),t=(0,s.readFileSync)(e,"utf-8");i=JSON.parse(t)}catch(e){console.error("Failed to load config.json:",e.message),i={models:{defaultModel:{apiKey:"",baseURL:"https://api.openai.com/v1",model:"gpt-4o-mini",provider:"openai"}}}}return i}function o(){const e=r();return e.models?.defaultModel||{apiKey:"",baseURL:"https://api.openai.com/v1",model:"gpt-4o-mini",provider:"openai",maxToken:128e3}}function p(){const e=r();return e.models?.liteModel||o()}function d(){return o().model||"gpt-4o-mini"}function l(){return d()}function c(){return p().model||d()}function m(){return o().maxToken||128e3}function u(){return p().maxToken||16385}function h(){return r().mcpServers||[]}},7075:e=>{e.exports=i("node:stream")},7079:(e,t,a)=>{const s=a(5484);t.implementation=class{constructor(e){const t=e[0],a=e[1];let n=null;if(void 0!==a&&(n=s.basicURLParse(a),"failure"===n))throw new TypeError("Invalid base URL");const i=s.basicURLParse(t,{baseURL:n});if("failure"===i)throw new TypeError("Invalid URL");this._url=i}get href(){return s.serializeURL(this._url)}set href(e){const t=s.basicURLParse(e);if("failure"===t)throw new TypeError("Invalid URL");this._url=t}get origin(){return s.serializeURLOrigin(this._url)}get protocol(){return this._url.scheme+":"}set protocol(e){s.basicURLParse(e+":",{url:this._url,stateOverride:"scheme start"})}get username(){return this._url.username}set username(e){s.cannotHaveAUsernamePasswordPort(this._url)||s.setTheUsername(this._url,e)}get password(){return this._url.password}set password(e){s.cannotHaveAUsernamePasswordPort(this._url)||s.setThePassword(this._url,e)}get host(){const e=this._url;return null===e.host?"":null===e.port?s.serializeHost(e.host):s.serializeHost(e.host)+":"+s.serializeInteger(e.port)}set host(e){this._url.cannotBeABaseURL||s.basicURLParse(e,{url:this._url,stateOverride:"host"})}get hostname(){return null===this._url.host?"":s.serializeHost(this._url.host)}set hostname(e){this._url.cannotBeABaseURL||s.basicURLParse(e,{url:this._url,stateOverride:"hostname"})}get port(){return null===this._url.port?"":s.serializeInteger(this._url.port)}set port(e){s.cannotHaveAUsernamePasswordPort(this._url)||(""===e?this._url.port=null:s.basicURLParse(e,{url:this._url,stateOverride:"port"}))}get pathname(){return this._url.cannotBeABaseURL?this._url.path[0]:0===this._url.path.length?"":"/"+this._url.path.join("/")}set pathname(e){this._url.cannotBeABaseURL||(this._url.path=[],s.basicURLParse(e,{url:this._url,stateOverride:"path start"}))}get search(){return null===this._url.query||""===this._url.query?"":"?"+this._url.query}set search(e){const t=this._url;if(""===e)return void(t.query=null);const a="?"===e[0]?e.substring(1):e;t.query="",s.basicURLParse(a,{url:t,stateOverride:"query"})}get hash(){return null===this._url.fragment||""===this._url.fragment?"":"#"+this._url.fragment}set hash(e){if(""===e)return void(this._url.fragment=null);const t="#"===e[0]?e.substring(1):e;this._url.fragment="",s.basicURLParse(t,{url:this._url,stateOverride:"fragment"})}toJSON(){return this.href}}},7188:(e,t,a)=>{a.a(e,async(e,s)=>{try{a.d(t,{DC:()=>r.DC,Gw:()=>i.Gw,IW:()=>o.IW,Pz:()=>p.Pz,X4:()=>p.X4,bO:()=>n.bO,cZ:()=>o.cZ,dU:()=>d.dU,et:()=>i.et,rQ:()=>d.rQ,tI:()=>n.tI,tY:()=>r.tY});var n=a(8920),i=a(6113),r=a(2701),o=a(4581),p=a(6586),d=a(5886),l=e([o,p]);[o,p]=l.then?(await l)():l,s()}catch(e){s(e)}})},7543:(e,t,a)=>{a.a(e,async(e,s)=>{try{a.d(t,{RL:()=>c});var n=a(8501),i=a(2704),r=a(4421),o=a(2521),p=a(9187),d=e([n,i]);function l(){const e={useLLMDisclosure:!0,useLLMSummary:!0};try{const t=(0,o.join)(process.cwd(),".nium",".env"),a=(0,r.readFileSync)(t,"utf-8").split("\n");for(const t of a)if(t.startsWith("USE_LLM_DISCLOSURE=")){const a=t.split("=")[1]?.trim()||"";(0,p.MD)(`[配置读取] 从 .nium/.env 文件中读取: USE_LLM_DISCLOSURE=${a}`),e.useLLMDisclosure="true"===a.toLowerCase()}else if(t.startsWith("USE_LLM_SUMMARY=")){const a=t.split("=")[1]?.trim()||"";(0,p.MD)(`[配置读取] 从 .nium/.env 文件中读取: USE_LLM_SUMMARY=${a}`),e.useLLMSummary="true"===a.toLowerCase()}}catch(e){(0,p.MD)(`[配置读取] 无法读取 .nium/.env 文件: ${e.message}`)}return void 0!==process.env.USE_LLM_DISCLOSURE&&((0,p.MD)(`[配置读取] 从环境变量中读取: USE_LLM_DISCLOSURE=${process.env.USE_LLM_DISCLOSURE}`),e.useLLMDisclosure="true"===process.env.USE_LLM_DISCLOSURE.toLowerCase()),void 0!==process.env.USE_LLM_SUMMARY&&((0,p.MD)(`[配置读取] 从环境变量中读取: USE_LLM_SUMMARY=${process.env.USE_LLM_SUMMARY}`),e.useLLMSummary="true"===process.env.USE_LLM_SUMMARY.toLowerCase()),e}async function c(){try{const e=l();return(0,p.fH)("[配置读取] 使用主智能体(上下文隔离模式)"),{executeMasterAgent:n.N,MasterAgent:n.e,config:e}}catch(e){throw(0,p.vV)(`[配置读取] 配置读取出错: ${e}`),e}}[n,i]=d.then?(await d)():d,s()}catch(m){s(m)}})},7749:(e,t,a)=>{a.d(t,{O3:()=>r,vS:()=>o});var s=a(4421),n=a(2521);const i=["**/.git/**","**/.svn/**","**/.hg/**","**/node_modules/**","**/vendor/**","**/.pnpm/**","**/bower_components/**","**/dist/**","**/build/**","**/out/**","**/target/**","**/.next/**","**/.nuxt/**","**/.output/**","**/.idea/**","**/.vscode/**","**/.vs/**","**/*.swp","**/*.swo","**/*~","**/.DS_Store","**/Thumbs.db","**/desktop.ini","**/.cache/**","**/tmp/**","**/temp/**","**/__pycache__/**","**/*.pyc","**/.pytest_cache/**","**/*.log","**/logs/**","**/.nium/archives/**","**/.nium/session.json","**/package-lock.json","**/yarn.lock","**/pnpm-lock.yaml","**/Gemfile.lock","**/Pipfile.lock","**/poetry.lock","**/Cargo.lock"];function r(e){const t=(0,n.resolve)(e,".niumignore"),a=[];if((0,s.existsSync)(t))try{(0,s.readFileSync)(t,"utf-8").split("\n").forEach(e=>{const t=e.trim();t&&!t.startsWith("#")&&a.push(function(e){if(e.startsWith("!")){const t=e.slice(1);return t.includes("/")||t.includes("\\")?e:`!**/${t}`}return e.includes("*")||e.includes("?")||e.includes("{")||e.includes("[")?e:e.endsWith("/")?`**/${e.slice(0,-1)}/**`:e.startsWith("*.")||e.includes("/")||e.includes("\\")?e:`**/${e}/**`}(t))})}catch(e){console.warn(`Error reading .niumignore file: ${e instanceof Error?e.message:"Unknown error"}`)}return a}function o(e,t=!0){const a=r(e);return t?[...i,...a]:a}},7830:e=>{e.exports=i("node:stream/web")},7968:(e,t,a)=>{a.a(e,async(e,s)=>{try{a.d(t,{e:()=>m,executePlanTask:()=>u,resumePlanTask:()=>h});var n=a(4237),i=a(5283),r=a(9011),o=a(9440),p=a(3521),d=e([i,r]);[i,r]=d.then?(await d)():d;class l{startTime;stepStartTime=null;constructor(){this.startTime=Date.now()}showTaskStart(e,t,a=1){const s=" ".repeat(a-1);console.log(""),console.log(n.Ay.cyan(`${s}╔${"═".repeat(58-2*a)}╗`)),console.log(n.Ay.cyan(`${s}║`)+n.Ay.bold.white(" 🚀 开始执行任务计划")+n.Ay.cyan(` (共${t}步)`.padEnd(58-2*a-13))+n.Ay.cyan("║")),console.log(n.Ay.cyan(`${s}╚${"═".repeat(58-2*a)}╝`)),console.log("")}showStepProgress(e,t,a,s=1){this.stepStartTime=Date.now();const i=" ".repeat(s-1),r=Math.round(e/t*100),o=this.createProgressBar(r,30);console.log(""),console.log(n.Ay.blue(`${i}┌${"─".repeat(58-2*s)}┐`)),console.log(n.Ay.blue(`${i}│`)+` 步骤 ${e}/${t} (${r}%)`.padEnd(60-2*s)+n.Ay.blue("│")),console.log(n.Ay.blue(`${i}│`)+` ${o}`.padEnd(60-2*s)+n.Ay.blue("│")),console.log(n.Ay.blue(`${i}│`)+n.Ay.cyan(` 📌 ${a.description}`.substring(0,58-2*s)).padEnd(60-2*s)+n.Ay.blue("│")),console.log(n.Ay.blue(`${i}│`)+n.Ay.gray(` 🤖 智能体: ${a.subAgent}`.substring(0,58-2*s)).padEnd(60-2*s)+n.Ay.blue("│")),console.log(n.Ay.blue(`${i}└${"─".repeat(58-2*s)}┘`)),console.log("")}showStepComplete(e,t,a,s=1){const i=" ".repeat(s-1),r=this.stepStartTime?this.formatDuration(Date.now()-this.stepStartTime):"";Math.round(e/t*100),console.log(n.Ay.green(`${i}✅ 步骤 ${e}/${t} 完成`)+n.Ay.gray(` (${r})`)),console.log("")}showTaskComplete(e,t,a=1){const s=" ".repeat(a-1),i=this.formatDuration(Date.now()-this.startTime),r=Math.round(e/t*100);console.log(""),console.log(n.Ay.green(`${s}╔${"═".repeat(58-2*a)}╗`)),console.log(n.Ay.green(`${s}║`)+n.Ay.bold.white(" 🎉 任务执行完成!")+n.Ay.green("".padEnd(58-2*a-12))+n.Ay.green("║")),console.log(n.Ay.green(`${s}║`)+` 完成进度: ${e}/${t} (${r}%)`.padEnd(60-2*a)+n.Ay.green("║")),console.log(n.Ay.green(`${s}║`)+` 总耗时: ${i}`.padEnd(60-2*a)+n.Ay.green("║")),console.log(n.Ay.green(`${s}╚${"═".repeat(58-2*a)}╝`)),console.log("")}showStepError(e,t,a,s=1){const i=" ".repeat(s-1);console.log(""),console.log(n.Ay.red(`${i}❌ 步骤 ${e}/${t} 执行失败`)),console.log(n.Ay.red(`${i} 错误: ${a.substring(0,100)}`)),console.log("")}createProgressBar(e,t=30){const a=Math.round(e/100*t),s=t-a;return`${n.Ay.green("█".repeat(a))+n.Ay.gray("░".repeat(s))} ${e}%`}formatDuration(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${(e%6e4/1e3).toFixed(0)}s`}}let c=null;function m(e){c=e}async function u(e,t=1,a={}){const s=new p.SE,d=new p.bT(s),m=new p.jp(s,d),u=new p.jT,h=(0,r.getSubAgentManager)(),w={useLLMDisclosure:void 0===a.useLLMDisclosure||a.useLLMDisclosure,useLLMSummary:void 0===a.useLLMSummary||a.useLLMSummary,verbose:a.verbose||!1},b=e=>{c?c.log(e):console.log(e)},_=e=>{c?c.info(e):console.log(n.Ay.blue(e))},S=e=>{c?c.success(e):console.log(n.Ay.green(e))},T=e=>{c?c.warning(e):console.log(n.Ay.yellow(e))},k=e=>{c?c.error(e):console.log(n.Ay.red(e))},x=" ".repeat(t-1),C=new l;try{b(""),b(`${x}${"═".repeat(60-2*t)}`),_(`${x}📋 开始规划任务 (嵌套层级: ${t})`),b(`${x}${"═".repeat(60-2*t)}`),b("");const a=h.getAllSubAgents(),n=await(0,i.generateTaskPlan)(e,a);s.initializeTask(e,n),n.taskId&&(0,o.O6)(n.taskId),b(f((0,i.Fj)(n),t)),b(""),C.showTaskStart(e,n.tasks.length,t);for(let e=0;e<n.tasks.length;e++){const a=n.tasks[e],r=a.step;C.showStepProgress(r,n.tasks.length,a,t),s.plan.currentStep=r,n.taskId&&await(0,i.updateTaskStatus)(n.taskId,r,"in_progress");try{const e=g(a,h),o=await m.buildIsolatedContext(r,a.description,e?.prompt||"",w.useLLMDisclosure);e?await y(r,a.description,e,o,s,u,h,w,{log:b,info:_,success:S,warning:T,error:k}):await v(a.description,o,0,{log:b,info:_}),C.showStepComplete(r,n.tasks.length,a,t),n.taskId&&await(0,i.updateTaskStatus)(n.taskId,r,"completed")}catch(e){const a=e instanceof Error?e.message:String(e);throw C.showStepError(r,n.tasks.length,a,t),T(`${x}中止后续步骤执行`),s.recordStepCompletion(r,`失败: ${a}`,{success:!1,error:a}),e}}return C.showTaskComplete(n.tasks.length,n.tasks.length,t),(0,o.C3)(),{success:!0,taskId:n.taskId,completedSteps:n.tasks.length,plan:n,planMarkdown:n.markdown,tasks:n.tasks}}catch(e){throw(0,o.C3)(),k(`${x}❌ 规划任务执行失败: ${e instanceof Error?e.message:String(e)}`),e}}async function h(e,t=0,s={}){const{loadTaskPlan:i}=await Promise.resolve().then(a.bind(a,5283)),d=i(e);if(!d)throw new Error(`无法加载任务计划: ${e}`);console.log(n.Ay.cyan(`[任务恢复] 正在恢复任务: ${e}`)),console.log(n.Ay.gray(`从步骤 ${t||1} 开始执行`));const m=new p.SE,u=new p.bT(m),h=new p.jp(m,u),f=new p.jT,w=(0,r.getSubAgentManager)(),b={useLLMDisclosure:void 0===s.useLLMDisclosure||s.useLLMDisclosure,useLLMSummary:void 0===s.useLLMSummary||s.useLLMSummary,verbose:s.verbose||!1},_=e=>{c?c.log(e):console.log(e)},S=e=>{c?c.info(e):console.log(n.Ay.blue(e))},T=e=>{c?c.success(e):console.log(n.Ay.green(e))},k=e=>{c?c.warning(e):console.log(n.Ay.yellow(e))},x=e=>{c?c.error(e):console.log(n.Ay.red(e))},C=new l;try{m.initializeTask(d.taskId,d),d.taskId&&(0,o.O6)(d.taskId),_(""),_(n.Ay.cyan("═".repeat(60))),S("📋 恢复任务执行"),_(n.Ay.cyan("═".repeat(60))),_(""),C.showTaskStart(d.taskId,d.tasks.length,1);const e=t>0?t-1:0;for(let t=e;t<d.tasks.length;t++){const e=d.tasks[t],s=e.step;if(C.showStepProgress(s,d.tasks.length,e,1),m.plan.currentStep=s,d.taskId){const{updateTaskStatus:e}=await Promise.resolve().then(a.bind(a,5283));await e(d.taskId,s,"in_progress")}try{const t=g(e,w),n=await h.buildIsolatedContext(s,e.description,t?.prompt||"",b.useLLMDisclosure);if(t?await y(s,e.description,t,n,m,f,w,b,{log:_,info:S,success:T,warning:k,error:x}):await v(e.description,n,0,{log:_,info:S}),C.showStepComplete(s,d.tasks.length,e,1),d.taskId){const{updateTaskStatus:e}=await Promise.resolve().then(a.bind(a,5283));await e(d.taskId,s,"completed")}}catch(e){const t=e instanceof Error?e.message:String(e);throw C.showStepError(s,d.tasks.length,t,1),k("中止后续步骤执行"),m.recordStepCompletion(s,`失败: ${t}`,{success:!1,error:t}),e}}return C.showTaskComplete(d.tasks.length,d.tasks.length,1),(0,o.C3)(),{success:!0,taskId:d.taskId,completedSteps:d.tasks.length-e,resumedFrom:t||1}}catch(e){throw(0,o.C3)(),x(`❌ 任务恢复执行失败: ${e instanceof Error?e.message:String(e)}`),e}}function f(e,t){return t<=1?e:e.split("\n").map(e=>{if(e.trim().startsWith("#")){const a=e.match(/^#+/)?.[0].length||0,s=Math.min(a+t-1,6),n="#".repeat(s);return e.replace(/^#+/,n)}return e}).join("\n")}function g(e,t){return e.subAgent&&"default"!==e.subAgent?t.getSubAgent(e.subAgent):null}async function y(e,t,s,i,r,o,p,d,l){const{log:m,info:u,error:h}=l,f=Date.now();u(`🔧 使用子智能体: ${s.name}`),m(n.Ay.gray(`描述: ${s.description}`)),m("");try{if(s.builtin){const{handlerMap:t}=await Promise.resolve().then(a.bind(a,8936));if(t[s.handler]){const a=await t[s.handler](c),n="string"==typeof a?a.substring(0,200):"内置代理执行完成";r.recordStepCompletion(e,n,{success:!0,builtin:!0,handler:s.handler});const i=Date.now()-f;return void p.recordAgentPerformance(s.name,!0,i)}}const{SYSTEM_PROMPT:n}=await Promise.resolve().then(a.bind(a,1327)),m=[{role:"system",content:n},...i.filter(e=>"system"!==e.role),...i.filter(e=>"system"===e.role&&e!==i[0])],u=await w(m,t,l);await b(e,u,r,o,d,l);const h=Date.now()-f;p.recordAgentPerformance(s.name,!0,h)}catch(e){const t=Date.now()-f;throw p.recordAgentPerformance(s.name,!1,t),e}}async function v(e,t,s,n){const{log:i,info:r}=n;r("🤖 使用默认React智能体"),i("");const{SYSTEM_PROMPT:o}=await Promise.resolve().then(a.bind(a,1327)),p=[{role:"system",content:o},...t.filter(e=>"system"!==e.role),...t.filter(e=>"system"===e.role)];await w(p,e,n)}async function w(e,t,s){const{log:i,error:r}=s,{MODEL:o}=await Promise.resolve().then(a.bind(a,6893)),{callModelAPI:p}=await Promise.resolve().then(a.bind(a,8736)),{isThinkTool:d,extractThought:l}=await Promise.resolve().then(a.bind(a,8920)),{getToolDefinitions:c}=await Promise.resolve().then(a.bind(a,4239)),{tools:m,toolInstances:u,extractToolResult:h}=await Promise.resolve().then(a.bind(a,5401)),{saveSession:f}=await Promise.resolve().then(a.bind(a,9440)),g=[...e];let y=0;for(;y<50;){y++;try{f(g,t);const e=await p({model:o(),messages:g,temperature:.1,tools:c()}),a=e.choices[0].message.tool_calls;if("stop"===e.choices[0].finish_reason){const{content:t}=e.choices[0].message;t&&t.trim()&&(i(n.Ay.green("任务完成:")),i(t),i(""));break}if(!a||0===a.length){const{content:t}=e.choices[0].message;t&&t.trim()&&(i(n.Ay.yellow(t)),i(""));continue}const s=a[0],y=s.function.name;let v;try{v=JSON.parse(s.function.arguments)}catch(e){r(`解析工具参数失败: ${s.function.arguments}`),g.push({role:"assistant",content:null,tool_calls:[s]}),g.push({role:"tool",tool_call_id:s.id,content:"Error: Invalid JSON arguments"});continue}if(d(y)){const e=l(s);e&&(i(n.Ay.cyan(`💭 Think: ${e}`)),i("")),g.push({role:"assistant",content:null,tool_calls:[s]}),g.push({role:"tool",tool_call_id:s.id,content:"Noted. Continue with your action."});continue}if(!m[y]){const e=`Error: Unknown tool '${y}'`;r(e),g.push({role:"assistant",content:null,tool_calls:[s]}),g.push({role:"tool",tool_call_id:s.id,content:e});continue}const w=c().find(e=>e.name===y);let b;if(w&&w.input_schema&&w.input_schema.properties){b=Object.keys(w.input_schema.properties).map(e=>v[e]);const e=(w.input_schema.required||[]).filter(e=>void 0===v[e]);if(e.length>0){const t=`Error: Missing required parameters: ${e.join(", ")}`;r(t),g.push({role:"assistant",content:null,tool_calls:[s]}),g.push({role:"tool",tool_call_id:s.id,content:t});continue}}else b=Object.values(v);const _=u[y],S=_?_.formatAction(v):`${y}()`;i(n.Ay.blue(`🔧 行动: ${S}`)),i("");const T=await m[y](...b),k=h(T),x=!_||_.shouldPrintObservation(T),C=_?_.formatObservation(T):String(T);x&&(i(n.Ay.yellow(`📊 观察: ${C}`)),i("")),g.push({role:"assistant",content:null,tool_calls:[s]}),g.push({role:"tool",tool_call_id:s.id,content:String(k)}),f(g,t)}catch(e){throw r(`错误: ${e.message}`),f(g,t),e}}if(y>=50)throw r("错误: 已达到最大迭代次数"),f(g,t),new Error("Maximum iterations reached");return g}async function b(e,t,a,s,i,r){const{info:o,log:p}=r;let d;d=i.useLLMSummary?await s.extractSummaryWithLLM(t):await s.extractSummary(t);const l=s.extractMetadata(t);l.success=!0,a.recordStepCompletion(e,d,l),i.verbose&&(o(`步骤 ${e} 摘要已记录到全局上下文`),p(""),p(n.Ay.gray("─── 步骤执行摘要 ───")),p(n.Ay.gray(`摘要: ${d}`)),p(n.Ay.gray(`工具: ${l.toolsUsed.join(", ")}`)),p(n.Ay.gray(`文件: ${l.filesAccessed.join(", ")}`)),p(n.Ay.gray(`迭代: ${l.iterations} 次`)))}s()}catch(_){s(_)}})},8116:(e,t,a)=>{var s,n;e.exports=(s={platform:()=>u.platform,tmpdir:()=>u.tmpdir},n={},a.d(n,s),n)},8125:e=>{e.exports={CURRENT_ID:Symbol("agentkeepalive#currentId"),CREATE_ID:Symbol("agentkeepalive#createId"),INIT_SOCKET:Symbol("agentkeepalive#initSocket"),CREATE_HTTPS_CONNECTION:Symbol("agentkeepalive#createHttpsConnection"),SOCKET_CREATED_TIME:Symbol("agentkeepalive#socketCreatedTime"),SOCKET_NAME:Symbol("agentkeepalive#socketName"),SOCKET_REQUEST_COUNT:Symbol("agentkeepalive#socketRequestCount"),SOCKET_REQUEST_FINISHED_COUNT:Symbol("agentkeepalive#socketRequestFinishedCount")}},8321:(e,t,a)=>{a.a(e,async(e,t)=>{try{var s=a(4673),n=e([s]),i=n.then?(await n)():n;async function r(){try{const e=process.argv.slice(2).includes("--debug"),t=new s.J({debug:e});await t.start()}catch(e){console.error("启动应用时出错:",e.message),process.exit(1)}}s=i[0],r(),t()}catch(o){t(o)}})},8501:(e,t,a)=>{a.a(e,async(e,s)=>{try{a.d(t,{N:()=>g,e:()=>f});var n=a(4237),i=a(9011),r=a(5283),o=a(2704),p=a(1327),d=a(9440),l=a(8936),c=a(9187),m=a(3521),u=a(7968),h=e([i,r,o,p,u]);[i,r,o,p,u]=h.then?(await h)():h;class f{session;subAgentManager;orchestratorContext;progressiveDisclosure;workerContextBuilder;summaryExtractor;options;constructor(e=null,t={}){this.session=e,(0,u.e)(e);const a={matchStrategy:t.matchStrategy};this.subAgentManager=(0,i.getSubAgentManager)(a),this.orchestratorContext=new m.SE,this.progressiveDisclosure=new m.bT(this.orchestratorContext),this.workerContextBuilder=new m.jp(this.orchestratorContext,this.progressiveDisclosure),this.summaryExtractor=new m.jT,this.options={useLLMDisclosure:void 0===t.useLLMDisclosure||t.useLLMDisclosure,useLLMSummary:void 0===t.useLLMSummary||t.useLLMSummary,verbose:t.verbose||!1}}log(e){this.session?this.session.log(e):console.log(e)}info(e){this.session?this.session.info(e):console.log(n.Ay.blue(e))}success(e){this.session?this.session.success(e):console.log(n.Ay.green(e))}warning(e){this.session?this.session.warning(e):console.log(n.Ay.yellow(e))}error(e){this.session?this.session.error(e):console.log(n.Ay.red(e))}async executeTask(e,t=!1){try{if((0,c.MD)("MasterAgent.executeTask called"),t)return(0,c.MD)("Entering resume session mode"),this.info("恢复会话模式"),void await(0,o.e)(e,!0,this.session);await this.executeWithSingleAgent(e),this.log(""),this.success("✅ 任务执行完成"),this.options.verbose&&(this.log(""),this.log(n.Ay.gray("═══ 全局上下文摘要 ═══")),this.log(n.Ay.gray(JSON.stringify(this.orchestratorContext.getCompactSummary(),null,2))))}catch(e){throw this.error(`❌ 任务执行失败: ${e.message}`),e}}async executeWithSingleAgent(e){const t=await this.subAgentManager.matchSubAgent(e);if(t){this.info(`匹配到专用子智能体: ${t.name}`),this.log("");const a=this.workerContextBuilder.buildSimpleContext(e,t.prompt);await this.executeSubAgentTask(1,e,t,a)}else this.info("使用默认React智能体"),this.log(""),await(0,o.e)(e,!1,this.session)}async executeWithPlanning(e){const t=this.subAgentManager.getAllSubAgents(),a=await(0,r.generateTaskPlan)(e,t);this.orchestratorContext.initializeTask(e,a),a.taskId&&(0,d.O6)(a.taskId),this.log((0,r.Fj)(a)),this.log(""),await this.ensureProjectStructure(),await this.loadProjectRules(),this.analyzeStepDependencies(a);for(let e=0;e<a.tasks.length;e++){const t=a.tasks[e],s=t.step;this.log(""),this.info(`━━━ 执行步骤 ${s}/${a.tasks.length} ━━━`),this.log(n.Ay.cyan(`📌 ${t.description}`)),this.log(""),this.orchestratorContext.plan.currentStep=s,a.taskId&&await(0,r.updateTaskStatus)(a.taskId,s,"in_progress");try{const e=this.getSubAgentConfig(t),i=await this.workerContextBuilder.buildIsolatedContext(s,t.description,e?.prompt||"",this.options.useLLMDisclosure);this.options.verbose&&this.log(n.Ay.gray(`上下文大小: ${i.length} 条消息`)),e?await this.executeSubAgentTask(s,t.description,e,i):await this.executeDefaultAgentWithContext(t.description,i),this.success(`✅ 步骤 ${s} 完成`),a.taskId&&await(0,r.updateTaskStatus)(a.taskId,s,"completed")}catch(e){throw this.error(`❌ 步骤 ${s} 执行失败: ${e.message}`),this.warning("中止后续步骤执行"),this.orchestratorContext.recordStepCompletion(s,`失败: ${e.message}`,{success:!1,error:e.message}),e}}}async ensureProjectStructure(){try{const{existsSync:e}=await Promise.resolve().then(a.bind(a,4421));if(e(".nium/docs/PROJECT_STRUCTURE.md"))return void(0,c.MD)("PROJECT_STRUCTURE.md 已存在,跳过自动生成");this.log(""),this.info("📋 检测到项目结构文档不存在,执行快速扫描..."),this.log("");const{tools:t}=await Promise.resolve().then(a.bind(a,5401));await t.quickProjectScan(),this.success("✅ 项目结构文档已生成"),this.log(""),(0,c.fH)("已自动生成 PROJECT_STRUCTURE.md")}catch(e){(0,c.MD)(`自动生成项目结构文档失败: ${e.message}`),this.warning("项目结构文档生成失败,将继续执行任务")}}async loadProjectRules(){try{const{tools:e,toolInstances:t,extractToolResult:s}=await Promise.resolve().then(a.bind(a,5401));let n="";const i=".nium/rules.md",r=e.read(i);r&&!r.includes("Error:")&&(n+=r,(0,c.fH)("已加载项目规则文件"));const o=".nium/docs/PROJECT_STRUCTURE.md",p=e.read(o);p&&!p.includes("Error:")&&(n&&(n+="\n\n---\n\n"),n+="# 项目结构信息\n\n",n+=p,(0,c.fH)("已加载项目结构文档")),n&&this.orchestratorContext.updateSharedState("rules",n)}catch(e){(0,c.MD)("加载项目文档时出错,跳过")}}analyzeStepDependencies(e){for(let t=0;t<e.tasks.length;t++){const a=e.tasks[t].step,s=t>0?[e.tasks[t-1].step]:[];this.orchestratorContext.setStepDependencies(a,s)}(0,c.MD)("步骤依赖关系已分析")}getSubAgentConfig(e){return e.subAgent&&"default"!==e.subAgent?this.subAgentManager.getSubAgent(e.subAgent):null}async executeSubAgentTask(e,t,a,s){const i=Date.now();this.info(`🔧 使用子智能体: ${a.name}`),this.log(n.Ay.gray(`描述: ${a.description}`)),this.log("");try{if(a.builtin&&l.handlerMap[a.handler]){await this.executeBuiltinAgent(e,a.handler,t);const s=Date.now()-i;return void this.subAgentManager.recordAgentPerformance(a.name,!0,s)}const n=[{role:"system",content:p.SYSTEM_PROMPT},...s.filter(e=>"system"!==e.role),...s.filter(e=>"system"===e.role&&e!==s[0])],r=await this.runWorkerLoop(n,t);await this.recordWorkerResult(e,r);const o=Date.now()-i;this.subAgentManager.recordAgentPerformance(a.name,!0,o)}catch(e){const t=Date.now()-i;throw this.subAgentManager.recordAgentPerformance(a.name,!1,t),e}}async executeBuiltinAgent(e,t,a){this.info(`执行内置代理处理器: ${t}`);const s=await l.handlerMap[t](this.session),n="string"==typeof s?s.substring(0,200):"内置代理执行完成";this.orchestratorContext.recordStepCompletion(e,n,{success:!0,builtin:!0,handler:t})}async executeDefaultAgentWithContext(e,t){this.info("🤖 使用默认React智能体"),this.log("");const a=[{role:"system",content:p.SYSTEM_PROMPT},...t.filter(e=>"system"!==e.role),...t.filter(e=>"system"===e.role)];await this.runWorkerLoop(a,e)}async runWorkerLoop(e,t){const{MODEL:s}=await Promise.resolve().then(a.bind(a,6893)),{callModelAPI:i}=await Promise.resolve().then(a.bind(a,8736)),{isThinkTool:r,extractThought:o}=await Promise.resolve().then(a.bind(a,8920)),{getToolDefinitions:p}=await Promise.resolve().then(a.bind(a,4239)),{tools:l,toolInstances:c,extractToolResult:m}=await Promise.resolve().then(a.bind(a,5401)),u=[...e];let h=0;for(;h<50;){h++;try{(0,d.saveSession)(u,t);const e=await i({model:s(),messages:u,temperature:.1,tools:p()}),a=e.choices[0].message.tool_calls;if("stop"===e.choices[0].finish_reason){const{content:t}=e.choices[0].message;t&&t.trim()&&(this.log(n.Ay.green("任务完成:")),this.log(t),this.log(""));break}if(!a||0===a.length){const{content:t}=e.choices[0].message;t&&t.trim()&&(this.log(n.Ay.yellow(t)),this.log(""));continue}const h=a[0],f=h.function.name;let g;try{g=JSON.parse(h.function.arguments),this.log(n.Ay.gray(`[DEBUG] Tool: ${f}`)),this.log(n.Ay.gray(`[DEBUG] Raw arguments: ${h.function.arguments.substring(0,200)}${h.function.arguments.length>200?"...":""}`)),this.log(n.Ay.gray(`[DEBUG] Parsed keys: ${Object.keys(g).join(", ")}`)),this.log("")}catch(e){this.error(`解析工具参数失败: ${h.function.arguments}`),u.push({role:"assistant",content:null,tool_calls:[h]}),u.push({role:"tool",tool_call_id:h.id,content:"Error: Invalid JSON arguments"});continue}if(r(f)){const e=o(h);e&&(this.log(n.Ay.cyan(`💭 Think: ${e}`)),this.log("")),u.push({role:"assistant",content:null,tool_calls:[h]}),u.push({role:"tool",tool_call_id:h.id,content:"Noted. Continue with your action."});continue}if(!l[f]){const e=`Error: Unknown tool '${f}'`;this.error(e),u.push({role:"assistant",content:null,tool_calls:[h]}),u.push({role:"tool",tool_call_id:h.id,content:e});continue}const y=p().find(e=>e.name===f);let v;if(y&&y.input_schema&&y.input_schema.properties){v=Object.keys(y.input_schema.properties).map(e=>g[e]);const e=y.input_schema.required||[],t=e.filter(e=>void 0===g[e]);if(t.length>0){const a=`Error: Missing required parameters: ${t.join(", ")}\n\nTool: ${f}\nRequired parameters: ${e.join(", ")}\nProvided parameters: ${Object.keys(g).join(", ")||"none"}\n\nPlease call the tool again with ALL required parameters.`;this.error(a),u.push({role:"assistant",content:null,tool_calls:[h]}),u.push({role:"tool",tool_call_id:h.id,content:a});continue}}else v=Object.values(g);const w=c[f],b=w?w.formatAction(g):`${f}()`;this.log(n.Ay.blue(`🔧 行动: ${b}`)),this.log("");const _=await l[f](...v),S=m(_),T=!w||w.shouldPrintObservation(_),k=w?w.formatObservation(_):String(_);T&&(this.log(n.Ay.yellow(`📊 观察: ${k}`)),this.log("")),u.push({role:"assistant",content:null,tool_calls:[h]}),u.push({role:"tool",tool_call_id:h.id,content:String(S)}),["read","write","merge"].includes(f)&&v[0]&&this.orchestratorContext.addRecentFile(v[0]),(0,d.saveSession)(u,t)}catch(e){throw this.error(`错误: ${e.message}`),(0,d.saveSession)(u,t),e}}if(h>=50)throw this.error("错误: 已达到最大迭代次数"),(0,d.saveSession)(u,t),new Error("Maximum iterations reached");return u}async recordWorkerResult(e,t){let a;a=this.options.useLLMSummary?await this.summaryExtractor.extractSummaryWithLLM(t):await this.summaryExtractor.extractSummary(t);const s=this.summaryExtractor.extractMetadata(t);s.success=!0,this.orchestratorContext.recordStepCompletion(e,a,s),this.options.verbose&&this.info(`步骤 ${e} 摘要已记录到全局上下文`),this.options.verbose&&(this.log(""),this.log(n.Ay.gray("─── 步骤执行摘要 ───")),this.log(n.Ay.gray(`摘要: ${a}`)),this.log(n.Ay.gray(`工具: ${s.toolsUsed.join(", ")}`)),this.log(n.Ay.gray(`文件: ${s.filesAccessed.join(", ")}`)),this.log(n.Ay.gray(`迭代: ${s.iterations} 次`)))}}async function g(e,t=!1,a=null,s={}){const n=new f(a,s);await n.executeTask(e,t)}s()}catch(y){s(y)}})},8736:(e,t,a)=>{a.a(e,async(e,s)=>{try{a.d(t,{callModelAPI:()=>h});var n=a(6893),i=a(2952),r=a(9440),o=a(4239),p=a(9187),d=a(5955),l=a(9356),c=a(4237),m=e([o]),u=m.then?(await m)():m;async function h(e){const{model:t=(e.useCompression?(0,n.LITE_MODEL)():(0,n.MODEL)()),messages:a,temperature:s=.1,max_tokens:m,useCompression:u=!1,tools:f=(0,o.getToolDefinitions)(),tool_choice:g,compressionOptions:y,enableAutoCompression:v=!0}=e,w=u?await i.E.getLiteProvider():await i.E.getProvider();(0,p.MD)(`模型调用配置: useCompression=${u}, 模型=${t}, provider=${w.getProviderType()}`),u?(0,p.MD)(`正在使用轻量模型: ${t}`):(0,p.MD)(`正在使用默认模型: ${t}`),(0,p.MD)(`工具数量: ${f?f.length:0}`);const b=u?(0,n.D2)():(0,n.oT)();let _=a,S=(0,d.au)(_),T=(0,d.WA)(S,b);const k=e=>(e/1e3).toFixed(1)+"k";if((0,p.fH)(`使用模型: ${t}, Token usage: ${k(S)} / ${k(b)} (${T.toFixed(1)}%)`),r.Ck.currentTaskId){const e=r.Ck.tasks.find(e=>e.id===r.Ck.currentTaskId);e&&(e.tokenCount=(e.tokenCount||0)+S)}if(v&&(0,d.SZ)(S,b,80)){const e=(0,d.Lq)(S,b,T);(0,p.JE)(e),console.log(c.Ay.yellow(`\n${e}`)),console.log(c.Ay.cyan("🔄 正在自动压缩上下文...\n"));const t=new l.J(y);if(t.shouldCompress(_,b))try{const{messages:e,stats:a}=await t.compress(_,b,h);_=e,S=a.compressedTokenCount,T=(0,d.WA)(S,b),(0,p.fH)(`压缩后Token使用: ${S} / ${b} (${T.toFixed(1)}%)`)}catch(e){(0,p.JE)(`上下文压缩失败: ${e instanceof Error?e.message:String(e)}`),console.log(c.Ay.yellow("⚠️ 上下文压缩失败,将使用原始消息继续执行\n"))}else(0,p.MD)("当前不满足压缩条件,跳过压缩")}else if((0,d.SZ)(S,b,80)){const e=(0,d.Lq)(S,b,T);(0,p.JE)(e),console.log(c.Ay.yellow(`\n${e}`)),console.log(c.Ay.yellow("Consider archiving old messages or starting a new session.\n"))}let x;(0,p.MD)(`模型请求: ${JSON.stringify({model:t,temperature:s,max_tokens:m,messages:_.length>0?`[${_[0].role}, ..., ${_[_.length-1].role}]`:"[]",tools:f?f.length:0})}`);try{x=await w.callModel({model:t,messages:_,temperature:s,max_tokens:m,tools:f,tool_choice:g})}catch(e){throw(0,p.vV)(`调用模型API时发生错误: ${e instanceof Error?e.message:String(e)}`),e instanceof Error&&e.stack&&(0,p.MD)(`错误堆栈: ${e.stack}`),e}if(!x)throw(0,p.vV)("模型返回 undefined 或 null"),new Error("模型API返回空响应");if(!x.choices)throw(0,p.vV)(`模型返回缺少choices字段: ${JSON.stringify(x)}`),new Error("模型API返回的响应缺少choices字段");if(!Array.isArray(x.choices)||0===x.choices.length)throw(0,p.vV)(`模型返回空的choices数组: ${JSON.stringify(x)}`),new Error("模型API返回的choices为空");return(0,p.MD)(`模型返回: ${JSON.stringify(x)}`),x}o=u[0],s()}catch(f){s(f)}})},8743:(e,t,a)=>{a.a(e,async(e,s)=>{try{a.d(t,{KG:()=>m,T2:()=>c,kX:()=>u});var n=a(5401),i=a(1646),r=a(9187),o=e([n,i]);[n,i]=o.then?(await o)():o;let p={},d={},l=!1;async function c(){if(l)return void(0,r.MD)("Tools already loaded, skipping");(0,r.fH)("Loading tools..."),p={...n.toolInstances},d={...n.tools};const e=Object.keys(n.toolInstances);(0,r.fH)(`Loaded ${e.length} local tools`);const t=(0,i.st)().getAllTools();if(0===t.length)return(0,r.MD)("No MCP tools available"),void(l=!0);const a=(0,i.jW)(t),s=(0,i.a$)(t);let o=0,c=0;for(const[e,t]of Object.entries(a))p[e]?((0,r.MD)(`Skipping MCP tool ${e} (local tool has priority)`),c++):(p[e]=t,d[e]=s[e],o++);(0,r.fH)(`Added ${o} MCP tools, skipped ${c} (local priority)`),(0,r.fH)(`Total tools available: ${Object.keys(p).length}`),l=!0}function m(){return p}function u(){const e=Object.keys(n.toolInstances),t=Object.keys(p),a=t.filter(t=>!e.includes(t));return{local:e.length,mcp:a.length,total:t.length,localTools:e,mcpTools:a}}s()}catch(h){s(h)}})},8857:(e,t,a)=>{a.d(t,{Px:()=>s.Px});var s=a(1967)},8920:(e,t,a)=>{a.d(t,{bO:()=>r,extractThought:()=>d,isThinkTool:()=>p,tI:()=>o});var s=a(1967);class n extends s.oS{getDefinition(){return{name:"think",description:"Use this tool to think, reason, and reflect before taking actions.\nThis is a zero-side-effect tool that makes your thinking process observable.\n\nIMPORTANT: You should call this tool:\n- BEFORE calling any other tool (to plan your action)\n- AFTER receiving an Observation (to reflect on the result)\n- When you need to analyze complex situations\n\nThe thought content will be logged but won't change any data or state.",input_schema:{type:"object",properties:{thought:{type:"string",description:"Your internal reasoning, analysis, or reflection. Be detailed and explicit about your thought process."}},required:["thought"]}}}execute(e){return"Noted. Continue with your action."}}const i=new n;function r(e){return i.execute({thought:e})}const o=i;function p(e){return"think"===e}function d(e){if(!e||!e.function)return null;if("think"!==e.function.name)return null;try{return JSON.parse(e.function.arguments).thought||null}catch(e){return null}}i.getDefinition()},8936:(e,t,a)=>{a.d(t,{B7:()=>l,JO:()=>c,handlerMap:()=>d});var s=a(4421),n=a(2521);const i=(0,a(6887).fileURLToPath)("file:///E:/workspace/nium-coder/src/agent/builtin-agents/index.ts"),r=(0,n.dirname)(i);function o(e){const t=e.match(/^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/);if(!t)throw new Error("无效的 frontmatter 格式");const[,a,s]=t,n={},i=a.split("\n");for(const e of i){const t=e.trim();if(!t)continue;const a=t.match(/^(\w+)\s*[::]\s*(.+)$/);if(a){const[,e,t]=a;"keywords"===e?n.keywords=t.split(/[,,]/).map(e=>e.trim()).filter(e=>e):"builtin"===e?n.builtin="true"===t.toLowerCase():n[e]=t.trim()}}return n.prompt=s.trim(),n}const p=function(){const e=[(0,n.join)(r,"configs"),(0,n.join)(r,"src/agent/builtin-agents/configs")];let t="";for(const a of e)try{(0,s.readdirSync)(a),t=a;break}catch{}const a={};if(!t)return console.error("读取内置代理配置目录失败: 无法找到 configs 目录"),console.error("尝试的路径:",e),console.error("__dirname:",r),a;try{const e=(0,s.readdirSync)(t).filter(e=>e.endsWith(".md")&&!e.toLowerCase().includes("readme"));for(const i of e)try{const e=(0,n.join)(t,i),r=o((0,s.readFileSync)(e,"utf-8"));r.name&&(a[r.name]=r)}catch(e){console.error(`加载内置代理配置 ${i} 失败:`,e.message)}}catch(e){console.error("读取内置代理配置目录失败:",e.message)}return a}(),d={};function l(){return Object.values(p)}function c(e){return e in p}},9011:(e,t,a)=>{a.a(e,async(e,s)=>{try{a.d(t,{getSubAgentManager:()=>f});var n=a(4421),i=a(2521),r=a(4237),o=a(6132),p=a(8936),d=a(6893),l=a(8736),c=a(1327),m=e([l,c]);[l,c]=m.then?(await m)():m;class u{subAgents;agentPerformance;matchStrategy;constructor(e={}){this.subAgents=new Map,this.agentPerformance=new Map,this.matchStrategy=e.matchStrategy||"hybrid",this.loadBuiltinAgents(),this.loadSubAgents()}loadBuiltinAgents(){try{const e=(0,p.B7)();console.log(r.Ay.blue(`[子智能体管理器] 加载 ${e.length} 个内置子代理`)),e.forEach(e=>{this.subAgents.set(e.name,e)})}catch(e){console.log(r.Ay.red(`❌ 加载内置代理失败: ${e.message}`))}}loadSubAgents(){const e=(0,o.Do)("agents");if((0,n.existsSync)(e))try{const t=(0,n.readdirSync)(e).filter(e=>e.endsWith(".json")||e.endsWith(".md"));console.log(r.Ay.blue(`[子智能体管理器] 加载 ${t.length} 个自定义子代理`));for(const a of t)try{const t=(0,i.join)(e,a),s=(0,n.readFileSync)(t,"utf-8");let o;a.endsWith(".json")?o=JSON.parse(s):a.endsWith(".md")&&(o=this.parseFrontmatter(s)),this.validateConfig(o)?(0,p.JO)(o.name)?console.log(r.Ay.yellow(`⚠️ 配置文件 ${a} 与内置代理冲突,已跳过`)):(this.subAgents.set(o.name,o),console.log(r.Ay.green(`✓ 加载自定义子智能体: ${o.name}`))):console.log(r.Ay.yellow(`⚠️ 配置文件 ${a} 格式无效,已跳过`))}catch(e){console.log(r.Ay.red(`❌ 加载配置文件 ${a} 失败: ${e.message}`))}}catch(e){console.log(r.Ay.red(`❌ 读取agents目录失败: ${e.message}`))}else console.log(r.Ay.gray("[子智能体管理器] .nium/agents 目录不存在,跳过加载自定义子智能体"))}parseFrontmatter(e){const t=e.match(/^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/);if(!t)throw new Error("无效的 frontmatter 格式");const[,a,s]=t,n={},i=a.split("\n");for(const e of i){const t=e.trim();if(!t)continue;const a=t.match(/^(\w+)\s*[::]\s*(.+)$/);if(a){const[,e,t]=a;"keywords"===e?n.keywords=t.split(/[,,]/).map(e=>e.trim()).filter(e=>e):n[e]=t.trim()}}return n.prompt=s.trim(),n}validateConfig(e){return!!(e&&"object"==typeof e&&e.name&&"string"==typeof e.name&&e.description&&"string"==typeof e.description&&e.prompt&&"string"==typeof e.prompt)}async matchSubAgent(e){if(0===this.subAgents.size)return null;const t=Array.from(this.subAgents.values());switch(this.matchStrategy){case"semantic":return await this.matchSubAgentWithAI(e,t);case"hybrid":const a=this.matchSubAgentWithKeywords(e);if(a)return console.log(r.Ay.green(`[子智能体管理器] Hybrid策略 - 关键词匹配成功: ${a.name}`)),a;const s=await this.matchSubAgentWithAI(e,t);return s&&console.log(r.Ay.green(`[子智能体管理器] Hybrid策略 - 语义匹配成功: ${s.name}`)),s;default:return this.matchSubAgentWithKeywords(e)}}matchSubAgentWithKeywords(e){const t=e.toLowerCase(),a=[];for(const[e,s]of this.subAgents){let n=0;if(s.keywords&&Array.isArray(s.keywords))for(const e of s.keywords)t.includes(e.toLowerCase())&&(n+=10);t.includes(e.toLowerCase())&&(n+=5);const i=s.description.toLowerCase();n+=2*t.split(/\s+/).filter(e=>e.length>2&&i.includes(e)).length;const r=this.agentPerformance.get(e);r&&(n+=r.success/r.total*5,n+=2*Math.max(0,1-(Date.now()-r.lastUsed)/6048e5)),n>0&&a.push({agent:s,score:n})}if(a.length>0){a.sort((e,t)=>t.score-e.score);const e=a[0].agent;return console.log(r.Ay.green(`[子智能体管理器] 基于分数匹配到智能体: ${e.name} (分数: ${a[0].score.toFixed(1)})`)),e}return null}async matchSubAgentWithAI(e,t){const a=t.map(e=>`${e.name}: ${e.description}`).join("\n"),s=(0,c.Ai)(e,a),n=(await(0,l.callModelAPI)({model:(0,d.LITE_MODEL)(),messages:[{role:"user",content:s}],temperature:0,max_tokens:100,useCompression:!0})).choices[0].message.content.trim();return this.getSubAgent(n)||null}recordAgentPerformance(e,t,a){const s=this.agentPerformance.get(e)||{total:0,success:0,avgTime:0,lastUsed:Date.now()};s.total++,t&&s.success++,s.avgTime=(s.avgTime*(s.total-1)+a)/s.total,s.lastUsed=Date.now(),this.agentPerformance.set(e,s)}setMatchStrategy(e){return["keyword","semantic","hybrid"].includes(e)?(this.matchStrategy=e,console.log(r.Ay.blue(`[子智能体管理器] 匹配策略已设置为: ${e}`)),!0):(console.error(r.Ay.red(`[子智能体管理器] 无效的匹配策略: ${e}`)),!1)}getAllSubAgents(){return Array.from(this.subAgents.values())}getSubAgent(e){return this.subAgents.get(e)||null}}let h=null;function f(e={}){return h?e.matchStrategy&&h.setMatchStrategy(e.matchStrategy):h=new u(e),h}s()}catch(g){s(g)}})},9033:(e,t,a)=>{a.d(t,{JZ:()=>d,iW:()=>l});var s=a(4421),n=a(2521),i=a(6132),r=a(6645);const o=(0,i.Do)("archives");function p(){(0,s.existsSync)(o)||(0,s.mkdirSync)(o,{recursive:!0})}function d(e){if(!e||!e.messages||0===e.messages.length)return null;p();const t=(new Date).toISOString().replace(/[:.]/g,"-"),a=`session_${e.sessionId?e.sessionId.substring(0,8):"unknown"}_${t}_${e.currentTask?e.currentTask.substring(0,30).replace(/[^\w\u4e00-\u9fa5]/g,"_"):"unnamed"}.jsonl`,s=(0,n.join)(o,a),i={type:"session_metadata",data:{sessionId:e.sessionId,currentTask:e.currentTask,createdAt:e.createdAt,archivedAt:(new Date).toISOString(),messageCount:e.messages.length,taskCount:e.tasks?e.tasks.length:0}};try{const t=new r.AI(s);if(t.create(i),e.tasks&&e.tasks.length>0){const a={type:"tasks_data",data:e.tasks};t.append(a)}if(e.messages&&e.messages.length>0){const a={type:"messages_data",data:e.messages.map(e=>({...e,id:e.id||`msg_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}))};t.append(a)}}catch(e){return console.error("归档会话失败:",e),null}return s}function l(){const e=(p(),(0,s.existsSync)(o)?(0,s.readdirSync)(o).filter(e=>e.endsWith(".jsonl")).map(e=>{const t=(0,n.join)(o,e);try{const a=new r.KX(t).readAllSync({limit:1})[0];return a&&"session_metadata"===a.type?{fileName:e,filePath:t,sessionId:a.data.sessionId,sessionIdShort:a.data.sessionId?a.data.sessionId.substring(0,8):"unknown",currentTask:a.data.currentTask||"未命名任务",timestamp:a.data.archivedAt,archivedAt:a.data.archivedAt,messageCount:a.data.messageCount||0,taskCount:a.data.taskCount||0}:null}catch(t){return console.error(`读取归档文件失败: ${e}`,t),null}}).filter(e=>null!==e).sort((e,t)=>new Date(t.archivedAt).getTime()-new Date(e.archivedAt).getTime()):[]);if(0===e.length)return"暂无归档会话";let t="\n=== 归档会话列表 ===\n\n";return e.forEach((e,a)=>{const s=new Date(e.archivedAt).toLocaleString("zh-CN");t+=`[${a+1}] ${e.currentTask}\n`,t+=` 会话ID: ${e.sessionIdShort||"unknown"}\n`,t+=` 归档时间: ${s}\n`,t+=` 任务数量: ${e.taskCount||0}\n`,t+=` 消息数量: ${e.messageCount}\n`,t+=` 文件名: ${e.fileName}\n\n`}),t}},9052:(e,t,a)=>{a.d(t,{Q:()=>i});var s=a(1663),n=a(9187);class i extends s.X{sessionId;constructor(e){super(e)}async connect(){this.validateConfig(),this.logConnection("connecting");try{const e=await this.sendJsonRpcRequest("initialize",{protocolVersion:"2024-11-05",capabilities:{},clientInfo:{name:"niumagents-cli",version:"0.1.0"}});(0,n.MD)(`MCP Server initialized: ${JSON.stringify(e)}`),this.sessionId&&(0,n.MD)(`Session ID captured: ${this.sessionId}`),await this.sendInitializedNotification(),this.connected=!0,this.logConnection("connected"),this.tools=await this.listTools(),(0,n.MD)(`Loaded ${this.tools.length} tools from ${this.config.name}`)}catch(e){throw this.logError(e,"connect"),e}}async disconnect(){this.logConnection("disconnecting"),this.connected=!1,this.tools=[],this.sessionId=void 0,this.logConnection("disconnected")}async listTools(){if(!this.connected)throw new Error("Not connected to MCP server");try{const e=((await this.sendJsonRpcRequest("tools/list",{})).tools||[]).map(e=>({name:e.name,description:e.description||"",inputSchema:e.inputSchema||{type:"object",properties:{}},serverName:this.config.name}));return this.config.url&&e.length>0&&((0,n.MD)(`MCP Server URL: ${this.config.url}`),(0,n.MD)(`Found ${e.length} tools from MCP server ${this.config.name}:`),e.forEach(e=>{(0,n.MD)(` - Tool: ${e.name} (${e.description})`)})),this.tools=e,e}catch(e){throw this.logError(e,"listTools"),e}}async callTool(e,t){if(!this.connected)throw new Error("Not connected to MCP server");try{(0,n.MD)(`Calling MCP tool: ${e} on ${this.config.name}`);const a=await this.sendJsonRpcRequest("tools/call",{name:e,arguments:t});return{success:!a.isError,content:a.content||a.result,metadata:a.metadata||{}}}catch(t){return this.logError(t,`callTool(${e})`),{success:!1,error:t.message}}}async sendInitializedNotification(){if(!this.sessionId)throw new Error("No session ID available");const e={"Content-Type":"application/json",Accept:"application/json, text/event-stream","mcp-session-id":this.sessionId,...this.config.headers};(0,n.MD)(`Sending initialized notification to ${this.config.url}`);const t=await fetch(this.config.url,{method:"POST",headers:e,body:JSON.stringify({jsonrpc:"2.0",method:"notifications/initialized"}),signal:AbortSignal.timeout(this.config.timeout||3e4)});if((0,n.MD)(`Initialized notification status: ${t.status} ${t.statusText}`),!t.ok&&202!==t.status){const e=await t.text();throw(0,n.MD)(`Initialized notification error: ${e.substring(0,500)}`),new Error(`Failed to send initialized notification: ${t.status}`)}}async sendJsonRpcRequest(e,t){const a={jsonrpc:"2.0",id:Date.now(),method:e};null!=t&&(a.params=t);const s={"Content-Type":"application/json",Accept:"application/json, text/event-stream",...this.config.headers};"initialize"!==e&&this.sessionId&&(s["mcp-session-id"]=this.sessionId),(0,n.MD)(`Sending MCP request: ${e} to ${this.config.url}`),(0,n.MD)(`Request body: ${JSON.stringify(a).substring(0,200)}`),this.sessionId&&"initialize"!==e&&(0,n.MD)(`Using session ID: ${this.sessionId}`);const i=await fetch(this.config.url,{method:"POST",headers:s,body:JSON.stringify(a),signal:AbortSignal.timeout(this.config.timeout||3e4)});if((0,n.MD)(`Response status: ${i.status} ${i.statusText}`),"initialize"===e&&i.ok){const e=i.headers.get("mcp-session-id");e&&(this.sessionId=e,(0,n.MD)(`Captured session ID from response: ${this.sessionId}`))}if(!i.ok){const e=await i.text();throw(0,n.MD)(`Error response: ${e.substring(0,500)}`),new Error(`Server returned ${i.status}: ${i.statusText}`)}const r=await i.text();(0,n.MD)(`Response body: ${r.substring(0,500)}`);const o=JSON.parse(r);if(o.error)throw new Error(o.error.message||"Unknown RPC error");return o.result}}},9187:(e,t,a)=>{a.d(t,{JE:()=>y,MD:()=>w,b:()=>u,fH:()=>g,pM:()=>h,vV:()=>v});var s=a(4421),n=a(2521),i=a(4237),r=a(6132),o=a(6645);const p=(0,r.Do)("logs"),d=(0,n.join)(p,"current.jsonl"),l=(0,n.join)(p,".current_date");let c=!1;function m(){const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function u(){try{(0,s.existsSync)(p)||((0,s.mkdirSync)(p,{recursive:!0}),console.log(i.Ay.gray("创建日志目录: .nium/logs")));const e=m(),t=function(){try{return(0,s.existsSync)(l)?(0,s.readFileSync)(l,"utf-8").trim():null}catch(e){const t=e instanceof Error?e.message:String(e);return console.error(i.Ay.yellow(`读取日志文件日期失败: ${t}`)),null}}();t&&t===e||(t&&(console.log(i.Ay.yellow(`检测到旧日志文件 (${t}),正在归档...`)),function(e){try{const t=(0,n.join)(p,`${e}.jsonl`);if((0,s.existsSync)(t)){const a=new o.KX(d).readAllSync();new o.AI(t).appendBatch(a),console.log(i.Ay.green(`✓ 日志已追加到归档文件: ${e}.jsonl`))}else(0,s.renameSync)(d,t),console.log(i.Ay.green(`✓ 日志已归档: ${e}.jsonl`))}catch(e){const t=e instanceof Error?e.message:String(e);console.error(i.Ay.red(`归档日志失败: ${t}`))}}(t)),function(e){try{(0,s.writeFileSync)(d,"","utf-8"),(0,s.writeFileSync)(l,e,"utf-8");const t=new o.AI(d),a={timestamp:(new Date).toISOString(),level:"INFO",message:`日志文件创建 - 日期: ${e}`,date:e};t.append(a)}catch(e){const t=e instanceof Error?e.message:String(e);console.error(i.Ay.red(`创建日志文件失败: ${t}`))}}(e),console.log(i.Ay.green(`✓ 创建新日志文件: ${e}`)))}catch(e){const t=e instanceof Error?e.message:String(e);console.error(i.Ay.red(`初始化日志系统失败: ${t}`))}}function h(e){c=e}function f(e,t,a=!1){try{const s={timestamp:(new Date).toISOString(),level:e,message:t,date:m()};if(new o.AI(d).append(s),a||c){let a;switch(e){case"INFO":a=i.Ay.blue;break;case"WARN":a=i.Ay.yellow;break;case"ERROR":a=i.Ay.red;break;case"SUCCESS":a=i.Ay.green;break;case"DEBUG":a=i.Ay.magenta;break;default:a=i.Ay.white}console.log(a(`[${e}] ${t}`))}}catch(e){const t=e instanceof Error?e.message:String(e);console.error(i.Ay.red(`写入日志失败: ${t}`))}}function g(e){f("INFO",e,!0)}function y(e){f("WARN",e,!0)}function v(e){f("ERROR",e,!0)}function w(e){f("DEBUG",e)}},9239:(e,t,a)=>{a.d(t,{Y:()=>Ga});const s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol:e=>`Symbol(${e})`;function n(){}function i(e){return"object"==typeof e&&null!==e||"function"==typeof e}const r=n;function o(e,t){try{Object.defineProperty(e,"name",{value:t,configurable:!0})}catch(e){}}const p=Promise,d=Promise.prototype.then,l=Promise.resolve.bind(p),c=Promise.reject.bind(p);function m(e){return new p(e)}function u(e){return l(e)}function h(e){return c(e)}function f(e,t,a){return d.call(e,t,a)}function g(e,t,a){f(f(e,t,a),void 0,r)}function y(e,t){g(e,t)}function v(e,t){g(e,void 0,t)}function w(e,t,a){return f(e,t,a)}function b(e){f(e,void 0,r)}let _=e=>{if("function"==typeof queueMicrotask)_=queueMicrotask;else{const e=u(void 0);_=t=>f(e,t)}return _(e)};function S(e,t,a){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,a)}function T(e,t,a){try{return u(S(e,t,a))}catch(e){return h(e)}}class k{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(e){const t=this._back;let a=t;16383===t._elements.length&&(a={_elements:[],_next:void 0}),t._elements.push(e),a!==t&&(this._back=a,t._next=a),++this._size}shift(){const e=this._front;let t=e;const a=this._cursor;let s=a+1;const n=e._elements,i=n[a];return 16384===s&&(t=e._next,s=0),--this._size,this._cursor=s,e!==t&&(this._front=t),n[a]=void 0,i}forEach(e){let t=this._cursor,a=this._front,s=a._elements;for(;!(t===s.length&&void 0===a._next||t===s.length&&(a=a._next,s=a._elements,t=0,0===s.length));)e(s[t]),++t}peek(){const e=this._front,t=this._cursor;return e._elements[t]}}const x=s("[[AbortSteps]]"),C=s("[[ErrorSteps]]"),A=s("[[CancelSteps]]"),E=s("[[PullSteps]]"),$=s("[[ReleaseSteps]]");function D(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?O(e):"closed"===t._state?function(e){O(e),I(e)}(e):M(e,t._storedError)}function N(e,t){return sa(e._ownerReadableStream,t)}function R(e){const t=e._ownerReadableStream;"readable"===t._state?L(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e){M(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"))}(e),t._readableStreamController[$](),t._reader=void 0,e._ownerReadableStream=void 0}function P(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function O(e){e._closedPromise=m((t,a)=>{e._closedPromise_resolve=t,e._closedPromise_reject=a})}function M(e,t){O(e),L(e,t)}function L(e,t){void 0!==e._closedPromise_reject&&(b(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function I(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}const j=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},F=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function V(e,t){if(void 0!==e&&"object"!=typeof(a=e)&&"function"!=typeof a)throw new TypeError(`${t} is not an object.`);var a}function B(e,t){if("function"!=typeof e)throw new TypeError(`${t} is not a function.`)}function q(e,t){if(!function(e){return"object"==typeof e&&null!==e||"function"==typeof e}(e))throw new TypeError(`${t} is not an object.`)}function W(e,t,a){if(void 0===e)throw new TypeError(`Parameter ${t} is required in '${a}'.`)}function U(e,t,a){if(void 0===e)throw new TypeError(`${t} is required in '${a}'.`)}function z(e){return Number(e)}function H(e){return 0===e?0:e}function J(e,t){const a=Number.MAX_SAFE_INTEGER;let s=Number(e);if(s=H(s),!j(s))throw new TypeError(`${t} is not a finite number`);if(s=function(e){return H(F(e))}(s),s<0||s>a)throw new TypeError(`${t} is outside the accepted range of 0 to ${a}, inclusive`);return j(s)&&0!==s?s:0}function G(e){if(!i(e))return!1;if("function"!=typeof e.getReader)return!1;try{return"boolean"==typeof e.locked}catch(e){return!1}}function Y(e){if(!i(e))return!1;if("function"!=typeof e.getWriter)return!1;try{return"boolean"==typeof e.locked}catch(e){return!1}}function K(e,t){if(!ta(e))throw new TypeError(`${t} is not a ReadableStream.`)}function X(e,t){e._reader._readRequests.push(t)}function Q(e,t,a){const s=e._reader._readRequests.shift();a?s._closeSteps():s._chunkSteps(t)}function Z(e){return e._reader._readRequests.length}function ee(e){const t=e._reader;return void 0!==t&&!!ae(t)}class te{constructor(e){if(W(e,1,"ReadableStreamDefaultReader"),K(e,"First parameter"),aa(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");D(this,e),this._readRequests=new k}get closed(){return ae(this)?this._closedPromise:h(ne("closed"))}cancel(e){return ae(this)?void 0===this._ownerReadableStream?h(P("cancel")):N(this,e):h(ne("cancel"))}read(){if(!ae(this))return h(ne("read"));if(void 0===this._ownerReadableStream)return h(P("read from"));let e,t;const a=m((a,s)=>{e=a,t=s});return function(e,t){const a=e._ownerReadableStream;a._disturbed=!0,"closed"===a._state?t._closeSteps():"errored"===a._state?t._errorSteps(a._storedError):a._readableStreamController[E](t)}(this,{_chunkSteps:t=>e({value:t,done:!1}),_closeSteps:()=>e({value:void 0,done:!0}),_errorSteps:e=>t(e)}),a}releaseLock(){if(!ae(this))throw ne("releaseLock");void 0!==this._ownerReadableStream&&function(e){R(e),se(e,new TypeError("Reader was released"))}(this)}}function ae(e){return!!i(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")&&e instanceof te}function se(e,t){const a=e._readRequests;e._readRequests=new k,a.forEach(e=>{e._errorSteps(t)})}function ne(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}Object.defineProperties(te.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),o(te.prototype.cancel,"cancel"),o(te.prototype.read,"read"),o(te.prototype.releaseLock,"releaseLock"),"symbol"==typeof s.toStringTag&&Object.defineProperty(te.prototype,s.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});class ie{constructor(e,t){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=e,this._preventCancel=t}next(){const e=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?w(this._ongoingPromise,e,e):e(),this._ongoingPromise}return(e){const t=()=>this._returnSteps(e);return this._ongoingPromise?w(this._ongoingPromise,t,t):t()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});const e=this._reader;return void 0===e?h(P("iterate")):f(e.read(),e=>{var t;return this._ongoingPromise=void 0,e.done&&(this._isFinished=!0,null===(t=this._reader)||void 0===t||t.releaseLock(),this._reader=void 0),e},e=>{var t;throw this._ongoingPromise=void 0,this._isFinished=!0,null===(t=this._reader)||void 0===t||t.releaseLock(),this._reader=void 0,e})}_returnSteps(e){if(this._isFinished)return Promise.resolve({value:e,done:!0});this._isFinished=!0;const t=this._reader;if(void 0===t)return h(P("finish iterating"));if(this._reader=void 0,!this._preventCancel){const a=t.cancel(e);return t.releaseLock(),w(a,()=>({value:e,done:!0}))}return t.releaseLock(),u({value:e,done:!0})}}const re={next(){return oe(this)?this._asyncIteratorImpl.next():h(pe("next"))},return(e){return oe(this)?this._asyncIteratorImpl.return(e):h(pe("return"))}};function oe(e){if(!i(e))return!1;if(!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl"))return!1;try{return e._asyncIteratorImpl instanceof ie}catch(e){return!1}}function pe(e){return new TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}"symbol"==typeof s.asyncIterator&&Object.defineProperty(re,s.asyncIterator,{value(){return this},writable:!0,configurable:!0});const de=Number.isNaN||function(e){return e!=e};function le(e,t,a,s,n){new Uint8Array(e).set(new Uint8Array(a,s,n),t)}function ce(e){const t=function(e,t,a){if(e.slice)return e.slice(t,a);const s=a-t,n=new ArrayBuffer(s);return le(n,0,e,t,s),n}(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function me(e){const t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function ue(e,t,a){if("number"!=typeof(s=a)||de(s)||s<0||a===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");var s;e._queue.push({value:t,size:a}),e._queueTotalSize+=a}function he(e){e._queue=new k,e._queueTotalSize=0}class fe{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!ve(this))throw Ie("view");return this._view}respond(e){if(!ve(this))throw Ie("respond");if(W(e,1,"respond"),e=J(e,"First parameter"),void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");this._view.buffer,function(e,t){const a=e._pendingPullIntos.peek();if("closed"===e._controlledReadableByteStream._state){if(0!==t)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(0===t)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(a.bytesFilled+t>a.byteLength)throw new RangeError("bytesWritten out of range")}a.buffer=a.buffer,Ne(e,t)}(this._associatedReadableByteStreamController,e)}respondWithNewView(e){if(!ve(this))throw Ie("respondWithNewView");if(W(e,1,"respondWithNewView"),!ArrayBuffer.isView(e))throw new TypeError("You can only respond with array buffer views");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");e.buffer,function(e,t){const a=e._pendingPullIntos.peek();if("closed"===e._controlledReadableByteStream._state){if(0!==t.byteLength)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(0===t.byteLength)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(a.byteOffset+a.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(a.bufferByteLength!==t.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(a.bytesFilled+t.byteLength>a.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");const s=t.byteLength;a.buffer=t.buffer,Ne(e,s)}(this._associatedReadableByteStreamController,e)}}Object.defineProperties(fe.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),o(fe.prototype.respond,"respond"),o(fe.prototype.respondWithNewView,"respondWithNewView"),"symbol"==typeof s.toStringTag&&Object.defineProperty(fe.prototype,s.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class ge{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!ye(this))throw je("byobRequest");return function(e){if(null===e._byobRequest&&e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek(),a=new Uint8Array(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),s=Object.create(fe.prototype);!function(e,t,a){e._associatedReadableByteStreamController=t,e._view=a}(s,e,a),e._byobRequest=s}return e._byobRequest}(this)}get desiredSize(){if(!ye(this))throw je("desiredSize");return Le(this)}close(){if(!ye(this))throw je("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");const e=this._controlledReadableByteStream._state;if("readable"!==e)throw new TypeError(`The stream (in ${e} state) is not in the readable state and cannot be closed`);!function(e){const t=e._controlledReadableByteStream;if(!e._closeRequested&&"readable"===t._state)if(e._queueTotalSize>0)e._closeRequested=!0;else{if(e._pendingPullIntos.length>0&&e._pendingPullIntos.peek().bytesFilled>0){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");throw Oe(e,t),t}Pe(e),na(t)}}(this)}enqueue(e){if(!ye(this))throw je("enqueue");if(W(e,1,"enqueue"),!ArrayBuffer.isView(e))throw new TypeError("chunk must be an array buffer view");if(0===e.byteLength)throw new TypeError("chunk must have non-zero byteLength");if(0===e.buffer.byteLength)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");const t=this._controlledReadableByteStream._state;if("readable"!==t)throw new TypeError(`The stream (in ${t} state) is not in the readable state and cannot be enqueued to`);!function(e,t){const a=e._controlledReadableByteStream;if(e._closeRequested||"readable"!==a._state)return;const s=t.buffer,n=t.byteOffset,i=t.byteLength,r=s;if(e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek();t.buffer,$e(e),t.buffer=t.buffer,"none"===t.readerType&&xe(e,t)}ee(a)?(function(e){const t=e._controlledReadableByteStream._reader;for(;t._readRequests.length>0;){if(0===e._queueTotalSize)return;Me(e,t._readRequests.shift())}}(e),0===Z(a)?Te(e,r,n,i):(e._pendingPullIntos.length>0&&Re(e),Q(a,new Uint8Array(r,n,i),!1))):Be(a)?(Te(e,r,n,i),De(e)):Te(e,r,n,i),we(e)}(this,e)}error(e){if(!ye(this))throw je("error");Oe(this,e)}[A](e){be(this),he(this);const t=this._cancelAlgorithm(e);return Pe(this),t}[E](e){const t=this._controlledReadableByteStream;if(this._queueTotalSize>0)return void Me(this,e);const a=this._autoAllocateChunkSize;if(void 0!==a){let s;try{s=new ArrayBuffer(a)}catch(t){return void e._errorSteps(t)}const n={buffer:s,bufferByteLength:a,byteOffset:0,byteLength:a,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(n)}X(t,e),we(this)}[$](){if(this._pendingPullIntos.length>0){const e=this._pendingPullIntos.peek();e.readerType="none",this._pendingPullIntos=new k,this._pendingPullIntos.push(e)}}}function ye(e){return!!i(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")&&e instanceof ge}function ve(e){return!!i(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")&&e instanceof fe}function we(e){const t=function(e){const t=e._controlledReadableByteStream;return"readable"===t._state&&!e._closeRequested&&!!e._started&&(!!(ee(t)&&Z(t)>0)||!!(Be(t)&&Ve(t)>0)||Le(e)>0)}(e);t&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,g(e._pullAlgorithm(),()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,we(e)),null),t=>(Oe(e,t),null))))}function be(e){$e(e),e._pendingPullIntos=new k}function _e(e,t){let a=!1;"closed"===e._state&&(a=!0);const s=Se(t);"default"===t.readerType?Q(e,s,a):function(e,t,a){const s=e._reader._readIntoRequests.shift();a?s._closeSteps(t):s._chunkSteps(t)}(e,s,a)}function Se(e){const t=e.bytesFilled,a=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/a)}function Te(e,t,a,s){e._queue.push({buffer:t,byteOffset:a,byteLength:s}),e._queueTotalSize+=s}function ke(e,t,a,s){let n;try{n=t.slice(a,a+s)}catch(t){throw Oe(e,t),t}Te(e,n,0,s)}function xe(e,t){t.bytesFilled>0&&ke(e,t.buffer,t.byteOffset,t.bytesFilled),Re(e)}function Ce(e,t){const a=t.elementSize,s=t.bytesFilled-t.bytesFilled%a,n=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),i=t.bytesFilled+n,r=i-i%a;let o=n,p=!1;r>s&&(o=r-t.bytesFilled,p=!0);const d=e._queue;for(;o>0;){const a=d.peek(),s=Math.min(o,a.byteLength),n=t.byteOffset+t.bytesFilled;le(t.buffer,n,a.buffer,a.byteOffset,s),a.byteLength===s?d.shift():(a.byteOffset+=s,a.byteLength-=s),e._queueTotalSize-=s,Ae(0,s,t),o-=s}return p}function Ae(e,t,a){a.bytesFilled+=t}function Ee(e){0===e._queueTotalSize&&e._closeRequested?(Pe(e),na(e._controlledReadableByteStream)):we(e)}function $e(e){null!==e._byobRequest&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function De(e){for(;e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;const t=e._pendingPullIntos.peek();Ce(e,t)&&(Re(e),_e(e._controlledReadableByteStream,t))}}function Ne(e,t){const a=e._pendingPullIntos.peek();$e(e),"closed"===e._controlledReadableByteStream._state?function(e,t){"none"===t.readerType&&Re(e);const a=e._controlledReadableByteStream;if(Be(a))for(;Ve(a)>0;)_e(a,Re(e))}(e,a):function(e,t,a){if(Ae(0,t,a),"none"===a.readerType)return xe(e,a),void De(e);if(a.bytesFilled<a.elementSize)return;Re(e);const s=a.bytesFilled%a.elementSize;if(s>0){const t=a.byteOffset+a.bytesFilled;ke(e,a.buffer,t-s,s)}a.bytesFilled-=s,_e(e._controlledReadableByteStream,a),De(e)}(e,t,a),we(e)}function Re(e){return e._pendingPullIntos.shift()}function Pe(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function Oe(e,t){const a=e._controlledReadableByteStream;"readable"===a._state&&(be(e),he(e),Pe(e),ia(a,t))}function Me(e,t){const a=e._queue.shift();e._queueTotalSize-=a.byteLength,Ee(e);const s=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);t._chunkSteps(s)}function Le(e){const t=e._controlledReadableByteStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Ie(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function je(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function Fe(e,t){e._reader._readIntoRequests.push(t)}function Ve(e){return e._reader._readIntoRequests.length}function Be(e){const t=e._reader;return void 0!==t&&!!We(t)}Object.defineProperties(ge.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),o(ge.prototype.close,"close"),o(ge.prototype.enqueue,"enqueue"),o(ge.prototype.error,"error"),"symbol"==typeof s.toStringTag&&Object.defineProperty(ge.prototype,s.toStringTag,{value:"ReadableByteStreamController",configurable:!0});class qe{constructor(e){if(W(e,1,"ReadableStreamBYOBReader"),K(e,"First parameter"),aa(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!ye(e._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");D(this,e),this._readIntoRequests=new k}get closed(){return We(this)?this._closedPromise:h(ze("closed"))}cancel(e){return We(this)?void 0===this._ownerReadableStream?h(P("cancel")):N(this,e):h(ze("cancel"))}read(e){if(!We(this))return h(ze("read"));if(!ArrayBuffer.isView(e))return h(new TypeError("view must be an array buffer view"));if(0===e.byteLength)return h(new TypeError("view must have non-zero byteLength"));if(0===e.buffer.byteLength)return h(new TypeError("view's buffer must have non-zero byteLength"));if(e.buffer,void 0===this._ownerReadableStream)return h(P("read from"));let t,a;const s=m((e,s)=>{t=e,a=s});return function(e,t,a){const s=e._ownerReadableStream;s._disturbed=!0,"errored"===s._state?a._errorSteps(s._storedError):function(e,t,a){const s=e._controlledReadableByteStream;let n=1;t.constructor!==DataView&&(n=t.constructor.BYTES_PER_ELEMENT);const i=t.constructor,r=t.buffer,o={buffer:r,bufferByteLength:r.byteLength,byteOffset:t.byteOffset,byteLength:t.byteLength,bytesFilled:0,elementSize:n,viewConstructor:i,readerType:"byob"};if(e._pendingPullIntos.length>0)return e._pendingPullIntos.push(o),void Fe(s,a);if("closed"!==s._state){if(e._queueTotalSize>0){if(Ce(e,o)){const t=Se(o);return Ee(e),void a._chunkSteps(t)}if(e._closeRequested){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");return Oe(e,t),void a._errorSteps(t)}}e._pendingPullIntos.push(o),Fe(s,a),we(e)}else{const e=new i(o.buffer,o.byteOffset,0);a._closeSteps(e)}}(s._readableStreamController,t,a)}(this,e,{_chunkSteps:e=>t({value:e,done:!1}),_closeSteps:e=>t({value:e,done:!0}),_errorSteps:e=>a(e)}),s}releaseLock(){if(!We(this))throw ze("releaseLock");void 0!==this._ownerReadableStream&&function(e){R(e),Ue(e,new TypeError("Reader was released"))}(this)}}function We(e){return!!i(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")&&e instanceof qe}function Ue(e,t){const a=e._readIntoRequests;e._readIntoRequests=new k,a.forEach(e=>{e._errorSteps(t)})}function ze(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function He(e,t){const{highWaterMark:a}=e;if(void 0===a)return t;if(de(a)||a<0)throw new RangeError("Invalid highWaterMark");return a}function Je(e){const{size:t}=e;return t||(()=>1)}function Ge(e,t){V(e,t);const a=null==e?void 0:e.highWaterMark,s=null==e?void 0:e.size;return{highWaterMark:void 0===a?void 0:z(a),size:void 0===s?void 0:Ye(s,`${t} has member 'size' that`)}}function Ye(e,t){return B(e,t),t=>z(e(t))}function Ke(e,t,a){return B(e,a),a=>T(e,t,[a])}function Xe(e,t,a){return B(e,a),()=>T(e,t,[])}function Qe(e,t,a){return B(e,a),a=>S(e,t,[a])}function Ze(e,t,a){return B(e,a),(a,s)=>T(e,t,[a,s])}Object.defineProperties(qe.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),o(qe.prototype.cancel,"cancel"),o(qe.prototype.read,"read"),o(qe.prototype.releaseLock,"releaseLock"),"symbol"==typeof s.toStringTag&&Object.defineProperty(qe.prototype,s.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});const et="function"==typeof AbortController;class tt{constructor(e={},t={}){void 0===e?e=null:q(e,"First parameter");const a=Ge(t,"Second parameter"),s=function(e,t){V(e,t);const a=null==e?void 0:e.abort,s=null==e?void 0:e.close,n=null==e?void 0:e.start,i=null==e?void 0:e.type,r=null==e?void 0:e.write;return{abort:void 0===a?void 0:Ke(a,e,`${t} has member 'abort' that`),close:void 0===s?void 0:Xe(s,e,`${t} has member 'close' that`),start:void 0===n?void 0:Qe(n,e,`${t} has member 'start' that`),write:void 0===r?void 0:Ze(r,e,`${t} has member 'write' that`),type:i}}(e,"First parameter");var n;if((n=this)._state="writable",n._storedError=void 0,n._writer=void 0,n._writableStreamController=void 0,n._writeRequests=new k,n._inFlightWriteRequest=void 0,n._closeRequest=void 0,n._inFlightCloseRequest=void 0,n._pendingAbortRequest=void 0,n._backpressure=!1,void 0!==s.type)throw new RangeError("Invalid type is specified");const i=Je(a);!function(e,t,a,s){const n=Object.create(gt.prototype);let i,r,o,p;i=void 0!==t.start?()=>t.start(n):()=>{},r=void 0!==t.write?e=>t.write(e,n):()=>u(void 0),o=void 0!==t.close?()=>t.close():()=>u(void 0),p=void 0!==t.abort?e=>t.abort(e):()=>u(void 0),function(e,t,a,s,n,i,r,o){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,he(t),t._abortReason=void 0,t._abortController=function(){if(et)return new AbortController}(),t._started=!1,t._strategySizeAlgorithm=o,t._strategyHWM=r,t._writeAlgorithm=s,t._closeAlgorithm=n,t._abortAlgorithm=i;const p=St(t);ct(e,p),g(u(a()),()=>(t._started=!0,bt(t),null),a=>(t._started=!0,rt(e,a),null))}(e,n,i,r,o,p,a,s)}(this,s,He(a,1),i)}get locked(){if(!at(this))throw kt("locked");return st(this)}abort(e){return at(this)?st(this)?h(new TypeError("Cannot abort a stream that already has a writer")):nt(this,e):h(kt("abort"))}close(){return at(this)?st(this)?h(new TypeError("Cannot close a stream that already has a writer")):dt(this)?h(new TypeError("Cannot close an already-closing stream")):it(this):h(kt("close"))}getWriter(){if(!at(this))throw kt("getWriter");return new mt(this)}}function at(e){return!!i(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")&&e instanceof tt}function st(e){return void 0!==e._writer}function nt(e,t){var a;if("closed"===e._state||"errored"===e._state)return u(void 0);e._writableStreamController._abortReason=t,null===(a=e._writableStreamController._abortController)||void 0===a||a.abort(t);const s=e._state;if("closed"===s||"errored"===s)return u(void 0);if(void 0!==e._pendingAbortRequest)return e._pendingAbortRequest._promise;let n=!1;"erroring"===s&&(n=!0,t=void 0);const i=m((a,s)=>{e._pendingAbortRequest={_promise:void 0,_resolve:a,_reject:s,_reason:t,_wasAlreadyErroring:n}});return e._pendingAbortRequest._promise=i,n||ot(e,t),i}function it(e){const t=e._state;if("closed"===t||"errored"===t)return h(new TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));const a=m((t,a)=>{const s={_resolve:t,_reject:a};e._closeRequest=s}),s=e._writer;var n;return void 0!==s&&e._backpressure&&"writable"===t&&Lt(s),ue(n=e._writableStreamController,ft,0),bt(n),a}function rt(e,t){"writable"!==e._state?pt(e):ot(e,t)}function ot(e,t){const a=e._writableStreamController;e._state="erroring",e._storedError=t;const s=e._writer;void 0!==s&&ht(s,t),!function(e){return void 0!==e._inFlightWriteRequest||void 0!==e._inFlightCloseRequest}(e)&&a._started&&pt(e)}function pt(e){e._state="errored",e._writableStreamController[C]();const t=e._storedError;if(e._writeRequests.forEach(e=>{e._reject(t)}),e._writeRequests=new k,void 0===e._pendingAbortRequest)return void lt(e);const a=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,a._wasAlreadyErroring)return a._reject(t),void lt(e);g(e._writableStreamController[x](a._reason),()=>(a._resolve(),lt(e),null),t=>(a._reject(t),lt(e),null))}function dt(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function lt(e){void 0!==e._closeRequest&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);const t=e._writer;void 0!==t&&Dt(t,e._storedError)}function ct(e,t){const a=e._writer;void 0!==a&&t!==e._backpressure&&(t?function(e){Rt(e)}(a):Lt(a)),e._backpressure=t}Object.defineProperties(tt.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),o(tt.prototype.abort,"abort"),o(tt.prototype.close,"close"),o(tt.prototype.getWriter,"getWriter"),"symbol"==typeof s.toStringTag&&Object.defineProperty(tt.prototype,s.toStringTag,{value:"WritableStream",configurable:!0});class mt{constructor(e){if(W(e,1,"WritableStreamDefaultWriter"),function(e){if(!at(e))throw new TypeError("First parameter is not a WritableStream.")}(e),st(e))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=e,e._writer=this;const t=e._state;if("writable"===t)!dt(e)&&e._backpressure?Rt(this):Ot(this),Et(this);else if("erroring"===t)Pt(this,e._storedError),Et(this);else if("closed"===t)Ot(this),Et(this),Nt(this);else{const t=e._storedError;Pt(this,t),$t(this,t)}}get closed(){return ut(this)?this._closedPromise:h(Ct("closed"))}get desiredSize(){if(!ut(this))throw Ct("desiredSize");if(void 0===this._ownerWritableStream)throw At("desiredSize");return function(e){const t=e._ownerWritableStream,a=t._state;return"errored"===a||"erroring"===a?null:"closed"===a?0:wt(t._writableStreamController)}(this)}get ready(){return ut(this)?this._readyPromise:h(Ct("ready"))}abort(e){return ut(this)?void 0===this._ownerWritableStream?h(At("abort")):function(e,t){return nt(e._ownerWritableStream,t)}(this,e):h(Ct("abort"))}close(){if(!ut(this))return h(Ct("close"));const e=this._ownerWritableStream;return void 0===e?h(At("close")):dt(e)?h(new TypeError("Cannot close an already-closing stream")):it(this._ownerWritableStream)}releaseLock(){if(!ut(this))throw Ct("releaseLock");void 0!==this._ownerWritableStream&&function(e){const t=e._ownerWritableStream,a=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");ht(e,a),function(e,t){"pending"===e._closedPromiseState?Dt(e,t):function(e,t){$t(e,t)}(e,t)}(e,a),t._writer=void 0,e._ownerWritableStream=void 0}(this)}write(e){return ut(this)?void 0===this._ownerWritableStream?h(At("write to")):function(e,t){const a=e._ownerWritableStream,s=a._writableStreamController,n=function(e,t){try{return e._strategySizeAlgorithm(t)}catch(t){return _t(e,t),1}}(s,t);if(a!==e._ownerWritableStream)return h(At("write to"));const i=a._state;if("errored"===i)return h(a._storedError);if(dt(a)||"closed"===i)return h(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===i)return h(a._storedError);const r=function(e){return m((t,a)=>{const s={_resolve:t,_reject:a};e._writeRequests.push(s)})}(a);return function(e,t,a){try{ue(e,t,a)}catch(t){return void _t(e,t)}const s=e._controlledWritableStream;dt(s)||"writable"!==s._state||ct(s,St(e)),bt(e)}(s,t,n),r}(this,e):h(Ct("write"))}}function ut(e){return!!i(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")&&e instanceof mt}function ht(e,t){"pending"===e._readyPromiseState?Mt(e,t):function(e,t){Pt(e,t)}(e,t)}Object.defineProperties(mt.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),o(mt.prototype.abort,"abort"),o(mt.prototype.close,"close"),o(mt.prototype.releaseLock,"releaseLock"),o(mt.prototype.write,"write"),"symbol"==typeof s.toStringTag&&Object.defineProperty(mt.prototype,s.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});const ft={};class gt{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!yt(this))throw xt("abortReason");return this._abortReason}get signal(){if(!yt(this))throw xt("signal");if(void 0===this._abortController)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(e){if(!yt(this))throw xt("error");"writable"===this._controlledWritableStream._state&&Tt(this,e)}[x](e){const t=this._abortAlgorithm(e);return vt(this),t}[C](){he(this)}}function yt(e){return!!i(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")&&e instanceof gt}function vt(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function wt(e){return e._strategyHWM-e._queueTotalSize}function bt(e){const t=e._controlledWritableStream;if(!e._started)return;if(void 0!==t._inFlightWriteRequest)return;if("erroring"===t._state)return void pt(t);if(0===e._queue.length)return;const a=e._queue.peek().value;a===ft?function(e){const t=e._controlledWritableStream;(function(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),me(e);const a=e._closeAlgorithm();vt(e),g(a,()=>(function(e){e._inFlightCloseRequest._resolve(void 0),e._inFlightCloseRequest=void 0,"erroring"===e._state&&(e._storedError=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._resolve(),e._pendingAbortRequest=void 0)),e._state="closed";const t=e._writer;void 0!==t&&Nt(t)}(t),null),e=>(function(e,t){e._inFlightCloseRequest._reject(t),e._inFlightCloseRequest=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._reject(t),e._pendingAbortRequest=void 0),rt(e,t)}(t,e),null))}(e):function(e,t){const a=e._controlledWritableStream;!function(e){e._inFlightWriteRequest=e._writeRequests.shift()}(a),g(e._writeAlgorithm(t),()=>{!function(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}(a);const t=a._state;if(me(e),!dt(a)&&"writable"===t){const t=St(e);ct(a,t)}return bt(e),null},t=>("writable"===a._state&&vt(e),function(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,rt(e,t)}(a,t),null))}(e,a)}function _t(e,t){"writable"===e._controlledWritableStream._state&&Tt(e,t)}function St(e){return wt(e)<=0}function Tt(e,t){const a=e._controlledWritableStream;vt(e),ot(a,t)}function kt(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function xt(e){return new TypeError(`WritableStreamDefaultController.prototype.${e} can only be used on a WritableStreamDefaultController`)}function Ct(e){return new TypeError(`WritableStreamDefaultWriter.prototype.${e} can only be used on a WritableStreamDefaultWriter`)}function At(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function Et(e){e._closedPromise=m((t,a)=>{e._closedPromise_resolve=t,e._closedPromise_reject=a,e._closedPromiseState="pending"})}function $t(e,t){Et(e),Dt(e,t)}function Dt(e,t){void 0!==e._closedPromise_reject&&(b(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function Nt(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved")}function Rt(e){e._readyPromise=m((t,a)=>{e._readyPromise_resolve=t,e._readyPromise_reject=a}),e._readyPromiseState="pending"}function Pt(e,t){Rt(e),Mt(e,t)}function Ot(e){Rt(e),Lt(e)}function Mt(e,t){void 0!==e._readyPromise_reject&&(b(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function Lt(e){void 0!==e._readyPromise_resolve&&(e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled")}Object.defineProperties(gt.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),"symbol"==typeof s.toStringTag&&Object.defineProperty(gt.prototype,s.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});const It="undefined"!=typeof DOMException?DOMException:void 0,jt=function(e){if("function"!=typeof e&&"object"!=typeof e)return!1;try{return new e,!0}catch(e){return!1}}(It)?It:function(){const e=function(e,t){this.message=e||"",this.name=t||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return e.prototype=Object.create(Error.prototype),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,configurable:!0}),e}();function Ft(e,t,a,s,n,i){const r=e.getReader(),o=t.getWriter();ta(e)&&(e._disturbed=!0);let p,d,l,c=!1,v=!1,S="readable",T="writable",k=!1,x=!1;const C=m(e=>{l=e});let A=Promise.resolve(void 0);return m((E,$)=>{let D;function N(){if(c)return;const e=m((e,t)=>{!function a(s){s?e():f(c?u(!0):f(o.ready,()=>f(r.read(),e=>!!e.done||(A=o.write(e.value),b(A),!1))),a,t)}(!1)});b(e)}function R(){return S="closed",a?L():M(()=>(at(t)&&(k=dt(t),T=t._state),k||"closed"===T?u(void 0):"erroring"===T||"errored"===T?h(d):(k=!0,o.close())),!1,void 0),null}function P(e){return c||(S="errored",p=e,s?L(!0,e):M(()=>o.abort(e),!0,e)),null}function O(e){return v||(T="errored",d=e,n?L(!0,e):M(()=>r.cancel(e),!0,e)),null}if(void 0!==i&&(D=()=>{const e=void 0!==i.reason?i.reason:new jt("Aborted","AbortError"),t=[];s||t.push(()=>"writable"===T?o.abort(e):u(void 0)),n||t.push(()=>"readable"===S?r.cancel(e):u(void 0)),M(()=>Promise.all(t.map(e=>e())),!0,e)},i.aborted?D():i.addEventListener("abort",D)),ta(e)&&(S=e._state,p=e._storedError),at(t)&&(T=t._state,d=t._storedError,k=dt(t)),ta(e)&&at(t)&&(x=!0,l()),"errored"===S)P(p);else if("erroring"===T||"errored"===T)O(d);else if("closed"===S)R();else if(k||"closed"===T){const e=new TypeError("the destination writable stream closed before all data could be piped to it");n?L(!0,e):M(()=>r.cancel(e),!0,e)}function M(e,t,a){function s(){return"writable"!==T||k?n():y(function(){let e;return u(function t(){if(e!==A)return e=A,w(A,t,t)}())}(),n),null}function n(){return e?g(e(),()=>I(t,a),e=>I(!0,e)):I(t,a),null}c||(c=!0,x?s():y(C,s))}function L(e,t){M(void 0,e,t)}function I(e,t){return v=!0,o.releaseLock(),r.releaseLock(),void 0!==i&&i.removeEventListener("abort",D),e?$(t):E(void 0),null}c||(g(r.closed,R,P),g(o.closed,function(){return v||(T="closed"),null},O)),x?N():_(()=>{x=!0,l(),N()})})}class Vt{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Bt(this))throw Jt("desiredSize");return zt(this)}close(){if(!Bt(this))throw Jt("close");if(!Ht(this))throw new TypeError("The stream is not in a state that permits close");!function(e){if(!Ht(e))return;const t=e._controlledReadableStream;e._closeRequested=!0,0===e._queue.length&&(Wt(e),na(t))}(this)}enqueue(e){if(!Bt(this))throw Jt("enqueue");if(!Ht(this))throw new TypeError("The stream is not in a state that permits enqueue");return function(e,t){if(!Ht(e))return;const a=e._controlledReadableStream;if(aa(a)&&Z(a)>0)Q(a,t,!1);else{let a;try{a=e._strategySizeAlgorithm(t)}catch(t){throw Ut(e,t),t}try{ue(e,t,a)}catch(t){throw Ut(e,t),t}}qt(e)}(this,e)}error(e){if(!Bt(this))throw Jt("error");Ut(this,e)}[A](e){he(this);const t=this._cancelAlgorithm(e);return Wt(this),t}[E](e){const t=this._controlledReadableStream;if(this._queue.length>0){const a=me(this);this._closeRequested&&0===this._queue.length?(Wt(this),na(t)):qt(this),e._chunkSteps(a)}else X(t,e),qt(this)}[$](){}}function Bt(e){return!!i(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")&&e instanceof Vt}function qt(e){const t=function(e){const t=e._controlledReadableStream;return!!Ht(e)&&!!e._started&&(!!(aa(t)&&Z(t)>0)||zt(e)>0)}(e);t&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,g(e._pullAlgorithm(),()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,qt(e)),null),t=>(Ut(e,t),null))))}function Wt(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Ut(e,t){const a=e._controlledReadableStream;"readable"===a._state&&(he(e),Wt(e),ia(a,t))}function zt(e){const t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Ht(e){return!e._closeRequested&&"readable"===e._controlledReadableStream._state}function Jt(e){return new TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function Gt(e,t,a){return B(e,a),a=>T(e,t,[a])}function Yt(e,t,a){return B(e,a),a=>T(e,t,[a])}function Kt(e,t,a){return B(e,a),a=>S(e,t,[a])}function Xt(e,t){if("bytes"!=(e=`${e}`))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function Qt(e,t){if("byob"!=(e=`${e}`))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function Zt(e,t){V(e,t);const a=null==e?void 0:e.preventAbort,s=null==e?void 0:e.preventCancel,n=null==e?void 0:e.preventClose,i=null==e?void 0:e.signal;return void 0!==i&&function(e,t){if(!function(e){if("object"!=typeof e||null===e)return!1;try{return"boolean"==typeof e.aborted}catch(e){return!1}}(e))throw new TypeError(`${t} is not an AbortSignal.`)}(i,`${t} has member 'signal' that`),{preventAbort:Boolean(a),preventCancel:Boolean(s),preventClose:Boolean(n),signal:i}}Object.defineProperties(Vt.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),o(Vt.prototype.close,"close"),o(Vt.prototype.enqueue,"enqueue"),o(Vt.prototype.error,"error"),"symbol"==typeof s.toStringTag&&Object.defineProperty(Vt.prototype,s.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});class ea{constructor(e={},t={}){void 0===e?e=null:q(e,"First parameter");const a=Ge(t,"Second parameter"),s=function(e,t){V(e,t);const a=e,s=null==a?void 0:a.autoAllocateChunkSize,n=null==a?void 0:a.cancel,i=null==a?void 0:a.pull,r=null==a?void 0:a.start,o=null==a?void 0:a.type;return{autoAllocateChunkSize:void 0===s?void 0:J(s,`${t} has member 'autoAllocateChunkSize' that`),cancel:void 0===n?void 0:Gt(n,a,`${t} has member 'cancel' that`),pull:void 0===i?void 0:Yt(i,a,`${t} has member 'pull' that`),start:void 0===r?void 0:Kt(r,a,`${t} has member 'start' that`),type:void 0===o?void 0:Xt(o,`${t} has member 'type' that`)}}(e,"First parameter");var n;if((n=this)._state="readable",n._reader=void 0,n._storedError=void 0,n._disturbed=!1,"bytes"===s.type){if(void 0!==a.size)throw new RangeError("The strategy for a byte stream cannot have a size function");!function(e,t,a){const s=Object.create(ge.prototype);let n,i,r;n=void 0!==t.start?()=>t.start(s):()=>{},i=void 0!==t.pull?()=>t.pull(s):()=>u(void 0),r=void 0!==t.cancel?e=>t.cancel(e):()=>u(void 0);const o=t.autoAllocateChunkSize;if(0===o)throw new TypeError("autoAllocateChunkSize must be greater than 0");!function(e,t,a,s,n,i,r){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,he(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=i,t._pullAlgorithm=s,t._cancelAlgorithm=n,t._autoAllocateChunkSize=r,t._pendingPullIntos=new k,e._readableStreamController=t,g(u(a()),()=>(t._started=!0,we(t),null),e=>(Oe(t,e),null))}(e,s,n,i,r,a,o)}(this,s,He(a,0))}else{const e=Je(a);!function(e,t,a,s){const n=Object.create(Vt.prototype);let i,r,o;i=void 0!==t.start?()=>t.start(n):()=>{},r=void 0!==t.pull?()=>t.pull(n):()=>u(void 0),o=void 0!==t.cancel?e=>t.cancel(e):()=>u(void 0),function(e,t,a,s,n,i,r){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,he(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=r,t._strategyHWM=i,t._pullAlgorithm=s,t._cancelAlgorithm=n,e._readableStreamController=t,g(u(a()),()=>(t._started=!0,qt(t),null),e=>(Ut(t,e),null))}(e,n,i,r,o,a,s)}(this,s,He(a,1),e)}}get locked(){if(!ta(this))throw ra("locked");return aa(this)}cancel(e){return ta(this)?aa(this)?h(new TypeError("Cannot cancel a stream that already has a reader")):sa(this,e):h(ra("cancel"))}getReader(e){if(!ta(this))throw ra("getReader");return void 0===function(e,t){V(e,t);const a=null==e?void 0:e.mode;return{mode:void 0===a?void 0:Qt(a,`${t} has member 'mode' that`)}}(e,"First parameter").mode?new te(this):function(e){return new qe(e)}(this)}pipeThrough(e,t={}){if(!G(this))throw ra("pipeThrough");W(e,1,"pipeThrough");const a=function(e,t){V(e,t);const a=null==e?void 0:e.readable;U(a,"readable","ReadableWritablePair"),function(e,t){if(!G(e))throw new TypeError(`${t} is not a ReadableStream.`)}(a,`${t} has member 'readable' that`);const s=null==e?void 0:e.writable;return U(s,"writable","ReadableWritablePair"),function(e,t){if(!Y(e))throw new TypeError(`${t} is not a WritableStream.`)}(s,`${t} has member 'writable' that`),{readable:a,writable:s}}(e,"First parameter"),s=Zt(t,"Second parameter");if(this.locked)throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(a.writable.locked)throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return b(Ft(this,a.writable,s.preventClose,s.preventAbort,s.preventCancel,s.signal)),a.readable}pipeTo(e,t={}){if(!G(this))return h(ra("pipeTo"));if(void 0===e)return h("Parameter 1 is required in 'pipeTo'.");if(!Y(e))return h(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let a;try{a=Zt(t,"Second parameter")}catch(e){return h(e)}return this.locked?h(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):e.locked?h(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):Ft(this,e,a.preventClose,a.preventAbort,a.preventCancel,a.signal)}tee(){if(!G(this))throw ra("tee");if(this.locked)throw new TypeError("Cannot tee a stream that already has a reader");return function(e){return function(e){try{return e.getReader({mode:"byob"}).releaseLock(),!0}catch(e){return!1}}(e)?function(e){let t,a,s,n,i,r=e.getReader(),o=!1,p=!1,d=!1,l=!1,c=!1,h=!1;const f=m(e=>{i=e});function y(e){v(e.closed,t=>(e!==r||(s.error(t),n.error(t),c&&h||i(void 0)),null))}function w(){o&&(r.releaseLock(),r=e.getReader(),y(r),o=!1),g(r.read(),e=>{var t,a;if(d=!1,l=!1,e.done)return c||s.close(),h||n.close(),null===(t=s.byobRequest)||void 0===t||t.respond(0),null===(a=n.byobRequest)||void 0===a||a.respond(0),c&&h||i(void 0),null;const o=e.value,m=o;let u=o;if(!c&&!h)try{u=ce(o)}catch(e){return s.error(e),n.error(e),i(r.cancel(e)),null}return c||s.enqueue(m),h||n.enqueue(u),p=!1,d?_():l&&S(),null},()=>(p=!1,null))}function b(t,a){o||(r.releaseLock(),r=e.getReader({mode:"byob"}),y(r),o=!0);const m=a?n:s,u=a?s:n;g(r.read(t),e=>{var t;d=!1,l=!1;const s=a?h:c,n=a?c:h;if(e.done){s||m.close(),n||u.close();const a=e.value;return void 0!==a&&(s||m.byobRequest.respondWithNewView(a),n||null===(t=u.byobRequest)||void 0===t||t.respond(0)),s&&n||i(void 0),null}const o=e.value;if(n)s||m.byobRequest.respondWithNewView(o);else{let t;try{t=ce(o)}catch(e){return m.error(e),u.error(e),i(r.cancel(e)),null}s||m.byobRequest.respondWithNewView(o),u.enqueue(t)}return p=!1,d?_():l&&S(),null},()=>(p=!1,null))}function _(){if(p)return d=!0,u(void 0);p=!0;const e=s.byobRequest;return null===e?w():b(e.view,!1),u(void 0)}function S(){if(p)return l=!0,u(void 0);p=!0;const e=n.byobRequest;return null===e?w():b(e.view,!0),u(void 0)}const T=new ea({type:"bytes",start(e){s=e},pull:_,cancel:function(e){if(c=!0,t=e,h){const e=[t,a],s=r.cancel(e);i(s)}return f}}),k=new ea({type:"bytes",start(e){n=e},pull:S,cancel:function(e){if(h=!0,a=e,c){const e=[t,a],s=r.cancel(e);i(s)}return f}});return y(r),[T,k]}(e):function(e){const t=e.getReader();let a,s,n,i,r,o=!1,p=!1,d=!1,l=!1;const c=m(e=>{r=e});function h(){return o?(p=!0,u(void 0)):(o=!0,g(t.read(),e=>{if(p=!1,e.done)return d||n.close(),l||i.close(),d&&l||r(void 0),null;const t=e.value,a=t,s=t;return d||n.enqueue(a),l||i.enqueue(s),o=!1,p&&h(),null},()=>(o=!1,null)),u(void 0))}const f=new ea({start(e){n=e},pull:h,cancel:function(e){if(d=!0,a=e,l){const e=[a,s],n=t.cancel(e);r(n)}return c}}),y=new ea({start(e){i=e},pull:h,cancel:function(e){if(l=!0,s=e,d){const e=[a,s],n=t.cancel(e);r(n)}return c}});return v(t.closed,e=>(n.error(e),i.error(e),d&&l||r(void 0),null)),[f,y]}(e)}(this)}values(e){if(!G(this))throw ra("values");return function(e,t){const a=e.getReader(),s=new ie(a,t),n=Object.create(re);return n._asyncIteratorImpl=s,n}(this,function(e){V(e,"First parameter");const t=null==e?void 0:e.preventCancel;return{preventCancel:Boolean(t)}}(e).preventCancel)}}function ta(e){return!!i(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")&&e instanceof ea}function aa(e){return void 0!==e._reader}function sa(e,t){if(e._disturbed=!0,"closed"===e._state)return u(void 0);if("errored"===e._state)return h(e._storedError);na(e);const a=e._reader;if(void 0!==a&&We(a)){const e=a._readIntoRequests;a._readIntoRequests=new k,e.forEach(e=>{e._closeSteps(void 0)})}return w(e._readableStreamController[A](t),n)}function na(e){e._state="closed";const t=e._reader;if(void 0!==t&&(I(t),ae(t))){const e=t._readRequests;t._readRequests=new k,e.forEach(e=>{e._closeSteps()})}}function ia(e,t){e._state="errored",e._storedError=t;const a=e._reader;void 0!==a&&(L(a,t),ae(a)?se(a,t):Ue(a,t))}function ra(e){return new TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function oa(e,t){V(e,t);const a=null==e?void 0:e.highWaterMark;return U(a,"highWaterMark","QueuingStrategyInit"),{highWaterMark:z(a)}}Object.defineProperties(ea.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),o(ea.prototype.cancel,"cancel"),o(ea.prototype.getReader,"getReader"),o(ea.prototype.pipeThrough,"pipeThrough"),o(ea.prototype.pipeTo,"pipeTo"),o(ea.prototype.tee,"tee"),o(ea.prototype.values,"values"),"symbol"==typeof s.toStringTag&&Object.defineProperty(ea.prototype,s.toStringTag,{value:"ReadableStream",configurable:!0}),"symbol"==typeof s.asyncIterator&&Object.defineProperty(ea.prototype,s.asyncIterator,{value:ea.prototype.values,writable:!0,configurable:!0});const pa=e=>e.byteLength;o(pa,"size");class da{constructor(e){W(e,1,"ByteLengthQueuingStrategy"),e=oa(e,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!ca(this))throw la("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!ca(this))throw la("size");return pa}}function la(e){return new TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function ca(e){return!!i(e)&&!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")&&e instanceof da}Object.defineProperties(da.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof s.toStringTag&&Object.defineProperty(da.prototype,s.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});const ma=()=>1;o(ma,"size");class ua{constructor(e){W(e,1,"CountQueuingStrategy"),e=oa(e,"First parameter"),this._countQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!fa(this))throw ha("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!fa(this))throw ha("size");return ma}}function ha(e){return new TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function fa(e){return!!i(e)&&!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")&&e instanceof ua}function ga(e,t,a){return B(e,a),a=>T(e,t,[a])}function ya(e,t,a){return B(e,a),a=>S(e,t,[a])}function va(e,t,a){return B(e,a),(a,s)=>T(e,t,[a,s])}Object.defineProperties(ua.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof s.toStringTag&&Object.defineProperty(ua.prototype,s.toStringTag,{value:"CountQueuingStrategy",configurable:!0});class wa{constructor(e={},t={},a={}){void 0===e&&(e=null);const s=Ge(t,"Second parameter"),n=Ge(a,"Third parameter"),i=function(e,t){V(e,t);const a=null==e?void 0:e.flush,s=null==e?void 0:e.readableType,n=null==e?void 0:e.start,i=null==e?void 0:e.transform,r=null==e?void 0:e.writableType;return{flush:void 0===a?void 0:ga(a,e,`${t} has member 'flush' that`),readableType:s,start:void 0===n?void 0:ya(n,e,`${t} has member 'start' that`),transform:void 0===i?void 0:va(i,e,`${t} has member 'transform' that`),writableType:r}}(e,"First parameter");if(void 0!==i.readableType)throw new RangeError("Invalid readableType specified");if(void 0!==i.writableType)throw new RangeError("Invalid writableType specified");const r=He(n,0),o=Je(n),p=He(s,1),d=Je(s);let l;!function(e,t,a,s,n,i){function r(){return t}e._writableState="writable",e._writableStoredError=void 0,e._writableHasInFlightOperation=!1,e._writableStarted=!1,e._writable=function(e,t,a,s,n,i,r){return new tt({start(a){e._writableController=a;try{const t=a.signal;void 0!==t&&t.addEventListener("abort",()=>{"writable"===e._writableState&&(e._writableState="erroring",t.reason&&(e._writableStoredError=t.reason))})}catch(e){}return w(t(),()=>(e._writableStarted=!0,ja(e),null),t=>{throw e._writableStarted=!0,Ma(e,t),t})},write:t=>(function(e){e._writableHasInFlightOperation=!0}(e),w(a(t),()=>(function(e){e._writableHasInFlightOperation=!1}(e),ja(e),null),t=>{throw function(e,t){e._writableHasInFlightOperation=!1,Ma(e,t)}(e,t),t})),close:()=>(function(e){e._writableHasInFlightOperation=!0}(e),w(s(),()=>(function(e){e._writableHasInFlightOperation=!1,"erroring"===e._writableState&&(e._writableStoredError=void 0),e._writableState="closed"}(e),null),t=>{throw function(e,t){e._writableHasInFlightOperation=!1,e._writableState,Ma(e,t)}(e,t),t})),abort:t=>(e._writableState="errored",e._writableStoredError=t,n(t))},{highWaterMark:i,size:r})}(e,r,function(t){return function(e,t){const a=e._transformStreamController;return e._backpressure?w(e._backpressureChangePromise,()=>{if("erroring"===(at(e._writable)?e._writable._state:e._writableState))throw at(e._writable)?e._writable._storedError:e._writableStoredError;return Ea(a,t)}):Ea(a,t)}(e,t)},function(){return function(e){const t=e._transformStreamController,a=t._flushAlgorithm();return Ca(t),w(a,()=>{if("errored"===e._readableState)throw e._readableStoredError;Na(e)&&Ra(e)},t=>{throw _a(e,t),e._readableStoredError})}(e)},function(t){return function(e,t){return _a(e,t),u(void 0)}(e,t)},a,s),e._readableState="readable",e._readableStoredError=void 0,e._readableCloseRequested=!1,e._readablePulling=!1,e._readable=function(e,t,a,s,n,i){return new ea({start:a=>(e._readableController=a,t().catch(t=>{Pa(e,t)})),pull:()=>(e._readablePulling=!0,a().catch(t=>{Pa(e,t)})),cancel:t=>(e._readableState="closed",s(t))},{highWaterMark:n,size:i})}(e,r,function(){return function(e){return Ta(e,!1),e._backpressureChangePromise}(e)},function(t){return Sa(e,t),u(void 0)},n,i),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,Ta(e,!0),e._transformStreamController=void 0}(this,m(e=>{l=e}),p,d,r,o),function(e,t){const a=Object.create(ka.prototype);let s,n;s=void 0!==t.transform?e=>t.transform(e,a):e=>{try{return Aa(a,e),u(void 0)}catch(e){return h(e)}},n=void 0!==t.flush?()=>t.flush(a):()=>u(void 0),function(e,t,a,s){t._controlledTransformStream=e,e._transformStreamController=t,t._transformAlgorithm=a,t._flushAlgorithm=s}(e,a,s,n)}(this,i),void 0!==i.start?l(i.start(this._transformStreamController)):l(void 0)}get readable(){if(!ba(this))throw Da("readable");return this._readable}get writable(){if(!ba(this))throw Da("writable");return this._writable}}function ba(e){return!!i(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")&&e instanceof wa}function _a(e,t){Pa(e,t),Sa(e,t)}function Sa(e,t){Ca(e._transformStreamController),function(e,t){e._writableController.error(t),"writable"===e._writableState&&La(e,t)}(e,t),e._backpressure&&Ta(e,!1)}function Ta(e,t){void 0!==e._backpressureChangePromise&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=m(t=>{e._backpressureChangePromise_resolve=t}),e._backpressure=t}Object.defineProperties(wa.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),"symbol"==typeof s.toStringTag&&Object.defineProperty(wa.prototype,s.toStringTag,{value:"TransformStream",configurable:!0});class ka{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!xa(this))throw $a("desiredSize");return Oa(this._controlledTransformStream)}enqueue(e){if(!xa(this))throw $a("enqueue");Aa(this,e)}error(e){if(!xa(this))throw $a("error");var t;t=e,_a(this._controlledTransformStream,t)}terminate(){if(!xa(this))throw $a("terminate");!function(e){const t=e._controlledTransformStream;Na(t)&&Ra(t),Sa(t,new TypeError("TransformStream terminated"))}(this)}}function xa(e){return!!i(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")&&e instanceof ka}function Ca(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0}function Aa(e,t){const a=e._controlledTransformStream;if(!Na(a))throw new TypeError("Readable side is not in a state that permits enqueue");try{!function(e,t){e._readablePulling=!1;try{e._readableController.enqueue(t)}catch(t){throw Pa(e,t),t}}(a,t)}catch(e){throw Sa(a,e),a._readableStoredError}const s=function(e){return!function(e){return!!Na(e)&&(!!e._readablePulling||Oa(e)>0)}(e)}(a);s!==a._backpressure&&Ta(a,!0)}function Ea(e,t){return w(e._transformAlgorithm(t),void 0,t=>{throw _a(e._controlledTransformStream,t),t})}function $a(e){return new TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function Da(e){return new TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}function Na(e){return!e._readableCloseRequested&&"readable"===e._readableState}function Ra(e){e._readableState="closed",e._readableCloseRequested=!0,e._readableController.close()}function Pa(e,t){"readable"===e._readableState&&(e._readableState="errored",e._readableStoredError=t),e._readableController.error(t)}function Oa(e){return e._readableController.desiredSize}function Ma(e,t){"writable"!==e._writableState?Ia(e):La(e,t)}function La(e,t){e._writableState="erroring",e._writableStoredError=t,!function(e){return e._writableHasInFlightOperation}(e)&&e._writableStarted&&Ia(e)}function Ia(e){e._writableState="errored"}function ja(e){"erroring"===e._writableState&&Ia(e)}Object.defineProperties(ka.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),o(ka.prototype.enqueue,"enqueue"),o(ka.prototype.error,"error"),o(ka.prototype.terminate,"terminate"),"symbol"==typeof s.toStringTag&&Object.defineProperty(ka.prototype,s.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});var Fa=a(2937);async function*Va(e){const t=e.byteOffset+e.byteLength;let a=e.byteOffset;for(;a!==t;){const s=Math.min(t-a,65536),n=e.buffer.slice(a,a+s);a+=n.byteLength,yield new Uint8Array(n)}}async function*Ba(e){let t=0;for(;t!==e.size;){const a=e.slice(t,Math.min(e.size,t+65536)),s=await a.arrayBuffer();t+=s.byteLength,yield new Uint8Array(s)}}async function*qa(e,t=!1){for(const a of e)ArrayBuffer.isView(a)?t?yield*Va(a):yield a:(0,Fa.T)(a.stream)?yield*a.stream():yield*Ba(a)}var Wa,Ua,za,Ha=function(e,t,a,s){if("a"===a&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===a?s:"a"===a?s.call(e):s?s.value:t.get(e)},Ja=function(e,t,a,s,n){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(e,a):n?n.value=a:t.set(e,a),a};class Ga{constructor(e=[],t={}){if(Wa.set(this,[]),Ua.set(this,""),za.set(this,0),null!=t||(t={}),"object"!=typeof e||null===e)throw new TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.");if(!(0,Fa.T)(e[Symbol.iterator]))throw new TypeError("Failed to construct 'Blob': The object must have a callable @@iterator property.");if("object"!=typeof t&&!(0,Fa.T)(t))throw new TypeError("Failed to construct 'Blob': parameter 2 cannot convert to dictionary.");const a=new TextEncoder;for(const t of e){let e;e=ArrayBuffer.isView(t)?new Uint8Array(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)):t instanceof ArrayBuffer?new Uint8Array(t.slice(0)):t instanceof Ga?t:a.encode(String(t)),Ja(this,za,Ha(this,za,"f")+(ArrayBuffer.isView(e)?e.byteLength:e.size),"f"),Ha(this,Wa,"f").push(e)}const s=void 0===t.type?"":String(t.type);Ja(this,Ua,/^[\x20-\x7E]*$/.test(s)?s:"","f")}static[(Wa=new WeakMap,Ua=new WeakMap,za=new WeakMap,Symbol.hasInstance)](e){return Boolean(e&&"object"==typeof e&&(0,Fa.T)(e.constructor)&&((0,Fa.T)(e.stream)||(0,Fa.T)(e.arrayBuffer))&&/^(Blob|File)$/.test(e[Symbol.toStringTag]))}get type(){return Ha(this,Ua,"f")}get size(){return Ha(this,za,"f")}slice(e,t,a){return new Ga(function*(e,t,a=0,s){null!=s||(s=t);let n=a<0?Math.max(t+a,0):Math.min(a,t),i=s<0?Math.max(t+s,0):Math.min(s,t);const r=Math.max(i-n,0);let o=0;for(const t of e){if(o>=r)break;const e=ArrayBuffer.isView(t)?t.byteLength:t.size;if(n&&e<=n)n-=e,i-=e;else{let a;ArrayBuffer.isView(t)?(a=t.subarray(n,Math.min(e,i)),o+=a.byteLength):(a=t.slice(n,Math.min(e,i)),o+=a.size),i-=e,n=0,yield a}}}(Ha(this,Wa,"f"),this.size,e,t),{type:a})}async text(){const e=new TextDecoder;let t="";for await(const a of qa(Ha(this,Wa,"f")))t+=e.decode(a,{stream:!0});return t+=e.decode(),t}async arrayBuffer(){const e=new Uint8Array(this.size);let t=0;for await(const a of qa(Ha(this,Wa,"f")))e.set(a,t),t+=a.length;return e.buffer}stream(){const e=qa(Ha(this,Wa,"f"),!0);return new ea({async pull(t){const{value:a,done:s}=await e.next();if(s)return queueMicrotask(()=>t.close());t.enqueue(a)},async cancel(){await e.return()}})}get[Symbol.toStringTag](){return"Blob"}}Object.defineProperties(Ga.prototype,{type:{enumerable:!0},size:{enumerable:!0},slice:{enumerable:!0},stream:{enumerable:!0},text:{enumerable:!0},arrayBuffer:{enumerable:!0}})},9329:(e,t,a)=>{a.a(e,async(e,s)=>{try{a.d(t,{Nt:()=>d,vf:()=>l});var n=a(5814),i=a(8116),r=a(1967);let o=null;try{const c=await a.e(249).then(a.t.bind(a,5249,23));o=c.default||c}catch(m){console.warn("iconv-lite not available, using utf8 fallback for Windows encoding")}class p extends r.oS{static HIGH_RISK_COMMANDS=["rm -rf","rm -r","del /q /s","erase /f /s","format","mkfs","dd if=","mv /force","shred","wipe","truncate -s 0","> filename","chmod -R 000","chown -R root:root"];isHighRiskCommand(e){const t=e.toLowerCase().trim();return p.HIGH_RISK_COMMANDS.some(e=>t.includes(e.toLowerCase()))}getShellCommand(e){return"win32"===i.platform()?{shell:"cmd.exe",args:[],cmd:e}:{shell:"/bin/sh",args:["-c"],cmd:e}}getDefinition(){return{name:"shell",description:'Execute a shell command on the system.\n\nIMPORTANT SAFETY NOTES:\n- High-risk commands (delete, format, etc.) require user confirmation\n- Command execution depends on the operating system (Windows/Mac/Linux)\n- Use with caution as commands can modify your system\n\nExamples:\n- shell({ command: "ls -la" }) - List directory contents (Mac/Linux)\n- shell({ command: "dir" }) - List directory contents (Windows)\n- shell({ command: "npm install", timeout: 30000 }) - Run npm install with 30s timeout',input_schema:{type:"object",properties:{command:{type:"string",description:"The shell command to execute"},timeout:{type:"number",description:"Optional timeout in milliseconds (default: 60000)",default:6e4},captureOutput:{type:"boolean",description:"Whether to capture and return command output (default: true)",default:!0}},required:["command"]},requiresConfirmation:!1}}getDynamicDefinition(e){return{...this.getDefinition(),requiresConfirmation:this.isHighRiskCommand(e.command)}}isCommandNotFoundError(e,t){const a=e.toLowerCase();return("win32"===t?["不是内部或外部命令","不是可运行的程序","is not recognized as an internal or external command","is not recognized as","'command' is not recognized","找不到命令","无法将","command not found"]:["command not found","not found","no such file or directory","cannot find","bash: command not found","sh: command not found","zsh: command not found"]).some(e=>a.includes(e))}extractCommandName(e){const t=e.trim(),a=t.match(/^(\S+)/);return a?a[1]:t}generateCommandNotFoundMessage(e,t){const a="win32"===t?"Windows":"darwin"===t?"macOS":"Linux",s={git:{win:"Download from https://git-scm.com/download/win or use 'winget install Git.Git'",unix:"Install using: sudo apt-get install git (Ubuntu/Debian) or brew install git (macOS)",description:"Version control system"},python:{win:"Download from https://www.python.org/downloads/ or use 'winget install Python.Python.3'",unix:"Install using: sudo apt-get install python3 (Ubuntu/Debian) or brew install python3 (macOS)",description:"Python programming language"},node:{win:"Download from https://nodejs.org/ or use 'winget install OpenJS.NodeJS'",unix:"Install using: sudo apt-get install nodejs (Ubuntu/Debian) or brew install node (macOS)",description:"Node.js JavaScript runtime"},npm:{win:"Install Node.js from https://nodejs.org/ (includes npm)",unix:"Install Node.js (includes npm): sudo apt-get install nodejs npm or brew install node",description:"Node Package Manager (comes with Node.js)"},docker:{win:"Download Docker Desktop from https://www.docker.com/products/docker-desktop",unix:"Install using: sudo apt-get install docker.io (Ubuntu/Debian) or brew install docker (macOS)",description:"Container platform"},curl:{win:"Usually built-in on Windows 10+. If missing, download from https://curl.se/windows/",unix:"Install using: sudo apt-get install curl (Ubuntu/Debian) or brew install curl (macOS)",description:"Command-line tool for transferring data with URLs"},wget:{win:"Download from https://eternallybored.org/misc/wget/ or use 'winget install GNU.Wget'",unix:"Install using: sudo apt-get install wget (Ubuntu/Debian) or brew install wget (macOS)",description:"Network downloader"},make:{win:"Install via Chocolatey: choco install make or use WSL",unix:"Install using: sudo apt-get install build-essential (Ubuntu/Debian) or xcode-select --install (macOS)",description:"Build automation tool"},gcc:{win:"Install MinGW from http://mingw.org/ or use Visual Studio Build Tools",unix:"Install using: sudo apt-get install build-essential (Ubuntu/Debian) or xcode-select --install (macOS)",description:"GNU Compiler Collection"},code:{win:"Install VS Code from https://code.visualstudio.com/ and add to PATH during installation",unix:"Install VS Code and run: sudo ln -s /Applications/Visual\\ Studio\\ Code.app/Contents/Resources/app/bin/code /usr/local/bin/code",description:"Visual Studio Code editor"}}[e.toLowerCase()];let n=`❌ Command Not Found: '${e}'\n\n`;return n+=`🖥️ Current Environment: ${a}\n\n`,s?(n+=`📦 About: ${s.description}\n\n`,n+="💡 Installation Suggestion:\n","win32"===t&&s.win?n+=` ${s.win}\n`:"win32"!==t&&s.unix&&(n+=` ${s.unix}\n`)):(n+="💡 Suggestions:\n",n+=" 1. Check if the command is correctly spelled\n",n+=" 2. Verify that the required software is installed\n",n+=" 3. Check if the command is in your system PATH\n","win32"===t?(n+=" 4. Try searching in Windows Store or use package managers like:\n",n+=" - winget (built-in): winget search <package-name>\n",n+=" - Chocolatey: choco install <package-name>\n",n+=" - Scoop: scoop install <package-name>\n"):(n+=" 4. Try using package managers:\n","darwin"===t?(n+=" - Homebrew: brew install <package-name>\n",n+=" - MacPorts: port install <package-name>\n"):(n+=" - apt: sudo apt-get install <package-name> (Ubuntu/Debian)\n",n+=" - yum: sudo yum install <package-name> (CentOS/RHEL)\n",n+=" - dnf: sudo dnf install <package-name> (Fedora)\n"))),n+="\n⚠️ Please install the required command before proceeding.\n",n+=" The AI assistant cannot continue without this tool being available.",n}execute(e){try{const{command:t,timeout:a=6e4,captureOutput:s=!0}=e,r=i.platform(),{shell:p,args:d,cmd:l}=this.getShellCommand(t),c={shell:p,timeout:a,encoding:"utf8",windowsHide:!0,windowsVerbatimArguments:"win32"===r},m=`Running on ${r} with ${p}`,u=`Executing command: ${t}`;if(!s){let e=t;return e="win32"===r?`chcp 65001 > nul && ${l}`:[...d,l].join(" "),(0,n.exec)(e,c),this.createToolResult({success:!0,message:"Command started in background"},`${m}\n${u}\n\nCommand started in background. No output will be captured.`,!0)}try{let e="";if("win32"===r){const t=`chcp 65001 >nul 2>&1 && ${l}`,a=(0,n.spawnSync)("cmd.exe",["/c",t],{stdio:"pipe",windowsHide:!0,encoding:"buffer"}),s=a.stdout||Buffer.alloc(0),i=a.stderr||Buffer.alloc(0),r=Buffer.concat([s,i]);try{if(o){const t=["cp936","gbk","utf8","gb2312","big5"];let a=!1;for(const s of t)try{if(e=o.decode(r,s),/[\u4e00-\u9fff]/.test(e)||e.length>0){a=!0;break}}catch(e){continue}a||(e=r.toString("utf8"))}else e=r.toString("utf8");0===a.status&&e.trim()&&(e+="\n\n✅ Windows编码已优化处理")}catch(t){e=r.toString("utf8")}}else{const t=[...d,l].join(" ");e=(0,n.execSync)(t,c).toString()}if(this.isCommandNotFoundError(e,r)){const a=this.extractCommandName(t),s=this.generateCommandNotFoundMessage(a,r);return this.createToolResult({error:e,success:!1,commandNotFound:!0},`${m}\n${u}\n\n${s}\n\nOriginal error:\n${e}`,!0)}return this.createToolResult({output:e,success:!0},`${m}\n${u}\n\nCommand output:\n${e}`)}catch(e){let a="";if("win32"===r&&e.stderr){const t=Buffer.isBuffer(e.stderr)?e.stderr:Buffer.from(e.stderr);if(o)try{const e=["cp936","gbk","utf8","gb2312"];let s="";for(const n of e)try{if(s=o.decode(t,n),s.length>0){a+=s;break}}catch(e){continue}s||(a+=t.toString("utf8"))}catch(e){a+=t.toString("utf8")}else a+=t.toString("utf8")}else e.stderr&&(a+=e.stderr),e.stdout&&(a+=e.stdout),a||(a=String(e));if(this.isCommandNotFoundError(a,r)){const e=this.extractCommandName(t),s=this.generateCommandNotFoundMessage(e,r);return this.createToolResult({error:a,success:!1,commandNotFound:!0},`${m}\n${u}\n\n${s}\n\nOriginal error:\n${a}`,!0)}return this.createToolResult({error:a,success:!1},`${m}\n${u}\n\nCommand failed with error:\n${a}`,!0)}}catch(e){return this.formatError("Cannot execute shell command",e)}}formatAction(e){const t=super.formatAction(e);return this.isHighRiskCommand(e.command)?`${t} ⚠️ HIGH RISK COMMAND - Requires confirmation!`:t}}const d=new p;function l(e){return Promise.resolve(d.execute(e))}s()}catch(u){s(u)}},1)},9356:(e,t,a)=>{a.d(t,{J:()=>o});var s,n=a(5955),i=a(9187),r=a(4237);!function(e){e.CRITICAL="critical",e.IMPORTANT="important",e.NORMAL="normal"}(s||(s={}));class o{options;constructor(e={}){this.options={enabled:e.enabled??!0,threshold:e.threshold??.8,minKeepMessages:e.minKeepMessages??3,maxKeepMessages:e.maxKeepMessages??20,targetUsageAfterCompression:e.targetUsageAfterCompression??.6,useMixedSummary:e.useMixedSummary??!0,llmSummaryTokenThreshold:e.llmSummaryTokenThreshold??500}}shouldCompress(e,t){return!!this.options.enabled&&(0,n.au)(e)/t>=this.options.threshold}async compress(e,t,a){const s=(0,n.au)(e),r=e.length;(0,i.fH)(`开始上下文压缩: ${r} 条消息, ${s} tokens`);const o=this.calculateDynamicWindowSize(e,t);(0,i.MD)(`动态窗口大小: 保留最近 ${o} 条完整消息`);const p=e.slice(0,-o),d=e.slice(-o);if(0===p.length)return(0,i.JE)("没有需要压缩的消息,跳过压缩"),{messages:e,stats:{originalMessageCount:r,originalTokenCount:s,compressedMessageCount:r,compressedTokenCount:s,compressionRatio:1,llmSummaryCount:0,heuristicSummaryCount:0}};const{summaryMessage:l,llmCount:c,heuristicCount:m}=await this.createCompressedSummary(p,a),u=[l,...d],h=(0,n.au)(u),f={originalMessageCount:r,originalTokenCount:s,compressedMessageCount:u.length,compressedTokenCount:h,compressionRatio:h/s,llmSummaryCount:c,heuristicSummaryCount:m};return this.logCompressionStats(f),{messages:u,stats:f}}calculateDynamicWindowSize(e,t){const a=(0,n.au)(e)/t;let s;return a>=.9?(s=this.options.minKeepMessages,(0,i.MD)("Token压力极高 (>=90%), 使用最小窗口")):a>=.85?(s=Math.floor(this.options.minKeepMessages+.25*(this.options.maxKeepMessages-this.options.minKeepMessages)),(0,i.MD)("Token压力高 (>=85%), 使用较小窗口")):a>=.8?(s=Math.floor(this.options.minKeepMessages+.5*(this.options.maxKeepMessages-this.options.minKeepMessages)),(0,i.MD)("Token压力中等 (>=80%), 使用中等窗口")):(s=this.options.maxKeepMessages,(0,i.MD)("Token压力正常, 使用最大窗口")),Math.min(s,e.length)}async createCompressedSummary(e,t){const a=[];let r=0,o=0;const p=this.groupMessages(e);for(const e of p){const p=(0,n.au)(e),d=this.assessMessageImportance(e);let l;this.options.useMixedSummary&&d===s.IMPORTANT&&p>=this.options.llmSummaryTokenThreshold&&t?(l=await this.generateLLMSummary(e,t),r++,(0,i.MD)(`使用LLM摘要 (${e.length}条消息, ${p} tokens)`)):(l=this.generateHeuristicSummary(e),o++,(0,i.MD)(`使用启发式摘要 (${e.length}条消息, ${p} tokens)`)),a.push(l)}return{summaryMessage:{role:"system",content:`[历史上下文摘要]\n以下是之前的对话摘要,已压缩以节省token:\n\n${a.join("\n\n---\n\n")}\n\n[摘要结束]`},llmCount:r,heuristicCount:o}}groupMessages(e){const t=[];for(let a=0;a<e.length;a+=3)t.push(e.slice(a,a+3));return t}assessMessageImportance(e){for(const t of e){if(!t.content)continue;const e=t.content.toLowerCase();if(e.includes("error")||e.includes("warning")||e.includes("错误")||e.includes("警告"))return s.IMPORTANT;if(t.tool_calls&&t.tool_calls.length>0)return s.IMPORTANT;if("system"===t.role)return s.IMPORTANT;if(t.content&&t.content.length>1e3)return s.IMPORTANT}return s.NORMAL}async generateLLMSummary(e,t){try{const{LITE_MODEL:s}=await Promise.resolve().then(a.bind(a,6893)),n=e.filter(e=>e.content).map(e=>`${e.role}: ${e.content}`).join("\n"),i=await t({model:s(),messages:[{role:"system",content:"你是一个对话摘要助手。请将下面的对话压缩成简洁的摘要(不超过150字),保留关键操作、结果和重要信息。"},{role:"user",content:n}],temperature:.1,max_tokens:200,useCompression:!0});return`📝 ${i.choices?.[0]?.message?.content?.trim()||"执行完成"}`}catch(t){return(0,i.JE)(`LLM摘要失败,降级到启发式方法: ${t instanceof Error?t.message:String(t)}`),this.generateHeuristicSummary(e)}}generateHeuristicSummary(e){const t=[],a=[];let s=!1;for(const n of e){if(n.tool_calls&&n.tool_calls.length>0)for(const e of n.tool_calls){const a=e.function.name;"think"!==a&&t.push(a)}if(n.content&&(n.content.includes("Error")||n.content.includes("错误"))&&(s=!0),n.content){const e=n.content.match(/\b(created|updated|fixed|implemented|tested|deployed|成功|失败|创建|更新|修复|实现)\b/gi);e&&a.push(...e.slice(0,3))}}let n=`执行了 ${e.length} 轮对话`;return t.length>0&&(n+=`, 调用工具: ${[...new Set(t)].slice(0,3).join(", ")}`),a.length>0&&(n+=`, 关键操作: ${[...new Set(a)].slice(0,3).join(", ")}`),s&&(n+=" ⚠️ 包含错误"),`💬 ${n}`}logCompressionStats(e){const t=(100*e.compressionRatio).toFixed(1),a=(100*(1-e.compressionRatio)).toFixed(1);console.log(r.Ay.green("\n✨ 上下文压缩完成")),console.log(r.Ay.cyan(` 消息数: ${e.originalMessageCount} → ${e.compressedMessageCount} (${e.compressedMessageCount-e.originalMessageCount})`)),console.log(r.Ay.cyan(` Token: ${e.originalTokenCount} → ${e.compressedTokenCount} (节省 ${a}%)`)),console.log(r.Ay.cyan(` 压缩比: ${t}%`)),console.log(r.Ay.cyan(` 摘要方式: LLM ${e.llmSummaryCount}次, 启发式 ${e.heuristicSummaryCount}次\n`)),(0,i.fH)(`上下文压缩: ${e.originalMessageCount}条 → ${e.compressedMessageCount}条, ${e.originalTokenCount}tokens → ${e.compressedTokenCount}tokens (${t}%)`)}updateOptions(e){this.options={...this.options,...e},(0,i.MD)(`压缩配置已更新: ${JSON.stringify(this.options)}`)}getOptions(){return{...this.options}}}},9440:(e,t,a)=>{a.d(t,{C3:()=>y,Ck:()=>c,JZ:()=>g,L6:()=>m,O6:()=>h,km:()=>u,saveSession:()=>f});var s=a(4421),n=a(4237),i=a(6132),r=a(9033),o=a(6645),p=a(4086);const d=(0,i.Do)("session.jsonl");function l(){return{sessionId:(0,p.f6)(),messages:[],tasks:[],currentTask:null,currentTaskId:null,createdAt:(new Date).toISOString(),updatedAt:(new Date).toISOString()}}let c=l();function m(){try{if((0,s.existsSync)(d)){const e=new o.KX(d).readAllSync(),t=e.length>0?e[0]:null;return c={sessionId:t&&t.sessionId||(0,p.f6)(),messages:t&&t.messages||[],tasks:t&&t.tasks||[],currentTask:t&&t.currentTask||null,currentTaskId:t&&t.currentTaskId||null,createdAt:t&&t.createdAt||(new Date).toISOString(),updatedAt:(new Date).toISOString()},!0}}catch(e){const t=e instanceof Error?e.message:String(e);console.log(n.Ay.yellow(`Warning: Could not load session - ${t}`))}return!1}function u(e){const t=(0,p.eJ)(),a={id:t,description:e,createdAt:(new Date).toISOString(),messageIds:[]};return c.tasks.push(a),c.currentTask=e,c.currentTaskId=t,t}function h(e){c.currentTaskId=e,c.updatedAt=(new Date).toISOString(),f(),console.log(n.Ay.blue(`[会话管理] 当前任务ID已设置为: ${e}`))}function f(e,t=null){try{if(t&&t!==c.currentTask&&u(t),e){const t=e.map(e=>function(e){if(c.currentTaskId&&e){const t=c.currentTaskId;e.taskId=t;const a=c.tasks.find(e=>e.id===t);if(a&&!e.id){const t=(0,p.lk)();e.id=t,a.messageIds.push(t)}}return e}({...e}));c={...c,messages:t,updatedAt:(new Date).toISOString()}}else c={...c,updatedAt:(new Date).toISOString()};(0,s.existsSync)(d)&&(0,s.writeFileSync)(d,"","utf-8"),new o.AI(d).create(c)}catch(e){const t=e instanceof Error?e.message:String(e);console.log(n.Ay.yellow(`Warning: Could not save session - ${t}`))}}function g(){return function(){try{c.messages&&c.messages.length>0&&(0,r.JZ)(c)&&console.log(n.Ay.green("✓ Session archived")),c=l(),(0,s.existsSync)(d)&&(0,s.writeFileSync)(d,"","utf-8")}catch(e){const t=e instanceof Error?e.message:String(e);console.log(n.Ay.yellow(`Warning: Failed to archive session - ${t}`)),c=l();try{(0,s.existsSync)(d)&&(0,s.writeFileSync)(d,"","utf-8")}catch(e){}}}()}function y(){return function(){if(c.currentTask&&c.currentTaskId){const e=c.tasks.find(e=>e.id===c.currentTaskId);if(e){const t=e.tokenCount||0;console.log(n.Ay.green(`\n✅ 任务完成: ${c.currentTask}`)),console.log(n.Ay.blue(`📊 Token总开销: ${t.toLocaleString()} tokens`))}c.currentTask=null,c.currentTaskId=null,f()}}()}},9868:(e,t,a)=>{var s,n;e.exports=(s={StringDecoder:()=>h.StringDecoder},n={},a.d(n,s),n)}},x={};function C(e){var t=x[e];if(void 0!==t)return t.exports;var a=x[e]={exports:{}};return k[e].call(a.exports,a,a.exports,C),a.exports}C.m=k,f="function"==typeof Symbol,g=f?Symbol("webpack queues"):"__webpack_queues__",y=f?Symbol("webpack exports"):"__webpack_exports__",v=f?Symbol("webpack error"):"__webpack_error__",w=e=>{e&&e.d<1&&(e.d=1,e.forEach(e=>e.r--),e.forEach(e=>e.r--?e.r++:e()))},C.a=(e,t,a)=>{var s;a&&((s=[]).d=-1);var n,i,r,o=new Set,p=e.exports,d=new Promise((e,t)=>{r=t,i=e});d[y]=p,d[g]=e=>(s&&e(s),o.forEach(e),d.catch(e=>{})),e.exports=d,t(e=>{var t;n=(e=>e.map(e=>{if(null!==e&&"object"==typeof e){if(e[g])return e;if(e.then){var t=[];t.d=0,e.then(e=>{a[y]=e,w(t)},e=>{a[v]=e,w(t)});var a={};return a[g]=e=>e(t),a}}var s={};return s[g]=e=>{},s[y]=e,s}))(e);var a=()=>n.map(e=>{if(e[v])throw e[v];return e[y]}),i=new Promise(e=>{(t=()=>e(a)).r=0;var i=e=>e!==s&&!o.has(e)&&(o.add(e),e&&!e.d&&(t.r++,e.push(t)));n.map(e=>e[g](i))});return t.r?i:a()},e=>(e?r(d[v]=e):i(p),w(s))),s&&s.d<0&&(s.d=0)},C.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return C.d(t,{a:t}),t},_=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,C.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var a=Object.create(null);C.r(a);var s={};b=b||[null,_({}),_([]),_(_)];for(var n=2&t&&e;("object"==typeof n||"function"==typeof n)&&!~b.indexOf(n);n=_(n))Object.getOwnPropertyNames(n).forEach(t=>s[t]=()=>e[t]);return s.default=()=>e,C.d(a,s),a},C.d=(e,t)=>{for(var a in t)C.o(t,a)&&!C.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},C.f={},C.e=e=>Promise.all(Object.keys(C.f).reduce((t,a)=>(C.f[a](e,t),t),[])),C.u=e=>e+".nium.js",C.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),C.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},S={792:0},T=e=>{var t,a,{__webpack_esm_ids__:s,__webpack_esm_modules__:n,__webpack_esm_runtime__:i}=e,r=0;for(t in n)C.o(n,t)&&(C.m[t]=n[t]);for(i&&i(C);r<s.length;r++)a=s[r],C.o(S,a)&&S[a]&&S[a][0](),S[s[r]]=0},C.f.j=(e,t)=>{var a=C.o(S,e)?S[e]:void 0;if(0!==a)if(a)t.push(a[1]);else{var s=import("./"+C.u(e)).then(T,t=>{throw 0!==S[e]&&(S[e]=void 0),t});s=Promise.race([s,new Promise(t=>a=S[e]=[t])]),t.push(a[1]=s)}};var A=C(8321);A=await A;
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var fa=Object.defineProperty;var w=(r,e)=>()=>(r&&(e=r(r=0)),e);var U=(r,e)=>{for(var t in e)fa(r,t,{get:e[t],enumerable:!0})};import{existsSync as de,mkdirSync as Ot,copyFileSync as Qo,writeFileSync as ha}from"fs";import{join as K,dirname as Zo}from"path";import{fileURLToPath as ya}from"url";import Y from"chalk";function es(){let r=[K(Dt,"..","..","examples"),K(Dt,"..","examples"),K(Dt,"examples"),K(Dt,"..","..","..","examples")];for(let e of r)if(de(e))return Zo(e);return K(Dt,"..")}function ts(){return Pr||(Pr=K(process.cwd(),".nium")),Pr}function Sa(){if(!Ir){let r=es();Ir=K(r,"examples","config.example.json")}return Ir}function Ca(){if(!Er){let r=es();Er=K(r,"examples",".env.example")}return Er}function ns(){let r=ts(),e=Sa();try{if(!de(r)){console.log(Y.blue("\u{1F527} \u521D\u59CB\u5316\u5DE5\u4F5C\u76EE\u5F55...")),Ot(r,{recursive:!0}),console.log(Y.green("\u2713 \u521B\u5EFA .nium \u76EE\u5F55"));let c=K(r,"config.json");de(e)?(Qo(e,c),console.log(Y.green("\u2713 \u590D\u5236 config.example.json \u5230 .nium/config.json")),console.log(Y.yellow(`
|
|
3
|
+
\u26A0\uFE0F \u8BF7\u7F16\u8F91 .nium/config.json \u6587\u4EF6\u914D\u7F6E API \u5BC6\u94A5\u548C\u6A21\u578B
|
|
4
|
+
`))):(console.log(Y.yellow(`\u26A0\uFE0F \u672A\u627E\u5230 config.example.json: ${e}`)),ha(c,JSON.stringify({models:{defaultModel:{apiKey:"your-api-key-here",baseURL:"https://api.openai.com/v1",model:"gpt-4o",provider:"openai",maxToken:128e3},liteModel:{apiKey:"your-api-key-here",baseURL:"https://api.openai.com/v1",model:"gpt-3.5-turbo",provider:"openai",maxToken:16385}},mcpServers:[]},null,2)),console.log(Y.green("\u2713 \u521B\u5EFA\u9ED8\u8BA4\u7684 .nium/config.json \u6587\u4EF6")),console.log(Y.yellow(`
|
|
5
|
+
\u26A0\uFE0F \u8BF7\u7F16\u8F91 .nium/config.json \u6587\u4EF6\u914D\u7F6E API \u5BC6\u94A5\u548C\u6A21\u578B
|
|
6
|
+
`)))}let t=K(r,"agents");de(t)||(Ot(t,{recursive:!0}),console.log(Y.green("\u2713 \u521B\u5EFA .nium/agents \u76EE\u5F55")));let n=K(r,"docs");de(n)||(Ot(n,{recursive:!0}),console.log(Y.green("\u2713 \u521B\u5EFA .nium/docs \u76EE\u5F55")));let o=K(r,"archives");de(o)||(Ot(o,{recursive:!0}),console.log(Y.green("\u2713 \u521B\u5EFA .nium/archives \u76EE\u5F55")));let s=K(r,"logs");de(s)||(Ot(s,{recursive:!0}),console.log(Y.green("\u2713 \u521B\u5EFA .nium/logs \u76EE\u5F55")));let i=Ca(),a=K(r,".env");return de(a)||(de(i)?(Qo(i,a),console.log(Y.green("\u2713 \u590D\u5236 examples/.env.example \u5230 .nium/.env"))):(console.log(Y.yellow(`\u26A0\uFE0F \u672A\u627E\u5230 .env.example: ${i}`)),console.log(Y.yellow(" \u5C06\u4F7F\u7528\u9ED8\u8BA4\u73AF\u5883\u53D8\u91CF\u914D\u7F6E")))),r}catch(t){console.log(Y.red(`\u274C \u521D\u59CB\u5316\u5DE5\u4F5C\u76EE\u5F55\u5931\u8D25: ${t.message}`)),process.exit(1)}}function ce(r){return K(ts(),r)}var Dt,Pr,Er,Ir,Pe=w(()=>{Dt=typeof __dirname<"u"?__dirname:Zo(ya(import.meta.url)),Pr=null,Er=null,Ir=null});import{existsSync as wa,readFileSync as va,appendFileSync as rs,writeFileSync as xa,createReadStream as Ta}from"fs";import{createInterface as ba}from"readline";var re,le,Rn=w(()=>{re=class{filePath;constructor(e){this.filePath=e}append(e){try{let t=JSON.stringify(e)+`
|
|
7
|
+
`;rs(this.filePath,t,"utf-8")}catch(t){throw new Error(`Failed to append to JSONL file: ${t.message}`)}}appendBatch(e){try{let t=e.map(n=>JSON.stringify(n)).join(`
|
|
8
|
+
`)+`
|
|
9
|
+
`;rs(this.filePath,t,"utf-8")}catch(t){throw new Error(`Failed to append batch to JSONL file: ${t.message}`)}}create(e){try{let t=JSON.stringify(e)+`
|
|
10
|
+
`;xa(this.filePath,t,"utf-8")}catch(t){throw new Error(`Failed to create JSONL file: ${t.message}`)}}getFilePath(){return this.filePath}},le=class{filePath;constructor(e){this.filePath=e}exists(){return wa(this.filePath)}readAllSync(e={}){if(!this.exists())return[];try{let n=va(this.filePath,"utf-8").split(`
|
|
11
|
+
`).filter(c=>c.trim().length>0),o=[],s=e.startLine||0,i=e.limit?s+e.limit:n.length,a=n.slice(s,i);for(let c of a)try{let l=JSON.parse(c);(!e.filter||e.filter(l))&&o.push(l)}catch{console.warn(`Invalid JSON line in ${this.filePath}: ${c.substring(0,50)}...`)}return o}catch(t){throw new Error(`Failed to read JSONL file: ${t.message}`)}}async readStream(e,t={}){if(this.exists())return new Promise((n,o)=>{let s=Ta(this.filePath,{encoding:"utf-8"}),i=ba({input:s,crlfDelay:1/0}),a=0,c=0,l=t.startLine||0,{limit:p}=t;i.on("line",async u=>{try{if(u.trim().length===0)return;if(a<l){a++;return}if(p&&c>=p){i.close();return}let g=JSON.parse(u);(!t.filter||t.filter(g))&&(await e(g,a),c++),a++}catch{console.warn(`Invalid JSON line at line ${a}: ${u.substring(0,50)}...`),a++}}),i.on("close",()=>{n()}),i.on("error",u=>{o(new Error(`Failed to read JSONL stream: ${u.message}`))})})}async count(){if(!this.exists())return 0;let e=0;return await this.readStream(()=>{e++}),e}getFilePath(){return this.filePath}}});var as={};U(as,{formatLogEntry:()=>Ra,getLogStats:()=>La,initLogger:()=>Dr,logDebug:()=>m,logError:()=>q,logInfo:()=>M,logSuccess:()=>Aa,logWarn:()=>J,readArchivedLogs:()=>Da,readCurrentLogs:()=>Oa,setDebugMode:()=>Rr,writeLog:()=>Ve});import{existsSync as Or,readFileSync as ka,writeFileSync as os,renameSync as $a,mkdirSync as Ma}from"fs";import{join as Ln}from"path";import z from"chalk";function is(){let r=new Date,e=r.getFullYear(),t=String(r.getMonth()+1).padStart(2,"0"),n=String(r.getDate()).padStart(2,"0");return`${e}-${t}-${n}`}function Pa(){try{return Or(Ar)?ka(Ar,"utf-8").trim():null}catch(r){let e=r instanceof Error?r.message:String(r);return console.error(z.yellow(`\u8BFB\u53D6\u65E5\u5FD7\u6587\u4EF6\u65E5\u671F\u5931\u8D25: ${e}`)),null}}function Ea(r){try{let e=Ln(He,`${r}.jsonl`);if(Or(e)){let n=new le(Ge).readAllSync();new re(e).appendBatch(n),console.log(z.green(`\u2713 \u65E5\u5FD7\u5DF2\u8FFD\u52A0\u5230\u5F52\u6863\u6587\u4EF6: ${r}.jsonl`))}else $a(Ge,e),console.log(z.green(`\u2713 \u65E5\u5FD7\u5DF2\u5F52\u6863: ${r}.jsonl`))}catch(e){let t=e instanceof Error?e.message:String(e);console.error(z.red(`\u5F52\u6863\u65E5\u5FD7\u5931\u8D25: ${t}`))}}function Ia(r){try{os(Ge,"","utf-8"),os(Ar,r,"utf-8");let e=new re(Ge),t={timestamp:new Date().toISOString(),level:"INFO",message:`\u65E5\u5FD7\u6587\u4EF6\u521B\u5EFA - \u65E5\u671F: ${r}`,date:r};e.append(t)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(z.red(`\u521B\u5EFA\u65E5\u5FD7\u6587\u4EF6\u5931\u8D25: ${t}`))}}function Dr(){try{Or(He)||(Ma(He,{recursive:!0}),console.log(z.gray("\u521B\u5EFA\u65E5\u5FD7\u76EE\u5F55: .nium/logs")));let r=is(),e=Pa();(!e||e!==r)&&(e&&(console.log(z.yellow(`\u68C0\u6D4B\u5230\u65E7\u65E5\u5FD7\u6587\u4EF6 (${e})\uFF0C\u6B63\u5728\u5F52\u6863...`)),Ea(e)),Ia(r),console.log(z.green(`\u2713 \u521B\u5EFA\u65B0\u65E5\u5FD7\u6587\u4EF6: ${r}`)))}catch(r){let e=r instanceof Error?r.message:String(r);console.error(z.red(`\u521D\u59CB\u5316\u65E5\u5FD7\u7CFB\u7EDF\u5931\u8D25: ${e}`))}}function Rr(r){ss=r}function Ve(r,e,t=!1){try{let n=new Date().toISOString(),o=is(),s={timestamp:n,level:r,message:e,date:o};if(new re(Ge).append(s),t||ss){let a;switch(r){case"INFO":a=z.blue;break;case"WARN":a=z.yellow;break;case"ERROR":a=z.red;break;case"SUCCESS":a=z.green;break;case"DEBUG":a=z.magenta;break;default:a=z.white}console.log(a(`[${r}] ${e}`))}}catch(n){let o=n instanceof Error?n.message:String(n);console.error(z.red(`\u5199\u5165\u65E5\u5FD7\u5931\u8D25: ${o}`))}}function M(r){Ve("INFO",r,!0)}function J(r){Ve("WARN",r,!0)}function q(r){Ve("ERROR",r,!0)}function Aa(r){Ve("SUCCESS",r,!0)}function m(r){Ve("DEBUG",r)}function Oa(r){try{let e=new le(Ge);return e.exists()?e.readAllSync({filter:r?.level?n=>n.level===r.level:void 0,limit:r?.limit}):[]}catch(e){let t=e instanceof Error?e.message:String(e);return console.error(z.red(`\u8BFB\u53D6\u65E5\u5FD7\u5931\u8D25: ${t}`)),[]}}function Da(r,e){try{let t=Ln(He,`${r}.jsonl`),n=new le(t);return n.exists()?n.readAllSync({filter:e?.level?s=>s.level===e.level:void 0,limit:e?.limit}):[]}catch(t){let n=t instanceof Error?t.message:String(t);return console.error(z.red(`\u8BFB\u53D6\u5F52\u6863\u65E5\u5FD7\u5931\u8D25: ${n}`)),[]}}function Ra(r){return`[${new Date(r.timestamp).toLocaleString("zh-CN")}] [${r.level.padEnd(7)}] ${r.message}`}function La(r){let e={total:r.length,byLevel:{INFO:0,WARN:0,ERROR:0,SUCCESS:0,DEBUG:0}};for(let t of r)t.level in e.byLevel&&e.byLevel[t.level]++;return e}var He,Ge,Ar,ss,H=w(()=>{Pe();Rn();He=ce("logs"),Ge=Ln(He,"current.jsonl"),Ar=Ln(He,".current_date"),ss=!1});import{existsSync as cs,mkdirSync as ja,readdirSync as Fa}from"fs";import{join as ls}from"path";function us(){cs(Be)||ja(Be,{recursive:!0})}function gs(r){if(!r||!r.messages||r.messages.length===0)return null;us();let e=new Date().toISOString().replace(/[:.]/g,"-"),t=r.sessionId?r.sessionId.substring(0,8):"unknown",n=r.currentTask?r.currentTask.substring(0,30).replace(/[^\w\u4e00-\u9fa5]/g,"_"):"unnamed",o=`session_${t}_${e}_${n}.jsonl`,s=ls(Be,o),i={type:"session_metadata",data:{sessionId:r.sessionId,currentTask:r.currentTask,createdAt:r.createdAt,archivedAt:new Date().toISOString(),messageCount:r.messages.length,taskCount:r.tasks?r.tasks.length:0}};try{let a=new re(s);if(a.create(i),r.tasks&&r.tasks.length>0){let c={type:"tasks_data",data:r.tasks};a.append(c)}r.messages&&r.messages.length>0&&r.messages.map(l=>({...l,id:l.id||`msg_${Date.now()}_${Math.random().toString(36).substr(2,9)}`})).forEach(l=>{a.append({type:"message",data:l})})}catch(a){return console.error("\u5F52\u6863\u4F1A\u8BDD\u5931\u8D25:",a),null}return s}function _a(){return us(),cs(Be)?Fa(Be).filter(e=>e.endsWith(".jsonl")).map(e=>{let t=ls(Be,e);try{let o=new le(t).readAllSync({limit:1})[0];return!o||o.type!=="session_metadata"?null:{fileName:e,filePath:t,sessionId:o.data.sessionId,sessionIdShort:o.data.sessionId?o.data.sessionId.substring(0,8):"unknown",currentTask:o.data.currentTask||"\u672A\u547D\u540D\u4EFB\u52A1",timestamp:o.data.archivedAt,archivedAt:o.data.archivedAt,messageCount:o.data.messageCount||0,taskCount:o.data.taskCount||0}}catch(n){return console.error(`\u8BFB\u53D6\u5F52\u6863\u6587\u4EF6\u5931\u8D25: ${e}`,n),null}}).filter(e=>e!==null).sort((e,t)=>new Date(t.archivedAt).getTime()-new Date(e.archivedAt).getTime()):[]}function ps(){let r=_a();if(r.length===0)return"\u6682\u65E0\u5F52\u6863\u4F1A\u8BDD";let e=`
|
|
12
|
+
=== \u5F52\u6863\u4F1A\u8BDD\u5217\u8868 ===
|
|
13
|
+
|
|
14
|
+
`;return r.forEach((t,n)=>{let s=new Date(t.archivedAt).toLocaleString("zh-CN");e+=`[${n+1}] ${t.currentTask}
|
|
15
|
+
`,e+=` \u4F1A\u8BDDID: ${t.sessionIdShort||"unknown"}
|
|
16
|
+
`,e+=` \u5F52\u6863\u65F6\u95F4: ${s}
|
|
17
|
+
`,e+=` \u4EFB\u52A1\u6570\u91CF: ${t.taskCount||0}
|
|
18
|
+
`,e+=` \u6D88\u606F\u6570\u91CF: ${t.messageCount}
|
|
19
|
+
`,e+=` \u6587\u4EF6\u540D: ${t.fileName}
|
|
20
|
+
|
|
21
|
+
`}),e}var Be,Lr=w(()=>{Pe();Rn();Be=ce("archives")});function Ee(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){let e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)})}function jr(){return"S"+Ee()}function jn(){return"T"+Ee()}var Fn=w(()=>{});var fs={};U(fs,{SESSION_FILE:()=>Ce,archiveSession:()=>Xe,associateMessageWithTask:()=>ds,completeCurrentTask:()=>Qe,loadSession:()=>_r,saveSession:()=>Q,sessionState:()=>v,setCurrentTaskId:()=>Ke,startNewTask:()=>_n});import{writeFileSync as Na,existsSync as ms}from"fs";import Ye from"chalk";function Fr(){return{sessionId:jr(),messages:[],tasks:[],currentTask:null,currentTaskId:null,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}}function Ua(){try{v.messages&&v.messages.length>0&&gs(v)&&m("\u4F1A\u8BDD\u5DF2\u5F52\u6863"),v=Fr(),new re(Ce).create(v)}catch(r){let e=r instanceof Error?r.message:String(r);console.log(Ye.yellow(`Warning: Failed to archive session - ${e}`)),v=Fr();try{new re(Ce).create(v)}catch{}}}function _r(){try{if(ms(Ce)){let e=new le(Ce).readAllSync(),t=e.length>0?e[0]:null;return v={sessionId:t&&t.sessionId||jr(),messages:t&&t.messages||[],tasks:t&&t.tasks||[],currentTask:t&&t.currentTask||null,currentTaskId:t&&t.currentTaskId||null,createdAt:t&&t.createdAt||new Date().toISOString(),updatedAt:new Date().toISOString()},!0}}catch(r){let e=r instanceof Error?r.message:String(r);console.log(Ye.yellow(`Warning: Could not load session - ${e}`))}return!1}function _n(r){let e=jn(),t={id:e,description:r,createdAt:new Date().toISOString(),messageIds:[]};return v.tasks.push(t),v.currentTask=r,v.currentTaskId=e,e}function ds(r){if(v.currentTaskId&&r){let e=v.currentTaskId;r.taskId=e;let t=v.tasks.find(n=>n.id===e);if(t&&!r.id){let n=Ee();r.id=n,t.messageIds.push(n)}}return r}function Ke(r){v.currentTaskId=r,v.updatedAt=new Date().toISOString(),Q(),console.log(Ye.blue(`[\u4F1A\u8BDD\u7BA1\u7406] \u5F53\u524D\u4EFB\u52A1ID\u5DF2\u8BBE\u7F6E\u4E3A: ${r}`))}function Q(r,e=null){try{if(e&&e!==v.currentTask&&_n(e),r){let n=r.map(o=>ds({...o}));v={...v,messages:n,updatedAt:new Date().toISOString()}}else v={...v,updatedAt:new Date().toISOString()};ms(Ce)&&Na(Ce,"","utf-8"),new re(Ce).create(v)}catch(t){let n=t instanceof Error?t.message:String(t);console.log(Ye.yellow(`Warning: Could not save session - ${n}`))}}function Xe(){return Ua()}function Wa(){if(v.currentTask&&v.currentTaskId){let r=v.tasks.find(e=>e.id===v.currentTaskId);if(r){let e=r.tokenCount||0;console.log(Ye.green(`
|
|
22
|
+
\u2705 \u4EFB\u52A1\u5B8C\u6210: ${v.currentTask}`)),console.log(Ye.blue(`\u{1F4CA} Token\u603B\u5F00\u9500: ${e.toLocaleString()} tokens`))}v.currentTask=null,v.currentTaskId=null,Q()}}function Qe(){return Wa()}var Ce,v,we=w(()=>{H();Pe();Lr();Rn();Fn();Ce=ce("session.jsonl");v=Fr()});var Nr,hs=w(()=>{Nr={name:"coder",description:"\u4EE3\u7801\u7F16\u5199\u548C\u5F00\u53D1\uFF0C\u5305\u62EC\u65B0\u6587\u4EF6\u521B\u5EFA\u548C\u73B0\u6709\u6587\u4EF6\u4FEE\u6539\uFF0C\u652F\u6301\u591A\u8BED\u8A00\u9879\u76EE",keywords:["code","\u4EE3\u7801","\u7F16\u7A0B","\u5F00\u53D1","\u5199\u4EE3\u7801","\u4EE3\u7801\u4FEE\u6539","\u65B0\u5EFA\u6587\u4EF6","\u4F9D\u8D56\u68C0\u67E5","\u5B9E\u73B0\u529F\u80FD","\u6DFB\u52A0\u7279\u6027","\u4FEE\u590Dbug","\u91CD\u6784","\u5B9E\u73B0","\u5F00\u53D1","\u7F16\u5199","\u521B\u5EFA\u7C7B","\u521B\u5EFA\u51FD\u6570","\u6DFB\u52A0\u65B9\u6CD5","\u5199\u4E00\u4E2A","\u751F\u6210\u4EE3\u7801","\u65B0\u589E\u529F\u80FD","feature","implement","develop","create","add function","add","method","write code","generate code","refactor code","fix code","update code","modify code","\u7F16\u7801","\u5199\u529F\u80FD","\u52A0\u529F\u80FD","\u6539\u4EE3\u7801","\u5199\u63A5\u53E3","\u5199API","\u5F00\u53D1\u63A5\u53E3","\u5B9E\u73B0\u63A5\u53E3"],prompt:`\u4F60\u662F\u4E00\u4F4D\u8DE8\u8BED\u8A00\u4EE3\u7801\u7F16\u5199\u4E13\u5BB6\u3002\u4F60\u7684\u4EFB\u52A1\u662F\u6839\u636E\u7528\u6237\u9700\u6C42\u7F16\u5199\u9AD8\u8D28\u91CF\u3001\u53EF\u7EF4\u62A4\u7684\u4EE3\u7801\uFF0C\u652F\u6301\u591A\u79CD\u7F16\u7A0B\u8BED\u8A00\u548C\u9879\u76EE\u7C7B\u578B\u3002
|
|
23
|
+
|
|
24
|
+
## \u6838\u5FC3\u89C4\u5219
|
|
25
|
+
|
|
26
|
+
1. **\u5206\u5C42\u8BED\u8A00\u7EA6\u675F\u6A21\u578B**\uFF1A
|
|
27
|
+
- **\u4E1A\u52A1\u4EE3\u7801\u5C42** (src/, lib/, app/): \u4E25\u683C\u4F7F\u7528\u9879\u76EE\u4E3B\u8981\u7F16\u7A0B\u8BED\u8A00
|
|
28
|
+
- **\u5DE5\u5177\u914D\u7F6E\u5C42** (config/, .nium/, \u6784\u5EFA\u811A\u672C): \u5141\u8BB8\u5DE5\u5177\u94FE\u8BED\u8A00 (TypeScript,
|
|
29
|
+
JSON, YAML, Shell)
|
|
30
|
+
- **\u6587\u6863\u5C42** (docs/, README, .md\u6587\u4EF6): \u5141\u8BB8\u591A\u6587\u6863\u683C\u5F0F (Markdown, HTML, \u6587\u672C)
|
|
31
|
+
- **\u6D4B\u8BD5\u5C42** (test/, tests/, spec/, **tests**/): \u5141\u8BB8\u6D4B\u8BD5\u4E13\u7528\u8BED\u8A00\u548C\u6846\u67B6
|
|
32
|
+
- **\u6784\u5EFA\u90E8\u7F72\u5C42** (Dockerfile, docker-compose.yml,
|
|
33
|
+
CI/CD\u914D\u7F6E, \u57FA\u7840\u8BBE\u65BD\u5373\u4EE3\u7801): \u5141\u8BB8\u57FA\u7840\u8BBE\u65BD\u8BED\u8A00 (Dockerfile, Shell, YAML, HCL)
|
|
34
|
+
|
|
35
|
+
**\u591A\u8BED\u8A00\u9879\u76EE\u652F\u6301**\uFF1A
|
|
36
|
+
|
|
37
|
+
- \u73B0\u4EE3\u9879\u76EE\u901A\u5E38\u5305\u542B\u591A\u79CD\u8BED\u8A00\u548C\u6280\u672F\u6808
|
|
38
|
+
- \u6839\u636E\u6587\u4EF6\u6240\u5728\u76EE\u5F55\u548C\u7528\u9014\u9009\u62E9\u9002\u5F53\u7684\u7F16\u7A0B\u8BED\u8A00
|
|
39
|
+
- \u5DE5\u5177\u94FE\u548C\u914D\u7F6E\u6587\u4EF6\u53EF\u4EE5\u4F7F\u7528\u4E0E\u4E1A\u52A1\u4EE3\u7801\u4E0D\u540C\u7684\u8BED\u8A00
|
|
40
|
+
\u9996\u5148\u68C0\u67E5\u9879\u76EE\u4FE1\u606F\u6587\u4EF6 \`.nium/project/project.json\` \u6216\u9879\u76EE\u7EA6\u5B9A\u6587\u4EF6
|
|
41
|
+
\`.nium/conventions.md\`\uFF0C\u5FEB\u901F\u4E86\u89E3\u9879\u76EE\u7684\u8BED\u8A00\u3001\u6846\u67B6\u548C\u6280\u672F\u6808\u3002\u5982\u679C\u6CA1\u6709\u8FD9\u4E9B\u6587\u4EF6\uFF0C\u901A\u8FC7\u68C0\u67E5\u9879\u76EE\u6839\u76EE\u5F55\u7684\u914D\u7F6E\u6587\u4EF6\u81EA\u52A8\u8BC6\u522B\u9879\u76EE\u7C7B\u578B\u548C\u4E3B\u8981\u8BED\u8A00
|
|
42
|
+
|
|
43
|
+
2. **\u591A\u8BED\u8A00\u4F9D\u8D56\u7BA1\u7406**\uFF1A
|
|
44
|
+
- \u5728\u8C03\u7528 \`write()\` \u6216 \`merge()\` \u5DE5\u5177\u751F\u6210\u4EE3\u7801\u4E4B\u540E\uFF0C\u5FC5\u987B\u68C0\u67E5\u4F9D\u8D56\u5F15\u5165\u60C5\u51B5
|
|
45
|
+
- \u5BF9\u4E8E\u65B0\u521B\u5EFA\u7684\u6587\u4EF6\uFF0C\u786E\u4FDD\u6240\u6709\u4F7F\u7528\u7684\u5916\u90E8\u4F9D\u8D56\u90FD\u5DF2\u6B63\u786E\u5F15\u5165
|
|
46
|
+
- \u5BF9\u4E8E\u5DF2\u5B58\u5728\u7684\u6587\u4EF6\uFF0C\u786E\u4FDD\u65B0\u589E\u6216\u4FEE\u6539\u7684\u4EE3\u7801\u6CA1\u6709\u5F15\u5165\u672A\u58F0\u660E\u7684\u4F9D\u8D56
|
|
47
|
+
- **\u4F9D\u8D56\u58F0\u660E\u6587\u4EF6\u68C0\u67E5\u89C4\u5219**\uFF1A
|
|
48
|
+
- **JavaScript/TypeScript**: \u68C0\u67E5 \`package.json\`
|
|
49
|
+
\u7684 dependencies \u548C devDependencies
|
|
50
|
+
- **Java (Maven)**: \u68C0\u67E5 \`pom.xml\` \u7684 \`<dependencies>\` \u90E8\u5206
|
|
51
|
+
- **Java (Gradle)**: \u68C0\u67E5 \`build.gradle\` \u7684 dependencies \u5757
|
|
52
|
+
- **Python**: \u68C0\u67E5 \`requirements.txt\`, \`setup.py\`, \u6216 \`pyproject.toml\`
|
|
53
|
+
- **Go**: \u68C0\u67E5 \`go.mod\` \u7684 require \u90E8\u5206
|
|
54
|
+
- **Rust**: \u68C0\u67E5 \`Cargo.toml\` \u7684 dependencies \u90E8\u5206
|
|
55
|
+
- **C#**: \u68C0\u67E5 \`*.csproj\` \u7684 \`<PackageReference>\` \u90E8\u5206
|
|
56
|
+
- **Ruby**: \u68C0\u67E5 \`Gemfile\`
|
|
57
|
+
- **PHP**: \u68C0\u67E5 \`composer.json\`
|
|
58
|
+
|
|
59
|
+
3. **\u4EE3\u7801\u98CE\u683C\u548C\u7EA6\u5B9A**\uFF1A
|
|
60
|
+
- \u4F18\u5148\u9075\u5FAA\u9879\u76EE\u7684\u4EE3\u7801\u89C4\u8303\u914D\u7F6E\uFF08ESLint, Prettier, Checkstyle, Black,
|
|
61
|
+
Rustfmt \u7B49\uFF09
|
|
62
|
+
- \u9075\u5FAA\u9879\u76EE\u5DF2\u6709\u7684\u4EE3\u7801\u98CE\u683C\u548C\u547D\u540D\u7EA6\u5B9A
|
|
63
|
+
- \u5982\u679C\u9879\u76EE\u6709 \`.editorconfig\`\uFF0C\u9075\u5FAA\u5176\u7F29\u8FDB\u548C\u6362\u884C\u89C4\u5219
|
|
64
|
+
- **\u5E38\u89C1\u8BED\u8A00\u7684\u547D\u540D\u7EA6\u5B9A**\uFF1A
|
|
65
|
+
- **JavaScript/TypeScript**: camelCase (\u53D8\u91CF/\u51FD\u6570), PascalCase (\u7C7B/\u63A5\u53E3)
|
|
66
|
+
- **Java**: camelCase (\u53D8\u91CF/\u65B9\u6CD5), PascalCase (\u7C7B), UPPER_SNAKE_CASE (\u5E38\u91CF)
|
|
67
|
+
- **Python**: snake_case (\u53D8\u91CF/\u51FD\u6570), PascalCase (\u7C7B), UPPER_SNAKE_CASE
|
|
68
|
+
(\u5E38\u91CF)
|
|
69
|
+
- **Go**: camelCase (\u79C1\u6709), PascalCase (\u516C\u5F00)
|
|
70
|
+
- **Rust**: snake_case (\u53D8\u91CF/\u51FD\u6570/\u6A21\u5757), PascalCase (\u7C7B\u578B/trait)
|
|
71
|
+
- **C#**: PascalCase (\u7C7B/\u65B9\u6CD5/\u5C5E\u6027), camelCase (\u79C1\u6709\u5B57\u6BB5)
|
|
72
|
+
|
|
73
|
+
4. **\u4EE3\u7801\u8D28\u91CF**\uFF1A
|
|
74
|
+
- \u7F16\u5199\u6A21\u5757\u5316\u3001\u53EF\u590D\u7528\u7684\u4EE3\u7801
|
|
75
|
+
- \u6DFB\u52A0\u6E05\u6670\u7684\u6CE8\u91CA\u89E3\u91CA\u590D\u6742\u903B\u8F91\uFF08\u9075\u5FAA\u8BED\u8A00\u4E60\u60EF\uFF09
|
|
76
|
+
- \u5904\u7406\u8FB9\u7F18\u60C5\u51B5\u548C\u9519\u8BEF\uFF08\u4F7F\u7528\u8BED\u8A00\u7684\u6807\u51C6\u9519\u8BEF\u5904\u7406\u673A\u5236\uFF09
|
|
77
|
+
- **\u9519\u8BEF\u5904\u7406\u6700\u4F73\u5B9E\u8DF5**\uFF1A
|
|
78
|
+
- **JavaScript/TypeScript**: try-catch, Promise.catch, async/await
|
|
79
|
+
- **Java**: try-catch-finally, throws \u58F0\u660E
|
|
80
|
+
- **Python**: try-except-finally
|
|
81
|
+
- **Go**: \u8FD4\u56DE error\uFF0C\u68C0\u67E5 \`if err != nil\`
|
|
82
|
+
- **Rust**: Result<T, E>, Option<T>, ? \u64CD\u4F5C\u7B26
|
|
83
|
+
- **C#**: try-catch-finally, using \u8BED\u53E5
|
|
84
|
+
|
|
85
|
+
5. **\u6D4B\u8BD5\u8003\u8651**\uFF1A
|
|
86
|
+
- \u7F16\u5199\u53EF\u6D4B\u8BD5\u7684\u4EE3\u7801\u7ED3\u6784
|
|
87
|
+
- \u4E86\u89E3\u9879\u76EE\u4F7F\u7528\u7684\u6D4B\u8BD5\u6846\u67B6\uFF1A
|
|
88
|
+
- **JavaScript/TypeScript**: Jest, Mocha, Vitest
|
|
89
|
+
- **Java**: JUnit, TestNG
|
|
90
|
+
- **Python**: pytest, unittest
|
|
91
|
+
- **Go**: testing \u5305
|
|
92
|
+
- **Rust**: \`#[test]\` \u6807\u6CE8
|
|
93
|
+
- **C#**: NUnit, xUnit
|
|
94
|
+
|
|
95
|
+
6. **\u4EFB\u52A1\u5B8C\u6210**\uFF1A\u786E\u4FDD\u4EE3\u7801\u5B8C\u5168\u6EE1\u8DB3\u7528\u6237\u9700\u6C42
|
|
96
|
+
|
|
97
|
+
## \u5DE5\u4F5C\u6D41\u7A0B
|
|
98
|
+
|
|
99
|
+
1. **\u8BC6\u522B\u9879\u76EE\u73AF\u5883**\uFF1A
|
|
100
|
+
- \u4F18\u5148\u8BFB\u53D6 \`.nium/project/project.json\` \u5FEB\u901F\u4E86\u89E3\u9879\u76EE
|
|
101
|
+
- \u6216\u8BFB\u53D6\u9879\u76EE\u914D\u7F6E\u6587\u4EF6\u8BC6\u522B\u8BED\u8A00\u548C\u6846\u67B6
|
|
102
|
+
- \u786E\u8BA4\u9879\u76EE\u7684\u4E3B\u8981\u7F16\u7A0B\u8BED\u8A00\u3001\u6784\u5EFA\u5DE5\u5177\u3001\u4F9D\u8D56\u7BA1\u7406\u65B9\u5F0F
|
|
103
|
+
|
|
104
|
+
2. **\u5206\u6790\u9700\u6C42**\uFF1A\u7406\u89E3\u7528\u6237\u9700\u8981\u5B9E\u73B0\u7684\u529F\u80FD\u6216\u4FEE\u6539
|
|
105
|
+
|
|
106
|
+
3. **\u68C0\u67E5\u73B0\u6709\u4EE3\u7801**\uFF1A
|
|
107
|
+
- \u5982\u679C\u662F\u4FEE\u6539\u73B0\u6709\u4EE3\u7801\uFF0C\u5148\u9605\u8BFB\u5F53\u524D\u6587\u4EF6\u5185\u5BB9
|
|
108
|
+
- \u4E86\u89E3\u73B0\u6709\u7684\u4EE3\u7801\u7ED3\u6784\u3001\u547D\u540D\u7EA6\u5B9A\u3001\u5BFC\u5165\u65B9\u5F0F
|
|
109
|
+
|
|
110
|
+
4. **\u7F16\u5199\u4EE3\u7801**\uFF1A
|
|
111
|
+
- \u4F7F\u7528\u9879\u76EE\u7684\u4E3B\u8981\u7F16\u7A0B\u8BED\u8A00\u751F\u6210\u6216\u4FEE\u6539\u4EE3\u7801\u5185\u5BB9
|
|
112
|
+
- \u9075\u5FAA\u9879\u76EE\u7684\u4EE3\u7801\u98CE\u683C\u548C\u7EA6\u5B9A
|
|
113
|
+
- \u6DFB\u52A0\u5FC5\u8981\u7684\u5BFC\u5165/\u5F15\u7528\u8BED\u53E5
|
|
114
|
+
|
|
115
|
+
5. **\u5199\u5165\u6587\u4EF6**\uFF1A\u6839\u636E\u573A\u666F\u9009\u62E9\u5408\u9002\u7684\u5DE5\u5177
|
|
116
|
+
- **write()**: \u521B\u5EFA\u65B0\u6587\u4EF6\u6216\u5B8C\u5168\u8986\u76D6\u73B0\u6709\u6587\u4EF6
|
|
117
|
+
- **merge()**: \u667A\u80FD\u5408\u5E76\u4FEE\u6539\u5230\u73B0\u6709\u6587\u4EF6\uFF08\u63A8\u8350\u7528\u4E8E\u4FEE\u6539\u73B0\u6709\u4EE3\u7801\uFF09
|
|
118
|
+
- **searchReplace()**: \u6279\u91CF\u67E5\u627E\u66FF\u6362\uFF08\u9002\u5408\u91CD\u547D\u540D\u53D8\u91CF\u3001\u51FD\u6570\u3001\u7C7B\u7B49\uFF09
|
|
119
|
+
- \u652F\u6301\u6B63\u5219\u8868\u8FBE\u5F0F\u5339\u914D
|
|
120
|
+
- \u53EF\u5728\u5355\u4E2A\u6587\u4EF6\u6216\u591A\u4E2A\u6587\u4EF6\u4E2D\u66FF\u6362
|
|
121
|
+
- \u9002\u7528\u573A\u666F\uFF1A\u91CD\u547D\u540D\u3001\u7EDF\u4E00\u683C\u5F0F\u3001\u6279\u91CF\u66F4\u65B0
|
|
122
|
+
|
|
123
|
+
**\u5DE5\u5177\u9009\u62E9\u6307\u5357**\uFF1A
|
|
124
|
+
- \u521B\u5EFA\u65B0\u6587\u4EF6 \u2192 \u4F7F\u7528 \`write()\`
|
|
125
|
+
- \u4FEE\u6539\u73B0\u6709\u6587\u4EF6\u5185\u5BB9 \u2192 \u4F7F\u7528 \`merge()\`\uFF08\u81EA\u52A8\u5904\u7406\u51B2\u7A81\uFF09
|
|
126
|
+
- \u91CD\u547D\u540D\u6807\u8BC6\u7B26\u6216\u6279\u91CF\u66FF\u6362 \u2192 \u4F7F\u7528 \`searchReplace()\`
|
|
127
|
+
- \u7B80\u5355\u5B57\u7B26\u4E32\u66FF\u6362 \u2192 \u4F7F\u7528 \`searchReplace()\`
|
|
128
|
+
|
|
129
|
+
6. **\u4F9D\u8D56\u68C0\u67E5**\uFF1A
|
|
130
|
+
- \u9A8C\u8BC1\u6240\u6709\u4F9D\u8D56\u90FD\u5DF2\u6B63\u786E\u5F15\u5165\u5230\u4F9D\u8D56\u58F0\u660E\u6587\u4EF6
|
|
131
|
+
- \u4F7F\u7528 \`read()\` \u68C0\u67E5\u4F9D\u8D56\u6587\u4EF6\uFF08package.json, pom.xml \u7B49\uFF09
|
|
132
|
+
- \u5982\u679C\u7F3A\u5C11\u4F9D\u8D56\uFF0C\u63D0\u793A\u7528\u6237\u6DFB\u52A0\u6216\u4F7F\u7528\u5305\u7BA1\u7406\u547D\u4EE4\u6DFB\u52A0
|
|
133
|
+
|
|
134
|
+
7. **\u9A8C\u8BC1\u5B8C\u6210**\uFF1A\u786E\u4FDD\u4EE3\u7801\u7B26\u5408\u6240\u6709\u8981\u6C42
|
|
135
|
+
|
|
136
|
+
## \u6587\u4EF6\u64CD\u4F5C\u5B89\u5168\u7EA6\u675F
|
|
137
|
+
|
|
138
|
+
**\u4E25\u683C\u9075\u5B88\u4EE5\u4E0B\u6587\u4EF6\u8DEF\u5F84\u5B89\u5168\u89C4\u5219**\uFF1A
|
|
139
|
+
|
|
140
|
+
1. **\u4EC5\u5728\u9879\u76EE\u76EE\u5F55\u5185\u64CD\u4F5C**
|
|
141
|
+
- \u2705 \u5141\u8BB8\uFF1A\u5728\u5F53\u524D\u5DE5\u4F5C\u76EE\u5F55\uFF08\u9879\u76EE\u6839\u76EE\u5F55\uFF09\u5185\u521B\u5EFA/\u4FEE\u6539\u6587\u4EF6
|
|
142
|
+
- \u274C \u7981\u6B62\uFF1A\u5199\u5165\u9879\u76EE\u76EE\u5F55\u5916\u7684\u4EFB\u4F55\u4F4D\u7F6E
|
|
143
|
+
|
|
144
|
+
2. **\u7981\u6B62\u7684\u8DEF\u5F84\u6A21\u5F0F**
|
|
145
|
+
- \u274C \u7CFB\u7EDF\u76EE\u5F55\uFF1A\`/\`\u3001\`/usr\`\u3001\`/etc\`\u3001\`/System\`\u3001\`C:\\Windows\`\u3001\`C:\\Program Files\`
|
|
146
|
+
\u7B49
|
|
147
|
+
- \u274C \u7236\u76EE\u5F55\u904D\u5386\uFF1A\`../\`\u3001\`../../\`\u3001\`../../../\` \u7B49
|
|
148
|
+
- \u274C \u7EDD\u5BF9\u8DEF\u5F84\uFF1A\`/tmp\`\u3001\`/var\`\u3001\`C:\\Users\\...\`\u3001\`/home/...\` \u7B49
|
|
149
|
+
- \u274C \u7528\u6237\u76EE\u5F55\uFF1A\`~\`\u3001\`$HOME\` \u7B49
|
|
150
|
+
|
|
151
|
+
3. **\u5141\u8BB8\u7684\u8DEF\u5F84\u6A21\u5F0F**
|
|
152
|
+
- \u2705 \u9879\u76EE\u76F8\u5BF9\u8DEF\u5F84\uFF1A\`src/utils/helper.js\`\u3001\`config/app.json\`\u3001\`lib/core.ts\`
|
|
153
|
+
- \u2705 \u9879\u76EE\u5B50\u76EE\u5F55\uFF1A\`src/...\`\u3001\`lib/...\`\u3001\`config/...\`\u3001\`tests/...\`\u3001\`docs/...\`
|
|
154
|
+
- \u2705 \u9879\u76EE\u6839\u6587\u4EF6\uFF1A\`package.json\`\u3001\`README.md\`\u3001\`tsconfig.json\`
|
|
155
|
+
|
|
156
|
+
4. **\u5B89\u5168\u68C0\u67E5\u6E05\u5355**
|
|
157
|
+
- \u5728\u8C03\u7528 \`write()\`\u3001\`merge()\`\u3001\`searchReplace()\` \u4E4B\u524D\uFF0C\u9A8C\u8BC1\u8DEF\u5F84\u662F\u5426\u5728\u9879\u76EE\u5185
|
|
158
|
+
- \u5982\u679C\u7528\u6237\u8BF7\u6C42\u5199\u5165\u9879\u76EE\u5916\u8DEF\u5F84\uFF0C\u793C\u8C8C\u62D2\u7EDD\u5E76\u89E3\u91CA\u5B89\u5168\u7EA6\u675F
|
|
159
|
+
- \u63D0\u793A\u7528\u6237\u5C06\u6587\u4EF6\u653E\u5728\u9879\u76EE\u5185\u7684\u5408\u9002\u4F4D\u7F6E
|
|
160
|
+
|
|
161
|
+
**\u793A\u4F8B**\uFF1A
|
|
162
|
+
|
|
163
|
+
\`\`\`
|
|
164
|
+
\u2705 \u6B63\u786E: write("src/utils/validation.js", content)
|
|
165
|
+
\u2705 \u6B63\u786E: write("config/database.json", content)
|
|
166
|
+
\u2705 \u6B63\u786E: merge("lib/api/client.ts", content)
|
|
167
|
+
|
|
168
|
+
\u274C \u9519\u8BEF: write("/etc/hosts", content) - \u7CFB\u7EDF\u6587\u4EF6
|
|
169
|
+
\u274C \u9519\u8BEF: write("../../../tmp/file.txt", content) - \u7236\u76EE\u5F55\u904D\u5386
|
|
170
|
+
\u274C \u9519\u8BEF: write("C:\\\\Windows\\\\System32\\\\config.ini", content) - \u7CFB\u7EDF\u76EE\u5F55
|
|
171
|
+
\u274C \u9519\u8BEF: write("/tmp/output.log", content) - \u9879\u76EE\u5916\u8DEF\u5F84
|
|
172
|
+
\`\`\`
|
|
173
|
+
|
|
174
|
+
\u5982\u679C\u7528\u6237\u8BF7\u6C42\u5728\u9879\u76EE\u5916\u5199\u5165\u6587\u4EF6\uFF0C\u5E94\u56DE\u590D\uFF1A
|
|
175
|
+
|
|
176
|
+
> "\u51FA\u4E8E\u5B89\u5168\u8003\u8651\uFF0C\u6211\u53EA\u80FD\u5728\u5F53\u524D\u9879\u76EE\u76EE\u5F55\u5185\u521B\u5EFA\u6216\u4FEE\u6539\u6587\u4EF6\u3002\u5EFA\u8BAE\u5C06\u6587\u4EF6\u653E\u5728\u9879\u76EE\u7684
|
|
177
|
+
> \`{\u9002\u5F53\u76EE\u5F55}\` \u76EE\u5F55\u4E0B\u3002\u4F8B\u5982\uFF1A\`{\u5EFA\u8BAE\u8DEF\u5F84}\`"
|
|
178
|
+
|
|
179
|
+
## \u7279\u522B\u6CE8\u610F
|
|
180
|
+
|
|
181
|
+
- **\u591A\u8BED\u8A00\u9879\u76EE**: \u5982\u679C\u9879\u76EE\u5305\u542B\u591A\u79CD\u8BED\u8A00\uFF0C\u786E\u8BA4\u5F53\u524D\u4EFB\u52A1\u9488\u5BF9\u54EA\u79CD\u8BED\u8A00
|
|
182
|
+
- **\u7248\u672C\u517C\u5BB9\u6027**: \u6CE8\u610F\u9879\u76EE\u58F0\u660E\u7684\u8FD0\u884C\u65F6\u7248\u672C\uFF08Node.js, JDK,
|
|
183
|
+
Python \u7B49\uFF09\uFF0C\u4F7F\u7528\u517C\u5BB9\u7684\u8BED\u6CD5\u7279\u6027
|
|
184
|
+
- **\u9879\u76EE\u7EA6\u5B9A**: \u5982\u679C\u5B58\u5728 \`.nium/conventions.md\`\uFF0C\u4F18\u5148\u9075\u5FAA\u5176\u4E2D\u7684\u56E2\u961F\u7EA6\u5B9A
|
|
185
|
+
- **\u6587\u4EF6\u5B89\u5168**: \u4E25\u683C\u9075\u5B88\u4E0A\u8FF0\u6587\u4EF6\u64CD\u4F5C\u5B89\u5168\u7EA6\u675F\uFF0C\u4FDD\u62A4\u7CFB\u7EDF\u5B89\u5168
|
|
186
|
+
|
|
187
|
+
\u786E\u4FDD\u5728\u5B8C\u6210\u4EE3\u7801\u7F16\u5199\u548C\u6587\u4EF6\u5199\u5165\u4E4B\u540E\uFF0C\u5FC5\u987B\u6267\u884C\u4F9D\u8D56\u68C0\u67E5\u6B65\u9AA4\uFF01`}});var Ur,ys=w(()=>{Ur={name:"explorer",description:"\u667A\u80FD\u63A2\u7D22\u9879\u76EE\u7ED3\u6784\uFF0C\u751F\u6210\u6587\u6863\u6216\u56DE\u7B54\u7ED3\u6784\u76F8\u5173\u95EE\u9898",keywords:["explore","\u9879\u76EE\u7ED3\u6784","\u6587\u4EF6\u5206\u6790","\u76EE\u5F55\u7ED3\u6784","\u9879\u76EE\u6982\u89C8","\u4EE3\u7801\u7EC4\u7EC7","\u67B6\u6784\u5206\u6790"],prompt:`\u4F60\u662F\u4E00\u4F4D\u9879\u76EE\u7ED3\u6784\u5206\u6790\u4E13\u5BB6\u3002\u4F60\u7684\u4EFB\u52A1\u662F\u667A\u80FD\u5730\u63A2\u7D22\u548C\u5206\u6790\u9879\u76EE\u7684\u6574\u4F53\u7ED3\u6784\u3002
|
|
188
|
+
|
|
189
|
+
## \u53EF\u7528\u5DE5\u5177
|
|
190
|
+
|
|
191
|
+
1. **quickProjectScan()** - \u5FEB\u901F\u626B\u63CF\u5E76\u751F\u6210\u5B8C\u6574\u7684\u9879\u76EE\u4FE1\u606F
|
|
192
|
+
- \u81EA\u52A8\u626B\u63CF\u6240\u6709\u6587\u4EF6
|
|
193
|
+
- \u5206\u6790\u76EE\u5F55\u7ED3\u6784
|
|
194
|
+
- \u68C0\u6D4B\u7F16\u7A0B\u8BED\u8A00
|
|
195
|
+
- \u751F\u6210 \`.nium/project/project.json\` \u6587\u4EF6
|
|
196
|
+
- \u63A8\u8350\u7528\u4E8E\uFF1A\u9996\u6B21\u63A2\u7D22\u3001\u751F\u6210\u9879\u76EE\u4FE1\u606F
|
|
197
|
+
|
|
198
|
+
2. **glob(pattern)** - \u6309\u6A21\u5F0F\u641C\u7D22\u6587\u4EF6
|
|
199
|
+
- \u4F8B\u5982\uFF1A\`glob('**/*.js')\` \u67E5\u627E\u6240\u6709 JS \u6587\u4EF6
|
|
200
|
+
- \u4F8B\u5982\uFF1A\`glob('src/**/*')\` \u67E5\u627E src \u76EE\u5F55\u4E0B\u6240\u6709\u6587\u4EF6
|
|
201
|
+
|
|
202
|
+
3. **grep(pattern, path)** - \u5728\u6587\u4EF6\u4E2D\u641C\u7D22\u5185\u5BB9
|
|
203
|
+
- \u4F8B\u5982\uFF1A\`grep('export.*API', 'src')\` \u67E5\u627E API \u5BFC\u51FA
|
|
204
|
+
|
|
205
|
+
4. **read(path)** - \u8BFB\u53D6\u6587\u4EF6\u5185\u5BB9
|
|
206
|
+
- \u7528\u4E8E\u6DF1\u5165\u4E86\u89E3\u5173\u952E\u6587\u4EF6
|
|
207
|
+
|
|
208
|
+
## \u5DE5\u4F5C\u7B56\u7565
|
|
209
|
+
|
|
210
|
+
### \u573A\u666F 1\uFF1A\u7528\u6237\u8981\u6C42"\u63A2\u7D22\u9879\u76EE"\u6216"\u751F\u6210\u9879\u76EE\u4FE1\u606F"
|
|
211
|
+
|
|
212
|
+
**\u7B56\u7565\uFF1A\u4F7F\u7528\u5FEB\u901F\u626B\u63CF**
|
|
213
|
+
|
|
214
|
+
1. \u76F4\u63A5\u8C03\u7528 \`quickProjectScan()\` \u5DE5\u5177
|
|
215
|
+
2. \u5DE5\u5177\u4F1A\u81EA\u52A8\u5B8C\u6210\u6240\u6709\u626B\u63CF\u548C\u4FE1\u606F\u6536\u96C6
|
|
216
|
+
3. \u5411\u7528\u6237\u6C47\u62A5\u63A2\u7D22\u5B8C\u6210\uFF0C\u9879\u76EE\u4FE1\u606F\u5DF2\u751F\u6210
|
|
217
|
+
4. \u5982\u9700\u67E5\u770B\u9879\u76EE\u4FE1\u606F\uFF0C\u53EF\u8BFB\u53D6 \`.nium/project/project.json\` \u6587\u4EF6
|
|
218
|
+
|
|
219
|
+
### \u573A\u666F 2\uFF1A\u7528\u6237\u63D0\u51FA\u5177\u4F53\u95EE\u9898\uFF08\u5982"\u524D\u7AEF\u4EE3\u7801\u5728\u54EA\u91CC\uFF1F"\uFF09
|
|
220
|
+
|
|
221
|
+
**\u7B56\u7565\uFF1A\u4F7F\u7528\u5DE5\u5177\u7EC4\u5408\u8FDB\u884C\u667A\u80FD\u5206\u6790**
|
|
222
|
+
|
|
223
|
+
1. \u4F7F\u7528 \`glob()\` \u641C\u7D22\u76F8\u5173\u6587\u4EF6
|
|
224
|
+
2. \u5FC5\u8981\u65F6\u4F7F\u7528 \`read()\` \u8BFB\u53D6\u5173\u952E\u6587\u4EF6
|
|
225
|
+
3. \u5206\u6790\u5E76\u56DE\u7B54\u7528\u6237\u95EE\u9898
|
|
226
|
+
|
|
227
|
+
### \u573A\u666F 3\uFF1A\u7528\u6237\u8981\u6C42"\u63A2\u7D22\u5E76\u5206\u6790\u67D0\u4E2A\u65B9\u9762"
|
|
228
|
+
|
|
229
|
+
**\u7B56\u7565\uFF1A\u6DF7\u5408\u4F7F\u7528**
|
|
230
|
+
|
|
231
|
+
1. \u5148\u8C03\u7528 \`quickProjectScan()\` \u83B7\u53D6\u6574\u4F53\u7ED3\u6784
|
|
232
|
+
2. \u518D\u4F7F\u7528\u5176\u4ED6\u5DE5\u5177\u6DF1\u5165\u5206\u6790\u7279\u5B9A\u65B9\u9762
|
|
233
|
+
3. \u6574\u5408\u4FE1\u606F\u5E76\u7ED9\u51FA\u5168\u9762\u7684\u7B54\u6848
|
|
234
|
+
|
|
235
|
+
## \u793A\u4F8B\u5BF9\u8BDD
|
|
236
|
+
|
|
237
|
+
**\u7528\u6237**\uFF1A\u63A2\u7D22\u8FD9\u4E2A\u9879\u76EE **\u4F60\u7684\u884C\u52A8**\uFF1A
|
|
238
|
+
|
|
239
|
+
1. think: \u7528\u6237\u9700\u8981\u5B8C\u6574\u7684\u9879\u76EE\u4FE1\u606F\uFF0C\u5E94\u4F7F\u7528 quickProjectScan
|
|
240
|
+
2. \u8C03\u7528 quickProjectScan()
|
|
241
|
+
3. \u5411\u7528\u6237\u6C47\u62A5: "\u6211\u5DF2\u7ECF\u5B8C\u6210\u4E86\u9879\u76EE\u63A2\u7D22\uFF0C\u9879\u76EE\u4FE1\u606F\u5DF2\u4FDD\u5B58\u5230 \`.nium/project/project.json\`"
|
|
242
|
+
4. \u5982\u9700\u67E5\u770B\u8BE6\u7EC6\u4FE1\u606F\uFF0C\u53EF\u8BFB\u53D6\u8BE5 JSON \u6587\u4EF6\u5E76\u5C55\u793A\u5173\u952E\u4FE1\u606F
|
|
243
|
+
|
|
244
|
+
**\u7528\u6237**\uFF1A\u524D\u7AEF\u4EE3\u7801\u5728\u54EA\u91CC\uFF1F **\u4F60\u7684\u884C\u52A8**\uFF1A
|
|
245
|
+
|
|
246
|
+
1. think: \u9700\u8981\u67E5\u627E\u524D\u7AEF\u76F8\u5173\u6587\u4EF6\uFF0C\u4F7F\u7528 glob \u641C\u7D22
|
|
247
|
+
2. \u8C03\u7528 glob('\\*_/_.{jsx,tsx,vue}')
|
|
248
|
+
3. \u5206\u6790\u7ED3\u679C\u5E76\u56DE\u7B54
|
|
249
|
+
|
|
250
|
+
**\u7528\u6237**\uFF1A\u63A2\u7D22\u9879\u76EE\u5E76\u544A\u8BC9\u6211 API \u662F\u5982\u4F55\u5B9A\u4E49\u7684 **\u4F60\u7684\u884C\u52A8**\uFF1A
|
|
251
|
+
|
|
252
|
+
1. think: \u5148\u83B7\u53D6\u6574\u4F53\u7ED3\u6784\uFF0C\u518D\u6DF1\u5165\u5206\u6790 API
|
|
253
|
+
2. \u8C03\u7528 quickProjectScan()
|
|
254
|
+
3. \u8C03\u7528 glob('**/routes/**') \u6216 grep('router', 'src')
|
|
255
|
+
4. \u8C03\u7528 read() \u8BFB\u53D6\u5173\u952E\u8DEF\u7531\u6587\u4EF6
|
|
256
|
+
5. \u6574\u5408\u4FE1\u606F\u5E76\u89E3\u91CA API \u67B6\u6784
|
|
257
|
+
|
|
258
|
+
## \u6838\u5FC3\u539F\u5219
|
|
259
|
+
|
|
260
|
+
1. **\u9AD8\u6548\u4F18\u5148**\uFF1A\u5BF9\u4E8E\u6807\u51C6\u7684\u63A2\u7D22\u8BF7\u6C42\uFF0C\u4F18\u5148\u4F7F\u7528 \`quickProjectScan()\`
|
|
261
|
+
2. **\u7CBE\u51C6\u56DE\u7B54**\uFF1A\u5BF9\u4E8E\u5177\u4F53\u95EE\u9898\uFF0C\u4F7F\u7528\u6700\u5408\u9002\u7684\u5DE5\u5177\u7EC4\u5408
|
|
262
|
+
3. **\u6DF1\u5EA6\u5206\u6790**\uFF1A\u5FC5\u8981\u65F6\u6DF1\u5165\u8BFB\u53D6\u548C\u5206\u6790\u5173\u952E\u4EE3\u7801\u6587\u4EF6
|
|
263
|
+
4. **\u6E05\u6670\u8868\u8FBE**\uFF1A\u4EE5\u7ED3\u6784\u5316\u3001\u6613\u61C2\u7684\u65B9\u5F0F\u5448\u73B0\u5206\u6790\u7ED3\u679C
|
|
264
|
+
5. **\u5408\u7406\u5C55\u793A**\uFF1A\u63A2\u7D22\u5B8C\u6210\u540E\uFF0C\u544A\u8BC9\u7528\u6237\u9879\u76EE\u4FE1\u606F\u5DF2\u751F\u6210\uFF0C\u53EF\u6839\u636E\u9700\u8981\u8BFB\u53D6\u5E76\u5C55\u793A\u5173\u952E\u4FE1\u606F`}});function Ss(){return Object.values(Ja)}var Ja,Cs=w(()=>{hs();ys();Ja={[Nr.name]:Nr,[Ur.name]:Ur}});var Ze={};U(Ze,{LITE_MODEL:()=>he,MODEL:()=>fe,getDefaultModelConfig:()=>Ie,getLiteModelConfig:()=>Rt,getLiteModelMaxToken:()=>zr,getMCPServerConfigs:()=>qr,getMaxToken:()=>Jr,getProvider:()=>Ha});import{readFileSync as za}from"fs";function Wr(){if(!Nn)try{let r=ce("config.json"),e=za(r,"utf-8");Nn=JSON.parse(e)}catch(r){console.error("Failed to load config.json:",r.message),Nn={models:{defaultModel:{apiKey:"",baseURL:"https://api.openai.com/v1",model:"gpt-4o-mini",provider:"openai"}}}}return Nn}function Ie(){let r=Wr(),e={apiKey:"",baseURL:"https://api.openai.com/v1",model:"gpt-4o-mini",provider:"openai",maxToken:128e3};return r.models?.defaultModel||e}function Rt(){return Wr().models?.liteModel||Ie()}function ws(){return Ie().model||"gpt-4o-mini"}function qa(){return Rt().model||ws()}function Ha(){return Ie().provider||"openai"}function fe(){return ws()}function he(){return qa()}function Jr(){return Ie().maxToken||128e3}function zr(){return Rt().maxToken||16385}function qr(){return Wr().mcpServers||[]}var Nn,te=w(()=>{Pe();Nn=null});var Ae,Un=w(()=>{Ae=class{config;constructor(e){this.config=e}getModelName(){return this.config.model}getProviderType(){return this.config.provider}_getApiKey(){return this.config.apiKey}_getBaseURL(){return this.config.baseURL}}});import Ga from"openai";var Hr,vs,xs=w(()=>{Un();Hr=class extends Ae{client=null;constructor(e){super(e)}_initClient(){return this.client||(this.client=new Ga({apiKey:this.config.apiKey,baseURL:this.config.baseURL||"https://api.openai.com/v1"})),this.client}async callModel(e){let{model:t=this.getModelName(),messages:n,temperature:o=.1,max_tokens:s,tools:i,tool_choice:a}=e,c=this._initClient(),l=[...n],p={model:t,messages:l,temperature:o,max_tokens:s};i&&i.length>0&&(p.tools=i.map(g=>({type:"function",function:{name:g.name,description:g.description,parameters:g.input_schema}})),a&&(a.type==="any"||(p.tool_choice=a)));let u=await c.chat.completions.create(p);return this._processReasoningContent(u),u}_processReasoningContent(e){if(e.choices&&e.choices[0]&&e.choices[0].message&&e.choices[0].message.reasoning_content){let{message:t}=e.choices[0],n=t.reasoning_content;if(t.tool_calls&&t.tool_calls.length>0){t.content?typeof t.content=="string"&&(t.content=`${n}
|
|
265
|
+
|
|
266
|
+
${t.content}`):t.content=n;return}try{let o=[];try{let s=JSON.parse(n);Array.isArray(s)&&s.length>0?(o=s.filter(i=>i&&i.name).map(i=>({id:`call_${i.name}_${Date.now()}`,type:"function",function:{name:i.name,arguments:JSON.stringify(i.parameters||{})}})),t.tool_calls=o):t.content||(t.content=n)}catch{t.content||(t.content=n)}}catch(o){console.warn("Failed to process reasoning_content:",o)}}}},vs=Hr});var Gr,Ts,bs=w(()=>{Un();Gr=class extends Ae{client=null;constructor(e){super(e)}async _initClient(){if(!this.client){let{Anthropic:e}=await import("@anthropic-ai/sdk");this.client=new e({apiKey:this.config.apiKey})}return this.client}async callModel(e){let{model:t=this.getModelName(),messages:n,temperature:o=.1,max_tokens:s=4096,tools:i,tool_choice:a}=e,c=await this._initClient(),l=[...n],p="",u=l.filter(f=>f.role==="system");u.length>0&&(p=u.map(f=>f.content).join(`
|
|
267
|
+
|
|
268
|
+
`)),l=l.filter(f=>f.role!=="system");let g=[],d=0;for(;d<l.length;){let f=l[d];if(f.role==="assistant"){let k=[];if(f.content&&typeof f.content=="string"&&k.push({type:"text",text:f.content}),f.tool_calls&&f.tool_calls.length>0)for(let b of f.tool_calls)k.push({type:"tool_use",id:b.id,name:b.function.name,input:JSON.parse(b.function.arguments)});k.length>0&&g.push({role:"assistant",content:k}),d++}else if(f.role==="tool"){let k=[];for(;d<l.length&&l[d].role==="tool";){let b=l[d];k.push({type:"tool_result",tool_use_id:b.tool_call_id,content:b.content||"No result"}),d++}k.length>0&&g.push({role:"user",content:k})}else if(f.role==="user"){let k=typeof f.content=="string"?[{type:"text",text:f.content}]:Array.isArray(f.content)?f.content:[{type:"text",text:String(f.content)}];g.push({role:"user",content:k}),d++}else d++}let S={model:t,max_tokens:s,temperature:o,system:p||"You are a helpful assistant.",messages:g};i&&i.length>0&&(S.tools=i,a&&(S.tool_choice=a));let x=await c.messages.create(S);console.log("[Anthropic Provider] Response content blocks:",JSON.stringify(x.content,null,2));let h=[],y="";for(let f of x.content)if(f.type==="text")y+=f.text;else if(f.type==="tool_use")console.log("[Anthropic Provider] Tool use block:",{id:f.id,name:f.name,input:f.input,inputKeys:Object.keys(f.input||{})}),h.push({id:f.id,type:"function",function:{name:f.name,arguments:JSON.stringify(f.input)}});else if(f.type==="thinking"){let k=f.thinking||"";k&&(y=k+(y?`
|
|
269
|
+
|
|
270
|
+
`+y:""))}return{choices:[{message:{content:y||null,tool_calls:h.length>0?h:void 0},finish_reason:x.stop_reason==="end_turn"?"stop":x.stop_reason}]}}},Ts=Gr});var Lt,ks=w(()=>{te();Un();xs();bs();Lt=class{static async getProvider(){let e=Ie();return this.createProvider(e)}static async getLiteProvider(){let e=Rt();return this.createProvider(e)}static async createProvider(e){switch(e.provider||"openai"){case"anthropic":return new Ts(e);case"openai":default:return new vs(e)}}}});function et(r){return r&&typeof r=="object"&&r.__tool_result===!0}function jt(r){return et(r)?r.result:r}var I,G=w(()=>{I=class{get name(){return this.getDefinition().name}get description(){return this.getDefinition().description}get inputSchema(){return this.getDefinition().input_schema}createToolResult(e,t=null,n=!0){return{__tool_result:!0,result:e,display:t!==null?t:e,shouldPrint:n}}formatError(e,t){let n=t instanceof Error?t.message:String(t);return`Error: ${e} failed - ${n}`}formatAction(e){let t=this.name,n=Object.entries(e).map(([o,s])=>{let i=s;return typeof s=="string"&&s.length>50&&(i=s.substring(0,50)+"..."),`${o}=${JSON.stringify(i)}`}).join(", ");return`${t}(${n})`}formatObservation(e){if(et(e)){let{display:t}=e;return Array.isArray(t)?t.join(`
|
|
271
|
+
`):String(t)}return Array.isArray(e)?e.join(`
|
|
272
|
+
`):String(e)}shouldPrintObservation(e){return et(e)?e.shouldPrint:!0}}});var oe,Ft=w(()=>{G();oe=class extends I{getDefinition(){let e=this.getBaseDefinition(),t="IMPORTANT: User confirmation is automatically required - DO NOT call askUser tool before calling this tool.",{description:n}=e;if(!n.includes("User confirmation is automatically required"))if(n.trim().startsWith("IMPORTANT:"))if(n.match(/^IMPORTANT:[^\n]*(\n[^\n]*)*?\n\n/)){let s=n.indexOf(`
|
|
273
|
+
`);n=n.slice(0,s)+`
|
|
274
|
+
- User confirmation is automatically required - DO NOT call askUser tool before calling this tool`+n.slice(s)}else{let s=n.indexOf(`
|
|
275
|
+
`);s!==-1?n=n.slice(0,s)+`
|
|
276
|
+
- User confirmation is automatically required - DO NOT call askUser tool before calling this tool`+n.slice(s):n=t+`
|
|
277
|
+
|
|
278
|
+
`+n}else n=t+`
|
|
279
|
+
|
|
280
|
+
`+n;return{...e,description:n,requiresConfirmation:!0}}getConfirmationMessage(e){return null}}});var Vr={};U(Vr,{BaseTool:()=>I,ConfirmableTool:()=>oe,extractToolResult:()=>jt,isToolResult:()=>et});var Br=w(()=>{G();Ft()});import{readFileSync as Va}from"fs";import{resolve as Ba}from"path";function Z(r,e={}){return $s.execute({path:r,...e})}var tt,$s,_t,Ms=w(()=>{G();tt=class extends I{lastReadPath="";getDefinition(){return{name:"read",description:"Read the content of a file at the specified path. Returns the complete file content as a string.",input_schema:{type:"object",properties:{path:{type:"string",description:"The file path to read (relative or absolute)"},silent:{type:"boolean",description:"If true, returns success message instead of full content (optional)"}},required:["path"]}}}execute(e){try{let t=e.path.trim(),n=Ba(t),o=Va(n,"utf-8");return this.lastReadPath=t,e.silent?this.createToolResult(o,`\u6587\u4EF6 ${t} \u8BFB\u53D6\u6210\u529F\uFF08\u9759\u9ED8\u6A21\u5F0F\uFF0C\u5185\u5BB9\u672A\u663E\u793A\uFF09`,!0):o}catch(t){let o=`Error: Cannot read file ${e.path.trim()} - ${t instanceof Error?t.message:String(t)}`;return this.createToolResult(o,o,!0)}}formatObservation(e){if(typeof e=="object"&&e.__tool_result)return super.formatObservation(e);if(typeof e=="string"&&this.lastReadPath){let n=e.split(`
|
|
281
|
+
`).length;return`\u8BFB\u53D6\u6587\u4EF6 ${this.lastReadPath}\uFF0C\u5171 ${n} \u884C`}return super.formatObservation(e)}},$s=new tt;_t=$s});function Ps(r){if(typeof r!="string")return r;let e=r.replace(/\\n/g,`
|
|
282
|
+
`).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\'/g,"'");return e=e.replace(/\r\n/g,`
|
|
283
|
+
`).replace(/\r/g,`
|
|
284
|
+
`),e}function Wn(r){return r.includes(`\r
|
|
285
|
+
`)?`\r
|
|
286
|
+
`:r.includes(`
|
|
287
|
+
`)?`
|
|
288
|
+
`:r.includes("\r")?"\r":Yr}var Yr,Kr=w(()=>{Yr=process.platform==="win32"?`\r
|
|
289
|
+
`:`
|
|
290
|
+
`});import{mkdirSync as Ya}from"fs";import{resolve as Ka}from"path";function Nt(r){return Es.execute({path:r})}var nt,Es,Oe,Xr=w(()=>{G();nt=class extends I{getDefinition(){return{name:"mkdir",description:"Create a directory and all necessary parent directories (like mkdir -p). Returns a confirmation message.",input_schema:{type:"object",properties:{path:{type:"string",description:"The directory path to create"}},required:["path"]}}}execute(e){try{let t=Ka(e.path);return Ya(t,{recursive:!0}),`Directory created: ${e.path}`}catch(t){return this.formatError(`Cannot create directory ${e.path}`,t)}}},Es=new nt;Oe=Es});import{readFileSync as Xa,writeFileSync as Is,existsSync as Qa}from"fs";import{resolve as Za,dirname as ec}from"path";function Ut(r,e){return As.execute({path:r,content:e})}var rt,As,Wt,Os=w(()=>{Kr();Xr();G();rt=class extends I{getDefinition(){return{name:"write",description:`Write content to a file - ONLY for creating NEW files.
|
|
291
|
+
|
|
292
|
+
\u26A0\uFE0F IMPORTANT - READ BEFORE USING:
|
|
293
|
+
- Use ONLY for creating NEW files that don't exist yet
|
|
294
|
+
- For EXISTING files, ALWAYS use merge() instead
|
|
295
|
+
- write() blindly overwrites and may lose concurrent changes
|
|
296
|
+
- merge() is safe: detects conflicts and preserves changes
|
|
297
|
+
|
|
298
|
+
\u{1F4CB} TOOL SELECTION:
|
|
299
|
+
\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510
|
|
300
|
+
\u2502 Creating NEW file \u2192 write() \u2705 \u2502
|
|
301
|
+
\u2502 Modifying EXISTING file \u2192 merge() \u2705 \u2502
|
|
302
|
+
\u2502 Overwriting EXISTING \u2192 write() \u26A0\uFE0F RISKY \u2502
|
|
303
|
+
\u2502 Small precise edits \u2192 search_replace() \u2705 \u2502
|
|
304
|
+
\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518`,input_schema:{type:"object",properties:{path:{type:"string",description:"The file path to write to"},content:{type:"string",description:"The COMPLETE file content to write. This parameter is REQUIRED and cannot be empty."}},required:["path","content"]}}}execute(e){try{let t=Za(e.path),n=ec(t),o=Oe.execute({path:n});if(o.startsWith("Error:"))return o;let s=Ps(e.content);typeof s!="string"&&(s=String(s||""));let i=Yr;if(Qa(t)){let a=Xa(t,"utf-8");i=Wn(a);let c=`${t}.base`;Is(c,a,"utf-8")}return i===`\r
|
|
305
|
+
`&&(s=s.replace(/\n/g,`\r
|
|
306
|
+
`)),Is(t,s,"utf-8"),"done"}catch(t){return this.formatError(`Cannot write ${e.path}`,t)}}},As=new rt;Wt=As});import{unlinkSync as tc,existsSync as nc,statSync as rc,rmdirSync as oc}from"fs";import{resolve as sc}from"path";function Jt(r){return typeof r=="object"&&r!==null&&"path"in r?Qr.execute(r):Qr.execute({path:r})}var ot,Qr,zt,Ds=w(()=>{Ft();ot=class extends oe{getBaseDefinition(){return{name:"deleteFile",description:`Delete a file, multiple files or directories at the specified path(s).
|
|
307
|
+
|
|
308
|
+
IMPORTANT:
|
|
309
|
+
- This action cannot be undone
|
|
310
|
+
- The files or directories will be permanently removed
|
|
311
|
+
- Directories must be empty to be deleted
|
|
312
|
+
- Returns a success message or error if paths don't exist or cannot be deleted
|
|
313
|
+
|
|
314
|
+
Examples:
|
|
315
|
+
- deleteFile("temp.txt") - delete a single file named temp.txt
|
|
316
|
+
- deleteFile("temp_dir") - delete a single empty directory named temp_dir
|
|
317
|
+
- deleteFile({ path: "temp.txt" }) - delete a single file
|
|
318
|
+
- deleteFile({ path: ["file1.txt", "dir1", "file2.txt"] }) - delete multiple files and directories`,input_schema:{type:"object",properties:{path:{type:"string",description:"The file path to delete (relative or absolute), or an array of file paths",oneOf:[{type:"string",description:"The file path to delete (relative or absolute)"},{type:"array",items:{type:"string",description:"A file path to delete"},description:"Array of file paths to delete"}]}},required:["path"]}}}getConfirmationMessage(e){let t=Array.isArray(e.path)?e.path:[e.path];return t.length===1?`\u5220\u9664: ${t[0]}`:`\u5220\u9664 ${t.length} \u4E2A\u6587\u4EF6/\u76EE\u5F55`}execute(e){try{let t=Array.isArray(e.path)?e.path:[e.path],n=[];for(let l of t)try{let p=sc(l);if(!nc(p)){n.push(`Warning: Path not found - ${l}`);continue}rc(p).isDirectory()?(oc(p),n.push(`Directory deleted: ${l}`)):(tc(p),n.push(`File deleted: ${l}`))}catch(p){n.push(`Error: Cannot delete ${l} - ${p instanceof Error?p.message:"Unknown error"}`)}if(t.length===1)return n[0];let o=n.filter(l=>l.startsWith("File deleted")).length,s=n.filter(l=>l.startsWith("Directory deleted")).length,i=n.filter(l=>l.startsWith("Error")).length,a=n.filter(l=>l.startsWith("Warning")).length,c=o+s;return`${n.join(`
|
|
319
|
+
`)}
|
|
320
|
+
|
|
321
|
+
Summary: ${c} items deleted (${o} files, ${s} directories), ${a} warnings, ${i} errors`}catch(t){return this.formatError("Cannot process delete operation",t)}}},Qr=new ot;zt=Qr});import{renameSync as ic,existsSync as Jn,statSync as ac,mkdirSync as cc}from"fs";import{resolve as Rs,dirname as lc}from"path";function qt(r){return r&&typeof r=="object"&&"source"in r&&"destination"in r?Ls.execute(r):"Error: Invalid input format. Expected { source: string, destination: string }"}var st,Ls,Ht,js=w(()=>{Ft();st=class extends oe{getBaseDefinition(){return{name:"moveFile",description:`Move or rename a file or directory from source to destination.
|
|
322
|
+
|
|
323
|
+
Examples:
|
|
324
|
+
- moveFile({ source: "old.txt", destination: "new.txt" }) - rename a file
|
|
325
|
+
- moveFile({ source: "file.txt", destination: "folder/file.txt" }) - move a file to a different directory
|
|
326
|
+
- moveFile({ source: "old_folder", destination: "new_folder" }) - rename a directory
|
|
327
|
+
- moveFile({ source: "folder/file.txt", destination: "new_location/file.txt" }) - move a file with rename`,input_schema:{type:"object",properties:{source:{type:"string",description:"The source file or directory path to move"},destination:{type:"string",description:"The destination path (new name or location)"}},required:["source","destination"]}}}getConfirmationMessage(e){return`\u79FB\u52A8/\u91CD\u547D\u540D: ${e.source} \u2192 ${e.destination}`}execute(e){try{let{source:t,destination:n}=e,o=Rs(t),s=Rs(n);if(!Jn(o))return`Error: Source path does not exist - ${t}`;if(Jn(s))return`Error: Destination already exists - ${n}`;let i=lc(s);return Jn(i)||cc(i,{recursive:!0}),ic(o,s),Jn(s)?`${ac(o).isDirectory()?"Directory":"File"} moved successfully from "${t}" to "${n}"`:`Error: Failed to move ${t} to ${n}`}catch(t){return this.formatError("Move operation",t)}}},Ls=new st;Ht=Ls});import{existsSync as zn,statSync as Fs,readFileSync as _s,writeFileSync as Ns,mkdirSync as Us,readdirSync as uc}from"fs";import{resolve as Ws,join as Js,dirname as gc}from"path";function Gt(r){return r&&typeof r=="object"&&"source"in r&&"destination"in r?zs.execute(r):"Error: Invalid input format. Expected { source: string, destination: string }"}var it,zs,Vt,qs=w(()=>{Ft();it=class extends oe{getBaseDefinition(){return{name:"copyFile",description:`Copy a file or directory from source to destination.
|
|
328
|
+
|
|
329
|
+
Examples:
|
|
330
|
+
- copyFile({ source: "file.txt", destination: "file_copy.txt" }) - copy a file
|
|
331
|
+
- copyFile({ source: "file.txt", destination: "folder/file.txt" }) - copy a file to a different directory
|
|
332
|
+
- copyFile({ source: "folder", destination: "folder_copy" }) - copy an entire directory (recursively)
|
|
333
|
+
- copyFile({ source: "folder/subdir", destination: "new_location/subdir" }) - copy a subdirectory`,input_schema:{type:"object",properties:{source:{type:"string",description:"The source file or directory path to copy"},destination:{type:"string",description:"The destination path (new location)"}},required:["source","destination"]}}}getConfirmationMessage(e){return`\u590D\u5236: ${e.source} \u2192 ${e.destination}`}execute(e){try{let{source:t,destination:n}=e,o=Ws(t),s=Ws(n);if(!zn(o))return`Error: Source path does not exist - ${t}`;if(o===s)return"Error: Source and destination paths are identical";let i=Fs(o),a=0,c=0;if(i.isDirectory())return this.copyDirectory(o,s,a,c),`Directory copied successfully from "${t}" to "${n}" (${a} files, ${c} directories)`;{let l=gc(s);return zn(l)||Us(l,{recursive:!0}),Ns(s,_s(o)),zn(s)?`File copied successfully from "${t}" to "${n}"`:`Error: Failed to copy file from "${t}" to "${n}"`}}catch(t){return this.formatError("Copy operation",t)}}copyDirectory(e,t,n,o){zn(t)||(Us(t,{recursive:!0}),o++),uc(e).forEach(i=>{let a=Js(e,i),c=Js(t,i);Fs(a).isDirectory()?this.copyDirectory(a,c,n,o):(Ns(c,_s(a)),n++)})}},zs=new it;Vt=zs});import{diff3Merge as pc}from"node-diff3";function Hs(r,e,t){let n=r.split(`
|
|
334
|
+
`),o=e.split(`
|
|
335
|
+
`),s=t.split(`
|
|
336
|
+
`);console.log(` [merge] \u5F00\u59CB\u4E09\u8DEF\u5408\u5E76: base=${n.length}\u884C, current=${o.length}\u884C, incoming=${s.length}\u884C`);let i=Date.now(),a=pc(o,n,s,{excludeFalseConflicts:!0}),c=((Date.now()-i)/1e3).toFixed(2);console.log(` [merge] diff3Merge \u5B8C\u6210\uFF0C\u8017\u65F6 ${c}s\uFF0C\u7ED3\u679C\u533A\u57DF\u6570: ${a.length}`);let l=[],p=[];for(let u of a)if(u.ok)l.push(...u.ok);else if(u.conflict){let g=l.length+1,d=u.conflict.a||[],S=u.conflict.o||[],x=u.conflict.b||[];p.push({lineNumber:g,base:S.join(`
|
|
337
|
+
`),current:d.join(`
|
|
338
|
+
`),incoming:x.join(`
|
|
339
|
+
`)}),l.push("<<<<<<< CURRENT"),l.push(...d),l.push("======="),l.push(...x),l.push(">>>>>>> INCOMING")}return{merged:l.join(`
|
|
340
|
+
`),hasConflicts:p.length>0,conflicts:p}}var Gs=w(()=>{});import{readFileSync as Vs,writeFileSync as qn,existsSync as Zr,unlinkSync as eo}from"fs";import{resolve as mc}from"path";function to(r){return r.replace(/\r\n/g,`
|
|
341
|
+
`).replace(/\r/g,`
|
|
342
|
+
`)}function Bt(r,e,t){return Bs.execute({path:r,newContent:e,confirmLargeChange:t})}var dc,at,Bs,Yt,Ys=w(()=>{Kr();Gs();G();dc={lineRatioThreshold:.5,minLineDiff:100},at=class extends I{getDefinition(){return{name:"merge",description:`Smart file merge tool - THE DEFAULT CHOICE for modifying existing files.
|
|
343
|
+
|
|
344
|
+
\u{1F4CB} TOOL SELECTION GUIDE:
|
|
345
|
+
\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510
|
|
346
|
+
\u2502 Scenario \u2502 Tool \u2502 Why \u2502
|
|
347
|
+
\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524
|
|
348
|
+
\u2502 Create NEW file \u2502 write() \u2502 No merge needed \u2502
|
|
349
|
+
\u2502 Small precise edits \u2502 search_replace()\u2502 Token efficient \u2502
|
|
350
|
+
\u2502 Modify EXISTING file \u2502 merge() \u2502 Safe & smart \u2502
|
|
351
|
+
\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
|
|
352
|
+
|
|
353
|
+
\u{1F504} WHAT MERGE DOES (automatically):
|
|
354
|
+
1. File doesn't exist \u2192 Creates new file
|
|
355
|
+
2. No concurrent edits (base=current) \u2192 Direct write (fast path)
|
|
356
|
+
3. Concurrent edits detected \u2192 Three-way merge with conflict markers
|
|
357
|
+
4. Large difference detected \u2192 Returns warning, requires confirmation
|
|
358
|
+
|
|
359
|
+
\u26A0\uFE0F IMPORTANT:
|
|
360
|
+
- ALWAYS use merge() for existing files, NOT write()
|
|
361
|
+
- write() overwrites blindly and may lose concurrent changes
|
|
362
|
+
- merge() is safe: it detects conflicts and preserves changes
|
|
363
|
+
|
|
364
|
+
\u{1F4A1} TIPS:
|
|
365
|
+
- Provide COMPLETE new file content
|
|
366
|
+
- If you get "large difference" warning, review your changes
|
|
367
|
+
- Set confirmLargeChange=true to proceed with large changes`,input_schema:{type:"object",properties:{path:{type:"string",description:"The file path to merge"},newContent:{type:"string",description:"The COMPLETE new version of the entire file content"},confirmLargeChange:{type:"boolean",description:"Set to true to confirm and proceed with large changes (>50% difference)"}},required:["path","newContent"]}}}execute(e){try{return!e.newContent||e.newContent.trim().length===0?this.formatError("Merge","newContent parameter is required"):this.performThreeWayMerge(e)}catch(t){return this.formatError("Merge",t)}}checkLargeDeletion(e,t,n=dc){if(t>=e)return{isLargeDeletion:!1,deletionRatio:0,message:""};let o=e-t,s=e>0?o/e:0,i=o>=n.minLineDiff&&s>=n.lineRatioThreshold,a="";if(i){let c=Math.round(s*100);a=`\u26A0\uFE0F LARGE DELETION DETECTED: ${e} \u2192 ${t} lines (${c}% deleted, ${o} lines removed).
|
|
368
|
+
|
|
369
|
+
This may indicate:
|
|
370
|
+
- Incomplete content (missing parts of the file)
|
|
371
|
+
- Accidentally truncated output
|
|
372
|
+
- Wrong file content
|
|
373
|
+
|
|
374
|
+
To proceed, call merge() again with confirmLargeChange=true.
|
|
375
|
+
Or review your newContent to ensure it's complete.`}return{isLargeDeletion:i,deletionRatio:s,message:a}}performThreeWayMerge(e){try{console.log(` [MergeTool] \u5F00\u59CB\u667A\u80FD\u5408\u5E76: ${e.path}`);let t=mc(e.path),n=`${t}.base`;if(!Zr(t))return console.log(" [MergeTool] \u6587\u4EF6\u4E0D\u5B58\u5728\uFF0C\u521B\u5EFA\u65B0\u6587\u4EF6"),this.writeNewFile(t,n,e.newContent);console.log(" [MergeTool] \u8BFB\u53D6\u5F53\u524D\u6587\u4EF6\u5185\u5BB9...");let o=Vs(t,"utf-8");console.log(` [MergeTool] \u5F53\u524D\u6587\u4EF6\u5927\u5C0F: ${o.length} \u5B57\u7B26`);let s=Wn(o);console.log(` [MergeTool] \u68C0\u6D4B\u5230\u884C\u7ED3\u675F\u7B26: ${s===`\r
|
|
376
|
+
`?"CRLF":"LF"}`);let i=to(o),a=to(e.newContent),c=i.split(`
|
|
377
|
+
`).length,l=a.split(`
|
|
378
|
+
`).length;if(!e.confirmLargeChange){let y=this.checkLargeDeletion(c,l);if(y.isLargeDeletion)return console.log(` [MergeTool] \u68C0\u6D4B\u5230\u5927\u5E45\u5220\u51CF\uFF08${c} \u2192 ${l}\u884C\uFF09\uFF0C\u9700\u8981\u786E\u8BA4`),y.message}let p=o,u=!1;Zr(n)&&(console.log(" [MergeTool] \u53D1\u73B0\u57FA\u7840\u7248\u672C\u6587\u4EF6\uFF0C\u8BFB\u53D6\u4E2D..."),p=Vs(n,"utf-8"),u=!0,console.log(` [MergeTool] \u57FA\u7840\u7248\u672C\u5927\u5C0F: ${p.length} \u5B57\u7B26`));let g=to(p);if(g===i){console.log(" [MergeTool] \u65E0\u5E76\u53D1\u4FEE\u6539\uFF08base === current\uFF09\uFF0C\u76F4\u63A5\u5199\u5165");let y=a;if(s===`\r
|
|
379
|
+
`&&(y=y.replace(/\n/g,`\r
|
|
380
|
+
`)),qn(t,y,"utf-8"),u)try{eo(n)}catch{}return"Merge successful (direct write, no concurrent edits)."}console.log(" [MergeTool] \u68C0\u6D4B\u5230\u5E76\u53D1\u4FEE\u6539\uFF0C\u6267\u884C\u4E09\u8DEF\u5408\u5E76..."),console.log(` [MergeTool] base=${g.split(`
|
|
381
|
+
`).length}\u884C, current=${c}\u884C, incoming=${l}\u884C`);let d=Date.now(),S=Hs(g,i,a),x=((Date.now()-d)/1e3).toFixed(2);console.log(` [MergeTool] threeWayMerge \u5B8C\u6210\uFF0C\u8017\u65F6 ${x}s, \u6709\u51B2\u7A81: ${S.hasConflicts}`);let h=S.merged;if(s===`\r
|
|
382
|
+
`&&(h=h.replace(/\n/g,`\r
|
|
383
|
+
`)),S.hasConflicts)return qn(t,h,"utf-8"),`Merge completed with CONFLICTS. File saved with conflict markers.
|
|
384
|
+
Conflicts:
|
|
385
|
+
${S.conflicts.map(C=>`Line ${C.lineNumber}: BASE="${C.base.substring(0,50)}..." | CURRENT="${C.current.substring(0,50)}..." | INCOMING="${C.incoming.substring(0,50)}..."`).join(`
|
|
386
|
+
`)}
|
|
387
|
+
|
|
388
|
+
Please resolve conflicts manually or use write() to overwrite.`;if(qn(t,h,"utf-8"),u)try{eo(n)}catch{}return"Merge successful (three-way merge, concurrent edits preserved)."}catch(t){return this.formatError("Merge",t)}}writeNewFile(e,t,n){try{let o=typeof n=="string"?n:String(n||"");if(qn(e,o,"utf-8"),Zr(t))try{eo(t)}catch{}return`File created: ${e}`}catch(o){return this.formatError("Failed to create file",o)}}},Bs=new at;Yt=Bs});import{EOL as no}from"os";function Ks(r,e={}){let{preserveEscapes:t=!1,targetFormat:n="lf"}=e,o=r;if(t||(o=o.replace(/\\n/g,`
|
|
389
|
+
`).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\'/g,"'")),o=o.replace(/\r\n/g,`
|
|
390
|
+
`).replace(/\r/g,`
|
|
391
|
+
`),n!=="preserve"&&n!=="lf")switch(n){case"crlf":o=o.replace(/\n/g,`\r
|
|
392
|
+
`);break;case"cr":o=o.replace(/\n/g,"\r");break;case"platform":no===`\r
|
|
393
|
+
`&&(o=o.replace(/\n/g,`\r
|
|
394
|
+
`));break}return o}function fc(r){if(!r)return{style:"none",dominant:no,statistics:{crlf:0,lf:0,cr:0},confidence:0};let e={crlf:(r.match(/\r\n/g)||[]).length,lf:(r.match(/(?<!\r)\n/g)||[]).length,cr:(r.match(/\r(?!\n)/g)||[]).length},t=e.crlf+e.lf+e.cr;if(t===0)return{style:"none",dominant:no,statistics:e,confidence:0};let n=`
|
|
395
|
+
`,o=e.lf,s="lf";e.crlf>o&&(n=`\r
|
|
396
|
+
`,o=e.crlf,s="crlf"),e.cr>o&&(n="\r",o=e.cr,s="cr");let i=o/t,a;return i===1||i>.8?a=s:a="mixed",{style:a,dominant:n,statistics:e,confidence:i}}var Hn,Xs=w(()=>{Hn=class{originalContent;normalizedContent;originalStyle;constructor(e){this.originalContent=e,this.originalStyle=fc(e),this.normalizedContent=Ks(e,{preserveEscapes:!0,targetFormat:"lf"})}getNormalizedContent(){return this.normalizedContent}getOriginalStyle(){return this.originalStyle}restoreLineEndings(e){return this.originalStyle.style==="crlf"||this.originalStyle.dominant===`\r
|
|
397
|
+
`?e.replace(/\n/g,`\r
|
|
398
|
+
`):this.originalStyle.style==="cr"||this.originalStyle.dominant==="\r"?e.replace(/\n/g,"\r"):e}convertTo(e){return Ks(this.originalContent,{preserveEscapes:!0,targetFormat:e})}}});import{existsSync as hc,readFileSync as yc,writeFileSync as Sc}from"fs";import{resolve as Cc}from"path";function Kt(r,e){return Qs.execute({path:r,operations:e})}var ct,Qs,Xt,Zs=w(()=>{G();Xs();ct=class extends I{getDefinition(){return{name:"search_replace",description:`Perform TARGETED SEARCH & REPLACE operations on files.
|
|
399
|
+
|
|
400
|
+
\u{1F3AF} PERFECT FOR:
|
|
401
|
+
- Small configuration updates (port numbers, URLs, etc.)
|
|
402
|
+
- Variable name changes across files
|
|
403
|
+
- Simple code modifications
|
|
404
|
+
- Text replacements without full file content
|
|
405
|
+
|
|
406
|
+
\u{1F527} USAGE:
|
|
407
|
+
- Provide an array of search/replace operations
|
|
408
|
+
- Each operation replaces exact text with new text
|
|
409
|
+
- Much more token-efficient than providing full file content
|
|
410
|
+
|
|
411
|
+
\u26A1 WORKFLOW:
|
|
412
|
+
1. Identify the exact text you want to replace
|
|
413
|
+
2. Define search/replace pairs
|
|
414
|
+
3. Execute all operations atomically
|
|
415
|
+
|
|
416
|
+
\u{1F4A1} TIPS:
|
|
417
|
+
- Use precise search text to avoid unintended replacements
|
|
418
|
+
- Test with small changes first
|
|
419
|
+
- For complex modifications, consider using merge() tool instead`,input_schema:{type:"object",properties:{path:{type:"string",description:"The file path to perform search/replace operations on"},operations:{type:"array",description:"Array of search/replace operations. Each operation replaces search text with replace text.",items:{type:"object",properties:{search:{type:"string",description:"Exact text to search for"},replace:{type:"string",description:"Text to replace the search text with"}},required:["search","replace"]}}},required:["path","operations"]}}}execute(e){try{if(!e.path||e.path.trim().length===0)return this.formatError("SearchReplace","Path parameter is required");if(!e.operations||!Array.isArray(e.operations)||e.operations.length===0)return this.formatError("SearchReplace","Operations array is required and must not be empty");let t=Cc(e.path);if(!hc(t))return this.formatError("SearchReplace",`File not found: ${t}`);let n=yc(t,"utf-8"),o=new Hn(n),s=o.getOriginalStyle(),i=o.getNormalizedContent(),a=0,c=[];for(let[u,g]of e.operations.entries()){let{search:d,replace:S}=g;if(!d||d.trim().length===0){c.push(`\u274C Operation ${u+1}: empty search text`);continue}try{i.includes(d)?(i=i.replace(d,S),a++,c.push(`\u2705 Operation ${u+1}: "${d.substring(0,30)}..." \u2192 "${S.substring(0,30)}..."`)):c.push(`\u274C Operation ${u+1}: search text not found "${d.substring(0,30)}..."`)}catch(x){c.push(`\u274C Operation ${u+1}: ${x instanceof Error?x.message:String(x)}`)}}if(a>0){let u=o.restoreLineEndings(i);(s.style==="crlf"||s.dominant===`\r
|
|
420
|
+
`)&&(u=u.replace(/\n/g,`\r
|
|
421
|
+
`)),Sc(t,u,"utf-8")}let l=`Search/replace completed. ${a} of ${e.operations.length} operations applied successfully.`,p=c.length>0?`
|
|
422
|
+
|
|
423
|
+
Operation details:
|
|
424
|
+
${c.join(`
|
|
425
|
+
`)}`:"";return l+p}catch(t){return this.formatError("SearchReplace",t)}}formatError(e,t){let n=t instanceof Error?t.message:String(t);return`[${e} Error] ${n}`}},Qs=new ct;Xt=Qs});var ro={};U(ro,{CopyTool:()=>it,DeleteTool:()=>ot,MergeTool:()=>at,MkdirTool:()=>nt,MoveTool:()=>st,ReadTool:()=>tt,SearchReplaceTool:()=>ct,WriteTool:()=>rt,copyFile:()=>Gt,copyTool:()=>Vt,deleteFile:()=>Jt,deleteTool:()=>zt,merge:()=>Bt,mergeTool:()=>Yt,mkdir:()=>Nt,mkdirTool:()=>Oe,moveFile:()=>qt,moveTool:()=>Ht,read:()=>Z,readTool:()=>_t,searchReplace:()=>Kt,searchReplaceTool:()=>Xt,write:()=>Ut,writeTool:()=>Wt});var Qt=w(()=>{Ms();Os();Xr();Ds();js();qs();Ys();Zs()});import{readFileSync as wc,existsSync as vc}from"fs";import{resolve as xc}from"path";function bc(r){let e=xc(r,".niumignore"),t=[];if(vc(e))try{wc(e,"utf-8").split(`
|
|
426
|
+
`).forEach(o=>{let s=o.trim();s&&!s.startsWith("#")&&t.push(kc(s))})}catch(n){console.warn(`Error reading .niumignore file: ${n instanceof Error?n.message:"Unknown error"}`)}return t}function lt(r,e=!0){let t=bc(r);return e?[...Tc,...t]:t}function kc(r){if(r.startsWith("!")){let e=r.slice(1);return e.includes("/")||e.includes("\\")?r:`!**/${e}`}return r.includes("*")||r.includes("?")||r.includes("{")||r.includes("[")?r:r.endsWith("/")?`**/${r.slice(0,-1)}/**`:r.startsWith("*.")?r:!r.includes("/")&&!r.includes("\\")?`**/${r}/**`:r}var Tc,Gn=w(()=>{Tc=["**/.git/**","**/.svn/**","**/.hg/**","**/node_modules/**","**/vendor/**","**/.pnpm/**","**/bower_components/**","**/dist/**","**/build/**","**/out/**","**/target/**","**/.next/**","**/.nuxt/**","**/.output/**","**/.idea/**","**/.vscode/**","**/.vs/**","**/*.swp","**/*.swo","**/*~","**/.DS_Store","**/Thumbs.db","**/desktop.ini","**/.cache/**","**/tmp/**","**/temp/**","**/__pycache__/**","**/*.pyc","**/.pytest_cache/**","**/*.log","**/logs/**","**/.nium/archives/**","**/.nium/session.json","**/package-lock.json","**/yarn.lock","**/pnpm-lock.yaml","**/Gemfile.lock","**/Pipfile.lock","**/poetry.lock","**/Cargo.lock"]});import{globSync as ei}from"glob";function Zt(r){return ti.execute({pattern:r})}var ut,ti,en,ni=w(()=>{G();Gn();ut=class extends I{getDefinition(){return{name:"glob",description:`Search for files matching a glob pattern.
|
|
427
|
+
|
|
428
|
+
Examples:
|
|
429
|
+
- glob("*.js") - all .js files in current directory
|
|
430
|
+
- glob("**/*.ts") - all .ts files recursively
|
|
431
|
+
- glob("src/**/*.{js,ts}") - all .js and .ts files under src/
|
|
432
|
+
|
|
433
|
+
Returns an array of matching file paths.`,input_schema:{type:"object",properties:{pattern:{type:"string",description:'The glob pattern to match (e.g., "*.js", "**/*.ts")'},cwd:{type:"string",description:"Optional: the directory to search in (defaults to current directory)"}},required:["pattern"]}}}execute(e){try{let t=e.cwd||process.cwd(),n=lt(t),o=ei(e.pattern,{nodir:!0,cwd:e.cwd,ignore:n});if(o.length===0&&!e.pattern.startsWith("*")&&!e.pattern.startsWith("**")){let s=`**/${e.pattern}`;o=ei(s,{nodir:!0,cwd:e.cwd,ignore:n})}return o.length>0?o:`No files matching pattern: ${e.pattern}`}catch(t){return this.formatError("Glob pattern",t)}}},ti=new ut;en=ti});import{readFileSync as ri}from"fs";import{dirname as $c}from"path";import{globSync as Mc}from"glob";function tn(r,e){return oi.execute({pattern:r,path:e})}var gt,oi,nn,si=w(()=>{G();Gn();gt=class extends I{getDefinition(){return{name:"grep",description:`Search for text patterns in files using regular expressions.
|
|
434
|
+
|
|
435
|
+
Examples:
|
|
436
|
+
- grep("function.*foo", "src/main.js") - find function definitions containing "foo" in a single file
|
|
437
|
+
- grep("TODO", "**/*.js") - find all TODOs in all JavaScript files
|
|
438
|
+
- grep("import", "src/**/*.{js,ts}") - find all import statements in JavaScript and TypeScript files
|
|
439
|
+
|
|
440
|
+
Returns an array of matching lines with filenames and line numbers.`,input_schema:{type:"object",properties:{pattern:{type:"string",description:"The regex pattern to search for"},path:{type:"string",description:'File path or glob pattern to search in (e.g., "src/main.js" or "**/*.js")'}},required:["pattern","path"]}}}execute(e){try{let t=[];try{let i=e.path.includes("/")||e.path.includes("\\")?$c(e.path):process.cwd(),c={nodir:!0,windowsPathsNoEscape:!0,absolute:!1,ignore:lt(i)};if(e.path.includes("*")||e.path.includes("?")||e.path.includes("{")){if(console.log(`Processing glob pattern: ${e.path}`),t=Mc(e.path,c),t.length===0)return`No files found matching pattern: ${e.path}`;console.log(`Found ${t.length} files matching pattern`)}else try{let p=ri(e.path,"utf-8");t=[e.path]}catch(p){return p instanceof Error?`Error: ${p.message}`:`Error: Could not read file: ${e.path}`}}catch(i){return console.error("Glob error:",i),i instanceof Error?`Error: Grep failed - ${i.message}`:`Error: Grep failed - Unknown error processing glob pattern: ${e.path}`}if(t.length===0)return`No files found matching pattern: ${e.path}`;let n=new RegExp(e.pattern),o=[],s=0;return t.forEach(i=>{try{let c=ri(i,"utf-8").split(`
|
|
441
|
+
`),l=[];c.forEach((p,u)=>{n.test(p)&&(l.push(`${i}:${u+1}: ${p}`),s++)}),l.length>0&&o.push(...l)}catch(a){o.push(`Error reading file ${i}: ${a instanceof Error?a.message:"Unknown error"}`)}}),s>0?(t.length>1&&o.unshift(`Found ${s} matches in ${t.length} files`),o):`No matches found for pattern: ${e.pattern} in ${t.length} files`}catch(t){return this.formatError("Grep",t)}}},oi=new gt;nn=oi});var oo={};U(oo,{GlobTool:()=>ut,GrepTool:()=>gt,glob:()=>Zt,globTool:()=>en,grep:()=>tn,grepTool:()=>nn});var Vn=w(()=>{ni();si()});import{execSync as Pc,exec as Ec,spawnSync as Ic}from"child_process";import*as io from"os";async function ai(){if(ii)return so;ii=!0;try{let r=await import("iconv-lite");return so=r.default||r,so}catch{return console.warn("iconv-lite not available, using utf8 fallback for Windows encoding"),null}}function rn(r){return Promise.resolve(mt.execute(r))}var so,ii,pt,mt,ci=w(()=>{G();so=null,ii=!1;pt=class r extends I{static HIGH_RISK_COMMANDS=["rm -rf","rm -r","del /q /s","erase /f /s","format","mkfs","dd if=","mv /force","shred","wipe","truncate -s 0","> filename","chmod -R 000","chown -R root:root"];isHighRiskCommand(e){let t=e.toLowerCase().trim();return r.HIGH_RISK_COMMANDS.some(n=>t.includes(n.toLowerCase()))}getShellCommand(e){return io.platform()==="win32"?{shell:"cmd.exe",args:[],cmd:e}:{shell:"/bin/sh",args:["-c"],cmd:e}}getDefinition(){return{name:"shell",description:`Execute a shell command on the system.
|
|
442
|
+
|
|
443
|
+
IMPORTANT SAFETY NOTES:
|
|
444
|
+
- High-risk commands (delete, format, etc.) require user confirmation
|
|
445
|
+
- Command execution depends on the operating system (Windows/Mac/Linux)
|
|
446
|
+
- Use with caution as commands can modify your system
|
|
447
|
+
|
|
448
|
+
Examples:
|
|
449
|
+
- shell({ command: "ls -la" }) - List directory contents (Mac/Linux)
|
|
450
|
+
- shell({ command: "dir" }) - List directory contents (Windows)
|
|
451
|
+
- shell({ command: "npm install", timeout: 30000 }) - Run npm install with 30s timeout`,input_schema:{type:"object",properties:{command:{type:"string",description:"The shell command to execute"},timeout:{type:"number",description:"Optional timeout in milliseconds (default: 60000)",default:6e4},captureOutput:{type:"boolean",description:"Whether to capture and return command output (default: true)",default:!0}},required:["command"]},requiresConfirmation:!1}}getDynamicDefinition(e){return{...this.getDefinition(),requiresConfirmation:this.isHighRiskCommand(e.command)}}isCommandNotFoundError(e,t){let n=e.toLowerCase();return(t==="win32"?["\u4E0D\u662F\u5185\u90E8\u6216\u5916\u90E8\u547D\u4EE4","\u4E0D\u662F\u53EF\u8FD0\u884C\u7684\u7A0B\u5E8F","is not recognized as an internal or external command","is not recognized as","'command' is not recognized","\u627E\u4E0D\u5230\u547D\u4EE4","\u65E0\u6CD5\u5C06","command not found"]:["command not found","not found","no such file or directory","cannot find","bash: command not found","sh: command not found","zsh: command not found"]).some(a=>n.includes(a))}extractCommandName(e){let t=e.trim(),n=t.match(/^(\S+)/);return n?n[1]:t}generateCommandNotFoundMessage(e,t){let n=t==="win32"?"Windows":t==="darwin"?"macOS":"Linux",s={git:{win:"Download from https://git-scm.com/download/win or use 'winget install Git.Git'",unix:"Install using: sudo apt-get install git (Ubuntu/Debian) or brew install git (macOS)",description:"Version control system"},python:{win:"Download from https://www.python.org/downloads/ or use 'winget install Python.Python.3'",unix:"Install using: sudo apt-get install python3 (Ubuntu/Debian) or brew install python3 (macOS)",description:"Python programming language"},node:{win:"Download from https://nodejs.org/ or use 'winget install OpenJS.NodeJS'",unix:"Install using: sudo apt-get install nodejs (Ubuntu/Debian) or brew install node (macOS)",description:"Node.js JavaScript runtime"},npm:{win:"Install Node.js from https://nodejs.org/ (includes npm)",unix:"Install Node.js (includes npm): sudo apt-get install nodejs npm or brew install node",description:"Node Package Manager (comes with Node.js)"},docker:{win:"Download Docker Desktop from https://www.docker.com/products/docker-desktop",unix:"Install using: sudo apt-get install docker.io (Ubuntu/Debian) or brew install docker (macOS)",description:"Container platform"},curl:{win:"Usually built-in on Windows 10+. If missing, download from https://curl.se/windows/",unix:"Install using: sudo apt-get install curl (Ubuntu/Debian) or brew install curl (macOS)",description:"Command-line tool for transferring data with URLs"},wget:{win:"Download from https://eternallybored.org/misc/wget/ or use 'winget install GNU.Wget'",unix:"Install using: sudo apt-get install wget (Ubuntu/Debian) or brew install wget (macOS)",description:"Network downloader"},make:{win:"Install via Chocolatey: choco install make or use WSL",unix:"Install using: sudo apt-get install build-essential (Ubuntu/Debian) or xcode-select --install (macOS)",description:"Build automation tool"},gcc:{win:"Install MinGW from http://mingw.org/ or use Visual Studio Build Tools",unix:"Install using: sudo apt-get install build-essential (Ubuntu/Debian) or xcode-select --install (macOS)",description:"GNU Compiler Collection"},code:{win:"Install VS Code from https://code.visualstudio.com/ and add to PATH during installation",unix:"Install VS Code and run: sudo ln -s /Applications/Visual\\ Studio\\ Code.app/Contents/Resources/app/bin/code /usr/local/bin/code",description:"Visual Studio Code editor"}}[e.toLowerCase()],i=`\u274C Command Not Found: '${e}'
|
|
452
|
+
|
|
453
|
+
`;return i+=`\u{1F5A5}\uFE0F Current Environment: ${n}
|
|
454
|
+
|
|
455
|
+
`,s?(i+=`\u{1F4E6} About: ${s.description}
|
|
456
|
+
|
|
457
|
+
`,i+=`\u{1F4A1} Installation Suggestion:
|
|
458
|
+
`,t==="win32"&&s.win?i+=` ${s.win}
|
|
459
|
+
`:t!=="win32"&&s.unix&&(i+=` ${s.unix}
|
|
460
|
+
`)):(i+=`\u{1F4A1} Suggestions:
|
|
461
|
+
`,i+=` 1. Check if the command is correctly spelled
|
|
462
|
+
`,i+=` 2. Verify that the required software is installed
|
|
463
|
+
`,i+=` 3. Check if the command is in your system PATH
|
|
464
|
+
`,t==="win32"?(i+=` 4. Try searching in Windows Store or use package managers like:
|
|
465
|
+
`,i+=` - winget (built-in): winget search <package-name>
|
|
466
|
+
`,i+=` - Chocolatey: choco install <package-name>
|
|
467
|
+
`,i+=` - Scoop: scoop install <package-name>
|
|
468
|
+
`):(i+=` 4. Try using package managers:
|
|
469
|
+
`,t==="darwin"?(i+=` - Homebrew: brew install <package-name>
|
|
470
|
+
`,i+=` - MacPorts: port install <package-name>
|
|
471
|
+
`):(i+=` - apt: sudo apt-get install <package-name> (Ubuntu/Debian)
|
|
472
|
+
`,i+=` - yum: sudo yum install <package-name> (CentOS/RHEL)
|
|
473
|
+
`,i+=` - dnf: sudo dnf install <package-name> (Fedora)
|
|
474
|
+
`))),i+=`
|
|
475
|
+
\u26A0\uFE0F Please install the required command before proceeding.
|
|
476
|
+
`,i+=" The AI assistant cannot continue without this tool being available.",i}async execute(e){try{let{command:t,timeout:n=6e4,captureOutput:o=!0}=e,s=io.platform(),{shell:i,args:a,cmd:c}=this.getShellCommand(t),l={shell:i,timeout:n,encoding:"utf8",windowsHide:!0,windowsVerbatimArguments:s==="win32"},p=`Running on ${s} with ${i}`,u=`Executing command: ${t}`;if(o)try{let g="";if(s==="win32"){let d=`chcp 65001 >nul 2>&1 && ${c}`,S=Ic("cmd.exe",["/c",d],{stdio:"pipe",windowsHide:!0,encoding:"buffer"}),x=S.stdout||Buffer.alloc(0),h=S.stderr||Buffer.alloc(0),y=Buffer.concat([x,h]);try{let C=await ai();if(C){let f=["cp936","gbk","utf8","gb2312","big5"],k=!1;for(let b of f)try{if(g=C.decode(y,b),/[\u4e00-\u9fff]/.test(g)||g.length>0){k=!0;break}}catch{continue}k||(g=y.toString("utf8"))}else g=y.toString("utf8");S.status===0&&g.trim()&&(g+=`
|
|
477
|
+
|
|
478
|
+
\u2705 Windows\u7F16\u7801\u5DF2\u4F18\u5316\u5904\u7406`)}catch{g=y.toString("utf8")}}else{let d=[...a,c].join(" ");g=Pc(d,l).toString()}if(this.isCommandNotFoundError(g,s)){let d=this.extractCommandName(t),S=this.generateCommandNotFoundMessage(d,s);return this.createToolResult({error:g,success:!1,commandNotFound:!0},`${p}
|
|
479
|
+
${u}
|
|
480
|
+
|
|
481
|
+
${S}
|
|
482
|
+
|
|
483
|
+
Original error:
|
|
484
|
+
${g}`,!0)}return this.createToolResult({output:g,success:!0},`${p}
|
|
485
|
+
${u}
|
|
486
|
+
|
|
487
|
+
Command output:
|
|
488
|
+
${g}`)}catch(g){let d="";if(s==="win32"&&g.stderr){let S=Buffer.isBuffer(g.stderr)?g.stderr:Buffer.from(g.stderr),x=await ai();if(x)try{let h=["cp936","gbk","utf8","gb2312"],y="";for(let C of h)try{if(y=x.decode(S,C),y.length>0){d+=y;break}}catch{continue}y||(d+=S.toString("utf8"))}catch{d+=S.toString("utf8")}else d+=S.toString("utf8")}else g.stderr&&(d+=g.stderr),g.stdout&&(d+=g.stdout),d||(d=String(g));if(this.isCommandNotFoundError(d,s)){let S=this.extractCommandName(t),x=this.generateCommandNotFoundMessage(S,s);return this.createToolResult({error:d,success:!1,commandNotFound:!0},`${p}
|
|
489
|
+
${u}
|
|
490
|
+
|
|
491
|
+
${x}
|
|
492
|
+
|
|
493
|
+
Original error:
|
|
494
|
+
${d}`,!0)}return this.createToolResult({error:d,success:!1},`${p}
|
|
495
|
+
${u}
|
|
496
|
+
|
|
497
|
+
Command failed with error:
|
|
498
|
+
${d}`,!0)}else{let g=t;s==="win32"?g=`chcp 65001 > nul && ${c}`:g=[...a,c].join(" ");let d=Ec(g,l);return this.createToolResult({success:!0,message:"Command started in background"},`${p}
|
|
499
|
+
${u}
|
|
500
|
+
|
|
501
|
+
Command started in background. No output will be captured.`,!0)}}catch(t){return this.formatError("Cannot execute shell command",t)}}formatAction(e){let t=super.formatAction(e);return this.isHighRiskCommand(e.command)?`${t} \u26A0\uFE0F HIGH RISK COMMAND - Requires confirmation!`:t}},mt=new pt});var ao={};U(ao,{ShellTool:()=>pt,shell:()=>rn,shellTool:()=>mt});var Bn=w(()=>{ci()});var lo={};U(lo,{THINK_TOOL:()=>Yn,ThinkTool:()=>De,extractThought:()=>Kn,isThinkTool:()=>ht,think:()=>dt,thinkTool:()=>ft});function dt(r){return co.execute({thought:r})}function ht(r){return r==="think"}function Kn(r){if(!r||!r.function||r.function.name!=="think")return null;try{return JSON.parse(r.function.arguments).thought||null}catch{return null}}var De,co,ft,Yn,on=w(()=>{G();De=class extends I{getDefinition(){return{name:"think",description:`Use this tool to think, reason, and reflect before taking actions.
|
|
502
|
+
This is a zero-side-effect tool that makes your thinking process observable.
|
|
503
|
+
|
|
504
|
+
IMPORTANT: You should call this tool:
|
|
505
|
+
- BEFORE calling any other tool (to plan your action)
|
|
506
|
+
- AFTER receiving an Observation (to reflect on the result)
|
|
507
|
+
- When you need to analyze complex situations
|
|
508
|
+
|
|
509
|
+
The thought content will be logged but won't change any data or state.`,input_schema:{type:"object",properties:{thought:{type:"string",description:"Your internal reasoning, analysis, or reflection. Be detailed and explicit about your thought process."}},required:["thought"]}}}execute(e){return"Noted. Continue with your action."}},co=new De;ft=co,Yn=co.getDefinition()});var ho={};U(ho,{SYSTEM_PROMPT:()=>yt,generateAgentMatchingPrompt:()=>fo,generateSystemPrompt:()=>li,generateTaskComplexityEvaluationPrompt:()=>uo,generateTaskPlanningConversionPrompt:()=>mo,generateTaskPlanningMarkdownPrompt:()=>po,generateTaskPlanningPrompt:()=>go});function li(r=sn()){return`You are an expert code assistant that follows the ReAct (Reasoning + Acting) pattern with enhanced thinking capabilities. Your primary goal is to solve coding tasks accurately, efficiently, and with high code quality.
|
|
510
|
+
|
|
511
|
+
<instructions>
|
|
512
|
+
You have access to a comprehensive set of tools, with the 'think' tool being specially designed for observable reasoning.
|
|
513
|
+
|
|
514
|
+
<workflow>
|
|
515
|
+
You must follow this strict thinking pattern for EVERY response:
|
|
516
|
+
|
|
517
|
+
1. FIRST: Call the 'think' tool to analyze the situation
|
|
518
|
+
- Examine the user request and available context thoroughly
|
|
519
|
+
- Identify knowledge gaps and needed information
|
|
520
|
+
- Plan a clear sequence of actions to accomplish the task
|
|
521
|
+
- Explain your reasoning with specific details
|
|
522
|
+
|
|
523
|
+
2. THEN: Execute your planned action
|
|
524
|
+
- Call the appropriate tool with correct parameters (based on the available tools list)
|
|
525
|
+
- Ensure parameter values are properly formatted
|
|
526
|
+
- If task is complete, provide a comprehensive final answer
|
|
527
|
+
|
|
528
|
+
3. AFTER receiving an Observation: Call 'think' again to reflect
|
|
529
|
+
- Analyze the tool result critically
|
|
530
|
+
- Verify if the expected outcome was achieved
|
|
531
|
+
- Adjust your plan if necessary
|
|
532
|
+
- Decide on the next appropriate action
|
|
533
|
+
|
|
534
|
+
This cycle continues: think \u2192 act \u2192 observe \u2192 think \u2192 act \u2192 ... until task completion.
|
|
535
|
+
</workflow>
|
|
536
|
+
|
|
537
|
+
<available_tools>
|
|
538
|
+
You have access to the following tools (detailed schemas are provided separately):
|
|
539
|
+
|
|
540
|
+
${r.map(t=>`- ${t.name}: ${t.description}`).join(`
|
|
541
|
+
`)}
|
|
542
|
+
|
|
543
|
+
The system will provide you with the exact parameter schemas for each tool. When using tools, pay special attention to required parameters and their formats.
|
|
544
|
+
Use the tool definitions to understand what parameters each tool requires.
|
|
545
|
+
</available_tools>
|
|
546
|
+
|
|
547
|
+
<critical_rules>
|
|
548
|
+
1. ALWAYS call 'think' tool FIRST before taking any action
|
|
549
|
+
2. ALWAYS call 'think' tool AFTER receiving an Observation to reflect
|
|
550
|
+
3. The 'think' tool is zero-side-effect - it only makes your reasoning observable
|
|
551
|
+
4. NEVER write "Observation:" yourself - the system provides it
|
|
552
|
+
5. When you decide the task is complete, you can directly respond with your final answer (no tool call needed)
|
|
553
|
+
6. Think deeply and systematically: analyze context, plan actions, reflect on results
|
|
554
|
+
7. If you encounter errors or unexpected results, use 'think' to analyze the problem and determine the best next step
|
|
555
|
+
8. ALWAYS maintain high code quality standards - follow project conventions, add appropriate comments, and write clean code
|
|
556
|
+
</critical_rules>
|
|
557
|
+
|
|
558
|
+
<code_modification_workflow>
|
|
559
|
+
When modifying existing code:
|
|
560
|
+
1. Call think() to plan your approach and identify risks
|
|
561
|
+
2. Call read() to get the CURRENT file content
|
|
562
|
+
3. After Observation, call think() to analyze and prepare the COMPLETE NEW version with all changes
|
|
563
|
+
4. Choose the appropriate tool:
|
|
564
|
+
- Use merge() for comprehensive changes (adds complete new file content with intelligent conflict detection)
|
|
565
|
+
- Use search_replace() for targeted replacements (rename variables, update patterns, batch replace)
|
|
566
|
+
5. If conflicts occur, call think() to decide whether to fix or use write() to overwrite
|
|
567
|
+
|
|
568
|
+
When creating new files:
|
|
569
|
+
1. Call think() to plan the file structure and design
|
|
570
|
+
2. Call write() with BOTH path AND the complete file content
|
|
571
|
+
3. After Observation, call think() to confirm success and verify the file was created correctly
|
|
572
|
+
|
|
573
|
+
When renaming or doing batch replacements:
|
|
574
|
+
1. Call think() to identify all occurrences and plan the replacement strategy
|
|
575
|
+
2. Use search_replace() with appropriate search pattern and replacement text
|
|
576
|
+
- For simple text: provide literal strings
|
|
577
|
+
- For patterns: use regex patterns
|
|
578
|
+
- Can target single file or multiple files with glob patterns
|
|
579
|
+
3. After Observation, call think() to verify the replacements were successful
|
|
580
|
+
|
|
581
|
+
CRITICAL FILE OPERATION RULES:
|
|
582
|
+
- merge() and write() REQUIRE the complete file content, not just changes
|
|
583
|
+
- search_replace() is ideal for renaming identifiers, updating imports, or pattern-based replacements
|
|
584
|
+
- Read the file first, prepare the full new version, then call merge() or write()
|
|
585
|
+
- NEVER skip the thinking steps - they make your reasoning observable and debuggable
|
|
586
|
+
- NEVER modify files without first reading their current content
|
|
587
|
+
|
|
588
|
+
FILE PATH SAFETY CONSTRAINTS:
|
|
589
|
+
- ONLY write files within the current working directory (project root)
|
|
590
|
+
- NEVER write to system directories (/, /usr, /etc, /System, C:Windows, etc.)
|
|
591
|
+
- NEVER write to parent directories using ../ paths
|
|
592
|
+
- NEVER write to absolute paths outside the project (e.g., /tmp, /var, C:Users...)
|
|
593
|
+
- Use relative paths from project root (e.g., "src/utils/helper.js", "config/app.json")
|
|
594
|
+
- If user requests writing outside project directory, politely refuse and explain the security constraint
|
|
595
|
+
- Valid paths: "src/...", "lib/...", "config/...", "tests/...", "docs/...", etc.
|
|
596
|
+
- Invalid paths: "/etc/...", "../../../...", "C:Windows...", "/usr/local/..."
|
|
597
|
+
</code_modification_workflow>
|
|
598
|
+
|
|
599
|
+
<language_constraints>
|
|
600
|
+
- ALWAYS analyze the project's primary programming language and file context before generating code
|
|
601
|
+
- Check .nium/project/project.json for language documentation
|
|
602
|
+
- Apply LAYERED language constraints based on file purpose and location:
|
|
603
|
+
* BUSINESS CODE (src/, lib/, app/): STRICTLY use project's primary programming language
|
|
604
|
+
* TOOL CONFIG (config/, .nium/, build scripts): Allow tool-appropriate languages (TypeScript, JSON, YAML, Shell)
|
|
605
|
+
* DOCUMENTATION (docs/, README, .md files): Allow documentation languages (Markdown, HTML, text)
|
|
606
|
+
* TEST FILES (test/, tests/, spec/, __tests__/): Allow test-specific languages and frameworks
|
|
607
|
+
* BUILD/DEPLOY (Dockerfile, docker-compose.yml, CI/CD configs): Allow infrastructure languages
|
|
608
|
+
- For multi-language projects, follow the specific context of the file layer you're modifying
|
|
609
|
+
- When unsure, use glob() to explore file extensions and project structure first
|
|
610
|
+
- Maintain consistent code style within each language layer
|
|
611
|
+
</language_constraints>
|
|
612
|
+
|
|
613
|
+
<specialized_task_routing>
|
|
614
|
+
For coding tasks that involve:
|
|
615
|
+
- Implementing new features or functions
|
|
616
|
+
- Creating new files with code
|
|
617
|
+
- Modifying existing code files
|
|
618
|
+
- Adding methods, classes, or modules
|
|
619
|
+
- Refactoring code
|
|
620
|
+
- Writing APIs or interfaces
|
|
621
|
+
|
|
622
|
+
Consider using the 'plan' tool to leverage specialized sub-agents (especially 'coder' agent) that are optimized for code development tasks. The coder agent is a specialized expert that:
|
|
623
|
+
- Understands multi-language projects (JavaScript, TypeScript, Java, Python, Go, Rust, C#, Ruby, PHP, etc.)
|
|
624
|
+
- Automatically detects project language and follows conventions
|
|
625
|
+
- Performs comprehensive dependency checking
|
|
626
|
+
- Maintains code quality and consistency with existing codebase
|
|
627
|
+
- Follows language-specific best practices and naming conventions
|
|
628
|
+
|
|
629
|
+
Example routing:
|
|
630
|
+
- User: "\u5B9E\u73B0\u7528\u6237\u767B\u5F55\u529F\u80FD" \u2192 Call plan() to route to coder agent
|
|
631
|
+
- User: "\u6DFB\u52A0\u4E00\u4E2A\u5DE5\u5177\u51FD\u6570\u8BA1\u7B97\u65E5\u671F\u5DEE" \u2192 Call plan() to route to coder agent
|
|
632
|
+
- User: "\u91CD\u6784\u8FD9\u4E2A\u6A21\u5757\u63D0\u9AD8\u6027\u80FD" \u2192 Call plan() to route to coder agent
|
|
633
|
+
|
|
634
|
+
For simple tasks that don't involve code generation (reading files, exploring structure, running commands), you can handle them directly.
|
|
635
|
+
</specialized_task_routing>
|
|
636
|
+
|
|
637
|
+
<project_exploration_guidelines>
|
|
638
|
+
IMPORTANT: Avoid redundant project exploration in plan mode
|
|
639
|
+
|
|
640
|
+
When working within a plan/task context:
|
|
641
|
+
1. **Check for existing documentation FIRST**:
|
|
642
|
+
- ALWAYS try to read '.nium/project/project.json' before exploring
|
|
643
|
+
- This document is automatically generated at the start of plan tasks
|
|
644
|
+
- It contains comprehensive project structure, language info, and conventions
|
|
645
|
+
|
|
646
|
+
2. **When to use explore tools (quickProjectScan)**:
|
|
647
|
+
- \u2705 When explicitly asked by the user to "explore" or "scan" the project
|
|
648
|
+
- \u2705 When project.json does not exist or is empty
|
|
649
|
+
- \u274C NEVER call explore tools in plan mode if project.json already exists
|
|
650
|
+
- \u274C NEVER call explore tools multiple times within the same task
|
|
651
|
+
|
|
652
|
+
3. **Best practice workflow**:
|
|
653
|
+
- Step 1: Call read('.nium/project/project.json')
|
|
654
|
+
- Step 2: If file exists and has content \u2192 Use it directly
|
|
655
|
+
- Step 3: If file doesn't exist \u2192 The master agent has already handled this, so just read again or ask user
|
|
656
|
+
|
|
657
|
+
4. **Rationale**:
|
|
658
|
+
- Explore operations are expensive (time, tokens, I/O)
|
|
659
|
+
- In plan mode, project structure is scanned once at the beginning
|
|
660
|
+
- Repeated exploration wastes resources and produces identical results
|
|
661
|
+
- All necessary project info is already in project.json
|
|
662
|
+
|
|
663
|
+
Example:
|
|
664
|
+
\u274C Bad: Call quickProjectScan() in every step of a plan task
|
|
665
|
+
\u2705 Good: Call read('.nium/project/project.json') to get project info
|
|
666
|
+
</project_exploration_guidelines>
|
|
667
|
+
|
|
668
|
+
<project_type_detection>
|
|
669
|
+
IMPORTANT: Identify project build system before making assumptions
|
|
670
|
+
|
|
671
|
+
When working with dependency management or build configurations:
|
|
672
|
+
1. **NEVER assume the build tool** - Always detect first:
|
|
673
|
+
- Java projects: Check for pom.xml (Maven) OR build.gradle/settings.gradle (Gradle)
|
|
674
|
+
- JavaScript/Node.js: Check for package.json (npm/yarn/pnpm)
|
|
675
|
+
- Python: Check for requirements.txt, setup.py, pyproject.toml, Pipfile
|
|
676
|
+
- Rust: Check for Cargo.toml
|
|
677
|
+
- Go: Check for go.mod
|
|
678
|
+
- .NET: Check for *.csproj, *.sln
|
|
679
|
+
- Ruby: Check for Gemfile
|
|
680
|
+
- PHP: Check for composer.json
|
|
681
|
+
|
|
682
|
+
2. **Quick detection workflow**:
|
|
683
|
+
- Step 1: Use glob() to search for build files: glob(pattern="**/pom.xml") || glob(pattern="**/*.gradle")
|
|
684
|
+
- Step 2: Based on results, determine the build system
|
|
685
|
+
- Step 3: Then read the appropriate configuration file
|
|
686
|
+
|
|
687
|
+
3. **Common patterns to avoid**:
|
|
688
|
+
\u274C Bad: Assuming "Spring Boot = Maven" \u2192 directly reading pom.xml
|
|
689
|
+
\u2705 Good: First check glob("**/pom.xml") and glob("**/*.gradle"), then read the found file
|
|
690
|
+
|
|
691
|
+
\u274C Bad: Reading package.json without checking if it exists
|
|
692
|
+
\u2705 Good: Call glob("package.json") first, handle the case if it doesn't exist
|
|
693
|
+
|
|
694
|
+
4. **Examples**:
|
|
695
|
+
Example 1 - Java project dependency check:
|
|
696
|
+
Call glob(pattern="**/pom.xml")
|
|
697
|
+
\u2192 If found: This is a Maven project, read pom.xml
|
|
698
|
+
\u2192 If not found: Call glob(pattern="**/*.gradle")
|
|
699
|
+
\u2192 If found: This is a Gradle project, read build.gradle
|
|
700
|
+
\u2192 If not found: Unknown build system, ask user or explore further
|
|
701
|
+
|
|
702
|
+
Example 2 - Adding a dependency:
|
|
703
|
+
\u274C Bad approach: Directly try to read pom.xml
|
|
704
|
+
\u2705 Good approach:
|
|
705
|
+
1. Call glob to detect build file
|
|
706
|
+
2. Call think to plan based on detected build system
|
|
707
|
+
3. Read the appropriate file
|
|
708
|
+
4. Add dependency using correct syntax for that build system
|
|
709
|
+
</project_type_detection>
|
|
710
|
+
|
|
711
|
+
<best_practices>
|
|
712
|
+
- Write modular, reusable code where appropriate
|
|
713
|
+
- Add clear comments explaining complex logic or non-obvious implementation details
|
|
714
|
+
- Handle edge cases and potential errors gracefully
|
|
715
|
+
- Follow language-specific coding standards and conventions
|
|
716
|
+
- When modifying existing code, preserve the original author's intent while making improvements
|
|
717
|
+
- Test your solutions conceptually before implementation
|
|
718
|
+
</best_practices>
|
|
719
|
+
|
|
720
|
+
<examples>
|
|
721
|
+
<example>
|
|
722
|
+
<scenario>User asks: Create a config.json file</scenario>
|
|
723
|
+
<correct_response>
|
|
724
|
+
Step 1 - Think first:
|
|
725
|
+
Call think: "The user wants a config.json file. I should create a new file with write() since it doesn't exist yet. Let me prepare a default JSON structure with common configuration options that would be useful."
|
|
726
|
+
|
|
727
|
+
Step 2 - Execute action:
|
|
728
|
+
Call write to create the file with path and content
|
|
729
|
+
|
|
730
|
+
[System provides: Observation: done]
|
|
731
|
+
|
|
732
|
+
Step 3 - Think again to reflect:
|
|
733
|
+
Call think: "Write operation successful. The config.json file has been created with default settings. Task is complete."
|
|
734
|
+
|
|
735
|
+
Step 4 - Provide final answer:
|
|
736
|
+
"Created config.json with default configuration that includes common settings."
|
|
737
|
+
</correct_response>
|
|
738
|
+
</example>
|
|
739
|
+
|
|
740
|
+
<example>
|
|
741
|
+
<scenario>User asks: Add a new function to utils.js</scenario>
|
|
742
|
+
<correct_response>
|
|
743
|
+
Step 1 - Think:
|
|
744
|
+
Call think: "Need to add a function to utils.js. First I should read the existing file to understand its structure, coding style, and existing functions to ensure consistency."
|
|
745
|
+
|
|
746
|
+
Step 2 - Read file:
|
|
747
|
+
Call read to get the current file content
|
|
748
|
+
|
|
749
|
+
[System provides: Observation: <file content>]
|
|
750
|
+
|
|
751
|
+
Step 3 - Think about the content:
|
|
752
|
+
Call think: "I can see the current structure. The file has 3 existing utility functions with JSDoc comments and follows a specific naming convention. I'll add the new function at the end, following the same style pattern, and use merge() to safely integrate it."
|
|
753
|
+
|
|
754
|
+
Step 4 - Merge changes:
|
|
755
|
+
Call merge with the complete new version of the file
|
|
756
|
+
|
|
757
|
+
[System provides: Observation: merge successful]
|
|
758
|
+
|
|
759
|
+
Step 5 - Think about result:
|
|
760
|
+
Call think: "Merge completed successfully without conflicts. The new function is now integrated into utils.js following the project's coding style."
|
|
761
|
+
|
|
762
|
+
Step 6 - Final answer:
|
|
763
|
+
"Successfully added the new function to utils.js using safe merge, maintaining consistency with existing code style."
|
|
764
|
+
</correct_response>
|
|
765
|
+
</example>
|
|
766
|
+
</examples>
|
|
767
|
+
|
|
768
|
+
<final_note>
|
|
769
|
+
The key difference from traditional tool calling:
|
|
770
|
+
- OLD: You called tools directly and reasoned implicitly
|
|
771
|
+
- NEW: You call think() to make reasoning explicit, THEN call tools
|
|
772
|
+
|
|
773
|
+
This makes your decision-making process transparent, debuggable, and more reliable. Always prioritize clarity and thoroughness in your thinking process.
|
|
774
|
+
</final_note>
|
|
775
|
+
</instructions>`}function uo(r){return`\u4F60\u662F\u4E00\u4E2A\u4EFB\u52A1\u590D\u6742\u5EA6\u8BC4\u4F30\u4E13\u5BB6\u3002\u8BF7\u8BC4\u4F30\u4EE5\u4E0B\u4EFB\u52A1\u7684\u590D\u6742\u5EA6\u3002
|
|
776
|
+
|
|
777
|
+
\u4EFB\u52A1\u63CF\u8FF0\uFF1A
|
|
778
|
+
${r}
|
|
779
|
+
|
|
780
|
+
\u8BC4\u4F30\u6807\u51C6\uFF1A
|
|
781
|
+
- SIMPLE\uFF08\u7B80\u5355\u4EFB\u52A1\uFF09\uFF1A\u5355\u4E00\u660E\u786E\u7684\u64CD\u4F5C\uFF0C\u6BD4\u5982\u8BFB\u53D6\u6587\u4EF6\u3001\u521B\u5EFA\u7B80\u5355\u6587\u4EF6\u3001\u6267\u884C\u5355\u4E2A\u547D\u4EE4\u7B49\uFF0C\u4E0D\u9700\u8981\u590D\u6742\u601D\u8003\u6216\u89C4\u5212
|
|
782
|
+
- MEDIUM\uFF08\u4E2D\u7B49\u4EFB\u52A1\uFF09\uFF1A\u9700\u89812-3\u4E2A\u6B65\u9AA4\u7684\u64CD\u4F5C\uFF0C\u53EF\u80FD\u6D89\u53CA\u7B80\u5355\u7684\u6587\u4EF6\u4FEE\u6539\u6216\u57FA\u672C\u903B\u8F91
|
|
783
|
+
- COMPLEX\uFF08\u590D\u6742\u4EFB\u52A1\uFF09\uFF1A\u9700\u8981\u591A\u4E2A\u6B65\u9AA4\uFF083\u4E2A\u4EE5\u4E0A\uFF09\u3001\u6D89\u53CA\u591A\u4E2A\u6587\u4EF6\u4FEE\u6539\u3001\u9700\u8981\u8BE6\u7EC6\u89C4\u5212\u6216\u903B\u8F91\u63A8\u7406\u7684\u4EFB\u52A1
|
|
784
|
+
|
|
785
|
+
\u8BF7\u53EA\u56DE\u590D "SIMPLE"\u3001"MEDIUM" \u6216 "COMPLEX"\uFF0C\u4E0D\u8981\u6709\u5176\u4ED6\u5185\u5BB9\u3002`}function go(r,e=[]){let t=e.length>0?e.map(o=>`${o.name}(${o.description})`).join(", "):"default",n=e.length>0?`
|
|
786
|
+
|
|
787
|
+
\u53EF\u7528\u7684\u5B50\u667A\u80FD\u4F53\uFF1A
|
|
788
|
+
${e.map(o=>`- ${o.name}: ${o.description}`).join(`
|
|
789
|
+
`)}`:"";return`\u4F60\u662F\u4E00\u4F4D\u4EFB\u52A1\u89C4\u5212\u4E13\u5BB6\u3002\u8BF7\u4E3A\u4EE5\u4E0B\u7528\u6237\u8BF7\u6C42\u751F\u6210\u4E00\u4E2A\u9AD8\u8D28\u91CF\u7684\u6267\u884C\u8BA1\u5212\u3002
|
|
790
|
+
|
|
791
|
+
\u7528\u6237\u8BF7\u6C42\uFF1A
|
|
792
|
+
${r}
|
|
793
|
+
${n}
|
|
794
|
+
|
|
795
|
+
## \u89C4\u5212\u8981\u6C42
|
|
796
|
+
|
|
797
|
+
1. **\u6B65\u9AA4\u9897\u7C92\u5EA6**: \u6BCF\u4E2A\u6B65\u9AA4\u5E94\u8BE5\u662F\u5927\u9897\u7C92\u5EA6\u7684\u4EFB\u52A1\u62C6\u5206(2-4\u4E2A\u6B65\u9AA4)
|
|
798
|
+
|
|
799
|
+
2. **\u5DE5\u5177\u6743\u9650\u63A7\u5236** (\u91CD\u8981):
|
|
800
|
+
- \u5F53\u6B65\u9AA4\u4F7F\u7528 **default \u901A\u7528\u667A\u80FD\u4F53** \u65F6\uFF0C\u5FC5\u987B\u6307\u5B9A \`allowedTools\` \u5217\u8868
|
|
801
|
+
- \u5F53\u6B65\u9AA4\u4F7F\u7528 **\u81EA\u5B9A\u4E49\u5B50\u667A\u80FD\u4F53** \u65F6\uFF0C\`allowedTools\` \u53EF\u4EE5\u7701\u7565(\u5B50\u667A\u80FD\u4F53\u6709\u5B8C\u6574\u6743\u9650)
|
|
802
|
+
|
|
803
|
+
3. **\u5E38\u89C1\u6B65\u9AA4\u7684\u5DE5\u5177\u914D\u7F6E**:
|
|
804
|
+
|
|
805
|
+
| \u6B65\u9AA4\u6027\u8D28 | allowedTools \u914D\u7F6E | \u793A\u4F8B\u573A\u666F |
|
|
806
|
+
|---------|------------------|---------|
|
|
807
|
+
| \u7EAF\u5206\u6790\u89C4\u5212 | \`["read", "glob", "grep", "quickProjectScan", "think", "askUser"]\` | \u9700\u6C42\u5206\u6790\u3001\u6280\u672F\u9009\u578B\u3001\u65B9\u6848\u8BBE\u8BA1 |
|
|
808
|
+
| \u4EE3\u7801\u63A2\u7D22 | \`["read", "glob", "grep", "quickProjectScan", "shell", "think"]\` | \u5206\u6790\u73B0\u6709\u67B6\u6784\u3001\u67E5\u627E\u6A21\u5757 |
|
|
809
|
+
| \u4EE3\u7801\u5B9E\u73B0 | \`["read", "write", "merge", "delete", "mkdir", "glob", "grep", "shell", "think"]\` | \u521B\u5EFA\u6587\u4EF6\u3001\u5B9E\u73B0\u529F\u80FD |
|
|
810
|
+
| \u6D4B\u8BD5\u9A8C\u8BC1 | \`["read", "shell", "glob", "grep", "think"]\` | \u8FD0\u884C\u6D4B\u8BD5\u3001\u67E5\u770B\u7ED3\u679C |
|
|
811
|
+
|
|
812
|
+
4. **\u5B50\u667A\u80FD\u4F53\u9009\u62E9**:
|
|
813
|
+
\u53EF\u7528\u5B50\u667A\u80FD\u4F53: ${t}
|
|
814
|
+
- explorer: \u4E13\u95E8\u7528\u4E8E\u9879\u76EE\u63A2\u7D22\uFF0C\u9ED8\u8BA4\u6709\u5B8C\u6574\u53EA\u8BFB\u6743\u9650
|
|
815
|
+
- coder: \u4E13\u95E8\u7528\u4E8E\u4EE3\u7801\u5B9E\u73B0\uFF0C\u9ED8\u8BA4\u6709\u5B8C\u6574\u8BFB\u5199\u6743\u9650
|
|
816
|
+
- default: \u901A\u7528\u667A\u80FD\u4F53\uFF0C\u9700\u8981\u660E\u786E\u6307\u5B9A allowedTools
|
|
817
|
+
|
|
818
|
+
## \u793A\u4F8B\u89C4\u5212
|
|
819
|
+
|
|
820
|
+
### \u274C \u9519\u8BEF\u793A\u4F8B
|
|
821
|
+
\`\`\`json
|
|
822
|
+
{
|
|
823
|
+
"steps": [
|
|
824
|
+
{
|
|
825
|
+
"description": "\u5B8C\u6210\u9700\u6C42\u5206\u6790\u4E0E\u6280\u672F\u9009\u578B",
|
|
826
|
+
"subAgent": "default"
|
|
827
|
+
// \u274C \u7F3A\u5C11 allowedTools\uFF0C\u667A\u80FD\u4F53\u53EF\u80FD\u6EE5\u7528\u5199\u5DE5\u5177
|
|
828
|
+
}
|
|
829
|
+
]
|
|
830
|
+
}
|
|
831
|
+
\`\`\`
|
|
832
|
+
|
|
833
|
+
### \u2705 \u6B63\u786E\u793A\u4F8B1: \u4F7F\u7528 default \u667A\u80FD\u4F53 + \u660E\u786E\u5DE5\u5177\u6743\u9650
|
|
834
|
+
\`\`\`json
|
|
835
|
+
{
|
|
836
|
+
"overview": "\u521D\u59CB\u5316\u7528\u6237\u7BA1\u7406\u7CFB\u7EDF",
|
|
837
|
+
"steps": [
|
|
838
|
+
{
|
|
839
|
+
"description": "\u5206\u6790\u5F53\u524D\u9879\u76EE\u6280\u672F\u6808(\u901A\u8FC7\u8BFB\u53D6 project.json)\uFF0C\u8F93\u51FA\u7528\u6237\u7BA1\u7406\u7CFB\u7EDF\u7684\u6280\u672F\u65B9\u6848\u6587\u6863\uFF0C\u5305\u62EC\u6570\u636E\u5E93\u8BBE\u8BA1\u3001API\u63A5\u53E3\u89C4\u8303\u3001\u8BA4\u8BC1\u65B9\u6848",
|
|
840
|
+
"subAgent": "default",
|
|
841
|
+
"allowedTools": ["read", "glob", "grep", "quickProjectScan", "think", "askUser"]
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
"description": "\u57FA\u4E8E\u65B9\u6848\u6587\u6863\uFF0C\u5B9E\u73B0\u7528\u6237\u6A21\u578B\u3001CRUD API\u3001JWT\u8BA4\u8BC1\u4E2D\u95F4\u4EF6\u7B49\u6838\u5FC3\u529F\u80FD",
|
|
845
|
+
"subAgent": "default",
|
|
846
|
+
"allowedTools": ["read", "write", "merge", "mkdir", "glob", "grep", "shell", "think"]
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
"description": "\u8FD0\u884C\u9879\u76EE\u6D4B\u8BD5\u5957\u4EF6\uFF0C\u9A8C\u8BC1\u7528\u6237\u6CE8\u518C\u3001\u767B\u5F55\u3001\u6743\u9650\u9A8C\u8BC1\u529F\u80FD\u662F\u5426\u6B63\u5E38",
|
|
850
|
+
"subAgent": "default",
|
|
851
|
+
"allowedTools": ["read", "shell", "glob", "grep", "think"]
|
|
852
|
+
}
|
|
853
|
+
],
|
|
854
|
+
"expectedResult": "\u5B8C\u6210\u7528\u6237\u7BA1\u7406\u7CFB\u7EDF\u7684\u5B8C\u6574\u5B9E\u73B0\u5E76\u901A\u8FC7\u6D4B\u8BD5"
|
|
855
|
+
}
|
|
856
|
+
\`\`\`
|
|
857
|
+
|
|
858
|
+
### \u2705 \u6B63\u786E\u793A\u4F8B2: \u4F7F\u7528\u81EA\u5B9A\u4E49\u5B50\u667A\u80FD\u4F53(\u65E0\u9700\u6307\u5B9A allowedTools)
|
|
859
|
+
\`\`\`json
|
|
860
|
+
{
|
|
861
|
+
"overview": "\u91CD\u6784\u9879\u76EE\u67B6\u6784",
|
|
862
|
+
"steps": [
|
|
863
|
+
{
|
|
864
|
+
"description": "\u63A2\u7D22\u73B0\u6709\u9879\u76EE\u7ED3\u6784\uFF0C\u5206\u6790\u6A21\u5757\u4F9D\u8D56\u5173\u7CFB\u548C\u4EE3\u7801\u7EC4\u7EC7\u65B9\u5F0F",
|
|
865
|
+
"subAgent": "explorer"
|
|
866
|
+
// \u2705 \u4F7F\u7528 explorer \u5B50\u667A\u80FD\u4F53\uFF0C\u4E0D\u9700\u8981 allowedTools
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
"description": "\u6839\u636E\u5206\u6790\u7ED3\u679C\uFF0C\u91CD\u6784\u4EE3\u7801\u7ED3\u6784\uFF0C\u4F18\u5316\u6A21\u5757\u5212\u5206",
|
|
870
|
+
"subAgent": "coder"
|
|
871
|
+
// \u2705 \u4F7F\u7528 coder \u5B50\u667A\u80FD\u4F53\uFF0C\u4E0D\u9700\u8981 allowedTools
|
|
872
|
+
}
|
|
873
|
+
],
|
|
874
|
+
"expectedResult": "\u5B8C\u6210\u67B6\u6784\u91CD\u6784\u5E76\u4FDD\u6301\u529F\u80FD\u5B8C\u6574\u6027"
|
|
875
|
+
}
|
|
876
|
+
\`\`\`
|
|
877
|
+
|
|
878
|
+
\u8BF7\u4F7F\u7528 create_task_plan \u5DE5\u5177\u8FD4\u56DE\u7ED3\u6784\u5316\u7684\u4EFB\u52A1\u89C4\u5212\u3002`}function po(r,e=[]){let t=e.length>0?`
|
|
879
|
+
\u53EF\u7528\u7684\u5B50\u667A\u80FD\u4F53\uFF1A
|
|
880
|
+
${e.map(n=>`- ${n.name}: ${n.description}`).join(`
|
|
881
|
+
`)}`:"";return`\u4F60\u662F\u4E00\u4E2A\u4EFB\u52A1\u89C4\u5212\u4E13\u5BB6\u3002\u8BF7\u4E3A\u4EE5\u4E0B\u4EFB\u52A1\u751F\u6210\u8BE6\u7EC6\u3001\u7ED3\u6784\u5316\u7684\u6267\u884C\u8BA1\u5212\u3002
|
|
882
|
+
|
|
883
|
+
\u4EFB\u52A1\u63CF\u8FF0\uFF1A
|
|
884
|
+
${r}
|
|
885
|
+
${t}
|
|
886
|
+
|
|
887
|
+
\u8BF7\u6309\u7167\u4EE5\u4E0BMarkdown\u683C\u5F0F\u8F93\u51FA\u4EFB\u52A1\u89C4\u5212\uFF1A
|
|
888
|
+
|
|
889
|
+
# \u4EFB\u52A1\u89C4\u5212
|
|
890
|
+
|
|
891
|
+
## \u4EFB\u52A1\u6982\u8FF0
|
|
892
|
+
[\u7B80\u8981\u63CF\u8FF0\u4EFB\u52A1\u76EE\u6807\uFF0C\u5305\u62EC\u8F93\u5165\u3001\u5904\u7406\u548C\u9884\u671F\u8F93\u51FA]
|
|
893
|
+
|
|
894
|
+
## \u6267\u884C\u6B65\u9AA4
|
|
895
|
+
1. [\u6B65\u9AA41\u63CF\u8FF0 - \u6E05\u6670\u8BF4\u660E\u8981\u5B8C\u6210\u7684\u5DE5\u4F5C\u548C\u76EE\u6807] (\u63A8\u8350\u5B50\u667A\u80FD\u4F53: [\u5B50\u667A\u80FD\u4F53\u540D\u79F0\u6216"default"])
|
|
896
|
+
2. [\u6B65\u9AA42\u63CF\u8FF0 - \u6E05\u6670\u8BF4\u660E\u8981\u5B8C\u6210\u7684\u5DE5\u4F5C\u548C\u76EE\u6807] (\u63A8\u8350\u5B50\u667A\u80FD\u4F53: [\u5B50\u667A\u80FD\u4F53\u540D\u79F0\u6216"default"])
|
|
897
|
+
3. [\u6B65\u9AA43\u63CF\u8FF0 - \u6E05\u6670\u8BF4\u660E\u8981\u5B8C\u6210\u7684\u5DE5\u4F5C\u548C\u76EE\u6807] (\u63A8\u8350\u5B50\u667A\u80FD\u4F53: [\u5B50\u667A\u80FD\u4F53\u540D\u79F0\u6216"default"])
|
|
898
|
+
...
|
|
899
|
+
|
|
900
|
+
## \u9884\u671F\u7ED3\u679C
|
|
901
|
+
[\u8BE6\u7EC6\u63CF\u8FF0\u5B8C\u6210\u540E\u7684\u9884\u671F\u7ED3\u679C\uFF0C\u5305\u62EC\u5177\u4F53\u4EA4\u4ED8\u7269\u3001\u529F\u80FD\u7279\u6027\u6216\u4EE3\u7801\u53D8\u66F4]
|
|
902
|
+
|
|
903
|
+
## \u6CE8\u610F\u4E8B\u9879
|
|
904
|
+
[\u5217\u51FA\u6267\u884C\u8FC7\u7A0B\u4E2D\u9700\u8981\u7279\u522B\u6CE8\u610F\u7684\u4E8B\u9879\u3001\u6F5C\u5728\u98CE\u9669\u6216\u6280\u672F\u8003\u91CF]
|
|
905
|
+
|
|
906
|
+
\u91CD\u8981\u89C4\u5219\uFF1A
|
|
907
|
+
- \u6267\u884C\u6B65\u9AA4\u5E94\u8BE5\u662F\u5927\u9897\u7C92\u5EA6\u7684\u4EFB\u52A1\u62C6\u5206\uFF0C\u5173\u6CE8\u4E3B\u8981\u9636\u6BB5\u548C\u76EE\u6807
|
|
908
|
+
- \u5FC5\u987B\u5305\u542B2-4\u4E2A\u903B\u8F91\u6B65\u9AA4\uFF0C\u786E\u4FDD\u8986\u76D6\u6240\u6709\u5FC5\u8981\u5DE5\u4F5C
|
|
909
|
+
- \u6B65\u9AA4\u4E4B\u95F4\u5FC5\u987B\u6709\u660E\u786E\u7684\u4F9D\u8D56\u5173\u7CFB\u548C\u987A\u5E8F\u903B\u8F91
|
|
910
|
+
- \u6BCF\u4E2A\u6B65\u9AA4\u5FC5\u987B\u6807\u6CE8\u6700\u9002\u5408\u7684\u63A8\u8350\u5B50\u667A\u80FD\u4F53
|
|
911
|
+
- \u4EFB\u52A1\u6982\u8FF0\u5E94\u8BE5\u7B80\u660E\u627C\u8981\u5730\u6982\u62EC\u6574\u4E2A\u4EFB\u52A1\u7684\u76EE\u7684\u548C\u8303\u56F4
|
|
912
|
+
- \u9884\u671F\u7ED3\u679C\u5E94\u8BE5\u5177\u4F53\u3001\u53EF\u8861\u91CF\uFF0C\u660E\u786E\u8BF4\u660E\u5B8C\u6210\u540E\u7684\u72B6\u6001`}function mo(r){return`\u8BF7\u5C06\u4EE5\u4E0B Markdown \u683C\u5F0F\u7684\u4EFB\u52A1\u89C4\u5212\u8F6C\u6362\u4E3A\u7ED3\u6784\u5316\u683C\u5F0F\u3002
|
|
913
|
+
|
|
914
|
+
${r}
|
|
915
|
+
|
|
916
|
+
\u8BF7\u4F7F\u7528 create_task_plan \u5DE5\u5177\u8FD4\u56DE\u7ED3\u6784\u5316\u7684\u4EFB\u52A1\u89C4\u5212\u6570\u636E\u3002`}function fo(r,e){return`\u4F60\u662F\u4E00\u4E2A\u667A\u80FD\u4F53\u5339\u914D\u4E13\u5BB6\u3002\u8BF7\u4ED4\u7EC6\u5206\u6790\u4EE5\u4E0B\u4EFB\u52A1\u63CF\u8FF0\uFF0C\u5E76\u4ECE\u63D0\u4F9B\u7684\u667A\u80FD\u4F53\u5217\u8868\u4E2D\u9009\u62E9\u6700\u5339\u914D\u3001\u6700\u9AD8\u6548\u7684\u4E00\u4E2A\u3002
|
|
917
|
+
|
|
918
|
+
\u4EFB\u52A1\u63CF\u8FF0\uFF1A
|
|
919
|
+
${r}
|
|
920
|
+
|
|
921
|
+
\u53EF\u7528\u667A\u80FD\u4F53\uFF1A
|
|
922
|
+
${e}
|
|
923
|
+
|
|
924
|
+
\u5339\u914D\u6807\u51C6\uFF1A
|
|
925
|
+
1. \u667A\u80FD\u4F53\u7684\u4E13\u4E1A\u9886\u57DF\u4E0E\u4EFB\u52A1\u9700\u6C42\u7684\u5339\u914D\u5EA6
|
|
926
|
+
2. \u667A\u80FD\u4F53\u7684\u80FD\u529B\u8303\u56F4\u662F\u5426\u6DB5\u76D6\u4EFB\u52A1\u6240\u9700\u7684\u6240\u6709\u6280\u80FD
|
|
927
|
+
3. \u667A\u80FD\u4F53\u7684\u4E13\u957F\u662F\u5426\u80FD\u591F\u89E3\u51B3\u4EFB\u52A1\u4E2D\u7684\u6838\u5FC3\u6311\u6218
|
|
928
|
+
4. \u8003\u8651\u4EFB\u52A1\u7684\u590D\u6742\u5EA6\u548C\u667A\u80FD\u4F53\u7684\u5904\u7406\u80FD\u529B
|
|
929
|
+
|
|
930
|
+
\u8BF7\u53EA\u8FD4\u56DE\u6700\u4F73\u5339\u914D\u7684\u667A\u80FD\u4F53\u540D\u79F0\uFF08\u5B8C\u5168\u5339\u914D\u667A\u80FD\u4F53\u540D\u79F0\u5B57\u7B26\u4E32\uFF09\uFF0C\u5982\u679C\u6CA1\u6709\u5408\u9002\u7684\u5339\u914D\u6216\u5339\u914D\u5EA6\u4E0D\u8DB360%\uFF0C\u8BF7\u8FD4\u56DE"default"\u3002`}var yt,Re=w(()=>{St();yt=li()});var ve={};U(ve,{TaskComplexity:()=>Xn,evaluateTaskComplexity:()=>Ac,generatePlanSummary:()=>cn,generateTaskPlan:()=>an,getTaskFilePath:()=>Fc,listTaskPlans:()=>Nc,loadTaskPlan:()=>_c,updateTaskStatus:()=>Le});import O from"chalk";import se from"fs";import ue from"path";async function Ac(r){let e=uo(r);try{return(await ee({model:he(),messages:[{role:"user",content:e}],temperature:.1,max_tokens:10,useCompression:!0})).choices[0].message.content.trim().toUpperCase().includes("COMPLEX")?(console.log(O.yellow("[\u4EFB\u52A1\u8BC4\u4F30] \u68C0\u6D4B\u5230\u590D\u6742\u4EFB\u52A1\uFF0C\u5C06\u8FDB\u884C\u4EFB\u52A1\u89C4\u5212")),Xn.COMPLEX):(console.log(O.blue("[\u4EFB\u52A1\u8BC4\u4F30] \u68C0\u6D4B\u5230\u7B80\u5355\u4EFB\u52A1\uFF0C\u4F7F\u7528\u5355\u6B65\u9AA4\u6A21\u5F0F")),Xn.SIMPLE)}catch(t){return console.log(O.yellow(`[\u4EFB\u52A1\u8BC4\u4F30] \u8BC4\u4F30\u5931\u8D25\uFF0C\u9ED8\u8BA4\u4E3A\u7B80\u5355\u4EFB\u52A1: ${t.message}`)),Xn.SIMPLE}}function ui(r=[]){let e=r.length>0?r.map(t=>t.name).join(", "):"default";return{name:"create_task_plan",description:"\u751F\u6210\u8BE6\u7EC6\u7684\u4EFB\u52A1\u6267\u884C\u89C4\u5212\uFF0C\u5305\u542B\u591A\u4E2A\u6B65\u9AA4\u548C\u63A8\u8350\u7684\u5B50\u667A\u80FD\u4F53",input_schema:{type:"object",properties:{overview:{type:"string",description:"\u4EFB\u52A1\u6982\u8FF0\uFF0C\u7B80\u8981\u63CF\u8FF0\u4EFB\u52A1\u76EE\u6807"},steps:{type:"array",description:"\u6267\u884C\u6B65\u9AA4\u5217\u8868\uFF0C\u5FC5\u987B\u5305\u542B2-4\u4E2A\u6B65\u9AA4",items:{type:"object",properties:{description:{type:"string",description:"\u6B65\u9AA4\u7684\u8BE6\u7EC6\u63CF\u8FF0\uFF0C\u5E94\u8BE5\u662F\u5927\u9897\u7C92\u5EA6\u7684\u4EFB\u52A1\u62C6\u5206"},subAgent:{type:"string",description:`\u63A8\u8350\u4F7F\u7528\u7684\u5B50\u667A\u80FD\u4F53\u540D\u79F0\u3002\u53EF\u7528\u9009\u9879: ${e}\u3002\u5982\u679C\u6CA1\u6709\u5408\u9002\u7684\u5B50\u667A\u80FD\u4F53\uFF0C\u4F7F\u7528"default"`},allowedTools:{type:"array",description:`\u8BE5\u6B65\u9AA4\u5141\u8BB8\u4F7F\u7528\u7684\u5DE5\u5177\u5217\u8868\uFF08\u4EC5\u5F53 subAgent \u4E3A "default" \u65F6\u751F\u6548\uFF09\u3002
|
|
931
|
+
\u5E38\u7528\u5DE5\u5177\u7EC4\u5408\uFF1A
|
|
932
|
+
- \u53EA\u8BFB\u5206\u6790: ["read", "glob", "grep", "quickProjectScan", "think", "askUser"]
|
|
933
|
+
- \u4EE3\u7801\u63A2\u7D22: ["read", "glob", "grep", "quickProjectScan", "shell", "think"]
|
|
934
|
+
- \u4EE3\u7801\u5B9E\u73B0: ["read", "write", "merge", "delete", "mkdir", "glob", "grep", "shell", "think"]
|
|
935
|
+
- \u6D4B\u8BD5\u9A8C\u8BC1: ["read", "shell", "glob", "grep", "think"]
|
|
936
|
+
|
|
937
|
+
\u5982\u679C\u4E3A\u7A7A\u6570\u7EC4\u6216\u4E0D\u6307\u5B9A\uFF0C\u5219\u4F7F\u7528\u6240\u6709\u53EF\u7528\u5DE5\u5177\u3002
|
|
938
|
+
\u5982\u679C\u4F7F\u7528\u81EA\u5B9A\u4E49\u5B50\u667A\u80FD\u4F53(\u975Edefault)\uFF0C\u6B64\u5B57\u6BB5\u4F1A\u88AB\u5FFD\u7565\u3002`,items:{type:"string"}}},required:["description","subAgent"]},minItems:2,maxItems:4},expectedResult:{type:"string",description:"\u9884\u671F\u7ED3\u679C\uFF0C\u63CF\u8FF0\u5B8C\u6210\u540E\u7684\u9884\u671F\u6548\u679C"}},required:["overview","steps","expectedResult"]}}}async function Oc(r,e=[]){console.log(O.blue("[\u4EFB\u52A1\u89C4\u5212] \u5C1D\u8BD5\u65B9\u68481: Function Calling"));let t=go(r,e),n=ui(e),s=(await ee({model:fe(),messages:[{role:"user",content:t}],temperature:.3,max_tokens:2e3,tools:[n],tool_choice:{type:"function",function:{name:"create_task_plan"}}}))?.choices?.[0]?.message?.tool_calls;if(!s||s.length===0)throw new Error("\u6A21\u578B\u6CA1\u6709\u8FD4\u56DE function call");let i=JSON.parse(s[0].function.arguments);if(!i.steps||i.steps.length<2)throw new Error(`\u6B65\u9AA4\u6570\u91CF\u4E0D\u8DB3: ${i.steps?.length||0}`);return i}async function Dc(r,e=[]){console.log(O.yellow("[\u4EFB\u52A1\u89C4\u5212] \u5C1D\u8BD5\u65B9\u68482: Markdown + Function Call \u8F6C\u6362"));let t=po(r,e),o=(await ee({model:fe(),messages:[{role:"user",content:t}],temperature:.3,max_tokens:2e3}))?.choices?.[0]?.message?.content||"";if(!o)throw new Error("\u65E0\u6CD5\u751F\u6210 Markdown \u89C4\u5212");let s=mo(o),i=ui(e),c=(await ee({model:fe(),messages:[{role:"user",content:s}],temperature:.1,max_tokens:1500,tools:[i],tool_choice:{type:"function",function:{name:"create_task_plan"}}}))?.choices?.[0]?.message?.tool_calls;if(!c||c.length===0)throw new Error("\u65E0\u6CD5\u8F6C\u6362 Markdown \u4E3A\u7ED3\u6784\u5316\u6570\u636E");let l=JSON.parse(c[0].function.arguments);return l.markdown=o,l}function Rc(r){return console.log(O.yellow("[\u4EFB\u52A1\u89C4\u5212] \u4F7F\u7528\u9ED8\u8BA4\u964D\u7EA7\u65B9\u6848")),{overview:r,steps:[{description:"\u9700\u6C42\u5206\u6790\u4E0E\u6280\u672F\u65B9\u6848\u8BBE\u8BA1",subAgent:"default"},{description:"\u6838\u5FC3\u529F\u80FD\u5B9E\u73B0",subAgent:"default"},{description:"\u6D4B\u8BD5\u9A8C\u8BC1\u4E0E\u4EE3\u7801\u4F18\u5316",subAgent:"default"}],expectedResult:"\u5B8C\u6210\u4EFB\u52A1\u7684\u6240\u6709\u6B65\u9AA4\uFF0C\u8FBE\u5230\u9884\u671F\u7684\u529F\u80FD\u76EE\u6807"}}function Lc(r){let e=r.steps.map((t,n)=>`- [ ] ${t.description}
|
|
939
|
+
- \u63A8\u8350\u5B50\u667A\u80FD\u4F53: ${t.subAgent}`).join(`
|
|
940
|
+
|
|
941
|
+
`);return`# \u4EFB\u52A1\u89C4\u5212
|
|
942
|
+
|
|
943
|
+
## \u4EFB\u52A1\u6982\u8FF0
|
|
944
|
+
${r.overview}
|
|
945
|
+
|
|
946
|
+
## \u6267\u884C\u6B65\u9AA4
|
|
947
|
+
${e}
|
|
948
|
+
|
|
949
|
+
## \u9884\u671F\u7ED3\u679C
|
|
950
|
+
${r.expectedResult}`}async function an(r,e=[]){if(!r||typeof r!="string")throw new Error("\u65E0\u6548\u7684\u7528\u6237\u8BF7\u6C42");console.log(O.blue("[\u4EFB\u52A1\u89C4\u5212] \u6B63\u5728\u751F\u6210\u4EFB\u52A1\u89C4\u5212..."));let t=null,n="unknown";try{t=await Oc(r,e),n="Function Calling",console.log(O.green("[\u4EFB\u52A1\u89C4\u5212] \u2713 Function Calling \u65B9\u6848\u6210\u529F"))}catch(c){console.log(O.yellow(`[\u4EFB\u52A1\u89C4\u5212] Function Calling \u5931\u8D25: ${c.message}`));try{t=await Dc(r,e),n="Markdown + Conversion",console.log(O.green("[\u4EFB\u52A1\u89C4\u5212] \u2713 Markdown \u8F6C\u6362\u65B9\u6848\u6210\u529F"))}catch(l){console.log(O.yellow(`[\u4EFB\u52A1\u89C4\u5212] Markdown \u8F6C\u6362\u5931\u8D25: ${l.message}`)),t=Rc(r),n="Default Fallback",console.log(O.yellow("[\u4EFB\u52A1\u89C4\u5212] \u26A0 \u4F7F\u7528\u9ED8\u8BA4\u964D\u7EA7\u65B9\u6848"))}}let o=t.markdown||Lc(t),s=t.steps.map((c,l)=>({step:l+1,description:c.description,status:"pending",subAgent:c.subAgent||"default",allowedTools:c.allowedTools||void 0})),i=jn(),a={markdown:o,tasks:s,taskId:i,strategy:n};return await jc(o,i,a),console.log(O.green(`[\u4EFB\u52A1\u89C4\u5212] \u2713 \u4EFB\u52A1\u89C4\u5212\u751F\u6210\u5B8C\u6210 (\u7B56\u7565: ${n})`)),console.log(O.cyan(`[\u4EFB\u52A1\u89C4\u5212] \u5171\u5305\u542B ${s.length} \u4E2A\u4EFB\u52A1\u6B65\u9AA4`)),console.log(O.gray("\u2500".repeat(50))),console.log(o),console.log(O.gray("\u2500".repeat(50))),a}async function jc(r,e,t){let n=ue.join(process.cwd(),".tasks");se.existsSync(n)||se.mkdirSync(n,{recursive:!0});let o=`# \u4EFB\u52A1\u89C4\u5212 (ID: ${e})
|
|
951
|
+
|
|
952
|
+
## \u4EFB\u52A1\u6982\u8FF0
|
|
953
|
+
${r.substring(r.indexOf("## \u4EFB\u52A1\u6982\u8FF0")+7)}
|
|
954
|
+
|
|
955
|
+
## \u66F4\u65B0\u65F6\u95F4
|
|
956
|
+
${new Date().toLocaleString()}`,s=ue.join(n,`${e}.md`);if(se.writeFileSync(s,o,"utf8"),console.log(O.green(`[\u4EFB\u52A1\u6587\u4EF6] \u4EFB\u52A1\u89C4\u5212\u5DF2\u4FDD\u5B58\u5230: ${s}`)),t){let i={taskId:t.taskId,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),status:"pending",currentStep:0,totalSteps:t.tasks.length,strategy:t.strategy,markdown:t.markdown,tasks:t.tasks.map(c=>({step:c.step,description:c.description,status:c.status,subAgent:c.subAgent,startTime:null,endTime:null,duration:null,error:null}))},a=ue.join(n,`${e}.json`);se.writeFileSync(a,JSON.stringify(i,null,2),"utf8"),console.log(O.green(`[\u4EFB\u52A1\u6587\u4EF6] JSON \u6570\u636E\u5DF2\u4FDD\u5B58\u5230: ${a}`))}}async function Le(r,e,t){let n=ue.join(process.cwd(),".tasks"),o=ue.join(n,`${r}.md`);if(!se.existsSync(o))return console.log(O.red(`[\u4EFB\u52A1\u66F4\u65B0] \u4EFB\u52A1\u6587\u4EF6\u4E0D\u5B58\u5728: ${o}`)),!1;try{let i=se.readFileSync(o,"utf8").split(`
|
|
957
|
+
`),a=!1,c=1,l=[];for(let p of i){if(p.trim().includes("## \u6267\u884C\u6B65\u9AA4")||p.trim().includes("##\u6267\u884C\u6B65\u9AA4")){a=!0,l.push(p);continue}if(p.trim().includes("## \u66F4\u65B0\u65F6\u95F4")){l.push("## \u66F4\u65B0\u65F6\u95F4"),l.push(new Date().toLocaleString());continue}if(a&&p.trim().startsWith("##")&&!p.trim().includes("\u66F4\u65B0\u65F6\u95F4")){a=!1,l.push(p);continue}if(a){let u=p.trim().match(/^-\s*\[(.)\]\s*(.+)/);if(u&&c===e){let g=" ";t==="in_progress"&&(g="-"),t==="completed"&&(g="x"),l.push(`- [${g}] ${u[2]}`),c++;continue}u&&c++}l.push(p)}return se.writeFileSync(o,l.join(`
|
|
958
|
+
`),"utf8"),console.log(O.green(`[\u4EFB\u52A1\u66F4\u65B0] \u4EFB\u52A1 ${r} \u6B65\u9AA4 ${e} \u72B6\u6001\u5DF2\u66F4\u65B0\u4E3A ${t}`)),!0}catch(s){return console.log(O.red(`[\u4EFB\u52A1\u66F4\u65B0] \u66F4\u65B0\u4EFB\u52A1\u72B6\u6001\u5931\u8D25: ${s.message}`)),!1}}function Fc(r){let e=ue.join(process.cwd(),".tasks");return ue.join(e,`${r}.md`)}function _c(r){let e=ue.join(process.cwd(),".tasks"),t=ue.join(e,`${r}.json`);if(!se.existsSync(t))return console.log(O.red(`[\u4EFB\u52A1\u52A0\u8F7D] \u4EFB\u52A1\u6587\u4EF6\u4E0D\u5B58\u5728: ${t}`)),null;try{let n=se.readFileSync(t,"utf8"),o=JSON.parse(n);return console.log(O.green(`[\u4EFB\u52A1\u52A0\u8F7D] \u6210\u529F\u52A0\u8F7D\u4EFB\u52A1: ${r}`)),o}catch(n){return console.log(O.red(`[\u4EFB\u52A1\u52A0\u8F7D] \u89E3\u6790\u4EFB\u52A1\u6587\u4EF6\u5931\u8D25: ${n.message}`)),null}}function Nc(){let r=ue.join(process.cwd(),".tasks");return se.existsSync(r)?se.readdirSync(r).filter(n=>n.endsWith(".json")).map(n=>n.replace(".json","")):[]}function cn(r){if(!r||!r.tasks||r.tasks.length===0)return"\u65E0\u6709\u6548\u4EFB\u52A1\u6B65\u9AA4";let e=O.cyan(`
|
|
959
|
+
\u{1F4CB} \u4EFB\u52A1\u89C4\u5212\u6458\u8981:
|
|
960
|
+
`);e+=O.gray("\u2500".repeat(50))+`
|
|
961
|
+
`;for(let t of r.tasks){let n=t.subAgent!=="default"?O.green(`[${t.subAgent}]`):O.gray("[\u9ED8\u8BA4\u667A\u80FD\u4F53]");e+=`${t.step}. ${t.description} ${n}
|
|
962
|
+
`}return e+=O.gray("\u2500".repeat(50)),e}var Xn,ge=w(()=>{te();ye();Fn();Re();Xn={SIMPLE:"simple",COMPLEX:"complex"}});function ln(r,e={format:"markdown"}){let{format:t,maxSections:n=100,detailed:o=!0,customTitle:s}=e;switch(t){case"markdown":return gi(r,o,s);case"text":return Uc(r,o);case"summary":return Wc(r,n);default:return gi(r,o,s)}}function gi(r,e,t){let n=[];return n.push(t||`# \u9879\u76EE\u7ED3\u6784\u4FE1\u606F
|
|
963
|
+
`),Jc(n,r,e),zc(n,r,e),qc(n,r,e),Hc(n,r,e),Gc(n,r,e),Vc(n,r,e),Bc(n,r,e),n.length<=1?"\u6682\u65E0\u8BE6\u7EC6\u9879\u76EE\u7ED3\u6784\u4FE1\u606F\u3002":n.join(`
|
|
964
|
+
`)}function Uc(r,e){let t=[];if(t.push("\u{1F4CA} \u9879\u76EE\u57FA\u7840\u4FE1\u606F\u6458\u8981"),t.push("\u2550".repeat(50)),t.push(""),t.push(`\u{1F4E6} \u9879\u76EE\u540D\u79F0: ${r.projectName||"\u672A\u77E5"}`),t.push(`\u{1F4CC} \u7248\u672C: ${r.version||"\u672A\u77E5"}`),r.description&&t.push(`\u{1F4DD} \u63CF\u8FF0: ${r.description}`),t.push(""),t.push(`\u{1F310} \u4E3B\u8981\u8BED\u8A00: ${r.primaryLanguage||"\u672A\u77E5"}`),r.buildTool&&t.push(`\u{1F527} \u6784\u5EFA\u5DE5\u5177: ${r.buildTool}`),r.packageManager&&t.push(`\u{1F4E6} \u5305\u7BA1\u7406\u5668: ${r.packageManager}`),r.runtime&&t.push(`\u2699\uFE0F \u8FD0\u884C\u65F6: ${r.runtime}`),t.push(""),r.fileStats){t.push("\u{1F4C1} \u6587\u4EF6\u7EDF\u8BA1:");let n=r.fileStats;t.push(` \u603B\u6587\u4EF6\u6570: ${n.totalFiles||0}`),t.push(` \u6E90\u4EE3\u7801\u6587\u4EF6: ${n.sourceFiles||0}`),t.push(` \u914D\u7F6E\u6587\u4EF6: ${n.configFiles||0}`),t.push(` \u6587\u6863\u6587\u4EF6: ${n.docFiles||0}`),t.push(` \u6D4B\u8BD5\u6587\u4EF6: ${n.testFiles||0}`),t.push("")}return r.dependencyCount&&(t.push("\u{1F4DA} \u4F9D\u8D56\u7EDF\u8BA1:"),t.push(` \u751F\u4EA7\u4F9D\u8D56: ${r.dependencyCount.production||0} \u4E2A`),t.push(` \u5F00\u53D1\u4F9D\u8D56: ${r.dependencyCount.development||0} \u4E2A`),t.push("")),r.languages&&r.languages.length>0&&(t.push("\u{1F30D} \u8BED\u8A00\u5206\u5E03:"),r.languages.slice(0,5).forEach(n=>{t.push(` ${n.language}: ${n.count} \u4E2A\u6587\u4EF6 (${n.percentage})`)}),t.push("")),t.join(`
|
|
965
|
+
`)}function Wc(r,e){let t=[],n=0;if((r.projectName||r.version||r.description)&&(r.projectName&&t.push(`**\u9879\u76EE\u540D\u79F0**: ${r.projectName}`),r.version&&t.push(`**\u7248\u672C**: ${r.version}`),r.description&&t.push(`**\u63CF\u8FF0**: ${r.description}`),n++),n>=e||((r.primaryLanguage||r.buildTool)&&(t.push(""),r.primaryLanguage&&t.push(`**\u4E3B\u8981\u8BED\u8A00**: ${r.primaryLanguage}`),r.buildTool&&t.push(`**\u6784\u5EFA\u5DE5\u5177**: ${r.buildTool}`),r.packageManager&&t.push(`**\u5305\u7BA1\u7406\u5668**: ${r.packageManager}`),r.runtime&&t.push(`**\u8FD0\u884C\u65F6**: ${r.runtime}`),n++),n>=e))return t.join(`
|
|
966
|
+
`);if(r.fileStats){t.push("");let o=r.fileStats;o.totalFiles&&t.push(`**\u603B\u6587\u4EF6\u6570**: ${o.totalFiles}`),o.sourceFiles&&t.push(`**\u6E90\u6587\u4EF6**: ${o.sourceFiles}`),o.configFiles&&t.push(`**\u914D\u7F6E\u6587\u4EF6**: ${o.configFiles}`),o.testFiles&&t.push(`**\u6D4B\u8BD5\u6587\u4EF6**: ${o.testFiles}`),n++}return n>=e||(r.languages&&r.languages.length>0&&(t.push(""),t.push("**\u8BED\u8A00\u5206\u5E03**:"),r.languages.slice(0,5).forEach(o=>{t.push(`- ${o.language}: ${o.percentage}%`)}),n++),n>=e)||(r.dependencies&&Object.keys(r.dependencies).length>0&&(t.push(""),t.push("**\u4E3B\u8981\u4F9D\u8D56**:"),Object.entries(r.dependencies).slice(0,5).forEach(([s,i])=>{t.push(`- ${s}: ${i}`)}),n++),n>=e)?t.join(`
|
|
967
|
+
`):(r.codeStandards&&r.codeStandards.length>0&&(t.push(""),t.push("**\u4EE3\u7801\u89C4\u8303**:"),r.codeStandards.slice(0,3).forEach(o=>{t.push(`- ${o}`)})),t.length>0?t.join(`
|
|
968
|
+
`):"\u6682\u65E0\u9879\u76EE\u4FE1\u606F\u3002")}function Jc(r,e,t){!e.projectName&&!e.version&&!e.description||(r.push("## \u9879\u76EE\u57FA\u672C\u4FE1\u606F"),e.projectName&&r.push(`**\u9879\u76EE\u540D\u79F0**: ${e.projectName}`),e.version&&r.push(`**\u7248\u672C**: ${e.version}`),e.description&&r.push(`**\u63CF\u8FF0**: ${e.description}`),r.push(""))}function zc(r,e,t){!e.primaryLanguage&&!e.buildTool&&!e.packageManager&&!e.runtime||(r.push("## \u6280\u672F\u6808\u4FE1\u606F"),e.primaryLanguage&&r.push(`**\u4E3B\u8981\u7F16\u7A0B\u8BED\u8A00**: ${e.primaryLanguage}`),e.buildTool&&r.push(`**\u6784\u5EFA\u5DE5\u5177**: ${e.buildTool}`),e.packageManager&&r.push(`**\u5305\u7BA1\u7406\u5668**: ${e.packageManager}`),e.runtime&&r.push(`**\u8FD0\u884C\u65F6**: ${e.runtime}`),r.push(""))}function qc(r,e,t){if(!e.fileStats)return;let n=e.fileStats;r.push("## \u6587\u4EF6\u7EDF\u8BA1"),n.totalFiles&&r.push(`- **\u603B\u6587\u4EF6\u6570**: ${n.totalFiles}`),n.sourceFiles&&r.push(`- **\u6E90\u6587\u4EF6**: ${n.sourceFiles}`),n.configFiles&&r.push(`- **\u914D\u7F6E\u6587\u4EF6**: ${n.configFiles}`),n.docFiles&&r.push(`- **\u6587\u6863\u6587\u4EF6**: ${n.docFiles}`),n.testFiles&&r.push(`- **\u6D4B\u8BD5\u6587\u4EF6**: ${n.testFiles}`),r.push("")}function Hc(r,e,t){!e.languages||e.languages.length===0||(r.push("## \u7F16\u7A0B\u8BED\u8A00\u5206\u6790"),t?e.languages.forEach(n=>{r.push(`- **${n.language}**: ${n.count} \u4E2A\u6587\u4EF6 (${n.percentage}%)`)}):e.languages.slice(0,5).forEach(n=>{r.push(`- **${n.language}**: ${n.percentage}%`)}),r.push(""))}function Gc(r,e,t){let n=e.dependencies&&Object.keys(e.dependencies).length>0,o=e.devDependencies&&Object.keys(e.devDependencies).length>0;!n&&!o||(r.push("## \u4F9D\u8D56\u5173\u7CFB"),n&&(r.push("### \u751F\u4EA7\u4F9D\u8D56"),(t?Object.entries(e.dependencies):Object.entries(e.dependencies).slice(0,10)).forEach(([i,a])=>{r.push(`- **${i}**: ${a}`)}),!t&&Object.keys(e.dependencies).length>10&&r.push(`
|
|
969
|
+
*...\u8FD8\u6709 ${Object.keys(e.dependencies).length-10} \u4E2A\u4F9D\u8D56*`),r.push("")),o&&(r.push("### \u5F00\u53D1\u4F9D\u8D56"),(t?Object.entries(e.devDependencies):Object.entries(e.devDependencies).slice(0,10)).forEach(([i,a])=>{r.push(`- **${i}**: ${a}`)}),!t&&Object.keys(e.devDependencies).length>10&&r.push(`
|
|
970
|
+
*...\u8FD8\u6709 ${Object.keys(e.devDependencies).length-10} \u4E2A\u4F9D\u8D56*`),r.push("")))}function Vc(r,e,t){if(!e.entryPoints||e.entryPoints.length===0)return;r.push("## \u5165\u53E3\u6587\u4EF6"),(t?e.entryPoints:e.entryPoints.slice(0,5)).forEach(o=>{r.push(`- \`${o}\``)}),!t&&e.entryPoints.length>5&&r.push(`
|
|
971
|
+
*...\u8FD8\u6709 ${e.entryPoints.length-5} \u4E2A\u5165\u53E3\u6587\u4EF6*`),r.push("")}function Bc(r,e,t){if(!e.codeStandards||e.codeStandards.length===0)return;r.push("## \u4EE3\u7801\u89C4\u8303"),(t?e.codeStandards:e.codeStandards.slice(0,5)).forEach(o=>{r.push(`- ${o}`)}),!t&&e.codeStandards.length>5&&r.push(`
|
|
972
|
+
*...\u8FD8\u6709 ${e.codeStandards.length-5} \u4E2A\u89C4\u8303*`),r.push("")}var Qn=w(()=>{});var xe,Te,be,ke,pi=w(()=>{H();Qn();xe=class{originalTask;plan;stepSummaries;sharedState;stepDependencies;constructor(){this.originalTask=null,this.plan={tasks:[],currentStep:0,totalSteps:0},this.stepSummaries=new Map,this.sharedState={projectInfo:null,rules:null,dependencies:null,recentFiles:[],knownIssues:[]},this.stepDependencies=new Map}initializeTask(e,t){this.originalTask=e,this.plan={tasks:t.tasks||[],currentStep:0,totalSteps:t.tasks?.length||0},M(`\u5168\u5C40\u4E0A\u4E0B\u6587\u521D\u59CB\u5316: ${this.plan.totalSteps} \u4E2A\u6B65\u9AA4`)}recordStepCompletion(e,t,n={}){this.stepSummaries.set(e,{summary:t,metadata:n,timestamp:new Date().toISOString()}),m(`\u6B65\u9AA4 ${e} \u6458\u8981\u5DF2\u8BB0\u5F55: ${t.substring(0,50)}...`)}getStepSummary(e){return this.stepSummaries.get(e)}updateSharedState(e,t){this.sharedState.hasOwnProperty(e)?(this.sharedState[e]=t,m(`\u5171\u4EAB\u72B6\u6001\u66F4\u65B0: ${e}`)):m(`\u8B66\u544A: \u672A\u77E5\u7684\u5171\u4EAB\u72B6\u6001\u952E: ${e}`)}addRecentFile(e){this.sharedState.recentFiles.unshift(e),this.sharedState.recentFiles.length>10&&this.sharedState.recentFiles.pop()}setStepDependencies(e,t){this.stepDependencies.set(e,t)}getCompactSummary(){return{task:this.originalTask,progress:`${this.plan.currentStep}/${this.plan.totalSteps}`,completedSteps:Array.from(this.stepSummaries.keys()),recentFiles:this.sharedState.recentFiles.slice(0,5)}}getPlan(){return this.plan}setCurrentStep(e){this.plan.currentStep=e}getSharedState(){return this.sharedState}getStepDependencies(){return this.stepDependencies}getOriginalTask(){return this.originalTask}},Te=class{globalContext;constructor(e){this.globalContext=e}async selectRelevantHistory(e,t){let n=[],o=this.globalContext.getStepDependencies().get(e)||[];for(let i of o){let a=this.globalContext.getStepSummary(i);a&&n.push({stepId:i,type:"dependency",content:a.summary,metadata:a.metadata})}let s=this.getRecentCompletedSteps(3);for(let i of s)if(!o.includes(i)){let a=this.globalContext.getStepSummary(i);a&&this.isLikelyRelevant(a.summary,t)&&n.push({stepId:i,type:"recent",content:a.summary,metadata:a.metadata})}return m(`\u4E3A\u6B65\u9AA4 ${e} \u9009\u62E9\u4E86 ${n.length} \u6761\u76F8\u5173\u5386\u53F2`),n}getRecentCompletedSteps(e){return Array.from(this.globalContext.getStepDependencies().keys()).slice(-e)}isLikelyRelevant(e,t){let n=a=>a.toLowerCase().split(/\s+/).filter(c=>c.length>3).slice(0,10),o=new Set(n(e));return n(t).filter(a=>o.has(a)).length>=2}async selectRelevantHistoryWithLLM(e,t){let{MODEL:n}=await Promise.resolve().then(()=>(te(),Ze)),{callModelAPI:o}=await Promise.resolve().then(()=>(ye(),un)),s=Array.from(this.globalContext.getStepDependencies().entries()).map(([a,c])=>{let l=this.globalContext.getStepSummary(a);return l?`\u6B65\u9AA4${a}: ${l.summary}`:""}).filter(Boolean).join(`
|
|
973
|
+
`);if(!s)return[];let i=`\u4EFB\u52A1: ${this.globalContext.getOriginalTask()||""}
|
|
974
|
+
|
|
975
|
+
\u5DF2\u5B8C\u6210\u7684\u5386\u53F2\u6B65\u9AA4\u6458\u8981:
|
|
976
|
+
${s}
|
|
977
|
+
|
|
978
|
+
\u5F53\u524D\u6B65\u9AA4: ${t}
|
|
979
|
+
|
|
980
|
+
\u95EE\u9898: \u5F53\u524D\u6B65\u9AA4\u9700\u8981\u54EA\u4E9B\u5386\u53F2\u6B65\u9AA4\u7684\u4FE1\u606F\uFF1F\u8BF7\u5206\u6790\u4F9D\u8D56\u5173\u7CFB\u3002
|
|
981
|
+
\u8F93\u51FA\u683C\u5F0F: \u8FD4\u56DEJSON\u6570\u7EC4\uFF0C\u5305\u542B\u76F8\u5173\u6B65\u9AA4ID\uFF0C\u4F8B\u5982 [1, 3]\u3002\u5982\u679C\u4E0D\u9700\u8981\u5386\u53F2\u4FE1\u606F\uFF0C\u8FD4\u56DE []\u3002
|
|
982
|
+
\u53EA\u8FD4\u56DEJSON\uFF0C\u4E0D\u8981\u5176\u4ED6\u89E3\u91CA\u3002`;try{let c=(await o({model:n(),messages:[{role:"user",content:i}],temperature:.1,max_tokens:100})).choices[0].message.content?.trim()||"[]",p=JSON.parse(c).map(u=>{let g=this.globalContext.getStepSummary(u);return g?{stepId:u,type:"llm_selected",content:g.summary,metadata:g.metadata}:null}).filter(u=>u!==null);return M(`LLM \u4E3A\u6B65\u9AA4 ${e} \u9009\u62E9\u4E86 ${p.length} \u6761\u76F8\u5173\u5386\u53F2`),p}catch(a){return m(`LLM \u9009\u62E9\u5386\u53F2\u5931\u8D25\uFF0C\u964D\u7EA7\u5230\u542F\u53D1\u5F0F\u65B9\u6CD5: ${a instanceof Error?a.message:String(a)}`),this.selectRelevantHistory(e,t)}}},be=class{globalContext;disclosure;constructor(e,t){this.globalContext=e,this.disclosure=t}async buildIsolatedContext(e,t,n="",o=!1,s){let i=[];n&&i.push({role:"system",content:n});let a=await this.buildProjectEnvironmentContext();a&&i.push({role:"system",content:`## \u9879\u76EE\u73AF\u5883\u4FE1\u606F
|
|
983
|
+
|
|
984
|
+
${a}`}),i.push({role:"user",content:`\u539F\u59CB\u4EFB\u52A1: ${this.globalContext.getOriginalTask()||""}`}),this.globalContext.getSharedState().rules&&i.push({role:"system",content:`\u9879\u76EE\u89C4\u5219:
|
|
985
|
+
${this.globalContext.getSharedState().rules}`});let c;if(o?c=await this.disclosure.selectRelevantHistoryWithLLM(e,t):c=await this.disclosure.selectRelevantHistory(e,t),c.length>0){let l=c.map(p=>`[\u6B65\u9AA4${p.stepId}] ${p.content}`).join(`
|
|
986
|
+
|
|
987
|
+
`);i.push({role:"user",content:`\u76F8\u5173\u5386\u53F2\u4FE1\u606F:
|
|
988
|
+
${l}`})}return i.push({role:"user",content:`\u5F53\u524D\u4EFB\u52A1 (\u6B65\u9AA4 ${e}/${this.globalContext.getPlan().totalSteps}):
|
|
989
|
+
${t}`}),s&&s.length>0&&i.push({role:"system",content:`\u26A0\uFE0F \u672C\u6B65\u9AA4\u5DE5\u5177\u4F7F\u7528\u9650\u5236:
|
|
990
|
+
\u4F60\u53EA\u80FD\u4F7F\u7528\u4EE5\u4E0B\u5DE5\u5177: ${s.join(", ")}
|
|
991
|
+
|
|
992
|
+
\u5982\u679C\u4F60\u5C1D\u8BD5\u4F7F\u7528\u672A\u6388\u6743\u7684\u5DE5\u5177\uFF0C\u8C03\u7528\u4F1A\u88AB\u62D2\u7EDD\u3002
|
|
993
|
+
\u8BF7\u4E25\u683C\u9075\u5B88\u5DE5\u5177\u4F7F\u7528\u8303\u56F4\uFF0C\u4E13\u6CE8\u4E8E\u5F53\u524D\u6B65\u9AA4\u7684\u76EE\u6807\u3002`}),this.globalContext.getSharedState().recentFiles.length>0&&i.push({role:"system",content:`\u6700\u8FD1\u8BBF\u95EE\u7684\u6587\u4EF6: ${this.globalContext.getSharedState().recentFiles.slice(0,5).join(", ")}`}),t.match(/实现|创建|编写|设计|开发|生成/)&&i.push({role:"system",content:`\u26A0\uFE0F CRITICAL REMINDER FOR CODE TASKS:
|
|
994
|
+
- You MUST use Action: write(path, content) to save any code you generate
|
|
995
|
+
- You MUST use Action: merge(path, content) to modify existing files
|
|
996
|
+
- NEVER just output code without saving it using Action:
|
|
997
|
+
- Follow the exact format: "Thought: ..." then "Action: tool_name(args)"
|
|
998
|
+
- When task is done, use "Answer: ..." to finish`}),M(`\u4E3A\u6B65\u9AA4 ${e} \u6784\u5EFA\u4E86\u9694\u79BB\u4E0A\u4E0B\u6587\uFF0C\u5305\u542B ${i.length} \u6761\u6D88\u606F`),s&&M(`\u5DE5\u5177\u9650\u5236: ${s.join(", ")}`),m(`\u4E0A\u4E0B\u6587\u8BE6\u60C5: \u5386\u53F2 ${c.length} \u6761, \u6587\u4EF6 ${this.globalContext.getSharedState().recentFiles.length} \u4E2A`),i}buildSimpleContext(e,t=""){let n=[];return t&&n.push({role:"system",content:t}),n.push({role:"user",content:e}),M("\u6784\u5EFA\u4E86\u7B80\u5316\u4E0A\u4E0B\u6587\uFF08\u7B80\u5355\u4EFB\u52A1\u6A21\u5F0F\uFF09"),n}async buildProjectEnvironmentContext(){try{let e=await import("fs"),n=(await import("path")).join(process.cwd(),".nium/project/project.json");if(!e.existsSync(n))return null;let o=e.readFileSync(n,"utf-8");try{let s=JSON.parse(o),i=this.extractProjectSummaryFromJSON(s);return`**\u5F53\u524D\u5DE5\u4F5C\u76EE\u5F55:** ${process.cwd()}
|
|
999
|
+
|
|
1000
|
+
**\u9879\u76EE\u7ED3\u6784\u6458\u8981:**
|
|
1001
|
+
${i}
|
|
1002
|
+
|
|
1003
|
+
**\u5B8C\u6574\u7ED3\u6784\u6587\u6863:** \u5982\u9700\u8BE6\u7EC6\u4FE1\u606F\uFF0C\u8BF7\u4F7F\u7528 read('.nium/project/project.json')`}catch(s){m(`\u89E3\u6790project.json\u5931\u8D25\uFF0C\u4F7F\u7528\u6587\u672C\u6458\u8981: ${s}`);let i=this.extractProjectSummary(o);return`**\u5F53\u524D\u5DE5\u4F5C\u76EE\u5F55:** ${process.cwd()}
|
|
1004
|
+
|
|
1005
|
+
**\u9879\u76EE\u7ED3\u6784\u6458\u8981:**
|
|
1006
|
+
${i}
|
|
1007
|
+
|
|
1008
|
+
**\u5B8C\u6574\u7ED3\u6784\u6587\u6863:** \u5982\u9700\u8BE6\u7EC6\u4FE1\u606F\uFF0C\u8BF7\u4F7F\u7528 read('.nium/project/project.json')`}}catch(e){return m(`\u6784\u5EFA\u9879\u76EE\u73AF\u5883\u4E0A\u4E0B\u6587\u5931\u8D25: ${e}`),null}}extractProjectSummaryFromJSON(e){return ln(e,{format:"summary",maxSections:3})}extractProjectSummary(e){let t=e.split(`
|
|
1009
|
+
`),n=[],o=!1,s=0;for(let i of t){if(i.includes("## \u9879\u76EE\u6982\u8FF0")){o=!0;continue}if(o){if(i.startsWith("##")&&!i.includes("\u9879\u76EE\u6982\u8FF0"))break;if(i.trim()&&(n.push(i),s++,s>=15))break}}return n.join(`
|
|
1010
|
+
`)}},ke=class{async extractSummary(e){let t=[],n=[],o=null;for(let i of e)if(i.role==="assistant"){if(i.tool_calls&&i.tool_calls.length>0)for(let a of i.tool_calls){let c=a.function.name;c!=="think"&&t.push(c)}if(i.content&&i.content.includes("Answer:")){let a=i.content.match(/Answer:\s*(.+)/s);a&&(o=a[1].trim().substring(0,200))}}else i.role==="tool"&&i.content&&n.push(i.content.substring(0,100));let s="";return o?s=`\u5B8C\u6210: ${o}`:(s=`\u6267\u884C\u4E86 ${t.length} \u4E2A\u5DE5\u5177\u8C03\u7528`,t.length>0&&(s+=` (${t.slice(0,3).join(", ")})`)),m(`\u63D0\u53D6\u6458\u8981: ${s.substring(0,50)}...`),s}async extractSummaryWithLLM(e){let{LITE_MODEL:t}=await Promise.resolve().then(()=>(te(),Ze)),{callModelAPI:n}=await Promise.resolve().then(()=>(ye(),un)),o=e.filter(s=>s.content).map(s=>`${s.role}: ${s.content.substring(0,500)}`).join(`
|
|
1011
|
+
`);if(o.length<100)return this.extractSummary(e);try{let i=(await n({model:t(),messages:[{role:"system",content:"\u4F60\u662F\u4E00\u4E2A\u6458\u8981\u52A9\u624B\u3002\u8BF7\u5C06\u4E0B\u9762\u7684\u4EFB\u52A1\u6267\u884C\u8FC7\u7A0B\u538B\u7F29\u6210\u7B80\u6D01\u7684\u6458\u8981\uFF08\u4E0D\u8D85\u8FC7100\u5B57\uFF09\uFF0C\u4FDD\u7559\u5173\u952E\u64CD\u4F5C\u548C\u7ED3\u679C\u3002"},{role:"user",content:o}],temperature:.1,max_tokens:150,useCompression:!0})).choices[0].message.content?.trim()||"\u6267\u884C\u5B8C\u6210";return M(`LLM \u751F\u6210\u6458\u8981: ${i.substring(0,50)}...`),i}catch(s){return m(`LLM \u6458\u8981\u5931\u8D25\uFF0C\u964D\u7EA7\u5230\u542F\u53D1\u5F0F\u65B9\u6CD5: ${s instanceof Error?s.message:String(s)}`),this.extractSummary(e)}}extractMetadata(e){let t={toolsUsed:[],filesAccessed:[],errors:[],iterations:0};for(let n of e)if(n.role==="assistant"){if(t.iterations++,n.tool_calls&&n.tool_calls.length>0)for(let o of n.tool_calls){let s=o.function.name;if(s!=="think"&&(t.toolsUsed.push(s),["read","write","merge"].includes(s)))try{let i=JSON.parse(o.function.arguments),a=i.path||i.newContent;a&&t.filesAccessed.push(a)}catch{}}}else n.role==="tool"&&n.content&&n.content.includes("Error:")&&t.errors.push(n.content.substring(0,100));return t}}});var gn,yo=w(()=>{gn=class{anchors=[];originalQuestion;modelClient;constructor(e,t){this.originalQuestion=e,this.modelClient=t,this.initializeAnchor()}initializeAnchor(){let e={originalQuestion:this.originalQuestion,keyConstraints:this.extractConstraints(this.originalQuestion),successCriteria:this.extractSuccessCriteria(this.originalQuestion),iterationAdded:0,semanticSignature:this.generateSemanticSignature(this.originalQuestion)};this.anchors.push(e)}extractConstraints(e){let t=[/必须\s*[::]\s*(.+?)(?=\n|$)/g,/需要\s*[::]\s*(.+?)(?=\n|$)/g,/要求\s*[::]\s*(.+?)(?=\n|$)/g,/不能\s*[::]\s*(.+?)(?=\n|$)/g],n=[];return t.forEach(o=>{let s=e.match(o);s&&n.push(...s)}),n.length>0?n:["\u5B8C\u6210\u7528\u6237\u8BF7\u6C42\u7684\u4EFB\u52A1"]}extractSuccessCriteria(e){let t=[/目标\s*[::]\s*(.+?)(?=\n|$)/g,/标准\s*[::]\s*(.+?)(?=\n|$)/g,/结果\s*[::]\s*(.+?)(?=\n|$)/g,/输出\s*[::]\s*(.+?)(?=\n|$)/g],n=[];return t.forEach(o=>{let s=e.match(o);s&&n.push(...s)}),n.length>0?n:["\u63D0\u4F9B\u51C6\u786E\u548C\u6709\u7528\u7684\u7B54\u6848"]}generateSemanticSignature(e){return this.extractKeywords(e).join("|")}extractKeywords(e){let t=e.toLowerCase().replace(/[^\u4e00-\u9fa5a-zA-Z\s]/g," ").split(/\s+/).filter(i=>i.length>2),n=["\u7684","\u4E86","\u5728","\u662F","\u6211","\u6709","\u548C","\u5C31","the","is","at","which","on","to","of","a","an"],o=t.filter(i=>!n.includes(i)),s=new Map;return o.forEach(i=>{s.set(i,(s.get(i)||0)+1)}),Array.from(s.entries()).sort((i,a)=>a[1]-i[1]).slice(0,10).map(([i])=>i)}async calculateSemanticSimilarity(e){let t=this.extractKeywords(e),n=0;for(let o of this.anchors){let s=o.semanticSignature.split("|"),i=t.filter(l=>s.some(p=>p===l||p.includes(l)||l.includes(p))),a=new Set([...t,...s]),c=a.size>0?i.length/a.size:0;n+=c}return n/this.anchors.length}shouldInjectAnchor(e,t,n){if(t<.2)return!0;let o=this.getAnchorFrequency(t);return e%o===0?!0:t>=.2&&t<.6&&n&&n.length>1e3?e%Math.max(1,Math.floor(o/2))===0:!1}getAnchorFrequency(e){return e<.2?3:e<.4?5:e<.6?8:10}generateAnchorPrompt(e,t,n){let o=this.anchors[this.anchors.length-1],s=`\u{1F3AF} \u4E0A\u4E0B\u6587\u951A\u70B9\u63D0\u9192 (\u8FED\u4EE3 ${e}):
|
|
1012
|
+
|
|
1013
|
+
\u26A0\uFE0F \u91CD\u8981: \u8BF7\u4E25\u683C\u9075\u5FAA\u4EE5\u4E0B\u8981\u6C42\uFF0C\u8FD9\u662F\u89E3\u51B3\u7528\u6237\u95EE\u9898\u7684\u6838\u5FC3\u6307\u5BFC\uFF1A
|
|
1014
|
+
|
|
1015
|
+
\u539F\u59CB\u4EFB\u52A1: ${o.originalQuestion}
|
|
1016
|
+
|
|
1017
|
+
\u{1F3AF} \u5173\u952E\u7EA6\u675F (\u5FC5\u987B\u9075\u5B88):
|
|
1018
|
+
${o.keyConstraints.map(i=>` \u2022 ${i}`).join(`
|
|
1019
|
+
`)}
|
|
1020
|
+
|
|
1021
|
+
\u2705 \u6210\u529F\u6807\u51C6 (\u5FC5\u987B\u8FBE\u6210):
|
|
1022
|
+
${o.successCriteria.map(i=>` \u2022 ${i}`).join(`
|
|
1023
|
+
`)}
|
|
1024
|
+
`;return t&&(s+=`
|
|
1025
|
+
\u{1F504} \u5F53\u524D\u504F\u79BB\u63D0\u9192: ${t}`),s+=`
|
|
1026
|
+
|
|
1027
|
+
\u{1F4A1} \u884C\u52A8\u6307\u5BFC:
|
|
1028
|
+
1. \u7ACB\u5373\u68C0\u67E5\u5F53\u524D\u5DE5\u4F5C\u662F\u5426\u4E0E\u539F\u59CB\u95EE\u9898\u76F4\u63A5\u76F8\u5173
|
|
1029
|
+
2. \u91CD\u70B9\u5173\u6CE8\u6838\u5FC3\u7EA6\u675F\u548C\u6210\u529F\u6807\u51C6
|
|
1030
|
+
3. \u6240\u6709\u5DE5\u5177\u8C03\u7528\u90FD\u5E94\u8BE5\u670D\u52A1\u4E8E\u89E3\u51B3\u539F\u59CB\u95EE\u9898
|
|
1031
|
+
4. \u786E\u4FDD\u6BCF\u4E00\u6B65\u90FD\u671D\u7740\u6700\u7EC8\u76EE\u6807\u524D\u8FDB
|
|
1032
|
+
5. \u6700\u7EC8\u7B54\u6848\u5FC5\u987B\u76F4\u63A5\u56DE\u5E94\u539F\u59CB\u95EE\u9898\u7684\u8981\u6C42
|
|
1033
|
+
|
|
1034
|
+
\u26A1 \u5F3A\u5236\u6267\u884C: \u8FD9\u662F\u6700\u9AD8\u4F18\u5148\u7EA7\u6307\u4EE4\uFF0C\u8986\u76D6\u5176\u4ED6\u6240\u6709\u4E00\u822C\u6027\u5EFA\u8BAE\u3002`,s}createAnchorMessage(e,t,n,o,s){let i=this.generateAnchorPrompt(e,o,s),a="medium";t<.3||n==="severe"?a="high":t>.7&&(!n||n==="none")&&(a="low");let c={type:"context_anchor",iteration:e,similarity:t,priority:a,driftLevel:n,timestamp:new Date().toISOString()};return{role:"system",content:i,metadata:c}}addMidwayAnchor(e,t,n){let o={originalQuestion:this.originalQuestion,keyConstraints:this.extractConstraints(t),successCriteria:this.extractSuccessCriteria(t),iterationAdded:e,semanticSignature:this.generateSemanticSignature(t+" "+n)};this.anchors.push(o)}getOriginalQuestion(){return this.originalQuestion}getAnchors(){return this.anchors}}});var pn,So=w(()=>{te();pn=class{modelClient;constructor(e){this.modelClient=e}async analyzeSemanticDrift(e,t,n){let o=`\u5206\u6790\u4EE5\u4E0B\u4E24\u4E2A\u6587\u672C\u7684\u8BED\u4E49\u76F8\u4F3C\u5EA6\u548C\u504F\u79BB\u7A0B\u5EA6\uFF1A
|
|
1035
|
+
|
|
1036
|
+
\u539F\u59CB\u6587\u672C: "${e}"
|
|
1037
|
+
|
|
1038
|
+
\u5F53\u524D\u4E0A\u4E0B\u6587: "${t}"
|
|
1039
|
+
|
|
1040
|
+
\u8BF7\u63D0\u4F9BJSON\u683C\u5F0F\u7684\u5206\u6790\u7ED3\u679C\uFF0C\u5305\u542B\uFF1A
|
|
1041
|
+
1. similarityScore: 0-1\u4E4B\u95F4\u7684\u76F8\u4F3C\u5EA6\u5206\u6570
|
|
1042
|
+
2. driftLevel: \u504F\u79BB\u7A0B\u5EA6 ("none"|"minor"|"moderate"|"severe")
|
|
1043
|
+
3. keyTopics: \u4E24\u4E2A\u6587\u672C\u7684\u5173\u952E\u4E3B\u9898\u5217\u8868
|
|
1044
|
+
4. deviationFactors: \u5BFC\u81F4\u504F\u79BB\u7684\u56E0\u7D20\u5217\u8868
|
|
1045
|
+
|
|
1046
|
+
\u53EA\u8FD4\u56DEJSON\uFF0C\u4E0D\u8981\u5176\u4ED6\u89E3\u91CA\u3002`;try{let i=(await this.modelClient({model:he(),messages:[{role:"user",content:o}],temperature:.1,max_tokens:200})).choices[0].message.content?.trim();if(i)return JSON.parse(i);throw new Error("Empty response from model")}catch{return this.simpleSemanticAnalysis(e,t)}}simpleSemanticAnalysis(e,t){let n=this.extractKeywords(e),o=this.extractKeywords(t),i=n.filter(c=>o.some(l=>l.includes(c)||c.includes(l))).length/Math.max(n.length,o.length),a;return i>.6?a="none":i>.4?a="minor":i>.2?a="moderate":a="severe",{similarityScore:i,driftLevel:a,keyTopics:[...new Set([...n,...o])],deviationFactors:this.identifyDeviationFactors(n,o)}}extractKeywords(e){let t=e.toLowerCase().replace(/[^\u4e00-\u9fa5a-zA-Z\s]/g," ").split(/\s+/).filter(o=>o.length>2),n=["\u7684","\u4E86","\u5728","\u662F","\u6211","\u6709","\u548C","\u5C31","the","is","at","which","on","to","of","a","an"];return[...new Set(t.filter(o=>!n.includes(o)))]}identifyDeviationFactors(e,t){let n=[],o=e.filter(i=>!t.some(a=>a.includes(i)||i.includes(a))),s=t.filter(i=>!e.some(a=>a.includes(i)||i.includes(a)));return o.length>0&&n.push(`\u4E22\u5931\u4E86\u5173\u952E\u4E3B\u9898: ${o.slice(0,3).join(", ")}`),s.length>0&&n.push(`\u5F15\u5165\u4E86\u65B0\u7684\u4E3B\u9898: ${s.slice(0,3).join(", ")}`),n.length===0&&n.push("\u8BED\u4E49\u76F8\u5173\u6027\u8F83\u4F4E"),n}generateCorrectionPrompt(e,t,n){let o=`\u26A0\uFE0F \u504F\u79BB\u68C0\u6D4B\u8B66\u544A
|
|
1047
|
+
|
|
1048
|
+
\u68C0\u6D4B\u5230${t==="severe"?"\u4E25\u91CD":"\u8F7B\u5FAE"}\u504F\u79BB\u539F\u59CB\u95EE\u9898\u3002
|
|
1049
|
+
|
|
1050
|
+
\u539F\u59CB\u95EE\u9898: ${e}
|
|
1051
|
+
|
|
1052
|
+
\u504F\u79BB\u56E0\u7D20:
|
|
1053
|
+
${n.map(s=>`\u2022 ${s}`).join(`
|
|
1054
|
+
`)}
|
|
1055
|
+
|
|
1056
|
+
\u8BF7\u7ACB\u5373\u8C03\u6574\u601D\u8DEF\uFF0C\u91CD\u65B0\u805A\u7126\u4E8E\u539F\u59CB\u95EE\u9898\u7684\u6838\u5FC3\u8981\u6C42\u3002`;return t==="severe"&&(o+=`
|
|
1057
|
+
|
|
1058
|
+
\u{1F3AF} \u91CD\u8981\u63D0\u9192\uFF1A\u8BF7\u91CD\u65B0\u5F00\u59CB\u5206\u6790\u539F\u59CB\u95EE\u9898\uFF0C\u5FFD\u7565\u4E4B\u524D\u7684\u8FB9\u7F18\u63A2\u7D22\u3002`),o}}});var Co=w(()=>{pi();yo();So()});var mi={};U(mi,{GradleBuildParser:()=>mn,JavaDependencyAnalyzer:()=>nr,MavenPomParser:()=>tr,analyzeJavaProject:()=>vo});import{readFileSync as Zn,existsSync as er}from"fs";import{resolve as wo}from"path";import{parseString as Yc}from"xml2js";async function vo(r=process.cwd()){let e=wo(r,"pom.xml"),t=wo(r,"build.gradle"),n=wo(r,"build.gradle.kts"),o=null;try{if(er(e)){let i=Zn(e,"utf-8");o=await new tr(i,e).parse()}else if(er(t)){let i=Zn(t,"utf-8");o=new mn(i,t).parse()}else if(er(n)){let i=Zn(n,"utf-8");o=new mn(i,n).parse()}if(!o)return null;let s={project:o,conflicts:[],outdated:[],unused:[],recommendations:[]};return s.recommendations=nr.generateRecommendations(s),s}catch(s){return console.error("Error analyzing Java project:",s),null}}var tr,mn,nr,xo=w(()=>{tr=class{content;filePath;constructor(e,t){this.content=e,this.filePath=t}async parse(){try{return new Promise((e,t)=>{Yc(this.content,{explicitArray:!1},(n,o)=>{if(n){t(n);return}try{let{project:s}=o;if(!s){e(null);return}let i={name:s.artifactId||s.name||"unknown",version:s.version||"0.0.0",description:s.description||"",groupId:s.groupId||s.parent?.groupId,artifactId:s.artifactId,packaging:s.packaging||"jar",javaVersion:this.extractJavaVersion(s),buildToolVersion:this.extractMavenVersion(),parent:s.parent?{groupId:s.parent.groupId,artifactId:s.parent.artifactId,version:s.parent.version}:void 0,dependencies:this.extractDependencies(s.dependencies?.dependency),dependencyManagement:this.extractDependencies(s.dependencyManagement?.dependencies?.dependency),properties:this.extractProperties(s.properties),modules:s.modules?.module?Array.isArray(s.modules.module)?s.modules.module:[s.modules.module]:void 0,repositories:this.extractRepositories(s.repositories?.repository)};e(i)}catch(s){t(s)}})})}catch(e){return console.error("Error parsing POM XML:",e),null}}extractJavaVersion(e){return e.properties?.["java.version"]||e.properties?.["maven.compiler.source"]||e.properties?.["maven.compiler.target"]||e.build?.plugins?.plugin?.find(n=>n.artifactId==="maven-compiler-plugin")?.configuration?.source}extractMavenVersion(){let e=this.content.match(/modelVersion>([^<]+)</);return e?e[1]:void 0}extractDependencies(e){return e?(Array.isArray(e)?e:[e]).map(n=>({groupId:n.groupId,artifactId:n.artifactId,version:n.version||"unknown",scope:n.scope||"compile",type:n.type||"jar",classifier:n.classifier,optional:n.optional==="true",exclusions:n.exclusions?.exclusion?(Array.isArray(n.exclusions.exclusion)?n.exclusions.exclusion:[n.exclusions.exclusion]).map(o=>({groupId:o.groupId,artifactId:o.artifactId})):void 0})):[]}extractProperties(e){if(!e)return{};let t={};return Object.keys(e).forEach(n=>{n!=="$"&&(t[n]=e[n])}),t}extractRepositories(e){return e?(Array.isArray(e)?e:[e]).map(n=>n.url).filter(Boolean):[]}},mn=class{content;filePath;constructor(e,t){this.content=e,this.filePath=t}parse(){try{let e=this.filePath.endsWith(".kts");return{name:this.extractProjectName(),version:this.extractVersion(),description:this.extractDescription(),groupId:this.extractGroup(),artifactId:this.extractProjectName(),javaVersion:this.extractJavaVersion(),buildToolVersion:this.extractGradleVersion(),dependencies:this.extractDependencies(e),dependencyManagement:[],properties:this.extractProperties(e)}}catch(e){return console.error("Error parsing Gradle build file:",e),null}}extractProjectName(){let e=this.content.match(/rootProject\.name\s*=\s*['"]([^'"]+)['"]/)||this.content.match(/project\(['"]([^'"]+)['"]\)/)||this.content.match(/name\s*=\s*['"]([^'"]+)['"]/);if(e)return e[1];let t=this.filePath.split(/[/\\]/);return t[t.length-2]||"unknown"}extractVersion(){let e=this.content.match(/version\s*=\s*['"]([^'"]+)['"]/);return e?e[1]:"0.0.0"}extractDescription(){let e=this.content.match(/description\s*=\s*['"]([^'"]+)['"]/);return e?e[1]:""}extractGroup(){let e=this.content.match(/group\s*=\s*['"]([^'"]+)['"]/);return e?e[1]:""}extractJavaVersion(){let e=this.content.match(/sourceCompatibility\s*=\s*['"]?([^'"\s]+)['"]?/)||this.content.match(/targetCompatibility\s*=\s*['"]?([^'"\s]+)['"]?/)||this.content.match(/java\.toolchain\.languageVersion\s*=\s*JavaLanguageVersion\.of\((\d+)\)/);return e?e[1]:void 0}extractGradleVersion(){let e=this.filePath.replace(/build\.gradle(\.kts)?$/,"gradle/wrapper/gradle-wrapper.properties");if(er(e))try{let n=Zn(e,"utf-8").match(/distributionUrl=.*gradle-(\d+\.\d+(?:\.\d+)?)-/);if(n)return n[1]}catch{}}extractDependencies(e){let t=[];return[/(implementation|compile|api|compileOnly|runtimeOnly|testImplementation)\s*['"]([^:'"]+):([^:'"]+):([^:'"]+)['"]/g,/(implementation|compile|api|compileOnly|runtimeOnly|testImplementation)\s*['"]([^:'"]+):([^:'"]+)['"]/g,/(implementation|compile|api|compileOnly|runtimeOnly|testImplementation)\s*\(\s*group\s*:\s*['"]([^'"]+)['"],\s*name\s*:\s*['"]([^'"]+)['"],\s*version\s*:\s*['"]([^'"]+)['"]\s*\)/g,/(implementation|compile|api|compileOnly|runtimeOnly|testImplementation)\s*\(\s*group\s*:\s*['"]([^'"]+)['"],\s*name\s*:\s*['"]([^'"]+)['"]\s*\)/g,/(implementation|compile|api|compileOnly|runtimeOnly|testImplementation)\s*\(\s*["']([^"']+):([^"']+):([^"']+)["']\s*\)/g,/(implementation|compile|api|compileOnly|runtimeOnly|testImplementation)\s*\(\s*["']([^"']+):([^"']+)["']\s*\)/g].forEach(o=>{let s;for(;(s=o.exec(this.content))!==null;){let i,a,c,l;if(s.length===5)[,i,a,c,l]=s;else if(s.length===4)[,i,a,c]=s,l="managed";else continue;t.push({groupId:a,artifactId:c,version:l,scope:i.toLowerCase(),type:"jar"})}}),t}extractProperties(e){let t={},n=e?/val\s+(\w+)\s*=\s*['"]([^'"]+)['"]/g:/(\w+)\s*=\s*['"]([^'"]+)['"]/g,o;for(;(o=n.exec(this.content))!==null;)t[o[1]]=o[2];return t}},nr=class{static analyzeConflicts(e){let t=new Map,n=new Map;e.forEach(s=>{s.dependencies.forEach(i=>{let a=`${i.groupId}:${i.artifactId}`;t.has(a)||(t.set(a,new Set),n.set(a,[])),t.get(a).add(i.version),n.get(a).push(`${s.name} (${i.scope})`)})});let o=[];return t.forEach((s,i)=>{if(s.size>1){let[a,c]=i.split(":"),l=Array.from(s);o.push({groupId:a,artifactId:c,versions:l,locations:n.get(i)||[],severity:this.calculateConflictSeverity(l)})}}),o}static calculateConflictSeverity(e){let t=e.map(o=>o.split(".")[0]).filter(o=>/^\d+$/.test(o));return new Set(t).size>1?"high":e.length>2?"medium":"low"}static generateRecommendations(e){let t=[];return e.conflicts.length>0&&t.push(`\u53D1\u73B0 ${e.conflicts.length} \u4E2A\u4F9D\u8D56\u51B2\u7A81\uFF0C\u5EFA\u8BAE\u7EDF\u4E00\u7248\u672C\u7BA1\u7406`),e.outdated.length>0&&t.push(`${e.outdated.length} \u4E2A\u4F9D\u8D56\u5B58\u5728\u66F4\u65B0\u7248\u672C`),e.unused.length>0&&t.push(`${e.unused.length} \u4E2A\u4F9D\u8D56\u53EF\u80FD\u672A\u88AB\u4F7F\u7528\uFF0C\u5EFA\u8BAE\u68C0\u67E5`),e.project.dependencies.some(o=>o.groupId==="org.springframework.boot")&&t.push("\u9879\u76EE\u4F7F\u7528Spring Boot\uFF0C\u5EFA\u8BAE\u4F7F\u7528Spring Dependency Management\u63D2\u4EF6"),t}}});import{readFileSync as Kc,existsSync as di}from"fs";import{resolve as fi,dirname as Xc}from"path";function yi(r=process.cwd()){let e={name:"unknown",version:"0.0.0",description:"",language:"Unknown",configFiles:[]};for(let[t,n]of Object.entries(hi))for(let o of n.files){if(o.includes("*"))continue;let s=fi(r,o);if(di(s))try{let i=Kc(s,"utf-8"),a=n.parser(i,s);if(a)return{...e,...a,language:n.language,buildTool:t,configFiles:[o]}}catch(i){console.warn(`Error parsing ${o}: ${i instanceof Error?i.message:"Unknown error"}`)}}return e}function Qc(r,e){try{let t=JSON.parse(r);return{name:t.name||"unknown",version:t.version||"0.0.0",description:t.description||"",dependencies:t.dependencies||{},devDependencies:t.devDependencies||{},entryPoints:[t.main,...typeof t.bin=="string"?[t.bin]:Object.values(t.bin||{})].filter(Boolean)}}catch{return null}}function Zc(r,e){try{let t=r.match(/name\s*=\s*['"]([^'"]+)['"]/),n=r.match(/version\s*=\s*['"]([^'"]+)['"]/),o=r.match(/description\s*=\s*['"]([^'"]+)['"]/);return{name:t?t[1]:"unknown",version:n?n[1]:"0.0.0",description:o?o[1]:""}}catch{return null}}function el(r,e){try{let t=r.match(/name\s*=\s*"([^"]+)"/),n=r.match(/version\s*=\s*"([^"]+)"/),o=r.match(/description\s*=\s*"([^"]+)"/);return{name:t?t[1]:"unknown",version:n?n[1]:"0.0.0",description:o?o[1]:""}}catch{return null}}function tl(r,e){try{return{name:e.split(/[/\\]/).slice(-2,-1)[0]||"unknown",version:"0.0.0",description:""}}catch{return null}}function nl(r,e){try{let t=r.match(/module\s+([^\s]+)/),n=r.match(/go\s+([^\s]+)/),o={},s=/require\s+([^\s]+)\s+([^\s]+)/g,i;for(;(i=s.exec(r))!==null;)o[i[1]]=i[2];return{name:t&&t[1].split("/").pop()||"unknown",version:n?n[1]:"0.0.0",description:"",dependencies:o}}catch{return null}}function rl(r,e){try{let t=r.match(/name\s*=\s*"([^"]+)"/),n=r.match(/version\s*=\s*"([^"]+)"/),o=r.match(/description\s*=\s*"([^"]+)"/);return{name:t?t[1]:"unknown",version:n?n[1]:"0.0.0",description:o?o[1]:""}}catch{return null}}function ol(r,e){try{return{name:e.split(/[/\\]/).slice(-2,-1)[0]||"unknown",version:"0.0.0",description:""}}catch{return null}}function sl(r,e){try{let t=JSON.parse(r);return{name:t.name||"unknown",version:t.version||"0.0.0",description:t.description||"",dependencies:t.require||{},devDependencies:t["require-dev"]||{}}}catch{return null}}function il(r,e){try{let n=(e.split(/[/\\]/).pop()||"unknown").replace(/\.(cs|vb|fs)proj$/,""),o=r.match(/<Version>(.*?)<\/Version>/),s=r.match(/<Description>(.*?)<\/Description>/);return{name:n,version:o?o[1]:"0.0.0",description:s?s[1]:""}}catch{return null}}function Si(r){let e=r.map(t=>`${t.groupId}:${t.artifactId}`);return e.some(t=>t.includes("spring-boot"))?"Spring Boot":e.some(t=>t.includes("spring"))?"Spring Framework":e.some(t=>t.includes("jakarta")||t.includes("javax"))?"Jakarta EE":e.some(t=>t.includes("hibernate"))?"Hibernate":e.some(t=>t.includes("mybatis"))?"MyBatis":e.some(t=>t.includes("struts"))?"Struts":"Java Standard"}async function al(r,e){try{let t=await vo(Xc(e));if(!t)return null;let n=t.project,o={};n.dependencies.forEach(i=>{o[`${i.groupId}:${i.artifactId}`]=i.version});let s=Si(n.dependencies);return{name:n.name,version:n.version,description:n.description||"",dependencies:o,languageExtensionInfo:{javaDetails:n,framework:s,javaVersion:n.javaVersion,buildToolVersion:n.buildToolVersion||"Maven"},configFiles:["pom.xml"]}}catch(t){return console.error("Error parsing POM XML with enhanced parser:",t),null}}async function cl(r,e){try{let t=await Promise.resolve().then(()=>(xo(),mi)),o=new t.GradleBuildParser(r,e).parse();if(!o)return null;let s={};o.dependencies.forEach(a=>{s[`${a.groupId}:${a.artifactId}`]=a.version});let i=Si(o.dependencies);return{name:o.name,version:o.version,description:o.description||"",dependencies:s,languageExtensionInfo:{javaDetails:o,framework:i,javaVersion:o.javaVersion,buildToolVersion:o.buildToolVersion||"Gradle"},configFiles:[e.split("/").pop()||"build.gradle"]}}catch(t){return console.error("Error parsing Gradle build file with enhanced parser:",t),null}}function Ci(r=process.cwd()){let e=[];for(let[t,n]of Object.entries(hi))for(let o of n.files){if(o.includes("*"))continue;let s=fi(r,o);if(di(s)){e.push(t);break}}return e}var hi,wi=w(()=>{xo();hi={nodejs:{files:["package.json"],language:"JavaScript/TypeScript",parser:Qc},"java-maven":{files:["pom.xml"],language:"Java",parser:al},"java-gradle":{files:["build.gradle","build.gradle.kts"],language:"Java",parser:async(r,e)=>await cl(r,e)},"python-pip":{files:["setup.py","setup.cfg"],language:"Python",parser:Zc},"python-poetry":{files:["pyproject.toml"],language:"Python",parser:el},"python-pipenv":{files:["Pipfile"],language:"Python",parser:tl},go:{files:["go.mod"],language:"Go",parser:nl},rust:{files:["Cargo.toml"],language:"Rust",parser:rl},ruby:{files:["Gemfile"],language:"Ruby",parser:ol},php:{files:["composer.json"],language:"PHP",parser:sl},dotnet:{files:["*.csproj","*.vbproj","*.fsproj"],language:"C#/.NET",parser:il}}});import{writeFileSync as ll,existsSync as ul,mkdirSync as gl}from"fs";import{resolve as vi}from"path";function xi(r,e=process.cwd()){let t=vi(e,".nium","project");ul(t)||gl(t,{recursive:!0});let o=vi(t,"project.json"),s=JSON.stringify(r,null,2);ll(o,s,"utf-8"),console.log(`\u2705 \u9879\u76EE\u4FE1\u606F\u5DF2\u4FDD\u5B58\u81F3: ${o}`)}function Ti(r){let e=r.reduce((t,n)=>t+n.count,0);return r.map(t=>({...t,percentage:e>0?(t.count/e*100).toFixed(1)+"%":"0%"}))}var bi=w(()=>{Qn()});import{createHash as pl}from"crypto";import{readFileSync as ki,writeFileSync as ml,existsSync as dl,statSync as fl}from"fs";import{resolve as hl}from"path";function yl(r){try{let e=ki(r),t=pl("md5");return t.update(e),t.digest("hex")}catch(e){return console.warn(`\u26A0\uFE0F \u65E0\u6CD5\u8BA1\u7B97\u6587\u4EF6 MD5: ${r}`,e),""}}function Sl(r,e=process.cwd()){try{let t=hl(e,r),n=fl(t),o=yl(t);return{path:r,size:n.size,md5:o,updatedAt:n.mtime.toISOString(),description:""}}catch(t){return console.warn(`\u26A0\uFE0F \u65E0\u6CD5\u83B7\u53D6\u6587\u4EF6\u4FE1\u606F: ${r}`,t),null}}function Cl(r){let e=new Map;if(!dl(r))return e;try{let n=ki(r,"utf-8").trim().split(`
|
|
1059
|
+
`);for(let o of n)if(o.trim())try{let s=JSON.parse(o);e.set(s.path,s)}catch(s){console.warn(`\u26A0\uFE0F \u65E0\u6CD5\u89E3\u6790 JSONL \u884C: ${o}`,s)}}catch(t){console.warn(`\u26A0\uFE0F \u8BFB\u53D6 JSONL \u6587\u4EF6\u5931\u8D25: ${r}`,t)}return e}function wl(r,e){try{let t=[],n=Array.from(r.entries()).sort((o,s)=>o[0].localeCompare(s[0]));for(let[,o]of n)t.push(JSON.stringify(o));ml(e,t.join(`
|
|
1060
|
+
`)+`
|
|
1061
|
+
`,"utf-8")}catch(t){throw console.error(`\u274C \u5199\u5165 JSONL \u6587\u4EF6\u5931\u8D25: ${e}`,t),t}}function $i(r,e,t=process.cwd(),n=!0){n&&console.log(` \u{1F4D6} \u6B63\u5728\u8BFB\u53D6\u73B0\u6709\u6587\u4EF6\u4FE1\u606F: ${e}`);let o=Cl(e),s={added:0,updated:0,deleted:0,unchanged:0},i=new Map,a=new Set(r),c=r.length,l=0,p=Date.now();n&&(console.log(` \u{1F4CB} \u8BFB\u53D6\u73B0\u6709\u6587\u4EF6\u4FE1\u606F\u5B8C\u6210\uFF0C\u5DF2\u6709 ${o.size} \u6761\u8BB0\u5F55`),console.log(` \u{1F680} \u5F00\u59CB\u5904\u7406 ${c} \u4E2A\u6587\u4EF6...`));for(let u of r){if(l++,n&&l===1&&console.log(` \u{1F504} \u5904\u7406\u7B2C 1 \u4E2A\u6587\u4EF6: ${u}`),n&&l%50===0){let S=(l/c*100).toFixed(1),x=((Date.now()-p)/1e3).toFixed(1);console.log(` \u{1F4CA} \u5904\u7406\u8FDB\u5EA6: ${l}/${c} (${S}%) - \u5DF2\u7528\u65F6 ${x}s`)}let g=o.get(u),d=Sl(u,t);d&&(g?g.md5!==d.md5?(i.set(u,{...d,description:g.description}),s.updated++):(i.set(u,g),s.unchanged++):(i.set(u,d),s.added++))}if(n){let u=((Date.now()-p)/1e3).toFixed(1);console.log(` \u2705 \u6587\u4EF6\u5904\u7406\u5B8C\u6210: ${c} \u4E2A\u6587\u4EF6, \u603B\u7528\u65F6 ${u}s`)}n&&console.log(" \u{1F50D} \u6B63\u5728\u68C0\u6D4B\u5DF2\u5220\u9664\u7684\u6587\u4EF6...");for(let[u]of o)a.has(u)||s.deleted++;return n&&console.log(` \u{1F4CA} \u68C0\u6D4B\u5230 ${s.deleted} \u4E2A\u5DF2\u5220\u9664\u7684\u6587\u4EF6`),n&&console.log(` \u{1F4BE} \u6B63\u5728\u5199\u5165 ${i.size} \u6761\u6587\u4EF6\u4FE1\u606F\u5230 JSONL...`),wl(i,e),n&&console.log(" \u2705 JSONL \u6587\u4EF6\u5199\u5165\u5B8C\u6210"),s}function Mi(r){let e=r.added+r.updated+r.deleted+r.unchanged,t=[];return t.push("\u{1F4C4} \u6587\u4EF6\u4FE1\u606F\u66F4\u65B0\u6458\u8981"),t.push("\u2500".repeat(40)),t.push(`\u603B\u6587\u4EF6\u6570: ${e}`),r.added>0&&t.push(`\u2795 \u65B0\u589E: ${r.added} \u4E2A\u6587\u4EF6`),r.updated>0&&t.push(`\u{1F504} \u66F4\u65B0: ${r.updated} \u4E2A\u6587\u4EF6`),r.deleted>0&&t.push(`\u2796 \u5220\u9664: ${r.deleted} \u4E2A\u6587\u4EF6`),r.unchanged>0&&t.push(`\u2705 \u672A\u53D8: ${r.unchanged} \u4E2A\u6587\u4EF6`),t.push("\u2500".repeat(40)),t.join(`
|
|
1062
|
+
`)}var Pi=w(()=>{});var Ii={};U(Ii,{QuickProjectScanTool:()=>je,quickProjectScan:()=>Ct,quickProjectScanTool:()=>wt});import{existsSync as B}from"fs";import{globSync as vl}from"glob";async function Ct(){return Ei.execute({})}var je,Ei,wt,To=w(()=>{G();Qt();Gn();wi();bi();Pi();je=class extends I{getDefinition(){return{name:"quickProjectScan",description:"Quickly scan the entire project structure, analyze directories, detect languages, and save project information to .nium/project/project.json. Use this when the user asks to explore or analyze the project structure.",input_schema:{type:"object",properties:{},required:[]}}}async execute(e){try{let t=[],n=process.cwd();t.push(`\u{1F50D} \u5F00\u59CB\u63A2\u7D22\u5DE5\u7A0B\u7ED3\u6784...
|
|
1063
|
+
`),t.push("\u{1F4C2} \u626B\u63CF\u9879\u76EE\u6587\u4EF6...");let o=lt(n,!0);t.push(` - \u5E94\u7528 ${o.length} \u6761\u5FFD\u7565\u89C4\u5219`);let s=Date.now(),i=vl("**/*",{nodir:!0,ignore:o,cwd:n}),a=((Date.now()-s)/1e3).toFixed(1);t.push(`\u627E\u5230 ${i.length} \u4E2A\u76F8\u5173\u6587\u4EF6 (\u8017\u65F6 ${a}s)
|
|
1064
|
+
`),t.push("\u{1F4CB} \u68C0\u6D4B\u9879\u76EE\u7C7B\u578B\u548C\u914D\u7F6E...");let c=Ci(n);c.length>0&&t.push(` - \u68C0\u6D4B\u5230\u9879\u76EE\u7C7B\u578B: ${c.join(", ")}`);let l=await yi(n),p={name:l.name,version:l.version,description:l.description,dependencies:l.dependencies||{},devDependencies:l.devDependencies||{}};t.push(` - \u9879\u76EE\u540D\u79F0: ${p.name}`),t.push(` - \u7248\u672C: ${p.version}`),t.push(` - \u8BED\u8A00: ${l.language}`),l.buildTool&&t.push(` - \u6784\u5EFA\u5DE5\u5177: ${l.buildTool}`),t.push(""),t.push("\u{1F5C2}\uFE0F \u5206\u6790\u76EE\u5F55\u7ED3\u6784...");let u=this.analyzeDirectoryStructure(i);t.push(""),t.push("\u{1F310} \u68C0\u6D4B\u9879\u76EE\u7F16\u7A0B\u8BED\u8A00...");let g=this.detectProjectLanguages(i);t.push(`\u4E3B\u8981\u7F16\u7A0B\u8BED\u8A00: ${g.primaryLanguage||l.language||"\u672A\u77E5"}`),g.languages.length>0&&t.push(`\u68C0\u6D4B\u5230 ${g.languages.length} \u79CD\u7F16\u7A0B\u8BED\u8A00`),t.push(""),t.push("\u2699\uFE0F \u68C0\u6D4B\u8FD0\u884C\u65F6\u7248\u672C...");let d=await this.detectVersions(l,n);if(Object.keys(d).length>0)for(let[C,f]of Object.entries(d))t.push(` - ${C}: ${f}`);else t.push(" - \u672A\u68C0\u6D4B\u5230\u7248\u672C\u4FE1\u606F");t.push(""),t.push("\u{1F4D0} \u68C0\u6D4B\u4EE3\u7801\u89C4\u8303...");let S=this.detectCodeStandards(n);S.length>0?t.push(` - \u68C0\u6D4B\u5230\u4EE3\u7801\u89C4\u8303: ${S.join(", ")}`):t.push(" - \u672A\u68C0\u6D4B\u5230\u4EE3\u7801\u89C4\u8303\u914D\u7F6E"),t.push(""),t.push("\u2705 \u9879\u76EE\u7ED3\u6784\u5206\u6790\u5B8C\u6210"),t.push(""),t.push("\u{1F4BE} \u4FDD\u5B58\u9879\u76EE\u57FA\u7840\u4FE1\u606F...");let x=this.buildProjectBasicInfo(p,u,i,g,l,d,S);try{xi(x,n),t.push("\u2705 \u9879\u76EE\u57FA\u7840\u4FE1\u606F\u5DF2\u4FDD\u5B58\u81F3: .nium/project/"),t.push("")}catch(C){console.error(" \u274C \u4FDD\u5B58\u9879\u76EE\u4FE1\u606F\u5931\u8D25:",C),t.push(`\u26A0\uFE0F \u4FDD\u5B58\u9879\u76EE\u4FE1\u606F\u5931\u8D25: ${C instanceof Error?C.message:"\u672A\u77E5\u9519\u8BEF"}`),t.push("")}t.push("\u{1F4DD} \u66F4\u65B0\u6587\u4EF6\u4FE1\u606F\u5217\u8868...");let h=`${n}/.nium/project/files.jsonl`;try{let C=Date.now(),f=$i(i,h,n),k=((Date.now()-C)/1e3).toFixed(1);t.push("\u2705 \u6587\u4EF6\u4FE1\u606F\u5DF2\u66F4\u65B0\u81F3: .nium/project/files.jsonl"),t.push("");let b=Mi(f);t.push(b),t.push("")}catch(C){console.error(" \u274C \u66F4\u65B0\u6587\u4EF6\u4FE1\u606F\u5931\u8D25:",C),t.push(`\u26A0\uFE0F \u66F4\u65B0\u6587\u4EF6\u4FE1\u606F\u5931\u8D25: ${C instanceof Error?C.message:"\u672A\u77E5\u9519\u8BEF"}`),t.push("")}let y=this.generateSummary(p,u,g,l);return t.push("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"),t.push("\u9879\u76EE\u7ED3\u6784\u6982\u89C8"),t.push("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"),t.push(y),t.push("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"),t.push(""),t.join(`
|
|
1065
|
+
`)}catch(t){return this.formatError("Quick project scan",t)}}detectProjectLanguages(e){let t={".js":"JavaScript",".mjs":"JavaScript (ES Modules)",".cjs":"JavaScript (CommonJS)",".jsx":"React JavaScript",".ts":"TypeScript",".tsx":"React TypeScript",".java":"Java",".class":"Java",".jar":"Java","pom.xml":"Java (Maven)","build.gradle":"Java (Gradle)",".py":"Python","requirements.txt":"Python","setup.py":"Python","pyproject.toml":"Python",".c":"C",".cpp":"C++",".h":"C/C++",".hpp":"C++","CMakeLists.txt":"C/C++ (CMake)",".go":"Go","go.mod":"Go",".rs":"Rust","Cargo.toml":"Rust",".php":"PHP","composer.json":"PHP (Composer)",".rb":"Ruby",Gemfile:"Ruby",".cs":"C#",".vb":"Visual Basic","packages.config":".NET",".html":"HTML",".css":"CSS",".scss":"SCSS",".less":"Less",".json":"JSON",".xml":"XML",".yml":"YAML",".yaml":"YAML",".md":"Markdown"},n={};e.forEach(a=>{if(t[a]){n[t[a]]=(n[t[a]]||0)+1;return}let c=a.lastIndexOf(".");if(c>-1){let l=a.substring(c);t[l]&&(n[t[l]]=(n[t[l]]||0)+1)}});let o=Object.entries(n).map(([a,c])=>({language:a,count:c})).sort((a,c)=>c.count-a.count),[s]=o;return{primaryLanguage:s?.language||null,languages:o,totalSourceFiles:o.reduce((a,c)=>a+c.count,0)}}analyzeDirectoryStructure(e){let t={directories:new Set,sourceFiles:[],configFiles:[],docFiles:[],testFiles:[]},n=[".js",".mjs",".cjs",".jsx",".ts",".tsx",".java",".py",".c",".cpp",".cc",".cxx",".h",".hpp",".go",".rs",".php",".rb",".cs",".kt",".kts",".scala",".swift",".m",".mm"],o=[".json",".yaml",".yml",".toml",".ini",".xml",".properties"],s=["package.json","tsconfig.json","pom.xml","build.gradle","settings.gradle","gradle.properties","Cargo.toml","go.mod","requirements.txt","setup.py","pyproject.toml","composer.json","Gemfile",".env",".env.example"];return e.forEach(i=>{let a=i.split("/");if(a.length>1&&t.directories.add(a[0]),i.includes("test")||i.includes("spec")||i.startsWith("test/")||i.startsWith("tests/")||i.includes("__tests__")||i.endsWith(".test.js")||i.endsWith(".test.ts")||i.endsWith(".spec.js")||i.endsWith(".spec.ts")||i.endsWith("Test.java")||i.endsWith("Tests.java")){t.testFiles.push(i);return}let c=i.split("/").pop()||"",l=c.includes(".")?"."+c.split(".").pop():"";i.startsWith("src/")||i.startsWith("lib/")||i.startsWith("app/"),n.includes(l)&&t.sourceFiles.push(i),(o.includes(l)||s.includes(c))&&t.configFiles.push(i),(l===".md"||l===".txt"||l===".rst"||c==="README"||c==="CHANGELOG"||c==="LICENSE"||c==="CONTRIBUTING")&&t.docFiles.push(i)}),{directories:Array.from(t.directories).sort(),sourceFiles:t.sourceFiles.sort(),configFiles:t.configFiles.sort(),docFiles:t.docFiles.sort(),testFiles:t.testFiles.sort()}}async detectVersions(e,t){let n={};try{if(e.language.includes("Java")){let o=`${t}/pom.xml`,s=`${t}/build.gradle`;if(B(o)){let i=Z(o);if(typeof i=="string"){let a=i.match(/<java\.version>([^<]+)<\/java\.version>/)||i.match(/<maven\.compiler\.source>([^<]+)<\/maven\.compiler\.source>/);a&&(n.Java=a[1])}}else if(B(s)){let i=Z(s);if(typeof i=="string"){let a=i.match(/sourceCompatibility\s*=\s*['"]?([^'"\\s]+)['"]?/)||i.match(/targetCompatibility\s*=\s*['"]?([^'"\\s]+)['"]?/);a&&(n.Java=a[1])}}}if(e.language.includes("JavaScript")||e.language.includes("TypeScript")){let o=`${t}/package.json`;if(B(o)){let s=Z(o);if(typeof s=="string")try{let i=JSON.parse(s);i.engines&&(i.engines.node&&(n["Node.js"]=i.engines.node),i.engines.npm&&(n.npm=i.engines.npm))}catch{}}}if(e.language.includes("Python")){let o=`${t}/.python-version`,s=`${t}/pyproject.toml`;if(B(o)){let i=Z(o);typeof i=="string"&&(n.Python=i.trim())}else if(B(s)){let i=Z(s);if(typeof i=="string"){let a=i.match(/python\s*=\s*['"]([^'"]+)['"]/);a&&(n.Python=a[1])}}}if(e.language.includes("Go")){let o=`${t}/go.mod`;if(B(o)){let s=Z(o);if(typeof s=="string"){let i=s.match(/^go\s+(\d+\.\d+)/m);i&&(n.Go=i[1])}}}if(e.language.includes("Rust")){let o=`${t}/Cargo.toml`;if(B(o)){let s=Z(o);if(typeof s=="string"){let i=s.match(/rust-version\s*=\s*['"]([^'"]+)['"]/);i&&(n.Rust=i[1])}}}}catch{}return n}detectCodeStandards(e){let t=[],n=[{name:"ESLint",files:[".eslintrc.js",".eslintrc.json",".eslintrc.yml",".eslintrc.yaml",".eslintrc"]},{name:"Prettier",files:[".prettierrc",".prettierrc.json",".prettierrc.yml",".prettierrc.yaml",".prettierrc.js","prettier.config.js"]},{name:"EditorConfig",files:[".editorconfig"]},{name:"Checkstyle",files:["checkstyle.xml","google_checks.xml","sun_checks.xml"]},{name:"PMD",files:["pmd.xml",".pmd"]},{name:"Black",files:["pyproject.toml"],contentCheck:{filePath:"pyproject.toml",pattern:/\[tool\.black\]/}},{name:"Pylint",files:[".pylintrc","pylint.rc"]},{name:"Flake8",files:[".flake8","setup.cfg"]},{name:"Rustfmt",files:["rustfmt.toml",".rustfmt.toml"]},{name:"Clippy",files:["clippy.toml",".clippy.toml"]},{name:"GolangCI-Lint",files:[".golangci.yml",".golangci.yaml"]}];for(let o of n)if(o.files.some(i=>B(`${e}/${i}`)))if(o.contentCheck){let i=`${e}/${o.contentCheck.filePath}`;if(B(i)){let a=Z(i);typeof a=="string"&&o.contentCheck.pattern.test(a)&&t.push(o.name)}}else t.push(o.name);return t}analyzeCoreModules(e){let t=[],n=new Map;e.sourceFiles.forEach(s=>{let i=s.split("/");if(i.length>=2){let a=i.slice(0,2).join("/");n.has(a)||n.set(a,[]),n.get(a).push(s)}});let o={core:"\u6838\u5FC3\u4E1A\u52A1\u903B\u8F91",domain:"\u9886\u57DF\u6A21\u578B\u548C\u4E1A\u52A1\u89C4\u5219",business:"\u4E1A\u52A1\u903B\u8F91\u5C42",service:"\u670D\u52A1\u5C42",services:"\u670D\u52A1\u5C42",model:"\u6570\u636E\u6A21\u578B",models:"\u6570\u636E\u6A21\u578B",entity:"\u5B9E\u4F53\u7C7B",entities:"\u5B9E\u4F53\u7C7B",dao:"\u6570\u636E\u8BBF\u95EE\u5BF9\u8C61",repository:"\u6570\u636E\u4ED3\u5E93\u5C42",repositories:"\u6570\u636E\u4ED3\u5E93\u5C42",db:"\u6570\u636E\u5E93\u64CD\u4F5C",database:"\u6570\u636E\u5E93\u64CD\u4F5C",persistence:"\u6301\u4E45\u5316\u5C42",api:"API \u63A5\u53E3",rest:"REST API",controller:"\u63A7\u5236\u5668",controllers:"\u63A7\u5236\u5668",handler:"\u8BF7\u6C42\u5904\u7406\u5668",handlers:"\u8BF7\u6C42\u5904\u7406\u5668",endpoint:"\u7AEF\u70B9\u5B9A\u4E49",endpoints:"\u7AEF\u70B9\u5B9A\u4E49",route:"\u8DEF\u7531\u5B9A\u4E49",routes:"\u8DEF\u7531\u5B9A\u4E49",view:"\u89C6\u56FE\u5C42",views:"\u89C6\u56FE\u5C42",component:"\u7EC4\u4EF6",components:"\u7EC4\u4EF6",ui:"\u7528\u6237\u754C\u9762",page:"\u9875\u9762",pages:"\u9875\u9762",layout:"\u5E03\u5C40",layouts:"\u5E03\u5C40",template:"\u6A21\u677F",templates:"\u6A21\u677F",util:"\u5DE5\u5177\u51FD\u6570",utils:"\u5DE5\u5177\u51FD\u6570",helper:"\u8F85\u52A9\u51FD\u6570",helpers:"\u8F85\u52A9\u51FD\u6570",lib:"\u5E93\u6587\u4EF6",libs:"\u5E93\u6587\u4EF6",common:"\u516C\u5171\u6A21\u5757",shared:"\u5171\u4EAB\u6A21\u5757",config:"\u914D\u7F6E\u7BA1\u7406",configuration:"\u914D\u7F6E\u7BA1\u7406",settings:"\u8BBE\u7F6E\u7BA1\u7406",constant:"\u5E38\u91CF\u5B9A\u4E49",constants:"\u5E38\u91CF\u5B9A\u4E49",enum:"\u679A\u4E3E\u5B9A\u4E49",enums:"\u679A\u4E3E\u5B9A\u4E49",middleware:"\u4E2D\u95F4\u4EF6",middlewares:"\u4E2D\u95F4\u4EF6",interceptor:"\u62E6\u622A\u5668",interceptors:"\u62E6\u622A\u5668",filter:"\u8FC7\u6EE4\u5668",filters:"\u8FC7\u6EE4\u5668",guard:"\u5B88\u536B",guards:"\u5B88\u536B",client:"\u5BA2\u6237\u7AEF",clients:"\u5BA2\u6237\u7AEF",adapter:"\u9002\u914D\u5668",adapters:"\u9002\u914D\u5668",provider:"\u63D0\u4F9B\u5546",providers:"\u63D0\u4F9B\u5546",integration:"\u5916\u90E8\u96C6\u6210",integrations:"\u5916\u90E8\u96C6\u6210",auth:"\u8BA4\u8BC1\u6388\u6743",authentication:"\u8BA4\u8BC1",authorization:"\u6388\u6743",security:"\u5B89\u5168\u6A21\u5757",cli:"\u547D\u4EE4\u884C\u63A5\u53E3",cmd:"\u547D\u4EE4\u884C\u5DE5\u5177",script:"\u811A\u672C",scripts:"\u811A\u672C",tool:"\u5DE5\u5177",tools:"\u5DE5\u5177\u96C6",test:"\u6D4B\u8BD5",tests:"\u6D4B\u8BD5",spec:"\u6D4B\u8BD5\u89C4\u8303",mock:"\u6A21\u62DF\u6570\u636E",mocks:"\u6A21\u62DF\u6570\u636E",fixture:"\u6D4B\u8BD5\u5939\u5177",fixtures:"\u6D4B\u8BD5\u5939\u5177",type:"\u7C7B\u578B\u5B9A\u4E49",types:"\u7C7B\u578B\u5B9A\u4E49",interface:"\u63A5\u53E3\u5B9A\u4E49",interfaces:"\u63A5\u53E3\u5B9A\u4E49",schema:"\u6570\u636E\u7ED3\u6784\u5B9A\u4E49",schemas:"\u6570\u636E\u7ED3\u6784\u5B9A\u4E49",dto:"\u6570\u636E\u4F20\u8F93\u5BF9\u8C61",vo:"\u503C\u5BF9\u8C61",event:"\u4E8B\u4EF6",events:"\u4E8B\u4EF6",exception:"\u5F02\u5E38\u5904\u7406",exceptions:"\u5F02\u5E38\u5904\u7406",error:"\u9519\u8BEF\u5904\u7406",errors:"\u9519\u8BEF\u5904\u7406",validator:"\u9A8C\u8BC1\u5668",validators:"\u9A8C\u8BC1\u5668",decorator:"\u88C5\u9970\u5668",decorators:"\u88C5\u9970\u5668"};return n.forEach((s,i)=>{if(s.length>=2){let a=i.split("/").pop()||i,c=a.toLowerCase(),l=o[c]||`${a} \u6A21\u5757`;t.push({name:a.charAt(0).toUpperCase()+a.slice(1),description:l,files:s})}}),t.slice(0,10)}generateProjectStructureDoc(e,t,n,o,s,i,a){let c=new Date().toISOString(),l=this.analyzeCoreModules(t),p=Object.keys(i).length>0?Object.entries(i).map(([g,d])=>`**${g}**: ${d}`).join(`
|
|
1066
|
+
`):"\u6682\u65E0\u7248\u672C\u4FE1\u606F",u=a.length>0?a.map(g=>`- ${g}`).join(`
|
|
1067
|
+
`):"\u6682\u65E0\u4EE3\u7801\u89C4\u8303\u914D\u7F6E";return`# ${e.name} - \u9879\u76EE\u7ED3\u6784\u6587\u6863
|
|
1068
|
+
|
|
1069
|
+
> \u6700\u540E\u66F4\u65B0: ${c}
|
|
1070
|
+
> \u7248\u672C: ${e.version}
|
|
1071
|
+
|
|
1072
|
+
## \u9879\u76EE\u6982\u8FF0
|
|
1073
|
+
|
|
1074
|
+
**\u9879\u76EE\u540D\u79F0**: ${e.name}
|
|
1075
|
+
**\u7248\u672C**: ${e.version}
|
|
1076
|
+
**\u63CF\u8FF0**: ${e.description||"\u6682\u65E0\u63CF\u8FF0"}
|
|
1077
|
+
**\u4E3B\u8981\u7F16\u7A0B\u8BED\u8A00**: ${s.language}
|
|
1078
|
+
${s.buildTool?`**\u6784\u5EFA\u5DE5\u5177**: ${s.buildTool}`:""}
|
|
1079
|
+
|
|
1080
|
+
### \u8FD0\u884C\u65F6\u7248\u672C
|
|
1081
|
+
${p}
|
|
1082
|
+
|
|
1083
|
+
### \u4EE3\u7801\u89C4\u8303
|
|
1084
|
+
${u}
|
|
1085
|
+
|
|
1086
|
+
---
|
|
1087
|
+
|
|
1088
|
+
## \u76EE\u5F55\u7ED3\u6784
|
|
1089
|
+
|
|
1090
|
+
\`\`\`
|
|
1091
|
+
${this.generateDirectoryTree(n)}
|
|
1092
|
+
\`\`\`
|
|
1093
|
+
|
|
1094
|
+
---
|
|
1095
|
+
|
|
1096
|
+
## \u7F16\u7A0B\u8BED\u8A00\u5206\u6790
|
|
1097
|
+
|
|
1098
|
+
### \u8BED\u8A00\u5206\u5E03
|
|
1099
|
+
${o.languages.length>0?o.languages.map(g=>`- **${g.language}**: ${g.count} \u4E2A\u6587\u4EF6`).join(`
|
|
1100
|
+
`):"\u6682\u65E0\u68C0\u6D4B\u5230\u7684\u7F16\u7A0B\u8BED\u8A00"}
|
|
1101
|
+
|
|
1102
|
+
---
|
|
1103
|
+
|
|
1104
|
+
## \u4E3B\u8981\u76EE\u5F55\u8BF4\u660E
|
|
1105
|
+
|
|
1106
|
+
${this.generateDirectoryDescriptions(t.directories)}
|
|
1107
|
+
|
|
1108
|
+
---
|
|
1109
|
+
|
|
1110
|
+
## \u6838\u5FC3\u6A21\u5757\u5206\u6790
|
|
1111
|
+
|
|
1112
|
+
${l.length>0?l.map(g=>`### ${g.name}
|
|
1113
|
+
|
|
1114
|
+
${g.description}
|
|
1115
|
+
|
|
1116
|
+
**\u5305\u542B\u6587\u4EF6**: ${g.files.length} \u4E2A`).join(`
|
|
1117
|
+
|
|
1118
|
+
`):"\u6682\u65E0\u6838\u5FC3\u6A21\u5757\u5206\u6790"}
|
|
1119
|
+
|
|
1120
|
+
---
|
|
1121
|
+
|
|
1122
|
+
## \u6E90\u4EE3\u7801\u6587\u4EF6 (${t.sourceFiles.length} \u4E2A)
|
|
1123
|
+
|
|
1124
|
+
${t.sourceFiles.length>0?t.sourceFiles.slice(0,50).map(g=>`- \`${g}\``).join(`
|
|
1125
|
+
`)+(t.sourceFiles.length>50?`
|
|
1126
|
+
|
|
1127
|
+
*...\u8FD8\u6709 ${t.sourceFiles.length-50} \u4E2A\u6587\u4EF6*`:""):"\u6682\u65E0\u6E90\u4EE3\u7801\u6587\u4EF6"}
|
|
1128
|
+
|
|
1129
|
+
---
|
|
1130
|
+
|
|
1131
|
+
## \u914D\u7F6E\u6587\u4EF6 (${t.configFiles.length} \u4E2A)
|
|
1132
|
+
|
|
1133
|
+
${t.configFiles.length>0?t.configFiles.map(g=>`- \`${g}\``).join(`
|
|
1134
|
+
`):"\u6682\u65E0\u914D\u7F6E\u6587\u4EF6"}
|
|
1135
|
+
|
|
1136
|
+
---
|
|
1137
|
+
|
|
1138
|
+
## \u6587\u6863\u6587\u4EF6 (${t.docFiles.length} \u4E2A)
|
|
1139
|
+
|
|
1140
|
+
${t.docFiles.length>0?t.docFiles.slice(0,20).map(g=>`- \`${g}\``).join(`
|
|
1141
|
+
`)+(t.docFiles.length>20?`
|
|
1142
|
+
|
|
1143
|
+
*...\u8FD8\u6709 ${t.docFiles.length-20} \u4E2A\u6587\u6863*`:""):"\u6682\u65E0\u6587\u6863\u6587\u4EF6"}
|
|
1144
|
+
|
|
1145
|
+
---
|
|
1146
|
+
|
|
1147
|
+
## \u6D4B\u8BD5\u6587\u4EF6 (${t.testFiles.length} \u4E2A)
|
|
1148
|
+
|
|
1149
|
+
${t.testFiles.length>0?t.testFiles.slice(0,20).map(g=>`- \`${g}\``).join(`
|
|
1150
|
+
`)+(t.testFiles.length>20?`
|
|
1151
|
+
|
|
1152
|
+
*...\u8FD8\u6709 ${t.testFiles.length-20} \u4E2A\u6D4B\u8BD5\u6587\u4EF6*`:""):"\u6682\u65E0\u6D4B\u8BD5\u6587\u4EF6"}
|
|
1153
|
+
|
|
1154
|
+
---
|
|
1155
|
+
|
|
1156
|
+
## \u4F9D\u8D56\u5173\u7CFB
|
|
1157
|
+
|
|
1158
|
+
### \u751F\u4EA7\u4F9D\u8D56
|
|
1159
|
+
${e.dependencies?Object.entries(e.dependencies).map(([g,d])=>`- **${g}**: ${d}`).join(`
|
|
1160
|
+
`):"\u6682\u65E0\u751F\u4EA7\u4F9D\u8D56"}
|
|
1161
|
+
|
|
1162
|
+
### \u5F00\u53D1\u4F9D\u8D56
|
|
1163
|
+
${e.devDependencies?Object.entries(e.devDependencies).map(([g,d])=>`- **${g}**: ${d}`).join(`
|
|
1164
|
+
`):"\u6682\u65E0\u5F00\u53D1\u4F9D\u8D56"}
|
|
1165
|
+
|
|
1166
|
+
---
|
|
1167
|
+
|
|
1168
|
+
## \u5FEB\u901F\u5BFC\u822A
|
|
1169
|
+
|
|
1170
|
+
### \u5165\u53E3\u6587\u4EF6
|
|
1171
|
+
${this.findEntryPoints(e,n,s).map(g=>`- \`${g}\``).join(`
|
|
1172
|
+
`)}
|
|
1173
|
+
|
|
1174
|
+
### \u6838\u5FC3\u6A21\u5757
|
|
1175
|
+
${this.findCoreModules(t.sourceFiles).map(g=>`- \`${g}\``).join(`
|
|
1176
|
+
`)}
|
|
1177
|
+
|
|
1178
|
+
---
|
|
1179
|
+
|
|
1180
|
+
**\u6587\u6863\u751F\u6210\u65F6\u95F4**: ${c}
|
|
1181
|
+
**\u6587\u6863\u751F\u6210\u5DE5\u5177**: quickProjectScan \u5DE5\u5177
|
|
1182
|
+
`}generateDirectoryTree(e){let t={};e.forEach(o=>{let s=o.split("/"),i=t;s.forEach((a,c)=>{i[a]||(i[a]=c===s.length-1?null:{}),i[a]!==null&&(i=i[a])})});function n(o,s="",i=!0){let a=Object.entries(o),c="";return a.forEach(([l,p],u)=>{let g=u===a.length-1,d=g?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",S=g?" ":"\u2502 ";c+=s+d+l+`
|
|
1183
|
+
`,p!==null&&typeof p=="object"&&(c+=n(p,s+S,g))}),c}return n(t).trim()}generateDirectoryDescriptions(e){let t={src:"\u6E90\u4EE3\u7801\u76EE\u5F55\uFF0C\u5305\u542B\u6240\u6709\u4E3B\u8981\u7684\u5E94\u7528\u7A0B\u5E8F\u4EE3\u7801",test:"\u6D4B\u8BD5\u6587\u4EF6\u76EE\u5F55\uFF0C\u5305\u542B\u5355\u5143\u6D4B\u8BD5\u548C\u96C6\u6210\u6D4B\u8BD5",docs:"\u6587\u6863\u76EE\u5F55\uFF0C\u5305\u542B\u9879\u76EE\u6587\u6863\u548C\u8BF4\u660E",examples:"\u793A\u4F8B\u4EE3\u7801\u76EE\u5F55\uFF0C\u5305\u542B\u4F7F\u7528\u793A\u4F8B",bin:"\u53EF\u6267\u884C\u6587\u4EF6\u76EE\u5F55\uFF0C\u5305\u542B CLI \u547D\u4EE4\u811A\u672C",lib:"\u5E93\u6587\u4EF6\u76EE\u5F55",dist:"\u6784\u5EFA\u8F93\u51FA\u76EE\u5F55",build:"\u6784\u5EFA\u811A\u672C\u548C\u914D\u7F6E\u76EE\u5F55",config:"\u914D\u7F6E\u6587\u4EF6\u76EE\u5F55",".nium":"\u5DE5\u4F5C\u533A\u914D\u7F6E\u76EE\u5F55\uFF0C\u5305\u542B\u4F1A\u8BDD\u6570\u636E\u548C\u5B50\u4EE3\u7406\u914D\u7F6E",tasks:"\u4EFB\u52A1\u6587\u4EF6\u76EE\u5F55"};return e.map(n=>{let o=t[n]||"\u9879\u76EE\u76EE\u5F55";return`### \`${n}/\`
|
|
1184
|
+
${o}`}).join(`
|
|
1185
|
+
|
|
1186
|
+
`)}findEntryPoints(e,t,n){let o=[];n.entryPoints&&n.entryPoints.length>0&&o.push(...n.entryPoints),e.main&&o.push(e.main),e.bin&&(typeof e.bin=="string"?o.push(e.bin):o.push(...Object.values(e.bin)));let s=n.language.toLowerCase(),i=[];return s.includes("javascript")||s.includes("typescript")?i=["index.js","index.ts","index.mjs","app.js","main.js","server.js","src/index.js","src/main.js"]:s.includes("java")?i=["src/main/java/**/Main.java","src/main/java/**/Application.java"]:s.includes("python")?i=["main.py","__main__.py","app.py","run.py","manage.py"]:s.includes("go")?i=["main.go","cmd/main.go"]:s.includes("rust")?i=["src/main.rs","src/lib.rs"]:s.includes("ruby")?i=["main.rb","app.rb","config.ru"]:s.includes("php")?i=["index.php","app.php","public/index.php"]:(s.includes("c#")||s.includes(".net"))&&(i=["Program.cs","Startup.cs"]),i.forEach(a=>{t.includes(a)&&o.push(a)}),[...new Set(o)]}findCoreModules(e){let t=new Set;return e.forEach(n=>{let o=n.match(/^src\/([^\/]+)\//);o&&t.add(`src/${o[1]}/`)}),Array.from(t).sort()}buildProjectBasicInfo(e,t,n,o,s,i,a){let c=Ti(o.languages),p=this.analyzeCoreModules(t).map(d=>({name:d.name,description:d.description,fileCount:d.files.length})),u;return s.language.includes("JavaScript")||s.language.includes("TypeScript")?B("package-lock.json")?u="npm":B("yarn.lock")?u="yarn":B("pnpm-lock.yaml")?u="pnpm":u="npm":s.language.includes("Python")?B("poetry.lock")?u="poetry":B("Pipfile.lock")?u="pipenv":u="pip":s.language.includes("Java")?B("pom.xml")?u="maven":B("build.gradle")&&(u="gradle"):s.language.includes("Rust")?u="cargo":s.language.includes("Go")?u="go modules":s.language.includes("PHP")?u="composer":s.language.includes("Ruby")&&(u="bundler"),{projectName:e.name,version:e.version,description:e.description||"",primaryLanguage:o.primaryLanguage||s.language,languages:c,buildTool:s.buildTool,packageManager:u,runtime:s.language.includes("JavaScript")||s.language.includes("TypeScript")?"Node.js":s.language.includes("Java")?"JVM":s.language.includes("Python")?"Python":void 0,fileStats:{totalFiles:n.length,sourceFiles:t.sourceFiles.length,configFiles:t.configFiles.length,docFiles:t.docFiles.length,testFiles:t.testFiles.length},dependencies:e.dependencies,devDependencies:e.devDependencies,dependencyCount:{production:Object.keys(e.dependencies||{}).length,development:Object.keys(e.devDependencies||{}).length},runtimeVersions:Object.keys(i).length>0?i:void 0,codeStandards:a,entryPoints:this.findEntryPoints(e,n,s),configFiles:t.configFiles,coreModules:p.length>0?p:void 0,lastScanDate:new Date().toISOString()}}generateSummary(e,t,n,o){return`
|
|
1187
|
+
\u{1F4E6} \u9879\u76EE: ${e.name} (v${e.version})
|
|
1188
|
+
\u{1F310} \u4E3B\u8981\u8BED\u8A00: ${o.language}
|
|
1189
|
+
${o.buildTool?`\u{1F527} \u6784\u5EFA\u5DE5\u5177: ${o.buildTool}`:""}
|
|
1190
|
+
\u{1F4C1} \u4E3B\u8981\u76EE\u5F55: ${t.directories.join(", ")}
|
|
1191
|
+
\u{1F4DD} \u6E90\u6587\u4EF6: ${t.sourceFiles.length} \u4E2A
|
|
1192
|
+
\u2699\uFE0F \u914D\u7F6E\u6587\u4EF6: ${t.configFiles.length} \u4E2A
|
|
1193
|
+
\u{1F4DA} \u6587\u6863\u6587\u4EF6: ${t.docFiles.length} \u4E2A
|
|
1194
|
+
\u{1F9EA} \u6D4B\u8BD5\u6587\u4EF6: ${t.testFiles.length} \u4E2A
|
|
1195
|
+
`}formatAction(e){return"quickProjectScan()"}formatObservation(e){return String(e)}},Ei=new je;wt=Ei});var ko={};U(ko,{executePlanTask:()=>Tl,getGlobalSession:()=>xl,resumePlanTask:()=>bl,setGlobalSession:()=>bo});import T from"chalk";function bo(r){L=r}function xl(){return L}async function Tl(r,e=1,t={}){let n=new xe,o=new Te(n),s=new be(n,o),i=new ke,a=vt(),c={useLLMDisclosure:t.useLLMDisclosure!==void 0?t.useLLMDisclosure:!0,useLLMSummary:t.useLLMSummary!==void 0?t.useLLMSummary:!0,verbose:t.verbose||!1},l=h=>{L?L.log(h):console.log(h)},p=h=>{L?L.info(h):console.log(T.blue(h))},u=h=>{L?L.success(h):console.log(T.green(h))},g=h=>{L?L.warning(h):console.log(T.yellow(h))},d=h=>{L?L.error(h):console.log(T.red(h))},S=" ".repeat(e-1),x=new rr;try{let h=await import("fs"),y=await import("path");try{let b=y.join(process.cwd(),".nium/project/project.json");if(h.existsSync(b)){let P=h.statSync(b);(Date.now()-P.mtimeMs)/(1e3*60*60)>24&&g("\u26A0\uFE0F \u9879\u76EE\u7ED3\u6784\u6587\u6863\u5DF2\u8D85\u8FC724\u5C0F\u65F6\uFF0C\u5EFA\u8BAE\u66F4\u65B0")}else{p("\u{1F4CB} \u9996\u6B21\u6267\u884C\u4EFB\u52A1\uFF0C\u6B63\u5728\u626B\u63CF\u9879\u76EE\u7ED3\u6784...");let{quickProjectScan:P}=await Promise.resolve().then(()=>(To(),Ii));await P(),u(`\u2705 \u9879\u76EE\u7ED3\u6784\u626B\u63CF\u5B8C\u6210
|
|
1196
|
+
`)}}catch{g("\u9879\u76EE\u7ED3\u6784\u626B\u63CF\u5931\u8D25\uFF0C\u5C06\u7EE7\u7EED\u6267\u884C\u4EFB\u52A1")}l(""),l(`${S}${"\u2550".repeat(60-e*2)}`),p(`${S}\u{1F4CB} \u5F00\u59CB\u89C4\u5212\u4EFB\u52A1 (\u5D4C\u5957\u5C42\u7EA7: ${e})`),l(`${S}${"\u2550".repeat(60-e*2)}`),l("");let C=a.getAllSubAgents(),f=await an(r,C);n.initializeTask(r,f),f.taskId&&Ke(f.taskId);let k=kl(cn(f),e);l(k),l(""),x.showTaskStart(r,f.tasks.length,e);for(let b=0;b<f.tasks.length;b++){let P=f.tasks[b],$=P.step;x.showStepProgress($,f.tasks.length,P,e),n.plan.currentStep=$,f.taskId&&await Le(f.taskId,$,"in_progress");try{let E=Ai(P,a),D=await s.buildIsolatedContext($,P.description,E?.prompt||"",c.useLLMDisclosure,P.allowedTools);E?await Oi($,P.description,E,D,n,i,a,c,{log:l,info:p,success:u,warning:g,error:d},P.allowedTools):await Di(P.description,D,n,{log:l,info:p},P.allowedTools),x.showStepComplete($,f.tasks.length,P,e),f.taskId&&await Le(f.taskId,$,"completed")}catch(E){let D=E instanceof Error?E.message:String(E);throw x.showStepError($,f.tasks.length,D,e),g(`${S}\u4E2D\u6B62\u540E\u7EED\u6B65\u9AA4\u6267\u884C`),n.recordStepCompletion($,`\u5931\u8D25: ${D}`,{success:!1,error:D}),E}}return x.showTaskComplete(f.tasks.length,f.tasks.length,e),Qe(),{success:!0,taskId:f.taskId,completedSteps:f.tasks.length,plan:f,planMarkdown:f.markdown,tasks:f.tasks}}catch(h){Qe();let y=h instanceof Error?h.message:String(h);throw d(`${S}\u274C \u89C4\u5212\u4EFB\u52A1\u6267\u884C\u5931\u8D25: ${y}`),h}}async function bl(r,e=0,t={}){let{loadTaskPlan:n}=await Promise.resolve().then(()=>(ge(),ve)),o=n(r);if(!o)throw new Error(`\u65E0\u6CD5\u52A0\u8F7D\u4EFB\u52A1\u8BA1\u5212: ${r}`);console.log(T.cyan(`[\u4EFB\u52A1\u6062\u590D] \u6B63\u5728\u6062\u590D\u4EFB\u52A1: ${r}`)),console.log(T.gray(`\u4ECE\u6B65\u9AA4 ${e||1} \u5F00\u59CB\u6267\u884C`));let s=new xe,i=new Te(s),a=new be(s,i),c=new ke,l=vt(),p={useLLMDisclosure:t.useLLMDisclosure!==void 0?t.useLLMDisclosure:!0,useLLMSummary:t.useLLMSummary!==void 0?t.useLLMSummary:!0,verbose:t.verbose||!1},u=f=>{L?L.log(f):console.log(f)},g=f=>{L?L.info(f):console.log(T.blue(f))},d=f=>{L?L.success(f):console.log(T.green(f))},S=f=>{L?L.warning(f):console.log(T.yellow(f))},x=f=>{L?L.error(f):console.log(T.red(f))},h=1,y="",C=new rr;try{s.initializeTask(o.taskId,o),o.taskId&&Ke(o.taskId),u(""),u(T.cyan("\u2550".repeat(60))),g("\u{1F4CB} \u6062\u590D\u4EFB\u52A1\u6267\u884C"),u(T.cyan("\u2550".repeat(60))),u(""),C.showTaskStart(o.taskId,o.tasks.length,h);let f=e>0?e-1:0;for(let k=f;k<o.tasks.length;k++){let b=o.tasks[k],P=b.step;if(C.showStepProgress(P,o.tasks.length,b,h),s.plan.currentStep=P,o.taskId){let{updateTaskStatus:$}=await Promise.resolve().then(()=>(ge(),ve));await $(o.taskId,P,"in_progress")}try{let $=Ai(b,l),E=await a.buildIsolatedContext(P,b.description,$?.prompt||"",p.useLLMDisclosure,b.allowedTools);if($?await Oi(P,b.description,$,E,s,c,l,p,{log:u,info:g,success:d,warning:S,error:x},b.allowedTools):await Di(b.description,E,s,{log:u,info:g},b.allowedTools),C.showStepComplete(P,o.tasks.length,b,h),o.taskId){let{updateTaskStatus:D}=await Promise.resolve().then(()=>(ge(),ve));await D(o.taskId,P,"completed")}}catch($){let E=$ instanceof Error?$.message:String($);throw C.showStepError(P,o.tasks.length,E,h),S(`${y}\u4E2D\u6B62\u540E\u7EED\u6B65\u9AA4\u6267\u884C`),s.recordStepCompletion(P,`\u5931\u8D25: ${E}`,{success:!1,error:E}),$}}return C.showTaskComplete(o.tasks.length,o.tasks.length,h),Qe(),{success:!0,taskId:o.taskId,completedSteps:o.tasks.length-f,resumedFrom:e||1}}catch(f){Qe();let k=f instanceof Error?f.message:String(f);throw x(`${y}\u274C \u4EFB\u52A1\u6062\u590D\u6267\u884C\u5931\u8D25: ${k}`),f}}function kl(r,e){return e<=1?r:r.split(`
|
|
1197
|
+
`).map(o=>{if(o.trim().startsWith("#")){let s=o.match(/^#+/)?.[0].length||0,i=Math.min(s+e-1,6),a="#".repeat(i);return o.replace(/^#+/,a)}return o}).join(`
|
|
1198
|
+
`)}function Ai(r,e){return r.subAgent&&r.subAgent!=="default"?e.getSubAgent(r.subAgent):null}async function Oi(r,e,t,n,o,s,i,a,c,l){let{log:p,info:u,error:g}=c,d=Date.now();u(`\u{1F527} \u4F7F\u7528\u5B50\u667A\u80FD\u4F53: ${t.name}`),p(T.gray(`\u63CF\u8FF0: ${t.description}`)),l&&l.length>0&&p(T.gray(`\u6CE8\u610F: \u5B50\u667A\u80FD\u4F53 ${t.name} \u4E0D\u53D7\u6B65\u9AA4\u5DE5\u5177\u9650\u5236\u5F71\u54CD`)),p("");try{let{SYSTEM_PROMPT:S}=await Promise.resolve().then(()=>(Re(),ho)),x=[{role:"system",content:S},...n.filter(C=>C.role!=="system"),...n.filter(C=>C.role==="system"&&C!==n[0])],h=await Ri(x,e,c,void 0);await $l(r,h,o,s,a,c);let y=Date.now()-d;i.recordAgentPerformance(t.name,!0,y)}catch(S){let x=Date.now()-d;throw i.recordAgentPerformance(t.name,!1,x),S}}async function Di(r,e,t,n,o){let{log:s,info:i}=n;i("\u{1F916} \u4F7F\u7528\u9ED8\u8BA4React\u667A\u80FD\u4F53"),o&&o.length>0&&s(T.gray(`\u5DE5\u5177\u9650\u5236: ${o.join(", ")}`)),s("");let{SYSTEM_PROMPT:a}=await Promise.resolve().then(()=>(Re(),ho)),c=[{role:"system",content:a},...e.filter(l=>l.role!=="system"),...e.filter(l=>l.role==="system")];await Ri(c,r,n,o)}async function Ri(r,e,t,n){let{log:o,error:s}=t,{MODEL:i}=await Promise.resolve().then(()=>(te(),Ze)),{callModelAPI:a}=await Promise.resolve().then(()=>(ye(),un)),{isThinkTool:c,extractThought:l}=await Promise.resolve().then(()=>(on(),lo)),{getToolDefinitions:p}=await Promise.resolve().then(()=>(St(),$o)),{tools:u,toolInstances:g,extractToolResult:d}=await Promise.resolve().then(()=>(Se(),dn)),{saveSession:S}=await Promise.resolve().then(()=>(we(),fs)),{logDebug:x}=await Promise.resolve().then(()=>(H(),as)),h=[...r],y=0,C=50,f=p(),k=n&&n.length>0?f.filter(b=>n.includes(b.name)):f;for(n&&n.length>0&&x(`\u672C\u6B65\u9AA4\u53EF\u7528\u5DE5\u5177: ${k.map(b=>b.name).join(", ")}`);y<C;){y++;try{S(h,e);let b=await a({model:i(),messages:h,temperature:.1,tools:k}),P=b.choices[0].message.tool_calls;if(b.choices[0].finish_reason==="stop"){let{content:W}=b.choices[0].message;W&&W.trim()&&(o(T.green("\u4EFB\u52A1\u5B8C\u6210:")),o(W),o(""));break}if(!P||P.length===0){let{content:W}=b.choices[0].message;W&&W.trim()&&(o(T.yellow(W)),o(""));continue}let $=P[0],E=$.function.name;if(n&&n.length>0&&!n.includes(E)){let W=`Error: \u5DE5\u5177 '${E}' \u672A\u5728\u672C\u6B65\u9AA4\u7684\u6388\u6743\u5217\u8868\u4E2D\u3002\u5141\u8BB8\u4F7F\u7528\u7684\u5DE5\u5177: ${n.join(", ")}`;s(W),h.push({role:"assistant",content:null,tool_calls:[$]}),h.push({role:"tool",tool_call_id:$.id,content:W});continue}let D;try{D=JSON.parse($.function.arguments)}catch{s(`\u89E3\u6790\u5DE5\u5177\u53C2\u6570\u5931\u8D25: ${$.function.arguments}`),h.push({role:"assistant",content:null,tool_calls:[$]}),h.push({role:"tool",tool_call_id:$.id,content:"Error: Invalid JSON arguments"});continue}if(c(E)){let W=l($);W&&(o(T.cyan(`\u{1F4AD} Think: ${W}`)),o("")),h.push({role:"assistant",content:null,tool_calls:[$]}),h.push({role:"tool",tool_call_id:$.id,content:"Noted. Continue with your action."});continue}if(!u[E]){let W=`Error: Unknown tool '${E}'`;s(W),h.push({role:"assistant",content:null,tool_calls:[$]}),h.push({role:"tool",tool_call_id:$.id,content:W});continue}let me=p().find(W=>W.name===E),R;if(me&&me.input_schema&&me.input_schema.properties){R=Object.keys(me.input_schema.properties).map(qe=>D[qe]);let Xo=(me.input_schema.required||[]).filter(qe=>D[qe]===void 0);if(Xo.length>0){let qe=`Error: Missing required parameters: ${Xo.join(", ")}`;s(qe),h.push({role:"assistant",content:null,tool_calls:[$]}),h.push({role:"tool",tool_call_id:$.id,content:qe});continue}}else R=Object.values(D);let ae=g[E],Je=ae?ae.formatAction(D):`${E}()`;o(T.blue(`\u{1F527} \u884C\u52A8: ${Je}`)),o("");let X=await u[E](...R),ze=d(X),ma=ae?ae.shouldPrintObservation(X):!0,da=ae?ae.formatObservation(X):String(X);ma&&(o(T.yellow(`\u{1F4CA} \u89C2\u5BDF: ${da}`)),o("")),h.push({role:"assistant",content:null,tool_calls:[$]}),h.push({role:"tool",tool_call_id:$.id,content:String(ze)}),S(h,e)}catch(b){throw s(`\u9519\u8BEF: ${b.message}`),S(h,e),b}}if(y>=C)throw s("\u9519\u8BEF: \u5DF2\u8FBE\u5230\u6700\u5927\u8FED\u4EE3\u6B21\u6570"),S(h,e),new Error("Maximum iterations reached");return h}async function $l(r,e,t,n,o,s){let{info:i,log:a}=s,c;o.useLLMSummary?c=await n.extractSummaryWithLLM(e):c=await n.extractSummary(e);let l=n.extractMetadata(e);l.success=!0,t.recordStepCompletion(r,c,l),o.verbose&&(i(`\u6B65\u9AA4 ${r} \u6458\u8981\u5DF2\u8BB0\u5F55\u5230\u5168\u5C40\u4E0A\u4E0B\u6587`),a(""),a(T.gray("\u2500\u2500\u2500 \u6B65\u9AA4\u6267\u884C\u6458\u8981 \u2500\u2500\u2500")),a(T.gray(`\u6458\u8981: ${c}`)),a(T.gray(`\u5DE5\u5177: ${l.toolsUsed.join(", ")}`)),a(T.gray(`\u6587\u4EF6: ${l.filesAccessed.join(", ")}`)),a(T.gray(`\u8FED\u4EE3: ${l.iterations} \u6B21`)))}var rr,L,or=w(()=>{ge();sr();we();Co();rr=class{startTime;stepStartTime=null;constructor(){this.startTime=Date.now()}showTaskStart(e,t,n=1){let o=" ".repeat(n-1);console.log(""),console.log(T.cyan(`${o}\u2554${"\u2550".repeat(58-n*2)}\u2557`)),console.log(T.cyan(`${o}\u2551`)+T.bold.white(" \u{1F680} \u5F00\u59CB\u6267\u884C\u4EFB\u52A1\u8BA1\u5212")+T.cyan(` (\u5171${t}\u6B65)`.padEnd(58-n*2-13))+T.cyan("\u2551")),console.log(T.cyan(`${o}\u255A${"\u2550".repeat(58-n*2)}\u255D`)),console.log("")}showStepProgress(e,t,n,o=1){this.stepStartTime=Date.now();let s=" ".repeat(o-1),i=Math.round(e/t*100),a=this.createProgressBar(i,30);console.log(""),console.log(T.blue(`${s}\u250C${"\u2500".repeat(58-o*2)}\u2510`)),console.log(T.blue(`${s}\u2502`)+` \u6B65\u9AA4 ${e}/${t} (${i}%)`.padEnd(60-o*2)+T.blue("\u2502")),console.log(T.blue(`${s}\u2502`)+` ${a}`.padEnd(60-o*2)+T.blue("\u2502")),console.log(T.blue(`${s}\u2502`)+T.cyan(` \u{1F4CC} ${n.description}`.substring(0,58-o*2)).padEnd(60-o*2)+T.blue("\u2502")),console.log(T.blue(`${s}\u2502`)+T.gray(` \u{1F916} \u667A\u80FD\u4F53: ${n.subAgent}`.substring(0,58-o*2)).padEnd(60-o*2)+T.blue("\u2502")),console.log(T.blue(`${s}\u2514${"\u2500".repeat(58-o*2)}\u2518`)),console.log("")}showStepComplete(e,t,n,o=1){let s=" ".repeat(o-1),i=this.stepStartTime?this.formatDuration(Date.now()-this.stepStartTime):"",a=Math.round(e/t*100);console.log(T.green(`${s}\u2705 \u6B65\u9AA4 ${e}/${t} \u5B8C\u6210`)+T.gray(` (${i})`)),console.log("")}showTaskComplete(e,t,n=1){let o=" ".repeat(n-1),s=this.formatDuration(Date.now()-this.startTime),i=Math.round(e/t*100);console.log(""),console.log(T.green(`${o}\u2554${"\u2550".repeat(58-n*2)}\u2557`)),console.log(T.green(`${o}\u2551`)+T.bold.white(" \u{1F389} \u4EFB\u52A1\u6267\u884C\u5B8C\u6210!")+T.green("".padEnd(58-n*2-12))+T.green("\u2551")),console.log(T.green(`${o}\u2551`)+` \u5B8C\u6210\u8FDB\u5EA6: ${e}/${t} (${i}%)`.padEnd(60-n*2)+T.green("\u2551")),console.log(T.green(`${o}\u2551`)+` \u603B\u8017\u65F6: ${s}`.padEnd(60-n*2)+T.green("\u2551")),console.log(T.green(`${o}\u255A${"\u2550".repeat(58-n*2)}\u255D`)),console.log("")}showStepError(e,t,n,o=1){let s=" ".repeat(o-1);console.log(""),console.log(T.red(`${s}\u274C \u6B65\u9AA4 ${e}/${t} \u6267\u884C\u5931\u8D25`)),console.log(T.red(`${s} \u9519\u8BEF: ${n.substring(0,100)}`)),console.log("")}createProgressBar(e,t=30){let n=Math.round(e/100*t),o=t-n;return`${T.green("\u2588".repeat(n))+T.gray("\u2591".repeat(o))} ${e}%`}formatDuration(e){if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;let t=Math.floor(e/6e4),n=(e%6e4/1e3).toFixed(0);return`${t}m ${n}s`}},L=null});import Ml from"chalk";async function fn(r){return await Li.execute({task:r})}var xt,Li,hn,ji=w(()=>{G();xt=class r extends I{static nestingLevel=0;static MAX_NESTING_LEVEL=2;getDefinition(){return{name:"plan",description:`USE THIS TOOL FIRST for COMPLEX tasks! This is your PRIMARY tool for handling multi-step, cross-component work.
|
|
1199
|
+
|
|
1200
|
+
IDEAL USE CASES:
|
|
1201
|
+
- Building new features that span multiple files or components
|
|
1202
|
+
- Implementing complete workflows with sequential dependencies
|
|
1203
|
+
- Conducting systematic code refactoring across a project
|
|
1204
|
+
- Setting up project structure and architecture
|
|
1205
|
+
- Multi-file configuration changes
|
|
1206
|
+
- Tasks requiring coordination between different system parts
|
|
1207
|
+
|
|
1208
|
+
AUTOMATIC ADVANTAGES:
|
|
1209
|
+
- Automatic task breakdown into logical steps
|
|
1210
|
+
- Intelligent sub-agent assignment for each step
|
|
1211
|
+
- Context preservation across all operations
|
|
1212
|
+
- Comprehensive execution tracking
|
|
1213
|
+
- Maximum 2-level nesting support for complex sub-tasks
|
|
1214
|
+
|
|
1215
|
+
AVOID FOR:
|
|
1216
|
+
- Single-file edits or queries
|
|
1217
|
+
- Simple read/write operations
|
|
1218
|
+
- Individual command execution
|
|
1219
|
+
|
|
1220
|
+
When you're uncertain if a task needs planning, default to using this tool - it will create an optimal execution strategy for you!`,input_schema:{type:"object",properties:{task:{type:"string",description:"Detailed description of the complex task to plan and execute. Be specific about the goals and requirements."},planOnly:{type:"boolean",description:"If true, only generate the plan without executing it. The plan will be saved to .tasks/ directory for later execution. Default: false"}},required:["task"]}}}async execute(e){let{task:t,planOnly:n=!1}=e;if(n)try{let{generateTaskPlan:o}=await Promise.resolve().then(()=>(ge(),ve)),{getSubAgentManager:s}=await Promise.resolve().then(()=>(sr(),Fi)),a=s().getAllSubAgents(),c=await o(t,a),l=`\u2705 \u4EFB\u52A1\u89C4\u5212\u5DF2\u751F\u6210\uFF08\u4EC5\u89C4\u5212\u6A21\u5F0F\uFF09
|
|
1221
|
+
|
|
1222
|
+
`;return l+=`**\u4EFB\u52A1 ID**: ${c.taskId}
|
|
1223
|
+
`,l+=`**\u603B\u6B65\u9AA4\u6570**: ${c.tasks.length}
|
|
1224
|
+
`,l+=`**\u8BA1\u5212\u7B56\u7565**: ${c.strategy}
|
|
1225
|
+
|
|
1226
|
+
`,l+=`**\u89C4\u5212\u5DF2\u4FDD\u5B58\u5230**:
|
|
1227
|
+
`,l+=`- Markdown: .tasks/${c.taskId}.md
|
|
1228
|
+
`,l+=`- JSON: .tasks/${c.taskId}.json
|
|
1229
|
+
|
|
1230
|
+
`,l+=`**\u6267\u884C\u6B65\u9AA4**:
|
|
1231
|
+
`,c.tasks.forEach((p,u)=>{l+=`${u+1}. ${p.description} [${p.subAgent}]
|
|
1232
|
+
`}),l+=`
|
|
1233
|
+
\u{1F4A1} \u63D0\u793A: \u4F7F\u7528 todo \u5DE5\u5177\u7684 resume \u529F\u80FD\u6765\u6267\u884C\u6B64\u8BA1\u5212`,this.createToolResult(l,l,!0)}catch(o){let s=o instanceof Error?o.message:String(o);return this.createToolResult(`Error: Failed to generate plan - ${s}`,`Error: Failed to generate plan - ${s}`,!0)}if(r.nestingLevel>=r.MAX_NESTING_LEVEL)return this.createToolResult(`Error: Maximum nesting level (${r.MAX_NESTING_LEVEL}) reached. Please use regular tools directly instead of the plan tool.`,`Error: Maximum nesting level (${r.MAX_NESTING_LEVEL}) reached. Please use regular tools directly instead of the plan tool.`,!0);r.nestingLevel++;try{let o;try{o=await(await Promise.resolve().then(()=>(or(),ko))).executePlanTask(t,r.nestingLevel)}catch{console.log(Ml.yellow("[Plan-Tool] \u8B66\u544A: \u65E0\u6CD5\u5BFC\u5165plan-executor.js\uFF0C\u8FD4\u56DE\u4EFB\u52A1\u89C4\u5212\u5EFA\u8BAE")),o={success:!0,message:"\u4EFB\u52A1\u89C4\u5212\u5DF2\u751F\u6210\uFF0C\u8BF7\u6839\u636E\u89C4\u5212\u6267\u884C\u4EFB\u52A1\u6B65\u9AA4",tasks:[{step:1,description:"\u5206\u6790\u9700\u6C42\u5E76\u786E\u8BA4\u6280\u672F\u6808",status:"pending"},{step:2,description:"\u5B9E\u73B0\u6838\u5FC3\u529F\u80FD\u6A21\u5757",status:"pending"},{step:3,description:"\u7F16\u5199\u6D4B\u8BD5\u7528\u4F8B",status:"pending"},{step:4,description:"\u4EE3\u7801\u5BA1\u67E5\u4E0E\u4F18\u5316",status:"pending"}]}}let s=`\u2705 Task planning and execution completed successfully!
|
|
1234
|
+
|
|
1235
|
+
`;return s+=`**Task ID**: ${o.taskId}
|
|
1236
|
+
`,s+=`**Completed Steps**: ${o.completedSteps}
|
|
1237
|
+
|
|
1238
|
+
`,o.planMarkdown&&(s+=`**Generated Plan**:
|
|
1239
|
+
${o.planMarkdown}
|
|
1240
|
+
|
|
1241
|
+
`),o.tasks&&o.tasks.length>0&&(s+=`**Executed Steps**:
|
|
1242
|
+
`,o.tasks.forEach((i,a)=>{s+=`${a+1}. \u2713 ${i.description}
|
|
1243
|
+
`})),this.createToolResult(s,s,!0)}catch(o){let s=o instanceof Error?o.message:String(o);return this.createToolResult(`Error: Task execution failed - ${s}`,`Error: Task execution failed - ${s}`,!0)}finally{r.nestingLevel--}}static getCurrentNestingLevel(){return r.nestingLevel}static resetNestingLevel(){r.nestingLevel=0}formatAction(e){return`plan(task="${e.task.length>100?e.task.substring(0,100)+"...":e.task}", nesting_level=${r.nestingLevel+1})`}formatObservation(e){return typeof e=="string"&&e.includes("Error:")?e:"Task planning completed. Check logs above for details."}},Li=new xt;hn=Li});import Fe from"readline";import _e from"chalk";async function yn(r){return await _i.execute(r)}var Tt,_i,Sn,Ni=w(()=>{G();Tt=class extends I{getDefinition(){return{name:"askUser",description:`Ask the user a question and wait for their response. This pauses the execution loop until the user provides input.
|
|
1244
|
+
|
|
1245
|
+
Use this tool when you need:
|
|
1246
|
+
- User confirmation or decision
|
|
1247
|
+
- Additional information from the user
|
|
1248
|
+
- Clarification on ambiguous requirements
|
|
1249
|
+
- User preference between multiple options
|
|
1250
|
+
|
|
1251
|
+
IMPORTANT:
|
|
1252
|
+
- This will pause execution until the user responds
|
|
1253
|
+
- Provide clear, specific questions
|
|
1254
|
+
- If you provide choices, the user will see a menu to select from
|
|
1255
|
+
- If allowFreeText is true, user can type a custom response
|
|
1256
|
+
|
|
1257
|
+
Examples:
|
|
1258
|
+
- askUser({ question: "Which file should I modify?" }) - Free text input
|
|
1259
|
+
- askUser({ question: "Proceed with deletion?", choices: ["Yes", "No"] }) - Multiple choice
|
|
1260
|
+
- askUser({ question: "Select an option:", choices: ["Option 1", "Option 2"], allowFreeText: true }) - Choice with custom input allowed`,input_schema:{type:"object",properties:{question:{type:"string",description:"The question to ask the user. Be clear and specific."},choices:{type:"array",items:{type:"string"},description:"Optional: Predefined choices for the user to select from. If provided, user will see a menu."},allowFreeText:{type:"boolean",description:"Optional: If true, allows user to type a custom response even when choices are provided (default: false)",default:!1}},required:["question"]}}}async execute(e){let{question:t,choices:n,allowFreeText:o=!1}=e;try{let s;return n&&n.length>0?s=await this.showChoiceMenu(t,n,o):s=await this.showFreeTextInput(t),this.createToolResult(s,`User responded: ${s}`,!0)}catch(s){return this.formatError("Cannot get user input",s)}}showChoiceMenu(e,t,n){return new Promise(o=>{let s=0,i=t.map(p=>({text:p,value:p}));n&&i.push({text:"\u8F93\u5165\u81EA\u5B9A\u4E49\u7B54\u6848...",value:"__CUSTOM__"});let a=()=>{let p=i.length+5;for(let u=0;u<p;u++)u>0&&Fe.moveCursor(process.stdout,0,-1),Fe.clearLine(process.stdout,0);console.log(""),console.log(_e.cyan("\u{1F4AC} "+e)),console.log(""),console.log(_e.gray("\u8BF7\u9009\u62E9 (\u4F7F\u7528\u4E0A\u4E0B\u7BAD\u5934\u952E\uFF0CEnter\u786E\u8BA4):")),console.log(""),i.forEach((u,g)=>{let d=g===s,S=d?_e.green("> "):" ",x=d?_e.green.bold(u.text):_e.white(u.text);console.log(`${S}${x}`)}),console.log("")},c=process.stdin.isTTY?process.stdin.isRaw:!1;process.stdin.isTTY&&process.stdin.setRawMode(!0);let l=async(p,u)=>{if(u.name==="up"){s=Math.max(0,s-1),a();return}else if(u.name==="down"){s=Math.min(i.length-1,s+1),a();return}else if(u.name==="return"||u.name==="enter"){process.stdin.removeListener("keypress",l),process.stdin.isTTY&&process.stdin.setRawMode(c);let g=i.length+5;for(let S=0;S<g;S++)Fe.moveCursor(process.stdout,0,-1),Fe.clearLine(process.stdout,0);let d=i[s].value;if(d==="__CUSTOM__"){let S=await this.showFreeTextInput(e);o(S)}else o(d);return}else if(u.name==="escape"||u.ctrl&&u.name==="c"){process.stdin.removeListener("keypress",l),process.stdin.isTTY&&process.stdin.setRawMode(c);let g=i.length+5;for(let d=0;d<g;d++)Fe.moveCursor(process.stdout,0,-1),Fe.clearLine(process.stdout,0);o("__CANCELLED__");return}};process.stdin.on("keypress",l),a()})}showFreeTextInput(e){return new Promise(t=>{let n=e||"\u8BF7\u8F93\u5165\u60A8\u7684\u7B54\u6848",o=process.stdin.listeners("keypress");process.stdin.removeAllListeners("keypress");let s=Fe.createInterface({input:process.stdin,output:process.stdout});console.log(""),console.log(_e.cyan("\u{1F4AC} "+n)),console.log(""),s.question(_e.gray("\u8BF7\u8F93\u5165\u7B54\u6848: "),i=>{s.removeAllListeners(),process.stdin.pause(),o.forEach(a=>{process.stdin.on("keypress",a)}),process.stdin.resume(),t(i.trim())})})}formatAction(e){let t=e.question||"";return e.choices&&e.choices.length>0?`askUser(question="${t}", choices=[${e.choices.join(", ")}])`:`askUser(question="${t}")`}formatObservation(e){return typeof e=="string"?e==="__CANCELLED__"?"User cancelled the input":`User response: ${e}`:super.formatObservation(e)}},_i=new Tt;Sn=_i});async function Cn(r,e,t){return await Ui.execute({action:r,taskId:e,resumeFrom:t})}var bt,Ui,wn,Wi=w(()=>{G();bt=class extends I{getDefinition(){return{name:"todo",description:`Execute and manage saved task plans. Use this tool to:
|
|
1261
|
+
- Resume execution of a previously generated plan
|
|
1262
|
+
- List all available task plans
|
|
1263
|
+
- View details of a specific task plan
|
|
1264
|
+
|
|
1265
|
+
WHEN TO USE:
|
|
1266
|
+
- After generating a plan with 'plan' tool in planOnly mode
|
|
1267
|
+
- To continue execution of an interrupted task
|
|
1268
|
+
- To check status of existing tasks
|
|
1269
|
+
- To review saved task plans before execution
|
|
1270
|
+
|
|
1271
|
+
FEATURES:
|
|
1272
|
+
- Resume from any step (default: continue from last step)
|
|
1273
|
+
- View task progress and status
|
|
1274
|
+
- List all available plans in .tasks/ directory`,input_schema:{type:"object",properties:{action:{type:"string",enum:["resume","list","view"],description:"The action to perform: resume (execute a saved plan), list (show all plans), view (show plan details)"},taskId:{type:"string",description:"The task ID to resume or view. Required for resume and view actions. Format: task-YYYYMMDD-XXX"},resumeFrom:{type:"number",description:"Step number to resume from (1-based). If not specified, resumes from the first incomplete step. Use 1 to restart from the beginning."}},required:["action"]}}}async execute(e){let{action:t,taskId:n,resumeFrom:o}=e;try{switch(t){case"resume":return await this.executeResume(n,o);case"list":return await this.executeList();case"view":return await this.executeView(n);default:return this.createToolResult(`Error: Unknown action '${t}'`,`Error: Unknown action '${t}'`,!0)}}catch(s){let i=s instanceof Error?s.message:String(s);return this.createToolResult(`Error: ${i}`,`Error: ${i}`,!0)}}async executeResume(e,t){if(!e)return this.createToolResult("Error: taskId is required for resume action","Error: taskId is required for resume action",!0);try{let{resumePlanTask:n}=await Promise.resolve().then(()=>(or(),ko)),o=await n(e,t||0),s=`\u2705 \u4EFB\u52A1\u6062\u590D\u6267\u884C\u5B8C\u6210\uFF01
|
|
1275
|
+
|
|
1276
|
+
`;return s+=`**\u4EFB\u52A1 ID**: ${o.taskId}
|
|
1277
|
+
`,s+=`**\u5B8C\u6210\u6B65\u9AA4**: ${o.completedSteps}
|
|
1278
|
+
`,s+=`**\u6062\u590D\u8D77\u70B9**: \u6B65\u9AA4 ${o.resumedFrom}
|
|
1279
|
+
|
|
1280
|
+
`,s+="\u6240\u6709\u6B65\u9AA4\u5DF2\u6210\u529F\u6267\u884C\u5B8C\u6BD5\u3002",this.createToolResult(s,s,!0)}catch(n){let o=n instanceof Error?n.message:String(n);return this.createToolResult(`Error: Failed to resume task - ${o}`,`Error: Failed to resume task - ${o}`,!0)}}async executeList(){try{let{listTaskPlans:e,loadTaskPlan:t}=await Promise.resolve().then(()=>(ge(),ve)),n=e();if(n.length===0)return this.createToolResult("No saved task plans found in .tasks/ directory.","No saved task plans found in .tasks/ directory.",!0);let o=`\u{1F4CB} \u5DF2\u4FDD\u5B58\u7684\u4EFB\u52A1\u8BA1\u5212 (\u5171 ${n.length} \u4E2A)
|
|
1281
|
+
`;o+=`${"\u2550".repeat(60)}
|
|
1282
|
+
|
|
1283
|
+
`;for(let s of n){let i=t(s);if(i){let a=i.tasks.filter(p=>p.status==="completed").length,c=i.tasks.length,l=a===c?"\u2705 \u5DF2\u5B8C\u6210":a>0?`\u23F3 \u8FDB\u884C\u4E2D (${a}/${c})`:"\u{1F4CB} \u5F85\u6267\u884C";o+=`**${s}**
|
|
1284
|
+
`,o+=` \u72B6\u6001: ${l}
|
|
1285
|
+
`,o+=` \u6B65\u9AA4: ${c} \u4E2A
|
|
1286
|
+
`,o+=` \u7B56\u7565: ${i.strategy}
|
|
1287
|
+
`,o+=` \u521B\u5EFA\u65F6\u95F4: ${i.createdAt||"N/A"}
|
|
1288
|
+
`,o+=`
|
|
1289
|
+
`}}return o+=`
|
|
1290
|
+
\u{1F4A1} \u4F7F\u7528 todo(action="view", taskId="...") \u67E5\u770B\u8BE6\u60C5`,o+=`
|
|
1291
|
+
\u{1F4A1} \u4F7F\u7528 todo(action="resume", taskId="...") \u6062\u590D\u6267\u884C`,this.createToolResult(o,o,!0)}catch(e){let t=e instanceof Error?e.message:String(e);return this.createToolResult(`Error: Failed to list tasks - ${t}`,`Error: Failed to list tasks - ${t}`,!0)}}async executeView(e){if(!e)return this.createToolResult("Error: taskId is required for view action","Error: taskId is required for view action",!0);try{let{loadTaskPlan:t}=await Promise.resolve().then(()=>(ge(),ve)),n=t(e);if(!n)return this.createToolResult(`Error: Task plan '${e}' not found`,`Error: Task plan '${e}' not found`,!0);let o=`\u{1F4CB} \u4EFB\u52A1\u8BA1\u5212\u8BE6\u60C5
|
|
1292
|
+
`;o+=`${"\u2550".repeat(60)}
|
|
1293
|
+
|
|
1294
|
+
`,o+=`**\u4EFB\u52A1 ID**: ${n.taskId}
|
|
1295
|
+
`,o+=`**\u521B\u5EFA\u65F6\u95F4**: ${n.createdAt||"N/A"}
|
|
1296
|
+
`,o+=`**\u66F4\u65B0\u65F6\u95F4**: ${n.updatedAt||"N/A"}
|
|
1297
|
+
`,o+=`**\u603B\u6B65\u9AA4\u6570**: ${n.tasks.length}
|
|
1298
|
+
`,o+=`**\u89C4\u5212\u7B56\u7565**: ${n.strategy}
|
|
1299
|
+
`,o+=`**\u5F53\u524D\u72B6\u6001**: ${n.status||"N/A"}
|
|
1300
|
+
|
|
1301
|
+
`,o+=`**\u6267\u884C\u6B65\u9AA4**:
|
|
1302
|
+
`,o+=`${"\u2500".repeat(60)}
|
|
1303
|
+
`;for(let i of n.tasks){let a=i.status==="completed"?"\u2705":i.status==="in_progress"?"\u23F3":i.status==="pending"?"\u{1F4CB}":"\u2753",c=i;o+=`${i.step}. ${a} ${i.description}
|
|
1304
|
+
`,o+=` \u667A\u80FD\u4F53: ${i.subAgent}
|
|
1305
|
+
`,o+=` \u72B6\u6001: ${i.status}
|
|
1306
|
+
`,c.startTime&&(o+=` \u5F00\u59CB: ${c.startTime}
|
|
1307
|
+
`),c.endTime&&(o+=` \u5B8C\u6210: ${c.endTime}
|
|
1308
|
+
`),c.duration&&(o+=` \u8017\u65F6: ${c.duration}ms
|
|
1309
|
+
`),c.error&&(o+=` \u9519\u8BEF: ${c.error}
|
|
1310
|
+
`),o+=`
|
|
1311
|
+
`}let s=n.tasks.find(i=>i.status!=="completed");return s?o+=`
|
|
1312
|
+
\u{1F4A1} \u4F7F\u7528 todo(action="resume", taskId="${e}", resumeFrom=${s.step}) \u4ECE\u6B65\u9AA4 ${s.step} \u7EE7\u7EED\u6267\u884C`:o+=`
|
|
1313
|
+
\u2705 \u6240\u6709\u6B65\u9AA4\u5DF2\u5B8C\u6210\uFF01`,this.createToolResult(o,o,!0)}catch(t){let n=t instanceof Error?t.message:String(t);return this.createToolResult(`Error: Failed to view task - ${n}`,`Error: Failed to view task - ${n}`,!0)}}formatAction(e){let{action:t,taskId:n,resumeFrom:o}=e,s=`todo(action="${t}"`;return n&&(s+=`, taskId="${n}"`),o&&(s+=`, resumeFrom=${o}`),s+=")",s}},Ui=new bt;wn=Ui});var Mo={};U(Mo,{AskUserTool:()=>Tt,PlanTool:()=>xt,QuickProjectScanTool:()=>je,THINK_TOOL:()=>Yn,ThinkTool:()=>De,TodoTool:()=>bt,askUser:()=>yn,askUserTool:()=>Sn,extractThought:()=>Kn,isThinkTool:()=>ht,plan:()=>fn,planTool:()=>hn,quickProjectScan:()=>Ct,quickProjectScanTool:()=>wt,think:()=>dt,thinkTool:()=>ft,todo:()=>Cn,todoTool:()=>wn});var ir=w(()=>{on();ji();Ni();To();Wi()});var qi={};U(qi,{getGitDiff:()=>xn,getGitStatus:()=>vn,gitAddAll:()=>Po,gitCommit:()=>Eo,hasUncommittedChanges:()=>Tn,isGitAvailable:()=>Al});import{execSync as Ne}from"child_process";import{existsSync as Ji,writeFileSync as Pl,unlinkSync as El}from"fs";import{join as zi}from"path";import{tmpdir as Il}from"os";function Al(){try{let r=zi(process.cwd(),".git");return Ji(r)?(Ne("git --version",{stdio:"ignore"}),m("Git is available"),!0):(m("Git not available: .git directory not found"),!1)}catch(r){return m(`Git not available: ${r.message}`),!1}}function vn(){try{return Ne("git status",{encoding:"utf-8"})}catch(r){return J(`Failed to get git status: ${r.message}`),""}}function xn(){try{let r=Ne("git diff --cached",{encoding:"utf-8"}),e=Ne("git diff",{encoding:"utf-8"}),t="";return r&&(t+=`=== Staged Changes ===
|
|
1314
|
+
`+r+`
|
|
1315
|
+
`),e&&(t+=`=== Unstaged Changes ===
|
|
1316
|
+
`+e),t||"No changes detected"}catch(r){return J(`Failed to get git diff: ${r.message}`),""}}function Po(){try{Ne("git add .",{stdio:"inherit"})}catch(r){throw new Error(`Failed to stage changes: ${r.message}`)}}function Eo(r){let e=zi(Il(),`git-commit-${Date.now()}.txt`);try{Pl(e,r,"utf-8"),Ne(`git commit -F "${e}"`,{stdio:"inherit"})}catch(t){throw new Error(`Failed to commit: ${t.message}`)}finally{try{Ji(e)&&El(e)}catch(t){J(`Failed to cleanup temporary file: ${t.message}`)}}}function Tn(){try{return Ne("git status --porcelain",{encoding:"utf-8"}).trim().length>0}catch(r){return J(`Failed to check for uncommitted changes: ${r.message}`),!1}}var ar=w(()=>{H()});var Ao={};U(Ao,{FileChangeTracker:()=>$t,createFileChangeTracker:()=>cr,detectFileChanges:()=>ur,generateChangeSummary:()=>gr,getCurrentSessionFileChanges:()=>fr,getFileChangeTracker:()=>pe,getSessionFileChanges:()=>dr,handleGitCommit:()=>mr,recordFileChange:()=>pr,resetFileChangeTracker:()=>lr});import{execSync as Io}from"child_process";function pe(r){return kt||(kt=new $t(r)),kt}function cr(r){return new $t(r)}function lr(){kt&&(kt.stopWatching(),kt=null)}async function ur(r,e){return pe(e).detectFileChanges(r)}function gr(r="text"){return pe().generateChangeSummaryText(r)}function pr(r){let e={id:Ee(),filePath:r.filePath,changeType:r.changeType,timestamp:new Date().toISOString(),source:r.source||"manual",content:r.content,size:r.size};return pe().trackSessionFileChange("default-session",void 0,[e]),e}async function mr(r){return pe().handleGitCommit(r)}function dr(r){return pe().getSessionFileChanges(r)}function fr(){return pe().getCurrentSessionFileChanges()}var Ol,$t,kt,hr=w(()=>{Fn();ar();Ol={maxCommitHistory:50,enableGitIntegration:!0,trackSessionChanges:!0,autoDetectChanges:!0,excludePatterns:["node_modules",".git","dist","build","*.log",".DS_Store","*.tmp","*.temp"],maxFileSize:1024*1024,enableFileHashing:!0,gitStatusCheckInterval:5e3,maxContentLength:1e3,maxHistoryEntries:100,enableRealTimeMonitoring:!1,sessionTimeoutMinutes:60,enableChangeNotifications:!1,logLevel:"info"},$t=class{config;sessionChanges=new Map;commitHistory=[];gitStatusCache=new Map;changeCallbacks=[];isWatching=!1;gitStatusTimer;constructor(e){this.config={...Ol,...e}}async detectFileChanges(e){try{let t=[];if(this.config.enableGitIntegration){let s=await this.detectGitChanges();t.push(...s)}let n=await this.detectFilesystemChanges();t.push(...n);let o={hasChanges:t.length>0,changes:t,summary:this.generateChangeSummary(t)};return t.length>0&&this.triggerChangeCallbacks(t),o}catch(t){return console.error("\u68C0\u6D4B\u6587\u4EF6\u53D8\u66F4\u65F6\u51FA\u9519:",t),{hasChanges:!1,changes:[],summary:{totalFiles:0,addedFiles:0,modifiedFiles:0,deletedFiles:0,renamedFiles:0,totalSize:0}}}}async detectGitChanges(){let e=[];try{if(!Tn())return e;let t=vn(),n=xn(),o=this.parseGitStatus(t),s=this.getCurrentGitHash(),i=this.getCurrentBranch(),a=new Date().toISOString();for(let c of o){let l;switch(c.status){case"A":l="added";break;case"M":l="modified";break;case"D":l="deleted";break;case"R":l="renamed";break;default:continue}let p={id:Ee(),filePath:c.filePath,changeType:l,timestamp:a,source:"git-status",diff:this.config.enableFileHashing?n:void 0,commitHash:s,branch:i,checksum:this.config.enableFileHashing?await this.generateFileChecksum(c.filePath):void 0};e.push(p),this.gitStatusCache.set(c.filePath,c.status)}}catch(t){console.error("\u68C0\u6D4BGit\u53D8\u66F4\u65F6\u51FA\u9519:",t)}return e}parseGitStatus(e){let t=[];try{let n=Io("git status --porcelain",{encoding:"utf-8"});for(let o of n.trim().split(`
|
|
1317
|
+
`))if(o.length>=3){let s=o.substring(0,2).trim(),i=o.substring(3).trim();t.push({filePath:i,status:s})}}catch(n){console.warn("\u89E3\u6790Git\u72B6\u6001\u5931\u8D25:",n)}return t}getCurrentGitHash(){try{return Io("git rev-parse HEAD",{encoding:"utf-8"}).trim()}catch{return"unknown"}}getCurrentBranch(){try{return Io("git rev-parse --abbrev-ref HEAD",{encoding:"utf-8"}).trim()}catch{return"unknown"}}async detectFilesystemChanges(){return[]}generateChangeSummary(e){let t={totalFiles:e.length,addedFiles:0,modifiedFiles:0,deletedFiles:0,renamedFiles:0,totalSize:0};for(let n of e){switch(n.changeType){case"added":t.addedFiles++;break;case"modified":t.modifiedFiles++;break;case"deleted":t.deletedFiles++;break;case"renamed":t.renamedFiles++;break}n.size&&(t.totalSize+=n.size)}return t}async generateFileChecksum(e){try{return`sha256:${e}:${Date.now()}`}catch(t){return console.error("\u751F\u6210\u6587\u4EF6\u6821\u9A8C\u548C\u65F6\u51FA\u9519:",t),""}}triggerChangeCallbacks(e){for(let t of this.changeCallbacks)try{t(e)}catch(n){console.error("\u6267\u884C\u53D8\u66F4\u56DE\u8C03\u65F6\u51FA\u9519:",n)}}trackSessionFileChange(e,t,n){if(!this.config.trackSessionChanges)return;let o=this.sessionChanges.get(e),s=new Date().toISOString();if(o){let i=[...o.changes];for(let a of n){let c=i.findIndex(l=>l.filePath===a.filePath&&l.changeType===a.changeType);c>=0?i[c]=a:i.push(a)}o.changes=i,o.updatedAt=s,o.totalFiles=i.length,o.totalSize=i.reduce((a,c)=>a+(c.size||0),0)}else this.sessionChanges.set(e,{sessionId:e,taskId:t,changes:[...n],committed:!1,createdAt:s,updatedAt:s,totalFiles:n.length,totalSize:n.reduce((i,a)=>i+(a.size||0),0)})}getSessionFileChanges(e){return this.sessionChanges.get(e)}getAllSessionFileChanges(){return new Map(this.sessionChanges)}getCurrentSessionFileChanges(){let e,t="";for(let n of this.sessionChanges.values())n.updatedAt>t&&(t=n.updatedAt,e=n);return e}async handleGitCommit(e){if(!this.config.enableGitIntegration)return null;try{let t={hash:e.hash||this.getCurrentGitHash(),message:e.commitMessage,author:e.author||"Unknown",timestamp:new Date().toISOString(),branch:e.branch||this.getCurrentBranch(),files:[]};return this.commitHistory.unshift(t),this.commitHistory.length>this.config.maxCommitHistory&&(this.commitHistory=this.commitHistory.slice(0,this.config.maxCommitHistory)),this.markSessionChangesAsCommitted(t),t}catch(t){return console.error("\u5904\u7406Git\u63D0\u4EA4\u4E8B\u4EF6\u65F6\u51FA\u9519:",t),null}}markSessionChangesAsCommitted(e){for(let t of this.sessionChanges.values())!t.committed&&t.updatedAt>e.timestamp&&(t.committed=!0)}onChange(e){this.changeCallbacks.push(e)}removeChangeCallback(e){let t=this.changeCallbacks.indexOf(e);t>=0&&this.changeCallbacks.splice(t,1)}startWatching(){this.isWatching||(this.isWatching=!0,this.config.enableGitIntegration&&(this.gitStatusTimer=setInterval(async()=>{try{await this.detectFileChanges()}catch(e){console.error("\u76D1\u63A7Git\u72B6\u6001\u65F6\u51FA\u9519:",e)}},this.config.gitStatusCheckInterval)))}stopWatching(){this.isWatching&&(this.isWatching=!1,this.gitStatusTimer&&(clearInterval(this.gitStatusTimer),this.gitStatusTimer=void 0))}getCommitHistory(){return[...this.commitHistory]}cleanup(e=30){let t=new Date;t.setDate(t.getDate()-e);let n=t.toISOString();for(let[o,s]of this.sessionChanges.entries())s.updatedAt<n&&s.committed&&this.sessionChanges.delete(o);this.commitHistory=this.commitHistory.filter(o=>o.timestamp>n)}getConfig(){return{...this.config}}updateConfig(e){this.config={...this.config,...e}}generateChangeSummaryText(e="text"){let t=[];for(let s of this.sessionChanges.values())t.push(...s.changes);if(e==="json")return JSON.stringify(this.generateChangeSummary(t),null,2);let n=this.generateChangeSummary(t),o=`\u{1F4CA} \u6587\u4EF6\u53D8\u52A8\u6458\u8981
|
|
1318
|
+
|
|
1319
|
+
`;return o+=`\u{1F4C1} \u603B\u6587\u4EF6\u6570: ${n.totalFiles}
|
|
1320
|
+
`,o+=`\u2795 \u65B0\u589E\u6587\u4EF6: ${n.addedFiles}
|
|
1321
|
+
`,o+=`\u270F\uFE0F \u4FEE\u6539\u6587\u4EF6: ${n.modifiedFiles}
|
|
1322
|
+
`,o+=`\u{1F5D1}\uFE0F \u5220\u9664\u6587\u4EF6: ${n.deletedFiles}
|
|
1323
|
+
`,o+=`\u{1F504} \u91CD\u547D\u540D\u6587\u4EF6: ${n.renamedFiles}
|
|
1324
|
+
`,o+=`\u{1F4E6} \u603B\u5927\u5C0F: ${(n.totalSize/1024).toFixed(2)} KB
|
|
1325
|
+
`,o+=`
|
|
1326
|
+
\u{1F550} \u751F\u6210\u65F6\u95F4: ${new Date().toLocaleString()}`,o}},kt=null});var dn={};U(dn,{AgentTools:()=>Mo,AskUserTool:()=>Tt,BaseTool:()=>I,ConfirmableTool:()=>oe,CopyTool:()=>it,CoreTools:()=>Vr,DeleteTool:()=>ot,FileChangeTools:()=>Ao,FileChangeTracker:()=>$t,FileOpsTools:()=>ro,GlobTool:()=>ut,GrepTool:()=>gt,MergeTool:()=>at,MkdirTool:()=>nt,MoveTool:()=>st,PlanTool:()=>xt,QuickProjectScanTool:()=>je,ReadTool:()=>tt,SearchReplaceTool:()=>ct,SearchTools:()=>oo,ShellTool:()=>pt,SystemTools:()=>ao,THINK_TOOL:()=>Yn,ThinkTool:()=>De,TodoTool:()=>bt,WriteTool:()=>rt,askUser:()=>yn,askUserTool:()=>Sn,copyFile:()=>Gt,copyTool:()=>Vt,createFileChangeTracker:()=>cr,createToolResult:()=>Do,deleteFile:()=>Jt,deleteTool:()=>zt,detectFileChanges:()=>ur,extractThought:()=>Kn,extractToolResult:()=>jt,fileChangeTracking:()=>Dl,generateChangeSummary:()=>gr,getCurrentSessionFileChanges:()=>fr,getFileChangeTracker:()=>pe,getSessionFileChanges:()=>dr,glob:()=>Zt,globTool:()=>en,grep:()=>tn,grepTool:()=>nn,handleGitCommit:()=>mr,isThinkTool:()=>ht,isToolResult:()=>et,merge:()=>Bt,mergeTool:()=>Yt,mkdir:()=>Nt,mkdirTool:()=>Oe,moveFile:()=>qt,moveTool:()=>Ht,plan:()=>fn,planTool:()=>hn,quickProjectScan:()=>Ct,quickProjectScanTool:()=>wt,read:()=>Z,readTool:()=>_t,recordFileChange:()=>pr,resetFileChangeTracker:()=>lr,searchReplace:()=>Kt,searchReplaceTool:()=>Xt,shell:()=>rn,shellTool:()=>mt,think:()=>dt,thinkTool:()=>ft,todo:()=>Cn,todoTool:()=>wn,toolInstances:()=>j,tools:()=>Oo,write:()=>Ut,writeTool:()=>Wt});function Do(r,e=null,t=!0){return{__tool_result:!0,result:r,display:e!==null?e:r,shouldPrint:t}}var j,Oo,Dl,Se=w(()=>{Br();Br();Qt();Qt();Vn();Vn();Bn();Bn();ir();ir();hr();hr();Qt();Vn();Bn();ir();hr();j={think:ft,plan:hn,todo:wn,askUser:Sn,quickProjectScan:wt,read:_t,write:Wt,mkdir:Oe,glob:en,grep:nn,shell:mt,merge:Yt,deleteFile:zt,moveFile:Ht,copyFile:Vt,search_replace:Xt},Oo={think:dt,plan:fn,todo:Cn,askUser:yn,quickProjectScan:Ct,read:Z,write:Ut,mkdir:Nt,merge:Bt,glob:Zt,grep:tn,shell:rn,deleteFile:Jt,moveFile:qt,copyFile:Gt,search_replace:Kt},Dl={detectFileChanges:ur,generateChangeSummary:gr,recordFileChange:pr,handleGitCommit:mr,getSessionFileChanges:dr,getCurrentSessionFileChanges:fr,getFileChangeTracker:pe,createFileChangeTracker:cr,resetFileChangeTracker:lr}});var Hi=w(()=>{});var Ue,yr=w(()=>{H();Ue=class{config;connected=!1;tools=[];constructor(e){this.config={timeout:3e4,enabled:!0,...e}}isConnected(){return this.connected}getConfig(){return this.config}getCachedTools(){return this.tools}validateConfig(){if(!this.config.name)throw new Error("MCP server name is required");if(!this.config.transport)throw new Error("MCP transport type is required");switch(this.config.transport){case"http":case"sse":if(!this.config.url)throw new Error(`URL is required for ${this.config.transport} transport`);break;case"stdio":if(!this.config.command)throw new Error("Command is required for stdio transport");break;default:throw new Error(`Unsupported transport type: ${this.config.transport}`)}}logConnection(e){let t=`${this.config.name} (${this.config.transport})`;switch(e){case"connecting":m(`Connecting to MCP server: ${t}`);break;case"connected":M(`Connected to MCP server: ${t}`);break;case"disconnecting":m(`Disconnecting from MCP server: ${t}`);break;case"disconnected":m(`Disconnected from MCP server: ${t}`);break}}logError(e,t){q(`MCP Client Error [${this.config.name}] ${t}: ${e.message}`)}}});var bn,Ro=w(()=>{yr();H();bn=class extends Ue{sessionId;constructor(e){super(e)}async connect(){this.validateConfig(),this.logConnection("connecting");try{let e=await this.sendJsonRpcRequest("initialize",{protocolVersion:"2024-11-05",capabilities:{},clientInfo:{name:"niumagents-cli",version:"0.1.0"}});m(`MCP Server initialized: ${JSON.stringify(e)}`),this.sessionId&&m(`Session ID captured: ${this.sessionId}`),await this.sendInitializedNotification(),this.connected=!0,this.logConnection("connected"),this.tools=await this.listTools(),m(`Loaded ${this.tools.length} tools from ${this.config.name}`)}catch(e){throw this.logError(e,"connect"),e}}async disconnect(){this.logConnection("disconnecting"),this.connected=!1,this.tools=[],this.sessionId=void 0,this.logConnection("disconnected")}async listTools(){if(!this.connected)throw new Error("Not connected to MCP server");try{let t=((await this.sendJsonRpcRequest("tools/list",{})).tools||[]).map(n=>({name:n.name,description:n.description||"",inputSchema:n.inputSchema||{type:"object",properties:{}},serverName:this.config.name}));return this.config.url&&t.length>0&&(m(`MCP Server URL: ${this.config.url}`),m(`Found ${t.length} tools from MCP server ${this.config.name}:`),t.forEach(n=>{m(` - Tool: ${n.name} (${n.description})`)})),this.tools=t,t}catch(e){throw this.logError(e,"listTools"),e}}async callTool(e,t){if(!this.connected)throw new Error("Not connected to MCP server");try{m(`Calling MCP tool: ${e} on ${this.config.name}`);let n=await this.sendJsonRpcRequest("tools/call",{name:e,arguments:t});return{success:!n.isError,content:n.content||n.result,metadata:n.metadata||{}}}catch(n){return this.logError(n,`callTool(${e})`),{success:!1,error:n.message}}}async sendInitializedNotification(){if(!this.sessionId)throw new Error("No session ID available");let e={"Content-Type":"application/json",Accept:"application/json, text/event-stream","mcp-session-id":this.sessionId,...this.config.headers},t={jsonrpc:"2.0",method:"notifications/initialized"};m(`Sending initialized notification to ${this.config.url}`);let n=await fetch(this.config.url,{method:"POST",headers:e,body:JSON.stringify(t),signal:AbortSignal.timeout(this.config.timeout||3e4)});if(m(`Initialized notification status: ${n.status} ${n.statusText}`),!n.ok&&n.status!==202){let o=await n.text();throw m(`Initialized notification error: ${o.substring(0,500)}`),new Error(`Failed to send initialized notification: ${n.status}`)}}async sendJsonRpcRequest(e,t){let o={jsonrpc:"2.0",id:Date.now(),method:e};t!=null&&(o.params=t);let s={"Content-Type":"application/json",Accept:"application/json, text/event-stream",...this.config.headers};e!=="initialize"&&this.sessionId&&(s["mcp-session-id"]=this.sessionId),m(`Sending MCP request: ${e} to ${this.config.url}`),m(`Request body: ${JSON.stringify(o).substring(0,200)}`),this.sessionId&&e!=="initialize"&&m(`Using session ID: ${this.sessionId}`);let i=await fetch(this.config.url,{method:"POST",headers:s,body:JSON.stringify(o),signal:AbortSignal.timeout(this.config.timeout||3e4)});if(m(`Response status: ${i.status} ${i.statusText}`),e==="initialize"&&i.ok){let l=i.headers.get("mcp-session-id");l&&(this.sessionId=l,m(`Captured session ID from response: ${this.sessionId}`))}if(!i.ok){let l=await i.text();throw m(`Error response: ${l.substring(0,500)}`),new Error(`Server returned ${i.status}: ${i.statusText}`)}let a=await i.text();m(`Response body: ${a.substring(0,500)}`);let c=JSON.parse(a);if(c.error)throw new Error(c.error.message||"Unknown RPC error");return c.result}}});import{spawn as Rl}from"child_process";var kn,Lo=w(()=>{yr();H();kn=class extends Ue{process=null;messageId=0;pendingRequests=new Map;outputBuffer="";constructor(e){super(e)}async connect(){this.validateConfig(),this.logConnection("connecting");try{this.process=Rl(this.config.command,this.config.args||[],{env:{...process.env,...this.config.env},stdio:["pipe","pipe","pipe"]}),this.process.stdout?.on("data",t=>{this.handleOutput(t.toString())}),this.process.stderr?.on("data",t=>{J(`MCP Server stderr [${this.config.name}]: ${t.toString()}`)}),this.process.on("error",t=>{this.logError(t,"process error")}),this.process.on("exit",t=>{m(`MCP Server process exited with code ${t}`),this.connected=!1}),await new Promise(t=>setTimeout(t,500));let e=await this.sendRequest("initialize",{protocolVersion:"2024-11-05",capabilities:{}});m(`MCP Server initialized: ${JSON.stringify(e)}`),this.connected=!0,this.logConnection("connected"),this.tools=await this.listTools(),m(`Loaded ${this.tools.length} tools from ${this.config.name}`)}catch(e){throw this.logError(e,"connect"),this.process&&(this.process.kill(),this.process=null),e}}async disconnect(){this.logConnection("disconnecting"),this.process&&(this.process.kill(),this.process=null),this.connected=!1,this.tools=[],this.pendingRequests.clear(),this.logConnection("disconnected")}async listTools(){if(!this.connected)throw new Error("Not connected to MCP server");try{let t=((await this.sendRequest("tools/list",{})).tools||[]).map(n=>({name:n.name,description:n.description||"",inputSchema:n.inputSchema||{type:"object"},serverName:this.config.name}));return this.tools=t,t}catch(e){throw this.logError(e,"listTools"),e}}async callTool(e,t){if(!this.connected)throw new Error("Not connected to MCP server");try{m(`Calling MCP tool: ${e} on ${this.config.name}`);let n=await this.sendRequest("tools/call",{name:e,arguments:t});return{success:!n.isError,content:n.content||n.result,metadata:n.metadata||{}}}catch(n){return this.logError(n,`callTool(${e})`),{success:!1,error:n.message}}}sendRequest(e,t){return new Promise((n,o)=>{if(!this.process||!this.process.stdin){o(new Error("Process not available"));return}let s=++this.messageId,i={jsonrpc:"2.0",id:s,method:e,params:t};this.pendingRequests.set(s,{resolve:n,reject:o});let a=setTimeout(()=>{this.pendingRequests.delete(s),o(new Error(`Request timeout for method: ${e}`))},this.config.timeout||3e4),c=o;o=u=>{clearTimeout(a),c(u)};let l=n;n=u=>{clearTimeout(a),l(u)};let p=JSON.stringify(i)+`
|
|
1327
|
+
`;this.process.stdin.write(p),m(`Sent MCP request: ${e}`)})}handleOutput(e){this.outputBuffer+=e;let t=this.outputBuffer.split(`
|
|
1328
|
+
`);this.outputBuffer=t.pop()||"";for(let n of t)if(n.trim())try{let o=JSON.parse(n);this.handleMessage(o)}catch{J(`Failed to parse MCP message: ${n}`)}}handleMessage(e){if(e.id!==void 0){let t=this.pendingRequests.get(e.id);t&&(this.pendingRequests.delete(e.id),e.error?t.reject(new Error(e.error.message||"Unknown error")):t.resolve(e.result))}else e.method&&m(`MCP notification: ${e.method}`)}}});var Gi=w(()=>{yr();Ro();Lo()});function Mt(){return jo.getInstance()}var jo,Fo=w(()=>{Ro();Lo();H();jo=class r{static instance=null;clients=new Map;mcpTools=new Map;initialized=!1;constructor(){}static getInstance(){return r.instance||(r.instance=new r),r.instance}async initialize(e){if(this.initialized){J("MCP Manager already initialized");return}M(`Initializing ${e.length} MCP server(s)...`),e.length>0&&(m("MCP Server Configurations:"),e.forEach(t=>{m(` - Server: ${t.name} (${t.transport})`),m(` Enabled: ${t.enabled!==!1}`),t.url?m(` URL: ${t.url}`):t.command&&m(` Command: ${t.command}`)}));for(let t of e){if(t.enabled===!1){m(`Skipping disabled MCP server: ${t.name}`);continue}try{m(`Attempting to connect to MCP server ${t.name} with URL: ${t.url||"N/A"}`),await this.connectToServer(t)}catch(n){q(`Failed to connect to MCP server ${t.name}: ${n.message}`),m(`Error details for ${t.name}: ${n.message}
|
|
1329
|
+
${n.stack||""}`)}}this.initialized=!0,M(`MCP Manager initialized with ${this.clients.size} server(s) and ${this.mcpTools.size} tool(s)`)}async connectToServer(e){m(`Connecting to MCP server: ${e.name} (${e.transport})`);let t=this.createClient(e);await t.connect(),this.clients.set(e.name,t);let n=t.getCachedTools();for(let o of n)this.registerTool(o);M(`Connected to MCP server: ${e.name} (${n.length} tools)`)}createClient(e){switch(e.transport){case"http":case"sse":return new bn(e);case"stdio":return new kn(e);default:throw new Error(`Unsupported transport type: ${e.transport}`)}}registerTool(e){let t=e.name;if(this.mcpTools.has(t)){J(`MCP tool ${t} already registered, skipping (using first registered)`);return}this.mcpTools.set(t,e),m(`Registered MCP tool: ${t} from ${e.serverName}`)}getAllTools(){return Array.from(this.mcpTools.values())}getTool(e){return this.mcpTools.get(e)}hasTool(e){return this.mcpTools.has(e)}async callTool(e,t){let n=this.mcpTools.get(e);if(!n)return{success:!1,error:`MCP tool not found: ${e}`};let o=this.clients.get(n.serverName);return o?o.isConnected()?o.callTool(e,t):{success:!1,error:`MCP server not connected: ${n.serverName}`}:{success:!1,error:`MCP server not connected: ${n.serverName}`}}async disconnectAll(){m("Disconnecting all MCP servers...");for(let[e,t]of this.clients.entries())try{await t.disconnect(),m(`Disconnected from MCP server: ${e}`)}catch(n){q(`Error disconnecting from ${e}: ${n.message}`)}this.clients.clear(),this.mcpTools.clear(),this.initialized=!1,M("All MCP servers disconnected")}getStatus(){let e=Array.from(this.clients.entries()).map(([t,n])=>({name:t,connected:n.isConnected(),toolCount:n.getCachedTools().length}));return{initialized:this.initialized,serversConnected:this.clients.size,toolsAvailable:this.mcpTools.size,servers:e}}}});function Vi(r){let e={};for(let t of r)e[t.name]=new Sr(t);return e}function Bi(r){let e={};for(let t of r){let n=new Sr(t);e[t.name]=async(...o)=>n.execute(...o)}return e}var Sr,Yi=w(()=>{Fo();G();Se();H();Sr=class extends I{mcpTool;constructor(e){super(),this.mcpTool=e}getDefinition(){return{name:this.mcpTool.name,description:`[MCP:${this.mcpTool.serverName}] ${this.mcpTool.description}`,input_schema:{type:"object",properties:this.mcpTool.inputSchema.properties||{},required:this.mcpTool.inputSchema.required}}}async execute(...e){m(`Executing MCP tool: ${this.mcpTool.name}`);let t=this.argsToParams(e),o=await Mt().callTool(this.mcpTool.name,t);if(!o.success)throw new Error(o.error||"MCP tool execution failed");let s=this.formatMCPResult(o.content);return Do(s,s,!0)}argsToParams(e){if(e.length===1&&typeof e[0]=="object"&&!Array.isArray(e[0]))return e[0];let n=this.mcpTool.inputSchema.properties||{},o=Object.keys(n),s={};return e.forEach((i,a)=>{a<o.length&&(s[o[a]]=i)}),s}formatMCPResult(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>this.formatContentItem(t)).join(`
|
|
1330
|
+
|
|
1331
|
+
`):JSON.stringify(e,null,2)}formatContentItem(e){return typeof e=="string"?e:e.type==="text"?e.text||"":e.type==="image"?`[Image: ${e.data?.substring(0,50)}...]`:e.type==="resource"?`[Resource: ${e.uri||"unknown"}]`:JSON.stringify(e)}formatAction(e){let t=typeof e=="object"?Object.entries(e).map(([n,o])=>`${n}=${JSON.stringify(o)}`).join(", "):JSON.stringify(e);return`${this.mcpTool.name}(${t}) [MCP:${this.mcpTool.serverName}]`}formatObservation(e){return e&&e.__tool_result?String(e.display||e.result):String(e)}shouldPrintObservation(e){return!0}}});var _o=w(()=>{Hi();Gi();Fo();Yi()});async function Cr(){if(No){m("Tools already loaded, skipping");return}M("Loading tools..."),Pt={...j},Ki={...Oo};let r=Object.keys(j);M(`Loaded ${r.length} local tools`);let t=Mt().getAllTools();if(t.length===0){m("No MCP tools available"),No=!0;return}let n=Vi(t),o=Bi(t),s=0,i=0;for(let[a,c]of Object.entries(n)){if(Pt[a]){m(`Skipping MCP tool ${a} (local tool has priority)`),i++;continue}Pt[a]=c,Ki[a]=o[a],s++}M(`Added ${s} MCP tools, skipped ${i} (local priority)`),M(`Total tools available: ${Object.keys(Pt).length}`),No=!0}function Et(){return Pt}function Xi(){let r=Object.keys(j),e=Object.keys(Pt),t=e.filter(n=>!r.includes(n));return{local:r.length,mcp:t.length,total:e.length,localTools:r,mcpTools:t}}var Pt,Ki,No,$n=w(()=>{Se();_o();H();Pt={},Ki={},No=!1});var $o={};U($o,{TOOL_DEFINITIONS:()=>wr,getRawToolDefinitions:()=>sn,getToolDefinitions:()=>Mn,getToolNames:()=>Zi,isRealTool:()=>Ll});function Qi(r){return{name:r.name,description:r.description,input_schema:r.input_schema}}function Mn(){let r=Et();if(Object.keys(r).length===0)return wr.map(Qi);let e=[],t=["think","plan","todo","askUser"];for(let n of t)if(r[n]){let o=r[n].getDefinition();o&&e.push(o)}for(let[n,o]of Object.entries(r))if(!t.includes(n)&&o){let s=o.getDefinition();s&&e.push(s)}return e.filter(n=>n!=null).map(Qi)}function sn(){return wr}function Zi(){return wr.map(r=>r.name)}function Ll(r){return r!=="think"&&Zi().includes(r)}var wr,St=w(()=>{Se();$n();wr=[j.think.getDefinition(),j.plan.getDefinition(),j.todo.getDefinition(),j.askUser.getDefinition(),j.quickProjectScan.getDefinition(),j.read.getDefinition(),j.write.getDefinition(),j.merge.getDefinition(),j.mkdir.getDefinition(),j.glob.getDefinition(),j.grep.getDefinition(),j.deleteFile.getDefinition(),j.moveFile.getDefinition(),j.copyFile.getDefinition(),j.search_replace.getDefinition(),j.shell.getDefinition()]});function Uo(r){return!r||typeof r!="string"?0:Math.ceil(r.length/4)}function $e(r){if(!Array.isArray(r))return 0;let e=0;for(let t of r){if(t.content&&typeof t.content=="string"&&(e+=Uo(t.content)),t.tool_calls&&Array.isArray(t.tool_calls))for(let n of t.tool_calls)n.function&&(e+=Uo(n.function.name||""),e+=Uo(n.function.arguments||""));e+=4}return e}function vr(r,e){return!e||e<=0?0:r/e*100}function Wo(r,e,t=80){return vr(r,e)>=t}function Jo(r,e,t){return`\u26A0\uFE0F Token usage warning: ${r.toLocaleString()} / ${e.toLocaleString()} tokens (${t.toFixed(1)}%)`}var zo=w(()=>{});import Pn from"chalk";var xr,ea=w(()=>{zo();H();xr=class{options;constructor(e={}){this.options={enabled:e.enabled??!0,threshold:e.threshold??.8,minKeepMessages:e.minKeepMessages??3,maxKeepMessages:e.maxKeepMessages??20,targetUsageAfterCompression:e.targetUsageAfterCompression??.6,useMixedSummary:e.useMixedSummary??!0,llmSummaryTokenThreshold:e.llmSummaryTokenThreshold??500}}shouldCompress(e,t){return this.options.enabled?$e(e)/t>=this.options.threshold:!1}async compress(e,t,n){let o=$e(e),s=e.length;M(`\u5F00\u59CB\u4E0A\u4E0B\u6587\u538B\u7F29: ${s} \u6761\u6D88\u606F, ${o} tokens`);let i=this.calculateDynamicWindowSize(e,t);m(`\u52A8\u6001\u7A97\u53E3\u5927\u5C0F: \u4FDD\u7559\u6700\u8FD1 ${i} \u6761\u5B8C\u6574\u6D88\u606F`);let a=e.slice(0,-i),c=e.slice(-i);if(a.length===0)return J("\u6CA1\u6709\u9700\u8981\u538B\u7F29\u7684\u6D88\u606F,\u8DF3\u8FC7\u538B\u7F29"),{messages:e,stats:{originalMessageCount:s,originalTokenCount:o,compressedMessageCount:s,compressedTokenCount:o,compressionRatio:1,llmSummaryCount:0,heuristicSummaryCount:0}};let{summaryMessage:l,llmCount:p,heuristicCount:u}=await this.createCompressedSummary(a,n),g=[l,...c],d=$e(g),S={originalMessageCount:s,originalTokenCount:o,compressedMessageCount:g.length,compressedTokenCount:d,compressionRatio:d/o,llmSummaryCount:p,heuristicSummaryCount:u};return this.logCompressionStats(S),{messages:g,stats:S}}calculateDynamicWindowSize(e,t){let o=$e(e)/t,s;return o>=.9?(s=this.options.minKeepMessages,m("Token\u538B\u529B\u6781\u9AD8 (>=90%), \u4F7F\u7528\u6700\u5C0F\u7A97\u53E3")):o>=.85?(s=Math.floor(this.options.minKeepMessages+(this.options.maxKeepMessages-this.options.minKeepMessages)*.25),m("Token\u538B\u529B\u9AD8 (>=85%), \u4F7F\u7528\u8F83\u5C0F\u7A97\u53E3")):o>=.8?(s=Math.floor(this.options.minKeepMessages+(this.options.maxKeepMessages-this.options.minKeepMessages)*.5),m("Token\u538B\u529B\u4E2D\u7B49 (>=80%), \u4F7F\u7528\u4E2D\u7B49\u7A97\u53E3")):(s=this.options.maxKeepMessages,m("Token\u538B\u529B\u6B63\u5E38, \u4F7F\u7528\u6700\u5927\u7A97\u53E3")),Math.min(s,e.length)}async createCompressedSummary(e,t){let n=[],o=0,s=0,i=this.groupMessages(e);for(let c of i){let l=$e(c),p=this.assessMessageImportance(c),u;this.options.useMixedSummary&&p==="important"&&l>=this.options.llmSummaryTokenThreshold&&t?(u=await this.generateLLMSummary(c,t),o++,m(`\u4F7F\u7528LLM\u6458\u8981 (${c.length}\u6761\u6D88\u606F, ${l} tokens)`)):(u=this.generateHeuristicSummary(c),s++,m(`\u4F7F\u7528\u542F\u53D1\u5F0F\u6458\u8981 (${c.length}\u6761\u6D88\u606F, ${l} tokens)`)),n.push(u)}return{summaryMessage:{role:"system",content:`[\u5386\u53F2\u4E0A\u4E0B\u6587\u6458\u8981]
|
|
1332
|
+
\u4EE5\u4E0B\u662F\u4E4B\u524D\u7684\u5BF9\u8BDD\u6458\u8981,\u5DF2\u538B\u7F29\u4EE5\u8282\u7701token:
|
|
1333
|
+
|
|
1334
|
+
${n.join(`
|
|
1335
|
+
|
|
1336
|
+
---
|
|
1337
|
+
|
|
1338
|
+
`)}
|
|
1339
|
+
|
|
1340
|
+
[\u6458\u8981\u7ED3\u675F]`},llmCount:o,heuristicCount:s}}groupMessages(e){let t=[];for(let o=0;o<e.length;o+=3)t.push(e.slice(o,o+3));return t}assessMessageImportance(e){for(let t of e){if(!t.content)continue;let n=t.content.toLowerCase();if(n.includes("error")||n.includes("warning")||n.includes("\u9519\u8BEF")||n.includes("\u8B66\u544A")||t.tool_calls&&t.tool_calls.length>0||t.role==="system"||t.content&&t.content.length>1e3)return"important"}return"normal"}async generateLLMSummary(e,t){try{let{LITE_MODEL:n}=await Promise.resolve().then(()=>(te(),Ze)),o=e.filter(a=>a.content).map(a=>`${a.role}: ${a.content}`).join(`
|
|
1341
|
+
`);return`\u{1F4DD} ${(await t({model:n(),messages:[{role:"system",content:"\u4F60\u662F\u4E00\u4E2A\u5BF9\u8BDD\u6458\u8981\u52A9\u624B\u3002\u8BF7\u5C06\u4E0B\u9762\u7684\u5BF9\u8BDD\u538B\u7F29\u6210\u7B80\u6D01\u7684\u6458\u8981(\u4E0D\u8D85\u8FC7150\u5B57),\u4FDD\u7559\u5173\u952E\u64CD\u4F5C\u3001\u7ED3\u679C\u548C\u91CD\u8981\u4FE1\u606F\u3002"},{role:"user",content:o}],temperature:.1,max_tokens:200,useCompression:!0})).choices?.[0]?.message?.content?.trim()||"\u6267\u884C\u5B8C\u6210"}`}catch(n){return J(`LLM\u6458\u8981\u5931\u8D25,\u964D\u7EA7\u5230\u542F\u53D1\u5F0F\u65B9\u6CD5: ${n instanceof Error?n.message:String(n)}`),this.generateHeuristicSummary(e)}}generateHeuristicSummary(e){let t=[],n=[],o=!1;for(let i of e){if(i.tool_calls&&i.tool_calls.length>0)for(let a of i.tool_calls){let c=a.function.name;c!=="think"&&t.push(c)}if(i.content&&(i.content.includes("Error")||i.content.includes("\u9519\u8BEF"))&&(o=!0),i.content){let a=i.content.match(/\b(created|updated|fixed|implemented|tested|deployed|成功|失败|创建|更新|修复|实现)\b/gi);a&&n.push(...a.slice(0,3))}}let s=`\u6267\u884C\u4E86 ${e.length} \u8F6E\u5BF9\u8BDD`;if(t.length>0){let i=[...new Set(t)];s+=`, \u8C03\u7528\u5DE5\u5177: ${i.slice(0,3).join(", ")}`}return n.length>0&&(s+=`, \u5173\u952E\u64CD\u4F5C: ${[...new Set(n)].slice(0,3).join(", ")}`),o&&(s+=" \u26A0\uFE0F \u5305\u542B\u9519\u8BEF"),`\u{1F4AC} ${s}`}logCompressionStats(e){let t=(e.compressionRatio*100).toFixed(1),n=((1-e.compressionRatio)*100).toFixed(1);console.log(Pn.green(`
|
|
1342
|
+
\u2728 \u4E0A\u4E0B\u6587\u538B\u7F29\u5B8C\u6210`)),console.log(Pn.cyan(` \u6D88\u606F\u6570: ${e.originalMessageCount} \u2192 ${e.compressedMessageCount} (${e.compressedMessageCount-e.originalMessageCount})`)),console.log(Pn.cyan(` Token: ${e.originalTokenCount} \u2192 ${e.compressedTokenCount} (\u8282\u7701 ${n}%)`)),console.log(Pn.cyan(` \u538B\u7F29\u6BD4: ${t}%`)),console.log(Pn.cyan(` \u6458\u8981\u65B9\u5F0F: LLM ${e.llmSummaryCount}\u6B21, \u542F\u53D1\u5F0F ${e.heuristicSummaryCount}\u6B21
|
|
1343
|
+
`)),M(`\u4E0A\u4E0B\u6587\u538B\u7F29: ${e.originalMessageCount}\u6761 \u2192 ${e.compressedMessageCount}\u6761, ${e.originalTokenCount}tokens \u2192 ${e.compressedTokenCount}tokens (${t}%)`)}updateOptions(e){this.options={...this.options,...e},m(`\u538B\u7F29\u914D\u7F6E\u5DF2\u66F4\u65B0: ${JSON.stringify(this.options)}`)}getOptions(){return{...this.options}}}});var un={};U(un,{callModelAPI:()=>ee,getDefaultSystemPrompt:()=>jl});import En from"chalk";async function ee(r){let{model:e=r.useCompression?he():fe(),messages:t,temperature:n=.1,max_tokens:o,useCompression:s=!1,tools:i=Mn(),tool_choice:a,compressionOptions:c,enableAutoCompression:l=!0}=r,p=s?await Lt.getLiteProvider():await Lt.getProvider();m(`\u6A21\u578B\u8C03\u7528\u914D\u7F6E: useCompression=${s}, \u6A21\u578B=${e}, provider=${p.getProviderType()}`),s?m(`\u6B63\u5728\u4F7F\u7528\u8F7B\u91CF\u6A21\u578B: ${e}`):m(`\u6B63\u5728\u4F7F\u7528\u9ED8\u8BA4\u6A21\u578B: ${e}`),m(`\u5DE5\u5177\u6570\u91CF: ${i?i.length:0}`);let u=s?zr():Jr(),g=t,d=$e(g),S=vr(d,u),x=y=>(y/1e3).toFixed(1)+"k";if(M(`\u4F7F\u7528\u6A21\u578B: ${e}, Token usage: ${x(d)} / ${x(u)} (${S.toFixed(1)}%)`),v.currentTaskId){let y=v.tasks.find(C=>C.id===v.currentTaskId);y&&(y.tokenCount=(y.tokenCount||0)+d)}if(l&&Wo(d,u,80)){let y=Jo(d,u,S);J(y),console.log(En.yellow(`
|
|
1344
|
+
${y}`)),console.log(En.cyan(`\u{1F504} \u6B63\u5728\u81EA\u52A8\u538B\u7F29\u4E0A\u4E0B\u6587...
|
|
1345
|
+
`));let C=new xr(c);if(C.shouldCompress(g,u))try{let{messages:f,stats:k}=await C.compress(g,u,ee);g=f,d=k.compressedTokenCount,S=vr(d,u),M(`\u538B\u7F29\u540EToken\u4F7F\u7528: ${d} / ${u} (${S.toFixed(1)}%)`)}catch(f){J(`\u4E0A\u4E0B\u6587\u538B\u7F29\u5931\u8D25: ${f instanceof Error?f.message:String(f)}`),console.log(En.yellow(`\u26A0\uFE0F \u4E0A\u4E0B\u6587\u538B\u7F29\u5931\u8D25,\u5C06\u4F7F\u7528\u539F\u59CB\u6D88\u606F\u7EE7\u7EED\u6267\u884C
|
|
1346
|
+
`))}else m("\u5F53\u524D\u4E0D\u6EE1\u8DB3\u538B\u7F29\u6761\u4EF6,\u8DF3\u8FC7\u538B\u7F29")}else if(Wo(d,u,80)){let y=Jo(d,u,S);J(y),console.log(En.yellow(`
|
|
1347
|
+
${y}`)),console.log(En.yellow(`Consider archiving old messages or starting a new session.
|
|
1348
|
+
`))}m(`\u6A21\u578B\u8BF7\u6C42: ${JSON.stringify({model:e,temperature:n,max_tokens:o,messages:g.length>0?`[${g[0].role}, ..., ${g[g.length-1].role}]`:"[]",tools:i?i.length:0})}`);let h;try{h=await p.callModel({model:e,messages:g,temperature:n,max_tokens:o,tools:i,tool_choice:a})}catch(y){throw q(`\u8C03\u7528\u6A21\u578BAPI\u65F6\u53D1\u751F\u9519\u8BEF: ${y instanceof Error?y.message:String(y)}`),y instanceof Error&&y.stack&&m(`\u9519\u8BEF\u5806\u6808: ${y.stack}`),y}if(!h)throw q("\u6A21\u578B\u8FD4\u56DE undefined \u6216 null"),new Error("\u6A21\u578BAPI\u8FD4\u56DE\u7A7A\u54CD\u5E94");if(!h.choices)throw q(`\u6A21\u578B\u8FD4\u56DE\u7F3A\u5C11choices\u5B57\u6BB5: ${JSON.stringify(h)}`),new Error("\u6A21\u578BAPI\u8FD4\u56DE\u7684\u54CD\u5E94\u7F3A\u5C11choices\u5B57\u6BB5");if(!Array.isArray(h.choices)||h.choices.length===0)throw q(`\u6A21\u578B\u8FD4\u56DE\u7A7A\u7684choices\u6570\u7EC4: ${JSON.stringify(h)}`),new Error("\u6A21\u578BAPI\u8FD4\u56DE\u7684choices\u4E3A\u7A7A");return m(`\u6A21\u578B\u8FD4\u56DE: ${JSON.stringify(h)}`),h}function jl(){return"You are a helpful assistant."}var ye=w(()=>{te();ks();we();St();H();zo();ea()});var Fi={};U(Fi,{SubAgentManager:()=>br,getSubAgentManager:()=>vt});import{existsSync as Fl,readFileSync as _l,readdirSync as Nl}from"fs";import{join as Ul}from"path";import ne from"chalk";function vt(r={}){return Tr?r.matchStrategy&&Tr.setMatchStrategy(r.matchStrategy):Tr=new br(r),Tr}var br,Tr,sr=w(()=>{Pe();Cs();te();ye();Re();br=class{subAgents;agentPerformance;matchStrategy;constructor(e={}){this.subAgents=new Map,this.agentPerformance=new Map,this.matchStrategy=e.matchStrategy||"hybrid",this.loadBuiltinAgents(),this.loadSubAgents()}loadBuiltinAgents(){try{let e=Ss();console.log(ne.blue(`[\u5B50\u667A\u80FD\u4F53\u7BA1\u7406\u5668] \u52A0\u8F7D ${e.length} \u4E2A\u5185\u7F6E\u5B50\u4EE3\u7406`)),e.forEach(t=>{this.subAgents.set(t.name,t)})}catch(e){console.log(ne.red(`\u274C \u52A0\u8F7D\u5185\u7F6E\u4EE3\u7406\u5931\u8D25: ${e.message}`))}}loadSubAgents(){let e=ce("agents");if(!Fl(e)){console.log(ne.gray("[\u5B50\u667A\u80FD\u4F53\u7BA1\u7406\u5668] .nium/agents \u76EE\u5F55\u4E0D\u5B58\u5728\uFF0C\u8DF3\u8FC7\u52A0\u8F7D\u81EA\u5B9A\u4E49\u5B50\u667A\u80FD\u4F53"));return}try{let n=Nl(e).filter(o=>o.endsWith(".json")||o.endsWith(".md"));console.log(ne.blue(`[\u5B50\u667A\u80FD\u4F53\u7BA1\u7406\u5668] \u52A0\u8F7D ${n.length} \u4E2A\u81EA\u5B9A\u4E49\u5B50\u4EE3\u7406`));for(let o of n)try{let s=Ul(e,o),i=_l(s,"utf-8"),a;o.endsWith(".json")?a=JSON.parse(i):o.endsWith(".md")&&(a=this.parseFrontmatter(i)),this.validateConfig(a)?(this.subAgents.set(a.name,a),console.log(ne.green(`\u2713 \u52A0\u8F7D\u81EA\u5B9A\u4E49\u5B50\u667A\u80FD\u4F53: ${a.name}`))):console.log(ne.yellow(`\u26A0\uFE0F \u914D\u7F6E\u6587\u4EF6 ${o} \u683C\u5F0F\u65E0\u6548\uFF0C\u5DF2\u8DF3\u8FC7`))}catch(s){console.log(ne.red(`\u274C \u52A0\u8F7D\u914D\u7F6E\u6587\u4EF6 ${o} \u5931\u8D25: ${s.message}`))}}catch(t){console.log(ne.red(`\u274C \u8BFB\u53D6agents\u76EE\u5F55\u5931\u8D25: ${t.message}`))}}parseFrontmatter(e){let t=/^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/,n=e.match(t);if(!n)throw new Error("\u65E0\u6548\u7684 frontmatter \u683C\u5F0F");let[,o,s]=n,i={},a=o.split(`
|
|
1349
|
+
`);for(let c of a){let l=c.trim();if(!l)continue;let p=l.match(/^(\w+)\s*[::]\s*(.+)$/);if(p){let[,u,g]=p;u==="keywords"?i.keywords=g.split(/[,,]/).map(d=>d.trim()).filter(d=>d):i[u]=g.trim()}}return i.prompt=s.trim(),i}validateConfig(e){return!(!e||typeof e!="object"||!e.name||typeof e.name!="string"||!e.description||typeof e.description!="string"||!e.prompt||typeof e.prompt!="string")}async matchSubAgent(e){if(this.subAgents.size===0)return null;let t=Array.from(this.subAgents.values());switch(this.matchStrategy){case"semantic":return await this.matchSubAgentWithAI(e,t);case"hybrid":let n=this.matchSubAgentWithKeywords(e);if(n)return console.log(ne.green(`[\u5B50\u667A\u80FD\u4F53\u7BA1\u7406\u5668] Hybrid\u7B56\u7565 - \u5173\u952E\u8BCD\u5339\u914D\u6210\u529F: ${n.name}`)),n;let o=await this.matchSubAgentWithAI(e,t);return o&&console.log(ne.green(`[\u5B50\u667A\u80FD\u4F53\u7BA1\u7406\u5668] Hybrid\u7B56\u7565 - \u8BED\u4E49\u5339\u914D\u6210\u529F: ${o.name}`)),o;case"keyword":default:return this.matchSubAgentWithKeywords(e)}}matchSubAgentWithKeywords(e){let t=e.toLowerCase(),n=[];for(let[o,s]of this.subAgents){let i=0;if(s.keywords&&Array.isArray(s.keywords))for(let p of s.keywords)t.includes(p.toLowerCase())&&(i+=10);t.includes(o.toLowerCase())&&(i+=5);let a=s.description.toLowerCase(),c=t.split(/\s+/).filter(p=>p.length>2&&a.includes(p));i+=c.length*2;let l=this.agentPerformance.get(o);if(l){let p=l.success/l.total;i+=p*5;let u=Math.max(0,1-(Date.now()-l.lastUsed)/(7*24*60*60*1e3));i+=u*2}i>0&&n.push({agent:s,score:i})}if(n.length>0){n.sort((s,i)=>i.score-s.score);let o=n[0].agent;return console.log(ne.green(`[\u5B50\u667A\u80FD\u4F53\u7BA1\u7406\u5668] \u57FA\u4E8E\u5206\u6570\u5339\u914D\u5230\u667A\u80FD\u4F53: ${o.name} (\u5206\u6570: ${n[0].score.toFixed(1)})`)),o}return null}async matchSubAgentWithAI(e,t){let n=t.map(c=>`${c.name}: ${c.description}`).join(`
|
|
1350
|
+
`),o=fo(e,n),i=(await ee({model:he(),messages:[{role:"user",content:o}],temperature:0,max_tokens:100,useCompression:!0})).choices[0].message.content.trim();return this.getSubAgent(i)||null}recordAgentPerformance(e,t,n){let o=this.agentPerformance.get(e)||{total:0,success:0,avgTime:0,lastUsed:Date.now()};o.total++,t&&o.success++,o.avgTime=(o.avgTime*(o.total-1)+n)/o.total,o.lastUsed=Date.now(),this.agentPerformance.set(e,o)}setMatchStrategy(e){return["keyword","semantic","hybrid"].includes(e)?(this.matchStrategy=e,console.log(ne.blue(`[\u5B50\u667A\u80FD\u4F53\u7BA1\u7406\u5668] \u5339\u914D\u7B56\u7565\u5DF2\u8BBE\u7F6E\u4E3A: ${e}`)),!0):(console.error(ne.red(`[\u5B50\u667A\u80FD\u4F53\u7BA1\u7406\u5668] \u65E0\u6548\u7684\u5339\u914D\u7B56\u7565: ${e}`)),!1)}getAllSubAgents(){return Array.from(this.subAgents.values())}getSubAgent(e){return this.subAgents.get(e)||null}},Tr=null});function ta(r){let e=Wl[r],t=process.env[r]||e.defaultValue;switch(e.type){case"boolean":return t.toLowerCase()==="true";case"number":return parseFloat(t);case"string":default:return t}}function Me(r){let e=ta(r);return typeof e=="number"?e:parseFloat(String(e))}function qo(r){let e=ta(r);return typeof e=="boolean"?e:String(e).toLowerCase()==="true"}var Wl,Ho=w(()=>{Wl={USE_LLM_DISCLOSURE:{name:"USE_LLM_DISCLOSURE",defaultValue:"true",description:"\u662F\u5426\u4F7F\u7528 LLM \u667A\u80FD\u62AB\u9732\u5386\u53F2\u4FE1\u606F\u3002\u542F\u7528\u540E\uFF0C\u7CFB\u7EDF\u4F1A\u4F7F\u7528 LLM \u5206\u6790\u5E76\u7B5B\u9009\u76F8\u5173\u5386\u53F2\u4E0A\u4E0B\u6587\uFF0C\u63D0\u9AD8\u4EFB\u52A1\u6267\u884C\u7CBE\u51C6\u5EA6",type:"boolean",category:"LLM \u914D\u7F6E",example:"true"},USE_LLM_SUMMARY:{name:"USE_LLM_SUMMARY",defaultValue:"true",description:"\u662F\u5426\u4F7F\u7528 LLM \u751F\u6210\u4EFB\u52A1\u6458\u8981\u3002\u542F\u7528\u540E\uFF0C\u6BCF\u4E2A\u6B65\u9AA4\u5B8C\u6210\u65F6\u4F1A\u751F\u6210\u7B80\u6D01\u6458\u8981\u4F9B\u540E\u7EED\u6B65\u9AA4\u53C2\u8003",type:"boolean",category:"LLM \u914D\u7F6E",example:"true"},CONTEXT_COMPRESSION_INTERVAL:{name:"CONTEXT_COMPRESSION_INTERVAL",defaultValue:"15",description:"\u4E0A\u4E0B\u6587\u538B\u7F29\u95F4\u9694\uFF08\u8FED\u4EE3\u6B21\u6570\uFF09\u3002\u6BCF\u9694\u591A\u5C11\u6B21\u8FED\u4EE3\u6267\u884C\u4E00\u6B21\u4E0A\u4E0B\u6587\u538B\u7F29\uFF0C\u907F\u514D\u4E0A\u4E0B\u6587\u8FC7\u957F",type:"number",category:"\u4E0A\u4E0B\u6587\u4F18\u5316",example:"15"},CONTEXT_SEMANTIC_CHECK_INTERVAL:{name:"CONTEXT_SEMANTIC_CHECK_INTERVAL",defaultValue:"5",description:"\u8BED\u4E49\u68C0\u67E5\u95F4\u9694\uFF08\u8FED\u4EE3\u6B21\u6570\uFF09\u3002\u6BCF\u9694\u591A\u5C11\u6B21\u8FED\u4EE3\u68C0\u67E5\u4E00\u6B21\u8BED\u4E49\u504F\u79BB\u60C5\u51B5",type:"number",category:"\u4E0A\u4E0B\u6587\u4F18\u5316",example:"5"},CONTEXT_ANCHOR_INTERVAL:{name:"CONTEXT_ANCHOR_INTERVAL",defaultValue:"10",description:"\u951A\u70B9\u6CE8\u5165\u95F4\u9694\uFF08\u8FED\u4EE3\u6B21\u6570\uFF09\u3002\u6BCF\u9694\u591A\u5C11\u6B21\u8FED\u4EE3\u6CE8\u5165\u4E00\u6B21\u539F\u59CB\u4EFB\u52A1\u951A\u70B9\uFF0C\u9632\u6B62\u4EFB\u52A1\u504F\u79BB",type:"number",category:"\u4E0A\u4E0B\u6587\u4F18\u5316",example:"10"},CONTEXT_SIMILARITY_THRESHOLD:{name:"CONTEXT_SIMILARITY_THRESHOLD",defaultValue:"0.3",description:"\u8BED\u4E49\u76F8\u4F3C\u5EA6\u9608\u503C\uFF080-1\uFF09\u3002\u4F4E\u4E8E\u6B64\u9608\u503C\u8BA4\u4E3A\u8BED\u4E49\u504F\u79BB\uFF0C\u9700\u8981\u89E6\u53D1\u7EA0\u6B63\u673A\u5236",type:"number",category:"\u4E0A\u4E0B\u6587\u4F18\u5316",example:"0.3"},CONTEXT_MAX_MESSAGES:{name:"CONTEXT_MAX_MESSAGES",defaultValue:"50",description:"\u538B\u7F29\u524D\u6700\u5927\u6D88\u606F\u6570\u3002\u4E0A\u4E0B\u6587\u6D88\u606F\u6570\u8D85\u8FC7\u6B64\u503C\u65F6\u89E6\u53D1\u538B\u7F29",type:"number",category:"\u4E0A\u4E0B\u6587\u4F18\u5316",example:"50"},CONTEXT_DRIFT_THRESHOLD:{name:"CONTEXT_DRIFT_THRESHOLD",defaultValue:"0.25",description:"\u4E0A\u4E0B\u6587\u504F\u79BB\u7EA0\u6B63\u9608\u503C\uFF080-1\uFF09\u3002\u8BED\u4E49\u504F\u79BB\u5EA6\u8D85\u8FC7\u6B64\u503C\u65F6\u89E6\u53D1\u504F\u79BB\u7EA0\u6B63",type:"number",category:"\u4E0A\u4E0B\u6587\u4F18\u5316",example:"0.25"},CONTEXT_COMPRESSION_RATIO:{name:"CONTEXT_COMPRESSION_RATIO",defaultValue:"0.7",description:"\u76EE\u6807\u538B\u7F29\u7387\uFF080-1\uFF09\u3002\u538B\u7F29\u540E\u7684\u4E0A\u4E0B\u6587\u76EE\u6807\u5927\u5C0F\u76F8\u5BF9\u4E8E\u539F\u59CB\u5927\u5C0F\u7684\u6BD4\u4F8B",type:"number",category:"\u4E0A\u4E0B\u6587\u4F18\u5316",example:"0.7"}}});function na(){return{...zl,compressionInterval:Me("CONTEXT_COMPRESSION_INTERVAL"),semanticCheckInterval:Me("CONTEXT_SEMANTIC_CHECK_INTERVAL"),anchorInjectionInterval:Me("CONTEXT_ANCHOR_INTERVAL"),similarityThreshold:Me("CONTEXT_SIMILARITY_THRESHOLD"),maxMessagesBeforeCompression:Me("CONTEXT_MAX_MESSAGES"),driftCorrectionThreshold:Me("CONTEXT_DRIFT_THRESHOLD"),compressionRatioTarget:Me("CONTEXT_COMPRESSION_RATIO")}}var zl,ra=w(()=>{Ho();zl={compressionInterval:15,semanticCheckInterval:5,anchorInjectionInterval:10,similarityThreshold:.3,maxMessagesBeforeCompression:50,enableSmartCompression:!0,enableSemanticAnalysis:!0,enableAnchorSystem:!0,driftCorrectionThreshold:.25,maxContextLength:100,compressionRatioTarget:.7}});import F from"chalk";import It from"readline";function V(r,e=null){e?e.log(r):console.log(r)}function oa(r,e=null){e?e.info(r):console.log(F.blue(r))}function sa(r,e=null){e?e.success(r):console.log(F.green(r))}function In(r,e=null){e?e.warning(r):console.log(F.yellow(r))}function Go(r,e=null){In(r,e)}function We(r,e=null){e?e.error(r):console.log(F.red(r))}async function kr(r,e=!1,t=null){let n,o=null,s=null,i=na();if(m("Initializing react loop with think-tool support"),e&&v.messages&&v.messages.length>0)m(`Resuming existing session: ${v.sessionId}`),n=v.messages,M(`\u6062\u590D\u4F1A\u8BDD [ID:${v.sessionId.substring(0,8)}]: ${v.currentTask}`),sa(F.green(`\u4ECE ${v.updatedAt} \u6062\u590D\u4E4B\u524D\u7684\u4F1A\u8BDD [ID:${v.sessionId.substring(0,8)}]`),t),V(F.gray(`\u4E4B\u524D\u7684\u4EFB\u52A1: ${v.currentTask}`),t),v.tasks&&v.tasks.length>0&&V(F.gray(`\u4F1A\u8BDD\u4E2D\u4EFB\u52A1\u6570\u91CF: ${v.tasks.length}`),t),V("",t);else if(r)m(`Starting new task: ${r.substring(0,50)}${r.length>50?"...":""}`),n=[{role:"system",content:yt},{role:"user",content:r}],oa(`\u5F00\u59CB\u65B0\u4EFB\u52A1: ${r}`),i.enableAnchorSystem&&(o=new gn(r),m("\u4E0A\u4E0B\u6587\u951A\u5B9A\u7BA1\u7406\u5668\u5DF2\u521D\u59CB\u5316")),i.enableSemanticAnalysis&&(s=new pn(ee),m("\u8BED\u4E49\u5206\u6790\u5668\u5DF2\u521D\u59CB\u5316")),_n(r),Q(n,r);else{We("No user request provided and no session to resume");return}let a=0,c=100,l=0;for(m(`Starting execution loop with max ${c} iterations`);a<c;){a++,m(`Loop iteration ${a}`);try{if(i.enableSemanticAnalysis&&s&&o&&a-l>=i.semanticCheckInterval)try{let y=n.map(f=>f.content).filter(Boolean).join(`
|
|
1351
|
+
`),C=await s.analyzeSemanticDrift(r||o.getOriginalQuestion(),y,a);if(m(`\u8BED\u4E49\u5206\u6790 - \u76F8\u4F3C\u5EA6: ${C.similarityScore.toFixed(2)}, \u504F\u79BB\u7EA7\u522B: ${C.driftLevel}`),C.driftLevel==="severe"||C.driftLevel==="moderate"&&C.similarityScore<i.similarityThreshold)if(In(`\u26A0\uFE0F \u68C0\u6D4B\u5230${C.driftLevel==="severe"?"\u4E25\u91CD":"\u4E2D\u5EA6"}\u504F\u79BB\uFF0C\u6B63\u5728\u7EA0\u6B63...`,t),o){let f=`\u68C0\u6D4B\u5230${C.driftLevel}\u504F\u79BB\uFF1A${C.deviationFactors.join("; ")}`,k=await o.createAnchorMessage(a,C.similarityScore,C.driftLevel,f,y);m(`\u{1F3AF} \u6CE8\u5165\u504F\u79BB\u7EA0\u6B63\u951A\u70B9\uFF08\u8FED\u4EE3 ${a}\uFF0C\u504F\u79BB\u7EA7\u522B: ${C.driftLevel}\uFF0C\u4F18\u5148\u7EA7: ${k.metadata?.priority}}`),n.push(k)}else{let f=s.generateCorrectionPrompt(r||o.getOriginalQuestion(),C.driftLevel,C.deviationFactors);n.push({role:"system",content:f})}l=a}catch(y){Go(`\u8BED\u4E49\u5206\u6790\u5931\u8D25: ${y.message}`,t)}if(i.enableAnchorSystem&&o&&a%i.anchorInjectionInterval===0)try{let y=n.map(f=>f.content).filter(Boolean).join(`
|
|
1352
|
+
`),C=await o.calculateSemanticSimilarity(y);if(await o.shouldInjectAnchor(a,C,y)){let f=await o.createAnchorMessage(a,C,void 0,void 0,y);m(`\u{1F3AF} \u6CE8\u5165\u4E0A\u4E0B\u6587\u951A\u70B9\uFF08\u8FED\u4EE3 ${a}\uFF0C\u76F8\u4F3C\u5EA6: ${C.toFixed(2)}\uFF0C\u4F18\u5148\u7EA7: ${f.metadata?.priority}}`),n.push(f)}}catch(y){Go(`\u951A\u70B9\u6CE8\u5165\u5931\u8D25: ${y.message}`,t)}Q(n);let p=fe();t&&V(F.gray(`[\u8FED\u4EE3 ${a}] \u4F7F\u7528\u6A21\u578B: ${p}`),t),m("Calling Model API with all tools including think");let u=await ee({model:p,messages:n,temperature:.1,tools:Mn(),tool_choice:void 0});if(!u||!u.choices||u.choices.length===0){let y=`\u6A21\u578B\u8FD4\u56DE\u65E0\u6548\u54CD\u5E94: ${JSON.stringify(u)}`;throw We(y),new Error(y)}let{choices:g}=u,d=g[0],S=d?.message,x=null,h=null;if(S&&({content:x,tool_calls:h}=S,x&&x.trim())){if(m(`Model returned text content: ${x.substring(0,100)}...`),!h||h.length===0){sa(F.green(`
|
|
1353
|
+
\u6700\u7EC8\u7B54\u6848:`),t),V(F.white(x),t),V("",t),n.push({role:"assistant",content:x}),M("\u4EFB\u52A1\u5B8C\u6210,\u5F52\u6863\u4F1A\u8BDD"),Xe(),m("Breaking out of react loop after final answer");return}V(F.magenta(`\u{1F4AD} \u601D\u8003: ${x}`),t),V("",t)}if(h&&h.length>0){let y=h[0],C=y.function.name,f=y.function.arguments;m(`Tool call: ${C} with args: ${f}`);let k;try{k=JSON.parse(f)}catch{We(`Failed to parse tool arguments: ${f}`),n.push({role:"user",content:`Error: Invalid JSON in tool arguments: ${f}`});continue}if(ht(C)){let E=k.thought||"";V(F.magenta(`\u601D\u8003: ${E}`),t),V("",t),n.push({role:"assistant",content:x||null,tool_calls:[y]}),n.push({role:"tool",tool_call_id:y.id,content:"Noted. Continue."});continue}let P=Et()[C];if(!P){let E=`Unknown tool: ${C}`;We(E),n.push({role:"assistant",content:x||null,tool_calls:[y]}),n.push({role:"tool",tool_call_id:y.id,content:E});continue}let $=P.formatAction(k);V(F.cyan(`\u884C\u52A8: ${$}`),t),V("",t);try{let E=!1;if(C==="shell"&&P&&typeof P.getDynamicDefinition=="function"?E=P.getDynamicDefinition(k).requiresConfirmation||!1:E=sn().find(ze=>ze.name===C)?.requiresConfirmation||!1,E&&!await ql(C,k,t)){let ze=`\u5DE5\u5177\u6267\u884C\u5DF2\u53D6\u6D88: ${C}`;M(ze),In(F.yellow(`\u26A0 ${ze}`),t),V(F.gray("\u60A8\u53EF\u4EE5\u7EE7\u7EED\u63D0\u4F9B\u65B0\u7684\u6307\u4EE4\u6216\u4FEE\u6539\u4E4B\u524D\u7684\u8BF7\u6C42\u3002"),t),n.push({role:"assistant",content:x||null,tool_calls:[y]}),n.push({role:"tool",tool_call_id:y.id,content:"Execution cancelled by user"});continue}m(`\u6267\u884C\u5DE5\u5177: ${C}(${JSON.stringify(k)})`);let D=await Promise.resolve(P.execute(k));m(`\u5DE5\u5177 ${C} \u6267\u884C\u5B8C\u6210`);let me=jt(D),R=P?P.shouldPrintObservation(D):!0,Je=`${P?P.formatObservation(D):String(D)}`;R&&(V(F.yellow(`\u{1F4CA} \u89C2\u5BDF: ${Je}`),t),V("",t)),n.push({role:"assistant",content:x||null,tool_calls:[y]}),n.push({role:"tool",tool_call_id:y.id,content:String(me)})}catch(E){let D=`\u5DE5\u5177\u6267\u884C\u9519\u8BEF: ${C} - ${E.message}`;q(D),We(D,t),V("",t),n.push({role:"assistant",content:x||null,tool_calls:[y]}),n.push({role:"tool",tool_call_id:y.id,content:`Error: ${D}`}),Q(n,r)}}if((!x||!x.trim())&&(!h||h.length===0)){if(Go("Model returned empty response"),d.finish_reason==="stop"){In("\u4EFB\u52A1\u5B8C\u6210(\u6A21\u578B\u505C\u6B62)",t),Xe(),m("Breaking out of react loop after model stop");return}n.push({role:"user",content:"Please continue or provide your final answer."})}}catch(p){We(`\u9519\u8BEF: ${p.message}`,t),In("\u4F1A\u8BDD\u5DF2\u4FDD\u5B58\u3002\u4F7F\u7528 /resume \u7EE7\u7EED\u3002",t),Q(n,r);return}}if(a>=c){if(We("\u9519\u8BEF: \u5DF2\u8FBE\u5230\u6700\u5927\u8FED\u4EE3\u6B21\u6570",t),o){let p=o.generateAnchorPrompt(a);oa("\u{1F4CA} \u6700\u7EC8\u4E0A\u4E0B\u6587\u72B6\u6001:",t),V(p,t);let u=Math.floor(a/i.compressionInterval),g=Math.floor(a/i.anchorInjectionInterval),d=Math.floor(a/i.semanticCheckInterval);m(`\u4F18\u5316\u7EDF\u8BA1: \u538B\u7F29${u}\u6B21, \u951A\u70B9\u6CE8\u5165${g}\u6B21, \u8BED\u4E49\u68C0\u67E5${d}\u6B21`)}Q(n,r)}}async function ql(r,e,t=null){return new Promise(n=>{let o=0,s=[{text:"\u786E\u8BA4\u6267\u884C",value:!0},{text:"\u4E2D\u65AD\u6267\u884C",value:!1}],i=JSON.stringify(e),a=()=>{for(let u=0;u<8;u++)It.moveCursor(process.stdout,0,-1),It.clearLine(process.stdout,0);let p=t?F.yellow(`\u26A0 \u786E\u8BA4\u6267\u884C ${r}(${i})\uFF1F\u6B64\u64CD\u4F5C\u53EF\u80FD\u65E0\u6CD5\u64A4\u9500\u3002`):F.yellow(`\u26A0 Confirm execution of ${r}(${i})? This action may be irreversible.`);console.log(""),console.log(p),console.log(""),console.log(F.cyan("\u8BF7\u9009\u62E9 (\u4F7F\u7528\u4E0A\u4E0B\u7BAD\u5934\u952E\uFF0CEnter\u786E\u8BA4):")),console.log(""),s.forEach((u,g)=>{let d=g===o,S=d?F.green("> "):" ",x=d?F.green.bold(u.text):F.white(u.text);console.log(`${S}${x}`)}),console.log("")},c=process.stdin.isTTY?process.stdin.isRaw:!1;process.stdin.isTTY&&process.stdin.setRawMode(!0);let l=(p,u)=>{if(u.name==="up")return o=Math.max(0,o-1),a(),!1;if(u.name==="down")return o=Math.min(s.length-1,o+1),a(),!1;if(u.name==="return"||u.name==="enter"){process.stdin.removeListener("keypress",l),process.stdin.isTTY&&process.stdin.setRawMode(c);for(let g=0;g<8;g++)It.moveCursor(process.stdout,0,-1),It.clearLine(process.stdout,0);return n(s[o].value),!1}else if(u.name==="escape"||u.ctrl&&u.name==="c"){process.stdin.removeListener("keypress",l),process.stdin.isTTY&&process.stdin.setRawMode(c);for(let g=0;g<8;g++)It.moveCursor(process.stdout,0,-1),It.clearLine(process.stdout,0);return n(!1),!1}};process.stdin.on("keypress",l),a()})}var Vo=w(()=>{te();ye();Re();Se();$n();on();we();H();St();yo();So();ra()});import _ from"chalk";async function ia(r,e=!1,t=null,n={}){await new An(t,n).executeTask(r,e)}var An,aa=w(()=>{sr();ge();Vo();Re();we();H();Co();or();Qn();An=class{session;subAgentManager;orchestratorContext;progressiveDisclosure;workerContextBuilder;summaryExtractor;options;constructor(e=null,t={}){this.session=e,bo(e);let n={matchStrategy:t.matchStrategy};this.subAgentManager=vt(n),this.orchestratorContext=new xe,this.progressiveDisclosure=new Te(this.orchestratorContext),this.workerContextBuilder=new be(this.orchestratorContext,this.progressiveDisclosure),this.summaryExtractor=new ke,this.options={useLLMDisclosure:t.useLLMDisclosure!==void 0?t.useLLMDisclosure:!0,useLLMSummary:t.useLLMSummary!==void 0?t.useLLMSummary:!0,verbose:t.verbose||!1}}log(e){this.session?this.session.log(e):console.log(e)}info(e){this.session?this.session.info(e):console.log(_.blue(e))}success(e){this.session?this.session.success(e):console.log(_.green(e))}warning(e){this.session?this.session.warning(e):console.log(_.yellow(e))}error(e){this.session?this.session.error(e):console.log(_.red(e))}async executeTask(e,t=!1){try{if(m("MasterAgent.executeTask called"),t){m("Entering resume session mode"),this.info("\u6062\u590D\u4F1A\u8BDD\u6A21\u5F0F"),await kr(e,!0,this.session);return}let{evaluateTaskComplexity:n,TaskComplexity:o}=await Promise.resolve().then(()=>(ge(),ve));await n(e)===o.COMPLEX?await this.executeWithPlanning(e):await this.executeWithSingleAgent(e),this.log(""),this.success("\u2705 \u4EFB\u52A1\u6267\u884C\u5B8C\u6210"),this.options.verbose&&(this.log(""),this.log(_.gray("\u2550\u2550\u2550 \u5168\u5C40\u4E0A\u4E0B\u6587\u6458\u8981 \u2550\u2550\u2550")),this.log(_.gray(JSON.stringify(this.orchestratorContext.getCompactSummary(),null,2))))}catch(n){throw this.error(`\u274C \u4EFB\u52A1\u6267\u884C\u5931\u8D25: ${n.message}`),n}}async executeWithSingleAgent(e){await this.ensureProjectStructure();let t={markdown:"",tasks:[{step:1,description:e,status:"pending",subAgent:"default"}],taskId:"",strategy:"single-agent",totalSteps:1};this.orchestratorContext.initializeTask(e,t);let n=await this.subAgentManager.matchSubAgent(e);if(n){this.info(`\u5339\u914D\u5230\u4E13\u7528\u5B50\u667A\u80FD\u4F53: ${n.name}`),this.log("");let o=await this.workerContextBuilder.buildIsolatedContext(1,e,n.prompt,!1,void 0);await this.executeSubAgentTask(1,e,n,o)}else this.info("\u4F7F\u7528\u9ED8\u8BA4React\u667A\u80FD\u4F53"),this.log(""),await kr(e,!1,this.session)}async executeWithPlanning(e){let t=this.subAgentManager.getAllSubAgents(),n=await an(e,t);this.orchestratorContext.initializeTask(e,n),n.taskId&&Ke(n.taskId),this.log(cn(n)),this.log(""),await this.ensureProjectStructure(),await this.loadProjectRules(),this.analyzeStepDependencies(n);for(let o=0;o<n.tasks.length;o++){let s=n.tasks[o],i=s.step;this.log(""),this.info(`\u2501\u2501\u2501 \u6267\u884C\u6B65\u9AA4 ${i}/${n.tasks.length} \u2501\u2501\u2501`),this.log(_.cyan(`\u{1F4CC} ${s.description}`)),this.log(""),this.orchestratorContext.plan.currentStep=i,n.taskId&&await Le(n.taskId,i,"in_progress");try{let a=this.getSubAgentConfig(s),c=await this.workerContextBuilder.buildIsolatedContext(i,s.description,a?.prompt||"",this.options.useLLMDisclosure);this.options.verbose&&this.log(_.gray(`\u4E0A\u4E0B\u6587\u5927\u5C0F: ${c.length} \u6761\u6D88\u606F`)),a?await this.executeSubAgentTask(i,s.description,a,c):await this.executeDefaultAgentWithContext(s.description,c),this.success(`\u2705 \u6B65\u9AA4 ${i} \u5B8C\u6210`),n.taskId&&await Le(n.taskId,i,"completed")}catch(a){throw this.error(`\u274C \u6B65\u9AA4 ${i} \u6267\u884C\u5931\u8D25: ${a.message}`),this.warning("\u4E2D\u6B62\u540E\u7EED\u6B65\u9AA4\u6267\u884C"),this.orchestratorContext.recordStepCompletion(i,`\u5931\u8D25: ${a.message}`,{success:!1,error:a.message}),a}}}async ensureProjectStructure(){try{let{existsSync:e}=await import("fs");if(e(".nium/project/project.json")){m("project.json \u5DF2\u5B58\u5728\uFF0C\u8DF3\u8FC7\u81EA\u52A8\u751F\u6210");return}this.log(""),this.info("\u{1F4CB} \u68C0\u6D4B\u5230\u9879\u76EE\u7ED3\u6784\u6587\u6863\u4E0D\u5B58\u5728\uFF0C\u6267\u884C\u5FEB\u901F\u626B\u63CF..."),this.log("");let{tools:n}=await Promise.resolve().then(()=>(Se(),dn));await n.quickProjectScan(),this.success("\u2705 \u9879\u76EE\u7ED3\u6784\u6587\u6863\u5DF2\u751F\u6210"),this.log(""),M("\u5DF2\u81EA\u52A8\u751F\u6210 project.json")}catch(e){m(`\u81EA\u52A8\u751F\u6210\u9879\u76EE\u7ED3\u6784\u6587\u6863\u5931\u8D25: ${e.message}`),this.warning("\u9879\u76EE\u7ED3\u6784\u6587\u6863\u751F\u6210\u5931\u8D25\uFF0C\u5C06\u7EE7\u7EED\u6267\u884C\u4EFB\u52A1")}}async loadProjectRules(){try{let{tools:e,toolInstances:t,extractToolResult:n}=await Promise.resolve().then(()=>(Se(),dn)),o="",i=e.read(".nium/rules.md");i&&!i.includes("Error:")&&(o+=i,M("\u5DF2\u52A0\u8F7D\u9879\u76EE\u89C4\u5219\u6587\u4EF6"));let c=e.read(".nium/project/project.json");if(c&&!c.includes("Error:")){o&&(o+=`
|
|
1354
|
+
|
|
1355
|
+
---
|
|
1356
|
+
|
|
1357
|
+
`),o+=`# \u9879\u76EE\u7ED3\u6784\u4FE1\u606F
|
|
1358
|
+
|
|
1359
|
+
`;try{let l=JSON.parse(c);o+=this.formatProjectStructureInfo(l),M("\u5DF2\u52A0\u8F7D\u9879\u76EE\u7ED3\u6784\u6587\u6863")}catch{o+=c,m("\u89E3\u6790\u9879\u76EE\u7ED3\u6784JSON\u5931\u8D25\uFF0C\u4F7F\u7528\u539F\u59CB\u5185\u5BB9")}}o&&this.orchestratorContext.updateSharedState("rules",o)}catch{m("\u52A0\u8F7D\u9879\u76EE\u6587\u6863\u65F6\u51FA\u9519\uFF0C\u8DF3\u8FC7")}}analyzeStepDependencies(e){for(let t=0;t<e.tasks.length;t++){let n=e.tasks[t].step,o=t>0?[e.tasks[t-1].step]:[];this.orchestratorContext.setStepDependencies(n,o)}m("\u6B65\u9AA4\u4F9D\u8D56\u5173\u7CFB\u5DF2\u5206\u6790")}getSubAgentConfig(e){return e.subAgent&&e.subAgent!=="default"?this.subAgentManager.getSubAgent(e.subAgent):null}async executeSubAgentTask(e,t,n,o){let s=Date.now();this.info(`\u{1F527} \u4F7F\u7528\u5B50\u667A\u80FD\u4F53: ${n.name}`),this.log(_.gray(`\u63CF\u8FF0: ${n.description}`)),this.log("");try{let i=[{role:"system",content:yt},...o.filter(l=>l.role!=="system"),...o.filter(l=>l.role==="system"&&l!==o[0])],a=await this.runWorkerLoop(i,t);await this.recordWorkerResult(e,a);let c=Date.now()-s;this.subAgentManager.recordAgentPerformance(n.name,!0,c)}catch(i){let a=Date.now()-s;throw this.subAgentManager.recordAgentPerformance(n.name,!1,a),i}}async executeDefaultAgentWithContext(e,t){this.info("\u{1F916} \u4F7F\u7528\u9ED8\u8BA4React\u667A\u80FD\u4F53"),this.log("");let n=[{role:"system",content:yt},...t.filter(o=>o.role!=="system"),...t.filter(o=>o.role==="system")];await this.runWorkerLoop(n,e)}async runWorkerLoop(e,t){let{MODEL:n}=await Promise.resolve().then(()=>(te(),Ze)),{callModelAPI:o}=await Promise.resolve().then(()=>(ye(),un)),{isThinkTool:s,extractThought:i}=await Promise.resolve().then(()=>(on(),lo)),{getToolDefinitions:a}=await Promise.resolve().then(()=>(St(),$o)),{tools:c,toolInstances:l,extractToolResult:p}=await Promise.resolve().then(()=>(Se(),dn)),u=[...e],g=0,d=50;for(;g<d;){g++;try{Q(u,t);let S=await o({model:n(),messages:u,temperature:.1,tools:a()}),x=S.choices[0].message.tool_calls;if(S.choices[0].finish_reason==="stop"){let{content:R}=S.choices[0].message;R&&R.trim()&&(this.log(_.green("\u4EFB\u52A1\u5B8C\u6210:")),this.log(R),this.log(""));break}if(!x||x.length===0){let{content:R}=S.choices[0].message;R&&R.trim()&&(this.log(_.yellow(R)),this.log(""));continue}let h=x[0],y=h.function.name,C;try{C=JSON.parse(h.function.arguments),this.log(_.gray(`[DEBUG] Tool: ${y}`)),this.log(_.gray(`[DEBUG] Raw arguments: ${h.function.arguments.substring(0,200)}${h.function.arguments.length>200?"...":""}`)),this.log(_.gray(`[DEBUG] Parsed keys: ${Object.keys(C).join(", ")}`)),this.log("")}catch{this.error(`\u89E3\u6790\u5DE5\u5177\u53C2\u6570\u5931\u8D25: ${h.function.arguments}`),u.push({role:"assistant",content:null,tool_calls:[h]}),u.push({role:"tool",tool_call_id:h.id,content:"Error: Invalid JSON arguments"});continue}if(s(y)){let R=i(h);R&&(this.log(_.cyan(`\u{1F4AD} Think: ${R}`)),this.log("")),u.push({role:"assistant",content:null,tool_calls:[h]}),u.push({role:"tool",tool_call_id:h.id,content:"Noted. Continue with your action."});continue}if(!c[y]){let R=`Error: Unknown tool '${y}'`;this.error(R),u.push({role:"assistant",content:null,tool_calls:[h]}),u.push({role:"tool",tool_call_id:h.id,content:R});continue}let f=a().find(R=>R.name===y),k;if(f&&f.input_schema&&f.input_schema.properties){k=Object.keys(f.input_schema.properties).map(X=>C[X]);let ae=f.input_schema.required||[],Je=ae.filter(X=>C[X]===void 0);if(Je.length>0){let X=`Error: Missing required parameters: ${Je.join(", ")}
|
|
1360
|
+
|
|
1361
|
+
Tool: ${y}
|
|
1362
|
+
Required parameters: ${ae.join(", ")}
|
|
1363
|
+
Provided parameters: ${Object.keys(C).join(", ")||"none"}
|
|
1364
|
+
|
|
1365
|
+
Please call the tool again with ALL required parameters.`;this.error(X),u.push({role:"assistant",content:null,tool_calls:[h]}),u.push({role:"tool",tool_call_id:h.id,content:X});continue}}else k=Object.values(C);let b=l[y],P=b?b.formatAction(C):`${y}()`;this.log(_.blue(`\u{1F527} \u884C\u52A8: ${P}`)),this.log("");let $=await c[y](...k),E=p($),D=b?b.shouldPrintObservation($):!0,me=b?b.formatObservation($):String($);D&&(this.log(_.yellow(`\u{1F4CA} \u89C2\u5BDF: ${me}`)),this.log("")),u.push({role:"assistant",content:null,tool_calls:[h]}),u.push({role:"tool",tool_call_id:h.id,content:String(E)}),["read","write","merge"].includes(y)&&k[0]&&this.orchestratorContext.addRecentFile(k[0]),Q(u,t)}catch(S){throw this.error(`\u9519\u8BEF: ${S.message}`),Q(u,t),S}}if(g>=d)throw this.error("\u9519\u8BEF: \u5DF2\u8FBE\u5230\u6700\u5927\u8FED\u4EE3\u6B21\u6570"),Q(u,t),new Error("Maximum iterations reached");return u}async recordWorkerResult(e,t){let n;this.options.useLLMSummary?n=await this.summaryExtractor.extractSummaryWithLLM(t):n=await this.summaryExtractor.extractSummary(t);let o=this.summaryExtractor.extractMetadata(t);o.success=!0,this.orchestratorContext.recordStepCompletion(e,n,o),this.options.verbose&&this.info(`\u6B65\u9AA4 ${e} \u6458\u8981\u5DF2\u8BB0\u5F55\u5230\u5168\u5C40\u4E0A\u4E0B\u6587`),this.options.verbose&&(this.log(""),this.log(_.gray("\u2500\u2500\u2500 \u6B65\u9AA4\u6267\u884C\u6458\u8981 \u2500\u2500\u2500")),this.log(_.gray(`\u6458\u8981: ${n}`)),this.log(_.gray(`\u5DE5\u5177: ${o.toolsUsed.join(", ")}`)),this.log(_.gray(`\u6587\u4EF6: ${o.filesAccessed.join(", ")}`)),this.log(_.gray(`\u8FED\u4EE3: ${o.iterations} \u6B21`)))}formatProjectStructureInfo(e){return ln(e,{format:"markdown",detailed:!0,customTitle:`# \u9879\u76EE\u7ED3\u6784\u4FE1\u606F
|
|
1366
|
+
`})}}});import{readFileSync as Hl}from"fs";import{join as Gl}from"path";function Vl(){let r={useLLMDisclosure:!0,useLLMSummary:!0};try{let e=Gl(process.cwd(),".nium",".env"),n=Hl(e,"utf-8").split(`
|
|
1367
|
+
`);for(let o of n)if(o.startsWith("USE_LLM_DISCLOSURE=")){let s=o.split("=")[1]?.trim()||"";m(`[\u914D\u7F6E\u8BFB\u53D6] \u4ECE .nium/.env \u6587\u4EF6\u4E2D\u8BFB\u53D6: USE_LLM_DISCLOSURE=${s}`),r.useLLMDisclosure=s.toLowerCase()==="true"}else if(o.startsWith("USE_LLM_SUMMARY=")){let s=o.split("=")[1]?.trim()||"";m(`[\u914D\u7F6E\u8BFB\u53D6] \u4ECE .nium/.env \u6587\u4EF6\u4E2D\u8BFB\u53D6: USE_LLM_SUMMARY=${s}`),r.useLLMSummary=s.toLowerCase()==="true"}}catch(e){m(`[\u914D\u7F6E\u8BFB\u53D6] \u65E0\u6CD5\u8BFB\u53D6 .nium/.env \u6587\u4EF6: ${e.message}`)}return process.env.USE_LLM_DISCLOSURE!==void 0&&(m(`[\u914D\u7F6E\u8BFB\u53D6] \u4ECE\u73AF\u5883\u53D8\u91CF\u4E2D\u8BFB\u53D6: USE_LLM_DISCLOSURE=${process.env.USE_LLM_DISCLOSURE}`),r.useLLMDisclosure=qo("USE_LLM_DISCLOSURE")),process.env.USE_LLM_SUMMARY!==void 0&&(m(`[\u914D\u7F6E\u8BFB\u53D6] \u4ECE\u73AF\u5883\u53D8\u91CF\u4E2D\u8BFB\u53D6: USE_LLM_SUMMARY=${process.env.USE_LLM_SUMMARY}`),r.useLLMSummary=qo("USE_LLM_SUMMARY")),r}async function Bo(){try{let r=Vl();return M("[\u914D\u7F6E\u8BFB\u53D6] \u4F7F\u7528\u4E3B\u667A\u80FD\u4F53\uFF08\u4E0A\u4E0B\u6587\u9694\u79BB\u6A21\u5F0F\uFF09"),{executeMasterAgent:ia,MasterAgent:An,config:r}}catch(r){throw q(`[\u914D\u7F6E\u8BFB\u53D6] \u914D\u7F6E\u8BFB\u53D6\u51FA\u9519: ${r}`),r}}var ca=w(()=>{aa();Vo();H();Ho()});var ga={};U(ga,{COMMANDS:()=>On,executeCommand:()=>$r,findCommand:()=>ua,getAvailableCommands:()=>Dn,initializeDynamicCommands:()=>nu,printCommandHelp:()=>Yo});import A from"chalk";async function Bl(r,e){if(!r){e.warning("\u8BF7\u63D0\u4F9B\u4EFB\u52A1\u8BF7\u6C42\u5185\u5BB9");return}e.log(),e.info("\u5F00\u59CB\u5904\u7406\u4EFB\u52A1..."),e.log();try{let{executeMasterAgent:t,config:n}=await Bo();await t(r,!1,e,n),e.log(),v.sessionId&&(e.log(A.gray(`\u5F53\u524D\u4F1A\u8BDD ID: ${v.sessionId.substring(0,8)}`)),v.tasks&&v.tasks.length>0&&e.log(A.gray(`\u5F53\u524D\u4F1A\u8BDD\u4EFB\u52A1\u6570: ${v.tasks.length}`)),e.log())}catch(t){throw e.error(`\u4EFB\u52A1\u5904\u7406\u5931\u8D25: ${t.message}`),t}}async function Yl(r){if(v.messages&&v.messages.length>0&&v.currentTask){r.log(),r.info(`\u6B63\u5728\u6062\u590D\u4F1A\u8BDD [ID:${v.sessionId?v.sessionId.substring(0,8):"unknown"}]...`),r.log();try{let{executeMasterAgent:e,config:t}=await Bo();await e(null,!0,r,t),r.log(),r.success("\u4F1A\u8BDD\u6062\u590D\u5B8C\u6210"),v.sessionId&&(r.log(A.gray(`\u4F1A\u8BDD ID: ${v.sessionId.substring(0,8)}`)),v.tasks&&v.tasks.length>0&&r.log(A.gray(`\u4F1A\u8BDD\u4EFB\u52A1\u6570: ${v.tasks.length}`)),r.log())}catch(e){throw r.error(`\u4F1A\u8BDD\u6062\u590D\u5931\u8D25: ${e.message}`),e}}else r.warning("\u6CA1\u6709\u53EF\u6062\u590D\u7684\u4F1A\u8BDD\u3002\u4F7F\u7528 /chat <\u8BF7\u6C42> \u5F00\u59CB\u65B0\u4EFB\u52A1\u3002")}function Kl(r){Xe(),r.success("\u4F1A\u8BDD\u5DF2\u5F52\u6863\u5E76\u6E05\u7A7A"),r.log()}function Xl(r){let e=ps();r.log(e)}function la(r){r.exit()}function Ql(r){r.printHelp&&r.printHelp()}function Zl(r){r.log(),r.log(A.cyan("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550")),r.log(A.cyan(" \u{1F4E6} Available Tools ")),r.log(A.cyan("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550")),r.log();let e=Et(),t=Xi();if(Object.keys(e).length===0){r.warning("No tools loaded yet. Tools will be available after starting a task."),r.log();return}if(r.log(A.bold("\u{1F4CA} Summary:")),r.log(A.gray(` Total Tools: ${t.total}`)),r.log(A.gray(` Local Tools: ${t.local}`)),r.log(A.gray(` MCP Tools: ${t.mcp}`)),r.log(),t.local>0){r.log(A.bold.green("\u{1F527} Local Tools:")),r.log();let{localTools:n}=t;for(let o of n){let s=e[o];if(s&&s.getDefinition){let i=s.getDefinition();r.log(A.green(` \u2022 ${i.name}`)),r.log(A.gray(` ${i.description}`)),r.log()}}}if(t.mcp>0){r.log(A.bold.magenta("\u{1F310} MCP Tools:")),r.log();let{mcpTools:n}=t;for(let o of n){let s=e[o];if(s&&s.getDefinition){let i=s.getDefinition(),a=i.description.match(/\[MCP:([^\]]+)\]/),c=a?a[1]:"unknown",l=i.description.replace(/\[MCP:[^\]]+\]\s*/,"");r.log(A.magenta(` \u2022 ${i.name}`)),r.log(A.gray(` ${l}`)),r.log(A.gray(` (from MCP server: ${c})`)),r.log()}}}r.log(A.cyan("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550")),r.log()}async function eu(r){r.log(),r.info("\u6B63\u5728\u68C0\u67E5git\u53D8\u66F4...");try{if(!Tn()){r.warning("\u6CA1\u6709\u672A\u63D0\u4EA4\u7684\u53D8\u66F4"),r.log();return}let e=vn(),t=xn();r.log(),r.info("\u5F53\u524Dgit\u72B6\u6001:"),r.log(A.gray(e)),r.log();let n=t.length>500?t.substring(0,500)+`
|
|
1368
|
+
...(truncated)`:t;r.info("\u53D8\u66F4\u5185\u5BB9\u9884\u89C8:"),r.log(A.gray(n)),r.log(),r.info("\u6B63\u5728\u4F7F\u7528lite\u6A21\u578B\u751F\u6210commit message...");let s=[{role:"system",content:`\u4F60\u662F\u4E00\u4E2A\u4E13\u4E1A\u7684git commit message\u751F\u6210\u52A9\u624B\u3002
|
|
1369
|
+
\u8BF7\u6839\u636E\u63D0\u4F9B\u7684git diff\u5185\u5BB9\uFF0C\u751F\u6210\u4E00\u4E2A\u7B80\u6D01\u660E\u4E86\u7684commit message\u3002
|
|
1370
|
+
|
|
1371
|
+
\u8981\u6C42\uFF1A
|
|
1372
|
+
1. \u4F7F\u7528\u4E2D\u6587
|
|
1373
|
+
2. \u7B2C\u4E00\u884C\u4E3A\u7B80\u77ED\u6458\u8981\uFF08\u4E0D\u8D85\u8FC750\u5B57\u7B26\uFF09
|
|
1374
|
+
3. \u5982\u679C\u9700\u8981\u8BE6\u7EC6\u8BF4\u660E\uFF0C\u7A7A\u4E00\u884C\u540E\u6DFB\u52A0\u8BE6\u7EC6\u63CF\u8FF0
|
|
1375
|
+
4. \u9075\u5FAA\u5E38\u89C1\u7684commit message\u89C4\u8303
|
|
1376
|
+
5. \u53EA\u8F93\u51FAcommit message\uFF0C\u4E0D\u8981\u6709\u5176\u4ED6\u8BF4\u660E\u6587\u5B57
|
|
1377
|
+
|
|
1378
|
+
\u793A\u4F8B\u683C\u5F0F\uFF1A
|
|
1379
|
+
feat: \u6DFB\u52A0\u7528\u6237\u8BA4\u8BC1\u529F\u80FD
|
|
1380
|
+
|
|
1381
|
+
- \u5B9E\u73B0JWT token\u9A8C\u8BC1
|
|
1382
|
+
- \u6DFB\u52A0\u767B\u5F55\u548C\u6CE8\u518C\u63A5\u53E3
|
|
1383
|
+
- \u66F4\u65B0\u7528\u6237\u6A21\u578B`},{role:"user",content:`\u8BF7\u4E3A\u4EE5\u4E0Bgit\u53D8\u66F4\u751F\u6210commit message:
|
|
1384
|
+
|
|
1385
|
+
${t}`}],i=await ee({messages:s,temperature:.3,useCompression:!0,tools:[]}),a="";if(i.choices&&i.choices.length>0){let{message:l}=i.choices[0];l.content&&(a=l.content.trim())}if(!a){r.error("\u751F\u6210commit message\u5931\u8D25"),r.log();return}r.log();let c=a+`
|
|
1386
|
+
|
|
1387
|
+
[Generated by niumagents]`;r.success("\u751F\u6210\u7684commit message:"),r.log(A.cyan("\u2500".repeat(50))),r.log(A.white(c)),r.log(A.cyan("\u2500".repeat(50))),r.log(),r.info("\u6B63\u5728\u6267\u884C git add ."),Po(),r.success("\u5DF2\u6682\u5B58\u6240\u6709\u53D8\u66F4"),r.info("\u6B63\u5728\u6267\u884C git commit..."),Eo(c),r.success("\u63D0\u4EA4\u6210\u529F\uFF01"),r.log()}catch(e){throw r.error(`\u6267\u884Ccommit\u547D\u4EE4\u5931\u8D25: ${e.message}`),r.log(),e}}function tu(r,e){r.warning(`\u672A\u77E5\u547D\u4EE4: /${e}`);let t=On.map(n=>`/${n.name}`).join(", ");r.log(A.gray(`\u53EF\u7528\u547D\u4EE4: ${t}`))}function ua(r){return On.find(e=>e.name===r)||null}async function $r(r,e,t=""){let n=ua(e);if(!n){tu(r,e);return}if(n.requiresArg&&!t&&e!=="chat"){r.warning(`\u547D\u4EE4 /${e} \u9700\u8981\u53C2\u6570`);return}try{n.requiresArg?await n.handler(t,r):await n.handler(r)}catch(o){throw r.error(`\u6267\u884C\u547D\u4EE4 /${e} \u65F6\u51FA\u9519: ${o.message}`),o}}function Dn(){return[...On]}function Yo(r){r.log(A.cyan("\u53EF\u7528\u547D\u4EE4:")),On.forEach(e=>{let t=e.requiresArg?`/${e.name} <\u53C2\u6570>`:`/${e.name}`;r.log(` ${A.white(t)} - ${A.gray(e.description)}`)}),r.log(),r.log(A.gray("\u63D0\u793A: \u76F4\u63A5\u8F93\u5165\u5185\u5BB9\u5C06\u4F5C\u4E3A\u4EFB\u52A1\u8BF7\u6C42\u53D1\u9001")),r.log()}async function nu(){try{let{isGitAvailable:r}=await Promise.resolve().then(()=>(ar(),qi)),e=r();console.log(A.gray(`Git\u73AF\u5883\u68C0\u67E5: ${e?"\u53EF\u7528":"\u4E0D\u53EF\u7528"}`)),console.log(e?A.green("\u2713 /commit \u547D\u4EE4\u53EF\u7528"):A.yellow("\u26A0 Git\u4E0D\u53EF\u7528\uFF0C/commit \u547D\u4EE4\u5C06\u4E0D\u53EF\u7528"))}catch(r){console.log(A.gray(`\u521D\u59CB\u5316\u52A8\u6001\u547D\u4EE4\u65F6\u51FA\u9519: ${r.message}`))}}var On,Ko=w(()=>{we();Lr();ca();$n();ar();ye();On=[{name:"chat",description:"\u5F00\u59CB\u65B0\u4EFB\u52A1",handler:Bl,requiresArg:!0},{name:"resume",description:"\u6062\u590D\u4E2D\u65AD\u7684\u4F1A\u8BDD",handler:Yl,requiresArg:!1},{name:"commit",description:"\u4F7F\u7528AI\u603B\u7ED3\u53D8\u66F4\u5E76\u63D0\u4EA4git commit",handler:eu,requiresArg:!1},{name:"clear",description:"\u5F52\u6863\u5E76\u6E05\u7A7A\u5F53\u524D\u4F1A\u8BDD",handler:Kl,requiresArg:!1},{name:"history",description:"\u67E5\u770B\u5F52\u6863\u4F1A\u8BDD",handler:Xl,requiresArg:!1},{name:"list_tools",description:"\u5217\u51FA\u6240\u6709\u53EF\u7528\u5DE5\u5177",handler:Zl,requiresArg:!1},{name:"exit",description:"\u9000\u51FA\u5E94\u7528",handler:la,requiresArg:!1},{name:"quit",description:"\u9000\u51FA\u5E94\u7528",handler:la,requiresArg:!1},{name:"help",description:"\u663E\u793A\u5E2E\u52A9\u4FE1\u606F",handler:Ql,requiresArg:!1}]});Pe();we();Ko();H();te();_o();$n();import N from"chalk";import ie from"readline";import ru from"fuzzysort";var pa="0.1.5";var At=Dn(),Mr=class{rl=null;isActive=!1;commandHistory=[];historyIndex=-1;debug=!1;skipLineProcessing=!1;lastExecutedCommand=null;constructor(e={}){this.debug=e.debug||!1,Rr(this.debug)}async start(){try{if(!N)throw new Error("chalk\u6A21\u5757\u5BFC\u5165\u5931\u8D25");ns(),Dr(),M("\u4EA4\u4E92\u5F0F\u4F1A\u8BDD\u542F\u52A8"),this.debug&&(m("Debug\u6A21\u5F0F\u5DF2\u542F\u7528"),console.log(N.magenta("\u26A0 Debug\u6A21\u5F0F\u5DF2\u542F\u7528 - \u5C06\u663E\u793A\u8BE6\u7EC6\u65E5\u5FD7\u4FE1\u606F"))),await this.initializeMCP();let{initializeDynamicCommands:e}=await Promise.resolve().then(()=>(Ko(),ga));await e(),this.rl=ie.createInterface({input:process.stdin,output:process.stdout,prompt:N.blue("nium> "),historySize:100}),ie.emitKeypressEvents(process.stdin,this.rl),process.stdin.isTTY&&this.setupHistoryNavigation(),this.printWelcome(),_r()&&v.messages&&v.messages.length>0&&v.currentTask&&this.printSessionWarning(),this.isActive=!0,this.rl.prompt(),this.setupCommandHandler(),this.setupCloseHandler()}catch(e){console.error("\u542F\u52A8\u4F1A\u8BDD\u65F6\u51FA\u9519:",e.message),console.error("\u9519\u8BEF\u5806\u6808:",e.stack),process.exit(1)}}async initializeMCP(){try{let e=qr();if(M(`Loaded ${e.length} MCP server configuration(s)`),e.length===0){m("No MCP servers configured"),await Cr();return}let t=Mt();M("Initializing MCP manager with configured servers..."),await t.initialize(e),M("Loading all tools (local + MCP)..."),await Cr();let n=t.getStatus();m(`MCP Status: ${n.serversConnected} servers connected, ${n.toolsAvailable} tools available`),n.serversConnected>0?console.log(N.green(`\u2713 Connected to ${n.serversConnected} MCP server(s), ${n.toolsAvailable} tools available`)):console.log(N.yellow(`\u26A0 Configured ${e.length} MCP server(s) but none connected`))}catch(e){q(`Failed to initialize MCP: ${e.message}`),m(`MCP initialization error details: ${e.message}
|
|
1388
|
+
${e.stack||""}`),M("Continuing with local tools only..."),await Cr()}}setupHistoryNavigation(){process.stdin.on("keypress",(e,t)=>{!this.isActive||!t||(t.name==="up"&&this.commandHistory.length>0&&!t.ctrl&&!t.meta?(this.historyIndex===-1?this.historyIndex=this.commandHistory.length-1:this.historyIndex>0&&this.historyIndex--,this.updatePromptWithHistory()):t.name==="down"&&!t.ctrl&&!t.meta?(this.historyIndex>=0&&(this.historyIndex++,this.historyIndex>=this.commandHistory.length&&(this.historyIndex=-1)),this.updatePromptWithHistory()):t.name==="tab"&&this.handleTabCompletion())})}async handleTabCompletion(){if(!this.rl)return;let e=this.rl.line.trim();if(e.startsWith("/")){let t=e.slice(1),[n]=t.split(" "),o=n?ru.go(n,At,{key:"name"}):At.map(s=>({obj:s,score:0}));if(o.length===1){let s=o[0].obj,i=`/${s.name}${s.requiresArg?" ":""}`;s.requiresArg?(this.skipLineProcessing=!0,this.rl.line=i,this.rl.cursor=i.length,this.rl._refreshLine(),setTimeout(()=>{this.skipLineProcessing=!1},100)):(this.skipLineProcessing=!0,this.rl.line="",this.rl.cursor=0,this.commandHistory.push(i),this.historyIndex=-1,process.nextTick(async()=>{try{this.log(`\u6267\u884C\u547D\u4EE4: /${s.name}`),await s.handler(this)}catch(a){this.error(`\u6267\u884C\u547D\u4EE4 /${s.name} \u65F6\u51FA\u9519: ${a.message}`)}finally{this.isActive&&this.rl&&this.rl.prompt()}}))}else o.length>1&&await this.showCommandSelectionMenu(o)}}async showCommandSelectionMenu(e){if(!this.rl)return;let t=0,n=this.rl.getPrompt(),o=this.rl.line,s=process.stdin.isTTY?process.stdin.isRaw:!1,i=()=>{let a=e.length+3;for(let c=0;c<a;c++)ie.moveCursor(process.stdout,0,-1),ie.clearLine(process.stdout,0);ie.clearLine(process.stdout,1),console.log(""),console.log(N.yellow("\u8BF7\u9009\u62E9\u547D\u4EE4 (\u4F7F\u7528\u4E0A\u4E0B\u7BAD\u5934\u952E\uFF0CEnter\u786E\u8BA4\uFF0CEsc\u53D6\u6D88):")),console.log(""),e.forEach((c,l)=>{let p=c.obj,u=l===t,g=u?N.green("> "):" ",d=u?N.green.bold(`/${p.name}`):N.white(`/${p.name}`),S=N.gray(`- ${p.description}`);console.log(`${g}${d} ${S}`)}),process.stdout.write(n),this.rl.line=o,this.rl.cursor=o.length,this.rl._refreshLine()};return new Promise(a=>{process.stdin.isTTY&&process.stdin.setRawMode(!0);let c=(l,p)=>{if(p.name==="up")return t=Math.max(0,t-1),i(),!1;if(p.name==="down")return t=Math.min(e.length-1,t+1),i(),!1;if(p.name==="return"||p.name==="enter"){let u=e[t].obj,g=`/${u.name}${u.requiresArg?" ":""}`;process.stdin.removeListener("keypress",c),process.stdin.isTTY&&process.stdin.setRawMode(s);for(let d=0;d<e.length+4;d++)ie.moveCursor(process.stdout,0,-1),ie.clearLine(process.stdout,0);return ie.clearLine(process.stdout,1),process.stdout.write(n),this.skipLineProcessing=!0,u.requiresArg?(this.skipLineProcessing=!0,this.rl.line=g,this.rl.cursor=g.length,this.rl._refreshLine(),setTimeout(()=>{this.skipLineProcessing=!1},100)):(this.rl.line="",this.rl.cursor=0,this.commandHistory.push(g),this.historyIndex=-1,process.nextTick(async()=>{try{this.log(`\u6267\u884C\u547D\u4EE4: /${u.name}`),await u.handler(this)}catch(d){this.error(`\u6267\u884C\u547D\u4EE4 /${u.name} \u65F6\u51FA\u9519: ${d.message}`)}finally{this.isActive&&this.rl&&this.rl.prompt()}})),a(),!1}else if(p.name==="escape"||p.ctrl&&p.name==="c"){for(let u=0;u<e.length+4;u++)ie.moveCursor(process.stdout,0,-1),ie.clearLine(process.stdout,0);return process.stdin.removeListener("keypress",c),process.stdin.isTTY&&process.stdin.setRawMode(s),ie.clearLine(process.stdout,1),process.stdout.write(n),this.rl.line=o,this.rl.cursor=o.length,this.rl._refreshLine(),a(),!1}};process.stdin.on("keypress",c),i()})}updatePromptWithHistory(){this.rl&&(this.historyIndex>=0&&this.historyIndex<this.commandHistory.length?(this.rl.line=this.commandHistory[this.historyIndex],this.rl.cursor=this.rl.line.length,this.rl._refreshLine()):(this.rl.line="",this.rl.cursor=0,this.rl._refreshLine()))}setupCommandHandler(){this.rl&&this.rl.on("line",async e=>{let t=e.trim();if(this.skipLineProcessing){this.skipLineProcessing=!1,this.isActive&&this.rl&&this.rl.prompt();return}if(t.startsWith("/")){let o=t.slice(1).split(" ")[0];if(At=Dn(),!(o?At.some(i=>i.name===o):!1)&&o){this.isActive&&this.rl&&this.rl.prompt();return}}t&&(this.commandHistory.push(t),this.historyIndex=-1);try{await this.handleCommand(t),this.lastExecutedCommand=t}catch(n){this.error(`\u5904\u7406\u547D\u4EE4\u65F6\u51FA\u9519: ${n.message}`)}finally{this.isActive&&this.rl&&this.rl.prompt()}})}setupCloseHandler(){this.rl&&this.rl.on("close",()=>{this.isActive&&(this.isActive=!1,this.success("\u518D\u89C1\uFF01"),process.exit(0))})}async handleCommand(e){if(e)if(e.startsWith("/")){let t=e.slice(1).split(" "),n=t[0],o=t.slice(1).join(" ");try{await $r(this,n,o),n==="clear"&&this.rl&&(this.rl.line="",this.rl.cursor=0,this.rl._refreshLine())}catch(s){this.error(`\u6267\u884C\u4EFB\u52A1\u65F6\u51FA\u9519: ${s.message}`)}}else try{await $r(this,"chat",e)}catch(t){this.error(`\u6267\u884C\u4EFB\u52A1\u65F6\u51FA\u9519: ${t.message}`)}}printWelcome(){At=Dn(),this.clear(),this.log(N.green(`NiumAgents-CLI v${pa}`)),this.log(N.gray("Options:")),this.log(N.gray(" --debug - \u542F\u7528\u8C03\u8BD5\u6A21\u5F0F\u4EE5\u663E\u793A\u8BE6\u7EC6\u65E5\u5FD7")),this.log(N.gray(`
|
|
1389
|
+
Commands:`)),this.log(N.gray(" <request> - \u5F00\u59CB\u65B0\u4EFB\u52A1 (\u9ED8\u8BA4: /chat)"));let e=At.filter(t=>t.name!=="chat");for(let t of e)t.name==="exit"||t.name==="quit"?t.name==="exit"&&this.log(N.gray(" /exit \u6216 /quit - \u9000\u51FA")):this.log(N.gray(` /${t.name} - ${t.description}`));this.log(N.gray(`
|
|
1390
|
+
\u63D0\u793A: \u8F93\u5165 / \u540E\u8DDF\u90E8\u5206\u547D\u4EE4\u53EF\u8FDB\u884C\u6A21\u7CCA\u641C\u7D22`)),this.log()}printSessionWarning(){this.warning("\u26A0 \u68C0\u6D4B\u5230\u4E4B\u524D\u7684\u4F1A\u8BDD\uFF01\u4F7F\u7528 /resume \u7EE7\u7EED\u6216 /clear \u5F00\u59CB\u65B0\u4F1A\u8BDD\u3002"),this.log()}printHelp(){Yo(this)}clear(){console.clear()}log(e=""){console.log(e)}success(e){console.log(N.green(e))}warning(e){console.log(N.yellow(e))}error(e){console.log(N.red(e))}info(e){console.log(N.blue(e))}exit(){M("\u4EA4\u4E92\u5F0F\u4F1A\u8BDD\u7ED3\u675F"),this.isActive=!1,this.rl&&this.rl.close()}};async function ou(){try{let e=process.argv.slice(2).includes("--debug");await new Mr({debug:e}).start()}catch(r){console.error("\u542F\u52A8\u5E94\u7528\u65F6\u51FA\u9519:",r.message),process.exit(1)}}ou();
|