@robota-sdk/agent-cli 3.0.0-beta.8 → 3.0.0-beta.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/LICENSE +661 -21
  2. package/README.md +1105 -116
  3. package/bin/robota.cjs +39 -0
  4. package/dist/node/bin.js +7 -9
  5. package/dist/node/bounded-output-DpjpS98g-DFgAppgl.js +2 -0
  6. package/dist/node/bounded-output-DpjpS98g-DFgAppgl.js.map +1 -0
  7. package/dist/node/bounded-output-DpjpS98g-DoRuRGhV.js +2 -0
  8. package/dist/node/bounded-output-DpjpS98g-yPybHprY.cjs +1 -0
  9. package/dist/node/cli-core-DWG6gqoq.js +2798 -0
  10. package/dist/node/command-executor-DV-H2oD6-BAvcn7Tf.cjs +1 -0
  11. package/dist/node/command-executor-DV-H2oD6-BfKoGoFw.js +2 -0
  12. package/dist/node/command-executor-DV-H2oD6-OKy8pwYH.js +2 -0
  13. package/dist/node/command-executor-DV-H2oD6-OKy8pwYH.js.map +1 -0
  14. package/dist/node/headless.js +4 -0
  15. package/dist/node/http-executor-cWzI2svn-Nn7UFLl8.cjs +1 -0
  16. package/dist/node/http-executor-cWzI2svn-TG_TMYKh.js +2 -0
  17. package/dist/node/http-executor-cWzI2svn-TG_TMYKh.js.map +1 -0
  18. package/dist/node/http-executor-cWzI2svn-Ype0naht.js +2 -0
  19. package/dist/node/index.cjs +2785 -1345
  20. package/dist/node/index.d.cts +3432 -36
  21. package/dist/node/index.d.cts.map +1 -0
  22. package/dist/node/index.d.ts +3432 -36
  23. package/dist/node/index.d.ts.map +1 -0
  24. package/dist/node/index.js +2797 -13
  25. package/dist/node/index.js.map +1 -0
  26. package/dist/node/node-2-nrieFn.js +2 -0
  27. package/dist/node/node-2-nrieFn.js.map +1 -0
  28. package/dist/node/node-Bs1jlR4B.js +67 -0
  29. package/dist/node/node-CFTax5Wl.cjs +1 -0
  30. package/dist/node/node-CQqDd5KI.js +14 -0
  31. package/dist/node/node-CQqDd5KI.js.map +1 -0
  32. package/dist/node/node-D8uo8Kzf.cjs +13 -0
  33. package/dist/node/node-DE_LpiDk.cjs +66 -0
  34. package/dist/node/node-Du_7g6qW.js +14 -0
  35. package/dist/node/node-OBnZskvR.cjs +1 -0
  36. package/dist/node/node-bJ0lEuNF.js +2 -0
  37. package/dist/node/node-bJ0lEuNF.js.map +1 -0
  38. package/dist/node/node-cmTHiSYe.js +2 -0
  39. package/dist/node/node-hHzxDyjn.js +67 -0
  40. package/dist/node/node-hHzxDyjn.js.map +1 -0
  41. package/dist/node/rolldown-runtime-C9xYM0wc.js +1 -0
  42. package/dist/node/rolldown-runtime-DK3Fl9T5-BIInC43l.cjs +1 -0
  43. package/dist/node/rolldown-runtime-DK3Fl9T5-BeX3Bzvn.js +2 -0
  44. package/dist/node/rolldown-runtime-DK3Fl9T5-DK3Fl9T5.js +2 -0
  45. package/dist/node/rolldown-runtime-DK3Fl9T5-DK3Fl9T5.js.map +1 -0
  46. package/dist/node/rolldown-runtime-rs7quPpn.js +2 -0
  47. package/dist/node/verdict-decoder-Dk_w2NG9-BKWMtxp8.js +2 -0
  48. package/dist/node/verdict-decoder-Dk_w2NG9-Bka7Cldj.js +2 -0
  49. package/dist/node/verdict-decoder-Dk_w2NG9-Bka7Cldj.js.map +1 -0
  50. package/dist/node/verdict-decoder-Dk_w2NG9-DNTeVdQ8.cjs +1 -0
  51. package/dist/web/assets/index-8_Slbxe7.css +1 -0
  52. package/dist/web/assets/index-Cgu5C1kn.js +77 -0
  53. package/dist/web/index.html +13 -0
  54. package/package.json +162 -32
  55. package/dist/node/bin.cjs +0 -1339
  56. package/dist/node/bin.d.cts +0 -1
  57. package/dist/node/bin.d.ts +0 -1
  58. package/dist/node/chunk-ICKV3U6G.js +0 -1318
package/bin/robota.cjs ADDED
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ // CJS wrapper — runs synchronously before any ESM module is loaded.
4
+ // Static ESM imports in dist/node/bin.js are hoisted by the JS engine,
5
+ // so version/env checks placed there would execute too late.
6
+
7
+ const REQUIRED_NODE_MAJOR = 22;
8
+ const nodeMajor = parseInt(process.versions.node.split('.')[0], 10);
9
+ if (nodeMajor < REQUIRED_NODE_MAJOR) {
10
+ process.stderr.write(
11
+ '\n Robota requires Node.js ' +
12
+ REQUIRED_NODE_MAJOR +
13
+ ' or higher.\n' +
14
+ ' Current version: ' +
15
+ process.versions.node +
16
+ '\n' +
17
+ ' (Reason: the TUI renderer ink 7.x requires Node.js 22+)\n\n' +
18
+ ' Upgrade options:\n' +
19
+ ' nvm: nvm install ' +
20
+ REQUIRED_NODE_MAJOR +
21
+ ' && nvm use ' +
22
+ REQUIRED_NODE_MAJOR +
23
+ '\n' +
24
+ ' Volta: volta install node@' +
25
+ REQUIRED_NODE_MAJOR +
26
+ '\n' +
27
+ ' Download: https://nodejs.org/en/download\n\n',
28
+ );
29
+ process.exit(1);
30
+ }
31
+
32
+ // Load ESM main entry only after synchronous checks pass.
33
+ // CJS can dynamic-import ESM in Node.js 12+. This is the only way to load
34
+ // an ESM module from CJS — eslint-disable is intentional and required.
35
+ // eslint-disable-next-line no-restricted-syntax
36
+ import(new URL('../dist/node/bin.js', 'file://' + __filename)).catch(function (err) {
37
+ process.stderr.write((err && err.message ? err.message : String(err)) + '\n');
38
+ process.exit(1);
39
+ });
package/dist/node/bin.js CHANGED
@@ -1,11 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- startCli
4
- } from "./chunk-ICKV3U6G.js";
2
+ ;(function(){var v=parseInt(process.versions.node.split('.')[0],10);if(v<22){process.stderr.write('\n✗ Node.js 22+ is required (current: '+process.version+')\n\nUpgrade:\n nvm: nvm install 22 && nvm use 22\n Volta: volta install node@22\n Download: https://nodejs.org/en/download\n\n');process.exit(1);}})();
3
+ import{C as e,D as t,E as n,S as r,T as i,_ as a,b as o,c as s,d as c,f as l,g as u,h as d,l as f,m as p,o as m,p as h,t as g,u as _,v,w as y,x as b,y as x}from"./cli-core-DWG6gqoq.js";import{join as S}from"node:path";function C(e){if(e===`1`)return!0;if(e===`0`)return!1}function w(e){if(e.flag!==void 0)return{reducedMotion:e.flag,override:`flag`};let t=C(e.env);return t===void 0?{reducedMotion:e.settings}:{reducedMotion:t,override:`environment`}}function T(e,t,n){let r=i(e??{}),a=w({settings:r.reducedMotion,flag:t,env:n.ROBOTA_REDUCED_MOTION});return{appearance:r,reducedMotion:a.reducedMotion,...a.override===void 0?{}:{reducedMotionOverride:a.override}}}const E=S(`.robota`,`themes`),D=RegExp(`^[A-Za-z0-9._-]{1,24}$`,`u`);function O(e,t,n){return e.listDirectory(t,n).filter(e=>e.kind===`file`&&e.name.endsWith(`.json`)).map(r=>({fileName:r.name,text:e.readText(S(t,r.name),n)}))}function k(e,t){let n=`load ${t.source} themes`,i=r(t.root);for(let r of O(i,t.directory,n)){let n=r.fileName.slice(0,-5);if(!D.test(n)){let n=u(r.fileName);e.skipped.push({id:`${t.idPrefix}${n}`,fileName:v(r.fileName),reason:`$: the file name ${n} cannot be a theme id — use at most 24 characters from letters, digits, dot, dash and underscore`});continue}let i=`${t.idPrefix}${n}`;if(e.claimed.has(i)){e.skipped.push({id:i,fileName:r.fileName,reason:`$: the id "${i}" is already taken by a theme loaded earlier`});continue}if(r.text===void 0){e.skipped.push({id:i,fileName:r.fileName,reason:`$: the file could not be read`});continue}let a=h({id:i,fileName:r.fileName,source:t.source,text:r.text});a.ok?(e.claimed.add(i),e.themes.push(a.theme)):e.skipped.push({id:i,fileName:r.fileName,reason:a.error})}}function A(t,n,r,i){let a=s(t,n,i);try{return e(a,{settingsPath:f(n)}).map(e=>({name:e.manifest.name,pluginDir:e.pluginDir}))}catch(e){let t=x(a.join(`, `)),n=x(e instanceof Error?e.message:String(e));return r.skipped.push({id:`custom:<plugins>`,fileName:t,reason:`$: the plugin scopes could not be read — ${n}`}),[]}}function j(e){let t={themes:[],skipped:[],claimed:new Set};k(t,{root:e.userHome,directory:E,source:`user`,idPrefix:`custom:`});let n=e.plugins??A(e.cwd,e.userHome,t,e.projectAccess);for(let e of n){if(!D.test(e.name)){let n=u(e.name);t.skipped.push({id:`custom:${n}`,fileName:v(e.name),reason:`$: the plugin name ${n} cannot be part of a theme id — its themes are not loaded`});continue}k(t,{root:e.pluginDir,directory:`themes`,source:`plugin`,idPrefix:`custom:${e.name}:`})}return{themes:t.themes,skipped:t.skipped}}function M(e){let t=T(e.settings,e.reducedMotionFlag,e.env),n={reducedMotion:t.reducedMotion,...t.reducedMotionOverride===void 0?{}:{reducedMotionOverride:t.reducedMotionOverride}};if(!e.enabled)return{registry:void 0,cataloguePort:void 0,skipped:[],...n};let r=j({cwd:e.cwd,userHome:e.userHome,...e.projectAccess===void 0?{}:{projectAccess:e.projectAccess}}),i=p([..._(),...r.themes],r.skipped);return{registry:i,cataloguePort:d({registry:i,readAppearance:()=>T(y(f()),void 0,{}).appearance,...t.reducedMotionOverride===void 0?{}:{reducedMotionPin:{tier:t.reducedMotionOverride,reducedMotion:t.reducedMotion}}}),skipped:r.skipped,...n}}let N=null,P=!1;function F(){return P}const I=[`string-width`,`setCursorPosition`,`getStringWidth`,`slice`,`charCodeAt`];function L(e,t){if(!t)return`rethrow`;let n=e.message??``;return I.some(e=>n.includes(e))?`ime-hint`:`guard-owned`}function R(e){N=e}function z(e,t){try{if(N){N.getSession().reportBackgroundError(e,t);return}}catch{}process.stderr.write(`\n[robota] ${t}: ${e.message}\n`)}function B(){P||(P=!0,process.on(`unhandledRejection`,e=>{z(e instanceof Error?e:Error(String(e)),`unhandled rejection`)}),process.on(`uncaughtException`,e=>{z(e instanceof Error?e:Error(String(e)),`uncaught exception`)}))}async function V(e={}){return g(e,n,{renderApp:a,createDefaultTuiCliAdapter:c,createNodeKeybindingsSource:l,createThemeSurface:M,installTuiProcessGuards:B,setLiveChannel:R})}t(),process.on(`uncaughtException`,e=>{let t=L(e,F());if(t===`ime-hint`){process.stderr.write(`
4
+ [robota] CJK/IME input error — this is a known issue with macOS Terminal.app.
5
+ Workaround: use iTerm2 (https://iterm2.com) or input your prompt in English.
6
+ Alternatively, use headless mode: robota -p "your prompt here"
5
7
 
6
- // src/bin.ts
7
- startCli().catch((err) => {
8
- const message = err instanceof Error ? err.message : String(err);
9
- process.stderr.write(message + "\n");
10
- process.exit(1);
11
- });
8
+ `);return}if(t!==`guard-owned`)throw e}),o(process.argv)?b(m()):V().catch(e=>{let t=e instanceof Error?e.message:String(e);process.stderr.write(t+`
9
+ `),process.exit(1)});export{};
@@ -0,0 +1,2 @@
1
+ var e=class extends Error{context;constructor(e,t){super(e),this.context=t,this.name=this.constructor.name,Object.setPrototypeOf(this,new.target.prototype)}},t=class extends e{code=`CONFIGURATION_ERROR`;category=`user`;recoverable=!1;constructor(e,t){super(`Configuration Error: ${e}`,t)}},n=class extends e{field;code=`VALIDATION_ERROR`;category=`user`;recoverable=!1;constructor(e,t,n){super(`Validation Error: ${e}`,n),this.field=t}},r=class extends e{issues;attempts;code=`STRUCTURED_OUTPUT_ERROR`;category=`provider`;recoverable=!0;constructor(e,t,n,r){super(`Structured Output Error: ${e}`,r),this.issues=t,this.attempts=n}},i=class extends e{provider;originalError;code=`PROVIDER_ERROR`;category=`provider`;recoverable=!0;status;type;constructor(e,t,n,r,i){super(`Provider Error (${t}): ${e}`,r),this.provider=t,this.originalError=n,i?.status!==void 0&&(this.status=i.status),i?.type!==void 0&&(this.type=i.type)}},a=class extends e{provider;code=`AUTHENTICATION_ERROR`;category=`user`;recoverable=!1;constructor(e,t,n){super(`Authentication Error: ${e}`,n),this.provider=t}},o=class extends e{retryAfter;provider;code=`RATE_LIMIT_ERROR`;category=`provider`;recoverable=!0;constructor(e,t,n,r){super(`Rate Limit Error: ${e}`,r),this.retryAfter=t,this.provider=n}},s=class extends e{originalError;code=`NETWORK_ERROR`;category=`system`;recoverable=!0;constructor(e,t,n){super(`Network Error: ${e}`,n),this.originalError=t}},c=class extends e{toolName;originalError;code=`TOOL_EXECUTION_ERROR`;category=`system`;recoverable=!1;constructor(e,t,n,r){super(`Tool Execution Error (${t}): ${e}`,r),this.toolName=t,this.originalError=n}},l=class extends e{toolName;callCount;maxSameToolInputs;code=`SAME_TOOL_INPUT_LOOP`;category=`system`;recoverable=!0;constructor(e,t,n,r){super(`Tool "${e}" was called with identical input ${t} times, past the maxSameToolInputs limit of ${n} — stopping the turn to break the loop`,r),this.toolName=e,this.callCount=t,this.maxSameToolInputs=n}},u=class extends e{availableModels;code=`MODEL_NOT_AVAILABLE`;category=`user`;recoverable=!1;constructor(e,t,n,r){super(`Model "${e}" is not available for provider "${t}"`,r),this.availableModels=n}},d=class extends e{pluginName;code=`PLUGIN_ERROR`;category=`system`;recoverable=!1;constructor(e,t,n){super(`Plugin Error (${t}): ${e}`,n),this.pluginName=t}},f=class extends e{code=`CACHE_INTEGRITY_ERROR`;category=`system`;recoverable=!1;constructor(e,t){super(`Cache Integrity Error: ${e}`,t)}},p=class extends e{executable;code=`UNSUPPORTED_SHELL`;category=`user`;recoverable=!1;constructor(e){super(`Unsupported shell executable: ${e}`,{executable:e}),this.executable=e}};function m(e){return e===`darwin`?'Host OS: macOS (POSIX, BSD userland). Use BSD-flavored utilities: `sed -i ""` needs an empty backup arg, `date`/`grep`/`stat` flags differ from GNU. Prefer portable POSIX flags; avoid Linux/GNU-only options.':e===`linux`?"Host OS: Linux (POSIX, usually GNU coreutils, but distro/user setup varies). Prefer portable POSIX flags; do not assume a specific distro, and probe with `command -v` before relying on a non-standard tool.":`Host OS: ${e}; active shell family: POSIX sh/bash. Write portable POSIX syntax and avoid host-specific flags.`}function h(e,t){let n=v(e)===`bash`?`bash`:`sh`;return{command:e,kind:n,platform:t,commandArgs:e=>[`-c`,e],interactiveArgs:[],label:`${n} on ${t}`,syntaxHint:m(t)}}function g(e,t){return{command:e,kind:`powershell`,platform:t,commandArgs:e=>[`-NoProfile`,`-Command`,e],interactiveArgs:[`-NoProfile`],label:`PowerShell on ${t}`,syntaxHint:`Host OS: ${t}; active shell family: PowerShell. Write PowerShell syntax (not bash): e.g. \`Get-ChildItem\` not \`ls -la\`, \`\$env:VAR\` not \`\$VAR\`.`}}function _(e,t){return{command:e,kind:`cmd`,platform:t,commandArgs:e=>[`/d`,`/s`,`/c`,e],interactiveArgs:[],label:`cmd.exe on ${t}`,syntaxHint:`Host OS: ${t}; active shell family: Windows cmd.exe. Write cmd.exe syntax.`}}function v(e){return(e.split(/[\\/]/).at(-1)?.toLowerCase()??``).replace(/\.exe$/i,``)}function y(e,t){switch(v(e)){case`sh`:case`bash`:return h(e,t);case`powershell`:case`pwsh`:return g(e,t);case`cmd`:return _(e,t);default:throw new p(e)}}function b(e){let t=e?.trim();return t===void 0||t.length===0?void 0:t}function x(e={}){let t=e.env??process.env,n=e.platform??process.platform,r=b(e.executable);return r===void 0?n===`win32`?g(`powershell.exe`,n):h(b(t.SHELL)??`/bin/sh`,n):y(r,n)}const S=/^(?!0{32}$)[0-9a-f]{32}$/,C=/^(?!0{16}$)[0-9a-f]{16}$/;function w(e){return e.replaceAll(`-`,``).slice(0,16)}const T=w;function E(e){return C.test(e)}function D(e,t){if(!(!S.test(e)||!C.test(t)))return`00-${e}-${t}-01`}function O(e,t){if(e.allowedOrigins.length===0)return;let n=D(e.traceId,w(t));if(n!==void 0)return{traceparent:n,allowedOrigins:[...e.allowedOrigins]}}function k(e,t){return O(e,t)}function A(e,t,n){if(t?.subprocessClasses?.includes(e)!==!0)return;let r=D(t.traceId,n);return r===void 0?void 0:{TRACEPARENT:r}}function j(e,t,n={}){if(t===void 0||n.TRACEPARENT!==void 0)return{...e,...n};let{TRACESTATE:r,...i}=e;return{...i,...t,...n}}function M(e,t){if(e===void 0||t===void 0)return{};let n;try{n=new URL(e).origin}catch{return{}}return n===`null`||!t.allowedOrigins.includes(n)?{}:{traceparent:t.traceparent}}const N=e=>`\n…[output truncated: ${e} byte(s) dropped]`;function P(e){let t=e.retain??`head`,n=e.truncationMarker??N,r=Math.max(0,Math.floor(e.maxBytes)),i=new TextEncoder,a=[],o=0,s=0,c=e=>{let t=r-o;if(t<=0)return;let n=e.byteLength<=t?e:e.subarray(0,t);a.push(n),o+=n.byteLength},l=e=>{let t=e.byteLength<=r?e:e.subarray(e.byteLength-r);for(a.push(t),o+=t.byteLength;o>r&&a.length>0;){let e=a[0],t=o-r;e.byteLength<=t?(a.shift(),o-=e.byteLength):(a[0]=e.subarray(t),o-=t)}};return{append(e){let n=typeof e==`string`?i.encode(e):e;s+=n.byteLength,t===`head`?c(n):l(n)},get retainedBytes(){return o},get totalBytes(){return s},get droppedBytes(){return s-o},get truncated(){return s>o},toString(){let e=new Uint8Array(o),r=0;for(let t of a)e.set(t,r),r+=t.byteLength;a=a.length>1?[e]:a;let i=new TextDecoder().decode(e);if(s<=o)return i;let c=n(s-o);return t===`head`?`${i}${c}`:`${c.replace(/^\n/,``)}\n${i}`}}}export{u as C,t as S,f as _,P as a,r as b,E as c,c as d,e as f,l as g,k as h,w as i,M as l,i as m,x as n,A as o,d as p,T as r,j as s,O as t,a as u,n as v,s as x,o as y};
2
+ //# sourceMappingURL=bounded-output-DpjpS98g-DFgAppgl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bounded-output-DpjpS98g-DFgAppgl.js","names":[],"sources":["../../../agent-core/dist/node/bounded-output-DpjpS98g.js"],"sourcesContent":["var e=class extends Error{context;constructor(e,t){super(e),this.context=t,this.name=this.constructor.name,Object.setPrototypeOf(this,new.target.prototype)}},t=class extends e{code=`CONFIGURATION_ERROR`;category=`user`;recoverable=!1;constructor(e,t){super(`Configuration Error: ${e}`,t)}},n=class extends e{field;code=`VALIDATION_ERROR`;category=`user`;recoverable=!1;constructor(e,t,n){super(`Validation Error: ${e}`,n),this.field=t}},r=class extends e{issues;attempts;code=`STRUCTURED_OUTPUT_ERROR`;category=`provider`;recoverable=!0;constructor(e,t,n,r){super(`Structured Output Error: ${e}`,r),this.issues=t,this.attempts=n}},i=class extends e{provider;originalError;code=`PROVIDER_ERROR`;category=`provider`;recoverable=!0;status;type;constructor(e,t,n,r,i){super(`Provider Error (${t}): ${e}`,r),this.provider=t,this.originalError=n,i?.status!==void 0&&(this.status=i.status),i?.type!==void 0&&(this.type=i.type)}},a=class extends e{provider;code=`AUTHENTICATION_ERROR`;category=`user`;recoverable=!1;constructor(e,t,n){super(`Authentication Error: ${e}`,n),this.provider=t}},o=class extends e{retryAfter;provider;code=`RATE_LIMIT_ERROR`;category=`provider`;recoverable=!0;constructor(e,t,n,r){super(`Rate Limit Error: ${e}`,r),this.retryAfter=t,this.provider=n}},s=class extends e{originalError;code=`NETWORK_ERROR`;category=`system`;recoverable=!0;constructor(e,t,n){super(`Network Error: ${e}`,n),this.originalError=t}},c=class extends e{toolName;originalError;code=`TOOL_EXECUTION_ERROR`;category=`system`;recoverable=!1;constructor(e,t,n,r){super(`Tool Execution Error (${t}): ${e}`,r),this.toolName=t,this.originalError=n}},l=class extends e{toolName;callCount;maxSameToolInputs;code=`SAME_TOOL_INPUT_LOOP`;category=`system`;recoverable=!0;constructor(e,t,n,r){super(`Tool \"${e}\" was called with identical input ${t} times, past the maxSameToolInputs limit of ${n} — stopping the turn to break the loop`,r),this.toolName=e,this.callCount=t,this.maxSameToolInputs=n}},u=class extends e{availableModels;code=`MODEL_NOT_AVAILABLE`;category=`user`;recoverable=!1;constructor(e,t,n,r){super(`Model \"${e}\" is not available for provider \"${t}\"`,r),this.availableModels=n}},d=class extends e{code=`CIRCUIT_BREAKER_OPEN`;category=`system`;recoverable=!0;constructor(e=`Circuit breaker is open`,t){super(e,t)}},f=class extends e{pluginName;code=`PLUGIN_ERROR`;category=`system`;recoverable=!1;constructor(e,t,n){super(`Plugin Error (${t}): ${e}`,n),this.pluginName=t}},p=class extends e{code=`STORAGE_ERROR`;category=`system`;recoverable=!0;constructor(e,t){super(`Storage Error: ${e}`,t)}},m=class extends e{code=`CACHE_INTEGRITY_ERROR`;category=`system`;recoverable=!1;constructor(e,t){super(`Cache Integrity Error: ${e}`,t)}},h=class extends e{executable;code=`UNSUPPORTED_SHELL`;category=`user`;recoverable=!1;constructor(e){super(`Unsupported shell executable: ${e}`,{executable:e}),this.executable=e}};function g(e){return e===`darwin`?'Host OS: macOS (POSIX, BSD userland). Use BSD-flavored utilities: `sed -i \"\"` needs an empty backup arg, `date`/`grep`/`stat` flags differ from GNU. Prefer portable POSIX flags; avoid Linux/GNU-only options.':e===`linux`?\"Host OS: Linux (POSIX, usually GNU coreutils, but distro/user setup varies). Prefer portable POSIX flags; do not assume a specific distro, and probe with `command -v` before relying on a non-standard tool.\":`Host OS: ${e}; active shell family: POSIX sh/bash. Write portable POSIX syntax and avoid host-specific flags.`}function _(e,t){let n=b(e)===`bash`?`bash`:`sh`;return{command:e,kind:n,platform:t,commandArgs:e=>[`-c`,e],interactiveArgs:[],label:`${n} on ${t}`,syntaxHint:g(t)}}function v(e,t){return{command:e,kind:`powershell`,platform:t,commandArgs:e=>[`-NoProfile`,`-Command`,e],interactiveArgs:[`-NoProfile`],label:`PowerShell on ${t}`,syntaxHint:`Host OS: ${t}; active shell family: PowerShell. Write PowerShell syntax (not bash): e.g. \\`Get-ChildItem\\` not \\`ls -la\\`, \\`\\$env:VAR\\` not \\`\\$VAR\\`.`}}function y(e,t){return{command:e,kind:`cmd`,platform:t,commandArgs:e=>[`/d`,`/s`,`/c`,e],interactiveArgs:[],label:`cmd.exe on ${t}`,syntaxHint:`Host OS: ${t}; active shell family: Windows cmd.exe. Write cmd.exe syntax.`}}function b(e){return(e.split(/[\\\\/]/).at(-1)?.toLowerCase()??``).replace(/\\.exe$/i,``)}function x(e,t){switch(b(e)){case`sh`:case`bash`:return _(e,t);case`powershell`:case`pwsh`:return v(e,t);case`cmd`:return y(e,t);default:throw new h(e)}}function S(e){let t=e?.trim();return t===void 0||t.length===0?void 0:t}function C(e={}){let t=e.env??process.env,n=e.platform??process.platform,r=S(e.executable);return r===void 0?n===`win32`?v(`powershell.exe`,n):_(S(t.SHELL)??`/bin/sh`,n):x(r,n)}const w=/^(?!0{32}$)[0-9a-f]{32}$/,T=/^(?!0{16}$)[0-9a-f]{16}$/;function E(e){return e.replaceAll(`-`,``).slice(0,16)}const D=E;function O(e){return T.test(e)}function k(e,t){if(!(!w.test(e)||!T.test(t)))return`00-${e}-${t}-01`}function A(e,t){if(e.allowedOrigins.length===0)return;let n=k(e.traceId,E(t));if(n!==void 0)return{traceparent:n,allowedOrigins:[...e.allowedOrigins]}}function j(e,t){return A(e,t)}function M(e,t,n){if(t?.subprocessClasses?.includes(e)!==!0)return;let r=k(t.traceId,n);return r===void 0?void 0:{TRACEPARENT:r}}function N(e,t,n={}){if(t===void 0||n.TRACEPARENT!==void 0)return{...e,...n};let{TRACESTATE:r,...i}=e;return{...i,...t,...n}}function P(e,t){if(e===void 0||t===void 0)return{};let n;try{n=new URL(e).origin}catch{return{}}return n===`null`||!t.allowedOrigins.includes(n)?{}:{traceparent:t.traceparent}}const F=e=>`\\n…[output truncated: ${e} byte(s) dropped]`;function I(e){let t=e.retain??`head`,n=e.truncationMarker??F,r=Math.max(0,Math.floor(e.maxBytes)),i=new TextEncoder,a=[],o=0,s=0,c=e=>{let t=r-o;if(t<=0)return;let n=e.byteLength<=t?e:e.subarray(0,t);a.push(n),o+=n.byteLength},l=e=>{let t=e.byteLength<=r?e:e.subarray(e.byteLength-r);for(a.push(t),o+=t.byteLength;o>r&&a.length>0;){let e=a[0],t=o-r;e.byteLength<=t?(a.shift(),o-=e.byteLength):(a[0]=e.subarray(t),o-=t)}};return{append(e){let n=typeof e==`string`?i.encode(e):e;s+=n.byteLength,t===`head`?c(n):l(n)},get retainedBytes(){return o},get totalBytes(){return s},get droppedBytes(){return s-o},get truncated(){return s>o},toString(){let e=new Uint8Array(o),r=0;for(let t of a)e.set(t,r),r+=t.byteLength;a=a.length>1?[e]:a;let i=new TextDecoder().decode(e);if(s<=o)return i;let c=n(s-o);return t===`head`?`${i}${c}`:`${c.replace(/^\\n/,``)}\\n${i}`}}}export{l as C,n as D,c as E,e as S,r as T,u as _,D as a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KAAK,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,OAAO,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,YAAY,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,WAAW,IAAI,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,eAAe,CAAC,OAAO,CAAC,EAAE,IAAI,YAAY,CAAC,OAAO,CAAC,EAAE,IAAI,cAAc,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC,EAAE,UAAU,CAAC,IAAI,EAAE,IAAI,WAAW,CAAC,EAAE,EAAE,EAAE,IAAI,IAAI,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,YAAY,CAAC,CAAC,OAAO,CAAC,EAAE,GAAG,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,OAAO,IAAI,OAAO,GAAG,IAAI,IAAI,GAAG,EAAE,QAAQ,MAAM,EAAE,EAAE,IAAI,GAAG,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ ;(function(){var v=parseInt(process.versions.node.split('.')[0],10);if(v<22){process.stderr.write('\n✗ Node.js 22+ is required (current: '+process.version+')\n\nUpgrade:\n nvm: nvm install 22 && nvm use 22\n Volta: volta install node@22\n Download: https://nodejs.org/en/download\n\n');process.exit(1);}})();
2
+ var e=class extends Error{context;constructor(e,t){super(e),this.context=t,this.name=this.constructor.name,Object.setPrototypeOf(this,new.target.prototype)}},t=class extends e{code=`CONFIGURATION_ERROR`;category=`user`;recoverable=!1;constructor(e,t){super(`Configuration Error: ${e}`,t)}},n=class extends e{field;code=`VALIDATION_ERROR`;category=`user`;recoverable=!1;constructor(e,t,n){super(`Validation Error: ${e}`,n),this.field=t}},r=class extends e{issues;attempts;code=`STRUCTURED_OUTPUT_ERROR`;category=`provider`;recoverable=!0;constructor(e,t,n,r){super(`Structured Output Error: ${e}`,r),this.issues=t,this.attempts=n}},i=class extends e{provider;originalError;code=`PROVIDER_ERROR`;category=`provider`;recoverable=!0;status;type;constructor(e,t,n,r,i){super(`Provider Error (${t}): ${e}`,r),this.provider=t,this.originalError=n,i?.status!==void 0&&(this.status=i.status),i?.type!==void 0&&(this.type=i.type)}},a=class extends e{provider;code=`AUTHENTICATION_ERROR`;category=`user`;recoverable=!1;constructor(e,t,n){super(`Authentication Error: ${e}`,n),this.provider=t}},o=class extends e{retryAfter;provider;code=`RATE_LIMIT_ERROR`;category=`provider`;recoverable=!0;constructor(e,t,n,r){super(`Rate Limit Error: ${e}`,r),this.retryAfter=t,this.provider=n}},s=class extends e{originalError;code=`NETWORK_ERROR`;category=`system`;recoverable=!0;constructor(e,t,n){super(`Network Error: ${e}`,n),this.originalError=t}},c=class extends e{toolName;originalError;code=`TOOL_EXECUTION_ERROR`;category=`system`;recoverable=!1;constructor(e,t,n,r){super(`Tool Execution Error (${t}): ${e}`,r),this.toolName=t,this.originalError=n}},l=class extends e{toolName;callCount;maxSameToolInputs;code=`SAME_TOOL_INPUT_LOOP`;category=`system`;recoverable=!0;constructor(e,t,n,r){super(`Tool "${e}" was called with identical input ${t} times, past the maxSameToolInputs limit of ${n} — stopping the turn to break the loop`,r),this.toolName=e,this.callCount=t,this.maxSameToolInputs=n}},u=class extends e{availableModels;code=`MODEL_NOT_AVAILABLE`;category=`user`;recoverable=!1;constructor(e,t,n,r){super(`Model "${e}" is not available for provider "${t}"`,r),this.availableModels=n}},d=class extends e{pluginName;code=`PLUGIN_ERROR`;category=`system`;recoverable=!1;constructor(e,t,n){super(`Plugin Error (${t}): ${e}`,n),this.pluginName=t}},f=class extends e{code=`CACHE_INTEGRITY_ERROR`;category=`system`;recoverable=!1;constructor(e,t){super(`Cache Integrity Error: ${e}`,t)}},p=class extends e{executable;code=`UNSUPPORTED_SHELL`;category=`user`;recoverable=!1;constructor(e){super(`Unsupported shell executable: ${e}`,{executable:e}),this.executable=e}};function m(e){return e===`darwin`?'Host OS: macOS (POSIX, BSD userland). Use BSD-flavored utilities: `sed -i ""` needs an empty backup arg, `date`/`grep`/`stat` flags differ from GNU. Prefer portable POSIX flags; avoid Linux/GNU-only options.':e===`linux`?"Host OS: Linux (POSIX, usually GNU coreutils, but distro/user setup varies). Prefer portable POSIX flags; do not assume a specific distro, and probe with `command -v` before relying on a non-standard tool.":`Host OS: ${e}; active shell family: POSIX sh/bash. Write portable POSIX syntax and avoid host-specific flags.`}function h(e,t){let n=v(e)===`bash`?`bash`:`sh`;return{command:e,kind:n,platform:t,commandArgs:e=>[`-c`,e],interactiveArgs:[],label:`${n} on ${t}`,syntaxHint:m(t)}}function g(e,t){return{command:e,kind:`powershell`,platform:t,commandArgs:e=>[`-NoProfile`,`-Command`,e],interactiveArgs:[`-NoProfile`],label:`PowerShell on ${t}`,syntaxHint:`Host OS: ${t}; active shell family: PowerShell. Write PowerShell syntax (not bash): e.g. \`Get-ChildItem\` not \`ls -la\`, \`\$env:VAR\` not \`\$VAR\`.`}}function _(e,t){return{command:e,kind:`cmd`,platform:t,commandArgs:e=>[`/d`,`/s`,`/c`,e],interactiveArgs:[],label:`cmd.exe on ${t}`,syntaxHint:`Host OS: ${t}; active shell family: Windows cmd.exe. Write cmd.exe syntax.`}}function v(e){return(e.split(/[\\/]/).at(-1)?.toLowerCase()??``).replace(/\.exe$/i,``)}function y(e,t){switch(v(e)){case`sh`:case`bash`:return h(e,t);case`powershell`:case`pwsh`:return g(e,t);case`cmd`:return _(e,t);default:throw new p(e)}}function b(e){let t=e?.trim();return t===void 0||t.length===0?void 0:t}function x(e={}){let t=e.env??process.env,n=e.platform??process.platform,r=b(e.executable);return r===void 0?n===`win32`?g(`powershell.exe`,n):h(b(t.SHELL)??`/bin/sh`,n):y(r,n)}const S=/^(?!0{32}$)[0-9a-f]{32}$/,C=/^(?!0{16}$)[0-9a-f]{16}$/;function w(e){return e.replaceAll(`-`,``).slice(0,16)}const T=w;function E(e){return C.test(e)}function D(e,t){if(!(!S.test(e)||!C.test(t)))return`00-${e}-${t}-01`}function O(e,t){if(e.allowedOrigins.length===0)return;let n=D(e.traceId,w(t));if(n!==void 0)return{traceparent:n,allowedOrigins:[...e.allowedOrigins]}}function k(e,t){return O(e,t)}function A(e,t,n){if(t?.subprocessClasses?.includes(e)!==!0)return;let r=D(t.traceId,n);return r===void 0?void 0:{TRACEPARENT:r}}function j(e,t,n={}){if(t===void 0||n.TRACEPARENT!==void 0)return{...e,...n};let{TRACESTATE:r,...i}=e;return{...i,...t,...n}}function M(e,t){if(e===void 0||t===void 0)return{};let n;try{n=new URL(e).origin}catch{return{}}return n===`null`||!t.allowedOrigins.includes(n)?{}:{traceparent:t.traceparent}}const N=e=>`\n…[output truncated: ${e} byte(s) dropped]`;function P(e){let t=e.retain??`head`,n=e.truncationMarker??N,r=Math.max(0,Math.floor(e.maxBytes)),i=new TextEncoder,a=[],o=0,s=0,c=e=>{let t=r-o;if(t<=0)return;let n=e.byteLength<=t?e:e.subarray(0,t);a.push(n),o+=n.byteLength},l=e=>{let t=e.byteLength<=r?e:e.subarray(e.byteLength-r);for(a.push(t),o+=t.byteLength;o>r&&a.length>0;){let e=a[0],t=o-r;e.byteLength<=t?(a.shift(),o-=e.byteLength):(a[0]=e.subarray(t),o-=t)}};return{append(e){let n=typeof e==`string`?i.encode(e):e;s+=n.byteLength,t===`head`?c(n):l(n)},get retainedBytes(){return o},get totalBytes(){return s},get droppedBytes(){return s-o},get truncated(){return s>o},toString(){let e=new Uint8Array(o),r=0;for(let t of a)e.set(t,r),r+=t.byteLength;a=a.length>1?[e]:a;let i=new TextDecoder().decode(e);if(s<=o)return i;let c=n(s-o);return t===`head`?`${i}${c}`:`${c.replace(/^\n/,``)}\n${i}`}}}export{u as C,t as S,f as _,P as a,r as b,E as c,c as d,e as f,l as g,k as h,w as i,M as l,i as m,x as n,A as o,d as p,T as r,j as s,O as t,a as u,n as v,s as x,o as y};
@@ -0,0 +1 @@
1
+ var e=class extends Error{context;constructor(e,t){super(e),this.context=t,this.name=this.constructor.name,Object.setPrototypeOf(this,new.target.prototype)}},t=class extends e{code=`CONFIGURATION_ERROR`;category=`user`;recoverable=!1;constructor(e,t){super(`Configuration Error: ${e}`,t)}},n=class extends e{field;code=`VALIDATION_ERROR`;category=`user`;recoverable=!1;constructor(e,t,n){super(`Validation Error: ${e}`,n),this.field=t}},r=class extends e{issues;attempts;code=`STRUCTURED_OUTPUT_ERROR`;category=`provider`;recoverable=!0;constructor(e,t,n,r){super(`Structured Output Error: ${e}`,r),this.issues=t,this.attempts=n}},i=class extends e{provider;originalError;code=`PROVIDER_ERROR`;category=`provider`;recoverable=!0;status;type;constructor(e,t,n,r,i){super(`Provider Error (${t}): ${e}`,r),this.provider=t,this.originalError=n,i?.status!==void 0&&(this.status=i.status),i?.type!==void 0&&(this.type=i.type)}},a=class extends e{provider;code=`AUTHENTICATION_ERROR`;category=`user`;recoverable=!1;constructor(e,t,n){super(`Authentication Error: ${e}`,n),this.provider=t}},o=class extends e{retryAfter;provider;code=`RATE_LIMIT_ERROR`;category=`provider`;recoverable=!0;constructor(e,t,n,r){super(`Rate Limit Error: ${e}`,r),this.retryAfter=t,this.provider=n}},s=class extends e{originalError;code=`NETWORK_ERROR`;category=`system`;recoverable=!0;constructor(e,t,n){super(`Network Error: ${e}`,n),this.originalError=t}},c=class extends e{toolName;originalError;code=`TOOL_EXECUTION_ERROR`;category=`system`;recoverable=!1;constructor(e,t,n,r){super(`Tool Execution Error (${t}): ${e}`,r),this.toolName=t,this.originalError=n}},l=class extends e{toolName;callCount;maxSameToolInputs;code=`SAME_TOOL_INPUT_LOOP`;category=`system`;recoverable=!0;constructor(e,t,n,r){super(`Tool "${e}" was called with identical input ${t} times, past the maxSameToolInputs limit of ${n} — stopping the turn to break the loop`,r),this.toolName=e,this.callCount=t,this.maxSameToolInputs=n}},u=class extends e{availableModels;code=`MODEL_NOT_AVAILABLE`;category=`user`;recoverable=!1;constructor(e,t,n,r){super(`Model "${e}" is not available for provider "${t}"`,r),this.availableModels=n}},d=class extends e{pluginName;code=`PLUGIN_ERROR`;category=`system`;recoverable=!1;constructor(e,t,n){super(`Plugin Error (${t}): ${e}`,n),this.pluginName=t}},f=class extends e{code=`CACHE_INTEGRITY_ERROR`;category=`system`;recoverable=!1;constructor(e,t){super(`Cache Integrity Error: ${e}`,t)}},p=class extends e{executable;code=`UNSUPPORTED_SHELL`;category=`user`;recoverable=!1;constructor(e){super(`Unsupported shell executable: ${e}`,{executable:e}),this.executable=e}};function m(e){return e===`darwin`?'Host OS: macOS (POSIX, BSD userland). Use BSD-flavored utilities: `sed -i ""` needs an empty backup arg, `date`/`grep`/`stat` flags differ from GNU. Prefer portable POSIX flags; avoid Linux/GNU-only options.':e===`linux`?"Host OS: Linux (POSIX, usually GNU coreutils, but distro/user setup varies). Prefer portable POSIX flags; do not assume a specific distro, and probe with `command -v` before relying on a non-standard tool.":`Host OS: ${e}; active shell family: POSIX sh/bash. Write portable POSIX syntax and avoid host-specific flags.`}function h(e,t){let n=v(e)===`bash`?`bash`:`sh`;return{command:e,kind:n,platform:t,commandArgs:e=>[`-c`,e],interactiveArgs:[],label:`${n} on ${t}`,syntaxHint:m(t)}}function g(e,t){return{command:e,kind:`powershell`,platform:t,commandArgs:e=>[`-NoProfile`,`-Command`,e],interactiveArgs:[`-NoProfile`],label:`PowerShell on ${t}`,syntaxHint:`Host OS: ${t}; active shell family: PowerShell. Write PowerShell syntax (not bash): e.g. \`Get-ChildItem\` not \`ls -la\`, \`\$env:VAR\` not \`\$VAR\`.`}}function _(e,t){return{command:e,kind:`cmd`,platform:t,commandArgs:e=>[`/d`,`/s`,`/c`,e],interactiveArgs:[],label:`cmd.exe on ${t}`,syntaxHint:`Host OS: ${t}; active shell family: Windows cmd.exe. Write cmd.exe syntax.`}}function v(e){return(e.split(/[\\/]/).at(-1)?.toLowerCase()??``).replace(/\.exe$/i,``)}function y(e,t){switch(v(e)){case`sh`:case`bash`:return h(e,t);case`powershell`:case`pwsh`:return g(e,t);case`cmd`:return _(e,t);default:throw new p(e)}}function b(e){let t=e?.trim();return t===void 0||t.length===0?void 0:t}function x(e={}){let t=e.env??process.env,n=e.platform??process.platform,r=b(e.executable);return r===void 0?n===`win32`?g(`powershell.exe`,n):h(b(t.SHELL)??`/bin/sh`,n):y(r,n)}const S=/^(?!0{32}$)[0-9a-f]{32}$/,C=/^(?!0{16}$)[0-9a-f]{16}$/;function w(e){return e.replaceAll(`-`,``).slice(0,16)}const T=w;function E(e){return C.test(e)}function D(e,t){if(!(!S.test(e)||!C.test(t)))return`00-${e}-${t}-01`}function O(e,t){if(e.allowedOrigins.length===0)return;let n=D(e.traceId,w(t));if(n!==void 0)return{traceparent:n,allowedOrigins:[...e.allowedOrigins]}}function k(e,t){return O(e,t)}function A(e,t,n){if(t?.subprocessClasses?.includes(e)!==!0)return;let r=D(t.traceId,n);return r===void 0?void 0:{TRACEPARENT:r}}function j(e,t,n={}){if(t===void 0||n.TRACEPARENT!==void 0)return{...e,...n};let{TRACESTATE:r,...i}=e;return{...i,...t,...n}}function M(e,t){if(e===void 0||t===void 0)return{};let n;try{n=new URL(e).origin}catch{return{}}return n===`null`||!t.allowedOrigins.includes(n)?{}:{traceparent:t.traceparent}}const N=e=>`\n…[output truncated: ${e} byte(s) dropped]`;function P(e){let t=e.retain??`head`,n=e.truncationMarker??N,r=Math.max(0,Math.floor(e.maxBytes)),i=new TextEncoder,a=[],o=0,s=0,c=e=>{let t=r-o;if(t<=0)return;let n=e.byteLength<=t?e:e.subarray(0,t);a.push(n),o+=n.byteLength},l=e=>{let t=e.byteLength<=r?e:e.subarray(e.byteLength-r);for(a.push(t),o+=t.byteLength;o>r&&a.length>0;){let e=a[0],t=o-r;e.byteLength<=t?(a.shift(),o-=e.byteLength):(a[0]=e.subarray(t),o-=t)}};return{append(e){let n=typeof e==`string`?i.encode(e):e;s+=n.byteLength,t===`head`?c(n):l(n)},get retainedBytes(){return o},get totalBytes(){return s},get droppedBytes(){return s-o},get truncated(){return s>o},toString(){let e=new Uint8Array(o),r=0;for(let t of a)e.set(t,r),r+=t.byteLength;a=a.length>1?[e]:a;let i=new TextDecoder().decode(e);if(s<=o)return i;let c=n(s-o);return t===`head`?`${i}${c}`:`${c.replace(/^\n/,``)}\n${i}`}}}Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return o}});