@exploratory/cli 0.0.0-stage → 1.0.0-rc.1
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/LICENSE +21 -0
- package/README.md +116 -2
- package/bin/expl.js +2 -0
- package/cli/expl.bundle.js +1 -0
- package/package.json +25 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Exploratory, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,117 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Exploratory CLI (`expl`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[English](https://github.com/exploratory-io/exploratory-cli/blob/main/README.md) | [日本語](https://github.com/exploratory-io/exploratory-cli/blob/main/README.ja.md)
|
|
4
|
+
|
|
5
|
+
## About
|
|
6
|
+
|
|
7
|
+
`expl` is the command line for Exploratory. It runs the same operations that AI agents use, from a terminal, a shell script or a CI job. It works with Exploratory Server (exploratory.io) and with Exploratory Desktop.
|
|
8
|
+
|
|
9
|
+
**If you use Exploratory Desktop, you already have `expl`.** It is bundled with the app, `expl server` included, so you do not need this package. This package is for people without Desktop: Server-only users, CI jobs and servers.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
You need Node.js 20 or later.
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx @exploratory/cli@<version> --version
|
|
17
|
+
npm install -g @exploratory/cli@<version>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The package is `@exploratory/cli`; the command it installs is `expl`. Pin the version you want in place of `<version>`. Desktop users and anyone who has both copies installed should read the [install guide](https://github.com/exploratory-io/exploratory-cli/blob/main/docs/install.md).
|
|
21
|
+
|
|
22
|
+
## Sign in to Exploratory Server
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
expl server login
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
This opens your browser and saves a token on this computer. On a machine without a browser, run `expl server login --no-browser` and paste the redirect URL when asked. To use a server other than `https://exploratory.io`, pass `--url` or set `EXPL_SERVER_URL`.
|
|
29
|
+
|
|
30
|
+
## Quick start
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
expl server status
|
|
34
|
+
expl server tools list
|
|
35
|
+
expl server search "sales"
|
|
36
|
+
expl server fetch <id> --json
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`expl server tools list` shows every command the server offers.
|
|
40
|
+
|
|
41
|
+
## Use in CI
|
|
42
|
+
|
|
43
|
+
Create a token once, on a computer where you are signed in:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
expl server token create --name ci
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Store it as a secret and pass it as `EXPL_SERVER_TOKEN` (or `--token`). A GitHub Actions step looks like this; the full files are in [examples](https://github.com/exploratory-io/exploratory-cli/tree/main/examples).
|
|
50
|
+
|
|
51
|
+
```yaml
|
|
52
|
+
- uses: actions/setup-node@v4
|
|
53
|
+
with:
|
|
54
|
+
node-version: 22
|
|
55
|
+
- run: npx @exploratory/cli@<version> server fetch <id> --json
|
|
56
|
+
env:
|
|
57
|
+
EXPL_SERVER_TOKEN: ${{ secrets.EXPL_SERVER_TOKEN }}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Use with Exploratory Desktop
|
|
61
|
+
|
|
62
|
+
Commands such as `expl project list` and `expl chart get` talk to the Exploratory Desktop running on the same computer. Desktop must be running and signed in. If it is not running, `expl` exits with code 3; if you are signed out or lack permission, with code 4. See the [Desktop guide](https://github.com/exploratory-io/exploratory-cli/blob/main/docs/desktop.md) for arguments, confirmations and flags.
|
|
63
|
+
|
|
64
|
+
## Use from AI agents
|
|
65
|
+
|
|
66
|
+
An agent can run `expl` from its shell. To teach Claude Code or Codex about it, save the skill that `expl` prints:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
mkdir -p ~/.claude/skills/exploratory-expl
|
|
70
|
+
expl skill > ~/.claude/skills/exploratory-expl/SKILL.md
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`expl server skill` prints the one for Exploratory Server. Copies of both are in [skills](https://github.com/exploratory-io/exploratory-cli/tree/main/skills). If you prefer MCP, use the [Exploratory plugin](https://github.com/exploratory-io/exploratory). See the [agents guide](https://github.com/exploratory-io/exploratory-cli/blob/main/docs/agents.md).
|
|
74
|
+
|
|
75
|
+
## Exit codes
|
|
76
|
+
|
|
77
|
+
| Code | Meaning |
|
|
78
|
+
|---|---|
|
|
79
|
+
| 0 | Success |
|
|
80
|
+
| 1 | The operation failed |
|
|
81
|
+
| 2 | Wrong usage |
|
|
82
|
+
| 3 | Desktop or Server cannot be reached |
|
|
83
|
+
| 4 | Authentication or permission |
|
|
84
|
+
| 130 | Interrupted with Ctrl+C |
|
|
85
|
+
|
|
86
|
+
## Documentation
|
|
87
|
+
|
|
88
|
+
- [Install](https://github.com/exploratory-io/exploratory-cli/blob/main/docs/install.md)
|
|
89
|
+
- [Exploratory Server](https://github.com/exploratory-io/exploratory-cli/blob/main/docs/server.md)
|
|
90
|
+
- [Exploratory Desktop](https://github.com/exploratory-io/exploratory-cli/blob/main/docs/desktop.md)
|
|
91
|
+
- [AI agents](https://github.com/exploratory-io/exploratory-cli/blob/main/docs/agents.md)
|
|
92
|
+
- [Exploratory CLI on exploratory.io](https://exploratory.io/cli)
|
|
93
|
+
|
|
94
|
+
## What is sent and recorded
|
|
95
|
+
|
|
96
|
+
`expl` sends no usage analytics of its own. It talks only to Exploratory Desktop on your computer and to the Exploratory Server you sign in to.
|
|
97
|
+
|
|
98
|
+
- **Exploratory Desktop.** Commands go to the Desktop app over a local connection on your computer. Desktop keeps a log of each tool call on your computer (tool name, parameter names without their values, result, duration) and deletes it after 90 days. While you are signed in and AI features are on, Desktop also sends one usage record for each tool call to the exploratory.io server you are signed in to, as it does for the Desktop MCP (never for local data catalog tools). A record holds the tool name and its arguments (which can include formulas and values you entered), success or failure with the error type and message, the size of the result (not the content), the duration, the Desktop version, the client name and version, and the session and item IDs.
|
|
99
|
+
- **Exploratory Server (`expl server`).** The server records the following. It records the same when an AI app connects to Exploratory through MCP.
|
|
100
|
+
- **Tokens:** stored as hashes, not as plain text, with the creation time, expiry and last use. You can see and revoke them in Connected AI Apps.
|
|
101
|
+
- **Data access log:** the item, your user ID and email address, the channel (`cli`), the operation, the client name, the IP address, the result and error code, and the duration. Kept for 90 days by default (1 to 400 days, set on the server).
|
|
102
|
+
- **Server log:** each tool call (email address, client, result, row count, duration), and when a token is created or deleted.
|
|
103
|
+
- **Errors of failed calls:** the time, the tool call and the error are collected to improve the product.
|
|
104
|
+
|
|
105
|
+
## Versions
|
|
106
|
+
|
|
107
|
+
This package has its own version, starting at 1.0.0. Each version is taken from the `expl` in an Exploratory Desktop release, and the [changelog](https://github.com/exploratory-io/exploratory-cli/blob/main/CHANGELOG.md) names which one. A new Server tool does not need a new CLI, because the command list is fetched from the server each time.
|
|
108
|
+
|
|
109
|
+
## Support and security
|
|
110
|
+
|
|
111
|
+
Questions and bug reports: see [SUPPORT.md](https://github.com/exploratory-io/exploratory-cli/blob/main/SUPPORT.md). Vulnerabilities: see [SECURITY.md](https://github.com/exploratory-io/exploratory-cli/blob/main/SECURITY.md); please do not open a public issue.
|
|
112
|
+
|
|
113
|
+
## About the source
|
|
114
|
+
|
|
115
|
+
The source of `expl` is developed together with Exploratory Desktop and is not in this repository. This repository holds the published package, the documentation and the release checks. Pull requests that fix the documentation are welcome; report CLI bugs as issues.
|
|
116
|
+
|
|
117
|
+
License: MIT
|
package/bin/expl.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{var e={755(e,t,n){const r=n(317),o=n(982),i=n(896),s=n(928),a="credential.dpapi",c=/^[A-Za-z0-9_.-]{16,200}$/,l=/^[A-Za-z0-9+/]{16,4096}={0,2}$/,u="powershell.exe",p=["-NoProfile","-NonInteractive","-Command","-"];function d(){}function f(e,t,n){const o=n||{};return new Promise(function(n,i){let a;try{a=r.execFile(e,t,{encoding:"utf8",timeout:3e4,maxBuffer:1048576,windowsHide:!0},function(t,r){if(t){const n=new Error("Command failed: "+s.basename(e));return n.code=t.code,void i(n)}n({stdout:r})})}catch(t){const n=new Error("Command could not start: "+s.basename(e));return n.code=t&&t.code,void i(n)}a.stdin.on("error",d),a.stdin.end(void 0===o.input?void 0:o.input)})}function m(e){for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<=31||127===n)return!0}return!1}function h(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'}function g(e,t,n){try{const r=e.fs.readFileSync(t,"utf8").trim();return n.test(r)?r:null}catch(e){return null}}function _(e,t,n){const r=t+"."+o.randomBytes(4).toString("hex")+".tmp";try{e.fs.mkdirSync(e.agentDir,{recursive:!0,mode:448}),e.fs.writeFileSync(r,n,{mode:384}),e.fs.renameSync(r,t)}catch(n){try{e.fs.unlinkSync(r)}catch(e){}throw new Error("Could not write "+t+" ("+(n&&n.code||"error")+")")}}function E(e,t){try{e.fs.unlinkSync(t)}catch(e){if(!e||"ENOENT"!==e.code)throw new Error("Could not remove "+t+" ("+(e&&e.code||"error")+")")}}function w(e){return["$ErrorActionPreference = 'Stop'","Add-Type -AssemblyName System.Security","$plain = '"+e+"'","$bytes = [Security.Cryptography.ProtectedData]::Protect([Text.Encoding]::UTF8.GetBytes($plain), $null, [Security.Cryptography.DataProtectionScope]::CurrentUser)","[Convert]::ToBase64String($bytes)"].join("\n")+"\n"}function y(e){return["$ErrorActionPreference = 'Stop'","Add-Type -AssemblyName System.Security","$blob = [Convert]::FromBase64String('"+e+"')","$bytes = [Security.Cryptography.ProtectedData]::Unprotect($blob, $null, [Security.Cryptography.DataProtectionScope]::CurrentUser)","[Text.Encoding]::UTF8.GetString($bytes)"].join("\n")+"\n"}const N={darwin:{name:"security",set:function(e,t){const n="add-generic-password -U -s "+h(e.service)+" -a "+h(e.account)+" -w "+h(t)+"\n";return e.execFile("security",["-i"],{input:n}).then(d)},get:function(e){return e.execFile("security",["find-generic-password","-s",e.service,"-a",e.account,"-w"],{}).then(function(e){return e.stdout})},remove:function(e){return e.execFile("security",["delete-generic-password","-s",e.service,"-a",e.account],{}).then(d)}},linux:{name:"secret-tool",set:function(e,t){return e.execFile("secret-tool",["store","--label="+e.service,"service",e.service,"account",e.account],{input:t}).then(d)},get:function(e){return e.execFile("secret-tool",["lookup","service",e.service,"account",e.account],{}).then(function(e){return e.stdout})},remove:function(e){return e.execFile("secret-tool",["clear","service",e.service,"account",e.account],{}).then(d)}},win32:{name:"dpapi",set:function(e,t){return e.execFile(u,p,{input:w(t)}).then(function(t){const n=String(t.stdout).trim();if(!l.test(n))throw new Error("DPAPI did not return a protected blob");_(e,s.join(e.agentDir,a),n+"\n")})},get:function(e){const t=g(e,s.join(e.agentDir,a),l);return null===t?Promise.resolve(null):e.execFile(u,p,{input:y(t)}).then(function(e){return e.stdout})},remove:function(e){try{return E(e,s.join(e.agentDir,a)),Promise.resolve()}catch(e){return Promise.reject(e)}}}};e.exports={create:function(e){const t=e||{},n=void 0===t.service||null===t.service?"Exploratory MCP":t.service;if("string"!=typeof n||""===n||m(n))throw new Error("service must be a non-empty string without control characters");if("string"!=typeof t.account||""===t.account||m(t.account))throw new Error("account must be a non-empty string without control characters");if("string"!=typeof t.agentDir||""===t.agentDir)throw new Error("agentDir is required");const r=t.platform||process.platform,o=N[r]||null,a={service:n,account:t.account,agentDir:t.agentDir,fs:t.fs||i,execFile:t.execFile||f},l=s.join(a.agentDir,"credential");return{get:async function(){if(o)try{const e=await o.get(a),t=null==e?"":String(e).trim();if(c.test(t))return t}catch(e){}return g(a,l,c)},set:async function(e){!function(e){if("string"!=typeof e||!c.test(e))throw new Error("The credential is not in the expected format (16 to 200 characters of A-Z a-z 0-9 _ . -)")}(e);let t=!1;if(o)try{return await o.set(a,e),function(e,t){try{E(e,t)}catch(e){}}(a,l),{where:"keychain"}}catch(e){n=e,t=Boolean(n)&&"ENOENT"===n.code}var n;return _(a,l,e+"\n"),o&&!t&&await o.remove(a).catch(d),{where:"file"}},remove:async function(){o&&await o.remove(a).catch(d),E(a,l)},isSecure:async function(){return null===g(a,l,c)},describe:function(){return{backend:o?o.name:"file",service:a.service,account:a.account,file:l}}}}}},548(e,t,n){n(439);const r=["metadata","aggregates","sample","row_level"];e.exports={normalize:function(e){return r.indexOf(e)>=0?e:"row_level"}}},439(e,t,n){const r=n(515),o=-32001,i={DESKTOP_NOT_RUNNING:!0,NOT_SIGNED_IN:!0,UNAUTHORIZED:!0,CHANNEL_DISABLED:!0,PAIRING_PENDING:!0,PAIRING_REQUIRED:!0,PROJECT_NOT_OPEN:!0,NOT_FOUND:!0,PERMISSION_DENIED:!0,CONFIRMATION_REQUIRED:!0,CONFIRMATION_DECLINED:!0,INVALID_PARAMETER:!0,INVALID_COLUMN:!0,INVALID_COLUMN_TYPE:!0,REVISION_CONFLICT:!0,EXECUTION_FAILED:!0,EXECUTION_TIMEOUT:!0,R_REQUIRED:!0,PDF_EXPORT_FAILED:!0,PDF_EXPORT_TIMEOUT:!0,RESOURCE_BUSY:!0,DATA_EGRESS_LIMIT:!0,UNSUPPORTED_OPERATION:!0,VERSION_MISMATCH:!0};class s extends Error{constructor(e,t,n){if(!i[e])throw new Error("Unknown agent error code: "+e);super(t||r.t("en",e+".message")),this.name="AgentError",this.code=e,this.details=n||{},Object.defineProperty(this,"isDefaultMessage",{value:!t,writable:!0}),Object.defineProperty(this,"actionKey",{value:e+".action",writable:!0})}toJSON(e){const t=Object.assign({},this.details,{error_code:this.code,message:this.isDefaultMessage?r.t(e,this.code+".message"):this.message});return t.suggested_actions||(t.suggested_actions=[r.t(e,this.actionKey)]),t}toJsonRpcResponse(e,t){const n=this.toJSON(t);return{jsonrpc:"2.0",id:void 0===e?null:e,error:{code:o,message:n.message,data:n}}}}s.parseToolErrorText=function(e){const t=e||"",n=t.split("\n"),r=n[0]||"",o=/^([A-Z][A-Z0-9_]+): ([\s\S]*)$/.exec(r);if(o&&i[o[1]]){let e=null;const t=[];let r=n.findIndex(function(e,t){return t>0&&0===e.indexOf("Details: ")});r<0&&(r=n.findIndex(function(e,t){return t>0&&0===e.indexOf("- ")})),r<0&&(r=n.length),o[2]=n.slice(0,r).join("\n").slice(o[1].length+2);for(let r=1;r<n.length;r++){const o=n[r];if(0===o.indexOf("Details: "))try{e=JSON.parse(o.slice(9))}catch(e){}else 0===o.indexOf("- ")&&t.push(o.slice(2))}return{errorCode:o[1],message:o[2],details:e,suggestedActions:t}}return/^Input validation error/.test(t)?{errorCode:"INVALID_PARAMETER",message:t,details:null,suggestedActions:[]}:(/^Output validation error/.test(t),{errorCode:"EXECUTION_FAILED",message:t,details:null,suggestedActions:[]})},s.markRBusy=function(e){return e.details.retryable=!0,e.actionKey="RESOURCE_BUSY.r_busy.action",e},s.from=function(e){const t=e&&e.message?String(e.message):String(e);return"There is another R process running."!==t||e instanceof s&&"EXECUTION_FAILED"!==e.code?e instanceof s?e:new s("EXECUTION_FAILED",t):s.markRBusy(new s("RESOURCE_BUSY",t,Object.assign({},e&&e.details)))},s.CODES=Object.freeze(Object.keys(i)),s.JSON_RPC_AGENT_ERROR_CODE=o,e.exports=s},515(e,t,n){const r={en:n(169),ja:n(719)};e.exports={t:function(e,t){const n=r["ja"===e?"ja":"en"][t];if("string"!=typeof n)throw new Error("Unknown agent error message key: "+t);return n}}},85(e){e.exports={MAX_OPERATION_WAIT_MS:25e3}},823(e,t,n){n(896);const r=n(928);n(548),e.exports={agentDir:function(e){return r.join(e,"agent")}}},495(e,t,n){const{ExplError:r}=n(877),{t:o}=n(42),i=[{key:"project",names:["--project"],value:!0},{key:"json",names:["--json"],value:!1},{key:"yes",names:["--yes","-y"],value:!1},{key:"noWait",names:["--no-wait"],value:!1},{key:"timeoutSec",names:["--timeout"],value:!0},{key:"quiet",names:["--quiet","-q"],value:!1},{key:"verbose",names:["--verbose"],value:!1},{key:"input",names:["--input"],value:!0},{key:"output",names:["--output"],value:!0},{key:"help",names:["--help","-h"],value:!1},{key:"version",names:["--version"],value:!1}];function s(e,t){const n=String(e),r=String(t),o=n.length,i=r.length;if(!o)return i;if(!i)return o;const s=new Array(i+1);for(let e=0;e<=i;e++)s[e]=e;for(let e=1;e<=o;e++){let t=s[0];s[0]=e;for(let o=1;o<=i;o++){const i=s[o];s[o]=n[e-1]===r[o-1]?t:1+Math.min(t,s[o],s[o-1]),t=i}}return s[i]}function a(e,t){return t.map(function(t){return{name:t,d:s(e,t)}}).filter(function(e){return e.d<=2}).sort(function(e,t){return e.d-t.d||e.name.localeCompare(t.name)}).slice(0,3).map(function(e){return e.name})}function c(e,t,n,s){const a=s||i;for(let i=0;i<a.length;i++){const s=a[i];for(let i=0;i<s.names.length;i++){const a=s.names[i];if(e===a){if(s.value){const e=t[n+1];if(void 0===e)throw new r("USAGE",o("args.missing_value",{name:a}));return{key:s.key,value:e,nextIndex:n+2}}return{key:s.key,value:!0,nextIndex:n+1}}if(0===a.indexOf("--")&&0===e.indexOf(a+"="))return{key:s.key,value:e.slice(a.length+1),nextIndex:n+1}}}return null}function l(e,t,n){if("url"!==t&&"token"!==t&&"output"!==t)if("noBrowser"!==t){if("timeoutSec"===t){const t=Number(n);if(!Number.isFinite(t))throw new r("USAGE",o("args.invalid_timeout"));return void(e.timeoutSec=t)}e[t]="project"!==t&&"input"!==t&&"output"!==t||n}else e.noBrowser=!0;else e[t]=n}function u(e,t,n){return n&&0===e.indexOf("@")&&e.length>1?t.readFile(e.slice(1)):e}function p(e,t){const n=0===e.indexOf("@")&&e.length>1?t.readFile(e.slice(1)):e;try{return JSON.parse(n)}catch(e){throw new r("USAGE",o("args.json_parse",{error:e.message}))}}function d(e,t){const n=t.unionTypes||[];if("null"===e&&n.indexOf("null")>=0)return null;if(("true"===e||"false"===e)&&n.indexOf("boolean")>=0)return"true"===e;const i=Number(e);if(""!==e&&Number.isFinite(i)&&(n.indexOf("number")>=0||n.indexOf("integer")>=0&&Number.isInteger(i)))return i;if(n.indexOf("string")>=0)return e;throw new r("USAGE",o("args.invalid_value_types",{flag:t.name,types:n.join(" or ")}))}function f(e,t,n){if("boolean"===t.itemKind){if("true"!==e&&"false"!==e)throw new r("USAGE",o("args.invalid_boolean",{flag:t.name}));return"true"===e}if("number"===t.itemKind||"integer"===t.itemKind){const n=Number(e);if(""===e||!("integer"===t.itemKind?Number.isInteger(n):Number.isFinite(n)))throw new r("USAGE",o("args.invalid_item",{kind:t.itemKind,flag:t.name}));return n}return u(e,n,!0)}function m(e,t,n,i){const s=a(t,n.map(function(e){return e.name}));let c=o("args.unknown_flag",{prefix:i,flag:t,noun:e.noun,verb:e.verb});return s.length&&(c+=o("args.did_you_mean_flag",{flag:s[0]})),new r("USAGE",c)}e.exports={SERVER_FLAG_SPECS:[{key:"url",names:["--url"],value:!0},{key:"token",names:["--token"],value:!0},{key:"output",names:["--output","-o"],value:!0},{key:"noBrowser",names:["--no-browser"],value:!1}],splitGlobals:function(e,t){const n=t?i.concat(t):i,r={project:null,json:!1,yes:!1,noWait:!1,timeoutSec:null,quiet:!1,verbose:!1,input:null,output:null,help:!1,version:!1};t&&t.forEach(function(e){r[e.key]=!!e.value&&null});const o=e.indexOf("--"),s=o>=0?e.slice(0,o):e.slice(),a=o>=0?e.slice(o+1):[],u=[];let p=0;for(;p<s.length;){const e=c(s[p],s,p,n);e?(l(r,e.key,e.value),p=e.nextIndex):(u.push(s[p]),p++)}for(let e=0;e<a.length;e++)u.push(a[e]);return{globals:r,rest:u}},toToolArgs:function(e,t,n,i,s){s=s||"expl";const a=Object.assign({},i||{}),c=Object.create(null);e.flags.forEach(function(e){c[e.name]=e});let l=!1,h=0;for(;h<t.length;){const i=t[h];if(0!==i.indexOf("--")){if(!e.positional)throw new r("USAGE",o("args.unexpected_argument",{prefix:s,token:i,noun:e.noun,verb:e.verb}));if(l)throw new r("USAGE",o("args.too_many_positional"));a[e.positional]=i,l=!0,h++;continue}let g=i.slice(2),_=null;const E=g.indexOf("=");E>=0&&(_=g.slice(E+1),g=g.slice(0,E));let w=null,y=!0;if(0===g.indexOf("no-")){const e=g.slice(3),t=c[e];t&&"boolean"===t.kind&&(w=t,y=!1,g=e)}if(w||(w=c[g]),!w)throw m(e,g,e.flags,s);if("boolean"===w.kind){a[w.prop]=y,h++;continue}let N=_;if(null===N){if(N=t[h+1],void 0===N)throw new r("USAGE",o("args.missing_value",{name:"--"+w.name}));h+=2}else h++;if("string"===w.kind){const e=u(N,n,!0);if(w.enumValues&&w.enumValues.indexOf(e)<0)throw new r("USAGE",o("args.invalid_enum",{flag:w.name,values:w.enumValues.join(", ")}));a[w.prop]=e;continue}if("number"===w.kind){const e=Number(N);if(!Number.isFinite(e))throw new r("USAGE",o("args.invalid_number",{flag:w.name}));a[w.prop]=e;continue}if("integer"===w.kind){const e=Number(N);if(!Number.isInteger(e))throw new r("USAGE",o("args.invalid_integer",{flag:w.name}));a[w.prop]=e;continue}if(w.enumValues&&w.enumValues.indexOf(N)<0)throw new r("USAGE",o("args.invalid_enum",{flag:w.name,values:w.enumValues.join(", ")}));if("scalarArray"===w.kind){const e=f(N,w,n);Array.isArray(a[w.prop])||(a[w.prop]=[]),a[w.prop].push(e);continue}"json"!==w.kind?"scalarUnion"!==w.kind?a[w.prop]=p(N,n):a[w.prop]=d(N,w):a[w.prop]=p(N,n)}return a},suggest:a}},965(e,t,n){const r=n(982),o=n(262),i=n(287),s=n(755),a=n(439),{ExplError:c,fromJsonRpcError:l,fromToolResult:u}=n(877),{t:p,getLang:d}=n(42),f="expl",m="x-exploratory-include-tool-meta",h="x-exploratory-tool-timeout-sec";e.exports={create:function(e){const t=e.agentDir,n=e.env||{},g=e.sessionId,_=e.clientVersion,E=e.onTrace;let w=0;const y=e.credentials||i.create({env:n,channel:"cli",store:s.create({agentDir:t,account:"cli-"+r.createHash("sha256").update(t).digest("hex").slice(0,12)}),pair:function(e){const n=o.readEndpoint(t);return n?o.requestPairing({socketPath:n.socket,channel:"cli",name:e}):Promise.resolve(null)}});let N=!1;function O(n,r,i){const s=o.readEndpoint(t);return s?y.resolve(f,{maxWaitMs:12e4,onPending:function(){!N&&e.onPairingWait&&(N=!0,e.onPairingWait())}}).then(function(e){if(e.token)return e;if("pending"===e.pairing)throw new c("PAIRING_PENDING");if("declined"===e.pairing)throw new c("PAIRING_REQUIRED");if("error"===e.pairing&&e.error)throw new c(e.error,null,null,new a(e.error).toJSON("en").suggested_actions);throw new c("DESKTOP_NOT_RUNNING")}).then(function(e){return function(e,t,n,r,i){const s=++w,a={jsonrpc:"2.0",id:s,method:n,params:r},u=JSON.stringify(a),m=function(e,t){const n={Host:"localhost",Accept:"application/json, text/event-stream","Content-Type":"application/json","x-exploratory-client-name":f,"x-exploratory-client-version":_,"x-exploratory-guide-session":g,"x-exploratory-ui-lang":d()};return t&&(n.Authorization="Bearer "+t),e&&Object.assign(n,e),n["x-exploratory-channel"]="cli",n}(i,t.token);m["Content-Length"]=Buffer.byteLength(u);let h=null;const N=[];return o.post({socketPath:e.socket,headers:m,body:u,onMessage:function(e){N.push(e),e&&e.id===s&&(h=e)}}).then(function(e){if(E&&E(JSON.stringify({method:n,params:r,id:s,messages:N})),e.connectError||!e.complete)throw new c("DESKTOP_NOT_RUNNING");if(!h)throw new c("EXECUTION_FAILED",p("client.no_response"));if(h.error){const e=l(h.error);throw"UNAUTHORIZED"===e.errorCode&&y.forget(t),e}return h.result})}(s,e,n,r,i)}):Promise.reject(new c("DESKTOP_NOT_RUNNING"))}return{listTools:function(){const e=[];let t=null;const n=function(){return O("tools/list",t?{cursor:t}:{},{[m]:"true"}).then(function(r){return r&&r.tools&&e.push.apply(e,r.tools),t=r&&r.nextCursor?r.nextCursor:null,t?n():e})};return n()},callTool:function(e,t,n){return O("tools/call",{name:e,arguments:t||{}},n&&n.timeoutSec>0?{[h]:String(n.timeoutSec)}:void 0).then(function(e){if(e&&e.isError)throw u(e);return e})},initialize:function(){return O("initialize",{protocolVersion:"2025-11-25",capabilities:{},clientInfo:{name:f,version:_}}).then(function(e){return{instructions:"string"==typeof e.instructions?e.instructions:null,serverInfo:e.serverInfo||{}}})}}}}},213(e){const t=["project","json","yes","no-wait","timeout","quiet","verbose","input","help","version"],n="confirmed_by_user";function r(e){return String(e).replace(/_/g,"-").replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function o(e){return!(!e||"object"!=typeof e)&&("string"===e.type||"number"===e.type||"integer"===e.type||"boolean"===e.type||"null"===e.type||(Array.isArray(e.type)?e.type.every(function(e){return"string"===e||"number"===e||"integer"===e||"boolean"===e||"null"===e}):!!Array.isArray(e.anyOf)&&e.anyOf.length>0&&e.anyOf.every(o)))}function i(e){return Array.isArray(e.anyOf)?e.anyOf.reduce(function(e,t){return e.concat(i(t))},[]):[].concat(e.type)}function s(e){return("id"===e||/(_id|[a-z]Id)$/.test(e))&&"project_id"!==e}function a(e){return String(e).replace(/(_id|Id)$/,"").replace(/_/g,"").toLowerCase()}function c(e,c){const l=c||t,u=e._meta&&e._meta["exploratory/capability_id"];if(!u)throw new Error("Tool "+e.name+" is missing exploratory/capability_id");let p,d;if(u.indexOf(".")<0)p=u,d="";else{const e=u.indexOf(".");p=u.slice(0,e),d=r(u.slice(e+1))}const f=e.inputSchema||{},m=f.properties||{},h=f.required||[],g=h.filter(s),_=Object.prototype.hasOwnProperty.call(m,"project_id"),E=e._meta&&e._meta["exploratory/positional"];let w=null;if(E&&Object.prototype.hasOwnProperty.call(m,E))w=E;else if(1===g.length)w=g[0];else if(0===g.length){const e=Object.keys(m).filter(function(e){return s(e)&&a(e)===p});1===e.length&&(w=e[0])}"project"===p&&_&&0===g.length&&(w="project_id");const y=[],N=[],O=new Set;return Object.keys(m).forEach(function(t){if("project_id"===t||t===n)return;const s=r(t);if(l.indexOf(s)>=0)return void y.push(t);if(O.has(s))throw new Error("Duplicate flag "+s+" on tool "+e.name);O.add(s);const a=function(e){if("boolean"===e.type)return{kind:"boolean",itemKind:null,enumValues:null};if("string"===e.type||"number"===e.type||"integer"===e.type)return{kind:e.type,itemKind:null,enumValues:e.enum||null};if("array"===e.type&&e.items){const t=e.items.type;return"string"===t||"number"===t||"integer"===t||"boolean"===t?{kind:"scalarArray",itemKind:t,enumValues:null}:{kind:"json",itemKind:null,enumValues:null}}return"object"===e.type?{kind:"json",itemKind:null,enumValues:null}:o(e)?{kind:"scalarUnion",itemKind:null,enumValues:null,unionTypes:i(e)}:{kind:"json",itemKind:null,enumValues:null}}(m[t]);N.push(Object.assign({name:s,prop:t,required:h.indexOf(t)>=0,description:m[t].description||""},a))}),{noun:p,verb:d,toolName:e.name,capabilityId:u,risk:e._meta["exploratory/risk"]||"LOW",readOnly:!(!e.annotations||!e.annotations.readOnlyHint),description:e.description||"",inputSchema:f,positional:w,flags:N,jsonOnly:y,requiresProject:_,projectOptional:_&&h.indexOf("project_id")<0,confirmsByUser:Object.prototype.hasOwnProperty.call(m,n)}}e.exports={GLOBAL_FLAGS:t,SERVER_FLAGS:["url","token","output","no-browser"],kebab:r,isEntityIdProp:s,entityOfIdProp:a,build:function(e,n){const r=(n=n||{}).globalFlags||t,o=[],i=Object.create(null),s=Object.create(null);return e.forEach(function(e){const t=c(e,r),n=t.noun+"\0"+t.verb;if(i[n])throw new Error("Duplicate command "+t.noun+" "+t.verb+" for tools "+i[n].toolName+" and "+e.name);i[n]=t,s[e.name]=t,o.push(t)}),{commands:o,find:function(e,t){return i[e+"\0"+t]||null},byToolName:function(e){return s[e]||null}}}}},648(e,t,n){const r=n(213),o={bash:['# expl completion for bash. Add to ~/.bashrc: eval "$(expl completion bash)"',"_expl() {"," # Slice the words before IFS changes: bash 3.2 (the macOS default) joins a quoted ${a[@]:1:n} slice into one word",' # when IFS has no space, so `expl dashboard pu` would reach __complete as the single argument "dashboard pu".',' local words=("${COMP_WORDS[@]:1:COMP_CWORD}")'," local IFS=$'\\n'",' COMPREPLY=($(expl __complete "${words[@]}" 2>/dev/null))',"}","complete -o default -F _expl expl"],zsh:['# expl completion for zsh. Add to ~/.zshrc: eval "$(expl completion zsh)"',"_expl() {"," local -a candidates",' candidates=("${(@f)$(expl __complete "${(@)words[2,CURRENT]}" 2>/dev/null)}")'," compadd -a candidates","}","compdef _expl expl"],powershell:["# expl completion for PowerShell. Add to $PROFILE: expl completion powershell | Out-String | Invoke-Expression","Register-ArgumentCompleter -Native -CommandName expl -ScriptBlock {"," param($wordToComplete, $commandAst, $cursorPosition)"," $words = @($commandAst.CommandElements | Select-Object -Skip 1 | ForEach-Object { $_.ToString() })"," if ($wordToComplete -eq '') { $words += '' }"," expl __complete @words 2>$null | ForEach-Object {"," [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)"," }","}"]},i={tools:["describe","list"],completion:["bash","powershell","zsh"],token:["create","list","revoke"]},s=["call","completion","help","lang","skill","status","tools"],a=["call","help","login","logout","skill","status","token","tools"];e.exports={script:function(e){return o[e]?o[e].join("\n")+"\n":null},complete:function(e,t,n){if("server"===e[0])return function(e,t){const n=t?t.commands:[],o=e.length?e[e.length-1]:"",s=e.slice(0,-1);let c=[];if(0===s.length)c=a.concat(n.map(function(e){return e.noun}));else if(1===s.length){const e=s[0];c=(i[e]||[]).concat(n.filter(function(t){return t.noun===e}).map(function(e){return e.verb}).filter(Boolean)),"call"===e&&(c=n.map(function(e){return e.toolName}))}else if(0===o.indexOf("-")){const e="call"===s[0]?t&&t.byToolName(s[1]):t&&t.find(s[0],s[1]||""),n=e?e.flags.map(function(e){return"boolean"===e.kind?["--"+e.name,"--no-"+e.name]:["--"+e.name]}):[];c=[].concat.apply([],n).concat(r.SERVER_FLAGS.map(function(e){return"--"+e}))}return c.filter(function(e,t){return c.indexOf(e)===t&&0===e.indexOf(o)}).sort()}(e.slice(1),n);const o=t?t.commands:[],c=e.length?e[e.length-1]:"",l=e.slice(0,-1);let u=[];if(0===l.length)u=s.concat(["server"]).concat(o.map(function(e){return e.noun}));else if(1===l.length){const e=l[0];u=(i[e]||[]).concat(o.filter(function(t){return t.noun===e}).map(function(e){return e.verb})),"project"===e&&u.push("use"),"call"===e&&(u=o.map(function(e){return e.toolName}))}else if(0===c.indexOf("-")){const e="call"===l[0]?t&&t.byToolName(l[1]):t&&t.find(l[0],l[1]),n=e?e.flags.map(function(e){return"boolean"===e.kind?["--"+e.name,"--no-"+e.name]:["--"+e.name]}):[];u=[].concat.apply([],n).concat(r.GLOBAL_FLAGS.map(function(e){return"--"+e}))}return u.filter(function(e,t){return u.indexOf(e)===t&&0===e.indexOf(c)}).sort()}}},877(e,t,n){const r=n(439),o=n(42);class i extends Error{constructor(e,t,n,i){const s=o.localizeErrorDefaults(e,t,i||[]);let a=s.message;if(!a)try{a=new r(e).message}catch(t){a=e}super(a),this.name="ExplError",this.errorCode=e,this.details=n||null,this.suggestedActions=s.actions}}e.exports={ExplError:i,exitCodeFor:function(e){return"USAGE"===e?2:"INTERRUPTED"===e?130:"BROKEN_PIPE"===e?0:"SERVER_UNREACHABLE"===e||"DESKTOP_NOT_RUNNING"===e?3:"NOT_LOGGED_IN"===e||"NOT_SIGNED_IN"===e||"UNAUTHORIZED"===e||"PERMISSION_DENIED"===e||"PAIRING_REQUIRED"===e||"CHANNEL_DISABLED"===e?4:1},fromJsonRpcError:function(e){const t=e&&e.data?e.data:{},n=t.error_code||"EXECUTION_FAILED",r=t.suggested_actions||[],o=Object.assign({},t);delete o.error_code,delete o.message,delete o.suggested_actions;const s=Object.keys(o);return new i(n,e.message||t.message,s.length?o:null,r)},fromToolResult:function(e){const t=e&&e.content&&e.content[0]&&e.content[0].text,n=e&&e.structuredContent||function(e){if("string"!=typeof e||"{"!==e.charAt(0))return null;try{const t=JSON.parse(e);return t&&"object"==typeof t?t:null}catch(e){return null}}(t),o=n&&n.error;if(o&&"object"==typeof o&&"string"==typeof o.code){const e=Object.assign({},o);return delete e.code,delete e.message,new i(o.code,o.message||o.code,Object.keys(e).length?e:null,[])}if(n&&"string"==typeof n.error_code){const e=Object.assign({},n);delete e.error_code,delete e.message,delete e.suggested_actions;const t=Object.keys(e);return new i(n.error_code,n.message||n.error_code,t.length?e:null,n.suggested_actions||[])}const s=r.parseToolErrorText(t||"");return new i(s.errorCode,s.message,s.details,s.suggestedActions)},fromHttpAuthError:function(e){const t="login"===e.source?"NOT_LOGGED_IN":"UNAUTHORIZED";let n="The server rejected the token.";const r=e.wwwAuthenticate||"",o=r.match(/error_description="([^"]*)"/i)||r.match(/error_description=([^,\s]+)/i);return o&&o[1]&&(n=o[1].replace(/\\"/g,'"')),new i(t,n,{source:e.source},[])}}},736(e,t,n){const r=n(896),o=n(928),i="ja",s="en";e.exports={readUILang:function(e,t){try{const n=(t||r).readFileSync(o.join(e,"..","userconf.json"),"utf8");return JSON.parse(n).ui_lang===i?i:s}catch(e){return s}},JAPANESE:i,ENGLISH:s}},107(e,t,n){const r=n(495),o=n(213),i=n(648),s=n(351),a=n(876),c=n(821),l=n(677),u=n(947),{ExplError:p,exitCodeFor:d}=n(877),{t:f,setLang:m}=n(42),h={status:!0,tools:!0,call:!0,help:!0,skill:!0,completion:!0,lang:!0},g=["en","ja"];function _(e,t){t.stdout&&e.stdout.write(t.stdout),t.stderr&&e.stderr.write(t.stderr)}function E(e,t,n){const r=e instanceof p?e:new p("EXECUTION_FAILED",e&&e.message?e.message:String(e));return"BROKEN_PIPE"===r.errorCode||_(t,s.renderError(r,{json:n})),d(r.errorCode)}function w(e){return o.build(e)}async function y(e){try{return(await e.callTool("get_environment",{})).structuredContent||null}catch(e){return null}}function N(e){return e.noun+(e.verb?" "+e.verb:"")}function O(e,t){return e.commands.filter(function(e){return e.noun===t}).map(function(e){return e.verb||"(default)"})}function x(e,t){const n=[(t=t||"expl")+" "+N(e)+" -- "+e.description,"",f("main.describe_tool",{tool:e.toolName}),f("main.describe_risk",{risk:e.risk})];return e.positional&&n.push(f("main.describe_positional",{positional:e.positional})),e.requiresProject&&n.push(f("main.describe_project")),e.jsonOnly.length&&n.push(f("main.describe_json_only",{props:e.jsonOnly.join(", ")})),e.flags.forEach(function(e){let t=" --"+e.name+" ("+e.kind+")"+(e.required?f("main.describe_required"):"");e.enumValues&&(t+=" enum: "+e.enumValues.join(", ")),e.description&&(t+=" -- "+e.description),n.push(t)}),n.push("",f("main.describe_example",{prefix:t,noun:e.noun,verb:e.verb,positional:e.positional?" <"+e.positional+">":""})),n.join("\n")+"\n"}function I(e){const t=e.tree,n=[f("main.help_usage",{prefix:e.prefix||"expl"}),"",f("main.help_builtin")];if((e.builtinHelp||[" expl status"," expl tools list|describe"," expl project use <id|name>"," expl call <tool_name>"," expl skill"," expl completion bash|zsh|powershell"," expl lang [en|ja]"," expl help"]).forEach(function(e){n.push(e)}),n.push(""),t.commands.length){const e=[];t.commands.forEach(function(t){e.indexOf(t.noun)<0&&e.push(t.noun)}),e.sort(),n.push(f("main.help_nouns",{nouns:e.join(", ")}))}else e.up||n.push(e.downHint||f("main.help_start_desktop"));return n.join("\n")+"\n"}async function v(e,t){const n=(await e.callTool("list_projects",{})).structuredContent||{},r=n.projects||n.items||[];return l.resolveProject(t,r)}async function T(e,t){const n=t.project||e.env.EXPL_PROJECT||e.state.readDefaultProject();if(n)return(await v(e.client,n)).project_id;const r=await y(e.client),o=r&&r.open_projects||[];if(!o.length)throw new p("USAGE",f("main.no_project"));return o[0].project_id}async function S(e,t){const n=e.deps,o=e.globals,i=e.json,s=e.tree,a=e.prefix||"expl";if(o.help&&0===t.length)return _(n,{stdout:I(e),stderr:""}),0;const c=t.slice(),l=c.shift();if(!l)return _(n,{stdout:I(e),stderr:""}),0;if("tools"===l){const t=c.shift();if("list"===t)return _(n,function(e,t){if(t){const t=e.commands.map(function(e){return{command:N(e),tool:e.toolName,read_only:e.readOnly,risk:e.risk}});return{stdout:JSON.stringify(t,null,2)+"\n",stderr:""}}const n=["COMMAND\tTOOL\tREAD_ONLY\tRISK"];return e.commands.forEach(function(e){n.push([N(e),e.toolName,String(e.readOnly),e.risk].join("\t"))}),{stdout:n.join("\n")+"\n",stderr:""}}(s,i)),0;if("describe"===t){const t=c.shift();if(!t)throw new p("USAGE",f("main.usage_tools_describe",{prefix:a}));let r=s.byToolName(t);if(!r&&t.indexOf(" ")<0){const e=s.commands.filter(function(e){return e.noun===t});1===e.length&&(r=e[0])}if(!r&&t.indexOf(" ")>0){const e=t.split(/\s+/);r=s.find(e[0],e[1]||"")}if(!r){if(!e.up)throw e.downError;throw new p("USAGE",f("main.unknown_command_or_tool",{ref:t}))}return _(n,{stdout:x(r,a),stderr:""}),0}throw new p("USAGE",f("main.usage_tools",{prefix:a}))}if("call"===l){const t=c.shift();if(!t)throw new p("USAGE",f("main.usage_call",{prefix:a}));const n=s.byToolName(t);if(!n){if(!e.up)throw e.downError;throw new p("USAGE",f("main.unknown_tool",{name:t}))}return await R(e,n,c)}if("help"===l)return _(n,{stdout:I(e),stderr:""}),0;if(h[l])throw new p("USAGE",f("main.unknown_command_noun",{prefix:a,noun:l}));let u="",d=s.find(l,"");if(d){if(o.help)return _(n,{stdout:x(d,a),stderr:""}),0}else{if(u=c.shift(),!u){if(o.help)return _(n,{stdout:f("main.verbs_for",{noun:l,verbs:O(s,l).join(", ")})+"\n",stderr:""}),0;let e=f("main.usage_noun_verb",{prefix:a,noun:l});const t=O(s,l);throw t.length&&(e+="\n"+f("main.verbs_for",{noun:l,verbs:t.join(", ")})),new p("USAGE",e)}if(o.help){if(d=s.find(l,u),!d){if(!e.up)throw e.downError;throw new p("USAGE",f("main.unknown_command_noun_verb",{prefix:a,noun:l,verb:u}))}return _(n,{stdout:x(d,a),stderr:""}),0}d=s.find(l,u)}if(!d){if(!e.up)throw e.downError;const t=s.commands.map(function(e){return N(e)}),n=r.suggest(l+(u?" "+u:""),t);let o=f("main.unknown_command_hint",{prefix:a});throw n.length&&(o+=f("main.did_you_mean",{prefix:a,candidate:n[0]})),new p("USAGE",o)}return await R(e,d,c)}async function R(e,t,n){if(!e.up)throw e.downError;const i=e.deps,a=e.globals,c=e.json,l=e.prefix||"expl";let d=null;if(a.input){const e="-"===a.input?i.readStdin():i.readFile(a.input);try{d=JSON.parse(e)}catch(e){throw new p("USAGE",f("main.input_parse",{error:e.message}))}}const m={readFile:i.readFile,readStdin:i.readStdin};let h=r.toToolArgs(t,n,m,d,l);e.resolveProject&&(h=await async function(e,t,n,r){if(!e.requiresProject)return r;const o="project_id"===e.positional?r.project_id:null;if(!o&&!t.project&&r.project_id)return r;if(e.projectOptional&&!o&&!t.project)return r;const i=o||t.project||n.env.EXPL_PROJECT||n.state.readDefaultProject();if(!i)throw new p("USAGE",f("main.no_project"));return r.project_id=(await v(n.client,i)).project_id,r}(t,a,i,h)),await async function(e,t,n,r,i,a){const c=(n.inputSchema.required||[]).filter(o.isEntityIdProp).filter(function(e){return void 0===r[e]||null===r[e]});if(!c.length)return;const l=c[0],u="--"+o.kebab(l),d=t.find(o.entityOfIdProp(l),"list"),m=d?(d.inputSchema.required||[]).filter(function(e){return"project_id"!==e}):[];if(d&&d.toolName!==n.toolName&&!m.length){const t=d.requiresProject&&r.project_id?{project_id:r.project_id}:{};try{const n=await e.callTool(d.toolName,t,{}),r=s.renderResult(n,{json:!1});i.stderr.write(f("main.candidates",{noun:d.noun})+"\n"+r.stdout+r.stderr)}catch(e){}}throw new p("USAGE",f("main.missing_id",{prefix:a,flag:u,noun:n.noun,verb:n.verb}))}(e.client,e.tree,t,h,i,l);let g=await async function(e,t,n,r,o,i){await async function(e,t,n,r){if("HIGH"!==e.risk||t.yes)return;if(!n.stdinIsTTY||!n.stdoutIsTTY)throw new p("USAGE",f("main.hard_to_undo"));n.stderr.write(f("main.confirm_prompt",{prefix:r,noun:e.noun,verb:e.verb,tool:e.toolName})+"\n");const o=(await n.readLine()).trim().toLowerCase();if("y"!==o&&"yes"!==o)throw new p("EXECUTION_FAILED",f("main.cancelled"))}(r,n,t,i),r.confirmsByUser&&(o.confirmed_by_user=!0);let s=await e.callTool(r.toolName,o,{timeoutSec:n.timeoutSec});return s&&s.structuredContent&&"running"===s.structuredContent.status&&!n.noWait&&(s=await u.waitFor(e,s,{projectId:o.project_id||null,timeoutSec:n.timeoutSec,onProgress:function(e){n.quiet||t.stderr.write(e+"\n")},isInterrupted:t.isInterrupted,interrupt:t.interrupt||null,now:function(){return Date.now()}})),s}(e.client,i,a,t,h,l);if(e.onResult){const n=await e.onResult(g,t);if(n)return _(i,n),0}const E=function(e,t,n){const r=(n&&n.content||[]).find(function(e){return e&&"image"===e.type&&"string"==typeof e.data});if(!r)return null;const o=n.structuredContent&&n.structuredContent.chart_id,i=t.output||e.pathJoin(e.makeTmpDir(),String(o||"image").replace(/[^A-Za-z0-9_-]/g,"_")+".png");return e.writeFile(i,Buffer.from(r.data,"base64")),i}(i,a,g);return E&&c&&(g=Object.assign({},g,{structuredContent:Object.assign({},g.structuredContent,{image_path:E})})),_(i,s.renderResult(g,{json:c})),E&&!c&&_(i,{stdout:f("main.image_saved",{path:E})+"\n",stderr:""}),0}e.exports={run:async function(e,t){if("__complete"===e[0]){const n=t.state.readToolsCache();let r=null;if(t.server&&t.server.state){const e=t.server.state.lastServerUrl();if(e){const n=t.server.state.readToolsCache(e);n&&n.length&&(r=w(n))}}const o=i.complete(e.slice(1),n&&n.length?w(n):null,r);return o.length&&t.stdout.write(o.join("\n")+"\n"),0}let n;try{n=r.splitGlobals(e)}catch(n){return E(n,t,e.indexOf("--json")>=0)}const o=n.globals,s=o.json;try{if(o.version)return await async function(e,t){const n=["expl "+e.version],r=await y(e.client);n.push(r&&r.app_version?"Exploratory "+r.app_version:f("main.version_not_running"));const o=n.join("\n")+"\n";return _(e,t?{stdout:JSON.stringify({expl:e.version,exploratory:r},null,2)+"\n",stderr:""}:{stdout:o,stderr:""}),0}(t,s);if("server"===n.rest[0])return await a.run(n.rest.slice(1),o,t);if("status"===n.rest[0])return await async function(e,t){const n=(await e.client.callTool("get_environment",{})).structuredContent||{};return t?(_(e,{stdout:JSON.stringify(n,null,2)+"\n",stderr:""}),0):(_(e,{stdout:["Exploratory "+(n.app_version||"?"),f("main.status_user",{user:n.user&&(n.user.display_name||n.user.username)||"?"})].join("\n")+"\n",stderr:""}),0)}(t,s);if("skill"===n.rest[0])return await async function(e){let t=null;try{t=(await e.client.initialize()).instructions}catch(e){t=null}return _(e,{stdout:c.render({instructions:t,version:e.version}),stderr:""}),0}(t);if("completion"===n.rest[0]){const e=i.script(n.rest[1]);if(!e)throw new p("USAGE",f("main.usage_completion"));return _(t,{stdout:e,stderr:""}),0}if("lang"===n.rest[0])return await async function(e,t,n,r){const o=r.shift();if(void 0!==o&&g.indexOf(o)<0)throw new p("USAGE",f("main.usage_lang"));const i={project_id:await T(e,t)};let s;void 0===o?(i.keys=["ui_lang"],s=await e.client.callTool("get_system_settings",i,{timeoutSec:t.timeoutSec})):(i.settings={ui_lang:o},s=await e.client.callTool("update_system_settings",i,{timeoutSec:t.timeoutSec}));const a=s.structuredContent||{},c=void 0===o?(a.settings||{}).ui_lang:o;if(void 0!==o&&(a.skipped||[]).length)throw new p("EXECUTION_FAILED",f("main.lang_not_changed",{reason:JSON.stringify(a.skipped)}));return void 0!==o&&m(o),_(e,n?{stdout:JSON.stringify({ui_lang:c},null,2)+"\n",stderr:""}:{stdout:f(void 0===o?"main.lang_current":"main.lang_changed",{lang:c})+"\n",stderr:""}),0}(t,o,s,n.rest.slice(1));const e=await async function(e,t){try{const n=await e.listTools();return t.writeToolsCache(n),{tools:n,desktopUp:!0}}catch(e){if(!(e instanceof p)||"DESKTOP_NOT_RUNNING"!==e.errorCode)throw e;return{tools:t.readToolsCache()||[],desktopUp:!1}}}(t.client,t.state),r=e.tools.length?w(e.tools):{commands:[],find:function(){return null},byToolName:function(){return null}},l=n.rest.slice();if("project"===l[0]&&"use"===l[1]){l.shift(),l.shift();const n=l.shift();if(!n)throw new p("USAGE",f("main.usage_project_use"));if(!e.desktopUp)throw new p("DESKTOP_NOT_RUNNING");const r=await v(t.client,n);return t.state.writeDefaultProject(r.project_id),_(t,{stdout:f("main.default_project",{name:r.name,projectId:r.project_id})+"\n",stderr:""}),0}return await S({prefix:"expl",client:t.client,tree:r,up:e.desktopUp,downError:new p("DESKTOP_NOT_RUNNING"),downHint:f("main.help_start_desktop"),globals:o,json:s,deps:t,resolveProject:!0,onResult:null,builtinHelp:null},l)}catch(e){return E(e,t,s)}},dispatchTree:S,describeCommand:x,topHelp:I}},42(e,t,n){const r=n(439),o=n(736),i={en:n(174),ja:n(980)};let s=o.ENGLISH;e.exports={setLang:function(e){s=e===o.JAPANESE?o.JAPANESE:o.ENGLISH},getLang:function(){return s},t:function(e,t){const n=i[s][e];if("string"!=typeof n)throw new Error("Unknown expl message key: "+e);return n.replace(/\{(\w+)\}/g,function(e,n){return t&&void 0!==t[n]?String(t[n]):e})},localizeErrorDefaults:function(e,t,n){const a=i.ja;if(s!==o.JAPANESE||r.CODES.indexOf(e)<0)return{message:t,actions:n};const c=new r(e),l=function(e){const t=c.toJSON(e).suggested_actions;return n.length===t.length&&n.every(function(e,n){return e===t[n]})},u=l("en")||l("ja");return{message:t&&t!==c.message&&t!==c.toJSON("ja").message?t:a["error."+e+".message"],actions:u?[a["error."+e+".action"]]:n}}}},351(e,t,n){const r=n(896),o=n(18),{ExplError:i}=n(877),{t:s}=n(42);function a(e){if(!e||"object"!=typeof e)return null;let t=null;const n=Object.keys(e);for(let r=0;r<n.length;r++){const o=e[n[r]];if(Array.isArray(o)&&o.length&&"object"==typeof o[0]&&null!==o[0]&&!Array.isArray(o[0])){if(t)return null;t=o}}return t}const c=[[4352,4447],[11904,42191],[44032,55203],[63744,64255],[65072,65103],[65280,65376],[65504,65510],[127744,128591],[131072,262141]],l=".pivot.measure.cell";function u(e){let t=0;for(const n of e){const e=n.codePointAt(0);t+=c.some(function(t){return e>=t[0]&&e<=t[1]})?2:1}return t}const p=/[\u0000-\u001F\u007F-\u009F]/g,d={"\n":"\\n","\r":"\\r","\t":"\\t"};function f(e){return null==e?"":("object"==typeof e?JSON.stringify(e):String(e)).replace(p,function(e){return d[e]||"\\u"+e.charCodeAt(0).toString(16).padStart(4,"0")})}function m(e){return String(e).replace(p,function(e){return"\n"===e||"\t"===e?e:d[e]||"\\u"+e.charCodeAt(0).toString(16).padStart(4,"0")})}function h(e,t){const n=[e.map(f)].concat(t.map(function(t){return e.map(function(e,n){return f(t[n])})})),r=e.map(function(e,t){return Math.max.apply(null,n.map(function(e){return u(e[t])}))});return n.map(function(e){return e.map(function(t,n){return n===e.length-1?t:t+" ".repeat(r[n]-u(t))}).join(" ").replace(/ +$/,"")}).join("\n")+"\n"}function g(e){const t=Object.keys(e[0]).filter(function(t){return null===(n=e[0][t])||"string"==typeof n||"number"==typeof n||"boolean"==typeof n;var n}).slice(0,6);return t.length?h(t.map(function(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").toUpperCase()}),e.map(function(e){return t.map(function(t){return e[t]})})):""}function _(e){const t=e.function&&"none"!==e.function?e.function:"";return e.column?t?e.column+" ("+t+")":e.column:t}function E(e){const t=e.rows;if(!Array.isArray(t)||!t.length||!Array.isArray(t[0]))return null;let n;if(e.definition&&Array.isArray(e.column_headers))n=function(e){const t=e.definition,n=e.rows,r=e.value_separator||"|||",o=e.column_headers.slice(0,n[0].length),i=o.filter(function(e){return/^r\d+$/.test(e)}).length,a=(t.rows||[]).map(function(e){return e.column||""}),c=i-a.length,u=(t.values||[]).map(_).join(r),p=o.map(function(e,t){return t<i?c>=0&&t>=c?a[t-c]:e:e===l?u:e}),d=e.totals||{},m=!1!==t.show_row_totals&&Array.isArray(d.row_totals)?d.row_totals:null,g=n.map(function(e,t){return m?e.concat([m[t]]):e});m&&p.push(s("output.total"));const E=d.column_totals;if(!1!==t.show_totals&&Array.isArray(E)&&i>0&&E.length===o.length-i){const t=[s("output.total")].concat(new Array(i-1).fill(null),E),n=e.total_row_count;m&&t.push(m.length===n+1?m[n]:null),g.push(t)}let w=h(p,g);return(t.values||[]).length>1&&o.indexOf(l)<0&&(w+=s("output.each_cell",{measure:f(u)})+"\n"),w}(e);else{const r=e.columns||[];n=h(t[0].map(function(e,t){return function(e){if(!e||"object"!=typeof e)return f(e);const t=e.column||e.name||"";return e.function&&"none"!==e.function?t+" ("+e.function+")":t}(r[t])}),t)}const r="number"==typeof e.total_row_count?e.total_row_count:e.row_count;return"number"==typeof r&&r>t.length&&(n+=s("output.showing_rows",{shown:t.length,total:r})+"\n"),n}const w=["title","displayName","display_name","name"],y=/(^id|_id|Id)$/;function N(e,t){if(void 0!==e)return e;if("string"!=typeof t)return null;try{return JSON.parse(t)}catch(e){return t}}e.exports={createWriter:function(e){const t=e.fsModule||r,n=e.ttyModule||o;let s=null,a=0,c=[];const l=function(){if(a--,a>0)return;const e=c;c=[],e.forEach(function(e){e()})};return e.isTTY&&(s=new n.WriteStream(e.fd),s.on("error",function(){})),{write:function(n){try{if(s)return a++,void s.write(n,l);t.writeSync(e.fd,n,"utf8")}catch(e){if(e&&"EPIPE"===e.code)throw new i("BROKEN_PIPE");throw e}},flush:function(){return 0===a?Promise.resolve():new Promise(function(e){c.push(e)})}}},renderResult:function(e,t){const n=e&&e.structuredContent;let r=(o=n&&n.warnings,Array.isArray(o)&&o.length?o.map(function(e){return s("output.warning",{text:m((t=e,"string"==typeof t?t:t&&"string"==typeof t.message?t.message:JSON.stringify(t)))})+"\n";var t}).join(""):"");var o;const i=e&&e.content&&e.content[0]&&e.content[0].text;if(t.json)return{stdout:JSON.stringify(N(n,i),null,2)+"\n",stderr:r};const c=function(e){if("string"!=typeof e||!/^\s*\{/.test(e))return null;try{const t=JSON.parse(e);return t&&"object"==typeof t&&!Array.isArray(t)?t:null}catch(e){return null}}(i),l=void 0!==n?n:c;let u="";!c&&"string"==typeof i&&i.length&&(u+=m(i)+(i.endsWith("\n")?"":"\n")),u+=function(e){if(!e||"object"!=typeof e)return"";const t=E(e);if(null!==t)return t;const n=e.result&&"object"==typeof e.result&&!Array.isArray(e.result)?e.result:null,r=n?E(n):null;if(null!==r)return r;const o=n?a(n):null;if(o)return g(o);if("string"==typeof e.text&&e.text.length)return m(e.text)+(e.text.endsWith("\n")?"":"\n");const i=a(e);if(i)return g(i);if(Object.keys(e).filter(function(e){return"warnings"!==e}).some(function(t){return null!==e[t]&&"object"==typeof e[t]}))return JSON.stringify(e,null,2)+"\n";if("string"==typeof e.body&&e.body.length)return m(e.body)+(e.body.endsWith("\n")?"":"\n");const s=function(e){const t=w.find(function(t){return"string"==typeof e[t]&&e[t]}),n=Object.keys(e).find(function(t){return y.test(t)&&"string"==typeof e[t]&&e[t]});return t&&n?f(e[t])+" ("+f(e[n])+")":""}(e);return s?s+"\n":""}(l);const p=function(e){if(!e||"object"!=typeof e)return null;const t=Object.keys(e).find(function(t){return/(^url|Url|_url)$/.test(t)&&"string"==typeof e[t]&&/^https?:\/\//.test(e[t])});return t?e[t]:null}(l);return p&&(u+="URL: "+m(p)+"\n"),{stdout:u,stderr:r}},jsonPayload:N,renderError:function(e,t){let n="";t.json&&(n=JSON.stringify({success:!1,error_code:e.errorCode,message:e.message,details:e.details,suggested_actions:e.suggestedActions},null,2)+"\n");let r=(e.suggestedActions||[]).slice();"DESKTOP_NOT_RUNNING"!==e.errorCode||r.length||r.push(s("output.start_desktop")),"NOT_LOGGED_IN"!==e.errorCode||r.length||r.push('Run "expl server login".'),"UNAUTHORIZED"===e.errorCode&&!r.length&&e.details&&"env"===e.details.source&&r.push('Create a new token with "expl server token create" and set EXPL_SERVER_TOKEN.');let o=s("output.error",{text:m(e.message)});return"USAGE"!==e.errorCode&&(o+=" ("+m(e.errorCode)+")"),o+="\n",r.forEach(function(e){o+=m(e)+"\n"}),{stdout:n,stderr:o}}}},587(e,t,n){const r=n(982),o=n(611),i=n(692),{URL:s,URLSearchParams:a}=n(16),{ExplError:c}=n(877);function l(e){return e.replace(/\/+$/,"")+"/oauth/clients/expl.json"}function u(e,t,n){return(n.request||p)(e,t,n)}function p(e,t,n){return new Promise(function(r,a){const l=new s(e.replace(/\/+$/,"")+t),u=("https:"===l.protocol?i:o).request({hostname:l.hostname,port:l.port||("https:"===l.protocol?443:80),path:l.pathname+l.search,method:n.method||"GET",headers:n.headers||{},agent:!1},function(e){let t="";e.setEncoding("utf8"),e.on("data",function(e){t+=e}),e.on("end",function(){r({statusCode:e.statusCode,body:t,headers:e.headers})})});u.setTimeout(n.timeoutMs||3e4,function(){u.destroy(Object.assign(new Error("timed out"),{code:"ETIMEDOUT"}))}),u.on("error",function(e){a(new c("SERVER_UNREACHABLE","Cannot reach "+l.origin+": "+(e.code||e.message)))}),n.body&&u.write(n.body),u.end()})}async function d(e,t,n){n=n||{};const r=e.replace(/\/+$/,""),o=new a(t);o.set("client_id",l(r)),o.set("resource",r+"/mcp");const i=await u(r,"/oauth/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","Content-Length":Buffer.byteLength(o.toString())},body:o.toString(),request:n.request});let s=null;try{s=JSON.parse(i.body)}catch(e){s=null}if(i.statusCode>=400){if(s&&"invalid_grant"===s.error)throw new c("NOT_LOGGED_IN",s.error_description||s.error);throw new c("SERVER_UNREACHABLE","HTTP "+i.statusCode+" from "+r+"/oauth/token")}if(!s||!s.access_token)throw new c("SERVER_UNREACHABLE","HTTP "+i.statusCode+" from "+r+"/oauth/token");return s}async function f(e){const t=e.serverUrl.replace(/\/+$/,""),n=await u(t,"/oauth/userinfo",{method:"GET",headers:{Authorization:"Bearer "+e.accessToken},request:e.request});if(401===n.statusCode||403===n.statusCode)throw new c("NOT_LOGGED_IN","The server rejected the login token.");if(n.statusCode>=400)throw new c("SERVER_UNREACHABLE","HTTP "+n.statusCode+" from "+t+"/oauth/userinfo");let r;try{r=JSON.parse(n.body)}catch(e){throw new c("SERVER_UNREACHABLE","HTTP "+n.statusCode+" from "+t+"/oauth/userinfo")}return{email:r.email||"?",display_name:r.display_name||null}}e.exports={refresh:function(e){return d(e.serverUrl,{grant_type:"refresh_token",refresh_token:e.refreshToken},{request:e.request})},revoke:async function(e){const t=e.serverUrl.replace(/\/+$/,""),n=new a({token:e.token,client_id:l(t)});try{await u(t,"/oauth/revoke",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","Content-Length":Buffer.byteLength(n.toString())},body:n.toString(),request:e.request})}catch(e){}},userinfo:f,login:async function(e){const t=e.serverUrl.replace(/\/+$/,""),i=function(e){const t=(e||r.randomBytes)(32).toString("base64url");return{verifier:t,challenge:r.createHash("sha256").update(t).digest("base64url")}}(),u=r.randomBytes(16).toString("hex");let p,m=null;e.noBrowser?p="http://127.0.0.1/callback":(m=await function(e){const t=e.httpModule||o;let n=null,r=null,i=null;const a=new Promise(function(e,t){r=e,i=t});a.catch(function(){});let l=!1,u=null;const p=function(){l||(l=!0,clearTimeout(u),n&&n.close())};return n=t.createServer(function(t,n){const o=new s(t.url,"http://127.0.0.1");if("/callback"!==o.pathname)return n.writeHead(404),void n.end();if(o.searchParams.get("state")!==e.state)return n.writeHead(400),void n.end("Invalid state.");const a=o.searchParams.get("error");if(a)return n.writeHead(400),n.end("Login failed."),i("access_denied"===a?new c("PERMISSION_DENIED","Login was denied in the browser."):new c("EXECUTION_FAILED","Login failed: "+(o.searchParams.get("error_description")||a))),void p();const l=o.searchParams.get("code");if(!l)return n.writeHead(400),void n.end("Missing code.");n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end("You can close this window and return to the terminal."),r(l),p()}),new Promise(function(t,r){n.listen(0,"127.0.0.1",function(){const r=n.address().port;u=setTimeout(function(){i(new c("EXECUTION_FAILED","Login timed out.")),p()},e.timeoutMs),t({port:r,redirectUri:"http://127.0.0.1:"+r+"/callback",code:a,close:p})}),n.on("error",r)})}({state:u,timeoutMs:6e5,httpModule:e.httpModule}),p=m.redirectUri);const h=function(e){const t=e.serverUrl.replace(/\/+$/,"");return t+"/oauth/authorize?"+new a({response_type:"code",client_id:l(t),redirect_uri:e.redirectUri,code_challenge:e.challenge,code_challenge_method:"S256",state:e.state,scope:"content:read",resource:t+"/mcp"}).toString()}({serverUrl:t,redirectUri:p,challenge:i.challenge,state:u});let g;!e.noBrowser&&e.interactive&&function(e,t){const r=t.spawn||n(317).spawn;let o,i;"darwin"===t.platform?(o="open",i=[e]):"win32"===t.platform?(o="rundll32",i=["url.dll,FileProtocolHandler",e]):(o="xdg-open",i=[e]);try{const e=r(o,i,{detached:!0,stdio:"ignore"});return e.on("error",function(){}),e.unref(),!0}catch(e){return!1}}(h,{platform:e.platform,spawn:e.spawn})?e.stderr.write("Opening "+h+" in your browser.\nIf the browser does not open, visit the URL above.\n"):e.stderr.write("Open this URL in your browser to log in:\n"+h+"\n"),e.noBrowser?(e.stderr.write("Paste the URL you were redirected to:\n"),g=function(e,t){let n;try{n=new s(e.trim())}catch(e){throw new c("USAGE","Paste the full redirect URL from your browser.")}if(n.searchParams.get("state")!==t)throw new c("USAGE","The redirect URL does not match this login attempt.");const r=n.searchParams.get("code");if(!r)throw new c("USAGE","The redirect URL has no authorization code.");return r}(await e.readLine(),u)):g=await m.code;const _=await function(e){return d(e.serverUrl,{grant_type:"authorization_code",code:e.code,redirect_uri:e.redirectUri,code_verifier:e.verifier},{request:e.request})}({serverUrl:t,code:g,verifier:i.verifier,redirectUri:p,request:e.request}),E=await f({serverUrl:t,accessToken:_.access_token,request:e.request}),w=new Date(Date.now()+1e3*(_.expires_in||3600)).toISOString();return{server_url:t,client_id:l(t),access_token:_.access_token,refresh_token:_.refresh_token,expires_at:w,email:E.email,saved_at:(new Date).toISOString()}},httpRequest:u}},654(e,t,n){const r=n(611),o=n(692),i=n(262),s=n(587),{ExplError:a,fromJsonRpcError:c,fromToolResult:l,fromHttpAuthError:u}=n(877),p="expl",d="x-exploratory-include-tool-meta",f=3e5;e.exports={create:function(e){const t=e.serverUrl.replace(/\/+$/,""),n=t+"/mcp",m=e.state;let h=e.auth;const g=e.sessionId,_=e.clientVersion,E=e.timeoutMs||f,w=e.onTrace,y=e.post||i.post,N=e.refresh||s.refresh,O=e.request;let x=0;async function I(){if(!h||"login"!==h.source||!h.credentials)return;const e=Date.parse(h.credentials.expires_at||"");Number.isFinite(e)&&e>Date.now()+6e4||await v()}async function v(){await m.withLock(t,async function(){const e=m.readCredentials(t);if(e&&e.access_token!==h.credentials.access_token)return h.credentials=e,void(h.token=e.access_token);const n=await N({serverUrl:t,refreshToken:h.credentials.refresh_token}),r=Object.assign({},h.credentials,{access_token:n.access_token,refresh_token:n.refresh_token||h.credentials.refresh_token,expires_at:new Date(Date.now()+1e3*(n.expires_in||3600)).toISOString(),saved_at:(new Date).toISOString()});m.writeCredentials(t,r),h.credentials=r,h.token=r.access_token})}async function T(e,r,o){if(!h)throw new a("NOT_LOGGED_IN","Not logged in to "+t+'. Run "expl server login".');async function i(s){const l=++x,d={jsonrpc:"2.0",id:l,method:e,params:r},f=JSON.stringify(d),m=function(e){const n={Host:new URL(t).host,Accept:"application/json, text/event-stream","Content-Type":"application/json","x-exploratory-client-name":p,"x-exploratory-client-version":_,"x-exploratory-guide-session":g};return h&&(n.Authorization="Bearer "+h.token),e&&Object.assign(n,e),n}(o);m["Content-Length"]=Buffer.byteLength(f);let N=null;const O=[],I=await y({url:n,headers:m,body:f,timeoutMs:E,onMessage:function(e){O.push(e),e&&e.id===l&&(N=e)}});w&&w(JSON.stringify({method:e,params:r,id:l,statusCode:I.statusCode,messages:O}));const T=function(e,n){if(e.connectError)throw new a("SERVER_UNREACHABLE","Cannot reach "+t+": "+e.connectError);if(e.rawBody)throw new a("SERVER_UNREACHABLE","Cannot reach "+t+": HTTP "+e.statusCode);if(401===e.statusCode&&h){if("login"===h.source&&n)return v().then(function(){return n()});throw u({statusCode:401,wwwAuthenticate:null,source:h.source})}if(!e.complete)throw new a("SERVER_UNREACHABLE","Cannot reach "+t+": incomplete response");return null}(I,s?function(){return i(!1)}:null);if(T)return T;if(!N)throw new a("EXECUTION_FAILED","No JSON-RPC response from "+t);if(N.error)throw c(N.error);return N.result}await I();try{return await i(!0)}catch(e){return async function(e){if(!h)throw e;if("login"!==h.source)throw e;if(!(e instanceof a)||"NOT_LOGGED_IN"!==e.errorCode)throw e;const n=m.readCredentials(t);if(n&&n.access_token!==h.token)return h.credentials=n,h.token=n.access_token,i(!1);throw e}(e)}}return{auth:h,listTools:async function(){const e=[];let t=null;for(;;){const n=t?{cursor:t}:{},r=await T("tools/list",n,{[d]:"true"});if(r&&r.tools&&e.push.apply(e,r.tools),t=r&&r.nextCursor?r.nextCursor:null,!t)break}return e},callTool:async function(e,t){const n=await T("tools/call",{name:e,arguments:t||{}});if(n&&n.isError)throw l(n);return n},initialize:async function(){const e=await T("initialize",{protocolVersion:"2025-11-25",capabilities:{},clientInfo:{name:p,version:_}});return{instructions:"string"==typeof e.instructions?e.instructions:null,serverInfo:e.serverInfo||{}}},download:async function(e){if(!h)throw new a("NOT_LOGGED_IN","Not logged in to "+t+'. Run "expl server login".');await I();const n=new URL(e);if(n.origin!==new URL(t).origin)throw new a("EXECUTION_FAILED","The download URL is not on "+t+": "+e);const i="https:"===n.protocol?o:r;return new Promise(function(r,o){const s=i.request({hostname:n.hostname,port:n.port||("https:"===n.protocol?443:80),path:n.pathname+n.search,method:"GET",headers:{Authorization:"Bearer "+h.token},agent:!1},function(t){const n=[];t.on("data",function(e){n.push(e)}),t.on("end",function(){200===t.statusCode?r(Buffer.concat(n)):o(new a("EXECUTION_FAILED","HTTP "+t.statusCode+" from "+e))})});s.setTimeout(E,function(){s.destroy(Object.assign(new Error("timed out"),{code:"ETIMEDOUT"}))}),s.on("error",function(e){o(new a("SERVER_UNREACHABLE","Cannot reach "+t+": "+(e.code||e.message)))}),s.end()})},serverRequest:async function(e,n,r,o){if(!h)throw new a("NOT_LOGGED_IN","Not logged in to "+t+'. Run "expl server login".');await I();const i=function(){return s.httpRequest(t,n,{method:e,headers:Object.assign({Authorization:"Bearer "+h.token},o||{}),body:r,request:O})};let c=await i();if(401===c.statusCode&&"login"===h.source&&(await v(),c=await i()),401===c.statusCode)throw u({statusCode:401,wwwAuthenticate:c.headers&&c.headers["www-authenticate"],source:h.source});return c}}},resolveToken:function(e){let t=null,n=null;if(e.flag)t="-"===e.flag?(e.readStdin().split(/\r?\n/)[0]||"").trim():e.flag,n="flag";else{if(!e.env||!e.env.EXPL_SERVER_TOKEN){const t=e.state.readCredentials(e.serverUrl);return t&&t.access_token?{source:"login",credentials:t,token:t.access_token}:null}t=e.env.EXPL_SERVER_TOKEN.trim(),n="env"}return t?{source:n,credentials:null,token:t}:null},DEFAULT_TIMEOUT_MS:f}},876(e,t,n){const r=n(495),o=n(213),i=n(351),s=n(654),a=n(134),{ExplError:c,exitCodeFor:l}=n(877),u=["expl server login [--url <server>] [--no-browser]","expl server logout","expl server status","expl server token create|list|revoke","expl server tools list|describe","expl server call <tool_name>","expl server skill"];function p(e,t){t.stdout&&e.stdout.write(t.stdout),t.stderr&&e.stderr.write(t.stderr)}function d(e,t,n){const r=e instanceof c?e:new c("EXECUTION_FAILED",e&&e.message?e.message:String(e));return"BROKEN_PIPE"===r.errorCode||p(t,i.renderError(r,{json:n})),l(r.errorCode)}const f={400:"USAGE",403:"PERMISSION_DENIED",404:"NOT_FOUND",409:"CONFLICT"};function m(e,t){let n=null;try{n=JSON.parse(e.body)}catch(e){n=null}if(e.statusCode>=200&&e.statusCode<300&&n)return n;const r=f[e.statusCode];if(r)throw new c(r,n&&n.error_description||"HTTP "+e.statusCode);throw new c("SERVER_UNREACHABLE","HTTP "+e.statusCode+" from "+t+"/oauth/cli-tokens")}e.exports={run:async function(e,t,l){const f=t.json;try{let h;try{h=r.splitGlobals(e,r.SERVER_FLAG_SPECS)}catch(e){return d(e,l,f)}if(t.project)throw new c("USAGE","--project is not used with expl server.");const g=Object.assign({},t,{url:h.globals.url||t.url||null,token:h.globals.token||t.token||null,output:h.globals.output||t.output||null,noBrowser:h.globals.noBrowser||t.noBrowser||!1});e=h.rest;const _=l.server.state,E=a.resolveServerUrl({flag:g.url,env:l.env,state:_}),w=t.timeoutSec?1e3*t.timeoutSec:s.DEFAULT_TIMEOUT_MS,y=e[0];if("login"===y){const e=await l.server.login({serverUrl:E,noBrowser:g.noBrowser,interactive:l.stdinIsTTY&&l.stdoutIsTTY,platform:l.server.platform,stderr:l.stderr,readLine:l.readLine,request:l.server.request,httpModule:l.server.httpModule,spawn:l.server.spawn});return _.writeCredentials(E,e),p(l,{stdout:"Logged in to "+new URL(E).host+" as "+e.email+".\n",stderr:""}),0}if("logout"===y){const e=_.readCredentials(E);return e?(await l.server.revoke({serverUrl:E,token:e.refresh_token,request:l.server.request}),_.deleteCredentials(E),p(l,{stdout:"Logged out of "+new URL(E).host+".\n",stderr:""}),0):(p(l,{stdout:"Not logged in.\n",stderr:""}),0)}const N=s.resolveToken({flag:g.token,env:l.env,state:_,serverUrl:E,readStdin:l.readStdin}),O=l.server.createClient({serverUrl:E,auth:N,state:_,sessionId:l.sessionId,clientVersion:l.version,timeoutMs:w,onTrace:l.onTrace,post:l.server.post,refresh:l.server.refresh,request:l.server.request});if("status"===y){if(!N)throw new c("NOT_LOGGED_IN","Not logged in to "+E+'. Run "expl server login".');return await async function(e,t,n,r,o){try{const i=await n.initialize(),s=i.serverInfo&&i.serverInfo.version?i.serverInfo.version:"?";let a="?";r&&(a=(await e.server.userinfo({serverUrl:o,accessToken:r.token,request:e.server.request})).email);let c="not logged in";if(r)if("login"===r.source&&r.credentials){const e=r.credentials.saved_at?r.credentials.saved_at.slice(0,10):"?",t=new Date(r.credentials.expires_at||"");c="login (refresh token saved "+e+", access token valid until "+(Number.isFinite(t.getTime())?t.toTimeString().slice(0,5):"?")+")"}else c="env"===r.source?"EXPL_SERVER_TOKEN":"--token";const l={server:o,version:s,user:a,auth:c};return p(e,t?{stdout:JSON.stringify(l,null,2)+"\n",stderr:""}:{stdout:"Server: "+o+" (Exploratory "+s+")\nUser: "+a+"\nAuth: "+c+"\n",stderr:""}),0}catch(n){return d(n,e,t)}}(l,f,O,N,E)}if("token"===y)return await async function(e,t,n,r,o,s){const a=e[0];if("create"===a){if(!o||"login"!==o.source)throw new c("NOT_LOGGED_IN",'Log in with "expl server login" to create tokens.');const i=function(e){const t=new c("USAGE","Usage: expl server token create --name <name> [--expires <days>]");let n=null,r=null;for(let o=0;o<e.length;o++){const i=e[o].indexOf("="),s=i>0?e[o].slice(0,i):e[o];if("--name"!==s&&"--expires"!==s)throw t;const a=i>0?e[o].slice(i+1):e[++o];if(void 0===a||""===a)throw t;"--name"===s?n=a:r=a}if(!n)throw t;if(null===r)return{name:n,expiresDays:null};if(!/^[0-9]+$/.test(r))throw new c("USAGE","--expires must be a number of days.");return{name:n,expiresDays:Number(r)}}(e.slice(1)),a=JSON.stringify(null===i.expiresDays?{name:i.name}:{name:i.name,expires_days:i.expiresDays}),l=m(await r.serverRequest("POST","/oauth/cli-tokens",a,{"Content-Type":"application/json"}),s);return p(t,n?{stdout:JSON.stringify(l,null,2)+"\n",stderr:""}:{stdout:l.token+"\n",stderr:"Token name: "+l.name+"\nExpires: "+l.expires_at+"\nSave this token; it will not be shown again.\nSet EXPL_SERVER_TOKEN for CI.\n"}),0}if("list"===a){if(e.length>1)throw new c("USAGE","Usage: expl server token list");if(!o)throw new c("NOT_LOGGED_IN","Not logged in to "+s+'. Run "expl server login".');const a=m(await r.serverRequest("GET","/oauth/cli-tokens",null,{}),s);return n||(a.tokens||[]).length?(p(t,i.renderResult({structuredContent:a},{json:n})),0):(p(t,{stdout:"No tokens.\n",stderr:""}),0)}if("revoke"===a){const i=e[1];if(!i||e.length>2)throw new c("USAGE","Usage: expl server token revoke <name>");if(!o)throw new c("NOT_LOGGED_IN","Not logged in to "+s+'. Run "expl server login".');return m(await r.serverRequest("DELETE","/oauth/cli-tokens/"+encodeURIComponent(i),null,{}),s),p(t,{stdout:n?JSON.stringify({success:!0})+"\n":"Revoked "+i+".\n",stderr:""}),0}throw new c("USAGE","Usage: expl server token create|list|revoke")}(e.slice(1),l,f,O,N,E);if("skill"===y){let e=null;try{e=(await O.initialize()).instructions}catch(t){e=null}return p(l,{stdout:n(821).render({instructions:null,version:l.version,server:{instructions:e},serverOnly:!0}),stderr:""}),0}const x=await async function(e,t,n){try{const r=await e.listTools();return n.writeToolsCache(t,r),{tools:r,up:!0,downError:null}}catch(e){if(!(e instanceof c))throw e;if("SERVER_UNREACHABLE"!==e.errorCode&&"NOT_LOGGED_IN"!==e.errorCode&&"UNAUTHORIZED"!==e.errorCode)throw e;return{tools:n.readToolsCache(t)||[],up:!1,downError:e}}}(O,E,_),I=o.GLOBAL_FLAGS.concat(o.SERVER_FLAGS),v=x.tools.length?o.build(x.tools,{globalFlags:I}):{commands:[],find:function(){return null},byToolName:function(){return null}},T=g.output?function(e,t,n,r){return async function(o){const s=n.output;let a=null;o.content&&o.content.forEach(function(e){"image"===e.type&&e.data&&(a=Buffer.from(e.data,"base64"))});const l=function(e){const t=e&&e.content&&e.content[0]&&e.content[0].text,n=i.jsonPayload(e&&e.structuredContent,t);return n&&"object"==typeof n&&(n.download_url||n.result&&n.result.download_url)||null}(o);if(!a&&!l)throw new c("USAGE","This command returns no file. --output works with dataframe export and chart get-image.");const u=a||await t.download(l);return"-"===s?(e.writeStdoutBytes(u),{stdout:"",stderr:""}):(e.writeFileBytes(s,u),r?{stdout:JSON.stringify({saved:s,bytes:u.length},null,2)+"\n",stderr:""}:{stdout:"Saved "+u.length+" bytes to "+s+"\n",stderr:""})}}(l,O,g,f):null;return await n(107).dispatchTree({prefix:"expl server",client:O,tree:v,up:x.up,downError:x.downError||new c("NOT_LOGGED_IN"),downHint:'Log in with "expl server login" to list its commands.',globals:t,serverGlobals:g,json:f,deps:l,resolveProject:!1,builtinHelp:u,onResult:T},e)}catch(e){return d(e,l,f)}}}},134(e,t,n){const r=n(896),o=n(928),i=n(677),{ExplError:s}=n(877);function a(e){if("string"!=typeof e||!e)throw new s("USAGE","Server URL is required.");const t=e.trim().replace(/\/+$/,"");if(!/^https?:\/\//i.test(t))throw new s("USAGE","Server URL must start with http:// or https://.");return t}function c(e){const t=new URL(a(e)),n=t.hostname.replace(/[^a-zA-Z0-9.-]/g,"_"),r=t.port||("https:"===t.protocol?"443":"80");return r===("https:"===t.protocol?"443":"80")?n:n+"_"+r}e.exports={create:function(e){const t=e.rootDir,n=e.fsModule||r,l=o.join(t,"expl/server");function u(e){return o.join(l,c(e)+".json")}function p(){n.mkdirSync(l,{recursive:!0,mode:448}),n.chmodSync(l,448)}return{readCredentials:function(e){const t=i.readJsonFile(l,c(e)+".json",n);return t&&"string"==typeof t.access_token&&"string"==typeof t.server_url&&function(e,t){try{return new URL(a(e)).origin===new URL(a(t)).origin}catch(e){return!1}}(t.server_url,e)?t:null},writeCredentials:function(e,t){p(),i.writeJsonFile(l,c(e)+".json",t,n)},deleteCredentials:function(e){try{n.unlinkSync(u(e))}catch(e){if("ENOENT"!==e.code)throw e}},readToolsCache:function(e){const t=i.readJsonFile(l,c(e)+".tools.json",n);return t&&Array.isArray(t.tools)?t.tools:null},writeToolsCache:function(e,t){p(),i.writeJsonFile(l,c(e)+".tools.json",{tools:t},n)},lastServerUrl:function(){let e=null,t="";try{n.readdirSync(l).forEach(function(r){if(!r.endsWith(".json")||r.endsWith(".tools.json")||r.endsWith(".lock"))return;const o=i.readJsonFile(l,r,n);o&&"string"==typeof o.server_url&&"string"==typeof o.saved_at&&(!t||o.saved_at>t)&&(t=o.saved_at,e=o.server_url)})}catch(e){if("ENOENT"!==e.code)throw e}return e},withLock:async function(e,t){p();const r=function(e){return u(e)+".lock"}(e),o=Date.now();for(;;)try{n.writeFileSync(r,String(process.pid),{flag:"wx",mode:384});break}catch(e){if("EEXIST"!==e.code)throw e;try{if(Date.now()-n.statSync(r).mtimeMs>6e4){n.unlinkSync(r);continue}}catch(e){if("ENOENT"!==e.code)throw e;continue}if(Date.now()-o>=7e4)throw new s("EXECUTION_FAILED","Another expl process is still refreshing the login. Try again.");await new Promise(function(e){setTimeout(e,50)})}try{return await t()}finally{try{n.unlinkSync(r)}catch(e){}}}}},resolveServerUrl:function(e){if(e.flag)return a(e.flag);if(e.env&&e.env.EXPL_SERVER_URL)return a(e.env.EXPL_SERVER_URL);const t=e.state.lastServerUrl();return t?a(t):"https://exploratory.io"}}},821(e){const t=["# Exploratory from the shell: expl","","expl calls the same operations the Exploratory MCP server offers. Exploratory Desktop must be running and","the user signed in.","","## How to work","","1. Find the command: `expl tools list --json` lists every command with its MCP tool name, whether it only"," reads, and its risk (LOW, MEDIUM, HIGH).","2. Read its arguments before calling it: `expl <noun> <verb> --help` (same as `expl tools describe`).","3. Always pass `--json` and read the result from stdout. Warnings go to stderr: read them too.","4. Pass a project with `--project <id|name>`, or set one once with `expl project use <id|name>`.","5. Pass complex input as JSON: `--input file.json` or `--input -` (stdin). Flags override its fields.","6. HIGH-risk commands (publish, delete, ...) refuse to run without `--yes` when not on a terminal."," Ask the user before you add `--yes`.","7. Long operations wait by default. With `--no-wait`, poll with `expl execution get <execution_id>`.","8. `expl call <tool_name>` runs a tool by its MCP name.","","## Exit codes","","| Code | Meaning |","|---|---|","| 0 | Success |","| 1 | The operation failed (NOT_FOUND, INVALID_PARAMETER, EXECUTION_FAILED, ...) |","| 2 | Usage error: unknown flag, unreadable JSON, or `--yes` missing |","| 3 | Exploratory Desktop is not running |","| 4 | Not signed in, unauthorized, or permission denied |","| 130 | Interrupted |","",'With `--json`, a failure prints `{"success": false, "error_code", "message", "suggested_actions"}` on stdout.'].join("\n"),n=["## Exploratory Server: expl server","","expl server calls the same operations as the Exploratory Server MCP. Run `expl server login` once on","each machine (or set EXPL_SERVER_TOKEN from `expl server token create` for CI).","","List commands: `expl server tools list --json`. Exit code 3 means the server is unreachable;","exit code 4 means not logged in or the token was rejected."].join("\n");e.exports={render:function(e){const r=!!e.serverOnly,o=["---","name: "+(r?"exploratory-expl-server":"exploratory-expl"),"description: "+(r?"Use expl server to search and read the data, charts, dashboards, notes and analytics published on Exploratory Server from the shell.":"Use the expl command to read and change Exploratory projects, dashboards, notes, charts and data frames from the shell."),"---","","\x3c!-- Generated by expl "+e.version+" --\x3e",""];return r||o.push(t),e.server&&(o.push("",n),e.server.instructions&&o.push("",e.server.instructions.trim())),e.instructions&&o.push("","## Exploratory guidance","",e.instructions.trim()),o.join("\n")+"\n"}}},677(e,t,n){const r=n(896),o=n(928),{ExplError:i}=n(877),{t:s,getLang:a}=n(42),c="expl.json",l="expl-tools.json";function u(e,t,n){try{const r=n.readFileSync(o.join(e,t),"utf8");return JSON.parse(r)}catch(e){return null}}function p(e,t,n,r){const i=o.join(e,t),s=i+"."+process.pid+".tmp";r.writeFileSync(s,JSON.stringify(n),{mode:384,encoding:"utf8"}),r.renameSync(s,i)}e.exports={create:function(e){const t=e.agentDir,n=e.fsModule||r;return{readDefaultProject:function(){const e=u(t,c,n);return e&&"string"==typeof e.default_project_id?e.default_project_id:null},writeDefaultProject:function(e){p(t,c,{default_project_id:e},n)},readToolsCache:function(){const e=u(t,l,n);return e&&Array.isArray(e.tools)&&e.lang===a()?e.tools:null},writeToolsCache:function(e){p(t,l,{lang:a(),tools:e},n)}}},resolveProject:function(e,t){const n=t.filter(function(t){return t.project_id===e});if(1===n.length)return n[0];const r=t.filter(function(t){return t.name===e});if(1===r.length)return r[0];if(0===r.length)throw new i("USAGE",s("state.no_project_named",{ref:e}));const o=r.map(function(e){return e.updated_at?e.project_id+" ("+e.updated_at+")":e.project_id});throw new i("USAGE",s("state.multiple_projects",{ref:e,ids:o.join("\n")}))},readJsonFile:u,writeJsonFile:p}},947(e,t,n){const r=n(85),{ExplError:o}=n(877),{t:i}=n(42);e.exports={waitFor:async function(e,t,n){const s=t&&t.structuredContent;if(!s||"running"!==s.status)return t;const a=s.execution_id,c=s.operation_id,l=s.capability||"operation",u=n.now(),p=null!=n.timeoutSec?u+1e3*n.timeoutSec:null,d=r.MAX_OPERATION_WAIT_MS,f=n.interrupt||null,m={},h=async function(){const t={execution_id:a,operation_id:c};throw n.projectId&&(t.project_id=n.projectId),await e.callTool("cancel_execution",t).catch(function(){}),new o("INTERRUPTED")};f&&(f.waiting=!0);try{for(;;){n.isInterrupted()&&await h(),n.onProgress(i("wait.waiting",{capability:l,operationId:c}));let t=d;if(null!=p&&(t=Math.min(t,Math.max(0,p-n.now())),0===t))throw new o("EXECUTION_TIMEOUT",i("wait.timed_out",{executionId:a,operationId:c}));const r=e.callTool("get_execution",{execution_id:a,operation_id:c,wait_ms:t}),s=f?await Promise.race([r,f.promise.then(function(){return m})]):await r;s===m&&await h();const u=s&&s.structuredContent&&s.structuredContent.operations,g=u&&u[0];if(!g||"running"!==g.status){if(g&&"failed"===g.status){const e=g.error||{};throw new o(e.error_code||"EXECUTION_FAILED",e.message,null,e.suggested_actions)}return s}}}finally{f&&(f.waiting=!1)}}}},287(e,t,n){const r=n(439),o=/^expc_[0-9a-f]{64}$/;e.exports={create:function(e){const t=e.env||{},n=e.now||Date.now;let i=null;function s(t,o){return i||(i=async function(){const i=n();for(;;){const s=await e.pair(t);if(!s)return{pairing:"unavailable"};if("approved"===s.status&&"string"==typeof s.credential){try{await e.store.set(s.credential)}catch(e){}return{token:s.credential,source:"paired"}}if(s.error){const t="string"==typeof s.error&&r.CODES.indexOf(s.error)>=0;return!t&&e.log&&e.log("pair reply not understood: "+String(JSON.stringify(s.error)).slice(0,200)),{pairing:"error",error:t?s.error:"VERSION_MISMATCH"}}if("pending"!==s.status)return{pairing:"declined"};if(n()-i>=(o.maxWaitMs||0))return{pairing:"pending"};o.onPending&&o.onPending()}}().then(function(e){return i=null,e},function(e){throw i=null,e}),i)}return{resolve:async function(n,r){const i="string"==typeof t.EXPLORATORY_AGENT_TOKEN?t.EXPLORATORY_AGENT_TOKEN.trim():"";if(i&&o.test(i))return e.log&&e.log("credential source=environment paired_format=true"),{token:i,source:"env"};i&&e.log&&e.log("credential source=environment paired_format=false; trying stored credential");let a=null;try{a=await e.store.get()}catch(e){a=null}if(a){if(e.log&&e.log("credential source=store paired_format="+o.test(a)),!o.test(a)){try{await e.store.remove()}catch(e){}return s(String(n||"").slice(0,100),r||{})}return{token:a,source:"store"}}return e.log&&e.log("credential source=pairing"),s(String(n||"").slice(0,100),r||{})},forget:async function(t){if(t&&("store"===t.source||"paired"===t.source))try{await e.store.remove()}catch(e){}}}}}},262(e,t,n){const r=n(896),o=n(611),i=n(692),s=n(928);function a(e){return new Promise(function(t){let n=!1,r=!1,s=!1;const a=function(e){s||(s=!0,p&&clearTimeout(p),t(e))};let c,l;if(e.url){const t=new URL(e.url);l="https:"===t.protocol?i:o;const n="https:"===t.protocol?443:80;c={hostname:t.hostname,port:t.port?Number(t.port):n,path:t.pathname+t.search,method:"POST",headers:e.headers,agent:!1}}else l=o,c={socketPath:e.socketPath,path:e.path||"/mcp",method:"POST",headers:e.headers,agent:!1};const u=l.request(c,function(t){n=!0,function(e,t,n){const r=e.headers["content-type"]||"",o=/^text\/event-stream/i.test(r),i=/^application\/json/i.test(r),s=function(e,t){let n="";return{push:function(r){n+=r;let o=n.search(/\r?\n\r?\n/);for(;o>=0;){const r=n.slice(0,o);n=n.slice(o).replace(/^\r?\n\r?\n/,"");const i=r.split(/\r?\n/).filter(function(e){return 0===e.indexOf("data:")}).map(function(e){return e.slice(5).replace(/^ /,"")}).join("\n");if(i)try{e(JSON.parse(i))}catch(e){t&&t("unreadable event from Exploratory: "+e.message)}o=n.search(/\r?\n\r?\n/)}}}}(t.onMessage,t.onParseError);let a="";e.setEncoding("utf8"),e.on("data",function(e){o?s.push(e):a+=e}),e.on("error",function(){}),e.on("close",function(){let s=null;if(!o&&a.trim())try{t.onMessage(JSON.parse(a))}catch(n){i?t.onParseError&&t.onParseError("unreadable response from Exploratory: HTTP "+e.statusCode):s=a.slice(0,1024)}n({complete:!!e.complete,statusCode:e.statusCode,connectError:null,contentType:r||null,rawBody:s})})}(t,e,a)});let p=null;e.timeoutMs&&e.timeoutMs>0&&(p=setTimeout(function(){u.destroy(),n||a({complete:!1,statusCode:null,connectError:"ETIMEDOUT",requestSent:r,contentType:null,rawBody:null})},e.timeoutMs)),u.on("socket",function(e){e.connecting||(r=!0),e.once("connect",function(){r=!0})}),u.on("error",function(e){n||a({complete:!1,statusCode:null,connectError:e.code||"CONNECTION_FAILED",requestSent:r,contentType:null,rawBody:null})}),u.end(e.body)})}e.exports={requestPairing:function(e){const t=JSON.stringify({name:e.name});let n=null;return a({socketPath:e.socketPath,path:"/pair",headers:{"Content-Type":"application/json",Accept:"application/json","Content-Length":Buffer.byteLength(t),Host:"localhost","x-exploratory-channel":e.channel},body:t,timeoutMs:4e4,onMessage:function(e){n=e}}).then(function(e){return e.connectError||!n?null:n})},readEndpoint:function(e){try{const t=JSON.parse(r.readFileSync(s.join(e,"endpoint.json"),"utf8"));return t&&"string"==typeof t.socket?t:null}catch(e){return null}},post:a}},49(e,t,n){const r=n(896),o=n(857),i=n(928),s=n(713),a=o.homedir()||process.env.HOME||process.env.HOMEPATH||process.env.USERPROFILE;function c(e){return s.hasUTF8Multibyte(e)||/\s/.test(e)}e.exports={getUserAccountRootDir:function(){const e=function(){let e=null;try{e=r.readFileSync(i.resolve(a,".exploratory_home")).toString().trim()}catch(e){}return e}();if(e||process.env.EXPLORATORY_HOME){const t=e||process.env.EXPLORATORY_HOME;return{userAccountRootDir:t,hasMultiByteInEXPLORATORY_HOME:c(t)}}return{userAccountRootDir:c(a)?"win32"===o.platform()?"\\exploratory":"/exploratory":i.resolve(a,".exploratory"),hasMultiByteInEXPLORATORY_HOME:!1}}}},713(e,t,n){const r={};var o,i=n(857);global.currentVariablesMap?o=global.currentVariablesMap:(o={},global.currentVariablesMap=o),r.registerExploratoryVariable=function(e){o[e]=!0},r.unregisterExploratoryVariable=function(e){delete o[e]},r.clearExploratoryVariables=function(){Object.keys(o).forEach(function(e){delete o[e]})},r.translateVariablePlaceholders=function(e,t){return e.replace(/\@\{([^\}\]]+)(?:\[([^\}\]]+)\])?\}/g,function(e,n,i){const s=r.extractQuoteParameterValue(n);let a=n;if(s&&(a=a.split(",")[0].trim()),t&&!o[a]){var c=new Error("EXP-PARAM-1 :: "+JSON.stringify([a])+" :: Parameter "+a+" is not defined.");throw c.VAR_EXISTENCE_ERROR=!0,c.isR=!0,c}return i?"exploratory_env$`"+n+"`["+i+"]":["FALSE","F"].includes(s)?"!!rlang::sym(exploratory_env$`"+a+"`)":"exploratory_env$`"+a+"`"})};const s=/quote\s*=\s*(TRUE|FALSE|T|F)/i;r.extractQuoteParameterValue=function(e){const t=e.match(s);return t?t[1].toUpperCase():null},r.checkVariableExistence=function(e){if(!o[e]){var t=new Error("EXP-PARAM-1 :: "+JSON.stringify([e])+" :: Parameter "+e+" is not defined.");throw t.VAR_EXISTENCE_ERROR=!0,t.isR=!0,t}},r.escapeForQuotedStringInR=function(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')},r.escapeForSingleQuotedStringInR=function(e){return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")},r.validateRObjectName=function(e){if(!e)return!1;if(e.length>1&&46===e.charCodeAt(0)&&e.charCodeAt(1)>=48&&e.charCodeAt(1)<=57)return!1;for(var t=0,n=e.length;t<n;t++){var r=e.charCodeAt(t);if(0===t&&r>=48&&r<=57)return!1;if(0===t&&95===r)return!1;if(r>=0&&r<=31)return!1;if(r>=32&&r<=45||47===r)return!1;if(r>=58&&r<=64)return!1;if(r>=91&&r<=94||96===r)return!1;if(r>=123&&r<=127)return!1}return!0},r.hasUTF8Multibyte=function(e){for(var t=0;t<e.length;t++)if(e.charCodeAt(t)>=128)return!0;return!1},r.escapeRegExp=function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},r.escapeHTMLTags=function(e){return"string"!=typeof e?e:e.replace(/[&'`"<>]/g,function(e){return{"&":"&","'":"'","`":"`",'"':""","<":"<",">":">"}[e]})},r.translateVariablePlaceholdersWithDummy=function(e){return e.replace(/@{[^}]*}/g,function(e){return"c("+e.replace(/./g,"X").slice(2,-1)+")"}).replace(/\bai\s*\(\s*(@[\p{L}\p{N}_-]+)/gu,function(e){return'ai(""'})},r.compareVersionStr=function(e,t,n){var r=n&&n.lexicographical,o=n&&n.zeroExtend,i=e.split("."),s=t.split(".");function a(e){return(r?/^\d+[A-Za-z]*$/:/^\d+$/).test(e)}if(!i.every(a)||!s.every(a))return NaN;if(o){for(;i.length<s.length;)i.push("0");for(;s.length<i.length;)s.push("0")}r||(i=i.map(Number),s=s.map(Number));for(var c=0;c<i.length;++c){if(s.length===c)return 1;if(i[c]!==s[c])return i[c]>s[c]?1:-1}return i.length!=s.length?-1:0},r.getValueAtPath=function(e,t,n){if(e&&t){var r=e;if(Array.isArray(t)){if(0===t.length)return;t.forEach(function(e){r=r?r[e]:void 0})}else r=r[t];return n&&(void 0!==n[r]&&null!==n[r]?r=n[r]:n["*"]&&(r=r?n["*"]:void 0)),r}},r.isTestMode=function(){return!!process.env.EXPLORATORY_TEST_RUNNER_ENABLED||!!process.env.EXPECTED_RESULT_DIR},r.generateRandomStr=function(){var e=function(){var e=(52*(1+Math.random())|0)%52;return e>=26?String.fromCharCode(97+e-26):String.fromCharCode(65+e)},t=function(){return e()+e()+e()+(10*(1+Math.random())|0)%10};return t()+t()},r.generateIdStr=function(e){var t="";return e&&(t=(t=e.replace(/[^0-9a-zA-Z ]/g," ").trim().replace(/[ ]{2,}/g," ")).replace(/ /g,"-")),t?t+"-"+r.generateRandomStr():r.generateRandomStr()},r.isAdhocChart=function(){return!!window?.parent?.exploratory?.adc},r.isIgnorableWarning=function(e){return["Warning: ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported in React 18.",'Warning: [react-bootstrap] Specifying only the `"hover"` trigger limits the visibilty of the overlay to just mouse users.'].some(t=>e.startsWith(t))},r.escapeSpecialCharacterForRegex=function(e){return["\\\\","\\$","\\*","\\+","\\.","\\?","\\[","\\]","\\^","\\{","\\}","\\|","\\(","\\)"].reduce(function(e,t){return e.replace(new RegExp(t,"g"),t)},e)},r.escapePathForR=function(e){return"win32"===i.platform()?(e=e.replace(/"/g,"")).replace(/\\/g,"\\\\"):e},r.isWin32bit=function(){return"win32"===i.platform()&&"x64"!==process.arch},e.exports=r},317(e){"use strict";e.exports=require("child_process")},982(e){"use strict";e.exports=require("crypto")},896(e){"use strict";e.exports=require("fs")},611(e){"use strict";e.exports=require("http")},692(e){"use strict";e.exports=require("https")},857(e){"use strict";e.exports=require("os")},928(e){"use strict";e.exports=require("path")},18(e){"use strict";e.exports=require("tty")},16(e){"use strict";e.exports=require("url")},169(e){"use strict";e.exports=JSON.parse('{"DESKTOP_NOT_RUNNING.message":"Exploratory Desktop is not running.","DESKTOP_NOT_RUNNING.action":"Ask the user to start Exploratory Desktop; this connection will work once it is running, without reconnecting","NOT_SIGNED_IN.message":"No user is signed in to Exploratory.","NOT_SIGNED_IN.action":"Sign in to Exploratory, then retry","UNAUTHORIZED.message":"This application has not been approved in Exploratory, or its access was removed.","UNAUTHORIZED.action":"Retry: Exploratory asks the user to approve this application; do not ask the user for a token or password","PAIRING_PENDING.message":"Exploratory is waiting for the user to approve this application.","PAIRING_PENDING.action":"Ask the user to answer the request shown in Exploratory, then retry","CHANNEL_DISABLED.message":"This way of connecting to Exploratory (MCP or CLI) is turned off in the Exploratory settings.","CHANNEL_DISABLED.action":"Ask the user to turn it on in Exploratory: Preferences > MCP / CLI (the Japanese UI shows the same item as 環境設定 > MCP / CLI), then retry","PAIRING_REQUIRED.message":"This connection was not accepted.","PAIRING_REQUIRED.action":"Tell the user the connection was not accepted; do not ask them to approve it","PROJECT_NOT_OPEN.message":"The project exists but is not open in Exploratory.","PROJECT_NOT_OPEN.action":"Open the project in Exploratory, then retry","NOT_FOUND.message":"The requested object was not found.","NOT_FOUND.action":"Call list_created_artifacts, list_charts or list_analytics to see available artifacts","PERMISSION_DENIED.message":"This application is not permitted to perform the operation.","PERMISSION_DENIED.action":"Tell the user this operation is not permitted for this connection","CONFIRMATION_REQUIRED.message":"The operation needs the user\'s confirmation.","CONFIRMATION_REQUIRED.action":"Ask the user to confirm in Exploratory","CONFIRMATION_DECLINED.message":"The user declined the operation in Exploratory.","CONFIRMATION_DECLINED.action":"Do not try again or look for another way to do the same thing; tell the user it was declined","INVALID_PARAMETER.message":"A parameter is invalid.","INVALID_PARAMETER.action":"Read the tool\'s description and input schema, fix the parameter the message names, then call the tool again","INVALID_COLUMN.message":"The column does not exist in the data frame.","INVALID_COLUMN.action":"Call get_data_frame to see the columns","INVALID_COLUMN_TYPE.message":"The column has the wrong type for the operation.","INVALID_COLUMN_TYPE.action":"Add a converted column with create_wrangling_step (a calculation, for example as.character(<column>), cut(<column>, ...) or <column> == \\"<value>\\"), then use that column","REVISION_CONFLICT.message":"The artifact changed since it was last read.","REVISION_CONFLICT.action":"Re-read the artifact and reconcile before updating","EXECUTION_FAILED.message":"The operation failed in Exploratory.","EXECUTION_FAILED.action":"Fix the cause the message names, then call the tool again; if it fails the same way twice, tell the user what failed","EXECUTION_TIMEOUT.message":"The operation took longer than allowed.","EXECUTION_TIMEOUT.action":"Retry, or use get_execution for the result","R_REQUIRED.message":"The document has no rendered output to export yet.","R_REQUIRED.action":"Ask the user to open it in Exploratory once so it renders, then call the tool again","PDF_EXPORT_FAILED.message":"Exploratory could not make the PDF.","PDF_EXPORT_FAILED.action":"Fix the cause the message names, then call the tool again; if it fails the same way twice, tell the user what failed","PDF_EXPORT_TIMEOUT.message":"Making the PDF took longer than allowed.","PDF_EXPORT_TIMEOUT.action":"Call the tool once more; if it times out again, tell the user","RESOURCE_BUSY.message":"Exploratory is busy with another operation.","RESOURCE_BUSY.action":"Retry shortly","DATA_EGRESS_LIMIT.message":"The result is larger than the amount that can be returned.","DATA_EGRESS_LIMIT.action":"Ask again for fewer rows or columns","UNSUPPORTED_OPERATION.message":"The operation is not supported.","UNSUPPORTED_OPERATION.action":"Do it with another tool if one fits; otherwise tell the user it is not supported","RESOURCE_BUSY.r_busy.action":"Wait for the current R operation to finish, then retry the same tool with the same arguments.","next.unknown_client_tool":"Call only the tools in your tool list.","next.not_found":"Find the right id with the list or get tool for that kind of object (for example list_data_frames, list_charts, list_analytics, list_notes or list_dashboards), then call again with it.","next.invalid":"Read this tool\'s description and input schema, fix the argument the message names, then call the tool again.","next.not_ready":"Wait a moment, then call the tool again.","next.not_allowed":"Use an object this conversation created or read, or ask the user to allow it.","next.other":"Fix the cause the message names, then call the tool again; if it fails the same way twice, tell the user what failed.","VERSION_MISMATCH.message":"The running Exploratory is not compatible with the version of this app (the MCP helper or expl), so it cannot connect.","VERSION_MISMATCH.action":"Ask the user to start the version of Exploratory that matches this app; for the MCP helper, reconnect the MCP helper from the running Exploratory. Then retry"}')},719(e){"use strict";e.exports=JSON.parse('{"DESKTOP_NOT_RUNNING.message":"Exploratory Desktop が起動していません。","DESKTOP_NOT_RUNNING.action":"利用者に Exploratory Desktop を起動するよう伝えてください。起動すれば、接続し直さなくても、この接続が使えるようになります","NOT_SIGNED_IN.message":"Exploratory にサインインしているユーザーがいません。","NOT_SIGNED_IN.action":"Exploratory にサインインしてから、もう一度実行してください","UNAUTHORIZED.message":"このアプリケーションは Exploratory で承認されていないか、アクセスが取り消されています。","UNAUTHORIZED.action":"もう一度実行してください。Exploratory が利用者にこのアプリケーションの承認を求めます。利用者にトークンやパスワードを尋ねないでください","PAIRING_PENDING.message":"Exploratory は、利用者がこのアプリケーションを承認するのを待っています。","PAIRING_PENDING.action":"Exploratory に表示された確認に答えるよう、利用者に伝えてから、もう一度実行してください","CHANNEL_DISABLED.message":"Exploratory の設定で、この接続方法(MCP または CLI)が無効になっています。","CHANNEL_DISABLED.action":"利用者に、Exploratory の 環境設定 > MCP / CLI で有効にするよう伝えてから、もう一度実行してください","PAIRING_REQUIRED.message":"この接続は受け付けられませんでした。","PAIRING_REQUIRED.action":"接続が受け付けられなかったことを利用者に伝えてください。承認を依頼しないでください","PROJECT_NOT_OPEN.message":"プロジェクトはありますが、Exploratory で開かれていません。","PROJECT_NOT_OPEN.action":"Exploratory でプロジェクトを開いてから、もう一度実行してください","NOT_FOUND.message":"指定されたオブジェクトが見つかりません。","NOT_FOUND.action":"list_created_artifacts、list_charts、list_analytics を呼んで、使えるものを確認してください","PERMISSION_DENIED.message":"このアプリケーションにはこの操作を行う権限がありません。","PERMISSION_DENIED.action":"この操作はこの接続では許可されていないことを、利用者に伝えてください","CONFIRMATION_REQUIRED.message":"この操作にはユーザーの確認が必要です。","CONFIRMATION_REQUIRED.action":"Exploratory で確認するよう、利用者に伝えてください","CONFIRMATION_DECLINED.message":"利用者が Exploratory でこの操作を断りました。","CONFIRMATION_DECLINED.action":"もう一度実行したり、同じことをする別の方法を探したりせず、断られたことを利用者に伝えてください","INVALID_PARAMETER.message":"パラメータが正しくありません。","INVALID_PARAMETER.action":"ツールの説明と入力スキーマを読み、メッセージに出ているパラメータを直してから、もう一度ツールを呼んでください","INVALID_COLUMN.message":"指定された列がデータフレームにありません。","INVALID_COLUMN.action":"get_data_frame を呼んで、列を確認してください","INVALID_COLUMN_TYPE.message":"この操作には列の型が合いません。","INVALID_COLUMN_TYPE.action":"create_wrangling_step で変換した列を追加し(計算で as.character(<列>)、cut(<列>, ...)、<列> == \\"<値>\\" など)、その列を使ってください","REVISION_CONFLICT.message":"最後に読み込んだあとで、このオブジェクトが変更されました。","REVISION_CONFLICT.action":"もう一度読み込んで内容を確認してから、更新してください","EXECUTION_FAILED.message":"Exploratory で操作に失敗しました。","EXECUTION_FAILED.action":"メッセージに出ている原因を直してから、もう一度ツールを呼んでください。同じ失敗が2回続くときは、失敗した内容を利用者に伝えてください","EXECUTION_TIMEOUT.message":"操作が許容時間を超えました。","EXECUTION_TIMEOUT.action":"もう一度実行するか、get_execution で結果を確認してください","R_REQUIRED.message":"書き出すための描画結果がまだありません。","R_REQUIRED.action":"Exploratory で一度開いて描画するよう利用者に伝えてから、もう一度ツールを呼んでください","PDF_EXPORT_FAILED.message":"Exploratory で PDF を作成できませんでした。","PDF_EXPORT_FAILED.action":"メッセージに出ている原因を直してから、もう一度ツールを呼んでください。同じ失敗が2回続くときは、失敗した内容を利用者に伝えてください","PDF_EXPORT_TIMEOUT.message":"PDF の作成が制限時間を超えました。","PDF_EXPORT_TIMEOUT.action":"もう一度ツールを呼んでください。再び時間切れになるときは、利用者に伝えてください","RESOURCE_BUSY.message":"Exploratory が別の操作を実行中です。","RESOURCE_BUSY.action":"しばらくしてから、もう一度実行してください","DATA_EGRESS_LIMIT.message":"結果が、返せる量を超えています。","DATA_EGRESS_LIMIT.action":"行数や列数を減らして、もう一度頼み直してください","UNSUPPORTED_OPERATION.message":"この操作には対応していません。","UNSUPPORTED_OPERATION.action":"ほかのツールで代用できる場合はそちらを使ってください。できない場合は、対応していないことを利用者に伝えてください","RESOURCE_BUSY.r_busy.action":"いま実行中の R の処理が終わるのを待ってから、同じツールを同じ引数でもう一度呼んでください。","next.unknown_client_tool":"ツール一覧にあるツールだけを呼んでください。","next.not_found":"その種類のオブジェクトの list か get のツール(たとえば list_data_frames、list_charts、list_analytics、list_notes、list_dashboards)で正しい id を調べてから、もう一度呼んでください。","next.invalid":"このツールの説明と入力スキーマを読み、メッセージに出ている引数を直してから、もう一度ツールを呼んでください。","next.not_ready":"少し待ってから、もう一度ツールを呼んでください。","next.not_allowed":"この会話で作成または読み込んだオブジェクトを使うか、利用者に許可を求めてください。","next.other":"メッセージに出ている原因を直してから、もう一度ツールを呼んでください。同じ失敗が2回続くときは、失敗した内容を利用者に伝えてください。","VERSION_MISMATCH.message":"起動している Exploratory と、このアプリ(MCP ヘルパーまたは expl)のバージョンに互換性がないため、接続できません。","VERSION_MISMATCH.action":"このアプリと同じバージョンの Exploratory を起動するよう、利用者に伝えてください。MCP ヘルパーの場合は、起動している Exploratory から MCP ヘルパーを接続し直すよう伝えてください。そのあと、もう一度実行してください"}')},174(e){"use strict";e.exports=JSON.parse('{"args.missing_value":"Missing value for {name}.","args.invalid_timeout":"Invalid value for --timeout.","args.json_parse":"Could not parse JSON: {error}","args.invalid_value_types":"Invalid value for --{flag}. Expected {types}.","args.invalid_boolean":"Invalid boolean for --{flag}.","args.invalid_item":"Invalid {kind} for --{flag}.","args.unknown_flag":"Unknown flag --{flag} for \\"{prefix} {noun} {verb}\\".","args.did_you_mean_flag":" Did you mean --{flag}?","args.unexpected_argument":"Unexpected argument \\"{token}\\" for \\"{prefix} {noun} {verb}\\".","args.too_many_positional":"Too many positional arguments.","args.invalid_enum":"Invalid value for --{flag}. Expected one of: {values}.","args.invalid_number":"Invalid number for --{flag}.","args.invalid_integer":"Invalid integer for --{flag}.","client.no_response":"Exploratory returned no response to this request.","client.pairing_wait":"Waiting for you to approve expl in Exploratory (a request is shown there)...","output.each_cell":"Each cell: {measure}","output.total":"Total","output.showing_rows":"Showing {shown} of {total} rows.","output.warning":"Warning: {text}","output.error":"Error: {text}","output.start_desktop":"Start Exploratory Desktop, then try again.","state.no_project_named":"No project named \\"{ref}\\". Run \\"expl project list\\".","state.multiple_projects":"Multiple projects named \\"{ref}\\". Use the project id (id and last updated):\\n{ids}","wait.waiting":"Waiting for {capability} ({operationId})...","wait.timed_out":"Timed out. Check progress with: expl execution get {executionId} --operation-id {operationId}","main.version_not_running":"Exploratory: not running","main.status_user":"User: {user}","main.describe_tool":"Tool: {tool}","main.describe_risk":"Risk: {risk}","main.describe_positional":"Positional: {positional}","main.describe_project":"Project: pass --project or set a default with expl project use","main.describe_json_only":"JSON-only properties: {props}","main.describe_required":" [required]","main.describe_example":"Example: {prefix} {noun} {verb}{positional} --json","main.help_usage":"Usage: {prefix} <noun> <verb> [args]","main.help_builtin":"Built-in commands:","main.help_nouns":"Nouns: {nouns}","main.help_start_desktop":"Start Exploratory to list its commands.","main.no_project":"No project. Pass --project <id|name> or run \\"expl project use <id|name>\\".","main.hard_to_undo":"This command is hard to undo. Pass --yes to run it.","main.confirm_prompt":"About to run \\"{prefix} {noun} {verb}\\" ({tool}, risk HIGH). Continue? [y/N]","main.cancelled":"Cancelled.","main.usage_completion":"Usage: expl completion bash|zsh|powershell","main.usage_tools_describe":"Usage: {prefix} tools describe <command|tool_name>","main.unknown_command_or_tool":"Unknown command or tool: {ref}","main.usage_tools":"Usage: {prefix} tools list|describe","main.usage_project_use":"Usage: expl project use <id|name>","main.default_project":"Default project: {name} ({projectId})","main.usage_call":"Usage: {prefix} call <tool_name>","main.unknown_tool":"Unknown tool: {name}","main.unknown_command_noun":"Unknown command: {prefix} {noun}","main.verbs_for":"Verbs for {noun}: {verbs}","main.usage_noun_verb":"Usage: {prefix} {noun} <verb>","main.unknown_command_noun_verb":"Unknown command: {prefix} {noun} {verb}","main.unknown_command_hint":"Unknown command. Run \\"{prefix} tools list\\".","main.did_you_mean":" Did you mean: {prefix} {candidate}?","main.input_parse":"Could not parse --input JSON: {error}","main.image_saved":"Image saved: {path}","main.missing_id":"Missing {flag} <id>. Pass it to \\"{prefix} {noun} {verb}\\", or give the id as the first argument.","main.usage_lang":"Usage: expl lang [en|ja]","main.lang_current":"UI language: {lang}","main.lang_changed":"UI language changed to {lang}.","main.lang_not_changed":"The UI language was not changed: {reason}","main.candidates":"Available {noun} (pick an id):"}')},980(e){"use strict";e.exports=JSON.parse('{"args.missing_value":"{name} の値がありません。","args.invalid_timeout":"--timeout の値が正しくありません。","args.json_parse":"JSON を解析できませんでした: {error}","args.invalid_value_types":"--{flag} の値が正しくありません。{types} を指定してください。","args.invalid_boolean":"--{flag} は true か false で指定してください。","args.invalid_item":"--{flag} の {kind} の値が正しくありません。","args.unknown_flag":"\\"{prefix} {noun} {verb}\\" に --{flag} というフラグはありません。","args.did_you_mean_flag":" --{flag} のことですか?","args.unexpected_argument":"\\"{prefix} {noun} {verb}\\" に不要な引数 \\"{token}\\" があります。","args.too_many_positional":"位置引数が多すぎます。","args.invalid_enum":"--{flag} の値が正しくありません。次のいずれかを指定してください: {values}。","args.invalid_number":"--{flag} は数値で指定してください。","args.invalid_integer":"--{flag} は整数で指定してください。","client.no_response":"Exploratory からこのリクエストへの応答がありません。","client.pairing_wait":"Exploratory で expl の承認を待っています(確認が表示されています)...","output.each_cell":"各セル: {measure}","output.total":"合計","output.showing_rows":"{total} 行中 {shown} 行を表示しています。","output.warning":"警告: {text}","output.error":"エラー: {text}","output.start_desktop":"Exploratory デスクトップを起動してから、もう一度実行してください。","state.no_project_named":"\\"{ref}\\" という名前のプロジェクトはありません。\\"expl project list\\" で確認してください。","state.multiple_projects":"\\"{ref}\\" という名前のプロジェクトが複数あります。プロジェクト ID (ID と最終更新日時) で指定してください:\\n{ids}","wait.waiting":"{capability} ({operationId}) を待っています...","wait.timed_out":"タイムアウトしました。進捗は次のコマンドで確認できます: expl execution get {executionId} --operation-id {operationId}","main.version_not_running":"Exploratory: 起動していません","main.status_user":"ユーザー: {user}","main.describe_tool":"ツール: {tool}","main.describe_risk":"リスク: {risk}","main.describe_positional":"位置引数: {positional}","main.describe_project":"プロジェクト: --project で指定するか、expl project use で既定を設定してください","main.describe_json_only":"JSON のみで指定できる項目: {props}","main.describe_required":" [必須]","main.describe_example":"例: {prefix} {noun} {verb}{positional} --json","main.help_usage":"使い方: {prefix} <名詞> <動詞> [引数]","main.help_builtin":"組み込みコマンド:","main.help_nouns":"名詞: {nouns}","main.help_start_desktop":"コマンド一覧を表示するには Exploratory を起動してください。","main.no_project":"プロジェクトが指定されていません。--project <id|name> を付けるか、\\"expl project use <id|name>\\" を実行してください。","main.hard_to_undo":"このコマンドは元に戻しにくい操作です。実行するには --yes を付けてください。","main.confirm_prompt":"\\"{prefix} {noun} {verb}\\" ({tool}、リスク HIGH) を実行します。続けますか? [y/N]","main.cancelled":"キャンセルしました。","main.usage_completion":"使い方: expl completion bash|zsh|powershell","main.usage_tools_describe":"使い方: {prefix} tools describe <command|tool_name>","main.unknown_command_or_tool":"コマンドまたはツールが見つかりません: {ref}","main.usage_tools":"使い方: {prefix} tools list|describe","main.usage_project_use":"使い方: expl project use <id|name>","main.default_project":"デフォルトのプロジェクト: {name} ({projectId})","main.usage_call":"使い方: {prefix} call <tool_name>","main.unknown_tool":"ツールが見つかりません: {name}","main.unknown_command_noun":"コマンドが見つかりません: {prefix} {noun}","main.verbs_for":"{noun} の動詞: {verbs}","main.usage_noun_verb":"使い方: {prefix} {noun} <動詞>","main.unknown_command_noun_verb":"コマンドが見つかりません: {prefix} {noun} {verb}","main.unknown_command_hint":"コマンドが見つかりません。\\"{prefix} tools list\\" で一覧を確認してください。","main.did_you_mean":" {prefix} {candidate} のことですか?","main.image_saved":"画像を保存しました: {path}","main.input_parse":"--input の JSON を解析できませんでした: {error}","error.DESKTOP_NOT_RUNNING.message":"Exploratory が起動していません。","error.DESKTOP_NOT_RUNNING.action":"Exploratory を起動してから、もう一度実行してください","error.CHANNEL_DISABLED.message":"環境設定で、この接続方法(MCP または CLI)が無効になっています。","error.CHANNEL_DISABLED.action":"Exploratory の 環境設定 > MCP / CLI で有効にしてから、もう一度実行してください","error.NOT_SIGNED_IN.message":"Exploratory にサインインしているユーザーがいません。","error.NOT_SIGNED_IN.action":"Exploratory にサインインしてから、もう一度実行してください","error.UNAUTHORIZED.message":"このアプリケーションは Exploratory で承認されていないか、アクセスが取り消されています。","error.UNAUTHORIZED.action":"もう一度実行してください。Exploratory が承認を求めます(トークンやパスワードを利用者に聞かないでください)","error.PAIRING_PENDING.message":"Exploratory が、このアプリケーションの承認を待っています。","error.PAIRING_PENDING.action":"Exploratory に表示された確認に答えてから、もう一度実行してください","error.PAIRING_REQUIRED.message":"この接続は受け付けられませんでした。","error.PAIRING_REQUIRED.action":"接続が受け付けられなかったことを利用者に伝えてください","error.PROJECT_NOT_OPEN.message":"プロジェクトはありますが、Exploratory で開かれていません。","error.PROJECT_NOT_OPEN.action":"Exploratory でプロジェクトを開いてから、もう一度実行してください","error.NOT_FOUND.message":"指定されたオブジェクトが見つかりません。","error.NOT_FOUND.action":"list_created_artifacts、list_charts、list_analytics で使えるものを確認してください","error.PERMISSION_DENIED.message":"このアプリケーションにはこの操作を行う権限がありません。","error.PERMISSION_DENIED.action":"この操作はこの接続では許可されていないことをユーザーに伝えてください","error.CONFIRMATION_REQUIRED.message":"この操作にはユーザーの確認が必要です。","error.CONFIRMATION_REQUIRED.action":"Exploratory で確認してください","error.CONFIRMATION_DECLINED.message":"ユーザーが Exploratory でこの操作を断りました。","error.CONFIRMATION_DECLINED.action":"同じ操作を繰り返さず、断られたことをユーザーに伝えてください","error.INVALID_PARAMETER.message":"パラメータが正しくありません。","error.INVALID_PARAMETER.action":"expl <名詞> <動詞> --help で指定できる値を確認し、メッセージに出ているパラメータを直して、もう一度実行してください","error.INVALID_COLUMN.message":"指定された列がデータフレームにありません。","error.INVALID_COLUMN.action":"get_data_frame で列を確認してください","error.INVALID_COLUMN_TYPE.message":"この操作には列の型が合いません。","error.INVALID_COLUMN_TYPE.action":"create_wrangling_step で変換した列を追加し (計算で as.character(<列>)、cut(<列>, ...)、<列> == \\"<値>\\" など)、その列を使ってください","error.REVISION_CONFLICT.message":"最後に読み込んだあとで、このオブジェクトが変更されました。","error.REVISION_CONFLICT.action":"もう一度読み込んで内容を確認してから、更新してください","error.EXECUTION_FAILED.message":"Exploratory で操作に失敗しました。","error.EXECUTION_FAILED.action":"メッセージに出ている原因を直して、もう一度実行してください。同じ失敗が続くときは、失敗した内容を確認してください","error.EXECUTION_TIMEOUT.message":"操作が許容時間を超えました。","error.EXECUTION_TIMEOUT.action":"もう一度実行するか、get_execution で結果を確認してください","error.RESOURCE_BUSY.message":"Exploratory が別の操作を実行中です。","error.RESOURCE_BUSY.action":"しばらくしてから、もう一度実行してください","error.DATA_EGRESS_LIMIT.message":"結果が、返せる量を超えています。","error.DATA_EGRESS_LIMIT.action":"行数や列数を減らして、もう一度頼み直してください","error.UNSUPPORTED_OPERATION.message":"この操作には対応していません。","error.UNSUPPORTED_OPERATION.action":"ほかのコマンドで代用できる場合はそちらを使ってください。できない場合は未対応の操作です","main.missing_id":"{flag} <id> が指定されていません。\\"{prefix} {noun} {verb}\\" に渡すか、最初の引数に id を指定してください。","main.usage_lang":"使い方: expl lang [en|ja]","main.lang_current":"UI の言語: {lang}","main.lang_changed":"UI の言語を {lang} に変えました。","main.lang_not_changed":"UI の言語を変えられませんでした: {reason}","main.candidates":"指定できる {noun} (id を選んでください):","error.PDF_EXPORT_FAILED.message":"PDF を作成できませんでした。","error.PDF_EXPORT_FAILED.action":"メッセージに示された原因を直して再実行し、同じ失敗が2回続く場合は失敗内容を利用者に伝えてください","error.PDF_EXPORT_TIMEOUT.message":"PDF の作成が制限時間を超えました。","error.PDF_EXPORT_TIMEOUT.action":"もう一度実行し、再び時間切れになる場合は利用者に伝えてください","error.R_REQUIRED.message":"書き出すための描画結果がまだありません。","error.R_REQUIRED.action":"Exploratory で一度開いて描画してから、もう一度実行してください","error.VERSION_MISMATCH.message":"起動している Exploratory とこの expl のバージョンに互換性がないため、接続できません。","error.VERSION_MISMATCH.action":"この expl と同じバージョンの Exploratory を起動してから、もう一度実行してください"}')}};const t={};function n(r){const o=t[r];if(void 0!==o)return o.exports;const i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}const r=n(982),o=n(896),i=n(857),s=n(928),a=n(18),c=n(49),l=n(823),u=n(965),p=n(736),d=n(107),f=n(42),m=n(351),h=n(587),g=n(654),_=n(134),E=n(677),w=m.createWriter({fd:1,isTTY:a.isatty(1)}),y=m.createWriter({fd:2,isTTY:a.isatty(2)});function N(e){const t=function(){process.exit(e)};Promise.all([w.flush(),y.flush()]).then(t).catch(t)}function O(e){try{y.write(f.t("output.error",{text:e&&e.message?e.message:String(e)})+"\n")}catch(e){}N(1)}process.on("beforeExit",function(){process.exit(process.exitCode||0)}),process.on("uncaughtException",O),process.on("unhandledRejection",O);let x=null;const I={promise:new Promise(function(e){x=e}),waiting:!1};let v=!1;process.on("SIGINT",function(){v=!0,x(),I.waiting||N(130)});const T=process.argv.slice(2),S=c.getUserAccountRootDir().userAccountRootDir,R=l.agentDir(S),A=function(){try{return JSON.parse(o.readFileSync(s.join(__dirname,"..","package.json"),"utf8")).version||"unknown"}catch(e){return"unknown"}}();f.setLang(p.readUILang(R));const b=r.randomBytes(16).toString("hex"),U=T.indexOf("--verbose")>=0?function(e){y.write(e+"\n")}:null,C=_.create({rootDir:S});d.run(T,{client:u.create({agentDir:R,env:process.env,sessionId:b,clientVersion:A,onTrace:U,onPairingWait:function(){y.write(f.t("client.pairing_wait")+"\n")}}),state:E.create({agentDir:R}),rootDir:S,sessionId:b,onTrace:U,server:{state:C,platform:process.platform,createClient:g.create,login:h.login,revoke:h.revoke,userinfo:h.userinfo,refresh:h.refresh,request:null,post:null,httpModule:null,spawn:null},writeFileBytes:function(e,t){o.writeFileSync(e,t)},writeStdoutBytes:function(e){let t=0;for(;t<e.length;)t+=o.writeSync(1,e,t,e.length-t)},stdout:w,stderr:y,stdinIsTTY:a.isatty(0),stdoutIsTTY:a.isatty(1),readStdin:function(){return o.readFileSync(0,"utf8")},readLine:function(){const e=Buffer.alloc(1),t=[];for(;;){let n;try{n=o.readSync(0,e,0,1,null)}catch(e){if("EAGAIN"===e.code)continue;if("EOF"===e.code)break;throw e}if(0===n||10===e[0])break;t.push(e[0])}return Buffer.from(t).toString("utf8").replace(/\r$/,"")},readFile:function(e){return o.readFileSync(e,"utf8")},writeFile:function(e,t){o.writeFileSync(e,t)},makeTmpDir:function(){return o.mkdtempSync(s.join(i.tmpdir(),"expl-"))},pathJoin:s.join,env:process.env,isInterrupted:function(){return v},interrupt:I,version:A}).then(N).catch(O)})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exploratory/cli",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0-rc.1",
|
|
4
|
+
"description": "Command-line interface for Exploratory",
|
|
5
|
+
"bin": {
|
|
6
|
+
"expl": "bin/expl.js"
|
|
7
|
+
},
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=20"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"bin",
|
|
13
|
+
"cli",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"homepage": "https://exploratory.io",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/exploratory-io/exploratory-cli.git",
|
|
22
|
+
"directory": "package"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
}
|
|
27
|
+
}
|