@ev-ai/agent-hook 1.3.3 → 1.3.4

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/COLLECTED-DATA.md CHANGED
@@ -59,7 +59,7 @@ Every event also carries: UTC timestamp, `installation_id` (per-machine under `~
59
59
 
60
60
  From runner stdin: session/conversation/turn ids (`prompt_id` / `prompt.id` / `generation_id` / `turn_id`), event name/source, status / `stop_reason` / SessionEnd `reason`, tool/skill name, `tool_use_id`, `permission_mode`, active `model` / Cursor `model_id`, `agent_id` / `agent_type`, Cursor `subagent_id` / `subagent_type` / `subagent_model` / `is_parallel_worker`, `effort` / `effort.level`, `duration_ms` / `duration`, Cursor shell `sandbox` (boolean), failure category fields (`failure_type`, `is_interrupt` — the message fields `error`, `error_details`, `error_message` are **not** forwarded), Claude `UserPromptExpansion` metadata (`command_name`, `expansion_type`, `command_source`), `cwd` (stdin when present; else `process.cwd()` when it is a git work tree or under `CURSOR_PROJECT_DIR`; else `CURSOR_PROJECT_DIR` — Cursor user-level hooks run from `~/.cursor`, which is not the workspace; extra Agents Window folders are not on the payload; the env path is never shipped as an env var; home prefix rewritten to `~` when the path is under the user home, otherwise absolute POSIX), and git-root-relative `cwd_relative` in addition when the session is inside a git repo and that resolved cwd is under the git root. `debug: true` on an untracked / home overlay is a third route to full stdin; it does not change the collector URL.
61
61
 
62
- **Content fields (sent unless killed):** `tool_input`, `tool_response`, `last_assistant_message`, and Cursor top-level `command`. `prompt` is **opt-in**: it joins them only with `EV_AI_HOOK_CAPTURE_PROMPT=on` (the kill switch below still wins). Two per-event exclusions apply: `command` is dropped on `beforeMCPExecution` (MCP spawn argv carries credentials) and `last_assistant_message` on `StopFailure` (runner error prose). Oversize values are clipped head+tail to a shared per-string budget; if that still cannot reach the 256 KiB cap, the largest fields are dropped (`_dropped_keys`) so the event's metadata always ships rather than the whole POST being rejected. Kill switch: `EV_AI_HOOK_CAPTURE_CONTENT=off` or `capture_hook_input: "allowlist"`. Session titles, `command_args`, transcript paths, file paths, file contents, edits, MCP URLs, and runner error prose stay dropped. Full stdin dump: `capture_hook_input: "full"` or `EV_AI_HOOK_CAPTURE_FULL_INPUT=1` (still size-capped). The first token of a shell or MCP spawn command is also sent separately as payload `executable` (see above).
62
+ **Content fields (opt-in, all together):** `prompt`, `tool_input`, `tool_response`, `last_assistant_message`, and Cursor top-level `command`. They are sent only with `EV_AI_HOOK_CAPTURE_PROMPT=on` or the org config `collect_prompt`; with prompt collection off, none of them are (the kill switch below still wins). Two per-event exclusions apply: `command` is dropped on `beforeMCPExecution` (MCP spawn argv carries credentials) and `last_assistant_message` on `StopFailure` (runner error prose). Oversize values are clipped head+tail to a shared per-string budget; if that still cannot reach the 256 KiB cap, the largest fields are dropped (`_dropped_keys`) so the event's metadata always ships rather than the whole POST being rejected. Kill switch: `EV_AI_HOOK_CAPTURE_CONTENT=off` or `capture_hook_input: "allowlist"`. Session titles, `command_args`, transcript paths, file paths, file contents, edits, MCP URLs, and runner error prose stay dropped. Full stdin dump: `capture_hook_input: "full"` or `EV_AI_HOOK_CAPTURE_FULL_INPUT=1` (still size-capped). The first token of a shell or MCP spawn command is also sent separately as payload `executable` (see above).
63
63
 
64
64
  Install wires Claude `SessionStart` / `UserPromptExpansion` / `UserPromptSubmit` / `PreToolUse` (all tools) / `PostToolUse` / `PostToolUseFailure` / `PermissionDenied` / `Stop` / `StopFailure` / `SessionEnd` / `SubagentStart` / `SubagentStop`; Cursor `sessionStart` / `beforeSubmitPrompt` / `preToolUse` / `postToolUse` / `postToolUseFailure` / `beforeShellExecution` / `afterShellExecution` / `beforeReadFile` / `afterFileEdit` / `beforeMCPExecution` / `subagentStart` / `subagentStop` / `stop`; Codex `SessionStart` / `UserPromptSubmit` / `PreToolUse` (all tools) / `PostToolUse` / `Stop` / `SubagentStart` / `SubagentStop`. Re-run `install` to upgrade existing repos (Cursor-specific shell/read/edit/MCP events are added beside generic pre/post tool hooks; `runner_event` distinguishes the row).
65
65
 
@@ -79,7 +79,7 @@ Username and hostname *are* sent (per-member usage for the installing org). The
79
79
 
80
80
  - Chat transcripts (the JSONL file), session titles, and keystrokes
81
81
  - Tool error messages and stderr (a failure **class** is sent, never the message). Tool **result bodies** (`tool_response`) and **arguments** (`tool_input` / Cursor `command`) **are** sent unless `EV_AI_HOOK_CAPTURE_CONTENT=off`
82
- - User **prompts** — dropped unless `EV_AI_HOOK_CAPTURE_PROMPT=on` (or full stdin capture). The last assistant message **is** sent unless `EV_AI_HOOK_CAPTURE_CONTENT=off`
82
+ - User **prompts**, tool args, tool results and the last assistant message — dropped unless `EV_AI_HOOK_CAPTURE_PROMPT=on`, the org config `collect_prompt`, or full stdin capture
83
83
  - Cursor top-level `content` / `edits` / `file_path` from `afterFileEdit` / `beforeReadFile` stdin — those stay dropped. **Claude nests the same data inside `tool_input`** (Write `content`, Edit `old_string` / `new_string`), and `tool_response` carries read / command output, so on Claude those bodies **are** sent unless `EV_AI_HOOK_CAPTURE_CONTENT=off`
84
84
  - Contents of skills, rules, commands, memory, or settings files **outside** the user-spec path (user-scope name+size listings still omit bodies). User-spec file-backed components **do** send capped `text` (once per content hash; may be deferred under the byte budget); `description` is derived server-side
85
85
  - Hook **prompt** strings (only `action_kind` + `action_hash` for `prompt`-type actions). Hook **command** strings (`command` / `bash` / `powershell`) *are* sent, sanitized: home directory rewritten to `~`, URLs/tokens/secret-shaped args redacted, capped at 300 chars
package/README.md CHANGED
@@ -8,9 +8,9 @@ This is an **opt-in, first-party observability agent** that an ev-ai customer in
8
8
 
9
9
  - **Data goes to the customer's own collector.** The destination is the org's ev-ai endpoint (default `https://hooks.ev-ai.ai/{orgToken}/hook`, or a self-hosted collector via `--url`). It is not a third party from the org's perspective — the customer is the data controller.
10
10
  - **It is consent-based and removable.** Nothing installs silently: the operator enables the ev-ai plugins (or runs file-wiring `install`), and uninstall / plugin disable removes ev-ai wiring. Non-managed hooks can be removed locally by the developer at any time.
11
- - **Prompt collection is opt-in.** User prompt bodies (`hook_input.prompt`) are dropped by default; set `EV_AI_HOOK_CAPTURE_PROMPT=on` to send them. Policy rules still match prompts locally either way.
12
- - **Collection is opt-out for tool-arg / tool-result / last-assistant-message bodies.** Those three `hook_input` fields are sent by default (size-capped). Set `EV_AI_HOOK_CAPTURE_CONTENT=off` or `capture_hook_input: "allowlist"` to drop them (and the prompt, even when `EV_AI_HOOK_CAPTURE_PROMPT=on`). On Claude that includes file bodies written or read through a tool, which arrive nested in `tool_input` / `tool_response`. Session titles, chat transcripts, keystrokes, and runner error prose stay dropped. `env_vars` is a fixed allowlist of non-secret CI/runtime markers; API keys and proxy vars are never read. See [Privacy defaults](#privacy-defaults).
13
- - **What it is not:** it is not spyware, not a keylogger, and not a data broker. It does not collect keystrokes, does not scrape the filesystem, and does not exfiltrate to any endpoint the operator did not configure. It does forward the bodies of tool calls the agent makes, unless content capture is turned off.
11
+ - **Prompt collection is opt-in, and it covers every content body.** User prompts, tool args, tool results and the last assistant message (`hook_input.prompt`, `tool_input`, `tool_response`, `last_assistant_message`, Cursor `command`) are dropped by default and sent together (size-capped) with `EV_AI_HOOK_CAPTURE_PROMPT=on` or the org config `collect_prompt`. Policy rules still match them locally either way.
12
+ - **Content kill switch.** `EV_AI_HOOK_CAPTURE_CONTENT=off` or `capture_hook_input: "allowlist"` drops all of them even when prompt collection is on. On Claude that includes file bodies written or read through a tool, which arrive nested in `tool_input` / `tool_response`. Session titles, chat transcripts, keystrokes, and runner error prose stay dropped. `env_vars` is a fixed allowlist of non-secret CI/runtime markers; API keys and proxy vars are never read. See [Privacy defaults](#privacy-defaults).
13
+ - **What it is not:** it is not spyware, not a keylogger, and not a data broker. It does not collect keystrokes, does not scrape the filesystem, and does not exfiltrate to any endpoint the operator did not configure. It forwards the bodies of prompts and tool calls only when prompt collection is turned on.
14
14
 
15
15
  ## What this package does on your machine
16
16
 
@@ -39,7 +39,7 @@ A plain list of every behavior a security reviewer or supply-chain scanner will
39
39
 
40
40
  **Subprocesses.** `git`, and for OS / host detection `sw_vers`, `uname`, `lsb_release`, `tty`, `systemd-detect-virt`; `sqlite3` as a fallback reader for Cursor's `state.vscdb`. All are invoked with fixed argument lists (no shell) and short timeouts.
41
41
 
42
- **Content capture.** Tool-argument, tool-result and last-assistant-message bodies are sent by default (size-capped). Turn them off with `EV_AI_HOOK_CAPTURE_CONTENT=off`. Prompt bodies are off by default; turn them on with `EV_AI_HOOK_CAPTURE_PROMPT=on`. See [Privacy defaults](#privacy-defaults).
42
+ **Content capture.** Prompt, tool-argument, tool-result and last-assistant-message bodies are off by default and move together; turn them on with `EV_AI_HOOK_CAPTURE_PROMPT=on` (size-capped). `EV_AI_HOOK_CAPTURE_CONTENT=off` forces them off. See [Privacy defaults](#privacy-defaults).
43
43
 
44
44
  **Shipped code is bundled and minified** (`dist/*.mjs`, built with esbuild from TypeScript).
45
45
 
@@ -204,7 +204,7 @@ Debug envelope logging: `EV_AI_HOOK_DEBUG=1` (redacted summary). Full envelope:
204
204
 
205
205
  Full field-by-field inventory of what is POSTed: [COLLECTED-DATA.md](./COLLECTED-DATA.md).
206
206
 
207
- - **`hook_input`**: metadata (session/tool ids, status, …) plus content fields by default — `tool_input`, `tool_response`, `last_assistant_message`, and Cursor `command`. `prompt` is opt-in: `EV_AI_HOOK_CAPTURE_PROMPT=on` (also accepts `1` / `true`). Kill switch: `EV_AI_HOOK_CAPTURE_CONTENT=off` or untracked/tracked manifest `capture_hook_input: "allowlist"`. Session titles, transcript paths, runner error prose, and file/attachment paths stay dropped, as do the MCP spawn argv on `beforeMCPExecution` and the error prose `StopFailure` puts in `last_assistant_message`. Full stdin dump: untracked operator manifest `capture_hook_input: "full"`, `debug: true` on `~/.ev-ai/config.json`, or `EV_AI_HOOK_CAPTURE_FULL_INPUT=1` (still size-capped). `debug` does not change the collector URL. A **git-tracked** (committed) manifest cannot set `full` or `debug` — use the env var or an untracked operator / home overlay instead.
207
+ - **`hook_input`**: metadata (session/tool ids, status, …). The content fields — `prompt`, `tool_input`, `tool_response`, `last_assistant_message`, and Cursor `command` — are opt-in together: `EV_AI_HOOK_CAPTURE_PROMPT=on` (also accepts `1` / `true`) or the org config `collect_prompt`. Kill switch: `EV_AI_HOOK_CAPTURE_CONTENT=off` or untracked/tracked manifest `capture_hook_input: "allowlist"`. Session titles, transcript paths, runner error prose, and file/attachment paths stay dropped, as do the MCP spawn argv on `beforeMCPExecution` and the error prose `StopFailure` puts in `last_assistant_message`. Full stdin dump: untracked operator manifest `capture_hook_input: "full"`, `debug: true` on `~/.ev-ai/config.json`, or `EV_AI_HOOK_CAPTURE_FULL_INPUT=1` (still size-capped). `debug` does not change the collector URL. A **git-tracked** (committed) manifest cannot set `full` or `debug` — use the env var or an untracked operator / home overlay instead.
208
208
  - **`env_vars`**: fixed allowlist only (CI markers, `GITHUB_*` context, vendor base-URL overrides). Gateway URL values (`*_BASE_URL`, etc.) are sent with host/path and non-sensitive query keys for proxy-substitution detection; embedded URL credentials (`user:pass@`) and credential-shaped query params (`key`, `api-key`, `token`, `sig`, …) are redacted. API keys and HTTP proxy vars are never read.
209
209
  - **Transport**: collector URL must be `https` (or `http://localhost` / `127.0.0.1`, which is allowed only so a collector can be exercised on the same machine). Cleartext remote URLs are blocked (fail-open, no POST).
210
210
  - **User spec / project directories.** Accepting home-directory inventory (`~/.claude`, `~/.cursor`, `~/.codex`) does not by itself describe the project walks. Those also inventory **gitignored** agent config in the working tree (`settings.local.json`, `CLAUDE.local.md`, uncommitted edits) and **every directory a session opens** — including a personal clone on a work machine (cwd walk always; repo walk when that clone has an origin remote) and a covering parent above the git root (for example `~/dev/CLAUDE.md` sitting above both work and personal clones). Disable the project walks with `EV_AI_HOOK_CWD_SPEC=off`. Disable home spec, project spec, and operator identity together with `EV_AI_HOOK_USER_SPEC=off`.
package/dist/cli.mjs CHANGED
@@ -12,7 +12,7 @@ var dp=Object.create;var si=Object.defineProperty;var pp=Object.getOwnPropertyDe
12
12
  `),n=!1;return t.map(o=>n?yc.test(o)?(n=!1,o):o.trim().length===0?o:Q.COMPONENT_SOURCE_REDACTION_PLACEHOLDER:h_.test(o)&&!yc.test(o)?(n=!0,o):__(o)).join(`
13
13
  `)}function S_(e){return bo(e)!==e}});var rt=V(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});y.redactComponentSource=y.prepareComponentInspectionText=y.fitSnapshotInspectionTextBudget=y.componentSourceContainsRedactableSecret=y.capComponentTextBytes=y.SNAPSHOT_INSPECTION_TEXT_MAX_BYTES=y.COMPONENT_SOURCE_REDACTION_PLACEHOLDER=y.COMPONENT_INSPECTION_TEXT_MAX_BYTES=y.usableCatalogText=y.parseFrontmatterField=y.parseFrontmatterDescription=y.mcpServerToolSegmentForms=y.mcpServerNameMatchesToolSegment=y.isNpmRegistryPublisher=y.EMPTY_NPM_PUBLISHER=y.displayPublisherName=y.classifyMcpProvenance=y.resolveMcpPackageIdentity=y.McpPackageEcosystem=y.pinnedPackageVersionFromSpec=y.pinnedPackageVersionFromNpx=y.packageNameFromSpec=y.npxPackageSpecs=y.npxExecBin=y.PACKAGE_FIELD_MAX=y.serializeMcpLaunchIdentity=y.projectMcpMissingLaunchIdentity=y.projectMcpLaunchIdentity=y.normalizeMcpToolNames=y.MCP_MISSING_LAUNCH_SERIALIZED=y.MCP_LAUNCH_IDENTITY_ALGORITHM=y.maskMcpLaunchForDisplay=y.launchContainsCredentials=y.hashMcpLaunchIdentity=y.foldMcpName=y.buildMcpFamilyCanonicalKey=y.ComponentKind=void 0;y.userConfigRootFromPath=O_;y.installationRootExternalKey=T_;y.normalizeRepositoryRelativePath=Ac;y.nativeKeyForSkillPath=P_;y.nativeKeyForRulePath=w_;y.nativeKeyForCommandPath=N_;y.serializeComponentIdentity=bc;y.buildComponentReference=M_;y.validateComponentReference=L_;var E_=ze("node:crypto"),y_=ze("node:path"),R_="cmp1_",C_=/^cmp1_[A-Za-z0-9_-]{43}$/,A_=["/skills/","/skills-cursor/"],k_=/(?:^|\/)\.(?:cursor|claude|codex)\/rules\/(.+)$/i,b_=/(?:^|\/)\.(?:cursor|claude|codex)\/(?:commands|prompts)\/(.+)$/i,x_=[".cursor",".claude",".codex"],I_={".claude.json":".claude",".agents":".codex"};y.ComponentKind={SKILL:"SKILL",INTERFACE:"INTERFACE",RULE:"RULE",COMMAND:"COMMAND"};function O_(e){let t=e.replaceAll("\\","/").split("/").filter(Boolean),n=t.find(o=>x_.includes(o));return n||(t.map(o=>I_[o]).find(o=>o!==void 0)??"unknown")}function T_(e,t){return`runtime-install:${e}/${t}`}function er(e,t){if(e.length===0)throw new Error(`${t} is required`);return e}function Ac(e){let t=e.replaceAll("\\","/");if(t.startsWith("/")||/^[A-Za-z]:\//.test(t))throw new Error("sourcePath must be repository-relative");let n=y_.posix.normalize(t).replace(/^\.\//,"");if(n==="."||n===".."||n.startsWith("../"))throw new Error("sourcePath must be repository-relative");return er(n,"sourcePath")}function P_(e){let t=e.replaceAll("\\","/");for(let n of A_){let r=t.split(n)[1]?.split("/")[0];if(r&&r.length>0)return r}return null}function kc(e,t,n){let r=e.replaceAll("\\","/"),s=t.exec(r)?.[1];if(!s||s.split("/").includes(".."))return null;let i=s.replace(n,"");return i.length>0?i:null}function w_(e){return kc(e,k_,/\.(mdc|md|rules)$/i)}function N_(e){return kc(e,b_,/\.(md|mdc|toml)$/i)}function v_(e){return`${Buffer.byteLength(e,"utf8")}:${e}`}function bc(e){let t=[er(e.installationRootExternalKey,"installationRootExternalKey"),er(e.installableKind,"installableKind"),Ac(e.sourcePath),er(e.nativeKey,"nativeKey")];return Buffer.from(`1|${t.map(v_).join("|")}`,"utf8")}function M_(e){let t=(0,E_.createHash)("sha256").update(bc(e)).digest("base64url");return`${R_}${t}`}function L_(e){return C_.test(e)}var Ce=Xn();Object.defineProperty(y,"buildMcpFamilyCanonicalKey",{enumerable:!0,get:function(){return Ce.buildMcpFamilyCanonicalKey}});Object.defineProperty(y,"foldMcpName",{enumerable:!0,get:function(){return Ce.foldMcpName}});Object.defineProperty(y,"hashMcpLaunchIdentity",{enumerable:!0,get:function(){return Ce.hashMcpLaunchIdentity}});Object.defineProperty(y,"launchContainsCredentials",{enumerable:!0,get:function(){return Ce.launchContainsCredentials}});Object.defineProperty(y,"maskMcpLaunchForDisplay",{enumerable:!0,get:function(){return Ce.maskMcpLaunchForDisplay}});Object.defineProperty(y,"MCP_LAUNCH_IDENTITY_ALGORITHM",{enumerable:!0,get:function(){return Ce.MCP_LAUNCH_IDENTITY_ALGORITHM}});Object.defineProperty(y,"MCP_MISSING_LAUNCH_SERIALIZED",{enumerable:!0,get:function(){return Ce.MCP_MISSING_LAUNCH_SERIALIZED}});Object.defineProperty(y,"normalizeMcpToolNames",{enumerable:!0,get:function(){return Ce.normalizeMcpToolNames}});Object.defineProperty(y,"projectMcpLaunchIdentity",{enumerable:!0,get:function(){return Ce.projectMcpLaunchIdentity}});Object.defineProperty(y,"projectMcpMissingLaunchIdentity",{enumerable:!0,get:function(){return Ce.projectMcpMissingLaunchIdentity}});Object.defineProperty(y,"serializeMcpLaunchIdentity",{enumerable:!0,get:function(){return Ce.serializeMcpLaunchIdentity}});var xt=Zn();Object.defineProperty(y,"PACKAGE_FIELD_MAX",{enumerable:!0,get:function(){return xt.PACKAGE_FIELD_MAX}});Object.defineProperty(y,"npxExecBin",{enumerable:!0,get:function(){return xt.npxExecBin}});Object.defineProperty(y,"npxPackageSpecs",{enumerable:!0,get:function(){return xt.npxPackageSpecs}});Object.defineProperty(y,"packageNameFromSpec",{enumerable:!0,get:function(){return xt.packageNameFromSpec}});Object.defineProperty(y,"pinnedPackageVersionFromNpx",{enumerable:!0,get:function(){return xt.pinnedPackageVersionFromNpx}});Object.defineProperty(y,"pinnedPackageVersionFromSpec",{enumerable:!0,get:function(){return xt.pinnedPackageVersionFromSpec}});var xc=lc();Object.defineProperty(y,"McpPackageEcosystem",{enumerable:!0,get:function(){return xc.McpPackageEcosystem}});Object.defineProperty(y,"resolveMcpPackageIdentity",{enumerable:!0,get:function(){return xc.resolveMcpPackageIdentity}});var tr=hc();Object.defineProperty(y,"classifyMcpProvenance",{enumerable:!0,get:function(){return tr.classifyMcpProvenance}});Object.defineProperty(y,"displayPublisherName",{enumerable:!0,get:function(){return tr.displayPublisherName}});Object.defineProperty(y,"EMPTY_NPM_PUBLISHER",{enumerable:!0,get:function(){return tr.EMPTY_NPM_PUBLISHER}});Object.defineProperty(y,"isNpmRegistryPublisher",{enumerable:!0,get:function(){return tr.isNpmRegistryPublisher}});var Ic=Sc();Object.defineProperty(y,"mcpServerNameMatchesToolSegment",{enumerable:!0,get:function(){return Ic.mcpServerNameMatchesToolSegment}});Object.defineProperty(y,"mcpServerToolSegmentForms",{enumerable:!0,get:function(){return Ic.mcpServerToolSegmentForms}});var xo=Ec();Object.defineProperty(y,"parseFrontmatterDescription",{enumerable:!0,get:function(){return xo.parseFrontmatterDescription}});Object.defineProperty(y,"parseFrontmatterField",{enumerable:!0,get:function(){return xo.parseFrontmatterField}});Object.defineProperty(y,"usableCatalogText",{enumerable:!0,get:function(){return xo.usableCatalogText}});var nt=Cc();Object.defineProperty(y,"COMPONENT_INSPECTION_TEXT_MAX_BYTES",{enumerable:!0,get:function(){return nt.COMPONENT_INSPECTION_TEXT_MAX_BYTES}});Object.defineProperty(y,"COMPONENT_SOURCE_REDACTION_PLACEHOLDER",{enumerable:!0,get:function(){return nt.COMPONENT_SOURCE_REDACTION_PLACEHOLDER}});Object.defineProperty(y,"SNAPSHOT_INSPECTION_TEXT_MAX_BYTES",{enumerable:!0,get:function(){return nt.SNAPSHOT_INSPECTION_TEXT_MAX_BYTES}});Object.defineProperty(y,"capComponentTextBytes",{enumerable:!0,get:function(){return nt.capComponentTextBytes}});Object.defineProperty(y,"componentSourceContainsRedactableSecret",{enumerable:!0,get:function(){return nt.componentSourceContainsRedactableSecret}});Object.defineProperty(y,"fitSnapshotInspectionTextBudget",{enumerable:!0,get:function(){return nt.fitSnapshotInspectionTextBudget}});Object.defineProperty(y,"prepareComponentInspectionText",{enumerable:!0,get:function(){return nt.prepareComponentInspectionText}});Object.defineProperty(y,"redactComponentSource",{enumerable:!0,get:function(){return nt.redactComponentSource}})});var gr=V(Ee=>{"use strict";Ee.isInteger=e=>typeof e=="number"?Number.isInteger(e):typeof e=="string"&&e.trim()!==""?Number.isInteger(Number(e)):!1;Ee.find=(e,t)=>e.nodes.find(n=>n.type===t);Ee.exceedsLimit=(e,t,n=1,r)=>r===!1||!Ee.isInteger(e)||!Ee.isInteger(t)?!1:(Number(t)-Number(e))/Number(n)>=r;Ee.escapeNode=(e,t=0,n)=>{let r=e.nodes[t];r&&(n&&r.type===n||r.type==="open"||r.type==="close")&&r.escaped!==!0&&(r.value="\\"+r.value,r.escaped=!0)};Ee.encloseBrace=e=>e.type!=="brace"?!1:e.commas>>0+e.ranges>>0===0?(e.invalid=!0,!0):!1;Ee.isInvalidBrace=e=>e.type!=="brace"?!1:e.invalid===!0||e.dollar?!0:e.commas>>0+e.ranges>>0===0||e.open!==!0||e.close!==!0?(e.invalid=!0,!0):!1;Ee.isOpenOrClose=e=>e.type==="open"||e.type==="close"?!0:e.open===!0||e.close===!0;Ee.reduce=e=>e.reduce((t,n)=>(n.type==="text"&&t.push(n.value),n.type==="range"&&(n.type="text"),t),[]);Ee.flatten=(...e)=>{let t=[],n=r=>{for(let o=0;o<r.length;o++){let s=r[o];if(Array.isArray(s)){n(s);continue}s!==void 0&&t.push(s)}return t};return n(e),t}});var hr=V((NO,cl)=>{"use strict";var al=gr();cl.exports=(e,t={})=>{let n=(r,o={})=>{let s=t.escapeInvalid&&al.isInvalidBrace(o),i=r.invalid===!0&&t.escapeInvalid===!0,a="";if(r.value)return(s||i)&&al.isOpenOrClose(r)?"\\"+r.value:r.value;if(r.value)return r.value;if(r.nodes)for(let c of r.nodes)a+=n(c);return a};return n(e)}});var ll=V((vO,ul)=>{"use strict";ul.exports=function(e){return typeof e=="number"?e-e===0:typeof e=="string"&&e.trim()!==""?Number.isFinite?Number.isFinite(+e):isFinite(+e):!1}});var El=V((MO,Sl)=>{"use strict";var fl=ll(),ft=(e,t,n)=>{if(fl(e)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(t===void 0||e===t)return String(e);if(fl(t)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let r={relaxZeros:!0,...n};typeof r.strictZeros=="boolean"&&(r.relaxZeros=r.strictZeros===!1);let o=String(r.relaxZeros),s=String(r.shorthand),i=String(r.capture),a=String(r.wrap),c=e+":"+t+"="+o+s+i+a;if(ft.cache.hasOwnProperty(c))return ft.cache[c].result;let l=Math.min(e,t),u=Math.max(e,t);if(Math.abs(l-u)===1){let S=e+"|"+t;return r.capture?`(${S})`:r.wrap===!1?S:`(?:${S})`}let d=_l(e)||_l(t),f={min:e,max:t,a:l,b:u},p=[],g=[];if(d&&(f.isPadded=d,f.maxLen=String(f.max).length),l<0){let S=u<0?Math.abs(u):1;g=dl(S,Math.abs(l),f,r),l=f.a=0}return u>=0&&(p=dl(l,u,f,r)),f.negatives=g,f.positives=p,f.result=py(g,p,r),r.capture===!0?f.result=`(${f.result})`:r.wrap!==!1&&p.length+g.length>1&&(f.result=`(?:${f.result})`),ft.cache[c]=f,f.result};function py(e,t,n){let r=ss(e,t,"-",!1,n)||[],o=ss(t,e,"",!1,n)||[],s=ss(e,t,"-?",!0,n)||[];return r.concat(s).concat(o).join("|")}function my(e,t){let n=1,r=1,o=ml(e,n),s=new Set([t]);for(;e<=o&&o<=t;)s.add(o),n+=1,o=ml(e,n);for(o=gl(t+1,r)-1;e<o&&o<=t;)s.add(o),r+=1,o=gl(t+1,r)-1;return s=[...s],s.sort(_y),s}function gy(e,t,n){if(e===t)return{pattern:e,count:[],digits:0};let r=hy(e,t),o=r.length,s="",i=0;for(let a=0;a<o;a++){let[c,l]=r[a];c===l?s+=c:c!=="0"||l!=="9"?s+=Sy(c,l,n):i++}return i&&(s+=n.shorthand===!0?"\\d":"[0-9]"),{pattern:s,count:[i],digits:o}}function dl(e,t,n,r){let o=my(e,t),s=[],i=e,a;for(let c=0;c<o.length;c++){let l=o[c],u=gy(String(i),String(l),r),d="";if(!n.isPadded&&a&&a.pattern===u.pattern){a.count.length>1&&a.count.pop(),a.count.push(u.count[0]),a.string=a.pattern+hl(a.count),i=l+1;continue}n.isPadded&&(d=Ey(l,n,r)),u.string=d+u.pattern+hl(u.count),s.push(u),i=l+1,a=u}return s}function ss(e,t,n,r,o){let s=[];for(let i of e){let{string:a}=i;!r&&!pl(t,"string",a)&&s.push(n+a),r&&pl(t,"string",a)&&s.push(n+a)}return s}function hy(e,t){let n=[];for(let r=0;r<e.length;r++)n.push([e[r],t[r]]);return n}function _y(e,t){return e>t?1:t>e?-1:0}function pl(e,t,n){return e.some(r=>r[t]===n)}function ml(e,t){return Number(String(e).slice(0,-t)+"9".repeat(t))}function gl(e,t){return e-e%Math.pow(10,t)}function hl(e){let[t=0,n=""]=e;return n||t>1?`{${t+(n?","+n:"")}}`:""}function Sy(e,t,n){return`[${e}${t-e===1?"":"-"}${t}]`}function _l(e){return/^-?(0+)\d/.test(e)}function Ey(e,t,n){if(!t.isPadded)return e;let r=Math.abs(t.maxLen-String(e).length),o=n.relaxZeros!==!1;switch(r){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${r}}`:`0{${r}}`}}ft.cache={};ft.clearCache=()=>ft.cache={};Sl.exports=ft});var cs=V((LO,xl)=>{"use strict";var yy=ze("util"),Rl=El(),yl=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Ry=e=>t=>e===!0?Number(t):String(t),is=e=>typeof e=="number"||typeof e=="string"&&e!=="",rn=e=>Number.isInteger(+e),as=e=>{let t=`${e}`,n=-1;if(t[0]==="-"&&(t=t.slice(1)),t==="0")return!1;for(;t[++n]==="0";);return n>0},Cy=(e,t,n)=>typeof e=="string"||typeof t=="string"?!0:n.stringify===!0,Ay=(e,t,n)=>{if(t>0){let r=e[0]==="-"?"-":"";r&&(e=e.slice(1)),e=r+e.padStart(r?t-1:t,"0")}return n===!1?String(e):e},Sr=(e,t)=>{let n=e[0]==="-"?"-":"";for(n&&(e=e.slice(1),t--);e.length<t;)e="0"+e;return n?"-"+e:e},ky=(e,t,n)=>{e.negatives.sort((a,c)=>a<c?-1:a>c?1:0),e.positives.sort((a,c)=>a<c?-1:a>c?1:0);let r=t.capture?"":"?:",o="",s="",i;return e.positives.length&&(o=e.positives.map(a=>Sr(String(a),n)).join("|")),e.negatives.length&&(s=`-(${r}${e.negatives.map(a=>Sr(String(a),n)).join("|")})`),o&&s?i=`${o}|${s}`:i=o||s,t.wrap?`(${r}${i})`:i},Cl=(e,t,n,r)=>{if(n)return Rl(e,t,{wrap:!1,...r});let o=String.fromCharCode(e);if(e===t)return o;let s=String.fromCharCode(t);return`[${o}-${s}]`},Al=(e,t,n)=>{if(Array.isArray(e)){let r=n.wrap===!0,o=n.capture?"":"?:";return r?`(${o}${e.join("|")})`:e.join("|")}return Rl(e,t,n)},kl=(...e)=>new RangeError("Invalid range arguments: "+yy.inspect(...e)),bl=(e,t,n)=>{if(n.strictRanges===!0)throw kl([e,t]);return[]},by=(e,t)=>{if(t.strictRanges===!0)throw new TypeError(`Expected step "${e}" to be a number`);return[]},xy=(e,t,n=1,r={})=>{let o=Number(e),s=Number(t);if(!Number.isInteger(o)||!Number.isInteger(s)){if(r.strictRanges===!0)throw kl([e,t]);return[]}o===0&&(o=0),s===0&&(s=0);let i=o>s,a=String(e),c=String(t),l=String(n);n=Math.max(Math.abs(n),1);let u=as(a)||as(c)||as(l),d=u?Math.max(a.length,c.length,l.length):0,f=u===!1&&Cy(e,t,r)===!1,p=r.transform||Ry(f);if(r.toRegex&&n===1)return Cl(Sr(e,d),Sr(t,d),!0,r);let g={negatives:[],positives:[]},S=O=>g[O<0?"negatives":"positives"].push(Math.abs(O)),A=[],k=0;for(;i?o>=s:o<=s;)r.toRegex===!0&&n>1?S(o):A.push(Ay(p(o,k),d,f)),o=i?o-n:o+n,k++;return r.toRegex===!0?n>1?ky(g,r,d):Al(A,null,{wrap:!1,...r}):A},Iy=(e,t,n=1,r={})=>{if(!rn(e)&&e.length>1||!rn(t)&&t.length>1)return bl(e,t,r);let o=r.transform||(f=>String.fromCharCode(f)),s=`${e}`.charCodeAt(0),i=`${t}`.charCodeAt(0),a=s>i,c=Math.min(s,i),l=Math.max(s,i);if(r.toRegex&&n===1)return Cl(c,l,!1,r);let u=[],d=0;for(;a?s>=i:s<=i;)u.push(o(s,d)),s=a?s-n:s+n,d++;return r.toRegex===!0?Al(u,null,{wrap:!1,options:r}):u},_r=(e,t,n,r={})=>{if(t==null&&is(e))return[e];if(!is(e)||!is(t))return bl(e,t,r);if(typeof n=="function")return _r(e,t,1,{transform:n});if(yl(n))return _r(e,t,0,n);let o={...r};return o.capture===!0&&(o.wrap=!0),n=n||o.step||1,rn(n)?rn(e)&&rn(t)?xy(e,t,n,o):Iy(e,t,Math.max(Math.abs(n),1),o):n!=null&&!yl(n)?by(n,o):_r(e,t,1,n)};xl.exports=_r});var Tl=V((HO,Ol)=>{"use strict";var Oy=cs(),Il=gr(),Ty=(e,t={})=>{let n=(r,o={})=>{let s=Il.isInvalidBrace(o),i=r.invalid===!0&&t.escapeInvalid===!0,a=s===!0||i===!0,c=t.escapeInvalid===!0?"\\":"",l="";if(r.isOpen===!0)return c+r.value;if(r.isClose===!0)return console.log("node.isClose",c,r.value),c+r.value;if(r.type==="open")return a?c+r.value:"(";if(r.type==="close")return a?c+r.value:")";if(r.type==="comma")return r.prev.type==="comma"?"":a?r.value:"|";if(r.value)return r.value;if(r.nodes&&r.ranges>0){let u=Il.reduce(r.nodes),d=Oy(...u,{...t,wrap:!1,toRegex:!0,strictZeros:!0});if(d.length!==0)return u.length>1&&d.length>1?`(${d})`:d}if(r.nodes)for(let u of r.nodes)l+=n(u,r);return l};return n(e)};Ol.exports=Ty});var Nl=V((UO,wl)=>{"use strict";var Py=cs(),Pl=hr(),Ot=gr(),dt=(e="",t="",n=!1)=>{let r=[];if(e=[].concat(e),t=[].concat(t),!t.length)return e;if(!e.length)return n?Ot.flatten(t).map(o=>`{${o}}`):t;for(let o of e)if(Array.isArray(o))for(let s of o)r.push(dt(s,t,n));else for(let s of t)n===!0&&typeof s=="string"&&(s=`{${s}}`),r.push(Array.isArray(s)?dt(o,s,n):o+s);return Ot.flatten(r)},wy=(e,t={})=>{let n=t.rangeLimit===void 0?1e3:t.rangeLimit,r=(o,s={})=>{o.queue=[];let i=s,a=s.queue;for(;i.type!=="brace"&&i.type!=="root"&&i.parent;)i=i.parent,a=i.queue;if(o.invalid||o.dollar){a.push(dt(a.pop(),Pl(o,t)));return}if(o.type==="brace"&&o.invalid!==!0&&o.nodes.length===2){a.push(dt(a.pop(),["{}"]));return}if(o.nodes&&o.ranges>0){let d=Ot.reduce(o.nodes);if(Ot.exceedsLimit(...d,t.step,n))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let f=Py(...d,t);f.length===0&&(f=Pl(o,t)),a.push(dt(a.pop(),f)),o.nodes=[];return}let c=Ot.encloseBrace(o),l=o.queue,u=o;for(;u.type!=="brace"&&u.type!=="root"&&u.parent;)u=u.parent,l=u.queue;for(let d=0;d<o.nodes.length;d++){let f=o.nodes[d];if(f.type==="comma"&&o.type==="brace"){d===1&&l.push(""),l.push("");continue}if(f.type==="close"){a.push(dt(a.pop(),l,c));continue}if(f.value&&f.type!=="open"){l.push(dt(l.pop(),f.value));continue}f.nodes&&r(f,o)}return l};return Ot.flatten(r(e))};wl.exports=wy});var Ml=V((DO,vl)=>{"use strict";vl.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
14
14
  `,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var Fl=V((FO,Dl)=>{"use strict";var Ny=hr(),{MAX_LENGTH:Ll,CHAR_BACKSLASH:us,CHAR_BACKTICK:vy,CHAR_COMMA:My,CHAR_DOT:Ly,CHAR_LEFT_PARENTHESES:Hy,CHAR_RIGHT_PARENTHESES:Uy,CHAR_LEFT_CURLY_BRACE:Dy,CHAR_RIGHT_CURLY_BRACE:Fy,CHAR_LEFT_SQUARE_BRACKET:Hl,CHAR_RIGHT_SQUARE_BRACKET:Ul,CHAR_DOUBLE_QUOTE:$y,CHAR_SINGLE_QUOTE:jy,CHAR_NO_BREAK_SPACE:By,CHAR_ZERO_WIDTH_NOBREAK_SPACE:Ky}=Ml(),Gy=(e,t={})=>{if(typeof e!="string")throw new TypeError("Expected a string");let n=t||{},r=typeof n.maxLength=="number"?Math.min(Ll,n.maxLength):Ll;if(e.length>r)throw new SyntaxError(`Input length (${e.length}), exceeds max characters (${r})`);let o={type:"root",input:e,nodes:[]},s=[o],i=o,a=o,c=0,l=e.length,u=0,d=0,f,p=()=>e[u++],g=S=>{if(S.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&S.type==="text"){a.value+=S.value;return}return i.nodes.push(S),S.parent=i,S.prev=a,a=S,S};for(g({type:"bos"});u<l;)if(i=s[s.length-1],f=p(),!(f===Ky||f===By)){if(f===us){g({type:"text",value:(t.keepEscaping?f:"")+p()});continue}if(f===Ul){g({type:"text",value:"\\"+f});continue}if(f===Hl){c++;let S;for(;u<l&&(S=p());){if(f+=S,S===Hl){c++;continue}if(S===us){f+=p();continue}if(S===Ul&&(c--,c===0))break}g({type:"text",value:f});continue}if(f===Hy){i=g({type:"paren",nodes:[]}),s.push(i),g({type:"text",value:f});continue}if(f===Uy){if(i.type!=="paren"){g({type:"text",value:f});continue}i=s.pop(),g({type:"text",value:f}),i=s[s.length-1];continue}if(f===$y||f===jy||f===vy){let S=f,A;for(t.keepQuotes!==!0&&(f="");u<l&&(A=p());){if(A===us){f+=A+p();continue}if(A===S){t.keepQuotes===!0&&(f+=A);break}f+=A}g({type:"text",value:f});continue}if(f===Dy){d++;let A={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||i.dollar===!0,depth:d,commas:0,ranges:0,nodes:[]};i=g(A),s.push(i),g({type:"open",value:f});continue}if(f===Fy){if(i.type!=="brace"){g({type:"text",value:f});continue}let S="close";i=s.pop(),i.close=!0,g({type:S,value:f}),d--,i=s[s.length-1];continue}if(f===My&&d>0){if(i.ranges>0){i.ranges=0;let S=i.nodes.shift();i.nodes=[S,{type:"text",value:Ny(i)}]}g({type:"comma",value:f}),i.commas++;continue}if(f===Ly&&d>0&&i.commas===0){let S=i.nodes;if(d===0||S.length===0){g({type:"text",value:f});continue}if(a.type==="dot"){if(i.range=[],a.value+=f,a.type="range",i.nodes.length!==3&&i.nodes.length!==5){i.invalid=!0,i.ranges=0,a.type="text";continue}i.ranges++,i.args=[];continue}if(a.type==="range"){S.pop();let A=S[S.length-1];A.value+=a.value+f,a=A,i.ranges--;continue}g({type:"dot",value:f});continue}g({type:"text",value:f})}do if(i=s.pop(),i.type!=="root"){i.nodes.forEach(k=>{k.nodes||(k.type==="open"&&(k.isOpen=!0),k.type==="close"&&(k.isClose=!0),k.nodes||(k.type="text"),k.invalid=!0)});let S=s[s.length-1],A=S.nodes.indexOf(i);S.nodes.splice(A,1,...i.nodes)}while(s.length>0);return g({type:"eos"}),o};Dl.exports=Gy});var Bl=V(($O,jl)=>{"use strict";var $l=hr(),Wy=Tl(),zy=Nl(),Vy=Fl(),me=(e,t={})=>{let n=[];if(Array.isArray(e))for(let r of e){let o=me.create(r,t);Array.isArray(o)?n.push(...o):n.push(o)}else n=[].concat(me.create(e,t));return t&&t.expand===!0&&t.nodupes===!0&&(n=[...new Set(n)]),n};me.parse=(e,t={})=>Vy(e,t);me.stringify=(e,t={})=>$l(typeof e=="string"?me.parse(e,t):e,t);me.compile=(e,t={})=>(typeof e=="string"&&(e=me.parse(e,t)),Wy(e,t));me.expand=(e,t={})=>{typeof e=="string"&&(e=me.parse(e,t));let n=zy(e,t);return t.noempty===!0&&(n=n.filter(Boolean)),t.nodupes===!0&&(n=[...new Set(n)]),n};me.create=(e,t={})=>e===""||e.length<3?[e]:t.expand!==!0?me.compile(e,t):me.expand(e,t);jl.exports=me});var on=V((jO,Vl)=>{"use strict";var Jy=ze("path"),we="\\\\/",Kl=`[^${we}]`,Yy=0,Ge="\\.",Xy="\\+",qy="\\?",Er="\\/",Zy="(?=.)",Gl="[^/]",ls=`(?:${Er}|$)`,Wl=`(?:^|${Er})`,fs=`${Ge}{1,2}${ls}`,Qy=`(?!${Ge})`,eR=`(?!${Wl}${fs})`,tR=`(?!${Ge}{0,1}${ls})`,nR=`(?!${fs})`,rR=`[^.${Er}]`,oR=`${Gl}*?`,zl={DOT_LITERAL:Ge,PLUS_LITERAL:Xy,QMARK_LITERAL:qy,SLASH_LITERAL:Er,ONE_CHAR:Zy,QMARK:Gl,END_ANCHOR:ls,DOTS_SLASH:fs,NO_DOT:Qy,NO_DOTS:eR,NO_DOT_SLASH:tR,NO_DOTS_SLASH:nR,QMARK_NO_DOT:rR,STAR:oR,START_ANCHOR:Wl},sR={...zl,SLASH_LITERAL:`[${we}]`,QMARK:Kl,STAR:`${Kl}*?`,DOTS_SLASH:`${Ge}{1,2}(?:[${we}]|$)`,NO_DOT:`(?!${Ge})`,NO_DOTS:`(?!(?:^|[${we}])${Ge}{1,2}(?:[${we}]|$))`,NO_DOT_SLASH:`(?!${Ge}{0,1}(?:[${we}]|$))`,NO_DOTS_SLASH:`(?!${Ge}{1,2}(?:[${we}]|$))`,QMARK_NO_DOT:`[^.${we}]`,START_ANCHOR:`(?:^|[${we}])`,END_ANCHOR:`(?:[${we}]|$)`},iR={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};Vl.exports={DEFAULT_MAX_EXTGLOB_RECURSION:Yy,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:iR,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:Jy.sep,extglobChars(e){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(e){return e===!0?sR:zl}}});var sn=V(ce=>{"use strict";var aR=ze("path"),cR=process.platform==="win32",{REGEX_BACKSLASH:uR,REGEX_REMOVE_BACKSLASH:lR,REGEX_SPECIAL_CHARS:fR,REGEX_SPECIAL_CHARS_GLOBAL:dR}=on();ce.isObject=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);ce.hasRegexChars=e=>fR.test(e);ce.isRegexChar=e=>e.length===1&&ce.hasRegexChars(e);ce.escapeRegex=e=>e.replace(dR,"\\$1");ce.toPosixSlashes=e=>e.replace(uR,"/");ce.removeBackslashes=e=>e.replace(lR,t=>t==="\\"?"":t);ce.supportsLookbehinds=()=>{let e=process.version.slice(1).split(".").map(Number);return e.length===3&&e[0]>=9||e[0]===8&&e[1]>=10};ce.isWindows=e=>e&&typeof e.windows=="boolean"?e.windows:cR===!0||aR.sep==="\\";ce.escapeLast=(e,t,n)=>{let r=e.lastIndexOf(t,n);return r===-1?e:e[r-1]==="\\"?ce.escapeLast(e,t,r-1):`${e.slice(0,r)}\\${e.slice(r)}`};ce.removePrefix=(e,t={})=>{let n=e;return n.startsWith("./")&&(n=n.slice(2),t.prefix="./"),n};ce.wrapOutput=(e,t={},n={})=>{let r=n.contains?"":"^",o=n.contains?"":"$",s=`${r}(?:${e})${o}`;return t.negated===!0&&(s=`(?:^(?!${s}).*$)`),s}});var tf=V((KO,ef)=>{"use strict";var Jl=sn(),{CHAR_ASTERISK:ds,CHAR_AT:pR,CHAR_BACKWARD_SLASH:an,CHAR_COMMA:mR,CHAR_DOT:ps,CHAR_EXCLAMATION_MARK:ms,CHAR_FORWARD_SLASH:Ql,CHAR_LEFT_CURLY_BRACE:gs,CHAR_LEFT_PARENTHESES:hs,CHAR_LEFT_SQUARE_BRACKET:gR,CHAR_PLUS:hR,CHAR_QUESTION_MARK:Yl,CHAR_RIGHT_CURLY_BRACE:_R,CHAR_RIGHT_PARENTHESES:Xl,CHAR_RIGHT_SQUARE_BRACKET:SR}=on(),ql=e=>e===Ql||e===an,Zl=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)},ER=(e,t)=>{let n=t||{},r=e.length-1,o=n.parts===!0||n.scanToEnd===!0,s=[],i=[],a=[],c=e,l=-1,u=0,d=0,f=!1,p=!1,g=!1,S=!1,A=!1,k=!1,O=!1,I=!1,v=!1,T=!1,K=0,D,x,w={value:"",depth:0,isGlob:!1},H=()=>l>=r,m=()=>c.charCodeAt(l+1),b=()=>(D=x,c.charCodeAt(++l));for(;l<r;){x=b();let ie;if(x===an){O=w.backslashes=!0,x=b(),x===gs&&(k=!0);continue}if(k===!0||x===gs){for(K++;H()!==!0&&(x=b());){if(x===an){O=w.backslashes=!0,b();continue}if(x===gs){K++;continue}if(k!==!0&&x===ps&&(x=b())===ps){if(f=w.isBrace=!0,g=w.isGlob=!0,T=!0,o===!0)continue;break}if(k!==!0&&x===mR){if(f=w.isBrace=!0,g=w.isGlob=!0,T=!0,o===!0)continue;break}if(x===_R&&(K--,K===0)){k=!1,f=w.isBrace=!0,T=!0;break}}if(o===!0)continue;break}if(x===Ql){if(s.push(l),i.push(w),w={value:"",depth:0,isGlob:!1},T===!0)continue;if(D===ps&&l===u+1){u+=2;continue}d=l+1;continue}if(n.noext!==!0&&(x===hR||x===pR||x===ds||x===Yl||x===ms)===!0&&m()===hs){if(g=w.isGlob=!0,S=w.isExtglob=!0,T=!0,x===ms&&l===u&&(v=!0),o===!0){for(;H()!==!0&&(x=b());){if(x===an){O=w.backslashes=!0,x=b();continue}if(x===Xl){g=w.isGlob=!0,T=!0;break}}continue}break}if(x===ds){if(D===ds&&(A=w.isGlobstar=!0),g=w.isGlob=!0,T=!0,o===!0)continue;break}if(x===Yl){if(g=w.isGlob=!0,T=!0,o===!0)continue;break}if(x===gR){for(;H()!==!0&&(ie=b());){if(ie===an){O=w.backslashes=!0,b();continue}if(ie===SR){p=w.isBracket=!0,g=w.isGlob=!0,T=!0;break}}if(o===!0)continue;break}if(n.nonegate!==!0&&x===ms&&l===u){I=w.negated=!0,u++;continue}if(n.noparen!==!0&&x===hs){if(g=w.isGlob=!0,o===!0){for(;H()!==!0&&(x=b());){if(x===hs){O=w.backslashes=!0,x=b();continue}if(x===Xl){T=!0;break}}continue}break}if(g===!0){if(T=!0,o===!0)continue;break}}n.noext===!0&&(S=!1,g=!1);let U=c,le="",h="";u>0&&(le=c.slice(0,u),c=c.slice(u),d-=u),U&&g===!0&&d>0?(U=c.slice(0,d),h=c.slice(d)):g===!0?(U="",h=c):U=c,U&&U!==""&&U!=="/"&&U!==c&&ql(U.charCodeAt(U.length-1))&&(U=U.slice(0,-1)),n.unescape===!0&&(h&&(h=Jl.removeBackslashes(h)),U&&O===!0&&(U=Jl.removeBackslashes(U)));let _={prefix:le,input:e,start:u,base:U,glob:h,isBrace:f,isBracket:p,isGlob:g,isExtglob:S,isGlobstar:A,negated:I,negatedExtglob:v};if(n.tokens===!0&&(_.maxDepth=0,ql(x)||i.push(w),_.tokens=i),n.parts===!0||n.tokens===!0){let ie;for(let F=0;F<s.length;F++){let Ae=ie?ie+1:u,ke=s[F],fe=e.slice(Ae,ke);n.tokens&&(F===0&&u!==0?(i[F].isPrefix=!0,i[F].value=le):i[F].value=fe,Zl(i[F]),_.maxDepth+=i[F].depth),(F!==0||fe!=="")&&a.push(fe),ie=ke}if(ie&&ie+1<e.length){let F=e.slice(ie+1);a.push(F),n.tokens&&(i[i.length-1].value=F,Zl(i[i.length-1]),_.maxDepth+=i[i.length-1].depth)}_.slashes=s,_.parts=a}return _};ef.exports=ER});var af=V((GO,sf)=>{"use strict";var cn=on(),se=sn(),{MAX_LENGTH:yr,POSIX_REGEX_SOURCE:yR,REGEX_NON_SPECIAL_CHARS:RR,REGEX_SPECIAL_CHARS_BACKREF:CR,REPLACEMENTS:nf}=cn,AR=(e,t)=>{if(typeof t.expandRange=="function")return t.expandRange(...e,t);e.sort();let n=`[${e.join("-")}]`;try{new RegExp(n)}catch{return e.map(o=>se.escapeRegex(o)).join("..")}return n},Tt=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,rf=e=>{let t=[],n=0,r=0,o=0,s="",i=!1;for(let a of e){if(i===!0){s+=a,i=!1;continue}if(a==="\\"){s+=a,i=!0;continue}if(a==='"'){o=o===1?0:1,s+=a;continue}if(o===0){if(a==="[")n++;else if(a==="]"&&n>0)n--;else if(n===0){if(a==="(")r++;else if(a===")"&&r>0)r--;else if(a==="|"&&r===0){t.push(s),s="";continue}}}s+=a}return t.push(s),t},kR=e=>{let t=!1;for(let n of e){if(t===!0){t=!1;continue}if(n==="\\"){t=!0;continue}if(/[?*+@!()[\]{}]/.test(n))return!1}return!0},of=e=>{let t=e.trim(),n=!0;for(;n===!0;)n=!1,/^@\([^\\()[\]{}|]+\)$/.test(t)&&(t=t.slice(2,-1),n=!0);if(kR(t))return t.replace(/\\(.)/g,"$1")},bR=e=>{let t=e.map(of).filter(Boolean);for(let n=0;n<t.length;n++)for(let r=n+1;r<t.length;r++){let o=t[n],s=t[r],i=o[0];if(!(!i||o!==i.repeat(o.length)||s!==i.repeat(s.length))&&(o===s||o.startsWith(s)||s.startsWith(o)))return!0}return!1},_s=(e,t=!0)=>{if(e[0]!=="+"&&e[0]!=="*"||e[1]!=="(")return;let n=0,r=0,o=0,s=!1;for(let i=1;i<e.length;i++){let a=e[i];if(s===!0){s=!1;continue}if(a==="\\"){s=!0;continue}if(a==='"'){o=o===1?0:1;continue}if(o!==1){if(a==="["){n++;continue}if(a==="]"&&n>0){n--;continue}if(!(n>0)){if(a==="("){r++;continue}if(a===")"&&(r--,r===0))return t===!0&&i!==e.length-1?void 0:{type:e[0],body:e.slice(2,i),end:i}}}}},xR=e=>{let t=0,n=[];for(;t<e.length;){let o=_s(e.slice(t),!1);if(!o||o.type!=="*")return;let s=rf(o.body).map(a=>a.trim());if(s.length!==1)return;let i=of(s[0]);if(!i||i.length!==1)return;n.push(i),t+=o.end+1}return n.length<1?void 0:`${n.length===1?se.escapeRegex(n[0]):`[${n.map(o=>se.escapeRegex(o)).join("")}]`}*`},IR=e=>{let t=0,n=e.trim(),r=_s(n);for(;r;)t++,n=r.body.trim(),r=_s(n);return t},OR=(e,t)=>{if(t.maxExtglobRecursion===!1)return{risky:!1};let n=typeof t.maxExtglobRecursion=="number"?t.maxExtglobRecursion:cn.DEFAULT_MAX_EXTGLOB_RECURSION,r=rf(e).map(o=>o.trim());if(r.length>1&&(r.some(o=>o==="")||r.some(o=>/^[*?]+$/.test(o))||bR(r)))return{risky:!0};for(let o of r){let s=xR(o);if(s)return{risky:!0,safeOutput:s};if(IR(o)>n)return{risky:!0}}return{risky:!1}},Ss=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a string");e=nf[e]||e;let n={...t},r=typeof n.maxLength=="number"?Math.min(yr,n.maxLength):yr,o=e.length;if(o>r)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${r}`);let s={type:"bos",value:"",output:n.prepend||""},i=[s],a=n.capture?"":"?:",c=se.isWindows(t),l=cn.globChars(c),u=cn.extglobChars(l),{DOT_LITERAL:d,PLUS_LITERAL:f,SLASH_LITERAL:p,ONE_CHAR:g,DOTS_SLASH:S,NO_DOT:A,NO_DOT_SLASH:k,NO_DOTS_SLASH:O,QMARK:I,QMARK_NO_DOT:v,STAR:T,START_ANCHOR:K}=l,D=C=>`(${a}(?:(?!${K}${C.dot?S:d}).)*?)`,x=n.dot?"":A,w=n.dot?I:v,H=n.bash===!0?D(n):T;n.capture&&(H=`(${H})`),typeof n.noext=="boolean"&&(n.noextglob=n.noext);let m={input:e,index:-1,start:0,dot:n.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:i};e=se.removePrefix(e,m),o=e.length;let b=[],U=[],le=[],h=s,_,ie=()=>m.index===o-1,F=m.peek=(C=1)=>e[m.index+C],Ae=m.advance=()=>e[++m.index]||"",ke=()=>e.slice(m.index+1),fe=(C="",Y=0)=>{m.consumed+=C,m.index+=Y},yn=C=>{m.output+=C.output!=null?C.output:C.value,fe(C.value)},lp=()=>{let C=1;for(;F()==="!"&&(F(2)!=="("||F(3)==="?");)Ae(),m.start++,C++;return C%2===0?!1:(m.negated=!0,m.start++,!0)},Rn=C=>{m[C]++,le.push(C)},We=C=>{m[C]--,le.pop()},N=C=>{if(h.type==="globstar"){let Y=m.braces>0&&(C.type==="comma"||C.type==="brace"),R=C.extglob===!0||b.length&&(C.type==="pipe"||C.type==="paren");C.type!=="slash"&&C.type!=="paren"&&!Y&&!R&&(m.output=m.output.slice(0,-h.output.length),h.type="star",h.value="*",h.output=H,m.output+=h.output)}if(b.length&&C.type!=="paren"&&(b[b.length-1].inner+=C.value),(C.value||C.output)&&yn(C),h&&h.type==="text"&&C.type==="text"){h.value+=C.value,h.output=(h.output||"")+C.value;return}C.prev=h,i.push(C),h=C},Cn=(C,Y)=>{let R={...u[Y],conditions:1,inner:""};R.prev=h,R.parens=m.parens,R.output=m.output,R.startIndex=m.index,R.tokensIndex=i.length;let P=(n.capture?"(":"")+R.open;Rn("parens"),N({type:C,value:Y,output:m.output?"":g}),N({type:"paren",extglob:!0,value:Ae(),output:P}),b.push(R)},fp=C=>{let Y=e.slice(C.startIndex,m.index+1),R=e.slice(C.startIndex+2,m.index),P=OR(R,n);if((C.type==="plus"||C.type==="star")&&P.risky){let G=P.safeOutput?(C.output?"":g)+(n.capture?`(${P.safeOutput})`:P.safeOutput):void 0,be=i[C.tokensIndex];be.type="text",be.value=Y,be.output=G||se.escapeRegex(Y);for(let xe=C.tokensIndex+1;xe<i.length;xe++)i[xe].value="",i[xe].output="",delete i[xe].suffix;m.output=C.output+be.output,m.backtrack=!0,N({type:"paren",extglob:!0,value:_,output:""}),We("parens");return}let z=C.close+(n.capture?")":""),oe;if(C.type==="negate"){let G=H;if(C.inner&&C.inner.length>1&&C.inner.includes("/")&&(G=D(n)),(G!==H||ie()||/^\)+$/.test(ke()))&&(z=C.close=`)$))${G}`),C.inner.includes("*")&&(oe=ke())&&/^\.[^\\/.]+$/.test(oe)){let be=Ss(oe,{...t,fastpaths:!1}).output;z=C.close=`)${be})${G})`}C.prev.type==="bos"&&(m.negatedExtglob=!0)}N({type:"paren",extglob:!0,value:_,output:z}),We("parens")};if(n.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let C=!1,Y=e.replace(CR,(R,P,z,oe,G,be)=>oe==="\\"?(C=!0,R):oe==="?"?P?P+oe+(G?I.repeat(G.length):""):be===0?w+(G?I.repeat(G.length):""):I.repeat(z.length):oe==="."?d.repeat(z.length):oe==="*"?P?P+oe+(G?H:""):H:P?R:`\\${R}`);return C===!0&&(n.unescape===!0?Y=Y.replace(/\\/g,""):Y=Y.replace(/\\+/g,R=>R.length%2===0?"\\\\":R?"\\":"")),Y===e&&n.contains===!0?(m.output=e,m):(m.output=se.wrapOutput(Y,m,t),m)}for(;!ie();){if(_=Ae(),_==="\0")continue;if(_==="\\"){let R=F();if(R==="/"&&n.bash!==!0||R==="."||R===";")continue;if(!R){_+="\\",N({type:"text",value:_});continue}let P=/^\\+/.exec(ke()),z=0;if(P&&P[0].length>2&&(z=P[0].length,m.index+=z,z%2!==0&&(_+="\\")),n.unescape===!0?_=Ae():_+=Ae(),m.brackets===0){N({type:"text",value:_});continue}}if(m.brackets>0&&(_!=="]"||h.value==="["||h.value==="[^")){if(n.posix!==!1&&_===":"){let R=h.value.slice(1);if(R.includes("[")&&(h.posix=!0,R.includes(":"))){let P=h.value.lastIndexOf("["),z=h.value.slice(0,P),oe=h.value.slice(P+2),G=yR[oe];if(G){h.value=z+G,m.backtrack=!0,Ae(),!s.output&&i.indexOf(h)===1&&(s.output=g);continue}}}(_==="["&&F()!==":"||_==="-"&&F()==="]")&&(_=`\\${_}`),_==="]"&&(h.value==="["||h.value==="[^")&&(_=`\\${_}`),n.posix===!0&&_==="!"&&h.value==="["&&(_="^"),h.value+=_,yn({value:_});continue}if(m.quotes===1&&_!=='"'){_=se.escapeRegex(_),h.value+=_,yn({value:_});continue}if(_==='"'){m.quotes=m.quotes===1?0:1,n.keepQuotes===!0&&N({type:"text",value:_});continue}if(_==="("){Rn("parens"),N({type:"paren",value:_});continue}if(_===")"){if(m.parens===0&&n.strictBrackets===!0)throw new SyntaxError(Tt("opening","("));let R=b[b.length-1];if(R&&m.parens===R.parens+1){fp(b.pop());continue}N({type:"paren",value:_,output:m.parens?")":"\\)"}),We("parens");continue}if(_==="["){if(n.nobracket===!0||!ke().includes("]")){if(n.nobracket!==!0&&n.strictBrackets===!0)throw new SyntaxError(Tt("closing","]"));_=`\\${_}`}else Rn("brackets");N({type:"bracket",value:_});continue}if(_==="]"){if(n.nobracket===!0||h&&h.type==="bracket"&&h.value.length===1){N({type:"text",value:_,output:`\\${_}`});continue}if(m.brackets===0){if(n.strictBrackets===!0)throw new SyntaxError(Tt("opening","["));N({type:"text",value:_,output:`\\${_}`});continue}We("brackets");let R=h.value.slice(1);if(h.posix!==!0&&R[0]==="^"&&!R.includes("/")&&(_=`/${_}`),h.value+=_,yn({value:_}),n.literalBrackets===!1||se.hasRegexChars(R))continue;let P=se.escapeRegex(h.value);if(m.output=m.output.slice(0,-h.value.length),n.literalBrackets===!0){m.output+=P,h.value=P;continue}h.value=`(${a}${P}|${h.value})`,m.output+=h.value;continue}if(_==="{"&&n.nobrace!==!0){Rn("braces");let R={type:"brace",value:_,output:"(",outputIndex:m.output.length,tokensIndex:m.tokens.length};U.push(R),N(R);continue}if(_==="}"){let R=U[U.length-1];if(n.nobrace===!0||!R){N({type:"text",value:_,output:_});continue}let P=")";if(R.dots===!0){let z=i.slice(),oe=[];for(let G=z.length-1;G>=0&&(i.pop(),z[G].type!=="brace");G--)z[G].type!=="dots"&&oe.unshift(z[G].value);P=AR(oe,n),m.backtrack=!0}if(R.comma!==!0&&R.dots!==!0){let z=m.output.slice(0,R.outputIndex),oe=m.tokens.slice(R.tokensIndex);R.value=R.output="\\{",_=P="\\}",m.output=z;for(let G of oe)m.output+=G.output||G.value}N({type:"brace",value:_,output:P}),We("braces"),U.pop();continue}if(_==="|"){b.length>0&&b[b.length-1].conditions++,N({type:"text",value:_});continue}if(_===","){let R=_,P=U[U.length-1];P&&le[le.length-1]==="braces"&&(P.comma=!0,R="|"),N({type:"comma",value:_,output:R});continue}if(_==="/"){if(h.type==="dot"&&m.index===m.start+1){m.start=m.index+1,m.consumed="",m.output="",i.pop(),h=s;continue}N({type:"slash",value:_,output:p});continue}if(_==="."){if(m.braces>0&&h.type==="dot"){h.value==="."&&(h.output=d);let R=U[U.length-1];h.type="dots",h.output+=_,h.value+=_,R.dots=!0;continue}if(m.braces+m.parens===0&&h.type!=="bos"&&h.type!=="slash"){N({type:"text",value:_,output:d});continue}N({type:"dot",value:_,output:d});continue}if(_==="?"){if(!(h&&h.value==="(")&&n.noextglob!==!0&&F()==="("&&F(2)!=="?"){Cn("qmark",_);continue}if(h&&h.type==="paren"){let P=F(),z=_;if(P==="<"&&!se.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(h.value==="("&&!/[!=<:]/.test(P)||P==="<"&&!/<([!=]|\w+>)/.test(ke()))&&(z=`\\${_}`),N({type:"text",value:_,output:z});continue}if(n.dot!==!0&&(h.type==="slash"||h.type==="bos")){N({type:"qmark",value:_,output:v});continue}N({type:"qmark",value:_,output:I});continue}if(_==="!"){if(n.noextglob!==!0&&F()==="("&&(F(2)!=="?"||!/[!=<:]/.test(F(3)))){Cn("negate",_);continue}if(n.nonegate!==!0&&m.index===0){lp();continue}}if(_==="+"){if(n.noextglob!==!0&&F()==="("&&F(2)!=="?"){Cn("plus",_);continue}if(h&&h.value==="("||n.regex===!1){N({type:"plus",value:_,output:f});continue}if(h&&(h.type==="bracket"||h.type==="paren"||h.type==="brace")||m.parens>0){N({type:"plus",value:_});continue}N({type:"plus",value:f});continue}if(_==="@"){if(n.noextglob!==!0&&F()==="("&&F(2)!=="?"){N({type:"at",extglob:!0,value:_,output:""});continue}N({type:"text",value:_});continue}if(_!=="*"){(_==="$"||_==="^")&&(_=`\\${_}`);let R=RR.exec(ke());R&&(_+=R[0],m.index+=R[0].length),N({type:"text",value:_});continue}if(h&&(h.type==="globstar"||h.star===!0)){h.type="star",h.star=!0,h.value+=_,h.output=H,m.backtrack=!0,m.globstar=!0,fe(_);continue}let C=ke();if(n.noextglob!==!0&&/^\([^?]/.test(C)){Cn("star",_);continue}if(h.type==="star"){if(n.noglobstar===!0){fe(_);continue}let R=h.prev,P=R.prev,z=R.type==="slash"||R.type==="bos",oe=P&&(P.type==="star"||P.type==="globstar");if(n.bash===!0&&(!z||C[0]&&C[0]!=="/")){N({type:"star",value:_,output:""});continue}let G=m.braces>0&&(R.type==="comma"||R.type==="brace"),be=b.length&&(R.type==="pipe"||R.type==="paren");if(!z&&R.type!=="paren"&&!G&&!be){N({type:"star",value:_,output:""});continue}for(;C.slice(0,3)==="/**";){let xe=e[m.index+4];if(xe&&xe!=="/")break;C=C.slice(3),fe("/**",3)}if(R.type==="bos"&&ie()){h.type="globstar",h.value+=_,h.output=D(n),m.output=h.output,m.globstar=!0,fe(_);continue}if(R.type==="slash"&&R.prev.type!=="bos"&&!oe&&ie()){m.output=m.output.slice(0,-(R.output+h.output).length),R.output=`(?:${R.output}`,h.type="globstar",h.output=D(n)+(n.strictSlashes?")":"|$)"),h.value+=_,m.globstar=!0,m.output+=R.output+h.output,fe(_);continue}if(R.type==="slash"&&R.prev.type!=="bos"&&C[0]==="/"){let xe=C[1]!==void 0?"|$":"";m.output=m.output.slice(0,-(R.output+h.output).length),R.output=`(?:${R.output}`,h.type="globstar",h.output=`${D(n)}${p}|${p}${xe})`,h.value+=_,m.output+=R.output+h.output,m.globstar=!0,fe(_+Ae()),N({type:"slash",value:"/",output:""});continue}if(R.type==="bos"&&C[0]==="/"){h.type="globstar",h.value+=_,h.output=`(?:^|${p}|${D(n)}${p})`,m.output=h.output,m.globstar=!0,fe(_+Ae()),N({type:"slash",value:"/",output:""});continue}m.output=m.output.slice(0,-h.output.length),h.type="globstar",h.output=D(n),h.value+=_,m.output+=h.output,m.globstar=!0,fe(_);continue}let Y={type:"star",value:_,output:H};if(n.bash===!0){Y.output=".*?",(h.type==="bos"||h.type==="slash")&&(Y.output=x+Y.output),N(Y);continue}if(h&&(h.type==="bracket"||h.type==="paren")&&n.regex===!0){Y.output=_,N(Y);continue}(m.index===m.start||h.type==="slash"||h.type==="dot")&&(h.type==="dot"?(m.output+=k,h.output+=k):n.dot===!0?(m.output+=O,h.output+=O):(m.output+=x,h.output+=x),F()!=="*"&&(m.output+=g,h.output+=g)),N(Y)}for(;m.brackets>0;){if(n.strictBrackets===!0)throw new SyntaxError(Tt("closing","]"));m.output=se.escapeLast(m.output,"["),We("brackets")}for(;m.parens>0;){if(n.strictBrackets===!0)throw new SyntaxError(Tt("closing",")"));m.output=se.escapeLast(m.output,"("),We("parens")}for(;m.braces>0;){if(n.strictBrackets===!0)throw new SyntaxError(Tt("closing","}"));m.output=se.escapeLast(m.output,"{"),We("braces")}if(n.strictSlashes!==!0&&(h.type==="star"||h.type==="bracket")&&N({type:"maybe_slash",value:"",output:`${p}?`}),m.backtrack===!0){m.output="";for(let C of m.tokens)m.output+=C.output!=null?C.output:C.value,C.suffix&&(m.output+=C.suffix)}return m};Ss.fastpaths=(e,t)=>{let n={...t},r=typeof n.maxLength=="number"?Math.min(yr,n.maxLength):yr,o=e.length;if(o>r)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${r}`);e=nf[e]||e;let s=se.isWindows(t),{DOT_LITERAL:i,SLASH_LITERAL:a,ONE_CHAR:c,DOTS_SLASH:l,NO_DOT:u,NO_DOTS:d,NO_DOTS_SLASH:f,STAR:p,START_ANCHOR:g}=cn.globChars(s),S=n.dot?d:u,A=n.dot?f:u,k=n.capture?"":"?:",O={negated:!1,prefix:""},I=n.bash===!0?".*?":p;n.capture&&(I=`(${I})`);let v=x=>x.noglobstar===!0?I:`(${k}(?:(?!${g}${x.dot?l:i}).)*?)`,T=x=>{switch(x){case"*":return`${S}${c}${I}`;case".*":return`${i}${c}${I}`;case"*.*":return`${S}${I}${i}${c}${I}`;case"*/*":return`${S}${I}${a}${c}${A}${I}`;case"**":return S+v(n);case"**/*":return`(?:${S}${v(n)}${a})?${A}${c}${I}`;case"**/*.*":return`(?:${S}${v(n)}${a})?${A}${I}${i}${c}${I}`;case"**/.*":return`(?:${S}${v(n)}${a})?${i}${c}${I}`;default:{let w=/^(.*?)\.(\w+)$/.exec(x);if(!w)return;let H=T(w[1]);return H?H+i+w[2]:void 0}}},K=se.removePrefix(e,O),D=T(K);return D&&n.strictSlashes!==!0&&(D+=`${a}?`),D};sf.exports=Ss});var uf=V((WO,cf)=>{"use strict";var TR=ze("path"),PR=tf(),Es=af(),ys=sn(),wR=on(),NR=e=>e&&typeof e=="object"&&!Array.isArray(e),ee=(e,t,n=!1)=>{if(Array.isArray(e)){let u=e.map(f=>ee(f,t,n));return f=>{for(let p of u){let g=p(f);if(g)return g}return!1}}let r=NR(e)&&e.tokens&&e.input;if(e===""||typeof e!="string"&&!r)throw new TypeError("Expected pattern to be a non-empty string");let o=t||{},s=ys.isWindows(t),i=r?ee.compileRe(e,t):ee.makeRe(e,t,!1,!0),a=i.state;delete i.state;let c=()=>!1;if(o.ignore){let u={...t,ignore:null,onMatch:null,onResult:null};c=ee(o.ignore,u,n)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:g}=ee.test(u,i,t,{glob:e,posix:s}),S={glob:e,state:a,regex:i,posix:s,input:u,output:g,match:p,isMatch:f};return typeof o.onResult=="function"&&o.onResult(S),f===!1?(S.isMatch=!1,d?S:!1):c(u)?(typeof o.onIgnore=="function"&&o.onIgnore(S),S.isMatch=!1,d?S:!1):(typeof o.onMatch=="function"&&o.onMatch(S),d?S:!0)};return n&&(l.state=a),l};ee.test=(e,t,n,{glob:r,posix:o}={})=>{if(typeof e!="string")throw new TypeError("Expected input to be a string");if(e==="")return{isMatch:!1,output:""};let s=n||{},i=s.format||(o?ys.toPosixSlashes:null),a=e===r,c=a&&i?i(e):e;return a===!1&&(c=i?i(e):e,a=c===r),(a===!1||s.capture===!0)&&(s.matchBase===!0||s.basename===!0?a=ee.matchBase(e,t,n,o):a=t.exec(c)),{isMatch:!!a,match:a,output:c}};ee.matchBase=(e,t,n,r=ys.isWindows(n))=>(t instanceof RegExp?t:ee.makeRe(t,n)).test(TR.basename(e));ee.isMatch=(e,t,n)=>ee(t,n)(e);ee.parse=(e,t)=>Array.isArray(e)?e.map(n=>ee.parse(n,t)):Es(e,{...t,fastpaths:!1});ee.scan=(e,t)=>PR(e,t);ee.compileRe=(e,t,n=!1,r=!1)=>{if(n===!0)return e.output;let o=t||{},s=o.contains?"":"^",i=o.contains?"":"$",a=`${s}(?:${e.output})${i}`;e&&e.negated===!0&&(a=`^(?!${a}).*$`);let c=ee.toRegex(a,t);return r===!0&&(c.state=e),c};ee.makeRe=(e,t={},n=!1,r=!1)=>{if(!e||typeof e!="string")throw new TypeError("Expected a non-empty string");let o={negated:!1,fastpaths:!0};return t.fastpaths!==!1&&(e[0]==="."||e[0]==="*")&&(o.output=Es.fastpaths(e,t)),o.output||(o=Es(e,t)),ee.compileRe(o,t,n,r)};ee.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?"i":""))}catch(n){if(t&&t.debug===!0)throw n;return/$^/}};ee.constants=wR;cf.exports=ee});var ff=V((zO,lf)=>{"use strict";lf.exports=uf()});var _f=V((VO,hf)=>{"use strict";var pf=ze("util"),mf=Bl(),Ne=ff(),Rs=sn(),df=e=>e===""||e==="./",gf=e=>{let t=e.indexOf("{");return t>-1&&e.indexOf("}",t)>-1},J=(e,t,n)=>{t=[].concat(t),e=[].concat(e);let r=new Set,o=new Set,s=new Set,i=0,a=u=>{s.add(u.output),n&&n.onResult&&n.onResult(u)};for(let u=0;u<t.length;u++){let d=Ne(String(t[u]),{...n,onResult:a},!0),f=d.state.negated||d.state.negatedExtglob;f&&i++;for(let p of e){let g=d(p,!0);(f?!g.isMatch:g.isMatch)&&(f?r.add(g.output):(r.delete(g.output),o.add(g.output)))}}let l=(i===t.length?[...s]:[...o]).filter(u=>!r.has(u));if(n&&l.length===0){if(n.failglob===!0)throw new Error(`No matches found for "${t.join(", ")}"`);if(n.nonull===!0||n.nullglob===!0)return n.unescape?t.map(u=>u.replace(/\\/g,"")):t}return l};J.match=J;J.matcher=(e,t)=>Ne(e,t);J.isMatch=(e,t,n)=>Ne(t,n)(e);J.any=J.isMatch;J.not=(e,t,n={})=>{t=[].concat(t).map(String);let r=new Set,o=[],s=a=>{n.onResult&&n.onResult(a),o.push(a.output)},i=new Set(J(e,t,{...n,onResult:s}));for(let a of o)i.has(a)||r.add(a);return[...r]};J.contains=(e,t,n)=>{if(typeof e!="string")throw new TypeError(`Expected a string: "${pf.inspect(e)}"`);if(Array.isArray(t))return t.some(r=>J.contains(e,r,n));if(typeof t=="string"){if(df(e)||df(t))return!1;if(e.includes(t)||e.startsWith("./")&&e.slice(2).includes(t))return!0}return J.isMatch(e,t,{...n,contains:!0})};J.matchKeys=(e,t,n)=>{if(!Rs.isObject(e))throw new TypeError("Expected the first argument to be an object");let r=J(Object.keys(e),t,n),o={};for(let s of r)o[s]=e[s];return o};J.some=(e,t,n)=>{let r=[].concat(e);for(let o of[].concat(t)){let s=Ne(String(o),n);if(r.some(i=>s(i)))return!0}return!1};J.every=(e,t,n)=>{let r=[].concat(e);for(let o of[].concat(t)){let s=Ne(String(o),n);if(!r.every(i=>s(i)))return!1}return!0};J.all=(e,t,n)=>{if(typeof e!="string")throw new TypeError(`Expected a string: "${pf.inspect(e)}"`);return[].concat(t).every(r=>Ne(r,n)(e))};J.capture=(e,t,n)=>{let r=Rs.isWindows(n),s=Ne.makeRe(String(e),{...n,capture:!0}).exec(r?Rs.toPosixSlashes(t):t);if(s)return s.slice(1).map(i=>i===void 0?"":i)};J.makeRe=(...e)=>Ne.makeRe(...e);J.scan=(...e)=>Ne.scan(...e);J.parse=(e,t)=>{let n=[];for(let r of[].concat(e||[]))for(let o of mf(String(r),t))n.push(Ne.parse(o,t));return n};J.braces=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a string");return t&&t.nobrace===!0||!gf(e)?[e]:mf(e,t)};J.braceExpand=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a string");return J.braces(e,{...t,expand:!0})};J.hasBraces=gf;hf.exports=J});import{realpathSync as Nk}from"node:fs";import{resolve as vk}from"node:path";import{fileURLToPath as Mk,pathToFileURL as Lk}from"node:url";import{createHash as Ip}from"node:crypto";import{homedir as Op}from"node:os";import{dirname as Qk,join as Tp,parse as eb,resolve as tb}from"node:path";var ii="EV_AI_LAUNCHER_VERSION";var ai="EV_AI_HOOK_SOURCE",ci="EV_AI_HOOK_FALLBACK_REASON",ui="EV_AI_LAUNCHER_SCOPE",Fr="EV_AI_LAUNCHER_READY_FD";var li="--defer-user-spec",An="--cap",fi=Buffer.from([1]);var Fk=1024*1024,$k=4*1024*1024,jk=64*1024,Bk=64*1024,Kk=64*1024;var $r=4096,Gk=4*1024*1024;import{createHash as Sp,randomBytes as Ep}from"node:crypto";import{existsSync as jr,mkdirSync as yp,readdirSync as Rp,readFileSync as Cp,renameSync as di,statSync as hi,unlinkSync as pi,writeFileSync as Ap}from"node:fs";import{basename as kp,dirname as mi,join as _i,relative as bp}from"node:path";function E(e){process.stderr.write(`[ev-ai-agent-hook] ${e}
15
- `)}function Ut(e){return e.replace(/^([a-z]+:\/\/)[^/@]+@/i,"$1")}function Dt(e){return Sp("sha256").update(e).digest("hex").slice(0,32)}function ge(e,t){yp(mi(e),{recursive:!0});let n=_i(mi(e),`.${kp(e)}.${process.pid}.${Ep(4).toString("hex")}.tmp`);try{Ap(n,t,"utf8");try{di(n,e)}catch(r){let o=r instanceof Error&&"code"in r?r.code:void 0;if(o==="EEXIST"||o==="EPERM"||o==="EACCES"){pi(e),di(n,e);return}throw r}}catch(r){try{pi(n)}catch{}throw r}}function kn(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function Br(){process.stdout.write('{"continue":true}')}function M(e){let t=process.env[e];return t===void 0||t===""?void 0:t}async function Ft(){return new Promise(e=>{let t="";if(process.stdin.isTTY){e("");return}process.stdin.setEncoding("utf8"),process.stdin.on("data",n=>{t+=n}),process.stdin.on("end",()=>{e(t)}),process.stdin.on("error",()=>{e(t)}),process.stdin.resume()})}async function bn(e){return new Promise(t=>{let n="",r=!1,o=i=>{r||(r=!0,clearTimeout(s),t(i||"{}"))},s=setTimeout(()=>{o(n)},e);if(process.stdin.isTTY){o("{}");return}process.stdin.setEncoding("utf8"),process.stdin.on("data",i=>{n+=i}),process.stdin.on("end",()=>{o(n)}),process.stdin.on("error",()=>{o(n)}),process.stdin.resume()})}async function ye(e,t,n=3e3,r={}){let{execFile:o}=await import("node:child_process"),{promisify:s}=await import("node:util"),i=s(o);try{let{stdout:a}=await i(e,t,{timeout:n,windowsHide:!0,maxBuffer:1048576,cwd:r.cwd});return{ok:!0,stdout:a.trim()}}catch(a){let c=a,l=typeof c.code=="number"?c.code:typeof c.status=="number"?c.status:void 0;return{ok:!1,code:l,spawnFailed:l===void 0}}}async function te(e,t,n=3e3,r={}){let o=await ye(e,t,n,r);return o.ok?o.stdout:""}async function Kr(e=process.cwd()){let t=await ye("git",["rev-parse","--show-toplevel"],2e3,{cwd:e});if(t.ok&&t.stdout)return{root:t.stdout,inGitRepo:!0};if(M("EV_AI_HOOK_DEBUG")){let r=t.ok?"empty stdout":t.spawnFailed?"spawn failed":`exit ${String(t.code??"unknown")}`;E(`DEBUG: git rev-parse --show-toplevel failed (${r}) cwd=${e}`)}let n=M("CURSOR_PROJECT_DIR")??M("CLAUDE_PROJECT_DIR");if(n&&jr(n)){let r=await ye("git",["rev-parse","--show-toplevel"],2e3,{cwd:n});return r.ok&&r.stdout?{root:r.stdout,inGitRepo:!0}:{root:n,inGitRepo:!1}}return{root:e,inGitRepo:!1}}async function Le(e=process.cwd()){return(await Kr(e)).root}function he(e,t){try{return JSON.parse(e)}catch{return t}}var gi=new Map;function xn(e){return e.charCodeAt(0)===65279?e.slice(1):e}function xp(e){let t;try{t=Cp(e,"utf8")}catch{return{ok:!1,reason:"read"}}try{return{ok:!0,value:JSON.parse(xn(t))}}catch{return{ok:!1,reason:"parse"}}}function Si(e){let t=gi.get(e);if(t!==void 0)return t;let n=xp(e);return gi.set(e,n),n}function Ei(e){return Si(e)}function ne(e,t){let n=Si(e);return n.ok?n.value:t}function it(e){return typeof e=="string"?e:""}function He(e,t){let n=e[t];if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return n;if(!t.includes("."))return;let r=t.split("."),o=e;for(let s of r){if(o===null||typeof o!="object"||Array.isArray(o))return;o=o[s]}if(typeof o=="string"||typeof o=="number"||typeof o=="boolean")return o}function L(e,t){let n=He(e,t);return typeof n=="string"?n:""}var Je=500;function yi(e,t=2){if(!jr(e))return{entries:[],truncated:!1};let n=[],r=!1,o=(s,i)=>{if(i>t||r)return;let a;try{a=Rp(s,{withFileTypes:!0})}catch{return}for(let c of a){if(r)return;let l=_i(s,c.name);if(c.isDirectory()){o(l,i+1);continue}if(c.isFile()){try{n.push({name:bp(e,l),size:hi(l).size})}catch{continue}if(n.length>=Je){r=!0;return}}}};return o(e,1),{entries:n,truncated:r}}function Gr(e){return jr(e)?{present:!0,size:hi(e).size}:{present:!1,size:0}}var Ai="https://hooks.ev-ai.ai",In=".claude/ev-ai-runtime-report.json",ki="config.json",Pp="max_concurrent_hooks",ob=1024*1024,wp=new Set(["localhost","127.0.0.1","[::1]","::1"]),Np=["claude","cursor","codex"],On=[In,".cursor/ev-ai-runtime-report.json",".codex/ev-ai-runtime-report.json"],Wr=/^[A-Za-z0-9._~-]+$/;function Tn(e){return e!==void 0&&Np.includes(e)}function bi(e){if(!e||typeof e!="object")return;let t=e[Pp];return typeof t=="number"&&Number.isSafeInteger(t)&&t>0?t:void 0}function Ri(e){if(e===void 0||!/^\d+$/.test(e))return;let t=Number(e);return Number.isSafeInteger(t)?t:void 0}function $t(e,t){let n=e[t+1];return n&&!n.startsWith("--")?{value:n,next:t+1}:{next:t}}function zr(e){let t,n,r,o,s,i;for(let a=0;a<e.length;a++){let c=e[a];if(c!==void 0){if(c==="--runner"){let l=$t(e,a);t=l.value,a=l.next;continue}if(c.startsWith("--runner=")){t=c.slice(9);continue}if(c==="--url"){let l=$t(e,a);l.value&&(r=l.value),a=l.next;continue}if(c.startsWith("--url=")){r=c.slice(6);continue}if(c==="--token"){let l=$t(e,a);l.value&&(o=l.value),a=l.next;continue}if(c.startsWith("--token=")){o=c.slice(8);continue}if(c==="--base-url"){let l=$t(e,a);l.value&&(s=l.value),a=l.next;continue}if(c.startsWith("--base-url=")){s=c.slice(11);continue}if(c===An){let l=$t(e,a);i=Ri(l.value)??i,a=l.next;continue}if(c.startsWith(`${An}=`)){i=Ri(c.slice(An.length+1))??i;continue}c!==li&&!c.startsWith("-")&&n===void 0&&(n=c)}}return{runner:Tn(t)?t:void 0,event:n,collectorUrl:r,orgToken:o,baseUrl:s,...i!==void 0?{cap:i}:{}}}function Pn(e,t=Ai){let n=t.replace(/\/+$/,""),r=e.trim();return`${n}/${r}/hook`}function jt(e=Op()){return Tp(e,".ev-ai",ki)}function xi(e,t){return{...e,...t}}function Ci(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<=32||n===127||n===39)return!0}return!1}function wn(e){try{let t=new URL(e);return t.protocol==="https:"?!0:t.protocol==="http:"?wp.has(t.hostname):!1}catch{return!1}}function Vr(e){try{let n=new URL(e).pathname.split("/").filter(r=>r.length>0);if(n.length>=2&&n[n.length-1]==="hook"){let r=n[n.length-2];return r&&r.length>0?r:void 0}return}catch{return}}function Et(e){let t;try{t=new URL(e)}catch{return`invalid URL (got: ${e})`}if(!wn(e))return`must be https (or http on localhost / 127.0.0.1 / ::1) (got: ${e})`;let n=Vr(e);if(!n)return`must end with /{orgToken}/hook (got: ${e})`;if(!Wr.test(n))return`org token must match ${Wr.source} (got: ${n})`;if(Ci(e))return`must not contain whitespace, control characters, or single quotes (got: ${e})`;if(Ci(t.pathname))return`pathname must not contain whitespace, control characters, or single quotes (got: ${e})`}function Bt(e){return new URL(e).toString()}function Jr(e){if(e.collector_url)return e.collector_url;let t=e.repo_ingest_token,n=typeof t=="string"?t.trim():void 0;return n?Pn(n):""}function Nn(e){try{let t=new URL(e),n=t.pathname.split("/").filter(r=>r.length>0);return n.length>=2&&n[n.length-1]==="hook"&&(n[n.length-2]="***",t.pathname=`/${n.join("/")}`),t.toString()}catch{return"<invalid-url>"}}function Ii(e){let t=e.collectorUrl?.trim(),n;if(t)n=t;else{let o=e.orgToken?.trim();o&&(n=Pn(o,e.baseUrl?.trim()??void 0))}if(!n)return{};let r=Et(n);return r?{problem:r}:{url:Bt(n)}}function Kt(e){if(Et(e))return;let t;try{t=new URL(e)}catch{return}let n=Vr(e);if(!n)return;let o=t.pathname.split("/").filter(a=>a.length>0).slice(0,-2),s=o.length>0?`/${o.join("/")}`:"",i=`${t.origin}${s}/${n}`;return Ip("sha256").update(i).digest("hex").slice(0,32)}var Ye=2,Oi="node_modules/@ev-ai/agent-hook/dist/hook.mjs",Ie="ev-ai-agent-hook";function vp(e){let t=e.split(/[/\\]/).pop();return t&&t.length>0?t:e}function vn(e){let t=vp(e);return t===Ie||t===`${Ie}.exe`}var Ti="https://cdn.ev-ai.ai/agent-hook";var Yr=`current/${Ie}`,Xr=`.ev-ai/agent-hook/${Ie}`,Pi=5e3,wi=5e3,qr=3e3;var Mn=3e3,Ni=1500,vi=4*1024,Zr=256*1024,Mp=4*1024,Mi=32*1024,Ue="1.3.3",Ln=`@ev-ai/agent-hook@${Ue}`,Li="ev-ai runtime report";import{chmodSync as Ea,cpSync as ya,existsSync as Xe,mkdirSync as po,readFileSync as Gm,rmSync as Kn,symlinkSync as Wm,writeFileSync as zm}from"node:fs";import{homedir as De}from"node:os";import{dirname as mo,isAbsolute as Vm,join as W,relative as Ra,resolve as _a,sep as Jm}from"node:path";import{fileURLToPath as Ym}from"node:url";import{existsSync as Lp,readdirSync as Hi}from"node:fs";import{homedir as Hn}from"node:os";import{join as ae}from"node:path";function Ui(e=process.platform){switch(e){case"darwin":return"/Library/Application Support/ClaudeCode";case"win32":return ae(process.env.ProgramFiles??"C:\\Program Files","ClaudeCode");default:return"/etc/claude-code"}}function Qr(e=process.platform){let t=Ui(e),n=[ae(t,"managed-settings.json")],r=ae(t,"managed-settings.d");try{if(!Lp(r))return n;let o=Hi(r).filter(s=>s.endsWith(".json")&&!s.startsWith(".")).sort().map(s=>ae(r,s));n.push(...o)}catch{}return n}function eo(e=process.platform,t=Hn()){return{serverManaged:ae(t,".claude","remote-settings.json"),fileBased:Qr(e)}}function Hp(e=process.platform){switch(e){case"darwin":return"/Library/Application Support/Cursor";case"win32":return ae(process.env.ProgramData??"C:\\ProgramData","Cursor");default:return"/etc/cursor"}}function Up(e=process.platform,t=Hn()){let n=[ae(Hp(e),"hooks.json")],r=ae(t,".cursor","managed");try{for(let o of Hi(r,{withFileTypes:!0}))!o.isDirectory()||o.name.startsWith(".")||n.push(ae(r,o.name,"hooks.json"))}catch{}return n}function Dp(e=process.platform,t=Hn()){let n=e==="win32"?ae(process.env.ProgramData??"C:\\ProgramData","OpenAI","Codex"):"/etc/codex",r=[ae(n,"requirements.toml")];return e!=="win32"&&r.push(ae(n,"managed_config.toml")),r.push(ae(t,".codex","managed_config.toml"),ae(n,"config.toml")),r}function Un(e,t=process.platform,n=Hn()){switch(e){case"claude":{let{serverManaged:r,fileBased:o}=eo(t,n);return[r,...o]}case"cursor":return Up(t,n);default:return Dp(t,n)}}import{createHash as Ji,randomBytes as em}from"node:crypto";import{existsSync as Yi,mkdirSync as no,readFileSync as Xi,unlinkSync as qi,writeFileSync as Zi}from"node:fs";import{homedir as ro}from"node:os";import{dirname as Fn,join as oo,resolve as tm}from"node:path";var Fp=new Set(["action@github.com","noreply@github.com","noreply@anthropic.com","cursoragent@cursor.com"]),$p=new Set(["github-actions","github actions","dependabot","renovate","cursoragent","cursor agent"]);function de(e,t){let n=(e??"").trim().toLowerCase(),r=(t??"").trim().toLowerCase();if(!n&&!r)return!1;if(n.includes("[bot]")||$p.has(n)||r.includes("[bot]")||Fp.has(r))return!0;if(r.endsWith("@users.noreply.github.com")){let o=r.slice(0,r.indexOf("@")),s=o.includes("+")?o.slice(o.indexOf("+")+1):o;if(s.endsWith("bot")||s.includes("[bot]"))return!0}return!1}import{existsSync as jp,readFileSync as Bp}from"node:fs";import{hostname as Di,userInfo as Kp}from"node:os";function yt(e){if(e===void 0||e==="")return!1;let t=e.trim().toLowerCase();return t!=="0"&&t!=="false"&&t!=="no"}function Fi(e=process.env){return yt(X("CURSOR_SANDBOX",e))}var Gp=["CIRCLECI","BUILDKITE","TF_BUILD","JENKINS_URL","JENKINS_HOME","CODEBUILD_BUILD_ID","DRONE","DRONE_BUILD_NUMBER","TEAMCITY_VERSION","TRAVIS","APPVEYOR","BITBUCKET_BUILD_NUMBER"];function Wp(e){return Gp.some(t=>!!X(t,e))}function zp(e){if(X("KUBERNETES_SERVICE_HOST",e)||yt(X("REMOTE_CONTAINERS",e))||yt(X("DEVCONTAINER",e)))return!0;try{if(jp("/.dockerenv")||Bp("/proc/1/environ","utf8").includes("container="))return!0}catch{}return!1}function $i(e){return["VSCODE_PID","VSCODE_IPC_HOOK","CURSOR_EXTENSION_HOST_ROLE","CURSOR_WORKSPACE_LABEL"].some(t=>!!X(t,e))}function Vp(e,t=process.platform){return $i(e)?t==="darwin"||t==="win32"?!0:["__CFBundleIdentifier","DISPLAY","WAYLAND_DISPLAY","SESSIONNAME"].some(n=>!!X(n,e)):!1}function Jp(e){return e===void 0?!1:e.trim().toLowerCase().startsWith("bc-")}function Yp(e){return e==="linux"}function X(e,t){if(t){let n=t[e];return n===void 0||n===""?void 0:n}return M(e)}function Xp(e,t,n){return e.trim().toLowerCase()==="cursor"&&t.trim().toLowerCase()==="ubuntu"&&!!qp(X("CURSOR_VERSION",n))}function qp(e){if(e===void 0)return null;let t=e.trim();return t.length>0?t:null}function to(e){if(Jp(e.sessionId))return!0;let t=e.hostname??Di(),n=e.osUser??Bi(e.env);return Xp(t,n,e.env)}function Zp(e){return yt(X("CURSOR_AGENT",e.env))?!0:to(e)}function Qp(e){return!!(process.stdin.isTTY||process.stdout.isTTY||(X("TERM",e)??X("TERM_PROGRAM",e))||(X("SSH_TTY",e)??X("SSH_CONNECTION",e))||(X("__CFBundleIdentifier",e)??X("XPC_SERVICE_NAME",e))||$i(e)||["DISPLAY","WAYLAND_DISPLAY","XDG_SESSION_TYPE","DBUS_SESSION_BUS_ADDRESS"].some(t=>!!X(t,e))||X("SESSIONNAME",e))}function Gt(e={}){let t=e.env;if(X("GITHUB_ACTIONS",t))return"github_actions";if(yt(X("CLAUDE_CODE_REMOTE",t)))return"claude_remote";let n=e.platform??process.platform;if(!Vp(t,n)&&Zp(e)&&(yt(X("CURSOR_AGENT",t))||Yp(n)))return"cursor_cloud";if(X("CODESPACES",t)||X("CODESPACE_NAME",t))return"codespaces";if(X("GITLAB_CI",t))return"gitlab_ci";if(Wp(t))return"managed";let r=X("CI",t);return r&&r!=="false"&&r!=="0"?"managed":zp(t)?"container":Qp(t)?"interactive":"unknown"}async function ji(){return await te("systemd-detect-virt",[],1e3)}function Bi(e=process.env,t=Kp){for(let n of["USER","LOGNAME","USERNAME"]){let r=e[n];if(typeof r=="string"){let o=r.trim();if(o.length>0)return o}}try{return t().username??""}catch{return""}}async function Ki(){let e=process.platform==="darwin"?"Darwin":process.platform==="win32"?"Windows_NT":"Linux",t="";if(process.platform==="darwin")t=await te("sw_vers",["-productVersion"],1e3);else if(process.platform==="linux"){try{let{readFileSync:s}=await import("node:fs"),i=s("/etc/os-release","utf8"),a=i.match(/^PRETTY_NAME="?([^"\n]+)"?/m)?.[1],c=i.match(/^VERSION_ID="?([^"\n]+)"?/m)?.[1];t=a??c??""}catch{t=await te("lsb_release",["-sd"],1e3).then(s=>s.replace(/^"|"$/g,""))}t||(t=await te("uname",["-r"],1e3))}else t=await te("ver",[],1e3);let n=Bi(),r=(process.env.SHELL??"").split(/[/\\]/).pop()??"",o="";try{o=await te("tty",[],500),o.includes("not a tty")&&(o="")}catch{o=""}return{os:e,os_version:t||null,user:n||null,shell:r||null,tty:o||null}}function Dn(){return Di()}var nm="installation.json",rm="cloud-bootstrap.lock",om=6e4;function Qi(e,t,n){let r=`${e}:${t??""}`;return n?`${n}:${r}`:r}function pe(e=ro()){return oo(e,".ev-ai","agent-hook")}function sm(e=ro()){return oo(pe(e),nm)}function ea(e){return oo(Fn(e),rm)}function ta(){return em(8).toString("hex")}function Rt(e){return Ji("sha256").update(e).digest("hex").slice(0,16)}function $(e){if(e===void 0)return null;let t=e.trim();return t.length>0?t:null}function na(e){return/^[A-Za-z0-9._-]{8,64}$/.test(e)}function im(e=process.env){let t=$(e.EV_AI_HOOK_INSTALLATION_ID);if(t){if(!na(t)){E(`WARN: ignoring EV_AI_HOOK_INSTALLATION_ID (expected 8\u201364 chars [A-Za-z0-9._-], got length ${t.length})`);return}return t}}function ra(e,t){return e&&na(e)?e:(e&&E(`WARN: ignoring installation id override (expected 8\u201364 chars [A-Za-z0-9._-], got length ${e.length})`),im(t))}function am(e){return/^[0-9a-f]{16}$/.test(e)}function cm(e=process.env){if($(e.GITHUB_ACTIONS)){let t=$(e.GITHUB_REPOSITORY_ID)??$(e.GITHUB_REPOSITORY),n=$(e.GITHUB_ACTOR)??$(e.GITHUB_TRIGGERING_ACTOR)??$(e.GITHUB_USER);if(t&&n)return Rt(`github_actions|${t}|${n}`)}if($(e.CODESPACES)||$(e.CODESPACE_NAME)){let t=$(e.CODESPACE_NAME);if(t)return Rt(`codespaces|${t}`);let n=$(e.GITHUB_REPOSITORY_ID)??$(e.GITHUB_REPOSITORY),r=$(e.GITHUB_USER)??$(e.GITHUB_ACTOR);if(n&&r)return Rt(`codespaces|${n}|${r}`)}if($(e.GITLAB_CI)){let t=$(e.CI_PROJECT_ID)??$(e.CI_PROJECT_PATH),n=$(e.GITLAB_USER_LOGIN)??$(e.GITLAB_USER_EMAIL)??$(e.GITLAB_USER_NAME);if(t&&n)return Rt(`gitlab|${t}|${n}`)}return null}var um="cursoragent@cursor.com";function lm(e){let t=$(e.CURSOR_USER_EMAIL);return!t||t.toLowerCase()===um?null:t}function fm(e,t){return $(e.CURSOR_PROJECT_DIR)??$(e.CLAUDE_PROJECT_DIR)??t}function dm(e){return Ut(e).replace(/\.git$/i,"").toLowerCase()}async function pm(e){let t=await te("git",["config","--get","remote.origin.url"],2e3,{cwd:e});return t?dm(t):e}async function mm(e){let t=$(await te("git",["config","--local","--get","user.email"],2e3,{cwd:e})||void 0);if(t&&!de(null,t))return t;let n=$(await te("git",["log","-1","--format=%ae"],2e3,{cwd:e})||void 0);return n&&!de(null,n)?n:null}function gm(e,t){let n=fm(e,t);return n?Rt(`cursor_cloud|${n}|${lm(e)??""}`):null}async function hm(e,t){let n=$(e.CLAUDE_PROJECT_DIR)??t;if(!n)return null;let r=await pm(n),o=await mm(n);return Rt(`claude_remote|${r}|${o??""}`)}function Gi(e,t){let n=ra(e,t);if(n)return n;let r=cm(t);return r||ta()}async function _m(e){let n=await te("git",["config","--get","remote.origin.url"],2e3,{cwd:e})||tm(e);return Ji("sha256").update(n).digest("hex").slice(0,16)}function Sm(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t={};for(let[n,r]of Object.entries(e))typeof r=="string"&&r.length>0&&(t[n]=r);return Object.keys(t).length>0?t:void 0}function Em(e){try{let t=JSON.parse(e);if(typeof t.installation_id!="string"||t.installation_id.length===0)return;let n=Sm(t.platform_agent_ids);return{installation_id:t.installation_id,...t.pinned===!0?{pinned:!0}:{},...n?{platform_agent_ids:n}:{},...typeof t.operator_identity_hash=="string"?{operator_identity_hash:t.operator_identity_hash}:{},...typeof t.operator_identity_sent_at=="string"?{operator_identity_sent_at:t.operator_identity_sent_at}:{}}}catch{return}}function at(e){if(Yi(e))try{return Em(Xi(e,"utf8"))}catch{}}function so(e){return at(e)}function oa(e,t,n){let r=at(e);if(!r||r.operator_identity_hash===t&&r.operator_identity_sent_at===n)return;let o={...r,operator_identity_hash:t,operator_identity_sent_at:n};try{ge(e,`${JSON.stringify(o,null,2)}
15
+ `)}function Ut(e){return e.replace(/^([a-z]+:\/\/)[^/@]+@/i,"$1")}function Dt(e){return Sp("sha256").update(e).digest("hex").slice(0,32)}function ge(e,t){yp(mi(e),{recursive:!0});let n=_i(mi(e),`.${kp(e)}.${process.pid}.${Ep(4).toString("hex")}.tmp`);try{Ap(n,t,"utf8");try{di(n,e)}catch(r){let o=r instanceof Error&&"code"in r?r.code:void 0;if(o==="EEXIST"||o==="EPERM"||o==="EACCES"){pi(e),di(n,e);return}throw r}}catch(r){try{pi(n)}catch{}throw r}}function kn(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function Br(){process.stdout.write('{"continue":true}')}function M(e){let t=process.env[e];return t===void 0||t===""?void 0:t}async function Ft(){return new Promise(e=>{let t="";if(process.stdin.isTTY){e("");return}process.stdin.setEncoding("utf8"),process.stdin.on("data",n=>{t+=n}),process.stdin.on("end",()=>{e(t)}),process.stdin.on("error",()=>{e(t)}),process.stdin.resume()})}async function bn(e){return new Promise(t=>{let n="",r=!1,o=i=>{r||(r=!0,clearTimeout(s),t(i||"{}"))},s=setTimeout(()=>{o(n)},e);if(process.stdin.isTTY){o("{}");return}process.stdin.setEncoding("utf8"),process.stdin.on("data",i=>{n+=i}),process.stdin.on("end",()=>{o(n)}),process.stdin.on("error",()=>{o(n)}),process.stdin.resume()})}async function ye(e,t,n=3e3,r={}){let{execFile:o}=await import("node:child_process"),{promisify:s}=await import("node:util"),i=s(o);try{let{stdout:a}=await i(e,t,{timeout:n,windowsHide:!0,maxBuffer:1048576,cwd:r.cwd});return{ok:!0,stdout:a.trim()}}catch(a){let c=a,l=typeof c.code=="number"?c.code:typeof c.status=="number"?c.status:void 0;return{ok:!1,code:l,spawnFailed:l===void 0}}}async function te(e,t,n=3e3,r={}){let o=await ye(e,t,n,r);return o.ok?o.stdout:""}async function Kr(e=process.cwd()){let t=await ye("git",["rev-parse","--show-toplevel"],2e3,{cwd:e});if(t.ok&&t.stdout)return{root:t.stdout,inGitRepo:!0};if(M("EV_AI_HOOK_DEBUG")){let r=t.ok?"empty stdout":t.spawnFailed?"spawn failed":`exit ${String(t.code??"unknown")}`;E(`DEBUG: git rev-parse --show-toplevel failed (${r}) cwd=${e}`)}let n=M("CURSOR_PROJECT_DIR")??M("CLAUDE_PROJECT_DIR");if(n&&jr(n)){let r=await ye("git",["rev-parse","--show-toplevel"],2e3,{cwd:n});return r.ok&&r.stdout?{root:r.stdout,inGitRepo:!0}:{root:n,inGitRepo:!1}}return{root:e,inGitRepo:!1}}async function Le(e=process.cwd()){return(await Kr(e)).root}function he(e,t){try{return JSON.parse(e)}catch{return t}}var gi=new Map;function xn(e){return e.charCodeAt(0)===65279?e.slice(1):e}function xp(e){let t;try{t=Cp(e,"utf8")}catch{return{ok:!1,reason:"read"}}try{return{ok:!0,value:JSON.parse(xn(t))}}catch{return{ok:!1,reason:"parse"}}}function Si(e){let t=gi.get(e);if(t!==void 0)return t;let n=xp(e);return gi.set(e,n),n}function Ei(e){return Si(e)}function ne(e,t){let n=Si(e);return n.ok?n.value:t}function it(e){return typeof e=="string"?e:""}function He(e,t){let n=e[t];if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return n;if(!t.includes("."))return;let r=t.split("."),o=e;for(let s of r){if(o===null||typeof o!="object"||Array.isArray(o))return;o=o[s]}if(typeof o=="string"||typeof o=="number"||typeof o=="boolean")return o}function L(e,t){let n=He(e,t);return typeof n=="string"?n:""}var Je=500;function yi(e,t=2){if(!jr(e))return{entries:[],truncated:!1};let n=[],r=!1,o=(s,i)=>{if(i>t||r)return;let a;try{a=Rp(s,{withFileTypes:!0})}catch{return}for(let c of a){if(r)return;let l=_i(s,c.name);if(c.isDirectory()){o(l,i+1);continue}if(c.isFile()){try{n.push({name:bp(e,l),size:hi(l).size})}catch{continue}if(n.length>=Je){r=!0;return}}}};return o(e,1),{entries:n,truncated:r}}function Gr(e){return jr(e)?{present:!0,size:hi(e).size}:{present:!1,size:0}}var Ai="https://hooks.ev-ai.ai",In=".claude/ev-ai-runtime-report.json",ki="config.json",Pp="max_concurrent_hooks",ob=1024*1024,wp=new Set(["localhost","127.0.0.1","[::1]","::1"]),Np=["claude","cursor","codex"],On=[In,".cursor/ev-ai-runtime-report.json",".codex/ev-ai-runtime-report.json"],Wr=/^[A-Za-z0-9._~-]+$/;function Tn(e){return e!==void 0&&Np.includes(e)}function bi(e){if(!e||typeof e!="object")return;let t=e[Pp];return typeof t=="number"&&Number.isSafeInteger(t)&&t>0?t:void 0}function Ri(e){if(e===void 0||!/^\d+$/.test(e))return;let t=Number(e);return Number.isSafeInteger(t)?t:void 0}function $t(e,t){let n=e[t+1];return n&&!n.startsWith("--")?{value:n,next:t+1}:{next:t}}function zr(e){let t,n,r,o,s,i;for(let a=0;a<e.length;a++){let c=e[a];if(c!==void 0){if(c==="--runner"){let l=$t(e,a);t=l.value,a=l.next;continue}if(c.startsWith("--runner=")){t=c.slice(9);continue}if(c==="--url"){let l=$t(e,a);l.value&&(r=l.value),a=l.next;continue}if(c.startsWith("--url=")){r=c.slice(6);continue}if(c==="--token"){let l=$t(e,a);l.value&&(o=l.value),a=l.next;continue}if(c.startsWith("--token=")){o=c.slice(8);continue}if(c==="--base-url"){let l=$t(e,a);l.value&&(s=l.value),a=l.next;continue}if(c.startsWith("--base-url=")){s=c.slice(11);continue}if(c===An){let l=$t(e,a);i=Ri(l.value)??i,a=l.next;continue}if(c.startsWith(`${An}=`)){i=Ri(c.slice(An.length+1))??i;continue}c!==li&&!c.startsWith("-")&&n===void 0&&(n=c)}}return{runner:Tn(t)?t:void 0,event:n,collectorUrl:r,orgToken:o,baseUrl:s,...i!==void 0?{cap:i}:{}}}function Pn(e,t=Ai){let n=t.replace(/\/+$/,""),r=e.trim();return`${n}/${r}/hook`}function jt(e=Op()){return Tp(e,".ev-ai",ki)}function xi(e,t){return{...e,...t}}function Ci(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<=32||n===127||n===39)return!0}return!1}function wn(e){try{let t=new URL(e);return t.protocol==="https:"?!0:t.protocol==="http:"?wp.has(t.hostname):!1}catch{return!1}}function Vr(e){try{let n=new URL(e).pathname.split("/").filter(r=>r.length>0);if(n.length>=2&&n[n.length-1]==="hook"){let r=n[n.length-2];return r&&r.length>0?r:void 0}return}catch{return}}function Et(e){let t;try{t=new URL(e)}catch{return`invalid URL (got: ${e})`}if(!wn(e))return`must be https (or http on localhost / 127.0.0.1 / ::1) (got: ${e})`;let n=Vr(e);if(!n)return`must end with /{orgToken}/hook (got: ${e})`;if(!Wr.test(n))return`org token must match ${Wr.source} (got: ${n})`;if(Ci(e))return`must not contain whitespace, control characters, or single quotes (got: ${e})`;if(Ci(t.pathname))return`pathname must not contain whitespace, control characters, or single quotes (got: ${e})`}function Bt(e){return new URL(e).toString()}function Jr(e){if(e.collector_url)return e.collector_url;let t=e.repo_ingest_token,n=typeof t=="string"?t.trim():void 0;return n?Pn(n):""}function Nn(e){try{let t=new URL(e),n=t.pathname.split("/").filter(r=>r.length>0);return n.length>=2&&n[n.length-1]==="hook"&&(n[n.length-2]="***",t.pathname=`/${n.join("/")}`),t.toString()}catch{return"<invalid-url>"}}function Ii(e){let t=e.collectorUrl?.trim(),n;if(t)n=t;else{let o=e.orgToken?.trim();o&&(n=Pn(o,e.baseUrl?.trim()??void 0))}if(!n)return{};let r=Et(n);return r?{problem:r}:{url:Bt(n)}}function Kt(e){if(Et(e))return;let t;try{t=new URL(e)}catch{return}let n=Vr(e);if(!n)return;let o=t.pathname.split("/").filter(a=>a.length>0).slice(0,-2),s=o.length>0?`/${o.join("/")}`:"",i=`${t.origin}${s}/${n}`;return Ip("sha256").update(i).digest("hex").slice(0,32)}var Ye=2,Oi="node_modules/@ev-ai/agent-hook/dist/hook.mjs",Ie="ev-ai-agent-hook";function vp(e){let t=e.split(/[/\\]/).pop();return t&&t.length>0?t:e}function vn(e){let t=vp(e);return t===Ie||t===`${Ie}.exe`}var Ti="https://cdn.ev-ai.ai/agent-hook";var Yr=`current/${Ie}`,Xr=`.ev-ai/agent-hook/${Ie}`,Pi=5e3,wi=5e3,qr=3e3;var Mn=3e3,Ni=1500,vi=4*1024,Zr=256*1024,Mp=4*1024,Mi=32*1024,Ue="1.3.4",Ln=`@ev-ai/agent-hook@${Ue}`,Li="ev-ai runtime report";import{chmodSync as Ea,cpSync as ya,existsSync as Xe,mkdirSync as po,readFileSync as Gm,rmSync as Kn,symlinkSync as Wm,writeFileSync as zm}from"node:fs";import{homedir as De}from"node:os";import{dirname as mo,isAbsolute as Vm,join as W,relative as Ra,resolve as _a,sep as Jm}from"node:path";import{fileURLToPath as Ym}from"node:url";import{existsSync as Lp,readdirSync as Hi}from"node:fs";import{homedir as Hn}from"node:os";import{join as ae}from"node:path";function Ui(e=process.platform){switch(e){case"darwin":return"/Library/Application Support/ClaudeCode";case"win32":return ae(process.env.ProgramFiles??"C:\\Program Files","ClaudeCode");default:return"/etc/claude-code"}}function Qr(e=process.platform){let t=Ui(e),n=[ae(t,"managed-settings.json")],r=ae(t,"managed-settings.d");try{if(!Lp(r))return n;let o=Hi(r).filter(s=>s.endsWith(".json")&&!s.startsWith(".")).sort().map(s=>ae(r,s));n.push(...o)}catch{}return n}function eo(e=process.platform,t=Hn()){return{serverManaged:ae(t,".claude","remote-settings.json"),fileBased:Qr(e)}}function Hp(e=process.platform){switch(e){case"darwin":return"/Library/Application Support/Cursor";case"win32":return ae(process.env.ProgramData??"C:\\ProgramData","Cursor");default:return"/etc/cursor"}}function Up(e=process.platform,t=Hn()){let n=[ae(Hp(e),"hooks.json")],r=ae(t,".cursor","managed");try{for(let o of Hi(r,{withFileTypes:!0}))!o.isDirectory()||o.name.startsWith(".")||n.push(ae(r,o.name,"hooks.json"))}catch{}return n}function Dp(e=process.platform,t=Hn()){let n=e==="win32"?ae(process.env.ProgramData??"C:\\ProgramData","OpenAI","Codex"):"/etc/codex",r=[ae(n,"requirements.toml")];return e!=="win32"&&r.push(ae(n,"managed_config.toml")),r.push(ae(t,".codex","managed_config.toml"),ae(n,"config.toml")),r}function Un(e,t=process.platform,n=Hn()){switch(e){case"claude":{let{serverManaged:r,fileBased:o}=eo(t,n);return[r,...o]}case"cursor":return Up(t,n);default:return Dp(t,n)}}import{createHash as Ji,randomBytes as em}from"node:crypto";import{existsSync as Yi,mkdirSync as no,readFileSync as Xi,unlinkSync as qi,writeFileSync as Zi}from"node:fs";import{homedir as ro}from"node:os";import{dirname as Fn,join as oo,resolve as tm}from"node:path";var Fp=new Set(["action@github.com","noreply@github.com","noreply@anthropic.com","cursoragent@cursor.com"]),$p=new Set(["github-actions","github actions","dependabot","renovate","cursoragent","cursor agent"]);function de(e,t){let n=(e??"").trim().toLowerCase(),r=(t??"").trim().toLowerCase();if(!n&&!r)return!1;if(n.includes("[bot]")||$p.has(n)||r.includes("[bot]")||Fp.has(r))return!0;if(r.endsWith("@users.noreply.github.com")){let o=r.slice(0,r.indexOf("@")),s=o.includes("+")?o.slice(o.indexOf("+")+1):o;if(s.endsWith("bot")||s.includes("[bot]"))return!0}return!1}import{existsSync as jp,readFileSync as Bp}from"node:fs";import{hostname as Di,userInfo as Kp}from"node:os";function yt(e){if(e===void 0||e==="")return!1;let t=e.trim().toLowerCase();return t!=="0"&&t!=="false"&&t!=="no"}function Fi(e=process.env){return yt(X("CURSOR_SANDBOX",e))}var Gp=["CIRCLECI","BUILDKITE","TF_BUILD","JENKINS_URL","JENKINS_HOME","CODEBUILD_BUILD_ID","DRONE","DRONE_BUILD_NUMBER","TEAMCITY_VERSION","TRAVIS","APPVEYOR","BITBUCKET_BUILD_NUMBER"];function Wp(e){return Gp.some(t=>!!X(t,e))}function zp(e){if(X("KUBERNETES_SERVICE_HOST",e)||yt(X("REMOTE_CONTAINERS",e))||yt(X("DEVCONTAINER",e)))return!0;try{if(jp("/.dockerenv")||Bp("/proc/1/environ","utf8").includes("container="))return!0}catch{}return!1}function $i(e){return["VSCODE_PID","VSCODE_IPC_HOOK","CURSOR_EXTENSION_HOST_ROLE","CURSOR_WORKSPACE_LABEL"].some(t=>!!X(t,e))}function Vp(e,t=process.platform){return $i(e)?t==="darwin"||t==="win32"?!0:["__CFBundleIdentifier","DISPLAY","WAYLAND_DISPLAY","SESSIONNAME"].some(n=>!!X(n,e)):!1}function Jp(e){return e===void 0?!1:e.trim().toLowerCase().startsWith("bc-")}function Yp(e){return e==="linux"}function X(e,t){if(t){let n=t[e];return n===void 0||n===""?void 0:n}return M(e)}function Xp(e,t,n){return e.trim().toLowerCase()==="cursor"&&t.trim().toLowerCase()==="ubuntu"&&!!qp(X("CURSOR_VERSION",n))}function qp(e){if(e===void 0)return null;let t=e.trim();return t.length>0?t:null}function to(e){if(Jp(e.sessionId))return!0;let t=e.hostname??Di(),n=e.osUser??Bi(e.env);return Xp(t,n,e.env)}function Zp(e){return yt(X("CURSOR_AGENT",e.env))?!0:to(e)}function Qp(e){return!!(process.stdin.isTTY||process.stdout.isTTY||(X("TERM",e)??X("TERM_PROGRAM",e))||(X("SSH_TTY",e)??X("SSH_CONNECTION",e))||(X("__CFBundleIdentifier",e)??X("XPC_SERVICE_NAME",e))||$i(e)||["DISPLAY","WAYLAND_DISPLAY","XDG_SESSION_TYPE","DBUS_SESSION_BUS_ADDRESS"].some(t=>!!X(t,e))||X("SESSIONNAME",e))}function Gt(e={}){let t=e.env;if(X("GITHUB_ACTIONS",t))return"github_actions";if(yt(X("CLAUDE_CODE_REMOTE",t)))return"claude_remote";let n=e.platform??process.platform;if(!Vp(t,n)&&Zp(e)&&(yt(X("CURSOR_AGENT",t))||Yp(n)))return"cursor_cloud";if(X("CODESPACES",t)||X("CODESPACE_NAME",t))return"codespaces";if(X("GITLAB_CI",t))return"gitlab_ci";if(Wp(t))return"managed";let r=X("CI",t);return r&&r!=="false"&&r!=="0"?"managed":zp(t)?"container":Qp(t)?"interactive":"unknown"}async function ji(){return await te("systemd-detect-virt",[],1e3)}function Bi(e=process.env,t=Kp){for(let n of["USER","LOGNAME","USERNAME"]){let r=e[n];if(typeof r=="string"){let o=r.trim();if(o.length>0)return o}}try{return t().username??""}catch{return""}}async function Ki(){let e=process.platform==="darwin"?"Darwin":process.platform==="win32"?"Windows_NT":"Linux",t="";if(process.platform==="darwin")t=await te("sw_vers",["-productVersion"],1e3);else if(process.platform==="linux"){try{let{readFileSync:s}=await import("node:fs"),i=s("/etc/os-release","utf8"),a=i.match(/^PRETTY_NAME="?([^"\n]+)"?/m)?.[1],c=i.match(/^VERSION_ID="?([^"\n]+)"?/m)?.[1];t=a??c??""}catch{t=await te("lsb_release",["-sd"],1e3).then(s=>s.replace(/^"|"$/g,""))}t||(t=await te("uname",["-r"],1e3))}else t=await te("ver",[],1e3);let n=Bi(),r=(process.env.SHELL??"").split(/[/\\]/).pop()??"",o="";try{o=await te("tty",[],500),o.includes("not a tty")&&(o="")}catch{o=""}return{os:e,os_version:t||null,user:n||null,shell:r||null,tty:o||null}}function Dn(){return Di()}var nm="installation.json",rm="cloud-bootstrap.lock",om=6e4;function Qi(e,t,n){let r=`${e}:${t??""}`;return n?`${n}:${r}`:r}function pe(e=ro()){return oo(e,".ev-ai","agent-hook")}function sm(e=ro()){return oo(pe(e),nm)}function ea(e){return oo(Fn(e),rm)}function ta(){return em(8).toString("hex")}function Rt(e){return Ji("sha256").update(e).digest("hex").slice(0,16)}function $(e){if(e===void 0)return null;let t=e.trim();return t.length>0?t:null}function na(e){return/^[A-Za-z0-9._-]{8,64}$/.test(e)}function im(e=process.env){let t=$(e.EV_AI_HOOK_INSTALLATION_ID);if(t){if(!na(t)){E(`WARN: ignoring EV_AI_HOOK_INSTALLATION_ID (expected 8\u201364 chars [A-Za-z0-9._-], got length ${t.length})`);return}return t}}function ra(e,t){return e&&na(e)?e:(e&&E(`WARN: ignoring installation id override (expected 8\u201364 chars [A-Za-z0-9._-], got length ${e.length})`),im(t))}function am(e){return/^[0-9a-f]{16}$/.test(e)}function cm(e=process.env){if($(e.GITHUB_ACTIONS)){let t=$(e.GITHUB_REPOSITORY_ID)??$(e.GITHUB_REPOSITORY),n=$(e.GITHUB_ACTOR)??$(e.GITHUB_TRIGGERING_ACTOR)??$(e.GITHUB_USER);if(t&&n)return Rt(`github_actions|${t}|${n}`)}if($(e.CODESPACES)||$(e.CODESPACE_NAME)){let t=$(e.CODESPACE_NAME);if(t)return Rt(`codespaces|${t}`);let n=$(e.GITHUB_REPOSITORY_ID)??$(e.GITHUB_REPOSITORY),r=$(e.GITHUB_USER)??$(e.GITHUB_ACTOR);if(n&&r)return Rt(`codespaces|${n}|${r}`)}if($(e.GITLAB_CI)){let t=$(e.CI_PROJECT_ID)??$(e.CI_PROJECT_PATH),n=$(e.GITLAB_USER_LOGIN)??$(e.GITLAB_USER_EMAIL)??$(e.GITLAB_USER_NAME);if(t&&n)return Rt(`gitlab|${t}|${n}`)}return null}var um="cursoragent@cursor.com";function lm(e){let t=$(e.CURSOR_USER_EMAIL);return!t||t.toLowerCase()===um?null:t}function fm(e,t){return $(e.CURSOR_PROJECT_DIR)??$(e.CLAUDE_PROJECT_DIR)??t}function dm(e){return Ut(e).replace(/\.git$/i,"").toLowerCase()}async function pm(e){let t=await te("git",["config","--get","remote.origin.url"],2e3,{cwd:e});return t?dm(t):e}async function mm(e){let t=$(await te("git",["config","--local","--get","user.email"],2e3,{cwd:e})||void 0);if(t&&!de(null,t))return t;let n=$(await te("git",["log","-1","--format=%ae"],2e3,{cwd:e})||void 0);return n&&!de(null,n)?n:null}function gm(e,t){let n=fm(e,t);return n?Rt(`cursor_cloud|${n}|${lm(e)??""}`):null}async function hm(e,t){let n=$(e.CLAUDE_PROJECT_DIR)??t;if(!n)return null;let r=await pm(n),o=await mm(n);return Rt(`claude_remote|${r}|${o??""}`)}function Gi(e,t){let n=ra(e,t);if(n)return n;let r=cm(t);return r||ta()}async function _m(e){let n=await te("git",["config","--get","remote.origin.url"],2e3,{cwd:e})||tm(e);return Ji("sha256").update(n).digest("hex").slice(0,16)}function Sm(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t={};for(let[n,r]of Object.entries(e))typeof r=="string"&&r.length>0&&(t[n]=r);return Object.keys(t).length>0?t:void 0}function Em(e){try{let t=JSON.parse(e);if(typeof t.installation_id!="string"||t.installation_id.length===0)return;let n=Sm(t.platform_agent_ids);return{installation_id:t.installation_id,...t.pinned===!0?{pinned:!0}:{},...n?{platform_agent_ids:n}:{},...typeof t.operator_identity_hash=="string"?{operator_identity_hash:t.operator_identity_hash}:{},...typeof t.operator_identity_sent_at=="string"?{operator_identity_sent_at:t.operator_identity_sent_at}:{}}}catch{return}}function at(e){if(Yi(e))try{return Em(Xi(e,"utf8"))}catch{}}function so(e){return at(e)}function oa(e,t,n){let r=at(e);if(!r||r.operator_identity_hash===t&&r.operator_identity_sent_at===n)return;let o={...r,operator_identity_hash:t,operator_identity_sent_at:n};try{ge(e,`${JSON.stringify(o,null,2)}
16
16
  `)}catch(s){let i=s instanceof Error?s.message:String(s);E(`WARN: operator identity cache write failed open: ${i}`)}}function sa(e,t=Date.now()){if(!e)return!0;if(at(e)?.operator_identity_hash)return!1;let n=ea(e);try{if(Yi(n)){let r=Number.NaN;try{r=Number(Xi(n,"utf8").trim())}catch{}let o=t-r;if(Number.isFinite(o)&&o>=0&&o<om)return!1;try{qi(n)}catch{}}}catch{}try{return no(Fn(n),{recursive:!0}),Zi(n,`${t}
17
17
  `,{encoding:"utf8",flag:"wx"}),!0}catch(r){if(ua(r))return!1;let o=r instanceof Error?r.message:String(r);return E(`WARN: cloud bootstrap claim failed open: ${o}`),!0}}function ia(e){if(e)try{qi(ea(e))}catch{}}function aa(e,t){let r=at(e)?.platform_agent_ids?.[t];return typeof r=="string"&&r.length>0?r:void 0}function ca(e,t,n){if(!n)return;let r=at(e);if(!r||r.platform_agent_ids?.[t]===n)return;let o={installation_id:r.installation_id,platform_agent_ids:{...r.platform_agent_ids,[t]:n},...r.operator_identity_hash?{operator_identity_hash:r.operator_identity_hash}:{},...r.operator_identity_sent_at?{operator_identity_sent_at:r.operator_identity_sent_at}:{}};try{ge(e,`${JSON.stringify(o,null,2)}
18
18
  `)}catch(s){let i=s instanceof Error?s.message:String(s);E(`WARN: platform_agent_id cache write failed open: ${i}`)}}function ua(e){return e instanceof Error&&"code"in e&&e.code==="EEXIST"}function ym(e,t){no(Fn(e),{recursive:!0}),Zi(e,`${JSON.stringify(t,null,2)}
@@ -27,7 +27,7 @@ Or use npx delivery:
27
27
  `,1)[0]??"";return t-Number(n.trim())}catch{return Number.NaN}}function AS(e){let t=[];for(let n of RS){let r=L(e,n).trim();r&&t.push(`${n}=${r}`)}return t.length===0?"":Dt(t.join("\0"))}function kS(e){let t=e.sessionId.trim();if(!t)return;let n=e.runnerEvent.trim().toLowerCase(),r=e.turnId.trim(),o=e.toolUseId.trim(),s=e.subagentId?.trim()??"",i=e.callFingerprint?.trim()??"",a=!!(o||r||s),c=yS.has(n);if(!a&&!c)return;let l=e.runnerPlatform.trim()||"unknown";return Dt(`${l}|${t}|${n}|${r}|${o}|${i}|${s}`)}function bS(e,t=Date.now()){let n;try{n=mS(e)}catch{return}let r=0;for(let o of n){if(r>=ES)break;r+=1;let s=vo(e,o),i=Xc(s,t);if(!(!Number.isFinite(i)||i<Yc))try{Vc(s)}catch{}}}function xS(e,t,n=Date.now()){let r=vo(t,e);try{if(dS(r)){let o=Xc(r,n);if(Number.isFinite(o)&&o>=0&&o<Yc)return!1;try{Vc(r)}catch{}}}catch{}try{pS(t,{recursive:!0}),hS(r,`${n}
28
28
  `,{encoding:"utf8",flag:"wx"})}catch(o){if(Vn(o))return!1;let s=o instanceof Error?o.message:String(o);return E(`WARN: event claim failed open: ${s}`),!0}return bS(t,n),!0}function IS(e,t,n){let r=qt(e),o=Po(e),s=L(e,"tool_use_id"),i=L(e,"subagent_id")||L(e,"agent_id"),a=Xt(e,t,void 0,n),c=AS(e);return{runnerPlatform:a,sessionId:r,runnerEvent:t,turnId:o,toolUseId:s,subagentId:i,callFingerprint:c}}function qc(e,t,n,r=Jc(),o=Date.now()){if(!SS)return!0;let s=kS(IS(e,t,n));if(!s)return!0;let i=xS(s,CS(r),o);return!i&&M("EV_AI_HOOK_DEBUG")&&E(`DEBUG: duplicate hook event suppressed (claim ${s.slice(0,8)}\u2026)`),i}import{mkdirSync as OS,readFileSync as ru,statSync as TS,unlinkSync as ou,writeFileSync as PS}from"node:fs";import{homedir as su}from"node:os";import{join as iu}from"node:path";var wS=4,NS=10;function Zc(e=process.platform){return e==="win32"?wS:NS}function au(e){return e==="session_start"||e==="session_end"}var cu=6e4,Mo=2e3,vS="slots",Lo=new Set,Qc=!1;function uu(e=su()){return iu(pe(e),vS)}function Ho(e,t=su(),n=process.platform){if(e!==void 0)return e>0?e:Zc(n);let r=ne(jt(t),{});return bi(r)??Zc(n)}function MS(e){if(!Number.isInteger(e)||e<=0)return!1;try{return process.kill(e,0),!0}catch(t){return t.code==="EPERM"}}function lu(e,t){return iu(e,`slot-${t}`)}function fu(e){return`${e.pid}
29
29
  ${e.acquiredAtMs}
30
- `}var LS=/^(\d+)\n(\d+)\n$/,HS=64;function US(e){let t=LS.exec(e);if(!t)return;let n=Number(t[1]),r=Number(t[2]);return Number.isSafeInteger(n)&&n>0&&Number.isSafeInteger(r)?{pid:n,acquiredAtMs:r}:void 0}function du(e,t=Date.now()){let n,r;try{let i=TS(e);if(!i.isFile())return!1;r=i.mtimeMs,n=i.size<=HS?ru(e,"utf8"):""}catch{return!1}let o=US(n);if(!o)return Math.abs(t-r)<Mo;let s=t-o.acquiredAtMs;return s<-Mo||s>=cu?!1:MS(o.pid)}function pu(e,t=uu(),n=Date.now){for(let r=0;r<e;r+=1)if(!du(lu(t,r),n()))return!0;return e<=0}function mu(e){return{pid:process.pid,acquiredAtMs:e}}function eu(e,t){let n=e instanceof Error?e.message:String(e);return E(`WARN: hook process slot failed open: ${n}`),mu(t)}function tu(e){return Lo.add(e),Qc||(Qc=!0,process.once("exit",()=>{for(let t of[...Lo])Uo(t)})),e}function nu(e){try{return PS(e.path,fu(e),{encoding:"utf8",flag:"wx",mode:384}),!0}catch(t){if(Vn(t))return!1;throw t}}function gu(e,t=uu(),n=Date.now){if(e<=0)return mu(n());let r;try{OS(t,{recursive:!0});for(let o=0;o<e;o+=1){let s={path:lu(t,o),pid:process.pid,acquiredAtMs:n()};if(nu(s))return tu(s);if(!du(s.path,n())){try{ou(s.path)}catch(i){if(!Wt(i)){r??=i;continue}}if(s.acquiredAtMs=n(),nu(s))return tu(s)}}}catch(o){return eu(o,n())}return r===void 0?null:eu(r,n())}function Uo(e,t=Date.now()){if(Lo.delete(e),!(!e.path||t-e.acquiredAtMs>=cu-Mo))try{ru(e.path,"utf8")===fu(e)&&ou(e.path)}catch{}}function Do(e){M("EV_AI_HOOK_DEBUG")&&E(`DEBUG: hook process cap reached (${e}/${e}); event dropped`)}import{closeSync as DS,writeSync as FS}from"node:fs";function hu(e=process.env){let t=e[Fr];if(delete e[Fr],t===void 0)return;let n=Number.parseInt(t,10);if(!(!Number.isInteger(n)||n<3)){try{FS(n,fi)}catch{}try{DS(n)}catch{}}}function Fo(e=process.env){let t=e[ii];if(t)return{launcherVersion:t,hookSource:e[ai]??"",fallbackReason:e[ci],launcherScope:e[ui]}}function _u(e,t){return(e?Kt(e):void 0)===t}import{realpathSync as ZA}from"node:fs";import{homedir as QA}from"node:os";var B=Ve(rt(),1);import{existsSync as $S,readFileSync as jS}from"node:fs";import{homedir as Su}from"node:os";import{join as BS}from"node:path";var KS="cloud-cache.json",GS=1440*60*1e3,WS=900*1e3;function zS(e=Su()){return BS(pe(e),KS)}function VS(e){if(!$S(e))return;let t=he(jS(e,"utf8"),{});if(!(typeof t.context!="string"||typeof t.probed_at!="number"||t.result!==null&&t.result!==void 0&&typeof t.result!="object"))return{context:t.context,probed_at:t.probed_at,result:t.result??null}}function JS(e,t){try{ge(e,`${JSON.stringify(t)}
30
+ `}var LS=/^(\d+)\n(\d+)\n$/,HS=64;function US(e){let t=LS.exec(e);if(!t)return;let n=Number(t[1]),r=Number(t[2]);return Number.isSafeInteger(n)&&n>0&&Number.isSafeInteger(r)?{pid:n,acquiredAtMs:r}:void 0}function du(e,t=Date.now()){let n,r;try{let i=TS(e);if(!i.isFile())return!1;r=i.mtimeMs,n=i.size<=HS?ru(e,"utf8"):""}catch{return!1}let o=US(n);if(!o)return Math.abs(t-r)<Mo;let s=t-o.acquiredAtMs;return s<-Mo||s>=cu?!1:MS(o.pid)}function pu(e,t=uu(),n=Date.now){for(let r=0;r<e;r+=1)if(!du(lu(t,r),n()))return!0;return e<=0}function mu(e){return{pid:process.pid,acquiredAtMs:e}}function eu(e,t){let n=e instanceof Error?e.message:String(e);return E(`WARN: hook process slot failed open: ${n}`),mu(t)}function tu(e){return Lo.add(e),Qc||(Qc=!0,process.once("exit",()=>{for(let t of[...Lo])Uo(t)})),e}function nu(e){try{return PS(e.path,fu(e),{encoding:"utf8",flag:"wx",mode:384}),!0}catch(t){if(Vn(t))return!1;throw t}}function gu(e,t=uu(),n=Date.now){if(e<=0)return mu(n());try{OS(t,{recursive:!0})}catch(o){return eu(o,n())}let r;for(let o=0;o<e;o+=1)try{let s={path:lu(t,o),pid:process.pid,acquiredAtMs:n()};if(nu(s))return tu(s);if(du(s.path,n()))continue;try{ou(s.path)}catch(i){if(!Wt(i))throw i}if(s.acquiredAtMs=n(),nu(s))return tu(s)}catch(s){r??=s}return r===void 0?null:eu(r,n())}function Uo(e,t=Date.now()){if(Lo.delete(e),!(!e.path||t-e.acquiredAtMs>=cu-Mo))try{ru(e.path,"utf8")===fu(e)&&ou(e.path)}catch{}}function Do(e){M("EV_AI_HOOK_DEBUG")&&E(`DEBUG: hook process cap reached (${e}/${e}); event dropped`)}import{closeSync as DS,writeSync as FS}from"node:fs";function hu(e=process.env){let t=e[Fr];if(delete e[Fr],t===void 0)return;let n=Number.parseInt(t,10);if(!(!Number.isInteger(n)||n<3)){try{FS(n,fi)}catch{}try{DS(n)}catch{}}}function Fo(e=process.env){let t=e[ii];if(t)return{launcherVersion:t,hookSource:e[ai]??"",fallbackReason:e[ci],launcherScope:e[ui]}}function _u(e,t){return(e?Kt(e):void 0)===t}import{realpathSync as ZA}from"node:fs";import{homedir as QA}from"node:os";var B=Ve(rt(),1);import{existsSync as $S,readFileSync as jS}from"node:fs";import{homedir as Su}from"node:os";import{join as BS}from"node:path";var KS="cloud-cache.json",GS=1440*60*1e3,WS=900*1e3;function zS(e=Su()){return BS(pe(e),KS)}function VS(e){if(!$S(e))return;let t=he(jS(e,"utf8"),{});if(!(typeof t.context!="string"||typeof t.probed_at!="number"||t.result!==null&&t.result!==void 0&&typeof t.result!="object"))return{context:t.context,probed_at:t.probed_at,result:t.result??null}}function JS(e,t){try{ge(e,`${JSON.stringify(t)}
31
31
  `)}catch(n){let r=n instanceof Error?n.message:String(n);E(`WARN: cloud cache write failed open: ${r}`)}}function YS(e,t,n){if(!e||e.context!==t)return!1;let r=e.result===null?WS:GS;return n-e.probed_at<r}async function XS(e){let t=await fetch("http://169.254.169.254/latest/api/token",{method:"PUT",headers:{"X-aws-ec2-metadata-token-ttl-seconds":"60"},signal:AbortSignal.timeout(e)}).catch(()=>{});if(!t?.ok)return;let n=(await t.text()).trim();if(!n)return;let r={"X-aws-ec2-metadata-token":n},[o,s]=await Promise.all([fetch("http://169.254.169.254/latest/meta-data/placement/region",{headers:r,signal:AbortSignal.timeout(e)}).catch(()=>{}),fetch("http://169.254.169.254/latest/meta-data/instance-id",{headers:r,signal:AbortSignal.timeout(e)}).catch(()=>{})]);if(!o?.ok&&!s?.ok)return;let i=o?.ok?(await o.text()).trim():"",a=s?.ok?(await s.text()).trim():"";if(!(!i&&!a))return{provider:"aws",region:i,instance_id:a}}async function qS(e){let t=await fetch("http://metadata.google.internal/computeMetadata/v1/instance/?recursive=true",{headers:{"Metadata-Flavor":"Google"},signal:AbortSignal.timeout(e)}).catch(()=>{});if(!t?.ok)return;let n=await t.json(),r=typeof n.zone=="string"?n.zone.split("/").pop()??"":"",o=n.id===void 0?"":String(n.id);if(!(!r&&!o))return{provider:"gcp",region:r,instance_id:o}}async function ZS(e){let t=await fetch("http://169.254.169.254/metadata/instance?api-version=2021-02-01",{headers:{Metadata:"true"},signal:AbortSignal.timeout(e)}).catch(()=>{});if(!t?.ok)return;let n=await t.json(),r=n.compute?.location??"",o=n.compute?.vmId??"";if(!(!r&&!o))return{provider:"azure",region:r,instance_id:o}}async function QS(e){let t=await Promise.allSettled([XS(e),qS(e),ZS(e)]);for(let n of t)if(n.status==="fulfilled"&&n.value)return n.value;return null}async function Eu(e,t){if(e==="interactive")return null;let n=t?.home??Su(),r=t?.timeoutMs??1e3,o=t?.nowMs??Date.now(),s=zS(n),i=VS(s);if(YS(i,e,o))return i.result;let a=await QS(r);return JS(s,{context:e,probed_at:o,result:a}),a}var Au=Ve(rt(),1);import{existsSync as Ru}from"node:fs";import{homedir as Cu}from"node:os";import{join as Qt,resolve as $o,sep as yu}from"node:path";function ir(e,t,n){if(!Ru(e))return;let r=ne(e,{});for(let[o,s]of Object.entries(r.mcpServers??{}))n.set(o,{declared:{name:o,...t},config:s})}function eE(e,t,n){if(!Ru(e))return;let r=ne(e,{}),o=$o(t),s=null;for(let a of Object.keys(r.projects??{})){let c=$o(a);(o===c||o.startsWith(c.endsWith(yu)?c:c+yu))&&(s===null||c.length>$o(s).length)&&(s=a)}if(s===null)return;let i=r.projects?.[s]?.mcpServers??{};for(let[a,c]of Object.entries(i))n.set(a,{declared:{name:a,source:"claude_json_project",sourcePath:".claude.json",scope:"user"},config:c})}function ku(e,t,n,r){let o=new Map;for(let s of e.mcp_servers??[])s.name&&o.set(s.name,{declared:{name:s.name,source:"manifest"}});return n==="claude"?(ir(Qt(r,".claude.json"),{source:"claude_json_user"},o),eE(Qt(r,".claude.json"),t,o)):n==="cursor"&&ir(Qt(r,".cursor/mcp.json"),{source:"cursor_mcp_user"},o),ir(Qt(t,".mcp.json"),{source:"mcp_json"},o),ir(Qt(t,".cursor/mcp.json"),{source:"cursor_mcp"},o),o}async function jo(e,t=process.cwd(),n="claude",r=Cu()){return[...ku(e,t,n,r).values()].map(o=>o.declared)}function bu(e,t,n=process.cwd(),r="claude",o=Cu()){let s=ku(t,n,r,o),i=s.get(e);if(i!==void 0)return i.config??null;for(let[a,c]of s)if((0,Au.mcpServerNameMatchesToolSegment)(a,e))return c.config??null;return null}var tE=["CI","GITHUB_ACTIONS","GITLAB_CI","CIRCLECI","BUILDKITE","TF_BUILD","JENKINS_URL","JENKINS_HOME","CODEBUILD_BUILD_ID","DRONE","DRONE_BUILD_NUMBER","TEAMCITY_VERSION","TRAVIS","APPVEYOR","BITBUCKET_BUILD_NUMBER","KUBERNETES_SERVICE_HOST","REMOTE_CONTAINERS","DEVCONTAINER","GITHUB_REPOSITORY","GITHUB_REPOSITORY_ID","GITHUB_REF","GITHUB_SHA","GITHUB_RUN_ID","GITHUB_WORKFLOW","GITHUB_ACTOR","GITHUB_TRIGGERING_ACTOR","GITHUB_ACTOR_ID","GITHUB_USER","GITLAB_USER_LOGIN","GITLAB_USER_NAME","GITLAB_USER_EMAIL","BUILD_REQUESTEDFOR","BUILD_REQUESTEDFOREMAIL","BUILD_REQUESTEDFORID","BUILDKITE_BUILD_CREATOR","BUILDKITE_BUILD_CREATOR_EMAIL","BUILD_USER","BUILD_USER_ID","BUILD_USER_EMAIL","CHANGE_AUTHOR","CHANGE_AUTHOR_EMAIL","CIRCLE_USERNAME","CODEBUILD_INITIATOR","DRONE_COMMIT_AUTHOR","DRONE_COMMIT_AUTHOR_NAME","DRONE_COMMIT_AUTHOR_EMAIL","EV_AI_HOOK_OPERATOR_NAME","EV_AI_HOOK_OPERATOR_EMAIL","EV_AI_HOOK_OPERATOR_LOGIN","GIT_AUTHOR_NAME","GIT_AUTHOR_EMAIL","GIT_COMMITTER_NAME","GIT_COMMITTER_EMAIL","EMAIL","RUNNER_OS","RUNNER_ARCH","NODE_ENV","TERM_PROGRAM","CLAUDE_CODE_REMOTE","CLAUDE_CODE_REMOTE_SESSION_ID","CURSOR_AGENT","CURSOR_VERSION","CURSOR_CODE_REMOTE","CURSOR_USER_EMAIL","CODESPACES","CODESPACE_NAME","ANTHROPIC_BASE_URL","OPENAI_BASE_URL","OPENAI_API_BASE","AZURE_OPENAI_ENDPOINT","GOOGLE_GEMINI_BASE_URL","GEMINI_API_BASE","CLAUDE_CODE_USE_BEDROCK","CLAUDE_CODE_USE_VERTEX"],nE=["CURSOR_PROJECT_DIR"],rE=new Set(["key","api-key","api_key","apikey","token","sig","signature","access_token","password","pwd","secret","client_secret"]);function oE(e){try{let t=new URL(e);(t.username||t.password)&&(t.username="",t.password="");for(let[n]of t.searchParams)rE.has(n.toLowerCase())&&t.searchParams.set(n,"[redacted]");return t.toString()}catch{return e}}function xu(e=process.env){let t=tE.map(r=>Object.prototype.hasOwnProperty.call(e,r)?{name:r,present:!0,value:oE(e[r]??"")}:{name:r,present:!1}),n=nE.map(r=>({name:r,present:Object.prototype.hasOwnProperty.call(e,r)&&!!e[r]}));return[...t,...n]}import{homedir as ME}from"node:os";import{homedir as Iu}from"node:os";import{join as sE}from"node:path";function iE(e=Iu()){return sE(e,".claude.json")}function ar(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function Ou(e=Iu()){let n=ne(iE(e),{}).oauthAccount;if(!n||typeof n!="object")return null;let r=ar(n.emailAddress),o=ar(n.fullName)??ar(n.displayName),s=ar(n.accountUuid),i=r??s;return!i||de(o,r)?null:{git_user_name:null,git_user_email:null,platform_login:i,identity_source:"claude_oauth"}}import{homedir as wu}from"node:os";import{join as Tu}from"node:path";var aE="https://api.openai.com/auth";function It(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function Nu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function cE(e){let t=e.split(".");if(t.length!==3||t.some(r=>r.length===0))return null;let n=t[1];if(!n)return null;try{let r=JSON.parse(Buffer.from(n,"base64url").toString("utf8"));return Nu(r)}catch{return null}}function Pu(e,t,n){return It(e[n])??It(t?.[n])}function uE(e=process.env,t=wu()){let n=It(e.CODEX_HOME)??Tu(t,".codex");return Tu(n,"auth.json")}function vu(e=process.env,t=wu()){let n=ne(uE(e,t),{}),r=It(n.auth_mode);if(r!==null&&r!=="chatgpt"||r===null&&It(n.OPENAI_API_KEY))return null;let o=It(n.tokens?.id_token);if(!o)return null;let s=cE(o);if(!s)return null;let i=Nu(s[aE]),a=Pu(s,i,"name"),c=Pu(s,i,"email");return!c||de(a,c)?null:{git_user_name:null,git_user_email:null,platform_login:c,identity_source:"codex_oauth"}}import{homedir as lr}from"node:os";import{join as Be}from"node:path";import{join as lE}from"node:path";var fE="cursor-ide-identity.json",dE=840*60*1e3;function Lu(e){return lE(pe(e),fE)}function Mu(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function Hu(e){let t=ne(e,{}),n=t.read_at_ms,r=t.db_path;if(!(typeof n!="number"||!Number.isFinite(n)||typeof r!="string"))return{read_at_ms:n,db_path:r,email:Mu(t.email),auth_id:Mu(t.auth_id)}}function Uu(e,t,n){if(e?.db_path!==t)return!1;let r=n-e.read_at_ms;return r>=0&&r<dE}function Du(e,t){try{ge(e,`${JSON.stringify(t)}
32
32
  `)}catch(n){let r=n instanceof Error?n.message:String(n);E(`WARN: cursor IDE identity cache write failed open: ${r}`)}}import{execFileSync as pE}from"node:child_process";import{existsSync as mE}from"node:fs";import{createRequire as gE}from"node:module";import{pathToFileURL as hE}from"node:url";var $u=gE(import.meta.url),cr=`
33
33
  SELECT key, value
@@ -39,7 +39,7 @@ ORDER BY key
39
39
  `.trim(),Bo=new Map;function Fu(e){if(typeof e=="string"){let t=e.trim();return t.length>0?t:null}if(e instanceof Uint8Array){let t=Buffer.from(e).toString("utf8").trim();return t.length>0?t:null}return null}function ju(e){return e.toLowerCase().includes("token")}function Bu(e){let t=new Map;if(!Array.isArray(e))return t;for(let n of e){if(n===null||typeof n!="object")continue;let r=n,o=Fu(r.key),s=Fu(r.value);o&&s&&!ju(o)&&t.set(o,s)}return t}function _E(e){let t=hE(e);return t.search="mode=ro&immutable=1",t.href}function SE(e){try{let t=$u("bun:sqlite");if(typeof t.Database!="function")return null;let n=new t.Database(e,{readonly:!0,create:!1});try{let r=n.query?.(cr)??n.prepare(cr);return Bu(r.all?.())}finally{n.close?.()}}catch{return null}}function EE(e){let t=process.emitWarning.bind(process);process.emitWarning=((n,...r)=>{(typeof n=="string"?n:n instanceof Error?n.message:"").includes("SQLite is an experimental feature")||t(n,...r)});try{return e()}finally{process.emitWarning=t}}function yE(e){try{return EE(()=>{let t=$u("node:sqlite");if(typeof t.DatabaseSync!="function")return null;let n=new t.DatabaseSync(e,{readOnly:!0});try{return Bu(n.prepare(cr).all?.())}finally{n.close?.()}})}catch{return null}}function RE(e){let t=new Map;for(let n of e.split(`
40
40
  `)){let r=n.trimEnd();if(!r)continue;let o=r.indexOf(" ");if(o<=0)continue;let s=r.slice(0,o).trim(),i=r.slice(o+1).trim();s&&i&&!ju(s)&&t.set(s,i)}return t}function CE(e){try{let t=pE("sqlite3",["-noheader","-batch","-separator"," ",e,cr],{encoding:"utf8",timeout:2e3,maxBuffer:65536,windowsHide:!0,stdio:["ignore","pipe","ignore"]});return RE(t)}catch{return null}}function Ku(e){let t=Bo.get(e);if(t)return t;if(!mE(e)){let o=new Map;return Bo.set(e,o),o}let n=_E(e),r=SE(n)??CE(n)??yE(n)??new Map;return Bo.set(e,r),r}var AE="cursorAuth/cachedEmail",kE="cursorAuth/stripeMembershipAuthId";function ur(e){if(e===void 0)return null;let t=e.trim();return t.length>0?t:null}function bE(e=lr(),t=process.platform,n=process.env){let r=ur(n.VSCODE_PORTABLE);if(r)return Be(r,"user-data");let o=ur(n.VSCODE_APPDATA);if(o)return Be(o,"Cursor");switch(t){case"darwin":return Be(e,"Library","Application Support","Cursor");case"win32":return Be(ur(n.APPDATA)??Be(e,"AppData","Roaming"),"Cursor");default:return Be(ur(n.XDG_CONFIG_HOME)??Be(e,".config"),"Cursor")}}function xE(e=lr()){return Be(e,".cursor","cli-config.json")}function IE(e=lr(),t=process.platform,n=process.env){return Be(bE(e,t,n),"User","globalStorage","state.vscdb")}function en(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function OE(e){return typeof e.userId=="number"&&Number.isFinite(e.userId)?String(e.userId):en(e.userId)}function TE(e){return en(e.email)??en(e.authId)??OE(e)}function Ko(e){let t=en(e.email),n=en(e.displayName),r=TE(e);return!r||de(n,t)?null:{git_user_name:null,git_user_email:null,platform_login:r,identity_source:"cursor_oauth"}}function PE(e){let n=ne(xE(e),{}).authInfo;return!n||typeof n!="object"?null:Ko(n)}function wE(e,t,n){let r=IE(e,process.platform,t),o=Lu(e),s=Hu(o);if(Uu(s,r,n))return Ko({email:s?.email,authId:s?.auth_id});let i=Ku(r),a=i.get(AE)??null,c=i.get(kE)??null;return Du(o,{read_at_ms:n,db_path:r,email:a,auth_id:c}),Ko({email:a,authId:c})}function Gu(e=lr(),t=process.env,n=Date.now()){return PE(e)??wE(e,t,n)}import{createHash as NE}from"node:crypto";import{resolve as vE}from"node:path";function q(e){return NE("sha256").update(e).digest("hex").slice(0,16)}function Go(e){return q(vE(e))}function Se(e,t){return`${e}\0${t}`}function Wu(e){let t=e.indexOf("\0");return t<=0?null:{path:e.slice(0,t),name:e.slice(t+1)}}function tn(e){let n=[...e].sort((r,o)=>{let s=r.path.localeCompare(o.path);return s!==0?s:r.name.localeCompare(o.name)}).map(r=>`${r.path}|${r.name}|${r.content_hash}`).join(`
41
41
  `);return q(n)}function LE(e,t,n="git_config",r=null){return q(`${e??""}|${t??""}|${r??""}|${n}`)}function HE(e){let t=null,n=null;for(let r of e.split(`
42
- `)){let o=r.trim();if(!o)continue;let s=o.indexOf(" ");if(s<=0)continue;let i=o.slice(0,s).toLowerCase(),a=o.slice(s+1).trim();a&&(i==="user.name"?t=a:i==="user.email"&&(n=a))}return{git_user_name:t,git_user_email:n,platform_login:null}}async function UE(e,t=te){let n=await t("git",["config","--get-regexp","^user\\.(name|email)$"],2e3,{cwd:e});return HE(n)}function DE(e=process.env){let t=j(e.GIT_AUTHOR_NAME),n=j(e.GIT_AUTHOR_EMAIL);if(t||n)return{git_user_name:t,git_user_email:n,platform_login:null,identity_source:"git_env"};let r=j(e.GIT_COMMITTER_NAME),o=j(e.GIT_COMMITTER_EMAIL);if(r||o)return{git_user_name:r,git_user_email:o,platform_login:null,identity_source:"git_env"};let s=j(e.EMAIL);return s?{git_user_name:null,git_user_email:s,platform_login:null,identity_source:"git_env"}:null}function Ke(e,t,n,r=null){return!e&&!t&&!r?null:{git_user_name:e,git_user_email:t,platform_login:r,identity_source:n}}function FE(e=process.env){let t=j(e.EV_AI_HOOK_OPERATOR_EMAIL),n=j(e.EV_AI_HOOK_OPERATOR_LOGIN),r=Ke(j(e.EV_AI_HOOK_OPERATOR_NAME),t,"configured",t??n);if(r)return r;let o=j(e.GITHUB_ACTOR)??j(e.GITHUB_TRIGGERING_ACTOR)??j(e.GITHUB_USER),s=Ke(o,null,"github",o);if(s)return s;let i=j(e.GITLAB_USER_LOGIN),a=j(e.GITLAB_USER_EMAIL),c=Ke(j(e.GITLAB_USER_NAME)??i,a,"gitlab",a??i);if(c)return c;let l=j(e.BUILD_REQUESTEDFOREMAIL),u=Ke(j(e.BUILD_REQUESTEDFOR),l,"azure_devops",l??j(e.BUILD_REQUESTEDFORID));if(u)return u;let d=j(e.BUILDKITE_BUILD_CREATOR_EMAIL),f=Ke(j(e.BUILDKITE_BUILD_CREATOR),d,"buildkite",d);if(f)return f;let p=j(e.BUILD_USER_EMAIL)??j(e.CHANGE_AUTHOR_EMAIL),g=Ke(j(e.BUILD_USER)??j(e.CHANGE_AUTHOR),p,"jenkins",p??j(e.BUILD_USER_ID));if(g)return g;let S=j(e.CIRCLE_USERNAME),A=Ke(S,null,"circleci",S);if(A)return A;let k=j(e.CODEBUILD_INITIATOR),O=Ke(k,null,"codebuild",k);if(O)return O;let I=j(e.DRONE_COMMIT_AUTHOR_EMAIL),v=j(e.DRONE_COMMIT_AUTHOR),T=Ke(v??j(e.DRONE_COMMIT_AUTHOR_NAME),I,"drone",I??v);if(T)return T;if(zu(e.CLAUDE_CODE_REMOTE)||zu(e.CURSOR_AGENT)){let K=j(e.CURSOR_USER_EMAIL);return{git_user_name:null,git_user_email:null,platform_login:K&&!de(null,K)?K:null,identity_source:"cloud"}}return null}function Wo(e){return!!((e.git_user_name??e.git_user_email)&&!de(e.git_user_name,e.git_user_email))}function j(e){if(e===void 0)return null;let t=e.trim();return t.length>0?t:null}function zu(e){if(e===void 0||e==="")return!1;let t=e.trim().toLowerCase();return t!=="0"&&t!=="false"&&t!=="no"}function $E(e,t,n){return e==="claude"?Ou(t):e==="cursor"?Gu(t,n):e==="codex"?vu(n,t):null}async function zo(e,t=te,n=process.env,r={}){let o=await UE(e,t),s=DE(n),i=Wo(o)?o:s&&Wo(s)?s:null,a=$E(r.runnerPlatform,r.home??ME(),n);if(a)return{git_user_name:i?.git_user_name??null,git_user_email:i?.git_user_email??null,platform_login:a.platform_login,identity_source:a.identity_source};let c=FE(n);return c?.platform_login?{git_user_name:i?.git_user_name??null,git_user_email:i?.git_user_email??null,platform_login:c.platform_login,identity_source:c.identity_source}:i?{...i,platform_login:null,identity_source:Wo(o)?"git_config":"git_env"}:c||(o.git_user_name||o.git_user_email?{...o,identity_source:"git_config"}:s||{git_user_name:null,git_user_email:null,platform_login:null,identity_source:"git_config"})}async function Vo(e){let{gitRoot:t,installationStorePath:n,forceResend:r}=e,o=e.exec??te,s=e.env??process.env,i=await zo(t,o,s,{runnerPlatform:e.runnerPlatform,home:e.home}),a=LE(i.git_user_name,i.git_user_email,i.identity_source,i.platform_login),l=(n?so(n):void 0)?.operator_identity_hash;if(!(r||l!==void 0&&l!==a||!l))return{commit:()=>{}};let p=n;return{operator:i,commit:()=>{p&&oa(p,a,kn())}}}function Jo(e){return e?!so(e)?.operator_identity_hash:!0}function Vu(e){return!0}import{existsSync as tA,readFileSync as nA}from"node:fs";import{homedir as yd}from"node:os";import{join as vt,resolve as rA}from"node:path";import{basename as VC,join as Nt}from"node:path";import{dirname as sl,resolve as pr}from"node:path";import{existsSync as jE}from"node:fs";import{homedir as Xu}from"node:os";import{relative as qu,resolve as Pe,sep as ot}from"node:path";var BE=["session_id","conversation_id","turn_id","generation_id","prompt.id","prompt_id","hook_event_name","event","source","status","stop_reason","reason","tool_name","tool","tool_use_id","skill_name","command_name","expansion_type","command_source","permission_mode","model","model_id","agent_id","agent_type","subagent_id","subagent_type","subagent_model","is_parallel_worker","effort","effort.level","duration_ms","duration","sandbox","failure_type","is_interrupt"],KE=["prompt","tool_input","tool_response","last_assistant_message","command"],GE=new Set;function WE(e){switch(e?.toLowerCase()){case"beforemcpexecution":return new Set(["command"]);case"stopfailure":return new Set(["last_assistant_message"]);default:return GE}}var Zu=new Set(["on","1","true"]);function Qo(e){let t=M("EV_AI_HOOK_CAPTURE_PROMPT")?.trim();return t!==void 0&&t!==""?Zu.has(t.toLowerCase()):e?.collect_prompt===!0}function Qu(e,t){let n=es(e);if(n==="allowlist")return"off";if(n==="full")return"full";let r=M("EV_AI_HOOK_CAPTURE_PROMPT")?.trim();return r!==void 0&&r!==""?Zu.has(r.toLowerCase())?"env":"off":t?.collect_prompt===!0?"config":"off"}function el(e){return es(e)==="allowlist"}function es(e){return M("EV_AI_HOOK_CAPTURE_CONTENT")?.toLowerCase()==="off"||e.capture_hook_input==="allowlist"?"allowlist":e.capture_hook_input==="full"||e.debug===!0||M("EV_AI_HOOK_CAPTURE_FULL_INPUT")==="1"?"full":"content"}function zE(e){let t={};for(let n of BE){let r=He(e,n);r!==void 0&&(t[n]=r)}return t}function fr(e,t){if(typeof e!="string"||e.length===0||!t)return null;let n=Pe(e),r=Pe(t),o=qu(r,n);return!o||o==="."?".":o.startsWith(`..${ot}`)||o===".."||Pe(r,o)!==n?null:o.split(ot).join("/")}function tl(e,t){let n=qu(Pe(t),Pe(e)).split(ot).join("/");return!n||n==="."?null:n===".."||n.startsWith("../")&&n.split("/").every(r=>r==="..")?n:null}function nl(e){return typeof e!="string"||e.length===0?null:Pe(e).split(ot).join("/")}function VE(){let e=M("CURSOR_PROJECT_DIR");if(!e)return null;let t=Pe(e);return jE(t)?t.split(ot).join("/"):null}function Xo(e,t){return fr(e,t)!==null}function JE(e,t){let n=Pe(t??Xu(),".cursor").split(ot).join("/");return Xo(e,n)}function YE(e,t,n){return t!==null&&Xo(e,t)?!0:t!==null&&JE(e,n.home)?!1:n.inGitRepo===!0&&n.gitRoot!==void 0&&Xo(e,n.gitRoot)?!0:t===null}function rl(e,t){let n=nl(e.cwd);if(n!==null)return n;let r=Pe(process.cwd()).split(ot).join("/"),o=VE();return YE(r,o,t)?r:o??r}function ts(e,t={}){return rl(e,t)}function ns(e,t=Xu()){let n=Pe(t).split(ot).join("/").replace(/\/$/,"");return n.length<=1?e:e===n?"~":e.startsWith(`${n}/`)?`~${e.slice(n.length)}`:e}function Ju(e,t,n){let r=nl(n.launchCwd)??rl(t,n);e.cwd=ns(r,n.home);let o=n.inGitRepo===!0&&n.gitRoot!==void 0?fr(r,n.gitRoot):null;o!==null&&(e.cwd_relative=o)}var ol="\u2026[truncated]\u2026",qo=Buffer.byteLength(ol,"utf8"),XE=8;function nn(e){return Buffer.byteLength(JSON.stringify(e),"utf8")}function Yu(e,t){if(t<=0)return"";let n=Buffer.from(e,"utf8");return n.length<=t?e:n.subarray(0,t).toString("utf8")}function qE(e,t){if(t<=0)return"";let n=Buffer.from(e,"utf8");return n.length<=t?e:n.subarray(n.length-t).toString("utf8")}function ZE(e,t){if(Buffer.byteLength(e,"utf8")<=t)return e;if(t<=qo)return Yu(e,t);let r=t-qo,o=Math.ceil(r/2),s=Math.floor(r/2);return`${Yu(e,o)}${ol}${qE(e,s)}`}function Zo(e,t,n){if(typeof e=="string"){n.push({path:t,value:e,bytes:Buffer.byteLength(e,"utf8")});return}if(Array.isArray(e)){e.forEach((r,o)=>{Zo(r,[...t,o],n)});return}if(e!==null&&typeof e=="object")for(let[r,o]of Object.entries(e))t.length===0&&r.startsWith("_")||Zo(o,[...t,r],n)}function QE(e,t,n){let r=e;for(let s=0;s<t.length-1;s++){let i=t[s];if(i===void 0)return;r=(Array.isArray(r),r[i])}let o=t[t.length-1];if(!(o===void 0||r===null||typeof r!="object")){if(Array.isArray(r)){r[o]=n;return}r[o]=n}}var ey=256;function ty(e,t,n){let r=n,o=Math.max(n,e[0]?.bytes??n);for(;r<o;){let s=Math.ceil((r+o)/2),i=0;for(let a of e)a.bytes>s&&(i+=a.bytes-s);i>=t?r=s:o=s-1}return r}function ny(e,t,n){let r=Number.POSITIVE_INFINITY;for(let o=0;o<6;o++){let s=nn(e);if(s<=t)return;let i=[];Zo(e,[],i),i.sort((u,d)=>d.bytes-u.bytes);let a=i.filter(u=>u.bytes>n);if(a.length===0)return;let c=ty(a,s-t,n),l=Math.max(n,Math.min(c,r-1));if(l>=r)return;r=l;for(let u of a)u.bytes>r&&QE(e,u.path,ZE(u.value,r))}}function ry(e,t){let n=Math.max(0,t-ey),r=Object.keys(e).filter(s=>!s.startsWith("_")).map(s=>({key:s,bytes:nn(e[s])})).sort((s,i)=>i.bytes-s.bytes),o=[];for(let{key:s}of r){if(nn(e)<=n)break;delete e[s],o.push(s)}o.length>0&&(e._dropped_keys=o.slice(0,10))}function Yo(e,t){let n=nn(e);if(n<=t)return e;let r=structuredClone(e);return r._truncated=!0,r._original_bytes=n,ny(r,t,qo+XE),nn(r)>t&&ry(r,t),r}function oy(e,t,n){let r=WE(n.runnerEvent),o=n.promptCapture??Qo();for(let s of KE){if(r.has(s)||s==="prompt"&&!o)continue;let i=t[s];i!==void 0&&(e[s]=i)}}function dr(e,t,n={}){let r=es(t);if(r==="full"){let s={...e};return delete s.cwd,delete s.transcript_path,Ju(s,e,n),Yo(s,Zr)}let o=zE(e);return Ju(o,e,n),r==="content"?(oy(o,e,n),Yo(o,Zr)):Yo(o,vi)}function sy(e){return typeof e=="string"&&e.length>0}function rs(e){let t=pr(e.home),n=pr(e.launchCwd),r=e.gitRoot?pr(e.gitRoot):null,o=new Set,s=[],i=null;e.inGitRepo&&sy(e.remote)&&r!==null&&r!==t&&(i=r,o.add(r)),n!==t&&!o.has(n)&&(s.push({scope:"cwd",dir:n}),o.add(n)),i!==null&&s.push({scope:"repo",dir:i});let a=null,c=r!==null&&fr(n,r)!==null;if(e.inGitRepo&&r!==null&&r!==t&&c){let l=sl(r);for(;;){let u=pr(l);if(u===t)break;let d=sl(u);if(d===u)break;if(e.hasProjectSpec(u)){s.push({scope:"parent",dir:u}),a=tl(u,n);break}l=d}}return{anchors:s,parentRel:a}}import{existsSync as il,readdirSync as iy,realpathSync as ay}from"node:fs";import{basename as cy,dirname as uy,relative as ly,resolve as fy,sep as dy}from"node:path";var os=400,mr=class{constructor(t,n={}){this.home=t;this.pathMode=n.pathMode??"home-relative",this.maxEntries=n.maxEntries??Je}components=[];truncated=!1;pathMode;maxEntries;pluginExpandRemaining;seenRealpaths=new Set;componentPath(t){if(this.pathMode==="tilde"){let r=fy(t).split(dy).join("/");return ns(r,this.home)}let n=ly(this.home,t).replace(/\\/g,"/");return!n||n.startsWith("..")?`external/${q(uy(t))}/${cy(t)}`:n}claimFile(t){try{let n=ay(t);return this.seenRealpaths.has(n)?!1:(this.seenRealpaths.add(n),!0)}catch{return this.seenRealpaths.has(t)?!1:(this.seenRealpaths.add(t),!0)}}get atGlobalCap(){return this.truncated||this.components.length>=this.maxEntries}get pluginBudgetSpent(){return this.pluginExpandRemaining!==void 0&&this.pluginExpandRemaining<=0}readEntries(t){if(!il(t))return[];try{return iy(t,{withFileTypes:!0})}catch{return[]}}readJson(t,n){if(il(t))return ne(t,n)}push(t){return this.components.length>=this.maxEntries?(this.truncated=!0,!1):this.pluginExpandRemaining!==void 0&&this.pluginExpandRemaining<=0?!1:(this.pluginExpandRemaining!==void 0&&(this.pluginExpandRemaining-=1),this.components.push(t),!0)}withPluginExpandCap(t,n){let r=this.pluginExpandRemaining;this.pluginExpandRemaining=t;try{let o=n(),s=t-(this.pluginExpandRemaining??0);return{result:o,expanded:s}}finally{this.pluginExpandRemaining=r}}};import{existsSync as Cs,readFileSync as LR,statSync as HR}from"node:fs";import{basename as Cf,join as pt,relative as As}from"node:path";var Sf=Ve(_f());var vR=["**/node_modules/**","**/dist/**","**/build/**","**/.git/**","**/.trash/**","**/.claude/cache/**","**/.codex/skills/.system/**","**/vendor/**","**/.yarn/**","**/coverage/**","**/.next/**"],Ef=vR.map(e=>Sf.default.matcher(e,{dot:!0}));function MR(e){return e===""?!1:Ef.some(t=>t(`${e}/`))}function yf(e,t){if(t==="")return!1;if(e==="")return MR(t);let n=e.replace(/\/+$/,"");return Ef.some(r=>r(`${n}/${t}/`)&&!r(`${n}/`))}var ks=100*1024,UR=4;function DR(e){return e.length<=ks?e:`${e.slice(0,ks-1)}\u2026`}function FR(e){try{let t=LR(e),n=t.toString("utf8");return{hash:q(t),length:t.length,text:DR(n)}}catch{return null}}var Rf={HOOK:"EVENT",COMMAND:"EXPLICIT_INVOCATION",MEMORY:void 0,MCP_SERVER:void 0,PLUGIN:void 0,SKILL:"UNSPECIFIED",RULE:"UNSPECIFIED",SUBAGENT:"UNSPECIFIED"};function $R(e){return e in Rf?Rf[e]:"UNSPECIFIED"}function Pt(e,t){if(!e.claimFile(t.absolutePath))return!1;let n=FR(t.absolutePath);if(!n)return!1;let r=t.name??Cf(t.absolutePath).replace(/\.(md|mdc|toml)$/i,""),o={kind:t.kind,name:r,path:e.componentPath(t.absolutePath),text:n.text,content_hash:n.hash,content_length:n.length,origin:t.origin,enabled:t.enabled},s=$R(t.kind);return s&&(o.trigger=s),t.attributes&&(o.attributes=t.attributes),e.push(o)}function jR(e,t,n){let r=As(e,t).replace(/\\/g,"/");return!r||r.startsWith("..")?Cf(t).replace(/\.(md|mdc|toml)$/i,""):n?r.replace(/\.(md|mdc|toml)$/i,""):r}function mt(e,t){let{dir:n,kind:r,origin:o,enabled:s,nested:i,extensions:a,skipDirs:c}=t;bs(e,{walkRoot:n,currentDir:n,depth:0,kind:r,origin:o,enabled:s,nested:i,extensions:a,skipDirs:c})}function bs(e,t){let{walkRoot:n,currentDir:r,depth:o,kind:s,origin:i,enabled:a,nested:c,extensions:l,skipDirs:u}=t;if(!(o>UR))for(let d of e.readEntries(r)){if(e.atGlobalCap){e.truncated=!0;return}if(e.pluginBudgetSpent)return;if(d.isDirectory()&&yf(n.replace(/\\/g,"/"),As(n,pt(r,d.name)).replace(/\\/g,"/"))||d.isDirectory()&&u?.includes(pt(r,d.name)))continue;if(c){if(!d.isDirectory())continue;let g=pt(r,d.name,c);if(Cs(g)){let S=As(n,pt(r,d.name)).replace(/\\/g,"/");Pt(e,{absolutePath:g,kind:s,origin:i,enabled:a,name:S||d.name});continue}bs(e,{walkRoot:n,currentDir:pt(r,d.name),depth:o+1,kind:s,origin:i,enabled:a,nested:c,extensions:l,skipDirs:u});continue}if(d.isDirectory()){bs(e,{walkRoot:n,currentDir:pt(r,d.name),depth:o+1,kind:s,origin:i,enabled:a,nested:c,extensions:l,skipDirs:u});continue}if(!d.isFile()||!l)continue;let f=d.name.toLowerCase();if(!l.some(g=>f.endsWith(g)))continue;let p=pt(r,d.name);Pt(e,{absolutePath:p,kind:s,origin:i,enabled:a,name:jR(n,p,!0)})}}function Af(e){for(let t of e)if(Cs(t))try{if(HR(t).size>0)return t}catch{continue}return e.find(t=>Cs(t))}import{existsSync as _C,readFileSync as SC}from"node:fs";var Rr=Ve(rt(),1);var BR="<omitted>",KR=["package_name","package_spec","package_version","package_version_source"],kf=100,bf=120,Cr=[{raw:"tools",attr:"tools"},{raw:"autoApprove",attr:"auto_approve"},{raw:"auto_approve",attr:"auto_approve"},{raw:"alwaysAllow",attr:"always_allow"},{raw:"always_allow",attr:"always_allow"},{raw:"enabledTools",attr:"enabled_tools"},{raw:"enabled_tools",attr:"enabled_tools"},{raw:"disabledTools",attr:"disabled_tools"},{raw:"disabled_tools",attr:"disabled_tools"}],xf=new Set(Cr.map(e=>e.attr)),GR=["enabled","disabled"],WR=["serverUrl","auth","bearer_token_env_var","default_tools_approval_mode","defaultToolsApprovalMode","env_vars","env_http_headers","http_headers"],zR=new Set(["type","command","url","args","env","envVars","headers",...GR,...WR,...Cr.map(e=>e.raw)]),VR=new Set(["transport","command_or_url","args","env_var_names","headers_present","auth","bearer_token_env_var","default_tools_approval_mode","env_http_header_names",...KR,...xf,...[...xf].map(e=>`${e}_truncated`)]);function If(e,t){for(let n of t)zR.has(n)||VR.has(n)||(e[n]=BR)}var JR=/^(authorization|auth|api[-_]?key|access[-_]?token|refresh[-_]?token|secret|password|passwd|token|bearer|client[-_]?secret|client[-_]?id|private[-_]?key|signing[-_]?key)$/i,YR=/(?:^|[-_])(secret|password|passwd|token|api[-_]?key|private[-_]?key|signing[-_]?key|client[-_]?secret|client[-_]?id)(?:[-_]|$)/i,XR=/^(sk-|ghp_|gho_|github_pat_|xox[baprs]-|AKIA|ASIA|AIza|ya29\.)/,qR=/^bearer(?:\s+|$)/i;function Ar(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function Of(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}function xs(e){if(Array.isArray(e)){let n=[];for(let r of e){if(typeof r!="string"||r.length===0)continue;let o=r.split("=",1)[0]?.trim();o&&n.push(o)}return n}let t=Ar(e);return t?Object.keys(t).filter(n=>n.length>0):[]}function gt(e){try{let t=new URL(e);return`${t.origin}${t.pathname}`}catch{return e}}function ZR(e,t){if(e!==void 0&&/^https?:\/\//i.test(e)&&(0,Rr.launchContainsCredentials)({kind:"url",url:e})||(0,Rr.launchContainsCredentials)({kind:"command",command:e??"",arguments:t}))return!0;let n=ln([...t]);return t.some((r,o)=>n[o]===r?!1:/^https?:\/\//i.test(r)?(0,Rr.launchContainsCredentials)({kind:"url",url:r}):!0)}function Tf(e,t,n){ZR(t,n)&&(e.launch_had_credentials=!0)}function QR(e){return XR.test(e)||qR.test(e)?"<redacted>":e.includes("://")?gt(e):e}function Pf(e){if(/^https?:\/\//i.test(e))return gt(e);let t=e.indexOf("=");return t>0?`${e.slice(0,t+1)}${Pf(e.slice(t+1))}`:QR(e)}function eC(e){let t=e.replace(/^-+/,"").split("=",1)[0]??"";return JR.test(t)||YR.test(t)}function ln(e){let t=[],n=!1;for(let r of e){if(n){t.push("<redacted>"),n=!1;continue}if(eC(r)){t.push("<redacted>"),n=!r.includes("=");continue}t.push(Pf(r))}return t}function tC(e){let t=Of(e);if(t.length===0)return;let n=[...new Set(t.map(r=>r.length>bf?r.slice(0,bf):r))].sort();if(n.length!==0)return n.length>kf?{names:n.slice(0,kf),truncated:!0}:{names:n,truncated:!1}}function nC(e){let t=Ar(e);if(!t)return{headers:[],envVars:[]};let n=[],r=[];for(let[o,s]of Object.entries(t))o.length>0&&n.push(o),typeof s=="string"&&s.length>0&&r.push(s);return{headers:n,envVars:r}}function wf(e,t){let n=new Set;for(let{raw:r,attr:o}of Cr){if(n.has(o)||!(r in t))continue;let s=t[r];if(o==="auto_approve"&&typeof s=="boolean"){e.auto_approve=s,n.add(o);continue}let i=tC(s);i&&(e[o]=i.names,i.truncated&&(e[`${o}_truncated`]=!0),n.add(o))}}function Nf(e,t){let n=Ar(e),r={transport:t};if(!n)return r;If(r,Object.keys(n));let o=typeof n.command=="string"?n.command:void 0,s=typeof n.url=="string"?n.url:void 0,i=typeof n.serverUrl=="string"?n.serverUrl:void 0,a=o??s??i,c=Of(n.args);a&&(r.command_or_url=gt(a));let l=ln(c);l.length>0&&(r.args=l),Tf(r,a,c);let u=nC(n.env_http_headers),d=[...new Set([...xs(n.env),...xs(n.envVars),...xs(n.env_vars),...u.envVars,...typeof n.bearer_token_env_var=="string"&&n.bearer_token_env_var.length>0?[n.bearer_token_env_var]:[]])].sort();d.length>0&&(r.env_var_names=d),u.headers.length>0&&(r.env_http_header_names=[...new Set(u.headers)].sort());for(let S of["headers","http_headers","env_http_headers"])if(n[S]!==void 0&&n[S]!==null){r.headers_present=!0;break}let f=typeof n.auth=="string"?n.auth:void 0;f&&(r.auth=f);let p=typeof n.bearer_token_env_var=="string"?n.bearer_token_env_var:void 0;p&&(r.bearer_token_env_var=p);let g=typeof n.default_tools_approval_mode=="string"?n.default_tools_approval_mode:typeof n.defaultToolsApprovalMode=="string"?n.defaultToolsApprovalMode:void 0;return g&&(r.default_tools_approval_mode=g),wf(r,n),r}function vf(e){let t=Ar(e);return t?t.enabled===!1?!1:t.disabled!==!0:!0}function Ts(e,t,n=!0){let r=Object.keys(t).sort().map(o=>[o,t[o]??null]);return q(JSON.stringify({name:e,attributes:r,enabled:n}))}function wt(e){let t=e.trim();return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t}function un(e,t){let n=new RegExp(`^\\s*${t}\\s*=\\s*\\[([^\\]]*)\\]`,"m").exec(e);return n?.[1]?[...n[1].matchAll(/"([^"]*)"|'([^']*)'/g)].map(r=>r[1]??r[2]??"").filter(r=>r.length>0):[]}function Os(e,t){let n=new RegExp(`^\\s*${t}\\s*=\\s*(true|false)\\s*$`,"m").exec(e);if(n?.[1])return n[1]==="true"}function Is(e,t){let n=new RegExp(`^\\s*${t}\\s*=\\s*(.+)$`,"m").exec(e);if(!n?.[1])return;let r=wt(n[1]);return r.length>0?r:void 0}function rC(e,t){let n=[],r=i=>{for(let a of i.split(/[,\n]/)){let c=/^\s*"?([A-Za-z_][A-Za-z0-9_-]*)"?\s*=\s*(.+?)\s*$/.exec(a);c?.[1]&&n.push([c[1],wt(c[2]??"")])}},o=new RegExp(`^\\s*${t}\\s*=\\s*\\{([^}]*)\\}`,"m").exec(e);o?.[1]&&r(o[1]);let s=new RegExp(`(?:^|\\n)\\[[^\\]]*\\.${t}\\]\\s*\\n([\\s\\S]*?)(?=\\n\\[|$)`).exec(`
42
+ `)){let o=r.trim();if(!o)continue;let s=o.indexOf(" ");if(s<=0)continue;let i=o.slice(0,s).toLowerCase(),a=o.slice(s+1).trim();a&&(i==="user.name"?t=a:i==="user.email"&&(n=a))}return{git_user_name:t,git_user_email:n,platform_login:null}}async function UE(e,t=te){let n=await t("git",["config","--get-regexp","^user\\.(name|email)$"],2e3,{cwd:e});return HE(n)}function DE(e=process.env){let t=j(e.GIT_AUTHOR_NAME),n=j(e.GIT_AUTHOR_EMAIL);if(t||n)return{git_user_name:t,git_user_email:n,platform_login:null,identity_source:"git_env"};let r=j(e.GIT_COMMITTER_NAME),o=j(e.GIT_COMMITTER_EMAIL);if(r||o)return{git_user_name:r,git_user_email:o,platform_login:null,identity_source:"git_env"};let s=j(e.EMAIL);return s?{git_user_name:null,git_user_email:s,platform_login:null,identity_source:"git_env"}:null}function Ke(e,t,n,r=null){return!e&&!t&&!r?null:{git_user_name:e,git_user_email:t,platform_login:r,identity_source:n}}function FE(e=process.env){let t=j(e.EV_AI_HOOK_OPERATOR_EMAIL),n=j(e.EV_AI_HOOK_OPERATOR_LOGIN),r=Ke(j(e.EV_AI_HOOK_OPERATOR_NAME),t,"configured",t??n);if(r)return r;let o=j(e.GITHUB_ACTOR)??j(e.GITHUB_TRIGGERING_ACTOR)??j(e.GITHUB_USER),s=Ke(o,null,"github",o);if(s)return s;let i=j(e.GITLAB_USER_LOGIN),a=j(e.GITLAB_USER_EMAIL),c=Ke(j(e.GITLAB_USER_NAME)??i,a,"gitlab",a??i);if(c)return c;let l=j(e.BUILD_REQUESTEDFOREMAIL),u=Ke(j(e.BUILD_REQUESTEDFOR),l,"azure_devops",l??j(e.BUILD_REQUESTEDFORID));if(u)return u;let d=j(e.BUILDKITE_BUILD_CREATOR_EMAIL),f=Ke(j(e.BUILDKITE_BUILD_CREATOR),d,"buildkite",d);if(f)return f;let p=j(e.BUILD_USER_EMAIL)??j(e.CHANGE_AUTHOR_EMAIL),g=Ke(j(e.BUILD_USER)??j(e.CHANGE_AUTHOR),p,"jenkins",p??j(e.BUILD_USER_ID));if(g)return g;let S=j(e.CIRCLE_USERNAME),A=Ke(S,null,"circleci",S);if(A)return A;let k=j(e.CODEBUILD_INITIATOR),O=Ke(k,null,"codebuild",k);if(O)return O;let I=j(e.DRONE_COMMIT_AUTHOR_EMAIL),v=j(e.DRONE_COMMIT_AUTHOR),T=Ke(v??j(e.DRONE_COMMIT_AUTHOR_NAME),I,"drone",I??v);if(T)return T;if(zu(e.CLAUDE_CODE_REMOTE)||zu(e.CURSOR_AGENT)){let K=j(e.CURSOR_USER_EMAIL);return{git_user_name:null,git_user_email:null,platform_login:K&&!de(null,K)?K:null,identity_source:"cloud"}}return null}function Wo(e){return!!((e.git_user_name??e.git_user_email)&&!de(e.git_user_name,e.git_user_email))}function j(e){if(e===void 0)return null;let t=e.trim();return t.length>0?t:null}function zu(e){if(e===void 0||e==="")return!1;let t=e.trim().toLowerCase();return t!=="0"&&t!=="false"&&t!=="no"}function $E(e,t,n){return e==="claude"?Ou(t):e==="cursor"?Gu(t,n):e==="codex"?vu(n,t):null}async function zo(e,t=te,n=process.env,r={}){let o=await UE(e,t),s=DE(n),i=Wo(o)?o:s&&Wo(s)?s:null,a=$E(r.runnerPlatform,r.home??ME(),n);if(a)return{git_user_name:i?.git_user_name??null,git_user_email:i?.git_user_email??null,platform_login:a.platform_login,identity_source:a.identity_source};let c=FE(n);return c?.platform_login?{git_user_name:i?.git_user_name??null,git_user_email:i?.git_user_email??null,platform_login:c.platform_login,identity_source:c.identity_source}:i?{...i,platform_login:null,identity_source:Wo(o)?"git_config":"git_env"}:c||(o.git_user_name||o.git_user_email?{...o,identity_source:"git_config"}:s||{git_user_name:null,git_user_email:null,platform_login:null,identity_source:"git_config"})}async function Vo(e){let{gitRoot:t,installationStorePath:n,forceResend:r}=e,o=e.exec??te,s=e.env??process.env,i=await zo(t,o,s,{runnerPlatform:e.runnerPlatform,home:e.home}),a=LE(i.git_user_name,i.git_user_email,i.identity_source,i.platform_login),l=(n?so(n):void 0)?.operator_identity_hash;if(!(r||l!==void 0&&l!==a||!l))return{commit:()=>{}};let p=n;return{operator:i,commit:()=>{p&&oa(p,a,kn())}}}function Jo(e){return e?!so(e)?.operator_identity_hash:!0}function Vu(e){return!0}import{existsSync as tA,readFileSync as nA}from"node:fs";import{homedir as yd}from"node:os";import{join as vt,resolve as rA}from"node:path";import{basename as VC,join as Nt}from"node:path";import{dirname as sl,resolve as pr}from"node:path";import{existsSync as jE}from"node:fs";import{homedir as Xu}from"node:os";import{relative as qu,resolve as Pe,sep as ot}from"node:path";var BE=["session_id","conversation_id","turn_id","generation_id","prompt.id","prompt_id","hook_event_name","event","source","status","stop_reason","reason","tool_name","tool","tool_use_id","skill_name","command_name","expansion_type","command_source","permission_mode","model","model_id","agent_id","agent_type","subagent_id","subagent_type","subagent_model","is_parallel_worker","effort","effort.level","duration_ms","duration","sandbox","failure_type","is_interrupt"],KE=["prompt","tool_input","tool_response","last_assistant_message","command"],GE=new Set;function WE(e){switch(e?.toLowerCase()){case"beforemcpexecution":return new Set(["command"]);case"stopfailure":return new Set(["last_assistant_message"]);default:return GE}}var Zu=new Set(["on","1","true"]);function Qo(e){let t=M("EV_AI_HOOK_CAPTURE_PROMPT")?.trim();return t!==void 0&&t!==""?Zu.has(t.toLowerCase()):e?.collect_prompt===!0}function Qu(e,t){let n=es(e);if(n==="allowlist")return"off";if(n==="full")return"full";let r=M("EV_AI_HOOK_CAPTURE_PROMPT")?.trim();return r!==void 0&&r!==""?Zu.has(r.toLowerCase())?"env":"off":t?.collect_prompt===!0?"config":"off"}function el(e){return es(e)==="allowlist"}function es(e){return M("EV_AI_HOOK_CAPTURE_CONTENT")?.toLowerCase()==="off"||e.capture_hook_input==="allowlist"?"allowlist":e.capture_hook_input==="full"||e.debug===!0||M("EV_AI_HOOK_CAPTURE_FULL_INPUT")==="1"?"full":"content"}function zE(e){let t={};for(let n of BE){let r=He(e,n);r!==void 0&&(t[n]=r)}return t}function fr(e,t){if(typeof e!="string"||e.length===0||!t)return null;let n=Pe(e),r=Pe(t),o=qu(r,n);return!o||o==="."?".":o.startsWith(`..${ot}`)||o===".."||Pe(r,o)!==n?null:o.split(ot).join("/")}function tl(e,t){let n=qu(Pe(t),Pe(e)).split(ot).join("/");return!n||n==="."?null:n===".."||n.startsWith("../")&&n.split("/").every(r=>r==="..")?n:null}function nl(e){return typeof e!="string"||e.length===0?null:Pe(e).split(ot).join("/")}function VE(){let e=M("CURSOR_PROJECT_DIR");if(!e)return null;let t=Pe(e);return jE(t)?t.split(ot).join("/"):null}function Xo(e,t){return fr(e,t)!==null}function JE(e,t){let n=Pe(t??Xu(),".cursor").split(ot).join("/");return Xo(e,n)}function YE(e,t,n){return t!==null&&Xo(e,t)?!0:t!==null&&JE(e,n.home)?!1:n.inGitRepo===!0&&n.gitRoot!==void 0&&Xo(e,n.gitRoot)?!0:t===null}function rl(e,t){let n=nl(e.cwd);if(n!==null)return n;let r=Pe(process.cwd()).split(ot).join("/"),o=VE();return YE(r,o,t)?r:o??r}function ts(e,t={}){return rl(e,t)}function ns(e,t=Xu()){let n=Pe(t).split(ot).join("/").replace(/\/$/,"");return n.length<=1?e:e===n?"~":e.startsWith(`${n}/`)?`~${e.slice(n.length)}`:e}function Ju(e,t,n){let r=nl(n.launchCwd)??rl(t,n);e.cwd=ns(r,n.home);let o=n.inGitRepo===!0&&n.gitRoot!==void 0?fr(r,n.gitRoot):null;o!==null&&(e.cwd_relative=o)}var ol="\u2026[truncated]\u2026",qo=Buffer.byteLength(ol,"utf8"),XE=8;function nn(e){return Buffer.byteLength(JSON.stringify(e),"utf8")}function Yu(e,t){if(t<=0)return"";let n=Buffer.from(e,"utf8");return n.length<=t?e:n.subarray(0,t).toString("utf8")}function qE(e,t){if(t<=0)return"";let n=Buffer.from(e,"utf8");return n.length<=t?e:n.subarray(n.length-t).toString("utf8")}function ZE(e,t){if(Buffer.byteLength(e,"utf8")<=t)return e;if(t<=qo)return Yu(e,t);let r=t-qo,o=Math.ceil(r/2),s=Math.floor(r/2);return`${Yu(e,o)}${ol}${qE(e,s)}`}function Zo(e,t,n){if(typeof e=="string"){n.push({path:t,value:e,bytes:Buffer.byteLength(e,"utf8")});return}if(Array.isArray(e)){e.forEach((r,o)=>{Zo(r,[...t,o],n)});return}if(e!==null&&typeof e=="object")for(let[r,o]of Object.entries(e))t.length===0&&r.startsWith("_")||Zo(o,[...t,r],n)}function QE(e,t,n){let r=e;for(let s=0;s<t.length-1;s++){let i=t[s];if(i===void 0)return;r=(Array.isArray(r),r[i])}let o=t[t.length-1];if(!(o===void 0||r===null||typeof r!="object")){if(Array.isArray(r)){r[o]=n;return}r[o]=n}}var ey=256;function ty(e,t,n){let r=n,o=Math.max(n,e[0]?.bytes??n);for(;r<o;){let s=Math.ceil((r+o)/2),i=0;for(let a of e)a.bytes>s&&(i+=a.bytes-s);i>=t?r=s:o=s-1}return r}function ny(e,t,n){let r=Number.POSITIVE_INFINITY;for(let o=0;o<6;o++){let s=nn(e);if(s<=t)return;let i=[];Zo(e,[],i),i.sort((u,d)=>d.bytes-u.bytes);let a=i.filter(u=>u.bytes>n);if(a.length===0)return;let c=ty(a,s-t,n),l=Math.max(n,Math.min(c,r-1));if(l>=r)return;r=l;for(let u of a)u.bytes>r&&QE(e,u.path,ZE(u.value,r))}}function ry(e,t){let n=Math.max(0,t-ey),r=Object.keys(e).filter(s=>!s.startsWith("_")).map(s=>({key:s,bytes:nn(e[s])})).sort((s,i)=>i.bytes-s.bytes),o=[];for(let{key:s}of r){if(nn(e)<=n)break;delete e[s],o.push(s)}o.length>0&&(e._dropped_keys=o.slice(0,10))}function Yo(e,t){let n=nn(e);if(n<=t)return e;let r=structuredClone(e);return r._truncated=!0,r._original_bytes=n,ny(r,t,qo+XE),nn(r)>t&&ry(r,t),r}function oy(e,t,n){if(!(n.promptCapture??Qo()))return;let r=WE(n.runnerEvent);for(let o of KE){if(r.has(o))continue;let s=t[o];s!==void 0&&(e[o]=s)}}function dr(e,t,n={}){let r=es(t);if(r==="full"){let s={...e};return delete s.cwd,delete s.transcript_path,Ju(s,e,n),Yo(s,Zr)}let o=zE(e);return Ju(o,e,n),r==="content"?(oy(o,e,n),Yo(o,Zr)):Yo(o,vi)}function sy(e){return typeof e=="string"&&e.length>0}function rs(e){let t=pr(e.home),n=pr(e.launchCwd),r=e.gitRoot?pr(e.gitRoot):null,o=new Set,s=[],i=null;e.inGitRepo&&sy(e.remote)&&r!==null&&r!==t&&(i=r,o.add(r)),n!==t&&!o.has(n)&&(s.push({scope:"cwd",dir:n}),o.add(n)),i!==null&&s.push({scope:"repo",dir:i});let a=null,c=r!==null&&fr(n,r)!==null;if(e.inGitRepo&&r!==null&&r!==t&&c){let l=sl(r);for(;;){let u=pr(l);if(u===t)break;let d=sl(u);if(d===u)break;if(e.hasProjectSpec(u)){s.push({scope:"parent",dir:u}),a=tl(u,n);break}l=d}}return{anchors:s,parentRel:a}}import{existsSync as il,readdirSync as iy,realpathSync as ay}from"node:fs";import{basename as cy,dirname as uy,relative as ly,resolve as fy,sep as dy}from"node:path";var os=400,mr=class{constructor(t,n={}){this.home=t;this.pathMode=n.pathMode??"home-relative",this.maxEntries=n.maxEntries??Je}components=[];truncated=!1;pathMode;maxEntries;pluginExpandRemaining;seenRealpaths=new Set;componentPath(t){if(this.pathMode==="tilde"){let r=fy(t).split(dy).join("/");return ns(r,this.home)}let n=ly(this.home,t).replace(/\\/g,"/");return!n||n.startsWith("..")?`external/${q(uy(t))}/${cy(t)}`:n}claimFile(t){try{let n=ay(t);return this.seenRealpaths.has(n)?!1:(this.seenRealpaths.add(n),!0)}catch{return this.seenRealpaths.has(t)?!1:(this.seenRealpaths.add(t),!0)}}get atGlobalCap(){return this.truncated||this.components.length>=this.maxEntries}get pluginBudgetSpent(){return this.pluginExpandRemaining!==void 0&&this.pluginExpandRemaining<=0}readEntries(t){if(!il(t))return[];try{return iy(t,{withFileTypes:!0})}catch{return[]}}readJson(t,n){if(il(t))return ne(t,n)}push(t){return this.components.length>=this.maxEntries?(this.truncated=!0,!1):this.pluginExpandRemaining!==void 0&&this.pluginExpandRemaining<=0?!1:(this.pluginExpandRemaining!==void 0&&(this.pluginExpandRemaining-=1),this.components.push(t),!0)}withPluginExpandCap(t,n){let r=this.pluginExpandRemaining;this.pluginExpandRemaining=t;try{let o=n(),s=t-(this.pluginExpandRemaining??0);return{result:o,expanded:s}}finally{this.pluginExpandRemaining=r}}};import{existsSync as Cs,readFileSync as LR,statSync as HR}from"node:fs";import{basename as Cf,join as pt,relative as As}from"node:path";var Sf=Ve(_f());var vR=["**/node_modules/**","**/dist/**","**/build/**","**/.git/**","**/.trash/**","**/.claude/cache/**","**/.codex/skills/.system/**","**/vendor/**","**/.yarn/**","**/coverage/**","**/.next/**"],Ef=vR.map(e=>Sf.default.matcher(e,{dot:!0}));function MR(e){return e===""?!1:Ef.some(t=>t(`${e}/`))}function yf(e,t){if(t==="")return!1;if(e==="")return MR(t);let n=e.replace(/\/+$/,"");return Ef.some(r=>r(`${n}/${t}/`)&&!r(`${n}/`))}var ks=100*1024,UR=4;function DR(e){return e.length<=ks?e:`${e.slice(0,ks-1)}\u2026`}function FR(e){try{let t=LR(e),n=t.toString("utf8");return{hash:q(t),length:t.length,text:DR(n)}}catch{return null}}var Rf={HOOK:"EVENT",COMMAND:"EXPLICIT_INVOCATION",MEMORY:void 0,MCP_SERVER:void 0,PLUGIN:void 0,SKILL:"UNSPECIFIED",RULE:"UNSPECIFIED",SUBAGENT:"UNSPECIFIED"};function $R(e){return e in Rf?Rf[e]:"UNSPECIFIED"}function Pt(e,t){if(!e.claimFile(t.absolutePath))return!1;let n=FR(t.absolutePath);if(!n)return!1;let r=t.name??Cf(t.absolutePath).replace(/\.(md|mdc|toml)$/i,""),o={kind:t.kind,name:r,path:e.componentPath(t.absolutePath),text:n.text,content_hash:n.hash,content_length:n.length,origin:t.origin,enabled:t.enabled},s=$R(t.kind);return s&&(o.trigger=s),t.attributes&&(o.attributes=t.attributes),e.push(o)}function jR(e,t,n){let r=As(e,t).replace(/\\/g,"/");return!r||r.startsWith("..")?Cf(t).replace(/\.(md|mdc|toml)$/i,""):n?r.replace(/\.(md|mdc|toml)$/i,""):r}function mt(e,t){let{dir:n,kind:r,origin:o,enabled:s,nested:i,extensions:a,skipDirs:c}=t;bs(e,{walkRoot:n,currentDir:n,depth:0,kind:r,origin:o,enabled:s,nested:i,extensions:a,skipDirs:c})}function bs(e,t){let{walkRoot:n,currentDir:r,depth:o,kind:s,origin:i,enabled:a,nested:c,extensions:l,skipDirs:u}=t;if(!(o>UR))for(let d of e.readEntries(r)){if(e.atGlobalCap){e.truncated=!0;return}if(e.pluginBudgetSpent)return;if(d.isDirectory()&&yf(n.replace(/\\/g,"/"),As(n,pt(r,d.name)).replace(/\\/g,"/"))||d.isDirectory()&&u?.includes(pt(r,d.name)))continue;if(c){if(!d.isDirectory())continue;let g=pt(r,d.name,c);if(Cs(g)){let S=As(n,pt(r,d.name)).replace(/\\/g,"/");Pt(e,{absolutePath:g,kind:s,origin:i,enabled:a,name:S||d.name});continue}bs(e,{walkRoot:n,currentDir:pt(r,d.name),depth:o+1,kind:s,origin:i,enabled:a,nested:c,extensions:l,skipDirs:u});continue}if(d.isDirectory()){bs(e,{walkRoot:n,currentDir:pt(r,d.name),depth:o+1,kind:s,origin:i,enabled:a,nested:c,extensions:l,skipDirs:u});continue}if(!d.isFile()||!l)continue;let f=d.name.toLowerCase();if(!l.some(g=>f.endsWith(g)))continue;let p=pt(r,d.name);Pt(e,{absolutePath:p,kind:s,origin:i,enabled:a,name:jR(n,p,!0)})}}function Af(e){for(let t of e)if(Cs(t))try{if(HR(t).size>0)return t}catch{continue}return e.find(t=>Cs(t))}import{existsSync as _C,readFileSync as SC}from"node:fs";var Rr=Ve(rt(),1);var BR="<omitted>",KR=["package_name","package_spec","package_version","package_version_source"],kf=100,bf=120,Cr=[{raw:"tools",attr:"tools"},{raw:"autoApprove",attr:"auto_approve"},{raw:"auto_approve",attr:"auto_approve"},{raw:"alwaysAllow",attr:"always_allow"},{raw:"always_allow",attr:"always_allow"},{raw:"enabledTools",attr:"enabled_tools"},{raw:"enabled_tools",attr:"enabled_tools"},{raw:"disabledTools",attr:"disabled_tools"},{raw:"disabled_tools",attr:"disabled_tools"}],xf=new Set(Cr.map(e=>e.attr)),GR=["enabled","disabled"],WR=["serverUrl","auth","bearer_token_env_var","default_tools_approval_mode","defaultToolsApprovalMode","env_vars","env_http_headers","http_headers"],zR=new Set(["type","command","url","args","env","envVars","headers",...GR,...WR,...Cr.map(e=>e.raw)]),VR=new Set(["transport","command_or_url","args","env_var_names","headers_present","auth","bearer_token_env_var","default_tools_approval_mode","env_http_header_names",...KR,...xf,...[...xf].map(e=>`${e}_truncated`)]);function If(e,t){for(let n of t)zR.has(n)||VR.has(n)||(e[n]=BR)}var JR=/^(authorization|auth|api[-_]?key|access[-_]?token|refresh[-_]?token|secret|password|passwd|token|bearer|client[-_]?secret|client[-_]?id|private[-_]?key|signing[-_]?key)$/i,YR=/(?:^|[-_])(secret|password|passwd|token|api[-_]?key|private[-_]?key|signing[-_]?key|client[-_]?secret|client[-_]?id)(?:[-_]|$)/i,XR=/^(sk-|ghp_|gho_|github_pat_|xox[baprs]-|AKIA|ASIA|AIza|ya29\.)/,qR=/^bearer(?:\s+|$)/i;function Ar(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function Of(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}function xs(e){if(Array.isArray(e)){let n=[];for(let r of e){if(typeof r!="string"||r.length===0)continue;let o=r.split("=",1)[0]?.trim();o&&n.push(o)}return n}let t=Ar(e);return t?Object.keys(t).filter(n=>n.length>0):[]}function gt(e){try{let t=new URL(e);return`${t.origin}${t.pathname}`}catch{return e}}function ZR(e,t){if(e!==void 0&&/^https?:\/\//i.test(e)&&(0,Rr.launchContainsCredentials)({kind:"url",url:e})||(0,Rr.launchContainsCredentials)({kind:"command",command:e??"",arguments:t}))return!0;let n=ln([...t]);return t.some((r,o)=>n[o]===r?!1:/^https?:\/\//i.test(r)?(0,Rr.launchContainsCredentials)({kind:"url",url:r}):!0)}function Tf(e,t,n){ZR(t,n)&&(e.launch_had_credentials=!0)}function QR(e){return XR.test(e)||qR.test(e)?"<redacted>":e.includes("://")?gt(e):e}function Pf(e){if(/^https?:\/\//i.test(e))return gt(e);let t=e.indexOf("=");return t>0?`${e.slice(0,t+1)}${Pf(e.slice(t+1))}`:QR(e)}function eC(e){let t=e.replace(/^-+/,"").split("=",1)[0]??"";return JR.test(t)||YR.test(t)}function ln(e){let t=[],n=!1;for(let r of e){if(n){t.push("<redacted>"),n=!1;continue}if(eC(r)){t.push("<redacted>"),n=!r.includes("=");continue}t.push(Pf(r))}return t}function tC(e){let t=Of(e);if(t.length===0)return;let n=[...new Set(t.map(r=>r.length>bf?r.slice(0,bf):r))].sort();if(n.length!==0)return n.length>kf?{names:n.slice(0,kf),truncated:!0}:{names:n,truncated:!1}}function nC(e){let t=Ar(e);if(!t)return{headers:[],envVars:[]};let n=[],r=[];for(let[o,s]of Object.entries(t))o.length>0&&n.push(o),typeof s=="string"&&s.length>0&&r.push(s);return{headers:n,envVars:r}}function wf(e,t){let n=new Set;for(let{raw:r,attr:o}of Cr){if(n.has(o)||!(r in t))continue;let s=t[r];if(o==="auto_approve"&&typeof s=="boolean"){e.auto_approve=s,n.add(o);continue}let i=tC(s);i&&(e[o]=i.names,i.truncated&&(e[`${o}_truncated`]=!0),n.add(o))}}function Nf(e,t){let n=Ar(e),r={transport:t};if(!n)return r;If(r,Object.keys(n));let o=typeof n.command=="string"?n.command:void 0,s=typeof n.url=="string"?n.url:void 0,i=typeof n.serverUrl=="string"?n.serverUrl:void 0,a=o??s??i,c=Of(n.args);a&&(r.command_or_url=gt(a));let l=ln(c);l.length>0&&(r.args=l),Tf(r,a,c);let u=nC(n.env_http_headers),d=[...new Set([...xs(n.env),...xs(n.envVars),...xs(n.env_vars),...u.envVars,...typeof n.bearer_token_env_var=="string"&&n.bearer_token_env_var.length>0?[n.bearer_token_env_var]:[]])].sort();d.length>0&&(r.env_var_names=d),u.headers.length>0&&(r.env_http_header_names=[...new Set(u.headers)].sort());for(let S of["headers","http_headers","env_http_headers"])if(n[S]!==void 0&&n[S]!==null){r.headers_present=!0;break}let f=typeof n.auth=="string"?n.auth:void 0;f&&(r.auth=f);let p=typeof n.bearer_token_env_var=="string"?n.bearer_token_env_var:void 0;p&&(r.bearer_token_env_var=p);let g=typeof n.default_tools_approval_mode=="string"?n.default_tools_approval_mode:typeof n.defaultToolsApprovalMode=="string"?n.defaultToolsApprovalMode:void 0;return g&&(r.default_tools_approval_mode=g),wf(r,n),r}function vf(e){let t=Ar(e);return t?t.enabled===!1?!1:t.disabled!==!0:!0}function Ts(e,t,n=!0){let r=Object.keys(t).sort().map(o=>[o,t[o]??null]);return q(JSON.stringify({name:e,attributes:r,enabled:n}))}function wt(e){let t=e.trim();return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t}function un(e,t){let n=new RegExp(`^\\s*${t}\\s*=\\s*\\[([^\\]]*)\\]`,"m").exec(e);return n?.[1]?[...n[1].matchAll(/"([^"]*)"|'([^']*)'/g)].map(r=>r[1]??r[2]??"").filter(r=>r.length>0):[]}function Os(e,t){let n=new RegExp(`^\\s*${t}\\s*=\\s*(true|false)\\s*$`,"m").exec(e);if(n?.[1])return n[1]==="true"}function Is(e,t){let n=new RegExp(`^\\s*${t}\\s*=\\s*(.+)$`,"m").exec(e);if(!n?.[1])return;let r=wt(n[1]);return r.length>0?r:void 0}function rC(e,t){let n=[],r=i=>{for(let a of i.split(/[,\n]/)){let c=/^\s*"?([A-Za-z_][A-Za-z0-9_-]*)"?\s*=\s*(.+?)\s*$/.exec(a);c?.[1]&&n.push([c[1],wt(c[2]??"")])}},o=new RegExp(`^\\s*${t}\\s*=\\s*\\{([^}]*)\\}`,"m").exec(e);o?.[1]&&r(o[1]);let s=new RegExp(`(?:^|\\n)\\[[^\\]]*\\.${t}\\]\\s*\\n([\\s\\S]*?)(?=\\n\\[|$)`).exec(`
43
43
  ${e}`);return s?.[1]&&r(s[1]),n}function Mf(e){return Os(e,"enabled")===!1?!1:Os(e,"disabled")!==!0}function oC(e,t){let n={};for(let{raw:r,attr:o}of Cr){if(o==="auto_approve"){let i=Os(t,r);if(i!==void 0){n[r]=i;continue}}let s=un(t,r);s.length>0&&(n[r]=s)}wf(e,n)}var sC=/^\s*([A-Za-z_][A-Za-z0-9_-]*)\s*[.=]/,iC=/^\[[^\]]*\.([A-Za-z_][A-Za-z0-9_-]*)\]\s*$/gm;function aC(e){let t=new Set,n=e.search(/^\[/m),r=n===-1?e:e.slice(0,n);for(let o of r.split(`
44
44
  `)){let s=sC.exec(o);s?.[1]&&t.add(s[1])}for(let o of e.matchAll(iC))o[1]&&t.add(o[1]);return[...t]}function Lf(e,t){let n={transport:t};If(n,aC(e));let r=/^\s*command\s*=\s*(.+)$/m.exec(e),o=/^\s*url\s*=\s*(.+)$/m.exec(e),s=r?wt(r[1]??""):void 0,i=o?wt(o[1]??""):void 0,a=s!==void 0&&s.length>0?s:i,c=un(e,"args");a&&(n.command_or_url=gt(a));let l=ln(c);l.length>0&&(n.args=l),Tf(n,a,c);let u=new Set;for(let k of e.split(`
45
45
  `)){let O=/^\s*env\.([A-Za-z_][A-Za-z0-9_]*)\s*=/.exec(k);O?.[1]&&u.add(O[1])}let d=/^\s*env\s*=\s*\{([^}]*)\}/m.exec(e);if(d?.[1])for(let k of d[1].split(",")){let O=/^\s*([A-Za-z_][A-Za-z0-9_]*)\s*=/.exec(k);O?.[1]&&u.add(O[1])}let f=/(?:^|\n)\[[^\]]*env\]\s*\n([\s\S]*?)(?=\n\[|$)/.exec(`
package/dist/hook.mjs CHANGED
@@ -11,7 +11,7 @@ var mp=Object.create;var Ns=Object.defineProperty;var gp=Object.getOwnPropertyDe
11
11
  `),n=!1;return t.map(o=>n?ha.test(o)?(n=!1,o):o.trim().length===0?o:Z.COMPONENT_SOURCE_REDACTION_PLACEHOLDER:fg.test(o)&&!ha.test(o)?(n=!0,o):pg(o)).join(`
12
12
  `)}function dg(e){return Wr(e)!==e}});var Je=W(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.redactComponentSource=E.prepareComponentInspectionText=E.fitSnapshotInspectionTextBudget=E.componentSourceContainsRedactableSecret=E.capComponentTextBytes=E.SNAPSHOT_INSPECTION_TEXT_MAX_BYTES=E.COMPONENT_SOURCE_REDACTION_PLACEHOLDER=E.COMPONENT_INSPECTION_TEXT_MAX_BYTES=E.usableCatalogText=E.parseFrontmatterField=E.parseFrontmatterDescription=E.mcpServerToolSegmentForms=E.mcpServerNameMatchesToolSegment=E.isNpmRegistryPublisher=E.EMPTY_NPM_PUBLISHER=E.displayPublisherName=E.classifyMcpProvenance=E.resolveMcpPackageIdentity=E.McpPackageEcosystem=E.pinnedPackageVersionFromSpec=E.pinnedPackageVersionFromNpx=E.packageNameFromSpec=E.npxPackageSpecs=E.npxExecBin=E.PACKAGE_FIELD_MAX=E.serializeMcpLaunchIdentity=E.projectMcpMissingLaunchIdentity=E.projectMcpLaunchIdentity=E.normalizeMcpToolNames=E.MCP_MISSING_LAUNCH_SERIALIZED=E.MCP_LAUNCH_IDENTITY_ALGORITHM=E.maskMcpLaunchForDisplay=E.launchContainsCredentials=E.hashMcpLaunchIdentity=E.foldMcpName=E.buildMcpFamilyCanonicalKey=E.ComponentKind=void 0;E.userConfigRootFromPath=Ag;E.installationRootExternalKey=Ig;E.normalizeRepositoryRelativePath=ya;E.nativeKeyForSkillPath=bg;E.nativeKeyForRulePath=xg;E.nativeKeyForCommandPath=Og;E.serializeComponentIdentity=Ca;E.buildComponentReference=kg;E.validateComponentReference=Pg;var mg=$e("node:crypto"),gg=$e("node:path"),_g="cmp1_",hg=/^cmp1_[A-Za-z0-9_-]{43}$/,Sg=["/skills/","/skills-cursor/"],Eg=/(?:^|\/)\.(?:cursor|claude|codex)\/rules\/(.+)$/i,yg=/(?:^|\/)\.(?:cursor|claude|codex)\/(?:commands|prompts)\/(.+)$/i,Rg=[".cursor",".claude",".codex"],Cg={".claude.json":".claude",".agents":".codex"};E.ComponentKind={SKILL:"SKILL",INTERFACE:"INTERFACE",RULE:"RULE",COMMAND:"COMMAND"};function Ag(e){let t=e.replaceAll("\\","/").split("/").filter(Boolean),n=t.find(o=>Rg.includes(o));return n||(t.map(o=>Cg[o]).find(o=>o!==void 0)??"unknown")}function Ig(e,t){return`runtime-install:${e}/${t}`}function Mn(e,t){if(e.length===0)throw new Error(`${t} is required`);return e}function ya(e){let t=e.replaceAll("\\","/");if(t.startsWith("/")||/^[A-Za-z]:\//.test(t))throw new Error("sourcePath must be repository-relative");let n=gg.posix.normalize(t).replace(/^\.\//,"");if(n==="."||n===".."||n.startsWith("../"))throw new Error("sourcePath must be repository-relative");return Mn(n,"sourcePath")}function bg(e){let t=e.replaceAll("\\","/");for(let n of Sg){let r=t.split(n)[1]?.split("/")[0];if(r&&r.length>0)return r}return null}function Ra(e,t,n){let r=e.replaceAll("\\","/"),s=t.exec(r)?.[1];if(!s||s.split("/").includes(".."))return null;let i=s.replace(n,"");return i.length>0?i:null}function xg(e){return Ra(e,Eg,/\.(mdc|md|rules)$/i)}function Og(e){return Ra(e,yg,/\.(md|mdc|toml)$/i)}function Tg(e){return`${Buffer.byteLength(e,"utf8")}:${e}`}function Ca(e){let t=[Mn(e.installationRootExternalKey,"installationRootExternalKey"),Mn(e.installableKind,"installableKind"),ya(e.sourcePath),Mn(e.nativeKey,"nativeKey")];return Buffer.from(`1|${t.map(Tg).join("|")}`,"utf8")}function kg(e){let t=(0,mg.createHash)("sha256").update(Ca(e)).digest("base64url");return`${_g}${t}`}function Pg(e){return hg.test(e)}var Re=kn();Object.defineProperty(E,"buildMcpFamilyCanonicalKey",{enumerable:!0,get:function(){return Re.buildMcpFamilyCanonicalKey}});Object.defineProperty(E,"foldMcpName",{enumerable:!0,get:function(){return Re.foldMcpName}});Object.defineProperty(E,"hashMcpLaunchIdentity",{enumerable:!0,get:function(){return Re.hashMcpLaunchIdentity}});Object.defineProperty(E,"launchContainsCredentials",{enumerable:!0,get:function(){return Re.launchContainsCredentials}});Object.defineProperty(E,"maskMcpLaunchForDisplay",{enumerable:!0,get:function(){return Re.maskMcpLaunchForDisplay}});Object.defineProperty(E,"MCP_LAUNCH_IDENTITY_ALGORITHM",{enumerable:!0,get:function(){return Re.MCP_LAUNCH_IDENTITY_ALGORITHM}});Object.defineProperty(E,"MCP_MISSING_LAUNCH_SERIALIZED",{enumerable:!0,get:function(){return Re.MCP_MISSING_LAUNCH_SERIALIZED}});Object.defineProperty(E,"normalizeMcpToolNames",{enumerable:!0,get:function(){return Re.normalizeMcpToolNames}});Object.defineProperty(E,"projectMcpLaunchIdentity",{enumerable:!0,get:function(){return Re.projectMcpLaunchIdentity}});Object.defineProperty(E,"projectMcpMissingLaunchIdentity",{enumerable:!0,get:function(){return Re.projectMcpMissingLaunchIdentity}});Object.defineProperty(E,"serializeMcpLaunchIdentity",{enumerable:!0,get:function(){return Re.serializeMcpLaunchIdentity}});var gt=Nn();Object.defineProperty(E,"PACKAGE_FIELD_MAX",{enumerable:!0,get:function(){return gt.PACKAGE_FIELD_MAX}});Object.defineProperty(E,"npxExecBin",{enumerable:!0,get:function(){return gt.npxExecBin}});Object.defineProperty(E,"npxPackageSpecs",{enumerable:!0,get:function(){return gt.npxPackageSpecs}});Object.defineProperty(E,"packageNameFromSpec",{enumerable:!0,get:function(){return gt.packageNameFromSpec}});Object.defineProperty(E,"pinnedPackageVersionFromNpx",{enumerable:!0,get:function(){return gt.pinnedPackageVersionFromNpx}});Object.defineProperty(E,"pinnedPackageVersionFromSpec",{enumerable:!0,get:function(){return gt.pinnedPackageVersionFromSpec}});var Aa=aa();Object.defineProperty(E,"McpPackageEcosystem",{enumerable:!0,get:function(){return Aa.McpPackageEcosystem}});Object.defineProperty(E,"resolveMcpPackageIdentity",{enumerable:!0,get:function(){return Aa.resolveMcpPackageIdentity}});var Ln=da();Object.defineProperty(E,"classifyMcpProvenance",{enumerable:!0,get:function(){return Ln.classifyMcpProvenance}});Object.defineProperty(E,"displayPublisherName",{enumerable:!0,get:function(){return Ln.displayPublisherName}});Object.defineProperty(E,"EMPTY_NPM_PUBLISHER",{enumerable:!0,get:function(){return Ln.EMPTY_NPM_PUBLISHER}});Object.defineProperty(E,"isNpmRegistryPublisher",{enumerable:!0,get:function(){return Ln.isNpmRegistryPublisher}});var Ia=ga();Object.defineProperty(E,"mcpServerNameMatchesToolSegment",{enumerable:!0,get:function(){return Ia.mcpServerNameMatchesToolSegment}});Object.defineProperty(E,"mcpServerToolSegmentForms",{enumerable:!0,get:function(){return Ia.mcpServerToolSegmentForms}});var Vr=_a();Object.defineProperty(E,"parseFrontmatterDescription",{enumerable:!0,get:function(){return Vr.parseFrontmatterDescription}});Object.defineProperty(E,"parseFrontmatterField",{enumerable:!0,get:function(){return Vr.parseFrontmatterField}});Object.defineProperty(E,"usableCatalogText",{enumerable:!0,get:function(){return Vr.usableCatalogText}});var Ve=Ea();Object.defineProperty(E,"COMPONENT_INSPECTION_TEXT_MAX_BYTES",{enumerable:!0,get:function(){return Ve.COMPONENT_INSPECTION_TEXT_MAX_BYTES}});Object.defineProperty(E,"COMPONENT_SOURCE_REDACTION_PLACEHOLDER",{enumerable:!0,get:function(){return Ve.COMPONENT_SOURCE_REDACTION_PLACEHOLDER}});Object.defineProperty(E,"SNAPSHOT_INSPECTION_TEXT_MAX_BYTES",{enumerable:!0,get:function(){return Ve.SNAPSHOT_INSPECTION_TEXT_MAX_BYTES}});Object.defineProperty(E,"capComponentTextBytes",{enumerable:!0,get:function(){return Ve.capComponentTextBytes}});Object.defineProperty(E,"componentSourceContainsRedactableSecret",{enumerable:!0,get:function(){return Ve.componentSourceContainsRedactableSecret}});Object.defineProperty(E,"fitSnapshotInspectionTextBudget",{enumerable:!0,get:function(){return Ve.fitSnapshotInspectionTextBudget}});Object.defineProperty(E,"prepareComponentInspectionText",{enumerable:!0,get:function(){return Ve.prepareComponentInspectionText}});Object.defineProperty(E,"redactComponentSource",{enumerable:!0,get:function(){return Ve.redactComponentSource}})});var Jn=W(Se=>{"use strict";Se.isInteger=e=>typeof e=="number"?Number.isInteger(e):typeof e=="string"&&e.trim()!==""?Number.isInteger(Number(e)):!1;Se.find=(e,t)=>e.nodes.find(n=>n.type===t);Se.exceedsLimit=(e,t,n=1,r)=>r===!1||!Se.isInteger(e)||!Se.isInteger(t)?!1:(Number(t)-Number(e))/Number(n)>=r;Se.escapeNode=(e,t=0,n)=>{let r=e.nodes[t];r&&(n&&r.type===n||r.type==="open"||r.type==="close")&&r.escaped!==!0&&(r.value="\\"+r.value,r.escaped=!0)};Se.encloseBrace=e=>e.type!=="brace"?!1:e.commas>>0+e.ranges>>0===0?(e.invalid=!0,!0):!1;Se.isInvalidBrace=e=>e.type!=="brace"?!1:e.invalid===!0||e.dollar?!0:e.commas>>0+e.ranges>>0===0||e.open!==!0||e.close!==!0?(e.invalid=!0,!0):!1;Se.isOpenOrClose=e=>e.type==="open"||e.type==="close"?!0:e.open===!0||e.close===!0;Se.reduce=e=>e.reduce((t,n)=>(n.type==="text"&&t.push(n.value),n.type==="range"&&(n.type="text"),t),[]);Se.flatten=(...e)=>{let t=[],n=r=>{for(let o=0;o<r.length;o++){let s=r[o];if(Array.isArray(s)){n(s);continue}s!==void 0&&t.push(s)}return t};return n(e),t}});var Yn=W((ux,su)=>{"use strict";var ou=Jn();su.exports=(e,t={})=>{let n=(r,o={})=>{let s=t.escapeInvalid&&ou.isInvalidBrace(o),i=r.invalid===!0&&t.escapeInvalid===!0,a="";if(r.value)return(s||i)&&ou.isOpenOrClose(r)?"\\"+r.value:r.value;if(r.value)return r.value;if(r.nodes)for(let c of r.nodes)a+=n(c);return a};return n(e)}});var au=W((lx,iu)=>{"use strict";iu.exports=function(e){return typeof e=="number"?e-e===0:typeof e=="string"&&e.trim()!==""?Number.isFinite?Number.isFinite(+e):isFinite(+e):!1}});var _u=W((fx,gu)=>{"use strict";var cu=au(),nt=(e,t,n)=>{if(cu(e)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(t===void 0||e===t)return String(e);if(cu(t)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let r={relaxZeros:!0,...n};typeof r.strictZeros=="boolean"&&(r.relaxZeros=r.strictZeros===!1);let o=String(r.relaxZeros),s=String(r.shorthand),i=String(r.capture),a=String(r.wrap),c=e+":"+t+"="+o+s+i+a;if(nt.cache.hasOwnProperty(c))return nt.cache[c].result;let u=Math.min(e,t),l=Math.max(e,t);if(Math.abs(u-l)===1){let S=e+"|"+t;return r.capture?`(${S})`:r.wrap===!1?S:`(?:${S})`}let p=mu(e)||mu(t),f={min:e,max:t,a:u,b:l},m=[],g=[];if(p&&(f.isPadded=p,f.maxLen=String(f.max).length),u<0){let S=l<0?Math.abs(l):1;g=uu(S,Math.abs(u),f,r),u=f.a=0}return l>=0&&(m=uu(u,l,f,r)),f.negatives=g,f.positives=m,f.result=cS(g,m,r),r.capture===!0?f.result=`(${f.result})`:r.wrap!==!1&&m.length+g.length>1&&(f.result=`(?:${f.result})`),nt.cache[c]=f,f.result};function cS(e,t,n){let r=Oo(e,t,"-",!1,n)||[],o=Oo(t,e,"",!1,n)||[],s=Oo(e,t,"-?",!0,n)||[];return r.concat(s).concat(o).join("|")}function uS(e,t){let n=1,r=1,o=fu(e,n),s=new Set([t]);for(;e<=o&&o<=t;)s.add(o),n+=1,o=fu(e,n);for(o=pu(t+1,r)-1;e<o&&o<=t;)s.add(o),r+=1,o=pu(t+1,r)-1;return s=[...s],s.sort(pS),s}function lS(e,t,n){if(e===t)return{pattern:e,count:[],digits:0};let r=fS(e,t),o=r.length,s="",i=0;for(let a=0;a<o;a++){let[c,u]=r[a];c===u?s+=c:c!=="0"||u!=="9"?s+=dS(c,u,n):i++}return i&&(s+=n.shorthand===!0?"\\d":"[0-9]"),{pattern:s,count:[i],digits:o}}function uu(e,t,n,r){let o=uS(e,t),s=[],i=e,a;for(let c=0;c<o.length;c++){let u=o[c],l=lS(String(i),String(u),r),p="";if(!n.isPadded&&a&&a.pattern===l.pattern){a.count.length>1&&a.count.pop(),a.count.push(l.count[0]),a.string=a.pattern+du(a.count),i=u+1;continue}n.isPadded&&(p=mS(u,n,r)),l.string=p+l.pattern+du(l.count),s.push(l),i=u+1,a=l}return s}function Oo(e,t,n,r,o){let s=[];for(let i of e){let{string:a}=i;!r&&!lu(t,"string",a)&&s.push(n+a),r&&lu(t,"string",a)&&s.push(n+a)}return s}function fS(e,t){let n=[];for(let r=0;r<e.length;r++)n.push([e[r],t[r]]);return n}function pS(e,t){return e>t?1:t>e?-1:0}function lu(e,t,n){return e.some(r=>r[t]===n)}function fu(e,t){return Number(String(e).slice(0,-t)+"9".repeat(t))}function pu(e,t){return e-e%Math.pow(10,t)}function du(e){let[t=0,n=""]=e;return n||t>1?`{${t+(n?","+n:"")}}`:""}function dS(e,t,n){return`[${e}${t-e===1?"":"-"}${t}]`}function mu(e){return/^-?(0+)\d/.test(e)}function mS(e,t,n){if(!t.isPadded)return e;let r=Math.abs(t.maxLen-String(e).length),o=n.relaxZeros!==!1;switch(r){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${r}}`:`0{${r}}`}}nt.cache={};nt.clearCache=()=>nt.cache={};gu.exports=nt});var Po=W((px,Au)=>{"use strict";var gS=$e("util"),Su=_u(),hu=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),_S=e=>t=>e===!0?Number(t):String(t),To=e=>typeof e=="number"||typeof e=="string"&&e!=="",zt=e=>Number.isInteger(+e),ko=e=>{let t=`${e}`,n=-1;if(t[0]==="-"&&(t=t.slice(1)),t==="0")return!1;for(;t[++n]==="0";);return n>0},hS=(e,t,n)=>typeof e=="string"||typeof t=="string"?!0:n.stringify===!0,SS=(e,t,n)=>{if(t>0){let r=e[0]==="-"?"-":"";r&&(e=e.slice(1)),e=r+e.padStart(r?t-1:t,"0")}return n===!1?String(e):e},qn=(e,t)=>{let n=e[0]==="-"?"-":"";for(n&&(e=e.slice(1),t--);e.length<t;)e="0"+e;return n?"-"+e:e},ES=(e,t,n)=>{e.negatives.sort((a,c)=>a<c?-1:a>c?1:0),e.positives.sort((a,c)=>a<c?-1:a>c?1:0);let r=t.capture?"":"?:",o="",s="",i;return e.positives.length&&(o=e.positives.map(a=>qn(String(a),n)).join("|")),e.negatives.length&&(s=`-(${r}${e.negatives.map(a=>qn(String(a),n)).join("|")})`),o&&s?i=`${o}|${s}`:i=o||s,t.wrap?`(${r}${i})`:i},Eu=(e,t,n,r)=>{if(n)return Su(e,t,{wrap:!1,...r});let o=String.fromCharCode(e);if(e===t)return o;let s=String.fromCharCode(t);return`[${o}-${s}]`},yu=(e,t,n)=>{if(Array.isArray(e)){let r=n.wrap===!0,o=n.capture?"":"?:";return r?`(${o}${e.join("|")})`:e.join("|")}return Su(e,t,n)},Ru=(...e)=>new RangeError("Invalid range arguments: "+gS.inspect(...e)),Cu=(e,t,n)=>{if(n.strictRanges===!0)throw Ru([e,t]);return[]},yS=(e,t)=>{if(t.strictRanges===!0)throw new TypeError(`Expected step "${e}" to be a number`);return[]},RS=(e,t,n=1,r={})=>{let o=Number(e),s=Number(t);if(!Number.isInteger(o)||!Number.isInteger(s)){if(r.strictRanges===!0)throw Ru([e,t]);return[]}o===0&&(o=0),s===0&&(s=0);let i=o>s,a=String(e),c=String(t),u=String(n);n=Math.max(Math.abs(n),1);let l=ko(a)||ko(c)||ko(u),p=l?Math.max(a.length,c.length,u.length):0,f=l===!1&&hS(e,t,r)===!1,m=r.transform||_S(f);if(r.toRegex&&n===1)return Eu(qn(e,p),qn(t,p),!0,r);let g={negatives:[],positives:[]},S=T=>g[T<0?"negatives":"positives"].push(Math.abs(T)),C=[],A=0;for(;i?o>=s:o<=s;)r.toRegex===!0&&n>1?S(o):C.push(SS(m(o,A),p,f)),o=i?o-n:o+n,A++;return r.toRegex===!0?n>1?ES(g,r,p):yu(C,null,{wrap:!1,...r}):C},CS=(e,t,n=1,r={})=>{if(!zt(e)&&e.length>1||!zt(t)&&t.length>1)return Cu(e,t,r);let o=r.transform||(f=>String.fromCharCode(f)),s=`${e}`.charCodeAt(0),i=`${t}`.charCodeAt(0),a=s>i,c=Math.min(s,i),u=Math.max(s,i);if(r.toRegex&&n===1)return Eu(c,u,!1,r);let l=[],p=0;for(;a?s>=i:s<=i;)l.push(o(s,p)),s=a?s-n:s+n,p++;return r.toRegex===!0?yu(l,null,{wrap:!1,options:r}):l},Xn=(e,t,n,r={})=>{if(t==null&&To(e))return[e];if(!To(e)||!To(t))return Cu(e,t,r);if(typeof n=="function")return Xn(e,t,1,{transform:n});if(hu(n))return Xn(e,t,0,n);let o={...r};return o.capture===!0&&(o.wrap=!0),n=n||o.step||1,zt(n)?zt(e)&&zt(t)?RS(e,t,n,o):CS(e,t,Math.max(Math.abs(n),1),o):n!=null&&!hu(n)?yS(n,o):Xn(e,t,1,n)};Au.exports=Xn});var xu=W((dx,bu)=>{"use strict";var AS=Po(),Iu=Jn(),IS=(e,t={})=>{let n=(r,o={})=>{let s=Iu.isInvalidBrace(o),i=r.invalid===!0&&t.escapeInvalid===!0,a=s===!0||i===!0,c=t.escapeInvalid===!0?"\\":"",u="";if(r.isOpen===!0)return c+r.value;if(r.isClose===!0)return console.log("node.isClose",c,r.value),c+r.value;if(r.type==="open")return a?c+r.value:"(";if(r.type==="close")return a?c+r.value:")";if(r.type==="comma")return r.prev.type==="comma"?"":a?r.value:"|";if(r.value)return r.value;if(r.nodes&&r.ranges>0){let l=Iu.reduce(r.nodes),p=AS(...l,{...t,wrap:!1,toRegex:!0,strictZeros:!0});if(p.length!==0)return l.length>1&&p.length>1?`(${p})`:p}if(r.nodes)for(let l of r.nodes)u+=n(l,r);return u};return n(e)};bu.exports=IS});var ku=W((mx,Tu)=>{"use strict";var bS=Po(),Ou=Yn(),ht=Jn(),rt=(e="",t="",n=!1)=>{let r=[];if(e=[].concat(e),t=[].concat(t),!t.length)return e;if(!e.length)return n?ht.flatten(t).map(o=>`{${o}}`):t;for(let o of e)if(Array.isArray(o))for(let s of o)r.push(rt(s,t,n));else for(let s of t)n===!0&&typeof s=="string"&&(s=`{${s}}`),r.push(Array.isArray(s)?rt(o,s,n):o+s);return ht.flatten(r)},xS=(e,t={})=>{let n=t.rangeLimit===void 0?1e3:t.rangeLimit,r=(o,s={})=>{o.queue=[];let i=s,a=s.queue;for(;i.type!=="brace"&&i.type!=="root"&&i.parent;)i=i.parent,a=i.queue;if(o.invalid||o.dollar){a.push(rt(a.pop(),Ou(o,t)));return}if(o.type==="brace"&&o.invalid!==!0&&o.nodes.length===2){a.push(rt(a.pop(),["{}"]));return}if(o.nodes&&o.ranges>0){let p=ht.reduce(o.nodes);if(ht.exceedsLimit(...p,t.step,n))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let f=bS(...p,t);f.length===0&&(f=Ou(o,t)),a.push(rt(a.pop(),f)),o.nodes=[];return}let c=ht.encloseBrace(o),u=o.queue,l=o;for(;l.type!=="brace"&&l.type!=="root"&&l.parent;)l=l.parent,u=l.queue;for(let p=0;p<o.nodes.length;p++){let f=o.nodes[p];if(f.type==="comma"&&o.type==="brace"){p===1&&u.push(""),u.push("");continue}if(f.type==="close"){a.push(rt(a.pop(),u,c));continue}if(f.value&&f.type!=="open"){u.push(rt(u.pop(),f.value));continue}f.nodes&&r(f,o)}return u};return ht.flatten(r(e))};Tu.exports=xS});var Nu=W((gx,Pu)=>{"use strict";Pu.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
13
13
  `,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var Hu=W((_x,vu)=>{"use strict";var OS=Yn(),{MAX_LENGTH:wu,CHAR_BACKSLASH:No,CHAR_BACKTICK:TS,CHAR_COMMA:kS,CHAR_DOT:PS,CHAR_LEFT_PARENTHESES:NS,CHAR_RIGHT_PARENTHESES:wS,CHAR_LEFT_CURLY_BRACE:MS,CHAR_RIGHT_CURLY_BRACE:LS,CHAR_LEFT_SQUARE_BRACKET:Mu,CHAR_RIGHT_SQUARE_BRACKET:Lu,CHAR_DOUBLE_QUOTE:vS,CHAR_SINGLE_QUOTE:HS,CHAR_NO_BREAK_SPACE:US,CHAR_ZERO_WIDTH_NOBREAK_SPACE:DS}=Nu(),FS=(e,t={})=>{if(typeof e!="string")throw new TypeError("Expected a string");let n=t||{},r=typeof n.maxLength=="number"?Math.min(wu,n.maxLength):wu;if(e.length>r)throw new SyntaxError(`Input length (${e.length}), exceeds max characters (${r})`);let o={type:"root",input:e,nodes:[]},s=[o],i=o,a=o,c=0,u=e.length,l=0,p=0,f,m=()=>e[l++],g=S=>{if(S.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&S.type==="text"){a.value+=S.value;return}return i.nodes.push(S),S.parent=i,S.prev=a,a=S,S};for(g({type:"bos"});l<u;)if(i=s[s.length-1],f=m(),!(f===DS||f===US)){if(f===No){g({type:"text",value:(t.keepEscaping?f:"")+m()});continue}if(f===Lu){g({type:"text",value:"\\"+f});continue}if(f===Mu){c++;let S;for(;l<u&&(S=m());){if(f+=S,S===Mu){c++;continue}if(S===No){f+=m();continue}if(S===Lu&&(c--,c===0))break}g({type:"text",value:f});continue}if(f===NS){i=g({type:"paren",nodes:[]}),s.push(i),g({type:"text",value:f});continue}if(f===wS){if(i.type!=="paren"){g({type:"text",value:f});continue}i=s.pop(),g({type:"text",value:f}),i=s[s.length-1];continue}if(f===vS||f===HS||f===TS){let S=f,C;for(t.keepQuotes!==!0&&(f="");l<u&&(C=m());){if(C===No){f+=C+m();continue}if(C===S){t.keepQuotes===!0&&(f+=C);break}f+=C}g({type:"text",value:f});continue}if(f===MS){p++;let C={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||i.dollar===!0,depth:p,commas:0,ranges:0,nodes:[]};i=g(C),s.push(i),g({type:"open",value:f});continue}if(f===LS){if(i.type!=="brace"){g({type:"text",value:f});continue}let S="close";i=s.pop(),i.close=!0,g({type:S,value:f}),p--,i=s[s.length-1];continue}if(f===kS&&p>0){if(i.ranges>0){i.ranges=0;let S=i.nodes.shift();i.nodes=[S,{type:"text",value:OS(i)}]}g({type:"comma",value:f}),i.commas++;continue}if(f===PS&&p>0&&i.commas===0){let S=i.nodes;if(p===0||S.length===0){g({type:"text",value:f});continue}if(a.type==="dot"){if(i.range=[],a.value+=f,a.type="range",i.nodes.length!==3&&i.nodes.length!==5){i.invalid=!0,i.ranges=0,a.type="text";continue}i.ranges++,i.args=[];continue}if(a.type==="range"){S.pop();let C=S[S.length-1];C.value+=a.value+f,a=C,i.ranges--;continue}g({type:"dot",value:f});continue}g({type:"text",value:f})}do if(i=s.pop(),i.type!=="root"){i.nodes.forEach(A=>{A.nodes||(A.type==="open"&&(A.isOpen=!0),A.type==="close"&&(A.isClose=!0),A.nodes||(A.type="text"),A.invalid=!0)});let S=s[s.length-1],C=S.nodes.indexOf(i);S.nodes.splice(C,1,...i.nodes)}while(s.length>0);return g({type:"eos"}),o};vu.exports=FS});var Fu=W((hx,Du)=>{"use strict";var Uu=Yn(),$S=xu(),jS=ku(),BS=Hu(),de=(e,t={})=>{let n=[];if(Array.isArray(e))for(let r of e){let o=de.create(r,t);Array.isArray(o)?n.push(...o):n.push(o)}else n=[].concat(de.create(e,t));return t&&t.expand===!0&&t.nodupes===!0&&(n=[...new Set(n)]),n};de.parse=(e,t={})=>BS(e,t);de.stringify=(e,t={})=>Uu(typeof e=="string"?de.parse(e,t):e,t);de.compile=(e,t={})=>(typeof e=="string"&&(e=de.parse(e,t)),$S(e,t));de.expand=(e,t={})=>{typeof e=="string"&&(e=de.parse(e,t));let n=jS(e,t);return t.noempty===!0&&(n=n.filter(Boolean)),t.nodupes===!0&&(n=[...new Set(n)]),n};de.create=(e,t={})=>e===""||e.length<3?[e]:t.expand!==!0?de.compile(e,t):de.expand(e,t);Du.exports=de});var Wt=W((Sx,Gu)=>{"use strict";var KS=$e("path"),ke="\\\\/",$u=`[^${ke}]`,GS=0,De="\\.",zS="\\+",WS="\\?",Zn="\\/",VS="(?=.)",ju="[^/]",wo=`(?:${Zn}|$)`,Bu=`(?:^|${Zn})`,Mo=`${De}{1,2}${wo}`,JS=`(?!${De})`,YS=`(?!${Bu}${Mo})`,XS=`(?!${De}{0,1}${wo})`,qS=`(?!${Mo})`,ZS=`[^.${Zn}]`,QS=`${ju}*?`,Ku={DOT_LITERAL:De,PLUS_LITERAL:zS,QMARK_LITERAL:WS,SLASH_LITERAL:Zn,ONE_CHAR:VS,QMARK:ju,END_ANCHOR:wo,DOTS_SLASH:Mo,NO_DOT:JS,NO_DOTS:YS,NO_DOT_SLASH:XS,NO_DOTS_SLASH:qS,QMARK_NO_DOT:ZS,STAR:QS,START_ANCHOR:Bu},eE={...Ku,SLASH_LITERAL:`[${ke}]`,QMARK:$u,STAR:`${$u}*?`,DOTS_SLASH:`${De}{1,2}(?:[${ke}]|$)`,NO_DOT:`(?!${De})`,NO_DOTS:`(?!(?:^|[${ke}])${De}{1,2}(?:[${ke}]|$))`,NO_DOT_SLASH:`(?!${De}{0,1}(?:[${ke}]|$))`,NO_DOTS_SLASH:`(?!${De}{1,2}(?:[${ke}]|$))`,QMARK_NO_DOT:`[^.${ke}]`,START_ANCHOR:`(?:^|[${ke}])`,END_ANCHOR:`(?:[${ke}]|$)`},tE={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};Gu.exports={DEFAULT_MAX_EXTGLOB_RECURSION:GS,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:tE,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:KS.sep,extglobChars(e){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(e){return e===!0?eE:Ku}}});var Vt=W(ae=>{"use strict";var nE=$e("path"),rE=process.platform==="win32",{REGEX_BACKSLASH:oE,REGEX_REMOVE_BACKSLASH:sE,REGEX_SPECIAL_CHARS:iE,REGEX_SPECIAL_CHARS_GLOBAL:aE}=Wt();ae.isObject=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);ae.hasRegexChars=e=>iE.test(e);ae.isRegexChar=e=>e.length===1&&ae.hasRegexChars(e);ae.escapeRegex=e=>e.replace(aE,"\\$1");ae.toPosixSlashes=e=>e.replace(oE,"/");ae.removeBackslashes=e=>e.replace(sE,t=>t==="\\"?"":t);ae.supportsLookbehinds=()=>{let e=process.version.slice(1).split(".").map(Number);return e.length===3&&e[0]>=9||e[0]===8&&e[1]>=10};ae.isWindows=e=>e&&typeof e.windows=="boolean"?e.windows:rE===!0||nE.sep==="\\";ae.escapeLast=(e,t,n)=>{let r=e.lastIndexOf(t,n);return r===-1?e:e[r-1]==="\\"?ae.escapeLast(e,t,r-1):`${e.slice(0,r)}\\${e.slice(r)}`};ae.removePrefix=(e,t={})=>{let n=e;return n.startsWith("./")&&(n=n.slice(2),t.prefix="./"),n};ae.wrapOutput=(e,t={},n={})=>{let r=n.contains?"":"^",o=n.contains?"":"$",s=`${r}(?:${e})${o}`;return t.negated===!0&&(s=`(?:^(?!${s}).*$)`),s}});var Zu=W((yx,qu)=>{"use strict";var zu=Vt(),{CHAR_ASTERISK:Lo,CHAR_AT:cE,CHAR_BACKWARD_SLASH:Jt,CHAR_COMMA:uE,CHAR_DOT:vo,CHAR_EXCLAMATION_MARK:Ho,CHAR_FORWARD_SLASH:Xu,CHAR_LEFT_CURLY_BRACE:Uo,CHAR_LEFT_PARENTHESES:Do,CHAR_LEFT_SQUARE_BRACKET:lE,CHAR_PLUS:fE,CHAR_QUESTION_MARK:Wu,CHAR_RIGHT_CURLY_BRACE:pE,CHAR_RIGHT_PARENTHESES:Vu,CHAR_RIGHT_SQUARE_BRACKET:dE}=Wt(),Ju=e=>e===Xu||e===Jt,Yu=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)},mE=(e,t)=>{let n=t||{},r=e.length-1,o=n.parts===!0||n.scanToEnd===!0,s=[],i=[],a=[],c=e,u=-1,l=0,p=0,f=!1,m=!1,g=!1,S=!1,C=!1,A=!1,T=!1,x=!1,M=!1,k=!1,K=0,D,b,N={value:"",depth:0,isGlob:!1},H=()=>u>=r,d=()=>c.charCodeAt(u+1),I=()=>(D=b,c.charCodeAt(++u));for(;u<r;){b=I();let se;if(b===Jt){T=N.backslashes=!0,b=I(),b===Uo&&(A=!0);continue}if(A===!0||b===Uo){for(K++;H()!==!0&&(b=I());){if(b===Jt){T=N.backslashes=!0,I();continue}if(b===Uo){K++;continue}if(A!==!0&&b===vo&&(b=I())===vo){if(f=N.isBrace=!0,g=N.isGlob=!0,k=!0,o===!0)continue;break}if(A!==!0&&b===uE){if(f=N.isBrace=!0,g=N.isGlob=!0,k=!0,o===!0)continue;break}if(b===pE&&(K--,K===0)){A=!1,f=N.isBrace=!0,k=!0;break}}if(o===!0)continue;break}if(b===Xu){if(s.push(u),i.push(N),N={value:"",depth:0,isGlob:!1},k===!0)continue;if(D===vo&&u===l+1){l+=2;continue}p=u+1;continue}if(n.noext!==!0&&(b===fE||b===cE||b===Lo||b===Wu||b===Ho)===!0&&d()===Do){if(g=N.isGlob=!0,S=N.isExtglob=!0,k=!0,b===Ho&&u===l&&(M=!0),o===!0){for(;H()!==!0&&(b=I());){if(b===Jt){T=N.backslashes=!0,b=I();continue}if(b===Vu){g=N.isGlob=!0,k=!0;break}}continue}break}if(b===Lo){if(D===Lo&&(C=N.isGlobstar=!0),g=N.isGlob=!0,k=!0,o===!0)continue;break}if(b===Wu){if(g=N.isGlob=!0,k=!0,o===!0)continue;break}if(b===lE){for(;H()!==!0&&(se=I());){if(se===Jt){T=N.backslashes=!0,I();continue}if(se===dE){m=N.isBracket=!0,g=N.isGlob=!0,k=!0;break}}if(o===!0)continue;break}if(n.nonegate!==!0&&b===Ho&&u===l){x=N.negated=!0,l++;continue}if(n.noparen!==!0&&b===Do){if(g=N.isGlob=!0,o===!0){for(;H()!==!0&&(b=I());){if(b===Do){T=N.backslashes=!0,b=I();continue}if(b===Vu){k=!0;break}}continue}break}if(g===!0){if(k=!0,o===!0)continue;break}}n.noext===!0&&(S=!1,g=!1);let U=c,ue="",_="";l>0&&(ue=c.slice(0,l),c=c.slice(l),p-=l),U&&g===!0&&p>0?(U=c.slice(0,p),_=c.slice(p)):g===!0?(U="",_=c):U=c,U&&U!==""&&U!=="/"&&U!==c&&Ju(U.charCodeAt(U.length-1))&&(U=U.slice(0,-1)),n.unescape===!0&&(_&&(_=zu.removeBackslashes(_)),U&&T===!0&&(U=zu.removeBackslashes(U)));let h={prefix:ue,input:e,start:l,base:U,glob:_,isBrace:f,isBracket:m,isGlob:g,isExtglob:S,isGlobstar:C,negated:x,negatedExtglob:M};if(n.tokens===!0&&(h.maxDepth=0,Ju(b)||i.push(N),h.tokens=i),n.parts===!0||n.tokens===!0){let se;for(let F=0;F<s.length;F++){let Ce=se?se+1:l,Ae=s[F],le=e.slice(Ce,Ae);n.tokens&&(F===0&&l!==0?(i[F].isPrefix=!0,i[F].value=ue):i[F].value=le,Yu(i[F]),h.maxDepth+=i[F].depth),(F!==0||le!=="")&&a.push(le),se=Ae}if(se&&se+1<e.length){let F=e.slice(se+1);a.push(F),n.tokens&&(i[i.length-1].value=F,Yu(i[i.length-1]),h.maxDepth+=i[i.length-1].depth)}h.slashes=s,h.parts=a}return h};qu.exports=mE});var rl=W((Rx,nl)=>{"use strict";var Yt=Wt(),oe=Vt(),{MAX_LENGTH:Qn,POSIX_REGEX_SOURCE:gE,REGEX_NON_SPECIAL_CHARS:_E,REGEX_SPECIAL_CHARS_BACKREF:hE,REPLACEMENTS:Qu}=Yt,SE=(e,t)=>{if(typeof t.expandRange=="function")return t.expandRange(...e,t);e.sort();let n=`[${e.join("-")}]`;try{new RegExp(n)}catch{return e.map(o=>oe.escapeRegex(o)).join("..")}return n},St=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,el=e=>{let t=[],n=0,r=0,o=0,s="",i=!1;for(let a of e){if(i===!0){s+=a,i=!1;continue}if(a==="\\"){s+=a,i=!0;continue}if(a==='"'){o=o===1?0:1,s+=a;continue}if(o===0){if(a==="[")n++;else if(a==="]"&&n>0)n--;else if(n===0){if(a==="(")r++;else if(a===")"&&r>0)r--;else if(a==="|"&&r===0){t.push(s),s="";continue}}}s+=a}return t.push(s),t},EE=e=>{let t=!1;for(let n of e){if(t===!0){t=!1;continue}if(n==="\\"){t=!0;continue}if(/[?*+@!()[\]{}]/.test(n))return!1}return!0},tl=e=>{let t=e.trim(),n=!0;for(;n===!0;)n=!1,/^@\([^\\()[\]{}|]+\)$/.test(t)&&(t=t.slice(2,-1),n=!0);if(EE(t))return t.replace(/\\(.)/g,"$1")},yE=e=>{let t=e.map(tl).filter(Boolean);for(let n=0;n<t.length;n++)for(let r=n+1;r<t.length;r++){let o=t[n],s=t[r],i=o[0];if(!(!i||o!==i.repeat(o.length)||s!==i.repeat(s.length))&&(o===s||o.startsWith(s)||s.startsWith(o)))return!0}return!1},Fo=(e,t=!0)=>{if(e[0]!=="+"&&e[0]!=="*"||e[1]!=="(")return;let n=0,r=0,o=0,s=!1;for(let i=1;i<e.length;i++){let a=e[i];if(s===!0){s=!1;continue}if(a==="\\"){s=!0;continue}if(a==='"'){o=o===1?0:1;continue}if(o!==1){if(a==="["){n++;continue}if(a==="]"&&n>0){n--;continue}if(!(n>0)){if(a==="("){r++;continue}if(a===")"&&(r--,r===0))return t===!0&&i!==e.length-1?void 0:{type:e[0],body:e.slice(2,i),end:i}}}}},RE=e=>{let t=0,n=[];for(;t<e.length;){let o=Fo(e.slice(t),!1);if(!o||o.type!=="*")return;let s=el(o.body).map(a=>a.trim());if(s.length!==1)return;let i=tl(s[0]);if(!i||i.length!==1)return;n.push(i),t+=o.end+1}return n.length<1?void 0:`${n.length===1?oe.escapeRegex(n[0]):`[${n.map(o=>oe.escapeRegex(o)).join("")}]`}*`},CE=e=>{let t=0,n=e.trim(),r=Fo(n);for(;r;)t++,n=r.body.trim(),r=Fo(n);return t},AE=(e,t)=>{if(t.maxExtglobRecursion===!1)return{risky:!1};let n=typeof t.maxExtglobRecursion=="number"?t.maxExtglobRecursion:Yt.DEFAULT_MAX_EXTGLOB_RECURSION,r=el(e).map(o=>o.trim());if(r.length>1&&(r.some(o=>o==="")||r.some(o=>/^[*?]+$/.test(o))||yE(r)))return{risky:!0};for(let o of r){let s=RE(o);if(s)return{risky:!0,safeOutput:s};if(CE(o)>n)return{risky:!0}}return{risky:!1}},$o=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a string");e=Qu[e]||e;let n={...t},r=typeof n.maxLength=="number"?Math.min(Qn,n.maxLength):Qn,o=e.length;if(o>r)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${r}`);let s={type:"bos",value:"",output:n.prepend||""},i=[s],a=n.capture?"":"?:",c=oe.isWindows(t),u=Yt.globChars(c),l=Yt.extglobChars(u),{DOT_LITERAL:p,PLUS_LITERAL:f,SLASH_LITERAL:m,ONE_CHAR:g,DOTS_SLASH:S,NO_DOT:C,NO_DOT_SLASH:A,NO_DOTS_SLASH:T,QMARK:x,QMARK_NO_DOT:M,STAR:k,START_ANCHOR:K}=u,D=R=>`(${a}(?:(?!${K}${R.dot?S:p}).)*?)`,b=n.dot?"":C,N=n.dot?x:M,H=n.bash===!0?D(n):k;n.capture&&(H=`(${H})`),typeof n.noext=="boolean"&&(n.noextglob=n.noext);let d={input:e,index:-1,start:0,dot:n.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:i};e=oe.removePrefix(e,d),o=e.length;let I=[],U=[],ue=[],_=s,h,se=()=>d.index===o-1,F=d.peek=(R=1)=>e[d.index+R],Ce=d.advance=()=>e[++d.index]||"",Ae=()=>e.slice(d.index+1),le=(R="",J=0)=>{d.consumed+=R,d.index+=J},an=R=>{d.output+=R.output!=null?R.output:R.value,le(R.value)},pp=()=>{let R=1;for(;F()==="!"&&(F(2)!=="("||F(3)==="?");)Ce(),d.start++,R++;return R%2===0?!1:(d.negated=!0,d.start++,!0)},cn=R=>{d[R]++,ue.push(R)},Fe=R=>{d[R]--,ue.pop()},w=R=>{if(_.type==="globstar"){let J=d.braces>0&&(R.type==="comma"||R.type==="brace"),y=R.extglob===!0||I.length&&(R.type==="pipe"||R.type==="paren");R.type!=="slash"&&R.type!=="paren"&&!J&&!y&&(d.output=d.output.slice(0,-_.output.length),_.type="star",_.value="*",_.output=H,d.output+=_.output)}if(I.length&&R.type!=="paren"&&(I[I.length-1].inner+=R.value),(R.value||R.output)&&an(R),_&&_.type==="text"&&R.type==="text"){_.value+=R.value,_.output=(_.output||"")+R.value;return}R.prev=_,i.push(R),_=R},un=(R,J)=>{let y={...l[J],conditions:1,inner:""};y.prev=_,y.parens=d.parens,y.output=d.output,y.startIndex=d.index,y.tokensIndex=i.length;let P=(n.capture?"(":"")+y.open;cn("parens"),w({type:R,value:J,output:d.output?"":g}),w({type:"paren",extglob:!0,value:Ce(),output:P}),I.push(y)},dp=R=>{let J=e.slice(R.startIndex,d.index+1),y=e.slice(R.startIndex+2,d.index),P=AE(y,n);if((R.type==="plus"||R.type==="star")&&P.risky){let G=P.safeOutput?(R.output?"":g)+(n.capture?`(${P.safeOutput})`:P.safeOutput):void 0,Ie=i[R.tokensIndex];Ie.type="text",Ie.value=J,Ie.output=G||oe.escapeRegex(J);for(let be=R.tokensIndex+1;be<i.length;be++)i[be].value="",i[be].output="",delete i[be].suffix;d.output=R.output+Ie.output,d.backtrack=!0,w({type:"paren",extglob:!0,value:h,output:""}),Fe("parens");return}let z=R.close+(n.capture?")":""),re;if(R.type==="negate"){let G=H;if(R.inner&&R.inner.length>1&&R.inner.includes("/")&&(G=D(n)),(G!==H||se()||/^\)+$/.test(Ae()))&&(z=R.close=`)$))${G}`),R.inner.includes("*")&&(re=Ae())&&/^\.[^\\/.]+$/.test(re)){let Ie=$o(re,{...t,fastpaths:!1}).output;z=R.close=`)${Ie})${G})`}R.prev.type==="bos"&&(d.negatedExtglob=!0)}w({type:"paren",extglob:!0,value:h,output:z}),Fe("parens")};if(n.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let R=!1,J=e.replace(hE,(y,P,z,re,G,Ie)=>re==="\\"?(R=!0,y):re==="?"?P?P+re+(G?x.repeat(G.length):""):Ie===0?N+(G?x.repeat(G.length):""):x.repeat(z.length):re==="."?p.repeat(z.length):re==="*"?P?P+re+(G?H:""):H:P?y:`\\${y}`);return R===!0&&(n.unescape===!0?J=J.replace(/\\/g,""):J=J.replace(/\\+/g,y=>y.length%2===0?"\\\\":y?"\\":"")),J===e&&n.contains===!0?(d.output=e,d):(d.output=oe.wrapOutput(J,d,t),d)}for(;!se();){if(h=Ce(),h==="\0")continue;if(h==="\\"){let y=F();if(y==="/"&&n.bash!==!0||y==="."||y===";")continue;if(!y){h+="\\",w({type:"text",value:h});continue}let P=/^\\+/.exec(Ae()),z=0;if(P&&P[0].length>2&&(z=P[0].length,d.index+=z,z%2!==0&&(h+="\\")),n.unescape===!0?h=Ce():h+=Ce(),d.brackets===0){w({type:"text",value:h});continue}}if(d.brackets>0&&(h!=="]"||_.value==="["||_.value==="[^")){if(n.posix!==!1&&h===":"){let y=_.value.slice(1);if(y.includes("[")&&(_.posix=!0,y.includes(":"))){let P=_.value.lastIndexOf("["),z=_.value.slice(0,P),re=_.value.slice(P+2),G=gE[re];if(G){_.value=z+G,d.backtrack=!0,Ce(),!s.output&&i.indexOf(_)===1&&(s.output=g);continue}}}(h==="["&&F()!==":"||h==="-"&&F()==="]")&&(h=`\\${h}`),h==="]"&&(_.value==="["||_.value==="[^")&&(h=`\\${h}`),n.posix===!0&&h==="!"&&_.value==="["&&(h="^"),_.value+=h,an({value:h});continue}if(d.quotes===1&&h!=='"'){h=oe.escapeRegex(h),_.value+=h,an({value:h});continue}if(h==='"'){d.quotes=d.quotes===1?0:1,n.keepQuotes===!0&&w({type:"text",value:h});continue}if(h==="("){cn("parens"),w({type:"paren",value:h});continue}if(h===")"){if(d.parens===0&&n.strictBrackets===!0)throw new SyntaxError(St("opening","("));let y=I[I.length-1];if(y&&d.parens===y.parens+1){dp(I.pop());continue}w({type:"paren",value:h,output:d.parens?")":"\\)"}),Fe("parens");continue}if(h==="["){if(n.nobracket===!0||!Ae().includes("]")){if(n.nobracket!==!0&&n.strictBrackets===!0)throw new SyntaxError(St("closing","]"));h=`\\${h}`}else cn("brackets");w({type:"bracket",value:h});continue}if(h==="]"){if(n.nobracket===!0||_&&_.type==="bracket"&&_.value.length===1){w({type:"text",value:h,output:`\\${h}`});continue}if(d.brackets===0){if(n.strictBrackets===!0)throw new SyntaxError(St("opening","["));w({type:"text",value:h,output:`\\${h}`});continue}Fe("brackets");let y=_.value.slice(1);if(_.posix!==!0&&y[0]==="^"&&!y.includes("/")&&(h=`/${h}`),_.value+=h,an({value:h}),n.literalBrackets===!1||oe.hasRegexChars(y))continue;let P=oe.escapeRegex(_.value);if(d.output=d.output.slice(0,-_.value.length),n.literalBrackets===!0){d.output+=P,_.value=P;continue}_.value=`(${a}${P}|${_.value})`,d.output+=_.value;continue}if(h==="{"&&n.nobrace!==!0){cn("braces");let y={type:"brace",value:h,output:"(",outputIndex:d.output.length,tokensIndex:d.tokens.length};U.push(y),w(y);continue}if(h==="}"){let y=U[U.length-1];if(n.nobrace===!0||!y){w({type:"text",value:h,output:h});continue}let P=")";if(y.dots===!0){let z=i.slice(),re=[];for(let G=z.length-1;G>=0&&(i.pop(),z[G].type!=="brace");G--)z[G].type!=="dots"&&re.unshift(z[G].value);P=SE(re,n),d.backtrack=!0}if(y.comma!==!0&&y.dots!==!0){let z=d.output.slice(0,y.outputIndex),re=d.tokens.slice(y.tokensIndex);y.value=y.output="\\{",h=P="\\}",d.output=z;for(let G of re)d.output+=G.output||G.value}w({type:"brace",value:h,output:P}),Fe("braces"),U.pop();continue}if(h==="|"){I.length>0&&I[I.length-1].conditions++,w({type:"text",value:h});continue}if(h===","){let y=h,P=U[U.length-1];P&&ue[ue.length-1]==="braces"&&(P.comma=!0,y="|"),w({type:"comma",value:h,output:y});continue}if(h==="/"){if(_.type==="dot"&&d.index===d.start+1){d.start=d.index+1,d.consumed="",d.output="",i.pop(),_=s;continue}w({type:"slash",value:h,output:m});continue}if(h==="."){if(d.braces>0&&_.type==="dot"){_.value==="."&&(_.output=p);let y=U[U.length-1];_.type="dots",_.output+=h,_.value+=h,y.dots=!0;continue}if(d.braces+d.parens===0&&_.type!=="bos"&&_.type!=="slash"){w({type:"text",value:h,output:p});continue}w({type:"dot",value:h,output:p});continue}if(h==="?"){if(!(_&&_.value==="(")&&n.noextglob!==!0&&F()==="("&&F(2)!=="?"){un("qmark",h);continue}if(_&&_.type==="paren"){let P=F(),z=h;if(P==="<"&&!oe.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(_.value==="("&&!/[!=<:]/.test(P)||P==="<"&&!/<([!=]|\w+>)/.test(Ae()))&&(z=`\\${h}`),w({type:"text",value:h,output:z});continue}if(n.dot!==!0&&(_.type==="slash"||_.type==="bos")){w({type:"qmark",value:h,output:M});continue}w({type:"qmark",value:h,output:x});continue}if(h==="!"){if(n.noextglob!==!0&&F()==="("&&(F(2)!=="?"||!/[!=<:]/.test(F(3)))){un("negate",h);continue}if(n.nonegate!==!0&&d.index===0){pp();continue}}if(h==="+"){if(n.noextglob!==!0&&F()==="("&&F(2)!=="?"){un("plus",h);continue}if(_&&_.value==="("||n.regex===!1){w({type:"plus",value:h,output:f});continue}if(_&&(_.type==="bracket"||_.type==="paren"||_.type==="brace")||d.parens>0){w({type:"plus",value:h});continue}w({type:"plus",value:f});continue}if(h==="@"){if(n.noextglob!==!0&&F()==="("&&F(2)!=="?"){w({type:"at",extglob:!0,value:h,output:""});continue}w({type:"text",value:h});continue}if(h!=="*"){(h==="$"||h==="^")&&(h=`\\${h}`);let y=_E.exec(Ae());y&&(h+=y[0],d.index+=y[0].length),w({type:"text",value:h});continue}if(_&&(_.type==="globstar"||_.star===!0)){_.type="star",_.star=!0,_.value+=h,_.output=H,d.backtrack=!0,d.globstar=!0,le(h);continue}let R=Ae();if(n.noextglob!==!0&&/^\([^?]/.test(R)){un("star",h);continue}if(_.type==="star"){if(n.noglobstar===!0){le(h);continue}let y=_.prev,P=y.prev,z=y.type==="slash"||y.type==="bos",re=P&&(P.type==="star"||P.type==="globstar");if(n.bash===!0&&(!z||R[0]&&R[0]!=="/")){w({type:"star",value:h,output:""});continue}let G=d.braces>0&&(y.type==="comma"||y.type==="brace"),Ie=I.length&&(y.type==="pipe"||y.type==="paren");if(!z&&y.type!=="paren"&&!G&&!Ie){w({type:"star",value:h,output:""});continue}for(;R.slice(0,3)==="/**";){let be=e[d.index+4];if(be&&be!=="/")break;R=R.slice(3),le("/**",3)}if(y.type==="bos"&&se()){_.type="globstar",_.value+=h,_.output=D(n),d.output=_.output,d.globstar=!0,le(h);continue}if(y.type==="slash"&&y.prev.type!=="bos"&&!re&&se()){d.output=d.output.slice(0,-(y.output+_.output).length),y.output=`(?:${y.output}`,_.type="globstar",_.output=D(n)+(n.strictSlashes?")":"|$)"),_.value+=h,d.globstar=!0,d.output+=y.output+_.output,le(h);continue}if(y.type==="slash"&&y.prev.type!=="bos"&&R[0]==="/"){let be=R[1]!==void 0?"|$":"";d.output=d.output.slice(0,-(y.output+_.output).length),y.output=`(?:${y.output}`,_.type="globstar",_.output=`${D(n)}${m}|${m}${be})`,_.value+=h,d.output+=y.output+_.output,d.globstar=!0,le(h+Ce()),w({type:"slash",value:"/",output:""});continue}if(y.type==="bos"&&R[0]==="/"){_.type="globstar",_.value+=h,_.output=`(?:^|${m}|${D(n)}${m})`,d.output=_.output,d.globstar=!0,le(h+Ce()),w({type:"slash",value:"/",output:""});continue}d.output=d.output.slice(0,-_.output.length),_.type="globstar",_.output=D(n),_.value+=h,d.output+=_.output,d.globstar=!0,le(h);continue}let J={type:"star",value:h,output:H};if(n.bash===!0){J.output=".*?",(_.type==="bos"||_.type==="slash")&&(J.output=b+J.output),w(J);continue}if(_&&(_.type==="bracket"||_.type==="paren")&&n.regex===!0){J.output=h,w(J);continue}(d.index===d.start||_.type==="slash"||_.type==="dot")&&(_.type==="dot"?(d.output+=A,_.output+=A):n.dot===!0?(d.output+=T,_.output+=T):(d.output+=b,_.output+=b),F()!=="*"&&(d.output+=g,_.output+=g)),w(J)}for(;d.brackets>0;){if(n.strictBrackets===!0)throw new SyntaxError(St("closing","]"));d.output=oe.escapeLast(d.output,"["),Fe("brackets")}for(;d.parens>0;){if(n.strictBrackets===!0)throw new SyntaxError(St("closing",")"));d.output=oe.escapeLast(d.output,"("),Fe("parens")}for(;d.braces>0;){if(n.strictBrackets===!0)throw new SyntaxError(St("closing","}"));d.output=oe.escapeLast(d.output,"{"),Fe("braces")}if(n.strictSlashes!==!0&&(_.type==="star"||_.type==="bracket")&&w({type:"maybe_slash",value:"",output:`${m}?`}),d.backtrack===!0){d.output="";for(let R of d.tokens)d.output+=R.output!=null?R.output:R.value,R.suffix&&(d.output+=R.suffix)}return d};$o.fastpaths=(e,t)=>{let n={...t},r=typeof n.maxLength=="number"?Math.min(Qn,n.maxLength):Qn,o=e.length;if(o>r)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${r}`);e=Qu[e]||e;let s=oe.isWindows(t),{DOT_LITERAL:i,SLASH_LITERAL:a,ONE_CHAR:c,DOTS_SLASH:u,NO_DOT:l,NO_DOTS:p,NO_DOTS_SLASH:f,STAR:m,START_ANCHOR:g}=Yt.globChars(s),S=n.dot?p:l,C=n.dot?f:l,A=n.capture?"":"?:",T={negated:!1,prefix:""},x=n.bash===!0?".*?":m;n.capture&&(x=`(${x})`);let M=b=>b.noglobstar===!0?x:`(${A}(?:(?!${g}${b.dot?u:i}).)*?)`,k=b=>{switch(b){case"*":return`${S}${c}${x}`;case".*":return`${i}${c}${x}`;case"*.*":return`${S}${x}${i}${c}${x}`;case"*/*":return`${S}${x}${a}${c}${C}${x}`;case"**":return S+M(n);case"**/*":return`(?:${S}${M(n)}${a})?${C}${c}${x}`;case"**/*.*":return`(?:${S}${M(n)}${a})?${C}${x}${i}${c}${x}`;case"**/.*":return`(?:${S}${M(n)}${a})?${i}${c}${x}`;default:{let N=/^(.*?)\.(\w+)$/.exec(b);if(!N)return;let H=k(N[1]);return H?H+i+N[2]:void 0}}},K=oe.removePrefix(e,T),D=k(K);return D&&n.strictSlashes!==!0&&(D+=`${a}?`),D};nl.exports=$o});var sl=W((Cx,ol)=>{"use strict";var IE=$e("path"),bE=Zu(),jo=rl(),Bo=Vt(),xE=Wt(),OE=e=>e&&typeof e=="object"&&!Array.isArray(e),Q=(e,t,n=!1)=>{if(Array.isArray(e)){let l=e.map(f=>Q(f,t,n));return f=>{for(let m of l){let g=m(f);if(g)return g}return!1}}let r=OE(e)&&e.tokens&&e.input;if(e===""||typeof e!="string"&&!r)throw new TypeError("Expected pattern to be a non-empty string");let o=t||{},s=Bo.isWindows(t),i=r?Q.compileRe(e,t):Q.makeRe(e,t,!1,!0),a=i.state;delete i.state;let c=()=>!1;if(o.ignore){let l={...t,ignore:null,onMatch:null,onResult:null};c=Q(o.ignore,l,n)}let u=(l,p=!1)=>{let{isMatch:f,match:m,output:g}=Q.test(l,i,t,{glob:e,posix:s}),S={glob:e,state:a,regex:i,posix:s,input:l,output:g,match:m,isMatch:f};return typeof o.onResult=="function"&&o.onResult(S),f===!1?(S.isMatch=!1,p?S:!1):c(l)?(typeof o.onIgnore=="function"&&o.onIgnore(S),S.isMatch=!1,p?S:!1):(typeof o.onMatch=="function"&&o.onMatch(S),p?S:!0)};return n&&(u.state=a),u};Q.test=(e,t,n,{glob:r,posix:o}={})=>{if(typeof e!="string")throw new TypeError("Expected input to be a string");if(e==="")return{isMatch:!1,output:""};let s=n||{},i=s.format||(o?Bo.toPosixSlashes:null),a=e===r,c=a&&i?i(e):e;return a===!1&&(c=i?i(e):e,a=c===r),(a===!1||s.capture===!0)&&(s.matchBase===!0||s.basename===!0?a=Q.matchBase(e,t,n,o):a=t.exec(c)),{isMatch:!!a,match:a,output:c}};Q.matchBase=(e,t,n,r=Bo.isWindows(n))=>(t instanceof RegExp?t:Q.makeRe(t,n)).test(IE.basename(e));Q.isMatch=(e,t,n)=>Q(t,n)(e);Q.parse=(e,t)=>Array.isArray(e)?e.map(n=>Q.parse(n,t)):jo(e,{...t,fastpaths:!1});Q.scan=(e,t)=>bE(e,t);Q.compileRe=(e,t,n=!1,r=!1)=>{if(n===!0)return e.output;let o=t||{},s=o.contains?"":"^",i=o.contains?"":"$",a=`${s}(?:${e.output})${i}`;e&&e.negated===!0&&(a=`^(?!${a}).*$`);let c=Q.toRegex(a,t);return r===!0&&(c.state=e),c};Q.makeRe=(e,t={},n=!1,r=!1)=>{if(!e||typeof e!="string")throw new TypeError("Expected a non-empty string");let o={negated:!1,fastpaths:!0};return t.fastpaths!==!1&&(e[0]==="."||e[0]==="*")&&(o.output=jo.fastpaths(e,t)),o.output||(o=jo(e,t)),Q.compileRe(o,t,n,r)};Q.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?"i":""))}catch(n){if(t&&t.debug===!0)throw n;return/$^/}};Q.constants=xE;ol.exports=Q});var al=W((Ax,il)=>{"use strict";il.exports=sl()});var dl=W((Ix,pl)=>{"use strict";var ul=$e("util"),ll=Fu(),Pe=al(),Ko=Vt(),cl=e=>e===""||e==="./",fl=e=>{let t=e.indexOf("{");return t>-1&&e.indexOf("}",t)>-1},V=(e,t,n)=>{t=[].concat(t),e=[].concat(e);let r=new Set,o=new Set,s=new Set,i=0,a=l=>{s.add(l.output),n&&n.onResult&&n.onResult(l)};for(let l=0;l<t.length;l++){let p=Pe(String(t[l]),{...n,onResult:a},!0),f=p.state.negated||p.state.negatedExtglob;f&&i++;for(let m of e){let g=p(m,!0);(f?!g.isMatch:g.isMatch)&&(f?r.add(g.output):(r.delete(g.output),o.add(g.output)))}}let u=(i===t.length?[...s]:[...o]).filter(l=>!r.has(l));if(n&&u.length===0){if(n.failglob===!0)throw new Error(`No matches found for "${t.join(", ")}"`);if(n.nonull===!0||n.nullglob===!0)return n.unescape?t.map(l=>l.replace(/\\/g,"")):t}return u};V.match=V;V.matcher=(e,t)=>Pe(e,t);V.isMatch=(e,t,n)=>Pe(t,n)(e);V.any=V.isMatch;V.not=(e,t,n={})=>{t=[].concat(t).map(String);let r=new Set,o=[],s=a=>{n.onResult&&n.onResult(a),o.push(a.output)},i=new Set(V(e,t,{...n,onResult:s}));for(let a of o)i.has(a)||r.add(a);return[...r]};V.contains=(e,t,n)=>{if(typeof e!="string")throw new TypeError(`Expected a string: "${ul.inspect(e)}"`);if(Array.isArray(t))return t.some(r=>V.contains(e,r,n));if(typeof t=="string"){if(cl(e)||cl(t))return!1;if(e.includes(t)||e.startsWith("./")&&e.slice(2).includes(t))return!0}return V.isMatch(e,t,{...n,contains:!0})};V.matchKeys=(e,t,n)=>{if(!Ko.isObject(e))throw new TypeError("Expected the first argument to be an object");let r=V(Object.keys(e),t,n),o={};for(let s of r)o[s]=e[s];return o};V.some=(e,t,n)=>{let r=[].concat(e);for(let o of[].concat(t)){let s=Pe(String(o),n);if(r.some(i=>s(i)))return!0}return!1};V.every=(e,t,n)=>{let r=[].concat(e);for(let o of[].concat(t)){let s=Pe(String(o),n);if(!r.every(i=>s(i)))return!1}return!0};V.all=(e,t,n)=>{if(typeof e!="string")throw new TypeError(`Expected a string: "${ul.inspect(e)}"`);return[].concat(t).every(r=>Pe(r,n)(e))};V.capture=(e,t,n)=>{let r=Ko.isWindows(n),s=Pe.makeRe(String(e),{...n,capture:!0}).exec(r?Ko.toPosixSlashes(t):t);if(s)return s.slice(1).map(i=>i===void 0?"":i)};V.makeRe=(...e)=>Pe.makeRe(...e);V.scan=(...e)=>Pe.scan(...e);V.parse=(e,t)=>{let n=[];for(let r of[].concat(e||[]))for(let o of ll(String(r),t))n.push(Pe.parse(o,t));return n};V.braces=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a string");return t&&t.nobrace===!0||!fl(e)?[e]:ll(e,t)};V.braceExpand=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a string");return V.braces(e,{...t,expand:!0})};V.hasBraces=fl;pl.exports=V});import{existsSync as kp,readFileSync as Pp}from"node:fs";import{hostname as js,userInfo as Np}from"node:os";import{createHash as yp,randomBytes as Rp}from"node:crypto";import{existsSync as hr,mkdirSync as Cp,readdirSync as Ap,readFileSync as Ip,renameSync as ws,statSync as Hs,unlinkSync as Ms,writeFileSync as bp}from"node:fs";import{basename as xp,dirname as Ls,join as Us,relative as Op}from"node:path";function O(e){process.stderr.write(`[ev-ai-agent-hook] ${e}
14
- `)}function Ot(e){return e.replace(/^([a-z]+:\/\/)[^/@]+@/i,"$1")}function Tt(e){return yp("sha256").update(e).digest("hex").slice(0,32)}function me(e,t){Cp(Ls(e),{recursive:!0});let n=Us(Ls(e),`.${xp(e)}.${process.pid}.${Rp(4).toString("hex")}.tmp`);try{bp(n,t,"utf8");try{ws(n,e)}catch(r){let o=r instanceof Error&&"code"in r?r.code:void 0;if(o==="EEXIST"||o==="EPERM"||o==="EACCES"){Ms(e),ws(n,e);return}throw r}}catch(r){try{Ms(n)}catch{}throw r}}function ln(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function Sr(){process.stdout.write('{"continue":true}')}function L(e){let t=process.env[e];return t===void 0||t===""?void 0:t}async function Er(){return new Promise(e=>{let t="";if(process.stdin.isTTY){e("");return}process.stdin.setEncoding("utf8"),process.stdin.on("data",n=>{t+=n}),process.stdin.on("end",()=>{e(t)}),process.stdin.on("error",()=>{e(t)}),process.stdin.resume()})}async function fn(e){return new Promise(t=>{let n="",r=!1,o=i=>{r||(r=!0,clearTimeout(s),t(i||"{}"))},s=setTimeout(()=>{o(n)},e);if(process.stdin.isTTY){o("{}");return}process.stdin.setEncoding("utf8"),process.stdin.on("data",i=>{n+=i}),process.stdin.on("end",()=>{o(n)}),process.stdin.on("error",()=>{o(n)}),process.stdin.resume()})}async function Ee(e,t,n=3e3,r={}){let{execFile:o}=await import("node:child_process"),{promisify:s}=await import("node:util"),i=s(o);try{let{stdout:a}=await i(e,t,{timeout:n,windowsHide:!0,maxBuffer:1048576,cwd:r.cwd});return{ok:!0,stdout:a.trim()}}catch(a){let c=a,u=typeof c.code=="number"?c.code:typeof c.status=="number"?c.status:void 0;return{ok:!1,code:u,spawnFailed:u===void 0}}}async function ee(e,t,n=3e3,r={}){let o=await Ee(e,t,n,r);return o.ok?o.stdout:""}async function yr(e=process.cwd()){let t=await Ee("git",["rev-parse","--show-toplevel"],2e3,{cwd:e});if(t.ok&&t.stdout)return{root:t.stdout,inGitRepo:!0};if(L("EV_AI_HOOK_DEBUG")){let r=t.ok?"empty stdout":t.spawnFailed?"spawn failed":`exit ${String(t.code??"unknown")}`;O(`DEBUG: git rev-parse --show-toplevel failed (${r}) cwd=${e}`)}let n=L("CURSOR_PROJECT_DIR")??L("CLAUDE_PROJECT_DIR");if(n&&hr(n)){let r=await Ee("git",["rev-parse","--show-toplevel"],2e3,{cwd:n});return r.ok&&r.stdout?{root:r.stdout,inGitRepo:!0}:{root:n,inGitRepo:!1}}return{root:e,inGitRepo:!1}}async function Rr(e=process.cwd()){return(await yr(e)).root}function ge(e,t){try{return JSON.parse(e)}catch{return t}}var vs=new Map;function pn(e){return e.charCodeAt(0)===65279?e.slice(1):e}function Tp(e){let t;try{t=Ip(e,"utf8")}catch{return{ok:!1,reason:"read"}}try{return{ok:!0,value:JSON.parse(pn(t))}}catch{return{ok:!1,reason:"parse"}}}function Ds(e){let t=vs.get(e);if(t!==void 0)return t;let n=Tp(e);return vs.set(e,n),n}function Fs(e){return Ds(e)}function te(e,t){let n=Ds(e);return n.ok?n.value:t}function qe(e){return typeof e=="string"?e:""}function Me(e,t){let n=e[t];if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return n;if(!t.includes("."))return;let r=t.split("."),o=e;for(let s of r){if(o===null||typeof o!="object"||Array.isArray(o))return;o=o[s]}if(typeof o=="string"||typeof o=="number"||typeof o=="boolean")return o}function v(e,t){let n=Me(e,t);return typeof n=="string"?n:""}var Be=500;function $s(e,t=2){if(!hr(e))return{entries:[],truncated:!1};let n=[],r=!1,o=(s,i)=>{if(i>t||r)return;let a;try{a=Ap(s,{withFileTypes:!0})}catch{return}for(let c of a){if(r)return;let u=Us(s,c.name);if(c.isDirectory()){o(u,i+1);continue}if(c.isFile()){try{n.push({name:Op(e,u),size:Hs(u).size})}catch{continue}if(n.length>=Be){r=!0;return}}}};return o(e,1),{entries:n,truncated:r}}function Cr(e){return hr(e)?{present:!0,size:Hs(e).size}:{present:!1,size:0}}function lt(e){if(e===void 0||e==="")return!1;let t=e.trim().toLowerCase();return t!=="0"&&t!=="false"&&t!=="no"}function Bs(e=process.env){return lt(Y("CURSOR_SANDBOX",e))}var wp=["CIRCLECI","BUILDKITE","TF_BUILD","JENKINS_URL","JENKINS_HOME","CODEBUILD_BUILD_ID","DRONE","DRONE_BUILD_NUMBER","TEAMCITY_VERSION","TRAVIS","APPVEYOR","BITBUCKET_BUILD_NUMBER"];function Mp(e){return wp.some(t=>!!Y(t,e))}function Lp(e){if(Y("KUBERNETES_SERVICE_HOST",e)||lt(Y("REMOTE_CONTAINERS",e))||lt(Y("DEVCONTAINER",e)))return!0;try{if(kp("/.dockerenv")||Pp("/proc/1/environ","utf8").includes("container="))return!0}catch{}return!1}function Ks(e){return["VSCODE_PID","VSCODE_IPC_HOOK","CURSOR_EXTENSION_HOST_ROLE","CURSOR_WORKSPACE_LABEL"].some(t=>!!Y(t,e))}function vp(e,t=process.platform){return Ks(e)?t==="darwin"||t==="win32"?!0:["__CFBundleIdentifier","DISPLAY","WAYLAND_DISPLAY","SESSIONNAME"].some(n=>!!Y(n,e)):!1}function Hp(e){return e===void 0?!1:e.trim().toLowerCase().startsWith("bc-")}function Up(e){return e==="linux"}function Y(e,t){if(t){let n=t[e];return n===void 0||n===""?void 0:n}return L(e)}function Dp(e,t,n){return e.trim().toLowerCase()==="cursor"&&t.trim().toLowerCase()==="ubuntu"&&!!Fp(Y("CURSOR_VERSION",n))}function Fp(e){if(e===void 0)return null;let t=e.trim();return t.length>0?t:null}function Ar(e){if(Hp(e.sessionId))return!0;let t=e.hostname??js(),n=e.osUser??zs(e.env);return Dp(t,n,e.env)}function $p(e){return lt(Y("CURSOR_AGENT",e.env))?!0:Ar(e)}function jp(e){return!!(process.stdin.isTTY||process.stdout.isTTY||(Y("TERM",e)??Y("TERM_PROGRAM",e))||(Y("SSH_TTY",e)??Y("SSH_CONNECTION",e))||(Y("__CFBundleIdentifier",e)??Y("XPC_SERVICE_NAME",e))||Ks(e)||["DISPLAY","WAYLAND_DISPLAY","XDG_SESSION_TYPE","DBUS_SESSION_BUS_ADDRESS"].some(t=>!!Y(t,e))||Y("SESSIONNAME",e))}function kt(e={}){let t=e.env;if(Y("GITHUB_ACTIONS",t))return"github_actions";if(lt(Y("CLAUDE_CODE_REMOTE",t)))return"claude_remote";let n=e.platform??process.platform;if(!vp(t,n)&&$p(e)&&(lt(Y("CURSOR_AGENT",t))||Up(n)))return"cursor_cloud";if(Y("CODESPACES",t)||Y("CODESPACE_NAME",t))return"codespaces";if(Y("GITLAB_CI",t))return"gitlab_ci";if(Mp(t))return"managed";let r=Y("CI",t);return r&&r!=="false"&&r!=="0"?"managed":Lp(t)?"container":jp(t)?"interactive":"unknown"}async function Gs(){return await ee("systemd-detect-virt",[],1e3)}function zs(e=process.env,t=Np){for(let n of["USER","LOGNAME","USERNAME"]){let r=e[n];if(typeof r=="string"){let o=r.trim();if(o.length>0)return o}}try{return t().username??""}catch{return""}}async function Ws(){let e=process.platform==="darwin"?"Darwin":process.platform==="win32"?"Windows_NT":"Linux",t="";if(process.platform==="darwin")t=await ee("sw_vers",["-productVersion"],1e3);else if(process.platform==="linux"){try{let{readFileSync:s}=await import("node:fs"),i=s("/etc/os-release","utf8"),a=i.match(/^PRETTY_NAME="?([^"\n]+)"?/m)?.[1],c=i.match(/^VERSION_ID="?([^"\n]+)"?/m)?.[1];t=a??c??""}catch{t=await ee("lsb_release",["-sd"],1e3).then(s=>s.replace(/^"|"$/g,""))}t||(t=await ee("uname",["-r"],1e3))}else t=await ee("ver",[],1e3);let n=zs(),r=(process.env.SHELL??"").split(/[/\\]/).pop()??"",o="";try{o=await ee("tty",[],500),o.includes("not a tty")&&(o="")}catch{o=""}return{os:e,os_version:t||null,user:n||null,shell:r||null,tty:o||null}}function dn(){return js()}import{createHash as Bp}from"node:crypto";import{homedir as Kp}from"node:os";import{dirname as pA,join as Gp,parse as dA,resolve as mA}from"node:path";var Vs="EV_AI_LAUNCHER_VERSION";var Js="EV_AI_HOOK_SOURCE",Ys="EV_AI_HOOK_FALLBACK_REASON",Xs="EV_AI_LAUNCHER_SCOPE",Ir="EV_AI_LAUNCHER_READY_FD";var qs="--defer-user-spec",mn="--cap",Zs=Buffer.from([1]);var nA=1024*1024,rA=4*1024*1024,oA=64*1024,sA=64*1024,iA=64*1024;var br=4096,aA=4*1024*1024;var ti="https://hooks.ev-ai.ai",ni=".claude/ev-ai-runtime-report.json",ri="config.json",zp="max_concurrent_hooks",hA=1024*1024,Wp=new Set(["localhost","127.0.0.1","[::1]","::1"]),Vp=["claude","cursor","codex"],oi=[ni,".cursor/ev-ai-runtime-report.json",".codex/ev-ai-runtime-report.json"],xr=/^[A-Za-z0-9._~-]+$/;function gn(e){return e!==void 0&&Vp.includes(e)}function si(e){if(!e||typeof e!="object")return;let t=e[zp];return typeof t=="number"&&Number.isSafeInteger(t)&&t>0?t:void 0}function Qs(e){if(e===void 0||!/^\d+$/.test(e))return;let t=Number(e);return Number.isSafeInteger(t)?t:void 0}function Pt(e,t){let n=e[t+1];return n&&!n.startsWith("--")?{value:n,next:t+1}:{next:t}}function Or(e){let t,n,r,o,s,i;for(let a=0;a<e.length;a++){let c=e[a];if(c!==void 0){if(c==="--runner"){let u=Pt(e,a);t=u.value,a=u.next;continue}if(c.startsWith("--runner=")){t=c.slice(9);continue}if(c==="--url"){let u=Pt(e,a);u.value&&(r=u.value),a=u.next;continue}if(c.startsWith("--url=")){r=c.slice(6);continue}if(c==="--token"){let u=Pt(e,a);u.value&&(o=u.value),a=u.next;continue}if(c.startsWith("--token=")){o=c.slice(8);continue}if(c==="--base-url"){let u=Pt(e,a);u.value&&(s=u.value),a=u.next;continue}if(c.startsWith("--base-url=")){s=c.slice(11);continue}if(c===mn){let u=Pt(e,a);i=Qs(u.value)??i,a=u.next;continue}if(c.startsWith(`${mn}=`)){i=Qs(c.slice(mn.length+1))??i;continue}c!==qs&&!c.startsWith("-")&&n===void 0&&(n=c)}}return{runner:gn(t)?t:void 0,event:n,collectorUrl:r,orgToken:o,baseUrl:s,...i!==void 0?{cap:i}:{}}}function _n(e,t=ti){let n=t.replace(/\/+$/,""),r=e.trim();return`${n}/${r}/hook`}function Nt(e=Kp()){return Gp(e,".ev-ai",ri)}function ii(e,t){return{...e,...t}}function ei(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<=32||n===127||n===39)return!0}return!1}function hn(e){try{let t=new URL(e);return t.protocol==="https:"?!0:t.protocol==="http:"?Wp.has(t.hostname):!1}catch{return!1}}function Tr(e){try{let n=new URL(e).pathname.split("/").filter(r=>r.length>0);if(n.length>=2&&n[n.length-1]==="hook"){let r=n[n.length-2];return r&&r.length>0?r:void 0}return}catch{return}}function kr(e){let t;try{t=new URL(e)}catch{return`invalid URL (got: ${e})`}if(!hn(e))return`must be https (or http on localhost / 127.0.0.1 / ::1) (got: ${e})`;let n=Tr(e);if(!n)return`must end with /{orgToken}/hook (got: ${e})`;if(!xr.test(n))return`org token must match ${xr.source} (got: ${n})`;if(ei(e))return`must not contain whitespace, control characters, or single quotes (got: ${e})`;if(ei(t.pathname))return`pathname must not contain whitespace, control characters, or single quotes (got: ${e})`}function ai(e){return new URL(e).toString()}function Pr(e){if(e.collector_url)return e.collector_url;let t=e.repo_ingest_token,n=typeof t=="string"?t.trim():void 0;return n?_n(n):""}function Sn(e){try{let t=new URL(e),n=t.pathname.split("/").filter(r=>r.length>0);return n.length>=2&&n[n.length-1]==="hook"&&(n[n.length-2]="***",t.pathname=`/${n.join("/")}`),t.toString()}catch{return"<invalid-url>"}}function ci(e){let t=e.collectorUrl?.trim(),n;if(t)n=t;else{let o=e.orgToken?.trim();o&&(n=_n(o,e.baseUrl?.trim()??void 0))}if(!n)return{};let r=kr(n);return r?{problem:r}:{url:ai(n)}}function wt(e){if(kr(e))return;let t;try{t=new URL(e)}catch{return}let n=Tr(e);if(!n)return;let o=t.pathname.split("/").filter(a=>a.length>0).slice(0,-2),s=o.length>0?`/${o.join("/")}`:"",i=`${t.origin}${s}/${n}`;return Bp("sha256").update(i).digest("hex").slice(0,32)}var yn=2;var En="ev-ai-agent-hook";function Jp(e){let t=e.split(/[/\\]/).pop();return t&&t.length>0?t:e}function ui(e){let t=Jp(e);return t===En||t===`${En}.exe`}var EA=`current/${En}`,yA=`.ev-ai/agent-hook/${En}`,li=5e3,fi=5e3,Nr=3e3;var Rn=3e3,pi=1500,di=4*1024,wr=256*1024,Yp=4*1024,mi=32*1024,Mr="1.3.3",RA=`@ev-ai/agent-hook@${Mr}`;import{existsSync as a_,mkdirSync as c_,readdirSync as u_,readFileSync as l_,unlinkSync as Ga,writeFileSync as f_}from"node:fs";import{homedir as za}from"node:os";import{join as eo}from"node:path";import{createHash as Ei,randomBytes as Zp}from"node:crypto";import{existsSync as yi,mkdirSync as Lr,readFileSync as Ri,unlinkSync as Ci,writeFileSync as Ai}from"node:fs";import{homedir as vr}from"node:os";import{dirname as Cn,join as Hr,resolve as Qp}from"node:path";var Xp=new Set(["action@github.com","noreply@github.com","noreply@anthropic.com","cursoragent@cursor.com"]),qp=new Set(["github-actions","github actions","dependabot","renovate","cursoragent","cursor agent"]);function fe(e,t){let n=(e??"").trim().toLowerCase(),r=(t??"").trim().toLowerCase();if(!n&&!r)return!1;if(n.includes("[bot]")||qp.has(n)||r.includes("[bot]")||Xp.has(r))return!0;if(r.endsWith("@users.noreply.github.com")){let o=r.slice(0,r.indexOf("@")),s=o.includes("+")?o.slice(o.indexOf("+")+1):o;if(s.endsWith("bot")||s.includes("[bot]"))return!0}return!1}var ed="installation.json",td="cloud-bootstrap.lock",nd=6e4;function Ii(e,t,n){let r=`${e}:${t??""}`;return n?`${n}:${r}`:r}function pe(e=vr()){return Hr(e,".ev-ai","agent-hook")}function rd(e=vr()){return Hr(pe(e),ed)}function bi(e){return Hr(Cn(e),td)}function xi(){return Zp(8).toString("hex")}function ft(e){return Ei("sha256").update(e).digest("hex").slice(0,16)}function $(e){if(e===void 0)return null;let t=e.trim();return t.length>0?t:null}function Oi(e){return/^[A-Za-z0-9._-]{8,64}$/.test(e)}function od(e=process.env){let t=$(e.EV_AI_HOOK_INSTALLATION_ID);if(t){if(!Oi(t)){O(`WARN: ignoring EV_AI_HOOK_INSTALLATION_ID (expected 8\u201364 chars [A-Za-z0-9._-], got length ${t.length})`);return}return t}}function Ti(e,t){return e&&Oi(e)?e:(e&&O(`WARN: ignoring installation id override (expected 8\u201364 chars [A-Za-z0-9._-], got length ${e.length})`),od(t))}function sd(e){return/^[0-9a-f]{16}$/.test(e)}function id(e=process.env){if($(e.GITHUB_ACTIONS)){let t=$(e.GITHUB_REPOSITORY_ID)??$(e.GITHUB_REPOSITORY),n=$(e.GITHUB_ACTOR)??$(e.GITHUB_TRIGGERING_ACTOR)??$(e.GITHUB_USER);if(t&&n)return ft(`github_actions|${t}|${n}`)}if($(e.CODESPACES)||$(e.CODESPACE_NAME)){let t=$(e.CODESPACE_NAME);if(t)return ft(`codespaces|${t}`);let n=$(e.GITHUB_REPOSITORY_ID)??$(e.GITHUB_REPOSITORY),r=$(e.GITHUB_USER)??$(e.GITHUB_ACTOR);if(n&&r)return ft(`codespaces|${n}|${r}`)}if($(e.GITLAB_CI)){let t=$(e.CI_PROJECT_ID)??$(e.CI_PROJECT_PATH),n=$(e.GITLAB_USER_LOGIN)??$(e.GITLAB_USER_EMAIL)??$(e.GITLAB_USER_NAME);if(t&&n)return ft(`gitlab|${t}|${n}`)}return null}var ad="cursoragent@cursor.com";function cd(e){let t=$(e.CURSOR_USER_EMAIL);return!t||t.toLowerCase()===ad?null:t}function ud(e,t){return $(e.CURSOR_PROJECT_DIR)??$(e.CLAUDE_PROJECT_DIR)??t}function ld(e){return Ot(e).replace(/\.git$/i,"").toLowerCase()}async function fd(e){let t=await ee("git",["config","--get","remote.origin.url"],2e3,{cwd:e});return t?ld(t):e}async function pd(e){let t=$(await ee("git",["config","--local","--get","user.email"],2e3,{cwd:e})||void 0);if(t&&!fe(null,t))return t;let n=$(await ee("git",["log","-1","--format=%ae"],2e3,{cwd:e})||void 0);return n&&!fe(null,n)?n:null}function dd(e,t){let n=ud(e,t);return n?ft(`cursor_cloud|${n}|${cd(e)??""}`):null}async function md(e,t){let n=$(e.CLAUDE_PROJECT_DIR)??t;if(!n)return null;let r=await fd(n),o=await pd(n);return ft(`claude_remote|${r}|${o??""}`)}function gi(e,t){let n=Ti(e,t);if(n)return n;let r=id(t);return r||xi()}async function gd(e){let n=await ee("git",["config","--get","remote.origin.url"],2e3,{cwd:e})||Qp(e);return Ei("sha256").update(n).digest("hex").slice(0,16)}function _d(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t={};for(let[n,r]of Object.entries(e))typeof r=="string"&&r.length>0&&(t[n]=r);return Object.keys(t).length>0?t:void 0}function hd(e){try{let t=JSON.parse(e);if(typeof t.installation_id!="string"||t.installation_id.length===0)return;let n=_d(t.platform_agent_ids);return{installation_id:t.installation_id,...t.pinned===!0?{pinned:!0}:{},...n?{platform_agent_ids:n}:{},...typeof t.operator_identity_hash=="string"?{operator_identity_hash:t.operator_identity_hash}:{},...typeof t.operator_identity_sent_at=="string"?{operator_identity_sent_at:t.operator_identity_sent_at}:{}}}catch{return}}function Ze(e){if(yi(e))try{return hd(Ri(e,"utf8"))}catch{}}function Ur(e){return Ze(e)}function ki(e,t,n){let r=Ze(e);if(!r||r.operator_identity_hash===t&&r.operator_identity_sent_at===n)return;let o={...r,operator_identity_hash:t,operator_identity_sent_at:n};try{me(e,`${JSON.stringify(o,null,2)}
14
+ `)}function Ot(e){return e.replace(/^([a-z]+:\/\/)[^/@]+@/i,"$1")}function Tt(e){return yp("sha256").update(e).digest("hex").slice(0,32)}function me(e,t){Cp(Ls(e),{recursive:!0});let n=Us(Ls(e),`.${xp(e)}.${process.pid}.${Rp(4).toString("hex")}.tmp`);try{bp(n,t,"utf8");try{ws(n,e)}catch(r){let o=r instanceof Error&&"code"in r?r.code:void 0;if(o==="EEXIST"||o==="EPERM"||o==="EACCES"){Ms(e),ws(n,e);return}throw r}}catch(r){try{Ms(n)}catch{}throw r}}function ln(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function Sr(){process.stdout.write('{"continue":true}')}function L(e){let t=process.env[e];return t===void 0||t===""?void 0:t}async function Er(){return new Promise(e=>{let t="";if(process.stdin.isTTY){e("");return}process.stdin.setEncoding("utf8"),process.stdin.on("data",n=>{t+=n}),process.stdin.on("end",()=>{e(t)}),process.stdin.on("error",()=>{e(t)}),process.stdin.resume()})}async function fn(e){return new Promise(t=>{let n="",r=!1,o=i=>{r||(r=!0,clearTimeout(s),t(i||"{}"))},s=setTimeout(()=>{o(n)},e);if(process.stdin.isTTY){o("{}");return}process.stdin.setEncoding("utf8"),process.stdin.on("data",i=>{n+=i}),process.stdin.on("end",()=>{o(n)}),process.stdin.on("error",()=>{o(n)}),process.stdin.resume()})}async function Ee(e,t,n=3e3,r={}){let{execFile:o}=await import("node:child_process"),{promisify:s}=await import("node:util"),i=s(o);try{let{stdout:a}=await i(e,t,{timeout:n,windowsHide:!0,maxBuffer:1048576,cwd:r.cwd});return{ok:!0,stdout:a.trim()}}catch(a){let c=a,u=typeof c.code=="number"?c.code:typeof c.status=="number"?c.status:void 0;return{ok:!1,code:u,spawnFailed:u===void 0}}}async function ee(e,t,n=3e3,r={}){let o=await Ee(e,t,n,r);return o.ok?o.stdout:""}async function yr(e=process.cwd()){let t=await Ee("git",["rev-parse","--show-toplevel"],2e3,{cwd:e});if(t.ok&&t.stdout)return{root:t.stdout,inGitRepo:!0};if(L("EV_AI_HOOK_DEBUG")){let r=t.ok?"empty stdout":t.spawnFailed?"spawn failed":`exit ${String(t.code??"unknown")}`;O(`DEBUG: git rev-parse --show-toplevel failed (${r}) cwd=${e}`)}let n=L("CURSOR_PROJECT_DIR")??L("CLAUDE_PROJECT_DIR");if(n&&hr(n)){let r=await Ee("git",["rev-parse","--show-toplevel"],2e3,{cwd:n});return r.ok&&r.stdout?{root:r.stdout,inGitRepo:!0}:{root:n,inGitRepo:!1}}return{root:e,inGitRepo:!1}}async function Rr(e=process.cwd()){return(await yr(e)).root}function ge(e,t){try{return JSON.parse(e)}catch{return t}}var vs=new Map;function pn(e){return e.charCodeAt(0)===65279?e.slice(1):e}function Tp(e){let t;try{t=Ip(e,"utf8")}catch{return{ok:!1,reason:"read"}}try{return{ok:!0,value:JSON.parse(pn(t))}}catch{return{ok:!1,reason:"parse"}}}function Ds(e){let t=vs.get(e);if(t!==void 0)return t;let n=Tp(e);return vs.set(e,n),n}function Fs(e){return Ds(e)}function te(e,t){let n=Ds(e);return n.ok?n.value:t}function qe(e){return typeof e=="string"?e:""}function Me(e,t){let n=e[t];if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return n;if(!t.includes("."))return;let r=t.split("."),o=e;for(let s of r){if(o===null||typeof o!="object"||Array.isArray(o))return;o=o[s]}if(typeof o=="string"||typeof o=="number"||typeof o=="boolean")return o}function v(e,t){let n=Me(e,t);return typeof n=="string"?n:""}var Be=500;function $s(e,t=2){if(!hr(e))return{entries:[],truncated:!1};let n=[],r=!1,o=(s,i)=>{if(i>t||r)return;let a;try{a=Ap(s,{withFileTypes:!0})}catch{return}for(let c of a){if(r)return;let u=Us(s,c.name);if(c.isDirectory()){o(u,i+1);continue}if(c.isFile()){try{n.push({name:Op(e,u),size:Hs(u).size})}catch{continue}if(n.length>=Be){r=!0;return}}}};return o(e,1),{entries:n,truncated:r}}function Cr(e){return hr(e)?{present:!0,size:Hs(e).size}:{present:!1,size:0}}function lt(e){if(e===void 0||e==="")return!1;let t=e.trim().toLowerCase();return t!=="0"&&t!=="false"&&t!=="no"}function Bs(e=process.env){return lt(Y("CURSOR_SANDBOX",e))}var wp=["CIRCLECI","BUILDKITE","TF_BUILD","JENKINS_URL","JENKINS_HOME","CODEBUILD_BUILD_ID","DRONE","DRONE_BUILD_NUMBER","TEAMCITY_VERSION","TRAVIS","APPVEYOR","BITBUCKET_BUILD_NUMBER"];function Mp(e){return wp.some(t=>!!Y(t,e))}function Lp(e){if(Y("KUBERNETES_SERVICE_HOST",e)||lt(Y("REMOTE_CONTAINERS",e))||lt(Y("DEVCONTAINER",e)))return!0;try{if(kp("/.dockerenv")||Pp("/proc/1/environ","utf8").includes("container="))return!0}catch{}return!1}function Ks(e){return["VSCODE_PID","VSCODE_IPC_HOOK","CURSOR_EXTENSION_HOST_ROLE","CURSOR_WORKSPACE_LABEL"].some(t=>!!Y(t,e))}function vp(e,t=process.platform){return Ks(e)?t==="darwin"||t==="win32"?!0:["__CFBundleIdentifier","DISPLAY","WAYLAND_DISPLAY","SESSIONNAME"].some(n=>!!Y(n,e)):!1}function Hp(e){return e===void 0?!1:e.trim().toLowerCase().startsWith("bc-")}function Up(e){return e==="linux"}function Y(e,t){if(t){let n=t[e];return n===void 0||n===""?void 0:n}return L(e)}function Dp(e,t,n){return e.trim().toLowerCase()==="cursor"&&t.trim().toLowerCase()==="ubuntu"&&!!Fp(Y("CURSOR_VERSION",n))}function Fp(e){if(e===void 0)return null;let t=e.trim();return t.length>0?t:null}function Ar(e){if(Hp(e.sessionId))return!0;let t=e.hostname??js(),n=e.osUser??zs(e.env);return Dp(t,n,e.env)}function $p(e){return lt(Y("CURSOR_AGENT",e.env))?!0:Ar(e)}function jp(e){return!!(process.stdin.isTTY||process.stdout.isTTY||(Y("TERM",e)??Y("TERM_PROGRAM",e))||(Y("SSH_TTY",e)??Y("SSH_CONNECTION",e))||(Y("__CFBundleIdentifier",e)??Y("XPC_SERVICE_NAME",e))||Ks(e)||["DISPLAY","WAYLAND_DISPLAY","XDG_SESSION_TYPE","DBUS_SESSION_BUS_ADDRESS"].some(t=>!!Y(t,e))||Y("SESSIONNAME",e))}function kt(e={}){let t=e.env;if(Y("GITHUB_ACTIONS",t))return"github_actions";if(lt(Y("CLAUDE_CODE_REMOTE",t)))return"claude_remote";let n=e.platform??process.platform;if(!vp(t,n)&&$p(e)&&(lt(Y("CURSOR_AGENT",t))||Up(n)))return"cursor_cloud";if(Y("CODESPACES",t)||Y("CODESPACE_NAME",t))return"codespaces";if(Y("GITLAB_CI",t))return"gitlab_ci";if(Mp(t))return"managed";let r=Y("CI",t);return r&&r!=="false"&&r!=="0"?"managed":Lp(t)?"container":jp(t)?"interactive":"unknown"}async function Gs(){return await ee("systemd-detect-virt",[],1e3)}function zs(e=process.env,t=Np){for(let n of["USER","LOGNAME","USERNAME"]){let r=e[n];if(typeof r=="string"){let o=r.trim();if(o.length>0)return o}}try{return t().username??""}catch{return""}}async function Ws(){let e=process.platform==="darwin"?"Darwin":process.platform==="win32"?"Windows_NT":"Linux",t="";if(process.platform==="darwin")t=await ee("sw_vers",["-productVersion"],1e3);else if(process.platform==="linux"){try{let{readFileSync:s}=await import("node:fs"),i=s("/etc/os-release","utf8"),a=i.match(/^PRETTY_NAME="?([^"\n]+)"?/m)?.[1],c=i.match(/^VERSION_ID="?([^"\n]+)"?/m)?.[1];t=a??c??""}catch{t=await ee("lsb_release",["-sd"],1e3).then(s=>s.replace(/^"|"$/g,""))}t||(t=await ee("uname",["-r"],1e3))}else t=await ee("ver",[],1e3);let n=zs(),r=(process.env.SHELL??"").split(/[/\\]/).pop()??"",o="";try{o=await ee("tty",[],500),o.includes("not a tty")&&(o="")}catch{o=""}return{os:e,os_version:t||null,user:n||null,shell:r||null,tty:o||null}}function dn(){return js()}import{createHash as Bp}from"node:crypto";import{homedir as Kp}from"node:os";import{dirname as pA,join as Gp,parse as dA,resolve as mA}from"node:path";var Vs="EV_AI_LAUNCHER_VERSION";var Js="EV_AI_HOOK_SOURCE",Ys="EV_AI_HOOK_FALLBACK_REASON",Xs="EV_AI_LAUNCHER_SCOPE",Ir="EV_AI_LAUNCHER_READY_FD";var qs="--defer-user-spec",mn="--cap",Zs=Buffer.from([1]);var nA=1024*1024,rA=4*1024*1024,oA=64*1024,sA=64*1024,iA=64*1024;var br=4096,aA=4*1024*1024;var ti="https://hooks.ev-ai.ai",ni=".claude/ev-ai-runtime-report.json",ri="config.json",zp="max_concurrent_hooks",hA=1024*1024,Wp=new Set(["localhost","127.0.0.1","[::1]","::1"]),Vp=["claude","cursor","codex"],oi=[ni,".cursor/ev-ai-runtime-report.json",".codex/ev-ai-runtime-report.json"],xr=/^[A-Za-z0-9._~-]+$/;function gn(e){return e!==void 0&&Vp.includes(e)}function si(e){if(!e||typeof e!="object")return;let t=e[zp];return typeof t=="number"&&Number.isSafeInteger(t)&&t>0?t:void 0}function Qs(e){if(e===void 0||!/^\d+$/.test(e))return;let t=Number(e);return Number.isSafeInteger(t)?t:void 0}function Pt(e,t){let n=e[t+1];return n&&!n.startsWith("--")?{value:n,next:t+1}:{next:t}}function Or(e){let t,n,r,o,s,i;for(let a=0;a<e.length;a++){let c=e[a];if(c!==void 0){if(c==="--runner"){let u=Pt(e,a);t=u.value,a=u.next;continue}if(c.startsWith("--runner=")){t=c.slice(9);continue}if(c==="--url"){let u=Pt(e,a);u.value&&(r=u.value),a=u.next;continue}if(c.startsWith("--url=")){r=c.slice(6);continue}if(c==="--token"){let u=Pt(e,a);u.value&&(o=u.value),a=u.next;continue}if(c.startsWith("--token=")){o=c.slice(8);continue}if(c==="--base-url"){let u=Pt(e,a);u.value&&(s=u.value),a=u.next;continue}if(c.startsWith("--base-url=")){s=c.slice(11);continue}if(c===mn){let u=Pt(e,a);i=Qs(u.value)??i,a=u.next;continue}if(c.startsWith(`${mn}=`)){i=Qs(c.slice(mn.length+1))??i;continue}c!==qs&&!c.startsWith("-")&&n===void 0&&(n=c)}}return{runner:gn(t)?t:void 0,event:n,collectorUrl:r,orgToken:o,baseUrl:s,...i!==void 0?{cap:i}:{}}}function _n(e,t=ti){let n=t.replace(/\/+$/,""),r=e.trim();return`${n}/${r}/hook`}function Nt(e=Kp()){return Gp(e,".ev-ai",ri)}function ii(e,t){return{...e,...t}}function ei(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<=32||n===127||n===39)return!0}return!1}function hn(e){try{let t=new URL(e);return t.protocol==="https:"?!0:t.protocol==="http:"?Wp.has(t.hostname):!1}catch{return!1}}function Tr(e){try{let n=new URL(e).pathname.split("/").filter(r=>r.length>0);if(n.length>=2&&n[n.length-1]==="hook"){let r=n[n.length-2];return r&&r.length>0?r:void 0}return}catch{return}}function kr(e){let t;try{t=new URL(e)}catch{return`invalid URL (got: ${e})`}if(!hn(e))return`must be https (or http on localhost / 127.0.0.1 / ::1) (got: ${e})`;let n=Tr(e);if(!n)return`must end with /{orgToken}/hook (got: ${e})`;if(!xr.test(n))return`org token must match ${xr.source} (got: ${n})`;if(ei(e))return`must not contain whitespace, control characters, or single quotes (got: ${e})`;if(ei(t.pathname))return`pathname must not contain whitespace, control characters, or single quotes (got: ${e})`}function ai(e){return new URL(e).toString()}function Pr(e){if(e.collector_url)return e.collector_url;let t=e.repo_ingest_token,n=typeof t=="string"?t.trim():void 0;return n?_n(n):""}function Sn(e){try{let t=new URL(e),n=t.pathname.split("/").filter(r=>r.length>0);return n.length>=2&&n[n.length-1]==="hook"&&(n[n.length-2]="***",t.pathname=`/${n.join("/")}`),t.toString()}catch{return"<invalid-url>"}}function ci(e){let t=e.collectorUrl?.trim(),n;if(t)n=t;else{let o=e.orgToken?.trim();o&&(n=_n(o,e.baseUrl?.trim()??void 0))}if(!n)return{};let r=kr(n);return r?{problem:r}:{url:ai(n)}}function wt(e){if(kr(e))return;let t;try{t=new URL(e)}catch{return}let n=Tr(e);if(!n)return;let o=t.pathname.split("/").filter(a=>a.length>0).slice(0,-2),s=o.length>0?`/${o.join("/")}`:"",i=`${t.origin}${s}/${n}`;return Bp("sha256").update(i).digest("hex").slice(0,32)}var yn=2;var En="ev-ai-agent-hook";function Jp(e){let t=e.split(/[/\\]/).pop();return t&&t.length>0?t:e}function ui(e){let t=Jp(e);return t===En||t===`${En}.exe`}var EA=`current/${En}`,yA=`.ev-ai/agent-hook/${En}`,li=5e3,fi=5e3,Nr=3e3;var Rn=3e3,pi=1500,di=4*1024,wr=256*1024,Yp=4*1024,mi=32*1024,Mr="1.3.4",RA=`@ev-ai/agent-hook@${Mr}`;import{existsSync as a_,mkdirSync as c_,readdirSync as u_,readFileSync as l_,unlinkSync as Ga,writeFileSync as f_}from"node:fs";import{homedir as za}from"node:os";import{join as eo}from"node:path";import{createHash as Ei,randomBytes as Zp}from"node:crypto";import{existsSync as yi,mkdirSync as Lr,readFileSync as Ri,unlinkSync as Ci,writeFileSync as Ai}from"node:fs";import{homedir as vr}from"node:os";import{dirname as Cn,join as Hr,resolve as Qp}from"node:path";var Xp=new Set(["action@github.com","noreply@github.com","noreply@anthropic.com","cursoragent@cursor.com"]),qp=new Set(["github-actions","github actions","dependabot","renovate","cursoragent","cursor agent"]);function fe(e,t){let n=(e??"").trim().toLowerCase(),r=(t??"").trim().toLowerCase();if(!n&&!r)return!1;if(n.includes("[bot]")||qp.has(n)||r.includes("[bot]")||Xp.has(r))return!0;if(r.endsWith("@users.noreply.github.com")){let o=r.slice(0,r.indexOf("@")),s=o.includes("+")?o.slice(o.indexOf("+")+1):o;if(s.endsWith("bot")||s.includes("[bot]"))return!0}return!1}var ed="installation.json",td="cloud-bootstrap.lock",nd=6e4;function Ii(e,t,n){let r=`${e}:${t??""}`;return n?`${n}:${r}`:r}function pe(e=vr()){return Hr(e,".ev-ai","agent-hook")}function rd(e=vr()){return Hr(pe(e),ed)}function bi(e){return Hr(Cn(e),td)}function xi(){return Zp(8).toString("hex")}function ft(e){return Ei("sha256").update(e).digest("hex").slice(0,16)}function $(e){if(e===void 0)return null;let t=e.trim();return t.length>0?t:null}function Oi(e){return/^[A-Za-z0-9._-]{8,64}$/.test(e)}function od(e=process.env){let t=$(e.EV_AI_HOOK_INSTALLATION_ID);if(t){if(!Oi(t)){O(`WARN: ignoring EV_AI_HOOK_INSTALLATION_ID (expected 8\u201364 chars [A-Za-z0-9._-], got length ${t.length})`);return}return t}}function Ti(e,t){return e&&Oi(e)?e:(e&&O(`WARN: ignoring installation id override (expected 8\u201364 chars [A-Za-z0-9._-], got length ${e.length})`),od(t))}function sd(e){return/^[0-9a-f]{16}$/.test(e)}function id(e=process.env){if($(e.GITHUB_ACTIONS)){let t=$(e.GITHUB_REPOSITORY_ID)??$(e.GITHUB_REPOSITORY),n=$(e.GITHUB_ACTOR)??$(e.GITHUB_TRIGGERING_ACTOR)??$(e.GITHUB_USER);if(t&&n)return ft(`github_actions|${t}|${n}`)}if($(e.CODESPACES)||$(e.CODESPACE_NAME)){let t=$(e.CODESPACE_NAME);if(t)return ft(`codespaces|${t}`);let n=$(e.GITHUB_REPOSITORY_ID)??$(e.GITHUB_REPOSITORY),r=$(e.GITHUB_USER)??$(e.GITHUB_ACTOR);if(n&&r)return ft(`codespaces|${n}|${r}`)}if($(e.GITLAB_CI)){let t=$(e.CI_PROJECT_ID)??$(e.CI_PROJECT_PATH),n=$(e.GITLAB_USER_LOGIN)??$(e.GITLAB_USER_EMAIL)??$(e.GITLAB_USER_NAME);if(t&&n)return ft(`gitlab|${t}|${n}`)}return null}var ad="cursoragent@cursor.com";function cd(e){let t=$(e.CURSOR_USER_EMAIL);return!t||t.toLowerCase()===ad?null:t}function ud(e,t){return $(e.CURSOR_PROJECT_DIR)??$(e.CLAUDE_PROJECT_DIR)??t}function ld(e){return Ot(e).replace(/\.git$/i,"").toLowerCase()}async function fd(e){let t=await ee("git",["config","--get","remote.origin.url"],2e3,{cwd:e});return t?ld(t):e}async function pd(e){let t=$(await ee("git",["config","--local","--get","user.email"],2e3,{cwd:e})||void 0);if(t&&!fe(null,t))return t;let n=$(await ee("git",["log","-1","--format=%ae"],2e3,{cwd:e})||void 0);return n&&!fe(null,n)?n:null}function dd(e,t){let n=ud(e,t);return n?ft(`cursor_cloud|${n}|${cd(e)??""}`):null}async function md(e,t){let n=$(e.CLAUDE_PROJECT_DIR)??t;if(!n)return null;let r=await fd(n),o=await pd(n);return ft(`claude_remote|${r}|${o??""}`)}function gi(e,t){let n=Ti(e,t);if(n)return n;let r=id(t);return r||xi()}async function gd(e){let n=await ee("git",["config","--get","remote.origin.url"],2e3,{cwd:e})||Qp(e);return Ei("sha256").update(n).digest("hex").slice(0,16)}function _d(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t={};for(let[n,r]of Object.entries(e))typeof r=="string"&&r.length>0&&(t[n]=r);return Object.keys(t).length>0?t:void 0}function hd(e){try{let t=JSON.parse(e);if(typeof t.installation_id!="string"||t.installation_id.length===0)return;let n=_d(t.platform_agent_ids);return{installation_id:t.installation_id,...t.pinned===!0?{pinned:!0}:{},...n?{platform_agent_ids:n}:{},...typeof t.operator_identity_hash=="string"?{operator_identity_hash:t.operator_identity_hash}:{},...typeof t.operator_identity_sent_at=="string"?{operator_identity_sent_at:t.operator_identity_sent_at}:{}}}catch{return}}function Ze(e){if(yi(e))try{return hd(Ri(e,"utf8"))}catch{}}function Ur(e){return Ze(e)}function ki(e,t,n){let r=Ze(e);if(!r||r.operator_identity_hash===t&&r.operator_identity_sent_at===n)return;let o={...r,operator_identity_hash:t,operator_identity_sent_at:n};try{me(e,`${JSON.stringify(o,null,2)}
15
15
  `)}catch(s){let i=s instanceof Error?s.message:String(s);O(`WARN: operator identity cache write failed open: ${i}`)}}function Pi(e,t=Date.now()){if(!e)return!0;if(Ze(e)?.operator_identity_hash)return!1;let n=bi(e);try{if(yi(n)){let r=Number.NaN;try{r=Number(Ri(n,"utf8").trim())}catch{}let o=t-r;if(Number.isFinite(o)&&o>=0&&o<nd)return!1;try{Ci(n)}catch{}}}catch{}try{return Lr(Cn(n),{recursive:!0}),Ai(n,`${t}
16
16
  `,{encoding:"utf8",flag:"wx"}),!0}catch(r){if(Li(r))return!1;let o=r instanceof Error?r.message:String(r);return O(`WARN: cloud bootstrap claim failed open: ${o}`),!0}}function Ni(e){if(e)try{Ci(bi(e))}catch{}}function wi(e,t){let r=Ze(e)?.platform_agent_ids?.[t];return typeof r=="string"&&r.length>0?r:void 0}function Mi(e,t,n){if(!n)return;let r=Ze(e);if(!r||r.platform_agent_ids?.[t]===n)return;let o={installation_id:r.installation_id,platform_agent_ids:{...r.platform_agent_ids,[t]:n},...r.operator_identity_hash?{operator_identity_hash:r.operator_identity_hash}:{},...r.operator_identity_sent_at?{operator_identity_sent_at:r.operator_identity_sent_at}:{}};try{me(e,`${JSON.stringify(o,null,2)}
17
17
  `)}catch(s){let i=s instanceof Error?s.message:String(s);O(`WARN: platform_agent_id cache write failed open: ${i}`)}}function Li(e){return e instanceof Error&&"code"in e&&e.code==="EEXIST"}function Sd(e,t){Lr(Cn(e),{recursive:!0}),Ai(e,`${JSON.stringify(t,null,2)}
@@ -20,7 +20,7 @@ var mp=Object.create;var Ns=Object.defineProperty;var gp=Object.getOwnPropertyDe
20
20
  `,1)[0]??"";return t-Number(n.trim())}catch{return Number.NaN}}function S_(e){let t=[];for(let n of __){let r=v(e,n).trim();r&&t.push(`${n}=${r}`)}return t.length===0?"":Tt(t.join("\0"))}function E_(e){let t=e.sessionId.trim();if(!t)return;let n=e.runnerEvent.trim().toLowerCase(),r=e.turnId.trim(),o=e.toolUseId.trim(),s=e.subagentId?.trim()??"",i=e.callFingerprint?.trim()??"",a=!!(o||r||s),c=g_.has(n);if(!a&&!c)return;let u=e.runnerPlatform.trim()||"unknown";return Tt(`${u}|${t}|${n}|${r}|${o}|${i}|${s}`)}function y_(e,t=Date.now()){let n;try{n=u_(e)}catch{return}let r=0;for(let o of n){if(r>=m_)break;r+=1;let s=eo(e,o),i=Va(s,t);if(!(!Number.isFinite(i)||i<Wa))try{Ga(s)}catch{}}}function R_(e,t,n=Date.now()){let r=eo(t,e);try{if(a_(r)){let o=Va(r,n);if(Number.isFinite(o)&&o>=0&&o<Wa)return!1;try{Ga(r)}catch{}}}catch{}try{c_(t,{recursive:!0}),f_(r,`${n}
21
21
  `,{encoding:"utf8",flag:"wx"})}catch(o){if(In(o))return!1;let s=o instanceof Error?o.message:String(o);return O(`WARN: event claim failed open: ${s}`),!0}return y_(t,n),!0}function C_(e,t,n){let r=Ft(e),o=qr(e),s=v(e,"tool_use_id"),i=v(e,"subagent_id")||v(e,"agent_id"),a=Dt(e,t,void 0,n),c=S_(e);return{runnerPlatform:a,sessionId:r,runnerEvent:t,turnId:o,toolUseId:s,subagentId:i,callFingerprint:c}}function Ja(e,t,n,r=za(),o=Date.now()){if(!d_)return!0;let s=E_(C_(e,t,n));if(!s)return!0;let i=R_(s,h_(r),o);return!i&&L("EV_AI_HOOK_DEBUG")&&O(`DEBUG: duplicate hook event suppressed (claim ${s.slice(0,8)}\u2026)`),i}import{mkdirSync as A_,readFileSync as ec,statSync as I_,unlinkSync as tc,writeFileSync as b_}from"node:fs";import{homedir as nc}from"node:os";import{join as rc}from"node:path";var x_=4,O_=10;function Ya(e=process.platform){return e==="win32"?x_:O_}function oc(e){return e==="session_start"||e==="session_end"}var sc=6e4,to=2e3,T_="slots",no=new Set,Xa=!1;function ic(e=nc()){return rc(pe(e),T_)}function ro(e,t=nc(),n=process.platform){if(e!==void 0)return e>0?e:Ya(n);let r=te(Nt(t),{});return si(r)??Ya(n)}function k_(e){if(!Number.isInteger(e)||e<=0)return!1;try{return process.kill(e,0),!0}catch(t){return t.code==="EPERM"}}function ac(e,t){return rc(e,`slot-${t}`)}function cc(e){return`${e.pid}
22
22
  ${e.acquiredAtMs}
23
- `}var P_=/^(\d+)\n(\d+)\n$/,N_=64;function w_(e){let t=P_.exec(e);if(!t)return;let n=Number(t[1]),r=Number(t[2]);return Number.isSafeInteger(n)&&n>0&&Number.isSafeInteger(r)?{pid:n,acquiredAtMs:r}:void 0}function uc(e,t=Date.now()){let n,r;try{let i=I_(e);if(!i.isFile())return!1;r=i.mtimeMs,n=i.size<=N_?ec(e,"utf8"):""}catch{return!1}let o=w_(n);if(!o)return Math.abs(t-r)<to;let s=t-o.acquiredAtMs;return s<-to||s>=sc?!1:k_(o.pid)}function lc(e,t=ic(),n=Date.now){for(let r=0;r<e;r+=1)if(!uc(ac(t,r),n()))return!0;return e<=0}function fc(e){return{pid:process.pid,acquiredAtMs:e}}function qa(e,t){let n=e instanceof Error?e.message:String(e);return O(`WARN: hook process slot failed open: ${n}`),fc(t)}function Za(e){return no.add(e),Xa||(Xa=!0,process.once("exit",()=>{for(let t of[...no])oo(t)})),e}function Qa(e){try{return b_(e.path,cc(e),{encoding:"utf8",flag:"wx",mode:384}),!0}catch(t){if(In(t))return!1;throw t}}function pc(e,t=ic(),n=Date.now){if(e<=0)return fc(n());let r;try{A_(t,{recursive:!0});for(let o=0;o<e;o+=1){let s={path:ac(t,o),pid:process.pid,acquiredAtMs:n()};if(Qa(s))return Za(s);if(!uc(s.path,n())){try{tc(s.path)}catch(i){if(!Mt(i)){r??=i;continue}}if(s.acquiredAtMs=n(),Qa(s))return Za(s)}}}catch(o){return qa(o,n())}return r===void 0?null:qa(r,n())}function oo(e,t=Date.now()){if(no.delete(e),!(!e.path||t-e.acquiredAtMs>=sc-to))try{ec(e.path,"utf8")===cc(e)&&tc(e.path)}catch{}}function so(e){L("EV_AI_HOOK_DEBUG")&&O(`DEBUG: hook process cap reached (${e}/${e}); event dropped`)}import{closeSync as M_,writeSync as L_}from"node:fs";function dc(e=process.env){let t=e[Ir];if(delete e[Ir],t===void 0)return;let n=Number.parseInt(t,10);if(!(!Number.isInteger(n)||n<3)){try{L_(n,Zs)}catch{}try{M_(n)}catch{}}}function io(e=process.env){let t=e[Vs];if(t)return{launcherVersion:t,hookSource:e[Js]??"",fallbackReason:e[Ys],launcherScope:e[Xs]}}function mc(e,t){return(e?wt(e):void 0)===t}import{realpathSync as oC}from"node:fs";import{homedir as sC}from"node:os";var B=je(Je(),1);import{existsSync as v_,readFileSync as H_}from"node:fs";import{homedir as gc}from"node:os";import{join as U_}from"node:path";var D_="cloud-cache.json",F_=1440*60*1e3,$_=900*1e3;function j_(e=gc()){return U_(pe(e),D_)}function B_(e){if(!v_(e))return;let t=ge(H_(e,"utf8"),{});if(!(typeof t.context!="string"||typeof t.probed_at!="number"||t.result!==null&&t.result!==void 0&&typeof t.result!="object"))return{context:t.context,probed_at:t.probed_at,result:t.result??null}}function K_(e,t){try{me(e,`${JSON.stringify(t)}
23
+ `}var P_=/^(\d+)\n(\d+)\n$/,N_=64;function w_(e){let t=P_.exec(e);if(!t)return;let n=Number(t[1]),r=Number(t[2]);return Number.isSafeInteger(n)&&n>0&&Number.isSafeInteger(r)?{pid:n,acquiredAtMs:r}:void 0}function uc(e,t=Date.now()){let n,r;try{let i=I_(e);if(!i.isFile())return!1;r=i.mtimeMs,n=i.size<=N_?ec(e,"utf8"):""}catch{return!1}let o=w_(n);if(!o)return Math.abs(t-r)<to;let s=t-o.acquiredAtMs;return s<-to||s>=sc?!1:k_(o.pid)}function lc(e,t=ic(),n=Date.now){for(let r=0;r<e;r+=1)if(!uc(ac(t,r),n()))return!0;return e<=0}function fc(e){return{pid:process.pid,acquiredAtMs:e}}function qa(e,t){let n=e instanceof Error?e.message:String(e);return O(`WARN: hook process slot failed open: ${n}`),fc(t)}function Za(e){return no.add(e),Xa||(Xa=!0,process.once("exit",()=>{for(let t of[...no])oo(t)})),e}function Qa(e){try{return b_(e.path,cc(e),{encoding:"utf8",flag:"wx",mode:384}),!0}catch(t){if(In(t))return!1;throw t}}function pc(e,t=ic(),n=Date.now){if(e<=0)return fc(n());try{A_(t,{recursive:!0})}catch(o){return qa(o,n())}let r;for(let o=0;o<e;o+=1)try{let s={path:ac(t,o),pid:process.pid,acquiredAtMs:n()};if(Qa(s))return Za(s);if(uc(s.path,n()))continue;try{tc(s.path)}catch(i){if(!Mt(i))throw i}if(s.acquiredAtMs=n(),Qa(s))return Za(s)}catch(s){r??=s}return r===void 0?null:qa(r,n())}function oo(e,t=Date.now()){if(no.delete(e),!(!e.path||t-e.acquiredAtMs>=sc-to))try{ec(e.path,"utf8")===cc(e)&&tc(e.path)}catch{}}function so(e){L("EV_AI_HOOK_DEBUG")&&O(`DEBUG: hook process cap reached (${e}/${e}); event dropped`)}import{closeSync as M_,writeSync as L_}from"node:fs";function dc(e=process.env){let t=e[Ir];if(delete e[Ir],t===void 0)return;let n=Number.parseInt(t,10);if(!(!Number.isInteger(n)||n<3)){try{L_(n,Zs)}catch{}try{M_(n)}catch{}}}function io(e=process.env){let t=e[Vs];if(t)return{launcherVersion:t,hookSource:e[Js]??"",fallbackReason:e[Ys],launcherScope:e[Xs]}}function mc(e,t){return(e?wt(e):void 0)===t}import{realpathSync as oC}from"node:fs";import{homedir as sC}from"node:os";var B=je(Je(),1);import{existsSync as v_,readFileSync as H_}from"node:fs";import{homedir as gc}from"node:os";import{join as U_}from"node:path";var D_="cloud-cache.json",F_=1440*60*1e3,$_=900*1e3;function j_(e=gc()){return U_(pe(e),D_)}function B_(e){if(!v_(e))return;let t=ge(H_(e,"utf8"),{});if(!(typeof t.context!="string"||typeof t.probed_at!="number"||t.result!==null&&t.result!==void 0&&typeof t.result!="object"))return{context:t.context,probed_at:t.probed_at,result:t.result??null}}function K_(e,t){try{me(e,`${JSON.stringify(t)}
24
24
  `)}catch(n){let r=n instanceof Error?n.message:String(n);O(`WARN: cloud cache write failed open: ${r}`)}}function G_(e,t,n){if(!e||e.context!==t)return!1;let r=e.result===null?$_:F_;return n-e.probed_at<r}async function z_(e){let t=await fetch("http://169.254.169.254/latest/api/token",{method:"PUT",headers:{"X-aws-ec2-metadata-token-ttl-seconds":"60"},signal:AbortSignal.timeout(e)}).catch(()=>{});if(!t?.ok)return;let n=(await t.text()).trim();if(!n)return;let r={"X-aws-ec2-metadata-token":n},[o,s]=await Promise.all([fetch("http://169.254.169.254/latest/meta-data/placement/region",{headers:r,signal:AbortSignal.timeout(e)}).catch(()=>{}),fetch("http://169.254.169.254/latest/meta-data/instance-id",{headers:r,signal:AbortSignal.timeout(e)}).catch(()=>{})]);if(!o?.ok&&!s?.ok)return;let i=o?.ok?(await o.text()).trim():"",a=s?.ok?(await s.text()).trim():"";if(!(!i&&!a))return{provider:"aws",region:i,instance_id:a}}async function W_(e){let t=await fetch("http://metadata.google.internal/computeMetadata/v1/instance/?recursive=true",{headers:{"Metadata-Flavor":"Google"},signal:AbortSignal.timeout(e)}).catch(()=>{});if(!t?.ok)return;let n=await t.json(),r=typeof n.zone=="string"?n.zone.split("/").pop()??"":"",o=n.id===void 0?"":String(n.id);if(!(!r&&!o))return{provider:"gcp",region:r,instance_id:o}}async function V_(e){let t=await fetch("http://169.254.169.254/metadata/instance?api-version=2021-02-01",{headers:{Metadata:"true"},signal:AbortSignal.timeout(e)}).catch(()=>{});if(!t?.ok)return;let n=await t.json(),r=n.compute?.location??"",o=n.compute?.vmId??"";if(!(!r&&!o))return{provider:"azure",region:r,instance_id:o}}async function J_(e){let t=await Promise.allSettled([z_(e),W_(e),V_(e)]);for(let n of t)if(n.status==="fulfilled"&&n.value)return n.value;return null}async function _c(e,t){if(e==="interactive")return null;let n=t?.home??gc(),r=t?.timeoutMs??1e3,o=t?.nowMs??Date.now(),s=j_(n),i=B_(s);if(G_(i,e,o))return i.result;let a=await J_(r);return K_(s,{context:e,probed_at:o,result:a}),a}var yc=je(Je(),1);import{existsSync as Sc}from"node:fs";import{homedir as Ec}from"node:os";import{join as jt,resolve as ao,sep as hc}from"node:path";function Fn(e,t,n){if(!Sc(e))return;let r=te(e,{});for(let[o,s]of Object.entries(r.mcpServers??{}))n.set(o,{declared:{name:o,...t},config:s})}function Y_(e,t,n){if(!Sc(e))return;let r=te(e,{}),o=ao(t),s=null;for(let a of Object.keys(r.projects??{})){let c=ao(a);(o===c||o.startsWith(c.endsWith(hc)?c:c+hc))&&(s===null||c.length>ao(s).length)&&(s=a)}if(s===null)return;let i=r.projects?.[s]?.mcpServers??{};for(let[a,c]of Object.entries(i))n.set(a,{declared:{name:a,source:"claude_json_project",sourcePath:".claude.json",scope:"user"},config:c})}function Rc(e,t,n,r){let o=new Map;for(let s of e.mcp_servers??[])s.name&&o.set(s.name,{declared:{name:s.name,source:"manifest"}});return n==="claude"?(Fn(jt(r,".claude.json"),{source:"claude_json_user"},o),Y_(jt(r,".claude.json"),t,o)):n==="cursor"&&Fn(jt(r,".cursor/mcp.json"),{source:"cursor_mcp_user"},o),Fn(jt(t,".mcp.json"),{source:"mcp_json"},o),Fn(jt(t,".cursor/mcp.json"),{source:"cursor_mcp"},o),o}async function co(e,t=process.cwd(),n="claude",r=Ec()){return[...Rc(e,t,n,r).values()].map(o=>o.declared)}function Cc(e,t,n=process.cwd(),r="claude",o=Ec()){let s=Rc(t,n,r,o),i=s.get(e);if(i!==void 0)return i.config??null;for(let[a,c]of s)if((0,yc.mcpServerNameMatchesToolSegment)(a,e))return c.config??null;return null}var X_=["CI","GITHUB_ACTIONS","GITLAB_CI","CIRCLECI","BUILDKITE","TF_BUILD","JENKINS_URL","JENKINS_HOME","CODEBUILD_BUILD_ID","DRONE","DRONE_BUILD_NUMBER","TEAMCITY_VERSION","TRAVIS","APPVEYOR","BITBUCKET_BUILD_NUMBER","KUBERNETES_SERVICE_HOST","REMOTE_CONTAINERS","DEVCONTAINER","GITHUB_REPOSITORY","GITHUB_REPOSITORY_ID","GITHUB_REF","GITHUB_SHA","GITHUB_RUN_ID","GITHUB_WORKFLOW","GITHUB_ACTOR","GITHUB_TRIGGERING_ACTOR","GITHUB_ACTOR_ID","GITHUB_USER","GITLAB_USER_LOGIN","GITLAB_USER_NAME","GITLAB_USER_EMAIL","BUILD_REQUESTEDFOR","BUILD_REQUESTEDFOREMAIL","BUILD_REQUESTEDFORID","BUILDKITE_BUILD_CREATOR","BUILDKITE_BUILD_CREATOR_EMAIL","BUILD_USER","BUILD_USER_ID","BUILD_USER_EMAIL","CHANGE_AUTHOR","CHANGE_AUTHOR_EMAIL","CIRCLE_USERNAME","CODEBUILD_INITIATOR","DRONE_COMMIT_AUTHOR","DRONE_COMMIT_AUTHOR_NAME","DRONE_COMMIT_AUTHOR_EMAIL","EV_AI_HOOK_OPERATOR_NAME","EV_AI_HOOK_OPERATOR_EMAIL","EV_AI_HOOK_OPERATOR_LOGIN","GIT_AUTHOR_NAME","GIT_AUTHOR_EMAIL","GIT_COMMITTER_NAME","GIT_COMMITTER_EMAIL","EMAIL","RUNNER_OS","RUNNER_ARCH","NODE_ENV","TERM_PROGRAM","CLAUDE_CODE_REMOTE","CLAUDE_CODE_REMOTE_SESSION_ID","CURSOR_AGENT","CURSOR_VERSION","CURSOR_CODE_REMOTE","CURSOR_USER_EMAIL","CODESPACES","CODESPACE_NAME","ANTHROPIC_BASE_URL","OPENAI_BASE_URL","OPENAI_API_BASE","AZURE_OPENAI_ENDPOINT","GOOGLE_GEMINI_BASE_URL","GEMINI_API_BASE","CLAUDE_CODE_USE_BEDROCK","CLAUDE_CODE_USE_VERTEX"],q_=["CURSOR_PROJECT_DIR"],Z_=new Set(["key","api-key","api_key","apikey","token","sig","signature","access_token","password","pwd","secret","client_secret"]);function Q_(e){try{let t=new URL(e);(t.username||t.password)&&(t.username="",t.password="");for(let[n]of t.searchParams)Z_.has(n.toLowerCase())&&t.searchParams.set(n,"[redacted]");return t.toString()}catch{return e}}function Ac(e=process.env){let t=X_.map(r=>Object.prototype.hasOwnProperty.call(e,r)?{name:r,present:!0,value:Q_(e[r]??"")}:{name:r,present:!1}),n=q_.map(r=>({name:r,present:Object.prototype.hasOwnProperty.call(e,r)&&!!e[r]}));return[...t,...n]}import{homedir as kh}from"node:os";import{homedir as Ic}from"node:os";import{join as eh}from"node:path";function th(e=Ic()){return eh(e,".claude.json")}function $n(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function bc(e=Ic()){let n=te(th(e),{}).oauthAccount;if(!n||typeof n!="object")return null;let r=$n(n.emailAddress),o=$n(n.fullName)??$n(n.displayName),s=$n(n.accountUuid),i=r??s;return!i||fe(o,r)?null:{git_user_name:null,git_user_email:null,platform_login:i,identity_source:"claude_oauth"}}import{homedir as Tc}from"node:os";import{join as xc}from"node:path";var nh="https://api.openai.com/auth";function _t(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function kc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function rh(e){let t=e.split(".");if(t.length!==3||t.some(r=>r.length===0))return null;let n=t[1];if(!n)return null;try{let r=JSON.parse(Buffer.from(n,"base64url").toString("utf8"));return kc(r)}catch{return null}}function Oc(e,t,n){return _t(e[n])??_t(t?.[n])}function oh(e=process.env,t=Tc()){let n=_t(e.CODEX_HOME)??xc(t,".codex");return xc(n,"auth.json")}function Pc(e=process.env,t=Tc()){let n=te(oh(e,t),{}),r=_t(n.auth_mode);if(r!==null&&r!=="chatgpt"||r===null&&_t(n.OPENAI_API_KEY))return null;let o=_t(n.tokens?.id_token);if(!o)return null;let s=rh(o);if(!s)return null;let i=kc(s[nh]),a=Oc(s,i,"name"),c=Oc(s,i,"email");return!c||fe(a,c)?null:{git_user_name:null,git_user_email:null,platform_login:c,identity_source:"codex_oauth"}}import{homedir as Kn}from"node:os";import{join as He}from"node:path";import{join as sh}from"node:path";var ih="cursor-ide-identity.json",ah=840*60*1e3;function wc(e){return sh(pe(e),ih)}function Nc(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function Mc(e){let t=te(e,{}),n=t.read_at_ms,r=t.db_path;if(!(typeof n!="number"||!Number.isFinite(n)||typeof r!="string"))return{read_at_ms:n,db_path:r,email:Nc(t.email),auth_id:Nc(t.auth_id)}}function Lc(e,t,n){if(e?.db_path!==t)return!1;let r=n-e.read_at_ms;return r>=0&&r<ah}function vc(e,t){try{me(e,`${JSON.stringify(t)}
25
25
  `)}catch(n){let r=n instanceof Error?n.message:String(n);O(`WARN: cursor IDE identity cache write failed open: ${r}`)}}import{execFileSync as ch}from"node:child_process";import{existsSync as uh}from"node:fs";import{createRequire as lh}from"node:module";import{pathToFileURL as fh}from"node:url";var Uc=lh(import.meta.url),jn=`
26
26
  SELECT key, value
@@ -32,7 +32,7 @@ ORDER BY key
32
32
  `.trim(),uo=new Map;function Hc(e){if(typeof e=="string"){let t=e.trim();return t.length>0?t:null}if(e instanceof Uint8Array){let t=Buffer.from(e).toString("utf8").trim();return t.length>0?t:null}return null}function Dc(e){return e.toLowerCase().includes("token")}function Fc(e){let t=new Map;if(!Array.isArray(e))return t;for(let n of e){if(n===null||typeof n!="object")continue;let r=n,o=Hc(r.key),s=Hc(r.value);o&&s&&!Dc(o)&&t.set(o,s)}return t}function ph(e){let t=fh(e);return t.search="mode=ro&immutable=1",t.href}function dh(e){try{let t=Uc("bun:sqlite");if(typeof t.Database!="function")return null;let n=new t.Database(e,{readonly:!0,create:!1});try{let r=n.query?.(jn)??n.prepare(jn);return Fc(r.all?.())}finally{n.close?.()}}catch{return null}}function mh(e){let t=process.emitWarning.bind(process);process.emitWarning=((n,...r)=>{(typeof n=="string"?n:n instanceof Error?n.message:"").includes("SQLite is an experimental feature")||t(n,...r)});try{return e()}finally{process.emitWarning=t}}function gh(e){try{return mh(()=>{let t=Uc("node:sqlite");if(typeof t.DatabaseSync!="function")return null;let n=new t.DatabaseSync(e,{readOnly:!0});try{return Fc(n.prepare(jn).all?.())}finally{n.close?.()}})}catch{return null}}function _h(e){let t=new Map;for(let n of e.split(`
33
33
  `)){let r=n.trimEnd();if(!r)continue;let o=r.indexOf(" ");if(o<=0)continue;let s=r.slice(0,o).trim(),i=r.slice(o+1).trim();s&&i&&!Dc(s)&&t.set(s,i)}return t}function hh(e){try{let t=ch("sqlite3",["-noheader","-batch","-separator"," ",e,jn],{encoding:"utf8",timeout:2e3,maxBuffer:65536,windowsHide:!0,stdio:["ignore","pipe","ignore"]});return _h(t)}catch{return null}}function $c(e){let t=uo.get(e);if(t)return t;if(!uh(e)){let o=new Map;return uo.set(e,o),o}let n=ph(e),r=dh(n)??hh(n)??gh(n)??new Map;return uo.set(e,r),r}var Sh="cursorAuth/cachedEmail",Eh="cursorAuth/stripeMembershipAuthId";function Bn(e){if(e===void 0)return null;let t=e.trim();return t.length>0?t:null}function yh(e=Kn(),t=process.platform,n=process.env){let r=Bn(n.VSCODE_PORTABLE);if(r)return He(r,"user-data");let o=Bn(n.VSCODE_APPDATA);if(o)return He(o,"Cursor");switch(t){case"darwin":return He(e,"Library","Application Support","Cursor");case"win32":return He(Bn(n.APPDATA)??He(e,"AppData","Roaming"),"Cursor");default:return He(Bn(n.XDG_CONFIG_HOME)??He(e,".config"),"Cursor")}}function Rh(e=Kn()){return He(e,".cursor","cli-config.json")}function Ch(e=Kn(),t=process.platform,n=process.env){return He(yh(e,t,n),"User","globalStorage","state.vscdb")}function Bt(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function Ah(e){return typeof e.userId=="number"&&Number.isFinite(e.userId)?String(e.userId):Bt(e.userId)}function Ih(e){return Bt(e.email)??Bt(e.authId)??Ah(e)}function lo(e){let t=Bt(e.email),n=Bt(e.displayName),r=Ih(e);return!r||fe(n,t)?null:{git_user_name:null,git_user_email:null,platform_login:r,identity_source:"cursor_oauth"}}function bh(e){let n=te(Rh(e),{}).authInfo;return!n||typeof n!="object"?null:lo(n)}function xh(e,t,n){let r=Ch(e,process.platform,t),o=wc(e),s=Mc(o);if(Lc(s,r,n))return lo({email:s?.email,authId:s?.auth_id});let i=$c(r),a=i.get(Sh)??null,c=i.get(Eh)??null;return vc(o,{read_at_ms:n,db_path:r,email:a,auth_id:c}),lo({email:a,authId:c})}function jc(e=Kn(),t=process.env,n=Date.now()){return bh(e)??xh(e,t,n)}import{createHash as Oh}from"node:crypto";import{resolve as Th}from"node:path";function X(e){return Oh("sha256").update(e).digest("hex").slice(0,16)}function fo(e){return X(Th(e))}function he(e,t){return`${e}\0${t}`}function Bc(e){let t=e.indexOf("\0");return t<=0?null:{path:e.slice(0,t),name:e.slice(t+1)}}function Kt(e){let n=[...e].sort((r,o)=>{let s=r.path.localeCompare(o.path);return s!==0?s:r.name.localeCompare(o.name)}).map(r=>`${r.path}|${r.name}|${r.content_hash}`).join(`
34
34
  `);return X(n)}function Ph(e,t,n="git_config",r=null){return X(`${e??""}|${t??""}|${r??""}|${n}`)}function Nh(e){let t=null,n=null;for(let r of e.split(`
35
- `)){let o=r.trim();if(!o)continue;let s=o.indexOf(" ");if(s<=0)continue;let i=o.slice(0,s).toLowerCase(),a=o.slice(s+1).trim();a&&(i==="user.name"?t=a:i==="user.email"&&(n=a))}return{git_user_name:t,git_user_email:n,platform_login:null}}async function wh(e,t=ee){let n=await t("git",["config","--get-regexp","^user\\.(name|email)$"],2e3,{cwd:e});return Nh(n)}function Mh(e=process.env){let t=j(e.GIT_AUTHOR_NAME),n=j(e.GIT_AUTHOR_EMAIL);if(t||n)return{git_user_name:t,git_user_email:n,platform_login:null,identity_source:"git_env"};let r=j(e.GIT_COMMITTER_NAME),o=j(e.GIT_COMMITTER_EMAIL);if(r||o)return{git_user_name:r,git_user_email:o,platform_login:null,identity_source:"git_env"};let s=j(e.EMAIL);return s?{git_user_name:null,git_user_email:s,platform_login:null,identity_source:"git_env"}:null}function Ue(e,t,n,r=null){return!e&&!t&&!r?null:{git_user_name:e,git_user_email:t,platform_login:r,identity_source:n}}function Lh(e=process.env){let t=j(e.EV_AI_HOOK_OPERATOR_EMAIL),n=j(e.EV_AI_HOOK_OPERATOR_LOGIN),r=Ue(j(e.EV_AI_HOOK_OPERATOR_NAME),t,"configured",t??n);if(r)return r;let o=j(e.GITHUB_ACTOR)??j(e.GITHUB_TRIGGERING_ACTOR)??j(e.GITHUB_USER),s=Ue(o,null,"github",o);if(s)return s;let i=j(e.GITLAB_USER_LOGIN),a=j(e.GITLAB_USER_EMAIL),c=Ue(j(e.GITLAB_USER_NAME)??i,a,"gitlab",a??i);if(c)return c;let u=j(e.BUILD_REQUESTEDFOREMAIL),l=Ue(j(e.BUILD_REQUESTEDFOR),u,"azure_devops",u??j(e.BUILD_REQUESTEDFORID));if(l)return l;let p=j(e.BUILDKITE_BUILD_CREATOR_EMAIL),f=Ue(j(e.BUILDKITE_BUILD_CREATOR),p,"buildkite",p);if(f)return f;let m=j(e.BUILD_USER_EMAIL)??j(e.CHANGE_AUTHOR_EMAIL),g=Ue(j(e.BUILD_USER)??j(e.CHANGE_AUTHOR),m,"jenkins",m??j(e.BUILD_USER_ID));if(g)return g;let S=j(e.CIRCLE_USERNAME),C=Ue(S,null,"circleci",S);if(C)return C;let A=j(e.CODEBUILD_INITIATOR),T=Ue(A,null,"codebuild",A);if(T)return T;let x=j(e.DRONE_COMMIT_AUTHOR_EMAIL),M=j(e.DRONE_COMMIT_AUTHOR),k=Ue(M??j(e.DRONE_COMMIT_AUTHOR_NAME),x,"drone",x??M);if(k)return k;if(Kc(e.CLAUDE_CODE_REMOTE)||Kc(e.CURSOR_AGENT)){let K=j(e.CURSOR_USER_EMAIL);return{git_user_name:null,git_user_email:null,platform_login:K&&!fe(null,K)?K:null,identity_source:"cloud"}}return null}function po(e){return!!((e.git_user_name??e.git_user_email)&&!fe(e.git_user_name,e.git_user_email))}function j(e){if(e===void 0)return null;let t=e.trim();return t.length>0?t:null}function Kc(e){if(e===void 0||e==="")return!1;let t=e.trim().toLowerCase();return t!=="0"&&t!=="false"&&t!=="no"}function vh(e,t,n){return e==="claude"?bc(t):e==="cursor"?jc(t,n):e==="codex"?Pc(n,t):null}async function mo(e,t=ee,n=process.env,r={}){let o=await wh(e,t),s=Mh(n),i=po(o)?o:s&&po(s)?s:null,a=vh(r.runnerPlatform,r.home??kh(),n);if(a)return{git_user_name:i?.git_user_name??null,git_user_email:i?.git_user_email??null,platform_login:a.platform_login,identity_source:a.identity_source};let c=Lh(n);return c?.platform_login?{git_user_name:i?.git_user_name??null,git_user_email:i?.git_user_email??null,platform_login:c.platform_login,identity_source:c.identity_source}:i?{...i,platform_login:null,identity_source:po(o)?"git_config":"git_env"}:c||(o.git_user_name||o.git_user_email?{...o,identity_source:"git_config"}:s||{git_user_name:null,git_user_email:null,platform_login:null,identity_source:"git_config"})}async function go(e){let{gitRoot:t,installationStorePath:n,forceResend:r}=e,o=e.exec??ee,s=e.env??process.env,i=await mo(t,o,s,{runnerPlatform:e.runnerPlatform,home:e.home}),a=Ph(i.git_user_name,i.git_user_email,i.identity_source,i.platform_login),u=(n?Ur(n):void 0)?.operator_identity_hash;if(!(r||u!==void 0&&u!==a||!u))return{commit:()=>{}};let m=n;return{operator:i,commit:()=>{m&&ki(m,a,ln())}}}function _o(e){return e?!Ur(e)?.operator_identity_hash:!0}function Gc(e){return!0}import{existsSync as Xy,readFileSync as qy}from"node:fs";import{homedir as hf}from"node:os";import{join as Ct,resolve as Zy}from"node:path";import{basename as By,join as Rt}from"node:path";import{dirname as nu,resolve as Wn}from"node:path";import{existsSync as Hh}from"node:fs";import{homedir as Vc}from"node:os";import{relative as Jc,resolve as Te,sep as Ye}from"node:path";var Uh=["session_id","conversation_id","turn_id","generation_id","prompt.id","prompt_id","hook_event_name","event","source","status","stop_reason","reason","tool_name","tool","tool_use_id","skill_name","command_name","expansion_type","command_source","permission_mode","model","model_id","agent_id","agent_type","subagent_id","subagent_type","subagent_model","is_parallel_worker","effort","effort.level","duration_ms","duration","sandbox","failure_type","is_interrupt"],Dh=["prompt","tool_input","tool_response","last_assistant_message","command"],Fh=new Set;function $h(e){switch(e?.toLowerCase()){case"beforemcpexecution":return new Set(["command"]);case"stopfailure":return new Set(["last_assistant_message"]);default:return Fh}}var Yc=new Set(["on","1","true"]);function Ro(e){let t=L("EV_AI_HOOK_CAPTURE_PROMPT")?.trim();return t!==void 0&&t!==""?Yc.has(t.toLowerCase()):e?.collect_prompt===!0}function Xc(e,t){let n=Co(e);if(n==="allowlist")return"off";if(n==="full")return"full";let r=L("EV_AI_HOOK_CAPTURE_PROMPT")?.trim();return r!==void 0&&r!==""?Yc.has(r.toLowerCase())?"env":"off":t?.collect_prompt===!0?"config":"off"}function qc(e){return Co(e)==="allowlist"}function Co(e){return L("EV_AI_HOOK_CAPTURE_CONTENT")?.toLowerCase()==="off"||e.capture_hook_input==="allowlist"?"allowlist":e.capture_hook_input==="full"||e.debug===!0||L("EV_AI_HOOK_CAPTURE_FULL_INPUT")==="1"?"full":"content"}function jh(e){let t={};for(let n of Uh){let r=Me(e,n);r!==void 0&&(t[n]=r)}return t}function Gn(e,t){if(typeof e!="string"||e.length===0||!t)return null;let n=Te(e),r=Te(t),o=Jc(r,n);return!o||o==="."?".":o.startsWith(`..${Ye}`)||o===".."||Te(r,o)!==n?null:o.split(Ye).join("/")}function Zc(e,t){let n=Jc(Te(t),Te(e)).split(Ye).join("/");return!n||n==="."?null:n===".."||n.startsWith("../")&&n.split("/").every(r=>r==="..")?n:null}function Qc(e){return typeof e!="string"||e.length===0?null:Te(e).split(Ye).join("/")}function Bh(){let e=L("CURSOR_PROJECT_DIR");if(!e)return null;let t=Te(e);return Hh(t)?t.split(Ye).join("/"):null}function So(e,t){return Gn(e,t)!==null}function Kh(e,t){let n=Te(t??Vc(),".cursor").split(Ye).join("/");return So(e,n)}function Gh(e,t,n){return t!==null&&So(e,t)?!0:t!==null&&Kh(e,n.home)?!1:n.inGitRepo===!0&&n.gitRoot!==void 0&&So(e,n.gitRoot)?!0:t===null}function eu(e,t){let n=Qc(e.cwd);if(n!==null)return n;let r=Te(process.cwd()).split(Ye).join("/"),o=Bh();return Gh(r,o,t)?r:o??r}function Ao(e,t={}){return eu(e,t)}function Io(e,t=Vc()){let n=Te(t).split(Ye).join("/").replace(/\/$/,"");return n.length<=1?e:e===n?"~":e.startsWith(`${n}/`)?`~${e.slice(n.length)}`:e}function zc(e,t,n){let r=Qc(n.launchCwd)??eu(t,n);e.cwd=Io(r,n.home);let o=n.inGitRepo===!0&&n.gitRoot!==void 0?Gn(r,n.gitRoot):null;o!==null&&(e.cwd_relative=o)}var tu="\u2026[truncated]\u2026",Eo=Buffer.byteLength(tu,"utf8"),zh=8;function Gt(e){return Buffer.byteLength(JSON.stringify(e),"utf8")}function Wc(e,t){if(t<=0)return"";let n=Buffer.from(e,"utf8");return n.length<=t?e:n.subarray(0,t).toString("utf8")}function Wh(e,t){if(t<=0)return"";let n=Buffer.from(e,"utf8");return n.length<=t?e:n.subarray(n.length-t).toString("utf8")}function Vh(e,t){if(Buffer.byteLength(e,"utf8")<=t)return e;if(t<=Eo)return Wc(e,t);let r=t-Eo,o=Math.ceil(r/2),s=Math.floor(r/2);return`${Wc(e,o)}${tu}${Wh(e,s)}`}function yo(e,t,n){if(typeof e=="string"){n.push({path:t,value:e,bytes:Buffer.byteLength(e,"utf8")});return}if(Array.isArray(e)){e.forEach((r,o)=>{yo(r,[...t,o],n)});return}if(e!==null&&typeof e=="object")for(let[r,o]of Object.entries(e))t.length===0&&r.startsWith("_")||yo(o,[...t,r],n)}function Jh(e,t,n){let r=e;for(let s=0;s<t.length-1;s++){let i=t[s];if(i===void 0)return;r=(Array.isArray(r),r[i])}let o=t[t.length-1];if(!(o===void 0||r===null||typeof r!="object")){if(Array.isArray(r)){r[o]=n;return}r[o]=n}}var Yh=256;function Xh(e,t,n){let r=n,o=Math.max(n,e[0]?.bytes??n);for(;r<o;){let s=Math.ceil((r+o)/2),i=0;for(let a of e)a.bytes>s&&(i+=a.bytes-s);i>=t?r=s:o=s-1}return r}function qh(e,t,n){let r=Number.POSITIVE_INFINITY;for(let o=0;o<6;o++){let s=Gt(e);if(s<=t)return;let i=[];yo(e,[],i),i.sort((l,p)=>p.bytes-l.bytes);let a=i.filter(l=>l.bytes>n);if(a.length===0)return;let c=Xh(a,s-t,n),u=Math.max(n,Math.min(c,r-1));if(u>=r)return;r=u;for(let l of a)l.bytes>r&&Jh(e,l.path,Vh(l.value,r))}}function Zh(e,t){let n=Math.max(0,t-Yh),r=Object.keys(e).filter(s=>!s.startsWith("_")).map(s=>({key:s,bytes:Gt(e[s])})).sort((s,i)=>i.bytes-s.bytes),o=[];for(let{key:s}of r){if(Gt(e)<=n)break;delete e[s],o.push(s)}o.length>0&&(e._dropped_keys=o.slice(0,10))}function ho(e,t){let n=Gt(e);if(n<=t)return e;let r=structuredClone(e);return r._truncated=!0,r._original_bytes=n,qh(r,t,Eo+zh),Gt(r)>t&&Zh(r,t),r}function Qh(e,t,n){let r=$h(n.runnerEvent),o=n.promptCapture??Ro();for(let s of Dh){if(r.has(s)||s==="prompt"&&!o)continue;let i=t[s];i!==void 0&&(e[s]=i)}}function zn(e,t,n={}){let r=Co(t);if(r==="full"){let s={...e};return delete s.cwd,delete s.transcript_path,zc(s,e,n),ho(s,wr)}let o=jh(e);return zc(o,e,n),r==="content"?(Qh(o,e,n),ho(o,wr)):ho(o,di)}function eS(e){return typeof e=="string"&&e.length>0}function bo(e){let t=Wn(e.home),n=Wn(e.launchCwd),r=e.gitRoot?Wn(e.gitRoot):null,o=new Set,s=[],i=null;e.inGitRepo&&eS(e.remote)&&r!==null&&r!==t&&(i=r,o.add(r)),n!==t&&!o.has(n)&&(s.push({scope:"cwd",dir:n}),o.add(n)),i!==null&&s.push({scope:"repo",dir:i});let a=null,c=r!==null&&Gn(n,r)!==null;if(e.inGitRepo&&r!==null&&r!==t&&c){let u=nu(r);for(;;){let l=Wn(u);if(l===t)break;let p=nu(l);if(p===l)break;if(e.hasProjectSpec(l)){s.push({scope:"parent",dir:l}),a=Zc(l,n);break}u=p}}return{anchors:s,parentRel:a}}import{existsSync as ru,readdirSync as tS,realpathSync as nS}from"node:fs";import{basename as rS,dirname as oS,relative as sS,resolve as iS,sep as aS}from"node:path";var xo=400,Vn=class{constructor(t,n={}){this.home=t;this.pathMode=n.pathMode??"home-relative",this.maxEntries=n.maxEntries??Be}components=[];truncated=!1;pathMode;maxEntries;pluginExpandRemaining;seenRealpaths=new Set;componentPath(t){if(this.pathMode==="tilde"){let r=iS(t).split(aS).join("/");return Io(r,this.home)}let n=sS(this.home,t).replace(/\\/g,"/");return!n||n.startsWith("..")?`external/${X(oS(t))}/${rS(t)}`:n}claimFile(t){try{let n=nS(t);return this.seenRealpaths.has(n)?!1:(this.seenRealpaths.add(n),!0)}catch{return this.seenRealpaths.has(t)?!1:(this.seenRealpaths.add(t),!0)}}get atGlobalCap(){return this.truncated||this.components.length>=this.maxEntries}get pluginBudgetSpent(){return this.pluginExpandRemaining!==void 0&&this.pluginExpandRemaining<=0}readEntries(t){if(!ru(t))return[];try{return tS(t,{withFileTypes:!0})}catch{return[]}}readJson(t,n){if(ru(t))return te(t,n)}push(t){return this.components.length>=this.maxEntries?(this.truncated=!0,!1):this.pluginExpandRemaining!==void 0&&this.pluginExpandRemaining<=0?!1:(this.pluginExpandRemaining!==void 0&&(this.pluginExpandRemaining-=1),this.components.push(t),!0)}withPluginExpandCap(t,n){let r=this.pluginExpandRemaining;this.pluginExpandRemaining=t;try{let o=n(),s=t-(this.pluginExpandRemaining??0);return{result:o,expanded:s}}finally{this.pluginExpandRemaining=r}}};import{existsSync as Go,readFileSync as PE,statSync as NE}from"node:fs";import{basename as Sl,join as ot,relative as zo}from"node:path";var ml=je(dl());var TE=["**/node_modules/**","**/dist/**","**/build/**","**/.git/**","**/.trash/**","**/.claude/cache/**","**/.codex/skills/.system/**","**/vendor/**","**/.yarn/**","**/coverage/**","**/.next/**"],gl=TE.map(e=>ml.default.matcher(e,{dot:!0}));function kE(e){return e===""?!1:gl.some(t=>t(`${e}/`))}function _l(e,t){if(t==="")return!1;if(e==="")return kE(t);let n=e.replace(/\/+$/,"");return gl.some(r=>r(`${n}/${t}/`)&&!r(`${n}/`))}var Wo=100*1024,wE=4;function ME(e){return e.length<=Wo?e:`${e.slice(0,Wo-1)}\u2026`}function LE(e){try{let t=PE(e),n=t.toString("utf8");return{hash:X(t),length:t.length,text:ME(n)}}catch{return null}}var hl={HOOK:"EVENT",COMMAND:"EXPLICIT_INVOCATION",MEMORY:void 0,MCP_SERVER:void 0,PLUGIN:void 0,SKILL:"UNSPECIFIED",RULE:"UNSPECIFIED",SUBAGENT:"UNSPECIFIED"};function vE(e){return e in hl?hl[e]:"UNSPECIFIED"}function Et(e,t){if(!e.claimFile(t.absolutePath))return!1;let n=LE(t.absolutePath);if(!n)return!1;let r=t.name??Sl(t.absolutePath).replace(/\.(md|mdc|toml)$/i,""),o={kind:t.kind,name:r,path:e.componentPath(t.absolutePath),text:n.text,content_hash:n.hash,content_length:n.length,origin:t.origin,enabled:t.enabled},s=vE(t.kind);return s&&(o.trigger=s),t.attributes&&(o.attributes=t.attributes),e.push(o)}function HE(e,t,n){let r=zo(e,t).replace(/\\/g,"/");return!r||r.startsWith("..")?Sl(t).replace(/\.(md|mdc|toml)$/i,""):n?r.replace(/\.(md|mdc|toml)$/i,""):r}function st(e,t){let{dir:n,kind:r,origin:o,enabled:s,nested:i,extensions:a,skipDirs:c}=t;Vo(e,{walkRoot:n,currentDir:n,depth:0,kind:r,origin:o,enabled:s,nested:i,extensions:a,skipDirs:c})}function Vo(e,t){let{walkRoot:n,currentDir:r,depth:o,kind:s,origin:i,enabled:a,nested:c,extensions:u,skipDirs:l}=t;if(!(o>wE))for(let p of e.readEntries(r)){if(e.atGlobalCap){e.truncated=!0;return}if(e.pluginBudgetSpent)return;if(p.isDirectory()&&_l(n.replace(/\\/g,"/"),zo(n,ot(r,p.name)).replace(/\\/g,"/"))||p.isDirectory()&&l?.includes(ot(r,p.name)))continue;if(c){if(!p.isDirectory())continue;let g=ot(r,p.name,c);if(Go(g)){let S=zo(n,ot(r,p.name)).replace(/\\/g,"/");Et(e,{absolutePath:g,kind:s,origin:i,enabled:a,name:S||p.name});continue}Vo(e,{walkRoot:n,currentDir:ot(r,p.name),depth:o+1,kind:s,origin:i,enabled:a,nested:c,extensions:u,skipDirs:l});continue}if(p.isDirectory()){Vo(e,{walkRoot:n,currentDir:ot(r,p.name),depth:o+1,kind:s,origin:i,enabled:a,nested:c,extensions:u,skipDirs:l});continue}if(!p.isFile()||!u)continue;let f=p.name.toLowerCase();if(!u.some(g=>f.endsWith(g)))continue;let m=ot(r,p.name);Et(e,{absolutePath:m,kind:s,origin:i,enabled:a,name:HE(n,m,!0)})}}function El(e){for(let t of e)if(Go(t))try{if(NE(t).size>0)return t}catch{continue}return e.find(t=>Go(t))}import{existsSync as py,readFileSync as dy}from"node:fs";var er=je(Je(),1);var UE="<omitted>",DE=["package_name","package_spec","package_version","package_version_source"],yl=100,Rl=120,tr=[{raw:"tools",attr:"tools"},{raw:"autoApprove",attr:"auto_approve"},{raw:"auto_approve",attr:"auto_approve"},{raw:"alwaysAllow",attr:"always_allow"},{raw:"always_allow",attr:"always_allow"},{raw:"enabledTools",attr:"enabled_tools"},{raw:"enabled_tools",attr:"enabled_tools"},{raw:"disabledTools",attr:"disabled_tools"},{raw:"disabled_tools",attr:"disabled_tools"}],Cl=new Set(tr.map(e=>e.attr)),FE=["enabled","disabled"],$E=["serverUrl","auth","bearer_token_env_var","default_tools_approval_mode","defaultToolsApprovalMode","env_vars","env_http_headers","http_headers"],jE=new Set(["type","command","url","args","env","envVars","headers",...FE,...$E,...tr.map(e=>e.raw)]),BE=new Set(["transport","command_or_url","args","env_var_names","headers_present","auth","bearer_token_env_var","default_tools_approval_mode","env_http_header_names",...DE,...Cl,...[...Cl].map(e=>`${e}_truncated`)]);function Al(e,t){for(let n of t)jE.has(n)||BE.has(n)||(e[n]=UE)}var KE=/^(authorization|auth|api[-_]?key|access[-_]?token|refresh[-_]?token|secret|password|passwd|token|bearer|client[-_]?secret|client[-_]?id|private[-_]?key|signing[-_]?key)$/i,GE=/(?:^|[-_])(secret|password|passwd|token|api[-_]?key|private[-_]?key|signing[-_]?key|client[-_]?secret|client[-_]?id)(?:[-_]|$)/i,zE=/^(sk-|ghp_|gho_|github_pat_|xox[baprs]-|AKIA|ASIA|AIza|ya29\.)/,WE=/^bearer(?:\s+|$)/i;function nr(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function Il(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}function Jo(e){if(Array.isArray(e)){let n=[];for(let r of e){if(typeof r!="string"||r.length===0)continue;let o=r.split("=",1)[0]?.trim();o&&n.push(o)}return n}let t=nr(e);return t?Object.keys(t).filter(n=>n.length>0):[]}function it(e){try{let t=new URL(e);return`${t.origin}${t.pathname}`}catch{return e}}function VE(e,t){if(e!==void 0&&/^https?:\/\//i.test(e)&&(0,er.launchContainsCredentials)({kind:"url",url:e})||(0,er.launchContainsCredentials)({kind:"command",command:e??"",arguments:t}))return!0;let n=qt([...t]);return t.some((r,o)=>n[o]===r?!1:/^https?:\/\//i.test(r)?(0,er.launchContainsCredentials)({kind:"url",url:r}):!0)}function bl(e,t,n){VE(t,n)&&(e.launch_had_credentials=!0)}function JE(e){return zE.test(e)||WE.test(e)?"<redacted>":e.includes("://")?it(e):e}function xl(e){if(/^https?:\/\//i.test(e))return it(e);let t=e.indexOf("=");return t>0?`${e.slice(0,t+1)}${xl(e.slice(t+1))}`:JE(e)}function YE(e){let t=e.replace(/^-+/,"").split("=",1)[0]??"";return KE.test(t)||GE.test(t)}function qt(e){let t=[],n=!1;for(let r of e){if(n){t.push("<redacted>"),n=!1;continue}if(YE(r)){t.push("<redacted>"),n=!r.includes("=");continue}t.push(xl(r))}return t}function XE(e){let t=Il(e);if(t.length===0)return;let n=[...new Set(t.map(r=>r.length>Rl?r.slice(0,Rl):r))].sort();if(n.length!==0)return n.length>yl?{names:n.slice(0,yl),truncated:!0}:{names:n,truncated:!1}}function qE(e){let t=nr(e);if(!t)return{headers:[],envVars:[]};let n=[],r=[];for(let[o,s]of Object.entries(t))o.length>0&&n.push(o),typeof s=="string"&&s.length>0&&r.push(s);return{headers:n,envVars:r}}function Ol(e,t){let n=new Set;for(let{raw:r,attr:o}of tr){if(n.has(o)||!(r in t))continue;let s=t[r];if(o==="auto_approve"&&typeof s=="boolean"){e.auto_approve=s,n.add(o);continue}let i=XE(s);i&&(e[o]=i.names,i.truncated&&(e[`${o}_truncated`]=!0),n.add(o))}}function Tl(e,t){let n=nr(e),r={transport:t};if(!n)return r;Al(r,Object.keys(n));let o=typeof n.command=="string"?n.command:void 0,s=typeof n.url=="string"?n.url:void 0,i=typeof n.serverUrl=="string"?n.serverUrl:void 0,a=o??s??i,c=Il(n.args);a&&(r.command_or_url=it(a));let u=qt(c);u.length>0&&(r.args=u),bl(r,a,c);let l=qE(n.env_http_headers),p=[...new Set([...Jo(n.env),...Jo(n.envVars),...Jo(n.env_vars),...l.envVars,...typeof n.bearer_token_env_var=="string"&&n.bearer_token_env_var.length>0?[n.bearer_token_env_var]:[]])].sort();p.length>0&&(r.env_var_names=p),l.headers.length>0&&(r.env_http_header_names=[...new Set(l.headers)].sort());for(let S of["headers","http_headers","env_http_headers"])if(n[S]!==void 0&&n[S]!==null){r.headers_present=!0;break}let f=typeof n.auth=="string"?n.auth:void 0;f&&(r.auth=f);let m=typeof n.bearer_token_env_var=="string"?n.bearer_token_env_var:void 0;m&&(r.bearer_token_env_var=m);let g=typeof n.default_tools_approval_mode=="string"?n.default_tools_approval_mode:typeof n.defaultToolsApprovalMode=="string"?n.defaultToolsApprovalMode:void 0;return g&&(r.default_tools_approval_mode=g),Ol(r,n),r}function kl(e){let t=nr(e);return t?t.enabled===!1?!1:t.disabled!==!0:!0}function qo(e,t,n=!0){let r=Object.keys(t).sort().map(o=>[o,t[o]??null]);return X(JSON.stringify({name:e,attributes:r,enabled:n}))}function yt(e){let t=e.trim();return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t}function Xt(e,t){let n=new RegExp(`^\\s*${t}\\s*=\\s*\\[([^\\]]*)\\]`,"m").exec(e);return n?.[1]?[...n[1].matchAll(/"([^"]*)"|'([^']*)'/g)].map(r=>r[1]??r[2]??"").filter(r=>r.length>0):[]}function Xo(e,t){let n=new RegExp(`^\\s*${t}\\s*=\\s*(true|false)\\s*$`,"m").exec(e);if(n?.[1])return n[1]==="true"}function Yo(e,t){let n=new RegExp(`^\\s*${t}\\s*=\\s*(.+)$`,"m").exec(e);if(!n?.[1])return;let r=yt(n[1]);return r.length>0?r:void 0}function ZE(e,t){let n=[],r=i=>{for(let a of i.split(/[,\n]/)){let c=/^\s*"?([A-Za-z_][A-Za-z0-9_-]*)"?\s*=\s*(.+?)\s*$/.exec(a);c?.[1]&&n.push([c[1],yt(c[2]??"")])}},o=new RegExp(`^\\s*${t}\\s*=\\s*\\{([^}]*)\\}`,"m").exec(e);o?.[1]&&r(o[1]);let s=new RegExp(`(?:^|\\n)\\[[^\\]]*\\.${t}\\]\\s*\\n([\\s\\S]*?)(?=\\n\\[|$)`).exec(`
35
+ `)){let o=r.trim();if(!o)continue;let s=o.indexOf(" ");if(s<=0)continue;let i=o.slice(0,s).toLowerCase(),a=o.slice(s+1).trim();a&&(i==="user.name"?t=a:i==="user.email"&&(n=a))}return{git_user_name:t,git_user_email:n,platform_login:null}}async function wh(e,t=ee){let n=await t("git",["config","--get-regexp","^user\\.(name|email)$"],2e3,{cwd:e});return Nh(n)}function Mh(e=process.env){let t=j(e.GIT_AUTHOR_NAME),n=j(e.GIT_AUTHOR_EMAIL);if(t||n)return{git_user_name:t,git_user_email:n,platform_login:null,identity_source:"git_env"};let r=j(e.GIT_COMMITTER_NAME),o=j(e.GIT_COMMITTER_EMAIL);if(r||o)return{git_user_name:r,git_user_email:o,platform_login:null,identity_source:"git_env"};let s=j(e.EMAIL);return s?{git_user_name:null,git_user_email:s,platform_login:null,identity_source:"git_env"}:null}function Ue(e,t,n,r=null){return!e&&!t&&!r?null:{git_user_name:e,git_user_email:t,platform_login:r,identity_source:n}}function Lh(e=process.env){let t=j(e.EV_AI_HOOK_OPERATOR_EMAIL),n=j(e.EV_AI_HOOK_OPERATOR_LOGIN),r=Ue(j(e.EV_AI_HOOK_OPERATOR_NAME),t,"configured",t??n);if(r)return r;let o=j(e.GITHUB_ACTOR)??j(e.GITHUB_TRIGGERING_ACTOR)??j(e.GITHUB_USER),s=Ue(o,null,"github",o);if(s)return s;let i=j(e.GITLAB_USER_LOGIN),a=j(e.GITLAB_USER_EMAIL),c=Ue(j(e.GITLAB_USER_NAME)??i,a,"gitlab",a??i);if(c)return c;let u=j(e.BUILD_REQUESTEDFOREMAIL),l=Ue(j(e.BUILD_REQUESTEDFOR),u,"azure_devops",u??j(e.BUILD_REQUESTEDFORID));if(l)return l;let p=j(e.BUILDKITE_BUILD_CREATOR_EMAIL),f=Ue(j(e.BUILDKITE_BUILD_CREATOR),p,"buildkite",p);if(f)return f;let m=j(e.BUILD_USER_EMAIL)??j(e.CHANGE_AUTHOR_EMAIL),g=Ue(j(e.BUILD_USER)??j(e.CHANGE_AUTHOR),m,"jenkins",m??j(e.BUILD_USER_ID));if(g)return g;let S=j(e.CIRCLE_USERNAME),C=Ue(S,null,"circleci",S);if(C)return C;let A=j(e.CODEBUILD_INITIATOR),T=Ue(A,null,"codebuild",A);if(T)return T;let x=j(e.DRONE_COMMIT_AUTHOR_EMAIL),M=j(e.DRONE_COMMIT_AUTHOR),k=Ue(M??j(e.DRONE_COMMIT_AUTHOR_NAME),x,"drone",x??M);if(k)return k;if(Kc(e.CLAUDE_CODE_REMOTE)||Kc(e.CURSOR_AGENT)){let K=j(e.CURSOR_USER_EMAIL);return{git_user_name:null,git_user_email:null,platform_login:K&&!fe(null,K)?K:null,identity_source:"cloud"}}return null}function po(e){return!!((e.git_user_name??e.git_user_email)&&!fe(e.git_user_name,e.git_user_email))}function j(e){if(e===void 0)return null;let t=e.trim();return t.length>0?t:null}function Kc(e){if(e===void 0||e==="")return!1;let t=e.trim().toLowerCase();return t!=="0"&&t!=="false"&&t!=="no"}function vh(e,t,n){return e==="claude"?bc(t):e==="cursor"?jc(t,n):e==="codex"?Pc(n,t):null}async function mo(e,t=ee,n=process.env,r={}){let o=await wh(e,t),s=Mh(n),i=po(o)?o:s&&po(s)?s:null,a=vh(r.runnerPlatform,r.home??kh(),n);if(a)return{git_user_name:i?.git_user_name??null,git_user_email:i?.git_user_email??null,platform_login:a.platform_login,identity_source:a.identity_source};let c=Lh(n);return c?.platform_login?{git_user_name:i?.git_user_name??null,git_user_email:i?.git_user_email??null,platform_login:c.platform_login,identity_source:c.identity_source}:i?{...i,platform_login:null,identity_source:po(o)?"git_config":"git_env"}:c||(o.git_user_name||o.git_user_email?{...o,identity_source:"git_config"}:s||{git_user_name:null,git_user_email:null,platform_login:null,identity_source:"git_config"})}async function go(e){let{gitRoot:t,installationStorePath:n,forceResend:r}=e,o=e.exec??ee,s=e.env??process.env,i=await mo(t,o,s,{runnerPlatform:e.runnerPlatform,home:e.home}),a=Ph(i.git_user_name,i.git_user_email,i.identity_source,i.platform_login),u=(n?Ur(n):void 0)?.operator_identity_hash;if(!(r||u!==void 0&&u!==a||!u))return{commit:()=>{}};let m=n;return{operator:i,commit:()=>{m&&ki(m,a,ln())}}}function _o(e){return e?!Ur(e)?.operator_identity_hash:!0}function Gc(e){return!0}import{existsSync as Xy,readFileSync as qy}from"node:fs";import{homedir as hf}from"node:os";import{join as Ct,resolve as Zy}from"node:path";import{basename as By,join as Rt}from"node:path";import{dirname as nu,resolve as Wn}from"node:path";import{existsSync as Hh}from"node:fs";import{homedir as Vc}from"node:os";import{relative as Jc,resolve as Te,sep as Ye}from"node:path";var Uh=["session_id","conversation_id","turn_id","generation_id","prompt.id","prompt_id","hook_event_name","event","source","status","stop_reason","reason","tool_name","tool","tool_use_id","skill_name","command_name","expansion_type","command_source","permission_mode","model","model_id","agent_id","agent_type","subagent_id","subagent_type","subagent_model","is_parallel_worker","effort","effort.level","duration_ms","duration","sandbox","failure_type","is_interrupt"],Dh=["prompt","tool_input","tool_response","last_assistant_message","command"],Fh=new Set;function $h(e){switch(e?.toLowerCase()){case"beforemcpexecution":return new Set(["command"]);case"stopfailure":return new Set(["last_assistant_message"]);default:return Fh}}var Yc=new Set(["on","1","true"]);function Ro(e){let t=L("EV_AI_HOOK_CAPTURE_PROMPT")?.trim();return t!==void 0&&t!==""?Yc.has(t.toLowerCase()):e?.collect_prompt===!0}function Xc(e,t){let n=Co(e);if(n==="allowlist")return"off";if(n==="full")return"full";let r=L("EV_AI_HOOK_CAPTURE_PROMPT")?.trim();return r!==void 0&&r!==""?Yc.has(r.toLowerCase())?"env":"off":t?.collect_prompt===!0?"config":"off"}function qc(e){return Co(e)==="allowlist"}function Co(e){return L("EV_AI_HOOK_CAPTURE_CONTENT")?.toLowerCase()==="off"||e.capture_hook_input==="allowlist"?"allowlist":e.capture_hook_input==="full"||e.debug===!0||L("EV_AI_HOOK_CAPTURE_FULL_INPUT")==="1"?"full":"content"}function jh(e){let t={};for(let n of Uh){let r=Me(e,n);r!==void 0&&(t[n]=r)}return t}function Gn(e,t){if(typeof e!="string"||e.length===0||!t)return null;let n=Te(e),r=Te(t),o=Jc(r,n);return!o||o==="."?".":o.startsWith(`..${Ye}`)||o===".."||Te(r,o)!==n?null:o.split(Ye).join("/")}function Zc(e,t){let n=Jc(Te(t),Te(e)).split(Ye).join("/");return!n||n==="."?null:n===".."||n.startsWith("../")&&n.split("/").every(r=>r==="..")?n:null}function Qc(e){return typeof e!="string"||e.length===0?null:Te(e).split(Ye).join("/")}function Bh(){let e=L("CURSOR_PROJECT_DIR");if(!e)return null;let t=Te(e);return Hh(t)?t.split(Ye).join("/"):null}function So(e,t){return Gn(e,t)!==null}function Kh(e,t){let n=Te(t??Vc(),".cursor").split(Ye).join("/");return So(e,n)}function Gh(e,t,n){return t!==null&&So(e,t)?!0:t!==null&&Kh(e,n.home)?!1:n.inGitRepo===!0&&n.gitRoot!==void 0&&So(e,n.gitRoot)?!0:t===null}function eu(e,t){let n=Qc(e.cwd);if(n!==null)return n;let r=Te(process.cwd()).split(Ye).join("/"),o=Bh();return Gh(r,o,t)?r:o??r}function Ao(e,t={}){return eu(e,t)}function Io(e,t=Vc()){let n=Te(t).split(Ye).join("/").replace(/\/$/,"");return n.length<=1?e:e===n?"~":e.startsWith(`${n}/`)?`~${e.slice(n.length)}`:e}function zc(e,t,n){let r=Qc(n.launchCwd)??eu(t,n);e.cwd=Io(r,n.home);let o=n.inGitRepo===!0&&n.gitRoot!==void 0?Gn(r,n.gitRoot):null;o!==null&&(e.cwd_relative=o)}var tu="\u2026[truncated]\u2026",Eo=Buffer.byteLength(tu,"utf8"),zh=8;function Gt(e){return Buffer.byteLength(JSON.stringify(e),"utf8")}function Wc(e,t){if(t<=0)return"";let n=Buffer.from(e,"utf8");return n.length<=t?e:n.subarray(0,t).toString("utf8")}function Wh(e,t){if(t<=0)return"";let n=Buffer.from(e,"utf8");return n.length<=t?e:n.subarray(n.length-t).toString("utf8")}function Vh(e,t){if(Buffer.byteLength(e,"utf8")<=t)return e;if(t<=Eo)return Wc(e,t);let r=t-Eo,o=Math.ceil(r/2),s=Math.floor(r/2);return`${Wc(e,o)}${tu}${Wh(e,s)}`}function yo(e,t,n){if(typeof e=="string"){n.push({path:t,value:e,bytes:Buffer.byteLength(e,"utf8")});return}if(Array.isArray(e)){e.forEach((r,o)=>{yo(r,[...t,o],n)});return}if(e!==null&&typeof e=="object")for(let[r,o]of Object.entries(e))t.length===0&&r.startsWith("_")||yo(o,[...t,r],n)}function Jh(e,t,n){let r=e;for(let s=0;s<t.length-1;s++){let i=t[s];if(i===void 0)return;r=(Array.isArray(r),r[i])}let o=t[t.length-1];if(!(o===void 0||r===null||typeof r!="object")){if(Array.isArray(r)){r[o]=n;return}r[o]=n}}var Yh=256;function Xh(e,t,n){let r=n,o=Math.max(n,e[0]?.bytes??n);for(;r<o;){let s=Math.ceil((r+o)/2),i=0;for(let a of e)a.bytes>s&&(i+=a.bytes-s);i>=t?r=s:o=s-1}return r}function qh(e,t,n){let r=Number.POSITIVE_INFINITY;for(let o=0;o<6;o++){let s=Gt(e);if(s<=t)return;let i=[];yo(e,[],i),i.sort((l,p)=>p.bytes-l.bytes);let a=i.filter(l=>l.bytes>n);if(a.length===0)return;let c=Xh(a,s-t,n),u=Math.max(n,Math.min(c,r-1));if(u>=r)return;r=u;for(let l of a)l.bytes>r&&Jh(e,l.path,Vh(l.value,r))}}function Zh(e,t){let n=Math.max(0,t-Yh),r=Object.keys(e).filter(s=>!s.startsWith("_")).map(s=>({key:s,bytes:Gt(e[s])})).sort((s,i)=>i.bytes-s.bytes),o=[];for(let{key:s}of r){if(Gt(e)<=n)break;delete e[s],o.push(s)}o.length>0&&(e._dropped_keys=o.slice(0,10))}function ho(e,t){let n=Gt(e);if(n<=t)return e;let r=structuredClone(e);return r._truncated=!0,r._original_bytes=n,qh(r,t,Eo+zh),Gt(r)>t&&Zh(r,t),r}function Qh(e,t,n){if(!(n.promptCapture??Ro()))return;let r=$h(n.runnerEvent);for(let o of Dh){if(r.has(o))continue;let s=t[o];s!==void 0&&(e[o]=s)}}function zn(e,t,n={}){let r=Co(t);if(r==="full"){let s={...e};return delete s.cwd,delete s.transcript_path,zc(s,e,n),ho(s,wr)}let o=jh(e);return zc(o,e,n),r==="content"?(Qh(o,e,n),ho(o,wr)):ho(o,di)}function eS(e){return typeof e=="string"&&e.length>0}function bo(e){let t=Wn(e.home),n=Wn(e.launchCwd),r=e.gitRoot?Wn(e.gitRoot):null,o=new Set,s=[],i=null;e.inGitRepo&&eS(e.remote)&&r!==null&&r!==t&&(i=r,o.add(r)),n!==t&&!o.has(n)&&(s.push({scope:"cwd",dir:n}),o.add(n)),i!==null&&s.push({scope:"repo",dir:i});let a=null,c=r!==null&&Gn(n,r)!==null;if(e.inGitRepo&&r!==null&&r!==t&&c){let u=nu(r);for(;;){let l=Wn(u);if(l===t)break;let p=nu(l);if(p===l)break;if(e.hasProjectSpec(l)){s.push({scope:"parent",dir:l}),a=Zc(l,n);break}u=p}}return{anchors:s,parentRel:a}}import{existsSync as ru,readdirSync as tS,realpathSync as nS}from"node:fs";import{basename as rS,dirname as oS,relative as sS,resolve as iS,sep as aS}from"node:path";var xo=400,Vn=class{constructor(t,n={}){this.home=t;this.pathMode=n.pathMode??"home-relative",this.maxEntries=n.maxEntries??Be}components=[];truncated=!1;pathMode;maxEntries;pluginExpandRemaining;seenRealpaths=new Set;componentPath(t){if(this.pathMode==="tilde"){let r=iS(t).split(aS).join("/");return Io(r,this.home)}let n=sS(this.home,t).replace(/\\/g,"/");return!n||n.startsWith("..")?`external/${X(oS(t))}/${rS(t)}`:n}claimFile(t){try{let n=nS(t);return this.seenRealpaths.has(n)?!1:(this.seenRealpaths.add(n),!0)}catch{return this.seenRealpaths.has(t)?!1:(this.seenRealpaths.add(t),!0)}}get atGlobalCap(){return this.truncated||this.components.length>=this.maxEntries}get pluginBudgetSpent(){return this.pluginExpandRemaining!==void 0&&this.pluginExpandRemaining<=0}readEntries(t){if(!ru(t))return[];try{return tS(t,{withFileTypes:!0})}catch{return[]}}readJson(t,n){if(ru(t))return te(t,n)}push(t){return this.components.length>=this.maxEntries?(this.truncated=!0,!1):this.pluginExpandRemaining!==void 0&&this.pluginExpandRemaining<=0?!1:(this.pluginExpandRemaining!==void 0&&(this.pluginExpandRemaining-=1),this.components.push(t),!0)}withPluginExpandCap(t,n){let r=this.pluginExpandRemaining;this.pluginExpandRemaining=t;try{let o=n(),s=t-(this.pluginExpandRemaining??0);return{result:o,expanded:s}}finally{this.pluginExpandRemaining=r}}};import{existsSync as Go,readFileSync as PE,statSync as NE}from"node:fs";import{basename as Sl,join as ot,relative as zo}from"node:path";var ml=je(dl());var TE=["**/node_modules/**","**/dist/**","**/build/**","**/.git/**","**/.trash/**","**/.claude/cache/**","**/.codex/skills/.system/**","**/vendor/**","**/.yarn/**","**/coverage/**","**/.next/**"],gl=TE.map(e=>ml.default.matcher(e,{dot:!0}));function kE(e){return e===""?!1:gl.some(t=>t(`${e}/`))}function _l(e,t){if(t==="")return!1;if(e==="")return kE(t);let n=e.replace(/\/+$/,"");return gl.some(r=>r(`${n}/${t}/`)&&!r(`${n}/`))}var Wo=100*1024,wE=4;function ME(e){return e.length<=Wo?e:`${e.slice(0,Wo-1)}\u2026`}function LE(e){try{let t=PE(e),n=t.toString("utf8");return{hash:X(t),length:t.length,text:ME(n)}}catch{return null}}var hl={HOOK:"EVENT",COMMAND:"EXPLICIT_INVOCATION",MEMORY:void 0,MCP_SERVER:void 0,PLUGIN:void 0,SKILL:"UNSPECIFIED",RULE:"UNSPECIFIED",SUBAGENT:"UNSPECIFIED"};function vE(e){return e in hl?hl[e]:"UNSPECIFIED"}function Et(e,t){if(!e.claimFile(t.absolutePath))return!1;let n=LE(t.absolutePath);if(!n)return!1;let r=t.name??Sl(t.absolutePath).replace(/\.(md|mdc|toml)$/i,""),o={kind:t.kind,name:r,path:e.componentPath(t.absolutePath),text:n.text,content_hash:n.hash,content_length:n.length,origin:t.origin,enabled:t.enabled},s=vE(t.kind);return s&&(o.trigger=s),t.attributes&&(o.attributes=t.attributes),e.push(o)}function HE(e,t,n){let r=zo(e,t).replace(/\\/g,"/");return!r||r.startsWith("..")?Sl(t).replace(/\.(md|mdc|toml)$/i,""):n?r.replace(/\.(md|mdc|toml)$/i,""):r}function st(e,t){let{dir:n,kind:r,origin:o,enabled:s,nested:i,extensions:a,skipDirs:c}=t;Vo(e,{walkRoot:n,currentDir:n,depth:0,kind:r,origin:o,enabled:s,nested:i,extensions:a,skipDirs:c})}function Vo(e,t){let{walkRoot:n,currentDir:r,depth:o,kind:s,origin:i,enabled:a,nested:c,extensions:u,skipDirs:l}=t;if(!(o>wE))for(let p of e.readEntries(r)){if(e.atGlobalCap){e.truncated=!0;return}if(e.pluginBudgetSpent)return;if(p.isDirectory()&&_l(n.replace(/\\/g,"/"),zo(n,ot(r,p.name)).replace(/\\/g,"/"))||p.isDirectory()&&l?.includes(ot(r,p.name)))continue;if(c){if(!p.isDirectory())continue;let g=ot(r,p.name,c);if(Go(g)){let S=zo(n,ot(r,p.name)).replace(/\\/g,"/");Et(e,{absolutePath:g,kind:s,origin:i,enabled:a,name:S||p.name});continue}Vo(e,{walkRoot:n,currentDir:ot(r,p.name),depth:o+1,kind:s,origin:i,enabled:a,nested:c,extensions:u,skipDirs:l});continue}if(p.isDirectory()){Vo(e,{walkRoot:n,currentDir:ot(r,p.name),depth:o+1,kind:s,origin:i,enabled:a,nested:c,extensions:u,skipDirs:l});continue}if(!p.isFile()||!u)continue;let f=p.name.toLowerCase();if(!u.some(g=>f.endsWith(g)))continue;let m=ot(r,p.name);Et(e,{absolutePath:m,kind:s,origin:i,enabled:a,name:HE(n,m,!0)})}}function El(e){for(let t of e)if(Go(t))try{if(NE(t).size>0)return t}catch{continue}return e.find(t=>Go(t))}import{existsSync as py,readFileSync as dy}from"node:fs";var er=je(Je(),1);var UE="<omitted>",DE=["package_name","package_spec","package_version","package_version_source"],yl=100,Rl=120,tr=[{raw:"tools",attr:"tools"},{raw:"autoApprove",attr:"auto_approve"},{raw:"auto_approve",attr:"auto_approve"},{raw:"alwaysAllow",attr:"always_allow"},{raw:"always_allow",attr:"always_allow"},{raw:"enabledTools",attr:"enabled_tools"},{raw:"enabled_tools",attr:"enabled_tools"},{raw:"disabledTools",attr:"disabled_tools"},{raw:"disabled_tools",attr:"disabled_tools"}],Cl=new Set(tr.map(e=>e.attr)),FE=["enabled","disabled"],$E=["serverUrl","auth","bearer_token_env_var","default_tools_approval_mode","defaultToolsApprovalMode","env_vars","env_http_headers","http_headers"],jE=new Set(["type","command","url","args","env","envVars","headers",...FE,...$E,...tr.map(e=>e.raw)]),BE=new Set(["transport","command_or_url","args","env_var_names","headers_present","auth","bearer_token_env_var","default_tools_approval_mode","env_http_header_names",...DE,...Cl,...[...Cl].map(e=>`${e}_truncated`)]);function Al(e,t){for(let n of t)jE.has(n)||BE.has(n)||(e[n]=UE)}var KE=/^(authorization|auth|api[-_]?key|access[-_]?token|refresh[-_]?token|secret|password|passwd|token|bearer|client[-_]?secret|client[-_]?id|private[-_]?key|signing[-_]?key)$/i,GE=/(?:^|[-_])(secret|password|passwd|token|api[-_]?key|private[-_]?key|signing[-_]?key|client[-_]?secret|client[-_]?id)(?:[-_]|$)/i,zE=/^(sk-|ghp_|gho_|github_pat_|xox[baprs]-|AKIA|ASIA|AIza|ya29\.)/,WE=/^bearer(?:\s+|$)/i;function nr(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function Il(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}function Jo(e){if(Array.isArray(e)){let n=[];for(let r of e){if(typeof r!="string"||r.length===0)continue;let o=r.split("=",1)[0]?.trim();o&&n.push(o)}return n}let t=nr(e);return t?Object.keys(t).filter(n=>n.length>0):[]}function it(e){try{let t=new URL(e);return`${t.origin}${t.pathname}`}catch{return e}}function VE(e,t){if(e!==void 0&&/^https?:\/\//i.test(e)&&(0,er.launchContainsCredentials)({kind:"url",url:e})||(0,er.launchContainsCredentials)({kind:"command",command:e??"",arguments:t}))return!0;let n=qt([...t]);return t.some((r,o)=>n[o]===r?!1:/^https?:\/\//i.test(r)?(0,er.launchContainsCredentials)({kind:"url",url:r}):!0)}function bl(e,t,n){VE(t,n)&&(e.launch_had_credentials=!0)}function JE(e){return zE.test(e)||WE.test(e)?"<redacted>":e.includes("://")?it(e):e}function xl(e){if(/^https?:\/\//i.test(e))return it(e);let t=e.indexOf("=");return t>0?`${e.slice(0,t+1)}${xl(e.slice(t+1))}`:JE(e)}function YE(e){let t=e.replace(/^-+/,"").split("=",1)[0]??"";return KE.test(t)||GE.test(t)}function qt(e){let t=[],n=!1;for(let r of e){if(n){t.push("<redacted>"),n=!1;continue}if(YE(r)){t.push("<redacted>"),n=!r.includes("=");continue}t.push(xl(r))}return t}function XE(e){let t=Il(e);if(t.length===0)return;let n=[...new Set(t.map(r=>r.length>Rl?r.slice(0,Rl):r))].sort();if(n.length!==0)return n.length>yl?{names:n.slice(0,yl),truncated:!0}:{names:n,truncated:!1}}function qE(e){let t=nr(e);if(!t)return{headers:[],envVars:[]};let n=[],r=[];for(let[o,s]of Object.entries(t))o.length>0&&n.push(o),typeof s=="string"&&s.length>0&&r.push(s);return{headers:n,envVars:r}}function Ol(e,t){let n=new Set;for(let{raw:r,attr:o}of tr){if(n.has(o)||!(r in t))continue;let s=t[r];if(o==="auto_approve"&&typeof s=="boolean"){e.auto_approve=s,n.add(o);continue}let i=XE(s);i&&(e[o]=i.names,i.truncated&&(e[`${o}_truncated`]=!0),n.add(o))}}function Tl(e,t){let n=nr(e),r={transport:t};if(!n)return r;Al(r,Object.keys(n));let o=typeof n.command=="string"?n.command:void 0,s=typeof n.url=="string"?n.url:void 0,i=typeof n.serverUrl=="string"?n.serverUrl:void 0,a=o??s??i,c=Il(n.args);a&&(r.command_or_url=it(a));let u=qt(c);u.length>0&&(r.args=u),bl(r,a,c);let l=qE(n.env_http_headers),p=[...new Set([...Jo(n.env),...Jo(n.envVars),...Jo(n.env_vars),...l.envVars,...typeof n.bearer_token_env_var=="string"&&n.bearer_token_env_var.length>0?[n.bearer_token_env_var]:[]])].sort();p.length>0&&(r.env_var_names=p),l.headers.length>0&&(r.env_http_header_names=[...new Set(l.headers)].sort());for(let S of["headers","http_headers","env_http_headers"])if(n[S]!==void 0&&n[S]!==null){r.headers_present=!0;break}let f=typeof n.auth=="string"?n.auth:void 0;f&&(r.auth=f);let m=typeof n.bearer_token_env_var=="string"?n.bearer_token_env_var:void 0;m&&(r.bearer_token_env_var=m);let g=typeof n.default_tools_approval_mode=="string"?n.default_tools_approval_mode:typeof n.defaultToolsApprovalMode=="string"?n.defaultToolsApprovalMode:void 0;return g&&(r.default_tools_approval_mode=g),Ol(r,n),r}function kl(e){let t=nr(e);return t?t.enabled===!1?!1:t.disabled!==!0:!0}function qo(e,t,n=!0){let r=Object.keys(t).sort().map(o=>[o,t[o]??null]);return X(JSON.stringify({name:e,attributes:r,enabled:n}))}function yt(e){let t=e.trim();return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t}function Xt(e,t){let n=new RegExp(`^\\s*${t}\\s*=\\s*\\[([^\\]]*)\\]`,"m").exec(e);return n?.[1]?[...n[1].matchAll(/"([^"]*)"|'([^']*)'/g)].map(r=>r[1]??r[2]??"").filter(r=>r.length>0):[]}function Xo(e,t){let n=new RegExp(`^\\s*${t}\\s*=\\s*(true|false)\\s*$`,"m").exec(e);if(n?.[1])return n[1]==="true"}function Yo(e,t){let n=new RegExp(`^\\s*${t}\\s*=\\s*(.+)$`,"m").exec(e);if(!n?.[1])return;let r=yt(n[1]);return r.length>0?r:void 0}function ZE(e,t){let n=[],r=i=>{for(let a of i.split(/[,\n]/)){let c=/^\s*"?([A-Za-z_][A-Za-z0-9_-]*)"?\s*=\s*(.+?)\s*$/.exec(a);c?.[1]&&n.push([c[1],yt(c[2]??"")])}},o=new RegExp(`^\\s*${t}\\s*=\\s*\\{([^}]*)\\}`,"m").exec(e);o?.[1]&&r(o[1]);let s=new RegExp(`(?:^|\\n)\\[[^\\]]*\\.${t}\\]\\s*\\n([\\s\\S]*?)(?=\\n\\[|$)`).exec(`
36
36
  ${e}`);return s?.[1]&&r(s[1]),n}function Pl(e){return Xo(e,"enabled")===!1?!1:Xo(e,"disabled")!==!0}function QE(e,t){let n={};for(let{raw:r,attr:o}of tr){if(o==="auto_approve"){let i=Xo(t,r);if(i!==void 0){n[r]=i;continue}}let s=Xt(t,r);s.length>0&&(n[r]=s)}Ol(e,n)}var ey=/^\s*([A-Za-z_][A-Za-z0-9_-]*)\s*[.=]/,ty=/^\[[^\]]*\.([A-Za-z_][A-Za-z0-9_-]*)\]\s*$/gm;function ny(e){let t=new Set,n=e.search(/^\[/m),r=n===-1?e:e.slice(0,n);for(let o of r.split(`
37
37
  `)){let s=ey.exec(o);s?.[1]&&t.add(s[1])}for(let o of e.matchAll(ty))o[1]&&t.add(o[1]);return[...t]}function Nl(e,t){let n={transport:t};Al(n,ny(e));let r=/^\s*command\s*=\s*(.+)$/m.exec(e),o=/^\s*url\s*=\s*(.+)$/m.exec(e),s=r?yt(r[1]??""):void 0,i=o?yt(o[1]??""):void 0,a=s!==void 0&&s.length>0?s:i,c=Xt(e,"args");a&&(n.command_or_url=it(a));let u=qt(c);u.length>0&&(n.args=u),bl(n,a,c);let l=new Set;for(let A of e.split(`
38
38
  `)){let T=/^\s*env\.([A-Za-z_][A-Za-z0-9_]*)\s*=/.exec(A);T?.[1]&&l.add(T[1])}let p=/^\s*env\s*=\s*\{([^}]*)\}/m.exec(e);if(p?.[1])for(let A of p[1].split(",")){let T=/^\s*([A-Za-z_][A-Za-z0-9_]*)\s*=/.exec(A);T?.[1]&&l.add(T[1])}let f=/(?:^|\n)\[[^\]]*env\]\s*\n([\s\S]*?)(?=\n\[|$)/.exec(`
@@ -1104,6 +1104,7 @@ var managed_hooks_snippet_exports = {};
1104
1104
  __export(managed_hooks_snippet_exports, {
1105
1105
  CLAUDE_MANAGED_HOOK_TIMEOUT_SECONDS: () => CLAUDE_MANAGED_HOOK_TIMEOUT_SECONDS,
1106
1106
  CLAUDE_MANAGED_SESSION_START_TIMEOUT_SECONDS: () => CLAUDE_MANAGED_SESSION_START_TIMEOUT_SECONDS,
1107
+ NPX_PACKAGE_SPEC: () => NPX_PACKAGE_SPEC,
1107
1108
  buildCollectorUrl: () => buildCollectorUrl,
1108
1109
  managedHooksSnippet: () => managedHooksSnippet
1109
1110
  });
@@ -1326,7 +1327,7 @@ var HOOK_INPUT_ALLOWLIST_MAX_BYTES = 4 * 1024;
1326
1327
  var HOOK_INPUT_FULL_MAX_BYTES = 256 * 1024;
1327
1328
  var HOOK_INPUT_MCP_MAX_BYTES = 4 * 1024;
1328
1329
  var GZIP_MIN_BYTES = 32 * 1024;
1329
- var PACKAGE_VERSION = "1.3.3";
1330
+ var PACKAGE_VERSION = "1.3.4";
1330
1331
  var NPX_PACKAGE_SPEC = `@ev-ai/agent-hook@${PACKAGE_VERSION}`;
1331
1332
  var HOOK_STATUS_MESSAGE = "ev-ai runtime report";
1332
1333
 
@@ -1470,8 +1471,8 @@ function withClaudeManagedHookLimits(doc) {
1470
1471
  }
1471
1472
  return { hooks };
1472
1473
  }
1473
- function managedHooksSnippet(runner, collectorUrl) {
1474
- const command = withUrlFlag(withRunnerFlag(npxHookCommand(), runner), collectorUrl);
1474
+ function managedHooksSnippet(runner, collectorUrl, packageSpec) {
1475
+ const command = withUrlFlag(withRunnerFlag(npxHookCommand(packageSpec), runner), collectorUrl);
1475
1476
  const doc = runner === "cursor" ? { version: 1, ...buildCursorPluginHooks(command) } : runner === "claude" ? withClaudeManagedHookLimits(buildClaudePluginHooks(command)) : buildCodexPluginHooks(command);
1476
1477
  return JSON.stringify(doc, null, 2);
1477
1478
  }
@@ -1479,6 +1480,7 @@ function managedHooksSnippet(runner, collectorUrl) {
1479
1480
  0 && (module.exports = {
1480
1481
  CLAUDE_MANAGED_HOOK_TIMEOUT_SECONDS,
1481
1482
  CLAUDE_MANAGED_SESSION_START_TIMEOUT_SECONDS,
1483
+ NPX_PACKAGE_SPEC,
1482
1484
  buildCollectorUrl,
1483
1485
  managedHooksSnippet
1484
1486
  });
@@ -1,3 +1,8 @@
1
1
  export type KnownRunner = 'claude' | 'cursor' | 'codex';
2
+ export const NPX_PACKAGE_SPEC: string;
2
3
  export function buildCollectorUrl(orgToken: string, baseUrl?: string): string;
3
- export function managedHooksSnippet(runner: KnownRunner, collectorUrl: string): string;
4
+ export function managedHooksSnippet(
5
+ runner: KnownRunner,
6
+ collectorUrl: string,
7
+ packageSpec?: string,
8
+ ): string;
@@ -1316,7 +1316,7 @@ var HOOK_INPUT_ALLOWLIST_MAX_BYTES = 4 * 1024;
1316
1316
  var HOOK_INPUT_FULL_MAX_BYTES = 256 * 1024;
1317
1317
  var HOOK_INPUT_MCP_MAX_BYTES = 4 * 1024;
1318
1318
  var GZIP_MIN_BYTES = 32 * 1024;
1319
- var PACKAGE_VERSION = "1.3.3";
1319
+ var PACKAGE_VERSION = "1.3.4";
1320
1320
  var NPX_PACKAGE_SPEC = `@ev-ai/agent-hook@${PACKAGE_VERSION}`;
1321
1321
  var HOOK_STATUS_MESSAGE = "ev-ai runtime report";
1322
1322
 
@@ -1460,14 +1460,15 @@ function withClaudeManagedHookLimits(doc) {
1460
1460
  }
1461
1461
  return { hooks };
1462
1462
  }
1463
- function managedHooksSnippet(runner, collectorUrl) {
1464
- const command = withUrlFlag(withRunnerFlag(npxHookCommand(), runner), collectorUrl);
1463
+ function managedHooksSnippet(runner, collectorUrl, packageSpec) {
1464
+ const command = withUrlFlag(withRunnerFlag(npxHookCommand(packageSpec), runner), collectorUrl);
1465
1465
  const doc = runner === "cursor" ? { version: 1, ...buildCursorPluginHooks(command) } : runner === "claude" ? withClaudeManagedHookLimits(buildClaudePluginHooks(command)) : buildCodexPluginHooks(command);
1466
1466
  return JSON.stringify(doc, null, 2);
1467
1467
  }
1468
1468
  export {
1469
1469
  CLAUDE_MANAGED_HOOK_TIMEOUT_SECONDS,
1470
1470
  CLAUDE_MANAGED_SESSION_START_TIMEOUT_SECONDS,
1471
+ NPX_PACKAGE_SPEC,
1471
1472
  buildCollectorUrl,
1472
1473
  managedHooksSnippet
1473
1474
  };
@@ -27,7 +27,7 @@ var HOOK_INPUT_ALLOWLIST_MAX_BYTES = 4 * 1024;
27
27
  var HOOK_INPUT_FULL_MAX_BYTES = 256 * 1024;
28
28
  var HOOK_INPUT_MCP_MAX_BYTES = 4 * 1024;
29
29
  var GZIP_MIN_BYTES = 32 * 1024;
30
- var PACKAGE_VERSION = "1.3.3";
30
+ var PACKAGE_VERSION = "1.3.4";
31
31
  var NPX_PACKAGE_SPEC = `@ev-ai/agent-hook@${PACKAGE_VERSION}`;
32
32
  var HOOK_STATUS_MESSAGE = "ev-ai runtime report";
33
33
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ev-ai/agent-hook",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "Cross-runner runtime telemetry hook for Claude Code, Cursor, and Codex",
5
5
  "type": "module",
6
6
  "bin": {