diff --git a/.changeset/agent-bundle-4f62216f30.md b/.changeset/agent-bundle-4f62216f30.md new file mode 100644 index 0000000..6dda613 --- /dev/null +++ b/.changeset/agent-bundle-4f62216f30.md @@ -0,0 +1,5 @@ +--- +"grok-bot-cli": patch +--- + +Build the plugin with the agent-bundle 0.3.0 pkg.pr.new preview (4f62216f30). diff --git a/artifact/INSTALL.md b/artifact/INSTALL.md index 118890f..5319eb8 100644 --- a/artifact/INSTALL.md +++ b/artifact/INSTALL.md @@ -33,7 +33,7 @@ claude plugin install gbot@gbot-marketplace --scope user With the optional `agent-bundle` CLI, `agent-bundle install claude --from ./` runs this sequence automatically when the installed copy has the same version but a different content hash; `--replace` -(alias `--force`) forces it. +forces it. ### Uninstall @@ -42,7 +42,7 @@ claude plugin uninstall gbot@gbot-marketplace --scope user --keep-data ``` Match the scope the plugin was installed with (`user`, `project`, or `local`). `--keep-data` keeps durable -runtime state (Claude orphans the cached copy, `state/` included, for its ~14-day grace period); omit it to +runtime state (Claude orphans the cached copy for its ~14-day grace period); omit it to remove `~/.claude/plugins/data//` immediately. The marketplace `gbot-marketplace` stays registered. Remove it only when nothing else installs from it: @@ -61,9 +61,10 @@ would be removed and `agent-bundle uninstall claude --from ./` reverses the reco (or under `$CLAUDE_CONFIG_DIR`; `user` is the install scope, pass `--scope project` or `--scope local` to match a scoped install), and `uninstall` consumes it, running the two commands above in order and retaining the marketplace while any other plugin, scope, or project still installs from it. Durable runtime state -is kept by default; `--purge-data --confirm-purge` removes `state/` and `~/.claude/plugins/data//` -immediately. A missing receipt or a cached copy that no longer matches it is refused unless `--force`; a -second run is a `not-installed` no-op. +is kept by default; `--purge-data --confirm-purge` removes the receipt-owned state roots and +`~/.claude/plugins/data//` immediately. A missing receipt or a cached copy that no longer matches it is refused unless `--force`; +`--purge-data --confirm-purge` without a receipt is refused even with `--force` (`AB7009`); a second run is a +`not-installed` no-op. ## Codex @@ -92,7 +93,7 @@ or omits `enabled` (`AB7004`) and leaves that install unchanged. Enable the plug With the optional `agent-bundle` CLI, `agent-bundle install codex --from ./` runs this sequence automatically when the installed copy has the same version but a different content hash; `--replace` -(alias `--force`) forces it. +forces it. ### Uninstall @@ -100,8 +101,7 @@ automatically when the installed copy has the same version but a different conte codex plugin remove gbot@gbot-marketplace ``` -Codex 0.147.0 deletes the cached plugin tree, `state/` included, on `plugin remove` and has no keep-data -option. +Codex 0.147.0 deletes the cached plugin tree on `plugin remove` and has no keep-data option. The marketplace `gbot-marketplace` stays registered. Remove it only when nothing else installs from it: `codex plugin list` shows every other plugin from it. @@ -114,8 +114,10 @@ With the optional `agent-bundle` CLI, `agent-bundle uninstall codex --from ./ -- would be removed and `agent-bundle uninstall codex --from ./` reverses the recorded registrations. `agent-bundle install codex` records a receipt at `~/.codex/agent-bundle/receipts/gbot.gbot-marketplace.user.json` (or under `$CODEX_HOME`), and `uninstall` consumes it, running the two commands above in order. `--keep-data` -cannot preserve durable state on Codex; the result says so (`unavailable`). A missing receipt or a cached -copy that no longer matches it is refused unless `--force`; a second run is a `not-installed` no-op. +keeps the framework state roots the receipt records outside the cached tree (`kept`); with nothing there the +result says so (`unavailable`). A missing receipt or a cached +copy that no longer matches it is refused unless `--force`; `--purge-data --confirm-purge` without a receipt is +refused even with `--force` (`AB7009`); a second run is a `not-installed` no-op. ## Cursor @@ -137,37 +139,38 @@ manifest-declared `hooks/hooks.json` from that directory; plugin hooks run from The installer writes an install receipt (`.agent-bundle-install.json`: plugin, version, content hash, owned files) beside the plugin manifest. Re-running `node ./install.mjs` on an identical artifact is a no-op that says so. When the installed copy has the same version but different content, the -installer replaces its owned files in place and leaves runtime state (`state/`) untouched: +installer replaces its owned files in place and leaves unowned entries untouched: ```sh node ./install.mjs # same-version content drift of a receipt-managed copy is replaced -node ./install.mjs --replace # also replace a different installed version, or adopt a pre-receipt copy +node ./install.mjs --replace # also replace a different installed version ``` -`--force` is an alias for `--replace`. A directory that is not an agent-bundle install of this -plugin is always refused with an installed-versus-artifact content-hash comparison; remove it -manually. The optional `agent-bundle` CLI applies the same policy through +A directory without a receipt naming this plugin (including a copy placed before install receipts +existed) is foreign and always refused with an installed-versus-artifact content-hash comparison; +remove it manually and reinstall. The optional `agent-bundle` CLI applies the same policy through `agent-bundle install cursor --from ./ [--replace]`. ### Uninstall ```sh node ./install.mjs --uninstall --plan # print exactly what would be removed -node ./install.mjs --uninstall # remove the receipt-owned files; keep state/ -node ./install.mjs --uninstall --purge-data --confirm-purge # also remove durable runtime state +node ./install.mjs --uninstall # remove the receipt-owned files; keep durable state +node ./install.mjs --uninstall --purge-data --confirm-purge # also remove receipt-owned durable runtime state node ./install.mjs --uninstall --mode marketplace # remove a staged marketplace repository ``` Uninstall removes exactly what the receipt owns: the listed files, the directories the installer created (including `~/.cursor/plugins/local` when the installer made it), and nothing else. Durable -runtime state under `state/` (state kernel, notices journal) — and, for an Agent Plugins pack with a stdio -server, the `~/.cursor/agent-bundle/plugin-data/` directory the receipt records as `PLUGIN_DATA` — is kept -unless `--purge-data --confirm-purge` is passed (a kept data directory leaves a remnant receipt behind so a later -purge still finds it; an empty one is pruned); unowned files are left in place and listed. A supported older -receipt with no recorded state location retains the current environment's default as unproven; a keep-data run -cannot turn that observation into later purge authority. A directory without a receipt is refused unless -`--force` (which removes a pre-receipt legacy copy by its inventory); owned content that no longer matches -the receipt is refused unless `--force`; a directory that is not this plugin's install is always refused. +runtime state (the framework state roots the receipt records with ownership evidence) — and, for an Agent +Plugins pack with a stdio server, the `~/.cursor/agent-bundle/plugin-data/` directory the receipt records +as `PLUGIN_DATA` — is kept unless `--purge-data --confirm-purge` is passed (a kept data directory leaves a +remnant receipt behind so a later purge still finds it; an empty one is pruned); unowned entries, including a +`state/` directory beside the plugin, are left in place and listed. A receipt with no recorded state location +(written before the install could record it) retains the current environment's default as unproven; a +keep-data run cannot turn that observation into later purge authority. A directory without a receipt naming +this plugin is foreign and always refused, with or without `--force`; owned content that no longer matches +the receipt is refused unless `--force`. A second run is a `Not installed` no-op. With the optional `agent-bundle` CLI, `agent-bundle uninstall cursor --from ./ [--mode marketplace]` applies the same policy, and `agent-bundle doctor --from ./` shows the lifecycle stage (placed, registered, enabled, active) with @@ -254,21 +257,21 @@ other clients; the recorded clients above name which of them expand the placehol ### Reinstall after a same-version rebuild The installer records an install receipt (`.agent-bundle-install.json`) and replaces its owned files in -place when the same version was rebuilt with different content; runtime state (`state/`) is never -touched. Pass `--replace` (alias `--force`) to replace a different installed version or to adopt a -copy installed before receipts existed. Foreign directories are refused with a content-hash -comparison. For a client that manages its own copy, remove and re-add the plugin through that client -when only content changed at the same version. +place when the same version was rebuilt with different content; unowned entries are never +touched. Pass `--replace` to replace a different installed version. A directory without a receipt +naming this plugin (including a copy installed before receipts existed) is foreign and refused with a +content-hash comparison; remove it manually. For a client that manages its own copy, remove and re-add +the plugin through that client when only content changed at the same version. ### Uninstall ```sh node ./install.mjs --uninstall --plan # print exactly what would be removed -node ./install.mjs --uninstall # remove the receipt-owned files; keep state/ -node ./install.mjs --uninstall --purge-data --confirm-purge # also remove durable runtime state +node ./install.mjs --uninstall # remove the receipt-owned files; keep durable state +node ./install.mjs --uninstall --purge-data --confirm-purge # also remove receipt-owned durable runtime state ``` Uninstall removes exactly what the receipt owns (files, installer-created directories) and keeps -durable runtime state under `state/` (and the recorded `PLUGIN_DATA` directory of an Agent Plugins pack) -unless `--purge-data --confirm-purge` is passed. A missing -receipt or modified owned content is refused unless `--force`; foreign directories are always refused. +the durable runtime state the receipt records (and the recorded `PLUGIN_DATA` directory of an Agent Plugins +pack) unless `--purge-data --confirm-purge` is passed. Modified owned content is refused unless `--force`; +a directory without a receipt naming this plugin is foreign and always refused. diff --git a/artifact/agent-bundle.compile-evidence.json b/artifact/agent-bundle.compile-evidence.json index 92aa812..a2f3518 100644 --- a/artifact/agent-bundle.compile-evidence.json +++ b/artifact/agent-bundle.compile-evidence.json @@ -1 +1 @@ -{"assets":[{"externals":[{"externalType":"node-commonjs","issuers":["node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.production.js"],"kind":"builtin","request":"async_hooks","userRequest":"async_hooks"},{"externalType":"node-commonjs","issuers":["node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.production.js"],"kind":"builtin","request":"crypto","userRequest":"crypto"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/736.js","node_modules/@agent-bundle/runtime/dist/index.js"],"kind":"builtin","request":"node:async_hooks","userRequest":"node:async_hooks"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/302.js"],"kind":"builtin","request":"node:buffer","userRequest":"node:buffer"},{"externalType":"module","issuers":["src/cli/codex/bridge/run.tsx","src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/relay/managed.js"],"kind":"builtin","request":"node:child_process","userRequest":"node:child_process"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/gateway.js","src/core/relay/control.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:crypto","userRequest":"node:crypto"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/codex/conversation.js","src/core/desktop-shim.js","src/core/history.js","src/core/store.js"],"kind":"builtin","request":"node:fs","userRequest":"node:fs"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/40.js","src/cli/skills/add.tsx","src/core/relay/managed.js"],"kind":"builtin","request":"node:fs/promises","userRequest":"node:fs/promises"},{"externalType":"module","issuers":["src/core/codex-bridge.js","src/core/relay/control.js"],"kind":"builtin","request":"node:net","userRequest":"node:net"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/history.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:os","userRequest":"node:os"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","src/cli/skills/add.tsx","src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/history.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:path","userRequest":"node:path"},{"externalType":"module","issuers":["src/core/history.js"],"kind":"builtin","request":"node:readline","userRequest":"node:readline"},{"externalType":"module","issuers":["src/core/relay/control.js"],"kind":"builtin","request":"node:string_decoder","userRequest":"node:string_decoder"},{"externalType":"module","issuers":[".agent-bundle-virtual/bin-gbot-flight-entry.mjs","src/core/relay/managed.js"],"kind":"builtin","request":"node:url","userRequest":"node:url"},{"externalType":"module","issuers":[".agent-bundle-virtual/bin-gbot-flight-entry.mjs"],"kind":"builtin","request":"node:worker_threads","userRequest":"node:worker_threads"},{"externalType":"node-commonjs","issuers":["node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.production.js"],"kind":"builtin","request":"stream","userRequest":"stream"},{"externalType":"node-commonjs","issuers":["node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-client.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-client.node.production.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.production.js"],"kind":"builtin","request":"util","userRequest":"util"}],"packages":["@agent-bundle/runtime","effect","react","react-dom","react-server-dom-rspack","rsc-markdown-stream","zod"],"path":"bin/gbot-flight.mjs","sha256":"814c0708905947e1d703498c2d36b554eff6753ca74da23122845b61182301fd"},{"externals":[{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/736.js","node_modules/@agent-bundle/runtime/dist/index.js"],"kind":"builtin","request":"node:async_hooks","userRequest":"node:async_hooks"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/302.js"],"kind":"builtin","request":"node:buffer","userRequest":"node:buffer"},{"externalType":"module","issuers":["src/cli/codex/bridge/run.tsx","src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/relay/managed.js"],"kind":"builtin","request":"node:child_process","userRequest":"node:child_process"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","node_modules/agent-bundle/dist/667~1.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/gateway.js","src/core/relay/control.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:crypto","userRequest":"node:crypto"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","node_modules/agent-bundle/dist/launch-env.js","node_modules/agent-bundle/dist/terminal-capability.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/codex/conversation.js","src/core/desktop-shim.js","src/core/history.js","src/core/store.js"],"kind":"builtin","request":"node:fs","userRequest":"node:fs"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/40.js","node_modules/agent-bundle/dist/667~1.js","src/cli/skills/add.tsx","src/core/relay/managed.js"],"kind":"builtin","request":"node:fs/promises","userRequest":"node:fs/promises"},{"externalType":"module","issuers":["src/core/codex-bridge.js","src/core/relay/control.js"],"kind":"builtin","request":"node:net","userRequest":"node:net"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/history.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:os","userRequest":"node:os"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","node_modules/agent-bundle/dist/launch-env.js","src/cli/skills/add.tsx","src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/history.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:path","userRequest":"node:path"},{"externalType":"module","issuers":["src/core/history.js"],"kind":"builtin","request":"node:readline","userRequest":"node:readline"},{"externalType":"module","issuers":["src/core/relay/control.js"],"kind":"builtin","request":"node:string_decoder","userRequest":"node:string_decoder"},{"externalType":"module","issuers":[".agent-bundle-virtual/bin-gbot-0.mjs",".agent-bundle-virtual/bin-gbot-entry.mjs","src/core/relay/managed.js"],"kind":"builtin","request":"node:url","userRequest":"node:url"},{"externalType":"module","issuers":[".agent-bundle-virtual/bin-gbot-entry.mjs"],"kind":"builtin","request":"node:worker_threads","userRequest":"node:worker_threads"},{"externalType":"node-commonjs","issuers":["node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-client.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-client.node.production.js"],"kind":"builtin","request":"util","userRequest":"util"}],"packages":["@agent-bundle/runtime","agent-bundle","effect","react","react-dom","react-server-dom-rspack","rsc-markdown-stream","zod"],"path":"bin/gbot.mjs","sha256":"af6f18e83e884b1edd5d4c8290838f46908d239d22bf86927de7376ec88f5f2f"},{"externals":[{"externalType":"node-commonjs","issuers":["node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.production.js"],"kind":"builtin","request":"async_hooks","userRequest":"async_hooks"},{"externalType":"node-commonjs","issuers":["node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.production.js"],"kind":"builtin","request":"crypto","userRequest":"crypto"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/736.js","node_modules/@agent-bundle/runtime/dist/index.js"],"kind":"builtin","request":"node:async_hooks","userRequest":"node:async_hooks"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/302.js"],"kind":"builtin","request":"node:buffer","userRequest":"node:buffer"},{"externalType":"module","issuers":["src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/relay/managed.js"],"kind":"builtin","request":"node:child_process","userRequest":"node:child_process"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/gateway.js","src/core/relay/control.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:crypto","userRequest":"node:crypto"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/codex/conversation.js","src/core/desktop-shim.js","src/core/store.js"],"kind":"builtin","request":"node:fs","userRequest":"node:fs"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/40.js","src/core/relay/managed.js"],"kind":"builtin","request":"node:fs/promises","userRequest":"node:fs/promises"},{"externalType":"module","issuers":["src/core/codex-bridge.js","src/core/relay/control.js"],"kind":"builtin","request":"node:net","userRequest":"node:net"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:os","userRequest":"node:os"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:path","userRequest":"node:path"},{"externalType":"module","issuers":["src/core/relay/control.js"],"kind":"builtin","request":"node:string_decoder","userRequest":"node:string_decoder"},{"externalType":"module","issuers":[".agent-bundle-virtual/mcp-grok-bot-b8c2461e-flight-entry.mjs","src/core/relay/managed.js"],"kind":"builtin","request":"node:url","userRequest":"node:url"},{"externalType":"module","issuers":[".agent-bundle-virtual/mcp-grok-bot-b8c2461e-flight-entry.mjs"],"kind":"builtin","request":"node:worker_threads","userRequest":"node:worker_threads"},{"externalType":"node-commonjs","issuers":["node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.production.js"],"kind":"builtin","request":"stream","userRequest":"stream"},{"externalType":"node-commonjs","issuers":["node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-client.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-client.node.production.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.production.js"],"kind":"builtin","request":"util","userRequest":"util"}],"packages":["@agent-bundle/runtime","agent-bundle","effect","react","react-dom","react-server-dom-rspack","rsc-markdown-stream","zod"],"path":"mcp/mcp-grok-bot-b8c2461e-flight.mjs","sha256":"8e1f5447c6aa03da02c6cc1dcfea6ede06e0a7ac5d2196fe1d52d4ed5970e9dd"},{"externals":[{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/736.js","node_modules/@agent-bundle/runtime/dist/index.js"],"kind":"builtin","request":"node:async_hooks","userRequest":"node:async_hooks"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/302.js"],"kind":"builtin","request":"node:buffer","userRequest":"node:buffer"},{"externalType":"module","issuers":["src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/relay/managed.js"],"kind":"builtin","request":"node:child_process","userRequest":"node:child_process"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","node_modules/@agent-bundle/runtime/dist/lineage.js","node_modules/agent-bundle/dist/667~1.js","node_modules/agent-bundle/dist/mcp-server-runtime.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/gateway.js","src/core/relay/control.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:crypto","userRequest":"node:crypto"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","node_modules/agent-bundle/dist/launch-env.js","node_modules/agent-bundle/dist/terminal-capability.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/codex/conversation.js","src/core/desktop-shim.js","src/core/store.js"],"kind":"builtin","request":"node:fs","userRequest":"node:fs"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/40.js","node_modules/agent-bundle/dist/667~1.js","src/core/relay/managed.js"],"kind":"builtin","request":"node:fs/promises","userRequest":"node:fs/promises"},{"externalType":"module","issuers":["src/core/codex-bridge.js","src/core/relay/control.js"],"kind":"builtin","request":"node:net","userRequest":"node:net"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:os","userRequest":"node:os"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","node_modules/agent-bundle/dist/launch-env.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:path","userRequest":"node:path"},{"externalType":"module","issuers":["node_modules/@modelcontextprotocol/server/dist/shimsNode.mjs"],"kind":"builtin","request":"node:process","userRequest":"node:process"},{"externalType":"module","issuers":["src/core/relay/control.js"],"kind":"builtin","request":"node:string_decoder","userRequest":"node:string_decoder"},{"externalType":"module","issuers":[".agent-bundle-virtual/mcp-grok-bot-b8c2461e-1.mjs",".agent-bundle-virtual/mcp-grok-bot-b8c2461e-2.mjs","src/core/relay/managed.js"],"kind":"builtin","request":"node:url","userRequest":"node:url"},{"externalType":"module","issuers":["node_modules/agent-bundle/dist/mcp-server-runtime.js"],"kind":"builtin","request":"node:worker_threads","userRequest":"node:worker_threads"},{"externalType":"node-commonjs","issuers":["node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-client.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-client.node.production.js"],"kind":"builtin","request":"util","userRequest":"util"}],"packages":["@agent-bundle/runtime","@modelcontextprotocol/core","@modelcontextprotocol/server","agent-bundle","effect","react","react-dom","react-server-dom-rspack","rsc-markdown-stream","zod"],"path":"mcp/mcp-grok-bot-b8c2461e.mjs","sha256":"db4bab649091f44a29bf1bfb55e2ef15a68ab80a18ed993415f89f1d51977bd7"},{"externals":[{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/state.js"],"kind":"builtin","request":"node:assert/strict","userRequest":"node:assert/strict"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/736.js"],"kind":"builtin","request":"node:async_hooks","userRequest":"node:async_hooks"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/302.js"],"kind":"builtin","request":"node:buffer","userRequest":"node:buffer"},{"externalType":"module","issuers":["src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js"],"kind":"builtin","request":"node:child_process","userRequest":"node:child_process"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/state/sqlite.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/gateway.js","src/core/relay/codex.js","src/core/relay/control.js","src/core/relay/engine.js","src/core/relay/profile.js","src/core/relay/records.js","src/core/relay/state.js","src/core/store.js"],"kind":"builtin","request":"node:crypto","userRequest":"node:crypto"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/state/sqlite.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/codex/conversation.js","src/core/desktop-shim.js","src/core/relay/codex.js","src/core/store.js"],"kind":"builtin","request":"node:fs","userRequest":"node:fs"},{"externalType":"module","issuers":["src/core/relay/ownership.js","src/core/relay/state.js","src/core/relay/worker.js"],"kind":"builtin","request":"node:fs/promises","userRequest":"node:fs/promises"},{"externalType":"module","issuers":["src/core/codex-bridge.js","src/core/relay/control.js","src/core/relay/ownership.js","src/core/relay/worker.js"],"kind":"builtin","request":"node:net","userRequest":"node:net"},{"externalType":"module","issuers":["src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/relay/engine.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:os","userRequest":"node:os"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/state/sqlite.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/relay/engine.js","src/core/relay/ownership.js","src/core/relay/profile.js","src/core/relay/state.js","src/core/store.js"],"kind":"builtin","request":"node:path","userRequest":"node:path"},{"externalType":"import","issuers":["src/core/relay/ownership.js"],"kind":"builtin","request":"node:sqlite","userRequest":"node:sqlite"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/state/sqlite.js"],"kind":"builtin","request":"node:sqlite","userRequest":"node:sqlite"},{"externalType":"module","issuers":["src/core/relay/control.js","src/core/relay/worker.js"],"kind":"builtin","request":"node:string_decoder","userRequest":"node:string_decoder"}],"packages":["@agent-bundle/runtime","effect","react","zod"],"path":"scripts/gbot-relay.mjs","sha256":"ca34a124ea75ee0e4fbff64fa4bd907865335cb303526c070bd29ad1048dfb1e"}],"coverage":{"rewritable":false,"unobserved":["import()","require()","require.resolve(…)","createRequire(…)(…)","import.meta.resolve(…)"]},"policy":{"name":"closed-world-externals","revision":1},"producer":{"name":"agent-bundle","rspack":"2.2.4","version":"0.2.1"}} +{"assets":[{"externals":[{"externalType":"node-commonjs","issuers":["node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.production.js"],"kind":"builtin","request":"async_hooks","userRequest":"async_hooks"},{"externalType":"node-commonjs","issuers":["node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.production.js"],"kind":"builtin","request":"crypto","userRequest":"crypto"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/736.js"],"kind":"builtin","request":"node:async_hooks","userRequest":"node:async_hooks"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/302.js"],"kind":"builtin","request":"node:buffer","userRequest":"node:buffer"},{"externalType":"module","issuers":["src/cli/codex/bridge/run.tsx","src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/relay/managed.js"],"kind":"builtin","request":"node:child_process","userRequest":"node:child_process"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/gateway.js","src/core/relay/control.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:crypto","userRequest":"node:crypto"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/codex/conversation.js","src/core/desktop-shim.js","src/core/history.js","src/core/store.js"],"kind":"builtin","request":"node:fs","userRequest":"node:fs"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/40.js","src/cli/skills/add.tsx","src/core/relay/managed.js"],"kind":"builtin","request":"node:fs/promises","userRequest":"node:fs/promises"},{"externalType":"module","issuers":["src/core/codex-bridge.js","src/core/relay/control.js"],"kind":"builtin","request":"node:net","userRequest":"node:net"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/history.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:os","userRequest":"node:os"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","src/cli/skills/add.tsx","src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/history.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:path","userRequest":"node:path"},{"externalType":"module","issuers":["src/core/history.js"],"kind":"builtin","request":"node:readline","userRequest":"node:readline"},{"externalType":"module","issuers":["src/core/relay/control.js"],"kind":"builtin","request":"node:string_decoder","userRequest":"node:string_decoder"},{"externalType":"module","issuers":[".agent-bundle-virtual/bin-gbot-flight-entry.mjs","src/core/relay/managed.js"],"kind":"builtin","request":"node:url","userRequest":"node:url"},{"externalType":"module","issuers":[".agent-bundle-virtual/bin-gbot-flight-entry.mjs"],"kind":"builtin","request":"node:worker_threads","userRequest":"node:worker_threads"},{"externalType":"node-commonjs","issuers":["node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.production.js"],"kind":"builtin","request":"stream","userRequest":"stream"},{"externalType":"node-commonjs","issuers":["node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-client.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-client.node.production.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.production.js"],"kind":"builtin","request":"util","userRequest":"util"}],"packages":["@agent-bundle/runtime","effect","react","react-dom","react-server-dom-rspack","rsc-markdown-stream","zod"],"path":"bin/gbot-flight.mjs","sha256":"f0ba2b7100d1e59c002b9327ec6dcd5c25a66a0dc3024a5c7ab7c7ff9e582fea"},{"externals":[{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/736.js"],"kind":"builtin","request":"node:async_hooks","userRequest":"node:async_hooks"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/302.js"],"kind":"builtin","request":"node:buffer","userRequest":"node:buffer"},{"externalType":"module","issuers":["src/cli/codex/bridge/run.tsx","src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/relay/managed.js"],"kind":"builtin","request":"node:child_process","userRequest":"node:child_process"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","node_modules/agent-bundle/dist/667~1.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/gateway.js","src/core/relay/control.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:crypto","userRequest":"node:crypto"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","node_modules/agent-bundle/dist/launch-env.js","node_modules/agent-bundle/dist/terminal-capability.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/codex/conversation.js","src/core/desktop-shim.js","src/core/history.js","src/core/store.js"],"kind":"builtin","request":"node:fs","userRequest":"node:fs"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/40.js","node_modules/agent-bundle/dist/667~1.js","src/cli/skills/add.tsx","src/core/relay/managed.js"],"kind":"builtin","request":"node:fs/promises","userRequest":"node:fs/promises"},{"externalType":"module","issuers":["src/core/codex-bridge.js","src/core/relay/control.js"],"kind":"builtin","request":"node:net","userRequest":"node:net"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/history.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:os","userRequest":"node:os"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","node_modules/agent-bundle/dist/launch-env.js","src/cli/skills/add.tsx","src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/history.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:path","userRequest":"node:path"},{"externalType":"module","issuers":["src/core/history.js"],"kind":"builtin","request":"node:readline","userRequest":"node:readline"},{"externalType":"module","issuers":["src/core/relay/control.js"],"kind":"builtin","request":"node:string_decoder","userRequest":"node:string_decoder"},{"externalType":"module","issuers":[".agent-bundle-virtual/bin-gbot-0.mjs",".agent-bundle-virtual/bin-gbot-entry.mjs","src/core/relay/managed.js"],"kind":"builtin","request":"node:url","userRequest":"node:url"},{"externalType":"module","issuers":[".agent-bundle-virtual/bin-gbot-entry.mjs"],"kind":"builtin","request":"node:worker_threads","userRequest":"node:worker_threads"},{"externalType":"node-commonjs","issuers":["node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-client.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-client.node.production.js"],"kind":"builtin","request":"util","userRequest":"util"}],"packages":["@agent-bundle/runtime","agent-bundle","effect","react","react-dom","react-server-dom-rspack","rsc-markdown-stream","zod"],"path":"bin/gbot.mjs","sha256":"e83a2ddd13b75246cf8e0ccbcf27f0fd56af497e7e66ed2244caa0a9c8b3def8"},{"externals":[{"externalType":"node-commonjs","issuers":["node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.production.js"],"kind":"builtin","request":"async_hooks","userRequest":"async_hooks"},{"externalType":"node-commonjs","issuers":["node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.production.js"],"kind":"builtin","request":"crypto","userRequest":"crypto"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/736.js"],"kind":"builtin","request":"node:async_hooks","userRequest":"node:async_hooks"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/302.js"],"kind":"builtin","request":"node:buffer","userRequest":"node:buffer"},{"externalType":"module","issuers":["src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/relay/managed.js"],"kind":"builtin","request":"node:child_process","userRequest":"node:child_process"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/gateway.js","src/core/relay/control.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:crypto","userRequest":"node:crypto"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/codex/conversation.js","src/core/desktop-shim.js","src/core/store.js"],"kind":"builtin","request":"node:fs","userRequest":"node:fs"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/40.js","src/core/relay/managed.js"],"kind":"builtin","request":"node:fs/promises","userRequest":"node:fs/promises"},{"externalType":"module","issuers":["src/core/codex-bridge.js","src/core/relay/control.js"],"kind":"builtin","request":"node:net","userRequest":"node:net"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:os","userRequest":"node:os"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:path","userRequest":"node:path"},{"externalType":"module","issuers":["src/core/relay/control.js"],"kind":"builtin","request":"node:string_decoder","userRequest":"node:string_decoder"},{"externalType":"module","issuers":[".agent-bundle-virtual/mcp-grok-bot-b8c2461e-flight-entry.mjs","src/core/relay/managed.js"],"kind":"builtin","request":"node:url","userRequest":"node:url"},{"externalType":"module","issuers":[".agent-bundle-virtual/mcp-grok-bot-b8c2461e-flight-entry.mjs"],"kind":"builtin","request":"node:worker_threads","userRequest":"node:worker_threads"},{"externalType":"node-commonjs","issuers":["node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.production.js"],"kind":"builtin","request":"stream","userRequest":"stream"},{"externalType":"node-commonjs","issuers":["node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-client.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-client.node.production.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-server.node.production.js"],"kind":"builtin","request":"util","userRequest":"util"}],"packages":["@agent-bundle/runtime","agent-bundle","effect","react","react-dom","react-server-dom-rspack","rsc-markdown-stream","zod"],"path":"mcp/mcp-grok-bot-b8c2461e-flight.mjs","sha256":"d7dbdf05896bc93357a0abd8f73730038f58dff03b6a93cdecacad912a63f909"},{"externals":[{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/736.js"],"kind":"builtin","request":"node:async_hooks","userRequest":"node:async_hooks"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/302.js"],"kind":"builtin","request":"node:buffer","userRequest":"node:buffer"},{"externalType":"module","issuers":["src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/relay/managed.js"],"kind":"builtin","request":"node:child_process","userRequest":"node:child_process"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","node_modules/@agent-bundle/runtime/dist/lineage.js","node_modules/agent-bundle/dist/667~1.js","node_modules/agent-bundle/dist/mcp-server-runtime.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/gateway.js","src/core/relay/control.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:crypto","userRequest":"node:crypto"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","node_modules/agent-bundle/dist/launch-env.js","node_modules/agent-bundle/dist/terminal-capability.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/codex/conversation.js","src/core/desktop-shim.js","src/core/store.js"],"kind":"builtin","request":"node:fs","userRequest":"node:fs"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/40.js","node_modules/agent-bundle/dist/667~1.js","src/core/relay/managed.js"],"kind":"builtin","request":"node:fs/promises","userRequest":"node:fs/promises"},{"externalType":"module","issuers":["src/core/codex-bridge.js","src/core/relay/control.js"],"kind":"builtin","request":"node:net","userRequest":"node:net"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:os","userRequest":"node:os"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/49.js","node_modules/agent-bundle/dist/launch-env.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:path","userRequest":"node:path"},{"externalType":"module","issuers":["node_modules/@modelcontextprotocol/server/dist/shimsNode.mjs"],"kind":"builtin","request":"node:process","userRequest":"node:process"},{"externalType":"module","issuers":["src/core/relay/control.js"],"kind":"builtin","request":"node:string_decoder","userRequest":"node:string_decoder"},{"externalType":"module","issuers":[".agent-bundle-virtual/mcp-grok-bot-b8c2461e-1.mjs",".agent-bundle-virtual/mcp-grok-bot-b8c2461e-2.mjs","src/core/relay/managed.js"],"kind":"builtin","request":"node:url","userRequest":"node:url"},{"externalType":"module","issuers":["node_modules/agent-bundle/dist/mcp-server-runtime.js"],"kind":"builtin","request":"node:worker_threads","userRequest":"node:worker_threads"},{"externalType":"node-commonjs","issuers":["node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-client.node.development.js","node_modules/react-server-dom-rspack/cjs/react-server-dom-rspack-client.node.production.js"],"kind":"builtin","request":"util","userRequest":"util"}],"packages":["@agent-bundle/runtime","@modelcontextprotocol/core","@modelcontextprotocol/server","agent-bundle","effect","react","react-dom","react-server-dom-rspack","rsc-markdown-stream","zod"],"path":"mcp/mcp-grok-bot-b8c2461e.mjs","sha256":"8ff249ab445ebf3c60adf9ee398c45a73b5c77031da1d373222dcba07539545d"},{"externals":[{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/state.js"],"kind":"builtin","request":"node:assert/strict","userRequest":"node:assert/strict"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/736.js"],"kind":"builtin","request":"node:async_hooks","userRequest":"node:async_hooks"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/302.js"],"kind":"builtin","request":"node:buffer","userRequest":"node:buffer"},{"externalType":"module","issuers":["src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js"],"kind":"builtin","request":"node:child_process","userRequest":"node:child_process"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/state/sqlite.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/gateway.js","src/core/relay/codex.js","src/core/relay/control.js","src/core/relay/engine.js","src/core/relay/profile.js","src/core/relay/records.js","src/core/relay/state.js","src/core/store.js"],"kind":"builtin","request":"node:crypto","userRequest":"node:crypto"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/state/sqlite.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/codex/conversation.js","src/core/desktop-shim.js","src/core/relay/codex.js","src/core/store.js"],"kind":"builtin","request":"node:fs","userRequest":"node:fs"},{"externalType":"module","issuers":["src/core/relay/ownership.js","src/core/relay/state.js","src/core/relay/worker.js"],"kind":"builtin","request":"node:fs/promises","userRequest":"node:fs/promises"},{"externalType":"module","issuers":["src/core/codex-bridge.js","src/core/relay/control.js","src/core/relay/ownership.js","src/core/relay/worker.js"],"kind":"builtin","request":"node:net","userRequest":"node:net"},{"externalType":"module","issuers":["src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/relay/engine.js","src/core/relay/profile.js","src/core/store.js"],"kind":"builtin","request":"node:os","userRequest":"node:os"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/state/sqlite.js","src/core/app-session.js","src/core/codex-bridge.js","src/core/desktop-shim.js","src/core/relay/engine.js","src/core/relay/ownership.js","src/core/relay/profile.js","src/core/relay/state.js","src/core/store.js"],"kind":"builtin","request":"node:path","userRequest":"node:path"},{"externalType":"import","issuers":["src/core/relay/ownership.js"],"kind":"builtin","request":"node:sqlite","userRequest":"node:sqlite"},{"externalType":"module","issuers":["node_modules/@agent-bundle/runtime/dist/state/sqlite.js"],"kind":"builtin","request":"node:sqlite","userRequest":"node:sqlite"},{"externalType":"module","issuers":["src/core/relay/control.js","src/core/relay/worker.js"],"kind":"builtin","request":"node:string_decoder","userRequest":"node:string_decoder"}],"packages":["@agent-bundle/runtime","effect","zod"],"path":"scripts/gbot-relay.mjs","sha256":"0ce92aadbd9a3c042cbb20576fa7f66574a2c8c684be46af678057699aa897b1"}],"coverage":{"rewritable":false,"unobserved":["import()","require()","require.resolve(…)","createRequire(…)(…)","import.meta.resolve(…)"]},"policy":{"name":"closed-world-externals","revision":1},"producer":{"name":"agent-bundle","rspack":"2.2.4","version":"0.3.0"}} diff --git a/artifact/agent-bundle.manifest.json b/artifact/agent-bundle.manifest.json index 00d14f7..4d74d1e 100644 --- a/artifact/agent-bundle.manifest.json +++ b/artifact/agent-bundle.manifest.json @@ -1 +1 @@ -{"application":{"description":"Message Grok Bot from Codex, Claude Code, and Cursor, with managed automatic replies and explicit Codex conversation links.","id":"plugin:gbot","name":"gbot","version":"0.9.0"},"compiler":{"adapters":[{"adapterRevision":"1.28.0","host":"claude","observedVersion":"2.1.260","schemas":[{"name":"hooks","revision":"2.1.260","sha256":"0cdfc5eb5201f2c3091768559ac82f4c563ccb1b7bce7a39d5f99e5f404654cb"},{"name":"lsp","revision":"2.1.260","sha256":"b4419c5d857267c7e2b21e3e1eb98b4fdc302c87109007190d3258e6ba7096e4"},{"name":"marketplace","revision":"2.1.260","sha256":"31ee4cc43ba5ce2be248030a69da2d31171550b2cc51c1fcb9f788a8ab92783d"},{"name":"mcp","revision":"2.1.260","sha256":"edd4770e41d6aee5beae1ff918d33139613a243e454ecbd52b72fa824be4a662"},{"name":"monitors","revision":"2.1.260","sha256":"6378d94b51fb7c784eaee178237008a03da0f889d0520d57486784954a1d484c"},{"name":"plugin","revision":"2.1.260","sha256":"2a976091b81ad07ae8eca57f6f9c5749efeba17fa089a0c12b6ca84d6e70f118"},{"name":"settings","revision":"2.1.260","sha256":"2bbca553621dbf9433a9b7d1ff7952543a368434f2d999a4e4e360b95b6d4c3d"},{"name":"theme","revision":"2.1.260","sha256":"9931264e6f5a1d4b3b854ce7a17d602c9ba1b57cc1991f1d3991b316eaa81ac2"}]},{"adapterRevision":"1.13.0","host":"codex","observedVersion":"0.147.0","schemas":[{"name":"app","revision":"0.147.0","sha256":"01c720a645e437bf0c4f8c26fd4cb5a13988e5649e4a8562ee23a1d4b7355c6a"},{"name":"hooks","revision":"0.147.0","sha256":"175b859eb8e85bd287d85ee840d97c3f5c2d0dda3223507a796d158e3770eeba"},{"name":"marketplace","revision":"0.147.0","sha256":"fbccce3ade39e1b077fcb440e60260de6e811e8c2d222b2ae0fe8fe47706b470"},{"name":"mcp","revision":"0.147.0","sha256":"75bd50f9fcb85c2e8d43bc132d61c172a02f28ea8bb77389816ae77b14a4257e"},{"name":"plugin","revision":"0.147.0","sha256":"074c6c71966a3e6560ccbceb8d82ec6a40cb1eccee2f2d863fb4ef1e2276a814"}]},{"adapterRevision":"1.13.0","host":"cursor","observedVersion":"2026-08-28","schemas":[{"name":"hooks","revision":"2026-08-28","sha256":"06154b7afa0861df462130b988912b897e7ccf962b8dd20c09193100bcde5d81"},{"name":"marketplace","revision":"2026-08-28","sha256":"1aae96a24c2796419933bc8bfe3a1255394e7199c35740b36325e0ce6dbc253d"},{"name":"mcp","revision":"2026-08-28","sha256":"f3fa4615afefe004c4fbcc09e635d890df0f1ec0cb39540feab72cbd3a31d844"},{"name":"plugin","revision":"2026-08-28","sha256":"a393b758901803fcf5cfe0d77bda8a83e987d32c3377dfce2d9edf445af884ed"}]},{"adapterRevision":"1.10.0","host":"portable","observedVersion":"1.0.0","schemas":[{"name":"mcp","revision":"1.0.0","sha256":"6539175bfcdf43085855183e86da40ea94b166547a72b47ae9a0a390516d3acb"},{"name":"plugin","revision":"1.0.0","sha256":"0a4aad95ce337878ad38802ebf0daa3fde76abe3f65400c86bcbb1ec0b3ab883"}]}],"agentSkills":{"schemaSha256":"6d06b61e423317421de2295ea1fd0c7b4491bfa36c5b7705c28616dfe76d4047","sourceRevision":"69ef37e9424c0a7ea9dd2293b559e43ec8176379","specification":"https://raw.githubusercontent.com/agentskills/agentskills/69ef37e9424c0a7ea9dd2293b559e43ec8176379/docs/specification.mdx"},"producer":{"name":"agent-bundle","version":"0.2.1"},"project":{"configDigest":"888dd04deb2d2ea8e35639dd53deba7140f0f0f0be781f50dc29cf63945e0159","configPath":"agent-bundle.config.ts","modelDigest":"e32c0b87d992979b6850b86182c8e2dbb23a72f96872f939466d1b85a5b72ef9","packageName":"grok-bot-cli","packageVersion":"0.9.0","revision":"eed6bf2f400d884920d9f4922f6b22963416fe7b47486837400bcc6eb709197c","sourceInputs":[{"executable":false,"path":".changeset/clean-pugs-dream.md","sha256":"9e5518cbc2979fa3ed5939def562f5c3630434ff01a5069e1de15729b9e6a9a5"},{"executable":false,"path":".changeset/config.json","sha256":"0a97ce5d0488bada887ee9ea3726edecc727454b7da0294f1b5fe4947f48ee7c"},{"executable":false,"path":".changeset/README.md","sha256":"495bd4805f8362853bce99689c1cd75db8c475dfa38930619d2e197d7554db27"},{"executable":false,"path":".github/workflows/changeset.yml","sha256":"293f8c43e3d9806f92f4ab3f242f1ecfc65988f73fd6fcf13fbff6f8533a827c"},{"executable":false,"path":".github/workflows/ci.yml","sha256":"0157614be1e712cbe461c6df3a74db3eda502ac9f19e2a983971a13bc1a14d9b"},{"executable":false,"path":".github/workflows/release.yml","sha256":"cb78aed6074c8eb8938bd97f7d70bc3f57b8d303dea28344830229c6ebc2f1f0"},{"executable":false,"path":".gitignore","sha256":"3e8fdb390e0a40ebc680e14f015cfc607d92061f174dcea0c559ecad0da5058e"},{"executable":false,"path":".npmrc","sha256":"d83f12f7ebebf59d1d17bc1a800e1de5c96791ea8155406d43a5b59aeabdaaf8"},{"executable":false,"path":"agent-bundle.config.ts","sha256":"888dd04deb2d2ea8e35639dd53deba7140f0f0f0be781f50dc29cf63945e0159"},{"executable":false,"path":"AGENTS.md","sha256":"e18ce90a031c533e7226789b97f6bce4aa7994b672544e0f425d20cc3bc15d29"},{"executable":false,"path":"CHANGELOG.md","sha256":"b657e7ee4f8992d678ffe62ac748db2e3752bb3e0b01a787861667a9e4ad5dd7"},{"executable":false,"path":"demo/grok-bot-cli-demo.gif","sha256":"0fe01e15fd2abbbc5cc3313e42931d404d3a320764e22fdcfb995f1a45dd73cd"},{"executable":false,"path":"demo/grok-bot-cli-demo.mp4","sha256":"b6ed66e43616674096c2f0a4a4da46fe4693c681833eab013f872a66b9ff933c"},{"executable":false,"path":"docs/codex-busy-threads.md","sha256":"2c3f292e39582f1aa431aeb2a0732c433bb167be9a6d1df2a04a8064cce47e76"},{"executable":false,"path":"docs/codex-duplex-architecture.md","sha256":"792f1be8bad508b042c5813c1fc3b7ea5ac87032803227830666727306e55fa2"},{"executable":false,"path":"docs/verification/2026-09-15-duplex.md","sha256":"c7d97f709a3c2d851c0a24690321bbda161ec925b4143a456b9951e174bf75df"},{"executable":false,"path":"LICENSE","sha256":"bc48c8a0f6b6e45842e574c79a6b955fe683ed13f48a50cc08bcccdb1a59fe59"},{"executable":false,"path":"package-lock.json","sha256":"16bc2bd5c891cfae1cea0bafe50b599396d3115cd2fd1f5f1cae1085a2ca3459"},{"executable":false,"path":"package.json","sha256":"c0f88e48436c0c130a872a8df4ec6af58f3cca6bb35a62d4cd7c21ac711b9cc1"},{"executable":false,"path":"README.md","sha256":"754b0438d4f973e9dfe755b56a4dfe29d65328a97be607f1790caac2413d57b0"},{"executable":false,"path":"renovate.json","sha256":"e80b4e42a3043bc12fa0640db4bac392d2bf770acf841360d7c8ceeeac2ec1a9"},{"executable":false,"path":"rstest.route-unit.config.ts","sha256":"7286e20dc3d4162673e7c3dfe824db00307e1fda178410f23044a97286d141f2"},{"executable":false,"path":"scripts/run-unit-tests.mjs","sha256":"58feb44330add2a4b04b3e8871bca0fa39ff48ed98e2f8295fb40af93c8e94d3"},{"executable":false,"path":"src/cli/_shared.ts","sha256":"555210759d9b2e2e60a01452c137abd73bad42bfab8b2311b66a3ab97f4ee5e9"},{"executable":false,"path":"src/cli/approvals/list.tsx","sha256":"8d21320b6cd9d6b2a266fd30196b8a439960f865a6f0a5dacf5845d64ed7388c"},{"executable":false,"path":"src/cli/approvals/respond.tsx","sha256":"7d9fe6e641deb08f444684733daac6da47fb472d90ed0e9ff77892f376a87255"},{"executable":false,"path":"src/cli/bots/create.tsx","sha256":"9f7a73a0595b642dd77f008ad596bcafd00fc5846ec1abff2ce62819d983eb84"},{"executable":false,"path":"src/cli/bots/delete.tsx","sha256":"126b53ac1da4a657f22d1a6770ddbab2cc66715c811de0873d50016bbe39cbf2"},{"executable":false,"path":"src/cli/bots/get.tsx","sha256":"f0c752a3b498819083a8ee5aa918d275727f1cc94d8774d8c84ac74db66e8a71"},{"executable":false,"path":"src/cli/bots/list.tsx","sha256":"21c0f7e39005860dfc2514b71f745bb4cab29d409ef2cff26f8759bb0fd261c1"},{"executable":false,"path":"src/cli/bots/update.tsx","sha256":"33b7f5aafbf931cf3cb5ecf423a76dacd09adb117a7d5490050639ae7f4210dd"},{"executable":false,"path":"src/cli/codex/bridge/respond.tsx","sha256":"9d3a6af4904af6e44583dfb4ef317b3fe1045a78e765fc27406eaca9bcadcd13"},{"executable":false,"path":"src/cli/codex/bridge/run.tsx","sha256":"a49d334bebb00db62ad2c54370a47ec2c9119b4c07eb6ba11fc4bba4dd8e4217"},{"executable":false,"path":"src/cli/codex/bridge/start.tsx","sha256":"9e423cf5d65168606f6235baa2bcd127eb949647f7a4dee284d75f831474524d"},{"executable":false,"path":"src/cli/codex/bridge/status.tsx","sha256":"c801f69080985c87025429fb136487acdfac093acb07241b3417ea9a83915a18"},{"executable":false,"path":"src/cli/codex/bridge/stop.tsx","sha256":"6710e298a21d124c442d5aa1a3744280e5cd4df93213797f2ea3c0654174184a"},{"executable":false,"path":"src/cli/codex/desktop-shim.tsx","sha256":"fa3d88d11895bc4a15700bd590c055aa392b2b0e0c1185c52da233a23589aba0"},{"executable":false,"path":"src/cli/codex/list-threads.tsx","sha256":"4419b29c5bc56f019e2835e3c8dbf4bc72291150900cfe2b8781a94c1482fe0f"},{"executable":false,"path":"src/cli/codex/queue.tsx","sha256":"7993ac5b827042cd95041775b183fde2d112b5ba7d5c82098e778a44e473826d"},{"executable":false,"path":"src/cli/codex/send.tsx","sha256":"6848001878471439bcc35a2c40010ecf0e57e61087879b1f4d6abb1be19e7924"},{"executable":false,"path":"src/cli/codex/status.tsx","sha256":"b8c31001cb2892c1bfccf502f9776ee06998eac4fc0356f92936fa2c34f272d8"},{"executable":false,"path":"src/cli/codex/wait.tsx","sha256":"c2ec45e5907e27ff0ab1885eceb2d62c33485b8d61f44ef871a24e7a7e8473ca"},{"executable":false,"path":"src/cli/codex/watch.tsx","sha256":"3280f42d15941cfd00b3727d9e271972c39165bd28db8f56acca5664d777cb4d"},{"executable":false,"path":"src/cli/doctor.tsx","sha256":"c30ce4e57fe707d36de29700abf5a2c56834bb4fb3adf2a70bb1089b4150ddc8"},{"executable":false,"path":"src/cli/groups/add.tsx","sha256":"2a5de115852f0ca6a6638300bd5006862a02a2f1e2f527b6fd680f610c1d777a"},{"executable":false,"path":"src/cli/groups/create.tsx","sha256":"da3f2539f338063daf51b80d86c27b2752f0e4a0334078d11508e27981590fa3"},{"executable":false,"path":"src/cli/groups/delete.tsx","sha256":"2d4e91113a2c24cefefcfd464513918791592b5e8734a4ef901eabe42c9c7289"},{"executable":false,"path":"src/cli/groups/get.tsx","sha256":"efed88fb3ab7292d60d6532f1f966f784ba3376b7826c9f3e5028467f86241e9"},{"executable":false,"path":"src/cli/groups/list.tsx","sha256":"f3cd229d41dd389b767447a04267700ab2293eae87a878f7d88149cb5798f4a6"},{"executable":false,"path":"src/cli/groups/members.tsx","sha256":"9b9eaecb65ea995006eff1b24a287110d16bf4830a0b0d07221c2f1317853641"},{"executable":false,"path":"src/cli/groups/remove.tsx","sha256":"96dd85d1b9732681ce9dc126ac3ae562d3f287f4c28e36b9a8f8c301dc93f63d"},{"executable":false,"path":"src/cli/groups/set.tsx","sha256":"4f9d90db612f14ddbb6d2afa5e45b66f044aed661ff95415e567e1be3b6108c6"},{"executable":false,"path":"src/cli/groups/update.tsx","sha256":"f44305815ddb6e27286f97ef68c04cfa5548acd5f04b1aba10ee7ce3cdbfc851"},{"executable":false,"path":"src/cli/history.tsx","sha256":"5151b48113b4ba0516bacabfabcd48e3256ead807c34d914deb84f31ded0b062"},{"executable":false,"path":"src/cli/send.tsx","sha256":"fd16790cfcde1c15328c3979acc0664112d5cf40d3f00a24da906e00dd63153e"},{"executable":false,"path":"src/cli/skills/add.tsx","sha256":"fbde237d172c026d7912174e705c03cbc9d74dad7806fc58c6ceb43127c69ba6"},{"executable":false,"path":"src/cli/skills/list.tsx","sha256":"34f255687c69aaf598a1dc54220453b57c46ed9ab4a168648d9c7eca6535ebae"},{"executable":false,"path":"src/cli/skills/remove.tsx","sha256":"21662c80a62f276c2dfd840a328e9665c0c5f63959a239d4dd877372c46f60d0"},{"executable":false,"path":"src/cli/thread.tsx","sha256":"29ab775936fa2987cb789754a44888fc52bdaad07180c5471122dda508cfd0c2"},{"executable":false,"path":"src/core/app-session.js","sha256":"2b2eb53ec3f4c7ea0dccf269fa9720af6f1ce36b8ca36e889d2bb271a092717d"},{"executable":false,"path":"src/core/codex-bridge.js","sha256":"02a0127f935a8c83d85ce1cf434d1a6fbecb3271ec3cd1c744b9175d2a5b88bb"},{"executable":false,"path":"src/core/codex/contract.js","sha256":"96e80f91c323df150d08a477abe6697b287cd7a1b11e98d17cb15f682fa46012"},{"executable":false,"path":"src/core/codex/conversation.js","sha256":"2eb3dc85807c4889e72e18a82ebfe7ea6d43a114ed961a06f970a593a6785983"},{"executable":false,"path":"src/core/codex/routes.ts","sha256":"bc220bf4111305e7fcaf46756b531ac2aabc1d12c87f89184ba5f670b11229ab"},{"executable":false,"path":"src/core/commands.js","sha256":"3ad8fafb86744a57992da93ad838ade0e9acb1b7ca09b829cefadbf2781be0c9"},{"executable":false,"path":"src/core/desktop-shim-bridge.js","sha256":"58f3f39b8527adf58f57313e02e34322b203b8c38d1acfbad419a8b9af214443"},{"executable":false,"path":"src/core/desktop-shim.js","sha256":"500b8617bade6fa1a9c395826e197892fb864067044cac80ab025849f8fd6f82"},{"executable":false,"path":"src/core/format.js","sha256":"83ee15f73a87ef24b75f7782f3b61dd4ef4cc1f2e01e38cdf19825b805fab3be"},{"executable":false,"path":"src/core/gateway.js","sha256":"3a4f838ee423600d29e05f58060dcaf81cdcea4ac93b36dd6108363ac24bc606"},{"executable":false,"path":"src/core/grok-approval-routes.ts","sha256":"a33daa4d05e0c2594c795bd7654c22f3e1003e4aaad41cd70034d03651dd01f9"},{"executable":false,"path":"src/core/grok-approvals.js","sha256":"6b651a65bdd17241dd5b7a01d94a318ece9356c1c9b965b0578e08250d74e8fe"},{"executable":false,"path":"src/core/headers.js","sha256":"e229f2826ebdfb52949dab500798c0fa8a5ff7c4e63de91a63103bf45d2ae3cc"},{"executable":false,"path":"src/core/history.js","sha256":"38ca8e8f8dcd2ad42952c424ea9f00be5972d8751e4c0ac87214171903d82d89"},{"executable":false,"path":"src/core/relay/codex.js","sha256":"827f4d209c0681d4ed973ef41e0b2264e64c38a43aecef279efe53713b129f0e"},{"executable":false,"path":"src/core/relay/completion.js","sha256":"9d1a47f92716d1ccc7c4f44d92a580084f3b622c6ac0f20c6391be81abeb56e4"},{"executable":false,"path":"src/core/relay/control.js","sha256":"3645540f9f799b8742e0d5782b6324454a1486a780f6cb97260b96ef62411771"},{"executable":false,"path":"src/core/relay/engine.js","sha256":"205dd43b337439a56c7b1521b2603679ebc7fd3b2da430f8a477f83549efd453"},{"executable":false,"path":"src/core/relay/intake.js","sha256":"b31146fe3c9edd2f09323a454687403666591b6c12483a55b07ac610d2e3610a"},{"executable":false,"path":"src/core/relay/interactions.js","sha256":"6b576ed3a5b6659bc17e384d26e40d6ccb41b118b3a91cf5c902e9758ccbc1b1"},{"executable":false,"path":"src/core/relay/managed.js","sha256":"dbe03ed964bd09739e580de73b7e9f90508062fa2e53b8244c6ca7f78fc7a60d"},{"executable":false,"path":"src/core/relay/ownership.js","sha256":"74805f04f6a8bc02b2951614c4814aa42f54aaa3abca027a2413ed5a54814caf"},{"executable":false,"path":"src/core/relay/profile.js","sha256":"3347d1d493d3470d82722468d31571464d8e11aa0b4deac5bda75f574078dfe5"},{"executable":false,"path":"src/core/relay/records.js","sha256":"c6ffc479436282348a491e0f18b1b0e2944deb0619e025484ab6a8d25ec3c2c5"},{"executable":false,"path":"src/core/relay/routes.ts","sha256":"0e00c45a87cea0af5faa7e21a681371708e88140659747bd8a068a8dd10eccc8"},{"executable":false,"path":"src/core/relay/state.js","sha256":"f803d955619387306852a2965a75afc26804a982309dd04c9564e5ae31d638d2"},{"executable":false,"path":"src/core/relay/worker.js","sha256":"4176ad91872f36f7ea6565d9f30d23d9d7a80ef27d7af975af760457132ba148"},{"executable":false,"path":"src/core/store.js","sha256":"caefeeebf686cecd37ef19585ef0a5d3acba9dbf1564fe128c3afe4de067305c"},{"executable":false,"path":"src/core/transcript.js","sha256":"0355f0978d2d126b90858e3f661130243fc4730ee81ba13080af1dfa39d8b081"},{"executable":false,"path":"src/core/url-policy.js","sha256":"62bf6d3c8af1f5840d5e2d682d8f2e52fcbfbee6695728b47ed31816f1736089"},{"executable":false,"path":"src/gbot-install.ts","sha256":"e3c833d7662610e70e65232e541017229fb9a049eacee0bdf31e2c33c6ab7189"},{"executable":false,"path":"src/gbot.ts","sha256":"c89a37b764956ceacb2917a991a6d82d987ed8d8e453c8d553485bbd7f3edcc0"},{"executable":false,"path":"src/mcp/grok-bot/tools/codex_send.tsx","sha256":"59d6ecff2d64247013d78e38372601591c083816ff6475dfa31d77b7d3ad29ca"},{"executable":false,"path":"src/mcp/grok-bot/tools/codex_threads.tsx","sha256":"7f1377fcb0cc14c43b47584094350596e77dcddaf835975e42b7caa7d2739bdd"},{"executable":false,"path":"src/mcp/grok-bot/tools/codex_wait.tsx","sha256":"fe1601ba242c82bdc34963caea4eb8aa7c9a9bc1fbb14ea16622a502674cf102"},{"executable":false,"path":"src/mcp/grok-bot/tools/codex_watch.tsx","sha256":"1471575be5e16426e6386ce14dbbc7950717056ae51e75d985e2f79cb4de0e17"},{"executable":false,"path":"src/mcp/grok-bot/tools/gbot_bridge_start.tsx","sha256":"c75c5c8a30ec43709a4d32baa8c3bc9796595381bb04fd2499ca30cd515c5a0b"},{"executable":false,"path":"src/mcp/grok-bot/tools/gbot_bridge_status.tsx","sha256":"486ce643b35cfa2eabf78f0deeabce7198adc66133669eec630e1d12206ad642"},{"executable":false,"path":"src/mcp/grok-bot/tools/gbot_bridge_stop.tsx","sha256":"371428a6e4b4e1312dd95d9681c29e765aec55e65d80d7c474535df838a43457"},{"executable":false,"path":"src/mcp/grok-bot/tools/gbot_codex_respond.tsx","sha256":"030e9c2081ed4ed40732b098c929022af3083f609f10934b35e1f428d33ae637"},{"executable":false,"path":"src/mcp/grok-bot/tools/gbot_grok_approvals.tsx","sha256":"17f164acdc48d6bc79a4c5044c7082760dd2a1646e5b56f6bff54c53fed96451"},{"executable":false,"path":"src/mcp/grok-bot/tools/gbot_grok_respond.tsx","sha256":"41964bb8cf0eb0f8493afa1dde16cd94c4f589d1a7e410577d1ed63ec4648542"},{"executable":false,"path":"src/mcp/grok-bot/tools/gbot_send.tsx","sha256":"2101d279a0e6bda2d57ba3da5366411df460a95692d4e64a1096880a89121d9a"},{"executable":false,"path":"src/mcp/grok-bot/tools/gbot_thread.tsx","sha256":"ef4aefec7243efaad18335e8508c7c17af0cd9b0f8a4b3693a7af9f666807fd6"},{"executable":false,"path":"src/scripts/gbot-relay.ts","sha256":"6690e316189ed8ebba43ea67a495338c927e4c0c21a9f896b7b2fecc8c6eb656"},{"executable":false,"path":"src/skills/talk-to-grok-bot/SKILL.md","sha256":"c671dd4a6bc29defa919fffeacf105420000e287ee727217c4baea968b3834a7"},{"executable":false,"path":"test/app-session.test.js","sha256":"0756b691703dd8c84bf0823f2afab16c6b158398e4ce6be229db6f459a0bbdb1"},{"executable":false,"path":"test/codex-bridge.test.js","sha256":"4ca47489c5794390c97d286ead62c2465abaa7125b16b924bff6e9e68a3e6a46"},{"executable":false,"path":"test/codex-contract.test.js","sha256":"926c7609679d8b6ac3b568d56ba5efa20df86d016a9031f085d19adbfb0e9064"},{"executable":false,"path":"test/codex-conversation.test.js","sha256":"c11559a8c0206982d506bcb018f9421085b8fb17ed82a6b255faf276a30f3a69"},{"executable":false,"path":"test/codex-session.test.js","sha256":"b39fe6afe0784b16e37b208089279dea01095d33e06ae26a1b60871796c7738a"},{"executable":false,"path":"test/codex-surfaces.test.js","sha256":"56d1b6550cc69d462a05e892cf82aa6a41495857b753215104e03207db514c81"},{"executable":false,"path":"test/connect-gateway.test.js","sha256":"5fabd87640b39e75c218300ca6be278268f248f3ff75e8cb72f9fade9eb0f7f3"},{"executable":false,"path":"test/desktop-shim.test.js","sha256":"89fb6c38a5fca5d41a96434cf9e8d51ae1d9992cf4f7930df0cc5840ef985705"},{"executable":false,"path":"test/doctor.test.js","sha256":"9685885df9e7363d3e077d246b1a17803c8899e9613b4a4d52ee4b9275e20694"},{"executable":false,"path":"test/gateway-groups.test.js","sha256":"14e227453e3e28c7cb60f91dba55733834c023ce9a914e40e22c68c899512bdc"},{"executable":false,"path":"test/gateway-send.test.js","sha256":"d059166153dde975f457e4e8c32ea08b0fc857b58fd48eab7da1959638e4fb05"},{"executable":false,"path":"test/gateway-skills.test.js","sha256":"feed62a884d1b7d12e358a27d73fb5587bcf761d4867ab1755d8bc34a4380069"},{"executable":false,"path":"test/gateway.test.js","sha256":"e5a7acd7ae347c82ef1e2a6000562767168e56d6f9d86aca8da46141731d1309"},{"executable":false,"path":"test/grok-approvals.test.js","sha256":"5ad4c548060a08dbe57949ab5ae240383fdb1709cd3694a909f5e1354fee3f73"},{"executable":false,"path":"test/helpers/codex-server.js","sha256":"432b4570601e94cf08c4861133d328404a97066642edb7ec0dbc314411a4d848"},{"executable":false,"path":"test/history.test.js","sha256":"eac4811f1b12d427df66996f33dd46bc3cbe31fc9fa030b3f32c571d5379f8dd"},{"executable":false,"path":"test/host-tool-inventory.test.js","sha256":"ce09bec4efcfac6860ab9defc5f32590c70ed81b664b1ba5346c167259b2be9e"},{"executable":false,"path":"test/pr69-integration.test.js","sha256":"a5dc99c11e2d3fcf18233c595f9c28301e5939f4b3657125eb3f970df2598840"},{"executable":false,"path":"test/relay-auth-recovery.test.js","sha256":"399c064f550fe33e166187a51da527728a97946d213377c8fcc8231378f5bbab"},{"executable":false,"path":"test/relay-codex.test.js","sha256":"43cb313e748e187f798a8a0bce5a01cce9ba360a52985b05ecededee9ad10581"},{"executable":false,"path":"test/relay-completion.test.js","sha256":"a8cc2402f82ce4b458074eafd32c8fa18f7ced7d85fdb6b7fa68f7b18b6a8c2e"},{"executable":false,"path":"test/relay-engine.test.js","sha256":"a3e7e4a63ec82014eec83b91d003ac89295d1f0ac3807bcf39071e4334bf2680"},{"executable":false,"path":"test/relay-gateway-lifecycle.test.js","sha256":"e16e7a34f7b6bb07965003e3018aa3a43ff192602db1c177bec9b6268fddb78b"},{"executable":false,"path":"test/relay-interactions.test.js","sha256":"83d70b1a813923fc6bae02b18d328107d0d04a6a761ab73b2051e3d114c7eaa5"},{"executable":false,"path":"test/relay-lifecycle.test.js","sha256":"e90130e1f609839bfd3f74c3edc333a22f37fe20dcde0146daa8d497133da4b7"},{"executable":false,"path":"test/relay-state.test.js","sha256":"c9143d5fa150b1ebcef9d515e161e25af3370b71eaf800a7b2bb1da1678b0bd3"},{"executable":false,"path":"test/relay-surfaces.test.js","sha256":"ba17ac4f1ffc02d4e06cd73eda143422a3d4d2f750630af9ed4e828dc9d7d2be"},{"executable":false,"path":"test/relay-worker.test.js","sha256":"6bd1bdaaaae59997132f289f822b6c4b8c9616c268fb2b45861e03f697c08197"},{"executable":false,"path":"test/release-config.test.js","sha256":"f3078277086d722f21d07e4134e10b89d2e849a94a0fa40f30025a5cb6fa6a15"},{"executable":false,"path":"test/store.test.js","sha256":"5d4ae4295287539ef4b7f98d0ca0cd42a931a3c7b25b092fbd2b8f1a08ca4bac"},{"executable":false,"path":"test/test-runner.test.js","sha256":"966ff3b67edb8e1f03b50120d4d820ab0f871121e9b359609e73faae8446454f"},{"executable":false,"path":"test/transcript.test.js","sha256":"28795d9cc8e42653ac430d18e17ff1e6bc2feb1b7935fe5c69b336d58e1793ae"},{"executable":false,"path":"test/url-policy.test.js","sha256":"dacfe322e0cbff178c0d67a5f76b6bd8d9fef14aa57c09c697eb69fa0019629c"},{"executable":false,"path":"tests/route-unit/tools.test.ts","sha256":"942349e51cc56dac903625be3b43b3a54f3b2b7e25410b0e56ebd3f185e93549"},{"executable":false,"path":"tsconfig.json","sha256":"fa2ced6d1721e8280a6aed615717cffcef25f6e2d16e15889b2be2a9df4fc226"}]},"provenance":[{"path":".agents/plugins/marketplace.json","sourceInputs":["agent-bundle.config.ts"]},{"path":".claude-plugin/marketplace.json","sourceInputs":["agent-bundle.config.ts","package.json"]},{"path":".claude-plugin/plugin.json","sourceInputs":["agent-bundle.config.ts","src/mcp/grok-bot/tools/codex_send.tsx","src/skills/talk-to-grok-bot/SKILL.md"]},{"path":".codex-plugin/mcp.json","sourceInputs":["agent-bundle.config.ts","src/mcp/grok-bot/tools/codex_send.tsx"]},{"path":".codex-plugin/plugin.json","sourceInputs":["agent-bundle.config.ts","package.json","src/mcp/grok-bot/tools/codex_send.tsx","src/skills/talk-to-grok-bot/SKILL.md"]},{"path":".cursor-plugin/marketplace.json","sourceInputs":["agent-bundle.config.ts"]},{"path":".cursor-plugin/mcp.json","sourceInputs":["agent-bundle.config.ts","src/mcp/grok-bot/tools/codex_send.tsx"]},{"path":".cursor-plugin/plugin.json","sourceInputs":["agent-bundle.config.ts","package.json","src/mcp/grok-bot/tools/codex_send.tsx","src/skills/talk-to-grok-bot/SKILL.md"]},{"path":".mcp.json","sourceInputs":["agent-bundle.config.ts","src/mcp/grok-bot/tools/codex_send.tsx"]},{"path":"agent-bundle.compile-evidence.json","sourceInputs":["agent-bundle.config.ts"]},{"path":"bin/gbot-flight.mjs","sourceInputs":["agent-bundle.config.ts","package.json","src/cli/_shared.ts","src/cli/approvals/list.tsx","src/cli/approvals/respond.tsx","src/cli/bots/create.tsx","src/cli/bots/delete.tsx","src/cli/bots/get.tsx","src/cli/bots/list.tsx","src/cli/bots/update.tsx","src/cli/codex/bridge/respond.tsx","src/cli/codex/bridge/run.tsx","src/cli/codex/bridge/start.tsx","src/cli/codex/bridge/status.tsx","src/cli/codex/bridge/stop.tsx","src/cli/codex/desktop-shim.tsx","src/cli/codex/list-threads.tsx","src/cli/codex/queue.tsx","src/cli/codex/send.tsx","src/cli/codex/status.tsx","src/cli/codex/wait.tsx","src/cli/codex/watch.tsx","src/cli/doctor.tsx","src/cli/groups/add.tsx","src/cli/groups/create.tsx","src/cli/groups/delete.tsx","src/cli/groups/get.tsx","src/cli/groups/list.tsx","src/cli/groups/members.tsx","src/cli/groups/remove.tsx","src/cli/groups/set.tsx","src/cli/groups/update.tsx","src/cli/history.tsx","src/cli/send.tsx","src/cli/skills/add.tsx","src/cli/skills/list.tsx","src/cli/skills/remove.tsx","src/cli/thread.tsx","src/core/app-session.js","src/core/codex-bridge.js","src/core/codex/contract.js","src/core/codex/conversation.js","src/core/codex/routes.ts","src/core/commands.js","src/core/desktop-shim-bridge.js","src/core/desktop-shim.js","src/core/format.js","src/core/gateway.js","src/core/grok-approval-routes.ts","src/core/grok-approvals.js","src/core/headers.js","src/core/history.js","src/core/relay/control.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/relay/routes.ts","src/core/store.js","src/core/transcript.js","src/core/url-policy.js","src/gbot.ts"]},{"path":"bin/gbot.mjs","sourceInputs":["agent-bundle.config.ts","package.json","src/cli/_shared.ts","src/cli/approvals/list.tsx","src/cli/approvals/respond.tsx","src/cli/bots/create.tsx","src/cli/bots/delete.tsx","src/cli/bots/get.tsx","src/cli/bots/list.tsx","src/cli/bots/update.tsx","src/cli/codex/bridge/respond.tsx","src/cli/codex/bridge/run.tsx","src/cli/codex/bridge/start.tsx","src/cli/codex/bridge/status.tsx","src/cli/codex/bridge/stop.tsx","src/cli/codex/desktop-shim.tsx","src/cli/codex/list-threads.tsx","src/cli/codex/queue.tsx","src/cli/codex/send.tsx","src/cli/codex/status.tsx","src/cli/codex/wait.tsx","src/cli/codex/watch.tsx","src/cli/doctor.tsx","src/cli/groups/add.tsx","src/cli/groups/create.tsx","src/cli/groups/delete.tsx","src/cli/groups/get.tsx","src/cli/groups/list.tsx","src/cli/groups/members.tsx","src/cli/groups/remove.tsx","src/cli/groups/set.tsx","src/cli/groups/update.tsx","src/cli/history.tsx","src/cli/send.tsx","src/cli/skills/add.tsx","src/cli/skills/list.tsx","src/cli/skills/remove.tsx","src/cli/thread.tsx","src/core/app-session.js","src/core/codex-bridge.js","src/core/codex/contract.js","src/core/codex/conversation.js","src/core/codex/routes.ts","src/core/commands.js","src/core/desktop-shim-bridge.js","src/core/desktop-shim.js","src/core/format.js","src/core/gateway.js","src/core/grok-approval-routes.ts","src/core/grok-approvals.js","src/core/headers.js","src/core/history.js","src/core/relay/control.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/relay/routes.ts","src/core/store.js","src/core/transcript.js","src/core/url-policy.js","src/gbot.ts"]},{"path":"INSTALL.md","sourceInputs":["agent-bundle.config.ts"]},{"path":"install.mjs","sourceInputs":["agent-bundle.config.ts"]},{"path":"mcp.json","sourceInputs":["src/mcp/grok-bot/tools/codex_send.tsx"]},{"path":"mcp/mcp-grok-bot-b8c2461e-flight.mjs","sourceInputs":["package.json","src/core/app-session.js","src/core/codex-bridge.js","src/core/codex/contract.js","src/core/codex/conversation.js","src/core/codex/routes.ts","src/core/desktop-shim-bridge.js","src/core/desktop-shim.js","src/core/gateway.js","src/core/grok-approval-routes.ts","src/core/grok-approvals.js","src/core/headers.js","src/core/relay/control.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/relay/routes.ts","src/core/store.js","src/core/transcript.js","src/core/url-policy.js","src/gbot.ts","src/mcp/grok-bot/tools/codex_send.tsx","src/mcp/grok-bot/tools/codex_threads.tsx","src/mcp/grok-bot/tools/codex_wait.tsx","src/mcp/grok-bot/tools/codex_watch.tsx","src/mcp/grok-bot/tools/gbot_bridge_start.tsx","src/mcp/grok-bot/tools/gbot_bridge_status.tsx","src/mcp/grok-bot/tools/gbot_bridge_stop.tsx","src/mcp/grok-bot/tools/gbot_codex_respond.tsx","src/mcp/grok-bot/tools/gbot_grok_approvals.tsx","src/mcp/grok-bot/tools/gbot_grok_respond.tsx","src/mcp/grok-bot/tools/gbot_send.tsx","src/mcp/grok-bot/tools/gbot_thread.tsx"]},{"path":"mcp/mcp-grok-bot-b8c2461e.mjs","sourceInputs":["package.json","src/core/app-session.js","src/core/codex-bridge.js","src/core/codex/contract.js","src/core/codex/conversation.js","src/core/codex/routes.ts","src/core/desktop-shim-bridge.js","src/core/desktop-shim.js","src/core/gateway.js","src/core/grok-approval-routes.ts","src/core/grok-approvals.js","src/core/headers.js","src/core/relay/control.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/relay/routes.ts","src/core/store.js","src/core/transcript.js","src/core/url-policy.js","src/gbot.ts","src/mcp/grok-bot/tools/codex_send.tsx","src/mcp/grok-bot/tools/codex_threads.tsx","src/mcp/grok-bot/tools/codex_wait.tsx","src/mcp/grok-bot/tools/codex_watch.tsx","src/mcp/grok-bot/tools/gbot_bridge_start.tsx","src/mcp/grok-bot/tools/gbot_bridge_status.tsx","src/mcp/grok-bot/tools/gbot_bridge_stop.tsx","src/mcp/grok-bot/tools/gbot_codex_respond.tsx","src/mcp/grok-bot/tools/gbot_grok_approvals.tsx","src/mcp/grok-bot/tools/gbot_grok_respond.tsx","src/mcp/grok-bot/tools/gbot_send.tsx","src/mcp/grok-bot/tools/gbot_thread.tsx"]},{"path":"plugin.json","sourceInputs":["agent-bundle.config.ts","package.json"]},{"path":"scripts/gbot-relay.mjs","sourceInputs":["package.json","src/core/app-session.js","src/core/codex-bridge.js","src/core/codex/contract.js","src/core/codex/conversation.js","src/core/desktop-shim-bridge.js","src/core/desktop-shim.js","src/core/gateway.js","src/core/grok-approvals.js","src/core/headers.js","src/core/relay/codex.js","src/core/relay/completion.js","src/core/relay/control.js","src/core/relay/engine.js","src/core/relay/intake.js","src/core/relay/interactions.js","src/core/relay/ownership.js","src/core/relay/profile.js","src/core/relay/records.js","src/core/relay/state.js","src/core/relay/worker.js","src/core/store.js","src/core/transcript.js","src/core/url-policy.js","src/scripts/gbot-relay.ts"]},{"path":"skills/talk-to-grok-bot/SKILL.md","sourceInputs":["src/skills/talk-to-grok-bot/SKILL.md"]}],"recordVersion":1,"validation":{"artifact":{"status":"passed"},"projections":[{"host":"claude","status":"passed"},{"host":"codex","status":"passed"},{"host":"cursor","status":"passed"},{"host":"portable","status":"passed"}],"source":{"status":"passed"}}},"distribution":{"channels":["local","npm"],"install":{"instructions":"INSTALL.md","script":"install.mjs"},"payloads":[]},"executables":{"bins":[{"hosts":["claude","codex","cursor","portable"],"name":"gbot","path":"bin/gbot.mjs","worker":"bin/gbot-flight.mjs"}],"hooks":[],"mcpServers":[{"apps":[],"hosts":["claude","codex","cursor","portable"],"id":"mcp:grok-bot","kind":"compiled","launch":{"args":[],"entry":"mcp/mcp-grok-bot-b8c2461e.mjs","env":{},"worker":"mcp/mcp-grok-bot-b8c2461e-flight.mjs"},"name":"grok-bot","transport":"stdio"}],"scripts":[{"hosts":["claude","codex","cursor","portable"],"id":"script:gbot-relay","mode":"bundle","name":"gbot-relay","path":"scripts/gbot-relay.mjs"}]},"files":[{"bytes":225,"kind":"generated","path":".agents/plugins/marketplace.json","sha256":"54d575719e003eb71ba2d7fb7379e12098243e701646e0ca83dba38ef2a78b1d"},{"bytes":729,"kind":"generated","path":".claude-plugin/marketplace.json","sha256":"c34ad145efb7252e387cb66825a2c7f28b71ec1199cc21b7a62e68f5eaf00c33"},{"bytes":199,"kind":"generated","path":".claude-plugin/plugin.json","sha256":"9f3c3ac18c027af51dec5571612a8cc1d77f4b590c216111be7ebb0a0395fce1"},{"bytes":156,"kind":"generated","path":".codex-plugin/mcp.json","sha256":"4b442017d0d30ec207cef7a4e5d2cd9dca246080008633459a27e3a5f2f7935b"},{"bytes":1015,"kind":"generated","path":".codex-plugin/plugin.json","sha256":"7089ffedb7a06970382f659207146f601723d412a0dcf81981d047557e0e04ec"},{"bytes":234,"kind":"generated","path":".cursor-plugin/marketplace.json","sha256":"c7f1a63855c76dd4680fa34c81b7e1170bb47be9bf1399dc8583b2d2d89eb9a0"},{"bytes":169,"kind":"generated","path":".cursor-plugin/mcp.json","sha256":"95c87d0f2ed3a4f6df7d0e519454b1234672eca030db3b8cd8776ef0f35dee74"},{"bytes":551,"kind":"generated","path":".cursor-plugin/plugin.json","sha256":"94693dbd9ecc58995dbb3581f8e5edfd62ea2db0e15ae49711775b4cf20f0338"},{"bytes":184,"kind":"generated","path":".mcp.json","sha256":"2539f66ffcb1c98a365f078c63122a1c25b7c7625f91314467843bde7628907b"},{"bytes":19841,"kind":"generated","path":"agent-bundle.compile-evidence.json","sha256":"36d1fe1f40b7e837cb7bc805c47014afd918f838a54931995f4d33516ad5f714"},{"bytes":1300907,"kind":"bundle","path":"bin/gbot-flight.mjs","sha256":"814c0708905947e1d703498c2d36b554eff6753ca74da23122845b61182301fd"},{"bytes":3162304,"kind":"bundle","mode":493,"path":"bin/gbot.mjs","sha256":"af6f18e83e884b1edd5d4c8290838f46908d239d22bf86927de7376ec88f5f2f"},{"bytes":22341,"kind":"generated","path":"INSTALL.md","sha256":"87d945aba4d2267bdd1e79be12c4c87842feb07e3cd394f69cb8ffa663b65632"},{"bytes":84117,"kind":"generated","path":"install.mjs","sha256":"761805b045027f6b226d1f91c5cb4229f6b20323d82f3f2c391490e09f8b8f53"},{"bytes":246,"kind":"generated","path":"mcp.json","sha256":"c06a01fa851792f42e0cc807a444e454c3ea2fd164dc1c2adef455acc93879e2"},{"bytes":1201808,"kind":"bundle","path":"mcp/mcp-grok-bot-b8c2461e-flight.mjs","sha256":"8e1f5447c6aa03da02c6cc1dcfea6ede06e0a7ac5d2196fe1d52d4ed5970e9dd"},{"bytes":4056758,"kind":"bundle","path":"mcp/mcp-grok-bot-b8c2461e.mjs","sha256":"db4bab649091f44a29bf1bfb55e2ef15a68ab80a18ed993415f89f1d51977bd7"},{"bytes":582,"kind":"generated","path":"plugin.json","sha256":"b623c1b69dd4674341091a90c634656f1460d08b0f051668f35c92232f89cbc0"},{"bytes":2108374,"kind":"bundle","path":"scripts/gbot-relay.mjs","sha256":"ca34a124ea75ee0e4fbff64fa4bd907865335cb303526c070bd29ad1048dfb1e"},{"bytes":7468,"kind":"copy","path":"skills/talk-to-grok-bot/SKILL.md","sha256":"c671dd4a6bc29defa919fffeacf105420000e287ee727217c4baea968b3834a7"}],"manifestVersion":6,"projections":[{"builtInHost":"claude","documents":{"marketplace":".claude-plugin/marketplace.json","mcp":".mcp.json","plugin":".claude-plugin/plugin.json"},"host":"claude","marketplace":{"name":"gbot-marketplace"}},{"builtInHost":"codex","documents":{"marketplace":".agents/plugins/marketplace.json","mcp":".codex-plugin/mcp.json","plugin":".codex-plugin/plugin.json"},"host":"codex","marketplace":{"name":"gbot-marketplace"}},{"builtInHost":"cursor","documents":{"marketplace":".cursor-plugin/marketplace.json","mcp":".cursor-plugin/mcp.json","plugin":".cursor-plugin/plugin.json"},"host":"cursor","marketplace":{"name":"gbot-marketplace"}},{"builtInHost":"portable","documents":{"mcp":"mcp.json","plugin":"plugin.json"},"host":"portable"}],"routes":{"cli":{"commands":[{"aliases":[],"description":"List current Grok approval cards (latest 200 entries).","exitCode":"zero","options":[{"key":"target","kind":"string","option":"target","positional":0,"repeated":false,"required":true}],"path":["approvals","list"],"routeId":"cli:approvals/list"},{"aliases":[],"description":"Explicit user decision: accept a Grok request once or decline; never grant persistent permissions.","exitCode":"zero","options":[{"choices":["accept","decline"],"key":"decision","kind":"enum","option":"decision","repeated":false,"required":true},{"key":"entryId","kind":"string","option":"entry-id","repeated":false,"required":true},{"key":"requestId","kind":"string","option":"request-id","repeated":false,"required":true},{"key":"target","kind":"string","option":"target","repeated":false,"required":true}],"path":["approvals","respond"],"routeId":"cli:approvals/respond"},{"aliases":[],"description":"Create a Grok Bot bot.","exitCode":"zero","options":[{"key":"avatarColor","kind":"string","option":"avatar-color","repeated":false,"required":false},{"key":"avatarShape","kind":"string","option":"avatar-shape","repeated":false,"required":false},{"key":"description","kind":"string","option":"description","repeated":false,"required":false},{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"key":"name","kind":"string","option":"name","repeated":false,"required":true},{"key":"title","kind":"string","option":"title","repeated":false,"required":false}],"path":["bots","create"],"routeId":"cli:bots/create"},{"aliases":[],"description":"Delete a bot or group by id or name.","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"description":"Bot or group id or name","key":"ref","kind":"string","option":"ref","positional":0,"repeated":false,"required":true}],"path":["bots","delete"],"routeId":"cli:bots/delete"},{"aliases":[],"description":"Show one bot or group by id or name.","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"description":"Bot or group id or name","key":"ref","kind":"string","option":"ref","positional":0,"repeated":false,"required":true}],"path":["bots","get"],"routeId":"cli:bots/get"},{"aliases":[],"description":"List Grok Bot bots (not groups).","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false}],"path":["bots","list"],"routeId":"cli:bots/list"},{"aliases":[],"description":"Update a bot or group profile.","exitCode":"zero","options":[{"key":"avatarColor","kind":"string","option":"avatar-color","repeated":false,"required":false},{"key":"avatarShape","kind":"string","option":"avatar-shape","repeated":false,"required":false},{"key":"description","kind":"string","option":"description","repeated":false,"required":false},{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"key":"hidden","kind":"string","option":"hidden","repeated":false,"required":false},{"key":"name","kind":"string","option":"name","repeated":false,"required":false},{"key":"notify","kind":"string","option":"notify","repeated":false,"required":false},{"description":"Bot or group id or name","key":"ref","kind":"string","option":"ref","positional":0,"repeated":false,"required":true},{"key":"title","kind":"string","option":"title","repeated":false,"required":false}],"path":["bots","update"],"routeId":"cli:bots/update"},{"aliases":[],"description":"Managed Grok/Codex bridge respond.","exitCode":"result","options":[{"description":"JSON object mapping each advertised question ID to {\"answers\":[\"answer\"]}; exact IDs required.","key":"answersJson","kind":"string","option":"answers-json","repeated":false,"required":false},{"key":"bindingId","kind":"string","option":"binding-id","repeated":false,"required":false},{"choices":["accept","decline","cancel"],"key":"decision","kind":"enum","option":"decision","repeated":false,"required":false},{"key":"exchangeId","kind":"string","option":"exchange-id","repeated":false,"required":false},{"key":"generation","kind":"string","option":"generation","repeated":false,"required":true},{"key":"interactionId","kind":"string","option":"interaction-id","repeated":false,"required":true},{"key":"threadId","kind":"string","option":"thread-id","repeated":false,"required":true},{"key":"turnId","kind":"string","option":"turn-id","repeated":false,"required":true}],"path":["codex","bridge","respond"],"routeId":"cli:codex/bridge/respond"},{"aliases":[],"description":"Run a bounded foreground relay (up to 23 hours). Use the packaged gbot-relay.mjs script for unlimited service lifetime.","exitCode":"result","options":[{"description":"Foreground lifetime in milliseconds (100..82800000; default 23h).","key":"lifetimeMs","kind":"number","option":"lifetime-ms","repeated":false,"required":false}],"path":["codex","bridge","run"],"routeId":"cli:codex/bridge/run"},{"aliases":[],"description":"Managed Grok/Codex bridge start.","exitCode":"result","options":[{"choices":["steer","reject"],"key":"busyPolicy","kind":"enum","option":"busy-policy","repeated":false,"required":false},{"key":"codexThreadId","kind":"string","option":"codex-thread-id","repeated":false,"required":false},{"key":"expectedCwd","kind":"string","option":"expected-cwd","repeated":false,"required":false},{"key":"grokTarget","kind":"string","option":"grok-target","positional":0,"repeated":false,"required":true},{"key":"requestId","kind":"string","option":"request-id","repeated":false,"required":false}],"path":["codex","bridge","start"],"routeId":"cli:codex/bridge/start"},{"aliases":[],"description":"Managed Grok/Codex bridge status.","exitCode":"result","options":[{"key":"bindingId","kind":"string","option":"binding-id","repeated":false,"required":false},{"key":"limit","kind":"number","option":"limit","repeated":false,"required":false}],"path":["codex","bridge","status"],"routeId":"cli:codex/bridge/status"},{"aliases":[],"description":"Managed Grok/Codex bridge stop.","exitCode":"result","options":[{"key":"all","kind":"boolean","option":"all","repeated":false,"required":false},{"key":"bindingId","kind":"string","option":"binding-id","repeated":false,"required":false},{"key":"worker","kind":"boolean","option":"worker","repeated":false,"required":false}],"path":["codex","bridge","stop"],"routeId":"cli:codex/bridge/stop"},{"aliases":[],"description":"Install, remove, or check the ChatGPT Desktop shim: a CODEX_CLI_PATH wrapper that bridges Desktop stdio onto the managed Codex daemon (stock app-server proxy hangs). macOS persists via LaunchAgent; always fails open to real Codex.","exitCode":"result","options":[{"choices":["install","uninstall","status"],"description":"install | uninstall | status","key":"action","kind":"enum","option":"action","positional":0,"repeated":false,"required":true}],"path":["codex","desktop-shim"],"routeId":"cli:codex/desktop-shim"},{"aliases":[],"description":"List Codex daemon-managed threads.","exitCode":"result","options":[{"description":"Opaque pagination cursor (may start with -)","key":"cursor","kind":"string","option":"cursor","repeated":false,"required":false},{"description":"Max threads to list (1-200)","key":"limit","kind":"number","option":"limit","repeated":false,"required":false}],"path":["codex","list-threads"],"routeId":"cli:codex/list-threads"},{"aliases":[],"description":"List the experimental Codex thread queue (GROK_BOT_CODEX_EXPERIMENTAL=1).","exitCode":"result","options":[{"key":"threadId","kind":"string","option":"thread-id","positional":0,"repeated":false,"required":true}],"path":["codex","queue"],"routeId":"cli:codex/queue"},{"aliases":[],"description":"Send to Codex; acceptance is distinct from completion. Options precede threadId.","exitCode":"result","options":[{"key":"bindingId","kind":"string","option":"binding-id","repeated":false,"required":false},{"key":"correlationId","kind":"string","option":"correlation-id","repeated":false,"required":false},{"key":"envelope","kind":"boolean","option":"envelope","repeated":false,"required":false},{"key":"expectedCwd","kind":"string","option":"expected-cwd","repeated":false,"required":false},{"description":"Required active-turn guard for steer; stale guards reject.","key":"expectedTurnId","kind":"string","option":"expected-turn-id","repeated":false,"required":false},{"key":"hop","kind":"number","option":"hop","repeated":false,"required":false},{"description":"Reply budget: 1-4194304 bytes.","key":"maxOutputBytes","kind":"number","option":"max-output-bytes","repeated":false,"required":false},{"key":"message","kind":"string","option":"message","positional":1,"repeated":true,"required":true},{"key":"replyTo","kind":"string","option":"reply-to","repeated":false,"required":false},{"key":"replyToGrok","kind":"string","option":"reply-to-grok","repeated":false,"required":false},{"key":"requestId","kind":"string","option":"request-id","repeated":false,"required":false},{"key":"threadId","kind":"string","option":"thread-id","positional":0,"repeated":false,"required":true},{"description":"Observation timeout: 1-600000 milliseconds.","key":"timeoutMs","kind":"number","option":"timeout-ms","repeated":false,"required":false},{"key":"wait","kind":"boolean","option":"wait","repeated":false,"required":false},{"choices":["reject","queue","steer"],"key":"whenBusy","kind":"enum","option":"when-busy","repeated":false,"required":false}],"path":["codex","send"],"routeId":"cli:codex/send"},{"aliases":[],"description":"Probe the local Codex app-server daemon. Exit 0 only when it is usable.","exitCode":"result","options":[],"path":["codex","status"],"routeId":"cli:codex/status"},{"aliases":[],"description":"Bounded Codex wait observation; never interrupts execution.","exitCode":"result","options":[{"key":"expectedCwd","kind":"string","option":"expected-cwd","repeated":false,"required":false},{"description":"Reply budget: 1-4194304 bytes.","key":"maxOutputBytes","kind":"number","option":"max-output-bytes","repeated":false,"required":false},{"key":"messageId","kind":"string","option":"message-id","repeated":false,"required":false},{"key":"threadId","kind":"string","option":"thread-id","positional":0,"repeated":false,"required":true},{"description":"Observation timeout: 1-600000 milliseconds.","key":"timeoutMs","kind":"number","option":"timeout-ms","repeated":false,"required":false},{"key":"turnId","kind":"string","option":"turn-id","positional":1,"repeated":false,"required":true}],"path":["codex","wait"],"routeId":"cli:codex/wait"},{"aliases":[],"description":"Bounded Codex watch observation; never interrupts execution.","exitCode":"result","options":[{"key":"expectedCwd","kind":"string","option":"expected-cwd","repeated":false,"required":false},{"description":"Maximum observed events: 1-500.","key":"maxEvents","kind":"number","option":"max-events","repeated":false,"required":false},{"key":"threadId","kind":"string","option":"thread-id","positional":0,"repeated":false,"required":true},{"description":"Observation timeout: 1-600000 milliseconds.","key":"timeoutMs","kind":"number","option":"timeout-ms","repeated":false,"required":false}],"path":["codex","watch"],"routeId":"cli:codex/watch"},{"aliases":[],"description":"Show which agents root and auth sources gbot can see.","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false}],"path":["doctor"],"routeId":"cli:doctor"},{"aliases":[],"description":"Add a bot to a group.","exitCode":"zero","options":[{"key":"bot","kind":"string","option":"bot","positional":1,"repeated":false,"required":true},{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"key":"group","kind":"string","option":"group","positional":0,"repeated":false,"required":true}],"path":["groups","add"],"routeId":"cli:groups/add"},{"aliases":[],"description":"Create a Grok Bot group.","exitCode":"zero","options":[{"key":"avatarColor","kind":"string","option":"avatar-color","repeated":false,"required":false},{"key":"avatarShape","kind":"string","option":"avatar-shape","repeated":false,"required":false},{"key":"description","kind":"string","option":"description","repeated":false,"required":false},{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"description":"Member bot id or name (repeatable)","key":"member","kind":"string","option":"member","repeated":true,"required":true},{"key":"name","kind":"string","option":"name","repeated":false,"required":true},{"key":"title","kind":"string","option":"title","repeated":false,"required":false}],"path":["groups","create"],"routeId":"cli:groups/create"},{"aliases":[],"description":"Delete a group by id or name.","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"description":"Group id or name","key":"ref","kind":"string","option":"ref","positional":0,"repeated":false,"required":true}],"path":["groups","delete"],"routeId":"cli:groups/delete"},{"aliases":[],"description":"Show one group by id or name.","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"description":"Group id or name","key":"ref","kind":"string","option":"ref","positional":0,"repeated":false,"required":true}],"path":["groups","get"],"routeId":"cli:groups/get"},{"aliases":[],"description":"List Grok Bot groups.","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false}],"path":["groups","list"],"routeId":"cli:groups/list"},{"aliases":[],"description":"Show members of a group (same payload as groups get).","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"description":"Group id or name","key":"ref","kind":"string","option":"ref","positional":0,"repeated":false,"required":true}],"path":["groups","members"],"routeId":"cli:groups/members"},{"aliases":[],"description":"Remove a bot from a group.","exitCode":"zero","options":[{"key":"bot","kind":"string","option":"bot","positional":1,"repeated":false,"required":true},{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"key":"group","kind":"string","option":"group","positional":0,"repeated":false,"required":true}],"path":["groups","remove"],"routeId":"cli:groups/remove"},{"aliases":[],"description":"Replace a group's member list.","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"key":"group","kind":"string","option":"group","positional":0,"repeated":false,"required":true},{"description":"Member bot id or name (repeatable)","key":"member","kind":"string","option":"member","repeated":true,"required":true}],"path":["groups","set"],"routeId":"cli:groups/set"},{"aliases":[],"description":"Update a group profile (members stay on set/add/remove).","exitCode":"zero","options":[{"key":"avatarColor","kind":"string","option":"avatar-color","repeated":false,"required":false},{"key":"avatarShape","kind":"string","option":"avatar-shape","repeated":false,"required":false},{"key":"description","kind":"string","option":"description","repeated":false,"required":false},{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"key":"hidden","kind":"string","option":"hidden","repeated":false,"required":false},{"key":"name","kind":"string","option":"name","repeated":false,"required":false},{"key":"notify","kind":"string","option":"notify","repeated":false,"required":false},{"description":"Group id or name","key":"ref","kind":"string","option":"ref","positional":0,"repeated":false,"required":true},{"key":"title","kind":"string","option":"title","repeated":false,"required":false}],"path":["groups","update"],"routeId":"cli:groups/update"},{"aliases":[],"description":"Read the opt-in local JSONL history without contacting the gateway.","exitCode":"zero","options":[{"description":"Directory containing history.jsonl","key":"historyDir","kind":"string","option":"history-dir","repeated":false,"required":false},{"description":"Maximum matching rows (1 or more)","key":"limit","kind":"number","option":"limit","repeated":false,"required":false},{"description":"Print the history file path","key":"path","kind":"boolean","option":"path","repeated":false,"required":false},{"description":"Bot or group id or name","key":"ref","kind":"string","option":"ref","positional":0,"repeated":false,"required":false},{"description":"Case-insensitive message text filter","key":"search","kind":"string","option":"search","repeated":false,"required":false}],"path":["history"],"routeId":"cli:history"},{"aliases":[],"description":"Send a message to a Grok Bot bot or group by name or id.","exitCode":"result","options":[{"key":"bindingId","kind":"string","option":"binding-id","repeated":false,"required":false},{"key":"codexThreadId","kind":"string","option":"codex-thread-id","repeated":false,"required":false},{"description":"Stable correlation id for multi-hop replies","key":"correlationId","kind":"string","option":"correlation-id","repeated":false,"required":false},{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Prepend the [gbot …] header","key":"envelope","kind":"boolean","option":"envelope","repeated":false,"required":false},{"key":"expectedCwd","kind":"string","option":"expected-cwd","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"description":"Directory containing history.jsonl","key":"historyDir","kind":"string","option":"history-dir","repeated":false,"required":false},{"description":"Hop count; refused at GROK_BOT_MAX_HOPS","key":"hop","kind":"number","option":"hop","repeated":false,"required":false},{"key":"message","kind":"string","option":"message","positional":1,"repeated":true,"required":true},{"description":"Skip local history for this command","key":"noHistory","kind":"boolean","option":"no-history","repeated":false,"required":false},{"choices":["auto","manual"],"key":"replyMode","kind":"enum","option":"reply-mode","repeated":false,"required":false},{"description":"Prior message id this send replies to","key":"replyTo","kind":"string","option":"reply-to","repeated":false,"required":false},{"key":"requestId","kind":"string","option":"request-id","repeated":false,"required":false},{"key":"target","kind":"string","option":"target","positional":0,"repeated":false,"required":true}],"path":["send"],"routeId":"cli:send"},{"aliases":[],"description":"Add a SKILL.md to the shared skill library. Every bot sees it.","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"description":"SKILL.md file, or a directory holding one","key":"path","kind":"string","option":"path","positional":0,"repeated":false,"required":true}],"path":["skills","add"],"routeId":"cli:skills/add"},{"aliases":[],"description":"List the skill library every bot in this Grok Bot shares.","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false}],"path":["skills","list"],"routeId":"cli:skills/list"},{"aliases":[],"description":"Remove a library skill by id or name. Every bot loses it.","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"description":"Skill id or name","key":"skill","kind":"string","option":"skill","positional":0,"repeated":false,"required":true}],"path":["skills","remove"],"routeId":"cli:skills/remove"},{"aliases":[],"description":"Read the most recent messages in a Grok Bot bot or group thread.","exitCode":"zero","options":[{"description":"Return entries after this opaque entry id","key":"after","kind":"string","option":"after","repeated":false,"required":false},{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Show full entry text in human output","key":"full","kind":"boolean","option":"full","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"description":"Directory containing history.jsonl","key":"historyDir","kind":"string","option":"history-dir","repeated":false,"required":false},{"description":"How many trailing entries to return (1-200)","key":"limit","kind":"number","option":"limit","repeated":false,"required":false},{"description":"Skip local history for this command","key":"noHistory","kind":"boolean","option":"no-history","repeated":false,"required":false},{"description":"Read one rooted thread by message id","key":"root","kind":"string","option":"root","repeated":false,"required":false},{"key":"target","kind":"string","option":"target","positional":0,"repeated":false,"required":true}],"path":["thread"],"routeId":"cli:thread"}],"mode":"generated","routes":[{"contract":"contract:src/cli/approvals/list.tsx#inputJsonSchema","description":"List current Grok approval cards (latest 200 entries).","id":"cli:approvals/list","inputSchema":{"additionalProperties":false,"properties":{"target":{"type":"string"}},"required":["target"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/approvals/list.tsx"},{"contract":"contract:src/cli/approvals/respond.tsx#inputJsonSchema","description":"Explicit user decision: accept a Grok request once or decline; never grant persistent permissions.","id":"cli:approvals/respond","inputSchema":{"additionalProperties":false,"properties":{"decision":{"enum":["accept","decline"],"type":"string"},"entryId":{"type":"string"},"requestId":{"type":"string"},"target":{"type":"string"}},"required":["target","entryId","requestId","decision"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/approvals/respond.tsx"},{"contract":"contract:src/cli/bots/create.tsx#inputJsonSchema","description":"Create a Grok Bot bot.","id":"cli:bots/create","inputSchema":{"additionalProperties":false,"properties":{"avatarColor":{"type":"string"},"avatarShape":{"type":"string"},"description":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"name":{"type":"string"},"title":{"type":"string"}},"required":["name"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/bots/create.tsx"},{"contract":"contract:src/cli/bots/delete.tsx#inputJsonSchema","description":"Delete a bot or group by id or name.","id":"cli:bots/delete","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"ref":{"description":"Bot or group id or name","type":"string"}},"required":["ref"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/bots/delete.tsx"},{"contract":"contract:src/cli/bots/get.tsx#inputJsonSchema","description":"Show one bot or group by id or name.","id":"cli:bots/get","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"ref":{"description":"Bot or group id or name","type":"string"}},"required":["ref"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/bots/get.tsx"},{"contract":"contract:src/cli/bots/list.tsx#inputJsonSchema","description":"List Grok Bot bots (not groups).","id":"cli:bots/list","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"}},"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/bots/list.tsx"},{"contract":"contract:src/cli/bots/update.tsx#inputJsonSchema","description":"Update a bot or group profile.","id":"cli:bots/update","inputSchema":{"additionalProperties":false,"properties":{"avatarColor":{"type":"string"},"avatarShape":{"type":"string"},"description":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"hidden":{"type":"string"},"name":{"type":"string"},"notify":{"type":"string"},"ref":{"description":"Bot or group id or name","type":"string"},"title":{"type":"string"}},"required":["ref"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/bots/update.tsx"},{"contract":"contract:src/cli/codex/bridge/respond.tsx#inputJsonSchema","description":"Managed Grok/Codex bridge respond.","id":"cli:codex/bridge/respond","inputSchema":{"additionalProperties":false,"properties":{"answersJson":{"description":"JSON object mapping each advertised question ID to {\"answers\":[\"answer\"]}; exact IDs required.","type":"string"},"bindingId":{"type":"string"},"decision":{"enum":["accept","decline","cancel"],"type":"string"},"exchangeId":{"type":"string"},"generation":{"type":"string"},"interactionId":{"type":"string"},"threadId":{"type":"string"},"turnId":{"type":"string"}},"required":["interactionId","generation","threadId","turnId"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/bridge/respond.tsx"},{"contract":"contract:src/cli/codex/bridge/run.tsx#inputJsonSchema","description":"Run a bounded foreground relay (up to 23 hours). Use the packaged gbot-relay.mjs script for unlimited service lifetime.","id":"cli:codex/bridge/run","inputSchema":{"additionalProperties":false,"properties":{"lifetimeMs":{"description":"Foreground lifetime in milliseconds (100..82800000; default 23h).","type":"number"}},"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/bridge/run.tsx"},{"contract":"contract:src/cli/codex/bridge/start.tsx#inputJsonSchema","description":"Managed Grok/Codex bridge start.","id":"cli:codex/bridge/start","inputSchema":{"additionalProperties":false,"properties":{"busyPolicy":{"enum":["steer","reject"],"type":"string"},"codexThreadId":{"type":"string"},"expectedCwd":{"type":"string"},"grokTarget":{"type":"string"},"requestId":{"type":"string"}},"required":["grokTarget"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/bridge/start.tsx"},{"contract":"contract:src/cli/codex/bridge/status.tsx#inputJsonSchema","description":"Managed Grok/Codex bridge status.","id":"cli:codex/bridge/status","inputSchema":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"limit":{"type":"number"}},"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/bridge/status.tsx"},{"contract":"contract:src/cli/codex/bridge/stop.tsx#inputJsonSchema","description":"Managed Grok/Codex bridge stop.","id":"cli:codex/bridge/stop","inputSchema":{"additionalProperties":false,"properties":{"all":{"type":"boolean"},"bindingId":{"type":"string"},"worker":{"type":"boolean"}},"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/bridge/stop.tsx"},{"contract":"contract:src/cli/codex/desktop-shim.tsx#inputJsonSchema","description":"Install, remove, or check the ChatGPT Desktop shim: a CODEX_CLI_PATH wrapper that bridges Desktop stdio onto the managed Codex daemon (stock app-server proxy hangs). macOS persists via LaunchAgent; always fails open to real Codex.","id":"cli:codex/desktop-shim","inputSchema":{"additionalProperties":false,"properties":{"action":{"description":"install | uninstall | status","enum":["install","uninstall","status"],"type":"string"}},"required":["action"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/desktop-shim.tsx"},{"contract":"contract:src/cli/codex/list-threads.tsx#inputJsonSchema","description":"List Codex daemon-managed threads.","id":"cli:codex/list-threads","inputSchema":{"additionalProperties":false,"properties":{"cursor":{"description":"Opaque pagination cursor (may start with -)","type":"string"},"limit":{"default":20,"description":"Max threads to list (1-200)","type":"number"}},"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/list-threads.tsx"},{"contract":"contract:src/cli/codex/queue.tsx#inputJsonSchema","description":"List the experimental Codex thread queue (GROK_BOT_CODEX_EXPERIMENTAL=1).","id":"cli:codex/queue","inputSchema":{"additionalProperties":false,"properties":{"threadId":{"type":"string"}},"required":["threadId"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/queue.tsx"},{"contract":"contract:src/cli/codex/send.tsx#inputJsonSchema","description":"Send to Codex; acceptance is distinct from completion. Options precede threadId.","id":"cli:codex/send","inputSchema":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"correlationId":{"type":"string"},"envelope":{"type":"boolean"},"expectedCwd":{"type":"string"},"expectedTurnId":{"description":"Required active-turn guard for steer; stale guards reject.","type":"string"},"hop":{"type":"number"},"maxOutputBytes":{"description":"Reply budget: 1-4194304 bytes.","type":"number"},"message":{"items":{"type":"string"},"type":"array"},"replyTo":{"type":"string"},"replyToGrok":{"type":"string"},"requestId":{"type":"string"},"threadId":{"type":"string"},"timeoutMs":{"description":"Observation timeout: 1-600000 milliseconds.","type":"number"},"wait":{"type":"boolean"},"whenBusy":{"enum":["reject","queue","steer"],"type":"string"}},"required":["threadId","message"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/send.tsx"},{"contract":"contract:src/cli/codex/status.tsx#inputJsonSchema","description":"Probe the local Codex app-server daemon. Exit 0 only when it is usable.","id":"cli:codex/status","inputSchema":{"additionalProperties":false,"properties":{},"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/status.tsx"},{"contract":"contract:src/cli/codex/wait.tsx#inputJsonSchema","description":"Bounded Codex wait observation; never interrupts execution.","id":"cli:codex/wait","inputSchema":{"additionalProperties":false,"properties":{"expectedCwd":{"type":"string"},"maxOutputBytes":{"description":"Reply budget: 1-4194304 bytes.","type":"number"},"messageId":{"type":"string"},"threadId":{"type":"string"},"timeoutMs":{"description":"Observation timeout: 1-600000 milliseconds.","type":"number"},"turnId":{"type":"string"}},"required":["threadId","turnId"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/wait.tsx"},{"contract":"contract:src/cli/codex/watch.tsx#inputJsonSchema","description":"Bounded Codex watch observation; never interrupts execution.","id":"cli:codex/watch","inputSchema":{"additionalProperties":false,"properties":{"expectedCwd":{"type":"string"},"maxEvents":{"description":"Maximum observed events: 1-500.","type":"number"},"threadId":{"type":"string"},"timeoutMs":{"description":"Observation timeout: 1-600000 milliseconds.","type":"number"}},"required":["threadId"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/watch.tsx"},{"contract":"contract:src/cli/doctor.tsx#inputJsonSchema","description":"Show which agents root and auth sources gbot can see.","id":"cli:doctor","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"}},"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/doctor.tsx"},{"contract":"contract:src/cli/groups/add.tsx#inputJsonSchema","description":"Add a bot to a group.","id":"cli:groups/add","inputSchema":{"additionalProperties":false,"properties":{"bot":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"group":{"type":"string"}},"required":["group","bot"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/groups/add.tsx"},{"contract":"contract:src/cli/groups/create.tsx#inputJsonSchema","description":"Create a Grok Bot group.","id":"cli:groups/create","inputSchema":{"additionalProperties":false,"properties":{"avatarColor":{"type":"string"},"avatarShape":{"type":"string"},"description":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"member":{"description":"Member bot id or name (repeatable)","items":{"type":"string"},"type":"array"},"name":{"type":"string"},"title":{"type":"string"}},"required":["name","member"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/groups/create.tsx"},{"contract":"contract:src/cli/groups/delete.tsx#inputJsonSchema","description":"Delete a group by id or name.","id":"cli:groups/delete","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"ref":{"description":"Group id or name","type":"string"}},"required":["ref"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/groups/delete.tsx"},{"contract":"contract:src/cli/groups/get.tsx#inputJsonSchema","description":"Show one group by id or name.","id":"cli:groups/get","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"ref":{"description":"Group id or name","type":"string"}},"required":["ref"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/groups/get.tsx"},{"contract":"contract:src/cli/groups/list.tsx#inputJsonSchema","description":"List Grok Bot groups.","id":"cli:groups/list","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"}},"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/groups/list.tsx"},{"contract":"contract:src/cli/groups/members.tsx#inputJsonSchema","description":"Show members of a group (same payload as groups get).","id":"cli:groups/members","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"ref":{"description":"Group id or name","type":"string"}},"required":["ref"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/groups/members.tsx"},{"contract":"contract:src/cli/groups/remove.tsx#inputJsonSchema","description":"Remove a bot from a group.","id":"cli:groups/remove","inputSchema":{"additionalProperties":false,"properties":{"bot":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"group":{"type":"string"}},"required":["group","bot"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/groups/remove.tsx"},{"contract":"contract:src/cli/groups/set.tsx#inputJsonSchema","description":"Replace a group's member list.","id":"cli:groups/set","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"group":{"type":"string"},"member":{"description":"Member bot id or name (repeatable)","items":{"type":"string"},"type":"array"}},"required":["group","member"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/groups/set.tsx"},{"contract":"contract:src/cli/groups/update.tsx#inputJsonSchema","description":"Update a group profile (members stay on set/add/remove).","id":"cli:groups/update","inputSchema":{"additionalProperties":false,"properties":{"avatarColor":{"type":"string"},"avatarShape":{"type":"string"},"description":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"hidden":{"type":"string"},"name":{"type":"string"},"notify":{"type":"string"},"ref":{"description":"Group id or name","type":"string"},"title":{"type":"string"}},"required":["ref"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/groups/update.tsx"},{"contract":"contract:src/cli/history.tsx#inputJsonSchema","description":"Read the opt-in local JSONL history without contacting the gateway.","id":"cli:history","inputSchema":{"additionalProperties":false,"properties":{"historyDir":{"description":"Directory containing history.jsonl","type":"string"},"limit":{"default":40,"description":"Maximum matching rows (1 or more)","type":"number"},"path":{"description":"Print the history file path","type":"boolean"},"ref":{"description":"Bot or group id or name","type":"string"},"search":{"description":"Case-insensitive message text filter","type":"string"}},"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/history.tsx"},{"contract":"contract:src/cli/send.tsx#inputJsonSchema","description":"Send a message to a Grok Bot bot or group by name or id.","id":"cli:send","inputSchema":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"codexThreadId":{"type":"string"},"correlationId":{"description":"Stable correlation id for multi-hop replies","type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"envelope":{"description":"Prepend the [gbot …] header","type":"boolean"},"expectedCwd":{"type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"historyDir":{"description":"Directory containing history.jsonl","type":"string"},"hop":{"description":"Hop count; refused at GROK_BOT_MAX_HOPS","type":"number"},"message":{"items":{"type":"string"},"type":"array"},"noHistory":{"description":"Skip local history for this command","type":"boolean"},"replyMode":{"enum":["auto","manual"],"type":"string"},"replyTo":{"description":"Prior message id this send replies to","type":"string"},"requestId":{"type":"string"},"target":{"type":"string"}},"required":["target","message"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/send.tsx"},{"contract":"contract:src/cli/skills/add.tsx#inputJsonSchema","description":"Add a SKILL.md to the shared skill library. Every bot sees it.","id":"cli:skills/add","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"path":{"description":"SKILL.md file, or a directory holding one","type":"string"}},"required":["path"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/skills/add.tsx"},{"contract":"contract:src/cli/skills/list.tsx#inputJsonSchema","description":"List the skill library every bot in this Grok Bot shares.","id":"cli:skills/list","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"}},"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/skills/list.tsx"},{"contract":"contract:src/cli/skills/remove.tsx#inputJsonSchema","description":"Remove a library skill by id or name. Every bot loses it.","id":"cli:skills/remove","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"skill":{"description":"Skill id or name","type":"string"}},"required":["skill"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/skills/remove.tsx"},{"contract":"contract:src/cli/thread.tsx#inputJsonSchema","description":"Read the most recent messages in a Grok Bot bot or group thread.","id":"cli:thread","inputSchema":{"additionalProperties":false,"properties":{"after":{"description":"Return entries after this opaque entry id","type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"full":{"description":"Show full entry text in human output","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"historyDir":{"description":"Directory containing history.jsonl","type":"string"},"limit":{"default":40,"description":"How many trailing entries to return (1-200)","type":"number"},"noHistory":{"description":"Skip local history for this command","type":"boolean"},"root":{"description":"Read one rooted thread by message id","type":"string"},"target":{"type":"string"}},"required":["target"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/thread.tsx"}]},"contracts":[{"id":"contract:src/cli/approvals/list.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"target":{"type":"string"}},"required":["target"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/approvals/list.tsx"},"routes":["cli:approvals/list"]},{"id":"contract:src/cli/approvals/respond.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"decision":{"enum":["accept","decline"],"type":"string"},"entryId":{"type":"string"},"requestId":{"type":"string"},"target":{"type":"string"}},"required":["target","entryId","requestId","decision"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/approvals/respond.tsx"},"routes":["cli:approvals/respond"]},{"id":"contract:src/cli/bots/create.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"avatarColor":{"type":"string"},"avatarShape":{"type":"string"},"description":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"name":{"type":"string"},"title":{"type":"string"}},"required":["name"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/bots/create.tsx"},"routes":["cli:bots/create"]},{"id":"contract:src/cli/bots/delete.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"ref":{"description":"Bot or group id or name","type":"string"}},"required":["ref"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/bots/delete.tsx"},"routes":["cli:bots/delete"]},{"id":"contract:src/cli/bots/get.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"ref":{"description":"Bot or group id or name","type":"string"}},"required":["ref"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/bots/get.tsx"},"routes":["cli:bots/get"]},{"id":"contract:src/cli/bots/list.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"}},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/bots/list.tsx"},"routes":["cli:bots/list"]},{"id":"contract:src/cli/bots/update.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"avatarColor":{"type":"string"},"avatarShape":{"type":"string"},"description":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"hidden":{"type":"string"},"name":{"type":"string"},"notify":{"type":"string"},"ref":{"description":"Bot or group id or name","type":"string"},"title":{"type":"string"}},"required":["ref"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/bots/update.tsx"},"routes":["cli:bots/update"]},{"id":"contract:src/cli/codex/bridge/respond.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"answersJson":{"description":"JSON object mapping each advertised question ID to {\"answers\":[\"answer\"]}; exact IDs required.","type":"string"},"bindingId":{"type":"string"},"decision":{"enum":["accept","decline","cancel"],"type":"string"},"exchangeId":{"type":"string"},"generation":{"type":"string"},"interactionId":{"type":"string"},"threadId":{"type":"string"},"turnId":{"type":"string"}},"required":["interactionId","generation","threadId","turnId"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/bridge/respond.tsx"},"routes":["cli:codex/bridge/respond"]},{"id":"contract:src/cli/codex/bridge/run.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"lifetimeMs":{"description":"Foreground lifetime in milliseconds (100..82800000; default 23h).","type":"number"}},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/bridge/run.tsx"},"routes":["cli:codex/bridge/run"]},{"id":"contract:src/cli/codex/bridge/start.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"busyPolicy":{"enum":["steer","reject"],"type":"string"},"codexThreadId":{"type":"string"},"expectedCwd":{"type":"string"},"grokTarget":{"type":"string"},"requestId":{"type":"string"}},"required":["grokTarget"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/bridge/start.tsx"},"routes":["cli:codex/bridge/start"]},{"id":"contract:src/cli/codex/bridge/status.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"limit":{"type":"number"}},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/bridge/status.tsx"},"routes":["cli:codex/bridge/status"]},{"id":"contract:src/cli/codex/bridge/stop.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"all":{"type":"boolean"},"bindingId":{"type":"string"},"worker":{"type":"boolean"}},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/bridge/stop.tsx"},"routes":["cli:codex/bridge/stop"]},{"id":"contract:src/cli/codex/desktop-shim.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"action":{"description":"install | uninstall | status","enum":["install","uninstall","status"],"type":"string"}},"required":["action"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/desktop-shim.tsx"},"routes":["cli:codex/desktop-shim"]},{"id":"contract:src/cli/codex/list-threads.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"cursor":{"description":"Opaque pagination cursor (may start with -)","type":"string"},"limit":{"default":20,"description":"Max threads to list (1-200)","type":"number"}},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/list-threads.tsx"},"routes":["cli:codex/list-threads"]},{"id":"contract:src/cli/codex/queue.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"threadId":{"type":"string"}},"required":["threadId"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/queue.tsx"},"routes":["cli:codex/queue"]},{"id":"contract:src/cli/codex/send.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"correlationId":{"type":"string"},"envelope":{"type":"boolean"},"expectedCwd":{"type":"string"},"expectedTurnId":{"description":"Required active-turn guard for steer; stale guards reject.","type":"string"},"hop":{"type":"number"},"maxOutputBytes":{"description":"Reply budget: 1-4194304 bytes.","type":"number"},"message":{"items":{"type":"string"},"type":"array"},"replyTo":{"type":"string"},"replyToGrok":{"type":"string"},"requestId":{"type":"string"},"threadId":{"type":"string"},"timeoutMs":{"description":"Observation timeout: 1-600000 milliseconds.","type":"number"},"wait":{"type":"boolean"},"whenBusy":{"enum":["reject","queue","steer"],"type":"string"}},"required":["threadId","message"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/send.tsx"},"routes":["cli:codex/send"]},{"id":"contract:src/cli/codex/status.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/status.tsx"},"routes":["cli:codex/status"]},{"id":"contract:src/cli/codex/wait.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"expectedCwd":{"type":"string"},"maxOutputBytes":{"description":"Reply budget: 1-4194304 bytes.","type":"number"},"messageId":{"type":"string"},"threadId":{"type":"string"},"timeoutMs":{"description":"Observation timeout: 1-600000 milliseconds.","type":"number"},"turnId":{"type":"string"}},"required":["threadId","turnId"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/wait.tsx"},"routes":["cli:codex/wait"]},{"id":"contract:src/cli/codex/watch.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"expectedCwd":{"type":"string"},"maxEvents":{"description":"Maximum observed events: 1-500.","type":"number"},"threadId":{"type":"string"},"timeoutMs":{"description":"Observation timeout: 1-600000 milliseconds.","type":"number"}},"required":["threadId"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/watch.tsx"},"routes":["cli:codex/watch"]},{"id":"contract:src/cli/doctor.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"}},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/doctor.tsx"},"routes":["cli:doctor"]},{"id":"contract:src/cli/groups/add.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"bot":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"group":{"type":"string"}},"required":["group","bot"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/groups/add.tsx"},"routes":["cli:groups/add"]},{"id":"contract:src/cli/groups/create.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"avatarColor":{"type":"string"},"avatarShape":{"type":"string"},"description":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"member":{"description":"Member bot id or name (repeatable)","items":{"type":"string"},"type":"array"},"name":{"type":"string"},"title":{"type":"string"}},"required":["name","member"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/groups/create.tsx"},"routes":["cli:groups/create"]},{"id":"contract:src/cli/groups/delete.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"ref":{"description":"Group id or name","type":"string"}},"required":["ref"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/groups/delete.tsx"},"routes":["cli:groups/delete"]},{"id":"contract:src/cli/groups/get.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"ref":{"description":"Group id or name","type":"string"}},"required":["ref"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/groups/get.tsx"},"routes":["cli:groups/get"]},{"id":"contract:src/cli/groups/list.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"}},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/groups/list.tsx"},"routes":["cli:groups/list"]},{"id":"contract:src/cli/groups/members.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"ref":{"description":"Group id or name","type":"string"}},"required":["ref"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/groups/members.tsx"},"routes":["cli:groups/members"]},{"id":"contract:src/cli/groups/remove.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"bot":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"group":{"type":"string"}},"required":["group","bot"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/groups/remove.tsx"},"routes":["cli:groups/remove"]},{"id":"contract:src/cli/groups/set.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"group":{"type":"string"},"member":{"description":"Member bot id or name (repeatable)","items":{"type":"string"},"type":"array"}},"required":["group","member"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/groups/set.tsx"},"routes":["cli:groups/set"]},{"id":"contract:src/cli/groups/update.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"avatarColor":{"type":"string"},"avatarShape":{"type":"string"},"description":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"hidden":{"type":"string"},"name":{"type":"string"},"notify":{"type":"string"},"ref":{"description":"Group id or name","type":"string"},"title":{"type":"string"}},"required":["ref"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/groups/update.tsx"},"routes":["cli:groups/update"]},{"id":"contract:src/cli/history.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"historyDir":{"description":"Directory containing history.jsonl","type":"string"},"limit":{"default":40,"description":"Maximum matching rows (1 or more)","type":"number"},"path":{"description":"Print the history file path","type":"boolean"},"ref":{"description":"Bot or group id or name","type":"string"},"search":{"description":"Case-insensitive message text filter","type":"string"}},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/history.tsx"},"routes":["cli:history"]},{"id":"contract:src/cli/send.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"codexThreadId":{"type":"string"},"correlationId":{"description":"Stable correlation id for multi-hop replies","type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"envelope":{"description":"Prepend the [gbot …] header","type":"boolean"},"expectedCwd":{"type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"historyDir":{"description":"Directory containing history.jsonl","type":"string"},"hop":{"description":"Hop count; refused at GROK_BOT_MAX_HOPS","type":"number"},"message":{"items":{"type":"string"},"type":"array"},"noHistory":{"description":"Skip local history for this command","type":"boolean"},"replyMode":{"enum":["auto","manual"],"type":"string"},"replyTo":{"description":"Prior message id this send replies to","type":"string"},"requestId":{"type":"string"},"target":{"type":"string"}},"required":["target","message"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/send.tsx"},"routes":["cli:send"]},{"id":"contract:src/cli/skills/add.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"path":{"description":"SKILL.md file, or a directory holding one","type":"string"}},"required":["path"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/skills/add.tsx"},"routes":["cli:skills/add"]},{"id":"contract:src/cli/skills/list.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"}},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/skills/list.tsx"},"routes":["cli:skills/list"]},{"id":"contract:src/cli/skills/remove.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"skill":{"description":"Skill id or name","type":"string"}},"required":["skill"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/skills/remove.tsx"},"routes":["cli:skills/remove"]},{"id":"contract:src/cli/thread.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"after":{"description":"Return entries after this opaque entry id","type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"full":{"description":"Show full entry text in human output","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"historyDir":{"description":"Directory containing history.jsonl","type":"string"},"limit":{"default":40,"description":"How many trailing entries to return (1-200)","type":"number"},"noHistory":{"description":"Skip local history for this command","type":"boolean"},"root":{"description":"Read one rooted thread by message id","type":"string"},"target":{"type":"string"}},"required":["target"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/thread.tsx"},"routes":["cli:thread"]},{"id":"contract:src/mcp/grok-bot/tools/codex_send.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"correlationId":{"type":"string"},"envelope":{"type":"boolean"},"expectedCwd":{"type":"string"},"expectedTurnId":{"type":"string"},"hop":{"type":"number"},"maxOutputBytes":{"type":"number"},"message":{"type":"string"},"replyTo":{"type":"string"},"replyToGrok":{"type":"string"},"requestId":{"type":"string"},"threadId":{"type":"string"},"timeoutMs":{"type":"number"},"wait":{"default":false,"type":"boolean"},"whenBusy":{"enum":["reject","queue","steer"],"type":"string"}},"required":["threadId","message"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/codex_send.tsx"},"routes":["tool:grok-bot/codex_send"]},{"id":"contract:src/mcp/grok-bot/tools/codex_threads.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"cursor":{"type":"string"},"limit":{"description":"Maximum threads in this page: 1-200.","type":"number"}},"required":[],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/codex_threads.tsx"},"routes":["tool:grok-bot/codex_threads"]},{"id":"contract:src/mcp/grok-bot/tools/codex_wait.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"expectedCwd":{"type":"string"},"maxOutputBytes":{"description":"Reply budget: 1-4194304 bytes.","type":"number"},"messageId":{"type":"string"},"threadId":{"type":"string"},"timeoutMs":{"description":"Observation timeout: 1-600000 milliseconds.","type":"number"},"turnId":{"type":"string"}},"required":["threadId","turnId"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/codex_wait.tsx"},"routes":["tool:grok-bot/codex_wait"]},{"id":"contract:src/mcp/grok-bot/tools/codex_watch.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"expectedCwd":{"type":"string"},"maxEvents":{"description":"Maximum observed events: 1-500.","type":"number"},"threadId":{"type":"string"},"timeoutMs":{"description":"Observation timeout: 1-600000 milliseconds.","type":"number"}},"required":["threadId"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/codex_watch.tsx"},"routes":["tool:grok-bot/codex_watch"]},{"id":"contract:src/mcp/grok-bot/tools/gbot_bridge_start.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"busyPolicy":{"enum":["steer","reject"],"type":"string"},"codexThreadId":{"type":"string"},"expectedCwd":{"type":"string"},"grokTarget":{"type":"string"},"requestId":{"type":"string"}},"required":["grokTarget"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/gbot_bridge_start.tsx"},"routes":["tool:grok-bot/gbot_bridge_start"]},{"id":"contract:src/mcp/grok-bot/tools/gbot_bridge_status.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"limit":{"type":"number"}},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/gbot_bridge_status.tsx"},"routes":["tool:grok-bot/gbot_bridge_status"]},{"id":"contract:src/mcp/grok-bot/tools/gbot_bridge_stop.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"all":{"type":"boolean"},"bindingId":{"type":"string"},"worker":{"type":"boolean"}},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/gbot_bridge_stop.tsx"},"routes":["tool:grok-bot/gbot_bridge_stop"]},{"id":"contract:src/mcp/grok-bot/tools/gbot_codex_respond.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"answersJson":{"description":"JSON object mapping each advertised question ID to {\"answers\":[\"answer\"]}; exact IDs required.","type":"string"},"bindingId":{"type":"string"},"decision":{"enum":["accept","decline","cancel"],"type":"string"},"exchangeId":{"type":"string"},"generation":{"type":"string"},"interactionId":{"type":"string"},"threadId":{"type":"string"},"turnId":{"type":"string"}},"required":["interactionId","generation","threadId","turnId"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/gbot_codex_respond.tsx"},"routes":["tool:grok-bot/gbot_codex_respond"]},{"id":"contract:src/mcp/grok-bot/tools/gbot_grok_approvals.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"target":{"type":"string"}},"required":["target"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/gbot_grok_approvals.tsx"},"routes":["tool:grok-bot/gbot_grok_approvals"]},{"id":"contract:src/mcp/grok-bot/tools/gbot_grok_respond.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"decision":{"enum":["accept","decline"],"type":"string"},"entryId":{"type":"string"},"requestId":{"type":"string"},"target":{"type":"string"}},"required":["target","entryId","requestId","decision"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/gbot_grok_respond.tsx"},"routes":["tool:grok-bot/gbot_grok_respond"]},{"id":"contract:src/mcp/grok-bot/tools/gbot_send.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"codexThreadId":{"type":"string"},"correlationId":{"type":"string"},"expectedCwd":{"type":"string"},"hop":{"description":"Explicit chain hop count, refused at the configured bound.","type":"number"},"message":{"type":"string"},"replyMode":{"enum":["auto","manual"],"type":"string"},"requestId":{"type":"string"},"target":{"type":"string"}},"required":["target","message"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/gbot_send.tsx"},"routes":["tool:grok-bot/gbot_send"]},{"id":"contract:src/mcp/grok-bot/tools/gbot_thread.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"after":{"description":"Opaque cursor from the previous call. Returns entries strictly after it; an unknown cursor resets with a bounded snapshot.","type":"string"},"full":{"default":false,"description":"Return entries with text up to bounded budgets (20k chars per entry, 200k total). Every entry reports truncated/fullLength; read any remainder with `gbot thread --full` / `--json` on the machine.","type":"boolean"},"limit":{"default":40,"description":"How many trailing entries to inspect (1-200). Entries are returned only with full:true.","type":"number"},"target":{"description":"Bot or group name or id, for example \"General\".","type":"string"}},"required":["target"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/gbot_thread.tsx"},"routes":["tool:grok-bot/gbot_thread"]}],"digest":"2ca82f243db8390590ba51a27b27dafd9050e415ce2cef09b135b41e65629e76","events":[],"layouts":[],"providers":[],"scripts":[{"id":"script:gbot-relay","kind":"script","provenance":{"kind":"conventional"},"source":"src/scripts/gbot-relay.ts"}],"servers":[{"id":"mcp:grok-bot","mode":"generated","name":"grok-bot","routes":[{"contract":"contract:src/mcp/grok-bot/tools/codex_send.tsx#inputJsonSchema","description":"Send to Codex. With replyToGrok or bindingId, managed delivery returns the terminal answer to Grok automatically. Otherwise optional wait observes completion and explicit steer requires expectedTurnId. Acceptance is not completion.","id":"tool:grok-bot/codex_send","inputSchema":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"correlationId":{"type":"string"},"envelope":{"type":"boolean"},"expectedCwd":{"type":"string"},"expectedTurnId":{"type":"string"},"hop":{"type":"number"},"maxOutputBytes":{"type":"number"},"message":{"type":"string"},"replyTo":{"type":"string"},"replyToGrok":{"type":"string"},"requestId":{"type":"string"},"threadId":{"type":"string"},"timeoutMs":{"type":"number"},"wait":{"default":false,"type":"boolean"},"whenBusy":{"enum":["reject","queue","steer"],"type":"string"}},"required":["threadId","message"],"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/codex_send.tsx"},{"contract":"contract:src/mcp/grok-bot/tools/codex_threads.tsx#inputJsonSchema","description":"Discover a bounded page of Codex daemon threads.","id":"tool:grok-bot/codex_threads","inputSchema":{"additionalProperties":false,"properties":{"cursor":{"type":"string"},"limit":{"description":"Maximum threads in this page: 1-200.","type":"number"}},"required":[],"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/codex_threads.tsx"},{"contract":"contract:src/mcp/grok-bot/tools/codex_wait.tsx#inputJsonSchema","description":"Explicit diagnostic observation of one Codex turn; returns execution and final reply without interrupting it.","id":"tool:grok-bot/codex_wait","inputSchema":{"additionalProperties":false,"properties":{"expectedCwd":{"type":"string"},"maxOutputBytes":{"description":"Reply budget: 1-4194304 bytes.","type":"number"},"messageId":{"type":"string"},"threadId":{"type":"string"},"timeoutMs":{"description":"Observation timeout: 1-600000 milliseconds.","type":"number"},"turnId":{"type":"string"}},"required":["threadId","turnId"],"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/codex_wait.tsx"},{"contract":"contract:src/mcp/grok-bot/tools/codex_watch.tsx#inputJsonSchema","description":"Watch bounded Codex thread events for diagnostics without answering approvals.","id":"tool:grok-bot/codex_watch","inputSchema":{"additionalProperties":false,"properties":{"expectedCwd":{"type":"string"},"maxEvents":{"description":"Maximum observed events: 1-500.","type":"number"},"threadId":{"type":"string"},"timeoutMs":{"description":"Observation timeout: 1-600000 milliseconds.","type":"number"}},"required":["threadId"],"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/codex_watch.tsx"},{"contract":"contract:src/mcp/grok-bot/tools/gbot_bridge_start.tsx#inputJsonSchema","description":"Link a Grok conversation to Codex once. New visible Grok messages arrive automatically and Codex final answers return to Grok.","id":"tool:grok-bot/gbot_bridge_start","inputSchema":{"additionalProperties":false,"properties":{"busyPolicy":{"enum":["steer","reject"],"type":"string"},"codexThreadId":{"type":"string"},"expectedCwd":{"type":"string"},"grokTarget":{"type":"string"},"requestId":{"type":"string"}},"required":["grokTarget"],"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/gbot_bridge_start.tsx"},{"contract":"contract:src/mcp/grok-bot/tools/gbot_bridge_status.tsx#inputJsonSchema","description":"Inspect worker health, route coverage, bounded receipts and scoped pending operator interactions.","id":"tool:grok-bot/gbot_bridge_status","inputSchema":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"limit":{"type":"number"}},"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/gbot_bridge_status.tsx"},{"contract":"contract:src/mcp/grok-bot/tools/gbot_bridge_stop.tsx#inputJsonSchema","description":"Stop a binding without deleting receipts or interrupting Codex. all stops all bindings; worker explicitly shuts down the worker.","id":"tool:grok-bot/gbot_bridge_stop","inputSchema":{"additionalProperties":false,"properties":{"all":{"type":"boolean"},"bindingId":{"type":"string"},"worker":{"type":"boolean"}},"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/gbot_bridge_stop.tsx"},{"contract":"contract:src/mcp/grok-bot/tools/gbot_codex_respond.tsx#inputJsonSchema","description":"Explicit operator response to a current scoped Codex interaction. Supports only one-time accept/decline/cancel or exact question-ID answers. Never auto-approve.","id":"tool:grok-bot/gbot_codex_respond","inputSchema":{"additionalProperties":false,"properties":{"answersJson":{"description":"JSON object mapping each advertised question ID to {\"answers\":[\"answer\"]}; exact IDs required.","type":"string"},"bindingId":{"type":"string"},"decision":{"enum":["accept","decline","cancel"],"type":"string"},"exchangeId":{"type":"string"},"generation":{"type":"string"},"interactionId":{"type":"string"},"threadId":{"type":"string"},"turnId":{"type":"string"}},"required":["interactionId","generation","threadId","turnId"],"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/gbot_codex_respond.tsx"},{"contract":"contract:src/mcp/grok-bot/tools/gbot_grok_approvals.tsx#inputJsonSchema","description":"List pending auto-review and local-tool approval cards in the latest 200 entries for a Grok bot. Older or unsupported requests require the owning Grok UI.","id":"tool:grok-bot/gbot_grok_approvals","inputSchema":{"additionalProperties":false,"properties":{"target":{"type":"string"}},"required":["target"],"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/gbot_grok_approvals.tsx"},{"contract":"contract:src/mcp/grok-bot/tools/gbot_grok_respond.tsx#inputJsonSchema","description":"Only after an explicit user decision: accept one current Grok approval once or decline it. Exact target, entryId and approval requestId required. Never auto-approve or grant persistent permissions. Success acknowledges response delivery, not execution.","id":"tool:grok-bot/gbot_grok_respond","inputSchema":{"additionalProperties":false,"properties":{"decision":{"enum":["accept","decline"],"type":"string"},"entryId":{"type":"string"},"requestId":{"type":"string"},"target":{"type":"string"}},"required":["target","entryId","requestId","decision"],"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/gbot_grok_respond.tsx"},{"contract":"contract:src/mcp/grok-bot/tools/gbot_send.tsx#inputJsonSchema","description":"Send to Grok Bot. Native Codex calls automatically receive replies in their originating thread; send once and continue work. Without a native source, supply codexThreadId or use manual gbot_thread reading.","id":"tool:grok-bot/gbot_send","inputSchema":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"codexThreadId":{"type":"string"},"correlationId":{"type":"string"},"expectedCwd":{"type":"string"},"hop":{"description":"Explicit chain hop count, refused at the configured bound.","type":"number"},"message":{"type":"string"},"replyMode":{"enum":["auto","manual"],"type":"string"},"requestId":{"type":"string"},"target":{"type":"string"}},"required":["target","message"],"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/gbot_send.tsx"},{"contract":"contract:src/mcp/grok-bot/tools/gbot_thread.tsx#inputJsonSchema","description":"Read a bounded Grok Bot thread tail. Returns a small receipt by default; pass the last cursor as after for an exclusive client-side delta, or full:true to include bounded entry text.","id":"tool:grok-bot/gbot_thread","inputSchema":{"additionalProperties":false,"properties":{"after":{"description":"Opaque cursor from the previous call. Returns entries strictly after it; an unknown cursor resets with a bounded snapshot.","type":"string"},"full":{"default":false,"description":"Return entries with text up to bounded budgets (20k chars per entry, 200k total). Every entry reports truncated/fullLength; read any remainder with `gbot thread --full` / `--json` on the machine.","type":"boolean"},"limit":{"default":40,"description":"How many trailing entries to inspect (1-200). Entries are returned only with full:true.","type":"number"},"target":{"description":"Bot or group name or id, for example \"General\".","type":"string"}},"required":["target"],"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/gbot_thread.tsx"}]}]},"runtime":{"node":"22.19.0"}} +{"application":{"description":"Message Grok Bot from Codex, Claude Code, and Cursor, with managed automatic replies and explicit Codex conversation links.","id":"plugin:gbot","name":"gbot","version":"0.9.0"},"compiler":{"adapters":[{"adapterRevision":"1.28.0","host":"claude","observedVersion":"2.1.260","schemas":[{"name":"hooks","revision":"2.1.260","sha256":"0cdfc5eb5201f2c3091768559ac82f4c563ccb1b7bce7a39d5f99e5f404654cb"},{"name":"lsp","revision":"2.1.260","sha256":"b4419c5d857267c7e2b21e3e1eb98b4fdc302c87109007190d3258e6ba7096e4"},{"name":"marketplace","revision":"2.1.260","sha256":"31ee4cc43ba5ce2be248030a69da2d31171550b2cc51c1fcb9f788a8ab92783d"},{"name":"mcp","revision":"2.1.260","sha256":"edd4770e41d6aee5beae1ff918d33139613a243e454ecbd52b72fa824be4a662"},{"name":"monitors","revision":"2.1.260","sha256":"6378d94b51fb7c784eaee178237008a03da0f889d0520d57486784954a1d484c"},{"name":"plugin","revision":"2.1.260","sha256":"2a976091b81ad07ae8eca57f6f9c5749efeba17fa089a0c12b6ca84d6e70f118"},{"name":"settings","revision":"2.1.260","sha256":"2bbca553621dbf9433a9b7d1ff7952543a368434f2d999a4e4e360b95b6d4c3d"},{"name":"theme","revision":"2.1.260","sha256":"9931264e6f5a1d4b3b854ce7a17d602c9ba1b57cc1991f1d3991b316eaa81ac2"}]},{"adapterRevision":"1.13.0","host":"codex","observedVersion":"0.147.0","schemas":[{"name":"app","revision":"0.147.0","sha256":"01c720a645e437bf0c4f8c26fd4cb5a13988e5649e4a8562ee23a1d4b7355c6a"},{"name":"hooks","revision":"0.147.0","sha256":"175b859eb8e85bd287d85ee840d97c3f5c2d0dda3223507a796d158e3770eeba"},{"name":"marketplace","revision":"0.147.0","sha256":"fbccce3ade39e1b077fcb440e60260de6e811e8c2d222b2ae0fe8fe47706b470"},{"name":"mcp","revision":"0.147.0","sha256":"75bd50f9fcb85c2e8d43bc132d61c172a02f28ea8bb77389816ae77b14a4257e"},{"name":"plugin","revision":"0.147.0","sha256":"074c6c71966a3e6560ccbceb8d82ec6a40cb1eccee2f2d863fb4ef1e2276a814"}]},{"adapterRevision":"1.13.0","host":"cursor","observedVersion":"2026-08-28","schemas":[{"name":"hooks","revision":"2026-08-28","sha256":"06154b7afa0861df462130b988912b897e7ccf962b8dd20c09193100bcde5d81"},{"name":"marketplace","revision":"2026-08-28","sha256":"1aae96a24c2796419933bc8bfe3a1255394e7199c35740b36325e0ce6dbc253d"},{"name":"mcp","revision":"2026-08-28","sha256":"f3fa4615afefe004c4fbcc09e635d890df0f1ec0cb39540feab72cbd3a31d844"},{"name":"plugin","revision":"2026-08-28","sha256":"a393b758901803fcf5cfe0d77bda8a83e987d32c3377dfce2d9edf445af884ed"}]},{"adapterRevision":"1.10.0","host":"portable","observedVersion":"1.0.0","schemas":[{"name":"mcp","revision":"1.0.0","sha256":"6539175bfcdf43085855183e86da40ea94b166547a72b47ae9a0a390516d3acb"},{"name":"plugin","revision":"1.0.0","sha256":"0a4aad95ce337878ad38802ebf0daa3fde76abe3f65400c86bcbb1ec0b3ab883"}]}],"agentSkills":{"schemaSha256":"6d06b61e423317421de2295ea1fd0c7b4491bfa36c5b7705c28616dfe76d4047","sourceRevision":"69ef37e9424c0a7ea9dd2293b559e43ec8176379","specification":"https://raw.githubusercontent.com/agentskills/agentskills/69ef37e9424c0a7ea9dd2293b559e43ec8176379/docs/specification.mdx"},"producer":{"name":"agent-bundle","version":"0.3.0"},"project":{"configDigest":"888dd04deb2d2ea8e35639dd53deba7140f0f0f0be781f50dc29cf63945e0159","configPath":"agent-bundle.config.ts","modelDigest":"cdf19dcc86c7bab4bc4619eb106a10d68175d105bb33665ce9d9a2d959b567bf","packageName":"grok-bot-cli","packageVersion":"0.9.0","revision":"c41b4d59474e4449847468a5f5cf4fcfdbca9b276164a0145447098e71f4e87f","sourceInputs":[{"executable":false,"path":".changeset/agent-bundle-4f62216f30.md","sha256":"814b494fc7dd6ab760dc43239afc26e1a481807fb99218979e501f81ef9eb152"},{"executable":false,"path":".changeset/clean-pugs-dream.md","sha256":"9e5518cbc2979fa3ed5939def562f5c3630434ff01a5069e1de15729b9e6a9a5"},{"executable":false,"path":".changeset/config.json","sha256":"0a97ce5d0488bada887ee9ea3726edecc727454b7da0294f1b5fe4947f48ee7c"},{"executable":false,"path":".changeset/README.md","sha256":"495bd4805f8362853bce99689c1cd75db8c475dfa38930619d2e197d7554db27"},{"executable":false,"path":".github/workflows/changeset.yml","sha256":"293f8c43e3d9806f92f4ab3f242f1ecfc65988f73fd6fcf13fbff6f8533a827c"},{"executable":false,"path":".github/workflows/ci.yml","sha256":"0157614be1e712cbe461c6df3a74db3eda502ac9f19e2a983971a13bc1a14d9b"},{"executable":false,"path":".github/workflows/release.yml","sha256":"cb78aed6074c8eb8938bd97f7d70bc3f57b8d303dea28344830229c6ebc2f1f0"},{"executable":false,"path":".gitignore","sha256":"3e8fdb390e0a40ebc680e14f015cfc607d92061f174dcea0c559ecad0da5058e"},{"executable":false,"path":".npmrc","sha256":"d83f12f7ebebf59d1d17bc1a800e1de5c96791ea8155406d43a5b59aeabdaaf8"},{"executable":false,"path":"agent-bundle.config.ts","sha256":"888dd04deb2d2ea8e35639dd53deba7140f0f0f0be781f50dc29cf63945e0159"},{"executable":false,"path":"AGENTS.md","sha256":"e18ce90a031c533e7226789b97f6bce4aa7994b672544e0f425d20cc3bc15d29"},{"executable":false,"path":"CHANGELOG.md","sha256":"b657e7ee4f8992d678ffe62ac748db2e3752bb3e0b01a787861667a9e4ad5dd7"},{"executable":false,"path":"demo/grok-bot-cli-demo.gif","sha256":"0fe01e15fd2abbbc5cc3313e42931d404d3a320764e22fdcfb995f1a45dd73cd"},{"executable":false,"path":"demo/grok-bot-cli-demo.mp4","sha256":"b6ed66e43616674096c2f0a4a4da46fe4693c681833eab013f872a66b9ff933c"},{"executable":false,"path":"docs/codex-busy-threads.md","sha256":"2c3f292e39582f1aa431aeb2a0732c433bb167be9a6d1df2a04a8064cce47e76"},{"executable":false,"path":"docs/codex-duplex-architecture.md","sha256":"792f1be8bad508b042c5813c1fc3b7ea5ac87032803227830666727306e55fa2"},{"executable":false,"path":"docs/verification/2026-09-15-duplex.md","sha256":"c7d97f709a3c2d851c0a24690321bbda161ec925b4143a456b9951e174bf75df"},{"executable":false,"path":"LICENSE","sha256":"bc48c8a0f6b6e45842e574c79a6b955fe683ed13f48a50cc08bcccdb1a59fe59"},{"executable":false,"path":"package-lock.json","sha256":"ffae5d4fae4eb3906cd69fe80a5c85f8ead845cb598d11759746e375099ddd11"},{"executable":false,"path":"package.json","sha256":"350031d01e314c771fe5c07bb310f8f6fbbc927383cf65e158abc8a3366e186f"},{"executable":false,"path":"README.md","sha256":"754b0438d4f973e9dfe755b56a4dfe29d65328a97be607f1790caac2413d57b0"},{"executable":false,"path":"renovate.json","sha256":"e80b4e42a3043bc12fa0640db4bac392d2bf770acf841360d7c8ceeeac2ec1a9"},{"executable":false,"path":"rstest.route-unit.config.ts","sha256":"7286e20dc3d4162673e7c3dfe824db00307e1fda178410f23044a97286d141f2"},{"executable":false,"path":"scripts/run-unit-tests.mjs","sha256":"58feb44330add2a4b04b3e8871bca0fa39ff48ed98e2f8295fb40af93c8e94d3"},{"executable":false,"path":"src/cli/_shared.ts","sha256":"555210759d9b2e2e60a01452c137abd73bad42bfab8b2311b66a3ab97f4ee5e9"},{"executable":false,"path":"src/cli/approvals/list.tsx","sha256":"8d21320b6cd9d6b2a266fd30196b8a439960f865a6f0a5dacf5845d64ed7388c"},{"executable":false,"path":"src/cli/approvals/respond.tsx","sha256":"7d9fe6e641deb08f444684733daac6da47fb472d90ed0e9ff77892f376a87255"},{"executable":false,"path":"src/cli/bots/create.tsx","sha256":"9f7a73a0595b642dd77f008ad596bcafd00fc5846ec1abff2ce62819d983eb84"},{"executable":false,"path":"src/cli/bots/delete.tsx","sha256":"126b53ac1da4a657f22d1a6770ddbab2cc66715c811de0873d50016bbe39cbf2"},{"executable":false,"path":"src/cli/bots/get.tsx","sha256":"f0c752a3b498819083a8ee5aa918d275727f1cc94d8774d8c84ac74db66e8a71"},{"executable":false,"path":"src/cli/bots/list.tsx","sha256":"21c0f7e39005860dfc2514b71f745bb4cab29d409ef2cff26f8759bb0fd261c1"},{"executable":false,"path":"src/cli/bots/update.tsx","sha256":"33b7f5aafbf931cf3cb5ecf423a76dacd09adb117a7d5490050639ae7f4210dd"},{"executable":false,"path":"src/cli/codex/bridge/respond.tsx","sha256":"9d3a6af4904af6e44583dfb4ef317b3fe1045a78e765fc27406eaca9bcadcd13"},{"executable":false,"path":"src/cli/codex/bridge/run.tsx","sha256":"a49d334bebb00db62ad2c54370a47ec2c9119b4c07eb6ba11fc4bba4dd8e4217"},{"executable":false,"path":"src/cli/codex/bridge/start.tsx","sha256":"9e423cf5d65168606f6235baa2bcd127eb949647f7a4dee284d75f831474524d"},{"executable":false,"path":"src/cli/codex/bridge/status.tsx","sha256":"c801f69080985c87025429fb136487acdfac093acb07241b3417ea9a83915a18"},{"executable":false,"path":"src/cli/codex/bridge/stop.tsx","sha256":"6710e298a21d124c442d5aa1a3744280e5cd4df93213797f2ea3c0654174184a"},{"executable":false,"path":"src/cli/codex/desktop-shim.tsx","sha256":"fa3d88d11895bc4a15700bd590c055aa392b2b0e0c1185c52da233a23589aba0"},{"executable":false,"path":"src/cli/codex/list-threads.tsx","sha256":"4419b29c5bc56f019e2835e3c8dbf4bc72291150900cfe2b8781a94c1482fe0f"},{"executable":false,"path":"src/cli/codex/queue.tsx","sha256":"7993ac5b827042cd95041775b183fde2d112b5ba7d5c82098e778a44e473826d"},{"executable":false,"path":"src/cli/codex/send.tsx","sha256":"6848001878471439bcc35a2c40010ecf0e57e61087879b1f4d6abb1be19e7924"},{"executable":false,"path":"src/cli/codex/status.tsx","sha256":"b8c31001cb2892c1bfccf502f9776ee06998eac4fc0356f92936fa2c34f272d8"},{"executable":false,"path":"src/cli/codex/wait.tsx","sha256":"c2ec45e5907e27ff0ab1885eceb2d62c33485b8d61f44ef871a24e7a7e8473ca"},{"executable":false,"path":"src/cli/codex/watch.tsx","sha256":"3280f42d15941cfd00b3727d9e271972c39165bd28db8f56acca5664d777cb4d"},{"executable":false,"path":"src/cli/doctor.tsx","sha256":"c30ce4e57fe707d36de29700abf5a2c56834bb4fb3adf2a70bb1089b4150ddc8"},{"executable":false,"path":"src/cli/groups/add.tsx","sha256":"2a5de115852f0ca6a6638300bd5006862a02a2f1e2f527b6fd680f610c1d777a"},{"executable":false,"path":"src/cli/groups/create.tsx","sha256":"da3f2539f338063daf51b80d86c27b2752f0e4a0334078d11508e27981590fa3"},{"executable":false,"path":"src/cli/groups/delete.tsx","sha256":"2d4e91113a2c24cefefcfd464513918791592b5e8734a4ef901eabe42c9c7289"},{"executable":false,"path":"src/cli/groups/get.tsx","sha256":"efed88fb3ab7292d60d6532f1f966f784ba3376b7826c9f3e5028467f86241e9"},{"executable":false,"path":"src/cli/groups/list.tsx","sha256":"f3cd229d41dd389b767447a04267700ab2293eae87a878f7d88149cb5798f4a6"},{"executable":false,"path":"src/cli/groups/members.tsx","sha256":"9b9eaecb65ea995006eff1b24a287110d16bf4830a0b0d07221c2f1317853641"},{"executable":false,"path":"src/cli/groups/remove.tsx","sha256":"96dd85d1b9732681ce9dc126ac3ae562d3f287f4c28e36b9a8f8c301dc93f63d"},{"executable":false,"path":"src/cli/groups/set.tsx","sha256":"4f9d90db612f14ddbb6d2afa5e45b66f044aed661ff95415e567e1be3b6108c6"},{"executable":false,"path":"src/cli/groups/update.tsx","sha256":"f44305815ddb6e27286f97ef68c04cfa5548acd5f04b1aba10ee7ce3cdbfc851"},{"executable":false,"path":"src/cli/history.tsx","sha256":"5151b48113b4ba0516bacabfabcd48e3256ead807c34d914deb84f31ded0b062"},{"executable":false,"path":"src/cli/send.tsx","sha256":"fd16790cfcde1c15328c3979acc0664112d5cf40d3f00a24da906e00dd63153e"},{"executable":false,"path":"src/cli/skills/add.tsx","sha256":"fbde237d172c026d7912174e705c03cbc9d74dad7806fc58c6ceb43127c69ba6"},{"executable":false,"path":"src/cli/skills/list.tsx","sha256":"34f255687c69aaf598a1dc54220453b57c46ed9ab4a168648d9c7eca6535ebae"},{"executable":false,"path":"src/cli/skills/remove.tsx","sha256":"21662c80a62f276c2dfd840a328e9665c0c5f63959a239d4dd877372c46f60d0"},{"executable":false,"path":"src/cli/thread.tsx","sha256":"29ab775936fa2987cb789754a44888fc52bdaad07180c5471122dda508cfd0c2"},{"executable":false,"path":"src/core/app-session.js","sha256":"2b2eb53ec3f4c7ea0dccf269fa9720af6f1ce36b8ca36e889d2bb271a092717d"},{"executable":false,"path":"src/core/codex-bridge.js","sha256":"02a0127f935a8c83d85ce1cf434d1a6fbecb3271ec3cd1c744b9175d2a5b88bb"},{"executable":false,"path":"src/core/codex/contract.js","sha256":"96e80f91c323df150d08a477abe6697b287cd7a1b11e98d17cb15f682fa46012"},{"executable":false,"path":"src/core/codex/conversation.js","sha256":"2eb3dc85807c4889e72e18a82ebfe7ea6d43a114ed961a06f970a593a6785983"},{"executable":false,"path":"src/core/codex/routes.ts","sha256":"bc220bf4111305e7fcaf46756b531ac2aabc1d12c87f89184ba5f670b11229ab"},{"executable":false,"path":"src/core/commands.js","sha256":"3ad8fafb86744a57992da93ad838ade0e9acb1b7ca09b829cefadbf2781be0c9"},{"executable":false,"path":"src/core/desktop-shim-bridge.js","sha256":"58f3f39b8527adf58f57313e02e34322b203b8c38d1acfbad419a8b9af214443"},{"executable":false,"path":"src/core/desktop-shim.js","sha256":"500b8617bade6fa1a9c395826e197892fb864067044cac80ab025849f8fd6f82"},{"executable":false,"path":"src/core/format.js","sha256":"83ee15f73a87ef24b75f7782f3b61dd4ef4cc1f2e01e38cdf19825b805fab3be"},{"executable":false,"path":"src/core/gateway.js","sha256":"3a4f838ee423600d29e05f58060dcaf81cdcea4ac93b36dd6108363ac24bc606"},{"executable":false,"path":"src/core/grok-approval-routes.ts","sha256":"a33daa4d05e0c2594c795bd7654c22f3e1003e4aaad41cd70034d03651dd01f9"},{"executable":false,"path":"src/core/grok-approvals.js","sha256":"6b651a65bdd17241dd5b7a01d94a318ece9356c1c9b965b0578e08250d74e8fe"},{"executable":false,"path":"src/core/headers.js","sha256":"e229f2826ebdfb52949dab500798c0fa8a5ff7c4e63de91a63103bf45d2ae3cc"},{"executable":false,"path":"src/core/history.js","sha256":"38ca8e8f8dcd2ad42952c424ea9f00be5972d8751e4c0ac87214171903d82d89"},{"executable":false,"path":"src/core/relay/codex.js","sha256":"827f4d209c0681d4ed973ef41e0b2264e64c38a43aecef279efe53713b129f0e"},{"executable":false,"path":"src/core/relay/completion.js","sha256":"9d1a47f92716d1ccc7c4f44d92a580084f3b622c6ac0f20c6391be81abeb56e4"},{"executable":false,"path":"src/core/relay/control.js","sha256":"3645540f9f799b8742e0d5782b6324454a1486a780f6cb97260b96ef62411771"},{"executable":false,"path":"src/core/relay/engine.js","sha256":"205dd43b337439a56c7b1521b2603679ebc7fd3b2da430f8a477f83549efd453"},{"executable":false,"path":"src/core/relay/intake.js","sha256":"b31146fe3c9edd2f09323a454687403666591b6c12483a55b07ac610d2e3610a"},{"executable":false,"path":"src/core/relay/interactions.js","sha256":"6b576ed3a5b6659bc17e384d26e40d6ccb41b118b3a91cf5c902e9758ccbc1b1"},{"executable":false,"path":"src/core/relay/managed.js","sha256":"dbe03ed964bd09739e580de73b7e9f90508062fa2e53b8244c6ca7f78fc7a60d"},{"executable":false,"path":"src/core/relay/ownership.js","sha256":"74805f04f6a8bc02b2951614c4814aa42f54aaa3abca027a2413ed5a54814caf"},{"executable":false,"path":"src/core/relay/profile.js","sha256":"3347d1d493d3470d82722468d31571464d8e11aa0b4deac5bda75f574078dfe5"},{"executable":false,"path":"src/core/relay/records.js","sha256":"c6ffc479436282348a491e0f18b1b0e2944deb0619e025484ab6a8d25ec3c2c5"},{"executable":false,"path":"src/core/relay/routes.ts","sha256":"0e00c45a87cea0af5faa7e21a681371708e88140659747bd8a068a8dd10eccc8"},{"executable":false,"path":"src/core/relay/state.js","sha256":"f803d955619387306852a2965a75afc26804a982309dd04c9564e5ae31d638d2"},{"executable":false,"path":"src/core/relay/worker.js","sha256":"4176ad91872f36f7ea6565d9f30d23d9d7a80ef27d7af975af760457132ba148"},{"executable":false,"path":"src/core/store.js","sha256":"caefeeebf686cecd37ef19585ef0a5d3acba9dbf1564fe128c3afe4de067305c"},{"executable":false,"path":"src/core/transcript.js","sha256":"0355f0978d2d126b90858e3f661130243fc4730ee81ba13080af1dfa39d8b081"},{"executable":false,"path":"src/core/url-policy.js","sha256":"62bf6d3c8af1f5840d5e2d682d8f2e52fcbfbee6695728b47ed31816f1736089"},{"executable":false,"path":"src/gbot-install.ts","sha256":"e3c833d7662610e70e65232e541017229fb9a049eacee0bdf31e2c33c6ab7189"},{"executable":false,"path":"src/gbot.ts","sha256":"c89a37b764956ceacb2917a991a6d82d987ed8d8e453c8d553485bbd7f3edcc0"},{"executable":false,"path":"src/mcp/grok-bot/tools/codex_send.tsx","sha256":"59d6ecff2d64247013d78e38372601591c083816ff6475dfa31d77b7d3ad29ca"},{"executable":false,"path":"src/mcp/grok-bot/tools/codex_threads.tsx","sha256":"7f1377fcb0cc14c43b47584094350596e77dcddaf835975e42b7caa7d2739bdd"},{"executable":false,"path":"src/mcp/grok-bot/tools/codex_wait.tsx","sha256":"fe1601ba242c82bdc34963caea4eb8aa7c9a9bc1fbb14ea16622a502674cf102"},{"executable":false,"path":"src/mcp/grok-bot/tools/codex_watch.tsx","sha256":"1471575be5e16426e6386ce14dbbc7950717056ae51e75d985e2f79cb4de0e17"},{"executable":false,"path":"src/mcp/grok-bot/tools/gbot_bridge_start.tsx","sha256":"c75c5c8a30ec43709a4d32baa8c3bc9796595381bb04fd2499ca30cd515c5a0b"},{"executable":false,"path":"src/mcp/grok-bot/tools/gbot_bridge_status.tsx","sha256":"486ce643b35cfa2eabf78f0deeabce7198adc66133669eec630e1d12206ad642"},{"executable":false,"path":"src/mcp/grok-bot/tools/gbot_bridge_stop.tsx","sha256":"371428a6e4b4e1312dd95d9681c29e765aec55e65d80d7c474535df838a43457"},{"executable":false,"path":"src/mcp/grok-bot/tools/gbot_codex_respond.tsx","sha256":"030e9c2081ed4ed40732b098c929022af3083f609f10934b35e1f428d33ae637"},{"executable":false,"path":"src/mcp/grok-bot/tools/gbot_grok_approvals.tsx","sha256":"17f164acdc48d6bc79a4c5044c7082760dd2a1646e5b56f6bff54c53fed96451"},{"executable":false,"path":"src/mcp/grok-bot/tools/gbot_grok_respond.tsx","sha256":"41964bb8cf0eb0f8493afa1dde16cd94c4f589d1a7e410577d1ed63ec4648542"},{"executable":false,"path":"src/mcp/grok-bot/tools/gbot_send.tsx","sha256":"2101d279a0e6bda2d57ba3da5366411df460a95692d4e64a1096880a89121d9a"},{"executable":false,"path":"src/mcp/grok-bot/tools/gbot_thread.tsx","sha256":"ef4aefec7243efaad18335e8508c7c17af0cd9b0f8a4b3693a7af9f666807fd6"},{"executable":false,"path":"src/scripts/gbot-relay.ts","sha256":"6690e316189ed8ebba43ea67a495338c927e4c0c21a9f896b7b2fecc8c6eb656"},{"executable":false,"path":"src/skills/talk-to-grok-bot/SKILL.md","sha256":"c671dd4a6bc29defa919fffeacf105420000e287ee727217c4baea968b3834a7"},{"executable":false,"path":"test/app-session.test.js","sha256":"0756b691703dd8c84bf0823f2afab16c6b158398e4ce6be229db6f459a0bbdb1"},{"executable":false,"path":"test/codex-bridge.test.js","sha256":"4ca47489c5794390c97d286ead62c2465abaa7125b16b924bff6e9e68a3e6a46"},{"executable":false,"path":"test/codex-contract.test.js","sha256":"926c7609679d8b6ac3b568d56ba5efa20df86d016a9031f085d19adbfb0e9064"},{"executable":false,"path":"test/codex-conversation.test.js","sha256":"c11559a8c0206982d506bcb018f9421085b8fb17ed82a6b255faf276a30f3a69"},{"executable":false,"path":"test/codex-session.test.js","sha256":"b39fe6afe0784b16e37b208089279dea01095d33e06ae26a1b60871796c7738a"},{"executable":false,"path":"test/codex-surfaces.test.js","sha256":"56d1b6550cc69d462a05e892cf82aa6a41495857b753215104e03207db514c81"},{"executable":false,"path":"test/connect-gateway.test.js","sha256":"5fabd87640b39e75c218300ca6be278268f248f3ff75e8cb72f9fade9eb0f7f3"},{"executable":false,"path":"test/desktop-shim.test.js","sha256":"89fb6c38a5fca5d41a96434cf9e8d51ae1d9992cf4f7930df0cc5840ef985705"},{"executable":false,"path":"test/doctor.test.js","sha256":"9685885df9e7363d3e077d246b1a17803c8899e9613b4a4d52ee4b9275e20694"},{"executable":false,"path":"test/gateway-groups.test.js","sha256":"14e227453e3e28c7cb60f91dba55733834c023ce9a914e40e22c68c899512bdc"},{"executable":false,"path":"test/gateway-send.test.js","sha256":"d059166153dde975f457e4e8c32ea08b0fc857b58fd48eab7da1959638e4fb05"},{"executable":false,"path":"test/gateway-skills.test.js","sha256":"feed62a884d1b7d12e358a27d73fb5587bcf761d4867ab1755d8bc34a4380069"},{"executable":false,"path":"test/gateway.test.js","sha256":"e5a7acd7ae347c82ef1e2a6000562767168e56d6f9d86aca8da46141731d1309"},{"executable":false,"path":"test/grok-approvals.test.js","sha256":"5ad4c548060a08dbe57949ab5ae240383fdb1709cd3694a909f5e1354fee3f73"},{"executable":false,"path":"test/helpers/codex-server.js","sha256":"432b4570601e94cf08c4861133d328404a97066642edb7ec0dbc314411a4d848"},{"executable":false,"path":"test/history.test.js","sha256":"eac4811f1b12d427df66996f33dd46bc3cbe31fc9fa030b3f32c571d5379f8dd"},{"executable":false,"path":"test/host-tool-inventory.test.js","sha256":"ce09bec4efcfac6860ab9defc5f32590c70ed81b664b1ba5346c167259b2be9e"},{"executable":false,"path":"test/pr69-integration.test.js","sha256":"a5dc99c11e2d3fcf18233c595f9c28301e5939f4b3657125eb3f970df2598840"},{"executable":false,"path":"test/relay-auth-recovery.test.js","sha256":"399c064f550fe33e166187a51da527728a97946d213377c8fcc8231378f5bbab"},{"executable":false,"path":"test/relay-codex.test.js","sha256":"43cb313e748e187f798a8a0bce5a01cce9ba360a52985b05ecededee9ad10581"},{"executable":false,"path":"test/relay-completion.test.js","sha256":"a8cc2402f82ce4b458074eafd32c8fa18f7ced7d85fdb6b7fa68f7b18b6a8c2e"},{"executable":false,"path":"test/relay-engine.test.js","sha256":"a3e7e4a63ec82014eec83b91d003ac89295d1f0ac3807bcf39071e4334bf2680"},{"executable":false,"path":"test/relay-gateway-lifecycle.test.js","sha256":"e16e7a34f7b6bb07965003e3018aa3a43ff192602db1c177bec9b6268fddb78b"},{"executable":false,"path":"test/relay-interactions.test.js","sha256":"83d70b1a813923fc6bae02b18d328107d0d04a6a761ab73b2051e3d114c7eaa5"},{"executable":false,"path":"test/relay-lifecycle.test.js","sha256":"e90130e1f609839bfd3f74c3edc333a22f37fe20dcde0146daa8d497133da4b7"},{"executable":false,"path":"test/relay-state.test.js","sha256":"c9143d5fa150b1ebcef9d515e161e25af3370b71eaf800a7b2bb1da1678b0bd3"},{"executable":false,"path":"test/relay-surfaces.test.js","sha256":"ba17ac4f1ffc02d4e06cd73eda143422a3d4d2f750630af9ed4e828dc9d7d2be"},{"executable":false,"path":"test/relay-worker.test.js","sha256":"6bd1bdaaaae59997132f289f822b6c4b8c9616c268fb2b45861e03f697c08197"},{"executable":false,"path":"test/release-config.test.js","sha256":"f3078277086d722f21d07e4134e10b89d2e849a94a0fa40f30025a5cb6fa6a15"},{"executable":false,"path":"test/store.test.js","sha256":"5d4ae4295287539ef4b7f98d0ca0cd42a931a3c7b25b092fbd2b8f1a08ca4bac"},{"executable":false,"path":"test/test-runner.test.js","sha256":"966ff3b67edb8e1f03b50120d4d820ab0f871121e9b359609e73faae8446454f"},{"executable":false,"path":"test/transcript.test.js","sha256":"28795d9cc8e42653ac430d18e17ff1e6bc2feb1b7935fe5c69b336d58e1793ae"},{"executable":false,"path":"test/url-policy.test.js","sha256":"dacfe322e0cbff178c0d67a5f76b6bd8d9fef14aa57c09c697eb69fa0019629c"},{"executable":false,"path":"tests/route-unit/tools.test.ts","sha256":"942349e51cc56dac903625be3b43b3a54f3b2b7e25410b0e56ebd3f185e93549"},{"executable":false,"path":"tsconfig.json","sha256":"fa2ced6d1721e8280a6aed615717cffcef25f6e2d16e15889b2be2a9df4fc226"}]},"provenance":[{"path":".agents/plugins/marketplace.json","sourceInputs":["agent-bundle.config.ts"]},{"path":".claude-plugin/marketplace.json","sourceInputs":["agent-bundle.config.ts","package.json"]},{"path":".claude-plugin/plugin.json","sourceInputs":["agent-bundle.config.ts","src/mcp/grok-bot/tools/codex_send.tsx","src/skills/talk-to-grok-bot/SKILL.md"]},{"path":".codex-plugin/mcp.json","sourceInputs":["agent-bundle.config.ts","src/mcp/grok-bot/tools/codex_send.tsx"]},{"path":".codex-plugin/plugin.json","sourceInputs":["agent-bundle.config.ts","package.json","src/mcp/grok-bot/tools/codex_send.tsx","src/skills/talk-to-grok-bot/SKILL.md"]},{"path":".cursor-plugin/marketplace.json","sourceInputs":["agent-bundle.config.ts"]},{"path":".cursor-plugin/mcp.json","sourceInputs":["agent-bundle.config.ts","src/mcp/grok-bot/tools/codex_send.tsx"]},{"path":".cursor-plugin/plugin.json","sourceInputs":["agent-bundle.config.ts","package.json","src/mcp/grok-bot/tools/codex_send.tsx","src/skills/talk-to-grok-bot/SKILL.md"]},{"path":".mcp.json","sourceInputs":["agent-bundle.config.ts","src/mcp/grok-bot/tools/codex_send.tsx"]},{"path":"agent-bundle.compile-evidence.json","sourceInputs":["agent-bundle.config.ts"]},{"path":"bin/gbot-flight.mjs","sourceInputs":["agent-bundle.config.ts","package.json","src/cli/_shared.ts","src/cli/approvals/list.tsx","src/cli/approvals/respond.tsx","src/cli/bots/create.tsx","src/cli/bots/delete.tsx","src/cli/bots/get.tsx","src/cli/bots/list.tsx","src/cli/bots/update.tsx","src/cli/codex/bridge/respond.tsx","src/cli/codex/bridge/run.tsx","src/cli/codex/bridge/start.tsx","src/cli/codex/bridge/status.tsx","src/cli/codex/bridge/stop.tsx","src/cli/codex/desktop-shim.tsx","src/cli/codex/list-threads.tsx","src/cli/codex/queue.tsx","src/cli/codex/send.tsx","src/cli/codex/status.tsx","src/cli/codex/wait.tsx","src/cli/codex/watch.tsx","src/cli/doctor.tsx","src/cli/groups/add.tsx","src/cli/groups/create.tsx","src/cli/groups/delete.tsx","src/cli/groups/get.tsx","src/cli/groups/list.tsx","src/cli/groups/members.tsx","src/cli/groups/remove.tsx","src/cli/groups/set.tsx","src/cli/groups/update.tsx","src/cli/history.tsx","src/cli/send.tsx","src/cli/skills/add.tsx","src/cli/skills/list.tsx","src/cli/skills/remove.tsx","src/cli/thread.tsx","src/core/app-session.js","src/core/codex-bridge.js","src/core/codex/contract.js","src/core/codex/conversation.js","src/core/codex/routes.ts","src/core/commands.js","src/core/desktop-shim-bridge.js","src/core/desktop-shim.js","src/core/format.js","src/core/gateway.js","src/core/grok-approval-routes.ts","src/core/grok-approvals.js","src/core/headers.js","src/core/history.js","src/core/relay/control.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/relay/routes.ts","src/core/store.js","src/core/transcript.js","src/core/url-policy.js","src/gbot.ts"]},{"path":"bin/gbot.mjs","sourceInputs":["agent-bundle.config.ts","package.json","src/cli/_shared.ts","src/cli/approvals/list.tsx","src/cli/approvals/respond.tsx","src/cli/bots/create.tsx","src/cli/bots/delete.tsx","src/cli/bots/get.tsx","src/cli/bots/list.tsx","src/cli/bots/update.tsx","src/cli/codex/bridge/respond.tsx","src/cli/codex/bridge/run.tsx","src/cli/codex/bridge/start.tsx","src/cli/codex/bridge/status.tsx","src/cli/codex/bridge/stop.tsx","src/cli/codex/desktop-shim.tsx","src/cli/codex/list-threads.tsx","src/cli/codex/queue.tsx","src/cli/codex/send.tsx","src/cli/codex/status.tsx","src/cli/codex/wait.tsx","src/cli/codex/watch.tsx","src/cli/doctor.tsx","src/cli/groups/add.tsx","src/cli/groups/create.tsx","src/cli/groups/delete.tsx","src/cli/groups/get.tsx","src/cli/groups/list.tsx","src/cli/groups/members.tsx","src/cli/groups/remove.tsx","src/cli/groups/set.tsx","src/cli/groups/update.tsx","src/cli/history.tsx","src/cli/send.tsx","src/cli/skills/add.tsx","src/cli/skills/list.tsx","src/cli/skills/remove.tsx","src/cli/thread.tsx","src/core/app-session.js","src/core/codex-bridge.js","src/core/codex/contract.js","src/core/codex/conversation.js","src/core/codex/routes.ts","src/core/commands.js","src/core/desktop-shim-bridge.js","src/core/desktop-shim.js","src/core/format.js","src/core/gateway.js","src/core/grok-approval-routes.ts","src/core/grok-approvals.js","src/core/headers.js","src/core/history.js","src/core/relay/control.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/relay/routes.ts","src/core/store.js","src/core/transcript.js","src/core/url-policy.js","src/gbot.ts"]},{"path":"INSTALL.md","sourceInputs":["agent-bundle.config.ts"]},{"path":"install.mjs","sourceInputs":["agent-bundle.config.ts"]},{"path":"mcp.json","sourceInputs":["src/mcp/grok-bot/tools/codex_send.tsx"]},{"path":"mcp/mcp-grok-bot-b8c2461e-flight.mjs","sourceInputs":["package.json","src/core/app-session.js","src/core/codex-bridge.js","src/core/codex/contract.js","src/core/codex/conversation.js","src/core/codex/routes.ts","src/core/desktop-shim-bridge.js","src/core/desktop-shim.js","src/core/gateway.js","src/core/grok-approval-routes.ts","src/core/grok-approvals.js","src/core/headers.js","src/core/relay/control.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/relay/routes.ts","src/core/store.js","src/core/transcript.js","src/core/url-policy.js","src/gbot.ts","src/mcp/grok-bot/tools/codex_send.tsx","src/mcp/grok-bot/tools/codex_threads.tsx","src/mcp/grok-bot/tools/codex_wait.tsx","src/mcp/grok-bot/tools/codex_watch.tsx","src/mcp/grok-bot/tools/gbot_bridge_start.tsx","src/mcp/grok-bot/tools/gbot_bridge_status.tsx","src/mcp/grok-bot/tools/gbot_bridge_stop.tsx","src/mcp/grok-bot/tools/gbot_codex_respond.tsx","src/mcp/grok-bot/tools/gbot_grok_approvals.tsx","src/mcp/grok-bot/tools/gbot_grok_respond.tsx","src/mcp/grok-bot/tools/gbot_send.tsx","src/mcp/grok-bot/tools/gbot_thread.tsx"]},{"path":"mcp/mcp-grok-bot-b8c2461e.mjs","sourceInputs":["package.json","src/core/app-session.js","src/core/codex-bridge.js","src/core/codex/contract.js","src/core/codex/conversation.js","src/core/codex/routes.ts","src/core/desktop-shim-bridge.js","src/core/desktop-shim.js","src/core/gateway.js","src/core/grok-approval-routes.ts","src/core/grok-approvals.js","src/core/headers.js","src/core/relay/control.js","src/core/relay/managed.js","src/core/relay/profile.js","src/core/relay/routes.ts","src/core/store.js","src/core/transcript.js","src/core/url-policy.js","src/gbot.ts","src/mcp/grok-bot/tools/codex_send.tsx","src/mcp/grok-bot/tools/codex_threads.tsx","src/mcp/grok-bot/tools/codex_wait.tsx","src/mcp/grok-bot/tools/codex_watch.tsx","src/mcp/grok-bot/tools/gbot_bridge_start.tsx","src/mcp/grok-bot/tools/gbot_bridge_status.tsx","src/mcp/grok-bot/tools/gbot_bridge_stop.tsx","src/mcp/grok-bot/tools/gbot_codex_respond.tsx","src/mcp/grok-bot/tools/gbot_grok_approvals.tsx","src/mcp/grok-bot/tools/gbot_grok_respond.tsx","src/mcp/grok-bot/tools/gbot_send.tsx","src/mcp/grok-bot/tools/gbot_thread.tsx"]},{"path":"plugin.json","sourceInputs":["agent-bundle.config.ts","package.json"]},{"path":"scripts/gbot-relay.mjs","sourceInputs":["package.json","src/core/app-session.js","src/core/codex-bridge.js","src/core/codex/contract.js","src/core/codex/conversation.js","src/core/desktop-shim-bridge.js","src/core/desktop-shim.js","src/core/gateway.js","src/core/grok-approvals.js","src/core/headers.js","src/core/relay/codex.js","src/core/relay/completion.js","src/core/relay/control.js","src/core/relay/engine.js","src/core/relay/intake.js","src/core/relay/interactions.js","src/core/relay/ownership.js","src/core/relay/profile.js","src/core/relay/records.js","src/core/relay/state.js","src/core/relay/worker.js","src/core/store.js","src/core/transcript.js","src/core/url-policy.js","src/scripts/gbot-relay.ts"]},{"path":"skills/talk-to-grok-bot/SKILL.md","sourceInputs":["src/skills/talk-to-grok-bot/SKILL.md"]}],"recordVersion":1,"validation":{"artifact":{"status":"passed"},"projections":[{"host":"claude","status":"passed"},{"host":"codex","status":"passed"},{"host":"cursor","status":"passed"},{"host":"portable","status":"passed"}],"source":{"status":"passed"}}},"distribution":{"channels":["local","npm"],"install":{"instructions":"INSTALL.md","script":"install.mjs"},"payloads":[]},"executables":{"bins":[{"hosts":["claude","codex","cursor","portable"],"name":"gbot","path":"bin/gbot.mjs","worker":"bin/gbot-flight.mjs"}],"hooks":[],"mcpServers":[{"apps":[],"hosts":["claude","codex","cursor","portable"],"id":"mcp:grok-bot","kind":"compiled","launch":{"args":[],"entry":"mcp/mcp-grok-bot-b8c2461e.mjs","env":{},"worker":"mcp/mcp-grok-bot-b8c2461e-flight.mjs"},"name":"grok-bot","transport":"stdio"}],"scripts":[{"hosts":["claude","codex","cursor","portable"],"id":"script:gbot-relay","mode":"bundle","name":"gbot-relay","path":"scripts/gbot-relay.mjs"}]},"files":[{"bytes":225,"kind":"generated","path":".agents/plugins/marketplace.json","sha256":"54d575719e003eb71ba2d7fb7379e12098243e701646e0ca83dba38ef2a78b1d"},{"bytes":729,"kind":"generated","path":".claude-plugin/marketplace.json","sha256":"c34ad145efb7252e387cb66825a2c7f28b71ec1199cc21b7a62e68f5eaf00c33"},{"bytes":199,"kind":"generated","path":".claude-plugin/plugin.json","sha256":"9f3c3ac18c027af51dec5571612a8cc1d77f4b590c216111be7ebb0a0395fce1"},{"bytes":156,"kind":"generated","path":".codex-plugin/mcp.json","sha256":"4b442017d0d30ec207cef7a4e5d2cd9dca246080008633459a27e3a5f2f7935b"},{"bytes":1015,"kind":"generated","path":".codex-plugin/plugin.json","sha256":"7089ffedb7a06970382f659207146f601723d412a0dcf81981d047557e0e04ec"},{"bytes":234,"kind":"generated","path":".cursor-plugin/marketplace.json","sha256":"c7f1a63855c76dd4680fa34c81b7e1170bb47be9bf1399dc8583b2d2d89eb9a0"},{"bytes":169,"kind":"generated","path":".cursor-plugin/mcp.json","sha256":"95c87d0f2ed3a4f6df7d0e519454b1234672eca030db3b8cd8776ef0f35dee74"},{"bytes":551,"kind":"generated","path":".cursor-plugin/plugin.json","sha256":"94693dbd9ecc58995dbb3581f8e5edfd62ea2db0e15ae49711775b4cf20f0338"},{"bytes":184,"kind":"generated","path":".mcp.json","sha256":"2539f66ffcb1c98a365f078c63122a1c25b7c7625f91314467843bde7628907b"},{"bytes":19629,"kind":"generated","path":"agent-bundle.compile-evidence.json","sha256":"b3abb91b4a15fe31bd2913fb760edf9a66f30360854902296d515cba22f83fcd"},{"bytes":1296431,"kind":"bundle","path":"bin/gbot-flight.mjs","sha256":"f0ba2b7100d1e59c002b9327ec6dcd5c25a66a0dc3024a5c7ab7c7ff9e582fea"},{"bytes":3178539,"kind":"bundle","mode":493,"path":"bin/gbot.mjs","sha256":"e83a2ddd13b75246cf8e0ccbcf27f0fd56af497e7e66ed2244caa0a9c8b3def8"},{"bytes":22663,"kind":"generated","path":"INSTALL.md","sha256":"2663aaf8d4e9f08f29e7b54704519798d130eaf849bfa01315b9341fe4e771f6"},{"bytes":78559,"kind":"generated","path":"install.mjs","sha256":"436368203a598b4de05504eb855c082c84224864c4c8ca651511e03e556aa959"},{"bytes":246,"kind":"generated","path":"mcp.json","sha256":"c06a01fa851792f42e0cc807a444e454c3ea2fd164dc1c2adef455acc93879e2"},{"bytes":1199395,"kind":"bundle","path":"mcp/mcp-grok-bot-b8c2461e-flight.mjs","sha256":"d7dbdf05896bc93357a0abd8f73730038f58dff03b6a93cdecacad912a63f909"},{"bytes":4075421,"kind":"bundle","path":"mcp/mcp-grok-bot-b8c2461e.mjs","sha256":"8ff249ab445ebf3c60adf9ee398c45a73b5c77031da1d373222dcba07539545d"},{"bytes":582,"kind":"generated","path":"plugin.json","sha256":"b623c1b69dd4674341091a90c634656f1460d08b0f051668f35c92232f89cbc0"},{"bytes":2050117,"kind":"bundle","path":"scripts/gbot-relay.mjs","sha256":"0ce92aadbd9a3c042cbb20576fa7f66574a2c8c684be46af678057699aa897b1"},{"bytes":7468,"kind":"copy","path":"skills/talk-to-grok-bot/SKILL.md","sha256":"c671dd4a6bc29defa919fffeacf105420000e287ee727217c4baea968b3834a7"}],"manifestVersion":6,"projections":[{"builtInHost":"claude","documents":{"marketplace":".claude-plugin/marketplace.json","mcp":".mcp.json","plugin":".claude-plugin/plugin.json"},"host":"claude","marketplace":{"name":"gbot-marketplace"}},{"builtInHost":"codex","documents":{"marketplace":".agents/plugins/marketplace.json","mcp":".codex-plugin/mcp.json","plugin":".codex-plugin/plugin.json"},"host":"codex","marketplace":{"name":"gbot-marketplace"}},{"builtInHost":"cursor","documents":{"marketplace":".cursor-plugin/marketplace.json","mcp":".cursor-plugin/mcp.json","plugin":".cursor-plugin/plugin.json"},"host":"cursor","marketplace":{"name":"gbot-marketplace"}},{"builtInHost":"portable","documents":{"mcp":"mcp.json","plugin":"plugin.json"},"host":"portable"}],"routes":{"cli":{"commands":[{"aliases":[],"description":"List current Grok approval cards (latest 200 entries).","exitCode":"zero","options":[{"key":"target","kind":"string","option":"target","positional":0,"repeated":false,"required":true}],"path":["approvals","list"],"routeId":"cli:approvals/list"},{"aliases":[],"description":"Explicit user decision: accept a Grok request once or decline; never grant persistent permissions.","exitCode":"zero","options":[{"choices":["accept","decline"],"key":"decision","kind":"enum","option":"decision","repeated":false,"required":true},{"key":"entryId","kind":"string","option":"entry-id","repeated":false,"required":true},{"key":"requestId","kind":"string","option":"request-id","repeated":false,"required":true},{"key":"target","kind":"string","option":"target","repeated":false,"required":true}],"path":["approvals","respond"],"routeId":"cli:approvals/respond"},{"aliases":[],"description":"Create a Grok Bot bot.","exitCode":"zero","options":[{"key":"avatarColor","kind":"string","option":"avatar-color","repeated":false,"required":false},{"key":"avatarShape","kind":"string","option":"avatar-shape","repeated":false,"required":false},{"key":"description","kind":"string","option":"description","repeated":false,"required":false},{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"key":"name","kind":"string","option":"name","repeated":false,"required":true},{"key":"title","kind":"string","option":"title","repeated":false,"required":false}],"path":["bots","create"],"routeId":"cli:bots/create"},{"aliases":[],"description":"Delete a bot or group by id or name.","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"description":"Bot or group id or name","key":"ref","kind":"string","option":"ref","positional":0,"repeated":false,"required":true}],"path":["bots","delete"],"routeId":"cli:bots/delete"},{"aliases":[],"description":"Show one bot or group by id or name.","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"description":"Bot or group id or name","key":"ref","kind":"string","option":"ref","positional":0,"repeated":false,"required":true}],"path":["bots","get"],"routeId":"cli:bots/get"},{"aliases":[],"description":"List Grok Bot bots (not groups).","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false}],"path":["bots","list"],"routeId":"cli:bots/list"},{"aliases":[],"description":"Update a bot or group profile.","exitCode":"zero","options":[{"key":"avatarColor","kind":"string","option":"avatar-color","repeated":false,"required":false},{"key":"avatarShape","kind":"string","option":"avatar-shape","repeated":false,"required":false},{"key":"description","kind":"string","option":"description","repeated":false,"required":false},{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"key":"hidden","kind":"string","option":"hidden","repeated":false,"required":false},{"key":"name","kind":"string","option":"name","repeated":false,"required":false},{"key":"notify","kind":"string","option":"notify","repeated":false,"required":false},{"description":"Bot or group id or name","key":"ref","kind":"string","option":"ref","positional":0,"repeated":false,"required":true},{"key":"title","kind":"string","option":"title","repeated":false,"required":false}],"path":["bots","update"],"routeId":"cli:bots/update"},{"aliases":[],"description":"Managed Grok/Codex bridge respond.","exitCode":"result","options":[{"description":"JSON object mapping each advertised question ID to {\"answers\":[\"answer\"]}; exact IDs required.","key":"answersJson","kind":"string","option":"answers-json","repeated":false,"required":false},{"key":"bindingId","kind":"string","option":"binding-id","repeated":false,"required":false},{"choices":["accept","decline","cancel"],"key":"decision","kind":"enum","option":"decision","repeated":false,"required":false},{"key":"exchangeId","kind":"string","option":"exchange-id","repeated":false,"required":false},{"key":"generation","kind":"string","option":"generation","repeated":false,"required":true},{"key":"interactionId","kind":"string","option":"interaction-id","repeated":false,"required":true},{"key":"threadId","kind":"string","option":"thread-id","repeated":false,"required":true},{"key":"turnId","kind":"string","option":"turn-id","repeated":false,"required":true}],"path":["codex","bridge","respond"],"routeId":"cli:codex/bridge/respond"},{"aliases":[],"description":"Run a bounded foreground relay (up to 23 hours). Use the packaged gbot-relay.mjs script for unlimited service lifetime.","exitCode":"result","options":[{"description":"Foreground lifetime in milliseconds (100..82800000; default 23h).","key":"lifetimeMs","kind":"number","option":"lifetime-ms","repeated":false,"required":false}],"path":["codex","bridge","run"],"routeId":"cli:codex/bridge/run"},{"aliases":[],"description":"Managed Grok/Codex bridge start.","exitCode":"result","options":[{"choices":["steer","reject"],"key":"busyPolicy","kind":"enum","option":"busy-policy","repeated":false,"required":false},{"key":"codexThreadId","kind":"string","option":"codex-thread-id","repeated":false,"required":false},{"key":"expectedCwd","kind":"string","option":"expected-cwd","repeated":false,"required":false},{"key":"grokTarget","kind":"string","option":"grok-target","positional":0,"repeated":false,"required":true},{"key":"requestId","kind":"string","option":"request-id","repeated":false,"required":false}],"path":["codex","bridge","start"],"routeId":"cli:codex/bridge/start"},{"aliases":[],"description":"Managed Grok/Codex bridge status.","exitCode":"result","options":[{"key":"bindingId","kind":"string","option":"binding-id","repeated":false,"required":false},{"key":"limit","kind":"number","option":"limit","repeated":false,"required":false}],"path":["codex","bridge","status"],"routeId":"cli:codex/bridge/status"},{"aliases":[],"description":"Managed Grok/Codex bridge stop.","exitCode":"result","options":[{"key":"all","kind":"boolean","option":"all","repeated":false,"required":false},{"key":"bindingId","kind":"string","option":"binding-id","repeated":false,"required":false},{"key":"worker","kind":"boolean","option":"worker","repeated":false,"required":false}],"path":["codex","bridge","stop"],"routeId":"cli:codex/bridge/stop"},{"aliases":[],"description":"Install, remove, or check the ChatGPT Desktop shim: a CODEX_CLI_PATH wrapper that bridges Desktop stdio onto the managed Codex daemon (stock app-server proxy hangs). macOS persists via LaunchAgent; always fails open to real Codex.","exitCode":"result","options":[{"choices":["install","uninstall","status"],"description":"install | uninstall | status","key":"action","kind":"enum","option":"action","positional":0,"repeated":false,"required":true}],"path":["codex","desktop-shim"],"routeId":"cli:codex/desktop-shim"},{"aliases":[],"description":"List Codex daemon-managed threads.","exitCode":"result","options":[{"description":"Opaque pagination cursor (may start with -)","key":"cursor","kind":"string","option":"cursor","repeated":false,"required":false},{"description":"Max threads to list (1-200)","key":"limit","kind":"number","option":"limit","repeated":false,"required":false}],"path":["codex","list-threads"],"routeId":"cli:codex/list-threads"},{"aliases":[],"description":"List the experimental Codex thread queue (GROK_BOT_CODEX_EXPERIMENTAL=1).","exitCode":"result","options":[{"key":"threadId","kind":"string","option":"thread-id","positional":0,"repeated":false,"required":true}],"path":["codex","queue"],"routeId":"cli:codex/queue"},{"aliases":[],"description":"Send to Codex; acceptance is distinct from completion. Options precede threadId.","exitCode":"result","options":[{"key":"bindingId","kind":"string","option":"binding-id","repeated":false,"required":false},{"key":"correlationId","kind":"string","option":"correlation-id","repeated":false,"required":false},{"key":"envelope","kind":"boolean","option":"envelope","repeated":false,"required":false},{"key":"expectedCwd","kind":"string","option":"expected-cwd","repeated":false,"required":false},{"description":"Required active-turn guard for steer; stale guards reject.","key":"expectedTurnId","kind":"string","option":"expected-turn-id","repeated":false,"required":false},{"key":"hop","kind":"number","option":"hop","repeated":false,"required":false},{"description":"Reply budget: 1-4194304 bytes.","key":"maxOutputBytes","kind":"number","option":"max-output-bytes","repeated":false,"required":false},{"key":"message","kind":"string","option":"message","positional":1,"repeated":true,"required":true},{"key":"replyTo","kind":"string","option":"reply-to","repeated":false,"required":false},{"key":"replyToGrok","kind":"string","option":"reply-to-grok","repeated":false,"required":false},{"key":"requestId","kind":"string","option":"request-id","repeated":false,"required":false},{"key":"threadId","kind":"string","option":"thread-id","positional":0,"repeated":false,"required":true},{"description":"Observation timeout: 1-600000 milliseconds.","key":"timeoutMs","kind":"number","option":"timeout-ms","repeated":false,"required":false},{"key":"wait","kind":"boolean","option":"wait","repeated":false,"required":false},{"choices":["reject","queue","steer"],"key":"whenBusy","kind":"enum","option":"when-busy","repeated":false,"required":false}],"path":["codex","send"],"routeId":"cli:codex/send"},{"aliases":[],"description":"Probe the local Codex app-server daemon. Exit 0 only when it is usable.","exitCode":"result","options":[],"path":["codex","status"],"routeId":"cli:codex/status"},{"aliases":[],"description":"Bounded Codex wait observation; never interrupts execution.","exitCode":"result","options":[{"key":"expectedCwd","kind":"string","option":"expected-cwd","repeated":false,"required":false},{"description":"Reply budget: 1-4194304 bytes.","key":"maxOutputBytes","kind":"number","option":"max-output-bytes","repeated":false,"required":false},{"key":"messageId","kind":"string","option":"message-id","repeated":false,"required":false},{"key":"threadId","kind":"string","option":"thread-id","positional":0,"repeated":false,"required":true},{"description":"Observation timeout: 1-600000 milliseconds.","key":"timeoutMs","kind":"number","option":"timeout-ms","repeated":false,"required":false},{"key":"turnId","kind":"string","option":"turn-id","positional":1,"repeated":false,"required":true}],"path":["codex","wait"],"routeId":"cli:codex/wait"},{"aliases":[],"description":"Bounded Codex watch observation; never interrupts execution.","exitCode":"result","options":[{"key":"expectedCwd","kind":"string","option":"expected-cwd","repeated":false,"required":false},{"description":"Maximum observed events: 1-500.","key":"maxEvents","kind":"number","option":"max-events","repeated":false,"required":false},{"key":"threadId","kind":"string","option":"thread-id","positional":0,"repeated":false,"required":true},{"description":"Observation timeout: 1-600000 milliseconds.","key":"timeoutMs","kind":"number","option":"timeout-ms","repeated":false,"required":false}],"path":["codex","watch"],"routeId":"cli:codex/watch"},{"aliases":[],"description":"Show which agents root and auth sources gbot can see.","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false}],"path":["doctor"],"routeId":"cli:doctor"},{"aliases":[],"description":"Add a bot to a group.","exitCode":"zero","options":[{"key":"bot","kind":"string","option":"bot","positional":1,"repeated":false,"required":true},{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"key":"group","kind":"string","option":"group","positional":0,"repeated":false,"required":true}],"path":["groups","add"],"routeId":"cli:groups/add"},{"aliases":[],"description":"Create a Grok Bot group.","exitCode":"zero","options":[{"key":"avatarColor","kind":"string","option":"avatar-color","repeated":false,"required":false},{"key":"avatarShape","kind":"string","option":"avatar-shape","repeated":false,"required":false},{"key":"description","kind":"string","option":"description","repeated":false,"required":false},{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"description":"Member bot id or name (repeatable)","key":"member","kind":"string","option":"member","repeated":true,"required":true},{"key":"name","kind":"string","option":"name","repeated":false,"required":true},{"key":"title","kind":"string","option":"title","repeated":false,"required":false}],"path":["groups","create"],"routeId":"cli:groups/create"},{"aliases":[],"description":"Delete a group by id or name.","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"description":"Group id or name","key":"ref","kind":"string","option":"ref","positional":0,"repeated":false,"required":true}],"path":["groups","delete"],"routeId":"cli:groups/delete"},{"aliases":[],"description":"Show one group by id or name.","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"description":"Group id or name","key":"ref","kind":"string","option":"ref","positional":0,"repeated":false,"required":true}],"path":["groups","get"],"routeId":"cli:groups/get"},{"aliases":[],"description":"List Grok Bot groups.","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false}],"path":["groups","list"],"routeId":"cli:groups/list"},{"aliases":[],"description":"Show members of a group (same payload as groups get).","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"description":"Group id or name","key":"ref","kind":"string","option":"ref","positional":0,"repeated":false,"required":true}],"path":["groups","members"],"routeId":"cli:groups/members"},{"aliases":[],"description":"Remove a bot from a group.","exitCode":"zero","options":[{"key":"bot","kind":"string","option":"bot","positional":1,"repeated":false,"required":true},{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"key":"group","kind":"string","option":"group","positional":0,"repeated":false,"required":true}],"path":["groups","remove"],"routeId":"cli:groups/remove"},{"aliases":[],"description":"Replace a group's member list.","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"key":"group","kind":"string","option":"group","positional":0,"repeated":false,"required":true},{"description":"Member bot id or name (repeatable)","key":"member","kind":"string","option":"member","repeated":true,"required":true}],"path":["groups","set"],"routeId":"cli:groups/set"},{"aliases":[],"description":"Update a group profile (members stay on set/add/remove).","exitCode":"zero","options":[{"key":"avatarColor","kind":"string","option":"avatar-color","repeated":false,"required":false},{"key":"avatarShape","kind":"string","option":"avatar-shape","repeated":false,"required":false},{"key":"description","kind":"string","option":"description","repeated":false,"required":false},{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"key":"hidden","kind":"string","option":"hidden","repeated":false,"required":false},{"key":"name","kind":"string","option":"name","repeated":false,"required":false},{"key":"notify","kind":"string","option":"notify","repeated":false,"required":false},{"description":"Group id or name","key":"ref","kind":"string","option":"ref","positional":0,"repeated":false,"required":true},{"key":"title","kind":"string","option":"title","repeated":false,"required":false}],"path":["groups","update"],"routeId":"cli:groups/update"},{"aliases":[],"description":"Read the opt-in local JSONL history without contacting the gateway.","exitCode":"zero","options":[{"description":"Directory containing history.jsonl","key":"historyDir","kind":"string","option":"history-dir","repeated":false,"required":false},{"description":"Maximum matching rows (1 or more)","key":"limit","kind":"number","option":"limit","repeated":false,"required":false},{"description":"Print the history file path","key":"path","kind":"boolean","option":"path","repeated":false,"required":false},{"description":"Bot or group id or name","key":"ref","kind":"string","option":"ref","positional":0,"repeated":false,"required":false},{"description":"Case-insensitive message text filter","key":"search","kind":"string","option":"search","repeated":false,"required":false}],"path":["history"],"routeId":"cli:history"},{"aliases":[],"description":"Send a message to a Grok Bot bot or group by name or id.","exitCode":"result","options":[{"key":"bindingId","kind":"string","option":"binding-id","repeated":false,"required":false},{"key":"codexThreadId","kind":"string","option":"codex-thread-id","repeated":false,"required":false},{"description":"Stable correlation id for multi-hop replies","key":"correlationId","kind":"string","option":"correlation-id","repeated":false,"required":false},{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Prepend the [gbot …] header","key":"envelope","kind":"boolean","option":"envelope","repeated":false,"required":false},{"key":"expectedCwd","kind":"string","option":"expected-cwd","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"description":"Directory containing history.jsonl","key":"historyDir","kind":"string","option":"history-dir","repeated":false,"required":false},{"description":"Hop count; refused at GROK_BOT_MAX_HOPS","key":"hop","kind":"number","option":"hop","repeated":false,"required":false},{"key":"message","kind":"string","option":"message","positional":1,"repeated":true,"required":true},{"description":"Skip local history for this command","key":"noHistory","kind":"boolean","option":"no-history","repeated":false,"required":false},{"choices":["auto","manual"],"key":"replyMode","kind":"enum","option":"reply-mode","repeated":false,"required":false},{"description":"Prior message id this send replies to","key":"replyTo","kind":"string","option":"reply-to","repeated":false,"required":false},{"key":"requestId","kind":"string","option":"request-id","repeated":false,"required":false},{"key":"target","kind":"string","option":"target","positional":0,"repeated":false,"required":true}],"path":["send"],"routeId":"cli:send"},{"aliases":[],"description":"Add a SKILL.md to the shared skill library. Every bot sees it.","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"description":"SKILL.md file, or a directory holding one","key":"path","kind":"string","option":"path","positional":0,"repeated":false,"required":true}],"path":["skills","add"],"routeId":"cli:skills/add"},{"aliases":[],"description":"List the skill library every bot in this Grok Bot shares.","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false}],"path":["skills","list"],"routeId":"cli:skills/list"},{"aliases":[],"description":"Remove a library skill by id or name. Every bot loses it.","exitCode":"zero","options":[{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"description":"Skill id or name","key":"skill","kind":"string","option":"skill","positional":0,"repeated":false,"required":true}],"path":["skills","remove"],"routeId":"cli:skills/remove"},{"aliases":[],"description":"Read the most recent messages in a Grok Bot bot or group thread.","exitCode":"zero","options":[{"description":"Return entries after this opaque entry id","key":"after","kind":"string","option":"after","repeated":false,"required":false},{"description":"Agents directory for --files mode","key":"dir","kind":"string","option":"dir","repeated":false,"required":false},{"description":"Force the on-disk agents store","key":"files","kind":"boolean","option":"files","repeated":false,"required":false},{"description":"Show full entry text in human output","key":"full","kind":"boolean","option":"full","repeated":false,"required":false},{"description":"Force the live gateway","key":"gateway","kind":"boolean","option":"gateway","repeated":false,"required":false},{"description":"Directory containing history.jsonl","key":"historyDir","kind":"string","option":"history-dir","repeated":false,"required":false},{"description":"How many trailing entries to return (1-200)","key":"limit","kind":"number","option":"limit","repeated":false,"required":false},{"description":"Skip local history for this command","key":"noHistory","kind":"boolean","option":"no-history","repeated":false,"required":false},{"description":"Read one rooted thread by message id","key":"root","kind":"string","option":"root","repeated":false,"required":false},{"key":"target","kind":"string","option":"target","positional":0,"repeated":false,"required":true}],"path":["thread"],"routeId":"cli:thread"}],"mode":"generated","routes":[{"contract":"contract:src/cli/approvals/list.tsx#inputJsonSchema","description":"List current Grok approval cards (latest 200 entries).","id":"cli:approvals/list","inputSchema":{"additionalProperties":false,"properties":{"target":{"type":"string"}},"required":["target"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/approvals/list.tsx"},{"contract":"contract:src/cli/approvals/respond.tsx#inputJsonSchema","description":"Explicit user decision: accept a Grok request once or decline; never grant persistent permissions.","id":"cli:approvals/respond","inputSchema":{"additionalProperties":false,"properties":{"decision":{"enum":["accept","decline"],"type":"string"},"entryId":{"type":"string"},"requestId":{"type":"string"},"target":{"type":"string"}},"required":["target","entryId","requestId","decision"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/approvals/respond.tsx"},{"contract":"contract:src/cli/bots/create.tsx#inputJsonSchema","description":"Create a Grok Bot bot.","id":"cli:bots/create","inputSchema":{"additionalProperties":false,"properties":{"avatarColor":{"type":"string"},"avatarShape":{"type":"string"},"description":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"name":{"type":"string"},"title":{"type":"string"}},"required":["name"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/bots/create.tsx"},{"contract":"contract:src/cli/bots/delete.tsx#inputJsonSchema","description":"Delete a bot or group by id or name.","id":"cli:bots/delete","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"ref":{"description":"Bot or group id or name","type":"string"}},"required":["ref"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/bots/delete.tsx"},{"contract":"contract:src/cli/bots/get.tsx#inputJsonSchema","description":"Show one bot or group by id or name.","id":"cli:bots/get","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"ref":{"description":"Bot or group id or name","type":"string"}},"required":["ref"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/bots/get.tsx"},{"contract":"contract:src/cli/bots/list.tsx#inputJsonSchema","description":"List Grok Bot bots (not groups).","id":"cli:bots/list","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"}},"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/bots/list.tsx"},{"contract":"contract:src/cli/bots/update.tsx#inputJsonSchema","description":"Update a bot or group profile.","id":"cli:bots/update","inputSchema":{"additionalProperties":false,"properties":{"avatarColor":{"type":"string"},"avatarShape":{"type":"string"},"description":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"hidden":{"type":"string"},"name":{"type":"string"},"notify":{"type":"string"},"ref":{"description":"Bot or group id or name","type":"string"},"title":{"type":"string"}},"required":["ref"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/bots/update.tsx"},{"contract":"contract:src/cli/codex/bridge/respond.tsx#inputJsonSchema","description":"Managed Grok/Codex bridge respond.","id":"cli:codex/bridge/respond","inputSchema":{"additionalProperties":false,"properties":{"answersJson":{"description":"JSON object mapping each advertised question ID to {\"answers\":[\"answer\"]}; exact IDs required.","type":"string"},"bindingId":{"type":"string"},"decision":{"enum":["accept","decline","cancel"],"type":"string"},"exchangeId":{"type":"string"},"generation":{"type":"string"},"interactionId":{"type":"string"},"threadId":{"type":"string"},"turnId":{"type":"string"}},"required":["interactionId","generation","threadId","turnId"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/bridge/respond.tsx"},{"contract":"contract:src/cli/codex/bridge/run.tsx#inputJsonSchema","description":"Run a bounded foreground relay (up to 23 hours). Use the packaged gbot-relay.mjs script for unlimited service lifetime.","id":"cli:codex/bridge/run","inputSchema":{"additionalProperties":false,"properties":{"lifetimeMs":{"description":"Foreground lifetime in milliseconds (100..82800000; default 23h).","type":"number"}},"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/bridge/run.tsx"},{"contract":"contract:src/cli/codex/bridge/start.tsx#inputJsonSchema","description":"Managed Grok/Codex bridge start.","id":"cli:codex/bridge/start","inputSchema":{"additionalProperties":false,"properties":{"busyPolicy":{"enum":["steer","reject"],"type":"string"},"codexThreadId":{"type":"string"},"expectedCwd":{"type":"string"},"grokTarget":{"type":"string"},"requestId":{"type":"string"}},"required":["grokTarget"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/bridge/start.tsx"},{"contract":"contract:src/cli/codex/bridge/status.tsx#inputJsonSchema","description":"Managed Grok/Codex bridge status.","id":"cli:codex/bridge/status","inputSchema":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"limit":{"type":"number"}},"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/bridge/status.tsx"},{"contract":"contract:src/cli/codex/bridge/stop.tsx#inputJsonSchema","description":"Managed Grok/Codex bridge stop.","id":"cli:codex/bridge/stop","inputSchema":{"additionalProperties":false,"properties":{"all":{"type":"boolean"},"bindingId":{"type":"string"},"worker":{"type":"boolean"}},"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/bridge/stop.tsx"},{"contract":"contract:src/cli/codex/desktop-shim.tsx#inputJsonSchema","description":"Install, remove, or check the ChatGPT Desktop shim: a CODEX_CLI_PATH wrapper that bridges Desktop stdio onto the managed Codex daemon (stock app-server proxy hangs). macOS persists via LaunchAgent; always fails open to real Codex.","id":"cli:codex/desktop-shim","inputSchema":{"additionalProperties":false,"properties":{"action":{"description":"install | uninstall | status","enum":["install","uninstall","status"],"type":"string"}},"required":["action"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/desktop-shim.tsx"},{"contract":"contract:src/cli/codex/list-threads.tsx#inputJsonSchema","description":"List Codex daemon-managed threads.","id":"cli:codex/list-threads","inputSchema":{"additionalProperties":false,"properties":{"cursor":{"description":"Opaque pagination cursor (may start with -)","type":"string"},"limit":{"default":20,"description":"Max threads to list (1-200)","type":"number"}},"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/list-threads.tsx"},{"contract":"contract:src/cli/codex/queue.tsx#inputJsonSchema","description":"List the experimental Codex thread queue (GROK_BOT_CODEX_EXPERIMENTAL=1).","id":"cli:codex/queue","inputSchema":{"additionalProperties":false,"properties":{"threadId":{"type":"string"}},"required":["threadId"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/queue.tsx"},{"contract":"contract:src/cli/codex/send.tsx#inputJsonSchema","description":"Send to Codex; acceptance is distinct from completion. Options precede threadId.","id":"cli:codex/send","inputSchema":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"correlationId":{"type":"string"},"envelope":{"type":"boolean"},"expectedCwd":{"type":"string"},"expectedTurnId":{"description":"Required active-turn guard for steer; stale guards reject.","type":"string"},"hop":{"type":"number"},"maxOutputBytes":{"description":"Reply budget: 1-4194304 bytes.","type":"number"},"message":{"items":{"type":"string"},"type":"array"},"replyTo":{"type":"string"},"replyToGrok":{"type":"string"},"requestId":{"type":"string"},"threadId":{"type":"string"},"timeoutMs":{"description":"Observation timeout: 1-600000 milliseconds.","type":"number"},"wait":{"type":"boolean"},"whenBusy":{"enum":["reject","queue","steer"],"type":"string"}},"required":["threadId","message"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/send.tsx"},{"contract":"contract:src/cli/codex/status.tsx#inputJsonSchema","description":"Probe the local Codex app-server daemon. Exit 0 only when it is usable.","id":"cli:codex/status","inputSchema":{"additionalProperties":false,"properties":{},"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/status.tsx"},{"contract":"contract:src/cli/codex/wait.tsx#inputJsonSchema","description":"Bounded Codex wait observation; never interrupts execution.","id":"cli:codex/wait","inputSchema":{"additionalProperties":false,"properties":{"expectedCwd":{"type":"string"},"maxOutputBytes":{"description":"Reply budget: 1-4194304 bytes.","type":"number"},"messageId":{"type":"string"},"threadId":{"type":"string"},"timeoutMs":{"description":"Observation timeout: 1-600000 milliseconds.","type":"number"},"turnId":{"type":"string"}},"required":["threadId","turnId"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/wait.tsx"},{"contract":"contract:src/cli/codex/watch.tsx#inputJsonSchema","description":"Bounded Codex watch observation; never interrupts execution.","id":"cli:codex/watch","inputSchema":{"additionalProperties":false,"properties":{"expectedCwd":{"type":"string"},"maxEvents":{"description":"Maximum observed events: 1-500.","type":"number"},"threadId":{"type":"string"},"timeoutMs":{"description":"Observation timeout: 1-600000 milliseconds.","type":"number"}},"required":["threadId"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/codex/watch.tsx"},{"contract":"contract:src/cli/doctor.tsx#inputJsonSchema","description":"Show which agents root and auth sources gbot can see.","id":"cli:doctor","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"}},"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/doctor.tsx"},{"contract":"contract:src/cli/groups/add.tsx#inputJsonSchema","description":"Add a bot to a group.","id":"cli:groups/add","inputSchema":{"additionalProperties":false,"properties":{"bot":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"group":{"type":"string"}},"required":["group","bot"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/groups/add.tsx"},{"contract":"contract:src/cli/groups/create.tsx#inputJsonSchema","description":"Create a Grok Bot group.","id":"cli:groups/create","inputSchema":{"additionalProperties":false,"properties":{"avatarColor":{"type":"string"},"avatarShape":{"type":"string"},"description":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"member":{"description":"Member bot id or name (repeatable)","items":{"type":"string"},"type":"array"},"name":{"type":"string"},"title":{"type":"string"}},"required":["name","member"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/groups/create.tsx"},{"contract":"contract:src/cli/groups/delete.tsx#inputJsonSchema","description":"Delete a group by id or name.","id":"cli:groups/delete","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"ref":{"description":"Group id or name","type":"string"}},"required":["ref"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/groups/delete.tsx"},{"contract":"contract:src/cli/groups/get.tsx#inputJsonSchema","description":"Show one group by id or name.","id":"cli:groups/get","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"ref":{"description":"Group id or name","type":"string"}},"required":["ref"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/groups/get.tsx"},{"contract":"contract:src/cli/groups/list.tsx#inputJsonSchema","description":"List Grok Bot groups.","id":"cli:groups/list","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"}},"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/groups/list.tsx"},{"contract":"contract:src/cli/groups/members.tsx#inputJsonSchema","description":"Show members of a group (same payload as groups get).","id":"cli:groups/members","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"ref":{"description":"Group id or name","type":"string"}},"required":["ref"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/groups/members.tsx"},{"contract":"contract:src/cli/groups/remove.tsx#inputJsonSchema","description":"Remove a bot from a group.","id":"cli:groups/remove","inputSchema":{"additionalProperties":false,"properties":{"bot":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"group":{"type":"string"}},"required":["group","bot"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/groups/remove.tsx"},{"contract":"contract:src/cli/groups/set.tsx#inputJsonSchema","description":"Replace a group's member list.","id":"cli:groups/set","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"group":{"type":"string"},"member":{"description":"Member bot id or name (repeatable)","items":{"type":"string"},"type":"array"}},"required":["group","member"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/groups/set.tsx"},{"contract":"contract:src/cli/groups/update.tsx#inputJsonSchema","description":"Update a group profile (members stay on set/add/remove).","id":"cli:groups/update","inputSchema":{"additionalProperties":false,"properties":{"avatarColor":{"type":"string"},"avatarShape":{"type":"string"},"description":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"hidden":{"type":"string"},"name":{"type":"string"},"notify":{"type":"string"},"ref":{"description":"Group id or name","type":"string"},"title":{"type":"string"}},"required":["ref"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/groups/update.tsx"},{"contract":"contract:src/cli/history.tsx#inputJsonSchema","description":"Read the opt-in local JSONL history without contacting the gateway.","id":"cli:history","inputSchema":{"additionalProperties":false,"properties":{"historyDir":{"description":"Directory containing history.jsonl","type":"string"},"limit":{"default":40,"description":"Maximum matching rows (1 or more)","type":"number"},"path":{"description":"Print the history file path","type":"boolean"},"ref":{"description":"Bot or group id or name","type":"string"},"search":{"description":"Case-insensitive message text filter","type":"string"}},"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/history.tsx"},{"contract":"contract:src/cli/send.tsx#inputJsonSchema","description":"Send a message to a Grok Bot bot or group by name or id.","id":"cli:send","inputSchema":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"codexThreadId":{"type":"string"},"correlationId":{"description":"Stable correlation id for multi-hop replies","type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"envelope":{"description":"Prepend the [gbot …] header","type":"boolean"},"expectedCwd":{"type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"historyDir":{"description":"Directory containing history.jsonl","type":"string"},"hop":{"description":"Hop count; refused at GROK_BOT_MAX_HOPS","type":"number"},"message":{"items":{"type":"string"},"type":"array"},"noHistory":{"description":"Skip local history for this command","type":"boolean"},"replyMode":{"enum":["auto","manual"],"type":"string"},"replyTo":{"description":"Prior message id this send replies to","type":"string"},"requestId":{"type":"string"},"target":{"type":"string"}},"required":["target","message"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/send.tsx"},{"contract":"contract:src/cli/skills/add.tsx#inputJsonSchema","description":"Add a SKILL.md to the shared skill library. Every bot sees it.","id":"cli:skills/add","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"path":{"description":"SKILL.md file, or a directory holding one","type":"string"}},"required":["path"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/skills/add.tsx"},{"contract":"contract:src/cli/skills/list.tsx#inputJsonSchema","description":"List the skill library every bot in this Grok Bot shares.","id":"cli:skills/list","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"}},"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/skills/list.tsx"},{"contract":"contract:src/cli/skills/remove.tsx#inputJsonSchema","description":"Remove a library skill by id or name. Every bot loses it.","id":"cli:skills/remove","inputSchema":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"skill":{"description":"Skill id or name","type":"string"}},"required":["skill"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/skills/remove.tsx"},{"contract":"contract:src/cli/thread.tsx#inputJsonSchema","description":"Read the most recent messages in a Grok Bot bot or group thread.","id":"cli:thread","inputSchema":{"additionalProperties":false,"properties":{"after":{"description":"Return entries after this opaque entry id","type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"full":{"description":"Show full entry text in human output","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"historyDir":{"description":"Directory containing history.jsonl","type":"string"},"limit":{"default":40,"description":"How many trailing entries to return (1-200)","type":"number"},"noHistory":{"description":"Skip local history for this command","type":"boolean"},"root":{"description":"Read one rooted thread by message id","type":"string"},"target":{"type":"string"}},"required":["target"],"type":"object"},"kind":"cli","provenance":{"kind":"conventional"},"source":"src/cli/thread.tsx"}]},"contracts":[{"id":"contract:src/cli/approvals/list.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"target":{"type":"string"}},"required":["target"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/approvals/list.tsx"},"routes":["cli:approvals/list"]},{"id":"contract:src/cli/approvals/respond.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"decision":{"enum":["accept","decline"],"type":"string"},"entryId":{"type":"string"},"requestId":{"type":"string"},"target":{"type":"string"}},"required":["target","entryId","requestId","decision"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/approvals/respond.tsx"},"routes":["cli:approvals/respond"]},{"id":"contract:src/cli/bots/create.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"avatarColor":{"type":"string"},"avatarShape":{"type":"string"},"description":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"name":{"type":"string"},"title":{"type":"string"}},"required":["name"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/bots/create.tsx"},"routes":["cli:bots/create"]},{"id":"contract:src/cli/bots/delete.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"ref":{"description":"Bot or group id or name","type":"string"}},"required":["ref"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/bots/delete.tsx"},"routes":["cli:bots/delete"]},{"id":"contract:src/cli/bots/get.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"ref":{"description":"Bot or group id or name","type":"string"}},"required":["ref"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/bots/get.tsx"},"routes":["cli:bots/get"]},{"id":"contract:src/cli/bots/list.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"}},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/bots/list.tsx"},"routes":["cli:bots/list"]},{"id":"contract:src/cli/bots/update.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"avatarColor":{"type":"string"},"avatarShape":{"type":"string"},"description":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"hidden":{"type":"string"},"name":{"type":"string"},"notify":{"type":"string"},"ref":{"description":"Bot or group id or name","type":"string"},"title":{"type":"string"}},"required":["ref"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/bots/update.tsx"},"routes":["cli:bots/update"]},{"id":"contract:src/cli/codex/bridge/respond.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"answersJson":{"description":"JSON object mapping each advertised question ID to {\"answers\":[\"answer\"]}; exact IDs required.","type":"string"},"bindingId":{"type":"string"},"decision":{"enum":["accept","decline","cancel"],"type":"string"},"exchangeId":{"type":"string"},"generation":{"type":"string"},"interactionId":{"type":"string"},"threadId":{"type":"string"},"turnId":{"type":"string"}},"required":["interactionId","generation","threadId","turnId"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/bridge/respond.tsx"},"routes":["cli:codex/bridge/respond"]},{"id":"contract:src/cli/codex/bridge/run.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"lifetimeMs":{"description":"Foreground lifetime in milliseconds (100..82800000; default 23h).","type":"number"}},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/bridge/run.tsx"},"routes":["cli:codex/bridge/run"]},{"id":"contract:src/cli/codex/bridge/start.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"busyPolicy":{"enum":["steer","reject"],"type":"string"},"codexThreadId":{"type":"string"},"expectedCwd":{"type":"string"},"grokTarget":{"type":"string"},"requestId":{"type":"string"}},"required":["grokTarget"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/bridge/start.tsx"},"routes":["cli:codex/bridge/start"]},{"id":"contract:src/cli/codex/bridge/status.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"limit":{"type":"number"}},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/bridge/status.tsx"},"routes":["cli:codex/bridge/status"]},{"id":"contract:src/cli/codex/bridge/stop.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"all":{"type":"boolean"},"bindingId":{"type":"string"},"worker":{"type":"boolean"}},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/bridge/stop.tsx"},"routes":["cli:codex/bridge/stop"]},{"id":"contract:src/cli/codex/desktop-shim.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"action":{"description":"install | uninstall | status","enum":["install","uninstall","status"],"type":"string"}},"required":["action"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/desktop-shim.tsx"},"routes":["cli:codex/desktop-shim"]},{"id":"contract:src/cli/codex/list-threads.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"cursor":{"description":"Opaque pagination cursor (may start with -)","type":"string"},"limit":{"default":20,"description":"Max threads to list (1-200)","type":"number"}},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/list-threads.tsx"},"routes":["cli:codex/list-threads"]},{"id":"contract:src/cli/codex/queue.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"threadId":{"type":"string"}},"required":["threadId"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/queue.tsx"},"routes":["cli:codex/queue"]},{"id":"contract:src/cli/codex/send.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"correlationId":{"type":"string"},"envelope":{"type":"boolean"},"expectedCwd":{"type":"string"},"expectedTurnId":{"description":"Required active-turn guard for steer; stale guards reject.","type":"string"},"hop":{"type":"number"},"maxOutputBytes":{"description":"Reply budget: 1-4194304 bytes.","type":"number"},"message":{"items":{"type":"string"},"type":"array"},"replyTo":{"type":"string"},"replyToGrok":{"type":"string"},"requestId":{"type":"string"},"threadId":{"type":"string"},"timeoutMs":{"description":"Observation timeout: 1-600000 milliseconds.","type":"number"},"wait":{"type":"boolean"},"whenBusy":{"enum":["reject","queue","steer"],"type":"string"}},"required":["threadId","message"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/send.tsx"},"routes":["cli:codex/send"]},{"id":"contract:src/cli/codex/status.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/status.tsx"},"routes":["cli:codex/status"]},{"id":"contract:src/cli/codex/wait.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"expectedCwd":{"type":"string"},"maxOutputBytes":{"description":"Reply budget: 1-4194304 bytes.","type":"number"},"messageId":{"type":"string"},"threadId":{"type":"string"},"timeoutMs":{"description":"Observation timeout: 1-600000 milliseconds.","type":"number"},"turnId":{"type":"string"}},"required":["threadId","turnId"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/wait.tsx"},"routes":["cli:codex/wait"]},{"id":"contract:src/cli/codex/watch.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"expectedCwd":{"type":"string"},"maxEvents":{"description":"Maximum observed events: 1-500.","type":"number"},"threadId":{"type":"string"},"timeoutMs":{"description":"Observation timeout: 1-600000 milliseconds.","type":"number"}},"required":["threadId"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/codex/watch.tsx"},"routes":["cli:codex/watch"]},{"id":"contract:src/cli/doctor.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"}},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/doctor.tsx"},"routes":["cli:doctor"]},{"id":"contract:src/cli/groups/add.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"bot":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"group":{"type":"string"}},"required":["group","bot"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/groups/add.tsx"},"routes":["cli:groups/add"]},{"id":"contract:src/cli/groups/create.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"avatarColor":{"type":"string"},"avatarShape":{"type":"string"},"description":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"member":{"description":"Member bot id or name (repeatable)","items":{"type":"string"},"type":"array"},"name":{"type":"string"},"title":{"type":"string"}},"required":["name","member"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/groups/create.tsx"},"routes":["cli:groups/create"]},{"id":"contract:src/cli/groups/delete.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"ref":{"description":"Group id or name","type":"string"}},"required":["ref"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/groups/delete.tsx"},"routes":["cli:groups/delete"]},{"id":"contract:src/cli/groups/get.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"ref":{"description":"Group id or name","type":"string"}},"required":["ref"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/groups/get.tsx"},"routes":["cli:groups/get"]},{"id":"contract:src/cli/groups/list.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"}},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/groups/list.tsx"},"routes":["cli:groups/list"]},{"id":"contract:src/cli/groups/members.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"ref":{"description":"Group id or name","type":"string"}},"required":["ref"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/groups/members.tsx"},"routes":["cli:groups/members"]},{"id":"contract:src/cli/groups/remove.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"bot":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"group":{"type":"string"}},"required":["group","bot"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/groups/remove.tsx"},"routes":["cli:groups/remove"]},{"id":"contract:src/cli/groups/set.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"group":{"type":"string"},"member":{"description":"Member bot id or name (repeatable)","items":{"type":"string"},"type":"array"}},"required":["group","member"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/groups/set.tsx"},"routes":["cli:groups/set"]},{"id":"contract:src/cli/groups/update.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"avatarColor":{"type":"string"},"avatarShape":{"type":"string"},"description":{"type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"hidden":{"type":"string"},"name":{"type":"string"},"notify":{"type":"string"},"ref":{"description":"Group id or name","type":"string"},"title":{"type":"string"}},"required":["ref"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/groups/update.tsx"},"routes":["cli:groups/update"]},{"id":"contract:src/cli/history.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"historyDir":{"description":"Directory containing history.jsonl","type":"string"},"limit":{"default":40,"description":"Maximum matching rows (1 or more)","type":"number"},"path":{"description":"Print the history file path","type":"boolean"},"ref":{"description":"Bot or group id or name","type":"string"},"search":{"description":"Case-insensitive message text filter","type":"string"}},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/history.tsx"},"routes":["cli:history"]},{"id":"contract:src/cli/send.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"codexThreadId":{"type":"string"},"correlationId":{"description":"Stable correlation id for multi-hop replies","type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"envelope":{"description":"Prepend the [gbot …] header","type":"boolean"},"expectedCwd":{"type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"historyDir":{"description":"Directory containing history.jsonl","type":"string"},"hop":{"description":"Hop count; refused at GROK_BOT_MAX_HOPS","type":"number"},"message":{"items":{"type":"string"},"type":"array"},"noHistory":{"description":"Skip local history for this command","type":"boolean"},"replyMode":{"enum":["auto","manual"],"type":"string"},"replyTo":{"description":"Prior message id this send replies to","type":"string"},"requestId":{"type":"string"},"target":{"type":"string"}},"required":["target","message"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/send.tsx"},"routes":["cli:send"]},{"id":"contract:src/cli/skills/add.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"path":{"description":"SKILL.md file, or a directory holding one","type":"string"}},"required":["path"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/skills/add.tsx"},"routes":["cli:skills/add"]},{"id":"contract:src/cli/skills/list.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"}},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/skills/list.tsx"},"routes":["cli:skills/list"]},{"id":"contract:src/cli/skills/remove.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"skill":{"description":"Skill id or name","type":"string"}},"required":["skill"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/skills/remove.tsx"},"routes":["cli:skills/remove"]},{"id":"contract:src/cli/thread.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"after":{"description":"Return entries after this opaque entry id","type":"string"},"dir":{"description":"Agents directory for --files mode","type":"string"},"files":{"description":"Force the on-disk agents store","type":"boolean"},"full":{"description":"Show full entry text in human output","type":"boolean"},"gateway":{"description":"Force the live gateway","type":"boolean"},"historyDir":{"description":"Directory containing history.jsonl","type":"string"},"limit":{"default":40,"description":"How many trailing entries to return (1-200)","type":"number"},"noHistory":{"description":"Skip local history for this command","type":"boolean"},"root":{"description":"Read one rooted thread by message id","type":"string"},"target":{"type":"string"}},"required":["target"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/cli/thread.tsx"},"routes":["cli:thread"]},{"id":"contract:src/mcp/grok-bot/tools/codex_send.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"correlationId":{"type":"string"},"envelope":{"type":"boolean"},"expectedCwd":{"type":"string"},"expectedTurnId":{"type":"string"},"hop":{"type":"number"},"maxOutputBytes":{"type":"number"},"message":{"type":"string"},"replyTo":{"type":"string"},"replyToGrok":{"type":"string"},"requestId":{"type":"string"},"threadId":{"type":"string"},"timeoutMs":{"type":"number"},"wait":{"default":false,"type":"boolean"},"whenBusy":{"enum":["reject","queue","steer"],"type":"string"}},"required":["threadId","message"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/codex_send.tsx"},"routes":["tool:grok-bot/codex_send"]},{"id":"contract:src/mcp/grok-bot/tools/codex_threads.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"cursor":{"type":"string"},"limit":{"description":"Maximum threads in this page: 1-200.","type":"number"}},"required":[],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/codex_threads.tsx"},"routes":["tool:grok-bot/codex_threads"]},{"id":"contract:src/mcp/grok-bot/tools/codex_wait.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"expectedCwd":{"type":"string"},"maxOutputBytes":{"description":"Reply budget: 1-4194304 bytes.","type":"number"},"messageId":{"type":"string"},"threadId":{"type":"string"},"timeoutMs":{"description":"Observation timeout: 1-600000 milliseconds.","type":"number"},"turnId":{"type":"string"}},"required":["threadId","turnId"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/codex_wait.tsx"},"routes":["tool:grok-bot/codex_wait"]},{"id":"contract:src/mcp/grok-bot/tools/codex_watch.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"expectedCwd":{"type":"string"},"maxEvents":{"description":"Maximum observed events: 1-500.","type":"number"},"threadId":{"type":"string"},"timeoutMs":{"description":"Observation timeout: 1-600000 milliseconds.","type":"number"}},"required":["threadId"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/codex_watch.tsx"},"routes":["tool:grok-bot/codex_watch"]},{"id":"contract:src/mcp/grok-bot/tools/gbot_bridge_start.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"busyPolicy":{"enum":["steer","reject"],"type":"string"},"codexThreadId":{"type":"string"},"expectedCwd":{"type":"string"},"grokTarget":{"type":"string"},"requestId":{"type":"string"}},"required":["grokTarget"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/gbot_bridge_start.tsx"},"routes":["tool:grok-bot/gbot_bridge_start"]},{"id":"contract:src/mcp/grok-bot/tools/gbot_bridge_status.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"limit":{"type":"number"}},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/gbot_bridge_status.tsx"},"routes":["tool:grok-bot/gbot_bridge_status"]},{"id":"contract:src/mcp/grok-bot/tools/gbot_bridge_stop.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"all":{"type":"boolean"},"bindingId":{"type":"string"},"worker":{"type":"boolean"}},"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/gbot_bridge_stop.tsx"},"routes":["tool:grok-bot/gbot_bridge_stop"]},{"id":"contract:src/mcp/grok-bot/tools/gbot_codex_respond.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"answersJson":{"description":"JSON object mapping each advertised question ID to {\"answers\":[\"answer\"]}; exact IDs required.","type":"string"},"bindingId":{"type":"string"},"decision":{"enum":["accept","decline","cancel"],"type":"string"},"exchangeId":{"type":"string"},"generation":{"type":"string"},"interactionId":{"type":"string"},"threadId":{"type":"string"},"turnId":{"type":"string"}},"required":["interactionId","generation","threadId","turnId"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/gbot_codex_respond.tsx"},"routes":["tool:grok-bot/gbot_codex_respond"]},{"id":"contract:src/mcp/grok-bot/tools/gbot_grok_approvals.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"target":{"type":"string"}},"required":["target"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/gbot_grok_approvals.tsx"},"routes":["tool:grok-bot/gbot_grok_approvals"]},{"id":"contract:src/mcp/grok-bot/tools/gbot_grok_respond.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"decision":{"enum":["accept","decline"],"type":"string"},"entryId":{"type":"string"},"requestId":{"type":"string"},"target":{"type":"string"}},"required":["target","entryId","requestId","decision"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/gbot_grok_respond.tsx"},"routes":["tool:grok-bot/gbot_grok_respond"]},{"id":"contract:src/mcp/grok-bot/tools/gbot_send.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"codexThreadId":{"type":"string"},"correlationId":{"type":"string"},"expectedCwd":{"type":"string"},"hop":{"description":"Explicit chain hop count, refused at the configured bound.","type":"number"},"message":{"type":"string"},"replyMode":{"enum":["auto","manual"],"type":"string"},"requestId":{"type":"string"},"target":{"type":"string"}},"required":["target","message"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/gbot_send.tsx"},"routes":["tool:grok-bot/gbot_send"]},{"id":"contract:src/mcp/grok-bot/tools/gbot_thread.tsx#inputJsonSchema","input":{"additionalProperties":false,"properties":{"after":{"description":"Opaque cursor from the previous call. Returns entries strictly after it; an unknown cursor resets with a bounded snapshot.","type":"string"},"full":{"default":false,"description":"Return entries with text up to bounded budgets (20k chars per entry, 200k total). Every entry reports truncated/fullLength; read any remainder with `gbot thread --full` / `--json` on the machine.","type":"boolean"},"limit":{"default":40,"description":"How many trailing entries to inspect (1-200). Entries are returned only with full:true.","type":"number"},"target":{"description":"Bot or group name or id, for example \"General\".","type":"string"}},"required":["target"],"type":"object"},"origin":{"binding":"inputJsonSchema","module":"src/mcp/grok-bot/tools/gbot_thread.tsx"},"routes":["tool:grok-bot/gbot_thread"]}],"digest":"2ca82f243db8390590ba51a27b27dafd9050e415ce2cef09b135b41e65629e76","events":[],"layouts":[],"providers":[],"scripts":[{"id":"script:gbot-relay","kind":"script","provenance":{"kind":"conventional"},"source":"src/scripts/gbot-relay.ts"}],"servers":[{"id":"mcp:grok-bot","mode":"generated","name":"grok-bot","routes":[{"contract":"contract:src/mcp/grok-bot/tools/codex_send.tsx#inputJsonSchema","description":"Send to Codex. With replyToGrok or bindingId, managed delivery returns the terminal answer to Grok automatically. Otherwise optional wait observes completion and explicit steer requires expectedTurnId. Acceptance is not completion.","id":"tool:grok-bot/codex_send","inputSchema":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"correlationId":{"type":"string"},"envelope":{"type":"boolean"},"expectedCwd":{"type":"string"},"expectedTurnId":{"type":"string"},"hop":{"type":"number"},"maxOutputBytes":{"type":"number"},"message":{"type":"string"},"replyTo":{"type":"string"},"replyToGrok":{"type":"string"},"requestId":{"type":"string"},"threadId":{"type":"string"},"timeoutMs":{"type":"number"},"wait":{"default":false,"type":"boolean"},"whenBusy":{"enum":["reject","queue","steer"],"type":"string"}},"required":["threadId","message"],"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/codex_send.tsx"},{"contract":"contract:src/mcp/grok-bot/tools/codex_threads.tsx#inputJsonSchema","description":"Discover a bounded page of Codex daemon threads.","id":"tool:grok-bot/codex_threads","inputSchema":{"additionalProperties":false,"properties":{"cursor":{"type":"string"},"limit":{"description":"Maximum threads in this page: 1-200.","type":"number"}},"required":[],"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/codex_threads.tsx"},{"contract":"contract:src/mcp/grok-bot/tools/codex_wait.tsx#inputJsonSchema","description":"Explicit diagnostic observation of one Codex turn; returns execution and final reply without interrupting it.","id":"tool:grok-bot/codex_wait","inputSchema":{"additionalProperties":false,"properties":{"expectedCwd":{"type":"string"},"maxOutputBytes":{"description":"Reply budget: 1-4194304 bytes.","type":"number"},"messageId":{"type":"string"},"threadId":{"type":"string"},"timeoutMs":{"description":"Observation timeout: 1-600000 milliseconds.","type":"number"},"turnId":{"type":"string"}},"required":["threadId","turnId"],"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/codex_wait.tsx"},{"contract":"contract:src/mcp/grok-bot/tools/codex_watch.tsx#inputJsonSchema","description":"Watch bounded Codex thread events for diagnostics without answering approvals.","id":"tool:grok-bot/codex_watch","inputSchema":{"additionalProperties":false,"properties":{"expectedCwd":{"type":"string"},"maxEvents":{"description":"Maximum observed events: 1-500.","type":"number"},"threadId":{"type":"string"},"timeoutMs":{"description":"Observation timeout: 1-600000 milliseconds.","type":"number"}},"required":["threadId"],"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/codex_watch.tsx"},{"contract":"contract:src/mcp/grok-bot/tools/gbot_bridge_start.tsx#inputJsonSchema","description":"Link a Grok conversation to Codex once. New visible Grok messages arrive automatically and Codex final answers return to Grok.","id":"tool:grok-bot/gbot_bridge_start","inputSchema":{"additionalProperties":false,"properties":{"busyPolicy":{"enum":["steer","reject"],"type":"string"},"codexThreadId":{"type":"string"},"expectedCwd":{"type":"string"},"grokTarget":{"type":"string"},"requestId":{"type":"string"}},"required":["grokTarget"],"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/gbot_bridge_start.tsx"},{"contract":"contract:src/mcp/grok-bot/tools/gbot_bridge_status.tsx#inputJsonSchema","description":"Inspect worker health, route coverage, bounded receipts and scoped pending operator interactions.","id":"tool:grok-bot/gbot_bridge_status","inputSchema":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"limit":{"type":"number"}},"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/gbot_bridge_status.tsx"},{"contract":"contract:src/mcp/grok-bot/tools/gbot_bridge_stop.tsx#inputJsonSchema","description":"Stop a binding without deleting receipts or interrupting Codex. all stops all bindings; worker explicitly shuts down the worker.","id":"tool:grok-bot/gbot_bridge_stop","inputSchema":{"additionalProperties":false,"properties":{"all":{"type":"boolean"},"bindingId":{"type":"string"},"worker":{"type":"boolean"}},"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/gbot_bridge_stop.tsx"},{"contract":"contract:src/mcp/grok-bot/tools/gbot_codex_respond.tsx#inputJsonSchema","description":"Explicit operator response to a current scoped Codex interaction. Supports only one-time accept/decline/cancel or exact question-ID answers. Never auto-approve.","id":"tool:grok-bot/gbot_codex_respond","inputSchema":{"additionalProperties":false,"properties":{"answersJson":{"description":"JSON object mapping each advertised question ID to {\"answers\":[\"answer\"]}; exact IDs required.","type":"string"},"bindingId":{"type":"string"},"decision":{"enum":["accept","decline","cancel"],"type":"string"},"exchangeId":{"type":"string"},"generation":{"type":"string"},"interactionId":{"type":"string"},"threadId":{"type":"string"},"turnId":{"type":"string"}},"required":["interactionId","generation","threadId","turnId"],"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/gbot_codex_respond.tsx"},{"contract":"contract:src/mcp/grok-bot/tools/gbot_grok_approvals.tsx#inputJsonSchema","description":"List pending auto-review and local-tool approval cards in the latest 200 entries for a Grok bot. Older or unsupported requests require the owning Grok UI.","id":"tool:grok-bot/gbot_grok_approvals","inputSchema":{"additionalProperties":false,"properties":{"target":{"type":"string"}},"required":["target"],"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/gbot_grok_approvals.tsx"},{"contract":"contract:src/mcp/grok-bot/tools/gbot_grok_respond.tsx#inputJsonSchema","description":"Only after an explicit user decision: accept one current Grok approval once or decline it. Exact target, entryId and approval requestId required. Never auto-approve or grant persistent permissions. Success acknowledges response delivery, not execution.","id":"tool:grok-bot/gbot_grok_respond","inputSchema":{"additionalProperties":false,"properties":{"decision":{"enum":["accept","decline"],"type":"string"},"entryId":{"type":"string"},"requestId":{"type":"string"},"target":{"type":"string"}},"required":["target","entryId","requestId","decision"],"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/gbot_grok_respond.tsx"},{"contract":"contract:src/mcp/grok-bot/tools/gbot_send.tsx#inputJsonSchema","description":"Send to Grok Bot. Native Codex calls automatically receive replies in their originating thread; send once and continue work. Without a native source, supply codexThreadId or use manual gbot_thread reading.","id":"tool:grok-bot/gbot_send","inputSchema":{"additionalProperties":false,"properties":{"bindingId":{"type":"string"},"codexThreadId":{"type":"string"},"correlationId":{"type":"string"},"expectedCwd":{"type":"string"},"hop":{"description":"Explicit chain hop count, refused at the configured bound.","type":"number"},"message":{"type":"string"},"replyMode":{"enum":["auto","manual"],"type":"string"},"requestId":{"type":"string"},"target":{"type":"string"}},"required":["target","message"],"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/gbot_send.tsx"},{"contract":"contract:src/mcp/grok-bot/tools/gbot_thread.tsx#inputJsonSchema","description":"Read a bounded Grok Bot thread tail. Returns a small receipt by default; pass the last cursor as after for an exclusive client-side delta, or full:true to include bounded entry text.","id":"tool:grok-bot/gbot_thread","inputSchema":{"additionalProperties":false,"properties":{"after":{"description":"Opaque cursor from the previous call. Returns entries strictly after it; an unknown cursor resets with a bounded snapshot.","type":"string"},"full":{"default":false,"description":"Return entries with text up to bounded budgets (20k chars per entry, 200k total). Every entry reports truncated/fullLength; read any remainder with `gbot thread --full` / `--json` on the machine.","type":"boolean"},"limit":{"default":40,"description":"How many trailing entries to inspect (1-200). Entries are returned only with full:true.","type":"number"},"target":{"description":"Bot or group name or id, for example \"General\".","type":"string"}},"required":["target"],"type":"object"},"kind":"tool","provenance":{"kind":"conventional"},"serverId":"mcp:grok-bot","source":"src/mcp/grok-bot/tools/gbot_thread.tsx"}]}]},"runtime":{"node":"22.19.0"}} diff --git a/artifact/bin/gbot-flight.mjs b/artifact/bin/gbot-flight.mjs index 9bb6af2..d3d3212 100644 --- a/artifact/bin/gbot-flight.mjs +++ b/artifact/bin/gbot-flight.mjs @@ -13564,9 +13564,9 @@ const config = { }; async function route({ input }) { const out = await (0,_core_grok_approval_routes_js__rspack_import_1/* .listOperation */.gi)(input); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -13624,9 +13624,9 @@ const config = { }; async function route({ input }) { const out = await (0,_core_grok_approval_routes_js__rspack_import_1/* .respondOperation */.lr)(input); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -13698,9 +13698,9 @@ async function botsCreate({ input }) { const { dir: _d, files: _f, gateway: _g, ...fields } = input; const rec = await backend.createAgent((0,_shared_js__rspack_import_1/* .toCreateInput */.cp)(fields)); if (rec == null) throw new Error('createAgent returned no record'); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_3/* .summarize */.eh)(rec), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Text */.g.Text, { children: `Created bot ${rec.name} (${rec.id})` }) }); @@ -13766,9 +13766,9 @@ const resultSchema = _shared_js__rspack_import_1/* .agentSummarySchema */.t_; async function botsDelete({ input }) { const backend = await (0,_shared_js__rspack_import_1/* .openBackendFromInput */.FS)(input); const rec = await backend.deleteAgent(input.ref); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: `Deleted ${rec.isGroup ? 'group' : 'bot'} ${rec.name} (${rec.id})` }) }); @@ -13835,9 +13835,9 @@ async function botsGet({ input }) { const backend = await (0,_shared_js__rspack_import_1/* .openBackendFromInput */.FS)(input); const rec = await backend.resolve(input.ref); const all = await backend.list(); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: (0,_core_format_js__rspack_import_4/* .formatRecord */.bM)(rec, all) }) }); @@ -13894,9 +13894,9 @@ async function botsList({ input }) { const rows = all.filter((r)=>!r.isGroup); const bots = rows.map(_core_format_js__rspack_import_3/* .summarize */.eh); const text = rows.length === 0 ? 'No bots.' : rows.map((r)=>(0,_core_format_js__rspack_import_3/* .formatRecord */.bM)(r, all)).join('\n\n'); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: bots, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: text }) }); @@ -13984,9 +13984,9 @@ async function botsUpdate({ input }) { const backend = await (0,_shared_js__rspack_import_1/* .openBackendFromInput */.FS)(input); const { dir: _d, files: _f, gateway: _g, ref, ...fields } = input; const rec = await backend.updateAgent(ref, (0,_shared_js__rspack_import_1/* .toUpdatePatch */.li)(fields)); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: `Updated ${rec.isGroup ? 'group' : 'bot'} ${rec.name} (${rec.id})` }) }); @@ -14070,9 +14070,9 @@ async function route({ input }) { } catch (error) { out = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error); } - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -14161,12 +14161,12 @@ async function route({ signal, input }) { } finally{ signal.removeEventListener('abort', stop); } - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g.Result, { value: { state: 'stopped', exitCode }, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g.Text, { children: "Relay worker stopped." }) }); @@ -14239,9 +14239,9 @@ async function route({ input }) { } catch (error) { out = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error); } - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -14295,9 +14295,9 @@ async function route({ input }) { } catch (error) { out = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error); } - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -14354,9 +14354,9 @@ async function route({ input }) { } catch (error) { out = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error); } - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -14432,21 +14432,21 @@ async function codexDesktopShim({ input }) { out = (0,_core_desktop_shim_js__rspack_import_1/* .installDesktopShim */.B0)(); } catch (error) { const message = error instanceof Error ? error.message : String(error); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: { action: 'install', error: message, exitCode: 1 }, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: `Desktop shim install failed: ${message}` }) }); } const text = `Installed ChatGPT Desktop shim:\n` + ` wrapper: ${out.wrapperPath}\n` + ` bridge: ${out.bridgePath}\n` + ` login env: ${out.envScriptPath}` + (out.plistPath ? `\n LaunchAgent: ${out.plistPath}` : '\n LaunchAgent: n/a (macOS-only)') + `\nFully quit and relaunch ChatGPT.app so it inherits CODEX_CLI_PATH; ` + `Desktop falls back to stock Codex if the shim is ever removed.` + formatWarnings(out.warnings); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: text }) }); @@ -14458,22 +14458,22 @@ async function codexDesktopShim({ input }) { out = (0,_core_desktop_shim_js__rspack_import_1/* .uninstallDesktopShim */.gM)(); } catch (error) { const message = error instanceof Error ? error.message : String(error); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: { action: 'uninstall', error: message, exitCode: 1 }, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: `Desktop shim uninstall failed: ${message}` }) }); } const removed = out.removed.length === 0 ? '(nothing installed)' : out.removed.join(', '); const text = `Removed ChatGPT Desktop shim: ${removed}. ` + `Desktop and Codex fall back to stock behavior; relaunch ChatGPT.app to pick it up.` + formatWarnings(out.warnings); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: text }) }); @@ -14481,9 +14481,9 @@ async function codexDesktopShim({ input }) { case 'status': { const out = (0,_core_desktop_shim_js__rspack_import_1/* .desktopShimStatus */.em)(); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: (0,_core_format_js__rspack_import_4/* .formatDesktopShimStatus */.fX)(out) }) }); @@ -14563,21 +14563,21 @@ async function codexListThreads({ input }) { }); } catch (error) { const failure = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g.Result, { value: failure, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g.Text, { children: failure.error }) }); } const more = out.nextCursor ? `\n\nmore: --cursor ${JSON.stringify((0,_core_codex_bridge_js__rspack_import_1/* .singleLine */.pF)(out.nextCursor))}` : ''; const text = out.threads.length === 0 ? 'No Codex threads.' : out.threads.map(_core_format_js__rspack_import_6/* .formatCodexThread */.nz).join('\n\n') + more; - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g.Result, { value: { ...out, exitCode: 0 }, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g.Text, { children: text }) }); @@ -14650,19 +14650,19 @@ async function codexQueue({ input }) { out = await (0,_core_codex_bridge_js__rspack_import_1/* .listCodexQueue */.Bt)(input.threadId); } catch (error) { const failure = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g.Result, { value: failure, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g.Text, { children: failure.error }) }); } - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g.Result, { value: { ...out, exitCode: 0 }, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g.Text, { children: (0,_core_format_js__rspack_import_6/* .formatCodexQueue */.e_)(out) }) }); @@ -14793,12 +14793,12 @@ async function route({ input, signal }) { ...input, message: input.message.join(' ').trim() }, context); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g.Result, { value: { ...out, exitCode: out.delivery === 'rejected' ? 1 : 0 }, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g.Text, { children: `Delivery ${out.delivery}; terminal answer returns to Grok automatically.` }) }); @@ -14810,9 +14810,9 @@ async function route({ input, signal }) { }, signal, (message)=>context.progress.report({ message }), true); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g.Text, { children: (0,_core_codex_routes_js__rspack_import_1/* .resultText */.D6)(out) }) }); @@ -14858,9 +14858,9 @@ const resultSchema = zod__rspack_import_2/* .object */.Ikc({ }).passthrough(); async function codexStatusCmd(_props) { const status = await (0,_core_codex_bridge_js__rspack_import_1/* .codexStatus */.MU)(); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: status, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: (0,_core_format_js__rspack_import_4/* .formatCodexStatus */.P2)(status) }) }); @@ -14932,9 +14932,9 @@ async function route({ input, signal }) { const out = await (0,_core_codex_routes_js__rspack_import_1/* .observeOperation */.gT)('wait', input, signal, (message)=>context.progress.report({ message })); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: (0,_core_codex_routes_js__rspack_import_1/* .resultText */.D6)(out) }) }); @@ -14998,9 +14998,9 @@ async function route({ input, signal }) { const out = await (0,_core_codex_routes_js__rspack_import_1/* .observeOperation */.gT)('watch', input, signal, (message)=>context.progress.report({ message })); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: (0,_core_codex_routes_js__rspack_import_1/* .resultText */.D6)(out) }) }); @@ -15103,9 +15103,9 @@ async function doctor({ input }) { ...candidates.map((c)=>` ${c}`), note ].join('\n'); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Result */.g.Result, { value: value, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Text */.g.Text, { children: text }) }); @@ -15176,9 +15176,9 @@ const resultSchema = _shared_js__rspack_import_1/* .agentSummarySchema */.t_; async function groupsAdd({ input }) { const backend = await (0,_shared_js__rspack_import_1/* .openBackendFromInput */.FS)(input); const rec = await backend.addGroupMember(input.group, input.bot); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: `Added to ${rec.name}. Members: ${rec.memberIds.length}` }) }); @@ -15264,9 +15264,9 @@ async function groupsCreate({ input }) { ...(0,_shared_js__rspack_import_1/* .toCreateInput */.cp)(fields), memberIds: member }); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: `Created group ${rec.name} (${rec.id}) with ${rec.memberIds.length} members` }) }); @@ -15334,9 +15334,9 @@ async function groupsDelete({ input }) { const rec = await backend.resolve(input.ref); if (!rec.isGroup) throw new Error(`"${rec.name}" is a bot, not a group. Use bots delete.`); const deleted = await backend.deleteAgent(input.ref); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(deleted), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: `Deleted group ${deleted.name} (${deleted.id})` }) }); @@ -15404,9 +15404,9 @@ async function groupsGet({ input }) { const rec = await backend.resolve(input.ref); if (!rec.isGroup) throw new Error(`"${rec.name}" is a bot, not a group.`); const all = await backend.list(); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: (0,_core_format_js__rspack_import_4/* .formatRecord */.bM)(rec, all) }) }); @@ -15463,9 +15463,9 @@ async function groupsList({ input }) { const rows = all.filter((r)=>r.isGroup); const groups = rows.map(_core_format_js__rspack_import_3/* .summarize */.eh); const text = rows.length === 0 ? 'No groups.' : rows.map((r)=>(0,_core_format_js__rspack_import_3/* .formatRecord */.bM)(r, all)).join('\n\n'); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: groups, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: text }) }); @@ -15533,9 +15533,9 @@ async function groupsMembers({ input }) { const rec = await backend.resolve(input.ref); if (!rec.isGroup) throw new Error(`"${rec.name}" is a bot, not a group.`); const all = await backend.list(); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: (0,_core_format_js__rspack_import_4/* .formatRecord */.bM)(rec, all) }) }); @@ -15606,9 +15606,9 @@ const resultSchema = _shared_js__rspack_import_1/* .agentSummarySchema */.t_; async function groupsRemove({ input }) { const backend = await (0,_shared_js__rspack_import_1/* .openBackendFromInput */.FS)(input); const rec = await backend.removeGroupMember(input.group, input.bot); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: `Removed from ${rec.name}. Members: ${rec.memberIds.length}` }) }); @@ -15682,9 +15682,9 @@ const resultSchema = _shared_js__rspack_import_1/* .agentSummarySchema */.t_; async function groupsSet({ input }) { const backend = await (0,_shared_js__rspack_import_1/* .openBackendFromInput */.FS)(input); const rec = await backend.setGroupMembers(input.group, input.member); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: `Updated ${rec.name}. Members: ${rec.memberIds.length}` }) }); @@ -15774,9 +15774,9 @@ async function groupsUpdate({ input }) { if (!current.isGroup) throw new Error(`"${current.name}" is a bot, not a group. Use bots update.`); const { dir: _d, files: _f, gateway: _g, ref, ...fields } = input; const rec = await backend.updateAgent(ref, (0,_shared_js__rspack_import_1/* .toUpdatePatch */.li)(fields)); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: `Updated group ${rec.name} (${rec.id})` }) }); @@ -15852,11 +15852,11 @@ const resultSchema = zod__rspack_import_2/* .union */.KCZ([ async function history({ input }) { const file = (0,_core_history_js__rspack_import_1/* .historyPath */.ae)(input.historyDir); if (input.path) { - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: { path: file }, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: file }) }); @@ -15867,9 +15867,9 @@ async function history({ input }) { search: input.search }); const text = rows.length ? rows.map((row)=>`[${row.recordedAt}] ${row.target.name} (${row.target.id}) [${row.role}] ${row.text}`).join('\n') : 'No local history.'; - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: rows, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: text }) }); @@ -16079,12 +16079,12 @@ async function send({ input }) { hop: input.hop, correlationId: input.correlationId }, await (0,_agent_bundle_runtime__rspack_import_7/* .agent */.MA)()); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Result */.g.Result, { value: { ...out, exitCode: out.delivery === 'rejected' ? 1 : 0 }, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Text */.g.Text, { children: `Delivery ${out.delivery}; inspect codex bridge status for automatic reply delivery.` }) }); @@ -16094,9 +16094,9 @@ async function send({ input }) { value = (0,_core_codex_contract_js__rspack_import_3/* .outcomeFromError */.DG)(error); } const text = value.exitCode === 0 ? `Sent to ${value.kind} ${value.name} (${value.id})${value.messageId ? ` message ${value.messageId}` : ''}; envelope ${value.envelopeId}` : value.error; - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Result */.g.Result, { value: value, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Text */.g.Text, { children: text }) }); @@ -16169,9 +16169,9 @@ async function skillsAdd({ input }) { const markdown = await (0,node_fs_promises__rspack_import_1.readFile)(await skillFile(input.path), 'utf8'); const backend = await (0,_shared_js__rspack_import_3/* .openBackendFromInput */.FS)(input); const skill = resultSchema.parse(await backend.addSkill(markdown)); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g.Result, { value: skill, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g.Text, { children: `Added skill ${skill.name} (${skill.id}) to the shared library` }) }); @@ -16224,9 +16224,9 @@ async function skillsList({ input }) { const backend = await (0,_shared_js__rspack_import_1/* .openBackendFromInput */.FS)(input); const skills = resultSchema.parse(await backend.skills()); const lines = skills.map((s)=>`${s.id} ${s.name} [${s.source}]${s.description ? ` ${s.description}` : ''}`); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: skills, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: lines.length > 0 ? lines.join('\n') : 'No skills.' }) }); @@ -16290,9 +16290,9 @@ const resultSchema = _shared_js__rspack_import_1/* .skillSchema */.b7; async function skillsRemove({ input }) { const backend = await (0,_shared_js__rspack_import_1/* .openBackendFromInput */.FS)(input); const skill = resultSchema.parse(await backend.removeSkill(input.skill)); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: skill, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: `Removed skill ${skill.name} (${skill.id}) from the shared library` }) }); @@ -16399,9 +16399,9 @@ async function thread({ input }) { event: 'thread', rootId: input.root }); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: rooted, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: (0,_core_format_js__rspack_import_5/* .formatTranscript */.oZ)(rooted, { full: input.full }) @@ -16431,9 +16431,9 @@ async function thread({ input }) { const text = (0,_core_format_js__rspack_import_5/* .formatTranscript */.oZ)(selected, { full: input.full }); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: selected, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: `${text}\n\ncursor: ${delta.cursor}${delta.gapReset ? ' (gap reset)' : ''}` }) }); @@ -16443,9 +16443,9 @@ async function thread({ input }) { disabled: input.noHistory, event: 'thread' }); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: (0,_core_format_js__rspack_import_5/* .formatTranscript */.oZ)(out, { full: input.full }) @@ -17415,50 +17415,11 @@ const Agent = Object.freeze({ Result: AgentResult, Text: AgentText }); -const Result = ({ children })=>createElement('agent-hook-result', null, children); -const AdditionalContext = ({ children })=>createElement('agent-hook-additional-context', null, children); -const Hook = (/* unused pure expression or super */ null && ({ - AdditionalContext: AdditionalContext, - Result: Result -})); -const McpResult = ({ _meta, children, isError, structuredContent })=>createElement('mcp-result', { - _meta, - isError, - structuredContent - }, children); -const McpText = ({ children })=>createElement('mcp-text', null, children); -const McpImage = ({ data, mimeType })=>createElement('mcp-image', { - data, - mimeType - }); -const McpAudio = ({ data, mimeType })=>createElement('mcp-audio', { - data, - mimeType - }); -const McpResourceLink = ({ mimeType, name, uri })=>createElement('mcp-resource-link', { - mimeType, - name, - uri - }); -const McpEmbeddedResource = ({ blob, children, mimeType, text, uri })=>createElement('mcp-embedded-resource', { - blob, - mimeType, - text, - uri - }, children); -const Mcp = (/* unused pure expression or super */ null && ({ - Audio: McpAudio, - EmbeddedResource: McpEmbeddedResource, - Image: McpImage, - ResourceLink: McpResourceLink, - Result: McpResult, - Text: McpText -})); __webpack_require__.d(__webpack_exports__, { }, { - g6: Agent + g: Agent }); @@ -32455,116 +32416,116 @@ var __webpack_exports__ = {}; /* import */ var _agent_bundle_runtime__rspack_import_38 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/49.js"); /* import */ var _agent_bundle_runtime__rspack_import_39 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js"); /* import */ var node_url__rspack_import_2 = __webpack_require__("node:url"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_approvals_list_tsx__rspack_import_3 = __webpack_require__("./src/cli/approvals/list.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_approvals_respond_tsx__rspack_import_4 = __webpack_require__("./src/cli/approvals/respond.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_bots_create_tsx__rspack_import_5 = __webpack_require__("./src/cli/bots/create.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_bots_delete_tsx__rspack_import_6 = __webpack_require__("./src/cli/bots/delete.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_bots_get_tsx__rspack_import_7 = __webpack_require__("./src/cli/bots/get.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_bots_list_tsx__rspack_import_8 = __webpack_require__("./src/cli/bots/list.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_bots_update_tsx__rspack_import_9 = __webpack_require__("./src/cli/bots/update.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_bridge_respond_tsx__rspack_import_10 = __webpack_require__("./src/cli/codex/bridge/respond.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_bridge_run_tsx__rspack_import_11 = __webpack_require__("./src/cli/codex/bridge/run.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_bridge_start_tsx__rspack_import_12 = __webpack_require__("./src/cli/codex/bridge/start.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_bridge_status_tsx__rspack_import_13 = __webpack_require__("./src/cli/codex/bridge/status.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_bridge_stop_tsx__rspack_import_14 = __webpack_require__("./src/cli/codex/bridge/stop.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_desktop_shim_tsx__rspack_import_15 = __webpack_require__("./src/cli/codex/desktop-shim.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_list_threads_tsx__rspack_import_16 = __webpack_require__("./src/cli/codex/list-threads.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_queue_tsx__rspack_import_17 = __webpack_require__("./src/cli/codex/queue.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_send_tsx__rspack_import_18 = __webpack_require__("./src/cli/codex/send.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_status_tsx__rspack_import_19 = __webpack_require__("./src/cli/codex/status.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_wait_tsx__rspack_import_20 = __webpack_require__("./src/cli/codex/wait.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_watch_tsx__rspack_import_21 = __webpack_require__("./src/cli/codex/watch.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_doctor_tsx__rspack_import_22 = __webpack_require__("./src/cli/doctor.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_groups_add_tsx__rspack_import_23 = __webpack_require__("./src/cli/groups/add.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_groups_create_tsx__rspack_import_24 = __webpack_require__("./src/cli/groups/create.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_groups_delete_tsx__rspack_import_25 = __webpack_require__("./src/cli/groups/delete.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_groups_get_tsx__rspack_import_26 = __webpack_require__("./src/cli/groups/get.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_groups_list_tsx__rspack_import_27 = __webpack_require__("./src/cli/groups/list.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_groups_members_tsx__rspack_import_28 = __webpack_require__("./src/cli/groups/members.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_groups_remove_tsx__rspack_import_29 = __webpack_require__("./src/cli/groups/remove.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_groups_set_tsx__rspack_import_30 = __webpack_require__("./src/cli/groups/set.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_groups_update_tsx__rspack_import_31 = __webpack_require__("./src/cli/groups/update.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_history_tsx__rspack_import_32 = __webpack_require__("./src/cli/history.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_send_tsx__rspack_import_33 = __webpack_require__("./src/cli/send.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_skills_add_tsx__rspack_import_34 = __webpack_require__("./src/cli/skills/add.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_skills_list_tsx__rspack_import_35 = __webpack_require__("./src/cli/skills/list.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_skills_remove_tsx__rspack_import_36 = __webpack_require__("./src/cli/skills/remove.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_thread_tsx__rspack_import_37 = __webpack_require__("./src/cli/thread.tsx"); +/* import */ var _src_cli_approvals_list_tsx__rspack_import_3 = __webpack_require__("./src/cli/approvals/list.tsx"); +/* import */ var _src_cli_approvals_respond_tsx__rspack_import_4 = __webpack_require__("./src/cli/approvals/respond.tsx"); +/* import */ var _src_cli_bots_create_tsx__rspack_import_5 = __webpack_require__("./src/cli/bots/create.tsx"); +/* import */ var _src_cli_bots_delete_tsx__rspack_import_6 = __webpack_require__("./src/cli/bots/delete.tsx"); +/* import */ var _src_cli_bots_get_tsx__rspack_import_7 = __webpack_require__("./src/cli/bots/get.tsx"); +/* import */ var _src_cli_bots_list_tsx__rspack_import_8 = __webpack_require__("./src/cli/bots/list.tsx"); +/* import */ var _src_cli_bots_update_tsx__rspack_import_9 = __webpack_require__("./src/cli/bots/update.tsx"); +/* import */ var _src_cli_codex_bridge_respond_tsx__rspack_import_10 = __webpack_require__("./src/cli/codex/bridge/respond.tsx"); +/* import */ var _src_cli_codex_bridge_run_tsx__rspack_import_11 = __webpack_require__("./src/cli/codex/bridge/run.tsx"); +/* import */ var _src_cli_codex_bridge_start_tsx__rspack_import_12 = __webpack_require__("./src/cli/codex/bridge/start.tsx"); +/* import */ var _src_cli_codex_bridge_status_tsx__rspack_import_13 = __webpack_require__("./src/cli/codex/bridge/status.tsx"); +/* import */ var _src_cli_codex_bridge_stop_tsx__rspack_import_14 = __webpack_require__("./src/cli/codex/bridge/stop.tsx"); +/* import */ var _src_cli_codex_desktop_shim_tsx__rspack_import_15 = __webpack_require__("./src/cli/codex/desktop-shim.tsx"); +/* import */ var _src_cli_codex_list_threads_tsx__rspack_import_16 = __webpack_require__("./src/cli/codex/list-threads.tsx"); +/* import */ var _src_cli_codex_queue_tsx__rspack_import_17 = __webpack_require__("./src/cli/codex/queue.tsx"); +/* import */ var _src_cli_codex_send_tsx__rspack_import_18 = __webpack_require__("./src/cli/codex/send.tsx"); +/* import */ var _src_cli_codex_status_tsx__rspack_import_19 = __webpack_require__("./src/cli/codex/status.tsx"); +/* import */ var _src_cli_codex_wait_tsx__rspack_import_20 = __webpack_require__("./src/cli/codex/wait.tsx"); +/* import */ var _src_cli_codex_watch_tsx__rspack_import_21 = __webpack_require__("./src/cli/codex/watch.tsx"); +/* import */ var _src_cli_doctor_tsx__rspack_import_22 = __webpack_require__("./src/cli/doctor.tsx"); +/* import */ var _src_cli_groups_add_tsx__rspack_import_23 = __webpack_require__("./src/cli/groups/add.tsx"); +/* import */ var _src_cli_groups_create_tsx__rspack_import_24 = __webpack_require__("./src/cli/groups/create.tsx"); +/* import */ var _src_cli_groups_delete_tsx__rspack_import_25 = __webpack_require__("./src/cli/groups/delete.tsx"); +/* import */ var _src_cli_groups_get_tsx__rspack_import_26 = __webpack_require__("./src/cli/groups/get.tsx"); +/* import */ var _src_cli_groups_list_tsx__rspack_import_27 = __webpack_require__("./src/cli/groups/list.tsx"); +/* import */ var _src_cli_groups_members_tsx__rspack_import_28 = __webpack_require__("./src/cli/groups/members.tsx"); +/* import */ var _src_cli_groups_remove_tsx__rspack_import_29 = __webpack_require__("./src/cli/groups/remove.tsx"); +/* import */ var _src_cli_groups_set_tsx__rspack_import_30 = __webpack_require__("./src/cli/groups/set.tsx"); +/* import */ var _src_cli_groups_update_tsx__rspack_import_31 = __webpack_require__("./src/cli/groups/update.tsx"); +/* import */ var _src_cli_history_tsx__rspack_import_32 = __webpack_require__("./src/cli/history.tsx"); +/* import */ var _src_cli_send_tsx__rspack_import_33 = __webpack_require__("./src/cli/send.tsx"); +/* import */ var _src_cli_skills_add_tsx__rspack_import_34 = __webpack_require__("./src/cli/skills/add.tsx"); +/* import */ var _src_cli_skills_list_tsx__rspack_import_35 = __webpack_require__("./src/cli/skills/list.tsx"); +/* import */ var _src_cli_skills_remove_tsx__rspack_import_36 = __webpack_require__("./src/cli/skills/remove.tsx"); +/* import */ var _src_cli_thread_tsx__rspack_import_37 = __webpack_require__("./src/cli/thread.tsx"); -const route0 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_approvals_list_tsx__rspack_import_3, 'default'), _tmp_gbot_agent_bundle_native_src_cli_approvals_list_tsx__rspack_import_3); +const route0 = Object.assign({}, Reflect.get(_src_cli_approvals_list_tsx__rspack_import_3, 'default'), _src_cli_approvals_list_tsx__rspack_import_3); -const route1 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_approvals_respond_tsx__rspack_import_4, 'default'), _tmp_gbot_agent_bundle_native_src_cli_approvals_respond_tsx__rspack_import_4); +const route1 = Object.assign({}, Reflect.get(_src_cli_approvals_respond_tsx__rspack_import_4, 'default'), _src_cli_approvals_respond_tsx__rspack_import_4); -const route2 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_bots_create_tsx__rspack_import_5, 'default'), _tmp_gbot_agent_bundle_native_src_cli_bots_create_tsx__rspack_import_5); +const route2 = Object.assign({}, Reflect.get(_src_cli_bots_create_tsx__rspack_import_5, 'default'), _src_cli_bots_create_tsx__rspack_import_5); -const route3 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_bots_delete_tsx__rspack_import_6, 'default'), _tmp_gbot_agent_bundle_native_src_cli_bots_delete_tsx__rspack_import_6); +const route3 = Object.assign({}, Reflect.get(_src_cli_bots_delete_tsx__rspack_import_6, 'default'), _src_cli_bots_delete_tsx__rspack_import_6); -const route4 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_bots_get_tsx__rspack_import_7, 'default'), _tmp_gbot_agent_bundle_native_src_cli_bots_get_tsx__rspack_import_7); +const route4 = Object.assign({}, Reflect.get(_src_cli_bots_get_tsx__rspack_import_7, 'default'), _src_cli_bots_get_tsx__rspack_import_7); -const route5 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_bots_list_tsx__rspack_import_8, 'default'), _tmp_gbot_agent_bundle_native_src_cli_bots_list_tsx__rspack_import_8); +const route5 = Object.assign({}, Reflect.get(_src_cli_bots_list_tsx__rspack_import_8, 'default'), _src_cli_bots_list_tsx__rspack_import_8); -const route6 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_bots_update_tsx__rspack_import_9, 'default'), _tmp_gbot_agent_bundle_native_src_cli_bots_update_tsx__rspack_import_9); +const route6 = Object.assign({}, Reflect.get(_src_cli_bots_update_tsx__rspack_import_9, 'default'), _src_cli_bots_update_tsx__rspack_import_9); -const route7 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_bridge_respond_tsx__rspack_import_10, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_bridge_respond_tsx__rspack_import_10); +const route7 = Object.assign({}, Reflect.get(_src_cli_codex_bridge_respond_tsx__rspack_import_10, 'default'), _src_cli_codex_bridge_respond_tsx__rspack_import_10); -const route8 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_bridge_run_tsx__rspack_import_11, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_bridge_run_tsx__rspack_import_11); +const route8 = Object.assign({}, Reflect.get(_src_cli_codex_bridge_run_tsx__rspack_import_11, 'default'), _src_cli_codex_bridge_run_tsx__rspack_import_11); -const route9 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_bridge_start_tsx__rspack_import_12, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_bridge_start_tsx__rspack_import_12); +const route9 = Object.assign({}, Reflect.get(_src_cli_codex_bridge_start_tsx__rspack_import_12, 'default'), _src_cli_codex_bridge_start_tsx__rspack_import_12); -const route10 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_bridge_status_tsx__rspack_import_13, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_bridge_status_tsx__rspack_import_13); +const route10 = Object.assign({}, Reflect.get(_src_cli_codex_bridge_status_tsx__rspack_import_13, 'default'), _src_cli_codex_bridge_status_tsx__rspack_import_13); -const route11 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_bridge_stop_tsx__rspack_import_14, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_bridge_stop_tsx__rspack_import_14); +const route11 = Object.assign({}, Reflect.get(_src_cli_codex_bridge_stop_tsx__rspack_import_14, 'default'), _src_cli_codex_bridge_stop_tsx__rspack_import_14); -const route12 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_desktop_shim_tsx__rspack_import_15, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_desktop_shim_tsx__rspack_import_15); +const route12 = Object.assign({}, Reflect.get(_src_cli_codex_desktop_shim_tsx__rspack_import_15, 'default'), _src_cli_codex_desktop_shim_tsx__rspack_import_15); -const route13 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_list_threads_tsx__rspack_import_16, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_list_threads_tsx__rspack_import_16); +const route13 = Object.assign({}, Reflect.get(_src_cli_codex_list_threads_tsx__rspack_import_16, 'default'), _src_cli_codex_list_threads_tsx__rspack_import_16); -const route14 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_queue_tsx__rspack_import_17, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_queue_tsx__rspack_import_17); +const route14 = Object.assign({}, Reflect.get(_src_cli_codex_queue_tsx__rspack_import_17, 'default'), _src_cli_codex_queue_tsx__rspack_import_17); -const route15 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_send_tsx__rspack_import_18, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_send_tsx__rspack_import_18); +const route15 = Object.assign({}, Reflect.get(_src_cli_codex_send_tsx__rspack_import_18, 'default'), _src_cli_codex_send_tsx__rspack_import_18); -const route16 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_status_tsx__rspack_import_19, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_status_tsx__rspack_import_19); +const route16 = Object.assign({}, Reflect.get(_src_cli_codex_status_tsx__rspack_import_19, 'default'), _src_cli_codex_status_tsx__rspack_import_19); -const route17 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_wait_tsx__rspack_import_20, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_wait_tsx__rspack_import_20); +const route17 = Object.assign({}, Reflect.get(_src_cli_codex_wait_tsx__rspack_import_20, 'default'), _src_cli_codex_wait_tsx__rspack_import_20); -const route18 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_watch_tsx__rspack_import_21, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_watch_tsx__rspack_import_21); +const route18 = Object.assign({}, Reflect.get(_src_cli_codex_watch_tsx__rspack_import_21, 'default'), _src_cli_codex_watch_tsx__rspack_import_21); -const route19 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_doctor_tsx__rspack_import_22, 'default'), _tmp_gbot_agent_bundle_native_src_cli_doctor_tsx__rspack_import_22); +const route19 = Object.assign({}, Reflect.get(_src_cli_doctor_tsx__rspack_import_22, 'default'), _src_cli_doctor_tsx__rspack_import_22); -const route20 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_groups_add_tsx__rspack_import_23, 'default'), _tmp_gbot_agent_bundle_native_src_cli_groups_add_tsx__rspack_import_23); +const route20 = Object.assign({}, Reflect.get(_src_cli_groups_add_tsx__rspack_import_23, 'default'), _src_cli_groups_add_tsx__rspack_import_23); -const route21 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_groups_create_tsx__rspack_import_24, 'default'), _tmp_gbot_agent_bundle_native_src_cli_groups_create_tsx__rspack_import_24); +const route21 = Object.assign({}, Reflect.get(_src_cli_groups_create_tsx__rspack_import_24, 'default'), _src_cli_groups_create_tsx__rspack_import_24); -const route22 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_groups_delete_tsx__rspack_import_25, 'default'), _tmp_gbot_agent_bundle_native_src_cli_groups_delete_tsx__rspack_import_25); +const route22 = Object.assign({}, Reflect.get(_src_cli_groups_delete_tsx__rspack_import_25, 'default'), _src_cli_groups_delete_tsx__rspack_import_25); -const route23 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_groups_get_tsx__rspack_import_26, 'default'), _tmp_gbot_agent_bundle_native_src_cli_groups_get_tsx__rspack_import_26); +const route23 = Object.assign({}, Reflect.get(_src_cli_groups_get_tsx__rspack_import_26, 'default'), _src_cli_groups_get_tsx__rspack_import_26); -const route24 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_groups_list_tsx__rspack_import_27, 'default'), _tmp_gbot_agent_bundle_native_src_cli_groups_list_tsx__rspack_import_27); +const route24 = Object.assign({}, Reflect.get(_src_cli_groups_list_tsx__rspack_import_27, 'default'), _src_cli_groups_list_tsx__rspack_import_27); -const route25 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_groups_members_tsx__rspack_import_28, 'default'), _tmp_gbot_agent_bundle_native_src_cli_groups_members_tsx__rspack_import_28); +const route25 = Object.assign({}, Reflect.get(_src_cli_groups_members_tsx__rspack_import_28, 'default'), _src_cli_groups_members_tsx__rspack_import_28); -const route26 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_groups_remove_tsx__rspack_import_29, 'default'), _tmp_gbot_agent_bundle_native_src_cli_groups_remove_tsx__rspack_import_29); +const route26 = Object.assign({}, Reflect.get(_src_cli_groups_remove_tsx__rspack_import_29, 'default'), _src_cli_groups_remove_tsx__rspack_import_29); -const route27 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_groups_set_tsx__rspack_import_30, 'default'), _tmp_gbot_agent_bundle_native_src_cli_groups_set_tsx__rspack_import_30); +const route27 = Object.assign({}, Reflect.get(_src_cli_groups_set_tsx__rspack_import_30, 'default'), _src_cli_groups_set_tsx__rspack_import_30); -const route28 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_groups_update_tsx__rspack_import_31, 'default'), _tmp_gbot_agent_bundle_native_src_cli_groups_update_tsx__rspack_import_31); +const route28 = Object.assign({}, Reflect.get(_src_cli_groups_update_tsx__rspack_import_31, 'default'), _src_cli_groups_update_tsx__rspack_import_31); -const route29 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_history_tsx__rspack_import_32, 'default'), _tmp_gbot_agent_bundle_native_src_cli_history_tsx__rspack_import_32); +const route29 = Object.assign({}, Reflect.get(_src_cli_history_tsx__rspack_import_32, 'default'), _src_cli_history_tsx__rspack_import_32); -const route30 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_send_tsx__rspack_import_33, 'default'), _tmp_gbot_agent_bundle_native_src_cli_send_tsx__rspack_import_33); +const route30 = Object.assign({}, Reflect.get(_src_cli_send_tsx__rspack_import_33, 'default'), _src_cli_send_tsx__rspack_import_33); -const route31 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_skills_add_tsx__rspack_import_34, 'default'), _tmp_gbot_agent_bundle_native_src_cli_skills_add_tsx__rspack_import_34); +const route31 = Object.assign({}, Reflect.get(_src_cli_skills_add_tsx__rspack_import_34, 'default'), _src_cli_skills_add_tsx__rspack_import_34); -const route32 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_skills_list_tsx__rspack_import_35, 'default'), _tmp_gbot_agent_bundle_native_src_cli_skills_list_tsx__rspack_import_35); +const route32 = Object.assign({}, Reflect.get(_src_cli_skills_list_tsx__rspack_import_35, 'default'), _src_cli_skills_list_tsx__rspack_import_35); -const route33 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_skills_remove_tsx__rspack_import_36, 'default'), _tmp_gbot_agent_bundle_native_src_cli_skills_remove_tsx__rspack_import_36); +const route33 = Object.assign({}, Reflect.get(_src_cli_skills_remove_tsx__rspack_import_36, 'default'), _src_cli_skills_remove_tsx__rspack_import_36); -const route34 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_thread_tsx__rspack_import_37, 'default'), _tmp_gbot_agent_bundle_native_src_cli_thread_tsx__rspack_import_37); +const route34 = Object.assign({}, Reflect.get(_src_cli_thread_tsx__rspack_import_37, 'default'), _src_cli_thread_tsx__rspack_import_37); const pluginRoot = (0,_agent_bundle_runtime__rspack_import_38/* .resolvePluginRoot */.E7)({ fallback: (0,node_url__rspack_import_2.fileURLToPath)(new URL('..', import.meta.url)), stateAnchor: 'user-data' diff --git a/artifact/bin/gbot.mjs b/artifact/bin/gbot.mjs index f86712b..3bcfeb4 100755 --- a/artifact/bin/gbot.mjs +++ b/artifact/bin/gbot.mjs @@ -11135,9 +11135,9 @@ const config = { }; async function route({ input }) { const out = await (0,_core_grok_approval_routes_js__rspack_import_1/* .listOperation */.gi)(input); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -11195,9 +11195,9 @@ const config = { }; async function route({ input }) { const out = await (0,_core_grok_approval_routes_js__rspack_import_1/* .respondOperation */.lr)(input); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -11269,9 +11269,9 @@ async function botsCreate({ input }) { const { dir: _d, files: _f, gateway: _g, ...fields } = input; const rec = await backend.createAgent((0,_shared_js__rspack_import_1/* .toCreateInput */.cp)(fields)); if (rec == null) throw new Error('createAgent returned no record'); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_3/* .summarize */.eh)(rec), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Text */.g.Text, { children: `Created bot ${rec.name} (${rec.id})` }) }); @@ -11337,9 +11337,9 @@ const resultSchema = _shared_js__rspack_import_1/* .agentSummarySchema */.t_; async function botsDelete({ input }) { const backend = await (0,_shared_js__rspack_import_1/* .openBackendFromInput */.FS)(input); const rec = await backend.deleteAgent(input.ref); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: `Deleted ${rec.isGroup ? 'group' : 'bot'} ${rec.name} (${rec.id})` }) }); @@ -11406,9 +11406,9 @@ async function botsGet({ input }) { const backend = await (0,_shared_js__rspack_import_1/* .openBackendFromInput */.FS)(input); const rec = await backend.resolve(input.ref); const all = await backend.list(); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: (0,_core_format_js__rspack_import_4/* .formatRecord */.bM)(rec, all) }) }); @@ -11465,9 +11465,9 @@ async function botsList({ input }) { const rows = all.filter((r)=>!r.isGroup); const bots = rows.map(_core_format_js__rspack_import_3/* .summarize */.eh); const text = rows.length === 0 ? 'No bots.' : rows.map((r)=>(0,_core_format_js__rspack_import_3/* .formatRecord */.bM)(r, all)).join('\n\n'); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: bots, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: text }) }); @@ -11555,9 +11555,9 @@ async function botsUpdate({ input }) { const backend = await (0,_shared_js__rspack_import_1/* .openBackendFromInput */.FS)(input); const { dir: _d, files: _f, gateway: _g, ref, ...fields } = input; const rec = await backend.updateAgent(ref, (0,_shared_js__rspack_import_1/* .toUpdatePatch */.li)(fields)); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: `Updated ${rec.isGroup ? 'group' : 'bot'} ${rec.name} (${rec.id})` }) }); @@ -11641,9 +11641,9 @@ async function route({ input }) { } catch (error) { out = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error); } - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -11732,12 +11732,12 @@ async function route({ signal, input }) { } finally{ signal.removeEventListener('abort', stop); } - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g.Result, { value: { state: 'stopped', exitCode }, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g.Text, { children: "Relay worker stopped." }) }); @@ -11810,9 +11810,9 @@ async function route({ input }) { } catch (error) { out = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error); } - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -11866,9 +11866,9 @@ async function route({ input }) { } catch (error) { out = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error); } - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -11925,9 +11925,9 @@ async function route({ input }) { } catch (error) { out = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error); } - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -12003,21 +12003,21 @@ async function codexDesktopShim({ input }) { out = (0,_core_desktop_shim_js__rspack_import_1/* .installDesktopShim */.B0)(); } catch (error) { const message = error instanceof Error ? error.message : String(error); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: { action: 'install', error: message, exitCode: 1 }, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: `Desktop shim install failed: ${message}` }) }); } const text = `Installed ChatGPT Desktop shim:\n` + ` wrapper: ${out.wrapperPath}\n` + ` bridge: ${out.bridgePath}\n` + ` login env: ${out.envScriptPath}` + (out.plistPath ? `\n LaunchAgent: ${out.plistPath}` : '\n LaunchAgent: n/a (macOS-only)') + `\nFully quit and relaunch ChatGPT.app so it inherits CODEX_CLI_PATH; ` + `Desktop falls back to stock Codex if the shim is ever removed.` + formatWarnings(out.warnings); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: text }) }); @@ -12029,22 +12029,22 @@ async function codexDesktopShim({ input }) { out = (0,_core_desktop_shim_js__rspack_import_1/* .uninstallDesktopShim */.gM)(); } catch (error) { const message = error instanceof Error ? error.message : String(error); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: { action: 'uninstall', error: message, exitCode: 1 }, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: `Desktop shim uninstall failed: ${message}` }) }); } const removed = out.removed.length === 0 ? '(nothing installed)' : out.removed.join(', '); const text = `Removed ChatGPT Desktop shim: ${removed}. ` + `Desktop and Codex fall back to stock behavior; relaunch ChatGPT.app to pick it up.` + formatWarnings(out.warnings); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: text }) }); @@ -12052,9 +12052,9 @@ async function codexDesktopShim({ input }) { case 'status': { const out = (0,_core_desktop_shim_js__rspack_import_1/* .desktopShimStatus */.em)(); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: (0,_core_format_js__rspack_import_4/* .formatDesktopShimStatus */.fX)(out) }) }); @@ -12134,21 +12134,21 @@ async function codexListThreads({ input }) { }); } catch (error) { const failure = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g.Result, { value: failure, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g.Text, { children: failure.error }) }); } const more = out.nextCursor ? `\n\nmore: --cursor ${JSON.stringify((0,_core_codex_bridge_js__rspack_import_1/* .singleLine */.pF)(out.nextCursor))}` : ''; const text = out.threads.length === 0 ? 'No Codex threads.' : out.threads.map(_core_format_js__rspack_import_6/* .formatCodexThread */.nz).join('\n\n') + more; - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g.Result, { value: { ...out, exitCode: 0 }, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g.Text, { children: text }) }); @@ -12221,19 +12221,19 @@ async function codexQueue({ input }) { out = await (0,_core_codex_bridge_js__rspack_import_1/* .listCodexQueue */.Bt)(input.threadId); } catch (error) { const failure = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g.Result, { value: failure, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g.Text, { children: failure.error }) }); } - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g.Result, { value: { ...out, exitCode: 0 }, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g.Text, { children: (0,_core_format_js__rspack_import_6/* .formatCodexQueue */.e_)(out) }) }); @@ -12364,12 +12364,12 @@ async function route({ input, signal }) { ...input, message: input.message.join(' ').trim() }, context); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g.Result, { value: { ...out, exitCode: out.delivery === 'rejected' ? 1 : 0 }, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g.Text, { children: `Delivery ${out.delivery}; terminal answer returns to Grok automatically.` }) }); @@ -12381,9 +12381,9 @@ async function route({ input, signal }) { }, signal, (message)=>context.progress.report({ message }), true); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g.Text, { children: (0,_core_codex_routes_js__rspack_import_1/* .resultText */.D6)(out) }) }); @@ -12429,9 +12429,9 @@ const resultSchema = zod__rspack_import_2/* .object */.Ikc({ }).passthrough(); async function codexStatusCmd(_props) { const status = await (0,_core_codex_bridge_js__rspack_import_1/* .codexStatus */.MU)(); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: status, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: (0,_core_format_js__rspack_import_4/* .formatCodexStatus */.P2)(status) }) }); @@ -12503,9 +12503,9 @@ async function route({ input, signal }) { const out = await (0,_core_codex_routes_js__rspack_import_1/* .observeOperation */.gT)('wait', input, signal, (message)=>context.progress.report({ message })); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: (0,_core_codex_routes_js__rspack_import_1/* .resultText */.D6)(out) }) }); @@ -12569,9 +12569,9 @@ async function route({ input, signal }) { const out = await (0,_core_codex_routes_js__rspack_import_1/* .observeOperation */.gT)('watch', input, signal, (message)=>context.progress.report({ message })); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: (0,_core_codex_routes_js__rspack_import_1/* .resultText */.D6)(out) }) }); @@ -12674,9 +12674,9 @@ async function doctor({ input }) { ...candidates.map((c)=>` ${c}`), note ].join('\n'); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Result */.g.Result, { value: value, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Text */.g.Text, { children: text }) }); @@ -12747,9 +12747,9 @@ const resultSchema = _shared_js__rspack_import_1/* .agentSummarySchema */.t_; async function groupsAdd({ input }) { const backend = await (0,_shared_js__rspack_import_1/* .openBackendFromInput */.FS)(input); const rec = await backend.addGroupMember(input.group, input.bot); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: `Added to ${rec.name}. Members: ${rec.memberIds.length}` }) }); @@ -12835,9 +12835,9 @@ async function groupsCreate({ input }) { ...(0,_shared_js__rspack_import_1/* .toCreateInput */.cp)(fields), memberIds: member }); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: `Created group ${rec.name} (${rec.id}) with ${rec.memberIds.length} members` }) }); @@ -12905,9 +12905,9 @@ async function groupsDelete({ input }) { const rec = await backend.resolve(input.ref); if (!rec.isGroup) throw new Error(`"${rec.name}" is a bot, not a group. Use bots delete.`); const deleted = await backend.deleteAgent(input.ref); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(deleted), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: `Deleted group ${deleted.name} (${deleted.id})` }) }); @@ -12975,9 +12975,9 @@ async function groupsGet({ input }) { const rec = await backend.resolve(input.ref); if (!rec.isGroup) throw new Error(`"${rec.name}" is a bot, not a group.`); const all = await backend.list(); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: (0,_core_format_js__rspack_import_4/* .formatRecord */.bM)(rec, all) }) }); @@ -13034,9 +13034,9 @@ async function groupsList({ input }) { const rows = all.filter((r)=>r.isGroup); const groups = rows.map(_core_format_js__rspack_import_3/* .summarize */.eh); const text = rows.length === 0 ? 'No groups.' : rows.map((r)=>(0,_core_format_js__rspack_import_3/* .formatRecord */.bM)(r, all)).join('\n\n'); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: groups, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: text }) }); @@ -13104,9 +13104,9 @@ async function groupsMembers({ input }) { const rec = await backend.resolve(input.ref); if (!rec.isGroup) throw new Error(`"${rec.name}" is a bot, not a group.`); const all = await backend.list(); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: (0,_core_format_js__rspack_import_4/* .formatRecord */.bM)(rec, all) }) }); @@ -13177,9 +13177,9 @@ const resultSchema = _shared_js__rspack_import_1/* .agentSummarySchema */.t_; async function groupsRemove({ input }) { const backend = await (0,_shared_js__rspack_import_1/* .openBackendFromInput */.FS)(input); const rec = await backend.removeGroupMember(input.group, input.bot); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: `Removed from ${rec.name}. Members: ${rec.memberIds.length}` }) }); @@ -13253,9 +13253,9 @@ const resultSchema = _shared_js__rspack_import_1/* .agentSummarySchema */.t_; async function groupsSet({ input }) { const backend = await (0,_shared_js__rspack_import_1/* .openBackendFromInput */.FS)(input); const rec = await backend.setGroupMembers(input.group, input.member); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: `Updated ${rec.name}. Members: ${rec.memberIds.length}` }) }); @@ -13345,9 +13345,9 @@ async function groupsUpdate({ input }) { if (!current.isGroup) throw new Error(`"${current.name}" is a bot, not a group. Use bots update.`); const { dir: _d, files: _f, gateway: _g, ref, ...fields } = input; const rec = await backend.updateAgent(ref, (0,_shared_js__rspack_import_1/* .toUpdatePatch */.li)(fields)); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec), - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: `Updated group ${rec.name} (${rec.id})` }) }); @@ -13423,11 +13423,11 @@ const resultSchema = zod__rspack_import_2/* .union */.KCZ([ async function history({ input }) { const file = (0,_core_history_js__rspack_import_1/* .historyPath */.ae)(input.historyDir); if (input.path) { - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: { path: file }, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: file }) }); @@ -13438,9 +13438,9 @@ async function history({ input }) { search: input.search }); const text = rows.length ? rows.map((row)=>`[${row.recordedAt}] ${row.target.name} (${row.target.id}) [${row.role}] ${row.text}`).join('\n') : 'No local history.'; - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: rows, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: text }) }); @@ -13650,12 +13650,12 @@ async function send({ input }) { hop: input.hop, correlationId: input.correlationId }, await (0,_agent_bundle_runtime__rspack_import_7/* .agent */.MA)()); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Result */.g.Result, { value: { ...out, exitCode: out.delivery === 'rejected' ? 1 : 0 }, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Text */.g.Text, { children: `Delivery ${out.delivery}; inspect codex bridge status for automatic reply delivery.` }) }); @@ -13665,9 +13665,9 @@ async function send({ input }) { value = (0,_core_codex_contract_js__rspack_import_3/* .outcomeFromError */.DG)(error); } const text = value.exitCode === 0 ? `Sent to ${value.kind} ${value.name} (${value.id})${value.messageId ? ` message ${value.messageId}` : ''}; envelope ${value.envelopeId}` : value.error; - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Result */.g.Result, { value: value, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Text */.g.Text, { children: text }) }); @@ -13740,9 +13740,9 @@ async function skillsAdd({ input }) { const markdown = await (0,node_fs_promises__rspack_import_1.readFile)(await skillFile(input.path), 'utf8'); const backend = await (0,_shared_js__rspack_import_3/* .openBackendFromInput */.FS)(input); const skill = resultSchema.parse(await backend.addSkill(markdown)); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g.Result, { value: skill, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g.Text, { children: `Added skill ${skill.name} (${skill.id}) to the shared library` }) }); @@ -13795,9 +13795,9 @@ async function skillsList({ input }) { const backend = await (0,_shared_js__rspack_import_1/* .openBackendFromInput */.FS)(input); const skills = resultSchema.parse(await backend.skills()); const lines = skills.map((s)=>`${s.id} ${s.name} [${s.source}]${s.description ? ` ${s.description}` : ''}`); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: skills, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: lines.length > 0 ? lines.join('\n') : 'No skills.' }) }); @@ -13861,9 +13861,9 @@ const resultSchema = _shared_js__rspack_import_1/* .skillSchema */.b7; async function skillsRemove({ input }) { const backend = await (0,_shared_js__rspack_import_1/* .openBackendFromInput */.FS)(input); const skill = resultSchema.parse(await backend.removeSkill(input.skill)); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: skill, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: `Removed skill ${skill.name} (${skill.id}) from the shared library` }) }); @@ -13970,9 +13970,9 @@ async function thread({ input }) { event: 'thread', rootId: input.root }); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: rooted, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: (0,_core_format_js__rspack_import_5/* .formatTranscript */.oZ)(rooted, { full: input.full }) @@ -14002,9 +14002,9 @@ async function thread({ input }) { const text = (0,_core_format_js__rspack_import_5/* .formatTranscript */.oZ)(selected, { full: input.full }); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: selected, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: `${text}\n\ncursor: ${delta.cursor}${delta.gapReset ? ' (gap reset)' : ''}` }) }); @@ -14014,9 +14014,9 @@ async function thread({ input }) { disabled: input.noHistory, event: 'thread' }); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: (0,_core_format_js__rspack_import_5/* .formatTranscript */.oZ)(out, { full: input.full }) @@ -14666,28 +14666,7 @@ module.exports = __rspack_createRequire_require("util"); }, "./node_modules/@agent-bundle/runtime/dist/302.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) { /* import */ var node_buffer__rspack_import_0 = __webpack_require__("node:buffer"); -/* import */ var react__rspack_import_1 = __webpack_require__("./node_modules/react/index.js"); - -const isServerComponent = (value)=>'function' == typeof value; -const asMcpElement = (node)=>{ - let element = node; - while(isValidElement(element) && isServerComponent(element.type))element = element.type(element.props); - if (!isValidElement(element) || 'string' != typeof element.type || !element.type.startsWith('mcp-')) throw new Error('Expected an MCP result element'); - return { - props: element.props, - type: element.type - }; -}; -const requiredString = (value, message)=>{ - if ('string' != typeof value || '' === value.trim()) throw new Error(message); - return value; -}; -const textChild = (children, message)=>{ - const values = Children.toArray(children); - if (1 !== values.length || 'string' != typeof values[0]) throw new Error(message); - return values[0]; -}; const jsonLeafBytes = (value)=>node_buffer__rspack_import_0.Buffer.byteLength(JSON.stringify(value), 'utf8'); const isArrayIndex = (key, length)=>{ if ('0' === key) return length > 0; @@ -14749,16 +14728,6 @@ const cloneJsonValue = (value, ancestors, path, depth = 0, budget)=>{ ancestors.delete(value); } }; -const jsonRecord = (value, message)=>{ - try { - if (null === value || 'object' != typeof value || Array.isArray(value)) throw new Error('not a plain object'); - return cloneJsonValue(value, new Set(), ''); - } catch (error) { - throw new Error(`${message} (${error instanceof Error ? error.message : String(error)})`, { - cause: error - }); - } -}; const deepFreezeJson = (value)=>{ if ('object' == typeof value && null !== value) { for (const child of Object.values(value))deepFreezeJson(child); @@ -14776,89 +14745,6 @@ const snapshotJsonValue = (value, message, budget)=>{ }); } }; -const lowerContent = (node)=>{ - const element = asMcpElement(node); - const { props } = element; - switch(element.type){ - case 'mcp-text': - return { - text: textChild(props.children, 'mcp-text requires one text child'), - type: 'text' - }; - case 'mcp-image': - return { - data: requiredString(props.data, 'mcp-image requires non-empty data and mimeType'), - mimeType: requiredString(props.mimeType, 'mcp-image requires non-empty data and mimeType'), - type: 'image' - }; - case 'mcp-audio': - return { - data: requiredString(props.data, 'mcp-audio requires non-empty data and mimeType'), - mimeType: requiredString(props.mimeType, 'mcp-audio requires non-empty data and mimeType'), - type: 'audio' - }; - case 'mcp-resource-link': - { - const mimeType = props.mimeType; - if (void 0 !== mimeType && 'string' != typeof mimeType) throw new Error('mcp-resource-link mimeType must be a string'); - return { - ...void 0 === mimeType ? {} : { - mimeType - }, - name: requiredString(props.name, 'mcp-resource-link requires non-empty uri and name'), - type: 'resource_link', - uri: requiredString(props.uri, 'mcp-resource-link requires non-empty uri and name') - }; - } - case 'mcp-embedded-resource': - { - const hasText = void 0 !== props.text; - const hasTextChild = void 0 !== props.children; - const hasBlob = void 0 !== props.blob; - if (Number(hasText) + Number(hasTextChild) + Number(hasBlob) !== 1) throw new Error('mcp-embedded-resource accepts exactly one text or blob value'); - const mimeType = props.mimeType; - if (void 0 !== mimeType && 'string' != typeof mimeType) throw new Error('mcp-embedded-resource mimeType must be a string'); - const resource = { - ...void 0 === mimeType ? {} : { - mimeType - }, - uri: requiredString(props.uri, 'mcp-embedded-resource requires a non-empty uri'), - ...hasBlob ? { - blob: requiredString(props.blob, 'mcp-embedded-resource blob must be non-empty') - } : { - text: hasTextChild ? textChild(props.children, 'mcp-embedded-resource requires one text child') : requiredString(props.text, 'mcp-embedded-resource text must be non-empty') - } - }; - return { - resource, - type: 'resource' - }; - } - case 'mcp-result': - throw new Error('mcp-result may not be nested'); - default: - throw new Error(`Unsupported MCP result element: ${element.type}`); - } -}; -const lowerMcpResult = (node)=>{ - const root = asMcpElement(node); - if ('mcp-result' !== root.type) throw new Error('Expected mcp-result as the root element'); - if (void 0 !== root.props.isError && 'boolean' != typeof root.props.isError) throw new Error('mcp-result isError must be a boolean'); - const structuredContent = root.props.structuredContent; - const metadata = root.props._meta; - return { - content: Children.toArray(root.props.children).map(lowerContent), - ...void 0 === metadata ? {} : { - _meta: jsonRecord(metadata, 'mcp-result _meta must be JSON-serializable') - }, - ...void 0 === structuredContent ? {} : { - structuredContent: jsonRecord(structuredContent, 'mcp-result structuredContent must be JSON-serializable') - }, - ...void 0 === root.props.isError ? {} : { - isError: root.props.isError - } - }; -}; const AGENT_DOCUMENT_VERSION = 1; const agentRenderAbortError = ()=>new DOMException('Agent render was aborted', 'AbortError'); const DEFAULT_AGENT_RENDER_LIMITS = Object.freeze({ @@ -14886,7 +14772,7 @@ const resolveAgentRenderLimits = (overrides = {})=>{ for (const [name, value] of Object.entries(limits))if (!Number.isSafeInteger(value) || value <= 0) throw new AgentContractError('invalid-document', `${name} must be a positive safe integer`); return Object.freeze(limits); }; -const agent_document_requiredString = (value, field)=>{ +const requiredString = (value, field)=>{ if ('string' != typeof value || '' === value.trim()) throw new AgentContractError('invalid-document', `${field} must be a non-empty string`); return value; }; @@ -14894,7 +14780,7 @@ const agent_document_text = (value, field)=>{ if ('string' != typeof value) throw new AgentContractError('invalid-document', `${field} must be a string`); return value; }; -const optionalString = (value, field)=>void 0 === value ? void 0 : agent_document_requiredString(value, field); +const optionalString = (value, field)=>void 0 === value ? void 0 : requiredString(value, field); const elapsedTimeExceeded = (maxElapsedMs)=>new AgentContractError('elapsed-time-exceeded', `Agent render elapsed time exceeds ${String(maxElapsedMs)}ms`); const expectDocumentDepth = (depth, limits)=>{ if (depth > limits.maxDocumentDepth) throw new AgentContractError('document-depth-exceeded', `Agent Document depth exceeds ${String(limits.maxDocumentDepth)}`); @@ -14992,15 +14878,15 @@ const snapshotNode = (node, depth, state)=>{ } case 'image': return Object.freeze({ - data: agent_document_requiredString(node.data, 'Agent image data'), + data: requiredString(node.data, 'Agent image data'), kind: 'image', - mimeType: agent_document_requiredString(node.mimeType, 'Agent image mimeType') + mimeType: requiredString(node.mimeType, 'Agent image mimeType') }); case 'audio': return Object.freeze({ - data: agent_document_requiredString(node.data, 'Agent audio data'), + data: requiredString(node.data, 'Agent audio data'), kind: 'audio', - mimeType: agent_document_requiredString(node.mimeType, 'Agent audio mimeType') + mimeType: requiredString(node.mimeType, 'Agent audio mimeType') }); case 'resource': { @@ -15010,13 +14896,13 @@ const snapshotNode = (node, depth, state)=>{ ...void 0 === mimeType ? {} : { mimeType }, - name: agent_document_requiredString(node.name, 'Agent resource name'), - uri: agent_document_requiredString(node.uri, 'Agent resource uri') + name: requiredString(node.name, 'Agent resource name'), + uri: requiredString(node.uri, 'Agent resource uri') }); } case 'error': return Object.freeze({ - code: agent_document_requiredString(node.code, 'Agent error code'), + code: requiredString(node.code, 'Agent error code'), kind: 'error', message: agent_document_text(node.message, 'Agent error message') }); @@ -15074,7 +14960,7 @@ const snapshotRenderError = (error, limits)=>{ nodes: 0 }); return Object.freeze({ - code: agent_document_requiredString(error.code, 'Agent render error code'), + code: requiredString(error.code, 'Agent render error code'), ...void 0 === data ? {} : { data }, @@ -15109,7 +14995,7 @@ const snapshotEvent = (input, sequence, limits)=>{ } case 'replace': return Object.freeze({ - boundaryId: agent_document_requiredString(input.boundaryId, 'Agent render boundaryId'), + boundaryId: requiredString(input.boundaryId, 'Agent render boundaryId'), document: createAgentDocument(input.document, limits), sequence, type: 'replace' @@ -15677,51 +15563,11 @@ const Agent = Object.freeze({ Result: AgentResult, Text: AgentText }); -const Result = ({ children })=>(0,react__rspack_import_0.createElement)('agent-hook-result', null, children); -const AdditionalContext = ({ children })=>(0,react__rspack_import_0.createElement)('agent-hook-additional-context', null, children); -const Hook = { - AdditionalContext: AdditionalContext, - Result: Result -}; -const McpResult = ({ _meta, children, isError, structuredContent })=>createElement('mcp-result', { - _meta, - isError, - structuredContent - }, children); -const McpText = ({ children })=>createElement('mcp-text', null, children); -const McpImage = ({ data, mimeType })=>createElement('mcp-image', { - data, - mimeType - }); -const McpAudio = ({ data, mimeType })=>createElement('mcp-audio', { - data, - mimeType - }); -const McpResourceLink = ({ mimeType, name, uri })=>createElement('mcp-resource-link', { - mimeType, - name, - uri - }); -const McpEmbeddedResource = ({ blob, children, mimeType, text, uri })=>createElement('mcp-embedded-resource', { - blob, - mimeType, - text, - uri - }, children); -const Mcp = (/* unused pure expression or super */ null && ({ - Audio: McpAudio, - EmbeddedResource: McpEmbeddedResource, - Image: McpImage, - ResourceLink: McpResourceLink, - Result: McpResult, - Text: McpText -})); __webpack_require__.d(__webpack_exports__, { }, { - g6: Agent, - qn: Hook + g: Agent }); @@ -16038,23 +15884,20 @@ __webpack_require__.d(__webpack_exports__, { }, "./node_modules/@agent-bundle/runtime/dist/index.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) { -/* import */ var effect__rspack_import_3 = __webpack_require__("./node_modules/effect/dist/Latch.js"); -/* import */ var effect__rspack_import_4 = __webpack_require__("./node_modules/effect/dist/Effect.js"); -/* import */ var effect__rspack_import_7 = __webpack_require__("./node_modules/effect/dist/Duration.js"); -/* import */ var effect__rspack_import_8 = __webpack_require__("./node_modules/effect/dist/Stream.js"); -/* import */ var effect__rspack_import_9 = __webpack_require__("./node_modules/effect/dist/Deferred.js"); -/* import */ var effect__rspack_import_10 = __webpack_require__("./node_modules/effect/dist/Queue.js"); -/* import */ var effect__rspack_import_11 = __webpack_require__("./node_modules/effect/dist/Option.js"); -/* import */ var effect__rspack_import_12 = __webpack_require__("./node_modules/effect/dist/Exit.js"); -/* import */ var effect__rspack_import_14 = __webpack_require__("./node_modules/effect/dist/Clock.js"); +/* import */ var effect__rspack_import_2 = __webpack_require__("./node_modules/effect/dist/Latch.js"); +/* import */ var effect__rspack_import_3 = __webpack_require__("./node_modules/effect/dist/Effect.js"); +/* import */ var effect__rspack_import_6 = __webpack_require__("./node_modules/effect/dist/Duration.js"); +/* import */ var effect__rspack_import_7 = __webpack_require__("./node_modules/effect/dist/Stream.js"); +/* import */ var effect__rspack_import_8 = __webpack_require__("./node_modules/effect/dist/Deferred.js"); +/* import */ var effect__rspack_import_9 = __webpack_require__("./node_modules/effect/dist/Queue.js"); +/* import */ var effect__rspack_import_10 = __webpack_require__("./node_modules/effect/dist/Option.js"); +/* import */ var effect__rspack_import_11 = __webpack_require__("./node_modules/effect/dist/Exit.js"); +/* import */ var effect__rspack_import_13 = __webpack_require__("./node_modules/effect/dist/Clock.js"); /* import */ var react__rspack_import_0 = __webpack_require__("./node_modules/react/index.js"); /* import */ var react_server_dom_rspack_client_node__rspack_import_1 = __webpack_require__("./node_modules/react-server-dom-rspack/client.node.js"); -/* import */ var node_async_hooks__rspack_import_2 = __webpack_require__("node:async_hooks"); -/* import */ var _315_js__rspack_import_5 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/315.js"); -/* import */ var _302_js__rspack_import_6 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/302.js"); -/* import */ var _707_js__rspack_import_13 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/707.js"); -/* import */ var _506_js__rspack_import_15 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js"); - +/* import */ var _315_js__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/315.js"); +/* import */ var _302_js__rspack_import_5 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/302.js"); +/* import */ var _707_js__rspack_import_12 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/707.js"); @@ -16065,10 +15908,10 @@ __webpack_require__.d(__webpack_exports__, { const createFlightDemand = ()=>{ - const pulling = effect__rspack_import_3/* .makeUnsafe */.LZ(false); + const pulling = effect__rspack_import_2/* .makeUnsafe */.LZ(false); let shellEmitted = false; return { - markShell: effect__rspack_import_4/* .sync */.OH5(()=>{ + markShell: effect__rspack_import_3/* .sync */.OH5(()=>{ shellEmitted = true; }), notePull () { @@ -16077,11 +15920,11 @@ const createFlightDemand = ()=>{ notePullEnd () { pulling.closeUnsafe(); }, - wait: effect__rspack_import_4/* .suspend */.DYE(()=>shellEmitted ? pulling.await : effect__rspack_import_4/* ["void"] */.rIH) + wait: effect__rspack_import_3/* .suspend */.DYE(()=>shellEmitted ? pulling.await : effect__rspack_import_3/* ["void"] */.rIH) }; }; -const emitBoundRenderEvent = (sequence, input)=>effect__rspack_import_4/* ["try"] */.SvU({ - catch: (error)=>(0,_315_js__rspack_import_5/* .toRuntimeError */.qN)(error), +const emitBoundRenderEvent = (sequence, input)=>effect__rspack_import_3/* ["try"] */.SvU({ + catch: (error)=>(0,_315_js__rspack_import_4/* .toRuntimeError */.qN)(error), try: ()=>sequence.emit(input) }); const agentElementTypes = Object.freeze([ @@ -16098,7 +15941,7 @@ const agentElementTypes = Object.freeze([ ]); const isAgentElementType = (value)=>agentElementTypes.includes(value); const protocolElement = (node)=>{ - if (!(0,react__rspack_import_0.isValidElement)(node) || 'string' != typeof node.type || !isAgentElementType(node.type)) throw new _302_js__rspack_import_6/* .AgentContractError */.I2('invalid-document', 'Flight output must contain only Agent protocol elements; function components and HTML are unsupported'); + if (!(0,react__rspack_import_0.isValidElement)(node) || 'string' != typeof node.type || !isAgentElementType(node.type)) throw new _302_js__rspack_import_5/* .AgentContractError */.I2('invalid-document', 'Flight output must contain only Agent protocol elements; function components and HTML are unsupported'); return { props: node.props, type: node.type @@ -16106,31 +15949,31 @@ const protocolElement = (node)=>{ }; const textChild = (children, type)=>{ const values = react__rspack_import_0.Children.toArray(children); - if (1 !== values.length || 'string' != typeof values[0]) throw new _302_js__rspack_import_6/* .AgentContractError */.I2('invalid-document', `${type} requires exactly one string child`); + if (1 !== values.length || 'string' != typeof values[0]) throw new _302_js__rspack_import_5/* .AgentContractError */.I2('invalid-document', `${type} requires exactly one string child`); return values[0]; }; const decodeBudget = (state)=>({ addBytes (n) { state.bytes += n; - if (state.bytes > state.limits.maxDocumentBytes) throw new _302_js__rspack_import_6/* .AgentContractError */.I2('document-bytes-exceeded', `Agent Document bytes exceed ${String(state.limits.maxDocumentBytes)}`); + if (state.bytes > state.limits.maxDocumentBytes) throw new _302_js__rspack_import_5/* .AgentContractError */.I2('document-bytes-exceeded', `Agent Document bytes exceed ${String(state.limits.maxDocumentBytes)}`); }, addNode () { - (0,_302_js__rspack_import_6/* .admitDocumentNode */.Dy)(state); + (0,_302_js__rspack_import_5/* .admitDocumentNode */.Dy)(state); }, checkDepth (depth) { - (0,_302_js__rspack_import_6/* .expectDocumentDepth */.MI)(depth, state.limits); + (0,_302_js__rspack_import_5/* .expectDocumentDepth */.MI)(depth, state.limits); } }); const isJsonObject = (value)=>null != value && 'object' == typeof value && !Array.isArray(value); const budgetedJson = (value, message, depth, state)=>{ try { - return (0,_302_js__rspack_import_6/* .snapshotJsonValue */.mY)(value, message, { + return (0,_302_js__rspack_import_5/* .snapshotJsonValue */.mY)(value, message, { depth, limits: decodeBudget(state) }); } catch (error) { - if (error instanceof _302_js__rspack_import_6/* .AgentContractError */.I2) throw error; - throw new _302_js__rspack_import_6/* .AgentContractError */.I2('invalid-document', error instanceof Error ? error.message : message, { + if (error instanceof _302_js__rspack_import_5/* .AgentContractError */.I2) throw error; + throw new _302_js__rspack_import_5/* .AgentContractError */.I2('invalid-document', error instanceof Error ? error.message : message, { cause: error }); } @@ -16189,8 +16032,8 @@ const decodeResult = (props, depth, state)=>{ return node; }; const decodeNode = (node, depth, state)=>{ - (0,_302_js__rspack_import_6/* .expectDocumentDepth */.MI)(depth, state.limits); - (0,_302_js__rspack_import_6/* .admitDocumentNode */.Dy)(state); + (0,_302_js__rspack_import_5/* .expectDocumentDepth */.MI)(depth, state.limits); + (0,_302_js__rspack_import_5/* .admitDocumentNode */.Dy)(state); const element = protocolElement(node); const { props } = element; switch(element.type){ @@ -16258,14 +16101,14 @@ const decodeNode = (node, depth, state)=>{ default: { const exhaustive = element.type; - throw new _302_js__rspack_import_6/* .AgentContractError */.I2('invalid-document', `Unsupported Agent protocol element: ${String(exhaustive)}`); + throw new _302_js__rspack_import_5/* .AgentContractError */.I2('invalid-document', `Unsupported Agent protocol element: ${String(exhaustive)}`); } } }; const decodeAgentDocument = (node, limits = {})=>{ - const resolved = (0,_302_js__rspack_import_6/* .resolveAgentRenderLimits */.i0)(limits); + const resolved = (0,_302_js__rspack_import_5/* .resolveAgentRenderLimits */.i0)(limits); const root = protocolElement(node); - if ('agent-result' !== root.type) throw new _302_js__rspack_import_6/* .AgentContractError */.I2('invalid-document', 'Flight output must have Agent.Result as its root'); + if ('agent-result' !== root.type) throw new _302_js__rspack_import_5/* .AgentContractError */.I2('invalid-document', 'Flight output must have Agent.Result as its root'); const state = { bytes: 0, discardedBytes: 0, @@ -16276,7 +16119,7 @@ const decodeAgentDocument = (node, limits = {})=>{ }; const documentRoot = decodeNode(node, 1, state); const value = state.resultValues.get(documentRoot)?.value; - const document = (0,_302_js__rspack_import_6/* .createAgentDocument */.ZX)({ + const document = (0,_302_js__rspack_import_5/* .createAgentDocument */.ZX)({ root: documentRoot, status: state.representedError ? 'represented-error' : 'success', ...void 0 === value ? {} : { @@ -16284,13 +16127,13 @@ const decodeAgentDocument = (node, limits = {})=>{ }, version: 1 }, resolved); - if (state.discardedBytes > 0 && state.discardedBytes + jsonBytes(document) > resolved.maxDocumentBytes) throw new _302_js__rspack_import_6/* .AgentContractError */.I2('document-bytes-exceeded', `Agent Document bytes exceed ${String(resolved.maxDocumentBytes)}`); + if (state.discardedBytes > 0 && state.discardedBytes + jsonBytes(document) > resolved.maxDocumentBytes) throw new _302_js__rspack_import_5/* .AgentContractError */.I2('document-bytes-exceeded', `Agent Document bytes exceed ${String(resolved.maxDocumentBytes)}`); return document; }; const REACT_FRAGMENT = Symbol.for('react.fragment'); const REACT_LAZY = Symbol.for('react.lazy'); const REACT_SUSPENSE = Symbol.for('react.suspense'); -const abortError = _302_js__rspack_import_6/* .agentRenderAbortError */.k2; +const abortError = _302_js__rspack_import_5/* .agentRenderAbortError */.k2; const isObject = (value)=>'object' == typeof value && null !== value; const isThenable = (value)=>isObject(value) && 'function' == typeof value.then; const isLazyElement = (value)=>isObject(value) && value.$$typeof === REACT_LAZY && isThenable(value._payload); @@ -16321,7 +16164,7 @@ const classifyNode = (node)=>{ kind: 'thenable', value: node }; - if (!(0,react__rspack_import_0.isValidElement)(node)) throw new _302_js__rspack_import_6/* .AgentContractError */.I2('invalid-document', 'Flight output contained an unsupported node'); + if (!(0,react__rspack_import_0.isValidElement)(node)) throw new _302_js__rspack_import_5/* .AgentContractError */.I2('invalid-document', 'Flight output contained an unsupported node'); const type = node.type; if (type === REACT_SUSPENSE) return { kind: 'suspense', @@ -16335,7 +16178,7 @@ const classifyNode = (node)=>{ kind: 'protocol', value: node }; - throw new _302_js__rspack_import_6/* .AgentContractError */.I2('invalid-document', "Flight output must contain only Agent protocol elements; function components and HTML are unsupported"); + throw new _302_js__rspack_import_5/* .AgentContractError */.I2('invalid-document', "Flight output must contain only Agent protocol elements; function components and HTML are unsupported"); }; const thenableStatus = (thenable)=>{ switch(thenable.status){ @@ -16510,8 +16353,8 @@ const snapshotTree = (root, ids)=>{ tree: materializeNode(root, '', ctx) }; }; -const hostError = (signal, error)=>signal.aborted || (0,_315_js__rspack_import_5/* .isAbortError */.zf)(error) ? abortError() : (0,_315_js__rspack_import_5/* .toRuntimeError */.qN)(error); -const waitSettledBoundary = (pending)=>effect__rspack_import_4/* .raceAll */.Vdx(pending.map((boundary)=>effect__rspack_import_4/* .promise */.ivC(()=>Promise.resolve(boundary.thenable).then(()=>({ +const hostError = (signal, error)=>signal.aborted || (0,_315_js__rspack_import_4/* .isAbortError */.zf)(error) ? abortError() : (0,_315_js__rspack_import_4/* .toRuntimeError */.qN)(error); +const waitSettledBoundary = (pending)=>effect__rspack_import_3/* .raceAll */.Vdx(pending.map((boundary)=>effect__rspack_import_3/* .promise */.ivC(()=>Promise.resolve(boundary.thenable).then(()=>({ boundary, ok: true }), (error)=>({ @@ -16521,8 +16364,8 @@ const waitSettledBoundary = (pending)=>effect__rspack_import_4/* .raceAll */.Vdx }))))); const waitOrDeadline = (wait, sequence)=>{ const remaining = sequence.remainingMs; - if (remaining <= 0) return effect__rspack_import_4/* .fail */.fJG((0,_302_js__rspack_import_6/* .elapsedTimeExceeded */.zm)(sequence.maxElapsedMs)); - return effect__rspack_import_4/* .raceFirst */.KT6(wait, effect__rspack_import_4/* .sleep */.yy4(effect__rspack_import_7/* .millis */.ne(remaining)).pipe(effect__rspack_import_4/* .flatMap */.qIB(()=>effect__rspack_import_4/* .fail */.fJG((0,_302_js__rspack_import_6/* .elapsedTimeExceeded */.zm)(sequence.maxElapsedMs))))); + if (remaining <= 0) return effect__rspack_import_3/* .fail */.fJG((0,_302_js__rspack_import_5/* .elapsedTimeExceeded */.zm)(sequence.maxElapsedMs)); + return effect__rspack_import_3/* .raceFirst */.KT6(wait, effect__rspack_import_3/* .sleep */.yy4(effect__rspack_import_6/* .millis */.ne(remaining)).pipe(effect__rspack_import_3/* .flatMap */.qIB(()=>effect__rspack_import_3/* .fail */.fJG((0,_302_js__rspack_import_5/* .elapsedTimeExceeded */.zm)(sequence.maxElapsedMs))))); }; const settledBoundaryInputs = (previous, next, winner, limits)=>{ const stillPending = new Set(next.pending.map((boundary)=>boundary.id)); @@ -16555,9 +16398,9 @@ const settledBoundaryInputs = (previous, next, winner, limits)=>{ for (const boundary of previous.pending)if (boundary.id !== winner.boundary.id) emitFor(boundary.id); return inputs; }; -const reconcileLoopStream = (root, ids, initial, limits, flightDone, progressInputs, sequence)=>effect__rspack_import_8/* .paginate */.EnV(initial, (snapshot)=>{ - if (0 === snapshot.pending.length) return waitOrDeadline(effect__rspack_import_9/* ["await"] */.Tx(flightDone), sequence).pipe(effect__rspack_import_4/* .andThen */.hgn(effect__rspack_import_10/* .clear */.IU(progressInputs)), effect__rspack_import_4/* .flatMap */.qIB((queued)=>effect__rspack_import_4/* ["try"] */.SvU({ - catch: (error)=>(0,_315_js__rspack_import_5/* .toRuntimeError */.qN)(error), +const reconcileLoopStream = (root, ids, initial, limits, flightDone, progressInputs, sequence)=>effect__rspack_import_7/* .paginate */.EnV(initial, (snapshot)=>{ + if (0 === snapshot.pending.length) return waitOrDeadline(effect__rspack_import_8/* ["await"] */.Tx(flightDone), sequence).pipe(effect__rspack_import_3/* .andThen */.hgn(effect__rspack_import_9/* .clear */.IU(progressInputs)), effect__rspack_import_3/* .flatMap */.qIB((queued)=>effect__rspack_import_3/* ["try"] */.SvU({ + catch: (error)=>(0,_315_js__rspack_import_4/* .toRuntimeError */.qN)(error), try: ()=>[ [ ...queued, @@ -16566,32 +16409,32 @@ const reconcileLoopStream = (root, ids, initial, limits, flightDone, progressInp type: 'complete' } ], - effect__rspack_import_11.none() + effect__rspack_import_10.none() ] }))); - return effect__rspack_import_4/* .raceFirst */.KT6(waitOrDeadline(waitSettledBoundary(snapshot.pending), sequence).pipe(effect__rspack_import_4/* .map */.TjK((winner)=>({ + return effect__rspack_import_3/* .raceFirst */.KT6(waitOrDeadline(waitSettledBoundary(snapshot.pending), sequence).pipe(effect__rspack_import_3/* .map */.TjK((winner)=>({ kind: 'boundary', winner - }))), effect__rspack_import_10/* .take */.s(progressInputs).pipe(effect__rspack_import_4/* .map */.TjK((input)=>({ + }))), effect__rspack_import_9/* .take */.s(progressInputs).pipe(effect__rspack_import_3/* .map */.TjK((input)=>({ kind: 'progress', input - })))).pipe(effect__rspack_import_4/* .flatMap */.qIB((event)=>{ + })))).pipe(effect__rspack_import_3/* .flatMap */.qIB((event)=>{ switch(event.kind){ case 'progress': - return effect__rspack_import_4/* .succeed */.PyW([ + return effect__rspack_import_3/* .succeed */.PyW([ [ event.input ], - effect__rspack_import_11.some(snapshot) + effect__rspack_import_10.some(snapshot) ]); case 'boundary': - return effect__rspack_import_4/* ["try"] */.SvU({ - catch: (error)=>(0,_315_js__rspack_import_5/* .toRuntimeError */.qN)(error), + return effect__rspack_import_3/* ["try"] */.SvU({ + catch: (error)=>(0,_315_js__rspack_import_4/* .toRuntimeError */.qN)(error), try: ()=>{ const next = snapshotTree(root, ids); return [ settledBoundaryInputs(snapshot, next, event.winner, limits), - effect__rspack_import_11.some(next) + effect__rspack_import_10.some(next) ]; } }); @@ -16603,38 +16446,38 @@ const reconcileLoopStream = (root, ids, initial, limits, flightDone, progressInp } })); }); -const gatedFlightStream = (flight, demand, flightDone)=>effect__rspack_import_8/* .unwrap */.oAg(effect__rspack_import_4/* .gen */.JkU(function*() { - const reader = yield* effect__rspack_import_4/* .acquireRelease */.Q56(effect__rspack_import_4/* .sync */.OH5(()=>flight.getReader()), (handle, exit)=>effect__rspack_import_4/* .gen */.JkU(function*() { - const cancelExit = yield* effect__rspack_import_4/* .exit */.NS5(effect__rspack_import_4/* .tryPromise */.$mh({ - catch: (error)=>(0,_315_js__rspack_import_5/* .toRuntimeError */.qN)(error), +const gatedFlightStream = (flight, demand, flightDone)=>effect__rspack_import_7/* .unwrap */.oAg(effect__rspack_import_3/* .gen */.JkU(function*() { + const reader = yield* effect__rspack_import_3/* .acquireRelease */.Q56(effect__rspack_import_3/* .sync */.OH5(()=>flight.getReader()), (handle, exit)=>effect__rspack_import_3/* .gen */.JkU(function*() { + const cancelExit = yield* effect__rspack_import_3/* .exit */.NS5(effect__rspack_import_3/* .tryPromise */.$mh({ + catch: (error)=>(0,_315_js__rspack_import_4/* .toRuntimeError */.qN)(error), try: ()=>handle.cancel() })); - if (effect__rspack_import_12/* .isFailure */.N6(exit)) return void (yield* effect__rspack_import_9/* .fail */.fJ(flightDone, (0,_315_js__rspack_import_5/* .mapCause */.K0)(exit.cause))); - if (effect__rspack_import_12/* .isFailure */.N6(cancelExit)) { - const error = (0,_315_js__rspack_import_5/* .mapCause */.K0)(cancelExit.cause); - yield* effect__rspack_import_9/* .fail */.fJ(flightDone, error); - return yield* effect__rspack_import_4/* .die */.F_Q(error); + if (effect__rspack_import_11/* .isFailure */.N6(exit)) return void (yield* effect__rspack_import_8/* .fail */.fJ(flightDone, (0,_315_js__rspack_import_4/* .mapCause */.K0)(exit.cause))); + if (effect__rspack_import_11/* .isFailure */.N6(cancelExit)) { + const error = (0,_315_js__rspack_import_4/* .mapCause */.K0)(cancelExit.cause); + yield* effect__rspack_import_8/* .fail */.fJ(flightDone, error); + return yield* effect__rspack_import_3/* .die */.F_Q(error); } - yield* effect__rspack_import_9/* .succeed */.Py(flightDone, void 0); + yield* effect__rspack_import_8/* .succeed */.Py(flightDone, void 0); })); - return effect__rspack_import_8/* .unfold */.t8s(void 0, ()=>demand.wait.pipe(effect__rspack_import_4/* .flatMap */.qIB(()=>effect__rspack_import_4/* .tryPromise */.$mh({ - catch: (error)=>(0,_315_js__rspack_import_5/* .toRuntimeError */.qN)(error), + return effect__rspack_import_7/* .unfold */.t8s(void 0, ()=>demand.wait.pipe(effect__rspack_import_3/* .flatMap */.qIB(()=>effect__rspack_import_3/* .tryPromise */.$mh({ + catch: (error)=>(0,_315_js__rspack_import_4/* .toRuntimeError */.qN)(error), try: ()=>reader.read() - })), effect__rspack_import_4/* .map */.TjK((next)=>next.done ? void 0 : [ + })), effect__rspack_import_3/* .map */.TjK((next)=>next.done ? void 0 : [ next.value, void 0 ]))); })); -const decodeFlightRoot = (flight, demand, signal, flightDone)=>effect__rspack_import_4/* .gen */.JkU(function*() { - (0,_707_js__rspack_import_13/* .ensureAgentFlightManifest */.n)(); - const flightAbort = yield* _315_js__rspack_import_5/* .scopedAbortSignal */.lQ; - const readable = (0,_315_js__rspack_import_5/* .streamToReadableStream */._I)(gatedFlightStream(flight, demand, flightDone), { +const decodeFlightRoot = (flight, demand, signal, flightDone)=>effect__rspack_import_3/* .gen */.JkU(function*() { + (0,_707_js__rspack_import_12/* .ensureAgentFlightManifest */.n)(); + const flightAbort = yield* _315_js__rspack_import_4/* .scopedAbortSignal */.lQ; + const readable = (0,_315_js__rspack_import_4/* .streamToReadableStream */._I)(gatedFlightStream(flight, demand, flightDone), { signal: flightAbort, strategy: { highWaterMark: 1 } }); - return yield* effect__rspack_import_4/* .tryPromise */.$mh({ + return yield* effect__rspack_import_3/* .tryPromise */.$mh({ catch: (error)=>hostError(signal, error), try: ()=>(0,react_server_dom_rspack_client_node__rspack_import_1.createFromReadableStream)(readable, { unstable_allowPartialStream: true @@ -16651,11 +16494,11 @@ const progressInput = (update)=>({ }, type: 'progress' }); -const handoffRequired = ()=>new _302_js__rspack_import_6/* .AgentContractError */.I2('handoff-required', 'The render is complete; later work requires a new invocation handoff'); +const handoffRequired = ()=>new _302_js__rspack_import_5/* .AgentContractError */.I2('handoff-required', 'The render is complete; later work requires a new invocation handoff'); const createAgentRenderEventSession = (options)=>{ const clock = options.clock; - const sequence = (0,_302_js__rspack_import_6/* .createAgentRenderEventSequence */.n4)(options.limits, void 0 === clock ? void 0 : ()=>clock.currentTimeMillisUnsafe()); - const maxBufferedProgress = (0,_302_js__rspack_import_6/* .resolveAgentRenderLimits */.i0)(options.limits).maxEvents; + const sequence = (0,_302_js__rspack_import_5/* .createAgentRenderEventSequence */.n4)(options.limits, void 0 === clock ? void 0 : ()=>clock.currentTimeMillisUnsafe()); + const maxBufferedProgress = (0,_302_js__rspack_import_5/* .resolveAgentRenderLimits */.i0)(options.limits).maxEvents; let offerProgress; let progressFailure; const bufferedProgress = []; @@ -16665,36 +16508,36 @@ const createAgentRenderEventSession = (options)=>{ if (sequence.completed) throw handoffRequired(); const input = progressInput(update); if (void 0 === offerProgress) { - if (bufferedProgress.length >= maxBufferedProgress) throw new _302_js__rspack_import_6/* .AgentContractError */.I2('event-count-exceeded', `Agent render event count exceeds ${String(maxBufferedProgress)}`); + if (bufferedProgress.length >= maxBufferedProgress) throw new _302_js__rspack_import_5/* .AgentContractError */.I2('event-count-exceeded', `Agent render event count exceeds ${String(maxBufferedProgress)}`); bufferedProgress.push(input); return; } - await (0,_315_js__rspack_import_5/* .runPromise */.pR)(offerProgress(input)); + await (0,_315_js__rspack_import_4/* .runPromise */.pR)(offerProgress(input)); } }); - const events = effect__rspack_import_8/* .unwrap */.oAg(effect__rspack_import_4/* .gen */.JkU(function*() { - const progressInputs = yield* effect__rspack_import_10/* .bounded */.Mm(0); - const flightDone = yield* effect__rspack_import_9/* .make */.L8(); + const events = effect__rspack_import_7/* .unwrap */.oAg(effect__rspack_import_3/* .gen */.JkU(function*() { + const progressInputs = yield* effect__rspack_import_9/* .bounded */.Mm(0); + const flightDone = yield* effect__rspack_import_8/* .make */.L8(); const bindProgress = ()=>{ - offerProgress = (input)=>effect__rspack_import_10/* .offer */.x(progressInputs, input).pipe(effect__rspack_import_4/* .flatMap */.qIB((accepted)=>{ - if (void 0 !== progressFailure) return effect__rspack_import_4/* .fail */.fJG(progressFailure); - if (!accepted) return effect__rspack_import_4/* .fail */.fJG(handoffRequired()); - return effect__rspack_import_4/* ["void"] */.rIH; + offerProgress = (input)=>effect__rspack_import_9/* .offer */.x(progressInputs, input).pipe(effect__rspack_import_3/* .flatMap */.qIB((accepted)=>{ + if (void 0 !== progressFailure) return effect__rspack_import_3/* .fail */.fJG(progressFailure); + if (!accepted) return effect__rspack_import_3/* .fail */.fJG(handoffRequired()); + return effect__rspack_import_3/* ["void"] */.rIH; })); }; - const finalizeProgress = (error)=>effect__rspack_import_4/* .sync */.OH5(()=>{ + const finalizeProgress = (error)=>effect__rspack_import_3/* .sync */.OH5(()=>{ progressFailure = error; - }).pipe(effect__rspack_import_4/* .andThen */.hgn(effect__rspack_import_10/* .shutdown */.n_(progressInputs))); - const setup = effect__rspack_import_4/* .gen */.JkU(function*() { - const flight = yield* effect__rspack_import_4/* .tryPromise */.$mh({ + }).pipe(effect__rspack_import_3/* .andThen */.hgn(effect__rspack_import_9/* .shutdown */.n_(progressInputs))); + const setup = effect__rspack_import_3/* .gen */.JkU(function*() { + const flight = yield* effect__rspack_import_3/* .tryPromise */.$mh({ catch: (error)=>hostError(options.signal, error), try: ()=>options.flight }); - if (options.signal.aborted) return yield* effect__rspack_import_4/* .fail */.fJG(abortError()); + if (options.signal.aborted) return yield* effect__rspack_import_3/* .fail */.fJG(abortError()); const root = yield* decodeFlightRoot(flight, options.demand, options.signal, flightDone); - if (options.signal.aborted) return yield* effect__rspack_import_4/* .fail */.fJG(abortError()); - const prepared = yield* effect__rspack_import_4/* ["try"] */.SvU({ - catch: (error)=>(0,_315_js__rspack_import_5/* .toRuntimeError */.qN)(error), + if (options.signal.aborted) return yield* effect__rspack_import_3/* .fail */.fJG(abortError()); + const prepared = yield* effect__rspack_import_3/* ["try"] */.SvU({ + catch: (error)=>(0,_315_js__rspack_import_4/* .toRuntimeError */.qN)(error), try: ()=>{ const ids = new Map(); const initial = snapshotTree(root, ids); @@ -16709,23 +16552,23 @@ const createAgentRenderEventSession = (options)=>{ } }); bindProgress(); - return effect__rspack_import_8/* .concat */.xWs(effect__rspack_import_8/* .fromArray */.ciY([ + return effect__rspack_import_7/* .concat */.xWs(effect__rspack_import_7/* .fromArray */.ciY([ prepared.shellInput, ...bufferedProgress - ]), reconcileLoopStream(root, prepared.ids, prepared.initial, options.limits, flightDone, progressInputs, sequence)).pipe(effect__rspack_import_8/* .mapEffect */.WK$((input)=>emitBoundRenderEvent(sequence, input)), effect__rspack_import_8/* .tap */.Mim((event)=>'shell' === event.type ? options.demand.markShell : effect__rspack_import_4/* ["void"] */.rIH), effect__rspack_import_8/* .takeUntil */.QKh((event)=>'complete' === event.type), effect__rspack_import_8/* .onExit */.cfM((exit)=>{ - if (effect__rspack_import_12/* .isSuccess */.oJ(exit)) return finalizeProgress(handoffRequired()); - const error = (0,_315_js__rspack_import_5/* .mapCause */.K0)(exit.cause); - return finalizeProgress(sequence.completed && (0,_315_js__rspack_import_5/* .isAbortError */.zf)(error) ? handoffRequired() : error); + ]), reconcileLoopStream(root, prepared.ids, prepared.initial, options.limits, flightDone, progressInputs, sequence)).pipe(effect__rspack_import_7/* .mapEffect */.WK$((input)=>emitBoundRenderEvent(sequence, input)), effect__rspack_import_7/* .tap */.Mim((event)=>'shell' === event.type ? options.demand.markShell : effect__rspack_import_3/* ["void"] */.rIH), effect__rspack_import_7/* .takeUntil */.QKh((event)=>'complete' === event.type), effect__rspack_import_7/* .onExit */.cfM((exit)=>{ + if (effect__rspack_import_11/* .isSuccess */.oJ(exit)) return finalizeProgress(handoffRequired()); + const error = (0,_315_js__rspack_import_4/* .mapCause */.K0)(exit.cause); + return finalizeProgress(sequence.completed && (0,_315_js__rspack_import_4/* .isAbortError */.zf)(error) ? handoffRequired() : error); })); }); - return yield* setup.pipe(effect__rspack_import_4/* .onExit */.cfM((exit)=>effect__rspack_import_12/* .isFailure */.N6(exit) ? finalizeProgress((0,_315_js__rspack_import_5/* .mapCause */.K0)(exit.cause)) : effect__rspack_import_4/* ["void"] */.rIH)); + return yield* setup.pipe(effect__rspack_import_3/* .onExit */.cfM((exit)=>effect__rspack_import_11/* .isFailure */.N6(exit) ? finalizeProgress((0,_315_js__rspack_import_4/* .mapCause */.K0)(exit.cause)) : effect__rspack_import_3/* ["void"] */.rIH)); })); return { - events: void 0 === clock ? events : effect__rspack_import_8/* .provideService */.PfK(events, effect__rspack_import_14/* .Clock */.zD, clock), + events: void 0 === clock ? events : effect__rspack_import_7/* .provideService */.PfK(events, effect__rspack_import_13/* .Clock */.zD, clock), progress }; }; -const toPublicEventStream = (events, demand, signal)=>(0,_315_js__rspack_import_5/* .streamToReadableStream */._I)(effect__rspack_import_8/* .interruptWhen */.S67(events, (0,_315_js__rspack_import_5/* .abortToInterrupt */.p7)(signal)), { +const toPublicEventStream = (events, demand, signal)=>(0,_315_js__rspack_import_4/* .streamToReadableStream */._I)(effect__rspack_import_7/* .interruptWhen */.S67(events, (0,_315_js__rspack_import_4/* .abortToInterrupt */.p7)(signal)), { closeOn: (event)=>'complete' === event.type, onPull: demand.notePull, onPullDelivered: demand.notePullEnd, @@ -16743,7 +16586,7 @@ const decodeAgentFlightStream = (flight, options = {})=>{ signal }).events, demand, signal); }; -const dispatcher_abortError = _302_js__rspack_import_6/* .agentRenderAbortError */.k2; +const dispatcher_abortError = _302_js__rspack_import_5/* .agentRenderAbortError */.k2; const abortedStream = ()=>new ReadableStream({ start (controller) { controller.error(dispatcher_abortError()); @@ -16778,7 +16621,7 @@ const drainCompleteDocument = async (events, signal)=>{ } if (void 0 !== complete) return complete; if (signal.aborted) throw dispatcher_abortError(); - throw new _302_js__rspack_import_6/* .AgentContractError */.I2('invalid-document', 'Flight stream ended without a complete document'); + throw new _302_js__rspack_import_5/* .AgentContractError */.I2('invalid-document', 'Flight stream ended without a complete document'); }; const createAgentRenderDispatcher = (host, options = {})=>{ const stream = (request)=>{ @@ -16789,7 +16632,7 @@ const createAgentRenderDispatcher = (host, options = {})=>{ demand, get flight () { const current = pendingFlight.current; - if (void 0 === current) return Promise.reject(new _302_js__rspack_import_6/* .AgentContractError */.I2('invalid-document', 'Flight worker is not running')); + if (void 0 === current) return Promise.reject(new _302_js__rspack_import_5/* .AgentContractError */.I2('invalid-document', 'Flight worker is not running')); return current; }, limits: { @@ -16920,21 +16763,21 @@ const appendNode = (node, content, capabilities, fallback)=>{ default: { const exhaustive = node; - throw new _302_js__rspack_import_6/* .AgentContractError */.I2('invalid-document', `Unsupported Agent Document node: ${String(exhaustive.kind)}`); + throw new _302_js__rspack_import_5/* .AgentContractError */.I2('invalid-document', `Unsupported Agent Document node: ${String(exhaustive.kind)}`); } } }; const project_mcp_isJsonObject = (value)=>null !== value && 'object' == typeof value && !Array.isArray(value); const objectStructuredContent = (value)=>{ if (void 0 === value) return; - const snapshot = (0,_302_js__rspack_import_6/* .snapshotJsonValue */.mY)(value, 'MCP structured content must be JSON-serializable'); + const snapshot = (0,_302_js__rspack_import_5/* .snapshotJsonValue */.mY)(value, 'MCP structured content must be JSON-serializable'); return project_mcp_isJsonObject(snapshot) ? snapshot : void 0; }; const resultMetadata = (document)=>{ if ('result' !== document.root.kind) return; const metadata = document.root.metadata; if (void 0 === metadata) return; - const snapshot = (0,_302_js__rspack_import_6/* .snapshotJsonValue */.mY)(metadata, 'MCP result _meta must be JSON-serializable'); + const snapshot = (0,_302_js__rspack_import_5/* .snapshotJsonValue */.mY)(metadata, 'MCP result _meta must be JSON-serializable'); if (!project_mcp_isJsonObject(snapshot)) throw new McpProjectionError('invalid-result-metadata', 'MCP result _meta must be a JSON object; Agent.Result metadata projects to CallToolResult._meta'); return snapshot; }; @@ -16964,8 +16807,8 @@ const attachMcpStructuredContent = (result, value)=>{ structuredContent: structured }; }; -const notifyProgress = (source, token, sendProgress)=>effect__rspack_import_4/* .tryPromise */.$mh({ - catch: (error)=>(0,_315_js__rspack_import_5/* .toRuntimeError */.qN)(error), +const notifyProgress = (source, token, sendProgress)=>effect__rspack_import_3/* .tryPromise */.$mh({ + catch: (error)=>(0,_315_js__rspack_import_4/* .toRuntimeError */.qN)(error), try: ()=>sendProgress({ progress: source.completed, progressToken: token, @@ -17006,18 +16849,18 @@ const documentProgressNodes = (document)=>{ appendProgressNodes(document.root, nodes); return nodes; }; -const projectMcpEventStream = effect__rspack_import_4/* .fnUntraced */.D9k(function*(events, options = {}) { +const projectMcpEventStream = effect__rspack_import_3/* .fnUntraced */.D9k(function*(events, options = {}) { let lastProgress = -1 / 0; let complete; const token = options.progressToken; const sendProgress = options.sendProgress; const notify = (source)=>{ - if (void 0 === token || void 0 === sendProgress) return effect__rspack_import_4/* ["void"] */.rIH; - if (!(source.completed > lastProgress)) return effect__rspack_import_4/* ["void"] */.rIH; + if (void 0 === token || void 0 === sendProgress) return effect__rspack_import_3/* ["void"] */.rIH; + if (!(source.completed > lastProgress)) return effect__rspack_import_3/* ["void"] */.rIH; lastProgress = source.completed; return notifyProgress(source, token, sendProgress); }; - yield* effect__rspack_import_8/* .runForEach */.o1d(events, (event)=>effect__rspack_import_4/* .gen */.JkU(function*() { + yield* effect__rspack_import_7/* .runForEach */.o1d(events, (event)=>effect__rspack_import_3/* .gen */.JkU(function*() { switch(event.type){ case 'progress': yield* notify(event); @@ -17038,7 +16881,7 @@ const projectMcpEventStream = effect__rspack_import_4/* .fnUntraced */.D9k(funct } } })); - if (void 0 === complete) return yield* effect__rspack_import_4/* .fail */.fJG(new _302_js__rspack_import_6/* .AgentContractError */.I2('invalid-document', 'MCP projector requires a complete document; the stream ended without one')); + if (void 0 === complete) return yield* effect__rspack_import_3/* .fail */.fJG(new _302_js__rspack_import_5/* .AgentContractError */.I2('invalid-document', 'MCP projector requires a complete document; the stream ended without one')); return Object.freeze({ document: complete, result: documentToCallToolResult(complete, options) @@ -17121,53 +16964,6 @@ const MarkdownContent = async ({ children, components })=>{ }); return createElement(Agent.Markdown, null, markdown.replace(/\n+$/u, '')); }; -const hookComponents = new Set(Object.values(_506_js__rspack_import_15/* .Hook */.qn)); -const isHookComponent = (value)=>hookComponents.has(value); -const resolveHookElement = (node)=>{ - let element = node; - while(isValidElement(element) && isHookComponent(element.type))element = element.type(element.props); - return element; -}; -const isAgentElement = (node, name)=>{ - const resolved = resolveHookElement(node); - return isValidElement(resolved) && resolved.type === name; -}; -const flattenText = (node)=>{ - if ('string' == typeof node || 'number' == typeof node) return String(node); - if (Array.isArray(node)) return node.map(flattenText).join(''); - if (isAgentElement(node, 'agent-hook-result')) throw new Error('Hook result contains duplicate roots'); - throw new Error('Hook additional context may contain only string or number children'); -}; -const lowerHookResult = (node)=>{ - const roots = Children.toArray(node).map(resolveHookElement); - if (1 !== roots.length || !isAgentElement(roots[0], 'agent-hook-result')) throw new Error('Expected exactly one agent-hook-result root'); - const result = roots[0]; - const contexts = Children.toArray(result.props.children).map(resolveHookElement).map((child)=>{ - if (isAgentElement(child, 'agent-hook-result')) throw new Error('Hook result contains duplicate roots'); - if (!isAgentElement(child, 'agent-hook-additional-context')) throw new Error('Hook result may contain only agent-hook-additional-context elements'); - return flattenText(child.props.children); - }); - if (0 === contexts.length) throw new Error('Hook result requires additional context'); - return { - hookSpecificOutput: { - additionalContext: contexts.join(''), - hookEventName: 'PostToolUse' - } - }; -}; -const createRscRequestContext = (label)=>{ - const storage = new AsyncLocalStorage(); - return Object.freeze({ - run (value, operation) { - return storage.run(value, operation); - }, - use () { - const value = storage.getStore(); - if (void 0 === value) throw new Error(`${label} used outside a render request`); - return value; - } - }); -}; var src_AGENT_DOCUMENT_VERSION = 1; var src_AGENT_REQUEST_STORE_VERSION = 6; var src_PLUGIN_STATE_DIRECTORY = "state"; @@ -17557,19 +17353,7 @@ const cliInputError = (command, input, error)=>{ }); return new CliInputError(issues.map(cliInputIssueLine).join('\n'), issues); }; -const resolveTerminal = (hostSurface, options)=>{ - if (void 0 !== options.terminal) return options.terminal; - if (void 0 === options.isTty) return (0,_terminal_capability_js__rspack_import_2/* .detectProcessTerminal */.JH)(hostSurface); - const stdout = { - columns: process.stdout.columns, - fd: 1, - isTTY: options.isTty(), - rows: process.stdout.rows - }; - return (0,_terminal_capability_js__rspack_import_2/* .detectProcessTerminal */.JH)(hostSurface, { - stdout - }); -}; +const resolveTerminal = (hostSurface, options)=>options.terminal ?? (0,_terminal_capability_js__rspack_import_2/* .detectProcessTerminal */.JH)(hostSurface); const webCommandRow = [ 'web', "Open one of the plugin's MCP Apps in a browser." @@ -18572,16 +18356,14 @@ __webpack_require__.d(__webpack_exports__, { }, "./node_modules/effect/dist/Array.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) { -/* import */ var _Equal_js__rspack_import_6 = __webpack_require__("./node_modules/effect/dist/Equal.js"); -/* import */ var _Equivalence_js__rspack_import_9 = __webpack_require__("./node_modules/effect/dist/Equivalence.js"); -/* import */ var _Function_js__rspack_import_2 = __webpack_require__("./node_modules/effect/dist/Function.js"); -/* import */ var _Hash_js__rspack_import_5 = __webpack_require__("./node_modules/effect/dist/Hash.js"); -/* import */ var _internal_array_js__rspack_import_3 = __webpack_require__("./node_modules/effect/dist/internal/array.js"); -/* import */ var _Iterable_js__rspack_import_4 = __webpack_require__("./node_modules/effect/dist/Iterable.js"); +/* import */ var _Equivalence_js__rspack_import_7 = __webpack_require__("./node_modules/effect/dist/Equivalence.js"); +/* import */ var _Function_js__rspack_import_4 = __webpack_require__("./node_modules/effect/dist/Function.js"); +/* import */ var _internal_array_js__rspack_import_2 = __webpack_require__("./node_modules/effect/dist/internal/array.js"); +/* import */ var _Iterable_js__rspack_import_3 = __webpack_require__("./node_modules/effect/dist/Iterable.js"); /* import */ var _Option_js__rspack_import_1 = __webpack_require__("./node_modules/effect/dist/Option.js"); -/* import */ var _Order_js__rspack_import_8 = __webpack_require__("./node_modules/effect/dist/Order.js"); +/* import */ var _Order_js__rspack_import_6 = __webpack_require__("./node_modules/effect/dist/Order.js"); /* import */ var _Record_js__rspack_import_0 = __webpack_require__("./node_modules/effect/dist/Record.js"); -/* import */ var _Result_js__rspack_import_7 = __webpack_require__("./node_modules/effect/dist/Result.js"); +/* import */ var _Result_js__rspack_import_5 = __webpack_require__("./node_modules/effect/dist/Result.js"); /** * Works with JavaScript arrays, readonly arrays, and non-empty arrays. * @@ -18607,6 +18389,7 @@ __webpack_require__.d(__webpack_exports__, { + /** * Exposes the global array constructor. * @@ -18663,6 +18446,7 @@ const make = (...elements) => elements; * * **Details** * + * `n` is rounded down. `NaN` and non-positive values are treated as `0`. * Elements are typed as `A | undefined` because the slots are empty. * * **Example** (Allocating a fixed-size array) @@ -18678,7 +18462,7 @@ const make = (...elements) => elements; * @category constructors * @since 2.0.0 */ -const allocate = n => new Array(n); +const allocate = n => new Array(Count.normalize(n)); /** * Creates a `NonEmptyArray` of length `n` where element `i` is computed by `f(i)`. * @@ -18688,9 +18472,9 @@ const allocate = n => new Array(n); * * **Details** * - * `n` is normalized to an integer greater than or equal to 1, so this function - * always returns at least one element. Supports both data-first and data-last - * usage. + * `n` is rounded down and normalized to an integer greater than or equal to 1. + * `NaN` is treated as `1`, so this function always returns at least one + * element. Supports both data-first and data-last usage. * * **Example** (Generating values from indices) * @@ -18707,7 +18491,7 @@ const allocate = n => new Array(n); * @since 2.0.0 */ const makeBy = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (n, f) => { - const max = Math.max(1, Math.floor(n)); + const max = Count.normalizeNonEmpty(n); const out = new Array(max); for (let i = 0; i < max; i++) { out[i] = f(i); @@ -19083,7 +18867,7 @@ const append = /*#__PURE__*/(/* unused pure expression or super */ null && (dual * @category combining * @since 2.0.0 */ -const appendAll = /*#__PURE__*/(0,_Function_js__rspack_import_2/* .dual */.XY)(2, (self, that) => fromIterable(self).concat(fromIterable(that))); +const appendAll = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, that) => fromIterable(self).concat(fromIterable(that))))); /** * Folds left-to-right while keeping every intermediate accumulator value. * @@ -19246,7 +19030,7 @@ const isReadonlyArrayEmpty = (/* unused pure expression or super */ null && (isA * @category guards * @since 4.0.0 */ -const isArrayNonEmpty = _internal_array_js__rspack_import_3/* .isArrayNonEmpty */.C; +const isArrayNonEmpty = _internal_array_js__rspack_import_2/* .isArrayNonEmpty */.C; /** * Checks whether a `ReadonlyArray` is non-empty, narrowing the type to * `NonEmptyReadonlyArray`. @@ -19271,7 +19055,7 @@ const isArrayNonEmpty = _internal_array_js__rspack_import_3/* .isArrayNonEmpty * * @category guards * @since 4.0.0 */ -const isReadonlyArrayNonEmpty = _internal_array_js__rspack_import_3/* .isArrayNonEmpty */.C; +const isReadonlyArrayNonEmpty = _internal_array_js__rspack_import_2/* .isArrayNonEmpty */.C; /** * Returns the number of elements in a `ReadonlyArray`. * @@ -19291,11 +19075,21 @@ const isReadonlyArrayNonEmpty = _internal_array_js__rspack_import_3/* .isArrayNo * @since 2.0.0 */ const length = self => self.length; +/** + * Checks whether a string represents a JavaScript array index: a non-negative + * integer below `2 ** 32 - 1`, written without leading zeroes, a sign, or + * exponent notation. + * + * @internal + */ +function isCanonicalArrayIndex(key) { + const index = Number(key); + return String(index) === key && Number.isInteger(index) && index >= 0 && index < 2 ** 32 - 1; +} /** @internal */ function isOutOfBounds(i, as) { return !Number.isFinite(i) || i < 0 || i >= as.length; } -const clamp = (i, as) => Math.floor(Math.min(Math.max(0, i), as.length)); /** * Reads an element at the given index safely, returning `Option.some` or * `Option.none` if the index is out of bounds. @@ -19619,6 +19413,7 @@ function init(self) { * @since 2.0.0 */ const initNonEmpty = self => self.slice(0, -1); +const clampCount = (n, length) => Math.min(Count.normalize(n), length); /** * Keeps the first `n` elements, creating a new array. * @@ -19628,7 +19423,8 @@ const initNonEmpty = self => self.slice(0, -1); * * **Details** * - * `n` is clamped to `[0, length]`. Returns an empty array when `n <= 0`. + * `n` is rounded down and clamped to `[0, length]`. `NaN` is treated as `0`. + * Returns an empty array when `n <= 0`. * * **Example** (Taking from the start) * @@ -19647,7 +19443,7 @@ const initNonEmpty = self => self.slice(0, -1); */ const take = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { const input = fromIterable(self); - return input.slice(0, clamp(n, input)); + return input.slice(0, clampCount(n, input.length)); }))); /** * Keeps the last `n` elements, creating a new array. @@ -19658,7 +19454,8 @@ const take = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 * * **Details** * - * `n` is clamped to `[0, length]`. Returns an empty array when `n <= 0`. + * `n` is rounded down and clamped to `[0, length]`. `NaN` is treated as `0`. + * Returns an empty array when `n <= 0`. * * **Example** (Taking from the end) * @@ -19676,7 +19473,7 @@ const take = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 */ const takeRight = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { const input = fromIterable(self); - const i = clamp(n, input); + const i = clampCount(n, input.length); return i === 0 ? [] : input.slice(-i); }))); /** @@ -19806,8 +19603,8 @@ const span = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 * * **Details** * - * `n` is clamped to `[0, length]`. When `n <= 0`, this returns a copy of the - * full array. + * `n` is rounded down and clamped to `[0, length]`. `NaN` is treated as `0`. + * When `n <= 0`, this returns a copy of the full array. * * **Example** (Dropping from the start) * @@ -19826,7 +19623,7 @@ const span = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 */ const drop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { const input = fromIterable(self); - return input.slice(clamp(n, input), input.length); + return input.slice(clampCount(n, input.length), input.length); }))); /** * Removes the last `n` elements, creating a new array. @@ -19837,7 +19634,7 @@ const drop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 * * **Details** * - * `n` is clamped to `[0, length]`. + * `n` is rounded down and clamped to `[0, length]`. `NaN` is treated as `0`. * * **Example** (Dropping from the end) * @@ -19855,7 +19652,7 @@ const drop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 */ const dropRight = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { const input = fromIterable(self); - return input.slice(0, input.length - clamp(n, input)); + return input.slice(0, input.length - clampCount(n, input.length)); }))); /** * Drops elements from the start while the predicate holds, returning the rest. @@ -20017,7 +19814,7 @@ const findLastIndex = /*#__PURE__*/(/* unused pure expression or super */ null & * @category searching * @since 2.0.0 */ -const findFirst = _Iterable_js__rspack_import_4/* .findFirst */.i8; +const findFirst = _Iterable_js__rspack_import_3/* .findFirst */.i8; /** * Returns the first selected value together with its index, wrapped in an * `Option`. @@ -20756,8 +20553,8 @@ const chop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 * * **Details** * - * `n` can be `0`, in which case all elements are placed in the second array. - * The index is floored to an integer. + * `n` is rounded down and clamped to `[0, length]`. `NaN` is treated as `0`, + * which places all elements in the second array. * * **Example** (Splitting at an index) * @@ -20775,7 +20572,7 @@ const chop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 */ const splitAt = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { const input = Array.from(self); - const _n = Math.floor(n); + const _n = Count.normalize(n); if (isReadonlyArrayNonEmpty(input)) { if (_n >= 1) { return splitAtNonEmpty(input, _n); @@ -20793,6 +20590,10 @@ const splitAt = /*#__PURE__*/(/* unused pure expression or super */ null && (dua * Use when downstream code requires the left side of the split to contain at * least one element. * + * **Details** + * + * `n` is rounded down and clamped to `[1, length]`. `NaN` is treated as `1`. + * * **Example** (Splitting a non-empty array) * * ```ts import.meta.vitest @@ -20807,7 +20608,7 @@ const splitAt = /*#__PURE__*/(/* unused pure expression or super */ null && (dua * @since 4.0.0 */ const splitAtNonEmpty = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { - const _n = Math.max(1, Math.floor(n)); + const _n = Count.normalizeNonEmpty(n); return _n >= self.length ? [copy(self), []] : [prepend(self.slice(1, _n), headNonEmpty(self)), self.slice(_n)]; }))); /** @@ -20819,7 +20620,8 @@ const splitAtNonEmpty = /*#__PURE__*/(/* unused pure expression or super */ null * * **Details** * - * Uses `chunksOf(ceil(length / n))` internally. The last chunk may be shorter. + * `n` is rounded down and normalized to at least `1`, with `NaN` treated as + * `1`. The last chunk may be shorter. * * **Example** (Splitting into groups) * @@ -20836,7 +20638,7 @@ const splitAtNonEmpty = /*#__PURE__*/(/* unused pure expression or super */ null */ const split = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { const input = fromIterable(self); - return chunksOf(input, Math.ceil(input.length / Math.floor(n))); + return chunksOf(input, Math.ceil(input.length / Count.normalizeNonEmpty(n))); }))); /** * Splits an iterable at the first element matching the predicate. The matching @@ -20903,7 +20705,8 @@ const copy = self => self.slice(); * * **Details** * - * Returns an empty array when `n <= 0`. + * `n` is rounded down. `NaN` and non-positive values are treated as `0`, which + * returns an empty array. * * **Example** (Padding an array) * @@ -20920,10 +20723,11 @@ const copy = self => self.slice(); * @since 3.8.4 */ const pad = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, (self, n, fill) => { - if (self.length >= n) { - return take(self, n); + const length = Count.normalize(n); + if (self.length >= length) { + return take(self, length); } - return appendAll(self, makeBy(n - self.length, () => fill)); + return appendAll(self, makeBy(length - self.length, () => fill)); }))); /** * Splits an iterable into chunks of length `n`. The last chunk may be shorter @@ -20936,8 +20740,10 @@ const pad = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, * * **Details** * - * `chunksOf(n)([])` is `[]`, not `[[]]`. Each chunk is a `NonEmptyArray`, and - * the outer return type preserves `NonEmptyArray`. + * `n` is rounded down and normalized to at least `1`; `NaN` and non-positive + * values therefore produce singleton chunks. `chunksOf(n)([])` is `[]`, not + * `[[]]`. Each chunk is a `NonEmptyArray`, and the outer return type preserves + * `NonEmptyArray`. * * **Example** (Chunking an array) * @@ -20969,8 +20775,9 @@ const chunksOf = /*#__PURE__*/(/* unused pure expression or super */ null && (du * * **Details** * - * Returns an empty array if `n <= 0` or the array has fewer than `n` elements. - * Each window is a tuple of exactly `n` elements. + * `n` is rounded down, with `NaN` and non-positive values treated as `0`. + * Returns an empty array if the normalized size is `0` or exceeds the array + * length. Each window is a tuple of exactly the normalized size. * * **Example** (Creating sliding windows) * @@ -20990,10 +20797,11 @@ const chunksOf = /*#__PURE__*/(/* unused pure expression or super */ null && (du */ const window = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { const input = fromIterable(self); - if (n > 0 && isReadonlyArrayNonEmpty(input)) { + const size = Count.normalize(n); + if (size > 0 && size <= input.length && isReadonlyArrayNonEmpty(input)) { return Array.from({ - length: input.length - (n - 1) - }, (_, index) => input.slice(index, index + n)); + length: input.length - (size - 1) + }, (_, index) => input.slice(index, index + size)); } return []; }))); @@ -21121,7 +20929,7 @@ const groupBy = /*#__PURE__*/(/* unused pure expression or super */ null && (dua return out; }))); const hashBucketsAdd = (buckets, value) => { - const hash = _Hash_js__rspack_import_5/* .hash */.tW(value); + const hash = Hash.hash(value); const bucket = buckets.get(hash); if (bucket === undefined) { buckets.set(hash, [value]); @@ -21129,7 +20937,7 @@ const hashBucketsAdd = (buckets, value) => { } // Hash collisions still require an Effect equality check. for (const previous of bucket) { - if (_Equal_js__rspack_import_6/* .equals */.aI(previous, value)) { + if (Equal.equals(previous, value)) { return false; } } @@ -21210,14 +21018,14 @@ const unionWith = /*#__PURE__*/(/* unused pure expression or super */ null && (d * @category set operations * @since 2.0.0 */ -const union = /*#__PURE__*/(0,_Function_js__rspack_import_2/* .dual */.XY)(2, (self, that) => { +const union = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, that) => { const a = fromIterable(self); const b = fromIterable(that); if (isReadonlyArrayNonEmpty(a)) { return isReadonlyArrayNonEmpty(b) ? dedupe(appendAll(a, b)) : a; } return b; -}); +}))); /** * Computes the intersection of two arrays using a custom equivalence. Order is * determined by the first array. @@ -21679,13 +21487,13 @@ const filter = /*#__PURE__*/(/* unused pure expression or super */ null && (dual * @category filtering * @since 2.0.0 */ -const partition = /*#__PURE__*/(0,_Function_js__rspack_import_2/* .dual */.XY)(2, (self, f) => { +const partition = /*#__PURE__*/(0,_Function_js__rspack_import_4/* .dual */.XY)(2, (self, f) => { const excluded = []; const satisfying = []; let i = 0; for (const a of self) { const result = f(a, i++); - if (_Result_js__rspack_import_7/* .isSuccess */.oJ(result)) { + if (_Result_js__rspack_import_5/* .isSuccess */.oJ(result)) { satisfying.push(result.success); } else { excluded.push(result.failure); @@ -22095,7 +21903,7 @@ const unfold = (b, f) => { * @category instances * @since 4.0.0 */ -const makeOrder = _Order_js__rspack_import_8/* .Array */.O3; +const makeOrder = _Order_js__rspack_import_6/* .Array */.O3; /** * Creates an `Equivalence` for arrays based on an element `Equivalence`. Two * arrays are equivalent when they have the same length and all elements are @@ -22116,7 +21924,7 @@ const makeOrder = _Order_js__rspack_import_8/* .Array */.O3; * @category instances * @since 4.0.0 */ -const makeEquivalence = _Equivalence_js__rspack_import_9/* .Array */.O3; +const makeEquivalence = _Equivalence_js__rspack_import_7/* .Array */.O3; /** * Runs a side-effect for each element. The callback receives `(element, index)`. * @@ -22558,7 +22366,6 @@ __webpack_require__.d(__webpack_exports__, { CZ: isArrayNonEmpty, ET: isReadonlyArrayNonEmpty, Ie: empty, - KC: union, Ts: fromIterable, jB: partition, of: of @@ -23915,6 +23722,7 @@ __webpack_require__.d(__webpack_exports__, { + /** @@ -24267,6 +24075,11 @@ const fromChunk = chunk => fromArray(Chunk.toReadonlyArray(chunk)); /** * Creates a `Channel` from an iterator that emits arrays of elements. * + * **Details** + * + * Finite fractional `chunkSize` values are rounded down. `NaN` and non-positive + * values are treated as `1` so every successful pull emits a non-empty array. + * * **Example** (Batching iterator output) * * ```ts import.meta.vitest @@ -24310,26 +24123,29 @@ const fromChunk = chunk => fromArray(Chunk.toReadonlyArray(chunk)); * @category constructors * @since 4.0.0 */ -const fromIteratorArray = (iterator, chunkSize = DefaultChunkSize) => fromPull(Effect.sync(() => { - const iter = iterator(); - let done = Option.none(); - return Effect.suspend(() => { - if (done._tag === "Some") return Cause.done(done.value); - const buffer = []; - while (buffer.length < chunkSize) { - const state = iter.next(); - if (state.done) { - if (buffer.length === 0) { - return Cause.done(state.value); +const fromIteratorArray = (iterator, chunkSize = DefaultChunkSize) => { + const size = Count.normalizeNonEmpty(chunkSize); + return fromPull(Effect.sync(() => { + const iter = iterator(); + let done = Option.none(); + return Effect.suspend(() => { + if (done._tag === "Some") return Cause.done(done.value); + const buffer = []; + while (buffer.length < size) { + const state = iter.next(); + if (state.done) { + if (buffer.length === 0) { + return Cause.done(state.value); + } + done = Option.some(state.value); + break; } - done = Option.some(state.value); - break; + buffer.push(state.value); } - buffer.push(state.value); - } - return Effect.succeed(buffer); - }); -})); + return Effect.succeed(buffer); + }); + })); +}; /** * Creates a `Channel` that emits all elements from an iterable. * @@ -24350,6 +24166,11 @@ const fromIterable = iterable => fromIterator(() => iterable[Symbol.iterator]()) /** * Creates a `Channel` that emits arrays of elements from an iterable. * + * **Details** + * + * Finite fractional `chunkSize` values are rounded down. `NaN` and non-positive + * values are treated as `1`. + * * **Example** (Batching iterable output) * * ```ts import.meta.vitest @@ -26293,6 +26114,29 @@ const catchCause = /*#__PURE__*/(/* unused pure expression or super */ null && ( return Effect.suspend(() => currentPull); }); })))); +/** + * Recovers from defects using the provided function. + * + * **Details** + * + * Typed failures and interruptions are not caught. + * + * **Example** (Recovering from a defect) + * + * ```ts import.meta.vitest + * import { Channel, Effect } from "effect" + * + * const channel = Channel.fromEffect(Effect.die("boom")).pipe( + * Channel.catchDefect((defect) => Channel.succeed(`recovered: ${defect}`)) + * ) + * + * Effect.runSync(Channel.runCollect(channel)) // => ["recovered: boom"] + * ``` + * + * @category error handling + * @since 4.0.0 + */ +const catchDefect = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, f) => catchCauseFilter(self, Cause.findDefect, f)))); /** * Runs an effect with the full failure `Cause` when the channel fails, then * fails the returned channel with the original cause. @@ -26872,9 +26716,8 @@ const splitLines = () => fromTransform((upstream, _scope) => Effect.sync(() => { // Accumulates text that has not yet been terminated by a line break. // Content is carried across chunks until a terminator is found. let stringBuilder = ""; - // Set when a chunk ends with \r so the next chunk can check whether - // the following character is \n (completing a \r\n pair) or not - // (standalone \r, which is itself a line terminator). + // A trailing \r completes the line immediately. Remember it only to + // suppress a leading \n in the next nonempty string. let midCRLF = false; // Remembers the upstream Done value after the first time the upstream // signals completion, so subsequent pulls return Done immediately @@ -26898,11 +26741,8 @@ const splitLines = () => fromTransform((upstream, _scope) => Effect.sync(() => { let indexOfLF = str.indexOf("\n"); if (midCRLF) { if (indexOfLF === 0) { - pushLine(""); from = 1; indexOfLF = str.indexOf("\n", from); - } else { - pushLine(""); } midCRLF = false; } @@ -26912,18 +26752,19 @@ const splitLines = () => fromTransform((upstream, _scope) => Effect.sync(() => { from = indexOfLF + 1; indexOfLF = str.indexOf("\n", from); } else { + pushLine(str.substring(from, indexOfCR)); if (str.length === indexOfCR + 1) { midCRLF = true; + from = str.length; indexOfCR = -1; } else { - pushLine(str.substring(from, indexOfCR)); from = indexOfCR + (indexOfLF === indexOfCR + 1 ? 2 : 1); indexOfCR = str.indexOf("\r", from); indexOfLF = str.indexOf("\n", from); } } } - stringBuilder = stringBuilder + str.substring(from, str.length - (midCRLF ? 1 : 0)); + stringBuilder = stringBuilder + str.substring(from); } } return Arr.isReadonlyArrayNonEmpty(chunkBuilder) ? chunkBuilder : null; @@ -26937,7 +26778,7 @@ const splitLines = () => fromTransform((upstream, _scope) => Effect.sync(() => { onFailure: Effect.failCause, onDone: leftover => { done = Option.some(leftover); - if (stringBuilder.length > 0 || midCRLF) { + if (stringBuilder.length > 0) { const last = stringBuilder; stringBuilder = ""; midCRLF = false; @@ -27627,6 +27468,11 @@ const runForEachWhile = /*#__PURE__*/(/* unused pure expression or super */ null /** * Concatenates a channel's `Uint8Array` chunks into a single `Uint8Array`. * + * **Gotchas** + * + * This materializes the full content in memory. The source channel must not + * reuse or mutate emitted buffers, which are retained until collection completes. + * * **Example** (Joining channel byte chunks) * * ```ts import.meta.vitest @@ -27641,11 +27487,6 @@ const runForEachWhile = /*#__PURE__*/(/* unused pure expression or super */ null * Array.from(bytes) // => [1, 2, 3, 4] * ``` * - * **Gotchas** - * - * This materializes the full content in memory. The source channel must not - * reuse or mutate emitted buffers, which are retained until collection completes. - * * @category running * @since 4.0.0 */ @@ -27699,13 +27540,6 @@ const runCollect = self => runFold(self, () => [], (acc, o) => { acc.push(o); return acc; }); -/** - * Runs a channel and outputs the done value. - * - * @category running - * @since 4.0.0 - */ -const runDone = self => runWith(self, identity_, Effect.succeed); /** * Runs a channel until the first output element is available, returning it in * an `Option`. @@ -28621,7 +28455,7 @@ const Service = function () { }; const ServiceProto = { [ServiceTypeId]: ServiceTypeId, - ... /*#__PURE__*/_Effectable_js__rspack_import_0/* .Prototype */.b({ + ... /*#__PURE__*/_Effectable_js__rspack_import_0/* .Prototype */.bp({ label: "Service", evaluate(fiber) { return (0,_internal_core_js__rspack_import_1/* .exitSucceed */.xt)(get(fiber.context, this)); @@ -29424,6 +29258,11 @@ const DeferredProto = { return (0,_Pipeable_js__rspack_import_1/* .pipeArguments */.tT)(this, arguments); } }; +const DeferredImpl = function () { + this.resumes = undefined; + this.effect = undefined; +}; +DeferredImpl.prototype = DeferredProto; /** * Creates an empty `Deferred` synchronously outside the `Effect` runtime. * @@ -29444,12 +29283,7 @@ const DeferredProto = { * @category unsafe * @since 4.0.0 */ -const makeUnsafe = () => { - const self = Object.create(DeferredProto); - self.resumes = undefined; - self.effect = undefined; - return self; -}; +const makeUnsafe = () => new DeferredImpl(); /** * Creates a new `Deferred`. * @@ -30128,15 +29962,15 @@ __webpack_require__.d(__webpack_exports__, { -const TypeId = "~effect/time/Duration"; +const TypeId = "~effect/Duration"; const bigint0 = /*#__PURE__*/BigInt(0); const bigint1 = /*#__PURE__*/BigInt(1); const bigint2 = /*#__PURE__*/BigInt(2); const bigint10 = /*#__PURE__*/BigInt(10); -const bigint24 = /*#__PURE__*/(/* unused pure expression or super */ null && (BigInt(24))); -const bigint60 = /*#__PURE__*/(/* unused pure expression or super */ null && (BigInt(60))); +const bigint24 = /*#__PURE__*/BigInt(24); +const bigint60 = /*#__PURE__*/BigInt(60); const bigint1e3 = /*#__PURE__*/BigInt(1_000); -const bigint1e6 = /*#__PURE__*/(/* unused pure expression or super */ null && (BigInt(1_000_000))); +const bigint1e6 = /*#__PURE__*/BigInt(1_000_000); const bigint1e9 = /*#__PURE__*/(/* unused pure expression or super */ null && (BigInt(1_000_000_000))); const roundTiesAwayFromZero = input => BigInt(input < 0 ? Math.ceil(input - 0.5) : Math.floor(input + 0.5)); const roundMillisToNanos = millis => roundTiesAwayFromZero(millis * 1_000_000); @@ -31573,7 +31407,7 @@ const CombinerMin = /*#__PURE__*/(/* unused pure expression or super */ null && //# sourceMappingURL=Duration.js.map __webpack_require__.d(__webpack_exports__, { }, { - Tn: infinity, + GP: format, bN: fromInputUnsafe, cF: nanos, kE: toMillis, @@ -31736,7 +31570,7 @@ const isEffect = _internal_core_js__rspack_import_0/* .isEffect */.yw; * ``` * * @see {@link forEach} for iterating over elements and applying an effect. - * @category combining + * @category collecting * @since 2.0.0 */ const all = _internal_effect_js__rspack_import_1/* .all */.Q7R; @@ -31764,7 +31598,7 @@ const all = _internal_effect_js__rspack_import_1/* .all */.Q7R; * await Effect.runPromise(program) // => [['0 is even', '2 is even'], [1, 3]] * ``` * - * @category filtering + * @category collecting * @since 2.0.0 */ const partition = _internal_effect_js__rspack_import_1/* .partition */.jBG; @@ -31802,7 +31636,7 @@ const partition = _internal_effect_js__rspack_import_1/* .partition */.jBG; * output // => ["Adding 1 at index 0", "Adding 2 at index 1", "Adding 3 at index 2", 6] * ``` * - * @category folding + * @category collecting * @since 2.0.0 */ const reduce = _internal_effect_js__rspack_import_1/* .reduce */.TSs; @@ -31830,7 +31664,7 @@ const reduce = _internal_effect_js__rspack_import_1/* .reduce */.TSs; * await Effect.runPromiseExit(program) // => Exit.fail(["0 is even", "2 is even"]) * ``` * - * @category validation + * @category collecting * @since 2.0.0 */ const validate = _internal_effect_js__rspack_import_1/* .validate */.tfT; @@ -31852,7 +31686,7 @@ const validate = _internal_effect_js__rspack_import_1/* .validate */.tfT; * await Effect.runPromise(program) // => Option.some(3) * ``` * - * @category searching + * @category collecting * @since 2.0.0 */ const findFirst = _internal_effect_js__rspack_import_1/* .findFirst */.i8i; @@ -31871,7 +31705,7 @@ const findFirst = _internal_effect_js__rspack_import_1/* .findFirst */.i8i; * * @see {@link findFirst} for the simpler effectful predicate-based variant * - * @category searching + * @category collecting * @since 4.0.0 */ const findFirstFilter = _internal_effect_js__rspack_import_1/* .findFirstFilter */.kAe; @@ -31936,7 +31770,7 @@ const findFirstFilter = _internal_effect_js__rspack_import_1/* .findFirstFilter * ``` * * @see {@link all} for combining multiple effects into one. - * @category sequencing + * @category collecting * @since 2.0.0 */ const forEach = _internal_effect_js__rspack_import_1/* .forEach */.jJl; @@ -31961,7 +31795,7 @@ const forEach = _internal_effect_js__rspack_import_1/* .forEach */.jJl; * await Effect.runPromise(empty) // => Option.none() * ``` * - * @category getters + * @category collecting * @since 2.0.0 */ const head = _internal_effect_js__rspack_import_1/* .head */.d5f; @@ -32372,7 +32206,7 @@ const never = _internal_effect_js__rspack_import_1/* .never */.ZmZ; * Effect.runSync(program) // => { x: 2, y: 3, sum: 5 } * ``` * - * @category constructors + * @category do notation * @since 2.0.0 */ const Do = _internal_effect_js__rspack_import_1.Do; @@ -32388,7 +32222,7 @@ const Do = _internal_effect_js__rspack_import_1.Do; * @see {@link Do} for starting from an empty accumulated record * @see {@link bind} for adding fields produced by effects * - * @category mapping + * @category do notation * @since 2.0.0 */ const bindTo = _internal_effect_js__rspack_import_1/* .bindTo */.JrD; @@ -32418,7 +32252,7 @@ const let_ = _internal_effect_js__rspack_import_1/* ["let"] */.uVU; * @see {@link bindTo} for naming the success value of an existing effect * @see {@link gen} for generator-based sequencing without accumulating a record * - * @category sequencing + * @category do notation * @since 2.0.0 */ const bind = _internal_effect_js__rspack_import_1/* .bind */.oIE; @@ -32695,6 +32529,23 @@ const yieldNowWith = _internal_effect_js__rspack_import_1/* .yieldNowWith */.KN3 * @since 4.0.0 */ const withFiber = _internal_core_js__rspack_import_0/* .withFiber */.R6; +/** + * Accesses the current fiber to compute a successful value. + * + * **Example** (Computing a value from the current fiber) + * + * ```ts import.meta.vitest + * import { Effect } from "effect" + * + * const program = Effect.withFiberSucceed((fiber) => typeof fiber.id) + * + * Effect.runSync(program) // => "number" + * ``` + * + * @category constructors + * @since 4.0.0 + */ +const withFiberSucceed = _internal_core_js__rspack_import_0/* .withFiberSucceed */.Hq; // ----------------------------------------------------------------------------- // Conversions // ----------------------------------------------------------------------------- @@ -34072,7 +33923,7 @@ const orDie = _internal_effect_js__rspack_import_1/* .orDie */.QgK; * output // => ["expected error: NetworkError", Exit.fail("NetworkError")] * ``` * - * @category sequencing + * @category error handling * @since 2.0.0 */ const tapError = _internal_effect_js__rspack_import_1/* .tapError */.sFT; @@ -34110,7 +33961,7 @@ const tapError = _internal_effect_js__rspack_import_1/* .tapError */.sFT; * output // => ["expected error: 504", Exit.fail(new NetworkError({ statusCode: 504 }))] * ``` * - * @category sequencing + * @category error handling * @since 2.0.0 */ const tapErrorTag = _internal_effect_js__rspack_import_1/* .tapErrorTag */.k$L; @@ -34146,7 +33997,7 @@ const tapErrorTag = _internal_effect_js__rspack_import_1/* .tapErrorTag */.k$L; * output // => ["Logging cause: Something went wrong", Exit.fail("Something went wrong")] * ``` * - * @category sequencing + * @category error handling * @since 4.0.0 */ const tapCause = _internal_effect_js__rspack_import_1/* .tapCause */.dGm; @@ -34178,7 +34029,7 @@ const tapCause = _internal_effect_js__rspack_import_1/* .tapCause */.dGm; * output // => ["Logging failure cause: Network timeout", Exit.fail("Network timeout")] * ``` * - * @category sequencing + * @category error handling * @since 4.0.0 */ const tapCauseIf = _internal_effect_js__rspack_import_1/* .tapCauseIf */.cA6; @@ -34201,7 +34052,7 @@ const tapCauseIf = _internal_effect_js__rspack_import_1/* .tapCauseIf */.cA6; * @see {@link tapCause} for observing every failure cause * @see {@link catchCauseFilter} for recovering from selected causes instead of only observing them * - * @category sequencing + * @category error handling * @since 4.0.0 */ const tapCauseFilter = _internal_effect_js__rspack_import_1/* .tapCauseFilter */.bKC; @@ -34236,7 +34087,7 @@ const tapCauseFilter = _internal_effect_js__rspack_import_1/* .tapCauseFilter */ * output // => ["defect: Something went wrong", Exit.die("Something went wrong")] * ``` * - * @category sequencing + * @category error handling * @since 2.0.0 */ const tapDefect = _internal_effect_js__rspack_import_1/* .tapDefect */.nAi; @@ -34577,8 +34428,9 @@ const withErrorReporting = _internal_effect_js__rspack_import_1/* .withErrorRepo * **Details** * * If the source effect succeeds, its value is preserved. If it fails in the - * error channel, `orElseSucceed` evaluates the fallback and succeeds with that - * value, removing the typed error from the returned effect. + * error channel, `orElseSucceed` evaluates the fallback with that error and + * succeeds with the returned value, removing the typed error from the returned + * effect. * * Defects and interruptions are not recovered by this operator. * @@ -34597,9 +34449,9 @@ const withErrorReporting = _internal_effect_js__rspack_import_1/* .withErrorRepo * } * } * - * const program = Effect.orElseSucceed(validate(-1), () => 18) + * const program = Effect.orElseSucceed(validate(-1), (error) => error === "IllegalAgeError" ? 18 : 0) * - * Effect.runSyncExit(program) // => Exit.succeed(18) + * Effect.runSyncExit(program) // => Exit.succeed(0) * ``` * * @category error handling @@ -34723,21 +34575,8 @@ const timeout = _internal_effect_js__rspack_import_1/* .timeout */.wRz; */ const timeoutOption = _internal_effect_js__rspack_import_1/* .timeoutOption */.D52; /** - * Applies a timeout to an effect, with a fallback effect executed if the timeout is reached. - * - * **When to use** - * - * Use when a timeout of an `Effect` should switch to a fallback effect. - * - * **Details** - * - * The fallback effect is created lazily by `orElse` and may introduce its own - * success, failure, and requirement types. - * - * **Gotchas** - * - * If the timeout wins, the source effect is interrupted before the fallback is - * run. + * Applies a timeout to an effect, lazily evaluating `orElse` after interrupting + * the source if the timeout is reached. * * **Example** (Falling back on timeout) * @@ -34985,7 +34824,7 @@ const raceFirst = _internal_effect_js__rspack_import_1/* .raceFirst */.KT6; * output // => [[2, 4], [2, 3]] * ``` * - * @category filtering + * @category collecting * @since 2.0.0 */ const filter = _internal_effect_js__rspack_import_1/* .filter */.pbD; @@ -35005,7 +34844,7 @@ const filter = _internal_effect_js__rspack_import_1/* .filter */.pbD; * @see {@link filter} for keeping original elements with a boolean predicate, refinement, or effectful predicate * @see {@link filterMapEffect} for using an effectful `Filter` * - * @category filtering + * @category collecting * @since 2.0.0 */ const filterMap = _internal_effect_js__rspack_import_1/* .filterMap */.x1Q; @@ -35030,7 +34869,7 @@ const filterMap = _internal_effect_js__rspack_import_1/* .filterMap */.x1Q; * @see {@link filterMap} for using a synchronous `Filter` * @see {@link filter} for keeping original elements with a predicate * - * @category filtering + * @category collecting * @since 4.0.0 */ const filterMapEffect = _internal_effect_js__rspack_import_1/* .filterMapEffect */.E8K; @@ -36571,6 +36410,8 @@ const onExitPrimitive = _internal_effect_js__rspack_import_1/* .onExitPrimitive * Ensures that a cleanup function runs whether this effect succeeds, fails, or * is interrupted. * + * **Details** + * * If both the effect and the cleanup function fail, the two causes are merged. * * **Example** (Observing every exit) @@ -36700,8 +36541,8 @@ const onExitFilter = _internal_effect_js__rspack_import_1/* .onExitFilter */.uRq */ const cached = _internal_effect_js__rspack_import_1/* .cached */.PO3; /** - * Returns an effect that caches its result for a specified `Duration`, - * known as "timeToLive" (TTL). + * Returns an effect that caches its result for a fixed duration or a duration + * computed from its `Exit`, known as "timeToLive" (TTL). * * **When to use** * @@ -36720,6 +36561,17 @@ const cached = _internal_effect_js__rspack_import_1/* .cached */.PO3; * After the specified duration has passed, the cache expires, and the effect * will be recomputed upon the next evaluation. * + * `timeToLive` accepts a `Duration.Input` or a function from `Exit` to + * `Duration.Input`. The function runs once after each fresh computation, + * including failures, so successes and failures can have different TTLs. It + * does not run when the cache is created or when a cached result is reused. + * The callback also receives interruption exits, which are cached for the + * returned duration. + * + * The TTL starts when the computation completes. Concurrent callers share the + * pending computation. A zero TTL expires immediately, and an infinite TTL + * keeps the result indefinitely. + * * **Example** (Memoizing an effect with TTL) * * ```ts import.meta.vitest @@ -36744,6 +36596,26 @@ const cached = _internal_effect_js__rspack_import_1/* .cached */.PO3; * output // => ["expensive task...", "result 1", "result 1", "result 1"] * ``` * + * **Example** (Caching successes while retrying failures) + * + * ```ts import.meta.vitest + * import { Effect, Exit } from "effect" + * + * let attempts = 0 + * const task = Effect.suspend(() => + * ++attempts === 1 ? Effect.fail("temporary failure") : Effect.succeed(42) + * ) + * const program = Effect.gen(function*() { + * const cached = yield* task.pipe( + * Effect.cachedWithTTL((exit) => Exit.isSuccess(exit) ? "1 hour" : 0) + * ) + * yield* Effect.exit(cached) + * return yield* cached + * }) + * + * Effect.runSync(program) // => 42 + * ``` + * * @see {@link cached} for a similar function that caches the result * indefinitely. * @see {@link cachedInvalidateWithTTL} for a similar function that includes an @@ -37123,10 +36995,10 @@ const repeat = _internal_schedule_js__rspack_import_2/* .repeat */.ux; * const program = Effect.repeatOrElse( * task, * Schedule.recurs(3), - * (error, attempts) => + * (error, previous) => * Effect.sync(() => { output.push( * `Final failure: ${error}, after ${ - * Option.getOrElse(attempts, () => 0) + * Option.isSome(previous) ? previous.value.attempt : 0 * } attempts` * ) }).pipe(Effect.map(() => 0)) * ) @@ -37914,7 +37786,7 @@ const forkDetach = _internal_effect_js__rspack_import_1/* .forkDetach */.yxg; * @see {@link forkIn} for forking into an explicit scope * @see {@link forkScoped} for forking fibers tied to the current scope * - * @category sequencing + * @category forking * @since 2.0.0 */ const awaitAllChildren = _internal_effect_js__rspack_import_1/* .awaitAllChildren */.PCg; @@ -39068,14 +38940,10 @@ const withLogSpan = /*#__PURE__*/(/* unused pure expression or super */ null && // Metrics // ----------------------------------------------------------------------------- /** - * Updates the `Metric` every time the `Effect` is executed. - * - * **Details** - * - * Also accepts an optional function which can be used to map the `Exit` value - * of the `Effect` into a valid `Input` for the `Metric`. + * Updates a metric after each effect execution, optionally mapping its `Exit` to + * the metric's input. * - * **Example** (Incrementing a metric for each execution) + * **Example** (Counting executions) * * ```ts import.meta.vitest * import { Effect, Metric } from "effect" @@ -39092,12 +38960,11 @@ const withLogSpan = /*#__PURE__*/(/* unused pure expression or super */ null && * Effect.runSync(Metric.value(counter)).count // => 1 * ``` * - * **Example** (Mapping exits before updating a metric) + * **Example** (Mapping exits) * * ```ts import.meta.vitest * import { Effect, Exit, Metric } from "effect" * - * // Track different exit types with custom mapping * const exitTracker = Metric.frequency("exit_types", { * description: "Tracks success/failure/defect counts" * }) @@ -39357,7 +39224,7 @@ const trackDuration = /*#__PURE__*/(/* unused pure expression or super */ null & * Effect.runSync(runnable) // => "Transaction complete" * ``` * - * @category services + * @category transactions * @since 4.0.0 */ class Transaction extends /*#__PURE__*/(/* unused pure expression or super */ null && (Context.Service()("effect/Effect/Transaction"))) {} @@ -39986,6 +39853,7 @@ __webpack_require__.d(__webpack_exports__, { * When the effect is evaluated, it calls `evaluate` with the current fiber. * * @see {@link Class} for a class-based approach to defining custom Effect values + * @see {@link Mixin} for wrapping an existing class constructor * * @category prototypes * @since 4.0.0 @@ -39994,14 +39862,15 @@ const Prototype = options => (0,_internal_core_js__rspack_import_0/* .makePrimit op: options.label, [_internal_core_js__rspack_import_0/* .evaluate */._3]: options.evaluate }); +const proto = /*#__PURE__*/(/* unused pure expression or super */ null && (Prototype({ + label: "Effectable", + evaluate(_) { + return this.asEffect(); + } +}))); const Base = /*#__PURE__*/(/* unused pure expression or super */ null && ((() => { const Base = function () {}; - Base.prototype = /*#__PURE__*/Prototype({ - label: "Effectable", - evaluate(_) { - return this; - } - }); + Base.prototype = proto; return Base; })())); /** @@ -40013,14 +39882,64 @@ const Base = /*#__PURE__*/(/* unused pure expression or super */ null && ((() => * as `Effect` values. * * @see {@link Prototype} for a lower-level primitive approach to creating custom Effect-like values without a class + * @see {@link Mixin} for wrapping an existing class constructor * @category constructors * @since 2.0.0 */ class Class extends (/* unused pure expression or super */ null && (Base)) {} +/** + * Returns a subclass of the provided class that inserts the Effect prototype + * into the inheritance chain. + * + * **When to use** + * + * Use to make instances of an existing class behave as `Effect` values without + * extending {@link Class} or modifying the original prototype. + * + * **Details** + * + * Pass the class to wrap, then implement `asEffect` on the final class. The + * returned class is abstract, and the success, error, and service types are + * inferred from the concrete `asEffect` return type. Concrete and abstract base + * classes are supported. Constructor parameters and instance members are + * preserved, except that Effect's prototype members shadow base prototype + * members with the same name: `pipe`, `toString`, `toJSON`, `[Symbol.iterator]`, + * and `[Symbol.for("nodejs.util.inspect.custom")]`. + * + * **Example** (Evaluating a mixed-in class) + * + * ```ts import.meta.vitest + * import { Effect, Effectable } from "effect" + * + * class Box { + * constructor(readonly value: number) {} + * } + * + * class EffectBox extends Effectable.Mixin(Box) { + * asEffect() { + * return Effect.succeed(this.value) + * } + * } + * + * const box = new EffectBox(2) + * Effect.isEffect(box) // => true + * await Effect.runPromise(box) // => 2 + * ``` + * + * @see {@link Prototype} for a lower-level primitive approach to creating custom Effect-like values without a class + * @see {@link Class} for a base constructor to extend + * @category constructors + * @since 4.0.0 + */ +const Mixin = klass => { + class Mixed extends klass {} + Object.defineProperties(Mixed.prototype, Object.getOwnPropertyDescriptors(proto)); + return Mixed; +}; //# sourceMappingURL=Effectable.js.map __webpack_require__.d(__webpack_exports__, { }, { - b: Prototype + bp: Prototype }); @@ -40060,7 +39979,7 @@ __webpack_require__.d(__webpack_exports__, { * @category type IDs * @since 4.0.0 */ -const EncodingErrorTypeId = "~effect/encoding/EncodingError"; +const EncodingErrorTypeId = "~effect/Encoding/EncodingError"; /** * Error returned when an encoding or decoding operation cannot process its * input. @@ -40382,6 +40301,8 @@ const encodeHex = input => typeof input === "string" ? hexEncodeUint8Array(encod * Generates a random lowercase hexadecimal string, optimized for lengths that * are multiples of 8. * + * **Details** + * * `length` is not validated. The function generates `length >>> 3` random * 8-character words, so non-negative lengths below `2 ** 32` are rounded down * to a multiple of 8 and other values follow JavaScript's unsigned 32-bit @@ -40395,12 +40316,41 @@ const encodeHex = input => typeof input === "string" ? hexEncodeUint8Array(encod * @since 4.0.0 */ const randomHex = length => { - let result = ""; - for (let i = length >>> 3; i > 0; i--) { - const word = Math.random() * 0x100000000 >>> 0; - result += byteToHex[word >>> 24] + byteToHex[word >>> 16 & 0xff] + byteToHex[word >>> 8 & 0xff] + byteToHex[word & 0xff]; + switch (length) { + case 16: + return randomHex16(); + case 32: + return randomHex32(); + default: + { + let result = ""; + for (let i = length >>> 3; i > 0; i--) { + result += randomHex8(); + } + return result; + } } - return result; +}; +const hexCharCodes = /*#__PURE__*/Uint8Array.from("0123456789abcdef", c => c.charCodeAt(0)); +const randomWord = () => Math.random() * 0x100000000 >>> 0; +// Trace and span identifiers are the common lengths. A single +// String.fromCharCode call produces a flat string, which avoids rope +// flattening when the identifier is later serialized. +const randomHex8 = () => { + const a = randomWord(); + return String.fromCharCode(hexCharCodes[a >>> 28], hexCharCodes[a >>> 24 & 15], hexCharCodes[a >>> 20 & 15], hexCharCodes[a >>> 16 & 15], hexCharCodes[a >>> 12 & 15], hexCharCodes[a >>> 8 & 15], hexCharCodes[a >>> 4 & 15], hexCharCodes[a & 15]); +}; +const randomHex16 = () => { + const a = randomWord(); + const b = randomWord(); + return String.fromCharCode(hexCharCodes[a >>> 28], hexCharCodes[a >>> 24 & 15], hexCharCodes[a >>> 20 & 15], hexCharCodes[a >>> 16 & 15], hexCharCodes[a >>> 12 & 15], hexCharCodes[a >>> 8 & 15], hexCharCodes[a >>> 4 & 15], hexCharCodes[a & 15], hexCharCodes[b >>> 28], hexCharCodes[b >>> 24 & 15], hexCharCodes[b >>> 20 & 15], hexCharCodes[b >>> 16 & 15], hexCharCodes[b >>> 12 & 15], hexCharCodes[b >>> 8 & 15], hexCharCodes[b >>> 4 & 15], hexCharCodes[b & 15]); +}; +const randomHex32 = () => { + const a = randomWord(); + const b = randomWord(); + const c = randomWord(); + const d = randomWord(); + return String.fromCharCode(hexCharCodes[a >>> 28], hexCharCodes[a >>> 24 & 15], hexCharCodes[a >>> 20 & 15], hexCharCodes[a >>> 16 & 15], hexCharCodes[a >>> 12 & 15], hexCharCodes[a >>> 8 & 15], hexCharCodes[a >>> 4 & 15], hexCharCodes[a & 15], hexCharCodes[b >>> 28], hexCharCodes[b >>> 24 & 15], hexCharCodes[b >>> 20 & 15], hexCharCodes[b >>> 16 & 15], hexCharCodes[b >>> 12 & 15], hexCharCodes[b >>> 8 & 15], hexCharCodes[b >>> 4 & 15], hexCharCodes[b & 15], hexCharCodes[c >>> 28], hexCharCodes[c >>> 24 & 15], hexCharCodes[c >>> 20 & 15], hexCharCodes[c >>> 16 & 15], hexCharCodes[c >>> 12 & 15], hexCharCodes[c >>> 8 & 15], hexCharCodes[c >>> 4 & 15], hexCharCodes[c & 15], hexCharCodes[d >>> 28], hexCharCodes[d >>> 24 & 15], hexCharCodes[d >>> 20 & 15], hexCharCodes[d >>> 16 & 15], hexCharCodes[d >>> 12 & 15], hexCharCodes[d >>> 8 & 15], hexCharCodes[d >>> 4 & 15], hexCharCodes[d & 15]); }; /** * Decodes a hexadecimal string into bytes safely. @@ -40524,10 +40474,9 @@ const base64codes = (/* unused pure expression or super */ null && ([255, 255, 2 // Base64Url internals const base64UrlEncodeUint8Array = data => base64EncodeUint8Array(data).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_"); // Hex internals -const byteToHex = []; -for (let i = 0; i < 256; i++) { - byteToHex.push(i.toString(16).padStart(2, "0")); -} +const byteToHex = /*#__PURE__*/(/* unused pure expression or super */ null && (Array.from({ + length: 256 +}, (_, i) => i.toString(16).padStart(2, "0")))); const hexEncodeUint8Array = bytes => { let result = ""; for (let i = 0; i < bytes.length; i++) { @@ -40600,7 +40549,7 @@ __webpack_require__.d(__webpack_exports__, { * @category symbols * @since 2.0.0 */ -const symbol = "~effect/interfaces/Equal"; +const symbol = "~effect/Equal"; function equals() { if (arguments.length === 1) { return self => compareBoth(self, arguments[0]); @@ -41746,6 +41695,7 @@ const Proto = (/* unused pure expression or super */ null && ({ const self = this; return effect.contextWith(context => effect.succeed(makeProto(self.steps.map(step => ({ ...step, + while: step.while ? input => effect.provideContext(step.while(input), context) : undefined, provide: Layer.isLayer(step.provide) ? Layer.provide(step.provide, Layer.succeedContext(context)) : step.provide }))))); }, @@ -43582,6 +43532,7 @@ __webpack_require__.d(__webpack_exports__, { * - Handles `BigInt`, `Symbol`, `Set`, `Map`, `Date`, `RegExp`, and class * instances that `JSON.stringify` cannot represent. * - Circular references are shown as `"[Circular]"` instead of throwing. + * - Failures while inspecting a value are rendered as diagnostic placeholders instead of throwing. * - Primitives: stringified naturally (`null`, `undefined`, `123`, `true`). * Strings are JSON-quoted. * - Objects with a custom `toString` (not `Object.prototype.toString`): @@ -43646,6 +43597,14 @@ function format(input, options) { } }; function recur(v, d = 0) { + try { + return recurUnsafe(v, d); + } catch { + if (typeof v === "object" && v !== null || typeof v === "function") ancestors.delete(v); + return "[inspection threw]"; + } + } + function recurUnsafe(v, d = 0) { if (typeof v === "string") return JSON.stringify(v); if (typeof v === "number" || v == null || typeof v === "boolean" || typeof v === "symbol") return String(v); if (typeof v === "bigint") return String(v) + "n"; @@ -43661,16 +43620,16 @@ function format(input, options) { output = formatDate(v); } else if (!options?.ignoreToString && _Predicate_js__rspack_import_1/* .hasProperty */.i5(v, "toString") && typeof v["toString"] === "function" && v["toString"] !== Object.prototype.toString && v["toString"] !== Array.prototype.toString) { const s = safeToString(v); - output = v instanceof Error && v.cause ? `${s} (cause: ${recur(v.cause, d)})` : s; + output = v instanceof Error && v.cause !== undefined ? `${s} (cause: ${recur(v.cause, d)})` : s; } else if (Symbol.iterator in v) { output = `${v.constructor.name}(${recur(Array.from(v), d)})`; } else { const keys = ownKeys(v); if (!gap || keys.length <= 1) { - const body = `{${keys.map(k => `${formatPropertyKey(k)}:${recur(v[k], d)}`).join(",")}}`; + const body = `{${keys.map(k => `${formatPropertyKey(k)}:${recur(safeGet(v, k), d)}`).join(",")}}`; output = wrap(v, body); } else { - const body = `{\n${keys.map(k => `${ind(d + 1)}${formatPropertyKey(k)}: ${recur(v[k], d + 1)}`).join(",\n")}\n${ind(d)}}`; + const body = `{\n${keys.map(k => `${ind(d + 1)}${formatPropertyKey(k)}: ${recur(safeGet(v, k), d + 1)}`).join(",\n")}\n${ind(d)}}`; output = wrap(v, body); } } @@ -43717,6 +43676,13 @@ function safeToString(input) { return "[toString threw]"; } } +function safeGet(input, key) { + try { + return input[key]; + } catch { + return "[property access threw]"; + } +} /** * Stringifies a value to JSON safely, silently dropping circular references. * @@ -44453,7 +44419,7 @@ __webpack_require__.d(__webpack_exports__, { * @category symbols * @since 2.0.0 */ -const symbol = "~effect/interfaces/Hash"; +const symbol = "~effect/Hash"; /** * Computes a hash value for any given value. * @@ -44495,10 +44461,6 @@ const hash = self => { return number(self); case "bigint": return string(self.toString(10)); - case "boolean": - return string(String(self)); - case "symbol": - return string(String(self)); case "string": return string(self); case "undefined": @@ -44543,7 +44505,8 @@ const hash = self => { } } default: - throw new Error(`BUG: unhandled typeof ${typeof self} - please report an issue at https://github.com/Effect-TS/effect/issues`); + // The remaining primitive types are boolean and symbol. + return string(String(self)); } }; /** @@ -44698,14 +44661,8 @@ const isHash = u => (0,_Predicate_js__rspack_import_2/* .hasProperty */.i5)(u, s * @since 2.0.0 */ const number = n => { - if (n !== n) { - return string("NaN"); - } - if (n === Infinity) { - return string("Infinity"); - } - if (n === -Infinity) { - return string("-Infinity"); + if (n !== n || n === Infinity || n === -Infinity) { + return string(String(n)); } let h = n | 0; if (h !== n) { @@ -45165,14 +45122,15 @@ __webpack_require__.d(__webpack_exports__, { + /** * Creates an iterable by applying a function to consecutive integers. * * **Details** * - * The function is called with each index starting from `0`. If no length is - * specified, the iterable is infinite. This is useful for generating - * sequences, patterns, or any indexed data. + * The function is called with each index starting from `0`. If a length is + * provided, it is rounded down and normalized to at least `1`, with `NaN` + * treated as `1`. If no length is specified, the iterable is infinite. * * **Example** (Generating values by index) * @@ -45197,7 +45155,7 @@ __webpack_require__.d(__webpack_exports__, { * @since 2.0.0 */ const makeBy = (f, options) => { - const max = options?.length !== undefined ? Math.max(1, Math.floor(options.length)) : Infinity; + const max = options?.length !== undefined ? Count.normalizeNonEmpty(options.length) : Infinity; return { [Symbol.iterator]() { let i = 0; @@ -45251,7 +45209,8 @@ const range = (start, end) => { * * **Details** * - * `n` is normalized to an integer greater than or equal to `1`. + * `n` is rounded down and normalized to an integer greater than or equal to + * `1`. `NaN` is treated as `1`. * * **Example** (Repeating a value) * @@ -45277,7 +45236,8 @@ const replicate = /*#__PURE__*/(/* unused pure expression or super */ null && (d * * **Details** * - * The result is lazy. Each repetition obtains a new iterator from `self`. + * The result is lazy. `n` is rounded down and normalized to at least `1`, with + * `NaN` treated as `1`. Each repetition obtains a new iterator from `self`. * * @see {@link forever} for repeating without an upper bound * @see {@link replicate} for repeating a single value @@ -45650,7 +45610,8 @@ const headUnsafe = self => { * * **Details** * - * `n` is normalized to a non-negative integer. + * `n` is rounded down and normalized to a non-negative integer. `NaN` is + * treated as `0`. * * **Example** (Taking from the start) * @@ -45678,24 +45639,27 @@ const headUnsafe = self => { * @category getters * @since 2.0.0 */ -const take = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => ({ - [Symbol.iterator]() { - let i = 0; - const iterator = self[Symbol.iterator](); - return { - next() { - if (i < n) { - i++; - return iterator.next(); +const take = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { + const count = Count.normalize(n); + return { + [Symbol.iterator]() { + let i = 0; + const iterator = self[Symbol.iterator](); + return { + next() { + if (i < count) { + i++; + return iterator.next(); + } + return { + done: true, + value: undefined + }; } - return { - done: true, - value: undefined - }; - } - }; - } -})))); + }; + } + }; +}))); /** * Takes the longest initial `Iterable` prefix for which all elements satisfy the * specified predicate. @@ -45754,7 +45718,8 @@ const takeWhile = /*#__PURE__*/(/* unused pure expression or super */ null && (d * * **Details** * - * `n` is normalized to a non-negative integer. + * `n` is rounded down and normalized to a non-negative integer. `NaN` is + * treated as `0`. * * **Example** (Dropping from the start) * @@ -45781,27 +45746,30 @@ const takeWhile = /*#__PURE__*/(/* unused pure expression or super */ null && (d * @category getters * @since 2.0.0 */ -const drop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => ({ - [Symbol.iterator]() { - const iterator = self[Symbol.iterator](); - let i = 0; - return { - next() { - while (i < n) { - const result = iterator.next(); - if (result.done) { - return { - done: true, - value: undefined - }; +const drop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { + const count = Count.normalize(n); + return { + [Symbol.iterator]() { + const iterator = self[Symbol.iterator](); + let i = 0; + return { + next() { + while (i < count) { + const result = iterator.next(); + if (result.done) { + return { + done: true, + value: undefined + }; + } + i++; } - i++; + return iterator.next(); } - return iterator.next(); - } - }; - } -})))); + }; + } + }; +}))); /** * Returns the first element that satisfies the specified * predicate, or `None` if no such element exists. @@ -46168,6 +46136,8 @@ const contains = /*#__PURE__*/(/* unused pure expression or super */ null && (co /** * Splits an `Iterable` into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of * the `Iterable`. + * `n` is rounded down and normalized to at least `1`; `NaN` and non-positive + * values therefore produce singleton pieces. * * **Example** (Chunking an iterable) * @@ -46202,7 +46172,7 @@ const contains = /*#__PURE__*/(/* unused pure expression or super */ null && (co * @since 2.0.0 */ const chunksOf = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { - const safeN = Math.max(1, Math.floor(n)); + const safeN = Count.normalizeNonEmpty(n); return { [Symbol.iterator]() { let iterator = self[Symbol.iterator](); @@ -48507,6 +48477,7 @@ const effectDiscard = effect => effectContext(internalEffect.as(effect, Context. * @since 2.0.0 */ const suspend = evaluate => fromBuildMemo((memoMap, scope) => internalEffect.suspend(() => evaluate().build(memoMap, scope))); +const unwrapKey = /*#__PURE__*/(/* unused pure expression or super */ null && (Context.Service("effect/Layer/unwrap"))); /** * Unwraps a `Layer` from an `Effect`, flattening the nested structure. * @@ -48541,10 +48512,7 @@ const suspend = evaluate => fromBuildMemo((memoMap, scope) => internalEffect.sus * @category converting * @since 4.0.0 */ -const unwrap = self => { - const service = Context.Service("effect/Layer/unwrap"); - return flatMap(effect(service)(self), Context.get(service)); -}; +const unwrap = self => flatMap(effect(unwrapKey)(self), Context.get(unwrapKey)); const mergeAllEffect = (layers, memoMap, scope) => { const parentScope = _Scope_js__rspack_import_3/* .forkUnsafe */.Fp(scope, "parallel"); return _internal_effect_js__rspack_import_0/* .forEach */.jJl(layers, layer => layer.build(memoMap, _Scope_js__rspack_import_3/* .forkUnsafe */.Fp(parentScope, "sequential")), { @@ -49586,9 +49554,9 @@ const withSpan = function () { const options = internalTracer.addSpanStackTrace(dataFirst ? arguments[2] : arguments[1]); if (dataFirst) { const self = arguments[0]; - return unwrap(internalEffect.map(options?.onEnd !== undefined ? internalEffect.tap(internalEffect.makeSpanScoped(name, options), span => internalEffect.addFinalizer(exit => options.onEnd(span, exit))) : internalEffect.makeSpanScoped(name, options), span => withParentSpan(self, span))); + return unwrap(internalEffect.map(options?.onEnd !== undefined ? internalEffect.tap(internalEffect.makeSpanScoped(name, options), span => internalEffect.addFinalizer(exit => options.onEnd(span, exit))) : internalEffect.makeSpanScoped(name, options), span => withParentSpan(self, span, options))); } - return self => unwrap(internalEffect.map(options?.onEnd !== undefined ? internalEffect.tap(internalEffect.makeSpanScoped(name, options), span => internalEffect.addFinalizer(exit => options.onEnd(span, exit))) : internalEffect.makeSpanScoped(name, options), span => withParentSpan(self, span))); + return self => unwrap(internalEffect.map(options?.onEnd !== undefined ? internalEffect.tap(internalEffect.makeSpanScoped(name, options), span => internalEffect.addFinalizer(exit => options.onEnd(span, exit))) : internalEffect.makeSpanScoped(name, options), span => withParentSpan(self, span, options))); }; /** * Wraps a layer so spans created during its construction use the supplied span @@ -49691,6 +49659,7 @@ __webpack_require__.d(__webpack_exports__, { }, "./node_modules/effect/dist/MutableList.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) { +/* import */ var _internal_count_js__rspack_import_0 = __webpack_require__("./node_modules/effect/dist/internal/count.js"); /** * Mutable lists for collecting ordered values and draining them from the front. * A `MutableList` can append values to the end, prepend values to the @@ -49702,6 +49671,7 @@ __webpack_require__.d(__webpack_exports__, { * @since 4.0.0 */ + /** * Defines the unique symbol used to represent an empty result when taking elements from a MutableList. * This symbol is returned by `take` when the list is empty, allowing for safe type checking. @@ -49876,6 +49846,7 @@ const prependAllUnsafe = (self, messages, mutable = false) => { offset: 0, next: self.head }; + if (!self.tail && messages.length > 0) self.tail = self.head; self.length += self.head.array.length; }; /** @@ -49980,6 +49951,11 @@ const clear = self => { * The taken elements are removed from the list. This operation is optimized for performance * and includes zero-copy optimizations when possible. * + * **Details** + * + * Finite fractional values of `n` are rounded down. `NaN` and non-positive + * values leave the list unchanged and return an empty array. + * * **Example** (Taking batches) * * ```ts import.meta.vitest @@ -49997,6 +49973,7 @@ const clear = self => { * @since 4.0.0 */ const takeN = (self, n) => { + n = _internal_count_js__rspack_import_0/* .normalize */.S(n); if (n <= 0 || !self.head) return []; n = Math.min(n, self.length); if (n === self.length && self.head?.offset === 0 && !self.head.next) { @@ -50035,8 +50012,9 @@ const takeN = (self, n) => { * * **Details** * - * If `n` is less than or equal to zero, or the list is empty, the list is left - * unchanged. If `n` is greater than or equal to the current length, the list is + * Finite fractional values of `n` are rounded down. If `n` is `NaN` or + * non-positive, or the list is empty, the list is left unchanged. If the + * normalized count is greater than or equal to the current length, the list is * cleared. * * @see {@link takeN} for removing up to `n` values and returning them as an array @@ -50046,6 +50024,7 @@ const takeN = (self, n) => { * @since 4.0.0 */ const takeNVoid = (self, n) => { + n = Count.normalize(n); if (n <= 0 || !self.head) return; n = Math.min(n, self.length); if (n === self.length && self.head?.offset === 0 && !self.head.next) { @@ -50133,12 +50112,18 @@ const take = self => { * Use when you need to inspect or snapshot a bounded prefix of the list without * consuming it. * + * **Details** + * + * Finite fractional values of `n` are rounded down. `NaN` and non-positive + * values return an empty array. + * * @see {@link takeN} for removing up to `n` values and returning them as an array * * @category converting * @since 4.0.0 */ const toArrayN = (self, n) => { + n = Count.normalize(n); if (n <= 0) return []; const length = Math.min(n, self.length); const out = new Array(length); @@ -50294,7 +50279,7 @@ __webpack_require__.r(__webpack_exports__); -const TypeId = "~effect/data/Option"; +const TypeId = "~effect/Option"; /** * Creates an `Option` representing the absence of a value. * @@ -52600,6 +52585,7 @@ function alwaysEqual() { * * Applies orders in iteration order and short-circuits on the first non-zero * result. It returns `0` only if all orders return `0`. + * The collection is materialized when the order is created, so it must be finite. * * **Example** (Combining multiple Orders) * @@ -52629,9 +52615,10 @@ function alwaysEqual() { * @since 2.0.0 */ function combineAll(collection) { + const orders = Array.from(collection); return make((a1, a2) => { let out = 0; - for (const O of collection) { + for (const O of orders) { out = O(a1, a2); if (out !== 0) { return out; @@ -54987,6 +54974,7 @@ __webpack_require__.d(__webpack_exports__, { + const TypeId = "~effect/Queue"; const EnqueueTypeId = "~effect/Queue/Enqueue"; const DequeueTypeId = "~effect/Queue/Dequeue"; @@ -55774,8 +55762,8 @@ const interrupt = self => core.withFiber(fiber => failCause(self, internalEffect * * **Details** * - * The operation is idempotent and returns `true`, including when the queue has - * already been shut down or completed. + * Returns `true` when the queue is shut down by this call, or `false` when it + * has already been shut down or completed. * * **Example** (Shutting down queues) * @@ -55800,28 +55788,48 @@ const interrupt = self => core.withFiber(fiber => failCause(self, internalEffect * await Effect.runPromise(program) // => { wasShutdown: true, size: 0 } * ``` * + * @see {@link shutdownUnsafe} for synchronous shutdown * @category completion * @since 2.0.0 */ -const shutdown = self => _internal_effect_js__rspack_import_3/* .sync */.OH5(() => { +const shutdown = self => _internal_effect_js__rspack_import_3/* .sync */.OH5(() => shutdownUnsafe(self)); +/** + * Shuts down the queue synchronously, discarding buffered messages and resuming + * pending operations. + * + * **When to use** + * + * Use when a synchronous callback must discard buffered messages and settle + * pending queue operations before returning. + * + * **Details** + * + * An open queue completes with an interruption. A queue already closing retains + * its completion cause. Call `failCauseUnsafe` first to shut down with a specific + * failure. Returns `true` when the queue is shut down by this call, or `false` + * when it has already been shut down or completed. + * + * @see {@link shutdown} for the effectful variant + * @see {@link failCauseUnsafe} to set a failure before discarding buffered messages + * @category completion + * @since 4.0.0 + */ +const shutdownUnsafe = self => { if (self.state._tag === "Done") { - return true; + return false; } _MutableList_js__rspack_import_2/* .clear */.IU(self.messages); const offers = self.state.offers; finalize(self, self.state._tag === "Open" ? exitInterrupt : self.state.exit); - if (offers.size > 0) { - for (const entry of offers) { - if (entry._tag === "Single") { - entry.resume(exitFalse); - } else { - entry.resume(_internal_core_js__rspack_import_1/* .exitSucceed */.xt(entry.remaining.slice(entry.offset))); - } + for (const entry of offers) { + if (entry._tag === "Single") { + entry.resume(exitFalse); + } else { + entry.resume(_internal_core_js__rspack_import_1/* .exitSucceed */.xt(entry.remaining.slice(entry.offset))); } - offers.clear(); } return true; -}); +}; /** * Takes and returns all currently buffered messages without waiting for more. * @@ -55949,9 +55957,10 @@ const collect = self => internalEffect.suspend(() => { * **Details** * * The operation may wait until enough messages are available to satisfy the - * queue's batching rules. If `n` is less than or equal to zero, it succeeds - * with an empty array. If the queue completes or fails before messages can be - * taken, the effect fails with the queue's terminal error. + * queue's batching rules. Finite fractional values of `n` are rounded down. + * If `n` is `NaN` or non-positive, it succeeds with an empty array. If the + * queue completes or fails before messages can be taken, the effect fails with + * the queue's terminal error. * * **Example** (Taking a fixed number of values) * @@ -55988,9 +55997,10 @@ const takeN = (self, n) => takeBetween(self, n, n); * **Details** * * The operation waits when fewer than the required minimum messages are - * available. It returns at most `max` messages. If the queue completes or fails - * before the minimum can be satisfied, the effect fails with the queue's - * terminal error. + * available. It returns at most `max` messages. Finite fractional bounds are + * rounded down, while `NaN` and non-positive bounds are treated as `0`. If the + * queue completes or fails before the minimum can be satisfied, the effect + * fails with the queue's terminal error. * * **Example** (Taking a bounded batch of values) * @@ -56020,7 +56030,11 @@ const takeN = (self, n) => takeBetween(self, n, n); * @category taking * @since 2.0.0 */ -const takeBetween = (self, min, max) => internalEffect.suspend(() => takeBetweenUnsafe(self, min, max) ?? internalEffect.andThen(awaitTake(self), takeBetween(self, 1, max))); +const takeBetween = (self, min, max) => { + min = Count.normalize(min); + max = Count.normalize(max); + return internalEffect.suspend(() => takeBetweenUnsafe(self, min, max) ?? internalEffect.andThen(awaitTake(self), takeBetween(self, 1, max))); +}; /** * Takes a single message from the queue, or wait for a message to be * available. @@ -56193,15 +56207,86 @@ const takeUnsafe = self => { releaseCapacity(self); return _internal_core_js__rspack_import_1/* .exitSucceed */.xt(message); } else if (self.capacity <= 0 && self.state.offers.size > 0) { - self.capacity = 1; - releaseCapacity(self); - self.capacity = 0; - const message = _MutableList_js__rspack_import_2/* .take */.s(self.messages); + const message = takeOfferUnsafe(self.state.offers); releaseCapacity(self); return _internal_core_js__rspack_import_1/* .exitSucceed */.xt(message); } return undefined; }; +/** + * Manually releases current queue takers synchronously. + * + * **When to use** + * + * Use when synchronous offers should release waiting consumers immediately + * instead of waiting for the scheduled release task. + * + * **Details** + * + * This immediately runs the queue's taker-release pass instead of waiting for + * its scheduled task. It does not complete the queue or resume fibers waiting + * on `Queue.await`. + * + * **Example** (Releasing a waiting taker synchronously) + * + * ```ts import.meta.vitest + * import { Effect, Fiber, Queue } from "effect" + * + * const program = Effect.gen(function*() { + * const queue = yield* Queue.unbounded() + * const taker = yield* Queue.take(queue).pipe(Effect.forkChild) + * yield* Effect.yieldNow + * + * Queue.offerUnsafe(queue, 1) + * Queue.flushUnsafe(queue) + * + * return yield* Fiber.join(taker) + * }) + * + * await Effect.runPromise(program) // => 1 + * ``` + * + * @category offering + * @since 4.0.0 + */ +const flushUnsafe = self => releaseTakers(self); +/** + * Manually releases current queue takers. + * + * **When to use** + * + * Use when synchronous offers should release waiting consumers through an + * `Effect` instead of waiting for the scheduled release task. + * + * **Details** + * + * This immediately runs the queue's taker-release pass instead of waiting for + * its scheduled task. It does not complete the queue or resume fibers waiting + * on `Queue.await`. + * + * **Example** (Releasing a waiting taker) + * + * ```ts import.meta.vitest + * import { Effect, Fiber, Queue } from "effect" + * + * const program = Effect.gen(function*() { + * const queue = yield* Queue.unbounded() + * const taker = yield* Queue.take(queue).pipe(Effect.forkChild) + * yield* Effect.yieldNow + * + * Queue.offerUnsafe(queue, 1) + * yield* Queue.flush(queue) + * + * return yield* Fiber.join(taker) + * }) + * + * await Effect.runPromise(program) // => 1 + * ``` + * + * @category offering + * @since 4.0.0 + */ +const flush = self => internalEffect.sync(() => flushUnsafe(self)); const await_ = self => internalEffect.callback(resume => { const awaiter = effect => resume(Pull.catchDone(effect, () => internalEffect.exitVoid)); if (self.state._tag === "Done") { @@ -56411,7 +56496,6 @@ const exitTrue = /*#__PURE__*/_internal_core_js__rspack_import_1/* .exitSucceed const exitFailDone = /*#__PURE__*/_internal_core_js__rspack_import_1/* .exitFail */.Rk(/*#__PURE__*/_internal_core_js__rspack_import_1/* .Done */.RS()); const exitInterrupt = /*#__PURE__*/_internal_effect_js__rspack_import_3/* .exitInterrupt */._sz(); const releaseTakers = self => { - self.scheduleRunning = false; if (self.state._tag === "Done" || self.state.takers.size === 0) { return; } @@ -56428,18 +56512,18 @@ const scheduleReleaseTaker = self => { return; } self.scheduleRunning = true; - self.dispatcher.scheduleTask(() => releaseTakers(self), 0); + self.dispatcher.scheduleTask(() => { + self.scheduleRunning = false; + releaseTakers(self); + }, 0); }; const takeBetweenUnsafe = (self, min, max) => { if (self.state._tag === "Done") { return self.state.exit; } else if (max <= 0 || min <= 0) { return core.exitSucceed([]); - } else if (self.capacity <= 0 && self.state.offers.size > 0) { - self.capacity = 1; - releaseCapacity(self); - self.capacity = 0; - const messages = [MutableList.take(self.messages)]; + } else if (self.capacity <= 0 && self.messages.length === 0 && self.state.offers.size > 0) { + const messages = [takeOfferUnsafe(self.state.offers)]; releaseCapacity(self); return core.exitSucceed(messages); } @@ -56487,6 +56571,21 @@ const offerRemainingArray = (self, remaining) => { }); }); }; +// Reserve a pending message for the consumer before the producer can reenter. +const takeOfferUnsafe = offers => { + const entry = offers.values().next().value; + if (entry._tag === "Single") { + offers.delete(entry); + entry.resume(exitTrue); + return entry.message; + } + const message = entry.remaining[entry.offset++]; + if (entry.offset === entry.remaining.length) { + offers.delete(entry); + entry.resume(_internal_core_js__rspack_import_1/* .exitSucceed */.xt([])); + } + return message; +}; const releaseCapacity = self => { if (self.state._tag === "Done") { return _Pull_js__rspack_import_4/* .isDoneCause */.Og(self.state.exit.cause); @@ -56497,21 +56596,21 @@ const releaseCapacity = self => { } return false; } - let n = self.capacity - self.messages.length; + // Resuming a producer can synchronously take, offer, or shut down this queue. for (const entry of self.state.offers) { - if (n === 0) break;else if (entry._tag === "Single") { + let n = self.capacity - self.messages.length; + if (n <= 0) break;else if (entry._tag === "Single") { _MutableList_js__rspack_import_2/* .append */.BC(self.messages, entry.message); - n--; - entry.resume(exitTrue); self.state.offers.delete(entry); + entry.resume(exitTrue); } else { for (; entry.offset < entry.remaining.length; entry.offset++) { if (n === 0) return false; _MutableList_js__rspack_import_2/* .append */.BC(self.messages, entry.remaining[entry.offset]); n--; } - entry.resume(_internal_core_js__rspack_import_1/* .exitSucceed */.xt([])); self.state.offers.delete(entry); + entry.resume(_internal_core_js__rspack_import_1/* .exitSucceed */.xt([])); } } return false; @@ -56533,10 +56632,7 @@ const takeAllUnsafe = self => { releaseCapacity(self); return messages; } else if (self.state._tag !== "Done" && self.state.offers.size > 0) { - self.capacity = 1; - releaseCapacity(self); - self.capacity = 0; - const messages = [_MutableList_js__rspack_import_2/* .take */.s(self.messages)]; + const messages = [takeOfferUnsafe(self.state.offers)]; releaseCapacity(self); return messages; } @@ -58196,7 +58292,7 @@ __webpack_require__.d(__webpack_exports__, { -const TypeId = "~effect/data/Result"; +const TypeId = "~effect/Result"; /** * Creates a `Result` holding a `Success` value. * @@ -60549,15 +60645,6 @@ const Scheduler = /*#__PURE__*/_Context_js__rspack_import_0/* .Reference */.Or(" fiberCached: true, defaultValue: () => new MixedScheduler() }); -const setImmediate = "setImmediate" in globalThis ? f => { - // @ts-ignore - const timer = globalThis.setImmediate(f); - // @ts-ignore - return () => globalThis.clearImmediate(timer); -} : f => { - const timer = setTimeout(f, 0); - return () => clearTimeout(timer); -}; const setMicrotask = f => { let cancelled = false; Promise.resolve().then(() => { @@ -60567,6 +60654,24 @@ const setMicrotask = f => { cancelled = true; }; }; +const setTimer = "setImmediate" in globalThis ? f => { + // @ts-ignore + const timer = globalThis.setImmediate(f); + // @ts-ignore + return () => globalThis.clearImmediate(timer); +} : f => { + const timer = setTimeout(f, 0); + return () => clearTimeout(timer); +}; +// Some runtimes (e.g. Cloudflare Workers) throw when a timer is set in global +// scope. Fall back to a microtask so effects can still yield at module load. +const setImmediate = f => { + try { + return setTimer(f); + } catch { + return setMicrotask(f); + } +}; class PriorityBuckets { buckets = []; scheduleTask(task, priority) { @@ -60629,7 +60734,7 @@ class MixedScheduler { * @since 2.0.0 */ shouldYield(fiber) { - return fiber.currentOpCount >= fiber.maxOpsBeforeYield; + return fiber.currentOpCount >= fiber.cache.maxOpsBeforeYield; } /** * Creates a dispatcher that schedules work through this scheduler. @@ -61532,6 +61637,8 @@ __webpack_require__.d(__webpack_exports__, { + + @@ -61876,7 +61983,7 @@ const transformPullBracket = (self, f) => fromChannel(Channel.fromTransformBrack * values.flat() // => [1, 2, 3] * ``` * - * @category constructors + * @category destructors * @since 2.0.0 */ const toChannel = stream => stream.channel; @@ -62094,6 +62201,8 @@ const failCauseSync = evaluate => fromChannel(Channel.failCauseSync(evaluate)); * **Details** * * The `maxChunkSize` parameter controls how many values are pulled per chunk. + * Finite fractional values are rounded down, while `NaN` and non-positive + * values are treated as `1`. * * **Example** (Consuming values from an iterator) * @@ -62125,7 +62234,9 @@ const fromIteratorSucceed = (iterator, maxChunkSize) => fromChannel(Channel.from * * **Details** * - * - `chunkSize`: Maximum number of values emitted per chunk. + * - `chunkSize`: Maximum number of values emitted per chunk. Finite fractional + * values are rounded down, while `NaN` and non-positive values are treated as + * `1`. * * **Example** (Creating a stream from an iterable) * @@ -62532,8 +62643,10 @@ const fromSubscription = pubsub => fromChannel(Channel.fromSubscriptionArray(pub * @since 3.1.0 */ const fromEventListener = (target, type, options) => callback(queue => { + const once = typeof options === "object" && options.once; function emit(event) { Queue.offerUnsafe(queue, event); + if (once) Queue.endUnsafe(queue); } return Effect.acquireRelease(Effect.sync(() => target.addEventListener(type, emit, options)), () => Effect.sync(() => target.removeEventListener(type, emit, options))); }, { @@ -62649,7 +62762,8 @@ const iterate = (value, next) => unfold(value, a => Effect.succeed([a, next(a)]) * **Details** * * If the provided `min` is greater than `max`, the stream will not emit any - * values. + * values. Finite fractional `chunkSize` values are rounded down, while `NaN` + * and non-positive values are treated as `1`. * * **Example** (Creating a numeric range) * @@ -62668,7 +62782,7 @@ const iterate = (value, next) => unfold(value, a => Effect.succeed([a, next(a)]) * @since 2.0.0 */ const range = (min, max, chunkSize = (/* inlined export .DefaultChunkSize */4096)) => min > max ? empty : fromPull(Effect.sync(() => { - const size = Math.max(1, chunkSize); + const size = Count.normalizeNonEmpty(chunkSize); let start = min; let done = false; return Effect.suspend(() => { @@ -62753,7 +62867,7 @@ const unwrap = effect => fromChannel(_Channel_js__rspack_import_1/* .unwrap */.o * events // => ["acquire", "release"] * ``` * - * @category constructors + * @category resource management * @since 2.0.0 */ const scoped = self => fromChannel(Channel.scoped(self.channel)); @@ -62776,6 +62890,31 @@ const map = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, let i = 0; return fromChannel(Channel.map(self.channel, Arr.map(o => f(o, i++)))); })))); +/** + * Replaces every element of the stream with the provided constant value. + * + * **Example** (Replacing stream elements) + * + * ```ts import.meta.vitest + * import { Effect, Stream } from "effect" + * + * const program = Effect.gen(function*() { + * const values = yield* Stream.make(1, 2, 3).pipe( + * Stream.as("x"), + * Stream.runCollect + * ) + * values // => [ 'x', 'x', 'x' ] + * }) + * + * await Effect.runPromise(program) + * ``` + * + * @see {@link map} for deriving the replacement value from each element + * + * @category mapping + * @since 4.0.0 + */ +const as = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, value) => map(self, () => value)))); /** * Maps both the failure and success channels of a stream. * @@ -62785,8 +62924,8 @@ const map = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, * import { Effect, Stream } from "effect" * * const mapper = { - * onFailure: (error: string) => `error: ${error}`, - * onSuccess: (value: number) => value * 2 + * onElement: (value: number) => value * 2, + * onError: (error: string) => `error: ${error}` * } * * const program = Effect.gen(function*() { @@ -62810,7 +62949,7 @@ const map = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, * @category mapping * @since 2.0.0 */ -const mapBoth = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, options) => self.pipe(map(options.onSuccess), mapError(options.onFailure))))); +const mapBoth = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, options) => self.pipe(map(options.onElement), mapError(options.onError))))); /** * Transforms each emitted chunk using the provided function, which receives the chunk and its index. * @@ -62896,7 +63035,7 @@ const mapEffect = /*#__PURE__*/(0,_Function_js__rspack_import_7/* .dual */.XY)(a * await Effect.runPromise(program) * ``` * - * @category mapping + * @category sequencing * @since 2.0.0 */ const flattenEffect = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(args => isStream(args[0]), (self, options) => mapEffect(self, identity, options)))); @@ -63120,7 +63259,7 @@ const tapSink = /*#__PURE__*/(/* unused pure expression or super */ null && (dua * await Effect.runPromise(program) * ``` * - * @category mapping + * @category sequencing * @since 2.0.0 */ const flatMap = /*#__PURE__*/(0,_Function_js__rspack_import_7/* .dual */.XY)(args => isStream(args[0]), (self, f, options) => self.channel.pipe(_Channel_js__rspack_import_1/* .flattenArray */.ed, _Channel_js__rspack_import_1/* .flatMap */.qI(a => f(a).channel, options), fromChannel)); @@ -63177,7 +63316,7 @@ const switchMap = /*#__PURE__*/(/* unused pure expression or super */ null && (d * await Effect.runPromise(program) * ``` * - * @category mapping + * @category sequencing * @since 2.0.0 */ const flatten = /*#__PURE__*/(0,_Function_js__rspack_import_7/* .dual */.XY)(args => isStream(args[0]), (self, options) => flatMap(self, _Function_js__rspack_import_7/* .identity */.D_, options)); @@ -63272,7 +63411,7 @@ const drainFork = /*#__PURE__*/(/* unused pure expression or super */ null && (d * await Effect.runPromise(program) * ``` * - * @category sequencing + * @category repetition * @since 2.0.0 */ const repeat = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, schedule) => fromChannel(Channel.repeat(self.channel, schedule))))); @@ -63409,7 +63548,7 @@ const timeoutOrElse = /*#__PURE__*/(/* unused pure expression or super */ null & * await Effect.runPromise(program) * ``` * - * @category sequencing + * @category repetition * @since 2.0.0 */ const repeatElements = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, schedule) => fromChannel(Channel.fromTransform((upstream, scope) => Effect.map(Channel.toTransform(Channel.flattenArray(self.channel))(upstream, scope), pullElement => { @@ -63447,7 +63586,7 @@ const repeatElements = /*#__PURE__*/(/* unused pure expression or super */ null * await Effect.runPromise(program) * ``` * - * @category sequencing + * @category repetition * @since 2.0.0 */ const forever = self => fromChannel(Channel.forever(self.channel)); @@ -63468,7 +63607,7 @@ const forever = self => fromChannel(Channel.forever(self.channel)); * await Effect.runPromise(program) * ``` * - * @category mapping + * @category sequencing * @since 4.0.0 */ const flattenIterable = self => flatMap(self, fromIterable); @@ -64561,7 +64700,7 @@ const partitionQueue = /*#__PURE__*/(/* unused pure expression or super */ null * consumed while that scope remains open. The first stream emits success values * from the filter, and the second emits failure values. * - * @see {@link partition} for the pure `Filter` variant, which returns the failing stream before the passing stream + * @see {@link partition} for the pure `Filter` variant * @see {@link partitionQueue} for the lower-level queue result * @see {@link filterMapEffect} for effectful filtering that discards failed filter results * @@ -64570,14 +64709,16 @@ const partitionQueue = /*#__PURE__*/(/* unused pure expression or super */ null */ const partitionEffect = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(args => isStream(args[0]), (self, filter, options) => Effect.map(partitionQueue(mapEffect(self, a => filter(a), options), result => result, options), ([passes, fails]) => [fromQueue(passes), fromQueue(fails)])))); /** - * Splits a stream into scoped excluded and satisfying substreams using a + * Splits a stream into scoped passing and failing substreams using a * `Filter`. * * **Details** * * The returned streams are backed by queues in the current scope and should be * consumed while that scope remains open. The faster stream may advance up to - * `bufferSize` elements ahead of the slower one. + * `capacity` elements ahead of the slower one. The first stream emits the + * filter successes and the second emits the filter failures. The default + * capacity is 16. * * **Example** (Partitioning a stream) * @@ -64585,14 +64726,14 @@ const partitionEffect = /*#__PURE__*/(/* unused pure expression or super */ null * import { Effect, Result, Stream } from "effect" * * const program = Effect.gen(function*() { - * const [excluded, satisfying] = yield* Stream.partition( + * const [passes, fails] = yield* Stream.partition( * Stream.make(1, 2, 3, 4), * (n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n) * ) - * const left = yield* Stream.runCollect(excluded) - * const right = yield* Stream.runCollect(satisfying) - * left // => [ 1, 3 ] - * right // => [ 2, 4 ] + * const evens = yield* Stream.runCollect(passes) + * const odds = yield* Stream.runCollect(fails) + * evens // => [ 2, 4 ] + * odds // => [ 1, 3 ] * }) * await Effect.runPromise(Effect.scoped(program)) * ``` @@ -64601,8 +64742,8 @@ const partitionEffect = /*#__PURE__*/(/* unused pure expression or super */ null * @since 2.0.0 */ const partition = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(args => isStream(args[0]), (self, filter, options) => Effect.map(partitionQueue(self, filter, { - capacity: options?.bufferSize ?? 16 -}), ([passes, fails]) => [fromQueue(fails), fromQueue(passes)])))); + capacity: options?.capacity ?? 16 +}), ([passes, fails]) => [fromQueue(passes), fromQueue(fails)])))); /** * Returns the specified stream if the given condition is satisfied, otherwise * returns an empty stream. @@ -64762,6 +64903,30 @@ const bufferArray = /*#__PURE__*/(/* unused pure expression or super */ null && * @since 2.0.0 */ const catchCause = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, f) => self.channel.pipe(Channel.catchCause(cause => f(cause).channel), fromChannel)))); +/** + * Recovers from defects using the provided function. + * + * **Details** + * + * Typed failures and interruptions are not caught. + * + * **Example** (Recovering from a defect) + * + * ```ts import.meta.vitest + * import { Effect, Stream } from "effect" + * + * const stream = Stream.die("boom").pipe( + * Stream.catchDefect((defect) => Stream.succeed(`recovered: ${defect}`)) + * ) + * + * const result = Effect.runSync(Stream.runCollect(stream)) + * result // => ["recovered: boom"] + * ``` + * + * @category error handling + * @since 4.0.0 + */ +const catchDefect = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, f) => self.channel.pipe(Channel.catchDefect(defect => f(defect).channel), fromChannel)))); /** * Runs an effect when the stream fails without changing its values or error, * unless the tap effect itself fails. @@ -64821,6 +64986,83 @@ const catch_ = /*#__PURE__*/(/* unused pure expression or super */ null && (dual * @since 2.0.0 */ const tapError = /*#__PURE__*/(0,_Function_js__rspack_import_7/* .dual */.XY)(2, (self, f) => self.channel.pipe(_Channel_js__rspack_import_1/* .tapError */.sF(f), fromChannel)); +/** + * Peeks at errors with a matching `_tag` effectfully without changing the + * stream unless the tap fails. + * + * **Example** (Effectfully peeking at a tagged error) + * + * ```ts import.meta.vitest + * import { Data, Effect, Stream } from "effect" + * + * class NetworkError extends Data.TaggedError("NetworkError")<{ + * statusCode: number + * }> {} + * + * class ValidationError extends Data.TaggedError("ValidationError")<{ + * field: string + * }> {} + * + * const seen: Array = [] + * const stream: Stream.Stream = Stream.fail( + * new NetworkError({ statusCode: 504 }) + * ) + * + * const program = stream.pipe( + * Stream.tapErrorTag("NetworkError", (error) => Effect.sync(() => seen.push(error.statusCode))), + * Stream.catch(() => Stream.make(0)), + * Stream.runCollect + * ) + * + * await Effect.runPromise(program) // => [ 0 ] + * seen // => [ 504 ] + * ``` + * + * @see {@link tapError} for peeking at every typed error + * @see {@link catchTag} for recovering from a tagged error + * + * @category error handling + * @since 4.0.0 + */ +const tapErrorTag = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, (self, k, f) => { + const predicate = Array.isArray(k) ? e => hasProperty(e, "_tag") && k.includes(e._tag) : isTagged(k); + return tapError(self, error => predicate(error) ? f(error) : Effect.void); +}))); +/** + * Peeks at defects effectfully without changing the stream unless the tap + * fails. + * + * **Example** (Effectfully peeking at defects) + * + * ```ts import.meta.vitest + * import { Effect, Stream } from "effect" + * + * const defects: Array = [] + * const stream = Stream.make(1, 2).pipe( + * Stream.concat(Stream.die("boom")), + * Stream.tapDefect((defect) => Effect.sync(() => defects.push(defect))), + * Stream.catchCause(() => Stream.make(3)) + * ) + * + * const program = Effect.gen(function*() { + * const values = yield* Stream.runCollect(stream) + * values // => [ 1, 2, 3 ] + * }) + * + * await Effect.runPromise(program) + * defects // => [ 'boom' ] + * ``` + * + * @see {@link tapCause} for peeking at the full failure cause + * @see {@link catchDefect} for recovering from defects + * + * @category error handling + * @since 4.0.0 + */ +const tapDefect = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, f) => tapCause(self, cause => { + const defect = Cause.findDefect(cause); + return Result.isSuccess(defect) ? f(defect.success) : Effect.void; +})))); /** * Recovers from errors that match a predicate by switching to a recovery stream. * @@ -65059,6 +65301,55 @@ const catchReasons = /*#__PURE__*/(/* unused pure expression or super */ null && const orElseHandler = orElse && ((reason, error) => orElse(reason, error).channel); return fromChannel(Channel.catchReasons(self.channel, errorTag, handlers, orElseHandler)); }))); +/** + * Promotes nested reason errors into the stream error channel, replacing the + * parent error. + * + * **Example** (Extracting the reason from a tagged error) + * + * ```ts import.meta.vitest + * import { Data, Effect, Stream } from "effect" + * + * class RateLimitError extends Data.TaggedError("RateLimitError")<{ + * retryAfter: number + * }> {} + * + * class QuotaExceededError extends Data.TaggedError("QuotaExceededError")<{ + * limit: number + * }> {} + * + * class AiError extends Data.TaggedError("AiError")<{ + * reason: RateLimitError | QuotaExceededError + * }> {} + * + * const stream: Stream.Stream = Stream.fail( + * new AiError({ reason: new RateLimitError({ retryAfter: 30 }) }) + * ) + * + * // Before: Stream + * // After: Stream + * const unwrapped = stream.pipe(Stream.unwrapReason("AiError")) + * + * const program = Effect.gen(function*() { + * const error = yield* Effect.flip(Stream.runCollect(unwrapped)) + * error._tag // => "RateLimitError" + * }) + * + * await Effect.runPromise(program) + * ``` + * + * @see {@link catchReason} for recovering from a specific reason + * @see {@link catchReasons} for handling several reasons at once + * + * @category error handling + * @since 4.0.0 + */ +const unwrapReason = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, errorTag) => catchFilter(self, e => { + if (isTagged(e, errorTag) && hasProperty(e, "reason")) { + return Result.succeed(e.reason); + } + return Result.fail(e); +}, fail)))); /** * Transforms the errors emitted by this stream using `f`. * @@ -65440,7 +65731,12 @@ const withExecutionPlan = /*#__PURE__*/(/* unused pure expression or super */ nu return loop; })))); /** - * Takes the first `n` elements from this stream, returning `Stream.empty` when `n < 1`. + * Takes the first `n` elements from this stream. + * + * **Details** + * + * Finite fractional values of `n` are rounded down. `NaN` and non-positive + * values return `Stream.empty` without evaluating the source stream. * * **Example** (Taking values from the left) * @@ -65461,7 +65757,10 @@ const withExecutionPlan = /*#__PURE__*/(/* unused pure expression or super */ nu * @category filtering * @since 2.0.0 */ -const take = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => n < 1 ? empty : takeUntil(self, (_, i) => i === n - 1)))); +const take = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { + const count = Count.normalize(n); + return count === 0 ? empty : takeUntil(self, (_, i) => i === count - 1); +}))); /** * Emits byte chunks until the configured limit would be exceeded, then drops * the crossing chunk and switches to a fallback stream. @@ -65469,13 +65768,13 @@ const take = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 * **Example** (Truncating at a byte limit) * * ```ts import.meta.vitest - * import { Effect, Stream } from "effect" + * import { ByteSize, Effect, Stream } from "effect" * * const program = Stream.make( * new Uint8Array([1, 2]), * new Uint8Array([3, 4, 5]) * ).pipe( - * Stream.limitBytes(4, () => Stream.empty), + * Stream.limitBytes(ByteSize.bytes(4), () => Stream.empty), * Stream.runCollect, * Effect.map((chunks) => chunks.map((chunk) => [...chunk])) * ) @@ -65487,7 +65786,7 @@ const take = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 * @since 4.0.0 */ const limitBytes = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, (self, bytes, onLimitReached) => suspend(() => { - const limit = BigInt(bytes); + const limit = ByteSize.fromInputUnsafe(bytes); let size = BigInt(0); let limitReached = false; return concat(takeWhile(self, chunk => { @@ -65503,6 +65802,11 @@ const limitBytes = /*#__PURE__*/(/* unused pure expression or super */ null && ( /** * Keeps the last `n` elements from this stream. * + * **Details** + * + * Finite fractional values of `n` are rounded down. `NaN` and non-positive + * values return `Stream.empty` without evaluating the source stream. + * * **Example** (Taking elements from the right) * * ```ts import.meta.vitest @@ -65522,17 +65826,21 @@ const limitBytes = /*#__PURE__*/(/* unused pure expression or super */ null && ( * @category filtering * @since 2.0.0 */ -const takeRight = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => mapAccumArray(self, MutableList.make, (list, arr) => { - MutableList.appendAll(list, arr); - if (list.length > n) { - MutableList.takeNVoid(list, list.length - n); - } - return [list, emptyArr]; -}, { - onHalt(list) { - return MutableList.takeAll(list); - } -})))); +const takeRight = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { + const count = Count.normalize(n); + if (count === 0) return empty; + return mapAccumArray(self, MutableList.make, (list, arr) => { + MutableList.appendAll(list, arr); + if (list.length > count) { + MutableList.takeNVoid(list, list.length - count); + } + return [list, emptyArr]; + }, { + onHalt(list) { + return MutableList.takeAll(list); + } + }); +}))); /** * Takes elements until the predicate matches. * @@ -65731,6 +66039,11 @@ const takeWhileEffect = /*#__PURE__*/(/* unused pure expression or super */ null /** * Drops the first `n` elements from this stream. * + * **Details** + * + * Finite fractional values of `n` are rounded down. `NaN` and non-positive + * values return the source stream unchanged. + * * **Example** (Dropping values from the left) * * ```ts import.meta.vitest @@ -65750,16 +66063,20 @@ const takeWhileEffect = /*#__PURE__*/(/* unused pure expression or super */ null * @category filtering * @since 2.0.0 */ -const drop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => transformPull(self, (pull, _scope) => Effect.sync(() => { - let dropped = 0; - const pump = pull.pipe(Effect.flatMap(chunk => { - if (dropped >= n) return Effect.succeed(chunk); - dropped += chunk.length; - if (dropped <= n) return pump; - return Effect.succeed(chunk.slice(n - dropped)); +const drop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { + const count = Count.normalize(n); + if (count === 0) return self; + return transformPull(self, (pull, _scope) => Effect.sync(() => { + let dropped = 0; + const pump = pull.pipe(Effect.flatMap(chunk => { + if (dropped >= count) return Effect.succeed(chunk); + dropped += chunk.length; + if (dropped <= count) return pump; + return Effect.succeed(chunk.slice(count - dropped)); + })); + return pump; })); - return pump; -}))))); +}))); /** * Drops elements until the specified predicate evaluates to `true`, then drops * that matching element. @@ -65918,7 +66235,9 @@ const dropWhileEffect = /*#__PURE__*/(/* unused pure expression or super */ null * * **Details** * - * Keeps the last `n` elements in memory to drop them on completion. + * Keeps the last `n` elements in memory to drop them on completion. Finite + * fractional values of `n` are rounded down. `NaN` and non-positive values + * return the source stream unchanged. * * **Example** (Dropping values from the right) * @@ -65940,12 +66259,13 @@ const dropWhileEffect = /*#__PURE__*/(/* unused pure expression or super */ null * @since 2.0.0 */ const dropRight = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { - if (n <= 0) return self; + const count = Count.normalize(n); + if (count === 0) return self; return transformPull(self, (pull, _scope) => Effect.sync(() => { const list = MutableList.make(); const emit = Effect.flatMap(pull, arr => { MutableList.appendAllUnsafe(list, arr); - const toTake = list.length - n; + const toTake = list.length - count; const items = MutableList.takeN(list, toTake); return Arr.isArrayNonEmpty(items) ? Effect.succeed(items) : emit; }); @@ -65981,7 +66301,8 @@ const chunks = self => self.channel.pipe(Channel.map(Arr.of), fromChannel); * * **Details** * - * The size is clamped to at least 1. + * Finite fractional sizes are rounded down. `NaN` and non-positive sizes are + * treated as `1`. * * **Example** (Rechunking stream elements) * @@ -66004,7 +66325,7 @@ const chunks = self => self.channel.pipe(Channel.map(Arr.of), fromChannel); * @since 2.0.0 */ const rechunk = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, target) => { - target = Math.max(1, target); + target = Count.normalizeNonEmpty(target); return transformPull(self, (pull, _scope) => Effect.sync(() => { let chunk = Arr.empty(); let index = 0; @@ -66016,7 +66337,9 @@ const rechunk = /*#__PURE__*/(/* unused pure expression or super */ null && (dua if (chunk.length === 0 && arr.length === target) { return Effect.succeed(arr); } else if (chunk.length + arr.length < target) { - chunk.push(...arr); + for (let i = 0; i < arr.length; i++) { + chunk.push(arr[i]); + } return loop(); } current = arr; @@ -66046,6 +66369,11 @@ const rechunk = /*#__PURE__*/(/* unused pure expression or super */ null && (dua /** * Emits a sliding window of `n` elements. * + * **Details** + * + * Finite fractional window sizes are rounded down. `NaN` and non-positive + * sizes are treated as `1`. + * * **Example** (Emitting sliding windows) * * ```ts import.meta.vitest @@ -66068,6 +66396,11 @@ const sliding = /*#__PURE__*/(/* unused pure expression or super */ null && (dua /** * Emits sliding windows of `chunkSize` elements, advancing by `stepSize`. * + * **Details** + * + * Finite fractional window and step sizes are rounded down. `NaN` and + * non-positive sizes are treated as `1`. + * * **Example** (Emitting sliding windows with a step size) * * ```ts import.meta.vitest @@ -66087,47 +66420,47 @@ const sliding = /*#__PURE__*/(/* unused pure expression or super */ null && (dua * @category grouping * @since 2.0.0 */ -const slidingSize = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, (self, chunkSize, stepSize) => transformPull(self, (upstream, _scope) => Effect.sync(() => { - let cause = null; - const list = MutableList.make(); - let emitted = false; - let skip = 0; - const pull = Effect.matchCauseEffect(upstream, { - onSuccess(arr) { - MutableList.appendAllUnsafe(list, arr); - if (skip > 0) { - const length = list.length; - MutableList.takeNVoid(list, skip); - skip = Math.max(0, skip - length); - } - if (list.length < chunkSize) return pull; - emitted = true; - const chunks = []; - while (list.length >= chunkSize) { - if (chunkSize === stepSize) { - chunks.push(MutableList.takeN(list, chunkSize)); - } else { - chunks.push(MutableList.toArrayN(list, chunkSize)); - if (chunkSize === 1 && stepSize <= 0) { - MutableList.take(list); +const slidingSize = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, (self, chunkSize, stepSize) => { + const windowSize = Count.normalizeNonEmpty(chunkSize); + const step = Count.normalizeNonEmpty(stepSize); + return transformPull(self, (upstream, _scope) => Effect.sync(() => { + let cause = null; + const list = MutableList.make(); + let emitted = false; + let skip = 0; + const pull = Effect.matchCauseEffect(upstream, { + onSuccess(arr) { + MutableList.appendAllUnsafe(list, arr); + if (skip > 0) { + const length = list.length; + MutableList.takeNVoid(list, skip); + skip = Math.max(0, skip - length); + } + if (list.length < windowSize) return pull; + emitted = true; + const chunks = []; + while (list.length >= windowSize) { + if (windowSize === step) { + chunks.push(MutableList.takeN(list, windowSize)); } else { + chunks.push(MutableList.toArrayN(list, windowSize)); const length = list.length; - MutableList.takeNVoid(list, stepSize); - skip = Math.max(0, stepSize - length); + MutableList.takeNVoid(list, step); + skip = Math.max(0, step - length); } } + return Effect.succeed(chunks); + }, + onFailure(cause_) { + if (emitted) MutableList.takeNVoid(list, windowSize - step); + if (list.length === 0) return Effect.failCause(cause_); + cause = cause_; + return Effect.succeed(Arr.of(MutableList.takeAll(list))); } - return Effect.succeed(chunks); - }, - onFailure(cause_) { - if (emitted) MutableList.takeNVoid(list, chunkSize - stepSize); - if (list.length === 0) return Effect.failCause(cause_); - cause = cause_; - return Effect.succeed(Arr.of(MutableList.takeAll(list))); - } - }); - return Effect.suspend(() => cause ? Effect.failCause(cause) : pull); -}))))); + }); + return Effect.suspend(() => cause ? Effect.failCause(cause) : pull); + })); +}))); /** * Splits the stream into non-empty groups whenever the predicate matches. * @@ -66247,7 +66580,7 @@ const combine = /*#__PURE__*/(/* unused pure expression or super */ null && (dua * await Effect.runPromise(program) * ``` * - * @category sequencing + * @category merging * @since 4.0.0 */ const combineArray = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(4, (self, that, s, f) => fromChannel(Channel.combine(self.channel, that.channel, s, f))))); @@ -66430,7 +66763,7 @@ const mapAccumArrayEffect = /*#__PURE__*/(/* unused pure expression or super */ * * const program = Effect.gen(function*() { * const values = yield* Stream.make(1, 2, 3).pipe( - * Stream.scan(0, (acc, n) => acc + n), + * Stream.scan(() => 0, (acc, n) => acc + n), * Stream.runCollect * ) * values // => [ 0, 1, 3, 6 ] @@ -66444,7 +66777,7 @@ const mapAccumArrayEffect = /*#__PURE__*/(/* unused pure expression or super */ */ const scan = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, (self, initial, f) => suspend(() => { let isFirst = true; - return fromChannel(Channel.mapAccum(self.channel, constant(initial), (state, arr) => { + return fromChannel(Channel.mapAccum(self.channel, initial, (state, arr) => { const states = Arr.empty(); if (isFirst) { isFirst = false; @@ -66467,7 +66800,7 @@ const scan = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3 * * const program = Effect.gen(function*() { * const states = yield* Stream.make(1, 2, 3).pipe( - * Stream.scanEffect(0, (sum, n) => Effect.succeed(sum + n)), + * Stream.scanEffect(() => 0, (sum, n) => Effect.succeed(sum + n)), * Stream.runCollect * ) * states // => [ 0, 1, 3, 6 ] @@ -66478,7 +66811,7 @@ const scan = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3 * @category accumulation * @since 2.0.0 */ -const scanEffect = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, (self, initial, f) => self.channel.pipe(Channel.flattenArray, Channel.scanEffect(initial, f), Channel.map(Arr.of), fromChannel)))); +const scanEffect = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, (self, initial, f) => suspend(() => self.channel.pipe(Channel.flattenArray, Channel.scanEffect(initial(), f), Channel.map(Arr.of), fromChannel))))); /** * Drops earlier elements within the debounce window and emits only the latest element after the pause. * @@ -66710,6 +67043,8 @@ const throttle = /*#__PURE__*/(/* unused pure expression or super */ null && (du * **Details** * * The final array may be smaller if there are not enough elements to fill it. + * Finite fractional sizes are rounded down. `NaN` and non-positive sizes are + * treated as `1`. * * **Example** (Grouping elements by size) * @@ -66735,6 +67070,11 @@ const grouped = /*#__PURE__*/(/* unused pure expression or super */ null && (dua * Partitions the stream into arrays, emitting when the chunk size is reached * or the duration passes. * + * **Details** + * + * Finite fractional chunk sizes are rounded down. `NaN` and non-positive sizes + * are treated as `1`. + * * **Example** (Grouping elements by size or time) * * ```ts import.meta.vitest @@ -66754,7 +67094,7 @@ const grouped = /*#__PURE__*/(/* unused pure expression or super */ null && (dua * @category grouping * @since 2.0.0 */ -const groupedWithin = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, (self, chunkSize, duration) => aggregateWithin(self, Sink.take(chunkSize), Schedule.spaced(duration))))); +const groupedWithin = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, (self, chunkSize, duration) => aggregateWithin(self, Sink.take(Count.normalizeNonEmpty(chunkSize)), Schedule.spaced(duration))))); /** * Groups elements into keyed substreams using an effectful classifier. * @@ -67090,7 +67430,8 @@ const aggregateWithin = /*#__PURE__*/(/* unused pure expression or super */ null * With the default suspend strategy, the source can only advance `capacity` * chunks ahead of the slowest downstream stream. If a downstream stream is * interrupted, it unsubscribes from the broadcast so it no longer contributes - * backpressure. + * backpressure. Finite fractional values of `n` are rounded down. `NaN` and + * non-positive values create no downstream streams. * * **Example** (Broadcasting to two consumers) * @@ -67119,10 +67460,11 @@ const aggregateWithin = /*#__PURE__*/(/* unused pure expression or super */ null * @since 4.0.0 */ const broadcastN = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, /*#__PURE__*/Effect.fnUntraced(function* (self, options) { + const n = Count.normalize(options.n); const pubsub = yield* makePubSub(options); - const streams = new Array(options.n); + const streams = new Array(n); const parentScope = yield* Scope.Scope; - for (let i = 0; i < options.n; i++) { + for (let i = 0; i < n; i++) { const scope = Scope.forkUnsafe(parentScope); const subscription = yield* PubSub.subscribe(pubsub).pipe(Effect.provideService(Scope.Scope, scope)); streams[i] = Channel.fromEffectTake(PubSub.take(subscription)).pipe(Channel.onExit(exit => Scope.close(scope, exit)), fromChannel); @@ -67505,7 +67847,7 @@ const changesWithEffect = /*#__PURE__*/(/* unused pure expression or super */ nu * await Effect.runPromise(program) * ``` * - * @category decoding + * @category text * @since 2.0.0 */ const decodeText = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(args => isStream(args[0]), (self, options) => suspend(() => { @@ -67533,7 +67875,7 @@ const decodeText = /*#__PURE__*/(/* unused pure expression or super */ null && ( * await Effect.runPromise(program) * ``` * - * @category encoding + * @category text * @since 2.0.0 */ const encodeText = self => suspend(() => { @@ -67556,7 +67898,7 @@ const encodeText = self => suspend(() => { * })) * ``` * - * @category splitting + * @category text * @since 2.0.0 */ const splitLines = self => self.channel.pipe(Channel.pipeTo(Channel.splitLines()), fromChannel); @@ -67838,7 +68180,7 @@ const onExit = /*#__PURE__*/(0,_Function_js__rspack_import_7/* .dual */.XY)(2, ( * errors // => ["boom"] * ``` * - * @category error handling + * @category resource management * @since 2.0.0 */ const onError = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, cleanup) => fromChannel(Channel.onError(self.channel, cleanup))))); @@ -68197,7 +68539,7 @@ const withSpan = function () { * await Effect.runPromise(effect) * ``` * - * @category constructors + * @category do notation * @since 2.0.0 */ const Do = /*#__PURE__*/(/* unused pure expression or super */ null && (succeed({}))); @@ -68224,12 +68566,12 @@ const let_ = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3 * await Effect.runPromise(result) // => [{ a: 1, b: 2 }, { a: 2, b: 3 }] * ``` * - * @category sequencing + * @category do notation * @since 2.0.0 */ -const bind = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(args => isStream(args[0]), (self, tag, f, options) => flatMap(self, a => map(f(a), b => ({ +const bind = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(args => isStream(args[0]), (self, name, f, options) => flatMap(self, a => map(f(a), b => ({ ...a, - [tag]: b + [name]: b })), options)))); /** * Binds an Effect-produced value into the do-notation record for each stream element. @@ -68252,12 +68594,12 @@ const bind = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(a * await Effect.runPromise(program) * ``` * - * @category sequencing + * @category do notation * @since 2.0.0 */ -const bindEffect = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(args => isStream(args[0]), (self, tag, f, options) => mapEffect(self, a => Effect.map(f(a), b => ({ +const bindEffect = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(args => isStream(args[0]), (self, name, f, options) => mapEffect(self, a => Effect.map(f(a), b => ({ ...a, - [tag]: b + [name]: b })), options)))); /** * Maps each element into a record keyed by the provided name. @@ -68272,7 +68614,7 @@ const bindEffect = /*#__PURE__*/(/* unused pure expression or super */ null && ( * await Effect.runPromise(Stream.runCollect(stream)) // => [{ value: 1 }, { value: 2 }, { value: 3 }] * ``` * - * @category mapping + * @category do notation * @since 2.0.0 */ const bindTo = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, name) => map(self, a => ({ @@ -68657,6 +68999,11 @@ const mkString = self => Channel.runFold(self.channel, () => "", (acc, chunk) => /** * Concatenates the stream's `Uint8Array` chunks into a single `ArrayBuffer`. * + * **Gotchas** + * + * This materializes the full content in memory. The source stream must not + * reuse or mutate emitted buffers, which are retained until collection completes. + * * **Example** (Joining byte chunks into an ArrayBuffer) * * ```ts import.meta.vitest @@ -68673,11 +69020,6 @@ const mkString = self => Channel.runFold(self.channel, () => "", (acc, chunk) => * await Effect.runPromise(program) // => [1, 2, 3, 4] * ``` * - * **Gotchas** - * - * This materializes the full content in memory. The source stream must not - * reuse or mutate emitted buffers, which are retained until collection completes. - * * @category destructors * @since 4.0.0 */ @@ -68685,6 +69027,11 @@ const mkArrayBuffer = self => Effect.map(Channel.mkUint8Array(self.channel), byt /** * Concatenates the stream's `Uint8Array` chunks into a single `Uint8Array`. * + * **Gotchas** + * + * This materializes the full content in memory. The source stream must not + * reuse or mutate emitted buffers, which are retained until collection completes. + * * **Example** (Joining Uint8Array chunks) * * ```ts import.meta.vitest @@ -68699,11 +69046,6 @@ const mkArrayBuffer = self => Effect.map(Channel.mkUint8Array(self.channel), byt * await Effect.runPromise(program) * ``` * - * **Gotchas** - * - * This materializes the full content in memory. The source stream must not - * reuse or mutate emitted buffers, which are retained until collection completes. - * * @category destructors * @since 4.0.0 */ @@ -69373,9 +69715,23 @@ const TracerKey = "effect/Tracer"; */ const Tracer = /*#__PURE__*/_Context_js__rspack_import_0/* .Reference */.Or(TracerKey, { fiberCached: true, - defaultValue: () => make({ - span: options => new NativeSpan(options) - }) + defaultValue: () => nativeTracer +}); +/** + * The default `Tracer` implementation backing the `Tracer` reference. It + * creates in-memory `NativeSpan` instances and does not export them anywhere. + * + * **Details** + * + * Runtime code can compare the active tracer against `nativeTracer` to detect + * that no tracing backend is installed and skip work that only a backend could + * observe, such as recording span attributes. + * + * @category references + * @since 4.0.0 + */ +const nativeTracer = /*#__PURE__*/make({ + span: options => new NativeSpan(options) }); /** * Default in-memory `Span` implementation used by the native tracer. It @@ -69384,9 +69740,11 @@ const Tracer = /*#__PURE__*/_Context_js__rspack_import_0/* .Reference */.Or(Trac * * **Details** * - * The constructor initializes the span with `Started` status, inherits the - * parent trace id or generates a new one, and always generates a new span id. - * Attributes, events, links, and status are then mutated through `Span` methods. + * The constructor initializes the span with `Started` status. Trace and span + * identifiers, the attribute map, and the event list are created lazily on + * first access, so spans that are never inspected allocate as little as + * possible. Attributes, events, links, and status are mutated through `Span` + * methods. * * @see {@link Span} for the interface implemented by native spans * @@ -69395,8 +69753,6 @@ const Tracer = /*#__PURE__*/_Context_js__rspack_import_0/* .Reference */.Or(Trac */ class NativeSpan { _tag = "Span"; - spanId; - traceId = "native"; sampled; name; parent; @@ -69405,8 +69761,10 @@ class NativeSpan { startTime; kind; status; - attributes; - events = []; + _traceId = undefined; + _spanId = undefined; + _attributes = undefined; + _events = undefined; constructor(options) { this.name = options.name; this.parent = options.parent; @@ -69419,9 +69777,18 @@ class NativeSpan { _tag: "Started", startTime: options.startTime }; - this.attributes = new Map(); - this.traceId = _Option_js__rspack_import_2.getOrUndefined(options.parent)?.traceId ?? _Encoding_js__rspack_import_3/* .randomHex */.nw(32); - this.spanId = _Encoding_js__rspack_import_3/* .randomHex */.nw(16); + } + get traceId() { + return this._traceId ??= _Option_js__rspack_import_2.getOrUndefined(this.parent)?.traceId ?? _Encoding_js__rspack_import_3/* .randomHex */.nw(32); + } + get spanId() { + return this._spanId ??= _Encoding_js__rspack_import_3/* .randomHex */.nw(16); + } + get attributes() { + return this._attributes ??= new Map(); + } + get events() { + return this._events ??= []; } end(endTime, exit) { this.status = { @@ -69457,6 +69824,8 @@ __webpack_require__.d(__webpack_exports__, { }, "./node_modules/effect/dist/Utils.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) { +/* import */ var _internal_stackTraceLimit_js__rspack_import_0 = __webpack_require__("./node_modules/effect/dist/internal/stackTraceLimit.js"); + /** * Yields its wrapped value exactly once through an `IterableIterator`. * @@ -69547,7 +69916,7 @@ const pickInternalCall = () => { } } }; - const isNotOptimizedAway = standard[InternalTypeId](() => new Error().stack)?.includes(InternalTypeId) === true; + const isNotOptimizedAway = (0,_internal_stackTraceLimit_js__rspack_import_0/* .getStackTraceLimit */.jt)() !== 0 && standard[InternalTypeId](() => new Error().stack)?.includes(InternalTypeId) === true; return isNotOptimizedAway ? standard[InternalTypeId] : forced[InternalTypeId]; }; /** @internal */ @@ -69567,6 +69936,12 @@ __webpack_require__.d(__webpack_exports__, { */ /** @internal */ const isArrayNonEmpty = self => self.length > 0; +/** @internal */ +function replaceAt(self, index, value) { + const out = self.slice(); + out[index] = value; + return out; +} //# sourceMappingURL=array.js.map __webpack_require__.d(__webpack_exports__, { }, { @@ -69688,8 +70063,6 @@ const isCause = self => (0,_Predicate_js__rspack_import_7/* .hasProperty */.i5)( const isCauseReason = self => (0,_Predicate_js__rspack_import_7/* .hasProperty */.i5)(self, CauseReasonTypeId); /** @internal */ class CauseImpl { - [CauseTypeId]; - reasons; constructor(failures) { this[CauseTypeId] = CauseTypeId; this.reasons = failures; @@ -69759,7 +70132,6 @@ class ReasonBase { const constEmptyAnnotations = /*#__PURE__*/new Map(); /** @internal */ class Fail extends ReasonBase { - error; constructor(error, annotations = constEmptyAnnotations) { super("Fail", annotations, error); this.error = error; @@ -69788,7 +70160,6 @@ const causeEmpty = /*#__PURE__*/new CauseImpl([]); const causeFail = error => new CauseImpl([new Fail(error)]); /** @internal */ class Die extends ReasonBase { - defect; constructor(defect, annotations = constEmptyAnnotations) { super("Die", annotations, defect); this.defect = defect; @@ -69837,10 +70208,12 @@ const makePrimitiveProto = options => ({ /** @internal */ const makePrimitive = options => { const Proto = makePrimitiveProto(options); - return function () { - const self = Object.create(Proto); - self[args] = options.single === false ? arguments : arguments[0]; - return self; + const PrimitiveImpl = function (value) { + this[args] = value; + }; + PrimitiveImpl.prototype = Proto; + return function (value) { + return new PrimitiveImpl(value); }; }; /** @internal */ @@ -69869,10 +70242,12 @@ const makeExit = options => { return _Hash_js__rspack_import_4/* .combine */.kg(_Hash_js__rspack_import_4/* .string */.Yj(options.op), _Hash_js__rspack_import_4/* .hash */.tW(this[args])); } }; + const ExitPrimitive = function (value) { + this[args] = value; + }; + ExitPrimitive.prototype = Proto; return function (value) { - const self = Object.create(Proto); - self[args] = value; - return self; + return new ExitPrimitive(value); }; }; /** @internal */ @@ -69899,9 +70274,9 @@ const exitFailCause = /*#__PURE__*/makeExit({ [evaluate](fiber) { let cause = this[args]; let annotated = false; - if (fiber.currentStackFrame) { + if (fiber.cache.stackFrame) { cause = causeAnnotate(cause, { - mapUnsafe: new Map([[StackTraceKey.key, fiber.currentStackFrame]]) + mapUnsafe: new Map([[StackTraceKey.key, fiber.cache.stackFrame]]) }); annotated = true; } @@ -69923,6 +70298,20 @@ const withFiber = /*#__PURE__*/makePrimitive({ return this[args](fiber); } }); +/** + * Accesses the current fiber to compute a value without a separate `succeed` + * operation. + * + * @internal + */ +const withFiberSucceed = /*#__PURE__*/makePrimitive({ + op: "WithFiberSucceed", + [evaluate](fiber) { + const value = this[args](fiber); + const cont = fiber.getCont(contA); + return cont ? cont[contA](value, fiber) : fiber.yieldWith(exitSucceed(value)); + } +}); /** @internal */ const YieldableError = /*#__PURE__*/function () { class YieldableError extends globalThis.Error {} @@ -70021,6 +70410,7 @@ __webpack_require__.d(__webpack_exports__, { DH: causeEmpty, Eh: causeAnnotate, GN: Yield, + Hq: withFiberSucceed, IH: ExitTypeId, In: StructuralProto, Iu: causeDie, @@ -70058,6 +70448,28 @@ __webpack_require__.d(__webpack_exports__, { }); +}, +"./node_modules/effect/dist/internal/count.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * Normalizes a collection count to a non-negative integer. `NaN` and + * non-positive values become `0`; positive infinity is preserved. + * + * @internal + */ +const normalize = n => n > 0 ? Math.floor(n) : 0; +/** + * Normalizes a collection count to an integer greater than or equal to `1`. + * + * @internal + */ +const normalizeNonEmpty = n => Math.max(1, normalize(n)); +//# sourceMappingURL=count.js.map +__webpack_require__.d(__webpack_exports__, { +}, { + S: normalize +}); + + }, "./node_modules/effect/dist/internal/doNotation.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) { /* import */ var _Function_js__rspack_import_0 = __webpack_require__("./node_modules/effect/dist/Function.js"); @@ -70087,31 +70499,31 @@ __webpack_require__.d(__webpack_exports__, { }, "./node_modules/effect/dist/internal/effect.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) { -/* import */ var _Array_js__rspack_import_7 = __webpack_require__("./node_modules/effect/dist/Array.js"); +/* import */ var _Array_js__rspack_import_16 = __webpack_require__("./node_modules/effect/dist/Array.js"); /* import */ var _Context_js__rspack_import_5 = __webpack_require__("./node_modules/effect/dist/Context.js"); /* import */ var _Duration_js__rspack_import_20 = __webpack_require__("./node_modules/effect/dist/Duration.js"); /* import */ var _Equal_js__rspack_import_1 = __webpack_require__("./node_modules/effect/dist/Equal.js"); /* import */ var _Filter_js__rspack_import_4 = __webpack_require__("./node_modules/effect/dist/Filter.js"); -/* import */ var _Formatter_js__rspack_import_9 = __webpack_require__("./node_modules/effect/dist/Formatter.js"); +/* import */ var _Formatter_js__rspack_import_8 = __webpack_require__("./node_modules/effect/dist/Formatter.js"); /* import */ var _Function_js__rspack_import_6 = __webpack_require__("./node_modules/effect/dist/Function.js"); /* import */ var _Hash_js__rspack_import_2 = __webpack_require__("./node_modules/effect/dist/Hash.js"); /* import */ var _Inspectable_js__rspack_import_25 = __webpack_require__("./node_modules/effect/dist/Inspectable.js"); /* import */ var _Iterable_js__rspack_import_23 = __webpack_require__("./node_modules/effect/dist/Iterable.js"); /* import */ var _Option_js__rspack_import_17 = __webpack_require__("./node_modules/effect/dist/Option.js"); /* import */ var _Order_js__rspack_import_24 = __webpack_require__("./node_modules/effect/dist/Order.js"); -/* import */ var _Pipeable_js__rspack_import_12 = __webpack_require__("./node_modules/effect/dist/Pipeable.js"); -/* import */ var _Predicate_js__rspack_import_11 = __webpack_require__("./node_modules/effect/dist/Predicate.js"); -/* import */ var _Redactable_js__rspack_import_10 = __webpack_require__("./node_modules/effect/dist/Redactable.js"); +/* import */ var _Pipeable_js__rspack_import_11 = __webpack_require__("./node_modules/effect/dist/Pipeable.js"); +/* import */ var _Predicate_js__rspack_import_10 = __webpack_require__("./node_modules/effect/dist/Predicate.js"); +/* import */ var _Redactable_js__rspack_import_9 = __webpack_require__("./node_modules/effect/dist/Redactable.js"); /* import */ var _Result_js__rspack_import_3 = __webpack_require__("./node_modules/effect/dist/Result.js"); /* import */ var _Scheduler_js__rspack_import_13 = __webpack_require__("./node_modules/effect/dist/Scheduler.js"); -/* import */ var _Tracer_js__rspack_import_14 = __webpack_require__("./node_modules/effect/dist/Tracer.js"); +/* import */ var _Tracer_js__rspack_import_12 = __webpack_require__("./node_modules/effect/dist/Tracer.js"); /* import */ var _Utils_js__rspack_import_18 = __webpack_require__("./node_modules/effect/dist/Utils.js"); /* import */ var _core_js__rspack_import_0 = __webpack_require__("./node_modules/effect/dist/internal/core.js"); /* import */ var _doNotation_js__rspack_import_22 = __webpack_require__("./node_modules/effect/dist/internal/doNotation.js"); -/* import */ var _metric_js__rspack_import_16 = __webpack_require__("./node_modules/effect/dist/internal/metric.js"); +/* import */ var _metric_js__rspack_import_15 = __webpack_require__("./node_modules/effect/dist/internal/metric.js"); /* import */ var _record_js__rspack_import_21 = __webpack_require__("./node_modules/effect/dist/internal/record.js"); -/* import */ var _references_js__rspack_import_15 = __webpack_require__("./node_modules/effect/dist/internal/references.js"); -/* import */ var _stackTraceLimit_js__rspack_import_8 = __webpack_require__("./node_modules/effect/dist/internal/stackTraceLimit.js"); +/* import */ var _references_js__rspack_import_14 = __webpack_require__("./node_modules/effect/dist/internal/references.js"); +/* import */ var _stackTraceLimit_js__rspack_import_7 = __webpack_require__("./node_modules/effect/dist/internal/stackTraceLimit.js"); /* import */ var _tracer_js__rspack_import_19 = __webpack_require__("./node_modules/effect/dist/internal/tracer.js"); @@ -70144,7 +70556,6 @@ __webpack_require__.d(__webpack_exports__, { // ---------------------------------------------------------------------------- /** @internal */ class Interrupt extends _core_js__rspack_import_0/* .ReasonBase */.ET { - fiberId; constructor(fiberId, annotations = _core_js__rspack_import_0/* .constEmptyAnnotations */.dO) { super("Interrupt", annotations, "Interrupted"); this.fiberId = fiberId; @@ -70242,6 +70653,25 @@ const causeAnnotations = self => { } return _Context_js__rspack_import_5/* .makeUnsafe */.LZ(map); }; +const dedupeReasons = (self, that) => { + // Keep deduplication local so causeCombine does not retain Array.ts in the core bundle. + // Snapshot both arrays before invoking user-defined hash or equality methods. + const buckets = new Map(); + const out = []; + for (const reason of self.concat(that)) { + const hash = _Hash_js__rspack_import_2/* .hash */.tW(reason); + const bucket = buckets.get(hash); + if (bucket === undefined) { + buckets.set(hash, [reason]); + } else if (bucket.some(previous => _Equal_js__rspack_import_1/* .equals */.aI(previous, reason))) { + continue; + } else { + bucket.push(reason); + } + out.push(reason); + } + return out; +}; /** @internal */ const causeCombine = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, that) => { if (self.reasons.length === 0) { @@ -70249,7 +70679,7 @@ const causeCombine = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY } else if (that.reasons.length === 0) { return self; } - const newCause = new _core_js__rspack_import_0/* .CauseImpl */.s0(_Array_js__rspack_import_7/* .union */.KC(self.reasons, that.reasons)); + const newCause = new _core_js__rspack_import_0/* .CauseImpl */.s0(dedupeReasons(self.reasons, that.reasons)); return _Equal_js__rspack_import_1/* .equals */.aI(self, newCause) ? self : newCause; }); /** @internal */ @@ -70293,8 +70723,8 @@ const causePrettyErrors = (self, options) => { const errors = []; const interrupts = []; if (self.reasons.length === 0) return errors; - const prevStackLimit = (0,_stackTraceLimit_js__rspack_import_8/* .getStackTraceLimit */.jt)(); - (0,_stackTraceLimit_js__rspack_import_8/* .setStackTraceLimit */.ft)(1); + const prevStackLimit = (0,_stackTraceLimit_js__rspack_import_7/* .getStackTraceLimit */.jt)(); + if (prevStackLimit !== 0) (0,_stackTraceLimit_js__rspack_import_7/* .setStackTraceLimit */.ft)(1); for (const failure of self.reasons) { if (failure._tag === "Interrupt") { interrupts.push(failure); @@ -70313,7 +70743,7 @@ const causePrettyErrors = (self, options) => { error.stack = `${error.name}: ${error.message}`; errors.push(causePrettyError(error, interrupts[0].annotations, options)); } - (0,_stackTraceLimit_js__rspack_import_8/* .setStackTraceLimit */.ft)(prevStackLimit); + if (prevStackLimit !== 0) (0,_stackTraceLimit_js__rspack_import_7/* .setStackTraceLimit */.ft)(prevStackLimit); return errors; }; /** @internal */ @@ -70343,7 +70773,7 @@ const causePrettyError = (original, annotations, options) => { } } } else { - error = new globalThis.Error(!original ? `Unknown error: ${original}` : kind === "string" ? original : (0,_Formatter_js__rspack_import_9/* .formatJson */.IB)(original)); + error = new globalThis.Error(!original ? `Unknown error: ${original}` : kind === "string" ? original : (0,_Formatter_js__rspack_import_8/* .formatJson */.IB)(original)); } return error; }; @@ -70357,7 +70787,7 @@ const causePrettyMessage = u => { // something's off, rollback to json } } - return (0,_Formatter_js__rspack_import_9/* .formatJson */.IB)(u); + return (0,_Formatter_js__rspack_import_8/* .formatJson */.IB)(u); }; const locationRegExp = /\((.*)\)/g; const cleanErrorStack = (stack, error, annotations) => { @@ -70440,7 +70870,7 @@ const fiberIdStore = { id: 0 }; /** @internal */ -const getCurrentFiber = () => globalThis[_Redactable_js__rspack_import_10/* .currentFiberTypeId */.fL]; +const getCurrentFiber = () => globalThis[_Redactable_js__rspack_import_9/* .currentFiberTypeId */.fL]; /** @internal */ class FiberImpl { constructor(context, interruptible = true) { @@ -70450,14 +70880,15 @@ class FiberImpl { this.currentOpCount = 0; this.interruptible = interruptible; this._stack = []; - this._observers = []; + this._observers = undefined; this._exit = undefined; this._children = undefined; this._interruptedCause = undefined; this._yielded = undefined; this._running = false; this._deferredInterrupt = false; - this.runtimeMetrics?.recordFiberStart(this.context); + this._parent = undefined; + this.cache.runtimeMetrics?.recordFiberStart(this.context); } [FiberTypeId]; id; @@ -70471,20 +70902,13 @@ class FiberImpl { _yielded; _running; _deferredInterrupt; + _parent; // set in setContext context; - currentScheduler; - currentTracerContext; - currentSpan; - currentLogLevel; - minimumLogLevel; - currentStackFrame; - runtimeMetrics; - maxOpsBeforeYield; - currentPreventYield; + cache; _dispatcher = undefined; get currentDispatcher() { - return this._dispatcher ??= this.currentScheduler.makeDispatcher(); + return this._dispatcher ??= this.cache.scheduler.makeDispatcher(); } getRef(ref) { return _Context_js__rspack_import_5/* .get */.Jt(this.context, ref); @@ -70494,9 +70918,13 @@ class FiberImpl { cb(this._exit); return _Function_js__rspack_import_6/* .constVoid */.Yi; } - this._observers.push(cb); + if (this._observers === undefined) { + this._observers = [cb]; + } else { + this._observers.push(cb); + } return () => { - if (this._exit) return; + if (this._exit || this._observers === undefined) return; const index = this._observers.indexOf(cb); if (index >= 0) { this._observers.splice(index, 1); @@ -70508,8 +70936,8 @@ class FiberImpl { return; } let cause = causeInterrupt(fiberId); - if (this.currentStackFrame) { - cause = (0,_core_js__rspack_import_0/* .causeAnnotate */.Eh)(cause, _Context_js__rspack_import_5/* .make */.L8(_core_js__rspack_import_0/* .StackTraceKey */.z8, this.currentStackFrame)); + if (this.cache.stackFrame) { + cause = (0,_core_js__rspack_import_0/* .causeAnnotate */.Eh)(cause, _Context_js__rspack_import_5/* .make */.L8(_core_js__rspack_import_0/* .StackTraceKey */.z8, this.cache.stackFrame)); } if (annotations) { cause = (0,_core_js__rspack_import_0/* .causeAnnotate */.Eh)(cause, annotations); @@ -70545,18 +70973,25 @@ class FiberImpl { return this.evaluate(flatMap(interruptChildren, () => exit)); } this._exit = exit; - this.runtimeMetrics?.recordFiberEnd(this.context, this._exit); - for (let i = 0; i < this._observers.length; i++) { - this._observers[i](exit); + this.cache.runtimeMetrics?.recordFiberEnd(this.context, this._exit); + if (this._parent) { + this._parent._children?.delete(this); + this._parent = undefined; + } + if (this._observers !== undefined) { + const observers = this._observers; + this._observers = undefined; + for (let i = 0; i < observers.length; i++) { + observers[i](exit); + } } - this._observers.length = 0; this._stack.length = 0; this._children = undefined; this.context = _Context_js__rspack_import_5/* .empty */.Ie(); } runLoop(effect) { - const prevFiber = globalThis[_Redactable_js__rspack_import_10/* .currentFiberTypeId */.fL]; - globalThis[_Redactable_js__rspack_import_10/* .currentFiberTypeId */.fL] = this; + const prevFiber = globalThis[_Redactable_js__rspack_import_9/* .currentFiberTypeId */.fL]; + globalThis[_Redactable_js__rspack_import_9/* .currentFiberTypeId */.fL] = this; const prevRunning = this._running; this._running = true; let yielding = false; @@ -70569,12 +71004,14 @@ class FiberImpl { current = failCause(this._interruptedCause); } this.currentOpCount++; - if (!yielding && !this.currentPreventYield && this.currentScheduler.shouldYield(this)) { + // Refresh the cache because a primitive can replace the fiber context. + const cache = this.cache; + if (!yielding && !cache.preventYield && cache.scheduler.shouldYield(this)) { yielding = true; const prev = current; current = flatMap(yieldNow, () => prev); } - current = this.currentTracerContext ? this.currentTracerContext(current, this) : current[_core_js__rspack_import_0/* .evaluate */._3](this); + current = cache.tracerContext ? cache.tracerContext(current, this) : current[_core_js__rspack_import_0/* .evaluate */._3](this); if (current === _core_js__rspack_import_0/* .Yield */.GN) { const yielded = this._yielded; if (_core_js__rspack_import_0/* .ExitTypeId */.IH in yielded) { @@ -70590,13 +71027,13 @@ class FiberImpl { } } } catch (error) { - if (!(0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(current, _core_js__rspack_import_0/* .evaluate */._3)) { + if (!(0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(current, _core_js__rspack_import_0/* .evaluate */._3)) { return (0,_core_js__rspack_import_0/* .exitDie */.V2)(`Fiber.runLoop: Not a valid effect: ${String(current)}`); } return this.runLoop((0,_core_js__rspack_import_0/* .exitDie */.V2)(error)); } finally { this._running = prevRunning; - globalThis[_Redactable_js__rspack_import_10/* .currentFiberTypeId */.fL] = prevFiber; + globalThis[_Redactable_js__rspack_import_9/* .currentFiberTypeId */.fL] = prevFiber; } } getCont(symbol) { @@ -70607,11 +71044,14 @@ class FiberImpl { while (true) { const op = this._stack.pop(); if (!op) return undefined; - const cont = op[_core_js__rspack_import_0/* .contAll */.u4] && op[_core_js__rspack_import_0/* .contAll */.u4](this); - if (cont) { - ; - cont[symbol] = cont; - return cont; + const all = op[_core_js__rspack_import_0/* .contAll */.u4]; + if (all !== undefined) { + const cont = all.call(op, this); + if (cont) { + ; + cont[symbol] = cont; + return cont; + } } if (op[symbol]) return op; } @@ -70624,7 +71064,7 @@ class FiberImpl { return this._children ??= new Set(); } pipe() { - return (0,_Pipeable_js__rspack_import_12/* .pipeArguments */.tT)(this, arguments); + return (0,_Pipeable_js__rspack_import_11/* .pipeArguments */.tT)(this, arguments); } setContext(context) { const previous = this.context; @@ -70632,27 +71072,39 @@ class FiberImpl { // Every key cached below opts in to Context caching, so contexts related // only by non-caching adds cannot have changed any of them if (previous !== undefined && _Context_js__rspack_import_5/* .hasSameCache */.Pf(previous, context)) return; - const scheduler = this.getRef(_Scheduler_js__rspack_import_13/* .Scheduler */._F); - if (scheduler !== this.currentScheduler) { - this.currentScheduler = scheduler; + // Contexts sharing a cacheRoot resolve every cached key identically, so + // the derived cache object is computed once per root and shared by all + // fibers running with that root (forked fibers reuse the parent's). + const root = context.cacheRoot; + const cache = root._fiberCache ??= makeFiberContextCache(context); + if (this.cache !== undefined && this.cache.scheduler !== cache.scheduler) { this._dispatcher = undefined; } - // The string-keyed lookups keep the Tracer key values (and the native - // tracer behind Tracer.Tracer's default) out of every bundle - this.currentSpan = _Context_js__rspack_import_5/* .getOrUndefinedUnsafe */.Ub(context, _Tracer_js__rspack_import_14/* .ParentSpanKey */.WG); - this.currentLogLevel = this.getRef(_references_js__rspack_import_15/* .CurrentLogLevel */.Gl); - this.minimumLogLevel = this.getRef(_references_js__rspack_import_15/* .MinimumLogLevel */.zQ); - this.currentStackFrame = this.getRef(_references_js__rspack_import_15/* .CurrentStackFrame */.vA); - this.maxOpsBeforeYield = this.getRef(_Scheduler_js__rspack_import_13/* .MaxOpsBeforeYield */.Zm); - this.currentPreventYield = this.getRef(_Scheduler_js__rspack_import_13/* .PreventSchedulerYield */.hf); - this.runtimeMetrics = _Context_js__rspack_import_5/* .getOrUndefinedUnsafe */.Ub(context, _metric_js__rspack_import_16/* .FiberRuntimeMetricsKey */.F); - const currentTracer = _Context_js__rspack_import_5/* .getOrUndefinedUnsafe */.Ub(context, _Tracer_js__rspack_import_14/* .TracerKey */.RL); - this.currentTracerContext = currentTracer ? currentTracer["context"] : undefined; + this.cache = cache; } get currentSpanLocal() { - return this.currentSpan?._tag === "Span" ? this.currentSpan : undefined; + const span = this.cache.span; + return span?._tag === "Span" ? span : undefined; } } +const makeFiberContextCache = context => { + // The string-keyed lookups keep the Tracer key values (and the native + // tracer behind Tracer.Tracer's default) out of every bundle + const currentTracer = _Context_js__rspack_import_5/* .getOrUndefinedUnsafe */.Ub(context, _Tracer_js__rspack_import_12/* .TracerKey */.RL); + return { + scheduler: _Context_js__rspack_import_5/* .get */.Jt(context, _Scheduler_js__rspack_import_13/* .Scheduler */._F), + tracer: currentTracer, + tracerContext: currentTracer ? currentTracer["context"] : undefined, + tracerEnabled: _Context_js__rspack_import_5/* .get */.Jt(context, _references_js__rspack_import_14/* .TracerEnabled */.rf), + span: _Context_js__rspack_import_5/* .getOrUndefinedUnsafe */.Ub(context, _Tracer_js__rspack_import_12/* .ParentSpanKey */.WG), + logLevel: _Context_js__rspack_import_5/* .get */.Jt(context, _references_js__rspack_import_14/* .CurrentLogLevel */.Gl), + minimumLogLevel: _Context_js__rspack_import_5/* .get */.Jt(context, _references_js__rspack_import_14/* .MinimumLogLevel */.zQ), + stackFrame: _Context_js__rspack_import_5/* .get */.Jt(context, _references_js__rspack_import_14/* .CurrentStackFrame */.vA), + runtimeMetrics: _Context_js__rspack_import_5/* .getOrUndefinedUnsafe */.Ub(context, _metric_js__rspack_import_15/* .FiberRuntimeMetricsKey */.F), + maxOpsBeforeYield: _Context_js__rspack_import_5/* .get */.Jt(context, _Scheduler_js__rspack_import_13/* .MaxOpsBeforeYield */.Zm), + preventYield: _Context_js__rspack_import_5/* .get */.Jt(context, _Scheduler_js__rspack_import_13/* .PreventSchedulerYield */.hf) + }; +}; const deferredInterruptCont = { [_core_js__rspack_import_0/* .contA */.ee](_value, fiber) { return failCause(fiber._interruptedCause); @@ -70665,9 +71117,9 @@ const fiberMiddleware = { interruptChildren: undefined }; const fiberStackAnnotations = fiber => { - if (!fiber.currentStackFrame) return undefined; + if (!fiber.cache.stackFrame) return undefined; const annotations = new Map(); - annotations.set(_core_js__rspack_import_0/* .InterruptorStackTrace.key */.QJ.key, fiber.currentStackFrame); + annotations.set(_core_js__rspack_import_0/* .InterruptorStackTrace.key */.QJ.key, fiber.cache.stackFrame); return _Context_js__rspack_import_5/* .makeUnsafe */.LZ(annotations); }; const fiberInterruptChildren = fiber => { @@ -70721,9 +71173,9 @@ const fiberJoin = self => { /** @internal */ const fiberJoinAll = self => callback(resume => { const fibers = Array.from(self); - if (fibers.length === 0) return resume(succeed(_Array_js__rspack_import_7/* .empty */.Ie())); + if (fibers.length === 0) return resume(succeed(_Array_js__rspack_import_16/* .empty */.Ie())); const out = new Array(fibers.length); - const cancels = _Array_js__rspack_import_7/* .empty */.Ie(); + const cancels = _Array_js__rspack_import_16/* .empty */.Ie(); let done = 0; let failed = false; for (let i = 0; i < fibers.length; i++) { @@ -70749,7 +71201,7 @@ const fiberJoinAll = self => callback(resume => { /** @internal */ const fiberInterrupt = self => (0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => fiberInterruptAs(self, fiber.id)); /** @internal */ -const fiberInterruptAs = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(args[0], FiberTypeId), (self, fiberId, annotations) => (0,_core_js__rspack_import_0/* .withFiber */.R6)(parent => { +const fiberInterruptAs = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(args[0], FiberTypeId), (self, fiberId, annotations) => (0,_core_js__rspack_import_0/* .withFiber */.R6)(parent => { let ann = fiberStackAnnotations(parent); ann = ann && annotations ? _Context_js__rspack_import_5/* .merge */.h1(ann, annotations) : ann ?? annotations; self.interruptUnsafe(fiberId, ann); @@ -70758,7 +71210,7 @@ const fiberInterruptAs = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual * /** @internal */ const fiberInterruptAll = fibers => (0,_core_js__rspack_import_0/* .withFiber */.R6)(parent => { const annotations = fiberStackAnnotations(parent); - let fiberArr = _Array_js__rspack_import_7/* .empty */.Ie(); + let fiberArr = _Array_js__rspack_import_16/* .empty */.Ie(); for (const fiber of fibers) { fiber.interruptUnsafe(parent.id, annotations); fiberArr.push(fiber); @@ -70768,7 +71220,7 @@ const fiberInterruptAll = fibers => (0,_core_js__rspack_import_0/* .withFiber */ /** @internal */ const fiberInterruptAllAs = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (fibers, fiberId) => (0,_core_js__rspack_import_0/* .withFiber */.R6)(parent => { const annotations = fiberStackAnnotations(parent); - const fiberArr = _Array_js__rspack_import_7/* .empty */.Ie(); + const fiberArr = _Array_js__rspack_import_16/* .empty */.Ie(); for (const fiber of fibers) { fiber.interruptUnsafe(fiberId, annotations); fiberArr.push(fiber); @@ -70881,39 +71333,48 @@ const withFiberId = f => (0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber const fiber = /*#__PURE__*/(0,_core_js__rspack_import_0/* .withFiber */.R6)(succeed); /** @internal */ const fiberId = /*#__PURE__*/withFiberId(succeed); -const callbackOptions = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitive */.Uf)({ - op: "Async", - single: false, - [_core_js__rspack_import_0/* .evaluate */._3](fiber) { - const register = (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => this[_core_js__rspack_import_0/* .args */.a2][0].bind(fiber.currentScheduler)); - let resumed = false; - let yielded = false; - const controller = this[_core_js__rspack_import_0/* .args */.a2][1] ? new AbortController() : undefined; - const onCancel = register(effect => { - if (resumed) return; - resumed = true; - if (yielded) { - fiber.evaluate(effect); - } else { - yielded = effect; +const callbackOptions = /*#__PURE__*/function () { + const Proto = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitiveProto */.yj)({ + op: "Async", + [_core_js__rspack_import_0/* .evaluate */._3](fiber) { + const register = (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => this.register.bind(fiber.cache.scheduler)); + let resumed = false; + let yielded = false; + const controller = this.withSignal ? new AbortController() : undefined; + const onCancel = register(effect => { + if (resumed) return; + resumed = true; + if (yielded) { + fiber.evaluate(effect); + } else { + yielded = effect; + } + }, controller?.signal); + if (yielded !== false) return yielded; + yielded = true; + fiber._yielded = () => { + resumed = true; + }; + if (controller === undefined && onCancel === undefined) { + return _core_js__rspack_import_0/* .Yield */.GN; } - }, controller?.signal); - if (yielded !== false) return yielded; - yielded = true; - fiber._yielded = () => { - resumed = true; - }; - if (controller === undefined && onCancel === undefined) { + fiber._stack.push(asyncFinalizer(() => { + resumed = true; + controller?.abort(); + return onCancel ?? exitVoid; + })); return _core_js__rspack_import_0/* .Yield */.GN; } - fiber._stack.push(asyncFinalizer(() => { - resumed = true; - controller?.abort(); - return onCancel ?? exitVoid; - })); - return _core_js__rspack_import_0/* .Yield */.GN; - } -}); + }); + const AsyncImpl = function (register, withSignal) { + this.register = register; + this.withSignal = withSignal; + }; + AsyncImpl.prototype = Proto; + return function (register, withSignal) { + return new AsyncImpl(register, withSignal); + }; +}(); const asyncFinalizer = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitive */.Uf)({ op: "AsyncFinalizer", [_core_js__rspack_import_0/* .contAll */.u4](fiber) { @@ -70931,7 +71392,14 @@ const callback = register => callbackOptions(register, register.length >= 2); /** @internal */ const never = /*#__PURE__*/callback(_Function_js__rspack_import_6/* .constVoid */.Yi); /** @internal */ -const gen = (...args) => suspend(() => fromIteratorUnsafe(args.length === 1 ? args[0]() : args[1].call(args[0].self))); +const gen = (...args) => { + if (args.length === 1) { + const body = args[0]; + return suspend(() => fromIteratorUnsafe(body())); + } + const [options, body] = args; + return suspend(() => fromIteratorUnsafe(body.call(options.self))); +}; /** @internal */ const fnUntraced = (body, ...pipeables) => { const fn = pipeables.length === 0 ? function () { @@ -70955,10 +71423,13 @@ const fn = function () { const nameFirst = typeof arguments[0] === "string"; const name = nameFirst ? arguments[0] : "Effect.fn"; const spanOptions = nameFirst ? arguments[1] : undefined; - const prevLimit = (0,_stackTraceLimit_js__rspack_import_8/* .getStackTraceLimit */.jt)(); - (0,_stackTraceLimit_js__rspack_import_8/* .setStackTraceLimit */.ft)(2); - const defError = new globalThis.Error(); - (0,_stackTraceLimit_js__rspack_import_8/* .setStackTraceLimit */.ft)(prevLimit); + const prevLimit = (0,_stackTraceLimit_js__rspack_import_7/* .getStackTraceLimit */.jt)(); + let defError; + if (prevLimit !== 0) { + (0,_stackTraceLimit_js__rspack_import_7/* .setStackTraceLimit */.ft)(2); + defError = new globalThis.Error(); + (0,_stackTraceLimit_js__rspack_import_7/* .setStackTraceLimit */.ft)(prevLimit); + } if (nameFirst) { return (body, ...pipeables) => makeFn(name, body, defError, pipeables, nameFirst, spanOptions); } @@ -70977,16 +71448,19 @@ const makeFn = (name, bodyOrOptions, defError, pipeables, addSpan, spanOptions) if (!(0,_core_js__rspack_import_0/* .isEffect */.yw)(result)) { return result; } - const prevLimit = (0,_stackTraceLimit_js__rspack_import_8/* .getStackTraceLimit */.jt)(); - (0,_stackTraceLimit_js__rspack_import_8/* .setStackTraceLimit */.ft)(2); - const callError = new globalThis.Error(); - (0,_stackTraceLimit_js__rspack_import_8/* .setStackTraceLimit */.ft)(prevLimit); - return updateService(addSpan ? useSpan(name, spanOptions, span => provideParentSpan(result, span)) : result, _references_js__rspack_import_15/* .CurrentStackFrame */.vA, prev => ({ + const prevLimit = (0,_stackTraceLimit_js__rspack_import_7/* .getStackTraceLimit */.jt)(); + let callError; + if (prevLimit !== 0) { + (0,_stackTraceLimit_js__rspack_import_7/* .setStackTraceLimit */.ft)(2); + callError = new globalThis.Error(); + (0,_stackTraceLimit_js__rspack_import_7/* .setStackTraceLimit */.ft)(prevLimit); + } + return updateService(addSpan ? useSpan(name, spanOptions, span => provideParentSpan(result, span)) : result, _references_js__rspack_import_14/* .CurrentStackFrame */.vA, prev => ({ name, - stack: fnStackCleaner(() => callError.stack), + stack: callError ? fnStackCleaner(() => callError.stack) : _Function_js__rspack_import_6/* .constUndefined */.MN, parent: { name: `${name} (definition)`, - stack: fnStackCleaner(() => defError.stack), + stack: defError ? fnStackCleaner(() => defError.stack) : _Function_js__rspack_import_6/* .constUndefined */.MN, parent: prev } })); @@ -70998,7 +71472,7 @@ const fnUntracedEager = (body, ...pipeables) => defineFunctionLength(body.length } : function () { let effect = fromIteratorEagerUnsafe(() => body.apply(this, arguments)); for (const pipeable of pipeables) { - effect = pipeable(effect); + effect = pipeable(effect, ...arguments); } return effect; }); @@ -71034,35 +71508,82 @@ const fromIteratorEagerUnsafe = evaluate => { return die(error); } }; -const fromIteratorUnsafe = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitive */.Uf)({ - op: "Iterator", - single: false, - [_core_js__rspack_import_0/* .contA */.ee](value, fiber) { - const iter = this[_core_js__rspack_import_0/* .args */.a2][0]; - while (true) { - const state = iter.next(value); - if (state.done) return succeed(state.value); - if (!effectIsExit(state.value)) { - fiber._stack.push(this); - return state.value; - } else if (state.value._tag === "Failure") { - return state.value; +const fromIteratorUnsafe = /*#__PURE__*/function () { + const Proto = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitiveProto */.yj)({ + op: "Iterator", + [_core_js__rspack_import_0/* .contA */.ee](value, fiber) { + const iter = this.iterator; + while (true) { + const state = iter.next(value); + if (state.done) return succeed(state.value); + if (!effectIsExit(state.value)) { + fiber._stack.push(this); + return state.value; + } else if (state.value._tag === "Failure") { + return state.value; + } + value = state.value.value; } - value = state.value.value; + }, + [_core_js__rspack_import_0/* .evaluate */._3](fiber) { + return this[_core_js__rspack_import_0/* .contA */.ee](this.initial, fiber); } - }, - [_core_js__rspack_import_0/* .evaluate */._3](fiber) { - return this[_core_js__rspack_import_0/* .contA */.ee](this[_core_js__rspack_import_0/* .args */.a2][1], fiber); - } -}); + }); + const IteratorImpl = function (iterator, initial) { + this.iterator = iterator; + this.initial = initial; + }; + IteratorImpl.prototype = Proto; + return function (iterator, initial) { + return new IteratorImpl(iterator, initial); + }; +}(); // ---------------------------------------------------------------------------- // mapping & sequencing // ---------------------------------------------------------------------------- /** @internal */ -const as = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, value) => { - const b = succeed(value); - return flatMap(self, _ => b); +const as = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, value) => new ContImpl(self, returnPayload, succeed(value))); +const evaluateCont = function (fiber) { + fiber._stack.push(this); + return this[_core_js__rspack_import_0/* .args */.a2]; +}; +const OnSuccessProto = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitiveProto */.yj)({ + op: "OnSuccess", + [_core_js__rspack_import_0/* .evaluate */._3]: evaluateCont }); +const OnSuccessImpl = function (self, f) { + this[_core_js__rspack_import_0/* .args */.a2] = self; + this[_core_js__rspack_import_0/* .contA */.ee] = f; +}; +OnSuccessImpl.prototype = OnSuccessProto; +// A success continuation with an extra payload slot. The stored continuation +// receives the primitive as `this` and reads `this.payload`, so combinators +// like map / as / tap / andThen can share module-level continuation functions +// instead of allocating a closure per call. +const ContImpl = function (self, cont, payload) { + this[_core_js__rspack_import_0/* .args */.a2] = self; + this[_core_js__rspack_import_0/* .contA */.ee] = cont; + this.payload = payload; +}; +ContImpl.prototype = OnSuccessProto; +const returnPayload = function () { + return this.payload; +}; +const mapCont = function (value) { + const f = this.payload; + return succeed((0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => f(value))); +}; +const andThenCont = function (value) { + const f = this.payload; + return (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => f(value)); +}; +const tapCont = function (value) { + const f = this.payload; + return new ContImpl((0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => f(value)), returnPayload, (0,_core_js__rspack_import_0/* .exitSucceed */.xt)(value)); +}; +const tapEffectCont = function (value) { + return new ContImpl(this.payload, returnPayload, (0,_core_js__rspack_import_0/* .exitSucceed */.xt)(value)); +}; /** @internal */ const asSome = self => map(self, _Option_js__rspack_import_17.some); /** @internal */ @@ -71071,16 +71592,16 @@ const flip = self => matchEffect(self, { onSuccess: fail }); /** @internal */ -const andThen = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => flatMap(self, a => (0,_core_js__rspack_import_0/* .isEffect */.yw)(f) ? f : (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => f(a)))); +const andThen = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => new ContImpl(self, (0,_core_js__rspack_import_0/* .isEffect */.yw)(f) ? returnPayload : andThenCont, f)); /** @internal */ -const tap = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => flatMap(self, a => as((0,_core_js__rspack_import_0/* .isEffect */.yw)(f) ? f : (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => f(a)), a))); +const tap = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => new ContImpl(self, (0,_core_js__rspack_import_0/* .isEffect */.yw)(f) ? tapEffectCont : tapCont, f)); /** @internal */ -const asVoid = self => flatMap(self, _ => exitVoid); +const asVoid = self => new ContImpl(self, returnPayload, exitVoid); /** @internal */ const sandbox = self => catchCause(self, fail); /** @internal */ const raceAll = (all, options) => (0,_core_js__rspack_import_0/* .withFiber */.R6)(parent => callback(resume => { - const effects = _Array_js__rspack_import_7/* .fromIterable */.Ts(all); + const effects = _Array_js__rspack_import_16/* .fromIterable */.Ts(all); const len = effects.length; let doneCount = 0; let done = false; @@ -71151,19 +71672,7 @@ const race = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args = /** @internal */ const raceFirst = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[1]), (self, that, options) => raceAllFirst([self, that], options)); /** @internal */ -const flatMap = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => { - const onSuccess = Object.create(OnSuccessProto); - onSuccess[_core_js__rspack_import_0/* .args */.a2] = self; - onSuccess[_core_js__rspack_import_0/* .contA */.ee] = f.length !== 1 ? a => f(a) : f; - return onSuccess; -}); -const OnSuccessProto = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitiveProto */.yj)({ - op: "OnSuccess", - [_core_js__rspack_import_0/* .evaluate */._3](fiber) { - fiber._stack.push(this); - return this[_core_js__rspack_import_0/* .args */.a2]; - } -}); +const flatMap = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => new OnSuccessImpl(self, f.length !== 1 ? a => f(a) : f)); /** @internal */ const matchCauseEffectEager = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, options) => { if (effectIsExit(self)) { @@ -71172,7 +71681,7 @@ const matchCauseEffectEager = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .d return matchCauseEffect(self, options); }); /** @internal */ -const effectIsExit = effect => _core_js__rspack_import_0/* .ExitTypeId */.IH in effect; +const effectIsExit = effect => effect[_core_js__rspack_import_0/* .ExitTypeId */.IH] !== undefined; /** @internal */ const flatMapEager = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => { if (effectIsExit(self)) { @@ -71186,7 +71695,7 @@ const flatMapEager = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY /** @internal */ const flatten = self => flatMap(self, _Function_js__rspack_import_6/* .identity */.D_); /** @internal */ -const map = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => flatMap(self, a => succeed((0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => f(a))))); +const map = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => new ContImpl(self, mapCont, f)); /** @internal */ const mapEager = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => effectIsExit(self) ? exitMap(self, f) : map(self, f)); /** @internal */ @@ -71308,7 +71817,9 @@ const updateServiceScoped = (service, update, options) => uninterruptible((0,_co const updated = update(original); fiber.setContext(_Context_js__rspack_import_5/* .add */.WQ(fiber.context, service, updated)); return scopeAddFinalizerExit(_Context_js__rspack_import_5/* .getUnsafe */.fp(fiber.context, scopeTag), _ => { - const current = _Context_js__rspack_import_5/* .getUnsafe */.fp(fiber.context, service); + const currentOption = _Context_js__rspack_import_5/* .getOption */.om(fiber.context, service); + if (_Option_js__rspack_import_17.isNone(currentOption)) return void_; + const current = currentOption.value; let next; if (options?.reset === undefined) { if (current !== updated) return void_; @@ -71356,7 +71867,7 @@ const zipWith = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(arg // ---------------------------------------------------------------------------- // filtering & conditionals // ---------------------------------------------------------------------------- -/* @internal */ +/** @internal */ const filterOrFail = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (self, predicate, orFailWith) => filterOrElse(self, predicate, orFailWith ? a => fail(orFailWith(a)) : () => fail(new _core_js__rspack_import_0/* .NoSuchElementError */.Xm()))); /** @internal */ const when = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, condition) => flatMap(condition, pass => pass ? asSome(self) : succeedNone)); @@ -71379,19 +71890,16 @@ const forever = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(arg // error handling // ---------------------------------------------------------------------------- /** @internal */ -const catchCause = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => { - const onFailure = Object.create(OnFailureProto); - onFailure[_core_js__rspack_import_0/* .args */.a2] = self; - onFailure[_core_js__rspack_import_0/* .contE */.Sc] = f.length !== 1 ? cause => f(cause) : f; - return onFailure; -}); +const catchCause = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => new OnFailureImpl(self, f.length !== 1 ? cause => f(cause) : f)); const OnFailureProto = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitiveProto */.yj)({ op: "OnFailure", - [_core_js__rspack_import_0/* .evaluate */._3](fiber) { - fiber._stack.push(this); - return this[_core_js__rspack_import_0/* .args */.a2]; - } + [_core_js__rspack_import_0/* .evaluate */._3]: evaluateCont }); +const OnFailureImpl = function (self, f) { + this[_core_js__rspack_import_0/* .args */.a2] = self; + this[_core_js__rspack_import_0/* .contE */.Sc] = f; +}; +OnFailureImpl.prototype = OnFailureProto; /** @internal */ const catchCauseIf = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(3, (self, predicate, f) => catchCause(self, cause => { if (!predicate(cause)) { @@ -71429,7 +71937,7 @@ const tapCauseFilter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */. const tapError = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => tapCauseFilter(self, findError, e => f(e))); /** @internal */ const tapErrorTag = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(3, (self, k, f) => { - const predicate = Array.isArray(k) ? e => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(e, "_tag") && k.includes(e._tag) : (0,_Predicate_js__rspack_import_11/* .isTagged */.$J)(k); + const predicate = Array.isArray(k) ? e => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(e, "_tag") && k.includes(e._tag) : (0,_Predicate_js__rspack_import_10/* .isTagged */.$J)(k); return tapError(self, error => predicate(error) ? f(error) : void_); }); /** @internal */ @@ -71455,7 +71963,7 @@ const catchFilter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY) })); /** @internal */ const catchTag = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (self, k, f, orElse) => { - const pred = Array.isArray(k) ? e => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(e, "_tag") && k.includes(e._tag) : (0,_Predicate_js__rspack_import_11/* .isTagged */.$J)(k); + const pred = Array.isArray(k) ? e => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(e, "_tag") && k.includes(e._tag) : (0,_Predicate_js__rspack_import_10/* .isTagged */.$J)(k); return catchIf(self, pred, f, orElse); }); /** @internal */ @@ -71463,19 +71971,19 @@ const catchTags = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(a let keys; return catchFilter(self, e => { keys ??= Object.keys(cases); - return (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(e, "_tag") && (0,_Predicate_js__rspack_import_11/* .isString */.Kg)(e["_tag"]) && keys.includes(e["_tag"]) ? _Result_js__rspack_import_3/* .succeed */.Py(e) : _Result_js__rspack_import_3/* .fail */.fJ(e); + return (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(e, "_tag") && (0,_Predicate_js__rspack_import_10/* .isString */.Kg)(e["_tag"]) && keys.includes(e["_tag"]) ? _Result_js__rspack_import_3/* .succeed */.Py(e) : _Result_js__rspack_import_3/* .fail */.fJ(e); }, e => (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => cases[e["_tag"]](e)), orElse); }); /** @internal */ -const catchReason = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (self, errorTag, reasonTag, f, orElse) => catchIf(self, e => (0,_Predicate_js__rspack_import_11/* .isTagged */.$J)(e, errorTag) && (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(e, "reason"), e => { +const catchReason = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (self, errorTag, reasonTag, f, orElse) => catchIf(self, e => (0,_Predicate_js__rspack_import_10/* .isTagged */.$J)(e, errorTag) && (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(e, "reason") && (orElse !== undefined || (0,_Predicate_js__rspack_import_10/* .isTagged */.$J)(e.reason, reasonTag)), e => { const reason = e.reason; - if ((0,_Predicate_js__rspack_import_11/* .isTagged */.$J)(reason, reasonTag)) return f(reason, e); + if ((0,_Predicate_js__rspack_import_10/* .isTagged */.$J)(reason, reasonTag)) return f(reason, e); return orElse ? (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => orElse(reason, e)) : fail(e); })); /** @internal */ const catchReasons = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (self, errorTag, cases, orElse) => { let keys; - return catchIf(self, e => (0,_Predicate_js__rspack_import_11/* .isTagged */.$J)(e, errorTag) && (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(e, "reason") && (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(e.reason, "_tag") && (0,_Predicate_js__rspack_import_11/* .isString */.Kg)(e.reason._tag), e => { + return catchIf(self, e => (0,_Predicate_js__rspack_import_10/* .isTagged */.$J)(e, errorTag) && (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(e, "reason") && (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(e.reason, "_tag") && (0,_Predicate_js__rspack_import_10/* .isString */.Kg)(e.reason._tag) && (orElse !== undefined || (keys ??= Object.keys(cases)).includes(e.reason._tag)), e => { const reason = e.reason; keys ??= Object.keys(cases); if (keys.includes(reason._tag)) { @@ -71486,14 +71994,14 @@ const catchReasons = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY }); /** @internal */ const unwrapReason = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, errorTag) => catchFilter(self, e => { - if ((0,_Predicate_js__rspack_import_11/* .isTagged */.$J)(e, errorTag) && (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(e, "reason")) { + if ((0,_Predicate_js__rspack_import_10/* .isTagged */.$J)(e, errorTag) && (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(e, "reason")) { return _Result_js__rspack_import_3/* .succeed */.Py(e.reason); } return _Result_js__rspack_import_3/* .fail */.fJ(e); }, fail)); /** @internal */ const mapError = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => catch_(self, error => failSync(() => f(error)))); -/* @internal */ +/** @internal */ const mapBoth = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, options) => matchEffect(self, { onFailure: e => failSync(() => options.onFailure(e)), onSuccess: a => sync(() => options.onSuccess(a)) @@ -71501,7 +72009,7 @@ const mapBoth = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, /** @internal */ const orDie = self => catch_(self, die); /** @internal */ -const orElseSucceed = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => catch_(self, _ => sync(f))); +const orElseSucceed = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => catch_(self, error => sync(() => f(error)))); /** @internal */ const firstSuccessOf = effects => suspend(() => { const iterator = effects[Symbol.iterator](); @@ -71563,20 +72071,17 @@ const result = self => matchEager(self, { // pattern matching // ---------------------------------------------------------------------------- /** @internal */ -const matchCauseEffect = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, options) => { - const primitive = Object.create(OnSuccessAndFailureProto); - primitive[_core_js__rspack_import_0/* .args */.a2] = self; - primitive[_core_js__rspack_import_0/* .contA */.ee] = options.onSuccess.length !== 1 ? a => options.onSuccess(a) : options.onSuccess; - primitive[_core_js__rspack_import_0/* .contE */.Sc] = options.onFailure.length !== 1 ? cause => options.onFailure(cause) : options.onFailure; - return primitive; -}); +const matchCauseEffect = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, options) => new OnSuccessAndFailureImpl(self, options.onSuccess.length !== 1 ? a => options.onSuccess(a) : options.onSuccess, options.onFailure.length !== 1 ? cause => options.onFailure(cause) : options.onFailure)); const OnSuccessAndFailureProto = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitiveProto */.yj)({ op: "OnSuccessAndFailure", - [_core_js__rspack_import_0/* .evaluate */._3](fiber) { - fiber._stack.push(this); - return this[_core_js__rspack_import_0/* .args */.a2]; - } + [_core_js__rspack_import_0/* .evaluate */._3]: evaluateCont }); +const OnSuccessAndFailureImpl = function (self, onSuccess, onFailure) { + this[_core_js__rspack_import_0/* .args */.a2] = self; + this[_core_js__rspack_import_0/* .contA */.ee] = onSuccess; + this[_core_js__rspack_import_0/* .contE */.Sc] = onFailure; +}; +OnSuccessAndFailureImpl.prototype = OnSuccessAndFailureProto; /** @internal */ const matchCause = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, options) => matchCauseEffect(self, { onFailure: cause => sync(() => options.onFailure(cause)), @@ -71647,12 +72152,17 @@ const isSuccess = /*#__PURE__*/matchEager({ /** @internal */ const delay = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, duration) => andThen(sleep(duration), self)); /** @internal */ -const timeoutOrElse = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, options) => raceFirst(self, flatMap(sleep(options.duration), options.orElse))); +const timeoutOrElse = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, options) => flatMap(timeoutOption(self, options.duration), option => _Option_js__rspack_import_17.isNone(option) ? options.orElse() : succeed(option.value))); /** @internal */ -const timeout = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, duration) => timeoutOrElse(self, { - duration, - orElse: () => fail(new TimeoutError()) -})); +const timeoutErrorFromDuration = duration => new TimeoutError(`Operation timed out after '${_Duration_js__rspack_import_20/* .format */.GP(duration)}'`); +/** @internal */ +const timeout = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, duration) => { + const decoded = _Duration_js__rspack_import_20/* .fromInputUnsafe */.bN(duration); + return timeoutOrElse(self, { + duration: decoded, + orElse: () => fail(timeoutErrorFromDuration(decoded)) + }); +}); /** @internal */ const timeoutOption = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, duration) => raceFirst(asSome(self), as(sleep(duration), _Option_js__rspack_import_17.none()))); /** @internal */ @@ -71816,30 +72326,40 @@ const acquireRelease = (acquire, release, options) => contextWith(context => uni /** @internal */ const addFinalizer = finalizer => flatMap(scope, scope => contextWith(context => scopeAddFinalizerExit(scope, exit => provideContext(finalizer(exit), context)))); /** @internal */ -const onExitPrimitive = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitive */.Uf)({ - op: "OnExit", - single: false, - [_core_js__rspack_import_0/* .evaluate */._3](fiber) { - fiber._stack.push(this); - return this[_core_js__rspack_import_0/* .args */.a2][0]; - }, - [_core_js__rspack_import_0/* .contAll */.u4](fiber) { - if (fiber.interruptible && this[_core_js__rspack_import_0/* .args */.a2][2] !== true) { - fiber._stack.push(setInterruptibleTrue); - fiber.interruptible = false; +const onExitPrimitive = /*#__PURE__*/function () { + const Proto = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitiveProto */.yj)({ + op: "OnExit", + [_core_js__rspack_import_0/* .evaluate */._3](fiber) { + fiber._stack.push(this); + return this.effect; + }, + [_core_js__rspack_import_0/* .contAll */.u4](fiber) { + if (fiber.interruptible && this.interruptible !== true) { + fiber._stack.push(setInterruptibleTrue); + fiber.interruptible = false; + } + }, + [_core_js__rspack_import_0/* .contA */.ee](value, _, exit) { + exit ??= (0,_core_js__rspack_import_0/* .exitSucceed */.xt)(value); + const eff = this.onExit(exit); + return eff ? flatMap(eff, _ => exit) : exit; + }, + [_core_js__rspack_import_0/* .contE */.Sc](cause, _, exit) { + exit ??= (0,_core_js__rspack_import_0/* .exitFailCause */.cb)(cause); + const eff = this.onExit(exit); + return eff ? flatMap(combineFinalizerCause(exit, eff), _ => exit) : exit; } - }, - [_core_js__rspack_import_0/* .contA */.ee](value, _, exit) { - exit ??= (0,_core_js__rspack_import_0/* .exitSucceed */.xt)(value); - const eff = this[_core_js__rspack_import_0/* .args */.a2][1](exit); - return eff ? flatMap(eff, _ => exit) : exit; - }, - [_core_js__rspack_import_0/* .contE */.Sc](cause, _, exit) { - exit ??= (0,_core_js__rspack_import_0/* .exitFailCause */.cb)(cause); - const eff = this[_core_js__rspack_import_0/* .args */.a2][1](exit); - return eff ? flatMap(combineFinalizerCause(exit, eff), _ => exit) : exit; - } -}); + }); + const OnExitImpl = function (effect, onExit, interruptible) { + this.effect = effect; + this.onExit = onExit; + this.interruptible = interruptible; + }; + OnExitImpl.prototype = Proto; + return function (effect, onExit, interruptible) { + return new OnExitImpl(effect, onExit, interruptible); + }; +}(); /** @internal */ const onExit = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, onExitPrimitive); /** @internal */ @@ -71876,16 +72396,15 @@ const onErrorFilter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.X /** @internal */ const onInterrupt = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, finalizer) => onErrorFilter(causeFilterInterruptors, finalizer)(self)); /** @internal */ -const acquireUseRelease = (acquire, use, release) => uninterruptibleMask(restore => flatMap(acquire, a => onExitPrimitive(restore(use(a)), exit => release(a, exit), true))); +const acquireUseRelease = (acquire, use, release) => uninterruptibleMask(restore => flatMap(acquire, a => onExitPrimitive(suspend(() => restore(use(a))), exit => release(a, exit), true))); /** @internal */ -const acquireDisposable = acquire => acquireRelease(acquire, resource => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(resource, Symbol.asyncDispose) ? promise(() => resource[Symbol.asyncDispose]()) : sync(() => resource[Symbol.dispose]())); +const acquireDisposable = acquire => acquireRelease(acquire, resource => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(resource, Symbol.asyncDispose) ? promise(() => resource[Symbol.asyncDispose]()) : sync(() => resource[Symbol.dispose]())); // ---------------------------------------------------------------------------- // Caching // ---------------------------------------------------------------------------- /** @internal */ const cachedInvalidateWithTTL = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, ttl) => sync(() => { - const ttlMillis = _Duration_js__rspack_import_20/* .toMillis */.kE(_Duration_js__rspack_import_20/* .fromInputUnsafe */.bN(ttl)); - const isFinite = Number.isFinite(ttlMillis); + const ttlMillis = typeof ttl === "function" ? exit => _Duration_js__rspack_import_20/* .toMillis */.kE(_Duration_js__rspack_import_20/* .fromInputUnsafe */.bN(ttl(exit))) : (0,_Function_js__rspack_import_6/* .constant */.dY)(_Duration_js__rspack_import_20/* .toMillis */.kE(_Duration_js__rspack_import_20/* .fromInputUnsafe */.bN(ttl))); const latch = makeLatchUnsafe(false); let expiresAt = 0; let running = false; @@ -71893,16 +72412,25 @@ const cachedInvalidateWithTTL = /*#__PURE__*/(0,_Function_js__rspack_import_6/* const wait = flatMap(latch.await, () => exit); return [(0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => { const clock = fiber.getRef(ClockRef); - const now = isFinite ? clock.currentTimeMillisUnsafe() : 0; + const now = expiresAt === Infinity ? 0 : clock.currentTimeMillisUnsafe(); if (running || now < expiresAt) return exit ?? wait; running = true; latch.closeUnsafe(); exit = undefined; return onExit(self, exit_ => sync(() => { - running = false; - expiresAt = clock.currentTimeMillisUnsafe() + ttlMillis; - exit = exit_; - latch.openUnsafe(); + try { + const duration = ttlMillis(exit_); + expiresAt = clock.currentTimeMillisUnsafe() + duration; + exit = exit_; + } catch (error) { + const cause = (0,_core_js__rspack_import_0/* .causeDie */.Iu)(error); + // Publish the same combined cause that onExit returns to the owner. + exit = (0,_core_js__rspack_import_0/* .exitFailCause */.cb)(exitIsFailure(exit_) ? causeCombine(exit_.cause, cause) : cause); + throw error; + } finally { + running = false; + latch.openUnsafe(); + } })); }), sync(() => { expiresAt = 0; @@ -71913,7 +72441,21 @@ const cachedInvalidateWithTTL = /*#__PURE__*/(0,_Function_js__rspack_import_6/* /** @internal */ const cachedWithTTL = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, timeToLive) => map(cachedInvalidateWithTTL(self, timeToLive), tuple => tuple[0])); /** @internal */ -const cached = self => cachedWithTTL(self, _Duration_js__rspack_import_20/* .infinity */.Tn); +const cached = self => sync(() => { + const latch = makeLatchUnsafe(false); + let started = false; + let exit; + const wait = flatMap(latch.await, () => exit); + return suspend(() => { + if (exit !== undefined) return exit; + if (started) return wait; + started = true; + return onExit(self, result => sync(() => { + exit = result; + latch.openUnsafe(); + })); + }); +}); // ---------------------------------------------------------------------------- // interruption // ---------------------------------------------------------------------------- @@ -71942,6 +72484,30 @@ const setFiberInterruptible = fiber => { fiber._stack.push(setInterruptibleFalse); if (fiber._interruptedCause) return failCause(fiber._interruptedCause); }; +/** + * Makes the current fiber uninterruptible for the returned effect without an + * extra primitive. Call only within `withFiber`. + * + * @internal + */ +const fiberEnterUninterruptibleUnsafe = fiber => { + const impl = fiber; + if (!impl.interruptible) return; + impl.interruptible = false; + impl._stack.push(setInterruptibleTrue); +}; +/** + * Makes the current fiber interruptible for the returned effect without an + * extra primitive. Call only within `withFiber` and return any pending + * interruption it produces. + * + * @internal + */ +const fiberEnterInterruptibleUnsafe = fiber => { + const impl = fiber; + if (impl.interruptible) return undefined; + return setFiberInterruptible(impl); +}; /** @internal */ const interruptible = self => (0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => { if (fiber.interruptible) return self; @@ -71968,7 +72534,7 @@ const abortSignal = /*#__PURE__*/map(/*#__PURE__*/acquireRelease(/*#__PURE__*/sy // ======================================================================== /** @internal */ const all = (arg, options) => { - if ((0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(arg)) { + if ((0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(arg)) { return options?.mode === "result" ? forEach(arg, result, options) : forEach(arg, _Function_js__rspack_import_6/* .identity */.D_, options); } else if (options?.discard) { return options.mode === "result" ? forEach(Object.values(arg), result, options) : forEach(Object.values(arg), _Function_js__rspack_import_6/* .identity */.D_, options); @@ -71984,10 +72550,10 @@ const all = (arg, options) => { }); }; /** @internal */ -const partition = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, f, options) => map(forEach(elements, (a, i) => result(f(a, i)), options), results => _Array_js__rspack_import_7/* .partition */.jB(results, _Function_js__rspack_import_6/* .identity */.D_))); +const partition = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, f, options) => map(forEach(elements, (a, i) => result(f(a, i)), options), results => _Array_js__rspack_import_16/* .partition */.jB(results, _Function_js__rspack_import_6/* .identity */.D_))); /** @internal */ const reduce = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(3, (elements, zero, f) => { - const arr = _Array_js__rspack_import_7/* .fromIterable */.Ts(elements); + const arr = _Array_js__rspack_import_16/* .fromIterable */.Ts(elements); if (arr.length === 0) return sync(zero); return suspend(() => { let index = 0; @@ -72003,16 +72569,16 @@ const reduce = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(3, ( }); }); /** @internal */ -const validate = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, f, options) => flatMap(partition(elements, f, { +const validate = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, f, options) => flatMap(partition(elements, f, { concurrency: options?.concurrency }), ([excluded, satisfying]) => { - if (_Array_js__rspack_import_7/* .isArrayNonEmpty */.CZ(excluded)) { + if (_Array_js__rspack_import_16/* .isArrayNonEmpty */.CZ(excluded)) { return fail(excluded); } return options?.discard ? void_ : succeed(satisfying); })); /** @internal */ -const findFirst = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, predicate) => suspend(() => { +const findFirst = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, predicate) => suspend(() => { const iterator = elements[Symbol.iterator](); const next = iterator.next(); if (!next.done) { @@ -72031,7 +72597,7 @@ const findFirstLoop = (iterator, index, predicate, value) => flatMap(predicate(v return succeed(_Option_js__rspack_import_17.none()); }); /** @internal */ -const findFirstFilter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, filter) => suspend(() => { +const findFirstFilter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, filter) => suspend(() => { const iterator = elements[Symbol.iterator](); const next = iterator.next(); if (!next.done) { @@ -72070,12 +72636,11 @@ const whileLoop = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitive */. }); /** @internal */ const forEach = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => typeof args[1] === "function", (iterable, f, options) => suspend(() => { - const concurrencyOption = options?.concurrency ?? 1; - const concurrency = concurrencyOption === "unbounded" ? Number.POSITIVE_INFINITY : Math.max(1, concurrencyOption); + const concurrency = resolveConcurrency(options?.concurrency); if (concurrency === 1) { return forEachSequential(iterable, f, options); } - const items = _Array_js__rspack_import_7/* .fromIterable */.Ts(iterable); + const items = _Array_js__rspack_import_16/* .fromIterable */.Ts(iterable); let length = items.length; if (length === 0) { return options?.discard ? void_ : succeed([]); @@ -72108,10 +72673,13 @@ const forEachSequential = (iterable, f, options) => suspend(() => { } }), out); }); -const iterateEagerImpl = options => { +/** @internal */ +const resolveConcurrency = concurrency => concurrency === "unbounded" ? Number.POSITIVE_INFINITY : Math.max(1, concurrency ?? 1); +/** @internal */ +const iterateEager = () => options => { const onItem = options.onItem; const step = options.step; - const runSequential = (state, items, index, end) => { + const runSequential = (state, items, index = 0, end = items.length) => { for (; index < end; index++) { const item = items[index]; const effect = onItem(state, item, index); @@ -72122,14 +72690,15 @@ const iterateEagerImpl = options => { if (terminal) return terminal._tag === "Failure" ? terminal : undefined; } }; + return runSequential; +}; +const iterateConcurrentImpl = options => { + const onItem = options.onItem; + const step = options.step; return (state, items, opts) => { let index = 0; - const end = opts?.end ?? items.length; - const concurrency = opts?.concurrency ?? 1; - if (concurrency === 1) { - return runSequential(state, items, 0, end); - } - const orderedStep = opts?.orderedStep === true; + const end = opts.end ?? items.length; + const concurrency = opts.concurrency; let done = false; let parentFiber; let fibers; @@ -72137,8 +72706,6 @@ const iterateEagerImpl = options => { let interrupted = false; let terminal; let effect; - let nextIndex = index; - const exits = orderedStep ? new Array(end) : undefined; const failDefect = error => { const defect = (0,_core_js__rspack_import_0/* .exitDie */.V2)(error); terminal = defect; @@ -72146,19 +72713,6 @@ const iterateEagerImpl = options => { interrupted = true; return fibers && fibers.size > 0 ? flatMap(uninterruptible(fiberInterruptAll(Array.from(fibers))), () => defect) : defect; }; - const runStep = (item, exit, currentIndex) => { - if (!orderedStep) return step(state, item, exit, currentIndex); - if (terminal) return terminal; - exits[currentIndex] = exit; - while (nextIndex < end) { - const nextExit = exits[nextIndex]; - if (nextExit === undefined) return; - exits[nextIndex] = undefined; - const index = nextIndex++; - const result = step(state, items[index], nextExit, index); - if (result) return result; - } - }; const go = () => { let paused = false; for (; !terminal && index < end; index++) { @@ -72166,7 +72720,7 @@ const iterateEagerImpl = options => { const eff = effect ?? onItem(state, item, index); // fast case (already an exit) if (effectIsExit(eff)) { - terminal = runStep(item, eff, index); + terminal = step(state, item, eff, index); if (terminal) break; // We have an effect, so enter "async" mode } else if (!parentFiber) { @@ -72194,7 +72748,7 @@ const iterateEagerImpl = options => { effect = undefined; const fiber = forkUnsafe(parentFiber, eff, true, true, "inherit"); if (fiber._exit) { - terminal = runStep(item, fiber._exit, index); + terminal = step(state, item, fiber._exit, index); if (terminal) break; continue; } @@ -72216,7 +72770,7 @@ const iterateEagerImpl = options => { } } } else { - const result = runStep(item, exit, currentIndex); + const result = step(state, item, exit, currentIndex); if (result) { terminal = result._tag === "Failure" ? (0,_core_js__rspack_import_0/* .exitFailCause */.cb)((0,_core_js__rspack_import_0/* .causeFromReasons */.b5)(result.cause.reasons.slice())) : result; go(); @@ -72261,8 +72815,8 @@ const iterateEagerImpl = options => { }; }; /** @internal */ -const iterateEager = () => iterateEagerImpl; -const forEachConcurrent = /*#__PURE__*/iterateEagerImpl({ +const iterateConcurrent = () => options => iterateConcurrentImpl(options); +const forEachConcurrent = /*#__PURE__*/iterateConcurrentImpl({ onItem(state, item, index) { return state.f(item, index); }, @@ -72272,17 +72826,17 @@ const forEachConcurrent = /*#__PURE__*/iterateEagerImpl({ } } }); -/* @internal */ +/** @internal */ const filterOrElse = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(3, (self, predicate, orElse) => flatMap(self, a => predicate(a) ? succeed(a) : orElse(a))); /** @internal */ const filterMapOrElse = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(3, (self, filter, orElse) => flatMap(self, a => { const result = filter(a); return _Result_js__rspack_import_3/* .isFailure */.N6(result) ? orElse(result.failure) : succeed(result.success); })); -/* @internal */ +/** @internal */ const filterMapOrFail = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (self, filter, orFailWith) => filterMapOrElse(self, filter, orFailWith ? x => fail(orFailWith(x)) : () => fail(new _core_js__rspack_import_0/* .NoSuchElementError */.Xm()))); /** @internal */ -const filter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, predicate, options) => suspend(() => { +const filter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, predicate, options) => suspend(() => { const out = []; return as(forEach(elements, (a, i) => { const result = predicate(a, i); @@ -72301,7 +72855,7 @@ const filter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args }), out); })); /** @internal */ -const filterMap = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, filter) => suspend(() => { +const filterMap = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, filter) => suspend(() => { const out = []; for (const a of elements) { const result = filter(a); @@ -72312,7 +72866,7 @@ const filterMap = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(a return succeed(out); })); /** @internal */ -const filterMapEffect = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, filter, options) => suspend(() => { +const filterMapEffect = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, filter, options) => suspend(() => { const out = []; return as(forEach(elements, a => map(filter(a), result => { if (_Result_js__rspack_import_3/* .isSuccess */.oJ(result)) { @@ -72356,7 +72910,7 @@ const forkUnsafe = (parent, effect, immediate = false, daemon = false, uninterru } if (!daemon && !child._exit) { parentRuntime.children().add(child); - child.addObserver(() => parentRuntime._children.delete(child)); + child._parent = parentRuntime; } return child; }; @@ -72587,13 +73141,13 @@ const makeLatch = open => sync(() => makeLatchUnsafe(open)); // Tracer // ---------------------------------------------------------------------------- /** @internal */ -const tracer = /*#__PURE__*/(0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => succeed(fiber.getRef(_Tracer_js__rspack_import_14/* .Tracer */.sh))); +const tracer = /*#__PURE__*/(0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => succeed(fiber.getRef(_Tracer_js__rspack_import_12/* .Tracer */.sh))); /** @internal */ -const withTracer = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (effect, tracer) => provideService(effect, _Tracer_js__rspack_import_14/* .Tracer */.sh, tracer)); +const withTracer = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (effect, tracer) => provideService(effect, _Tracer_js__rspack_import_12/* .Tracer */.sh, tracer)); /** @internal */ -const withTracerEnabled = /*#__PURE__*/provideService(_references_js__rspack_import_15/* .TracerEnabled */.rf); +const withTracerEnabled = /*#__PURE__*/provideService(_references_js__rspack_import_14/* .TracerEnabled */.rf); /** @internal */ -const withTracerTiming = /*#__PURE__*/provideService(_references_js__rspack_import_15/* .TracerTimingEnabled */.nU); +const withTracerTiming = /*#__PURE__*/provideService(_references_js__rspack_import_14/* .TracerTimingEnabled */.nU); const bigint0 = /*#__PURE__*/BigInt(0); const NoopSpanProto = { _tag: "Span", @@ -72618,36 +73172,36 @@ const NoopSpanProto = { const noopSpan = options => Object.assign(Object.create(NoopSpanProto), options); const filterDisablePropagation = span => { if (!span) return _Option_js__rspack_import_17.none(); - return _Context_js__rspack_import_5/* .get */.Jt(span.annotations, _Tracer_js__rspack_import_14/* .DisablePropagation */.DW) ? span._tag === "Span" ? filterDisablePropagation(_Option_js__rspack_import_17.getOrUndefined(span.parent)) : _Option_js__rspack_import_17.none() : _Option_js__rspack_import_17.some(span); + return _Context_js__rspack_import_5/* .get */.Jt(span.annotations, _Tracer_js__rspack_import_12/* .DisablePropagation */.DW) ? span._tag === "Span" ? filterDisablePropagation(_Option_js__rspack_import_17.getOrUndefined(span.parent)) : _Option_js__rspack_import_17.none() : _Option_js__rspack_import_17.some(span); }; /** @internal */ const makeSpanUnsafe = (fiber, name, options) => { - const disablePropagation = !fiber.getRef(_references_js__rspack_import_15/* .TracerEnabled */.rf) || options?.annotations && _Context_js__rspack_import_5/* .get */.Jt(options.annotations, _Tracer_js__rspack_import_14/* .DisablePropagation */.DW); - const parent = options?.parent !== undefined ? _Option_js__rspack_import_17.some(options.parent) : options?.root ? _Option_js__rspack_import_17.none() : filterDisablePropagation(fiber.currentSpan); + const disablePropagation = !fiber.getRef(_references_js__rspack_import_14/* .TracerEnabled */.rf) || options?.annotations && _Context_js__rspack_import_5/* .get */.Jt(options.annotations, _Tracer_js__rspack_import_12/* .DisablePropagation */.DW); + const parent = options?.parent !== undefined ? _Option_js__rspack_import_17.some(options.parent) : options?.root ? _Option_js__rspack_import_17.none() : filterDisablePropagation(fiber.cache.span); let span; if (disablePropagation) { span = noopSpan({ name, parent, - annotations: _Context_js__rspack_import_5/* .add */.WQ(options?.annotations ?? _Context_js__rspack_import_5/* .empty */.Ie(), _Tracer_js__rspack_import_14/* .DisablePropagation */.DW, true) + annotations: _Context_js__rspack_import_5/* .add */.WQ(options?.annotations ?? _Context_js__rspack_import_5/* .empty */.Ie(), _Tracer_js__rspack_import_12/* .DisablePropagation */.DW, true) }); } else { - const tracer = fiber.getRef(_Tracer_js__rspack_import_14/* .Tracer */.sh); + const tracer = fiber.getRef(_Tracer_js__rspack_import_12/* .Tracer */.sh); const clock = fiber.getRef(ClockRef); - const timingEnabled = fiber.getRef(_references_js__rspack_import_15/* .TracerTimingEnabled */.nU); - const annotationsFromEnv = fiber.getRef(_references_js__rspack_import_15/* .TracerSpanAnnotations */.ce); - const linksFromEnv = fiber.getRef(_references_js__rspack_import_15/* .TracerSpanLinks */.ls); - const level = options?.level ?? fiber.getRef(_Tracer_js__rspack_import_14/* .CurrentTraceLevel */.pX); + const timingEnabled = fiber.getRef(_references_js__rspack_import_14/* .TracerTimingEnabled */.nU); + const annotationsFromEnv = fiber.getRef(_references_js__rspack_import_14/* .TracerSpanAnnotations */.ce); + const linksFromEnv = fiber.getRef(_references_js__rspack_import_14/* .TracerSpanLinks */.ls); + const level = options?.level ?? fiber.getRef(_Tracer_js__rspack_import_12/* .CurrentTraceLevel */.pX); const links = options?.links !== undefined ? [...linksFromEnv, ...options.links] : linksFromEnv.length === 0 ? [] : linksFromEnv.slice(); span = tracer.span({ name, parent, annotations: options?.annotations ?? _Context_js__rspack_import_5/* .empty */.Ie(), links, - startTime: timingEnabled ? clock.currentTimeNanosUnsafe() : BigInt(0), + startTime: timingEnabled ? clock.currentTimeNanosUnsafe() : bigint0, kind: options?.kind ?? "internal", root: options?.root ?? _Option_js__rspack_import_17.isNone(parent), - sampled: options?.sampled ?? (_Option_js__rspack_import_17.isSome(parent) && parent.value.sampled === false ? false : !isLogLevelGreaterThan(fiber.getRef(_Tracer_js__rspack_import_14/* .MinimumTraceLevel */.EW), level)) + sampled: options?.sampled ?? (_Option_js__rspack_import_17.isSome(parent) && parent.value.sampled === false ? false : !isLogLevelGreaterThan(fiber.getRef(_Tracer_js__rspack_import_12/* .MinimumTraceLevel */.EW), level)) }); for (const key in annotationsFromEnv) { span.attribute(key, annotationsFromEnv[key]); @@ -72667,7 +73221,7 @@ const makeSpanScoped = (name, options) => uninterruptible((0,_core_js__rspack_im const scope = _Context_js__rspack_import_5/* .getUnsafe */.fp(fiber.context, scopeTag); const span = makeSpanUnsafe(fiber, name, options ?? {}); const clock = fiber.getRef(ClockRef); - const timingEnabled = fiber.getRef(_references_js__rspack_import_15/* .TracerTimingEnabled */.nU); + const timingEnabled = fiber.getRef(_references_js__rspack_import_14/* .TracerTimingEnabled */.nU); return as(scopeAddFinalizerExit(scope, exit => endSpan(span, exit, clock, timingEnabled)), span); })); /** @internal */ @@ -72683,16 +73237,16 @@ const withSpanScoped = function () { }; const provideSpanStackFrame = (name, stack) => { stack = typeof stack === "function" ? stack : _Function_js__rspack_import_6/* .constUndefined */.MN; - return updateService(_references_js__rspack_import_15/* .CurrentStackFrame */.vA, parent => ({ + return updateService(_references_js__rspack_import_14/* .CurrentStackFrame */.vA, parent => ({ name, stack, parent })); }; /** @internal */ -const spanAnnotations = _references_js__rspack_import_15/* .TracerSpanAnnotations */.ce; +const spanAnnotations = _references_js__rspack_import_14/* .TracerSpanAnnotations */.ce; /** @internal */ -const spanLinks = _references_js__rspack_import_15/* .TracerSpanLinks */.ls; +const spanLinks = _references_js__rspack_import_14/* .TracerSpanLinks */.ls; /** @internal */ const linkSpans = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (self, span, attributes = {}) => { const spans = Array.isArray(span) ? span : [span]; @@ -72700,7 +73254,7 @@ const linkSpans = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(a span, attributes })); - return updateService(self, _references_js__rspack_import_15/* .TracerSpanLinks */.ls, current => [...current, ...links]); + return updateService(self, _references_js__rspack_import_14/* .TracerSpanLinks */.ls, current => [...current, ...links]); }); /** @internal */ const endSpan = (span, exit, clock, timingEnabled) => sync(() => { @@ -72714,11 +73268,11 @@ const useSpan = (name, ...args) => { return (0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => { const span = makeSpanUnsafe(fiber, name, options); const clock = fiber.getRef(ClockRef); - const timingEnabled = fiber.getRef(_references_js__rspack_import_15/* .TracerTimingEnabled */.nU); - return onExit((0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => evaluate(span)), exit => endSpan(span, exit, clock, timingEnabled)); + const timingEnabled = fiber.getRef(_references_js__rspack_import_14/* .TracerTimingEnabled */.nU); + return onExit(suspend(() => (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => evaluate(span))), exit => endSpan(span, exit, clock, timingEnabled)); }); }; -const provideParentSpan = /*#__PURE__*/provideService(_Tracer_js__rspack_import_14/* .ParentSpan */.Tv); +const provideParentSpan = /*#__PURE__*/provideService(_Tracer_js__rspack_import_12/* .ParentSpan */.Tv); /** @internal */ const withParentSpan = function () { const dataFirst = (0,_core_js__rspack_import_0/* .isEffect */.yw)(arguments[0]); @@ -72748,7 +73302,7 @@ const withSpan = function () { return (self, ...args) => useSpan(name, fnArg ? fnArg(...args) : options, span => withParentSpan(self, span, traceOptions)); }; /** @internal */ -const annotateSpans = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (effect, ...args) => updateService(effect, _references_js__rspack_import_15/* .TracerSpanAnnotations */.ce, annotations => { +const annotateSpans = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (effect, ...args) => updateService(effect, _references_js__rspack_import_14/* .TracerSpanAnnotations */.ce, annotations => { const newAnnotations = args.length === 1 ? { ...annotations, ...args[0] @@ -72782,7 +73336,7 @@ const currentSpan = /*#__PURE__*/(0,_core_js__rspack_import_0/* .withFiber */.R6 return span ? succeed(span) : fail(new _core_js__rspack_import_0/* .NoSuchElementError */.Xm()); }); /** @internal */ -const currentParentSpan = /*#__PURE__*/serviceOptional(_Tracer_js__rspack_import_14/* .ParentSpan */.Tv); +const currentParentSpan = /*#__PURE__*/serviceOptional(_Tracer_js__rspack_import_12/* .ParentSpan */.Tv); // ---------------------------------------------------------------------------- // Clock // ---------------------------------------------------------------------------- @@ -72868,7 +73422,7 @@ const monotonicTimeNanos = /*#__PURE__*/clockWith(clock => clock.monotonicTimeNa /** @internal */ const TimeoutErrorTypeId = "~effect/Cause/TimeoutError"; /** @internal */ -const isTimeoutError = u => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(u, TimeoutErrorTypeId); +const isTimeoutError = u => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(u, TimeoutErrorTypeId); /** @internal */ class TimeoutError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .TaggedError */.rN)("TimeoutError") { [TimeoutErrorTypeId] = TimeoutErrorTypeId; @@ -72881,7 +73435,7 @@ class TimeoutError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .TaggedEr /** @internal */ const IllegalArgumentErrorTypeId = "~effect/Cause/IllegalArgumentError"; /** @internal */ -const isIllegalArgumentError = u => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(u, IllegalArgumentErrorTypeId); +const isIllegalArgumentError = u => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(u, IllegalArgumentErrorTypeId); /** @internal */ class IllegalArgumentError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .TaggedError */.rN)("IllegalArgumentError") { [IllegalArgumentErrorTypeId] = IllegalArgumentErrorTypeId; @@ -72894,7 +73448,7 @@ class IllegalArgumentError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* . /** @internal */ const ExceededCapacityErrorTypeId = "~effect/Cause/ExceededCapacityError"; /** @internal */ -const isExceededCapacityError = u => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(u, ExceededCapacityErrorTypeId); +const isExceededCapacityError = u => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(u, ExceededCapacityErrorTypeId); /** @internal */ class ExceededCapacityError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .TaggedError */.rN)("ExceededCapacityError") { [ExceededCapacityErrorTypeId] = ExceededCapacityErrorTypeId; @@ -72907,7 +73461,7 @@ class ExceededCapacityError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* /** @internal */ const AsyncFiberErrorTypeId = "~effect/Cause/AsyncFiberError"; /** @internal */ -const isAsyncFiberError = u => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(u, AsyncFiberErrorTypeId); +const isAsyncFiberError = u => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(u, AsyncFiberErrorTypeId); /** @internal */ class AsyncFiberError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .TaggedError */.rN)("AsyncFiberError") { [AsyncFiberErrorTypeId] = AsyncFiberErrorTypeId; @@ -72921,7 +73475,7 @@ class AsyncFiberError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .Tagge /** @internal */ const UnknownErrorTypeId = "~effect/Cause/UnknownError"; /** @internal */ -const isUnknownError = u => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(u, UnknownErrorTypeId); +const isUnknownError = u => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(u, UnknownErrorTypeId); /** @internal */ class UnknownError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .TaggedError */.rN)("UnknownError") { [UnknownErrorTypeId] = UnknownErrorTypeId; @@ -72936,7 +73490,7 @@ class UnknownError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .TaggedEr // Console // ---------------------------------------------------------------------------- /** @internal */ -const ConsoleRef = /*#__PURE__*/_Context_js__rspack_import_5/* .Reference */.Or("effect/Console/CurrentConsole", { +const ConsoleRef = /*#__PURE__*/_Context_js__rspack_import_5/* .Reference */.Or("effect/Console", { defaultValue: () => globalThis.console }); // ---------------------------------------------------------------------------- @@ -72971,7 +73525,7 @@ const isLogLevelGreaterThan = /*#__PURE__*/_Order_js__rspack_import_24/* .isGrea // Logger // ---------------------------------------------------------------------------- /** @internal */ -const CurrentLoggers = /*#__PURE__*/_Context_js__rspack_import_5/* .Reference */.Or("effect/Loggers/CurrentLoggers", { +const CurrentLoggers = /*#__PURE__*/_Context_js__rspack_import_5/* .Reference */.Or("effect/Logger/CurrentLoggers", { defaultValue: () => new Set([defaultLogger, tracerLogger]) }); /** @internal */ @@ -72982,7 +73536,7 @@ const LogToStderr = /*#__PURE__*/_Context_js__rspack_import_5/* .Reference */.Or const annotateLogsScoped = function () { const entries = typeof arguments[0] === "string" ? [[arguments[0], arguments[1]]] : Object.entries(arguments[0]); return uninterruptible((0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => { - const prev = fiber.getRef(_references_js__rspack_import_15/* .CurrentLogAnnotations */.iL); + const prev = fiber.getRef(_references_js__rspack_import_14/* .CurrentLogAnnotations */.iL); const next = { ...prev }; @@ -72990,22 +73544,22 @@ const annotateLogsScoped = function () { const [key, value] = entries[i]; _record_js__rspack_import_21/* .assignProperty */.x(next, key, value); } - fiber.setContext(_Context_js__rspack_import_5/* .add */.WQ(fiber.context, _references_js__rspack_import_15/* .CurrentLogAnnotations */.iL, next)); + fiber.setContext(_Context_js__rspack_import_5/* .add */.WQ(fiber.context, _references_js__rspack_import_14/* .CurrentLogAnnotations */.iL, next)); return scopeAddFinalizerExit(_Context_js__rspack_import_5/* .getUnsafe */.fp(fiber.context, scopeTag), _ => { - const current = fiber.getRef(_references_js__rspack_import_15/* .CurrentLogAnnotations */.iL); + const current = fiber.getRef(_references_js__rspack_import_14/* .CurrentLogAnnotations */.iL); const next = { ...current }; for (let i = 0; i < entries.length; i++) { const [key, value] = entries[i]; - if (current[key] !== value) continue; + if (current[key] !== value && !Object.is(current[key], value)) continue; if (Object.hasOwn(prev, key)) { _record_js__rspack_import_21/* .assignProperty */.x(next, key, prev[key]); } else { delete next[key]; } } - fiber.setContext(_Context_js__rspack_import_5/* .add */.WQ(fiber.context, _references_js__rspack_import_15/* .CurrentLogAnnotations */.iL, next)); + fiber.setContext(_Context_js__rspack_import_5/* .add */.WQ(fiber.context, _references_js__rspack_import_14/* .CurrentLogAnnotations */.iL, next)); return void_; }); })); @@ -73018,7 +73572,7 @@ const LoggerProto = { _Output: _Function_js__rspack_import_6/* .identity */.D_ }, pipe() { - return (0,_Pipeable_js__rspack_import_12/* .pipeArguments */.tT)(this, arguments); + return (0,_Pipeable_js__rspack_import_11/* .pipeArguments */.tT)(this, arguments); } }; /** @internal */ @@ -73077,8 +73631,8 @@ const logWithLevel = level => (...message) => { cause = _core_js__rspack_import_0/* .causeEmpty */.DH; } return (0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => { - const logLevel = level ?? fiber.currentLogLevel; - if (isLogLevelGreaterThan(fiber.minimumLogLevel, logLevel)) { + const logLevel = level ?? fiber.cache.logLevel; + if (isLogLevelGreaterThan(fiber.cache.minimumLogLevel, logLevel)) { return void_; } const clock = fiber.getRef(ClockRef); @@ -73145,24 +73699,22 @@ const consolePretty = options => { // property accesses, which bundlers must retain as possible side effects const process = globalThis.process; const hasProcessStdout = typeof process?.stdout === "object" && process.stdout !== null; - const processStdoutIsTTY = hasProcessStdout && process.stdout.isTTY === true; - const hasProcessStdoutOrDeno = hasProcessStdout || "Deno" in globalThis; - const mode_ = options?.mode ?? "auto"; - const mode = mode_ === "auto" ? hasProcessStdoutOrDeno ? "tty" : "browser" : mode_; - const isBrowser = mode === "browser"; - const showColors = typeof options?.colors === "boolean" ? options.colors : processStdoutIsTTY || isBrowser; - const formatDate = options?.formatDate ?? defaultDateFormat; - return isBrowser ? prettyLoggerBrowser({ - colors: showColors, - formatDate - }) : prettyLoggerTty({ - colors: showColors, - formatDate - }); + const isDeno = "Deno" in globalThis; + const mode = options?.mode ?? "auto"; + const isTtyLogger = mode === "auto" ? hasProcessStdout || isDeno : mode === "tty"; + return isTtyLogger ? prettyLoggerTty(options) : prettyLoggerBrowser(options); }; +/** @internal */ const prettyLoggerTty = options => { - const processIsBun = globalThis.process?.isBun === true; - const color = options.colors ? withColor : withColorNoop; + const formatDate = options?.formatDate ?? defaultDateFormat; + // evaluated lazily so the module-level bundle stays free of `process` + // property accesses, which bundlers must retain as possible side effects + const process = globalThis.process; + const hasProcessStdout = typeof process?.stdout === "object" && process.stdout !== null; + const processStdoutIsTTY = hasProcessStdout && process.stdout.isTTY === true; + const showColors = typeof options?.colors === "boolean" ? options.colors : processStdoutIsTTY; + const color = showColors ? withColor : withColorNoop; + const processIsBun = process?.isBun === true; return loggerMake(({ cause, date, @@ -73174,7 +73726,7 @@ const prettyLoggerTty = options => { // oxlint-disable-next-line no-console const log = fiber.getRef(LogToStderr) ? console.error : console.log; const message = Array.isArray(message_) ? message_.slice() : [message_]; - let firstLine = color(`[${options.formatDate(date)}]`, colors.white) + ` ${color(logLevel.toUpperCase(), ...logLevelColors[logLevel])}` + ` (#${fiber.id})`; + let firstLine = color(`[${formatDate(date)}]`, colors.white) + ` ${color(logLevel.toUpperCase(), ...logLevelColors[logLevel])}` + ` (#${fiber.id})`; const now = date.getTime(); const spans = fiber.getRef(CurrentLogSpans); for (const span of spans) { @@ -73208,8 +73760,11 @@ const prettyLoggerTty = options => { if (!processIsBun) console.groupEnd(); }); }; +/** @internal */ const prettyLoggerBrowser = options => { - const color = options.colors ? "%c" : ""; + const showColors = options?.colors !== false; + const color = showColors ? "%c" : ""; + const formatDate = options?.formatDate ?? defaultDateFormat; return loggerMake(({ cause, date, @@ -73219,13 +73774,13 @@ const prettyLoggerBrowser = options => { }) => { const console = fiber.getRef(ConsoleRef); const message = Array.isArray(message_) ? message_.slice() : [message_]; - let firstLine = `${color}[${options.formatDate(date)}]`; + let firstLine = `${color}[${formatDate(date)}]`; const firstParams = []; - if (options.colors) { + if (showColors) { firstParams.push("color:gray"); } firstLine += ` ${color}${logLevel.toUpperCase()}${color} (#${fiber.id})`; - if (options.colors) { + if (showColors) { firstParams.push(logLevelStyle[logLevel], ""); } const now = date.getTime(); @@ -73239,7 +73794,7 @@ const prettyLoggerBrowser = options => { const firstMaybeString = structuredMessage(message[0]); if (typeof firstMaybeString === "string") { firstLine += ` ${color}${firstMaybeString}`; - if (options.colors) { + if (showColors) { firstParams.push("color:deepskyblue"); } messageIndex++; @@ -73260,7 +73815,7 @@ const prettyLoggerBrowser = options => { const annotations = fiber.getRef(CurrentLogAnnotations); for (const [key, value] of Object.entries(annotations)) { const redacted = redact(value); - if (options.colors) { + if (showColors) { // oxlint-disable-next-line no-console console.log(`%c${key}:`, "color:gray", redacted); } else { @@ -73285,12 +73840,12 @@ const defaultLogger = /*#__PURE__*/loggerMake(({ message_.push(causePretty(cause)); } const now = date.getTime(); - const spans = fiber.getRef(_references_js__rspack_import_15/* .CurrentLogSpans */.d8); + const spans = fiber.getRef(_references_js__rspack_import_14/* .CurrentLogSpans */.d8); let spanString = ""; for (const span of spans) { spanString += ` ${formatLogSpan(span, now)}`; } - const annotations = fiber.getRef(_references_js__rspack_import_15/* .CurrentLogAnnotations */.iL); + const annotations = fiber.getRef(_references_js__rspack_import_14/* .CurrentLogAnnotations */.iL); if (Object.keys(annotations).length > 0) { message_.push(annotations); } @@ -73307,8 +73862,8 @@ const tracerLogger = /*#__PURE__*/loggerMake(({ message }) => { const clock = fiber.getRef(ClockRef); - const annotations = fiber.getRef(_references_js__rspack_import_15/* .CurrentLogAnnotations */.iL); - const span = fiber.currentSpan; + const annotations = fiber.getRef(_references_js__rspack_import_14/* .CurrentLogAnnotations */.iL); + const span = fiber.cache.span; if (span === undefined || span._tag === "ExternalSpan") return; const attributes = {}; for (const [key, value] of Object.entries(annotations)) { @@ -73339,7 +73894,7 @@ const withErrorReporting = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual }))); /** @internal */ const reportCauseUnsafe = (fiber, cause, defectsOnly) => { - const reporters = fiber.getRef(_references_js__rspack_import_15/* .CurrentErrorReporters */.oQ); + const reporters = fiber.getRef(_references_js__rspack_import_14/* .CurrentErrorReporters */.oQ); if (reporters.size === 0) return; if (defectsOnly && !hasDies(cause)) return; const opts = { @@ -73829,7 +74384,7 @@ __webpack_require__.d(__webpack_exports__, { }, "./node_modules/effect/dist/internal/metric.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) { /** @internal */ -const FiberRuntimeMetricsKey = "effect/observability/Metric/FiberRuntimeMetricsKey"; +const FiberRuntimeMetricsKey = "effect/Metric/FiberRuntimeMetrics"; //# sourceMappingURL=metric.js.map __webpack_require__.d(__webpack_exports__, { }, { @@ -73856,7 +74411,7 @@ __webpack_require__.d(__webpack_exports__, { -const TypeId = "~effect/data/Option"; +const TypeId = "~effect/Option"; const CommonProto = { [TypeId]: { _A: _ => _ @@ -73923,11 +74478,12 @@ const isSome = fa => fa._tag === "Some"; /** @internal */ const none = /*#__PURE__*/Object.create(NoneProto); /** @internal */ -const some = value => { - const a = Object.create(SomeProto); - a.value = value; - return a; +const SomeImpl = function (value) { + this.value = value; }; +SomeImpl.prototype = SomeProto; +/** @internal */ +const some = value => new SomeImpl(value); //# sourceMappingURL=option.js.map __webpack_require__.d(__webpack_exports__, { }, { @@ -73987,6 +74543,7 @@ const CurrentStackFrame = /*#__PURE__*/_Context_js__rspack_import_0/* .Reference }); /** @internal */ const TracerEnabled = /*#__PURE__*/_Context_js__rspack_import_0/* .Reference */.Or("effect/References/TracerEnabled", { + fiberCached: true, defaultValue: _Function_js__rspack_import_1/* .constTrue */.ue }); /** @internal */ @@ -74065,7 +74622,9 @@ const request = /*#__PURE__*/(0,_Function_js__rspack_import_0/* .dual */.XY)(2, const requestUnsafe = (self, options) => { const entry = addEntry(options.resolver, self, options.onExit, { context: options.context, - currentScheduler: _Context_js__rspack_import_3/* .get */.Jt(options.context, _Scheduler_js__rspack_import_4/* .Scheduler */._F) + cache: { + scheduler: _Context_js__rspack_import_3/* .get */.Jt(options.context, _Scheduler_js__rspack_import_4/* .Scheduler */._F) + } }); return () => removeEntryUnsafe(options.resolver, entry); }; @@ -74086,8 +74645,9 @@ const addEntry = (resolver, request, resume, fiber) => { completeUnsafe(effect) { if (completed) return; completed = true; + // Removed entries still notify resolver hooks, but not their cancelled callers. + if (batch && !batch.entrySet.delete(entry)) return; resume(effect); - batch?.entrySet.delete(entry); } }); if (resolver.preCheck !== undefined && !resolver.preCheck(entry)) { @@ -74131,7 +74691,7 @@ const addEntry = (resolver, request, resume, fiber) => { } batchMap.set(key, batch); batch.fiber = _effect_js__rspack_import_1/* .runForkWith */.eJC(fiber.context)(batch.delayEffect, { - scheduler: fiber.currentScheduler + scheduler: fiber.cache.scheduler }); } batch.entrySet.add(entry); @@ -74139,7 +74699,7 @@ const addEntry = (resolver, request, resume, fiber) => { if (batch.resolver.collectWhile(batch.entries)) return entry; batch.fiber.interruptUnsafe(fiber.id); batch.fiber = _effect_js__rspack_import_1/* .runForkWith */.eJC(fiber.context)(runBatch(batch), { - scheduler: fiber.currentScheduler + scheduler: fiber.cache.scheduler }); return entry; }; @@ -74150,12 +74710,16 @@ const removeEntryUnsafe = (resolver, entry) => { const key = resolver.batchKey(entry); const batch = batchMap.get(key); if (!batch) return; - batch.entries.delete(entry); + if (!batch.entries.delete(entry)) return; batch.entrySet.delete(entry); + let fiber; if (batch.entries.size === 0) { batchMap.delete(key); - batch.fiber?.interruptUnsafe(); + fiber = batch.fiber; } + // Delay finalizers may enqueue new requests, so complete the removed entry first. + entry.completeUnsafe(_effect_js__rspack_import_1/* .exitInterrupt */._sz()); + fiber?.interruptUnsafe(); }; const maybeRemoveEntry = (resolver, entry) => _effect_js__rspack_import_1/* .sync */.OH5(() => removeEntryUnsafe(resolver, entry)); function runBatch(batch) { @@ -74191,7 +74755,7 @@ __webpack_require__.d(__webpack_exports__, { -const TypeId = "~effect/data/Result"; +const TypeId = "~effect/Result"; const CommonProto = { [TypeId]: { /* v8 ignore next 2 */ @@ -74250,17 +74814,19 @@ const isFailure = result => result._tag === "Failure"; /** @internal */ const isSuccess = result => result._tag === "Success"; /** @internal */ -const fail = failure => { - const a = Object.create(FailureProto); - a.failure = failure; - return a; +const FailureImpl = function (failure) { + this.failure = failure; }; +FailureImpl.prototype = FailureProto; +/** @internal */ +const fail = failure => new FailureImpl(failure); /** @internal */ -const succeed = success => { - const a = Object.create(SuccessProto); - a.success = success; - return a; +const SuccessImpl = function (success) { + this.success = success; }; +SuccessImpl.prototype = SuccessProto; +/** @internal */ +const succeed = success => new SuccessImpl(success); /** @internal */ const getFailure = self => isSuccess(self) ? _option_js__rspack_import_7/* .none */.dv : _option_js__rspack_import_7/* .some */.zN(self.failure); /** @internal */ @@ -74442,18 +75008,17 @@ const streamVariance = { _E: _Function_js__rspack_import_0/* .identity */.D_, _A: _Function_js__rspack_import_0/* .identity */.D_ }; -const StreamProto = { +const Stream = function (channel) { + this.channel = channel; +}; +Stream.prototype = { [TypeId]: streamVariance, pipe() { return (0,_Pipeable_js__rspack_import_1/* .pipeArguments */.tT)(this, arguments); } }; /** @internal */ -const fromChannel = channel => { - const self = Object.create(StreamProto); - self.channel = channel; - return self; -}; +const fromChannel = channel => new Stream(channel); //# sourceMappingURL=stream.js.map __webpack_require__.d(__webpack_exports__, { }, { @@ -74473,6 +75038,12 @@ const addSpanStackTrace = options => { return options; } const limit = (0,_stackTraceLimit_js__rspack_import_0/* .getStackTraceLimit */.jt)(); + if (limit === 0 && options?.captureStackTrace !== true) { + return { + ...options, + captureStackTrace: false + }; + } (0,_stackTraceLimit_js__rspack_import_0/* .setStackTraceLimit */.ft)(3); const traceError = new Error(); (0,_stackTraceLimit_js__rspack_import_0/* .setStackTraceLimit */.ft)(limit); @@ -84447,116 +85018,116 @@ __webpack_require__.a(__webpack_module__, async function (__rspack_load_async_de /* import */ var _agent_bundle_runtime__rspack_import_41 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/index.js"); /* import */ var node_url__rspack_import_2 = __webpack_require__("node:url"); /* import */ var node_worker_threads__rspack_import_3 = __webpack_require__("node:worker_threads"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_approvals_list_tsx__rspack_import_4 = __webpack_require__("./src/cli/approvals/list.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_approvals_respond_tsx__rspack_import_5 = __webpack_require__("./src/cli/approvals/respond.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_bots_create_tsx__rspack_import_6 = __webpack_require__("./src/cli/bots/create.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_bots_delete_tsx__rspack_import_7 = __webpack_require__("./src/cli/bots/delete.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_bots_get_tsx__rspack_import_8 = __webpack_require__("./src/cli/bots/get.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_bots_list_tsx__rspack_import_9 = __webpack_require__("./src/cli/bots/list.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_bots_update_tsx__rspack_import_10 = __webpack_require__("./src/cli/bots/update.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_bridge_respond_tsx__rspack_import_11 = __webpack_require__("./src/cli/codex/bridge/respond.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_bridge_run_tsx__rspack_import_12 = __webpack_require__("./src/cli/codex/bridge/run.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_bridge_start_tsx__rspack_import_13 = __webpack_require__("./src/cli/codex/bridge/start.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_bridge_status_tsx__rspack_import_14 = __webpack_require__("./src/cli/codex/bridge/status.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_bridge_stop_tsx__rspack_import_15 = __webpack_require__("./src/cli/codex/bridge/stop.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_desktop_shim_tsx__rspack_import_16 = __webpack_require__("./src/cli/codex/desktop-shim.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_list_threads_tsx__rspack_import_17 = __webpack_require__("./src/cli/codex/list-threads.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_queue_tsx__rspack_import_18 = __webpack_require__("./src/cli/codex/queue.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_send_tsx__rspack_import_19 = __webpack_require__("./src/cli/codex/send.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_status_tsx__rspack_import_20 = __webpack_require__("./src/cli/codex/status.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_wait_tsx__rspack_import_21 = __webpack_require__("./src/cli/codex/wait.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_codex_watch_tsx__rspack_import_22 = __webpack_require__("./src/cli/codex/watch.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_doctor_tsx__rspack_import_23 = __webpack_require__("./src/cli/doctor.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_groups_add_tsx__rspack_import_24 = __webpack_require__("./src/cli/groups/add.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_groups_create_tsx__rspack_import_25 = __webpack_require__("./src/cli/groups/create.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_groups_delete_tsx__rspack_import_26 = __webpack_require__("./src/cli/groups/delete.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_groups_get_tsx__rspack_import_27 = __webpack_require__("./src/cli/groups/get.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_groups_list_tsx__rspack_import_28 = __webpack_require__("./src/cli/groups/list.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_groups_members_tsx__rspack_import_29 = __webpack_require__("./src/cli/groups/members.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_groups_remove_tsx__rspack_import_30 = __webpack_require__("./src/cli/groups/remove.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_groups_set_tsx__rspack_import_31 = __webpack_require__("./src/cli/groups/set.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_groups_update_tsx__rspack_import_32 = __webpack_require__("./src/cli/groups/update.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_history_tsx__rspack_import_33 = __webpack_require__("./src/cli/history.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_send_tsx__rspack_import_34 = __webpack_require__("./src/cli/send.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_skills_add_tsx__rspack_import_35 = __webpack_require__("./src/cli/skills/add.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_skills_list_tsx__rspack_import_36 = __webpack_require__("./src/cli/skills/list.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_skills_remove_tsx__rspack_import_37 = __webpack_require__("./src/cli/skills/remove.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_cli_thread_tsx__rspack_import_38 = __webpack_require__("./src/cli/thread.tsx"); +/* import */ var _src_cli_approvals_list_tsx__rspack_import_4 = __webpack_require__("./src/cli/approvals/list.tsx"); +/* import */ var _src_cli_approvals_respond_tsx__rspack_import_5 = __webpack_require__("./src/cli/approvals/respond.tsx"); +/* import */ var _src_cli_bots_create_tsx__rspack_import_6 = __webpack_require__("./src/cli/bots/create.tsx"); +/* import */ var _src_cli_bots_delete_tsx__rspack_import_7 = __webpack_require__("./src/cli/bots/delete.tsx"); +/* import */ var _src_cli_bots_get_tsx__rspack_import_8 = __webpack_require__("./src/cli/bots/get.tsx"); +/* import */ var _src_cli_bots_list_tsx__rspack_import_9 = __webpack_require__("./src/cli/bots/list.tsx"); +/* import */ var _src_cli_bots_update_tsx__rspack_import_10 = __webpack_require__("./src/cli/bots/update.tsx"); +/* import */ var _src_cli_codex_bridge_respond_tsx__rspack_import_11 = __webpack_require__("./src/cli/codex/bridge/respond.tsx"); +/* import */ var _src_cli_codex_bridge_run_tsx__rspack_import_12 = __webpack_require__("./src/cli/codex/bridge/run.tsx"); +/* import */ var _src_cli_codex_bridge_start_tsx__rspack_import_13 = __webpack_require__("./src/cli/codex/bridge/start.tsx"); +/* import */ var _src_cli_codex_bridge_status_tsx__rspack_import_14 = __webpack_require__("./src/cli/codex/bridge/status.tsx"); +/* import */ var _src_cli_codex_bridge_stop_tsx__rspack_import_15 = __webpack_require__("./src/cli/codex/bridge/stop.tsx"); +/* import */ var _src_cli_codex_desktop_shim_tsx__rspack_import_16 = __webpack_require__("./src/cli/codex/desktop-shim.tsx"); +/* import */ var _src_cli_codex_list_threads_tsx__rspack_import_17 = __webpack_require__("./src/cli/codex/list-threads.tsx"); +/* import */ var _src_cli_codex_queue_tsx__rspack_import_18 = __webpack_require__("./src/cli/codex/queue.tsx"); +/* import */ var _src_cli_codex_send_tsx__rspack_import_19 = __webpack_require__("./src/cli/codex/send.tsx"); +/* import */ var _src_cli_codex_status_tsx__rspack_import_20 = __webpack_require__("./src/cli/codex/status.tsx"); +/* import */ var _src_cli_codex_wait_tsx__rspack_import_21 = __webpack_require__("./src/cli/codex/wait.tsx"); +/* import */ var _src_cli_codex_watch_tsx__rspack_import_22 = __webpack_require__("./src/cli/codex/watch.tsx"); +/* import */ var _src_cli_doctor_tsx__rspack_import_23 = __webpack_require__("./src/cli/doctor.tsx"); +/* import */ var _src_cli_groups_add_tsx__rspack_import_24 = __webpack_require__("./src/cli/groups/add.tsx"); +/* import */ var _src_cli_groups_create_tsx__rspack_import_25 = __webpack_require__("./src/cli/groups/create.tsx"); +/* import */ var _src_cli_groups_delete_tsx__rspack_import_26 = __webpack_require__("./src/cli/groups/delete.tsx"); +/* import */ var _src_cli_groups_get_tsx__rspack_import_27 = __webpack_require__("./src/cli/groups/get.tsx"); +/* import */ var _src_cli_groups_list_tsx__rspack_import_28 = __webpack_require__("./src/cli/groups/list.tsx"); +/* import */ var _src_cli_groups_members_tsx__rspack_import_29 = __webpack_require__("./src/cli/groups/members.tsx"); +/* import */ var _src_cli_groups_remove_tsx__rspack_import_30 = __webpack_require__("./src/cli/groups/remove.tsx"); +/* import */ var _src_cli_groups_set_tsx__rspack_import_31 = __webpack_require__("./src/cli/groups/set.tsx"); +/* import */ var _src_cli_groups_update_tsx__rspack_import_32 = __webpack_require__("./src/cli/groups/update.tsx"); +/* import */ var _src_cli_history_tsx__rspack_import_33 = __webpack_require__("./src/cli/history.tsx"); +/* import */ var _src_cli_send_tsx__rspack_import_34 = __webpack_require__("./src/cli/send.tsx"); +/* import */ var _src_cli_skills_add_tsx__rspack_import_35 = __webpack_require__("./src/cli/skills/add.tsx"); +/* import */ var _src_cli_skills_list_tsx__rspack_import_36 = __webpack_require__("./src/cli/skills/list.tsx"); +/* import */ var _src_cli_skills_remove_tsx__rspack_import_37 = __webpack_require__("./src/cli/skills/remove.tsx"); +/* import */ var _src_cli_thread_tsx__rspack_import_38 = __webpack_require__("./src/cli/thread.tsx"); -const route0 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_approvals_list_tsx__rspack_import_4, 'default'), _tmp_gbot_agent_bundle_native_src_cli_approvals_list_tsx__rspack_import_4); +const route0 = Object.assign({}, Reflect.get(_src_cli_approvals_list_tsx__rspack_import_4, 'default'), _src_cli_approvals_list_tsx__rspack_import_4); -const route1 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_approvals_respond_tsx__rspack_import_5, 'default'), _tmp_gbot_agent_bundle_native_src_cli_approvals_respond_tsx__rspack_import_5); +const route1 = Object.assign({}, Reflect.get(_src_cli_approvals_respond_tsx__rspack_import_5, 'default'), _src_cli_approvals_respond_tsx__rspack_import_5); -const route2 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_bots_create_tsx__rspack_import_6, 'default'), _tmp_gbot_agent_bundle_native_src_cli_bots_create_tsx__rspack_import_6); +const route2 = Object.assign({}, Reflect.get(_src_cli_bots_create_tsx__rspack_import_6, 'default'), _src_cli_bots_create_tsx__rspack_import_6); -const route3 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_bots_delete_tsx__rspack_import_7, 'default'), _tmp_gbot_agent_bundle_native_src_cli_bots_delete_tsx__rspack_import_7); +const route3 = Object.assign({}, Reflect.get(_src_cli_bots_delete_tsx__rspack_import_7, 'default'), _src_cli_bots_delete_tsx__rspack_import_7); -const route4 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_bots_get_tsx__rspack_import_8, 'default'), _tmp_gbot_agent_bundle_native_src_cli_bots_get_tsx__rspack_import_8); +const route4 = Object.assign({}, Reflect.get(_src_cli_bots_get_tsx__rspack_import_8, 'default'), _src_cli_bots_get_tsx__rspack_import_8); -const route5 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_bots_list_tsx__rspack_import_9, 'default'), _tmp_gbot_agent_bundle_native_src_cli_bots_list_tsx__rspack_import_9); +const route5 = Object.assign({}, Reflect.get(_src_cli_bots_list_tsx__rspack_import_9, 'default'), _src_cli_bots_list_tsx__rspack_import_9); -const route6 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_bots_update_tsx__rspack_import_10, 'default'), _tmp_gbot_agent_bundle_native_src_cli_bots_update_tsx__rspack_import_10); +const route6 = Object.assign({}, Reflect.get(_src_cli_bots_update_tsx__rspack_import_10, 'default'), _src_cli_bots_update_tsx__rspack_import_10); -const route7 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_bridge_respond_tsx__rspack_import_11, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_bridge_respond_tsx__rspack_import_11); +const route7 = Object.assign({}, Reflect.get(_src_cli_codex_bridge_respond_tsx__rspack_import_11, 'default'), _src_cli_codex_bridge_respond_tsx__rspack_import_11); -const route8 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_bridge_run_tsx__rspack_import_12, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_bridge_run_tsx__rspack_import_12); +const route8 = Object.assign({}, Reflect.get(_src_cli_codex_bridge_run_tsx__rspack_import_12, 'default'), _src_cli_codex_bridge_run_tsx__rspack_import_12); -const route9 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_bridge_start_tsx__rspack_import_13, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_bridge_start_tsx__rspack_import_13); +const route9 = Object.assign({}, Reflect.get(_src_cli_codex_bridge_start_tsx__rspack_import_13, 'default'), _src_cli_codex_bridge_start_tsx__rspack_import_13); -const route10 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_bridge_status_tsx__rspack_import_14, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_bridge_status_tsx__rspack_import_14); +const route10 = Object.assign({}, Reflect.get(_src_cli_codex_bridge_status_tsx__rspack_import_14, 'default'), _src_cli_codex_bridge_status_tsx__rspack_import_14); -const route11 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_bridge_stop_tsx__rspack_import_15, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_bridge_stop_tsx__rspack_import_15); +const route11 = Object.assign({}, Reflect.get(_src_cli_codex_bridge_stop_tsx__rspack_import_15, 'default'), _src_cli_codex_bridge_stop_tsx__rspack_import_15); -const route12 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_desktop_shim_tsx__rspack_import_16, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_desktop_shim_tsx__rspack_import_16); +const route12 = Object.assign({}, Reflect.get(_src_cli_codex_desktop_shim_tsx__rspack_import_16, 'default'), _src_cli_codex_desktop_shim_tsx__rspack_import_16); -const route13 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_list_threads_tsx__rspack_import_17, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_list_threads_tsx__rspack_import_17); +const route13 = Object.assign({}, Reflect.get(_src_cli_codex_list_threads_tsx__rspack_import_17, 'default'), _src_cli_codex_list_threads_tsx__rspack_import_17); -const route14 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_queue_tsx__rspack_import_18, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_queue_tsx__rspack_import_18); +const route14 = Object.assign({}, Reflect.get(_src_cli_codex_queue_tsx__rspack_import_18, 'default'), _src_cli_codex_queue_tsx__rspack_import_18); -const route15 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_send_tsx__rspack_import_19, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_send_tsx__rspack_import_19); +const route15 = Object.assign({}, Reflect.get(_src_cli_codex_send_tsx__rspack_import_19, 'default'), _src_cli_codex_send_tsx__rspack_import_19); -const route16 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_status_tsx__rspack_import_20, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_status_tsx__rspack_import_20); +const route16 = Object.assign({}, Reflect.get(_src_cli_codex_status_tsx__rspack_import_20, 'default'), _src_cli_codex_status_tsx__rspack_import_20); -const route17 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_wait_tsx__rspack_import_21, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_wait_tsx__rspack_import_21); +const route17 = Object.assign({}, Reflect.get(_src_cli_codex_wait_tsx__rspack_import_21, 'default'), _src_cli_codex_wait_tsx__rspack_import_21); -const route18 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_codex_watch_tsx__rspack_import_22, 'default'), _tmp_gbot_agent_bundle_native_src_cli_codex_watch_tsx__rspack_import_22); +const route18 = Object.assign({}, Reflect.get(_src_cli_codex_watch_tsx__rspack_import_22, 'default'), _src_cli_codex_watch_tsx__rspack_import_22); -const route19 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_doctor_tsx__rspack_import_23, 'default'), _tmp_gbot_agent_bundle_native_src_cli_doctor_tsx__rspack_import_23); +const route19 = Object.assign({}, Reflect.get(_src_cli_doctor_tsx__rspack_import_23, 'default'), _src_cli_doctor_tsx__rspack_import_23); -const route20 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_groups_add_tsx__rspack_import_24, 'default'), _tmp_gbot_agent_bundle_native_src_cli_groups_add_tsx__rspack_import_24); +const route20 = Object.assign({}, Reflect.get(_src_cli_groups_add_tsx__rspack_import_24, 'default'), _src_cli_groups_add_tsx__rspack_import_24); -const route21 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_groups_create_tsx__rspack_import_25, 'default'), _tmp_gbot_agent_bundle_native_src_cli_groups_create_tsx__rspack_import_25); +const route21 = Object.assign({}, Reflect.get(_src_cli_groups_create_tsx__rspack_import_25, 'default'), _src_cli_groups_create_tsx__rspack_import_25); -const route22 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_groups_delete_tsx__rspack_import_26, 'default'), _tmp_gbot_agent_bundle_native_src_cli_groups_delete_tsx__rspack_import_26); +const route22 = Object.assign({}, Reflect.get(_src_cli_groups_delete_tsx__rspack_import_26, 'default'), _src_cli_groups_delete_tsx__rspack_import_26); -const route23 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_groups_get_tsx__rspack_import_27, 'default'), _tmp_gbot_agent_bundle_native_src_cli_groups_get_tsx__rspack_import_27); +const route23 = Object.assign({}, Reflect.get(_src_cli_groups_get_tsx__rspack_import_27, 'default'), _src_cli_groups_get_tsx__rspack_import_27); -const route24 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_groups_list_tsx__rspack_import_28, 'default'), _tmp_gbot_agent_bundle_native_src_cli_groups_list_tsx__rspack_import_28); +const route24 = Object.assign({}, Reflect.get(_src_cli_groups_list_tsx__rspack_import_28, 'default'), _src_cli_groups_list_tsx__rspack_import_28); -const route25 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_groups_members_tsx__rspack_import_29, 'default'), _tmp_gbot_agent_bundle_native_src_cli_groups_members_tsx__rspack_import_29); +const route25 = Object.assign({}, Reflect.get(_src_cli_groups_members_tsx__rspack_import_29, 'default'), _src_cli_groups_members_tsx__rspack_import_29); -const route26 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_groups_remove_tsx__rspack_import_30, 'default'), _tmp_gbot_agent_bundle_native_src_cli_groups_remove_tsx__rspack_import_30); +const route26 = Object.assign({}, Reflect.get(_src_cli_groups_remove_tsx__rspack_import_30, 'default'), _src_cli_groups_remove_tsx__rspack_import_30); -const route27 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_groups_set_tsx__rspack_import_31, 'default'), _tmp_gbot_agent_bundle_native_src_cli_groups_set_tsx__rspack_import_31); +const route27 = Object.assign({}, Reflect.get(_src_cli_groups_set_tsx__rspack_import_31, 'default'), _src_cli_groups_set_tsx__rspack_import_31); -const route28 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_groups_update_tsx__rspack_import_32, 'default'), _tmp_gbot_agent_bundle_native_src_cli_groups_update_tsx__rspack_import_32); +const route28 = Object.assign({}, Reflect.get(_src_cli_groups_update_tsx__rspack_import_32, 'default'), _src_cli_groups_update_tsx__rspack_import_32); -const route29 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_history_tsx__rspack_import_33, 'default'), _tmp_gbot_agent_bundle_native_src_cli_history_tsx__rspack_import_33); +const route29 = Object.assign({}, Reflect.get(_src_cli_history_tsx__rspack_import_33, 'default'), _src_cli_history_tsx__rspack_import_33); -const route30 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_send_tsx__rspack_import_34, 'default'), _tmp_gbot_agent_bundle_native_src_cli_send_tsx__rspack_import_34); +const route30 = Object.assign({}, Reflect.get(_src_cli_send_tsx__rspack_import_34, 'default'), _src_cli_send_tsx__rspack_import_34); -const route31 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_skills_add_tsx__rspack_import_35, 'default'), _tmp_gbot_agent_bundle_native_src_cli_skills_add_tsx__rspack_import_35); +const route31 = Object.assign({}, Reflect.get(_src_cli_skills_add_tsx__rspack_import_35, 'default'), _src_cli_skills_add_tsx__rspack_import_35); -const route32 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_skills_list_tsx__rspack_import_36, 'default'), _tmp_gbot_agent_bundle_native_src_cli_skills_list_tsx__rspack_import_36); +const route32 = Object.assign({}, Reflect.get(_src_cli_skills_list_tsx__rspack_import_36, 'default'), _src_cli_skills_list_tsx__rspack_import_36); -const route33 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_skills_remove_tsx__rspack_import_37, 'default'), _tmp_gbot_agent_bundle_native_src_cli_skills_remove_tsx__rspack_import_37); +const route33 = Object.assign({}, Reflect.get(_src_cli_skills_remove_tsx__rspack_import_37, 'default'), _src_cli_skills_remove_tsx__rspack_import_37); -const route34 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_cli_thread_tsx__rspack_import_38, 'default'), _tmp_gbot_agent_bundle_native_src_cli_thread_tsx__rspack_import_38); +const route34 = Object.assign({}, Reflect.get(_src_cli_thread_tsx__rspack_import_38, 'default'), _src_cli_thread_tsx__rspack_import_38); const pluginRoot = (0,_agent_bundle_runtime__rspack_import_39/* .resolvePluginRoot */.E7)({ fallback: (0,node_url__rspack_import_2.fileURLToPath)(new URL('..', import.meta.url)), stateAnchor: 'user-data' diff --git a/artifact/install.mjs b/artifact/install.mjs index 904c1df..95048bb 100644 --- a/artifact/install.mjs +++ b/artifact/install.mjs @@ -10,11 +10,9 @@ const pluginName = "gbot"; const pluginVersion = "0.9.0"; const receiptFile = ".agent-bundle-install.json"; const receiptFormat = "agent-bundle-install-receipt/2"; -const legacyReceiptFormat = "agent-bundle-install-receipt/1"; const preservedEntries = ["state"]; // Runtime roots match case-insensitively: on case-insensitive filesystems State/ is state/. const isPreservedRoot = (name) => preservedEntries.includes(String(name).toLowerCase()); -const markerFiles = ["INSTALL.md","install.mjs"]; const source = resolve(fileURLToPath(new URL('.', import.meta.url))); const artifactManifest = await (async () => { try { @@ -39,7 +37,7 @@ const marketplacePlugin = join(marketplaceRepo, 'plugins', pluginName); const pluginData = join(cursorRoot, 'agent-bundle', 'plugin-data', pluginName); const receiptsRoot = join(cursorRoot, 'agent-bundle', 'receipts'); const marketplaceReceipt = join(receiptsRoot, `${pluginName}.marketplace.json`); -const usage = 'Usage: node install.mjs [--mode local|marketplace] [--replace|--force] [--help]\n node install.mjs --uninstall [--mode local|marketplace] [--keep-data | --purge-data --confirm-purge] [--force] [--plan]'; +const usage = 'Usage: node install.mjs [--mode local|marketplace] [--replace] [--help]\n node install.mjs --uninstall [--mode local|marketplace] [--keep-data | --purge-data --confirm-purge] [--force] [--plan]'; let replace = false; let force = false; @@ -52,7 +50,8 @@ let mode = 'local'; const argv = process.argv.slice(2); for (let index = 0; index < argv.length; index += 1) { const argument = argv[index]; - if (argument === '--replace' || argument === '--force') { replace = true; force = argument === '--force'; continue; } + if (argument === '--replace') { replace = true; continue; } + if (argument === '--force') { force = true; continue; } if (argument === '--uninstall') { uninstall = true; continue; } if (argument === '--plan') { plan = true; continue; } if (argument === '--keep-data') { keepData = true; continue; } @@ -68,6 +67,8 @@ for (let index = 0; index < argv.length; index += 1) { console.error(`Unknown installer argument ${JSON.stringify(argument)}.\n${usage}`); process.exit(2); } +if (!uninstall && force) { console.error(`--force applies to --uninstall only. Use --replace to replace an install.\n${usage}`); process.exit(2); } +if (uninstall && replace) { console.error(`--replace applies to installation only. Use --force to override uninstall ownership checks.\n${usage}`); process.exit(2); } if (!uninstall && (plan || keepData || purgeData || confirmPurge)) { console.error(`--plan, --keep-data, --purge-data, and --confirm-purge apply to --uninstall only.\n${usage}`); process.exit(2); @@ -252,9 +253,7 @@ const isReceiptState = (value) => value !== null && typeof value === 'object' && typeof root.root === 'string' && isAbsolute(root.root) && typeof root.canonicalRoot === 'string' && isAbsolute(root.canonicalRoot) && ['declared', 'derived'].includes(root.source) && Array.isArray(root.servers) && root.servers.every((server) => typeof server === 'string') && isStateOwnership(root.ownership)); -// Same shape check as the core reader: a receipt missing any field reads as absent. A format/1 receipt (#420) -// is read with its lifecycle fields synthesized (local mode, user scope, one cursor-local-plugin registration, -// no host directories) and `migratedFrom` set; the next replacement rewrites it as the current format. +// Same shape check as the core reader: a receipt missing any field, or of any other format, reads as absent. const readReceiptFile = async (path) => { let value; try { @@ -262,18 +261,13 @@ const readReceiptFile = async (path) => { value = JSON.parse(await readFile(path, 'utf8')); } catch (error) { if (error?.code === 'ENOENT' || error instanceof SyntaxError) return undefined; throw error; } if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined; - if ((value.format !== receiptFormat && value.format !== legacyReceiptFormat) || + if (value.format !== receiptFormat || typeof value.plugin !== 'string' || typeof value.version !== 'string' || typeof value.host !== 'string' || typeof value.contentHash !== 'string' || typeof value.installedAt !== 'string' || !Array.isArray(value.files) || !value.files.every(safeRelative) || !Array.isArray(value.directories) || !value.directories.every(safeRelative) || (value.state !== undefined && !isReceiptState(value.state)) || - (value.stateRoot !== undefined && (value.stateRoot === null || typeof value.stateRoot !== 'object' || Array.isArray(value.stateRoot) || typeof value.stateRoot.root !== 'string' || !['derived', 'native'].includes(value.stateRoot.source))) || (value.webDataRoot !== undefined && typeof value.webDataRoot !== 'string')) return undefined; - if (value.format === legacyReceiptFormat) { - return { ...value, format: receiptFormat, hostDirectories: [], migratedFrom: legacyReceiptFormat, mode: 'local', - registrations: [{ kind: 'cursor-local-plugin' }], scope: 'user', updatedAt: value.installedAt }; - } if (!['host-cli', 'local', 'marketplace'].includes(value.mode) || !isScope(value.scope) || typeof value.updatedAt !== 'string' || !Array.isArray(value.hostDirectories) || !value.hostDirectories.every(safeRelative) || !Array.isArray(value.registrations) || !value.registrations.every(isRegistration)) return undefined; @@ -312,11 +306,6 @@ const readManifest = async (root) => { return undefined; }; -const hasMarkers = async (root) => { - for (const marker of markerFiles) if (!(await exists(join(root, marker)))) return false; - return true; -}; - // Agent Plugins packs (root plugin.json with an agent-plugins.org $schema, no .cursor-plugin/plugin.json). // Observed on Cursor 3.18.25 (docs/audits/2026-09-03-agent-plugins-cursor-ide-proof.md): the loader spawns their // stdio servers without expanding ${PLUGIN_ROOT}/${PLUGIN_DATA} in args, env values or cwd, without providing @@ -408,7 +397,6 @@ const receiptFor = (tree, options = {}) => { registrations: options.registrations ?? [{ kind: 'cursor-local-plugin' }], scope: 'user', ...(options.state === undefined ? {} : { state: options.state }), - ...(options.stateRoot === undefined ? {} : { stateRoot: options.stateRoot }), updatedAt: now, version: pluginVersion, ...(options.webDataRoot === undefined ? {} : { webDataRoot: options.webDataRoot }), @@ -585,8 +573,8 @@ const ensureAncestors = async (file, created) => { } }; -// Unowned entries under root that survive the uninstall, POSIX-relative: files that are neither owned nor runtime state -// (symlinks listed, never followed) plus unowned directories holding nothing retained (`name/`), which the prune never touches. +// Unowned entries under root that survive the uninstall, POSIX-relative: files that are not owned (symlinks listed, +// never followed) plus unowned directories holding nothing retained (`name/`), which the prune never touches. const listRetained = async (root, owned, ownedDirectories) => { const retained = []; const visit = async (relativePath) => { @@ -596,7 +584,7 @@ const listRetained = async (root, owned, ownedDirectories) => { let kept = 0; for (const name of entries) { const child = relativePath === '' ? name : `${relativePath}/${name}`; - if (relativePath === '' && (name === receiptFile || isPreservedRoot(name))) continue; + if (relativePath === '' && name === receiptFile) continue; const metadata = await lstat(join(root, child)); if (metadata.isDirectory() && !metadata.isSymbolicLink()) { const below = await visit(child); @@ -659,7 +647,7 @@ const runtimeStateRoots = async () => { const webCanonical = resolve(destination); const webDigest = createHash('sha256').update(webCanonical).digest('hex').slice(0, 16); const webName = /^[a-zA-Z0-9](?:[a-zA-Z0-9._-]*[a-zA-Z0-9])?$/u.test(basename(webCanonical)) ? basename(webCanonical) : 'plugin'; - return [explicitStateRoot ?? join(stateHome, segment), join(canonical, 'state'), join(homedir(), '.agent-bundle', 'web-data', `${webName}-${webDigest}`), explicitStateRoot === undefined ? 'derived' : 'native']; + return [explicitStateRoot ?? join(stateHome, segment), join(homedir(), '.agent-bundle', 'web-data', `${webName}-${webDigest}`)]; }; if (uninstall && mode === 'local') { @@ -668,48 +656,29 @@ if (uninstall && mode === 'local') { const destinationMetadata = await lstat(destination); if (destinationMetadata.isSymbolicLink() || !destinationMetadata.isDirectory()) throw unsupported('.'); const receipt = await readReceipt(destination); - let owned; - let ownedDirectories; - let hostDirectories; - let receiptStatus; if (receipt === undefined) { - // No receipt: only a legacy layout (emitted install surface + manifest naming this plugin) may go, under --force. const manifest = await readManifest(destination); - const legacy = manifest?.name === pluginName && await hasMarkers(destination); - if (!legacy) { - throw new Error(`Refusing to uninstall foreign directory ${destination}: it carries no install receipt and is not a ` + - `recognizable agent-bundle install of ${pluginName}${manifest === undefined ? " (no loader manifest)" : ` (manifest names ${JSON.stringify(manifest.name)})`}. ` + - 'Remove it manually if it is stale; --force does not apply to foreign directories.'); - } + throw new Error(`Refusing to uninstall foreign directory ${destination}: it carries no install receipt naming ${pluginName}` + + `${manifest === undefined ? " (no loader manifest)" : ` (manifest names ${JSON.stringify(manifest.name)})`}. ` + + 'Remove it manually if it is stale; --force does not apply to foreign directories.'); + } + if (receipt.plugin !== pluginName) { + throw new Error(`Refusing to uninstall ${destination}: its install receipt names plugin ${JSON.stringify(receipt.plugin)}, not ` + + `${JSON.stringify(pluginName)}. Uninstall that plugin from its own bundle instead; --force does not apply.`); + } + const installedHash = await hashOwned(destination, receipt.files); + let receiptStatus = 'consumed'; + if (installedHash !== receipt.contentHash) { if (!force) { - throw new Error(`Refusing to uninstall ${destination} without an install receipt: this copy predates install receipts, so ownership ` + - 'cannot be proven. Re-run with --force to remove its inventoried plugin files (runtime state under state/ is kept unless ' + - '--purge-data --confirm-purge is passed), or reinstall with --replace first to adopt it.'); + throw new Error(`Refusing to uninstall ${destination}: the owned files hash ${short(installedHash)} but the receipt recorded ` + + `${short(receipt.contentHash)}, so the installed copy was modified after installation. Re-run with --force to remove the ` + + 'receipt-owned files anyway (unowned entries are never removed).'); } - const tree = await inventory(destination); - owned = tree.files; - ownedDirectories = directoriesOf(tree.files); - hostDirectories = []; - receiptStatus = 'forced-legacy'; - } else { - if (receipt.plugin !== pluginName) { - throw new Error(`Refusing to uninstall ${destination}: its install receipt names plugin ${JSON.stringify(receipt.plugin)}, not ` + - `${JSON.stringify(pluginName)}. Uninstall that plugin from its own bundle instead; --force does not apply.`); - } - const installedHash = await hashOwned(destination, receipt.files); - receiptStatus = receipt.migratedFrom === undefined ? 'consumed' : 'migrated'; - if (installedHash !== receipt.contentHash) { - if (!force) { - throw new Error(`Refusing to uninstall ${destination}: the owned files hash ${short(installedHash)} but the receipt recorded ` + - `${short(receipt.contentHash)}, so the installed copy was modified after installation. Re-run with --force to remove the ` + - 'receipt-owned files anyway (unowned entries are never removed).'); - } - receiptStatus = 'forced-mismatch'; - } - owned = receipt.files; - ownedDirectories = receipt.directories; - hostDirectories = receipt.hostDirectories; + receiptStatus = 'forced-mismatch'; } + const owned = receipt.files; + const ownedDirectories = receipt.directories; + const hostDirectories = receipt.hostDirectories; // A symlinked ancestor would let a leaf-only delete reach outside the plugin root: refused before any change. await assertRealAncestors(destination, owned); const files = []; @@ -720,13 +689,13 @@ if (uninstall && mode === 'local') { if (metadata.isSymbolicLink() || !metadata.isFile()) throw unsupported(file); files.push(path); } - if (await exists(join(destination, receiptFile))) files.push(join(destination, receiptFile)); - const [resolvedStateDirectory, stateDirectory, resolvedWebDataDirectory, resolvedStateSource] = await runtimeStateRoots(); + files.push(join(destination, receiptFile)); + const [resolvedStateDirectory, resolvedWebDataDirectory] = await runtimeStateRoots(); const retainedState = []; const ownedStatePaths = []; const emptyOwnedStateFiles = []; const emptyOwnedStateRoots = []; - if (receipt?.state !== undefined) { + if (receipt.state !== undefined) { for (const root of receipt.state.roots) { let metadata; try { metadata = await lstat(root.root); } catch (error) { if (error?.code === 'ENOENT') continue; throw error; } @@ -751,35 +720,25 @@ if (uninstall && mode === 'local') { ownedStatePaths.push(root.root); } } else { - const fallbackStateDirectory = receipt?.stateRoot?.root ?? resolvedStateDirectory; - const fallbackStateSource = receipt?.stateRoot?.source ?? resolvedStateSource; + // A receipt without a state block was written between the two receipt writes of an install: the observed root + // is real but unproven, so it is retained until a reinstall records ownership. let metadata; - try { metadata = await lstat(fallbackStateDirectory); } catch (error) { if (error?.code !== 'ENOENT') throw error; } - if (metadata?.isDirectory()) { - if (receipt?.stateRoot?.root === fallbackStateDirectory && fallbackStateSource === 'derived') ownedStatePaths.push(fallbackStateDirectory); - else retainedState.push({ path: fallbackStateDirectory, reason: 'unproven' }); - } + try { metadata = await lstat(resolvedStateDirectory); } catch (error) { if (error?.code !== 'ENOENT') throw error; } + if (metadata?.isDirectory()) retainedState.push({ path: resolvedStateDirectory, reason: 'unproven' }); } - const webDataDirectory = receipt?.webDataRoot ?? resolvedWebDataDirectory; - const externalDataPaths = [...ownedStatePaths]; - for (const path of [webDataDirectory]) { - if (path === stateDirectory) continue; - let metadata; - try { metadata = await lstat(path); } catch (error) { if (error?.code === 'ENOENT') continue; throw error; } - if (metadata.isSymbolicLink() || !metadata.isDirectory()) throw unsupported(path); - externalDataPaths.push(path); + const webDataDirectory = receipt.webDataRoot ?? resolvedWebDataDirectory; + const dataPaths = [...ownedStatePaths]; + let webDataMetadata; + try { webDataMetadata = await lstat(webDataDirectory); } catch (error) { if (error?.code !== 'ENOENT') throw error; } + if (webDataMetadata !== undefined) { + if (webDataMetadata.isSymbolicLink() || !webDataMetadata.isDirectory()) throw unsupported(webDataDirectory); + dataPaths.push(webDataDirectory); } - let stateMetadata; - try { stateMetadata = await lstat(stateDirectory); } catch (error) { if (error?.code !== 'ENOENT') throw error; } - if (stateMetadata !== undefined && (stateMetadata.isSymbolicLink() || !stateMetadata.isDirectory())) throw unsupported('state'); - // A state/ holding nothing is not durable state: pruned like an installer-created directory instead of kept as a remnant. - const emptyState = stateMetadata !== undefined && (await readdir(stateDirectory)).length === 0 ? stateDirectory : undefined; - const dataPaths = [...externalDataPaths, ...(stateMetadata === undefined || emptyState !== undefined ? [] : [stateDirectory])]; - const dataKinds = [...externalDataPaths.map((path) => ownedStatePaths.includes(path) ? `owned framework state root ${path}` : `web-data directory ${path}`), ...(stateMetadata === undefined || emptyState !== undefined ? [] : ['legacy state/ (state kernel, notices journal)'])]; + const dataKinds = dataPaths.map((path) => ownedStatePaths.includes(path) ? `owned framework state root ${path}` : `web-data directory ${path}`); // The receipt's cursorExpansion records the PLUGIN_DATA directory this installer created for the copy (spec 9.1). Only // the directory at this home's own plugin-data location is receipt-owned; a written one is durable state (kept or - // purged like state/), an empty one is an installer-created directory that is pruned, a recorded path elsewhere is left alone. - const recordedPluginData = receipt?.cursorExpansion?.pluginData; + // purged like an owned state root), an empty one is an installer-created directory that is pruned, a recorded path elsewhere is left alone. + const recordedPluginData = receipt.cursorExpansion?.pluginData; const pluginDataRecorded = recordedPluginData === pluginData; let emptyPluginData; let foreignNote = ""; @@ -803,30 +762,29 @@ if (uninstall && mode === 'local') { const retainedStateNote = retainedState.length === 0 ? '' : ` Retained ${retainedState.map((entry) => `${entry.path} (${entry.reason})`).join(', ')} because the receipt does not prove exclusive ownership.`; const dataOutcome = dataPaths.length === 0 ? retainedState.length === 0 ? 'absent' : 'kept' : purgeData ? 'purged' : 'kept'; const dataDetail = dataPaths.length === 0 && retainedState.length === 0 - ? `No durable runtime state exists (${emptyState === undefined ? 'no state/ under the installed plugin root' : 'state/ under the installed plugin root is empty and is pruned'}${emptyPluginData === undefined ? '' : `; the installer-created PLUGIN_DATA directory ${emptyPluginData} is empty and is pruned`}).${foreignNote}` + ? `No durable runtime state exists${emptyPluginData === undefined ? '' : ` (the installer-created PLUGIN_DATA directory ${emptyPluginData} is empty and is pruned)`}.${foreignNote}` : purgeData ? `${dataPaths.length === 0 ? 'No owned durable runtime state is removed.' : `Durable runtime state — ${dataKinds.join(' and ')} — is removed (--purge-data --confirm-purge).`}${retainedStateNote}${foreignNote}` : `Durable runtime state${dataKinds.length === 0 ? '' : ` — ${dataKinds.join(' and ')}`} — is kept; pass --purge-data --confirm-purge to remove owned roots.${retainedStateNote}${foreignNote}`; // External state kept by --keep-data needs the remnant receipt and recorded ownership so a later purge // removes the same root even though no plugin content remains. - const keepRoot = !purgeData && [...dataPaths, ...retainedState.map((entry) => entry.path)].some((path) => path !== stateDirectory); + const keepRoot = !purgeData && (dataPaths.length > 0 || retainedState.length > 0); const directories = [ ...ownedDirectories.map((directory) => join(destination, directory)), ...(keepRoot ? [] : [destination]), ...hostDirectories.map((directory) => join(cursorRoot, directory)), ...(emptyPluginData === undefined ? [] : [emptyPluginData]), - ...(emptyState === undefined ? [] : [emptyState]), ...(pluginDataRecorded ? [join(cursorRoot, 'agent-bundle', 'plugin-data'), join(cursorRoot, 'agent-bundle')] : []), ...emptyOwnedStateRoots, ].sort((left, right) => right.length - left.length || left.localeCompare(right)); files.push(...emptyOwnedStateFiles); const ownedSet = new Set(owned); const ownedDirectorySet = new Set(ownedDirectories); - const remnantOnly = receipt !== undefined && receipt.files.length === 0 && receipt.registrations.length === 0; + const remnantOnly = receipt.files.length === 0 && receipt.registrations.length === 0; const purging = purgeData && dataPaths.length > 0; // A keep-data rerun over a remnant whose preserved data (or retained unowned entries) are still there is the documented - // no-op. Once state/ and the PLUGIN_DATA directory are gone or emptied by hand the remnant guards nothing, and the rerun - // consumes it (receipt, empty plugin root, the host and plugin-data directories it recorded) like an explicit purge would. + // no-op. Once the recorded roots and the PLUGIN_DATA directory are gone or emptied by hand the remnant guards nothing, and + // the rerun consumes it (receipt, empty plugin root, the host and plugin-data directories it recorded) like an explicit purge would. const remnantGuards = dataPaths.length > 0 || retainedState.length > 0 || (await listRetained(destination, ownedSet, ownedDirectorySet)).length > 0; if (remnantOnly && !purgeData && remnantGuards && files.length === 1 && files[0] === join(destination, receiptFile)) { // A rerun over what an earlier --keep-data uninstall left behind, still keeping the data: nothing to remove, so the @@ -879,9 +837,9 @@ if (uninstall && mode === 'local') { // created host directories receipt-owned for a later purge and lets Doctor explain the directory; a reinstall fills it in. await writeReceiptFile(join(destination, receiptFile), receiptFor({ files: [], hash: createHash('sha256').digest('hex') }, { // A kept PLUGIN_DATA directory stays receipt-owned through the remnant's expansion record. - ...(keepRoot && receipt?.cursorExpansion !== undefined ? { cursorExpansion: receipt.cursorExpansion } : {}), - directories: [], hostDirectories, installedAt: receipt?.installedAt, registrations: [], - ...(receipt?.state === undefined ? {} : { state: receipt.state }), + ...(keepRoot && receipt.cursorExpansion !== undefined ? { cursorExpansion: receipt.cursorExpansion } : {}), + directories: [], hostDirectories, installedAt: receipt.installedAt, registrations: [], + ...(receipt.state === undefined ? {} : { state: receipt.state }), ...(keepRoot ? { webDataRoot: webDataDirectory } : {}), })); console.log(`Remnant receipt: ${join(destination, receiptFile)} — owns no files; keeps the created host directories receipt-owned for a later purge.`); @@ -900,7 +858,7 @@ if (uninstall && mode === 'marketplace') { console.log(`Not installed ${pluginName}@${pluginVersion} for cursor (marketplace mode) at ${marketplaceRepo}`); process.exit(0); } - let receiptStatus = receipt === undefined ? 'forced-missing' : receipt.migratedFrom === undefined ? 'consumed' : 'migrated'; + let receiptStatus = receipt === undefined ? 'forced-missing' : 'consumed'; const recorded = receipt?.registrations.find((registration) => registration.kind === 'cursor-marketplace-staging'); if (repoExists) { if (receipt === undefined) { @@ -1191,18 +1149,15 @@ const receipt = await readReceipt(destination); const manifest = await readManifest(destination); let ownership; let installedHash; -// --uninstall --keep-data leaves a shell holding only state/: a reinstall fills it back in around the preserved -// durable state instead of refusing it as foreign (nothing in it is anyone's plugin content). -const remnantEntries = (await readdir(destination)).filter((name) => name !== receiptFile); -const stateOnlyRemnant = receipt === undefined - ? remnantEntries.length > 0 && remnantEntries.every(isPreservedRoot) - : receipt.plugin === pluginName && receipt.files.length === 0 && receipt.registrations.length === 0; // remnant receipt from --uninstall --keep-data +// --uninstall --keep-data leaves a remnant receipt owning no files around the preserved durable state: a reinstall +// fills the shell back in instead of refusing it. +const remnant = receipt !== undefined && receipt.plugin === pluginName && receipt.files.length === 0 && receipt.registrations.length === 0; if (receipt !== undefined && receipt.plugin === pluginName) { ownership = 'receipt'; installedHash = await hashOwned(destination, receipt.files); } else { installedHash = (await inventory(destination)).hash; - ownership = stateOnlyRemnant || (receipt === undefined && manifest?.name === pluginName && await hasMarkers(destination)) ? 'legacy' : 'foreign'; + ownership = 'foreign'; } const installedVersion = manifest?.version ?? (ownership === 'receipt' ? receipt.version : undefined); const installedName = manifest?.name ?? (ownership === 'receipt' ? receipt.plugin : pluginName); @@ -1223,52 +1178,22 @@ if (ownership === 'foreign') { const inventoryMatches = ownership !== 'receipt' || (receipt.files.length === artifact.files.length && receipt.files.every((file, index) => file === artifact.files[index])); if (installedHash === artifact.hash && inventoryMatches) { - if (ownership === 'legacy' && replace) { - // Byte-identical pre-receipt copy: adoption only writes the receipt (adoption created no directories), - // through an exclusively created random sibling so no existing file or link is followed or overwritten. - await writeReceiptFile(join(destination, receiptFile), receiptFor(artifact, { directories: [], hostDirectories: [] })); - await attachStateOwnership(); - console.log(`Adopted ${pluginName}@${pluginVersion} at ${destination} (content ${short(artifact.hash)})`); - reportExpansion(); - process.exit(0); - } - if (ownership === 'receipt' && receipt.migratedFrom !== undefined) { - // An identical receipt-managed copy whose receipt predates the current format is upgraded in place: - // lifecycle fields exactly as the reader synthesized them, and nothing else changes. - await writeReceiptFile(join(destination, receiptFile), receiptFor(artifact, { - directories: receipt.directories, hostDirectories: receipt.hostDirectories, installedAt: receipt.installedAt, - })); - } - if (ownership === 'receipt' && receipt.state === undefined) await attachStateOwnership(); + if (receipt.state === undefined) await attachStateOwnership(); console.log(`Already installed ${pluginName}@${pluginVersion} at ${destination} (content ${short(artifact.hash)})`); process.exit(0); } if (installedVersion !== undefined && installedVersion !== pluginVersion && !replace) { throw new Error(`Refusing version collision at ${destination}: ${detail}. Re-run with --replace to replace this agent-bundle install.`); } -if (ownership === 'legacy' && !replace && !stateOnlyRemnant) { - throw new Error(`Refusing content collision at ${destination}: ${detail}; this copy predates install receipts. ` + - 'Re-run with --replace once to adopt it; later same-version rebuilds replace automatically.'); -} // Owned-files-only replacement: stale owned files leave first, staged files rename over their // predecessors, and the receipt lands last as the commit marker. Unowned entries (runtime state) stay. const staged = await stage(artifact); try { - // A legacy copy has no inventory: only files the new artifact also ships count as owned; everything - // else (operator files, stale artifact files, runtime state) stays in place and remains unowned. const incoming = new Set(staged.inventory.files); - let owned; - if (ownership === 'receipt') { - owned = receipt.files; - } else { - owned = []; - for (const file of (await inventory(destination)).files) { - if (await isOwnedEntry(destination, incoming, file)) owned.push(file); - } - } + const owned = receipt.files; const ownedSet = new Set(owned); - const ownedDirectories = new Set(ownership === 'receipt' ? receipt.directories : []); + const ownedDirectories = new Set(receipt.directories); await assertRealAncestors(destination, owned); await assertRealAncestors(destination, staged.inventory.files, ownedSet); // An existing directory at an incoming file path is fine only when it is wholly owned: it and every @@ -1318,13 +1243,12 @@ try { // ones this replacement created; the first install time and the host directories it created carry // over. Finalised in the private staging copy, then committed by rename. const directories = sortNames(new Set([...[...ownedDirectories].filter((directory) => !pruned.has(directory)), ...created])); - const previous = ownership === 'receipt' ? receipt : undefined; await writeFile(join(staged.root, receiptFile), receiptFor(staged.inventory, { - directories, hostDirectories: previous?.hostDirectories ?? [], installedAt: previous?.installedAt, + directories, hostDirectories: receipt.hostDirectories, installedAt: receipt.installedAt, }), 'utf8'); await rename(join(staged.root, receiptFile), join(destination, receiptFile)); - await attachStateOwnership(previous?.state); - if (stateOnlyRemnant) console.log(`Installed ${pluginName}@${pluginVersion} at ${destination} (content ${short(artifact.hash)})`); + await attachStateOwnership(receipt.state); + if (remnant) console.log(`Installed ${pluginName}@${pluginVersion} at ${destination} (content ${short(artifact.hash)})`); else console.log(`Replaced ${pluginName}@${pluginVersion} at ${destination} (content ${short(installedHash)} -> ${short(artifact.hash)})`); reportExpansion(); } finally { diff --git a/artifact/mcp/mcp-grok-bot-b8c2461e-flight.mjs b/artifact/mcp/mcp-grok-bot-b8c2461e-flight.mjs index 18536f7..23e24e9 100644 --- a/artifact/mcp/mcp-grok-bot-b8c2461e-flight.mjs +++ b/artifact/mcp/mcp-grok-bot-b8c2461e-flight.mjs @@ -14077,9 +14077,9 @@ const resultSchema = zod__rspack_import_4/* .union */.KCZ([ const context = await (0,_agent_bundle_runtime__rspack_import_5/* .agent */.MA)(); if (input.replyToGrok || input.bindingId) { const out = await (0,_core_relay_routes_js__rspack_import_3/* .codexReturnOperation */.lt)(input, context); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Text */.g.Text, { children: `Delivery ${out.delivery}; terminal answer returns to Grok automatically.` }) }); @@ -14090,9 +14090,9 @@ const resultSchema = zod__rspack_import_4/* .union */.KCZ([ }, context.signal, (message)=>context.progress.report({ message })); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Text */.g.Text, { children: (0,_core_codex_routes_js__rspack_import_2/* .resultText */.D6)(out) }) }); @@ -14149,9 +14149,9 @@ __webpack_require__.r(__webpack_exports__); }, async (input)=>{ const context = await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)(); const out = await (0,_core_codex_routes_js__rspack_import_2/* .threadsOperation */.$c)(input); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: (0,_core_codex_routes_js__rspack_import_2/* .resultText */.D6)(out) }) }); @@ -14226,9 +14226,9 @@ __webpack_require__.r(__webpack_exports__); const out = await (0,_core_codex_routes_js__rspack_import_2/* .observeOperation */.gT)('wait', input, context.signal, (message)=>context.progress.report({ message })); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: (0,_core_codex_routes_js__rspack_import_2/* .resultText */.D6)(out) }) }); @@ -14296,9 +14296,9 @@ __webpack_require__.r(__webpack_exports__); const out = await (0,_core_codex_routes_js__rspack_import_2/* .observeOperation */.gT)('watch', input, context.signal, (message)=>context.progress.report({ message })); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: (0,_core_codex_routes_js__rspack_import_2/* .resultText */.D6)(out) }) }); @@ -14362,9 +14362,9 @@ __webpack_require__.r(__webpack_exports__); } }, async (input)=>{ const out = await (0,_core_relay_routes_js__rspack_import_2/* .bridgeOperation */.n1)('startBinding', input, await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)()); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -14412,9 +14412,9 @@ __webpack_require__.r(__webpack_exports__); } }, async (input)=>{ const out = await (0,_core_relay_routes_js__rspack_import_2/* .bridgeOperation */.n1)('status', input, await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)()); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -14465,9 +14465,9 @@ __webpack_require__.r(__webpack_exports__); } }, async (input)=>{ const out = await (0,_core_relay_routes_js__rspack_import_2/* .bridgeOperation */.n1)('stop', input, await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)()); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -14548,9 +14548,9 @@ __webpack_require__.r(__webpack_exports__); } }, async (input)=>{ const out = await (0,_core_relay_routes_js__rspack_import_2/* .bridgeOperation */.n1)('respond', input, await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)()); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -14602,9 +14602,9 @@ __webpack_require__.r(__webpack_exports__); } }, async (input)=>{ const out = await (0,_core_grok_approval_routes_js__rspack_import_2/* .listOperation */.gi)(input); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -14672,9 +14672,9 @@ __webpack_require__.r(__webpack_exports__); } }, async (input)=>{ const out = await (0,_core_grok_approval_routes_js__rspack_import_2/* .respondOperation */.lr)(input); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -14757,9 +14757,9 @@ __webpack_require__.r(__webpack_exports__); } }, async (input)=>{ const out = await (0,_core_relay_routes_js__rspack_import_2/* .grokSendOperation */.bv)(input, await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)()); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: out.replyRoute.mode === 'auto' ? `Delivery ${out.delivery}; replies will arrive in Codex thread ${out.replyRoute.threadId}. Continue work; no polling needed.` : `Delivery ${out.delivery}${out.delivery === 'unknown' ? ' (no receipt; check the thread before resending)' : ''}; read the reply with gbot_thread.` }) }); @@ -14856,9 +14856,9 @@ const inputSchema = zod__rspack_import_3/* .object */.Ikc({ summary }; if (!full) { - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: receipt, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: summary }) }); @@ -14867,9 +14867,9 @@ const inputSchema = zod__rspack_import_3/* .object */.Ikc({ ...receipt, entries }; - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: value, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: summary }) }); @@ -15281,50 +15281,11 @@ const Agent = Object.freeze({ Result: AgentResult, Text: AgentText }); -const Result = ({ children })=>createElement('agent-hook-result', null, children); -const AdditionalContext = ({ children })=>createElement('agent-hook-additional-context', null, children); -const Hook = (/* unused pure expression or super */ null && ({ - AdditionalContext: AdditionalContext, - Result: Result -})); -const McpResult = ({ _meta, children, isError, structuredContent })=>createElement('mcp-result', { - _meta, - isError, - structuredContent - }, children); -const McpText = ({ children })=>createElement('mcp-text', null, children); -const McpImage = ({ data, mimeType })=>createElement('mcp-image', { - data, - mimeType - }); -const McpAudio = ({ data, mimeType })=>createElement('mcp-audio', { - data, - mimeType - }); -const McpResourceLink = ({ mimeType, name, uri })=>createElement('mcp-resource-link', { - mimeType, - name, - uri - }); -const McpEmbeddedResource = ({ blob, children, mimeType, text, uri })=>createElement('mcp-embedded-resource', { - blob, - mimeType, - text, - uri - }, children); -const Mcp = (/* unused pure expression or super */ null && ({ - Audio: McpAudio, - EmbeddedResource: McpEmbeddedResource, - Image: McpImage, - ResourceLink: McpResourceLink, - Result: McpResult, - Text: McpText -})); __webpack_require__.d(__webpack_exports__, { }, { - g6: Agent + g: Agent }); @@ -30548,47 +30509,47 @@ var __webpack_exports__ = {}; /* import */ var _agent_bundle_runtime__rspack_import_16 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js"); /* import */ var _agent_bundle_runtime__rspack_import_17 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js"); /* import */ var node_url__rspack_import_2 = __webpack_require__("node:url"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_send_tsx__rspack_import_3 = __webpack_require__("./src/mcp/grok-bot/tools/codex_send.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_threads_tsx__rspack_import_4 = __webpack_require__("./src/mcp/grok-bot/tools/codex_threads.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_wait_tsx__rspack_import_5 = __webpack_require__("./src/mcp/grok-bot/tools/codex_wait.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_watch_tsx__rspack_import_6 = __webpack_require__("./src/mcp/grok-bot/tools/codex_watch.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_bridge_start_tsx__rspack_import_7 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_bridge_start.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_bridge_status_tsx__rspack_import_8 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_bridge_status.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_bridge_stop_tsx__rspack_import_9 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_bridge_stop.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_codex_respond_tsx__rspack_import_10 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_codex_respond.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_grok_approvals_tsx__rspack_import_11 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_grok_approvals.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_grok_respond_tsx__rspack_import_12 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_grok_respond.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_send_tsx__rspack_import_13 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_send.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_thread_tsx__rspack_import_14 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_thread.tsx"); +/* import */ var _src_mcp_grok_bot_tools_codex_send_tsx__rspack_import_3 = __webpack_require__("./src/mcp/grok-bot/tools/codex_send.tsx"); +/* import */ var _src_mcp_grok_bot_tools_codex_threads_tsx__rspack_import_4 = __webpack_require__("./src/mcp/grok-bot/tools/codex_threads.tsx"); +/* import */ var _src_mcp_grok_bot_tools_codex_wait_tsx__rspack_import_5 = __webpack_require__("./src/mcp/grok-bot/tools/codex_wait.tsx"); +/* import */ var _src_mcp_grok_bot_tools_codex_watch_tsx__rspack_import_6 = __webpack_require__("./src/mcp/grok-bot/tools/codex_watch.tsx"); +/* import */ var _src_mcp_grok_bot_tools_gbot_bridge_start_tsx__rspack_import_7 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_bridge_start.tsx"); +/* import */ var _src_mcp_grok_bot_tools_gbot_bridge_status_tsx__rspack_import_8 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_bridge_status.tsx"); +/* import */ var _src_mcp_grok_bot_tools_gbot_bridge_stop_tsx__rspack_import_9 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_bridge_stop.tsx"); +/* import */ var _src_mcp_grok_bot_tools_gbot_codex_respond_tsx__rspack_import_10 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_codex_respond.tsx"); +/* import */ var _src_mcp_grok_bot_tools_gbot_grok_approvals_tsx__rspack_import_11 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_grok_approvals.tsx"); +/* import */ var _src_mcp_grok_bot_tools_gbot_grok_respond_tsx__rspack_import_12 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_grok_respond.tsx"); +/* import */ var _src_mcp_grok_bot_tools_gbot_send_tsx__rspack_import_13 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_send.tsx"); +/* import */ var _src_mcp_grok_bot_tools_gbot_thread_tsx__rspack_import_14 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_thread.tsx"); -const route0 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_send_tsx__rspack_import_3, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_send_tsx__rspack_import_3); +const route0 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_codex_send_tsx__rspack_import_3, 'default'), _src_mcp_grok_bot_tools_codex_send_tsx__rspack_import_3); -const route1 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_threads_tsx__rspack_import_4, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_threads_tsx__rspack_import_4); +const route1 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_codex_threads_tsx__rspack_import_4, 'default'), _src_mcp_grok_bot_tools_codex_threads_tsx__rspack_import_4); -const route2 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_wait_tsx__rspack_import_5, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_wait_tsx__rspack_import_5); +const route2 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_codex_wait_tsx__rspack_import_5, 'default'), _src_mcp_grok_bot_tools_codex_wait_tsx__rspack_import_5); -const route3 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_watch_tsx__rspack_import_6, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_watch_tsx__rspack_import_6); +const route3 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_codex_watch_tsx__rspack_import_6, 'default'), _src_mcp_grok_bot_tools_codex_watch_tsx__rspack_import_6); -const route4 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_bridge_start_tsx__rspack_import_7, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_bridge_start_tsx__rspack_import_7); +const route4 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_gbot_bridge_start_tsx__rspack_import_7, 'default'), _src_mcp_grok_bot_tools_gbot_bridge_start_tsx__rspack_import_7); -const route5 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_bridge_status_tsx__rspack_import_8, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_bridge_status_tsx__rspack_import_8); +const route5 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_gbot_bridge_status_tsx__rspack_import_8, 'default'), _src_mcp_grok_bot_tools_gbot_bridge_status_tsx__rspack_import_8); -const route6 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_bridge_stop_tsx__rspack_import_9, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_bridge_stop_tsx__rspack_import_9); +const route6 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_gbot_bridge_stop_tsx__rspack_import_9, 'default'), _src_mcp_grok_bot_tools_gbot_bridge_stop_tsx__rspack_import_9); -const route7 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_codex_respond_tsx__rspack_import_10, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_codex_respond_tsx__rspack_import_10); +const route7 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_gbot_codex_respond_tsx__rspack_import_10, 'default'), _src_mcp_grok_bot_tools_gbot_codex_respond_tsx__rspack_import_10); -const route8 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_grok_approvals_tsx__rspack_import_11, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_grok_approvals_tsx__rspack_import_11); +const route8 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_gbot_grok_approvals_tsx__rspack_import_11, 'default'), _src_mcp_grok_bot_tools_gbot_grok_approvals_tsx__rspack_import_11); -const route9 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_grok_respond_tsx__rspack_import_12, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_grok_respond_tsx__rspack_import_12); +const route9 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_gbot_grok_respond_tsx__rspack_import_12, 'default'), _src_mcp_grok_bot_tools_gbot_grok_respond_tsx__rspack_import_12); -const route10 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_send_tsx__rspack_import_13, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_send_tsx__rspack_import_13); +const route10 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_gbot_send_tsx__rspack_import_13, 'default'), _src_mcp_grok_bot_tools_gbot_send_tsx__rspack_import_13); -const route11 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_thread_tsx__rspack_import_14, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_thread_tsx__rspack_import_14); +const route11 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_gbot_thread_tsx__rspack_import_14, 'default'), _src_mcp_grok_bot_tools_gbot_thread_tsx__rspack_import_14); // Generated routes contain only intrinsic Agent protocol elements, so no client references exist. globalThis.__rspack_rsc_manifest__ ??= Object.freeze({ clientManifest: Object.freeze({}) @@ -31265,7 +31226,7 @@ const render = async (message)=>{ type: 'observed-render-start' }); const renderStartedAt = performance.now(); - const element = validationError === undefined ? composeLayouts(observedRoute, props, controller.signal) : /*#__PURE__*/ (0,react__rspack_import_1.createElement)(_agent_bundle_runtime__rspack_import_17/* .Agent.Result */.g6.Result, null, /*#__PURE__*/ (0,react__rspack_import_1.createElement)(_agent_bundle_runtime__rspack_import_17/* .Agent.Error */.g6.Error, { + const element = validationError === undefined ? composeLayouts(observedRoute, props, controller.signal) : /*#__PURE__*/ (0,react__rspack_import_1.createElement)(_agent_bundle_runtime__rspack_import_17/* .Agent.Result */.g.Result, null, /*#__PURE__*/ (0,react__rspack_import_1.createElement)(_agent_bundle_runtime__rspack_import_17/* .Agent.Error */.g.Error, { code: 'invalid-input' }, `Input validation error: ${validationError instanceof Error ? validationError.message : String(validationError)}`)); const flight = (0,_agent_bundle_runtime_flight_server__rspack_import_18/* .renderAgentFlight */.y)(element, { diff --git a/artifact/mcp/mcp-grok-bot-b8c2461e.mjs b/artifact/mcp/mcp-grok-bot-b8c2461e.mjs index e270f58..d1b2f32 100644 --- a/artifact/mcp/mcp-grok-bot-b8c2461e.mjs +++ b/artifact/mcp/mcp-grok-bot-b8c2461e.mjs @@ -11648,9 +11648,9 @@ const resultSchema = zod__rspack_import_4/* .union */.KCZ([ const context = await (0,_agent_bundle_runtime__rspack_import_5/* .agent */.MA)(); if (input.replyToGrok || input.bindingId) { const out = await (0,_core_relay_routes_js__rspack_import_3/* .codexReturnOperation */.lt)(input, context); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Text */.g.Text, { children: `Delivery ${out.delivery}; terminal answer returns to Grok automatically.` }) }); @@ -11661,9 +11661,9 @@ const resultSchema = zod__rspack_import_4/* .union */.KCZ([ }, context.signal, (message)=>context.progress.report({ message })); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Text */.g.Text, { children: (0,_core_codex_routes_js__rspack_import_2/* .resultText */.D6)(out) }) }); @@ -11720,9 +11720,9 @@ __webpack_require__.r(__webpack_exports__); }, async (input)=>{ const context = await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)(); const out = await (0,_core_codex_routes_js__rspack_import_2/* .threadsOperation */.$c)(input); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: (0,_core_codex_routes_js__rspack_import_2/* .resultText */.D6)(out) }) }); @@ -11797,9 +11797,9 @@ __webpack_require__.r(__webpack_exports__); const out = await (0,_core_codex_routes_js__rspack_import_2/* .observeOperation */.gT)('wait', input, context.signal, (message)=>context.progress.report({ message })); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: (0,_core_codex_routes_js__rspack_import_2/* .resultText */.D6)(out) }) }); @@ -11867,9 +11867,9 @@ __webpack_require__.r(__webpack_exports__); const out = await (0,_core_codex_routes_js__rspack_import_2/* .observeOperation */.gT)('watch', input, context.signal, (message)=>context.progress.report({ message })); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: (0,_core_codex_routes_js__rspack_import_2/* .resultText */.D6)(out) }) }); @@ -11933,9 +11933,9 @@ __webpack_require__.r(__webpack_exports__); } }, async (input)=>{ const out = await (0,_core_relay_routes_js__rspack_import_2/* .bridgeOperation */.n1)('startBinding', input, await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)()); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -11983,9 +11983,9 @@ __webpack_require__.r(__webpack_exports__); } }, async (input)=>{ const out = await (0,_core_relay_routes_js__rspack_import_2/* .bridgeOperation */.n1)('status', input, await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)()); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -12036,9 +12036,9 @@ __webpack_require__.r(__webpack_exports__); } }, async (input)=>{ const out = await (0,_core_relay_routes_js__rspack_import_2/* .bridgeOperation */.n1)('stop', input, await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)()); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -12119,9 +12119,9 @@ __webpack_require__.r(__webpack_exports__); } }, async (input)=>{ const out = await (0,_core_relay_routes_js__rspack_import_2/* .bridgeOperation */.n1)('respond', input, await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)()); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -12173,9 +12173,9 @@ __webpack_require__.r(__webpack_exports__); } }, async (input)=>{ const out = await (0,_core_grok_approval_routes_js__rspack_import_2/* .listOperation */.gi)(input); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -12243,9 +12243,9 @@ __webpack_require__.r(__webpack_exports__); } }, async (input)=>{ const out = await (0,_core_grok_approval_routes_js__rspack_import_2/* .respondOperation */.lr)(input); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, { children: JSON.stringify(out) }) }); @@ -12328,9 +12328,9 @@ __webpack_require__.r(__webpack_exports__); } }, async (input)=>{ const out = await (0,_core_relay_routes_js__rspack_import_2/* .grokSendOperation */.bv)(input, await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)()); - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: out, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: out.replyRoute.mode === 'auto' ? `Delivery ${out.delivery}; replies will arrive in Codex thread ${out.replyRoute.threadId}. Continue work; no polling needed.` : `Delivery ${out.delivery}${out.delivery === 'unknown' ? ' (no receipt; check the thread before resending)' : ''}; read the reply with gbot_thread.` }) }); @@ -12427,9 +12427,9 @@ const inputSchema = zod__rspack_import_3/* .object */.Ikc({ summary }; if (!full) { - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: receipt, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: summary }) }); @@ -12438,9 +12438,9 @@ const inputSchema = zod__rspack_import_3/* .object */.Ikc({ ...receipt, entries }; - return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, { + return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, { value: value, - children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, { + children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, { children: summary }) }); @@ -12538,28 +12538,7 @@ module.exports = __rspack_createRequire_require("util"); }, "./node_modules/@agent-bundle/runtime/dist/302.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) { /* import */ var node_buffer__rspack_import_0 = __webpack_require__("node:buffer"); -/* import */ var react__rspack_import_1 = __webpack_require__("./node_modules/react/index.js"); - -const isServerComponent = (value)=>'function' == typeof value; -const asMcpElement = (node)=>{ - let element = node; - while(isValidElement(element) && isServerComponent(element.type))element = element.type(element.props); - if (!isValidElement(element) || 'string' != typeof element.type || !element.type.startsWith('mcp-')) throw new Error('Expected an MCP result element'); - return { - props: element.props, - type: element.type - }; -}; -const requiredString = (value, message)=>{ - if ('string' != typeof value || '' === value.trim()) throw new Error(message); - return value; -}; -const textChild = (children, message)=>{ - const values = Children.toArray(children); - if (1 !== values.length || 'string' != typeof values[0]) throw new Error(message); - return values[0]; -}; const jsonLeafBytes = (value)=>node_buffer__rspack_import_0.Buffer.byteLength(JSON.stringify(value), 'utf8'); const isArrayIndex = (key, length)=>{ if ('0' === key) return length > 0; @@ -12621,16 +12600,6 @@ const cloneJsonValue = (value, ancestors, path, depth = 0, budget)=>{ ancestors.delete(value); } }; -const jsonRecord = (value, message)=>{ - try { - if (null === value || 'object' != typeof value || Array.isArray(value)) throw new Error('not a plain object'); - return cloneJsonValue(value, new Set(), ''); - } catch (error) { - throw new Error(`${message} (${error instanceof Error ? error.message : String(error)})`, { - cause: error - }); - } -}; const deepFreezeJson = (value)=>{ if ('object' == typeof value && null !== value) { for (const child of Object.values(value))deepFreezeJson(child); @@ -12648,89 +12617,6 @@ const snapshotJsonValue = (value, message, budget)=>{ }); } }; -const lowerContent = (node)=>{ - const element = asMcpElement(node); - const { props } = element; - switch(element.type){ - case 'mcp-text': - return { - text: textChild(props.children, 'mcp-text requires one text child'), - type: 'text' - }; - case 'mcp-image': - return { - data: requiredString(props.data, 'mcp-image requires non-empty data and mimeType'), - mimeType: requiredString(props.mimeType, 'mcp-image requires non-empty data and mimeType'), - type: 'image' - }; - case 'mcp-audio': - return { - data: requiredString(props.data, 'mcp-audio requires non-empty data and mimeType'), - mimeType: requiredString(props.mimeType, 'mcp-audio requires non-empty data and mimeType'), - type: 'audio' - }; - case 'mcp-resource-link': - { - const mimeType = props.mimeType; - if (void 0 !== mimeType && 'string' != typeof mimeType) throw new Error('mcp-resource-link mimeType must be a string'); - return { - ...void 0 === mimeType ? {} : { - mimeType - }, - name: requiredString(props.name, 'mcp-resource-link requires non-empty uri and name'), - type: 'resource_link', - uri: requiredString(props.uri, 'mcp-resource-link requires non-empty uri and name') - }; - } - case 'mcp-embedded-resource': - { - const hasText = void 0 !== props.text; - const hasTextChild = void 0 !== props.children; - const hasBlob = void 0 !== props.blob; - if (Number(hasText) + Number(hasTextChild) + Number(hasBlob) !== 1) throw new Error('mcp-embedded-resource accepts exactly one text or blob value'); - const mimeType = props.mimeType; - if (void 0 !== mimeType && 'string' != typeof mimeType) throw new Error('mcp-embedded-resource mimeType must be a string'); - const resource = { - ...void 0 === mimeType ? {} : { - mimeType - }, - uri: requiredString(props.uri, 'mcp-embedded-resource requires a non-empty uri'), - ...hasBlob ? { - blob: requiredString(props.blob, 'mcp-embedded-resource blob must be non-empty') - } : { - text: hasTextChild ? textChild(props.children, 'mcp-embedded-resource requires one text child') : requiredString(props.text, 'mcp-embedded-resource text must be non-empty') - } - }; - return { - resource, - type: 'resource' - }; - } - case 'mcp-result': - throw new Error('mcp-result may not be nested'); - default: - throw new Error(`Unsupported MCP result element: ${element.type}`); - } -}; -const lowerMcpResult = (node)=>{ - const root = asMcpElement(node); - if ('mcp-result' !== root.type) throw new Error('Expected mcp-result as the root element'); - if (void 0 !== root.props.isError && 'boolean' != typeof root.props.isError) throw new Error('mcp-result isError must be a boolean'); - const structuredContent = root.props.structuredContent; - const metadata = root.props._meta; - return { - content: Children.toArray(root.props.children).map(lowerContent), - ...void 0 === metadata ? {} : { - _meta: jsonRecord(metadata, 'mcp-result _meta must be JSON-serializable') - }, - ...void 0 === structuredContent ? {} : { - structuredContent: jsonRecord(structuredContent, 'mcp-result structuredContent must be JSON-serializable') - }, - ...void 0 === root.props.isError ? {} : { - isError: root.props.isError - } - }; -}; const AGENT_DOCUMENT_VERSION = 1; const agentRenderAbortError = ()=>new DOMException('Agent render was aborted', 'AbortError'); const DEFAULT_AGENT_RENDER_LIMITS = Object.freeze({ @@ -12758,7 +12644,7 @@ const resolveAgentRenderLimits = (overrides = {})=>{ for (const [name, value] of Object.entries(limits))if (!Number.isSafeInteger(value) || value <= 0) throw new AgentContractError('invalid-document', `${name} must be a positive safe integer`); return Object.freeze(limits); }; -const agent_document_requiredString = (value, field)=>{ +const requiredString = (value, field)=>{ if ('string' != typeof value || '' === value.trim()) throw new AgentContractError('invalid-document', `${field} must be a non-empty string`); return value; }; @@ -12766,7 +12652,7 @@ const agent_document_text = (value, field)=>{ if ('string' != typeof value) throw new AgentContractError('invalid-document', `${field} must be a string`); return value; }; -const optionalString = (value, field)=>void 0 === value ? void 0 : agent_document_requiredString(value, field); +const optionalString = (value, field)=>void 0 === value ? void 0 : requiredString(value, field); const elapsedTimeExceeded = (maxElapsedMs)=>new AgentContractError('elapsed-time-exceeded', `Agent render elapsed time exceeds ${String(maxElapsedMs)}ms`); const expectDocumentDepth = (depth, limits)=>{ if (depth > limits.maxDocumentDepth) throw new AgentContractError('document-depth-exceeded', `Agent Document depth exceeds ${String(limits.maxDocumentDepth)}`); @@ -12864,15 +12750,15 @@ const snapshotNode = (node, depth, state)=>{ } case 'image': return Object.freeze({ - data: agent_document_requiredString(node.data, 'Agent image data'), + data: requiredString(node.data, 'Agent image data'), kind: 'image', - mimeType: agent_document_requiredString(node.mimeType, 'Agent image mimeType') + mimeType: requiredString(node.mimeType, 'Agent image mimeType') }); case 'audio': return Object.freeze({ - data: agent_document_requiredString(node.data, 'Agent audio data'), + data: requiredString(node.data, 'Agent audio data'), kind: 'audio', - mimeType: agent_document_requiredString(node.mimeType, 'Agent audio mimeType') + mimeType: requiredString(node.mimeType, 'Agent audio mimeType') }); case 'resource': { @@ -12882,13 +12768,13 @@ const snapshotNode = (node, depth, state)=>{ ...void 0 === mimeType ? {} : { mimeType }, - name: agent_document_requiredString(node.name, 'Agent resource name'), - uri: agent_document_requiredString(node.uri, 'Agent resource uri') + name: requiredString(node.name, 'Agent resource name'), + uri: requiredString(node.uri, 'Agent resource uri') }); } case 'error': return Object.freeze({ - code: agent_document_requiredString(node.code, 'Agent error code'), + code: requiredString(node.code, 'Agent error code'), kind: 'error', message: agent_document_text(node.message, 'Agent error message') }); @@ -12946,7 +12832,7 @@ const snapshotRenderError = (error, limits)=>{ nodes: 0 }); return Object.freeze({ - code: agent_document_requiredString(error.code, 'Agent render error code'), + code: requiredString(error.code, 'Agent render error code'), ...void 0 === data ? {} : { data }, @@ -12981,7 +12867,7 @@ const snapshotEvent = (input, sequence, limits)=>{ } case 'replace': return Object.freeze({ - boundaryId: agent_document_requiredString(input.boundaryId, 'Agent render boundaryId'), + boundaryId: requiredString(input.boundaryId, 'Agent render boundaryId'), document: createAgentDocument(input.document, limits), sequence, type: 'replace' @@ -13554,51 +13440,11 @@ const Agent = Object.freeze({ Result: AgentResult, Text: AgentText }); -const Result = ({ children })=>(0,react__rspack_import_0.createElement)('agent-hook-result', null, children); -const AdditionalContext = ({ children })=>(0,react__rspack_import_0.createElement)('agent-hook-additional-context', null, children); -const Hook = { - AdditionalContext: AdditionalContext, - Result: Result -}; -const McpResult = ({ _meta, children, isError, structuredContent })=>createElement('mcp-result', { - _meta, - isError, - structuredContent - }, children); -const McpText = ({ children })=>createElement('mcp-text', null, children); -const McpImage = ({ data, mimeType })=>createElement('mcp-image', { - data, - mimeType - }); -const McpAudio = ({ data, mimeType })=>createElement('mcp-audio', { - data, - mimeType - }); -const McpResourceLink = ({ mimeType, name, uri })=>createElement('mcp-resource-link', { - mimeType, - name, - uri - }); -const McpEmbeddedResource = ({ blob, children, mimeType, text, uri })=>createElement('mcp-embedded-resource', { - blob, - mimeType, - text, - uri - }, children); -const Mcp = (/* unused pure expression or super */ null && ({ - Audio: McpAudio, - EmbeddedResource: McpEmbeddedResource, - Image: McpImage, - ResourceLink: McpResourceLink, - Result: McpResult, - Text: McpText -})); __webpack_require__.d(__webpack_exports__, { }, { - g6: Agent, - qn: Hook + g: Agent }); @@ -14065,23 +13911,20 @@ __webpack_require__.d(__webpack_exports__, { }, "./node_modules/@agent-bundle/runtime/dist/index.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) { -/* import */ var effect__rspack_import_3 = __webpack_require__("./node_modules/effect/dist/Latch.js"); -/* import */ var effect__rspack_import_4 = __webpack_require__("./node_modules/effect/dist/Effect.js"); -/* import */ var effect__rspack_import_7 = __webpack_require__("./node_modules/effect/dist/Duration.js"); -/* import */ var effect__rspack_import_8 = __webpack_require__("./node_modules/effect/dist/Stream.js"); -/* import */ var effect__rspack_import_9 = __webpack_require__("./node_modules/effect/dist/Deferred.js"); -/* import */ var effect__rspack_import_10 = __webpack_require__("./node_modules/effect/dist/Queue.js"); -/* import */ var effect__rspack_import_11 = __webpack_require__("./node_modules/effect/dist/Option.js"); -/* import */ var effect__rspack_import_12 = __webpack_require__("./node_modules/effect/dist/Exit.js"); -/* import */ var effect__rspack_import_14 = __webpack_require__("./node_modules/effect/dist/Clock.js"); +/* import */ var effect__rspack_import_2 = __webpack_require__("./node_modules/effect/dist/Latch.js"); +/* import */ var effect__rspack_import_3 = __webpack_require__("./node_modules/effect/dist/Effect.js"); +/* import */ var effect__rspack_import_6 = __webpack_require__("./node_modules/effect/dist/Duration.js"); +/* import */ var effect__rspack_import_7 = __webpack_require__("./node_modules/effect/dist/Stream.js"); +/* import */ var effect__rspack_import_8 = __webpack_require__("./node_modules/effect/dist/Deferred.js"); +/* import */ var effect__rspack_import_9 = __webpack_require__("./node_modules/effect/dist/Queue.js"); +/* import */ var effect__rspack_import_10 = __webpack_require__("./node_modules/effect/dist/Option.js"); +/* import */ var effect__rspack_import_11 = __webpack_require__("./node_modules/effect/dist/Exit.js"); +/* import */ var effect__rspack_import_13 = __webpack_require__("./node_modules/effect/dist/Clock.js"); /* import */ var react__rspack_import_0 = __webpack_require__("./node_modules/react/index.js"); /* import */ var react_server_dom_rspack_client_node__rspack_import_1 = __webpack_require__("./node_modules/react-server-dom-rspack/client.node.js"); -/* import */ var node_async_hooks__rspack_import_2 = __webpack_require__("node:async_hooks"); -/* import */ var _315_js__rspack_import_5 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/315.js"); -/* import */ var _302_js__rspack_import_6 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/302.js"); -/* import */ var _707_js__rspack_import_13 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/707.js"); -/* import */ var _506_js__rspack_import_15 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js"); - +/* import */ var _315_js__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/315.js"); +/* import */ var _302_js__rspack_import_5 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/302.js"); +/* import */ var _707_js__rspack_import_12 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/707.js"); @@ -14092,10 +13935,10 @@ __webpack_require__.d(__webpack_exports__, { const createFlightDemand = ()=>{ - const pulling = effect__rspack_import_3/* .makeUnsafe */.LZ(false); + const pulling = effect__rspack_import_2/* .makeUnsafe */.LZ(false); let shellEmitted = false; return { - markShell: effect__rspack_import_4/* .sync */.OH5(()=>{ + markShell: effect__rspack_import_3/* .sync */.OH5(()=>{ shellEmitted = true; }), notePull () { @@ -14104,11 +13947,11 @@ const createFlightDemand = ()=>{ notePullEnd () { pulling.closeUnsafe(); }, - wait: effect__rspack_import_4/* .suspend */.DYE(()=>shellEmitted ? pulling.await : effect__rspack_import_4/* ["void"] */.rIH) + wait: effect__rspack_import_3/* .suspend */.DYE(()=>shellEmitted ? pulling.await : effect__rspack_import_3/* ["void"] */.rIH) }; }; -const emitBoundRenderEvent = (sequence, input)=>effect__rspack_import_4/* ["try"] */.SvU({ - catch: (error)=>(0,_315_js__rspack_import_5/* .toRuntimeError */.qN)(error), +const emitBoundRenderEvent = (sequence, input)=>effect__rspack_import_3/* ["try"] */.SvU({ + catch: (error)=>(0,_315_js__rspack_import_4/* .toRuntimeError */.qN)(error), try: ()=>sequence.emit(input) }); const agentElementTypes = Object.freeze([ @@ -14125,7 +13968,7 @@ const agentElementTypes = Object.freeze([ ]); const isAgentElementType = (value)=>agentElementTypes.includes(value); const protocolElement = (node)=>{ - if (!(0,react__rspack_import_0.isValidElement)(node) || 'string' != typeof node.type || !isAgentElementType(node.type)) throw new _302_js__rspack_import_6/* .AgentContractError */.I2('invalid-document', 'Flight output must contain only Agent protocol elements; function components and HTML are unsupported'); + if (!(0,react__rspack_import_0.isValidElement)(node) || 'string' != typeof node.type || !isAgentElementType(node.type)) throw new _302_js__rspack_import_5/* .AgentContractError */.I2('invalid-document', 'Flight output must contain only Agent protocol elements; function components and HTML are unsupported'); return { props: node.props, type: node.type @@ -14133,31 +13976,31 @@ const protocolElement = (node)=>{ }; const textChild = (children, type)=>{ const values = react__rspack_import_0.Children.toArray(children); - if (1 !== values.length || 'string' != typeof values[0]) throw new _302_js__rspack_import_6/* .AgentContractError */.I2('invalid-document', `${type} requires exactly one string child`); + if (1 !== values.length || 'string' != typeof values[0]) throw new _302_js__rspack_import_5/* .AgentContractError */.I2('invalid-document', `${type} requires exactly one string child`); return values[0]; }; const decodeBudget = (state)=>({ addBytes (n) { state.bytes += n; - if (state.bytes > state.limits.maxDocumentBytes) throw new _302_js__rspack_import_6/* .AgentContractError */.I2('document-bytes-exceeded', `Agent Document bytes exceed ${String(state.limits.maxDocumentBytes)}`); + if (state.bytes > state.limits.maxDocumentBytes) throw new _302_js__rspack_import_5/* .AgentContractError */.I2('document-bytes-exceeded', `Agent Document bytes exceed ${String(state.limits.maxDocumentBytes)}`); }, addNode () { - (0,_302_js__rspack_import_6/* .admitDocumentNode */.Dy)(state); + (0,_302_js__rspack_import_5/* .admitDocumentNode */.Dy)(state); }, checkDepth (depth) { - (0,_302_js__rspack_import_6/* .expectDocumentDepth */.MI)(depth, state.limits); + (0,_302_js__rspack_import_5/* .expectDocumentDepth */.MI)(depth, state.limits); } }); const isJsonObject = (value)=>null != value && 'object' == typeof value && !Array.isArray(value); const budgetedJson = (value, message, depth, state)=>{ try { - return (0,_302_js__rspack_import_6/* .snapshotJsonValue */.mY)(value, message, { + return (0,_302_js__rspack_import_5/* .snapshotJsonValue */.mY)(value, message, { depth, limits: decodeBudget(state) }); } catch (error) { - if (error instanceof _302_js__rspack_import_6/* .AgentContractError */.I2) throw error; - throw new _302_js__rspack_import_6/* .AgentContractError */.I2('invalid-document', error instanceof Error ? error.message : message, { + if (error instanceof _302_js__rspack_import_5/* .AgentContractError */.I2) throw error; + throw new _302_js__rspack_import_5/* .AgentContractError */.I2('invalid-document', error instanceof Error ? error.message : message, { cause: error }); } @@ -14216,8 +14059,8 @@ const decodeResult = (props, depth, state)=>{ return node; }; const decodeNode = (node, depth, state)=>{ - (0,_302_js__rspack_import_6/* .expectDocumentDepth */.MI)(depth, state.limits); - (0,_302_js__rspack_import_6/* .admitDocumentNode */.Dy)(state); + (0,_302_js__rspack_import_5/* .expectDocumentDepth */.MI)(depth, state.limits); + (0,_302_js__rspack_import_5/* .admitDocumentNode */.Dy)(state); const element = protocolElement(node); const { props } = element; switch(element.type){ @@ -14285,14 +14128,14 @@ const decodeNode = (node, depth, state)=>{ default: { const exhaustive = element.type; - throw new _302_js__rspack_import_6/* .AgentContractError */.I2('invalid-document', `Unsupported Agent protocol element: ${String(exhaustive)}`); + throw new _302_js__rspack_import_5/* .AgentContractError */.I2('invalid-document', `Unsupported Agent protocol element: ${String(exhaustive)}`); } } }; const decodeAgentDocument = (node, limits = {})=>{ - const resolved = (0,_302_js__rspack_import_6/* .resolveAgentRenderLimits */.i0)(limits); + const resolved = (0,_302_js__rspack_import_5/* .resolveAgentRenderLimits */.i0)(limits); const root = protocolElement(node); - if ('agent-result' !== root.type) throw new _302_js__rspack_import_6/* .AgentContractError */.I2('invalid-document', 'Flight output must have Agent.Result as its root'); + if ('agent-result' !== root.type) throw new _302_js__rspack_import_5/* .AgentContractError */.I2('invalid-document', 'Flight output must have Agent.Result as its root'); const state = { bytes: 0, discardedBytes: 0, @@ -14303,7 +14146,7 @@ const decodeAgentDocument = (node, limits = {})=>{ }; const documentRoot = decodeNode(node, 1, state); const value = state.resultValues.get(documentRoot)?.value; - const document = (0,_302_js__rspack_import_6/* .createAgentDocument */.ZX)({ + const document = (0,_302_js__rspack_import_5/* .createAgentDocument */.ZX)({ root: documentRoot, status: state.representedError ? 'represented-error' : 'success', ...void 0 === value ? {} : { @@ -14311,13 +14154,13 @@ const decodeAgentDocument = (node, limits = {})=>{ }, version: 1 }, resolved); - if (state.discardedBytes > 0 && state.discardedBytes + jsonBytes(document) > resolved.maxDocumentBytes) throw new _302_js__rspack_import_6/* .AgentContractError */.I2('document-bytes-exceeded', `Agent Document bytes exceed ${String(resolved.maxDocumentBytes)}`); + if (state.discardedBytes > 0 && state.discardedBytes + jsonBytes(document) > resolved.maxDocumentBytes) throw new _302_js__rspack_import_5/* .AgentContractError */.I2('document-bytes-exceeded', `Agent Document bytes exceed ${String(resolved.maxDocumentBytes)}`); return document; }; const REACT_FRAGMENT = Symbol.for('react.fragment'); const REACT_LAZY = Symbol.for('react.lazy'); const REACT_SUSPENSE = Symbol.for('react.suspense'); -const abortError = _302_js__rspack_import_6/* .agentRenderAbortError */.k2; +const abortError = _302_js__rspack_import_5/* .agentRenderAbortError */.k2; const isObject = (value)=>'object' == typeof value && null !== value; const isThenable = (value)=>isObject(value) && 'function' == typeof value.then; const isLazyElement = (value)=>isObject(value) && value.$$typeof === REACT_LAZY && isThenable(value._payload); @@ -14348,7 +14191,7 @@ const classifyNode = (node)=>{ kind: 'thenable', value: node }; - if (!(0,react__rspack_import_0.isValidElement)(node)) throw new _302_js__rspack_import_6/* .AgentContractError */.I2('invalid-document', 'Flight output contained an unsupported node'); + if (!(0,react__rspack_import_0.isValidElement)(node)) throw new _302_js__rspack_import_5/* .AgentContractError */.I2('invalid-document', 'Flight output contained an unsupported node'); const type = node.type; if (type === REACT_SUSPENSE) return { kind: 'suspense', @@ -14362,7 +14205,7 @@ const classifyNode = (node)=>{ kind: 'protocol', value: node }; - throw new _302_js__rspack_import_6/* .AgentContractError */.I2('invalid-document', "Flight output must contain only Agent protocol elements; function components and HTML are unsupported"); + throw new _302_js__rspack_import_5/* .AgentContractError */.I2('invalid-document', "Flight output must contain only Agent protocol elements; function components and HTML are unsupported"); }; const thenableStatus = (thenable)=>{ switch(thenable.status){ @@ -14537,8 +14380,8 @@ const snapshotTree = (root, ids)=>{ tree: materializeNode(root, '', ctx) }; }; -const hostError = (signal, error)=>signal.aborted || (0,_315_js__rspack_import_5/* .isAbortError */.zf)(error) ? abortError() : (0,_315_js__rspack_import_5/* .toRuntimeError */.qN)(error); -const waitSettledBoundary = (pending)=>effect__rspack_import_4/* .raceAll */.Vdx(pending.map((boundary)=>effect__rspack_import_4/* .promise */.ivC(()=>Promise.resolve(boundary.thenable).then(()=>({ +const hostError = (signal, error)=>signal.aborted || (0,_315_js__rspack_import_4/* .isAbortError */.zf)(error) ? abortError() : (0,_315_js__rspack_import_4/* .toRuntimeError */.qN)(error); +const waitSettledBoundary = (pending)=>effect__rspack_import_3/* .raceAll */.Vdx(pending.map((boundary)=>effect__rspack_import_3/* .promise */.ivC(()=>Promise.resolve(boundary.thenable).then(()=>({ boundary, ok: true }), (error)=>({ @@ -14548,8 +14391,8 @@ const waitSettledBoundary = (pending)=>effect__rspack_import_4/* .raceAll */.Vdx }))))); const waitOrDeadline = (wait, sequence)=>{ const remaining = sequence.remainingMs; - if (remaining <= 0) return effect__rspack_import_4/* .fail */.fJG((0,_302_js__rspack_import_6/* .elapsedTimeExceeded */.zm)(sequence.maxElapsedMs)); - return effect__rspack_import_4/* .raceFirst */.KT6(wait, effect__rspack_import_4/* .sleep */.yy4(effect__rspack_import_7/* .millis */.ne(remaining)).pipe(effect__rspack_import_4/* .flatMap */.qIB(()=>effect__rspack_import_4/* .fail */.fJG((0,_302_js__rspack_import_6/* .elapsedTimeExceeded */.zm)(sequence.maxElapsedMs))))); + if (remaining <= 0) return effect__rspack_import_3/* .fail */.fJG((0,_302_js__rspack_import_5/* .elapsedTimeExceeded */.zm)(sequence.maxElapsedMs)); + return effect__rspack_import_3/* .raceFirst */.KT6(wait, effect__rspack_import_3/* .sleep */.yy4(effect__rspack_import_6/* .millis */.ne(remaining)).pipe(effect__rspack_import_3/* .flatMap */.qIB(()=>effect__rspack_import_3/* .fail */.fJG((0,_302_js__rspack_import_5/* .elapsedTimeExceeded */.zm)(sequence.maxElapsedMs))))); }; const settledBoundaryInputs = (previous, next, winner, limits)=>{ const stillPending = new Set(next.pending.map((boundary)=>boundary.id)); @@ -14582,9 +14425,9 @@ const settledBoundaryInputs = (previous, next, winner, limits)=>{ for (const boundary of previous.pending)if (boundary.id !== winner.boundary.id) emitFor(boundary.id); return inputs; }; -const reconcileLoopStream = (root, ids, initial, limits, flightDone, progressInputs, sequence)=>effect__rspack_import_8/* .paginate */.EnV(initial, (snapshot)=>{ - if (0 === snapshot.pending.length) return waitOrDeadline(effect__rspack_import_9/* ["await"] */.Tx(flightDone), sequence).pipe(effect__rspack_import_4/* .andThen */.hgn(effect__rspack_import_10/* .clear */.IU(progressInputs)), effect__rspack_import_4/* .flatMap */.qIB((queued)=>effect__rspack_import_4/* ["try"] */.SvU({ - catch: (error)=>(0,_315_js__rspack_import_5/* .toRuntimeError */.qN)(error), +const reconcileLoopStream = (root, ids, initial, limits, flightDone, progressInputs, sequence)=>effect__rspack_import_7/* .paginate */.EnV(initial, (snapshot)=>{ + if (0 === snapshot.pending.length) return waitOrDeadline(effect__rspack_import_8/* ["await"] */.Tx(flightDone), sequence).pipe(effect__rspack_import_3/* .andThen */.hgn(effect__rspack_import_9/* .clear */.IU(progressInputs)), effect__rspack_import_3/* .flatMap */.qIB((queued)=>effect__rspack_import_3/* ["try"] */.SvU({ + catch: (error)=>(0,_315_js__rspack_import_4/* .toRuntimeError */.qN)(error), try: ()=>[ [ ...queued, @@ -14593,32 +14436,32 @@ const reconcileLoopStream = (root, ids, initial, limits, flightDone, progressInp type: 'complete' } ], - effect__rspack_import_11.none() + effect__rspack_import_10.none() ] }))); - return effect__rspack_import_4/* .raceFirst */.KT6(waitOrDeadline(waitSettledBoundary(snapshot.pending), sequence).pipe(effect__rspack_import_4/* .map */.TjK((winner)=>({ + return effect__rspack_import_3/* .raceFirst */.KT6(waitOrDeadline(waitSettledBoundary(snapshot.pending), sequence).pipe(effect__rspack_import_3/* .map */.TjK((winner)=>({ kind: 'boundary', winner - }))), effect__rspack_import_10/* .take */.s(progressInputs).pipe(effect__rspack_import_4/* .map */.TjK((input)=>({ + }))), effect__rspack_import_9/* .take */.s(progressInputs).pipe(effect__rspack_import_3/* .map */.TjK((input)=>({ kind: 'progress', input - })))).pipe(effect__rspack_import_4/* .flatMap */.qIB((event)=>{ + })))).pipe(effect__rspack_import_3/* .flatMap */.qIB((event)=>{ switch(event.kind){ case 'progress': - return effect__rspack_import_4/* .succeed */.PyW([ + return effect__rspack_import_3/* .succeed */.PyW([ [ event.input ], - effect__rspack_import_11.some(snapshot) + effect__rspack_import_10.some(snapshot) ]); case 'boundary': - return effect__rspack_import_4/* ["try"] */.SvU({ - catch: (error)=>(0,_315_js__rspack_import_5/* .toRuntimeError */.qN)(error), + return effect__rspack_import_3/* ["try"] */.SvU({ + catch: (error)=>(0,_315_js__rspack_import_4/* .toRuntimeError */.qN)(error), try: ()=>{ const next = snapshotTree(root, ids); return [ settledBoundaryInputs(snapshot, next, event.winner, limits), - effect__rspack_import_11.some(next) + effect__rspack_import_10.some(next) ]; } }); @@ -14630,38 +14473,38 @@ const reconcileLoopStream = (root, ids, initial, limits, flightDone, progressInp } })); }); -const gatedFlightStream = (flight, demand, flightDone)=>effect__rspack_import_8/* .unwrap */.oAg(effect__rspack_import_4/* .gen */.JkU(function*() { - const reader = yield* effect__rspack_import_4/* .acquireRelease */.Q56(effect__rspack_import_4/* .sync */.OH5(()=>flight.getReader()), (handle, exit)=>effect__rspack_import_4/* .gen */.JkU(function*() { - const cancelExit = yield* effect__rspack_import_4/* .exit */.NS5(effect__rspack_import_4/* .tryPromise */.$mh({ - catch: (error)=>(0,_315_js__rspack_import_5/* .toRuntimeError */.qN)(error), +const gatedFlightStream = (flight, demand, flightDone)=>effect__rspack_import_7/* .unwrap */.oAg(effect__rspack_import_3/* .gen */.JkU(function*() { + const reader = yield* effect__rspack_import_3/* .acquireRelease */.Q56(effect__rspack_import_3/* .sync */.OH5(()=>flight.getReader()), (handle, exit)=>effect__rspack_import_3/* .gen */.JkU(function*() { + const cancelExit = yield* effect__rspack_import_3/* .exit */.NS5(effect__rspack_import_3/* .tryPromise */.$mh({ + catch: (error)=>(0,_315_js__rspack_import_4/* .toRuntimeError */.qN)(error), try: ()=>handle.cancel() })); - if (effect__rspack_import_12/* .isFailure */.N6(exit)) return void (yield* effect__rspack_import_9/* .fail */.fJ(flightDone, (0,_315_js__rspack_import_5/* .mapCause */.K0)(exit.cause))); - if (effect__rspack_import_12/* .isFailure */.N6(cancelExit)) { - const error = (0,_315_js__rspack_import_5/* .mapCause */.K0)(cancelExit.cause); - yield* effect__rspack_import_9/* .fail */.fJ(flightDone, error); - return yield* effect__rspack_import_4/* .die */.F_Q(error); + if (effect__rspack_import_11/* .isFailure */.N6(exit)) return void (yield* effect__rspack_import_8/* .fail */.fJ(flightDone, (0,_315_js__rspack_import_4/* .mapCause */.K0)(exit.cause))); + if (effect__rspack_import_11/* .isFailure */.N6(cancelExit)) { + const error = (0,_315_js__rspack_import_4/* .mapCause */.K0)(cancelExit.cause); + yield* effect__rspack_import_8/* .fail */.fJ(flightDone, error); + return yield* effect__rspack_import_3/* .die */.F_Q(error); } - yield* effect__rspack_import_9/* .succeed */.Py(flightDone, void 0); + yield* effect__rspack_import_8/* .succeed */.Py(flightDone, void 0); })); - return effect__rspack_import_8/* .unfold */.t8s(void 0, ()=>demand.wait.pipe(effect__rspack_import_4/* .flatMap */.qIB(()=>effect__rspack_import_4/* .tryPromise */.$mh({ - catch: (error)=>(0,_315_js__rspack_import_5/* .toRuntimeError */.qN)(error), + return effect__rspack_import_7/* .unfold */.t8s(void 0, ()=>demand.wait.pipe(effect__rspack_import_3/* .flatMap */.qIB(()=>effect__rspack_import_3/* .tryPromise */.$mh({ + catch: (error)=>(0,_315_js__rspack_import_4/* .toRuntimeError */.qN)(error), try: ()=>reader.read() - })), effect__rspack_import_4/* .map */.TjK((next)=>next.done ? void 0 : [ + })), effect__rspack_import_3/* .map */.TjK((next)=>next.done ? void 0 : [ next.value, void 0 ]))); })); -const decodeFlightRoot = (flight, demand, signal, flightDone)=>effect__rspack_import_4/* .gen */.JkU(function*() { - (0,_707_js__rspack_import_13/* .ensureAgentFlightManifest */.n)(); - const flightAbort = yield* _315_js__rspack_import_5/* .scopedAbortSignal */.lQ; - const readable = (0,_315_js__rspack_import_5/* .streamToReadableStream */._I)(gatedFlightStream(flight, demand, flightDone), { +const decodeFlightRoot = (flight, demand, signal, flightDone)=>effect__rspack_import_3/* .gen */.JkU(function*() { + (0,_707_js__rspack_import_12/* .ensureAgentFlightManifest */.n)(); + const flightAbort = yield* _315_js__rspack_import_4/* .scopedAbortSignal */.lQ; + const readable = (0,_315_js__rspack_import_4/* .streamToReadableStream */._I)(gatedFlightStream(flight, demand, flightDone), { signal: flightAbort, strategy: { highWaterMark: 1 } }); - return yield* effect__rspack_import_4/* .tryPromise */.$mh({ + return yield* effect__rspack_import_3/* .tryPromise */.$mh({ catch: (error)=>hostError(signal, error), try: ()=>(0,react_server_dom_rspack_client_node__rspack_import_1.createFromReadableStream)(readable, { unstable_allowPartialStream: true @@ -14678,11 +14521,11 @@ const progressInput = (update)=>({ }, type: 'progress' }); -const handoffRequired = ()=>new _302_js__rspack_import_6/* .AgentContractError */.I2('handoff-required', 'The render is complete; later work requires a new invocation handoff'); +const handoffRequired = ()=>new _302_js__rspack_import_5/* .AgentContractError */.I2('handoff-required', 'The render is complete; later work requires a new invocation handoff'); const createAgentRenderEventSession = (options)=>{ const clock = options.clock; - const sequence = (0,_302_js__rspack_import_6/* .createAgentRenderEventSequence */.n4)(options.limits, void 0 === clock ? void 0 : ()=>clock.currentTimeMillisUnsafe()); - const maxBufferedProgress = (0,_302_js__rspack_import_6/* .resolveAgentRenderLimits */.i0)(options.limits).maxEvents; + const sequence = (0,_302_js__rspack_import_5/* .createAgentRenderEventSequence */.n4)(options.limits, void 0 === clock ? void 0 : ()=>clock.currentTimeMillisUnsafe()); + const maxBufferedProgress = (0,_302_js__rspack_import_5/* .resolveAgentRenderLimits */.i0)(options.limits).maxEvents; let offerProgress; let progressFailure; const bufferedProgress = []; @@ -14692,36 +14535,36 @@ const createAgentRenderEventSession = (options)=>{ if (sequence.completed) throw handoffRequired(); const input = progressInput(update); if (void 0 === offerProgress) { - if (bufferedProgress.length >= maxBufferedProgress) throw new _302_js__rspack_import_6/* .AgentContractError */.I2('event-count-exceeded', `Agent render event count exceeds ${String(maxBufferedProgress)}`); + if (bufferedProgress.length >= maxBufferedProgress) throw new _302_js__rspack_import_5/* .AgentContractError */.I2('event-count-exceeded', `Agent render event count exceeds ${String(maxBufferedProgress)}`); bufferedProgress.push(input); return; } - await (0,_315_js__rspack_import_5/* .runPromise */.pR)(offerProgress(input)); + await (0,_315_js__rspack_import_4/* .runPromise */.pR)(offerProgress(input)); } }); - const events = effect__rspack_import_8/* .unwrap */.oAg(effect__rspack_import_4/* .gen */.JkU(function*() { - const progressInputs = yield* effect__rspack_import_10/* .bounded */.Mm(0); - const flightDone = yield* effect__rspack_import_9/* .make */.L8(); + const events = effect__rspack_import_7/* .unwrap */.oAg(effect__rspack_import_3/* .gen */.JkU(function*() { + const progressInputs = yield* effect__rspack_import_9/* .bounded */.Mm(0); + const flightDone = yield* effect__rspack_import_8/* .make */.L8(); const bindProgress = ()=>{ - offerProgress = (input)=>effect__rspack_import_10/* .offer */.x(progressInputs, input).pipe(effect__rspack_import_4/* .flatMap */.qIB((accepted)=>{ - if (void 0 !== progressFailure) return effect__rspack_import_4/* .fail */.fJG(progressFailure); - if (!accepted) return effect__rspack_import_4/* .fail */.fJG(handoffRequired()); - return effect__rspack_import_4/* ["void"] */.rIH; + offerProgress = (input)=>effect__rspack_import_9/* .offer */.x(progressInputs, input).pipe(effect__rspack_import_3/* .flatMap */.qIB((accepted)=>{ + if (void 0 !== progressFailure) return effect__rspack_import_3/* .fail */.fJG(progressFailure); + if (!accepted) return effect__rspack_import_3/* .fail */.fJG(handoffRequired()); + return effect__rspack_import_3/* ["void"] */.rIH; })); }; - const finalizeProgress = (error)=>effect__rspack_import_4/* .sync */.OH5(()=>{ + const finalizeProgress = (error)=>effect__rspack_import_3/* .sync */.OH5(()=>{ progressFailure = error; - }).pipe(effect__rspack_import_4/* .andThen */.hgn(effect__rspack_import_10/* .shutdown */.n_(progressInputs))); - const setup = effect__rspack_import_4/* .gen */.JkU(function*() { - const flight = yield* effect__rspack_import_4/* .tryPromise */.$mh({ + }).pipe(effect__rspack_import_3/* .andThen */.hgn(effect__rspack_import_9/* .shutdown */.n_(progressInputs))); + const setup = effect__rspack_import_3/* .gen */.JkU(function*() { + const flight = yield* effect__rspack_import_3/* .tryPromise */.$mh({ catch: (error)=>hostError(options.signal, error), try: ()=>options.flight }); - if (options.signal.aborted) return yield* effect__rspack_import_4/* .fail */.fJG(abortError()); + if (options.signal.aborted) return yield* effect__rspack_import_3/* .fail */.fJG(abortError()); const root = yield* decodeFlightRoot(flight, options.demand, options.signal, flightDone); - if (options.signal.aborted) return yield* effect__rspack_import_4/* .fail */.fJG(abortError()); - const prepared = yield* effect__rspack_import_4/* ["try"] */.SvU({ - catch: (error)=>(0,_315_js__rspack_import_5/* .toRuntimeError */.qN)(error), + if (options.signal.aborted) return yield* effect__rspack_import_3/* .fail */.fJG(abortError()); + const prepared = yield* effect__rspack_import_3/* ["try"] */.SvU({ + catch: (error)=>(0,_315_js__rspack_import_4/* .toRuntimeError */.qN)(error), try: ()=>{ const ids = new Map(); const initial = snapshotTree(root, ids); @@ -14736,23 +14579,23 @@ const createAgentRenderEventSession = (options)=>{ } }); bindProgress(); - return effect__rspack_import_8/* .concat */.xWs(effect__rspack_import_8/* .fromArray */.ciY([ + return effect__rspack_import_7/* .concat */.xWs(effect__rspack_import_7/* .fromArray */.ciY([ prepared.shellInput, ...bufferedProgress - ]), reconcileLoopStream(root, prepared.ids, prepared.initial, options.limits, flightDone, progressInputs, sequence)).pipe(effect__rspack_import_8/* .mapEffect */.WK$((input)=>emitBoundRenderEvent(sequence, input)), effect__rspack_import_8/* .tap */.Mim((event)=>'shell' === event.type ? options.demand.markShell : effect__rspack_import_4/* ["void"] */.rIH), effect__rspack_import_8/* .takeUntil */.QKh((event)=>'complete' === event.type), effect__rspack_import_8/* .onExit */.cfM((exit)=>{ - if (effect__rspack_import_12/* .isSuccess */.oJ(exit)) return finalizeProgress(handoffRequired()); - const error = (0,_315_js__rspack_import_5/* .mapCause */.K0)(exit.cause); - return finalizeProgress(sequence.completed && (0,_315_js__rspack_import_5/* .isAbortError */.zf)(error) ? handoffRequired() : error); + ]), reconcileLoopStream(root, prepared.ids, prepared.initial, options.limits, flightDone, progressInputs, sequence)).pipe(effect__rspack_import_7/* .mapEffect */.WK$((input)=>emitBoundRenderEvent(sequence, input)), effect__rspack_import_7/* .tap */.Mim((event)=>'shell' === event.type ? options.demand.markShell : effect__rspack_import_3/* ["void"] */.rIH), effect__rspack_import_7/* .takeUntil */.QKh((event)=>'complete' === event.type), effect__rspack_import_7/* .onExit */.cfM((exit)=>{ + if (effect__rspack_import_11/* .isSuccess */.oJ(exit)) return finalizeProgress(handoffRequired()); + const error = (0,_315_js__rspack_import_4/* .mapCause */.K0)(exit.cause); + return finalizeProgress(sequence.completed && (0,_315_js__rspack_import_4/* .isAbortError */.zf)(error) ? handoffRequired() : error); })); }); - return yield* setup.pipe(effect__rspack_import_4/* .onExit */.cfM((exit)=>effect__rspack_import_12/* .isFailure */.N6(exit) ? finalizeProgress((0,_315_js__rspack_import_5/* .mapCause */.K0)(exit.cause)) : effect__rspack_import_4/* ["void"] */.rIH)); + return yield* setup.pipe(effect__rspack_import_3/* .onExit */.cfM((exit)=>effect__rspack_import_11/* .isFailure */.N6(exit) ? finalizeProgress((0,_315_js__rspack_import_4/* .mapCause */.K0)(exit.cause)) : effect__rspack_import_3/* ["void"] */.rIH)); })); return { - events: void 0 === clock ? events : effect__rspack_import_8/* .provideService */.PfK(events, effect__rspack_import_14/* .Clock */.zD, clock), + events: void 0 === clock ? events : effect__rspack_import_7/* .provideService */.PfK(events, effect__rspack_import_13/* .Clock */.zD, clock), progress }; }; -const toPublicEventStream = (events, demand, signal)=>(0,_315_js__rspack_import_5/* .streamToReadableStream */._I)(effect__rspack_import_8/* .interruptWhen */.S67(events, (0,_315_js__rspack_import_5/* .abortToInterrupt */.p7)(signal)), { +const toPublicEventStream = (events, demand, signal)=>(0,_315_js__rspack_import_4/* .streamToReadableStream */._I)(effect__rspack_import_7/* .interruptWhen */.S67(events, (0,_315_js__rspack_import_4/* .abortToInterrupt */.p7)(signal)), { closeOn: (event)=>'complete' === event.type, onPull: demand.notePull, onPullDelivered: demand.notePullEnd, @@ -14770,7 +14613,7 @@ const decodeAgentFlightStream = (flight, options = {})=>{ signal }).events, demand, signal); }; -const dispatcher_abortError = _302_js__rspack_import_6/* .agentRenderAbortError */.k2; +const dispatcher_abortError = _302_js__rspack_import_5/* .agentRenderAbortError */.k2; const abortedStream = ()=>new ReadableStream({ start (controller) { controller.error(dispatcher_abortError()); @@ -14805,7 +14648,7 @@ const drainCompleteDocument = async (events, signal)=>{ } if (void 0 !== complete) return complete; if (signal.aborted) throw dispatcher_abortError(); - throw new _302_js__rspack_import_6/* .AgentContractError */.I2('invalid-document', 'Flight stream ended without a complete document'); + throw new _302_js__rspack_import_5/* .AgentContractError */.I2('invalid-document', 'Flight stream ended without a complete document'); }; const createAgentRenderDispatcher = (host, options = {})=>{ const stream = (request)=>{ @@ -14816,7 +14659,7 @@ const createAgentRenderDispatcher = (host, options = {})=>{ demand, get flight () { const current = pendingFlight.current; - if (void 0 === current) return Promise.reject(new _302_js__rspack_import_6/* .AgentContractError */.I2('invalid-document', 'Flight worker is not running')); + if (void 0 === current) return Promise.reject(new _302_js__rspack_import_5/* .AgentContractError */.I2('invalid-document', 'Flight worker is not running')); return current; }, limits: { @@ -14947,21 +14790,21 @@ const appendNode = (node, content, capabilities, fallback)=>{ default: { const exhaustive = node; - throw new _302_js__rspack_import_6/* .AgentContractError */.I2('invalid-document', `Unsupported Agent Document node: ${String(exhaustive.kind)}`); + throw new _302_js__rspack_import_5/* .AgentContractError */.I2('invalid-document', `Unsupported Agent Document node: ${String(exhaustive.kind)}`); } } }; const project_mcp_isJsonObject = (value)=>null !== value && 'object' == typeof value && !Array.isArray(value); const objectStructuredContent = (value)=>{ if (void 0 === value) return; - const snapshot = (0,_302_js__rspack_import_6/* .snapshotJsonValue */.mY)(value, 'MCP structured content must be JSON-serializable'); + const snapshot = (0,_302_js__rspack_import_5/* .snapshotJsonValue */.mY)(value, 'MCP structured content must be JSON-serializable'); return project_mcp_isJsonObject(snapshot) ? snapshot : void 0; }; const resultMetadata = (document)=>{ if ('result' !== document.root.kind) return; const metadata = document.root.metadata; if (void 0 === metadata) return; - const snapshot = (0,_302_js__rspack_import_6/* .snapshotJsonValue */.mY)(metadata, 'MCP result _meta must be JSON-serializable'); + const snapshot = (0,_302_js__rspack_import_5/* .snapshotJsonValue */.mY)(metadata, 'MCP result _meta must be JSON-serializable'); if (!project_mcp_isJsonObject(snapshot)) throw new McpProjectionError('invalid-result-metadata', 'MCP result _meta must be a JSON object; Agent.Result metadata projects to CallToolResult._meta'); return snapshot; }; @@ -14991,8 +14834,8 @@ const attachMcpStructuredContent = (result, value)=>{ structuredContent: structured }; }; -const notifyProgress = (source, token, sendProgress)=>effect__rspack_import_4/* .tryPromise */.$mh({ - catch: (error)=>(0,_315_js__rspack_import_5/* .toRuntimeError */.qN)(error), +const notifyProgress = (source, token, sendProgress)=>effect__rspack_import_3/* .tryPromise */.$mh({ + catch: (error)=>(0,_315_js__rspack_import_4/* .toRuntimeError */.qN)(error), try: ()=>sendProgress({ progress: source.completed, progressToken: token, @@ -15033,18 +14876,18 @@ const documentProgressNodes = (document)=>{ appendProgressNodes(document.root, nodes); return nodes; }; -const projectMcpEventStream = effect__rspack_import_4/* .fnUntraced */.D9k(function*(events, options = {}) { +const projectMcpEventStream = effect__rspack_import_3/* .fnUntraced */.D9k(function*(events, options = {}) { let lastProgress = -1 / 0; let complete; const token = options.progressToken; const sendProgress = options.sendProgress; const notify = (source)=>{ - if (void 0 === token || void 0 === sendProgress) return effect__rspack_import_4/* ["void"] */.rIH; - if (!(source.completed > lastProgress)) return effect__rspack_import_4/* ["void"] */.rIH; + if (void 0 === token || void 0 === sendProgress) return effect__rspack_import_3/* ["void"] */.rIH; + if (!(source.completed > lastProgress)) return effect__rspack_import_3/* ["void"] */.rIH; lastProgress = source.completed; return notifyProgress(source, token, sendProgress); }; - yield* effect__rspack_import_8/* .runForEach */.o1d(events, (event)=>effect__rspack_import_4/* .gen */.JkU(function*() { + yield* effect__rspack_import_7/* .runForEach */.o1d(events, (event)=>effect__rspack_import_3/* .gen */.JkU(function*() { switch(event.type){ case 'progress': yield* notify(event); @@ -15065,18 +14908,18 @@ const projectMcpEventStream = effect__rspack_import_4/* .fnUntraced */.D9k(funct } } })); - if (void 0 === complete) return yield* effect__rspack_import_4/* .fail */.fJG(new _302_js__rspack_import_6/* .AgentContractError */.I2('invalid-document', 'MCP projector requires a complete document; the stream ended without one')); + if (void 0 === complete) return yield* effect__rspack_import_3/* .fail */.fJG(new _302_js__rspack_import_5/* .AgentContractError */.I2('invalid-document', 'MCP projector requires a complete document; the stream ended without one')); return Object.freeze({ document: complete, result: documentToCallToolResult(complete, options) }); }); const projectMcpRenderStream = async (events, options = {})=>{ - const program = projectMcpEventStream(effect__rspack_import_8/* .fromReadableStream */.fph({ + const program = projectMcpEventStream(effect__rspack_import_7/* .fromReadableStream */.fph({ evaluate: ()=>events, - onError: (error)=>(0,_315_js__rspack_import_5/* .toRuntimeError */.qN)(error) + onError: (error)=>(0,_315_js__rspack_import_4/* .toRuntimeError */.qN)(error) }), options); - return (0,_315_js__rspack_import_5/* .runPromise */.pR)(void 0 === options.signal ? program : (0,_315_js__rspack_import_5/* .interruptWhenAborted */.Vd)(program, options.signal), void 0 === options.signal ? void 0 : { + return (0,_315_js__rspack_import_4/* .runPromise */.pR)(void 0 === options.signal ? program : (0,_315_js__rspack_import_4/* .interruptWhenAborted */.Vd)(program, options.signal), void 0 === options.signal ? void 0 : { signal: options.signal }); }; @@ -15148,53 +14991,6 @@ const MarkdownContent = async ({ children, components })=>{ }); return createElement(Agent.Markdown, null, markdown.replace(/\n+$/u, '')); }; -const hookComponents = new Set(Object.values(_506_js__rspack_import_15/* .Hook */.qn)); -const isHookComponent = (value)=>hookComponents.has(value); -const resolveHookElement = (node)=>{ - let element = node; - while(isValidElement(element) && isHookComponent(element.type))element = element.type(element.props); - return element; -}; -const isAgentElement = (node, name)=>{ - const resolved = resolveHookElement(node); - return isValidElement(resolved) && resolved.type === name; -}; -const flattenText = (node)=>{ - if ('string' == typeof node || 'number' == typeof node) return String(node); - if (Array.isArray(node)) return node.map(flattenText).join(''); - if (isAgentElement(node, 'agent-hook-result')) throw new Error('Hook result contains duplicate roots'); - throw new Error('Hook additional context may contain only string or number children'); -}; -const lowerHookResult = (node)=>{ - const roots = Children.toArray(node).map(resolveHookElement); - if (1 !== roots.length || !isAgentElement(roots[0], 'agent-hook-result')) throw new Error('Expected exactly one agent-hook-result root'); - const result = roots[0]; - const contexts = Children.toArray(result.props.children).map(resolveHookElement).map((child)=>{ - if (isAgentElement(child, 'agent-hook-result')) throw new Error('Hook result contains duplicate roots'); - if (!isAgentElement(child, 'agent-hook-additional-context')) throw new Error('Hook result may contain only agent-hook-additional-context elements'); - return flattenText(child.props.children); - }); - if (0 === contexts.length) throw new Error('Hook result requires additional context'); - return { - hookSpecificOutput: { - additionalContext: contexts.join(''), - hookEventName: 'PostToolUse' - } - }; -}; -const createRscRequestContext = (label)=>{ - const storage = new AsyncLocalStorage(); - return Object.freeze({ - run (value, operation) { - return storage.run(value, operation); - }, - use () { - const value = storage.getStore(); - if (void 0 === value) throw new Error(`${label} used outside a render request`); - return value; - } - }); -}; var src_AGENT_DOCUMENT_VERSION = 1; var src_AGENT_REQUEST_STORE_VERSION = 6; var src_PLUGIN_STATE_DIRECTORY = "state"; @@ -40590,16 +40386,14 @@ __webpack_require__.d(__webpack_exports__, { }, "./node_modules/effect/dist/Array.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) { -/* import */ var _Equal_js__rspack_import_6 = __webpack_require__("./node_modules/effect/dist/Equal.js"); -/* import */ var _Equivalence_js__rspack_import_9 = __webpack_require__("./node_modules/effect/dist/Equivalence.js"); -/* import */ var _Function_js__rspack_import_2 = __webpack_require__("./node_modules/effect/dist/Function.js"); -/* import */ var _Hash_js__rspack_import_5 = __webpack_require__("./node_modules/effect/dist/Hash.js"); -/* import */ var _internal_array_js__rspack_import_3 = __webpack_require__("./node_modules/effect/dist/internal/array.js"); -/* import */ var _Iterable_js__rspack_import_4 = __webpack_require__("./node_modules/effect/dist/Iterable.js"); +/* import */ var _Equivalence_js__rspack_import_7 = __webpack_require__("./node_modules/effect/dist/Equivalence.js"); +/* import */ var _Function_js__rspack_import_4 = __webpack_require__("./node_modules/effect/dist/Function.js"); +/* import */ var _internal_array_js__rspack_import_2 = __webpack_require__("./node_modules/effect/dist/internal/array.js"); +/* import */ var _Iterable_js__rspack_import_3 = __webpack_require__("./node_modules/effect/dist/Iterable.js"); /* import */ var _Option_js__rspack_import_1 = __webpack_require__("./node_modules/effect/dist/Option.js"); -/* import */ var _Order_js__rspack_import_8 = __webpack_require__("./node_modules/effect/dist/Order.js"); +/* import */ var _Order_js__rspack_import_6 = __webpack_require__("./node_modules/effect/dist/Order.js"); /* import */ var _Record_js__rspack_import_0 = __webpack_require__("./node_modules/effect/dist/Record.js"); -/* import */ var _Result_js__rspack_import_7 = __webpack_require__("./node_modules/effect/dist/Result.js"); +/* import */ var _Result_js__rspack_import_5 = __webpack_require__("./node_modules/effect/dist/Result.js"); /** * Works with JavaScript arrays, readonly arrays, and non-empty arrays. * @@ -40625,6 +40419,7 @@ __webpack_require__.d(__webpack_exports__, { + /** * Exposes the global array constructor. * @@ -40681,6 +40476,7 @@ const make = (...elements) => elements; * * **Details** * + * `n` is rounded down. `NaN` and non-positive values are treated as `0`. * Elements are typed as `A | undefined` because the slots are empty. * * **Example** (Allocating a fixed-size array) @@ -40696,7 +40492,7 @@ const make = (...elements) => elements; * @category constructors * @since 2.0.0 */ -const allocate = n => new Array(n); +const allocate = n => new Array(Count.normalize(n)); /** * Creates a `NonEmptyArray` of length `n` where element `i` is computed by `f(i)`. * @@ -40706,9 +40502,9 @@ const allocate = n => new Array(n); * * **Details** * - * `n` is normalized to an integer greater than or equal to 1, so this function - * always returns at least one element. Supports both data-first and data-last - * usage. + * `n` is rounded down and normalized to an integer greater than or equal to 1. + * `NaN` is treated as `1`, so this function always returns at least one + * element. Supports both data-first and data-last usage. * * **Example** (Generating values from indices) * @@ -40725,7 +40521,7 @@ const allocate = n => new Array(n); * @since 2.0.0 */ const makeBy = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (n, f) => { - const max = Math.max(1, Math.floor(n)); + const max = Count.normalizeNonEmpty(n); const out = new Array(max); for (let i = 0; i < max; i++) { out[i] = f(i); @@ -41101,7 +40897,7 @@ const append = /*#__PURE__*/(/* unused pure expression or super */ null && (dual * @category combining * @since 2.0.0 */ -const appendAll = /*#__PURE__*/(0,_Function_js__rspack_import_2/* .dual */.XY)(2, (self, that) => fromIterable(self).concat(fromIterable(that))); +const appendAll = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, that) => fromIterable(self).concat(fromIterable(that))))); /** * Folds left-to-right while keeping every intermediate accumulator value. * @@ -41264,7 +41060,7 @@ const isReadonlyArrayEmpty = (/* unused pure expression or super */ null && (isA * @category guards * @since 4.0.0 */ -const isArrayNonEmpty = _internal_array_js__rspack_import_3/* .isArrayNonEmpty */.C; +const isArrayNonEmpty = _internal_array_js__rspack_import_2/* .isArrayNonEmpty */.C; /** * Checks whether a `ReadonlyArray` is non-empty, narrowing the type to * `NonEmptyReadonlyArray`. @@ -41289,7 +41085,7 @@ const isArrayNonEmpty = _internal_array_js__rspack_import_3/* .isArrayNonEmpty * * @category guards * @since 4.0.0 */ -const isReadonlyArrayNonEmpty = _internal_array_js__rspack_import_3/* .isArrayNonEmpty */.C; +const isReadonlyArrayNonEmpty = _internal_array_js__rspack_import_2/* .isArrayNonEmpty */.C; /** * Returns the number of elements in a `ReadonlyArray`. * @@ -41309,11 +41105,21 @@ const isReadonlyArrayNonEmpty = _internal_array_js__rspack_import_3/* .isArrayNo * @since 2.0.0 */ const length = self => self.length; +/** + * Checks whether a string represents a JavaScript array index: a non-negative + * integer below `2 ** 32 - 1`, written without leading zeroes, a sign, or + * exponent notation. + * + * @internal + */ +function isCanonicalArrayIndex(key) { + const index = Number(key); + return String(index) === key && Number.isInteger(index) && index >= 0 && index < 2 ** 32 - 1; +} /** @internal */ function isOutOfBounds(i, as) { return !Number.isFinite(i) || i < 0 || i >= as.length; } -const clamp = (i, as) => Math.floor(Math.min(Math.max(0, i), as.length)); /** * Reads an element at the given index safely, returning `Option.some` or * `Option.none` if the index is out of bounds. @@ -41637,6 +41443,7 @@ function init(self) { * @since 2.0.0 */ const initNonEmpty = self => self.slice(0, -1); +const clampCount = (n, length) => Math.min(Count.normalize(n), length); /** * Keeps the first `n` elements, creating a new array. * @@ -41646,7 +41453,8 @@ const initNonEmpty = self => self.slice(0, -1); * * **Details** * - * `n` is clamped to `[0, length]`. Returns an empty array when `n <= 0`. + * `n` is rounded down and clamped to `[0, length]`. `NaN` is treated as `0`. + * Returns an empty array when `n <= 0`. * * **Example** (Taking from the start) * @@ -41665,7 +41473,7 @@ const initNonEmpty = self => self.slice(0, -1); */ const take = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { const input = fromIterable(self); - return input.slice(0, clamp(n, input)); + return input.slice(0, clampCount(n, input.length)); }))); /** * Keeps the last `n` elements, creating a new array. @@ -41676,7 +41484,8 @@ const take = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 * * **Details** * - * `n` is clamped to `[0, length]`. Returns an empty array when `n <= 0`. + * `n` is rounded down and clamped to `[0, length]`. `NaN` is treated as `0`. + * Returns an empty array when `n <= 0`. * * **Example** (Taking from the end) * @@ -41694,7 +41503,7 @@ const take = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 */ const takeRight = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { const input = fromIterable(self); - const i = clamp(n, input); + const i = clampCount(n, input.length); return i === 0 ? [] : input.slice(-i); }))); /** @@ -41824,8 +41633,8 @@ const span = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 * * **Details** * - * `n` is clamped to `[0, length]`. When `n <= 0`, this returns a copy of the - * full array. + * `n` is rounded down and clamped to `[0, length]`. `NaN` is treated as `0`. + * When `n <= 0`, this returns a copy of the full array. * * **Example** (Dropping from the start) * @@ -41844,7 +41653,7 @@ const span = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 */ const drop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { const input = fromIterable(self); - return input.slice(clamp(n, input), input.length); + return input.slice(clampCount(n, input.length), input.length); }))); /** * Removes the last `n` elements, creating a new array. @@ -41855,7 +41664,7 @@ const drop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 * * **Details** * - * `n` is clamped to `[0, length]`. + * `n` is rounded down and clamped to `[0, length]`. `NaN` is treated as `0`. * * **Example** (Dropping from the end) * @@ -41873,7 +41682,7 @@ const drop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 */ const dropRight = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { const input = fromIterable(self); - return input.slice(0, input.length - clamp(n, input)); + return input.slice(0, input.length - clampCount(n, input.length)); }))); /** * Drops elements from the start while the predicate holds, returning the rest. @@ -42035,7 +41844,7 @@ const findLastIndex = /*#__PURE__*/(/* unused pure expression or super */ null & * @category searching * @since 2.0.0 */ -const findFirst = _Iterable_js__rspack_import_4/* .findFirst */.i8; +const findFirst = _Iterable_js__rspack_import_3/* .findFirst */.i8; /** * Returns the first selected value together with its index, wrapped in an * `Option`. @@ -42774,8 +42583,8 @@ const chop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 * * **Details** * - * `n` can be `0`, in which case all elements are placed in the second array. - * The index is floored to an integer. + * `n` is rounded down and clamped to `[0, length]`. `NaN` is treated as `0`, + * which places all elements in the second array. * * **Example** (Splitting at an index) * @@ -42793,7 +42602,7 @@ const chop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 */ const splitAt = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { const input = Array.from(self); - const _n = Math.floor(n); + const _n = Count.normalize(n); if (isReadonlyArrayNonEmpty(input)) { if (_n >= 1) { return splitAtNonEmpty(input, _n); @@ -42811,6 +42620,10 @@ const splitAt = /*#__PURE__*/(/* unused pure expression or super */ null && (dua * Use when downstream code requires the left side of the split to contain at * least one element. * + * **Details** + * + * `n` is rounded down and clamped to `[1, length]`. `NaN` is treated as `1`. + * * **Example** (Splitting a non-empty array) * * ```ts import.meta.vitest @@ -42825,7 +42638,7 @@ const splitAt = /*#__PURE__*/(/* unused pure expression or super */ null && (dua * @since 4.0.0 */ const splitAtNonEmpty = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { - const _n = Math.max(1, Math.floor(n)); + const _n = Count.normalizeNonEmpty(n); return _n >= self.length ? [copy(self), []] : [prepend(self.slice(1, _n), headNonEmpty(self)), self.slice(_n)]; }))); /** @@ -42837,7 +42650,8 @@ const splitAtNonEmpty = /*#__PURE__*/(/* unused pure expression or super */ null * * **Details** * - * Uses `chunksOf(ceil(length / n))` internally. The last chunk may be shorter. + * `n` is rounded down and normalized to at least `1`, with `NaN` treated as + * `1`. The last chunk may be shorter. * * **Example** (Splitting into groups) * @@ -42854,7 +42668,7 @@ const splitAtNonEmpty = /*#__PURE__*/(/* unused pure expression or super */ null */ const split = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { const input = fromIterable(self); - return chunksOf(input, Math.ceil(input.length / Math.floor(n))); + return chunksOf(input, Math.ceil(input.length / Count.normalizeNonEmpty(n))); }))); /** * Splits an iterable at the first element matching the predicate. The matching @@ -42921,7 +42735,8 @@ const copy = self => self.slice(); * * **Details** * - * Returns an empty array when `n <= 0`. + * `n` is rounded down. `NaN` and non-positive values are treated as `0`, which + * returns an empty array. * * **Example** (Padding an array) * @@ -42938,10 +42753,11 @@ const copy = self => self.slice(); * @since 3.8.4 */ const pad = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, (self, n, fill) => { - if (self.length >= n) { - return take(self, n); + const length = Count.normalize(n); + if (self.length >= length) { + return take(self, length); } - return appendAll(self, makeBy(n - self.length, () => fill)); + return appendAll(self, makeBy(length - self.length, () => fill)); }))); /** * Splits an iterable into chunks of length `n`. The last chunk may be shorter @@ -42954,8 +42770,10 @@ const pad = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, * * **Details** * - * `chunksOf(n)([])` is `[]`, not `[[]]`. Each chunk is a `NonEmptyArray`, and - * the outer return type preserves `NonEmptyArray`. + * `n` is rounded down and normalized to at least `1`; `NaN` and non-positive + * values therefore produce singleton chunks. `chunksOf(n)([])` is `[]`, not + * `[[]]`. Each chunk is a `NonEmptyArray`, and the outer return type preserves + * `NonEmptyArray`. * * **Example** (Chunking an array) * @@ -42987,8 +42805,9 @@ const chunksOf = /*#__PURE__*/(/* unused pure expression or super */ null && (du * * **Details** * - * Returns an empty array if `n <= 0` or the array has fewer than `n` elements. - * Each window is a tuple of exactly `n` elements. + * `n` is rounded down, with `NaN` and non-positive values treated as `0`. + * Returns an empty array if the normalized size is `0` or exceeds the array + * length. Each window is a tuple of exactly the normalized size. * * **Example** (Creating sliding windows) * @@ -43008,10 +42827,11 @@ const chunksOf = /*#__PURE__*/(/* unused pure expression or super */ null && (du */ const window = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { const input = fromIterable(self); - if (n > 0 && isReadonlyArrayNonEmpty(input)) { + const size = Count.normalize(n); + if (size > 0 && size <= input.length && isReadonlyArrayNonEmpty(input)) { return Array.from({ - length: input.length - (n - 1) - }, (_, index) => input.slice(index, index + n)); + length: input.length - (size - 1) + }, (_, index) => input.slice(index, index + size)); } return []; }))); @@ -43139,7 +42959,7 @@ const groupBy = /*#__PURE__*/(/* unused pure expression or super */ null && (dua return out; }))); const hashBucketsAdd = (buckets, value) => { - const hash = _Hash_js__rspack_import_5/* .hash */.tW(value); + const hash = Hash.hash(value); const bucket = buckets.get(hash); if (bucket === undefined) { buckets.set(hash, [value]); @@ -43147,7 +42967,7 @@ const hashBucketsAdd = (buckets, value) => { } // Hash collisions still require an Effect equality check. for (const previous of bucket) { - if (_Equal_js__rspack_import_6/* .equals */.aI(previous, value)) { + if (Equal.equals(previous, value)) { return false; } } @@ -43228,14 +43048,14 @@ const unionWith = /*#__PURE__*/(/* unused pure expression or super */ null && (d * @category set operations * @since 2.0.0 */ -const union = /*#__PURE__*/(0,_Function_js__rspack_import_2/* .dual */.XY)(2, (self, that) => { +const union = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, that) => { const a = fromIterable(self); const b = fromIterable(that); if (isReadonlyArrayNonEmpty(a)) { return isReadonlyArrayNonEmpty(b) ? dedupe(appendAll(a, b)) : a; } return b; -}); +}))); /** * Computes the intersection of two arrays using a custom equivalence. Order is * determined by the first array. @@ -43697,13 +43517,13 @@ const filter = /*#__PURE__*/(/* unused pure expression or super */ null && (dual * @category filtering * @since 2.0.0 */ -const partition = /*#__PURE__*/(0,_Function_js__rspack_import_2/* .dual */.XY)(2, (self, f) => { +const partition = /*#__PURE__*/(0,_Function_js__rspack_import_4/* .dual */.XY)(2, (self, f) => { const excluded = []; const satisfying = []; let i = 0; for (const a of self) { const result = f(a, i++); - if (_Result_js__rspack_import_7/* .isSuccess */.oJ(result)) { + if (_Result_js__rspack_import_5/* .isSuccess */.oJ(result)) { satisfying.push(result.success); } else { excluded.push(result.failure); @@ -44113,7 +43933,7 @@ const unfold = (b, f) => { * @category instances * @since 4.0.0 */ -const makeOrder = _Order_js__rspack_import_8/* .Array */.O3; +const makeOrder = _Order_js__rspack_import_6/* .Array */.O3; /** * Creates an `Equivalence` for arrays based on an element `Equivalence`. Two * arrays are equivalent when they have the same length and all elements are @@ -44134,7 +43954,7 @@ const makeOrder = _Order_js__rspack_import_8/* .Array */.O3; * @category instances * @since 4.0.0 */ -const makeEquivalence = _Equivalence_js__rspack_import_9/* .Array */.O3; +const makeEquivalence = _Equivalence_js__rspack_import_7/* .Array */.O3; /** * Runs a side-effect for each element. The callback receives `(element, index)`. * @@ -44576,7 +44396,6 @@ __webpack_require__.d(__webpack_exports__, { CZ: isArrayNonEmpty, ET: isReadonlyArrayNonEmpty, Ie: empty, - KC: union, Ts: fromIterable, jB: partition, of: of @@ -45935,6 +45754,7 @@ __webpack_require__.d(__webpack_exports__, { + /** @@ -46287,6 +46107,11 @@ const fromChunk = chunk => fromArray(Chunk.toReadonlyArray(chunk)); /** * Creates a `Channel` from an iterator that emits arrays of elements. * + * **Details** + * + * Finite fractional `chunkSize` values are rounded down. `NaN` and non-positive + * values are treated as `1` so every successful pull emits a non-empty array. + * * **Example** (Batching iterator output) * * ```ts import.meta.vitest @@ -46330,26 +46155,29 @@ const fromChunk = chunk => fromArray(Chunk.toReadonlyArray(chunk)); * @category constructors * @since 4.0.0 */ -const fromIteratorArray = (iterator, chunkSize = DefaultChunkSize) => fromPull(Effect.sync(() => { - const iter = iterator(); - let done = Option.none(); - return Effect.suspend(() => { - if (done._tag === "Some") return Cause.done(done.value); - const buffer = []; - while (buffer.length < chunkSize) { - const state = iter.next(); - if (state.done) { - if (buffer.length === 0) { - return Cause.done(state.value); +const fromIteratorArray = (iterator, chunkSize = DefaultChunkSize) => { + const size = Count.normalizeNonEmpty(chunkSize); + return fromPull(Effect.sync(() => { + const iter = iterator(); + let done = Option.none(); + return Effect.suspend(() => { + if (done._tag === "Some") return Cause.done(done.value); + const buffer = []; + while (buffer.length < size) { + const state = iter.next(); + if (state.done) { + if (buffer.length === 0) { + return Cause.done(state.value); + } + done = Option.some(state.value); + break; } - done = Option.some(state.value); - break; + buffer.push(state.value); } - buffer.push(state.value); - } - return Effect.succeed(buffer); - }); -})); + return Effect.succeed(buffer); + }); + })); +}; /** * Creates a `Channel` that emits all elements from an iterable. * @@ -46370,6 +46198,11 @@ const fromIterable = iterable => fromIterator(() => iterable[Symbol.iterator]()) /** * Creates a `Channel` that emits arrays of elements from an iterable. * + * **Details** + * + * Finite fractional `chunkSize` values are rounded down. `NaN` and non-positive + * values are treated as `1`. + * * **Example** (Batching iterable output) * * ```ts import.meta.vitest @@ -48313,6 +48146,29 @@ const catchCause = /*#__PURE__*/(/* unused pure expression or super */ null && ( return Effect.suspend(() => currentPull); }); })))); +/** + * Recovers from defects using the provided function. + * + * **Details** + * + * Typed failures and interruptions are not caught. + * + * **Example** (Recovering from a defect) + * + * ```ts import.meta.vitest + * import { Channel, Effect } from "effect" + * + * const channel = Channel.fromEffect(Effect.die("boom")).pipe( + * Channel.catchDefect((defect) => Channel.succeed(`recovered: ${defect}`)) + * ) + * + * Effect.runSync(Channel.runCollect(channel)) // => ["recovered: boom"] + * ``` + * + * @category error handling + * @since 4.0.0 + */ +const catchDefect = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, f) => catchCauseFilter(self, Cause.findDefect, f)))); /** * Runs an effect with the full failure `Cause` when the channel fails, then * fails the returned channel with the original cause. @@ -48892,9 +48748,8 @@ const splitLines = () => fromTransform((upstream, _scope) => Effect.sync(() => { // Accumulates text that has not yet been terminated by a line break. // Content is carried across chunks until a terminator is found. let stringBuilder = ""; - // Set when a chunk ends with \r so the next chunk can check whether - // the following character is \n (completing a \r\n pair) or not - // (standalone \r, which is itself a line terminator). + // A trailing \r completes the line immediately. Remember it only to + // suppress a leading \n in the next nonempty string. let midCRLF = false; // Remembers the upstream Done value after the first time the upstream // signals completion, so subsequent pulls return Done immediately @@ -48918,11 +48773,8 @@ const splitLines = () => fromTransform((upstream, _scope) => Effect.sync(() => { let indexOfLF = str.indexOf("\n"); if (midCRLF) { if (indexOfLF === 0) { - pushLine(""); from = 1; indexOfLF = str.indexOf("\n", from); - } else { - pushLine(""); } midCRLF = false; } @@ -48932,18 +48784,19 @@ const splitLines = () => fromTransform((upstream, _scope) => Effect.sync(() => { from = indexOfLF + 1; indexOfLF = str.indexOf("\n", from); } else { + pushLine(str.substring(from, indexOfCR)); if (str.length === indexOfCR + 1) { midCRLF = true; + from = str.length; indexOfCR = -1; } else { - pushLine(str.substring(from, indexOfCR)); from = indexOfCR + (indexOfLF === indexOfCR + 1 ? 2 : 1); indexOfCR = str.indexOf("\r", from); indexOfLF = str.indexOf("\n", from); } } } - stringBuilder = stringBuilder + str.substring(from, str.length - (midCRLF ? 1 : 0)); + stringBuilder = stringBuilder + str.substring(from); } } return Arr.isReadonlyArrayNonEmpty(chunkBuilder) ? chunkBuilder : null; @@ -48957,7 +48810,7 @@ const splitLines = () => fromTransform((upstream, _scope) => Effect.sync(() => { onFailure: Effect.failCause, onDone: leftover => { done = Option.some(leftover); - if (stringBuilder.length > 0 || midCRLF) { + if (stringBuilder.length > 0) { const last = stringBuilder; stringBuilder = ""; midCRLF = false; @@ -49647,6 +49500,11 @@ const runForEachWhile = /*#__PURE__*/(/* unused pure expression or super */ null /** * Concatenates a channel's `Uint8Array` chunks into a single `Uint8Array`. * + * **Gotchas** + * + * This materializes the full content in memory. The source channel must not + * reuse or mutate emitted buffers, which are retained until collection completes. + * * **Example** (Joining channel byte chunks) * * ```ts import.meta.vitest @@ -49661,11 +49519,6 @@ const runForEachWhile = /*#__PURE__*/(/* unused pure expression or super */ null * Array.from(bytes) // => [1, 2, 3, 4] * ``` * - * **Gotchas** - * - * This materializes the full content in memory. The source channel must not - * reuse or mutate emitted buffers, which are retained until collection completes. - * * @category running * @since 4.0.0 */ @@ -49719,13 +49572,6 @@ const runCollect = self => runFold(self, () => [], (acc, o) => { acc.push(o); return acc; }); -/** - * Runs a channel and outputs the done value. - * - * @category running - * @since 4.0.0 - */ -const runDone = self => runWith(self, identity_, Effect.succeed); /** * Runs a channel until the first output element is available, returning it in * an `Option`. @@ -50642,7 +50488,7 @@ const Service = function () { }; const ServiceProto = { [ServiceTypeId]: ServiceTypeId, - ... /*#__PURE__*/_Effectable_js__rspack_import_0/* .Prototype */.b({ + ... /*#__PURE__*/_Effectable_js__rspack_import_0/* .Prototype */.bp({ label: "Service", evaluate(fiber) { return (0,_internal_core_js__rspack_import_1/* .exitSucceed */.xt)(get(fiber.context, this)); @@ -51445,6 +51291,11 @@ const DeferredProto = { return (0,_Pipeable_js__rspack_import_1/* .pipeArguments */.tT)(this, arguments); } }; +const DeferredImpl = function () { + this.resumes = undefined; + this.effect = undefined; +}; +DeferredImpl.prototype = DeferredProto; /** * Creates an empty `Deferred` synchronously outside the `Effect` runtime. * @@ -51465,12 +51316,7 @@ const DeferredProto = { * @category unsafe * @since 4.0.0 */ -const makeUnsafe = () => { - const self = Object.create(DeferredProto); - self.resumes = undefined; - self.effect = undefined; - return self; -}; +const makeUnsafe = () => new DeferredImpl(); /** * Creates a new `Deferred`. * @@ -52149,15 +51995,15 @@ __webpack_require__.d(__webpack_exports__, { -const TypeId = "~effect/time/Duration"; +const TypeId = "~effect/Duration"; const bigint0 = /*#__PURE__*/BigInt(0); const bigint1 = /*#__PURE__*/BigInt(1); const bigint2 = /*#__PURE__*/BigInt(2); const bigint10 = /*#__PURE__*/BigInt(10); -const bigint24 = /*#__PURE__*/(/* unused pure expression or super */ null && (BigInt(24))); -const bigint60 = /*#__PURE__*/(/* unused pure expression or super */ null && (BigInt(60))); +const bigint24 = /*#__PURE__*/BigInt(24); +const bigint60 = /*#__PURE__*/BigInt(60); const bigint1e3 = /*#__PURE__*/BigInt(1_000); -const bigint1e6 = /*#__PURE__*/(/* unused pure expression or super */ null && (BigInt(1_000_000))); +const bigint1e6 = /*#__PURE__*/BigInt(1_000_000); const bigint1e9 = /*#__PURE__*/(/* unused pure expression or super */ null && (BigInt(1_000_000_000))); const roundTiesAwayFromZero = input => BigInt(input < 0 ? Math.ceil(input - 0.5) : Math.floor(input + 0.5)); const roundMillisToNanos = millis => roundTiesAwayFromZero(millis * 1_000_000); @@ -53594,7 +53440,7 @@ const CombinerMin = /*#__PURE__*/(/* unused pure expression or super */ null && //# sourceMappingURL=Duration.js.map __webpack_require__.d(__webpack_exports__, { }, { - Tn: infinity, + GP: format, bN: fromInputUnsafe, cF: nanos, kE: toMillis, @@ -53757,7 +53603,7 @@ const isEffect = _internal_core_js__rspack_import_0/* .isEffect */.yw; * ``` * * @see {@link forEach} for iterating over elements and applying an effect. - * @category combining + * @category collecting * @since 2.0.0 */ const all = _internal_effect_js__rspack_import_1/* .all */.Q7R; @@ -53785,7 +53631,7 @@ const all = _internal_effect_js__rspack_import_1/* .all */.Q7R; * await Effect.runPromise(program) // => [['0 is even', '2 is even'], [1, 3]] * ``` * - * @category filtering + * @category collecting * @since 2.0.0 */ const partition = _internal_effect_js__rspack_import_1/* .partition */.jBG; @@ -53823,7 +53669,7 @@ const partition = _internal_effect_js__rspack_import_1/* .partition */.jBG; * output // => ["Adding 1 at index 0", "Adding 2 at index 1", "Adding 3 at index 2", 6] * ``` * - * @category folding + * @category collecting * @since 2.0.0 */ const reduce = _internal_effect_js__rspack_import_1/* .reduce */.TSs; @@ -53851,7 +53697,7 @@ const reduce = _internal_effect_js__rspack_import_1/* .reduce */.TSs; * await Effect.runPromiseExit(program) // => Exit.fail(["0 is even", "2 is even"]) * ``` * - * @category validation + * @category collecting * @since 2.0.0 */ const validate = _internal_effect_js__rspack_import_1/* .validate */.tfT; @@ -53873,7 +53719,7 @@ const validate = _internal_effect_js__rspack_import_1/* .validate */.tfT; * await Effect.runPromise(program) // => Option.some(3) * ``` * - * @category searching + * @category collecting * @since 2.0.0 */ const findFirst = _internal_effect_js__rspack_import_1/* .findFirst */.i8i; @@ -53892,7 +53738,7 @@ const findFirst = _internal_effect_js__rspack_import_1/* .findFirst */.i8i; * * @see {@link findFirst} for the simpler effectful predicate-based variant * - * @category searching + * @category collecting * @since 4.0.0 */ const findFirstFilter = _internal_effect_js__rspack_import_1/* .findFirstFilter */.kAe; @@ -53957,7 +53803,7 @@ const findFirstFilter = _internal_effect_js__rspack_import_1/* .findFirstFilter * ``` * * @see {@link all} for combining multiple effects into one. - * @category sequencing + * @category collecting * @since 2.0.0 */ const forEach = _internal_effect_js__rspack_import_1/* .forEach */.jJl; @@ -53982,7 +53828,7 @@ const forEach = _internal_effect_js__rspack_import_1/* .forEach */.jJl; * await Effect.runPromise(empty) // => Option.none() * ``` * - * @category getters + * @category collecting * @since 2.0.0 */ const head = _internal_effect_js__rspack_import_1/* .head */.d5f; @@ -54393,7 +54239,7 @@ const never = _internal_effect_js__rspack_import_1/* .never */.ZmZ; * Effect.runSync(program) // => { x: 2, y: 3, sum: 5 } * ``` * - * @category constructors + * @category do notation * @since 2.0.0 */ const Do = _internal_effect_js__rspack_import_1.Do; @@ -54409,7 +54255,7 @@ const Do = _internal_effect_js__rspack_import_1.Do; * @see {@link Do} for starting from an empty accumulated record * @see {@link bind} for adding fields produced by effects * - * @category mapping + * @category do notation * @since 2.0.0 */ const bindTo = _internal_effect_js__rspack_import_1/* .bindTo */.JrD; @@ -54439,7 +54285,7 @@ const let_ = _internal_effect_js__rspack_import_1/* ["let"] */.uVU; * @see {@link bindTo} for naming the success value of an existing effect * @see {@link gen} for generator-based sequencing without accumulating a record * - * @category sequencing + * @category do notation * @since 2.0.0 */ const bind = _internal_effect_js__rspack_import_1/* .bind */.oIE; @@ -54716,6 +54562,23 @@ const yieldNowWith = _internal_effect_js__rspack_import_1/* .yieldNowWith */.KN3 * @since 4.0.0 */ const withFiber = _internal_core_js__rspack_import_0/* .withFiber */.R6; +/** + * Accesses the current fiber to compute a successful value. + * + * **Example** (Computing a value from the current fiber) + * + * ```ts import.meta.vitest + * import { Effect } from "effect" + * + * const program = Effect.withFiberSucceed((fiber) => typeof fiber.id) + * + * Effect.runSync(program) // => "number" + * ``` + * + * @category constructors + * @since 4.0.0 + */ +const withFiberSucceed = _internal_core_js__rspack_import_0/* .withFiberSucceed */.Hq; // ----------------------------------------------------------------------------- // Conversions // ----------------------------------------------------------------------------- @@ -56093,7 +55956,7 @@ const orDie = _internal_effect_js__rspack_import_1/* .orDie */.QgK; * output // => ["expected error: NetworkError", Exit.fail("NetworkError")] * ``` * - * @category sequencing + * @category error handling * @since 2.0.0 */ const tapError = _internal_effect_js__rspack_import_1/* .tapError */.sFT; @@ -56131,7 +55994,7 @@ const tapError = _internal_effect_js__rspack_import_1/* .tapError */.sFT; * output // => ["expected error: 504", Exit.fail(new NetworkError({ statusCode: 504 }))] * ``` * - * @category sequencing + * @category error handling * @since 2.0.0 */ const tapErrorTag = _internal_effect_js__rspack_import_1/* .tapErrorTag */.k$L; @@ -56167,7 +56030,7 @@ const tapErrorTag = _internal_effect_js__rspack_import_1/* .tapErrorTag */.k$L; * output // => ["Logging cause: Something went wrong", Exit.fail("Something went wrong")] * ``` * - * @category sequencing + * @category error handling * @since 4.0.0 */ const tapCause = _internal_effect_js__rspack_import_1/* .tapCause */.dGm; @@ -56199,7 +56062,7 @@ const tapCause = _internal_effect_js__rspack_import_1/* .tapCause */.dGm; * output // => ["Logging failure cause: Network timeout", Exit.fail("Network timeout")] * ``` * - * @category sequencing + * @category error handling * @since 4.0.0 */ const tapCauseIf = _internal_effect_js__rspack_import_1/* .tapCauseIf */.cA6; @@ -56222,7 +56085,7 @@ const tapCauseIf = _internal_effect_js__rspack_import_1/* .tapCauseIf */.cA6; * @see {@link tapCause} for observing every failure cause * @see {@link catchCauseFilter} for recovering from selected causes instead of only observing them * - * @category sequencing + * @category error handling * @since 4.0.0 */ const tapCauseFilter = _internal_effect_js__rspack_import_1/* .tapCauseFilter */.bKC; @@ -56257,7 +56120,7 @@ const tapCauseFilter = _internal_effect_js__rspack_import_1/* .tapCauseFilter */ * output // => ["defect: Something went wrong", Exit.die("Something went wrong")] * ``` * - * @category sequencing + * @category error handling * @since 2.0.0 */ const tapDefect = _internal_effect_js__rspack_import_1/* .tapDefect */.nAi; @@ -56598,8 +56461,9 @@ const withErrorReporting = _internal_effect_js__rspack_import_1/* .withErrorRepo * **Details** * * If the source effect succeeds, its value is preserved. If it fails in the - * error channel, `orElseSucceed` evaluates the fallback and succeeds with that - * value, removing the typed error from the returned effect. + * error channel, `orElseSucceed` evaluates the fallback with that error and + * succeeds with the returned value, removing the typed error from the returned + * effect. * * Defects and interruptions are not recovered by this operator. * @@ -56618,9 +56482,9 @@ const withErrorReporting = _internal_effect_js__rspack_import_1/* .withErrorRepo * } * } * - * const program = Effect.orElseSucceed(validate(-1), () => 18) + * const program = Effect.orElseSucceed(validate(-1), (error) => error === "IllegalAgeError" ? 18 : 0) * - * Effect.runSyncExit(program) // => Exit.succeed(18) + * Effect.runSyncExit(program) // => Exit.succeed(0) * ``` * * @category error handling @@ -56744,21 +56608,8 @@ const timeout = _internal_effect_js__rspack_import_1/* .timeout */.wRz; */ const timeoutOption = _internal_effect_js__rspack_import_1/* .timeoutOption */.D52; /** - * Applies a timeout to an effect, with a fallback effect executed if the timeout is reached. - * - * **When to use** - * - * Use when a timeout of an `Effect` should switch to a fallback effect. - * - * **Details** - * - * The fallback effect is created lazily by `orElse` and may introduce its own - * success, failure, and requirement types. - * - * **Gotchas** - * - * If the timeout wins, the source effect is interrupted before the fallback is - * run. + * Applies a timeout to an effect, lazily evaluating `orElse` after interrupting + * the source if the timeout is reached. * * **Example** (Falling back on timeout) * @@ -57006,7 +56857,7 @@ const raceFirst = _internal_effect_js__rspack_import_1/* .raceFirst */.KT6; * output // => [[2, 4], [2, 3]] * ``` * - * @category filtering + * @category collecting * @since 2.0.0 */ const filter = _internal_effect_js__rspack_import_1/* .filter */.pbD; @@ -57026,7 +56877,7 @@ const filter = _internal_effect_js__rspack_import_1/* .filter */.pbD; * @see {@link filter} for keeping original elements with a boolean predicate, refinement, or effectful predicate * @see {@link filterMapEffect} for using an effectful `Filter` * - * @category filtering + * @category collecting * @since 2.0.0 */ const filterMap = _internal_effect_js__rspack_import_1/* .filterMap */.x1Q; @@ -57051,7 +56902,7 @@ const filterMap = _internal_effect_js__rspack_import_1/* .filterMap */.x1Q; * @see {@link filterMap} for using a synchronous `Filter` * @see {@link filter} for keeping original elements with a predicate * - * @category filtering + * @category collecting * @since 4.0.0 */ const filterMapEffect = _internal_effect_js__rspack_import_1/* .filterMapEffect */.E8K; @@ -58592,6 +58443,8 @@ const onExitPrimitive = _internal_effect_js__rspack_import_1/* .onExitPrimitive * Ensures that a cleanup function runs whether this effect succeeds, fails, or * is interrupted. * + * **Details** + * * If both the effect and the cleanup function fail, the two causes are merged. * * **Example** (Observing every exit) @@ -58721,8 +58574,8 @@ const onExitFilter = _internal_effect_js__rspack_import_1/* .onExitFilter */.uRq */ const cached = _internal_effect_js__rspack_import_1/* .cached */.PO3; /** - * Returns an effect that caches its result for a specified `Duration`, - * known as "timeToLive" (TTL). + * Returns an effect that caches its result for a fixed duration or a duration + * computed from its `Exit`, known as "timeToLive" (TTL). * * **When to use** * @@ -58741,6 +58594,17 @@ const cached = _internal_effect_js__rspack_import_1/* .cached */.PO3; * After the specified duration has passed, the cache expires, and the effect * will be recomputed upon the next evaluation. * + * `timeToLive` accepts a `Duration.Input` or a function from `Exit` to + * `Duration.Input`. The function runs once after each fresh computation, + * including failures, so successes and failures can have different TTLs. It + * does not run when the cache is created or when a cached result is reused. + * The callback also receives interruption exits, which are cached for the + * returned duration. + * + * The TTL starts when the computation completes. Concurrent callers share the + * pending computation. A zero TTL expires immediately, and an infinite TTL + * keeps the result indefinitely. + * * **Example** (Memoizing an effect with TTL) * * ```ts import.meta.vitest @@ -58765,6 +58629,26 @@ const cached = _internal_effect_js__rspack_import_1/* .cached */.PO3; * output // => ["expensive task...", "result 1", "result 1", "result 1"] * ``` * + * **Example** (Caching successes while retrying failures) + * + * ```ts import.meta.vitest + * import { Effect, Exit } from "effect" + * + * let attempts = 0 + * const task = Effect.suspend(() => + * ++attempts === 1 ? Effect.fail("temporary failure") : Effect.succeed(42) + * ) + * const program = Effect.gen(function*() { + * const cached = yield* task.pipe( + * Effect.cachedWithTTL((exit) => Exit.isSuccess(exit) ? "1 hour" : 0) + * ) + * yield* Effect.exit(cached) + * return yield* cached + * }) + * + * Effect.runSync(program) // => 42 + * ``` + * * @see {@link cached} for a similar function that caches the result * indefinitely. * @see {@link cachedInvalidateWithTTL} for a similar function that includes an @@ -59144,10 +59028,10 @@ const repeat = _internal_schedule_js__rspack_import_2/* .repeat */.ux; * const program = Effect.repeatOrElse( * task, * Schedule.recurs(3), - * (error, attempts) => + * (error, previous) => * Effect.sync(() => { output.push( * `Final failure: ${error}, after ${ - * Option.getOrElse(attempts, () => 0) + * Option.isSome(previous) ? previous.value.attempt : 0 * } attempts` * ) }).pipe(Effect.map(() => 0)) * ) @@ -59935,7 +59819,7 @@ const forkDetach = _internal_effect_js__rspack_import_1/* .forkDetach */.yxg; * @see {@link forkIn} for forking into an explicit scope * @see {@link forkScoped} for forking fibers tied to the current scope * - * @category sequencing + * @category forking * @since 2.0.0 */ const awaitAllChildren = _internal_effect_js__rspack_import_1/* .awaitAllChildren */.PCg; @@ -61089,14 +60973,10 @@ const withLogSpan = /*#__PURE__*/(/* unused pure expression or super */ null && // Metrics // ----------------------------------------------------------------------------- /** - * Updates the `Metric` every time the `Effect` is executed. + * Updates a metric after each effect execution, optionally mapping its `Exit` to + * the metric's input. * - * **Details** - * - * Also accepts an optional function which can be used to map the `Exit` value - * of the `Effect` into a valid `Input` for the `Metric`. - * - * **Example** (Incrementing a metric for each execution) + * **Example** (Counting executions) * * ```ts import.meta.vitest * import { Effect, Metric } from "effect" @@ -61113,12 +60993,11 @@ const withLogSpan = /*#__PURE__*/(/* unused pure expression or super */ null && * Effect.runSync(Metric.value(counter)).count // => 1 * ``` * - * **Example** (Mapping exits before updating a metric) + * **Example** (Mapping exits) * * ```ts import.meta.vitest * import { Effect, Exit, Metric } from "effect" * - * // Track different exit types with custom mapping * const exitTracker = Metric.frequency("exit_types", { * description: "Tracks success/failure/defect counts" * }) @@ -61378,7 +61257,7 @@ const trackDuration = /*#__PURE__*/(/* unused pure expression or super */ null & * Effect.runSync(runnable) // => "Transaction complete" * ``` * - * @category services + * @category transactions * @since 4.0.0 */ class Transaction extends /*#__PURE__*/(/* unused pure expression or super */ null && (Context.Service()("effect/Effect/Transaction"))) {} @@ -62007,6 +61886,7 @@ __webpack_require__.d(__webpack_exports__, { * When the effect is evaluated, it calls `evaluate` with the current fiber. * * @see {@link Class} for a class-based approach to defining custom Effect values + * @see {@link Mixin} for wrapping an existing class constructor * * @category prototypes * @since 4.0.0 @@ -62015,14 +61895,15 @@ const Prototype = options => (0,_internal_core_js__rspack_import_0/* .makePrimit op: options.label, [_internal_core_js__rspack_import_0/* .evaluate */._3]: options.evaluate }); +const proto = /*#__PURE__*/(/* unused pure expression or super */ null && (Prototype({ + label: "Effectable", + evaluate(_) { + return this.asEffect(); + } +}))); const Base = /*#__PURE__*/(/* unused pure expression or super */ null && ((() => { const Base = function () {}; - Base.prototype = /*#__PURE__*/Prototype({ - label: "Effectable", - evaluate(_) { - return this; - } - }); + Base.prototype = proto; return Base; })())); /** @@ -62034,14 +61915,64 @@ const Base = /*#__PURE__*/(/* unused pure expression or super */ null && ((() => * as `Effect` values. * * @see {@link Prototype} for a lower-level primitive approach to creating custom Effect-like values without a class + * @see {@link Mixin} for wrapping an existing class constructor * @category constructors * @since 2.0.0 */ class Class extends (/* unused pure expression or super */ null && (Base)) {} +/** + * Returns a subclass of the provided class that inserts the Effect prototype + * into the inheritance chain. + * + * **When to use** + * + * Use to make instances of an existing class behave as `Effect` values without + * extending {@link Class} or modifying the original prototype. + * + * **Details** + * + * Pass the class to wrap, then implement `asEffect` on the final class. The + * returned class is abstract, and the success, error, and service types are + * inferred from the concrete `asEffect` return type. Concrete and abstract base + * classes are supported. Constructor parameters and instance members are + * preserved, except that Effect's prototype members shadow base prototype + * members with the same name: `pipe`, `toString`, `toJSON`, `[Symbol.iterator]`, + * and `[Symbol.for("nodejs.util.inspect.custom")]`. + * + * **Example** (Evaluating a mixed-in class) + * + * ```ts import.meta.vitest + * import { Effect, Effectable } from "effect" + * + * class Box { + * constructor(readonly value: number) {} + * } + * + * class EffectBox extends Effectable.Mixin(Box) { + * asEffect() { + * return Effect.succeed(this.value) + * } + * } + * + * const box = new EffectBox(2) + * Effect.isEffect(box) // => true + * await Effect.runPromise(box) // => 2 + * ``` + * + * @see {@link Prototype} for a lower-level primitive approach to creating custom Effect-like values without a class + * @see {@link Class} for a base constructor to extend + * @category constructors + * @since 4.0.0 + */ +const Mixin = klass => { + class Mixed extends klass {} + Object.defineProperties(Mixed.prototype, Object.getOwnPropertyDescriptors(proto)); + return Mixed; +}; //# sourceMappingURL=Effectable.js.map __webpack_require__.d(__webpack_exports__, { }, { - b: Prototype + bp: Prototype }); @@ -62081,7 +62012,7 @@ __webpack_require__.d(__webpack_exports__, { * @category type IDs * @since 4.0.0 */ -const EncodingErrorTypeId = "~effect/encoding/EncodingError"; +const EncodingErrorTypeId = "~effect/Encoding/EncodingError"; /** * Error returned when an encoding or decoding operation cannot process its * input. @@ -62403,6 +62334,8 @@ const encodeHex = input => typeof input === "string" ? hexEncodeUint8Array(encod * Generates a random lowercase hexadecimal string, optimized for lengths that * are multiples of 8. * + * **Details** + * * `length` is not validated. The function generates `length >>> 3` random * 8-character words, so non-negative lengths below `2 ** 32` are rounded down * to a multiple of 8 and other values follow JavaScript's unsigned 32-bit @@ -62416,12 +62349,41 @@ const encodeHex = input => typeof input === "string" ? hexEncodeUint8Array(encod * @since 4.0.0 */ const randomHex = length => { - let result = ""; - for (let i = length >>> 3; i > 0; i--) { - const word = Math.random() * 0x100000000 >>> 0; - result += byteToHex[word >>> 24] + byteToHex[word >>> 16 & 0xff] + byteToHex[word >>> 8 & 0xff] + byteToHex[word & 0xff]; + switch (length) { + case 16: + return randomHex16(); + case 32: + return randomHex32(); + default: + { + let result = ""; + for (let i = length >>> 3; i > 0; i--) { + result += randomHex8(); + } + return result; + } } - return result; +}; +const hexCharCodes = /*#__PURE__*/Uint8Array.from("0123456789abcdef", c => c.charCodeAt(0)); +const randomWord = () => Math.random() * 0x100000000 >>> 0; +// Trace and span identifiers are the common lengths. A single +// String.fromCharCode call produces a flat string, which avoids rope +// flattening when the identifier is later serialized. +const randomHex8 = () => { + const a = randomWord(); + return String.fromCharCode(hexCharCodes[a >>> 28], hexCharCodes[a >>> 24 & 15], hexCharCodes[a >>> 20 & 15], hexCharCodes[a >>> 16 & 15], hexCharCodes[a >>> 12 & 15], hexCharCodes[a >>> 8 & 15], hexCharCodes[a >>> 4 & 15], hexCharCodes[a & 15]); +}; +const randomHex16 = () => { + const a = randomWord(); + const b = randomWord(); + return String.fromCharCode(hexCharCodes[a >>> 28], hexCharCodes[a >>> 24 & 15], hexCharCodes[a >>> 20 & 15], hexCharCodes[a >>> 16 & 15], hexCharCodes[a >>> 12 & 15], hexCharCodes[a >>> 8 & 15], hexCharCodes[a >>> 4 & 15], hexCharCodes[a & 15], hexCharCodes[b >>> 28], hexCharCodes[b >>> 24 & 15], hexCharCodes[b >>> 20 & 15], hexCharCodes[b >>> 16 & 15], hexCharCodes[b >>> 12 & 15], hexCharCodes[b >>> 8 & 15], hexCharCodes[b >>> 4 & 15], hexCharCodes[b & 15]); +}; +const randomHex32 = () => { + const a = randomWord(); + const b = randomWord(); + const c = randomWord(); + const d = randomWord(); + return String.fromCharCode(hexCharCodes[a >>> 28], hexCharCodes[a >>> 24 & 15], hexCharCodes[a >>> 20 & 15], hexCharCodes[a >>> 16 & 15], hexCharCodes[a >>> 12 & 15], hexCharCodes[a >>> 8 & 15], hexCharCodes[a >>> 4 & 15], hexCharCodes[a & 15], hexCharCodes[b >>> 28], hexCharCodes[b >>> 24 & 15], hexCharCodes[b >>> 20 & 15], hexCharCodes[b >>> 16 & 15], hexCharCodes[b >>> 12 & 15], hexCharCodes[b >>> 8 & 15], hexCharCodes[b >>> 4 & 15], hexCharCodes[b & 15], hexCharCodes[c >>> 28], hexCharCodes[c >>> 24 & 15], hexCharCodes[c >>> 20 & 15], hexCharCodes[c >>> 16 & 15], hexCharCodes[c >>> 12 & 15], hexCharCodes[c >>> 8 & 15], hexCharCodes[c >>> 4 & 15], hexCharCodes[c & 15], hexCharCodes[d >>> 28], hexCharCodes[d >>> 24 & 15], hexCharCodes[d >>> 20 & 15], hexCharCodes[d >>> 16 & 15], hexCharCodes[d >>> 12 & 15], hexCharCodes[d >>> 8 & 15], hexCharCodes[d >>> 4 & 15], hexCharCodes[d & 15]); }; /** * Decodes a hexadecimal string into bytes safely. @@ -62545,10 +62507,9 @@ const base64codes = (/* unused pure expression or super */ null && ([255, 255, 2 // Base64Url internals const base64UrlEncodeUint8Array = data => base64EncodeUint8Array(data).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_"); // Hex internals -const byteToHex = []; -for (let i = 0; i < 256; i++) { - byteToHex.push(i.toString(16).padStart(2, "0")); -} +const byteToHex = /*#__PURE__*/(/* unused pure expression or super */ null && (Array.from({ + length: 256 +}, (_, i) => i.toString(16).padStart(2, "0")))); const hexEncodeUint8Array = bytes => { let result = ""; for (let i = 0; i < bytes.length; i++) { @@ -62621,7 +62582,7 @@ __webpack_require__.d(__webpack_exports__, { * @category symbols * @since 2.0.0 */ -const symbol = "~effect/interfaces/Equal"; +const symbol = "~effect/Equal"; function equals() { if (arguments.length === 1) { return self => compareBoth(self, arguments[0]); @@ -63767,6 +63728,7 @@ const Proto = (/* unused pure expression or super */ null && ({ const self = this; return effect.contextWith(context => effect.succeed(makeProto(self.steps.map(step => ({ ...step, + while: step.while ? input => effect.provideContext(step.while(input), context) : undefined, provide: Layer.isLayer(step.provide) ? Layer.provide(step.provide, Layer.succeedContext(context)) : step.provide }))))); }, @@ -65603,6 +65565,7 @@ __webpack_require__.d(__webpack_exports__, { * - Handles `BigInt`, `Symbol`, `Set`, `Map`, `Date`, `RegExp`, and class * instances that `JSON.stringify` cannot represent. * - Circular references are shown as `"[Circular]"` instead of throwing. + * - Failures while inspecting a value are rendered as diagnostic placeholders instead of throwing. * - Primitives: stringified naturally (`null`, `undefined`, `123`, `true`). * Strings are JSON-quoted. * - Objects with a custom `toString` (not `Object.prototype.toString`): @@ -65667,6 +65630,14 @@ function format(input, options) { } }; function recur(v, d = 0) { + try { + return recurUnsafe(v, d); + } catch { + if (typeof v === "object" && v !== null || typeof v === "function") ancestors.delete(v); + return "[inspection threw]"; + } + } + function recurUnsafe(v, d = 0) { if (typeof v === "string") return JSON.stringify(v); if (typeof v === "number" || v == null || typeof v === "boolean" || typeof v === "symbol") return String(v); if (typeof v === "bigint") return String(v) + "n"; @@ -65682,16 +65653,16 @@ function format(input, options) { output = formatDate(v); } else if (!options?.ignoreToString && _Predicate_js__rspack_import_1/* .hasProperty */.i5(v, "toString") && typeof v["toString"] === "function" && v["toString"] !== Object.prototype.toString && v["toString"] !== Array.prototype.toString) { const s = safeToString(v); - output = v instanceof Error && v.cause ? `${s} (cause: ${recur(v.cause, d)})` : s; + output = v instanceof Error && v.cause !== undefined ? `${s} (cause: ${recur(v.cause, d)})` : s; } else if (Symbol.iterator in v) { output = `${v.constructor.name}(${recur(Array.from(v), d)})`; } else { const keys = ownKeys(v); if (!gap || keys.length <= 1) { - const body = `{${keys.map(k => `${formatPropertyKey(k)}:${recur(v[k], d)}`).join(",")}}`; + const body = `{${keys.map(k => `${formatPropertyKey(k)}:${recur(safeGet(v, k), d)}`).join(",")}}`; output = wrap(v, body); } else { - const body = `{\n${keys.map(k => `${ind(d + 1)}${formatPropertyKey(k)}: ${recur(v[k], d + 1)}`).join(",\n")}\n${ind(d)}}`; + const body = `{\n${keys.map(k => `${ind(d + 1)}${formatPropertyKey(k)}: ${recur(safeGet(v, k), d + 1)}`).join(",\n")}\n${ind(d)}}`; output = wrap(v, body); } } @@ -65738,6 +65709,13 @@ function safeToString(input) { return "[toString threw]"; } } +function safeGet(input, key) { + try { + return input[key]; + } catch { + return "[property access threw]"; + } +} /** * Stringifies a value to JSON safely, silently dropping circular references. * @@ -66474,7 +66452,7 @@ __webpack_require__.d(__webpack_exports__, { * @category symbols * @since 2.0.0 */ -const symbol = "~effect/interfaces/Hash"; +const symbol = "~effect/Hash"; /** * Computes a hash value for any given value. * @@ -66516,10 +66494,6 @@ const hash = self => { return number(self); case "bigint": return string(self.toString(10)); - case "boolean": - return string(String(self)); - case "symbol": - return string(String(self)); case "string": return string(self); case "undefined": @@ -66564,7 +66538,8 @@ const hash = self => { } } default: - throw new Error(`BUG: unhandled typeof ${typeof self} - please report an issue at https://github.com/Effect-TS/effect/issues`); + // The remaining primitive types are boolean and symbol. + return string(String(self)); } }; /** @@ -66719,14 +66694,8 @@ const isHash = u => (0,_Predicate_js__rspack_import_2/* .hasProperty */.i5)(u, s * @since 2.0.0 */ const number = n => { - if (n !== n) { - return string("NaN"); - } - if (n === Infinity) { - return string("Infinity"); - } - if (n === -Infinity) { - return string("-Infinity"); + if (n !== n || n === Infinity || n === -Infinity) { + return string(String(n)); } let h = n | 0; if (h !== n) { @@ -67186,14 +67155,15 @@ __webpack_require__.d(__webpack_exports__, { + /** * Creates an iterable by applying a function to consecutive integers. * * **Details** * - * The function is called with each index starting from `0`. If no length is - * specified, the iterable is infinite. This is useful for generating - * sequences, patterns, or any indexed data. + * The function is called with each index starting from `0`. If a length is + * provided, it is rounded down and normalized to at least `1`, with `NaN` + * treated as `1`. If no length is specified, the iterable is infinite. * * **Example** (Generating values by index) * @@ -67218,7 +67188,7 @@ __webpack_require__.d(__webpack_exports__, { * @since 2.0.0 */ const makeBy = (f, options) => { - const max = options?.length !== undefined ? Math.max(1, Math.floor(options.length)) : Infinity; + const max = options?.length !== undefined ? Count.normalizeNonEmpty(options.length) : Infinity; return { [Symbol.iterator]() { let i = 0; @@ -67272,7 +67242,8 @@ const range = (start, end) => { * * **Details** * - * `n` is normalized to an integer greater than or equal to `1`. + * `n` is rounded down and normalized to an integer greater than or equal to + * `1`. `NaN` is treated as `1`. * * **Example** (Repeating a value) * @@ -67298,7 +67269,8 @@ const replicate = /*#__PURE__*/(/* unused pure expression or super */ null && (d * * **Details** * - * The result is lazy. Each repetition obtains a new iterator from `self`. + * The result is lazy. `n` is rounded down and normalized to at least `1`, with + * `NaN` treated as `1`. Each repetition obtains a new iterator from `self`. * * @see {@link forever} for repeating without an upper bound * @see {@link replicate} for repeating a single value @@ -67671,7 +67643,8 @@ const headUnsafe = self => { * * **Details** * - * `n` is normalized to a non-negative integer. + * `n` is rounded down and normalized to a non-negative integer. `NaN` is + * treated as `0`. * * **Example** (Taking from the start) * @@ -67699,24 +67672,27 @@ const headUnsafe = self => { * @category getters * @since 2.0.0 */ -const take = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => ({ - [Symbol.iterator]() { - let i = 0; - const iterator = self[Symbol.iterator](); - return { - next() { - if (i < n) { - i++; - return iterator.next(); +const take = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { + const count = Count.normalize(n); + return { + [Symbol.iterator]() { + let i = 0; + const iterator = self[Symbol.iterator](); + return { + next() { + if (i < count) { + i++; + return iterator.next(); + } + return { + done: true, + value: undefined + }; } - return { - done: true, - value: undefined - }; - } - }; - } -})))); + }; + } + }; +}))); /** * Takes the longest initial `Iterable` prefix for which all elements satisfy the * specified predicate. @@ -67775,7 +67751,8 @@ const takeWhile = /*#__PURE__*/(/* unused pure expression or super */ null && (d * * **Details** * - * `n` is normalized to a non-negative integer. + * `n` is rounded down and normalized to a non-negative integer. `NaN` is + * treated as `0`. * * **Example** (Dropping from the start) * @@ -67802,27 +67779,30 @@ const takeWhile = /*#__PURE__*/(/* unused pure expression or super */ null && (d * @category getters * @since 2.0.0 */ -const drop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => ({ - [Symbol.iterator]() { - const iterator = self[Symbol.iterator](); - let i = 0; - return { - next() { - while (i < n) { - const result = iterator.next(); - if (result.done) { - return { - done: true, - value: undefined - }; +const drop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { + const count = Count.normalize(n); + return { + [Symbol.iterator]() { + const iterator = self[Symbol.iterator](); + let i = 0; + return { + next() { + while (i < count) { + const result = iterator.next(); + if (result.done) { + return { + done: true, + value: undefined + }; + } + i++; } - i++; + return iterator.next(); } - return iterator.next(); - } - }; - } -})))); + }; + } + }; +}))); /** * Returns the first element that satisfies the specified * predicate, or `None` if no such element exists. @@ -68189,6 +68169,8 @@ const contains = /*#__PURE__*/(/* unused pure expression or super */ null && (co /** * Splits an `Iterable` into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of * the `Iterable`. + * `n` is rounded down and normalized to at least `1`; `NaN` and non-positive + * values therefore produce singleton pieces. * * **Example** (Chunking an iterable) * @@ -68223,7 +68205,7 @@ const contains = /*#__PURE__*/(/* unused pure expression or super */ null && (co * @since 2.0.0 */ const chunksOf = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { - const safeN = Math.max(1, Math.floor(n)); + const safeN = Count.normalizeNonEmpty(n); return { [Symbol.iterator]() { let iterator = self[Symbol.iterator](); @@ -70528,6 +70510,7 @@ const effectDiscard = effect => effectContext(internalEffect.as(effect, Context. * @since 2.0.0 */ const suspend = evaluate => fromBuildMemo((memoMap, scope) => internalEffect.suspend(() => evaluate().build(memoMap, scope))); +const unwrapKey = /*#__PURE__*/(/* unused pure expression or super */ null && (Context.Service("effect/Layer/unwrap"))); /** * Unwraps a `Layer` from an `Effect`, flattening the nested structure. * @@ -70562,10 +70545,7 @@ const suspend = evaluate => fromBuildMemo((memoMap, scope) => internalEffect.sus * @category converting * @since 4.0.0 */ -const unwrap = self => { - const service = Context.Service("effect/Layer/unwrap"); - return flatMap(effect(service)(self), Context.get(service)); -}; +const unwrap = self => flatMap(effect(unwrapKey)(self), Context.get(unwrapKey)); const mergeAllEffect = (layers, memoMap, scope) => { const parentScope = _Scope_js__rspack_import_3/* .forkUnsafe */.Fp(scope, "parallel"); return _internal_effect_js__rspack_import_0/* .forEach */.jJl(layers, layer => layer.build(memoMap, _Scope_js__rspack_import_3/* .forkUnsafe */.Fp(parentScope, "sequential")), { @@ -71607,9 +71587,9 @@ const withSpan = function () { const options = internalTracer.addSpanStackTrace(dataFirst ? arguments[2] : arguments[1]); if (dataFirst) { const self = arguments[0]; - return unwrap(internalEffect.map(options?.onEnd !== undefined ? internalEffect.tap(internalEffect.makeSpanScoped(name, options), span => internalEffect.addFinalizer(exit => options.onEnd(span, exit))) : internalEffect.makeSpanScoped(name, options), span => withParentSpan(self, span))); + return unwrap(internalEffect.map(options?.onEnd !== undefined ? internalEffect.tap(internalEffect.makeSpanScoped(name, options), span => internalEffect.addFinalizer(exit => options.onEnd(span, exit))) : internalEffect.makeSpanScoped(name, options), span => withParentSpan(self, span, options))); } - return self => unwrap(internalEffect.map(options?.onEnd !== undefined ? internalEffect.tap(internalEffect.makeSpanScoped(name, options), span => internalEffect.addFinalizer(exit => options.onEnd(span, exit))) : internalEffect.makeSpanScoped(name, options), span => withParentSpan(self, span))); + return self => unwrap(internalEffect.map(options?.onEnd !== undefined ? internalEffect.tap(internalEffect.makeSpanScoped(name, options), span => internalEffect.addFinalizer(exit => options.onEnd(span, exit))) : internalEffect.makeSpanScoped(name, options), span => withParentSpan(self, span, options))); }; /** * Wraps a layer so spans created during its construction use the supplied span @@ -71712,6 +71692,7 @@ __webpack_require__.d(__webpack_exports__, { }, "./node_modules/effect/dist/MutableList.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) { +/* import */ var _internal_count_js__rspack_import_0 = __webpack_require__("./node_modules/effect/dist/internal/count.js"); /** * Mutable lists for collecting ordered values and draining them from the front. * A `MutableList` can append values to the end, prepend values to the @@ -71723,6 +71704,7 @@ __webpack_require__.d(__webpack_exports__, { * @since 4.0.0 */ + /** * Defines the unique symbol used to represent an empty result when taking elements from a MutableList. * This symbol is returned by `take` when the list is empty, allowing for safe type checking. @@ -71897,6 +71879,7 @@ const prependAllUnsafe = (self, messages, mutable = false) => { offset: 0, next: self.head }; + if (!self.tail && messages.length > 0) self.tail = self.head; self.length += self.head.array.length; }; /** @@ -72001,6 +71984,11 @@ const clear = self => { * The taken elements are removed from the list. This operation is optimized for performance * and includes zero-copy optimizations when possible. * + * **Details** + * + * Finite fractional values of `n` are rounded down. `NaN` and non-positive + * values leave the list unchanged and return an empty array. + * * **Example** (Taking batches) * * ```ts import.meta.vitest @@ -72018,6 +72006,7 @@ const clear = self => { * @since 4.0.0 */ const takeN = (self, n) => { + n = _internal_count_js__rspack_import_0/* .normalize */.S(n); if (n <= 0 || !self.head) return []; n = Math.min(n, self.length); if (n === self.length && self.head?.offset === 0 && !self.head.next) { @@ -72056,8 +72045,9 @@ const takeN = (self, n) => { * * **Details** * - * If `n` is less than or equal to zero, or the list is empty, the list is left - * unchanged. If `n` is greater than or equal to the current length, the list is + * Finite fractional values of `n` are rounded down. If `n` is `NaN` or + * non-positive, or the list is empty, the list is left unchanged. If the + * normalized count is greater than or equal to the current length, the list is * cleared. * * @see {@link takeN} for removing up to `n` values and returning them as an array @@ -72067,6 +72057,7 @@ const takeN = (self, n) => { * @since 4.0.0 */ const takeNVoid = (self, n) => { + n = Count.normalize(n); if (n <= 0 || !self.head) return; n = Math.min(n, self.length); if (n === self.length && self.head?.offset === 0 && !self.head.next) { @@ -72154,12 +72145,18 @@ const take = self => { * Use when you need to inspect or snapshot a bounded prefix of the list without * consuming it. * + * **Details** + * + * Finite fractional values of `n` are rounded down. `NaN` and non-positive + * values return an empty array. + * * @see {@link takeN} for removing up to `n` values and returning them as an array * * @category converting * @since 4.0.0 */ const toArrayN = (self, n) => { + n = Count.normalize(n); if (n <= 0) return []; const length = Math.min(n, self.length); const out = new Array(length); @@ -73123,7 +73120,7 @@ __webpack_require__.r(__webpack_exports__); -const TypeId = "~effect/data/Option"; +const TypeId = "~effect/Option"; /** * Creates an `Option` representing the absence of a value. * @@ -75429,6 +75426,7 @@ function alwaysEqual() { * * Applies orders in iteration order and short-circuits on the first non-zero * result. It returns `0` only if all orders return `0`. + * The collection is materialized when the order is created, so it must be finite. * * **Example** (Combining multiple Orders) * @@ -75458,9 +75456,10 @@ function alwaysEqual() { * @since 2.0.0 */ function combineAll(collection) { + const orders = Array.from(collection); return make((a1, a2) => { let out = 0; - for (const O of collection) { + for (const O of orders) { out = O(a1, a2); if (out !== 0) { return out; @@ -77816,6 +77815,7 @@ __webpack_require__.d(__webpack_exports__, { + const TypeId = "~effect/Queue"; const EnqueueTypeId = "~effect/Queue/Enqueue"; const DequeueTypeId = "~effect/Queue/Dequeue"; @@ -78603,8 +78603,8 @@ const interrupt = self => core.withFiber(fiber => failCause(self, internalEffect * * **Details** * - * The operation is idempotent and returns `true`, including when the queue has - * already been shut down or completed. + * Returns `true` when the queue is shut down by this call, or `false` when it + * has already been shut down or completed. * * **Example** (Shutting down queues) * @@ -78629,28 +78629,48 @@ const interrupt = self => core.withFiber(fiber => failCause(self, internalEffect * await Effect.runPromise(program) // => { wasShutdown: true, size: 0 } * ``` * + * @see {@link shutdownUnsafe} for synchronous shutdown * @category completion * @since 2.0.0 */ -const shutdown = self => _internal_effect_js__rspack_import_3/* .sync */.OH5(() => { +const shutdown = self => _internal_effect_js__rspack_import_3/* .sync */.OH5(() => shutdownUnsafe(self)); +/** + * Shuts down the queue synchronously, discarding buffered messages and resuming + * pending operations. + * + * **When to use** + * + * Use when a synchronous callback must discard buffered messages and settle + * pending queue operations before returning. + * + * **Details** + * + * An open queue completes with an interruption. A queue already closing retains + * its completion cause. Call `failCauseUnsafe` first to shut down with a specific + * failure. Returns `true` when the queue is shut down by this call, or `false` + * when it has already been shut down or completed. + * + * @see {@link shutdown} for the effectful variant + * @see {@link failCauseUnsafe} to set a failure before discarding buffered messages + * @category completion + * @since 4.0.0 + */ +const shutdownUnsafe = self => { if (self.state._tag === "Done") { - return true; + return false; } _MutableList_js__rspack_import_2/* .clear */.IU(self.messages); const offers = self.state.offers; finalize(self, self.state._tag === "Open" ? exitInterrupt : self.state.exit); - if (offers.size > 0) { - for (const entry of offers) { - if (entry._tag === "Single") { - entry.resume(exitFalse); - } else { - entry.resume(_internal_core_js__rspack_import_1/* .exitSucceed */.xt(entry.remaining.slice(entry.offset))); - } + for (const entry of offers) { + if (entry._tag === "Single") { + entry.resume(exitFalse); + } else { + entry.resume(_internal_core_js__rspack_import_1/* .exitSucceed */.xt(entry.remaining.slice(entry.offset))); } - offers.clear(); } return true; -}); +}; /** * Takes and returns all currently buffered messages without waiting for more. * @@ -78778,9 +78798,10 @@ const collect = self => internalEffect.suspend(() => { * **Details** * * The operation may wait until enough messages are available to satisfy the - * queue's batching rules. If `n` is less than or equal to zero, it succeeds - * with an empty array. If the queue completes or fails before messages can be - * taken, the effect fails with the queue's terminal error. + * queue's batching rules. Finite fractional values of `n` are rounded down. + * If `n` is `NaN` or non-positive, it succeeds with an empty array. If the + * queue completes or fails before messages can be taken, the effect fails with + * the queue's terminal error. * * **Example** (Taking a fixed number of values) * @@ -78817,9 +78838,10 @@ const takeN = (self, n) => takeBetween(self, n, n); * **Details** * * The operation waits when fewer than the required minimum messages are - * available. It returns at most `max` messages. If the queue completes or fails - * before the minimum can be satisfied, the effect fails with the queue's - * terminal error. + * available. It returns at most `max` messages. Finite fractional bounds are + * rounded down, while `NaN` and non-positive bounds are treated as `0`. If the + * queue completes or fails before the minimum can be satisfied, the effect + * fails with the queue's terminal error. * * **Example** (Taking a bounded batch of values) * @@ -78849,7 +78871,11 @@ const takeN = (self, n) => takeBetween(self, n, n); * @category taking * @since 2.0.0 */ -const takeBetween = (self, min, max) => internalEffect.suspend(() => takeBetweenUnsafe(self, min, max) ?? internalEffect.andThen(awaitTake(self), takeBetween(self, 1, max))); +const takeBetween = (self, min, max) => { + min = Count.normalize(min); + max = Count.normalize(max); + return internalEffect.suspend(() => takeBetweenUnsafe(self, min, max) ?? internalEffect.andThen(awaitTake(self), takeBetween(self, 1, max))); +}; /** * Takes a single message from the queue, or wait for a message to be * available. @@ -79022,15 +79048,86 @@ const takeUnsafe = self => { releaseCapacity(self); return _internal_core_js__rspack_import_1/* .exitSucceed */.xt(message); } else if (self.capacity <= 0 && self.state.offers.size > 0) { - self.capacity = 1; - releaseCapacity(self); - self.capacity = 0; - const message = _MutableList_js__rspack_import_2/* .take */.s(self.messages); + const message = takeOfferUnsafe(self.state.offers); releaseCapacity(self); return _internal_core_js__rspack_import_1/* .exitSucceed */.xt(message); } return undefined; }; +/** + * Manually releases current queue takers synchronously. + * + * **When to use** + * + * Use when synchronous offers should release waiting consumers immediately + * instead of waiting for the scheduled release task. + * + * **Details** + * + * This immediately runs the queue's taker-release pass instead of waiting for + * its scheduled task. It does not complete the queue or resume fibers waiting + * on `Queue.await`. + * + * **Example** (Releasing a waiting taker synchronously) + * + * ```ts import.meta.vitest + * import { Effect, Fiber, Queue } from "effect" + * + * const program = Effect.gen(function*() { + * const queue = yield* Queue.unbounded() + * const taker = yield* Queue.take(queue).pipe(Effect.forkChild) + * yield* Effect.yieldNow + * + * Queue.offerUnsafe(queue, 1) + * Queue.flushUnsafe(queue) + * + * return yield* Fiber.join(taker) + * }) + * + * await Effect.runPromise(program) // => 1 + * ``` + * + * @category offering + * @since 4.0.0 + */ +const flushUnsafe = self => releaseTakers(self); +/** + * Manually releases current queue takers. + * + * **When to use** + * + * Use when synchronous offers should release waiting consumers through an + * `Effect` instead of waiting for the scheduled release task. + * + * **Details** + * + * This immediately runs the queue's taker-release pass instead of waiting for + * its scheduled task. It does not complete the queue or resume fibers waiting + * on `Queue.await`. + * + * **Example** (Releasing a waiting taker) + * + * ```ts import.meta.vitest + * import { Effect, Fiber, Queue } from "effect" + * + * const program = Effect.gen(function*() { + * const queue = yield* Queue.unbounded() + * const taker = yield* Queue.take(queue).pipe(Effect.forkChild) + * yield* Effect.yieldNow + * + * Queue.offerUnsafe(queue, 1) + * yield* Queue.flush(queue) + * + * return yield* Fiber.join(taker) + * }) + * + * await Effect.runPromise(program) // => 1 + * ``` + * + * @category offering + * @since 4.0.0 + */ +const flush = self => internalEffect.sync(() => flushUnsafe(self)); const await_ = self => internalEffect.callback(resume => { const awaiter = effect => resume(Pull.catchDone(effect, () => internalEffect.exitVoid)); if (self.state._tag === "Done") { @@ -79240,7 +79337,6 @@ const exitTrue = /*#__PURE__*/_internal_core_js__rspack_import_1/* .exitSucceed const exitFailDone = /*#__PURE__*/_internal_core_js__rspack_import_1/* .exitFail */.Rk(/*#__PURE__*/_internal_core_js__rspack_import_1/* .Done */.RS()); const exitInterrupt = /*#__PURE__*/_internal_effect_js__rspack_import_3/* .exitInterrupt */._sz(); const releaseTakers = self => { - self.scheduleRunning = false; if (self.state._tag === "Done" || self.state.takers.size === 0) { return; } @@ -79257,18 +79353,18 @@ const scheduleReleaseTaker = self => { return; } self.scheduleRunning = true; - self.dispatcher.scheduleTask(() => releaseTakers(self), 0); + self.dispatcher.scheduleTask(() => { + self.scheduleRunning = false; + releaseTakers(self); + }, 0); }; const takeBetweenUnsafe = (self, min, max) => { if (self.state._tag === "Done") { return self.state.exit; } else if (max <= 0 || min <= 0) { return core.exitSucceed([]); - } else if (self.capacity <= 0 && self.state.offers.size > 0) { - self.capacity = 1; - releaseCapacity(self); - self.capacity = 0; - const messages = [MutableList.take(self.messages)]; + } else if (self.capacity <= 0 && self.messages.length === 0 && self.state.offers.size > 0) { + const messages = [takeOfferUnsafe(self.state.offers)]; releaseCapacity(self); return core.exitSucceed(messages); } @@ -79316,6 +79412,21 @@ const offerRemainingArray = (self, remaining) => { }); }); }; +// Reserve a pending message for the consumer before the producer can reenter. +const takeOfferUnsafe = offers => { + const entry = offers.values().next().value; + if (entry._tag === "Single") { + offers.delete(entry); + entry.resume(exitTrue); + return entry.message; + } + const message = entry.remaining[entry.offset++]; + if (entry.offset === entry.remaining.length) { + offers.delete(entry); + entry.resume(_internal_core_js__rspack_import_1/* .exitSucceed */.xt([])); + } + return message; +}; const releaseCapacity = self => { if (self.state._tag === "Done") { return _Pull_js__rspack_import_4/* .isDoneCause */.Og(self.state.exit.cause); @@ -79326,21 +79437,21 @@ const releaseCapacity = self => { } return false; } - let n = self.capacity - self.messages.length; + // Resuming a producer can synchronously take, offer, or shut down this queue. for (const entry of self.state.offers) { - if (n === 0) break;else if (entry._tag === "Single") { + let n = self.capacity - self.messages.length; + if (n <= 0) break;else if (entry._tag === "Single") { _MutableList_js__rspack_import_2/* .append */.BC(self.messages, entry.message); - n--; - entry.resume(exitTrue); self.state.offers.delete(entry); + entry.resume(exitTrue); } else { for (; entry.offset < entry.remaining.length; entry.offset++) { if (n === 0) return false; _MutableList_js__rspack_import_2/* .append */.BC(self.messages, entry.remaining[entry.offset]); n--; } - entry.resume(_internal_core_js__rspack_import_1/* .exitSucceed */.xt([])); self.state.offers.delete(entry); + entry.resume(_internal_core_js__rspack_import_1/* .exitSucceed */.xt([])); } } return false; @@ -79362,10 +79473,7 @@ const takeAllUnsafe = self => { releaseCapacity(self); return messages; } else if (self.state._tag !== "Done" && self.state.offers.size > 0) { - self.capacity = 1; - releaseCapacity(self); - self.capacity = 0; - const messages = [_MutableList_js__rspack_import_2/* .take */.s(self.messages)]; + const messages = [takeOfferUnsafe(self.state.offers)]; releaseCapacity(self); return messages; } @@ -81025,7 +81133,7 @@ __webpack_require__.d(__webpack_exports__, { -const TypeId = "~effect/data/Result"; +const TypeId = "~effect/Result"; /** * Creates a `Result` holding a `Success` value. * @@ -83378,15 +83486,6 @@ const Scheduler = /*#__PURE__*/_Context_js__rspack_import_0/* .Reference */.Or(" fiberCached: true, defaultValue: () => new MixedScheduler() }); -const setImmediate = "setImmediate" in globalThis ? f => { - // @ts-ignore - const timer = globalThis.setImmediate(f); - // @ts-ignore - return () => globalThis.clearImmediate(timer); -} : f => { - const timer = setTimeout(f, 0); - return () => clearTimeout(timer); -}; const setMicrotask = f => { let cancelled = false; Promise.resolve().then(() => { @@ -83396,6 +83495,24 @@ const setMicrotask = f => { cancelled = true; }; }; +const setTimer = "setImmediate" in globalThis ? f => { + // @ts-ignore + const timer = globalThis.setImmediate(f); + // @ts-ignore + return () => globalThis.clearImmediate(timer); +} : f => { + const timer = setTimeout(f, 0); + return () => clearTimeout(timer); +}; +// Some runtimes (e.g. Cloudflare Workers) throw when a timer is set in global +// scope. Fall back to a microtask so effects can still yield at module load. +const setImmediate = f => { + try { + return setTimer(f); + } catch { + return setMicrotask(f); + } +}; class PriorityBuckets { buckets = []; scheduleTask(task, priority) { @@ -83458,7 +83575,7 @@ class MixedScheduler { * @since 2.0.0 */ shouldYield(fiber) { - return fiber.currentOpCount >= fiber.maxOpsBeforeYield; + return fiber.currentOpCount >= fiber.cache.maxOpsBeforeYield; } /** * Creates a dispatcher that schedules work through this scheduler. @@ -84361,6 +84478,8 @@ __webpack_require__.d(__webpack_exports__, { + + @@ -84705,7 +84824,7 @@ const transformPullBracket = (self, f) => fromChannel(Channel.fromTransformBrack * values.flat() // => [1, 2, 3] * ``` * - * @category constructors + * @category destructors * @since 2.0.0 */ const toChannel = stream => stream.channel; @@ -84923,6 +85042,8 @@ const failCauseSync = evaluate => fromChannel(Channel.failCauseSync(evaluate)); * **Details** * * The `maxChunkSize` parameter controls how many values are pulled per chunk. + * Finite fractional values are rounded down, while `NaN` and non-positive + * values are treated as `1`. * * **Example** (Consuming values from an iterator) * @@ -84954,7 +85075,9 @@ const fromIteratorSucceed = (iterator, maxChunkSize) => fromChannel(Channel.from * * **Details** * - * - `chunkSize`: Maximum number of values emitted per chunk. + * - `chunkSize`: Maximum number of values emitted per chunk. Finite fractional + * values are rounded down, while `NaN` and non-positive values are treated as + * `1`. * * **Example** (Creating a stream from an iterable) * @@ -85361,8 +85484,10 @@ const fromSubscription = pubsub => fromChannel(Channel.fromSubscriptionArray(pub * @since 3.1.0 */ const fromEventListener = (target, type, options) => callback(queue => { + const once = typeof options === "object" && options.once; function emit(event) { Queue.offerUnsafe(queue, event); + if (once) Queue.endUnsafe(queue); } return Effect.acquireRelease(Effect.sync(() => target.addEventListener(type, emit, options)), () => Effect.sync(() => target.removeEventListener(type, emit, options))); }, { @@ -85478,7 +85603,8 @@ const iterate = (value, next) => unfold(value, a => Effect.succeed([a, next(a)]) * **Details** * * If the provided `min` is greater than `max`, the stream will not emit any - * values. + * values. Finite fractional `chunkSize` values are rounded down, while `NaN` + * and non-positive values are treated as `1`. * * **Example** (Creating a numeric range) * @@ -85497,7 +85623,7 @@ const iterate = (value, next) => unfold(value, a => Effect.succeed([a, next(a)]) * @since 2.0.0 */ const range = (min, max, chunkSize = (/* inlined export .DefaultChunkSize */4096)) => min > max ? empty : fromPull(Effect.sync(() => { - const size = Math.max(1, chunkSize); + const size = Count.normalizeNonEmpty(chunkSize); let start = min; let done = false; return Effect.suspend(() => { @@ -85582,7 +85708,7 @@ const unwrap = effect => fromChannel(_Channel_js__rspack_import_1/* .unwrap */.o * events // => ["acquire", "release"] * ``` * - * @category constructors + * @category resource management * @since 2.0.0 */ const scoped = self => fromChannel(Channel.scoped(self.channel)); @@ -85605,6 +85731,31 @@ const map = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, let i = 0; return fromChannel(Channel.map(self.channel, Arr.map(o => f(o, i++)))); })))); +/** + * Replaces every element of the stream with the provided constant value. + * + * **Example** (Replacing stream elements) + * + * ```ts import.meta.vitest + * import { Effect, Stream } from "effect" + * + * const program = Effect.gen(function*() { + * const values = yield* Stream.make(1, 2, 3).pipe( + * Stream.as("x"), + * Stream.runCollect + * ) + * values // => [ 'x', 'x', 'x' ] + * }) + * + * await Effect.runPromise(program) + * ``` + * + * @see {@link map} for deriving the replacement value from each element + * + * @category mapping + * @since 4.0.0 + */ +const as = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, value) => map(self, () => value)))); /** * Maps both the failure and success channels of a stream. * @@ -85614,8 +85765,8 @@ const map = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, * import { Effect, Stream } from "effect" * * const mapper = { - * onFailure: (error: string) => `error: ${error}`, - * onSuccess: (value: number) => value * 2 + * onElement: (value: number) => value * 2, + * onError: (error: string) => `error: ${error}` * } * * const program = Effect.gen(function*() { @@ -85639,7 +85790,7 @@ const map = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, * @category mapping * @since 2.0.0 */ -const mapBoth = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, options) => self.pipe(map(options.onSuccess), mapError(options.onFailure))))); +const mapBoth = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, options) => self.pipe(map(options.onElement), mapError(options.onError))))); /** * Transforms each emitted chunk using the provided function, which receives the chunk and its index. * @@ -85725,7 +85876,7 @@ const mapEffect = /*#__PURE__*/(0,_Function_js__rspack_import_7/* .dual */.XY)(a * await Effect.runPromise(program) * ``` * - * @category mapping + * @category sequencing * @since 2.0.0 */ const flattenEffect = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(args => isStream(args[0]), (self, options) => mapEffect(self, identity, options)))); @@ -85949,7 +86100,7 @@ const tapSink = /*#__PURE__*/(/* unused pure expression or super */ null && (dua * await Effect.runPromise(program) * ``` * - * @category mapping + * @category sequencing * @since 2.0.0 */ const flatMap = /*#__PURE__*/(0,_Function_js__rspack_import_7/* .dual */.XY)(args => isStream(args[0]), (self, f, options) => self.channel.pipe(_Channel_js__rspack_import_1/* .flattenArray */.ed, _Channel_js__rspack_import_1/* .flatMap */.qI(a => f(a).channel, options), fromChannel)); @@ -86006,7 +86157,7 @@ const switchMap = /*#__PURE__*/(/* unused pure expression or super */ null && (d * await Effect.runPromise(program) * ``` * - * @category mapping + * @category sequencing * @since 2.0.0 */ const flatten = /*#__PURE__*/(0,_Function_js__rspack_import_7/* .dual */.XY)(args => isStream(args[0]), (self, options) => flatMap(self, _Function_js__rspack_import_7/* .identity */.D_, options)); @@ -86101,7 +86252,7 @@ const drainFork = /*#__PURE__*/(/* unused pure expression or super */ null && (d * await Effect.runPromise(program) * ``` * - * @category sequencing + * @category repetition * @since 2.0.0 */ const repeat = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, schedule) => fromChannel(Channel.repeat(self.channel, schedule))))); @@ -86238,7 +86389,7 @@ const timeoutOrElse = /*#__PURE__*/(/* unused pure expression or super */ null & * await Effect.runPromise(program) * ``` * - * @category sequencing + * @category repetition * @since 2.0.0 */ const repeatElements = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, schedule) => fromChannel(Channel.fromTransform((upstream, scope) => Effect.map(Channel.toTransform(Channel.flattenArray(self.channel))(upstream, scope), pullElement => { @@ -86276,7 +86427,7 @@ const repeatElements = /*#__PURE__*/(/* unused pure expression or super */ null * await Effect.runPromise(program) * ``` * - * @category sequencing + * @category repetition * @since 2.0.0 */ const forever = self => fromChannel(Channel.forever(self.channel)); @@ -86297,7 +86448,7 @@ const forever = self => fromChannel(Channel.forever(self.channel)); * await Effect.runPromise(program) * ``` * - * @category mapping + * @category sequencing * @since 4.0.0 */ const flattenIterable = self => flatMap(self, fromIterable); @@ -87390,7 +87541,7 @@ const partitionQueue = /*#__PURE__*/(/* unused pure expression or super */ null * consumed while that scope remains open. The first stream emits success values * from the filter, and the second emits failure values. * - * @see {@link partition} for the pure `Filter` variant, which returns the failing stream before the passing stream + * @see {@link partition} for the pure `Filter` variant * @see {@link partitionQueue} for the lower-level queue result * @see {@link filterMapEffect} for effectful filtering that discards failed filter results * @@ -87399,14 +87550,16 @@ const partitionQueue = /*#__PURE__*/(/* unused pure expression or super */ null */ const partitionEffect = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(args => isStream(args[0]), (self, filter, options) => Effect.map(partitionQueue(mapEffect(self, a => filter(a), options), result => result, options), ([passes, fails]) => [fromQueue(passes), fromQueue(fails)])))); /** - * Splits a stream into scoped excluded and satisfying substreams using a + * Splits a stream into scoped passing and failing substreams using a * `Filter`. * * **Details** * * The returned streams are backed by queues in the current scope and should be * consumed while that scope remains open. The faster stream may advance up to - * `bufferSize` elements ahead of the slower one. + * `capacity` elements ahead of the slower one. The first stream emits the + * filter successes and the second emits the filter failures. The default + * capacity is 16. * * **Example** (Partitioning a stream) * @@ -87414,14 +87567,14 @@ const partitionEffect = /*#__PURE__*/(/* unused pure expression or super */ null * import { Effect, Result, Stream } from "effect" * * const program = Effect.gen(function*() { - * const [excluded, satisfying] = yield* Stream.partition( + * const [passes, fails] = yield* Stream.partition( * Stream.make(1, 2, 3, 4), * (n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n) * ) - * const left = yield* Stream.runCollect(excluded) - * const right = yield* Stream.runCollect(satisfying) - * left // => [ 1, 3 ] - * right // => [ 2, 4 ] + * const evens = yield* Stream.runCollect(passes) + * const odds = yield* Stream.runCollect(fails) + * evens // => [ 2, 4 ] + * odds // => [ 1, 3 ] * }) * await Effect.runPromise(Effect.scoped(program)) * ``` @@ -87430,8 +87583,8 @@ const partitionEffect = /*#__PURE__*/(/* unused pure expression or super */ null * @since 2.0.0 */ const partition = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(args => isStream(args[0]), (self, filter, options) => Effect.map(partitionQueue(self, filter, { - capacity: options?.bufferSize ?? 16 -}), ([passes, fails]) => [fromQueue(fails), fromQueue(passes)])))); + capacity: options?.capacity ?? 16 +}), ([passes, fails]) => [fromQueue(passes), fromQueue(fails)])))); /** * Returns the specified stream if the given condition is satisfied, otherwise * returns an empty stream. @@ -87591,6 +87744,30 @@ const bufferArray = /*#__PURE__*/(/* unused pure expression or super */ null && * @since 2.0.0 */ const catchCause = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, f) => self.channel.pipe(Channel.catchCause(cause => f(cause).channel), fromChannel)))); +/** + * Recovers from defects using the provided function. + * + * **Details** + * + * Typed failures and interruptions are not caught. + * + * **Example** (Recovering from a defect) + * + * ```ts import.meta.vitest + * import { Effect, Stream } from "effect" + * + * const stream = Stream.die("boom").pipe( + * Stream.catchDefect((defect) => Stream.succeed(`recovered: ${defect}`)) + * ) + * + * const result = Effect.runSync(Stream.runCollect(stream)) + * result // => ["recovered: boom"] + * ``` + * + * @category error handling + * @since 4.0.0 + */ +const catchDefect = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, f) => self.channel.pipe(Channel.catchDefect(defect => f(defect).channel), fromChannel)))); /** * Runs an effect when the stream fails without changing its values or error, * unless the tap effect itself fails. @@ -87650,6 +87827,83 @@ const catch_ = /*#__PURE__*/(/* unused pure expression or super */ null && (dual * @since 2.0.0 */ const tapError = /*#__PURE__*/(0,_Function_js__rspack_import_7/* .dual */.XY)(2, (self, f) => self.channel.pipe(_Channel_js__rspack_import_1/* .tapError */.sF(f), fromChannel)); +/** + * Peeks at errors with a matching `_tag` effectfully without changing the + * stream unless the tap fails. + * + * **Example** (Effectfully peeking at a tagged error) + * + * ```ts import.meta.vitest + * import { Data, Effect, Stream } from "effect" + * + * class NetworkError extends Data.TaggedError("NetworkError")<{ + * statusCode: number + * }> {} + * + * class ValidationError extends Data.TaggedError("ValidationError")<{ + * field: string + * }> {} + * + * const seen: Array = [] + * const stream: Stream.Stream = Stream.fail( + * new NetworkError({ statusCode: 504 }) + * ) + * + * const program = stream.pipe( + * Stream.tapErrorTag("NetworkError", (error) => Effect.sync(() => seen.push(error.statusCode))), + * Stream.catch(() => Stream.make(0)), + * Stream.runCollect + * ) + * + * await Effect.runPromise(program) // => [ 0 ] + * seen // => [ 504 ] + * ``` + * + * @see {@link tapError} for peeking at every typed error + * @see {@link catchTag} for recovering from a tagged error + * + * @category error handling + * @since 4.0.0 + */ +const tapErrorTag = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, (self, k, f) => { + const predicate = Array.isArray(k) ? e => hasProperty(e, "_tag") && k.includes(e._tag) : isTagged(k); + return tapError(self, error => predicate(error) ? f(error) : Effect.void); +}))); +/** + * Peeks at defects effectfully without changing the stream unless the tap + * fails. + * + * **Example** (Effectfully peeking at defects) + * + * ```ts import.meta.vitest + * import { Effect, Stream } from "effect" + * + * const defects: Array = [] + * const stream = Stream.make(1, 2).pipe( + * Stream.concat(Stream.die("boom")), + * Stream.tapDefect((defect) => Effect.sync(() => defects.push(defect))), + * Stream.catchCause(() => Stream.make(3)) + * ) + * + * const program = Effect.gen(function*() { + * const values = yield* Stream.runCollect(stream) + * values // => [ 1, 2, 3 ] + * }) + * + * await Effect.runPromise(program) + * defects // => [ 'boom' ] + * ``` + * + * @see {@link tapCause} for peeking at the full failure cause + * @see {@link catchDefect} for recovering from defects + * + * @category error handling + * @since 4.0.0 + */ +const tapDefect = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, f) => tapCause(self, cause => { + const defect = Cause.findDefect(cause); + return Result.isSuccess(defect) ? f(defect.success) : Effect.void; +})))); /** * Recovers from errors that match a predicate by switching to a recovery stream. * @@ -87888,6 +88142,55 @@ const catchReasons = /*#__PURE__*/(/* unused pure expression or super */ null && const orElseHandler = orElse && ((reason, error) => orElse(reason, error).channel); return fromChannel(Channel.catchReasons(self.channel, errorTag, handlers, orElseHandler)); }))); +/** + * Promotes nested reason errors into the stream error channel, replacing the + * parent error. + * + * **Example** (Extracting the reason from a tagged error) + * + * ```ts import.meta.vitest + * import { Data, Effect, Stream } from "effect" + * + * class RateLimitError extends Data.TaggedError("RateLimitError")<{ + * retryAfter: number + * }> {} + * + * class QuotaExceededError extends Data.TaggedError("QuotaExceededError")<{ + * limit: number + * }> {} + * + * class AiError extends Data.TaggedError("AiError")<{ + * reason: RateLimitError | QuotaExceededError + * }> {} + * + * const stream: Stream.Stream = Stream.fail( + * new AiError({ reason: new RateLimitError({ retryAfter: 30 }) }) + * ) + * + * // Before: Stream + * // After: Stream + * const unwrapped = stream.pipe(Stream.unwrapReason("AiError")) + * + * const program = Effect.gen(function*() { + * const error = yield* Effect.flip(Stream.runCollect(unwrapped)) + * error._tag // => "RateLimitError" + * }) + * + * await Effect.runPromise(program) + * ``` + * + * @see {@link catchReason} for recovering from a specific reason + * @see {@link catchReasons} for handling several reasons at once + * + * @category error handling + * @since 4.0.0 + */ +const unwrapReason = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, errorTag) => catchFilter(self, e => { + if (isTagged(e, errorTag) && hasProperty(e, "reason")) { + return Result.succeed(e.reason); + } + return Result.fail(e); +}, fail)))); /** * Transforms the errors emitted by this stream using `f`. * @@ -88269,7 +88572,12 @@ const withExecutionPlan = /*#__PURE__*/(/* unused pure expression or super */ nu return loop; })))); /** - * Takes the first `n` elements from this stream, returning `Stream.empty` when `n < 1`. + * Takes the first `n` elements from this stream. + * + * **Details** + * + * Finite fractional values of `n` are rounded down. `NaN` and non-positive + * values return `Stream.empty` without evaluating the source stream. * * **Example** (Taking values from the left) * @@ -88290,7 +88598,10 @@ const withExecutionPlan = /*#__PURE__*/(/* unused pure expression or super */ nu * @category filtering * @since 2.0.0 */ -const take = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => n < 1 ? empty : takeUntil(self, (_, i) => i === n - 1)))); +const take = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { + const count = Count.normalize(n); + return count === 0 ? empty : takeUntil(self, (_, i) => i === count - 1); +}))); /** * Emits byte chunks until the configured limit would be exceeded, then drops * the crossing chunk and switches to a fallback stream. @@ -88298,13 +88609,13 @@ const take = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 * **Example** (Truncating at a byte limit) * * ```ts import.meta.vitest - * import { Effect, Stream } from "effect" + * import { ByteSize, Effect, Stream } from "effect" * * const program = Stream.make( * new Uint8Array([1, 2]), * new Uint8Array([3, 4, 5]) * ).pipe( - * Stream.limitBytes(4, () => Stream.empty), + * Stream.limitBytes(ByteSize.bytes(4), () => Stream.empty), * Stream.runCollect, * Effect.map((chunks) => chunks.map((chunk) => [...chunk])) * ) @@ -88316,7 +88627,7 @@ const take = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 * @since 4.0.0 */ const limitBytes = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, (self, bytes, onLimitReached) => suspend(() => { - const limit = BigInt(bytes); + const limit = ByteSize.fromInputUnsafe(bytes); let size = BigInt(0); let limitReached = false; return concat(takeWhile(self, chunk => { @@ -88332,6 +88643,11 @@ const limitBytes = /*#__PURE__*/(/* unused pure expression or super */ null && ( /** * Keeps the last `n` elements from this stream. * + * **Details** + * + * Finite fractional values of `n` are rounded down. `NaN` and non-positive + * values return `Stream.empty` without evaluating the source stream. + * * **Example** (Taking elements from the right) * * ```ts import.meta.vitest @@ -88351,17 +88667,21 @@ const limitBytes = /*#__PURE__*/(/* unused pure expression or super */ null && ( * @category filtering * @since 2.0.0 */ -const takeRight = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => mapAccumArray(self, MutableList.make, (list, arr) => { - MutableList.appendAll(list, arr); - if (list.length > n) { - MutableList.takeNVoid(list, list.length - n); - } - return [list, emptyArr]; -}, { - onHalt(list) { - return MutableList.takeAll(list); - } -})))); +const takeRight = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { + const count = Count.normalize(n); + if (count === 0) return empty; + return mapAccumArray(self, MutableList.make, (list, arr) => { + MutableList.appendAll(list, arr); + if (list.length > count) { + MutableList.takeNVoid(list, list.length - count); + } + return [list, emptyArr]; + }, { + onHalt(list) { + return MutableList.takeAll(list); + } + }); +}))); /** * Takes elements until the predicate matches. * @@ -88560,6 +88880,11 @@ const takeWhileEffect = /*#__PURE__*/(/* unused pure expression or super */ null /** * Drops the first `n` elements from this stream. * + * **Details** + * + * Finite fractional values of `n` are rounded down. `NaN` and non-positive + * values return the source stream unchanged. + * * **Example** (Dropping values from the left) * * ```ts import.meta.vitest @@ -88579,16 +88904,20 @@ const takeWhileEffect = /*#__PURE__*/(/* unused pure expression or super */ null * @category filtering * @since 2.0.0 */ -const drop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => transformPull(self, (pull, _scope) => Effect.sync(() => { - let dropped = 0; - const pump = pull.pipe(Effect.flatMap(chunk => { - if (dropped >= n) return Effect.succeed(chunk); - dropped += chunk.length; - if (dropped <= n) return pump; - return Effect.succeed(chunk.slice(n - dropped)); +const drop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { + const count = Count.normalize(n); + if (count === 0) return self; + return transformPull(self, (pull, _scope) => Effect.sync(() => { + let dropped = 0; + const pump = pull.pipe(Effect.flatMap(chunk => { + if (dropped >= count) return Effect.succeed(chunk); + dropped += chunk.length; + if (dropped <= count) return pump; + return Effect.succeed(chunk.slice(count - dropped)); + })); + return pump; })); - return pump; -}))))); +}))); /** * Drops elements until the specified predicate evaluates to `true`, then drops * that matching element. @@ -88747,7 +89076,9 @@ const dropWhileEffect = /*#__PURE__*/(/* unused pure expression or super */ null * * **Details** * - * Keeps the last `n` elements in memory to drop them on completion. + * Keeps the last `n` elements in memory to drop them on completion. Finite + * fractional values of `n` are rounded down. `NaN` and non-positive values + * return the source stream unchanged. * * **Example** (Dropping values from the right) * @@ -88769,12 +89100,13 @@ const dropWhileEffect = /*#__PURE__*/(/* unused pure expression or super */ null * @since 2.0.0 */ const dropRight = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { - if (n <= 0) return self; + const count = Count.normalize(n); + if (count === 0) return self; return transformPull(self, (pull, _scope) => Effect.sync(() => { const list = MutableList.make(); const emit = Effect.flatMap(pull, arr => { MutableList.appendAllUnsafe(list, arr); - const toTake = list.length - n; + const toTake = list.length - count; const items = MutableList.takeN(list, toTake); return Arr.isArrayNonEmpty(items) ? Effect.succeed(items) : emit; }); @@ -88810,7 +89142,8 @@ const chunks = self => self.channel.pipe(Channel.map(Arr.of), fromChannel); * * **Details** * - * The size is clamped to at least 1. + * Finite fractional sizes are rounded down. `NaN` and non-positive sizes are + * treated as `1`. * * **Example** (Rechunking stream elements) * @@ -88833,7 +89166,7 @@ const chunks = self => self.channel.pipe(Channel.map(Arr.of), fromChannel); * @since 2.0.0 */ const rechunk = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, target) => { - target = Math.max(1, target); + target = Count.normalizeNonEmpty(target); return transformPull(self, (pull, _scope) => Effect.sync(() => { let chunk = Arr.empty(); let index = 0; @@ -88845,7 +89178,9 @@ const rechunk = /*#__PURE__*/(/* unused pure expression or super */ null && (dua if (chunk.length === 0 && arr.length === target) { return Effect.succeed(arr); } else if (chunk.length + arr.length < target) { - chunk.push(...arr); + for (let i = 0; i < arr.length; i++) { + chunk.push(arr[i]); + } return loop(); } current = arr; @@ -88875,6 +89210,11 @@ const rechunk = /*#__PURE__*/(/* unused pure expression or super */ null && (dua /** * Emits a sliding window of `n` elements. * + * **Details** + * + * Finite fractional window sizes are rounded down. `NaN` and non-positive + * sizes are treated as `1`. + * * **Example** (Emitting sliding windows) * * ```ts import.meta.vitest @@ -88897,6 +89237,11 @@ const sliding = /*#__PURE__*/(/* unused pure expression or super */ null && (dua /** * Emits sliding windows of `chunkSize` elements, advancing by `stepSize`. * + * **Details** + * + * Finite fractional window and step sizes are rounded down. `NaN` and + * non-positive sizes are treated as `1`. + * * **Example** (Emitting sliding windows with a step size) * * ```ts import.meta.vitest @@ -88916,47 +89261,47 @@ const sliding = /*#__PURE__*/(/* unused pure expression or super */ null && (dua * @category grouping * @since 2.0.0 */ -const slidingSize = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, (self, chunkSize, stepSize) => transformPull(self, (upstream, _scope) => Effect.sync(() => { - let cause = null; - const list = MutableList.make(); - let emitted = false; - let skip = 0; - const pull = Effect.matchCauseEffect(upstream, { - onSuccess(arr) { - MutableList.appendAllUnsafe(list, arr); - if (skip > 0) { - const length = list.length; - MutableList.takeNVoid(list, skip); - skip = Math.max(0, skip - length); - } - if (list.length < chunkSize) return pull; - emitted = true; - const chunks = []; - while (list.length >= chunkSize) { - if (chunkSize === stepSize) { - chunks.push(MutableList.takeN(list, chunkSize)); - } else { - chunks.push(MutableList.toArrayN(list, chunkSize)); - if (chunkSize === 1 && stepSize <= 0) { - MutableList.take(list); +const slidingSize = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, (self, chunkSize, stepSize) => { + const windowSize = Count.normalizeNonEmpty(chunkSize); + const step = Count.normalizeNonEmpty(stepSize); + return transformPull(self, (upstream, _scope) => Effect.sync(() => { + let cause = null; + const list = MutableList.make(); + let emitted = false; + let skip = 0; + const pull = Effect.matchCauseEffect(upstream, { + onSuccess(arr) { + MutableList.appendAllUnsafe(list, arr); + if (skip > 0) { + const length = list.length; + MutableList.takeNVoid(list, skip); + skip = Math.max(0, skip - length); + } + if (list.length < windowSize) return pull; + emitted = true; + const chunks = []; + while (list.length >= windowSize) { + if (windowSize === step) { + chunks.push(MutableList.takeN(list, windowSize)); } else { + chunks.push(MutableList.toArrayN(list, windowSize)); const length = list.length; - MutableList.takeNVoid(list, stepSize); - skip = Math.max(0, stepSize - length); + MutableList.takeNVoid(list, step); + skip = Math.max(0, step - length); } } + return Effect.succeed(chunks); + }, + onFailure(cause_) { + if (emitted) MutableList.takeNVoid(list, windowSize - step); + if (list.length === 0) return Effect.failCause(cause_); + cause = cause_; + return Effect.succeed(Arr.of(MutableList.takeAll(list))); } - return Effect.succeed(chunks); - }, - onFailure(cause_) { - if (emitted) MutableList.takeNVoid(list, chunkSize - stepSize); - if (list.length === 0) return Effect.failCause(cause_); - cause = cause_; - return Effect.succeed(Arr.of(MutableList.takeAll(list))); - } - }); - return Effect.suspend(() => cause ? Effect.failCause(cause) : pull); -}))))); + }); + return Effect.suspend(() => cause ? Effect.failCause(cause) : pull); + })); +}))); /** * Splits the stream into non-empty groups whenever the predicate matches. * @@ -89076,7 +89421,7 @@ const combine = /*#__PURE__*/(/* unused pure expression or super */ null && (dua * await Effect.runPromise(program) * ``` * - * @category sequencing + * @category merging * @since 4.0.0 */ const combineArray = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(4, (self, that, s, f) => fromChannel(Channel.combine(self.channel, that.channel, s, f))))); @@ -89259,7 +89604,7 @@ const mapAccumArrayEffect = /*#__PURE__*/(/* unused pure expression or super */ * * const program = Effect.gen(function*() { * const values = yield* Stream.make(1, 2, 3).pipe( - * Stream.scan(0, (acc, n) => acc + n), + * Stream.scan(() => 0, (acc, n) => acc + n), * Stream.runCollect * ) * values // => [ 0, 1, 3, 6 ] @@ -89273,7 +89618,7 @@ const mapAccumArrayEffect = /*#__PURE__*/(/* unused pure expression or super */ */ const scan = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, (self, initial, f) => suspend(() => { let isFirst = true; - return fromChannel(Channel.mapAccum(self.channel, constant(initial), (state, arr) => { + return fromChannel(Channel.mapAccum(self.channel, initial, (state, arr) => { const states = Arr.empty(); if (isFirst) { isFirst = false; @@ -89296,7 +89641,7 @@ const scan = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3 * * const program = Effect.gen(function*() { * const states = yield* Stream.make(1, 2, 3).pipe( - * Stream.scanEffect(0, (sum, n) => Effect.succeed(sum + n)), + * Stream.scanEffect(() => 0, (sum, n) => Effect.succeed(sum + n)), * Stream.runCollect * ) * states // => [ 0, 1, 3, 6 ] @@ -89307,7 +89652,7 @@ const scan = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3 * @category accumulation * @since 2.0.0 */ -const scanEffect = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, (self, initial, f) => self.channel.pipe(Channel.flattenArray, Channel.scanEffect(initial, f), Channel.map(Arr.of), fromChannel)))); +const scanEffect = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, (self, initial, f) => suspend(() => self.channel.pipe(Channel.flattenArray, Channel.scanEffect(initial(), f), Channel.map(Arr.of), fromChannel))))); /** * Drops earlier elements within the debounce window and emits only the latest element after the pause. * @@ -89539,6 +89884,8 @@ const throttle = /*#__PURE__*/(/* unused pure expression or super */ null && (du * **Details** * * The final array may be smaller if there are not enough elements to fill it. + * Finite fractional sizes are rounded down. `NaN` and non-positive sizes are + * treated as `1`. * * **Example** (Grouping elements by size) * @@ -89564,6 +89911,11 @@ const grouped = /*#__PURE__*/(/* unused pure expression or super */ null && (dua * Partitions the stream into arrays, emitting when the chunk size is reached * or the duration passes. * + * **Details** + * + * Finite fractional chunk sizes are rounded down. `NaN` and non-positive sizes + * are treated as `1`. + * * **Example** (Grouping elements by size or time) * * ```ts import.meta.vitest @@ -89583,7 +89935,7 @@ const grouped = /*#__PURE__*/(/* unused pure expression or super */ null && (dua * @category grouping * @since 2.0.0 */ -const groupedWithin = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, (self, chunkSize, duration) => aggregateWithin(self, Sink.take(chunkSize), Schedule.spaced(duration))))); +const groupedWithin = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, (self, chunkSize, duration) => aggregateWithin(self, Sink.take(Count.normalizeNonEmpty(chunkSize)), Schedule.spaced(duration))))); /** * Groups elements into keyed substreams using an effectful classifier. * @@ -89919,7 +90271,8 @@ const aggregateWithin = /*#__PURE__*/(/* unused pure expression or super */ null * With the default suspend strategy, the source can only advance `capacity` * chunks ahead of the slowest downstream stream. If a downstream stream is * interrupted, it unsubscribes from the broadcast so it no longer contributes - * backpressure. + * backpressure. Finite fractional values of `n` are rounded down. `NaN` and + * non-positive values create no downstream streams. * * **Example** (Broadcasting to two consumers) * @@ -89948,10 +90301,11 @@ const aggregateWithin = /*#__PURE__*/(/* unused pure expression or super */ null * @since 4.0.0 */ const broadcastN = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, /*#__PURE__*/Effect.fnUntraced(function* (self, options) { + const n = Count.normalize(options.n); const pubsub = yield* makePubSub(options); - const streams = new Array(options.n); + const streams = new Array(n); const parentScope = yield* Scope.Scope; - for (let i = 0; i < options.n; i++) { + for (let i = 0; i < n; i++) { const scope = Scope.forkUnsafe(parentScope); const subscription = yield* PubSub.subscribe(pubsub).pipe(Effect.provideService(Scope.Scope, scope)); streams[i] = Channel.fromEffectTake(PubSub.take(subscription)).pipe(Channel.onExit(exit => Scope.close(scope, exit)), fromChannel); @@ -90334,7 +90688,7 @@ const changesWithEffect = /*#__PURE__*/(/* unused pure expression or super */ nu * await Effect.runPromise(program) * ``` * - * @category decoding + * @category text * @since 2.0.0 */ const decodeText = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(args => isStream(args[0]), (self, options) => suspend(() => { @@ -90362,7 +90716,7 @@ const decodeText = /*#__PURE__*/(/* unused pure expression or super */ null && ( * await Effect.runPromise(program) * ``` * - * @category encoding + * @category text * @since 2.0.0 */ const encodeText = self => suspend(() => { @@ -90385,7 +90739,7 @@ const encodeText = self => suspend(() => { * })) * ``` * - * @category splitting + * @category text * @since 2.0.0 */ const splitLines = self => self.channel.pipe(Channel.pipeTo(Channel.splitLines()), fromChannel); @@ -90667,7 +91021,7 @@ const onExit = /*#__PURE__*/(0,_Function_js__rspack_import_7/* .dual */.XY)(2, ( * errors // => ["boom"] * ``` * - * @category error handling + * @category resource management * @since 2.0.0 */ const onError = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, cleanup) => fromChannel(Channel.onError(self.channel, cleanup))))); @@ -91026,7 +91380,7 @@ const withSpan = function () { * await Effect.runPromise(effect) * ``` * - * @category constructors + * @category do notation * @since 2.0.0 */ const Do = /*#__PURE__*/(/* unused pure expression or super */ null && (succeed({}))); @@ -91053,12 +91407,12 @@ const let_ = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3 * await Effect.runPromise(result) // => [{ a: 1, b: 2 }, { a: 2, b: 3 }] * ``` * - * @category sequencing + * @category do notation * @since 2.0.0 */ -const bind = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(args => isStream(args[0]), (self, tag, f, options) => flatMap(self, a => map(f(a), b => ({ +const bind = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(args => isStream(args[0]), (self, name, f, options) => flatMap(self, a => map(f(a), b => ({ ...a, - [tag]: b + [name]: b })), options)))); /** * Binds an Effect-produced value into the do-notation record for each stream element. @@ -91081,12 +91435,12 @@ const bind = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(a * await Effect.runPromise(program) * ``` * - * @category sequencing + * @category do notation * @since 2.0.0 */ -const bindEffect = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(args => isStream(args[0]), (self, tag, f, options) => mapEffect(self, a => Effect.map(f(a), b => ({ +const bindEffect = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(args => isStream(args[0]), (self, name, f, options) => mapEffect(self, a => Effect.map(f(a), b => ({ ...a, - [tag]: b + [name]: b })), options)))); /** * Maps each element into a record keyed by the provided name. @@ -91101,7 +91455,7 @@ const bindEffect = /*#__PURE__*/(/* unused pure expression or super */ null && ( * await Effect.runPromise(Stream.runCollect(stream)) // => [{ value: 1 }, { value: 2 }, { value: 3 }] * ``` * - * @category mapping + * @category do notation * @since 2.0.0 */ const bindTo = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, name) => map(self, a => ({ @@ -91486,6 +91840,11 @@ const mkString = self => Channel.runFold(self.channel, () => "", (acc, chunk) => /** * Concatenates the stream's `Uint8Array` chunks into a single `ArrayBuffer`. * + * **Gotchas** + * + * This materializes the full content in memory. The source stream must not + * reuse or mutate emitted buffers, which are retained until collection completes. + * * **Example** (Joining byte chunks into an ArrayBuffer) * * ```ts import.meta.vitest @@ -91502,11 +91861,6 @@ const mkString = self => Channel.runFold(self.channel, () => "", (acc, chunk) => * await Effect.runPromise(program) // => [1, 2, 3, 4] * ``` * - * **Gotchas** - * - * This materializes the full content in memory. The source stream must not - * reuse or mutate emitted buffers, which are retained until collection completes. - * * @category destructors * @since 4.0.0 */ @@ -91514,6 +91868,11 @@ const mkArrayBuffer = self => Effect.map(Channel.mkUint8Array(self.channel), byt /** * Concatenates the stream's `Uint8Array` chunks into a single `Uint8Array`. * + * **Gotchas** + * + * This materializes the full content in memory. The source stream must not + * reuse or mutate emitted buffers, which are retained until collection completes. + * * **Example** (Joining Uint8Array chunks) * * ```ts import.meta.vitest @@ -91528,11 +91887,6 @@ const mkArrayBuffer = self => Effect.map(Channel.mkUint8Array(self.channel), byt * await Effect.runPromise(program) * ``` * - * **Gotchas** - * - * This materializes the full content in memory. The source stream must not - * reuse or mutate emitted buffers, which are retained until collection completes. - * * @category destructors * @since 4.0.0 */ @@ -92203,9 +92557,23 @@ const TracerKey = "effect/Tracer"; */ const Tracer = /*#__PURE__*/_Context_js__rspack_import_0/* .Reference */.Or(TracerKey, { fiberCached: true, - defaultValue: () => make({ - span: options => new NativeSpan(options) - }) + defaultValue: () => nativeTracer +}); +/** + * The default `Tracer` implementation backing the `Tracer` reference. It + * creates in-memory `NativeSpan` instances and does not export them anywhere. + * + * **Details** + * + * Runtime code can compare the active tracer against `nativeTracer` to detect + * that no tracing backend is installed and skip work that only a backend could + * observe, such as recording span attributes. + * + * @category references + * @since 4.0.0 + */ +const nativeTracer = /*#__PURE__*/make({ + span: options => new NativeSpan(options) }); /** * Default in-memory `Span` implementation used by the native tracer. It @@ -92214,9 +92582,11 @@ const Tracer = /*#__PURE__*/_Context_js__rspack_import_0/* .Reference */.Or(Trac * * **Details** * - * The constructor initializes the span with `Started` status, inherits the - * parent trace id or generates a new one, and always generates a new span id. - * Attributes, events, links, and status are then mutated through `Span` methods. + * The constructor initializes the span with `Started` status. Trace and span + * identifiers, the attribute map, and the event list are created lazily on + * first access, so spans that are never inspected allocate as little as + * possible. Attributes, events, links, and status are mutated through `Span` + * methods. * * @see {@link Span} for the interface implemented by native spans * @@ -92225,8 +92595,6 @@ const Tracer = /*#__PURE__*/_Context_js__rspack_import_0/* .Reference */.Or(Trac */ class NativeSpan { _tag = "Span"; - spanId; - traceId = "native"; sampled; name; parent; @@ -92235,8 +92603,10 @@ class NativeSpan { startTime; kind; status; - attributes; - events = []; + _traceId = undefined; + _spanId = undefined; + _attributes = undefined; + _events = undefined; constructor(options) { this.name = options.name; this.parent = options.parent; @@ -92249,9 +92619,18 @@ class NativeSpan { _tag: "Started", startTime: options.startTime }; - this.attributes = new Map(); - this.traceId = _Option_js__rspack_import_2.getOrUndefined(options.parent)?.traceId ?? _Encoding_js__rspack_import_3/* .randomHex */.nw(32); - this.spanId = _Encoding_js__rspack_import_3/* .randomHex */.nw(16); + } + get traceId() { + return this._traceId ??= _Option_js__rspack_import_2.getOrUndefined(this.parent)?.traceId ?? _Encoding_js__rspack_import_3/* .randomHex */.nw(32); + } + get spanId() { + return this._spanId ??= _Encoding_js__rspack_import_3/* .randomHex */.nw(16); + } + get attributes() { + return this._attributes ??= new Map(); + } + get events() { + return this._events ??= []; } end(endTime, exit) { this.status = { @@ -92287,6 +92666,8 @@ __webpack_require__.d(__webpack_exports__, { }, "./node_modules/effect/dist/Utils.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) { +/* import */ var _internal_stackTraceLimit_js__rspack_import_0 = __webpack_require__("./node_modules/effect/dist/internal/stackTraceLimit.js"); + /** * Yields its wrapped value exactly once through an `IterableIterator`. * @@ -92377,7 +92758,7 @@ const pickInternalCall = () => { } } }; - const isNotOptimizedAway = standard[InternalTypeId](() => new Error().stack)?.includes(InternalTypeId) === true; + const isNotOptimizedAway = (0,_internal_stackTraceLimit_js__rspack_import_0/* .getStackTraceLimit */.jt)() !== 0 && standard[InternalTypeId](() => new Error().stack)?.includes(InternalTypeId) === true; return isNotOptimizedAway ? standard[InternalTypeId] : forced[InternalTypeId]; }; /** @internal */ @@ -92397,6 +92778,12 @@ __webpack_require__.d(__webpack_exports__, { */ /** @internal */ const isArrayNonEmpty = self => self.length > 0; +/** @internal */ +function replaceAt(self, index, value) { + const out = self.slice(); + out[index] = value; + return out; +} //# sourceMappingURL=array.js.map __webpack_require__.d(__webpack_exports__, { }, { @@ -92518,8 +92905,6 @@ const isCause = self => (0,_Predicate_js__rspack_import_7/* .hasProperty */.i5)( const isCauseReason = self => (0,_Predicate_js__rspack_import_7/* .hasProperty */.i5)(self, CauseReasonTypeId); /** @internal */ class CauseImpl { - [CauseTypeId]; - reasons; constructor(failures) { this[CauseTypeId] = CauseTypeId; this.reasons = failures; @@ -92589,7 +92974,6 @@ class ReasonBase { const constEmptyAnnotations = /*#__PURE__*/new Map(); /** @internal */ class Fail extends ReasonBase { - error; constructor(error, annotations = constEmptyAnnotations) { super("Fail", annotations, error); this.error = error; @@ -92618,7 +93002,6 @@ const causeEmpty = /*#__PURE__*/new CauseImpl([]); const causeFail = error => new CauseImpl([new Fail(error)]); /** @internal */ class Die extends ReasonBase { - defect; constructor(defect, annotations = constEmptyAnnotations) { super("Die", annotations, defect); this.defect = defect; @@ -92667,10 +93050,12 @@ const makePrimitiveProto = options => ({ /** @internal */ const makePrimitive = options => { const Proto = makePrimitiveProto(options); - return function () { - const self = Object.create(Proto); - self[args] = options.single === false ? arguments : arguments[0]; - return self; + const PrimitiveImpl = function (value) { + this[args] = value; + }; + PrimitiveImpl.prototype = Proto; + return function (value) { + return new PrimitiveImpl(value); }; }; /** @internal */ @@ -92699,10 +93084,12 @@ const makeExit = options => { return _Hash_js__rspack_import_4/* .combine */.kg(_Hash_js__rspack_import_4/* .string */.Yj(options.op), _Hash_js__rspack_import_4/* .hash */.tW(this[args])); } }; + const ExitPrimitive = function (value) { + this[args] = value; + }; + ExitPrimitive.prototype = Proto; return function (value) { - const self = Object.create(Proto); - self[args] = value; - return self; + return new ExitPrimitive(value); }; }; /** @internal */ @@ -92729,9 +93116,9 @@ const exitFailCause = /*#__PURE__*/makeExit({ [evaluate](fiber) { let cause = this[args]; let annotated = false; - if (fiber.currentStackFrame) { + if (fiber.cache.stackFrame) { cause = causeAnnotate(cause, { - mapUnsafe: new Map([[StackTraceKey.key, fiber.currentStackFrame]]) + mapUnsafe: new Map([[StackTraceKey.key, fiber.cache.stackFrame]]) }); annotated = true; } @@ -92753,6 +93140,20 @@ const withFiber = /*#__PURE__*/makePrimitive({ return this[args](fiber); } }); +/** + * Accesses the current fiber to compute a value without a separate `succeed` + * operation. + * + * @internal + */ +const withFiberSucceed = /*#__PURE__*/makePrimitive({ + op: "WithFiberSucceed", + [evaluate](fiber) { + const value = this[args](fiber); + const cont = fiber.getCont(contA); + return cont ? cont[contA](value, fiber) : fiber.yieldWith(exitSucceed(value)); + } +}); /** @internal */ const YieldableError = /*#__PURE__*/function () { class YieldableError extends globalThis.Error {} @@ -92851,6 +93252,7 @@ __webpack_require__.d(__webpack_exports__, { DH: causeEmpty, Eh: causeAnnotate, GN: Yield, + Hq: withFiberSucceed, IH: ExitTypeId, In: StructuralProto, Iu: causeDie, @@ -92888,6 +93290,28 @@ __webpack_require__.d(__webpack_exports__, { }); +}, +"./node_modules/effect/dist/internal/count.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * Normalizes a collection count to a non-negative integer. `NaN` and + * non-positive values become `0`; positive infinity is preserved. + * + * @internal + */ +const normalize = n => n > 0 ? Math.floor(n) : 0; +/** + * Normalizes a collection count to an integer greater than or equal to `1`. + * + * @internal + */ +const normalizeNonEmpty = n => Math.max(1, normalize(n)); +//# sourceMappingURL=count.js.map +__webpack_require__.d(__webpack_exports__, { +}, { + S: normalize +}); + + }, "./node_modules/effect/dist/internal/doNotation.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) { /* import */ var _Function_js__rspack_import_0 = __webpack_require__("./node_modules/effect/dist/Function.js"); @@ -92917,31 +93341,31 @@ __webpack_require__.d(__webpack_exports__, { }, "./node_modules/effect/dist/internal/effect.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) { -/* import */ var _Array_js__rspack_import_7 = __webpack_require__("./node_modules/effect/dist/Array.js"); +/* import */ var _Array_js__rspack_import_16 = __webpack_require__("./node_modules/effect/dist/Array.js"); /* import */ var _Context_js__rspack_import_5 = __webpack_require__("./node_modules/effect/dist/Context.js"); /* import */ var _Duration_js__rspack_import_20 = __webpack_require__("./node_modules/effect/dist/Duration.js"); /* import */ var _Equal_js__rspack_import_1 = __webpack_require__("./node_modules/effect/dist/Equal.js"); /* import */ var _Filter_js__rspack_import_4 = __webpack_require__("./node_modules/effect/dist/Filter.js"); -/* import */ var _Formatter_js__rspack_import_9 = __webpack_require__("./node_modules/effect/dist/Formatter.js"); +/* import */ var _Formatter_js__rspack_import_8 = __webpack_require__("./node_modules/effect/dist/Formatter.js"); /* import */ var _Function_js__rspack_import_6 = __webpack_require__("./node_modules/effect/dist/Function.js"); /* import */ var _Hash_js__rspack_import_2 = __webpack_require__("./node_modules/effect/dist/Hash.js"); /* import */ var _Inspectable_js__rspack_import_25 = __webpack_require__("./node_modules/effect/dist/Inspectable.js"); /* import */ var _Iterable_js__rspack_import_23 = __webpack_require__("./node_modules/effect/dist/Iterable.js"); /* import */ var _Option_js__rspack_import_17 = __webpack_require__("./node_modules/effect/dist/Option.js"); /* import */ var _Order_js__rspack_import_24 = __webpack_require__("./node_modules/effect/dist/Order.js"); -/* import */ var _Pipeable_js__rspack_import_12 = __webpack_require__("./node_modules/effect/dist/Pipeable.js"); -/* import */ var _Predicate_js__rspack_import_11 = __webpack_require__("./node_modules/effect/dist/Predicate.js"); -/* import */ var _Redactable_js__rspack_import_10 = __webpack_require__("./node_modules/effect/dist/Redactable.js"); +/* import */ var _Pipeable_js__rspack_import_11 = __webpack_require__("./node_modules/effect/dist/Pipeable.js"); +/* import */ var _Predicate_js__rspack_import_10 = __webpack_require__("./node_modules/effect/dist/Predicate.js"); +/* import */ var _Redactable_js__rspack_import_9 = __webpack_require__("./node_modules/effect/dist/Redactable.js"); /* import */ var _Result_js__rspack_import_3 = __webpack_require__("./node_modules/effect/dist/Result.js"); /* import */ var _Scheduler_js__rspack_import_13 = __webpack_require__("./node_modules/effect/dist/Scheduler.js"); -/* import */ var _Tracer_js__rspack_import_14 = __webpack_require__("./node_modules/effect/dist/Tracer.js"); +/* import */ var _Tracer_js__rspack_import_12 = __webpack_require__("./node_modules/effect/dist/Tracer.js"); /* import */ var _Utils_js__rspack_import_18 = __webpack_require__("./node_modules/effect/dist/Utils.js"); /* import */ var _core_js__rspack_import_0 = __webpack_require__("./node_modules/effect/dist/internal/core.js"); /* import */ var _doNotation_js__rspack_import_22 = __webpack_require__("./node_modules/effect/dist/internal/doNotation.js"); -/* import */ var _metric_js__rspack_import_16 = __webpack_require__("./node_modules/effect/dist/internal/metric.js"); +/* import */ var _metric_js__rspack_import_15 = __webpack_require__("./node_modules/effect/dist/internal/metric.js"); /* import */ var _record_js__rspack_import_21 = __webpack_require__("./node_modules/effect/dist/internal/record.js"); -/* import */ var _references_js__rspack_import_15 = __webpack_require__("./node_modules/effect/dist/internal/references.js"); -/* import */ var _stackTraceLimit_js__rspack_import_8 = __webpack_require__("./node_modules/effect/dist/internal/stackTraceLimit.js"); +/* import */ var _references_js__rspack_import_14 = __webpack_require__("./node_modules/effect/dist/internal/references.js"); +/* import */ var _stackTraceLimit_js__rspack_import_7 = __webpack_require__("./node_modules/effect/dist/internal/stackTraceLimit.js"); /* import */ var _tracer_js__rspack_import_19 = __webpack_require__("./node_modules/effect/dist/internal/tracer.js"); @@ -92974,7 +93398,6 @@ __webpack_require__.d(__webpack_exports__, { // ---------------------------------------------------------------------------- /** @internal */ class Interrupt extends _core_js__rspack_import_0/* .ReasonBase */.ET { - fiberId; constructor(fiberId, annotations = _core_js__rspack_import_0/* .constEmptyAnnotations */.dO) { super("Interrupt", annotations, "Interrupted"); this.fiberId = fiberId; @@ -93072,6 +93495,25 @@ const causeAnnotations = self => { } return _Context_js__rspack_import_5/* .makeUnsafe */.LZ(map); }; +const dedupeReasons = (self, that) => { + // Keep deduplication local so causeCombine does not retain Array.ts in the core bundle. + // Snapshot both arrays before invoking user-defined hash or equality methods. + const buckets = new Map(); + const out = []; + for (const reason of self.concat(that)) { + const hash = _Hash_js__rspack_import_2/* .hash */.tW(reason); + const bucket = buckets.get(hash); + if (bucket === undefined) { + buckets.set(hash, [reason]); + } else if (bucket.some(previous => _Equal_js__rspack_import_1/* .equals */.aI(previous, reason))) { + continue; + } else { + bucket.push(reason); + } + out.push(reason); + } + return out; +}; /** @internal */ const causeCombine = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, that) => { if (self.reasons.length === 0) { @@ -93079,7 +93521,7 @@ const causeCombine = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY } else if (that.reasons.length === 0) { return self; } - const newCause = new _core_js__rspack_import_0/* .CauseImpl */.s0(_Array_js__rspack_import_7/* .union */.KC(self.reasons, that.reasons)); + const newCause = new _core_js__rspack_import_0/* .CauseImpl */.s0(dedupeReasons(self.reasons, that.reasons)); return _Equal_js__rspack_import_1/* .equals */.aI(self, newCause) ? self : newCause; }); /** @internal */ @@ -93123,8 +93565,8 @@ const causePrettyErrors = (self, options) => { const errors = []; const interrupts = []; if (self.reasons.length === 0) return errors; - const prevStackLimit = (0,_stackTraceLimit_js__rspack_import_8/* .getStackTraceLimit */.jt)(); - (0,_stackTraceLimit_js__rspack_import_8/* .setStackTraceLimit */.ft)(1); + const prevStackLimit = (0,_stackTraceLimit_js__rspack_import_7/* .getStackTraceLimit */.jt)(); + if (prevStackLimit !== 0) (0,_stackTraceLimit_js__rspack_import_7/* .setStackTraceLimit */.ft)(1); for (const failure of self.reasons) { if (failure._tag === "Interrupt") { interrupts.push(failure); @@ -93143,7 +93585,7 @@ const causePrettyErrors = (self, options) => { error.stack = `${error.name}: ${error.message}`; errors.push(causePrettyError(error, interrupts[0].annotations, options)); } - (0,_stackTraceLimit_js__rspack_import_8/* .setStackTraceLimit */.ft)(prevStackLimit); + if (prevStackLimit !== 0) (0,_stackTraceLimit_js__rspack_import_7/* .setStackTraceLimit */.ft)(prevStackLimit); return errors; }; /** @internal */ @@ -93173,7 +93615,7 @@ const causePrettyError = (original, annotations, options) => { } } } else { - error = new globalThis.Error(!original ? `Unknown error: ${original}` : kind === "string" ? original : (0,_Formatter_js__rspack_import_9/* .formatJson */.IB)(original)); + error = new globalThis.Error(!original ? `Unknown error: ${original}` : kind === "string" ? original : (0,_Formatter_js__rspack_import_8/* .formatJson */.IB)(original)); } return error; }; @@ -93187,7 +93629,7 @@ const causePrettyMessage = u => { // something's off, rollback to json } } - return (0,_Formatter_js__rspack_import_9/* .formatJson */.IB)(u); + return (0,_Formatter_js__rspack_import_8/* .formatJson */.IB)(u); }; const locationRegExp = /\((.*)\)/g; const cleanErrorStack = (stack, error, annotations) => { @@ -93270,7 +93712,7 @@ const fiberIdStore = { id: 0 }; /** @internal */ -const getCurrentFiber = () => globalThis[_Redactable_js__rspack_import_10/* .currentFiberTypeId */.fL]; +const getCurrentFiber = () => globalThis[_Redactable_js__rspack_import_9/* .currentFiberTypeId */.fL]; /** @internal */ class FiberImpl { constructor(context, interruptible = true) { @@ -93280,14 +93722,15 @@ class FiberImpl { this.currentOpCount = 0; this.interruptible = interruptible; this._stack = []; - this._observers = []; + this._observers = undefined; this._exit = undefined; this._children = undefined; this._interruptedCause = undefined; this._yielded = undefined; this._running = false; this._deferredInterrupt = false; - this.runtimeMetrics?.recordFiberStart(this.context); + this._parent = undefined; + this.cache.runtimeMetrics?.recordFiberStart(this.context); } [FiberTypeId]; id; @@ -93301,20 +93744,13 @@ class FiberImpl { _yielded; _running; _deferredInterrupt; + _parent; // set in setContext context; - currentScheduler; - currentTracerContext; - currentSpan; - currentLogLevel; - minimumLogLevel; - currentStackFrame; - runtimeMetrics; - maxOpsBeforeYield; - currentPreventYield; + cache; _dispatcher = undefined; get currentDispatcher() { - return this._dispatcher ??= this.currentScheduler.makeDispatcher(); + return this._dispatcher ??= this.cache.scheduler.makeDispatcher(); } getRef(ref) { return _Context_js__rspack_import_5/* .get */.Jt(this.context, ref); @@ -93324,9 +93760,13 @@ class FiberImpl { cb(this._exit); return _Function_js__rspack_import_6/* .constVoid */.Yi; } - this._observers.push(cb); + if (this._observers === undefined) { + this._observers = [cb]; + } else { + this._observers.push(cb); + } return () => { - if (this._exit) return; + if (this._exit || this._observers === undefined) return; const index = this._observers.indexOf(cb); if (index >= 0) { this._observers.splice(index, 1); @@ -93338,8 +93778,8 @@ class FiberImpl { return; } let cause = causeInterrupt(fiberId); - if (this.currentStackFrame) { - cause = (0,_core_js__rspack_import_0/* .causeAnnotate */.Eh)(cause, _Context_js__rspack_import_5/* .make */.L8(_core_js__rspack_import_0/* .StackTraceKey */.z8, this.currentStackFrame)); + if (this.cache.stackFrame) { + cause = (0,_core_js__rspack_import_0/* .causeAnnotate */.Eh)(cause, _Context_js__rspack_import_5/* .make */.L8(_core_js__rspack_import_0/* .StackTraceKey */.z8, this.cache.stackFrame)); } if (annotations) { cause = (0,_core_js__rspack_import_0/* .causeAnnotate */.Eh)(cause, annotations); @@ -93375,18 +93815,25 @@ class FiberImpl { return this.evaluate(flatMap(interruptChildren, () => exit)); } this._exit = exit; - this.runtimeMetrics?.recordFiberEnd(this.context, this._exit); - for (let i = 0; i < this._observers.length; i++) { - this._observers[i](exit); + this.cache.runtimeMetrics?.recordFiberEnd(this.context, this._exit); + if (this._parent) { + this._parent._children?.delete(this); + this._parent = undefined; + } + if (this._observers !== undefined) { + const observers = this._observers; + this._observers = undefined; + for (let i = 0; i < observers.length; i++) { + observers[i](exit); + } } - this._observers.length = 0; this._stack.length = 0; this._children = undefined; this.context = _Context_js__rspack_import_5/* .empty */.Ie(); } runLoop(effect) { - const prevFiber = globalThis[_Redactable_js__rspack_import_10/* .currentFiberTypeId */.fL]; - globalThis[_Redactable_js__rspack_import_10/* .currentFiberTypeId */.fL] = this; + const prevFiber = globalThis[_Redactable_js__rspack_import_9/* .currentFiberTypeId */.fL]; + globalThis[_Redactable_js__rspack_import_9/* .currentFiberTypeId */.fL] = this; const prevRunning = this._running; this._running = true; let yielding = false; @@ -93399,12 +93846,14 @@ class FiberImpl { current = failCause(this._interruptedCause); } this.currentOpCount++; - if (!yielding && !this.currentPreventYield && this.currentScheduler.shouldYield(this)) { + // Refresh the cache because a primitive can replace the fiber context. + const cache = this.cache; + if (!yielding && !cache.preventYield && cache.scheduler.shouldYield(this)) { yielding = true; const prev = current; current = flatMap(yieldNow, () => prev); } - current = this.currentTracerContext ? this.currentTracerContext(current, this) : current[_core_js__rspack_import_0/* .evaluate */._3](this); + current = cache.tracerContext ? cache.tracerContext(current, this) : current[_core_js__rspack_import_0/* .evaluate */._3](this); if (current === _core_js__rspack_import_0/* .Yield */.GN) { const yielded = this._yielded; if (_core_js__rspack_import_0/* .ExitTypeId */.IH in yielded) { @@ -93420,13 +93869,13 @@ class FiberImpl { } } } catch (error) { - if (!(0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(current, _core_js__rspack_import_0/* .evaluate */._3)) { + if (!(0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(current, _core_js__rspack_import_0/* .evaluate */._3)) { return (0,_core_js__rspack_import_0/* .exitDie */.V2)(`Fiber.runLoop: Not a valid effect: ${String(current)}`); } return this.runLoop((0,_core_js__rspack_import_0/* .exitDie */.V2)(error)); } finally { this._running = prevRunning; - globalThis[_Redactable_js__rspack_import_10/* .currentFiberTypeId */.fL] = prevFiber; + globalThis[_Redactable_js__rspack_import_9/* .currentFiberTypeId */.fL] = prevFiber; } } getCont(symbol) { @@ -93437,11 +93886,14 @@ class FiberImpl { while (true) { const op = this._stack.pop(); if (!op) return undefined; - const cont = op[_core_js__rspack_import_0/* .contAll */.u4] && op[_core_js__rspack_import_0/* .contAll */.u4](this); - if (cont) { - ; - cont[symbol] = cont; - return cont; + const all = op[_core_js__rspack_import_0/* .contAll */.u4]; + if (all !== undefined) { + const cont = all.call(op, this); + if (cont) { + ; + cont[symbol] = cont; + return cont; + } } if (op[symbol]) return op; } @@ -93454,7 +93906,7 @@ class FiberImpl { return this._children ??= new Set(); } pipe() { - return (0,_Pipeable_js__rspack_import_12/* .pipeArguments */.tT)(this, arguments); + return (0,_Pipeable_js__rspack_import_11/* .pipeArguments */.tT)(this, arguments); } setContext(context) { const previous = this.context; @@ -93462,27 +93914,39 @@ class FiberImpl { // Every key cached below opts in to Context caching, so contexts related // only by non-caching adds cannot have changed any of them if (previous !== undefined && _Context_js__rspack_import_5/* .hasSameCache */.Pf(previous, context)) return; - const scheduler = this.getRef(_Scheduler_js__rspack_import_13/* .Scheduler */._F); - if (scheduler !== this.currentScheduler) { - this.currentScheduler = scheduler; + // Contexts sharing a cacheRoot resolve every cached key identically, so + // the derived cache object is computed once per root and shared by all + // fibers running with that root (forked fibers reuse the parent's). + const root = context.cacheRoot; + const cache = root._fiberCache ??= makeFiberContextCache(context); + if (this.cache !== undefined && this.cache.scheduler !== cache.scheduler) { this._dispatcher = undefined; } - // The string-keyed lookups keep the Tracer key values (and the native - // tracer behind Tracer.Tracer's default) out of every bundle - this.currentSpan = _Context_js__rspack_import_5/* .getOrUndefinedUnsafe */.Ub(context, _Tracer_js__rspack_import_14/* .ParentSpanKey */.WG); - this.currentLogLevel = this.getRef(_references_js__rspack_import_15/* .CurrentLogLevel */.Gl); - this.minimumLogLevel = this.getRef(_references_js__rspack_import_15/* .MinimumLogLevel */.zQ); - this.currentStackFrame = this.getRef(_references_js__rspack_import_15/* .CurrentStackFrame */.vA); - this.maxOpsBeforeYield = this.getRef(_Scheduler_js__rspack_import_13/* .MaxOpsBeforeYield */.Zm); - this.currentPreventYield = this.getRef(_Scheduler_js__rspack_import_13/* .PreventSchedulerYield */.hf); - this.runtimeMetrics = _Context_js__rspack_import_5/* .getOrUndefinedUnsafe */.Ub(context, _metric_js__rspack_import_16/* .FiberRuntimeMetricsKey */.F); - const currentTracer = _Context_js__rspack_import_5/* .getOrUndefinedUnsafe */.Ub(context, _Tracer_js__rspack_import_14/* .TracerKey */.RL); - this.currentTracerContext = currentTracer ? currentTracer["context"] : undefined; + this.cache = cache; } get currentSpanLocal() { - return this.currentSpan?._tag === "Span" ? this.currentSpan : undefined; + const span = this.cache.span; + return span?._tag === "Span" ? span : undefined; } } +const makeFiberContextCache = context => { + // The string-keyed lookups keep the Tracer key values (and the native + // tracer behind Tracer.Tracer's default) out of every bundle + const currentTracer = _Context_js__rspack_import_5/* .getOrUndefinedUnsafe */.Ub(context, _Tracer_js__rspack_import_12/* .TracerKey */.RL); + return { + scheduler: _Context_js__rspack_import_5/* .get */.Jt(context, _Scheduler_js__rspack_import_13/* .Scheduler */._F), + tracer: currentTracer, + tracerContext: currentTracer ? currentTracer["context"] : undefined, + tracerEnabled: _Context_js__rspack_import_5/* .get */.Jt(context, _references_js__rspack_import_14/* .TracerEnabled */.rf), + span: _Context_js__rspack_import_5/* .getOrUndefinedUnsafe */.Ub(context, _Tracer_js__rspack_import_12/* .ParentSpanKey */.WG), + logLevel: _Context_js__rspack_import_5/* .get */.Jt(context, _references_js__rspack_import_14/* .CurrentLogLevel */.Gl), + minimumLogLevel: _Context_js__rspack_import_5/* .get */.Jt(context, _references_js__rspack_import_14/* .MinimumLogLevel */.zQ), + stackFrame: _Context_js__rspack_import_5/* .get */.Jt(context, _references_js__rspack_import_14/* .CurrentStackFrame */.vA), + runtimeMetrics: _Context_js__rspack_import_5/* .getOrUndefinedUnsafe */.Ub(context, _metric_js__rspack_import_15/* .FiberRuntimeMetricsKey */.F), + maxOpsBeforeYield: _Context_js__rspack_import_5/* .get */.Jt(context, _Scheduler_js__rspack_import_13/* .MaxOpsBeforeYield */.Zm), + preventYield: _Context_js__rspack_import_5/* .get */.Jt(context, _Scheduler_js__rspack_import_13/* .PreventSchedulerYield */.hf) + }; +}; const deferredInterruptCont = { [_core_js__rspack_import_0/* .contA */.ee](_value, fiber) { return failCause(fiber._interruptedCause); @@ -93495,9 +93959,9 @@ const fiberMiddleware = { interruptChildren: undefined }; const fiberStackAnnotations = fiber => { - if (!fiber.currentStackFrame) return undefined; + if (!fiber.cache.stackFrame) return undefined; const annotations = new Map(); - annotations.set(_core_js__rspack_import_0/* .InterruptorStackTrace.key */.QJ.key, fiber.currentStackFrame); + annotations.set(_core_js__rspack_import_0/* .InterruptorStackTrace.key */.QJ.key, fiber.cache.stackFrame); return _Context_js__rspack_import_5/* .makeUnsafe */.LZ(annotations); }; const fiberInterruptChildren = fiber => { @@ -93551,9 +94015,9 @@ const fiberJoin = self => { /** @internal */ const fiberJoinAll = self => callback(resume => { const fibers = Array.from(self); - if (fibers.length === 0) return resume(succeed(_Array_js__rspack_import_7/* .empty */.Ie())); + if (fibers.length === 0) return resume(succeed(_Array_js__rspack_import_16/* .empty */.Ie())); const out = new Array(fibers.length); - const cancels = _Array_js__rspack_import_7/* .empty */.Ie(); + const cancels = _Array_js__rspack_import_16/* .empty */.Ie(); let done = 0; let failed = false; for (let i = 0; i < fibers.length; i++) { @@ -93579,7 +94043,7 @@ const fiberJoinAll = self => callback(resume => { /** @internal */ const fiberInterrupt = self => (0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => fiberInterruptAs(self, fiber.id)); /** @internal */ -const fiberInterruptAs = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(args[0], FiberTypeId), (self, fiberId, annotations) => (0,_core_js__rspack_import_0/* .withFiber */.R6)(parent => { +const fiberInterruptAs = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(args[0], FiberTypeId), (self, fiberId, annotations) => (0,_core_js__rspack_import_0/* .withFiber */.R6)(parent => { let ann = fiberStackAnnotations(parent); ann = ann && annotations ? _Context_js__rspack_import_5/* .merge */.h1(ann, annotations) : ann ?? annotations; self.interruptUnsafe(fiberId, ann); @@ -93588,7 +94052,7 @@ const fiberInterruptAs = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual * /** @internal */ const fiberInterruptAll = fibers => (0,_core_js__rspack_import_0/* .withFiber */.R6)(parent => { const annotations = fiberStackAnnotations(parent); - let fiberArr = _Array_js__rspack_import_7/* .empty */.Ie(); + let fiberArr = _Array_js__rspack_import_16/* .empty */.Ie(); for (const fiber of fibers) { fiber.interruptUnsafe(parent.id, annotations); fiberArr.push(fiber); @@ -93598,7 +94062,7 @@ const fiberInterruptAll = fibers => (0,_core_js__rspack_import_0/* .withFiber */ /** @internal */ const fiberInterruptAllAs = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (fibers, fiberId) => (0,_core_js__rspack_import_0/* .withFiber */.R6)(parent => { const annotations = fiberStackAnnotations(parent); - const fiberArr = _Array_js__rspack_import_7/* .empty */.Ie(); + const fiberArr = _Array_js__rspack_import_16/* .empty */.Ie(); for (const fiber of fibers) { fiber.interruptUnsafe(fiberId, annotations); fiberArr.push(fiber); @@ -93711,39 +94175,48 @@ const withFiberId = f => (0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber const fiber = /*#__PURE__*/(0,_core_js__rspack_import_0/* .withFiber */.R6)(succeed); /** @internal */ const fiberId = /*#__PURE__*/withFiberId(succeed); -const callbackOptions = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitive */.Uf)({ - op: "Async", - single: false, - [_core_js__rspack_import_0/* .evaluate */._3](fiber) { - const register = (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => this[_core_js__rspack_import_0/* .args */.a2][0].bind(fiber.currentScheduler)); - let resumed = false; - let yielded = false; - const controller = this[_core_js__rspack_import_0/* .args */.a2][1] ? new AbortController() : undefined; - const onCancel = register(effect => { - if (resumed) return; - resumed = true; - if (yielded) { - fiber.evaluate(effect); - } else { - yielded = effect; +const callbackOptions = /*#__PURE__*/function () { + const Proto = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitiveProto */.yj)({ + op: "Async", + [_core_js__rspack_import_0/* .evaluate */._3](fiber) { + const register = (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => this.register.bind(fiber.cache.scheduler)); + let resumed = false; + let yielded = false; + const controller = this.withSignal ? new AbortController() : undefined; + const onCancel = register(effect => { + if (resumed) return; + resumed = true; + if (yielded) { + fiber.evaluate(effect); + } else { + yielded = effect; + } + }, controller?.signal); + if (yielded !== false) return yielded; + yielded = true; + fiber._yielded = () => { + resumed = true; + }; + if (controller === undefined && onCancel === undefined) { + return _core_js__rspack_import_0/* .Yield */.GN; } - }, controller?.signal); - if (yielded !== false) return yielded; - yielded = true; - fiber._yielded = () => { - resumed = true; - }; - if (controller === undefined && onCancel === undefined) { + fiber._stack.push(asyncFinalizer(() => { + resumed = true; + controller?.abort(); + return onCancel ?? exitVoid; + })); return _core_js__rspack_import_0/* .Yield */.GN; } - fiber._stack.push(asyncFinalizer(() => { - resumed = true; - controller?.abort(); - return onCancel ?? exitVoid; - })); - return _core_js__rspack_import_0/* .Yield */.GN; - } -}); + }); + const AsyncImpl = function (register, withSignal) { + this.register = register; + this.withSignal = withSignal; + }; + AsyncImpl.prototype = Proto; + return function (register, withSignal) { + return new AsyncImpl(register, withSignal); + }; +}(); const asyncFinalizer = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitive */.Uf)({ op: "AsyncFinalizer", [_core_js__rspack_import_0/* .contAll */.u4](fiber) { @@ -93761,7 +94234,14 @@ const callback = register => callbackOptions(register, register.length >= 2); /** @internal */ const never = /*#__PURE__*/callback(_Function_js__rspack_import_6/* .constVoid */.Yi); /** @internal */ -const gen = (...args) => suspend(() => fromIteratorUnsafe(args.length === 1 ? args[0]() : args[1].call(args[0].self))); +const gen = (...args) => { + if (args.length === 1) { + const body = args[0]; + return suspend(() => fromIteratorUnsafe(body())); + } + const [options, body] = args; + return suspend(() => fromIteratorUnsafe(body.call(options.self))); +}; /** @internal */ const fnUntraced = (body, ...pipeables) => { const fn = pipeables.length === 0 ? function () { @@ -93785,10 +94265,13 @@ const fn = function () { const nameFirst = typeof arguments[0] === "string"; const name = nameFirst ? arguments[0] : "Effect.fn"; const spanOptions = nameFirst ? arguments[1] : undefined; - const prevLimit = (0,_stackTraceLimit_js__rspack_import_8/* .getStackTraceLimit */.jt)(); - (0,_stackTraceLimit_js__rspack_import_8/* .setStackTraceLimit */.ft)(2); - const defError = new globalThis.Error(); - (0,_stackTraceLimit_js__rspack_import_8/* .setStackTraceLimit */.ft)(prevLimit); + const prevLimit = (0,_stackTraceLimit_js__rspack_import_7/* .getStackTraceLimit */.jt)(); + let defError; + if (prevLimit !== 0) { + (0,_stackTraceLimit_js__rspack_import_7/* .setStackTraceLimit */.ft)(2); + defError = new globalThis.Error(); + (0,_stackTraceLimit_js__rspack_import_7/* .setStackTraceLimit */.ft)(prevLimit); + } if (nameFirst) { return (body, ...pipeables) => makeFn(name, body, defError, pipeables, nameFirst, spanOptions); } @@ -93807,16 +94290,19 @@ const makeFn = (name, bodyOrOptions, defError, pipeables, addSpan, spanOptions) if (!(0,_core_js__rspack_import_0/* .isEffect */.yw)(result)) { return result; } - const prevLimit = (0,_stackTraceLimit_js__rspack_import_8/* .getStackTraceLimit */.jt)(); - (0,_stackTraceLimit_js__rspack_import_8/* .setStackTraceLimit */.ft)(2); - const callError = new globalThis.Error(); - (0,_stackTraceLimit_js__rspack_import_8/* .setStackTraceLimit */.ft)(prevLimit); - return updateService(addSpan ? useSpan(name, spanOptions, span => provideParentSpan(result, span)) : result, _references_js__rspack_import_15/* .CurrentStackFrame */.vA, prev => ({ + const prevLimit = (0,_stackTraceLimit_js__rspack_import_7/* .getStackTraceLimit */.jt)(); + let callError; + if (prevLimit !== 0) { + (0,_stackTraceLimit_js__rspack_import_7/* .setStackTraceLimit */.ft)(2); + callError = new globalThis.Error(); + (0,_stackTraceLimit_js__rspack_import_7/* .setStackTraceLimit */.ft)(prevLimit); + } + return updateService(addSpan ? useSpan(name, spanOptions, span => provideParentSpan(result, span)) : result, _references_js__rspack_import_14/* .CurrentStackFrame */.vA, prev => ({ name, - stack: fnStackCleaner(() => callError.stack), + stack: callError ? fnStackCleaner(() => callError.stack) : _Function_js__rspack_import_6/* .constUndefined */.MN, parent: { name: `${name} (definition)`, - stack: fnStackCleaner(() => defError.stack), + stack: defError ? fnStackCleaner(() => defError.stack) : _Function_js__rspack_import_6/* .constUndefined */.MN, parent: prev } })); @@ -93828,7 +94314,7 @@ const fnUntracedEager = (body, ...pipeables) => defineFunctionLength(body.length } : function () { let effect = fromIteratorEagerUnsafe(() => body.apply(this, arguments)); for (const pipeable of pipeables) { - effect = pipeable(effect); + effect = pipeable(effect, ...arguments); } return effect; }); @@ -93864,35 +94350,82 @@ const fromIteratorEagerUnsafe = evaluate => { return die(error); } }; -const fromIteratorUnsafe = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitive */.Uf)({ - op: "Iterator", - single: false, - [_core_js__rspack_import_0/* .contA */.ee](value, fiber) { - const iter = this[_core_js__rspack_import_0/* .args */.a2][0]; - while (true) { - const state = iter.next(value); - if (state.done) return succeed(state.value); - if (!effectIsExit(state.value)) { - fiber._stack.push(this); - return state.value; - } else if (state.value._tag === "Failure") { - return state.value; +const fromIteratorUnsafe = /*#__PURE__*/function () { + const Proto = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitiveProto */.yj)({ + op: "Iterator", + [_core_js__rspack_import_0/* .contA */.ee](value, fiber) { + const iter = this.iterator; + while (true) { + const state = iter.next(value); + if (state.done) return succeed(state.value); + if (!effectIsExit(state.value)) { + fiber._stack.push(this); + return state.value; + } else if (state.value._tag === "Failure") { + return state.value; + } + value = state.value.value; } - value = state.value.value; + }, + [_core_js__rspack_import_0/* .evaluate */._3](fiber) { + return this[_core_js__rspack_import_0/* .contA */.ee](this.initial, fiber); } - }, - [_core_js__rspack_import_0/* .evaluate */._3](fiber) { - return this[_core_js__rspack_import_0/* .contA */.ee](this[_core_js__rspack_import_0/* .args */.a2][1], fiber); - } -}); + }); + const IteratorImpl = function (iterator, initial) { + this.iterator = iterator; + this.initial = initial; + }; + IteratorImpl.prototype = Proto; + return function (iterator, initial) { + return new IteratorImpl(iterator, initial); + }; +}(); // ---------------------------------------------------------------------------- // mapping & sequencing // ---------------------------------------------------------------------------- /** @internal */ -const as = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, value) => { - const b = succeed(value); - return flatMap(self, _ => b); +const as = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, value) => new ContImpl(self, returnPayload, succeed(value))); +const evaluateCont = function (fiber) { + fiber._stack.push(this); + return this[_core_js__rspack_import_0/* .args */.a2]; +}; +const OnSuccessProto = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitiveProto */.yj)({ + op: "OnSuccess", + [_core_js__rspack_import_0/* .evaluate */._3]: evaluateCont }); +const OnSuccessImpl = function (self, f) { + this[_core_js__rspack_import_0/* .args */.a2] = self; + this[_core_js__rspack_import_0/* .contA */.ee] = f; +}; +OnSuccessImpl.prototype = OnSuccessProto; +// A success continuation with an extra payload slot. The stored continuation +// receives the primitive as `this` and reads `this.payload`, so combinators +// like map / as / tap / andThen can share module-level continuation functions +// instead of allocating a closure per call. +const ContImpl = function (self, cont, payload) { + this[_core_js__rspack_import_0/* .args */.a2] = self; + this[_core_js__rspack_import_0/* .contA */.ee] = cont; + this.payload = payload; +}; +ContImpl.prototype = OnSuccessProto; +const returnPayload = function () { + return this.payload; +}; +const mapCont = function (value) { + const f = this.payload; + return succeed((0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => f(value))); +}; +const andThenCont = function (value) { + const f = this.payload; + return (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => f(value)); +}; +const tapCont = function (value) { + const f = this.payload; + return new ContImpl((0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => f(value)), returnPayload, (0,_core_js__rspack_import_0/* .exitSucceed */.xt)(value)); +}; +const tapEffectCont = function (value) { + return new ContImpl(this.payload, returnPayload, (0,_core_js__rspack_import_0/* .exitSucceed */.xt)(value)); +}; /** @internal */ const asSome = self => map(self, _Option_js__rspack_import_17.some); /** @internal */ @@ -93901,16 +94434,16 @@ const flip = self => matchEffect(self, { onSuccess: fail }); /** @internal */ -const andThen = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => flatMap(self, a => (0,_core_js__rspack_import_0/* .isEffect */.yw)(f) ? f : (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => f(a)))); +const andThen = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => new ContImpl(self, (0,_core_js__rspack_import_0/* .isEffect */.yw)(f) ? returnPayload : andThenCont, f)); /** @internal */ -const tap = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => flatMap(self, a => as((0,_core_js__rspack_import_0/* .isEffect */.yw)(f) ? f : (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => f(a)), a))); +const tap = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => new ContImpl(self, (0,_core_js__rspack_import_0/* .isEffect */.yw)(f) ? tapEffectCont : tapCont, f)); /** @internal */ -const asVoid = self => flatMap(self, _ => exitVoid); +const asVoid = self => new ContImpl(self, returnPayload, exitVoid); /** @internal */ const sandbox = self => catchCause(self, fail); /** @internal */ const raceAll = (all, options) => (0,_core_js__rspack_import_0/* .withFiber */.R6)(parent => callback(resume => { - const effects = _Array_js__rspack_import_7/* .fromIterable */.Ts(all); + const effects = _Array_js__rspack_import_16/* .fromIterable */.Ts(all); const len = effects.length; let doneCount = 0; let done = false; @@ -93981,19 +94514,7 @@ const race = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args = /** @internal */ const raceFirst = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[1]), (self, that, options) => raceAllFirst([self, that], options)); /** @internal */ -const flatMap = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => { - const onSuccess = Object.create(OnSuccessProto); - onSuccess[_core_js__rspack_import_0/* .args */.a2] = self; - onSuccess[_core_js__rspack_import_0/* .contA */.ee] = f.length !== 1 ? a => f(a) : f; - return onSuccess; -}); -const OnSuccessProto = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitiveProto */.yj)({ - op: "OnSuccess", - [_core_js__rspack_import_0/* .evaluate */._3](fiber) { - fiber._stack.push(this); - return this[_core_js__rspack_import_0/* .args */.a2]; - } -}); +const flatMap = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => new OnSuccessImpl(self, f.length !== 1 ? a => f(a) : f)); /** @internal */ const matchCauseEffectEager = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, options) => { if (effectIsExit(self)) { @@ -94002,7 +94523,7 @@ const matchCauseEffectEager = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .d return matchCauseEffect(self, options); }); /** @internal */ -const effectIsExit = effect => _core_js__rspack_import_0/* .ExitTypeId */.IH in effect; +const effectIsExit = effect => effect[_core_js__rspack_import_0/* .ExitTypeId */.IH] !== undefined; /** @internal */ const flatMapEager = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => { if (effectIsExit(self)) { @@ -94016,7 +94537,7 @@ const flatMapEager = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY /** @internal */ const flatten = self => flatMap(self, _Function_js__rspack_import_6/* .identity */.D_); /** @internal */ -const map = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => flatMap(self, a => succeed((0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => f(a))))); +const map = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => new ContImpl(self, mapCont, f)); /** @internal */ const mapEager = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => effectIsExit(self) ? exitMap(self, f) : map(self, f)); /** @internal */ @@ -94138,7 +94659,9 @@ const updateServiceScoped = (service, update, options) => uninterruptible((0,_co const updated = update(original); fiber.setContext(_Context_js__rspack_import_5/* .add */.WQ(fiber.context, service, updated)); return scopeAddFinalizerExit(_Context_js__rspack_import_5/* .getUnsafe */.fp(fiber.context, scopeTag), _ => { - const current = _Context_js__rspack_import_5/* .getUnsafe */.fp(fiber.context, service); + const currentOption = _Context_js__rspack_import_5/* .getOption */.om(fiber.context, service); + if (_Option_js__rspack_import_17.isNone(currentOption)) return void_; + const current = currentOption.value; let next; if (options?.reset === undefined) { if (current !== updated) return void_; @@ -94186,7 +94709,7 @@ const zipWith = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(arg // ---------------------------------------------------------------------------- // filtering & conditionals // ---------------------------------------------------------------------------- -/* @internal */ +/** @internal */ const filterOrFail = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (self, predicate, orFailWith) => filterOrElse(self, predicate, orFailWith ? a => fail(orFailWith(a)) : () => fail(new _core_js__rspack_import_0/* .NoSuchElementError */.Xm()))); /** @internal */ const when = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, condition) => flatMap(condition, pass => pass ? asSome(self) : succeedNone)); @@ -94209,19 +94732,16 @@ const forever = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(arg // error handling // ---------------------------------------------------------------------------- /** @internal */ -const catchCause = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => { - const onFailure = Object.create(OnFailureProto); - onFailure[_core_js__rspack_import_0/* .args */.a2] = self; - onFailure[_core_js__rspack_import_0/* .contE */.Sc] = f.length !== 1 ? cause => f(cause) : f; - return onFailure; -}); +const catchCause = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => new OnFailureImpl(self, f.length !== 1 ? cause => f(cause) : f)); const OnFailureProto = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitiveProto */.yj)({ op: "OnFailure", - [_core_js__rspack_import_0/* .evaluate */._3](fiber) { - fiber._stack.push(this); - return this[_core_js__rspack_import_0/* .args */.a2]; - } + [_core_js__rspack_import_0/* .evaluate */._3]: evaluateCont }); +const OnFailureImpl = function (self, f) { + this[_core_js__rspack_import_0/* .args */.a2] = self; + this[_core_js__rspack_import_0/* .contE */.Sc] = f; +}; +OnFailureImpl.prototype = OnFailureProto; /** @internal */ const catchCauseIf = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(3, (self, predicate, f) => catchCause(self, cause => { if (!predicate(cause)) { @@ -94259,7 +94779,7 @@ const tapCauseFilter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */. const tapError = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => tapCauseFilter(self, findError, e => f(e))); /** @internal */ const tapErrorTag = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(3, (self, k, f) => { - const predicate = Array.isArray(k) ? e => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(e, "_tag") && k.includes(e._tag) : (0,_Predicate_js__rspack_import_11/* .isTagged */.$J)(k); + const predicate = Array.isArray(k) ? e => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(e, "_tag") && k.includes(e._tag) : (0,_Predicate_js__rspack_import_10/* .isTagged */.$J)(k); return tapError(self, error => predicate(error) ? f(error) : void_); }); /** @internal */ @@ -94285,7 +94805,7 @@ const catchFilter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY) })); /** @internal */ const catchTag = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (self, k, f, orElse) => { - const pred = Array.isArray(k) ? e => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(e, "_tag") && k.includes(e._tag) : (0,_Predicate_js__rspack_import_11/* .isTagged */.$J)(k); + const pred = Array.isArray(k) ? e => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(e, "_tag") && k.includes(e._tag) : (0,_Predicate_js__rspack_import_10/* .isTagged */.$J)(k); return catchIf(self, pred, f, orElse); }); /** @internal */ @@ -94293,19 +94813,19 @@ const catchTags = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(a let keys; return catchFilter(self, e => { keys ??= Object.keys(cases); - return (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(e, "_tag") && (0,_Predicate_js__rspack_import_11/* .isString */.Kg)(e["_tag"]) && keys.includes(e["_tag"]) ? _Result_js__rspack_import_3/* .succeed */.Py(e) : _Result_js__rspack_import_3/* .fail */.fJ(e); + return (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(e, "_tag") && (0,_Predicate_js__rspack_import_10/* .isString */.Kg)(e["_tag"]) && keys.includes(e["_tag"]) ? _Result_js__rspack_import_3/* .succeed */.Py(e) : _Result_js__rspack_import_3/* .fail */.fJ(e); }, e => (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => cases[e["_tag"]](e)), orElse); }); /** @internal */ -const catchReason = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (self, errorTag, reasonTag, f, orElse) => catchIf(self, e => (0,_Predicate_js__rspack_import_11/* .isTagged */.$J)(e, errorTag) && (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(e, "reason"), e => { +const catchReason = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (self, errorTag, reasonTag, f, orElse) => catchIf(self, e => (0,_Predicate_js__rspack_import_10/* .isTagged */.$J)(e, errorTag) && (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(e, "reason") && (orElse !== undefined || (0,_Predicate_js__rspack_import_10/* .isTagged */.$J)(e.reason, reasonTag)), e => { const reason = e.reason; - if ((0,_Predicate_js__rspack_import_11/* .isTagged */.$J)(reason, reasonTag)) return f(reason, e); + if ((0,_Predicate_js__rspack_import_10/* .isTagged */.$J)(reason, reasonTag)) return f(reason, e); return orElse ? (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => orElse(reason, e)) : fail(e); })); /** @internal */ const catchReasons = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (self, errorTag, cases, orElse) => { let keys; - return catchIf(self, e => (0,_Predicate_js__rspack_import_11/* .isTagged */.$J)(e, errorTag) && (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(e, "reason") && (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(e.reason, "_tag") && (0,_Predicate_js__rspack_import_11/* .isString */.Kg)(e.reason._tag), e => { + return catchIf(self, e => (0,_Predicate_js__rspack_import_10/* .isTagged */.$J)(e, errorTag) && (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(e, "reason") && (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(e.reason, "_tag") && (0,_Predicate_js__rspack_import_10/* .isString */.Kg)(e.reason._tag) && (orElse !== undefined || (keys ??= Object.keys(cases)).includes(e.reason._tag)), e => { const reason = e.reason; keys ??= Object.keys(cases); if (keys.includes(reason._tag)) { @@ -94316,14 +94836,14 @@ const catchReasons = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY }); /** @internal */ const unwrapReason = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, errorTag) => catchFilter(self, e => { - if ((0,_Predicate_js__rspack_import_11/* .isTagged */.$J)(e, errorTag) && (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(e, "reason")) { + if ((0,_Predicate_js__rspack_import_10/* .isTagged */.$J)(e, errorTag) && (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(e, "reason")) { return _Result_js__rspack_import_3/* .succeed */.Py(e.reason); } return _Result_js__rspack_import_3/* .fail */.fJ(e); }, fail)); /** @internal */ const mapError = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => catch_(self, error => failSync(() => f(error)))); -/* @internal */ +/** @internal */ const mapBoth = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, options) => matchEffect(self, { onFailure: e => failSync(() => options.onFailure(e)), onSuccess: a => sync(() => options.onSuccess(a)) @@ -94331,7 +94851,7 @@ const mapBoth = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, /** @internal */ const orDie = self => catch_(self, die); /** @internal */ -const orElseSucceed = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => catch_(self, _ => sync(f))); +const orElseSucceed = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => catch_(self, error => sync(() => f(error)))); /** @internal */ const firstSuccessOf = effects => suspend(() => { const iterator = effects[Symbol.iterator](); @@ -94393,20 +94913,17 @@ const result = self => matchEager(self, { // pattern matching // ---------------------------------------------------------------------------- /** @internal */ -const matchCauseEffect = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, options) => { - const primitive = Object.create(OnSuccessAndFailureProto); - primitive[_core_js__rspack_import_0/* .args */.a2] = self; - primitive[_core_js__rspack_import_0/* .contA */.ee] = options.onSuccess.length !== 1 ? a => options.onSuccess(a) : options.onSuccess; - primitive[_core_js__rspack_import_0/* .contE */.Sc] = options.onFailure.length !== 1 ? cause => options.onFailure(cause) : options.onFailure; - return primitive; -}); +const matchCauseEffect = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, options) => new OnSuccessAndFailureImpl(self, options.onSuccess.length !== 1 ? a => options.onSuccess(a) : options.onSuccess, options.onFailure.length !== 1 ? cause => options.onFailure(cause) : options.onFailure)); const OnSuccessAndFailureProto = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitiveProto */.yj)({ op: "OnSuccessAndFailure", - [_core_js__rspack_import_0/* .evaluate */._3](fiber) { - fiber._stack.push(this); - return this[_core_js__rspack_import_0/* .args */.a2]; - } + [_core_js__rspack_import_0/* .evaluate */._3]: evaluateCont }); +const OnSuccessAndFailureImpl = function (self, onSuccess, onFailure) { + this[_core_js__rspack_import_0/* .args */.a2] = self; + this[_core_js__rspack_import_0/* .contA */.ee] = onSuccess; + this[_core_js__rspack_import_0/* .contE */.Sc] = onFailure; +}; +OnSuccessAndFailureImpl.prototype = OnSuccessAndFailureProto; /** @internal */ const matchCause = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, options) => matchCauseEffect(self, { onFailure: cause => sync(() => options.onFailure(cause)), @@ -94477,12 +94994,17 @@ const isSuccess = /*#__PURE__*/matchEager({ /** @internal */ const delay = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, duration) => andThen(sleep(duration), self)); /** @internal */ -const timeoutOrElse = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, options) => raceFirst(self, flatMap(sleep(options.duration), options.orElse))); +const timeoutOrElse = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, options) => flatMap(timeoutOption(self, options.duration), option => _Option_js__rspack_import_17.isNone(option) ? options.orElse() : succeed(option.value))); /** @internal */ -const timeout = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, duration) => timeoutOrElse(self, { - duration, - orElse: () => fail(new TimeoutError()) -})); +const timeoutErrorFromDuration = duration => new TimeoutError(`Operation timed out after '${_Duration_js__rspack_import_20/* .format */.GP(duration)}'`); +/** @internal */ +const timeout = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, duration) => { + const decoded = _Duration_js__rspack_import_20/* .fromInputUnsafe */.bN(duration); + return timeoutOrElse(self, { + duration: decoded, + orElse: () => fail(timeoutErrorFromDuration(decoded)) + }); +}); /** @internal */ const timeoutOption = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, duration) => raceFirst(asSome(self), as(sleep(duration), _Option_js__rspack_import_17.none()))); /** @internal */ @@ -94646,30 +95168,40 @@ const acquireRelease = (acquire, release, options) => contextWith(context => uni /** @internal */ const addFinalizer = finalizer => flatMap(scope, scope => contextWith(context => scopeAddFinalizerExit(scope, exit => provideContext(finalizer(exit), context)))); /** @internal */ -const onExitPrimitive = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitive */.Uf)({ - op: "OnExit", - single: false, - [_core_js__rspack_import_0/* .evaluate */._3](fiber) { - fiber._stack.push(this); - return this[_core_js__rspack_import_0/* .args */.a2][0]; - }, - [_core_js__rspack_import_0/* .contAll */.u4](fiber) { - if (fiber.interruptible && this[_core_js__rspack_import_0/* .args */.a2][2] !== true) { - fiber._stack.push(setInterruptibleTrue); - fiber.interruptible = false; +const onExitPrimitive = /*#__PURE__*/function () { + const Proto = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitiveProto */.yj)({ + op: "OnExit", + [_core_js__rspack_import_0/* .evaluate */._3](fiber) { + fiber._stack.push(this); + return this.effect; + }, + [_core_js__rspack_import_0/* .contAll */.u4](fiber) { + if (fiber.interruptible && this.interruptible !== true) { + fiber._stack.push(setInterruptibleTrue); + fiber.interruptible = false; + } + }, + [_core_js__rspack_import_0/* .contA */.ee](value, _, exit) { + exit ??= (0,_core_js__rspack_import_0/* .exitSucceed */.xt)(value); + const eff = this.onExit(exit); + return eff ? flatMap(eff, _ => exit) : exit; + }, + [_core_js__rspack_import_0/* .contE */.Sc](cause, _, exit) { + exit ??= (0,_core_js__rspack_import_0/* .exitFailCause */.cb)(cause); + const eff = this.onExit(exit); + return eff ? flatMap(combineFinalizerCause(exit, eff), _ => exit) : exit; } - }, - [_core_js__rspack_import_0/* .contA */.ee](value, _, exit) { - exit ??= (0,_core_js__rspack_import_0/* .exitSucceed */.xt)(value); - const eff = this[_core_js__rspack_import_0/* .args */.a2][1](exit); - return eff ? flatMap(eff, _ => exit) : exit; - }, - [_core_js__rspack_import_0/* .contE */.Sc](cause, _, exit) { - exit ??= (0,_core_js__rspack_import_0/* .exitFailCause */.cb)(cause); - const eff = this[_core_js__rspack_import_0/* .args */.a2][1](exit); - return eff ? flatMap(combineFinalizerCause(exit, eff), _ => exit) : exit; - } -}); + }); + const OnExitImpl = function (effect, onExit, interruptible) { + this.effect = effect; + this.onExit = onExit; + this.interruptible = interruptible; + }; + OnExitImpl.prototype = Proto; + return function (effect, onExit, interruptible) { + return new OnExitImpl(effect, onExit, interruptible); + }; +}(); /** @internal */ const onExit = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, onExitPrimitive); /** @internal */ @@ -94706,16 +95238,15 @@ const onErrorFilter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.X /** @internal */ const onInterrupt = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, finalizer) => onErrorFilter(causeFilterInterruptors, finalizer)(self)); /** @internal */ -const acquireUseRelease = (acquire, use, release) => uninterruptibleMask(restore => flatMap(acquire, a => onExitPrimitive(restore(use(a)), exit => release(a, exit), true))); +const acquireUseRelease = (acquire, use, release) => uninterruptibleMask(restore => flatMap(acquire, a => onExitPrimitive(suspend(() => restore(use(a))), exit => release(a, exit), true))); /** @internal */ -const acquireDisposable = acquire => acquireRelease(acquire, resource => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(resource, Symbol.asyncDispose) ? promise(() => resource[Symbol.asyncDispose]()) : sync(() => resource[Symbol.dispose]())); +const acquireDisposable = acquire => acquireRelease(acquire, resource => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(resource, Symbol.asyncDispose) ? promise(() => resource[Symbol.asyncDispose]()) : sync(() => resource[Symbol.dispose]())); // ---------------------------------------------------------------------------- // Caching // ---------------------------------------------------------------------------- /** @internal */ const cachedInvalidateWithTTL = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, ttl) => sync(() => { - const ttlMillis = _Duration_js__rspack_import_20/* .toMillis */.kE(_Duration_js__rspack_import_20/* .fromInputUnsafe */.bN(ttl)); - const isFinite = Number.isFinite(ttlMillis); + const ttlMillis = typeof ttl === "function" ? exit => _Duration_js__rspack_import_20/* .toMillis */.kE(_Duration_js__rspack_import_20/* .fromInputUnsafe */.bN(ttl(exit))) : (0,_Function_js__rspack_import_6/* .constant */.dY)(_Duration_js__rspack_import_20/* .toMillis */.kE(_Duration_js__rspack_import_20/* .fromInputUnsafe */.bN(ttl))); const latch = makeLatchUnsafe(false); let expiresAt = 0; let running = false; @@ -94723,16 +95254,25 @@ const cachedInvalidateWithTTL = /*#__PURE__*/(0,_Function_js__rspack_import_6/* const wait = flatMap(latch.await, () => exit); return [(0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => { const clock = fiber.getRef(ClockRef); - const now = isFinite ? clock.currentTimeMillisUnsafe() : 0; + const now = expiresAt === Infinity ? 0 : clock.currentTimeMillisUnsafe(); if (running || now < expiresAt) return exit ?? wait; running = true; latch.closeUnsafe(); exit = undefined; return onExit(self, exit_ => sync(() => { - running = false; - expiresAt = clock.currentTimeMillisUnsafe() + ttlMillis; - exit = exit_; - latch.openUnsafe(); + try { + const duration = ttlMillis(exit_); + expiresAt = clock.currentTimeMillisUnsafe() + duration; + exit = exit_; + } catch (error) { + const cause = (0,_core_js__rspack_import_0/* .causeDie */.Iu)(error); + // Publish the same combined cause that onExit returns to the owner. + exit = (0,_core_js__rspack_import_0/* .exitFailCause */.cb)(exitIsFailure(exit_) ? causeCombine(exit_.cause, cause) : cause); + throw error; + } finally { + running = false; + latch.openUnsafe(); + } })); }), sync(() => { expiresAt = 0; @@ -94743,7 +95283,21 @@ const cachedInvalidateWithTTL = /*#__PURE__*/(0,_Function_js__rspack_import_6/* /** @internal */ const cachedWithTTL = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, timeToLive) => map(cachedInvalidateWithTTL(self, timeToLive), tuple => tuple[0])); /** @internal */ -const cached = self => cachedWithTTL(self, _Duration_js__rspack_import_20/* .infinity */.Tn); +const cached = self => sync(() => { + const latch = makeLatchUnsafe(false); + let started = false; + let exit; + const wait = flatMap(latch.await, () => exit); + return suspend(() => { + if (exit !== undefined) return exit; + if (started) return wait; + started = true; + return onExit(self, result => sync(() => { + exit = result; + latch.openUnsafe(); + })); + }); +}); // ---------------------------------------------------------------------------- // interruption // ---------------------------------------------------------------------------- @@ -94772,6 +95326,30 @@ const setFiberInterruptible = fiber => { fiber._stack.push(setInterruptibleFalse); if (fiber._interruptedCause) return failCause(fiber._interruptedCause); }; +/** + * Makes the current fiber uninterruptible for the returned effect without an + * extra primitive. Call only within `withFiber`. + * + * @internal + */ +const fiberEnterUninterruptibleUnsafe = fiber => { + const impl = fiber; + if (!impl.interruptible) return; + impl.interruptible = false; + impl._stack.push(setInterruptibleTrue); +}; +/** + * Makes the current fiber interruptible for the returned effect without an + * extra primitive. Call only within `withFiber` and return any pending + * interruption it produces. + * + * @internal + */ +const fiberEnterInterruptibleUnsafe = fiber => { + const impl = fiber; + if (impl.interruptible) return undefined; + return setFiberInterruptible(impl); +}; /** @internal */ const interruptible = self => (0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => { if (fiber.interruptible) return self; @@ -94798,7 +95376,7 @@ const abortSignal = /*#__PURE__*/map(/*#__PURE__*/acquireRelease(/*#__PURE__*/sy // ======================================================================== /** @internal */ const all = (arg, options) => { - if ((0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(arg)) { + if ((0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(arg)) { return options?.mode === "result" ? forEach(arg, result, options) : forEach(arg, _Function_js__rspack_import_6/* .identity */.D_, options); } else if (options?.discard) { return options.mode === "result" ? forEach(Object.values(arg), result, options) : forEach(Object.values(arg), _Function_js__rspack_import_6/* .identity */.D_, options); @@ -94814,10 +95392,10 @@ const all = (arg, options) => { }); }; /** @internal */ -const partition = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, f, options) => map(forEach(elements, (a, i) => result(f(a, i)), options), results => _Array_js__rspack_import_7/* .partition */.jB(results, _Function_js__rspack_import_6/* .identity */.D_))); +const partition = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, f, options) => map(forEach(elements, (a, i) => result(f(a, i)), options), results => _Array_js__rspack_import_16/* .partition */.jB(results, _Function_js__rspack_import_6/* .identity */.D_))); /** @internal */ const reduce = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(3, (elements, zero, f) => { - const arr = _Array_js__rspack_import_7/* .fromIterable */.Ts(elements); + const arr = _Array_js__rspack_import_16/* .fromIterable */.Ts(elements); if (arr.length === 0) return sync(zero); return suspend(() => { let index = 0; @@ -94833,16 +95411,16 @@ const reduce = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(3, ( }); }); /** @internal */ -const validate = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, f, options) => flatMap(partition(elements, f, { +const validate = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, f, options) => flatMap(partition(elements, f, { concurrency: options?.concurrency }), ([excluded, satisfying]) => { - if (_Array_js__rspack_import_7/* .isArrayNonEmpty */.CZ(excluded)) { + if (_Array_js__rspack_import_16/* .isArrayNonEmpty */.CZ(excluded)) { return fail(excluded); } return options?.discard ? void_ : succeed(satisfying); })); /** @internal */ -const findFirst = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, predicate) => suspend(() => { +const findFirst = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, predicate) => suspend(() => { const iterator = elements[Symbol.iterator](); const next = iterator.next(); if (!next.done) { @@ -94861,7 +95439,7 @@ const findFirstLoop = (iterator, index, predicate, value) => flatMap(predicate(v return succeed(_Option_js__rspack_import_17.none()); }); /** @internal */ -const findFirstFilter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, filter) => suspend(() => { +const findFirstFilter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, filter) => suspend(() => { const iterator = elements[Symbol.iterator](); const next = iterator.next(); if (!next.done) { @@ -94900,12 +95478,11 @@ const whileLoop = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitive */. }); /** @internal */ const forEach = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => typeof args[1] === "function", (iterable, f, options) => suspend(() => { - const concurrencyOption = options?.concurrency ?? 1; - const concurrency = concurrencyOption === "unbounded" ? Number.POSITIVE_INFINITY : Math.max(1, concurrencyOption); + const concurrency = resolveConcurrency(options?.concurrency); if (concurrency === 1) { return forEachSequential(iterable, f, options); } - const items = _Array_js__rspack_import_7/* .fromIterable */.Ts(iterable); + const items = _Array_js__rspack_import_16/* .fromIterable */.Ts(iterable); let length = items.length; if (length === 0) { return options?.discard ? void_ : succeed([]); @@ -94938,10 +95515,13 @@ const forEachSequential = (iterable, f, options) => suspend(() => { } }), out); }); -const iterateEagerImpl = options => { +/** @internal */ +const resolveConcurrency = concurrency => concurrency === "unbounded" ? Number.POSITIVE_INFINITY : Math.max(1, concurrency ?? 1); +/** @internal */ +const iterateEager = () => options => { const onItem = options.onItem; const step = options.step; - const runSequential = (state, items, index, end) => { + const runSequential = (state, items, index = 0, end = items.length) => { for (; index < end; index++) { const item = items[index]; const effect = onItem(state, item, index); @@ -94952,14 +95532,15 @@ const iterateEagerImpl = options => { if (terminal) return terminal._tag === "Failure" ? terminal : undefined; } }; + return runSequential; +}; +const iterateConcurrentImpl = options => { + const onItem = options.onItem; + const step = options.step; return (state, items, opts) => { let index = 0; - const end = opts?.end ?? items.length; - const concurrency = opts?.concurrency ?? 1; - if (concurrency === 1) { - return runSequential(state, items, 0, end); - } - const orderedStep = opts?.orderedStep === true; + const end = opts.end ?? items.length; + const concurrency = opts.concurrency; let done = false; let parentFiber; let fibers; @@ -94967,8 +95548,6 @@ const iterateEagerImpl = options => { let interrupted = false; let terminal; let effect; - let nextIndex = index; - const exits = orderedStep ? new Array(end) : undefined; const failDefect = error => { const defect = (0,_core_js__rspack_import_0/* .exitDie */.V2)(error); terminal = defect; @@ -94976,19 +95555,6 @@ const iterateEagerImpl = options => { interrupted = true; return fibers && fibers.size > 0 ? flatMap(uninterruptible(fiberInterruptAll(Array.from(fibers))), () => defect) : defect; }; - const runStep = (item, exit, currentIndex) => { - if (!orderedStep) return step(state, item, exit, currentIndex); - if (terminal) return terminal; - exits[currentIndex] = exit; - while (nextIndex < end) { - const nextExit = exits[nextIndex]; - if (nextExit === undefined) return; - exits[nextIndex] = undefined; - const index = nextIndex++; - const result = step(state, items[index], nextExit, index); - if (result) return result; - } - }; const go = () => { let paused = false; for (; !terminal && index < end; index++) { @@ -94996,7 +95562,7 @@ const iterateEagerImpl = options => { const eff = effect ?? onItem(state, item, index); // fast case (already an exit) if (effectIsExit(eff)) { - terminal = runStep(item, eff, index); + terminal = step(state, item, eff, index); if (terminal) break; // We have an effect, so enter "async" mode } else if (!parentFiber) { @@ -95024,7 +95590,7 @@ const iterateEagerImpl = options => { effect = undefined; const fiber = forkUnsafe(parentFiber, eff, true, true, "inherit"); if (fiber._exit) { - terminal = runStep(item, fiber._exit, index); + terminal = step(state, item, fiber._exit, index); if (terminal) break; continue; } @@ -95046,7 +95612,7 @@ const iterateEagerImpl = options => { } } } else { - const result = runStep(item, exit, currentIndex); + const result = step(state, item, exit, currentIndex); if (result) { terminal = result._tag === "Failure" ? (0,_core_js__rspack_import_0/* .exitFailCause */.cb)((0,_core_js__rspack_import_0/* .causeFromReasons */.b5)(result.cause.reasons.slice())) : result; go(); @@ -95091,8 +95657,8 @@ const iterateEagerImpl = options => { }; }; /** @internal */ -const iterateEager = () => iterateEagerImpl; -const forEachConcurrent = /*#__PURE__*/iterateEagerImpl({ +const iterateConcurrent = () => options => iterateConcurrentImpl(options); +const forEachConcurrent = /*#__PURE__*/iterateConcurrentImpl({ onItem(state, item, index) { return state.f(item, index); }, @@ -95102,17 +95668,17 @@ const forEachConcurrent = /*#__PURE__*/iterateEagerImpl({ } } }); -/* @internal */ +/** @internal */ const filterOrElse = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(3, (self, predicate, orElse) => flatMap(self, a => predicate(a) ? succeed(a) : orElse(a))); /** @internal */ const filterMapOrElse = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(3, (self, filter, orElse) => flatMap(self, a => { const result = filter(a); return _Result_js__rspack_import_3/* .isFailure */.N6(result) ? orElse(result.failure) : succeed(result.success); })); -/* @internal */ +/** @internal */ const filterMapOrFail = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (self, filter, orFailWith) => filterMapOrElse(self, filter, orFailWith ? x => fail(orFailWith(x)) : () => fail(new _core_js__rspack_import_0/* .NoSuchElementError */.Xm()))); /** @internal */ -const filter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, predicate, options) => suspend(() => { +const filter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, predicate, options) => suspend(() => { const out = []; return as(forEach(elements, (a, i) => { const result = predicate(a, i); @@ -95131,7 +95697,7 @@ const filter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args }), out); })); /** @internal */ -const filterMap = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, filter) => suspend(() => { +const filterMap = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, filter) => suspend(() => { const out = []; for (const a of elements) { const result = filter(a); @@ -95142,7 +95708,7 @@ const filterMap = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(a return succeed(out); })); /** @internal */ -const filterMapEffect = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, filter, options) => suspend(() => { +const filterMapEffect = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, filter, options) => suspend(() => { const out = []; return as(forEach(elements, a => map(filter(a), result => { if (_Result_js__rspack_import_3/* .isSuccess */.oJ(result)) { @@ -95186,7 +95752,7 @@ const forkUnsafe = (parent, effect, immediate = false, daemon = false, uninterru } if (!daemon && !child._exit) { parentRuntime.children().add(child); - child.addObserver(() => parentRuntime._children.delete(child)); + child._parent = parentRuntime; } return child; }; @@ -95417,13 +95983,13 @@ const makeLatch = open => sync(() => makeLatchUnsafe(open)); // Tracer // ---------------------------------------------------------------------------- /** @internal */ -const tracer = /*#__PURE__*/(0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => succeed(fiber.getRef(_Tracer_js__rspack_import_14/* .Tracer */.sh))); +const tracer = /*#__PURE__*/(0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => succeed(fiber.getRef(_Tracer_js__rspack_import_12/* .Tracer */.sh))); /** @internal */ -const withTracer = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (effect, tracer) => provideService(effect, _Tracer_js__rspack_import_14/* .Tracer */.sh, tracer)); +const withTracer = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (effect, tracer) => provideService(effect, _Tracer_js__rspack_import_12/* .Tracer */.sh, tracer)); /** @internal */ -const withTracerEnabled = /*#__PURE__*/provideService(_references_js__rspack_import_15/* .TracerEnabled */.rf); +const withTracerEnabled = /*#__PURE__*/provideService(_references_js__rspack_import_14/* .TracerEnabled */.rf); /** @internal */ -const withTracerTiming = /*#__PURE__*/provideService(_references_js__rspack_import_15/* .TracerTimingEnabled */.nU); +const withTracerTiming = /*#__PURE__*/provideService(_references_js__rspack_import_14/* .TracerTimingEnabled */.nU); const bigint0 = /*#__PURE__*/BigInt(0); const NoopSpanProto = { _tag: "Span", @@ -95448,36 +96014,36 @@ const NoopSpanProto = { const noopSpan = options => Object.assign(Object.create(NoopSpanProto), options); const filterDisablePropagation = span => { if (!span) return _Option_js__rspack_import_17.none(); - return _Context_js__rspack_import_5/* .get */.Jt(span.annotations, _Tracer_js__rspack_import_14/* .DisablePropagation */.DW) ? span._tag === "Span" ? filterDisablePropagation(_Option_js__rspack_import_17.getOrUndefined(span.parent)) : _Option_js__rspack_import_17.none() : _Option_js__rspack_import_17.some(span); + return _Context_js__rspack_import_5/* .get */.Jt(span.annotations, _Tracer_js__rspack_import_12/* .DisablePropagation */.DW) ? span._tag === "Span" ? filterDisablePropagation(_Option_js__rspack_import_17.getOrUndefined(span.parent)) : _Option_js__rspack_import_17.none() : _Option_js__rspack_import_17.some(span); }; /** @internal */ const makeSpanUnsafe = (fiber, name, options) => { - const disablePropagation = !fiber.getRef(_references_js__rspack_import_15/* .TracerEnabled */.rf) || options?.annotations && _Context_js__rspack_import_5/* .get */.Jt(options.annotations, _Tracer_js__rspack_import_14/* .DisablePropagation */.DW); - const parent = options?.parent !== undefined ? _Option_js__rspack_import_17.some(options.parent) : options?.root ? _Option_js__rspack_import_17.none() : filterDisablePropagation(fiber.currentSpan); + const disablePropagation = !fiber.getRef(_references_js__rspack_import_14/* .TracerEnabled */.rf) || options?.annotations && _Context_js__rspack_import_5/* .get */.Jt(options.annotations, _Tracer_js__rspack_import_12/* .DisablePropagation */.DW); + const parent = options?.parent !== undefined ? _Option_js__rspack_import_17.some(options.parent) : options?.root ? _Option_js__rspack_import_17.none() : filterDisablePropagation(fiber.cache.span); let span; if (disablePropagation) { span = noopSpan({ name, parent, - annotations: _Context_js__rspack_import_5/* .add */.WQ(options?.annotations ?? _Context_js__rspack_import_5/* .empty */.Ie(), _Tracer_js__rspack_import_14/* .DisablePropagation */.DW, true) + annotations: _Context_js__rspack_import_5/* .add */.WQ(options?.annotations ?? _Context_js__rspack_import_5/* .empty */.Ie(), _Tracer_js__rspack_import_12/* .DisablePropagation */.DW, true) }); } else { - const tracer = fiber.getRef(_Tracer_js__rspack_import_14/* .Tracer */.sh); + const tracer = fiber.getRef(_Tracer_js__rspack_import_12/* .Tracer */.sh); const clock = fiber.getRef(ClockRef); - const timingEnabled = fiber.getRef(_references_js__rspack_import_15/* .TracerTimingEnabled */.nU); - const annotationsFromEnv = fiber.getRef(_references_js__rspack_import_15/* .TracerSpanAnnotations */.ce); - const linksFromEnv = fiber.getRef(_references_js__rspack_import_15/* .TracerSpanLinks */.ls); - const level = options?.level ?? fiber.getRef(_Tracer_js__rspack_import_14/* .CurrentTraceLevel */.pX); + const timingEnabled = fiber.getRef(_references_js__rspack_import_14/* .TracerTimingEnabled */.nU); + const annotationsFromEnv = fiber.getRef(_references_js__rspack_import_14/* .TracerSpanAnnotations */.ce); + const linksFromEnv = fiber.getRef(_references_js__rspack_import_14/* .TracerSpanLinks */.ls); + const level = options?.level ?? fiber.getRef(_Tracer_js__rspack_import_12/* .CurrentTraceLevel */.pX); const links = options?.links !== undefined ? [...linksFromEnv, ...options.links] : linksFromEnv.length === 0 ? [] : linksFromEnv.slice(); span = tracer.span({ name, parent, annotations: options?.annotations ?? _Context_js__rspack_import_5/* .empty */.Ie(), links, - startTime: timingEnabled ? clock.currentTimeNanosUnsafe() : BigInt(0), + startTime: timingEnabled ? clock.currentTimeNanosUnsafe() : bigint0, kind: options?.kind ?? "internal", root: options?.root ?? _Option_js__rspack_import_17.isNone(parent), - sampled: options?.sampled ?? (_Option_js__rspack_import_17.isSome(parent) && parent.value.sampled === false ? false : !isLogLevelGreaterThan(fiber.getRef(_Tracer_js__rspack_import_14/* .MinimumTraceLevel */.EW), level)) + sampled: options?.sampled ?? (_Option_js__rspack_import_17.isSome(parent) && parent.value.sampled === false ? false : !isLogLevelGreaterThan(fiber.getRef(_Tracer_js__rspack_import_12/* .MinimumTraceLevel */.EW), level)) }); for (const key in annotationsFromEnv) { span.attribute(key, annotationsFromEnv[key]); @@ -95497,7 +96063,7 @@ const makeSpanScoped = (name, options) => uninterruptible((0,_core_js__rspack_im const scope = _Context_js__rspack_import_5/* .getUnsafe */.fp(fiber.context, scopeTag); const span = makeSpanUnsafe(fiber, name, options ?? {}); const clock = fiber.getRef(ClockRef); - const timingEnabled = fiber.getRef(_references_js__rspack_import_15/* .TracerTimingEnabled */.nU); + const timingEnabled = fiber.getRef(_references_js__rspack_import_14/* .TracerTimingEnabled */.nU); return as(scopeAddFinalizerExit(scope, exit => endSpan(span, exit, clock, timingEnabled)), span); })); /** @internal */ @@ -95513,16 +96079,16 @@ const withSpanScoped = function () { }; const provideSpanStackFrame = (name, stack) => { stack = typeof stack === "function" ? stack : _Function_js__rspack_import_6/* .constUndefined */.MN; - return updateService(_references_js__rspack_import_15/* .CurrentStackFrame */.vA, parent => ({ + return updateService(_references_js__rspack_import_14/* .CurrentStackFrame */.vA, parent => ({ name, stack, parent })); }; /** @internal */ -const spanAnnotations = _references_js__rspack_import_15/* .TracerSpanAnnotations */.ce; +const spanAnnotations = _references_js__rspack_import_14/* .TracerSpanAnnotations */.ce; /** @internal */ -const spanLinks = _references_js__rspack_import_15/* .TracerSpanLinks */.ls; +const spanLinks = _references_js__rspack_import_14/* .TracerSpanLinks */.ls; /** @internal */ const linkSpans = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (self, span, attributes = {}) => { const spans = Array.isArray(span) ? span : [span]; @@ -95530,7 +96096,7 @@ const linkSpans = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(a span, attributes })); - return updateService(self, _references_js__rspack_import_15/* .TracerSpanLinks */.ls, current => [...current, ...links]); + return updateService(self, _references_js__rspack_import_14/* .TracerSpanLinks */.ls, current => [...current, ...links]); }); /** @internal */ const endSpan = (span, exit, clock, timingEnabled) => sync(() => { @@ -95544,11 +96110,11 @@ const useSpan = (name, ...args) => { return (0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => { const span = makeSpanUnsafe(fiber, name, options); const clock = fiber.getRef(ClockRef); - const timingEnabled = fiber.getRef(_references_js__rspack_import_15/* .TracerTimingEnabled */.nU); - return onExit((0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => evaluate(span)), exit => endSpan(span, exit, clock, timingEnabled)); + const timingEnabled = fiber.getRef(_references_js__rspack_import_14/* .TracerTimingEnabled */.nU); + return onExit(suspend(() => (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => evaluate(span))), exit => endSpan(span, exit, clock, timingEnabled)); }); }; -const provideParentSpan = /*#__PURE__*/provideService(_Tracer_js__rspack_import_14/* .ParentSpan */.Tv); +const provideParentSpan = /*#__PURE__*/provideService(_Tracer_js__rspack_import_12/* .ParentSpan */.Tv); /** @internal */ const withParentSpan = function () { const dataFirst = (0,_core_js__rspack_import_0/* .isEffect */.yw)(arguments[0]); @@ -95578,7 +96144,7 @@ const withSpan = function () { return (self, ...args) => useSpan(name, fnArg ? fnArg(...args) : options, span => withParentSpan(self, span, traceOptions)); }; /** @internal */ -const annotateSpans = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (effect, ...args) => updateService(effect, _references_js__rspack_import_15/* .TracerSpanAnnotations */.ce, annotations => { +const annotateSpans = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (effect, ...args) => updateService(effect, _references_js__rspack_import_14/* .TracerSpanAnnotations */.ce, annotations => { const newAnnotations = args.length === 1 ? { ...annotations, ...args[0] @@ -95612,7 +96178,7 @@ const currentSpan = /*#__PURE__*/(0,_core_js__rspack_import_0/* .withFiber */.R6 return span ? succeed(span) : fail(new _core_js__rspack_import_0/* .NoSuchElementError */.Xm()); }); /** @internal */ -const currentParentSpan = /*#__PURE__*/serviceOptional(_Tracer_js__rspack_import_14/* .ParentSpan */.Tv); +const currentParentSpan = /*#__PURE__*/serviceOptional(_Tracer_js__rspack_import_12/* .ParentSpan */.Tv); // ---------------------------------------------------------------------------- // Clock // ---------------------------------------------------------------------------- @@ -95698,7 +96264,7 @@ const monotonicTimeNanos = /*#__PURE__*/clockWith(clock => clock.monotonicTimeNa /** @internal */ const TimeoutErrorTypeId = "~effect/Cause/TimeoutError"; /** @internal */ -const isTimeoutError = u => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(u, TimeoutErrorTypeId); +const isTimeoutError = u => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(u, TimeoutErrorTypeId); /** @internal */ class TimeoutError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .TaggedError */.rN)("TimeoutError") { [TimeoutErrorTypeId] = TimeoutErrorTypeId; @@ -95711,7 +96277,7 @@ class TimeoutError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .TaggedEr /** @internal */ const IllegalArgumentErrorTypeId = "~effect/Cause/IllegalArgumentError"; /** @internal */ -const isIllegalArgumentError = u => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(u, IllegalArgumentErrorTypeId); +const isIllegalArgumentError = u => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(u, IllegalArgumentErrorTypeId); /** @internal */ class IllegalArgumentError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .TaggedError */.rN)("IllegalArgumentError") { [IllegalArgumentErrorTypeId] = IllegalArgumentErrorTypeId; @@ -95724,7 +96290,7 @@ class IllegalArgumentError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* . /** @internal */ const ExceededCapacityErrorTypeId = "~effect/Cause/ExceededCapacityError"; /** @internal */ -const isExceededCapacityError = u => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(u, ExceededCapacityErrorTypeId); +const isExceededCapacityError = u => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(u, ExceededCapacityErrorTypeId); /** @internal */ class ExceededCapacityError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .TaggedError */.rN)("ExceededCapacityError") { [ExceededCapacityErrorTypeId] = ExceededCapacityErrorTypeId; @@ -95737,7 +96303,7 @@ class ExceededCapacityError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* /** @internal */ const AsyncFiberErrorTypeId = "~effect/Cause/AsyncFiberError"; /** @internal */ -const isAsyncFiberError = u => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(u, AsyncFiberErrorTypeId); +const isAsyncFiberError = u => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(u, AsyncFiberErrorTypeId); /** @internal */ class AsyncFiberError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .TaggedError */.rN)("AsyncFiberError") { [AsyncFiberErrorTypeId] = AsyncFiberErrorTypeId; @@ -95751,7 +96317,7 @@ class AsyncFiberError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .Tagge /** @internal */ const UnknownErrorTypeId = "~effect/Cause/UnknownError"; /** @internal */ -const isUnknownError = u => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(u, UnknownErrorTypeId); +const isUnknownError = u => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(u, UnknownErrorTypeId); /** @internal */ class UnknownError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .TaggedError */.rN)("UnknownError") { [UnknownErrorTypeId] = UnknownErrorTypeId; @@ -95766,7 +96332,7 @@ class UnknownError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .TaggedEr // Console // ---------------------------------------------------------------------------- /** @internal */ -const ConsoleRef = /*#__PURE__*/_Context_js__rspack_import_5/* .Reference */.Or("effect/Console/CurrentConsole", { +const ConsoleRef = /*#__PURE__*/_Context_js__rspack_import_5/* .Reference */.Or("effect/Console", { defaultValue: () => globalThis.console }); // ---------------------------------------------------------------------------- @@ -95801,7 +96367,7 @@ const isLogLevelGreaterThan = /*#__PURE__*/_Order_js__rspack_import_24/* .isGrea // Logger // ---------------------------------------------------------------------------- /** @internal */ -const CurrentLoggers = /*#__PURE__*/_Context_js__rspack_import_5/* .Reference */.Or("effect/Loggers/CurrentLoggers", { +const CurrentLoggers = /*#__PURE__*/_Context_js__rspack_import_5/* .Reference */.Or("effect/Logger/CurrentLoggers", { defaultValue: () => new Set([defaultLogger, tracerLogger]) }); /** @internal */ @@ -95812,7 +96378,7 @@ const LogToStderr = /*#__PURE__*/_Context_js__rspack_import_5/* .Reference */.Or const annotateLogsScoped = function () { const entries = typeof arguments[0] === "string" ? [[arguments[0], arguments[1]]] : Object.entries(arguments[0]); return uninterruptible((0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => { - const prev = fiber.getRef(_references_js__rspack_import_15/* .CurrentLogAnnotations */.iL); + const prev = fiber.getRef(_references_js__rspack_import_14/* .CurrentLogAnnotations */.iL); const next = { ...prev }; @@ -95820,22 +96386,22 @@ const annotateLogsScoped = function () { const [key, value] = entries[i]; _record_js__rspack_import_21/* .assignProperty */.x(next, key, value); } - fiber.setContext(_Context_js__rspack_import_5/* .add */.WQ(fiber.context, _references_js__rspack_import_15/* .CurrentLogAnnotations */.iL, next)); + fiber.setContext(_Context_js__rspack_import_5/* .add */.WQ(fiber.context, _references_js__rspack_import_14/* .CurrentLogAnnotations */.iL, next)); return scopeAddFinalizerExit(_Context_js__rspack_import_5/* .getUnsafe */.fp(fiber.context, scopeTag), _ => { - const current = fiber.getRef(_references_js__rspack_import_15/* .CurrentLogAnnotations */.iL); + const current = fiber.getRef(_references_js__rspack_import_14/* .CurrentLogAnnotations */.iL); const next = { ...current }; for (let i = 0; i < entries.length; i++) { const [key, value] = entries[i]; - if (current[key] !== value) continue; + if (current[key] !== value && !Object.is(current[key], value)) continue; if (Object.hasOwn(prev, key)) { _record_js__rspack_import_21/* .assignProperty */.x(next, key, prev[key]); } else { delete next[key]; } } - fiber.setContext(_Context_js__rspack_import_5/* .add */.WQ(fiber.context, _references_js__rspack_import_15/* .CurrentLogAnnotations */.iL, next)); + fiber.setContext(_Context_js__rspack_import_5/* .add */.WQ(fiber.context, _references_js__rspack_import_14/* .CurrentLogAnnotations */.iL, next)); return void_; }); })); @@ -95848,7 +96414,7 @@ const LoggerProto = { _Output: _Function_js__rspack_import_6/* .identity */.D_ }, pipe() { - return (0,_Pipeable_js__rspack_import_12/* .pipeArguments */.tT)(this, arguments); + return (0,_Pipeable_js__rspack_import_11/* .pipeArguments */.tT)(this, arguments); } }; /** @internal */ @@ -95907,8 +96473,8 @@ const logWithLevel = level => (...message) => { cause = _core_js__rspack_import_0/* .causeEmpty */.DH; } return (0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => { - const logLevel = level ?? fiber.currentLogLevel; - if (isLogLevelGreaterThan(fiber.minimumLogLevel, logLevel)) { + const logLevel = level ?? fiber.cache.logLevel; + if (isLogLevelGreaterThan(fiber.cache.minimumLogLevel, logLevel)) { return void_; } const clock = fiber.getRef(ClockRef); @@ -95975,24 +96541,22 @@ const consolePretty = options => { // property accesses, which bundlers must retain as possible side effects const process = globalThis.process; const hasProcessStdout = typeof process?.stdout === "object" && process.stdout !== null; - const processStdoutIsTTY = hasProcessStdout && process.stdout.isTTY === true; - const hasProcessStdoutOrDeno = hasProcessStdout || "Deno" in globalThis; - const mode_ = options?.mode ?? "auto"; - const mode = mode_ === "auto" ? hasProcessStdoutOrDeno ? "tty" : "browser" : mode_; - const isBrowser = mode === "browser"; - const showColors = typeof options?.colors === "boolean" ? options.colors : processStdoutIsTTY || isBrowser; - const formatDate = options?.formatDate ?? defaultDateFormat; - return isBrowser ? prettyLoggerBrowser({ - colors: showColors, - formatDate - }) : prettyLoggerTty({ - colors: showColors, - formatDate - }); + const isDeno = "Deno" in globalThis; + const mode = options?.mode ?? "auto"; + const isTtyLogger = mode === "auto" ? hasProcessStdout || isDeno : mode === "tty"; + return isTtyLogger ? prettyLoggerTty(options) : prettyLoggerBrowser(options); }; +/** @internal */ const prettyLoggerTty = options => { - const processIsBun = globalThis.process?.isBun === true; - const color = options.colors ? withColor : withColorNoop; + const formatDate = options?.formatDate ?? defaultDateFormat; + // evaluated lazily so the module-level bundle stays free of `process` + // property accesses, which bundlers must retain as possible side effects + const process = globalThis.process; + const hasProcessStdout = typeof process?.stdout === "object" && process.stdout !== null; + const processStdoutIsTTY = hasProcessStdout && process.stdout.isTTY === true; + const showColors = typeof options?.colors === "boolean" ? options.colors : processStdoutIsTTY; + const color = showColors ? withColor : withColorNoop; + const processIsBun = process?.isBun === true; return loggerMake(({ cause, date, @@ -96004,7 +96568,7 @@ const prettyLoggerTty = options => { // oxlint-disable-next-line no-console const log = fiber.getRef(LogToStderr) ? console.error : console.log; const message = Array.isArray(message_) ? message_.slice() : [message_]; - let firstLine = color(`[${options.formatDate(date)}]`, colors.white) + ` ${color(logLevel.toUpperCase(), ...logLevelColors[logLevel])}` + ` (#${fiber.id})`; + let firstLine = color(`[${formatDate(date)}]`, colors.white) + ` ${color(logLevel.toUpperCase(), ...logLevelColors[logLevel])}` + ` (#${fiber.id})`; const now = date.getTime(); const spans = fiber.getRef(CurrentLogSpans); for (const span of spans) { @@ -96038,8 +96602,11 @@ const prettyLoggerTty = options => { if (!processIsBun) console.groupEnd(); }); }; +/** @internal */ const prettyLoggerBrowser = options => { - const color = options.colors ? "%c" : ""; + const showColors = options?.colors !== false; + const color = showColors ? "%c" : ""; + const formatDate = options?.formatDate ?? defaultDateFormat; return loggerMake(({ cause, date, @@ -96049,13 +96616,13 @@ const prettyLoggerBrowser = options => { }) => { const console = fiber.getRef(ConsoleRef); const message = Array.isArray(message_) ? message_.slice() : [message_]; - let firstLine = `${color}[${options.formatDate(date)}]`; + let firstLine = `${color}[${formatDate(date)}]`; const firstParams = []; - if (options.colors) { + if (showColors) { firstParams.push("color:gray"); } firstLine += ` ${color}${logLevel.toUpperCase()}${color} (#${fiber.id})`; - if (options.colors) { + if (showColors) { firstParams.push(logLevelStyle[logLevel], ""); } const now = date.getTime(); @@ -96069,7 +96636,7 @@ const prettyLoggerBrowser = options => { const firstMaybeString = structuredMessage(message[0]); if (typeof firstMaybeString === "string") { firstLine += ` ${color}${firstMaybeString}`; - if (options.colors) { + if (showColors) { firstParams.push("color:deepskyblue"); } messageIndex++; @@ -96090,7 +96657,7 @@ const prettyLoggerBrowser = options => { const annotations = fiber.getRef(CurrentLogAnnotations); for (const [key, value] of Object.entries(annotations)) { const redacted = redact(value); - if (options.colors) { + if (showColors) { // oxlint-disable-next-line no-console console.log(`%c${key}:`, "color:gray", redacted); } else { @@ -96115,12 +96682,12 @@ const defaultLogger = /*#__PURE__*/loggerMake(({ message_.push(causePretty(cause)); } const now = date.getTime(); - const spans = fiber.getRef(_references_js__rspack_import_15/* .CurrentLogSpans */.d8); + const spans = fiber.getRef(_references_js__rspack_import_14/* .CurrentLogSpans */.d8); let spanString = ""; for (const span of spans) { spanString += ` ${formatLogSpan(span, now)}`; } - const annotations = fiber.getRef(_references_js__rspack_import_15/* .CurrentLogAnnotations */.iL); + const annotations = fiber.getRef(_references_js__rspack_import_14/* .CurrentLogAnnotations */.iL); if (Object.keys(annotations).length > 0) { message_.push(annotations); } @@ -96137,8 +96704,8 @@ const tracerLogger = /*#__PURE__*/loggerMake(({ message }) => { const clock = fiber.getRef(ClockRef); - const annotations = fiber.getRef(_references_js__rspack_import_15/* .CurrentLogAnnotations */.iL); - const span = fiber.currentSpan; + const annotations = fiber.getRef(_references_js__rspack_import_14/* .CurrentLogAnnotations */.iL); + const span = fiber.cache.span; if (span === undefined || span._tag === "ExternalSpan") return; const attributes = {}; for (const [key, value] of Object.entries(annotations)) { @@ -96169,7 +96736,7 @@ const withErrorReporting = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual }))); /** @internal */ const reportCauseUnsafe = (fiber, cause, defectsOnly) => { - const reporters = fiber.getRef(_references_js__rspack_import_15/* .CurrentErrorReporters */.oQ); + const reporters = fiber.getRef(_references_js__rspack_import_14/* .CurrentErrorReporters */.oQ); if (reporters.size === 0) return; if (defectsOnly && !hasDies(cause)) return; const opts = { @@ -96659,7 +97226,7 @@ __webpack_require__.d(__webpack_exports__, { }, "./node_modules/effect/dist/internal/metric.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) { /** @internal */ -const FiberRuntimeMetricsKey = "effect/observability/Metric/FiberRuntimeMetricsKey"; +const FiberRuntimeMetricsKey = "effect/Metric/FiberRuntimeMetrics"; //# sourceMappingURL=metric.js.map __webpack_require__.d(__webpack_exports__, { }, { @@ -96686,7 +97253,7 @@ __webpack_require__.d(__webpack_exports__, { -const TypeId = "~effect/data/Option"; +const TypeId = "~effect/Option"; const CommonProto = { [TypeId]: { _A: _ => _ @@ -96753,11 +97320,12 @@ const isSome = fa => fa._tag === "Some"; /** @internal */ const none = /*#__PURE__*/Object.create(NoneProto); /** @internal */ -const some = value => { - const a = Object.create(SomeProto); - a.value = value; - return a; +const SomeImpl = function (value) { + this.value = value; }; +SomeImpl.prototype = SomeProto; +/** @internal */ +const some = value => new SomeImpl(value); //# sourceMappingURL=option.js.map __webpack_require__.d(__webpack_exports__, { }, { @@ -96817,6 +97385,7 @@ const CurrentStackFrame = /*#__PURE__*/_Context_js__rspack_import_0/* .Reference }); /** @internal */ const TracerEnabled = /*#__PURE__*/_Context_js__rspack_import_0/* .Reference */.Or("effect/References/TracerEnabled", { + fiberCached: true, defaultValue: _Function_js__rspack_import_1/* .constTrue */.ue }); /** @internal */ @@ -96895,7 +97464,9 @@ const request = /*#__PURE__*/(0,_Function_js__rspack_import_0/* .dual */.XY)(2, const requestUnsafe = (self, options) => { const entry = addEntry(options.resolver, self, options.onExit, { context: options.context, - currentScheduler: _Context_js__rspack_import_3/* .get */.Jt(options.context, _Scheduler_js__rspack_import_4/* .Scheduler */._F) + cache: { + scheduler: _Context_js__rspack_import_3/* .get */.Jt(options.context, _Scheduler_js__rspack_import_4/* .Scheduler */._F) + } }); return () => removeEntryUnsafe(options.resolver, entry); }; @@ -96916,8 +97487,9 @@ const addEntry = (resolver, request, resume, fiber) => { completeUnsafe(effect) { if (completed) return; completed = true; + // Removed entries still notify resolver hooks, but not their cancelled callers. + if (batch && !batch.entrySet.delete(entry)) return; resume(effect); - batch?.entrySet.delete(entry); } }); if (resolver.preCheck !== undefined && !resolver.preCheck(entry)) { @@ -96961,7 +97533,7 @@ const addEntry = (resolver, request, resume, fiber) => { } batchMap.set(key, batch); batch.fiber = _effect_js__rspack_import_1/* .runForkWith */.eJC(fiber.context)(batch.delayEffect, { - scheduler: fiber.currentScheduler + scheduler: fiber.cache.scheduler }); } batch.entrySet.add(entry); @@ -96969,7 +97541,7 @@ const addEntry = (resolver, request, resume, fiber) => { if (batch.resolver.collectWhile(batch.entries)) return entry; batch.fiber.interruptUnsafe(fiber.id); batch.fiber = _effect_js__rspack_import_1/* .runForkWith */.eJC(fiber.context)(runBatch(batch), { - scheduler: fiber.currentScheduler + scheduler: fiber.cache.scheduler }); return entry; }; @@ -96980,12 +97552,16 @@ const removeEntryUnsafe = (resolver, entry) => { const key = resolver.batchKey(entry); const batch = batchMap.get(key); if (!batch) return; - batch.entries.delete(entry); + if (!batch.entries.delete(entry)) return; batch.entrySet.delete(entry); + let fiber; if (batch.entries.size === 0) { batchMap.delete(key); - batch.fiber?.interruptUnsafe(); + fiber = batch.fiber; } + // Delay finalizers may enqueue new requests, so complete the removed entry first. + entry.completeUnsafe(_effect_js__rspack_import_1/* .exitInterrupt */._sz()); + fiber?.interruptUnsafe(); }; const maybeRemoveEntry = (resolver, entry) => _effect_js__rspack_import_1/* .sync */.OH5(() => removeEntryUnsafe(resolver, entry)); function runBatch(batch) { @@ -97021,7 +97597,7 @@ __webpack_require__.d(__webpack_exports__, { -const TypeId = "~effect/data/Result"; +const TypeId = "~effect/Result"; const CommonProto = { [TypeId]: { /* v8 ignore next 2 */ @@ -97080,17 +97656,19 @@ const isFailure = result => result._tag === "Failure"; /** @internal */ const isSuccess = result => result._tag === "Success"; /** @internal */ -const fail = failure => { - const a = Object.create(FailureProto); - a.failure = failure; - return a; +const FailureImpl = function (failure) { + this.failure = failure; }; +FailureImpl.prototype = FailureProto; /** @internal */ -const succeed = success => { - const a = Object.create(SuccessProto); - a.success = success; - return a; +const fail = failure => new FailureImpl(failure); +/** @internal */ +const SuccessImpl = function (success) { + this.success = success; }; +SuccessImpl.prototype = SuccessProto; +/** @internal */ +const succeed = success => new SuccessImpl(success); /** @internal */ const getFailure = self => isSuccess(self) ? _option_js__rspack_import_7/* .none */.dv : _option_js__rspack_import_7/* .some */.zN(self.failure); /** @internal */ @@ -97272,18 +97850,17 @@ const streamVariance = { _E: _Function_js__rspack_import_0/* .identity */.D_, _A: _Function_js__rspack_import_0/* .identity */.D_ }; -const StreamProto = { +const Stream = function (channel) { + this.channel = channel; +}; +Stream.prototype = { [TypeId]: streamVariance, pipe() { return (0,_Pipeable_js__rspack_import_1/* .pipeArguments */.tT)(this, arguments); } }; /** @internal */ -const fromChannel = channel => { - const self = Object.create(StreamProto); - self.channel = channel; - return self; -}; +const fromChannel = channel => new Stream(channel); //# sourceMappingURL=stream.js.map __webpack_require__.d(__webpack_exports__, { }, { @@ -97303,6 +97880,12 @@ const addSpanStackTrace = options => { return options; } const limit = (0,_stackTraceLimit_js__rspack_import_0/* .getStackTraceLimit */.jt)(); + if (limit === 0 && options?.captureStackTrace !== true) { + return { + ...options, + captureStackTrace: false + }; + } (0,_stackTraceLimit_js__rspack_import_0/* .setStackTraceLimit */.ft)(3); const traceError = new Error(); (0,_stackTraceLimit_js__rspack_import_0/* .setStackTraceLimit */.ft)(limit); @@ -107394,47 +107977,47 @@ __webpack_require__.r(__webpack_exports__); /* import */ var agent_bundle_mcp_server_runtime__rspack_import_1 = __webpack_require__("./node_modules/agent-bundle/dist/mcp-server-runtime.js"); /* import */ var _agent_bundle_runtime_lineage__rspack_import_16 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/lineage.js"); /* import */ var agent_bundle_mcp_apps__rspack_import_2 = __webpack_require__("./.agent-bundle-virtual/mcp-grok-bot-b8c2461e-0.mjs"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_send_tsx__rspack_import_3 = __webpack_require__("./src/mcp/grok-bot/tools/codex_send.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_threads_tsx__rspack_import_4 = __webpack_require__("./src/mcp/grok-bot/tools/codex_threads.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_wait_tsx__rspack_import_5 = __webpack_require__("./src/mcp/grok-bot/tools/codex_wait.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_watch_tsx__rspack_import_6 = __webpack_require__("./src/mcp/grok-bot/tools/codex_watch.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_bridge_start_tsx__rspack_import_7 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_bridge_start.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_bridge_status_tsx__rspack_import_8 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_bridge_status.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_bridge_stop_tsx__rspack_import_9 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_bridge_stop.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_codex_respond_tsx__rspack_import_10 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_codex_respond.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_grok_approvals_tsx__rspack_import_11 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_grok_approvals.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_grok_respond_tsx__rspack_import_12 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_grok_respond.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_send_tsx__rspack_import_13 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_send.tsx"); -/* import */ var _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_thread_tsx__rspack_import_14 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_thread.tsx"); +/* import */ var _src_mcp_grok_bot_tools_codex_send_tsx__rspack_import_3 = __webpack_require__("./src/mcp/grok-bot/tools/codex_send.tsx"); +/* import */ var _src_mcp_grok_bot_tools_codex_threads_tsx__rspack_import_4 = __webpack_require__("./src/mcp/grok-bot/tools/codex_threads.tsx"); +/* import */ var _src_mcp_grok_bot_tools_codex_wait_tsx__rspack_import_5 = __webpack_require__("./src/mcp/grok-bot/tools/codex_wait.tsx"); +/* import */ var _src_mcp_grok_bot_tools_codex_watch_tsx__rspack_import_6 = __webpack_require__("./src/mcp/grok-bot/tools/codex_watch.tsx"); +/* import */ var _src_mcp_grok_bot_tools_gbot_bridge_start_tsx__rspack_import_7 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_bridge_start.tsx"); +/* import */ var _src_mcp_grok_bot_tools_gbot_bridge_status_tsx__rspack_import_8 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_bridge_status.tsx"); +/* import */ var _src_mcp_grok_bot_tools_gbot_bridge_stop_tsx__rspack_import_9 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_bridge_stop.tsx"); +/* import */ var _src_mcp_grok_bot_tools_gbot_codex_respond_tsx__rspack_import_10 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_codex_respond.tsx"); +/* import */ var _src_mcp_grok_bot_tools_gbot_grok_approvals_tsx__rspack_import_11 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_grok_approvals.tsx"); +/* import */ var _src_mcp_grok_bot_tools_gbot_grok_respond_tsx__rspack_import_12 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_grok_respond.tsx"); +/* import */ var _src_mcp_grok_bot_tools_gbot_send_tsx__rspack_import_13 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_send.tsx"); +/* import */ var _src_mcp_grok_bot_tools_gbot_thread_tsx__rspack_import_14 = __webpack_require__("./src/mcp/grok-bot/tools/gbot_thread.tsx"); -const route0 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_send_tsx__rspack_import_3, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_send_tsx__rspack_import_3); +const route0 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_codex_send_tsx__rspack_import_3, 'default'), _src_mcp_grok_bot_tools_codex_send_tsx__rspack_import_3); -const route1 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_threads_tsx__rspack_import_4, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_threads_tsx__rspack_import_4); +const route1 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_codex_threads_tsx__rspack_import_4, 'default'), _src_mcp_grok_bot_tools_codex_threads_tsx__rspack_import_4); -const route2 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_wait_tsx__rspack_import_5, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_wait_tsx__rspack_import_5); +const route2 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_codex_wait_tsx__rspack_import_5, 'default'), _src_mcp_grok_bot_tools_codex_wait_tsx__rspack_import_5); -const route3 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_watch_tsx__rspack_import_6, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_codex_watch_tsx__rspack_import_6); +const route3 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_codex_watch_tsx__rspack_import_6, 'default'), _src_mcp_grok_bot_tools_codex_watch_tsx__rspack_import_6); -const route4 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_bridge_start_tsx__rspack_import_7, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_bridge_start_tsx__rspack_import_7); +const route4 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_gbot_bridge_start_tsx__rspack_import_7, 'default'), _src_mcp_grok_bot_tools_gbot_bridge_start_tsx__rspack_import_7); -const route5 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_bridge_status_tsx__rspack_import_8, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_bridge_status_tsx__rspack_import_8); +const route5 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_gbot_bridge_status_tsx__rspack_import_8, 'default'), _src_mcp_grok_bot_tools_gbot_bridge_status_tsx__rspack_import_8); -const route6 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_bridge_stop_tsx__rspack_import_9, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_bridge_stop_tsx__rspack_import_9); +const route6 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_gbot_bridge_stop_tsx__rspack_import_9, 'default'), _src_mcp_grok_bot_tools_gbot_bridge_stop_tsx__rspack_import_9); -const route7 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_codex_respond_tsx__rspack_import_10, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_codex_respond_tsx__rspack_import_10); +const route7 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_gbot_codex_respond_tsx__rspack_import_10, 'default'), _src_mcp_grok_bot_tools_gbot_codex_respond_tsx__rspack_import_10); -const route8 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_grok_approvals_tsx__rspack_import_11, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_grok_approvals_tsx__rspack_import_11); +const route8 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_gbot_grok_approvals_tsx__rspack_import_11, 'default'), _src_mcp_grok_bot_tools_gbot_grok_approvals_tsx__rspack_import_11); -const route9 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_grok_respond_tsx__rspack_import_12, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_grok_respond_tsx__rspack_import_12); +const route9 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_gbot_grok_respond_tsx__rspack_import_12, 'default'), _src_mcp_grok_bot_tools_gbot_grok_respond_tsx__rspack_import_12); -const route10 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_send_tsx__rspack_import_13, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_send_tsx__rspack_import_13); +const route10 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_gbot_send_tsx__rspack_import_13, 'default'), _src_mcp_grok_bot_tools_gbot_send_tsx__rspack_import_13); -const route11 = Object.assign({}, Reflect.get(_tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_thread_tsx__rspack_import_14, 'default'), _tmp_gbot_agent_bundle_native_src_mcp_grok_bot_tools_gbot_thread_tsx__rspack_import_14); +const route11 = Object.assign({}, Reflect.get(_src_mcp_grok_bot_tools_gbot_thread_tsx__rspack_import_14, 'default'), _src_mcp_grok_bot_tools_gbot_thread_tsx__rspack_import_14); const ARTIFACT_EPOCH = "gbot@0.9.0"; const pluginRoot = (0,_agent_bundle_runtime__rspack_import_15/* .resolvePluginRoot */.E7)({ fallback: (0,node_url__rspack_import_0.fileURLToPath)(new URL('..', import.meta.url)), diff --git a/artifact/scripts/gbot-relay.mjs b/artifact/scripts/gbot-relay.mjs index 98ee338..a311950 100644 --- a/artifact/scripts/gbot-relay.mjs +++ b/artifact/scripts/gbot-relay.mjs @@ -10,1922 +10,6 @@ import * as __rspack_external_node_path_806ed179 from "node:path"; import * as __rspack_external_node_sqlite_cecf0237 from "node:sqlite"; import * as __rspack_external_node_string_decoder_69b9bd04 from "node:string_decoder"; var __webpack_modules__ = ({ -"./node_modules/react/cjs/react.development.js"(module, exports, __webpack_require__) { -/* module decorator */ module = __webpack_require__.nmd(module); -/** - * @license React - * react.development.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - -"production" !== process.env.NODE_ENV && - (function () { - function defineDeprecationWarning(methodName, info) { - Object.defineProperty(Component.prototype, methodName, { - get: function () { - console.warn( - "%s(...) is deprecated in plain JavaScript React classes. %s", - info[0], - info[1] - ); - } - }); - } - function getIteratorFn(maybeIterable) { - if (null === maybeIterable || "object" !== typeof maybeIterable) - return null; - maybeIterable = - (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || - maybeIterable["@@iterator"]; - return "function" === typeof maybeIterable ? maybeIterable : null; - } - function warnNoop(publicInstance, callerName) { - publicInstance = - ((publicInstance = publicInstance.constructor) && - (publicInstance.displayName || publicInstance.name)) || - "ReactClass"; - var warningKey = publicInstance + "." + callerName; - didWarnStateUpdateForUnmountedComponent[warningKey] || - (console.error( - "Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.", - callerName, - publicInstance - ), - (didWarnStateUpdateForUnmountedComponent[warningKey] = !0)); - } - function Component(props, context, updater) { - this.props = props; - this.context = context; - this.refs = emptyObject; - this.updater = updater || ReactNoopUpdateQueue; - } - function ComponentDummy() {} - function PureComponent(props, context, updater) { - this.props = props; - this.context = context; - this.refs = emptyObject; - this.updater = updater || ReactNoopUpdateQueue; - } - function noop() {} - function testStringCoercion(value) { - return "" + value; - } - function checkKeyStringCoercion(value) { - try { - testStringCoercion(value); - var JSCompiler_inline_result = !1; - } catch (e) { - JSCompiler_inline_result = !0; - } - if (JSCompiler_inline_result) { - JSCompiler_inline_result = console; - var JSCompiler_temp_const = JSCompiler_inline_result.error; - var JSCompiler_inline_result$jscomp$0 = - ("function" === typeof Symbol && - Symbol.toStringTag && - value[Symbol.toStringTag]) || - value.constructor.name || - "Object"; - JSCompiler_temp_const.call( - JSCompiler_inline_result, - "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", - JSCompiler_inline_result$jscomp$0 - ); - return testStringCoercion(value); - } - } - function getComponentNameFromType(type) { - if (null == type) return null; - if ("function" === typeof type) - return type.$$typeof === REACT_CLIENT_REFERENCE - ? null - : type.displayName || type.name || null; - if ("string" === typeof type) return type; - switch (type) { - case REACT_FRAGMENT_TYPE: - return "Fragment"; - case REACT_PROFILER_TYPE: - return "Profiler"; - case REACT_STRICT_MODE_TYPE: - return "StrictMode"; - case REACT_SUSPENSE_TYPE: - return "Suspense"; - case REACT_SUSPENSE_LIST_TYPE: - return "SuspenseList"; - case REACT_ACTIVITY_TYPE: - return "Activity"; - case REACT_VIEW_TRANSITION_TYPE: - return "ViewTransition"; - } - if ("object" === typeof type) - switch ( - ("number" === typeof type.tag && - console.error( - "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." - ), - type.$$typeof) - ) { - case REACT_PORTAL_TYPE: - return "Portal"; - case REACT_CONTEXT_TYPE: - return type.displayName || "Context"; - case REACT_CONSUMER_TYPE: - return (type._context.displayName || "Context") + ".Consumer"; - case REACT_FORWARD_REF_TYPE: - var innerType = type.render; - type = type.displayName; - type || - ((type = innerType.displayName || innerType.name || ""), - (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); - return type; - case REACT_MEMO_TYPE: - return ( - (innerType = type.displayName || null), - null !== innerType - ? innerType - : getComponentNameFromType(type.type) || "Memo" - ); - case REACT_LAZY_TYPE: - innerType = type._payload; - type = type._init; - try { - return getComponentNameFromType(type(innerType)); - } catch (x) {} - } - return null; - } - function getTaskName(type) { - if (type === REACT_FRAGMENT_TYPE) return "<>"; - if ( - "object" === typeof type && - null !== type && - type.$$typeof === REACT_LAZY_TYPE - ) - return "<...>"; - try { - var name = getComponentNameFromType(type); - return name ? "<" + name + ">" : "<...>"; - } catch (x) { - return "<...>"; - } - } - function getOwner() { - var dispatcher = ReactSharedInternals.A; - return null === dispatcher ? null : dispatcher.getOwner(); - } - function UnknownOwner() { - return Error("react-stack-top-frame"); - } - function hasValidKey(config) { - if (hasOwnProperty.call(config, "key")) { - var getter = Object.getOwnPropertyDescriptor(config, "key").get; - if (getter && getter.isReactWarning) return !1; - } - return void 0 !== config.key; - } - function defineKeyPropWarningGetter(props, displayName) { - function warnAboutAccessingKey() { - specialPropKeyWarningShown || - ((specialPropKeyWarningShown = !0), - console.error( - "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", - displayName - )); - } - warnAboutAccessingKey.isReactWarning = !0; - Object.defineProperty(props, "key", { - get: warnAboutAccessingKey, - configurable: !0 - }); - } - function elementRefGetterWithDeprecationWarning() { - var componentName = getComponentNameFromType(this.type); - didWarnAboutElementRef[componentName] || - ((didWarnAboutElementRef[componentName] = !0), - console.error( - "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release." - )); - componentName = this.props.ref; - return void 0 !== componentName ? componentName : null; - } - function ReactElement(type, key, props, owner, debugStack, debugTask) { - var refProp = props.ref; - type = { - $$typeof: REACT_ELEMENT_TYPE, - type: type, - key: key, - props: props, - _owner: owner - }; - null !== (void 0 !== refProp ? refProp : null) - ? Object.defineProperty(type, "ref", { - enumerable: !1, - get: elementRefGetterWithDeprecationWarning - }) - : Object.defineProperty(type, "ref", { enumerable: !1, value: null }); - type._store = {}; - Object.defineProperty(type._store, "validated", { - configurable: !1, - enumerable: !1, - writable: !0, - value: 0 - }); - Object.defineProperty(type, "_debugInfo", { - configurable: !1, - enumerable: !1, - writable: !0, - value: null - }); - Object.defineProperty(type, "_debugStack", { - configurable: !1, - enumerable: !1, - writable: !0, - value: debugStack - }); - Object.defineProperty(type, "_debugTask", { - configurable: !1, - enumerable: !1, - writable: !0, - value: debugTask - }); - Object.freeze && (Object.freeze(type.props), Object.freeze(type)); - return type; - } - function cloneAndReplaceKey(oldElement, newKey) { - newKey = ReactElement( - oldElement.type, - newKey, - oldElement.props, - oldElement._owner, - oldElement._debugStack, - oldElement._debugTask - ); - oldElement._store && - (newKey._store.validated = oldElement._store.validated); - return newKey; - } - function validateChildKeys(node) { - isValidElement(node) - ? node._store && (node._store.validated = 1) - : "object" === typeof node && - null !== node && - node.$$typeof === REACT_LAZY_TYPE && - ("fulfilled" === node._payload.status - ? isValidElement(node._payload.value) && - node._payload.value._store && - (node._payload.value._store.validated = 1) - : node._store && (node._store.validated = 1)); - } - function isValidElement(object) { - return ( - "object" === typeof object && - null !== object && - object.$$typeof === REACT_ELEMENT_TYPE - ); - } - function escape(key) { - var escaperLookup = { "=": "=0", ":": "=2" }; - return ( - "$" + - key.replace(/[=:]/g, function (match) { - return escaperLookup[match]; - }) - ); - } - function getElementKey(element, index) { - return "object" === typeof element && - null !== element && - null != element.key - ? (checkKeyStringCoercion(element.key), escape("" + element.key)) - : index.toString(36); - } - function resolveThenable(thenable) { - switch (thenable.status) { - case "fulfilled": - return thenable.value; - case "rejected": - throw thenable.reason; - default: - switch ( - ("string" === typeof thenable.status - ? thenable.then(noop, noop) - : ((thenable.status = "pending"), - thenable.then( - function (fulfilledValue) { - "pending" === thenable.status && - ((thenable.status = "fulfilled"), - (thenable.value = fulfilledValue)); - }, - function (error) { - "pending" === thenable.status && - ((thenable.status = "rejected"), - (thenable.reason = error)); - } - )), - thenable.status) - ) { - case "fulfilled": - return thenable.value; - case "rejected": - throw thenable.reason; - } - } - throw thenable; - } - function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { - var type = typeof children; - if ("undefined" === type || "boolean" === type) children = null; - var invokeCallback = !1; - if (null === children) invokeCallback = !0; - else - switch (type) { - case "bigint": - case "string": - case "number": - invokeCallback = !0; - break; - case "object": - switch (children.$$typeof) { - case REACT_ELEMENT_TYPE: - case REACT_PORTAL_TYPE: - invokeCallback = !0; - break; - case REACT_LAZY_TYPE: - return ( - (invokeCallback = children._init), - mapIntoArray( - invokeCallback(children._payload), - array, - escapedPrefix, - nameSoFar, - callback - ) - ); - } - } - if (invokeCallback) { - invokeCallback = children; - callback = callback(invokeCallback); - var childKey = - "" === nameSoFar ? "." + getElementKey(invokeCallback, 0) : nameSoFar; - isArrayImpl(callback) - ? ((escapedPrefix = ""), - null != childKey && - (escapedPrefix = - childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), - mapIntoArray(callback, array, escapedPrefix, "", function (c) { - return c; - })) - : null != callback && - (isValidElement(callback) && - (null != callback.key && - ((invokeCallback && invokeCallback.key === callback.key) || - checkKeyStringCoercion(callback.key)), - (escapedPrefix = cloneAndReplaceKey( - callback, - escapedPrefix + - (null == callback.key || - (invokeCallback && invokeCallback.key === callback.key) - ? "" - : ("" + callback.key).replace( - userProvidedKeyEscapeRegex, - "$&/" - ) + "/") + - childKey - )), - "" !== nameSoFar && - null != invokeCallback && - isValidElement(invokeCallback) && - null == invokeCallback.key && - invokeCallback._store && - !invokeCallback._store.validated && - (escapedPrefix._store.validated = 2), - (callback = escapedPrefix)), - array.push(callback)); - return 1; - } - invokeCallback = 0; - childKey = "" === nameSoFar ? "." : nameSoFar + ":"; - if (isArrayImpl(children)) - for (var i = 0; i < children.length; i++) - (nameSoFar = children[i]), - (type = childKey + getElementKey(nameSoFar, i)), - (invokeCallback += mapIntoArray( - nameSoFar, - array, - escapedPrefix, - type, - callback - )); - else if (((i = getIteratorFn(children)), "function" === typeof i)) - for ( - i === children.entries && - (didWarnAboutMaps || - console.warn( - "Using Maps as children is not supported. Use an array of keyed ReactElements instead." - ), - (didWarnAboutMaps = !0)), - children = i.call(children), - i = 0; - !(nameSoFar = children.next()).done; - - ) - (nameSoFar = nameSoFar.value), - (type = childKey + getElementKey(nameSoFar, i++)), - (invokeCallback += mapIntoArray( - nameSoFar, - array, - escapedPrefix, - type, - callback - )); - else if ("object" === type) { - if ("function" === typeof children.then) - return mapIntoArray( - resolveThenable(children), - array, - escapedPrefix, - nameSoFar, - callback - ); - array = String(children); - throw Error( - "Objects are not valid as a React child (found: " + - ("[object Object]" === array - ? "object with keys {" + Object.keys(children).join(", ") + "}" - : array) + - "). If you meant to render a collection of children, use an array instead." - ); - } - return invokeCallback; - } - function mapChildren(children, func, context) { - if (null == children) return children; - var result = [], - count = 0; - mapIntoArray(children, result, "", "", function (child) { - return func.call(context, child, count++); - }); - return result; - } - function lazyInitializer(payload) { - if (-1 === payload._status) { - var resolveDebugValue = null, - rejectDebugValue = null, - ioInfo = payload._ioInfo; - null != ioInfo && - ((ioInfo.start = ioInfo.end = performance.now()), - (ioInfo.value = new Promise(function (resolve, reject) { - resolveDebugValue = resolve; - rejectDebugValue = reject; - }))); - ioInfo = payload._result; - var thenable = ioInfo(); - thenable.then( - function (moduleObject) { - if (0 === payload._status || -1 === payload._status) { - payload._status = 1; - payload._result = moduleObject; - var _ioInfo = payload._ioInfo; - if (null != _ioInfo) { - _ioInfo.end = performance.now(); - var debugValue = - null == moduleObject ? void 0 : moduleObject.default; - resolveDebugValue(debugValue); - _ioInfo.value.status = "fulfilled"; - _ioInfo.value.value = debugValue; - } - void 0 === thenable.status && - ((thenable.status = "fulfilled"), - (thenable.value = moduleObject)); - } - }, - function (error) { - if (0 === payload._status || -1 === payload._status) { - payload._status = 2; - payload._result = error; - var _ioInfo2 = payload._ioInfo; - null != _ioInfo2 && - ((_ioInfo2.end = performance.now()), - _ioInfo2.value.then(noop, noop), - rejectDebugValue(error), - (_ioInfo2.value.status = "rejected"), - (_ioInfo2.value.reason = error)); - void 0 === thenable.status && - ((thenable.status = "rejected"), (thenable.reason = error)); - } - } - ); - ioInfo = payload._ioInfo; - if (null != ioInfo) { - var displayName = thenable.displayName; - "string" === typeof displayName && (ioInfo.name = displayName); - } - -1 === payload._status && - ((payload._status = 0), (payload._result = thenable)); - } - if (1 === payload._status) - return ( - (ioInfo = payload._result), - void 0 === ioInfo && - console.error( - "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?", - ioInfo - ), - "default" in ioInfo || - console.error( - "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))", - ioInfo - ), - ioInfo.default - ); - throw payload._result; - } - function resolveDispatcher() { - var dispatcher = ReactSharedInternals.H; - null === dispatcher && - console.error( - "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem." - ); - return dispatcher; - } - function releaseAsyncTransition() { - ReactSharedInternals.asyncTransitions--; - } - function startTransition(scope) { - var prevTransition = ReactSharedInternals.T, - currentTransition = {}; - currentTransition.types = - null !== prevTransition ? prevTransition.types : null; - currentTransition._updatedFibers = new Set(); - ReactSharedInternals.T = currentTransition; - try { - var returnValue = scope(), - onStartTransitionFinish = ReactSharedInternals.S; - null !== onStartTransitionFinish && - onStartTransitionFinish(currentTransition, returnValue); - "object" === typeof returnValue && - null !== returnValue && - "function" === typeof returnValue.then && - (ReactSharedInternals.asyncTransitions++, - returnValue.then(releaseAsyncTransition, releaseAsyncTransition), - returnValue.then(noop, reportGlobalError)); - } catch (error) { - reportGlobalError(error); - } finally { - null === prevTransition && - currentTransition._updatedFibers && - ((scope = currentTransition._updatedFibers.size), - currentTransition._updatedFibers.clear(), - 10 < scope && - console.warn( - "Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table." - )), - null !== prevTransition && - null !== currentTransition.types && - (null !== prevTransition.types && - prevTransition.types !== currentTransition.types && - console.error( - "We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React." - ), - (prevTransition.types = currentTransition.types)), - (ReactSharedInternals.T = prevTransition); - } - } - function addTransitionType(type) { - var transition = ReactSharedInternals.T; - if (null !== transition) { - var transitionTypes = transition.types; - null === transitionTypes - ? (transition.types = [type]) - : -1 === transitionTypes.indexOf(type) && transitionTypes.push(type); - } else - 0 === ReactSharedInternals.asyncTransitions && - console.error( - "addTransitionType can only be called inside a `startTransition()` callback. It must be associated with a specific Transition." - ), - startTransition(addTransitionType.bind(null, type)); - } - function enqueueTask(task) { - if (null === enqueueTaskImpl) - try { - var requireString = ("require" + Math.random()).slice(0, 7); - enqueueTaskImpl = (module && module[requireString]).call( - module, - "timers" - ).setImmediate; - } catch (_err) { - enqueueTaskImpl = function (callback) { - !1 === didWarnAboutMessageChannel && - ((didWarnAboutMessageChannel = !0), - "undefined" === typeof MessageChannel && - console.error( - "This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning." - )); - var channel = new MessageChannel(); - channel.port1.onmessage = callback; - channel.port2.postMessage(void 0); - }; - } - return enqueueTaskImpl(task); - } - function aggregateErrors(errors) { - return 1 < errors.length && "function" === typeof AggregateError - ? new AggregateError(errors) - : errors[0]; - } - function popActScope(prevActQueue, prevActScopeDepth) { - prevActScopeDepth !== actScopeDepth - 1 && - console.error( - "You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. " - ); - actScopeDepth = prevActScopeDepth; - } - function recursivelyFlushAsyncActWork(returnValue, resolve, reject) { - var queue = ReactSharedInternals.actQueue; - if (null !== queue) - if (0 !== queue.length) - try { - flushActQueue(queue); - enqueueTask(function () { - return recursivelyFlushAsyncActWork(returnValue, resolve, reject); - }); - return; - } catch (error) { - ReactSharedInternals.thrownErrors.push(error); - } - else ReactSharedInternals.actQueue = null; - 0 < ReactSharedInternals.thrownErrors.length - ? ((queue = aggregateErrors(ReactSharedInternals.thrownErrors)), - (ReactSharedInternals.thrownErrors.length = 0), - reject(queue)) - : resolve(returnValue); - } - function flushActQueue(queue) { - if (!isFlushing) { - isFlushing = !0; - var i = 0; - try { - for (; i < queue.length; i++) { - var callback = queue[i]; - do { - ReactSharedInternals.didUsePromise = !1; - var continuation = callback(!1); - if (null !== continuation) { - if (ReactSharedInternals.didUsePromise) { - queue[i] = callback; - queue.splice(0, i); - return; - } - callback = continuation; - } else break; - } while (1); - } - queue.length = 0; - } catch (error) { - queue.splice(0, i + 1), ReactSharedInternals.thrownErrors.push(error); - } finally { - isFlushing = !1; - } - } - } - "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && - "function" === - typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && - __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); - var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), - REACT_PORTAL_TYPE = Symbol.for("react.portal"), - REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), - REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), - REACT_PROFILER_TYPE = Symbol.for("react.profiler"), - REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), - REACT_CONTEXT_TYPE = Symbol.for("react.context"), - REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), - REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), - REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), - REACT_MEMO_TYPE = Symbol.for("react.memo"), - REACT_LAZY_TYPE = Symbol.for("react.lazy"), - REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), - REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"), - MAYBE_ITERATOR_SYMBOL = Symbol.iterator, - didWarnStateUpdateForUnmountedComponent = {}, - ReactNoopUpdateQueue = { - isMounted: function () { - return !1; - }, - enqueueForceUpdate: function (publicInstance) { - warnNoop(publicInstance, "forceUpdate"); - }, - enqueueReplaceState: function (publicInstance) { - warnNoop(publicInstance, "replaceState"); - }, - enqueueSetState: function (publicInstance) { - warnNoop(publicInstance, "setState"); - } - }, - assign = Object.assign, - emptyObject = {}; - Object.freeze(emptyObject); - Component.prototype.isReactComponent = {}; - Component.prototype.setState = function (partialState, callback) { - if ( - "object" !== typeof partialState && - "function" !== typeof partialState && - null != partialState - ) - throw Error( - "takes an object of state variables to update or a function which returns an object of state variables." - ); - this.updater.enqueueSetState(this, partialState, callback, "setState"); - }; - Component.prototype.forceUpdate = function (callback) { - this.updater.enqueueForceUpdate(this, callback, "forceUpdate"); - }; - var deprecatedAPIs = { - isMounted: [ - "isMounted", - "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks." - ], - replaceState: [ - "replaceState", - "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)." - ] - }; - for (fnName in deprecatedAPIs) - deprecatedAPIs.hasOwnProperty(fnName) && - defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); - ComponentDummy.prototype = Component.prototype; - deprecatedAPIs = PureComponent.prototype = new ComponentDummy(); - deprecatedAPIs.constructor = PureComponent; - assign(deprecatedAPIs, Component.prototype); - deprecatedAPIs.isPureReactComponent = !0; - var isArrayImpl = Array.isArray, - REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), - ReactSharedInternals = { - H: null, - A: null, - T: null, - S: null, - actQueue: null, - asyncTransitions: 0, - isBatchingLegacy: !1, - didScheduleLegacyUpdate: !1, - didUsePromise: !1, - thrownErrors: [], - getCurrentStack: null, - recentlyCreatedOwnerStacks: 0 - }, - hasOwnProperty = Object.prototype.hasOwnProperty, - createTask = console.createTask - ? console.createTask - : function () { - return null; - }; - deprecatedAPIs = { - react_stack_bottom_frame: function (callStackForError) { - return callStackForError(); - } - }; - var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime; - var didWarnAboutElementRef = {}; - var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind( - deprecatedAPIs, - UnknownOwner - )(); - var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner)); - var didWarnAboutMaps = !1, - userProvidedKeyEscapeRegex = /\/+/g, - reportGlobalError = - "function" === typeof reportError - ? reportError - : function (error) { - if ( - "object" === typeof window && - "function" === typeof window.ErrorEvent - ) { - var event = new window.ErrorEvent("error", { - bubbles: !0, - cancelable: !0, - message: - "object" === typeof error && - null !== error && - "string" === typeof error.message - ? String(error.message) - : String(error), - error: error - }); - if (!window.dispatchEvent(event)) return; - } else if ( - "object" === typeof process && - "function" === typeof process.emit - ) { - process.emit("uncaughtException", error); - return; - } - console.error(error); - }, - didWarnAboutMessageChannel = !1, - enqueueTaskImpl = null, - actScopeDepth = 0, - didWarnNoAwaitAct = !1, - isFlushing = !1, - queueSeveralMicrotasks = - "function" === typeof queueMicrotask - ? function (callback) { - queueMicrotask(function () { - return queueMicrotask(callback); - }); - } - : enqueueTask; - deprecatedAPIs = Object.freeze({ - __proto__: null, - c: function (size) { - return resolveDispatcher().useMemoCache(size); - } - }); - var fnName = { - map: mapChildren, - forEach: function (children, forEachFunc, forEachContext) { - mapChildren( - children, - function () { - forEachFunc.apply(this, arguments); - }, - forEachContext - ); - }, - count: function (children) { - var n = 0; - mapChildren(children, function () { - n++; - }); - return n; - }, - toArray: function (children) { - return ( - mapChildren(children, function (child) { - return child; - }) || [] - ); - }, - only: function (children) { - if (!isValidElement(children)) - throw Error( - "React.Children.only expected to receive a single React element child." - ); - return children; - } - }; - exports.Activity = REACT_ACTIVITY_TYPE; - exports.Children = fnName; - exports.Component = Component; - exports.Fragment = REACT_FRAGMENT_TYPE; - exports.Profiler = REACT_PROFILER_TYPE; - exports.PureComponent = PureComponent; - exports.StrictMode = REACT_STRICT_MODE_TYPE; - exports.Suspense = REACT_SUSPENSE_TYPE; - exports.ViewTransition = REACT_VIEW_TRANSITION_TYPE; - exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = - ReactSharedInternals; - exports.__COMPILER_RUNTIME = deprecatedAPIs; - exports.act = function (callback) { - var prevActQueue = ReactSharedInternals.actQueue, - prevActScopeDepth = actScopeDepth; - actScopeDepth++; - var queue = (ReactSharedInternals.actQueue = - null !== prevActQueue ? prevActQueue : []), - didAwaitActCall = !1; - try { - var result = callback(); - } catch (error) { - ReactSharedInternals.thrownErrors.push(error); - } - if (0 < ReactSharedInternals.thrownErrors.length) - throw ( - (popActScope(prevActQueue, prevActScopeDepth), - (callback = aggregateErrors(ReactSharedInternals.thrownErrors)), - (ReactSharedInternals.thrownErrors.length = 0), - callback) - ); - if ( - null !== result && - "object" === typeof result && - "function" === typeof result.then - ) { - var thenable = result; - queueSeveralMicrotasks(function () { - didAwaitActCall || - didWarnNoAwaitAct || - ((didWarnNoAwaitAct = !0), - console.error( - "You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);" - )); - }); - return { - then: function (resolve, reject) { - didAwaitActCall = !0; - thenable.then( - function (returnValue) { - popActScope(prevActQueue, prevActScopeDepth); - if (0 === prevActScopeDepth) { - try { - flushActQueue(queue), - enqueueTask(function () { - return recursivelyFlushAsyncActWork( - returnValue, - resolve, - reject - ); - }); - } catch (error$0) { - ReactSharedInternals.thrownErrors.push(error$0); - } - if (0 < ReactSharedInternals.thrownErrors.length) { - var _thrownError = aggregateErrors( - ReactSharedInternals.thrownErrors - ); - ReactSharedInternals.thrownErrors.length = 0; - reject(_thrownError); - } - } else resolve(returnValue); - }, - function (error) { - popActScope(prevActQueue, prevActScopeDepth); - 0 < ReactSharedInternals.thrownErrors.length - ? ((error = aggregateErrors( - ReactSharedInternals.thrownErrors - )), - (ReactSharedInternals.thrownErrors.length = 0), - reject(error)) - : reject(error); - } - ); - } - }; - } - var returnValue$jscomp$0 = result; - popActScope(prevActQueue, prevActScopeDepth); - 0 === prevActScopeDepth && - (flushActQueue(queue), - 0 !== queue.length && - queueSeveralMicrotasks(function () { - didAwaitActCall || - didWarnNoAwaitAct || - ((didWarnNoAwaitAct = !0), - console.error( - "A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)" - )); - }), - (ReactSharedInternals.actQueue = null)); - if (0 < ReactSharedInternals.thrownErrors.length) - throw ( - ((callback = aggregateErrors(ReactSharedInternals.thrownErrors)), - (ReactSharedInternals.thrownErrors.length = 0), - callback) - ); - return { - then: function (resolve, reject) { - didAwaitActCall = !0; - 0 === prevActScopeDepth - ? ((ReactSharedInternals.actQueue = queue), - enqueueTask(function () { - return recursivelyFlushAsyncActWork( - returnValue$jscomp$0, - resolve, - reject - ); - })) - : resolve(returnValue$jscomp$0); - } - }; - }; - exports.addTransitionType = addTransitionType; - exports.cache = function (fn) { - return function () { - return fn.apply(null, arguments); - }; - }; - exports.cacheSignal = function () { - return null; - }; - exports.captureOwnerStack = function () { - var getCurrentStack = ReactSharedInternals.getCurrentStack; - return null === getCurrentStack ? null : getCurrentStack(); - }; - exports.cloneElement = function (element, config, children) { - if (null === element || void 0 === element) - throw Error( - "The argument must be a React element, but you passed " + - element + - "." - ); - var props = assign({}, element.props), - key = element.key, - owner = element._owner; - if (null != config) { - var JSCompiler_inline_result; - a: { - if ( - hasOwnProperty.call(config, "ref") && - (JSCompiler_inline_result = Object.getOwnPropertyDescriptor( - config, - "ref" - ).get) && - JSCompiler_inline_result.isReactWarning - ) { - JSCompiler_inline_result = !1; - break a; - } - JSCompiler_inline_result = void 0 !== config.ref; - } - JSCompiler_inline_result && (owner = getOwner()); - hasValidKey(config) && - (checkKeyStringCoercion(config.key), (key = "" + config.key)); - for (propName in config) - !hasOwnProperty.call(config, propName) || - "key" === propName || - "__self" === propName || - "__source" === propName || - ("ref" === propName && void 0 === config.ref) || - (props[propName] = config[propName]); - } - var propName = arguments.length - 2; - if (1 === propName) props.children = children; - else if (1 < propName) { - JSCompiler_inline_result = Array(propName); - for (var i = 0; i < propName; i++) - JSCompiler_inline_result[i] = arguments[i + 2]; - props.children = JSCompiler_inline_result; - } - props = ReactElement( - element.type, - key, - props, - owner, - element._debugStack, - element._debugTask - ); - for (key = 2; key < arguments.length; key++) - validateChildKeys(arguments[key]); - return props; - }; - exports.createContext = function (defaultValue) { - defaultValue = { - $$typeof: REACT_CONTEXT_TYPE, - _currentValue: defaultValue, - _currentValue2: defaultValue, - _threadCount: 0, - Provider: null, - Consumer: null - }; - defaultValue.Provider = defaultValue; - defaultValue.Consumer = { - $$typeof: REACT_CONSUMER_TYPE, - _context: defaultValue - }; - defaultValue._currentRenderer = null; - defaultValue._currentRenderer2 = null; - return defaultValue; - }; - exports.createElement = function (type, config, children) { - for (var i = 2; i < arguments.length; i++) - validateChildKeys(arguments[i]); - var propName; - i = {}; - var key = null; - if (null != config) - for (propName in (didWarnAboutOldJSXRuntime || - !("__self" in config) || - "key" in config || - ((didWarnAboutOldJSXRuntime = !0), - console.warn( - "Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform" - )), - hasValidKey(config) && - (checkKeyStringCoercion(config.key), (key = "" + config.key)), - config)) - hasOwnProperty.call(config, propName) && - "key" !== propName && - "__self" !== propName && - "__source" !== propName && - (i[propName] = config[propName]); - var childrenLength = arguments.length - 2; - if (1 === childrenLength) i.children = children; - else if (1 < childrenLength) { - for ( - var childArray = Array(childrenLength), _i = 0; - _i < childrenLength; - _i++ - ) - childArray[_i] = arguments[_i + 2]; - Object.freeze && Object.freeze(childArray); - i.children = childArray; - } - if (type && type.defaultProps) - for (propName in ((childrenLength = type.defaultProps), childrenLength)) - void 0 === i[propName] && (i[propName] = childrenLength[propName]); - key && - defineKeyPropWarningGetter( - i, - "function" === typeof type - ? type.displayName || type.name || "Unknown" - : type - ); - (propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++) - ? ((childArray = Error.stackTraceLimit), - (Error.stackTraceLimit = 10), - (childrenLength = Error("react-stack-top-frame")), - (Error.stackTraceLimit = childArray)) - : (childrenLength = unknownOwnerDebugStack); - return ReactElement( - type, - key, - i, - getOwner(), - childrenLength, - propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask - ); - }; - exports.createRef = function () { - var refObject = { current: null }; - Object.seal(refObject); - return refObject; - }; - exports.forwardRef = function (render) { - null != render && render.$$typeof === REACT_MEMO_TYPE - ? console.error( - "forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))." - ) - : "function" !== typeof render - ? console.error( - "forwardRef requires a render function but was given %s.", - null === render ? "null" : typeof render - ) - : 0 !== render.length && - 2 !== render.length && - console.error( - "forwardRef render functions accept exactly two parameters: props and ref. %s", - 1 === render.length - ? "Did you forget to use the ref parameter?" - : "Any additional parameter will be undefined." - ); - null != render && - null != render.defaultProps && - console.error( - "forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?" - ); - var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render: render }, - ownName; - Object.defineProperty(elementType, "displayName", { - enumerable: !1, - configurable: !0, - get: function () { - return ownName; - }, - set: function (name) { - ownName = name; - render.name || - render.displayName || - (Object.defineProperty(render, "name", { value: name }), - (render.displayName = name)); - } - }); - return elementType; - }; - exports.isValidElement = isValidElement; - exports.lazy = function (ctor) { - ctor = { _status: -1, _result: ctor }; - var lazyType = { - $$typeof: REACT_LAZY_TYPE, - _payload: ctor, - _init: lazyInitializer - }, - ioInfo = { - name: "lazy", - start: -1, - end: -1, - value: null, - owner: null, - debugStack: Error("react-stack-top-frame"), - debugTask: console.createTask ? console.createTask("lazy()") : null - }; - ctor._ioInfo = ioInfo; - lazyType._debugInfo = [{ awaited: ioInfo }]; - return lazyType; - }; - exports.memo = function (type, compare) { - null == type && - console.error( - "memo: The first argument must be a component. Instead received: %s", - null === type ? "null" : typeof type - ); - compare = { - $$typeof: REACT_MEMO_TYPE, - type: type, - compare: void 0 === compare ? null : compare - }; - var ownName; - Object.defineProperty(compare, "displayName", { - enumerable: !1, - configurable: !0, - get: function () { - return ownName; - }, - set: function (name) { - ownName = name; - type.name || - type.displayName || - (Object.defineProperty(type, "name", { value: name }), - (type.displayName = name)); - } - }); - return compare; - }; - exports.startTransition = startTransition; - exports.unstable_useCacheRefresh = function () { - return resolveDispatcher().useCacheRefresh(); - }; - exports.use = function (usable) { - return resolveDispatcher().use(usable); - }; - exports.useActionState = function (action, initialState, permalink) { - return resolveDispatcher().useActionState( - action, - initialState, - permalink - ); - }; - exports.useCallback = function (callback, deps) { - return resolveDispatcher().useCallback(callback, deps); - }; - exports.useContext = function (Context) { - var dispatcher = resolveDispatcher(); - Context.$$typeof === REACT_CONSUMER_TYPE && - console.error( - "Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?" - ); - return dispatcher.useContext(Context); - }; - exports.useDebugValue = function (value, formatterFn) { - return resolveDispatcher().useDebugValue(value, formatterFn); - }; - exports.useDeferredValue = function (value, initialValue) { - return resolveDispatcher().useDeferredValue(value, initialValue); - }; - exports.useEffect = function (create, deps) { - null == create && - console.warn( - "React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?" - ); - return resolveDispatcher().useEffect(create, deps); - }; - exports.useEffectEvent = function (callback) { - return resolveDispatcher().useEffectEvent(callback); - }; - exports.useId = function () { - return resolveDispatcher().useId(); - }; - exports.useImperativeHandle = function (ref, create, deps) { - return resolveDispatcher().useImperativeHandle(ref, create, deps); - }; - exports.useInsertionEffect = function (create, deps) { - null == create && - console.warn( - "React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?" - ); - return resolveDispatcher().useInsertionEffect(create, deps); - }; - exports.useLayoutEffect = function (create, deps) { - null == create && - console.warn( - "React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?" - ); - return resolveDispatcher().useLayoutEffect(create, deps); - }; - exports.useMemo = function (create, deps) { - return resolveDispatcher().useMemo(create, deps); - }; - exports.useOptimistic = function (passthrough, reducer) { - return resolveDispatcher().useOptimistic(passthrough, reducer); - }; - exports.useReducer = function (reducer, initialArg, init) { - return resolveDispatcher().useReducer(reducer, initialArg, init); - }; - exports.useRef = function (initialValue) { - return resolveDispatcher().useRef(initialValue); - }; - exports.useState = function (initialState) { - return resolveDispatcher().useState(initialState); - }; - exports.useSyncExternalStore = function ( - subscribe, - getSnapshot, - getServerSnapshot - ) { - return resolveDispatcher().useSyncExternalStore( - subscribe, - getSnapshot, - getServerSnapshot - ); - }; - exports.useTransition = function () { - return resolveDispatcher().useTransition(); - }; - exports.version = "19.3.0"; - "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && - "function" === - typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && - __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); - })(); - - -}, -"./node_modules/react/cjs/react.production.js"(__unused_rspack_module, exports) { -var __rspack_unused_export; -/** - * @license React - * react.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - -var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), - REACT_PORTAL_TYPE = Symbol.for("react.portal"), - REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), - REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), - REACT_PROFILER_TYPE = Symbol.for("react.profiler"), - REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), - REACT_CONTEXT_TYPE = Symbol.for("react.context"), - REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), - REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), - REACT_MEMO_TYPE = Symbol.for("react.memo"), - REACT_LAZY_TYPE = Symbol.for("react.lazy"), - REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), - REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"), - MAYBE_ITERATOR_SYMBOL = Symbol.iterator; -function getIteratorFn(maybeIterable) { - if (null === maybeIterable || "object" !== typeof maybeIterable) return null; - maybeIterable = - (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || - maybeIterable["@@iterator"]; - return "function" === typeof maybeIterable ? maybeIterable : null; -} -var ReactNoopUpdateQueue = { - isMounted: function () { - return !1; - }, - enqueueForceUpdate: function () {}, - enqueueReplaceState: function () {}, - enqueueSetState: function () {} - }, - assign = Object.assign, - emptyObject = {}; -function Component(props, context, updater) { - this.props = props; - this.context = context; - this.refs = emptyObject; - this.updater = updater || ReactNoopUpdateQueue; -} -Component.prototype.isReactComponent = {}; -Component.prototype.setState = function (partialState, callback) { - if ( - "object" !== typeof partialState && - "function" !== typeof partialState && - null != partialState - ) - throw Error( - "takes an object of state variables to update or a function which returns an object of state variables." - ); - this.updater.enqueueSetState(this, partialState, callback, "setState"); -}; -Component.prototype.forceUpdate = function (callback) { - this.updater.enqueueForceUpdate(this, callback, "forceUpdate"); -}; -function ComponentDummy() {} -ComponentDummy.prototype = Component.prototype; -function PureComponent(props, context, updater) { - this.props = props; - this.context = context; - this.refs = emptyObject; - this.updater = updater || ReactNoopUpdateQueue; -} -var pureComponentPrototype = (PureComponent.prototype = new ComponentDummy()); -pureComponentPrototype.constructor = PureComponent; -assign(pureComponentPrototype, Component.prototype); -pureComponentPrototype.isPureReactComponent = !0; -var isArrayImpl = Array.isArray; -function noop() {} -var ReactSharedInternals = { H: null, A: null, T: null, S: null }, - hasOwnProperty = Object.prototype.hasOwnProperty; -function ReactElement(type, key, props) { - var refProp = props.ref; - return { - $$typeof: REACT_ELEMENT_TYPE, - type: type, - key: key, - ref: void 0 !== refProp ? refProp : null, - props: props - }; -} -function cloneAndReplaceKey(oldElement, newKey) { - return ReactElement(oldElement.type, newKey, oldElement.props); -} -function isValidElement(object) { - return ( - "object" === typeof object && - null !== object && - object.$$typeof === REACT_ELEMENT_TYPE - ); -} -function escape(key) { - var escaperLookup = { "=": "=0", ":": "=2" }; - return ( - "$" + - key.replace(/[=:]/g, function (match) { - return escaperLookup[match]; - }) - ); -} -var userProvidedKeyEscapeRegex = /\/+/g; -function getElementKey(element, index) { - return "object" === typeof element && null !== element && null != element.key - ? escape("" + element.key) - : index.toString(36); -} -function resolveThenable(thenable) { - switch (thenable.status) { - case "fulfilled": - return thenable.value; - case "rejected": - throw thenable.reason; - default: - switch ( - ("string" === typeof thenable.status - ? thenable.then(noop, noop) - : ((thenable.status = "pending"), - thenable.then( - function (fulfilledValue) { - "pending" === thenable.status && - ((thenable.status = "fulfilled"), - (thenable.value = fulfilledValue)); - }, - function (error) { - "pending" === thenable.status && - ((thenable.status = "rejected"), (thenable.reason = error)); - } - )), - thenable.status) - ) { - case "fulfilled": - return thenable.value; - case "rejected": - throw thenable.reason; - } - } - throw thenable; -} -function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { - var type = typeof children; - if ("undefined" === type || "boolean" === type) children = null; - var invokeCallback = !1; - if (null === children) invokeCallback = !0; - else - switch (type) { - case "bigint": - case "string": - case "number": - invokeCallback = !0; - break; - case "object": - switch (children.$$typeof) { - case REACT_ELEMENT_TYPE: - case REACT_PORTAL_TYPE: - invokeCallback = !0; - break; - case REACT_LAZY_TYPE: - return ( - (invokeCallback = children._init), - mapIntoArray( - invokeCallback(children._payload), - array, - escapedPrefix, - nameSoFar, - callback - ) - ); - } - } - if (invokeCallback) - return ( - (callback = callback(children)), - (invokeCallback = - "" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar), - isArrayImpl(callback) - ? ((escapedPrefix = ""), - null != invokeCallback && - (escapedPrefix = - invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), - mapIntoArray(callback, array, escapedPrefix, "", function (c) { - return c; - })) - : null != callback && - (isValidElement(callback) && - (callback = cloneAndReplaceKey( - callback, - escapedPrefix + - (null == callback.key || - (children && children.key === callback.key) - ? "" - : ("" + callback.key).replace( - userProvidedKeyEscapeRegex, - "$&/" - ) + "/") + - invokeCallback - )), - array.push(callback)), - 1 - ); - invokeCallback = 0; - var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":"; - if (isArrayImpl(children)) - for (var i = 0; i < children.length; i++) - (nameSoFar = children[i]), - (type = nextNamePrefix + getElementKey(nameSoFar, i)), - (invokeCallback += mapIntoArray( - nameSoFar, - array, - escapedPrefix, - type, - callback - )); - else if (((i = getIteratorFn(children)), "function" === typeof i)) - for ( - children = i.call(children), i = 0; - !(nameSoFar = children.next()).done; - - ) - (nameSoFar = nameSoFar.value), - (type = nextNamePrefix + getElementKey(nameSoFar, i++)), - (invokeCallback += mapIntoArray( - nameSoFar, - array, - escapedPrefix, - type, - callback - )); - else if ("object" === type) { - if ("function" === typeof children.then) - return mapIntoArray( - resolveThenable(children), - array, - escapedPrefix, - nameSoFar, - callback - ); - array = String(children); - throw Error( - "Objects are not valid as a React child (found: " + - ("[object Object]" === array - ? "object with keys {" + Object.keys(children).join(", ") + "}" - : array) + - "). If you meant to render a collection of children, use an array instead." - ); - } - return invokeCallback; -} -function mapChildren(children, func, context) { - if (null == children) return children; - var result = [], - count = 0; - mapIntoArray(children, result, "", "", function (child) { - return func.call(context, child, count++); - }); - return result; -} -function lazyInitializer(payload) { - if (-1 === payload._status) { - var ctor = payload._result, - thenable = ctor(); - thenable.then( - function (moduleObject) { - if (0 === payload._status || -1 === payload._status) - (payload._status = 1), - (payload._result = moduleObject), - void 0 === thenable.status && - ((thenable.status = "fulfilled"), - (thenable.value = moduleObject)); - }, - function (error) { - if (0 === payload._status || -1 === payload._status) - (payload._status = 2), - (payload._result = error), - void 0 === thenable.status && - ((thenable.status = "rejected"), (thenable.reason = error)); - } - ); - -1 === payload._status && - ((payload._status = 0), (payload._result = thenable)); - } - if (1 === payload._status) return payload._result.default; - throw payload._result; -} -var reportGlobalError = - "function" === typeof reportError - ? reportError - : function (error) { - if ( - "object" === typeof window && - "function" === typeof window.ErrorEvent - ) { - var event = new window.ErrorEvent("error", { - bubbles: !0, - cancelable: !0, - message: - "object" === typeof error && - null !== error && - "string" === typeof error.message - ? String(error.message) - : String(error), - error: error - }); - if (!window.dispatchEvent(event)) return; - } else if ( - "object" === typeof process && - "function" === typeof process.emit - ) { - process.emit("uncaughtException", error); - return; - } - console.error(error); - }; -function startTransition(scope) { - var prevTransition = ReactSharedInternals.T, - currentTransition = {}; - currentTransition.types = - null !== prevTransition ? prevTransition.types : null; - ReactSharedInternals.T = currentTransition; - try { - var returnValue = scope(), - onStartTransitionFinish = ReactSharedInternals.S; - null !== onStartTransitionFinish && - onStartTransitionFinish(currentTransition, returnValue); - "object" === typeof returnValue && - null !== returnValue && - "function" === typeof returnValue.then && - returnValue.then(noop, reportGlobalError); - } catch (error) { - reportGlobalError(error); - } finally { - null !== prevTransition && - null !== currentTransition.types && - (prevTransition.types = currentTransition.types), - (ReactSharedInternals.T = prevTransition); - } -} -function addTransitionType(type) { - var transition = ReactSharedInternals.T; - if (null !== transition) { - var transitionTypes = transition.types; - null === transitionTypes - ? (transition.types = [type]) - : -1 === transitionTypes.indexOf(type) && transitionTypes.push(type); - } else startTransition(addTransitionType.bind(null, type)); -} -var Children = { - map: mapChildren, - forEach: function (children, forEachFunc, forEachContext) { - mapChildren( - children, - function () { - forEachFunc.apply(this, arguments); - }, - forEachContext - ); - }, - count: function (children) { - var n = 0; - mapChildren(children, function () { - n++; - }); - return n; - }, - toArray: function (children) { - return ( - mapChildren(children, function (child) { - return child; - }) || [] - ); - }, - only: function (children) { - if (!isValidElement(children)) - throw Error( - "React.Children.only expected to receive a single React element child." - ); - return children; - } -}; -__rspack_unused_export = REACT_ACTIVITY_TYPE; -__rspack_unused_export = Children; -__rspack_unused_export = Component; -__rspack_unused_export = REACT_FRAGMENT_TYPE; -__rspack_unused_export = REACT_PROFILER_TYPE; -__rspack_unused_export = PureComponent; -__rspack_unused_export = REACT_STRICT_MODE_TYPE; -__rspack_unused_export = REACT_SUSPENSE_TYPE; -__rspack_unused_export = REACT_VIEW_TRANSITION_TYPE; -__rspack_unused_export = - ReactSharedInternals; -__rspack_unused_export = { - __proto__: null, - c: function (size) { - return ReactSharedInternals.H.useMemoCache(size); - } -}; -__rspack_unused_export = addTransitionType; -__rspack_unused_export = function (fn) { - return function () { - return fn.apply(null, arguments); - }; -}; -__rspack_unused_export = function () { - return null; -}; -__rspack_unused_export = function (element, config, children) { - if (null === element || void 0 === element) - throw Error( - "The argument must be a React element, but you passed " + element + "." - ); - var props = assign({}, element.props), - key = element.key; - if (null != config) - for (propName in (void 0 !== config.key && (key = "" + config.key), config)) - !hasOwnProperty.call(config, propName) || - "key" === propName || - "__self" === propName || - "__source" === propName || - ("ref" === propName && void 0 === config.ref) || - (props[propName] = config[propName]); - var propName = arguments.length - 2; - if (1 === propName) props.children = children; - else if (1 < propName) { - for (var childArray = Array(propName), i = 0; i < propName; i++) - childArray[i] = arguments[i + 2]; - props.children = childArray; - } - return ReactElement(element.type, key, props); -}; -__rspack_unused_export = function (defaultValue) { - defaultValue = { - $$typeof: REACT_CONTEXT_TYPE, - _currentValue: defaultValue, - _currentValue2: defaultValue, - _threadCount: 0, - Provider: null, - Consumer: null - }; - defaultValue.Provider = defaultValue; - defaultValue.Consumer = { - $$typeof: REACT_CONSUMER_TYPE, - _context: defaultValue - }; - return defaultValue; -}; -__rspack_unused_export = function (type, config, children) { - var propName, - props = {}, - key = null; - if (null != config) - for (propName in (void 0 !== config.key && (key = "" + config.key), config)) - hasOwnProperty.call(config, propName) && - "key" !== propName && - "__self" !== propName && - "__source" !== propName && - (props[propName] = config[propName]); - var childrenLength = arguments.length - 2; - if (1 === childrenLength) props.children = children; - else if (1 < childrenLength) { - for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++) - childArray[i] = arguments[i + 2]; - props.children = childArray; - } - if (type && type.defaultProps) - for (propName in ((childrenLength = type.defaultProps), childrenLength)) - void 0 === props[propName] && - (props[propName] = childrenLength[propName]); - return ReactElement(type, key, props); -}; -__rspack_unused_export = function () { - return { current: null }; -}; -__rspack_unused_export = function (render) { - return { $$typeof: REACT_FORWARD_REF_TYPE, render: render }; -}; -__rspack_unused_export = isValidElement; -__rspack_unused_export = function (ctor) { - return { - $$typeof: REACT_LAZY_TYPE, - _payload: { _status: -1, _result: ctor }, - _init: lazyInitializer - }; -}; -__rspack_unused_export = function (type, compare) { - return { - $$typeof: REACT_MEMO_TYPE, - type: type, - compare: void 0 === compare ? null : compare - }; -}; -__rspack_unused_export = startTransition; -__rspack_unused_export = function () { - return ReactSharedInternals.H.useCacheRefresh(); -}; -__rspack_unused_export = function (usable) { - return ReactSharedInternals.H.use(usable); -}; -__rspack_unused_export = function (action, initialState, permalink) { - return ReactSharedInternals.H.useActionState(action, initialState, permalink); -}; -__rspack_unused_export = function (callback, deps) { - return ReactSharedInternals.H.useCallback(callback, deps); -}; -__rspack_unused_export = function (Context) { - return ReactSharedInternals.H.useContext(Context); -}; -__rspack_unused_export = function () {}; -__rspack_unused_export = function (value, initialValue) { - return ReactSharedInternals.H.useDeferredValue(value, initialValue); -}; -__rspack_unused_export = function (create, deps) { - return ReactSharedInternals.H.useEffect(create, deps); -}; -__rspack_unused_export = function (callback) { - return ReactSharedInternals.H.useEffectEvent(callback); -}; -__rspack_unused_export = function () { - return ReactSharedInternals.H.useId(); -}; -__rspack_unused_export = function (ref, create, deps) { - return ReactSharedInternals.H.useImperativeHandle(ref, create, deps); -}; -__rspack_unused_export = function (create, deps) { - return ReactSharedInternals.H.useInsertionEffect(create, deps); -}; -__rspack_unused_export = function (create, deps) { - return ReactSharedInternals.H.useLayoutEffect(create, deps); -}; -__rspack_unused_export = function (create, deps) { - return ReactSharedInternals.H.useMemo(create, deps); -}; -__rspack_unused_export = function (passthrough, reducer) { - return ReactSharedInternals.H.useOptimistic(passthrough, reducer); -}; -__rspack_unused_export = function (reducer, initialArg, init) { - return ReactSharedInternals.H.useReducer(reducer, initialArg, init); -}; -__rspack_unused_export = function (initialValue) { - return ReactSharedInternals.H.useRef(initialValue); -}; -__rspack_unused_export = function (initialState) { - return ReactSharedInternals.H.useState(initialState); -}; -__rspack_unused_export = function ( - subscribe, - getSnapshot, - getServerSnapshot -) { - return ReactSharedInternals.H.useSyncExternalStore( - subscribe, - getSnapshot, - getServerSnapshot - ); -}; -__rspack_unused_export = function () { - return ReactSharedInternals.H.useTransition(); -}; -__rspack_unused_export = "19.3.0"; - - -}, -"./node_modules/react/index.js"(module, __unused_rspack_exports, __webpack_require__) { - - -if (process.env.NODE_ENV === 'production') { - /* unused reexport */ __webpack_require__("./node_modules/react/cjs/react.production.js"); -} else { - /* unused reexport */ __webpack_require__("./node_modules/react/cjs/react.development.js"); -} - - -}, "./src/scripts/gbot-relay.ts"(module, __unused_rspack___webpack_exports__, __webpack_require__) { __webpack_require__.a(module, async function (__rspack_load_async_deps, __rspack_async_done) { try { /* import */ var _core_relay_worker_js__rspack_import_0 = __webpack_require__("./src/core/relay/worker.js"); @@ -2298,28 +382,7 @@ __webpack_require__.d(__webpack_exports__, { }, "./node_modules/@agent-bundle/runtime/dist/302.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) { /* import */ var node_buffer__rspack_import_0 = __webpack_require__("node:buffer"); -/* import */ var react__rspack_import_1 = __webpack_require__("./node_modules/react/index.js"); - -const isServerComponent = (value)=>'function' == typeof value; -const asMcpElement = (node)=>{ - let element = node; - while(isValidElement(element) && isServerComponent(element.type))element = element.type(element.props); - if (!isValidElement(element) || 'string' != typeof element.type || !element.type.startsWith('mcp-')) throw new Error('Expected an MCP result element'); - return { - props: element.props, - type: element.type - }; -}; -const requiredString = (value, message)=>{ - if ('string' != typeof value || '' === value.trim()) throw new Error(message); - return value; -}; -const textChild = (children, message)=>{ - const values = Children.toArray(children); - if (1 !== values.length || 'string' != typeof values[0]) throw new Error(message); - return values[0]; -}; const jsonLeafBytes = (value)=>Buffer.byteLength(JSON.stringify(value), 'utf8'); const isArrayIndex = (key, length)=>{ if ('0' === key) return length > 0; @@ -2381,16 +444,6 @@ const cloneJsonValue = (value, ancestors, path, depth = 0, budget)=>{ ancestors.delete(value); } }; -const jsonRecord = (value, message)=>{ - try { - if (null === value || 'object' != typeof value || Array.isArray(value)) throw new Error('not a plain object'); - return cloneJsonValue(value, new Set(), ''); - } catch (error) { - throw new Error(`${message} (${error instanceof Error ? error.message : String(error)})`, { - cause: error - }); - } -}; const deepFreezeJson = (value)=>{ if ('object' == typeof value && null !== value) { for (const child of Object.values(value))deepFreezeJson(child); @@ -2408,89 +461,6 @@ const snapshotJsonValue = (value, message, budget)=>{ }); } }; -const lowerContent = (node)=>{ - const element = asMcpElement(node); - const { props } = element; - switch(element.type){ - case 'mcp-text': - return { - text: textChild(props.children, 'mcp-text requires one text child'), - type: 'text' - }; - case 'mcp-image': - return { - data: requiredString(props.data, 'mcp-image requires non-empty data and mimeType'), - mimeType: requiredString(props.mimeType, 'mcp-image requires non-empty data and mimeType'), - type: 'image' - }; - case 'mcp-audio': - return { - data: requiredString(props.data, 'mcp-audio requires non-empty data and mimeType'), - mimeType: requiredString(props.mimeType, 'mcp-audio requires non-empty data and mimeType'), - type: 'audio' - }; - case 'mcp-resource-link': - { - const mimeType = props.mimeType; - if (void 0 !== mimeType && 'string' != typeof mimeType) throw new Error('mcp-resource-link mimeType must be a string'); - return { - ...void 0 === mimeType ? {} : { - mimeType - }, - name: requiredString(props.name, 'mcp-resource-link requires non-empty uri and name'), - type: 'resource_link', - uri: requiredString(props.uri, 'mcp-resource-link requires non-empty uri and name') - }; - } - case 'mcp-embedded-resource': - { - const hasText = void 0 !== props.text; - const hasTextChild = void 0 !== props.children; - const hasBlob = void 0 !== props.blob; - if (Number(hasText) + Number(hasTextChild) + Number(hasBlob) !== 1) throw new Error('mcp-embedded-resource accepts exactly one text or blob value'); - const mimeType = props.mimeType; - if (void 0 !== mimeType && 'string' != typeof mimeType) throw new Error('mcp-embedded-resource mimeType must be a string'); - const resource = { - ...void 0 === mimeType ? {} : { - mimeType - }, - uri: requiredString(props.uri, 'mcp-embedded-resource requires a non-empty uri'), - ...hasBlob ? { - blob: requiredString(props.blob, 'mcp-embedded-resource blob must be non-empty') - } : { - text: hasTextChild ? textChild(props.children, 'mcp-embedded-resource requires one text child') : requiredString(props.text, 'mcp-embedded-resource text must be non-empty') - } - }; - return { - resource, - type: 'resource' - }; - } - case 'mcp-result': - throw new Error('mcp-result may not be nested'); - default: - throw new Error(`Unsupported MCP result element: ${element.type}`); - } -}; -const lowerMcpResult = (node)=>{ - const root = asMcpElement(node); - if ('mcp-result' !== root.type) throw new Error('Expected mcp-result as the root element'); - if (void 0 !== root.props.isError && 'boolean' != typeof root.props.isError) throw new Error('mcp-result isError must be a boolean'); - const structuredContent = root.props.structuredContent; - const metadata = root.props._meta; - return { - content: Children.toArray(root.props.children).map(lowerContent), - ...void 0 === metadata ? {} : { - _meta: jsonRecord(metadata, 'mcp-result _meta must be JSON-serializable') - }, - ...void 0 === structuredContent ? {} : { - structuredContent: jsonRecord(structuredContent, 'mcp-result structuredContent must be JSON-serializable') - }, - ...void 0 === root.props.isError ? {} : { - isError: root.props.isError - } - }; -}; const AGENT_DOCUMENT_VERSION = 1; const agentRenderAbortError = ()=>new DOMException('Agent render was aborted', 'AbortError'); const DEFAULT_AGENT_RENDER_LIMITS = Object.freeze({ @@ -2518,7 +488,7 @@ const resolveAgentRenderLimits = (overrides = {})=>{ for (const [name, value] of Object.entries(limits))if (!Number.isSafeInteger(value) || value <= 0) throw new AgentContractError('invalid-document', `${name} must be a positive safe integer`); return Object.freeze(limits); }; -const agent_document_requiredString = (value, field)=>{ +const requiredString = (value, field)=>{ if ('string' != typeof value || '' === value.trim()) throw new AgentContractError('invalid-document', `${field} must be a non-empty string`); return value; }; @@ -2526,7 +496,7 @@ const agent_document_text = (value, field)=>{ if ('string' != typeof value) throw new AgentContractError('invalid-document', `${field} must be a string`); return value; }; -const optionalString = (value, field)=>void 0 === value ? void 0 : agent_document_requiredString(value, field); +const optionalString = (value, field)=>void 0 === value ? void 0 : requiredString(value, field); const elapsedTimeExceeded = (maxElapsedMs)=>new AgentContractError('elapsed-time-exceeded', `Agent render elapsed time exceeds ${String(maxElapsedMs)}ms`); const expectDocumentDepth = (depth, limits)=>{ if (depth > limits.maxDocumentDepth) throw new AgentContractError('document-depth-exceeded', `Agent Document depth exceeds ${String(limits.maxDocumentDepth)}`); @@ -2624,15 +594,15 @@ const snapshotNode = (node, depth, state)=>{ } case 'image': return Object.freeze({ - data: agent_document_requiredString(node.data, 'Agent image data'), + data: requiredString(node.data, 'Agent image data'), kind: 'image', - mimeType: agent_document_requiredString(node.mimeType, 'Agent image mimeType') + mimeType: requiredString(node.mimeType, 'Agent image mimeType') }); case 'audio': return Object.freeze({ - data: agent_document_requiredString(node.data, 'Agent audio data'), + data: requiredString(node.data, 'Agent audio data'), kind: 'audio', - mimeType: agent_document_requiredString(node.mimeType, 'Agent audio mimeType') + mimeType: requiredString(node.mimeType, 'Agent audio mimeType') }); case 'resource': { @@ -2642,13 +612,13 @@ const snapshotNode = (node, depth, state)=>{ ...void 0 === mimeType ? {} : { mimeType }, - name: agent_document_requiredString(node.name, 'Agent resource name'), - uri: agent_document_requiredString(node.uri, 'Agent resource uri') + name: requiredString(node.name, 'Agent resource name'), + uri: requiredString(node.uri, 'Agent resource uri') }); } case 'error': return Object.freeze({ - code: agent_document_requiredString(node.code, 'Agent error code'), + code: requiredString(node.code, 'Agent error code'), kind: 'error', message: agent_document_text(node.message, 'Agent error message') }); @@ -2706,7 +676,7 @@ const snapshotRenderError = (error, limits)=>{ nodes: 0 }); return Object.freeze({ - code: agent_document_requiredString(error.code, 'Agent render error code'), + code: requiredString(error.code, 'Agent render error code'), ...void 0 === data ? {} : { data }, @@ -2741,7 +711,7 @@ const snapshotEvent = (input, sequence, limits)=>{ } case 'replace': return Object.freeze({ - boundaryId: agent_document_requiredString(input.boundaryId, 'Agent render boundaryId'), + boundaryId: requiredString(input.boundaryId, 'Agent render boundaryId'), document: createAgentDocument(input.document, limits), sequence, type: 'replace' @@ -3448,6 +1418,36 @@ const READABLE_KERNEL_FORMATS = Object.freeze([ KERNEL_FORMAT, COMPACTED_KERNEL_FORMAT ]); +const TABLE_COLUMNS = Object.freeze({ + agent_state_head: [ + 'id', + 'revision NOT NULL', + 'state NOT NULL' + ], + agent_state_journal: [ + 'revision', + 'kind NOT NULL', + 'name', + 'payload', + 'state', + 'result_state NOT NULL', + 'to_version', + 'idempotency_key NOT NULL', + 'committed_at NOT NULL' + ], + agent_state_meta: [ + 'id', + 'definition_id NOT NULL', + 'schema_version NOT NULL', + 'kernel_format NOT NULL' + ], + agent_state_pruned_keys: [ + 'idempotency_key', + 'revision NOT NULL', + 'canonical_input NOT NULL' + ] +}); +const columnSignature = (column)=>0 === column.notnull ? column.name : `${column.name} NOT NULL`; const SQLITE_CORRUPT = 11; const SQLITE_NOTADB = 26; const SQLITE_BUSY = 5; @@ -3525,7 +1525,7 @@ const recordFromRow = (definitionId, row)=>{ throw new _65_js__rspack_import_6/* .AgentStateError */.nk('corrupt', `State '${definitionId}' journal row at revision ${String(row.revision)} has an invalid shape`); }; const sanitizedFileName = (definitionId)=>`${definitionId.replace(/[^a-zA-Z0-9._-]+/gu, '-')}-${(0,node_crypto__rspack_import_0.createHash)('sha256').update(definitionId, 'utf8').digest('hex').slice(0, 16)}.sqlite`; -const legacySanitizedFileName = (definitionId)=>`${definitionId.replace(/[^a-zA-Z0-9._-]+/gu, '-')}-${Buffer.from(definitionId, 'utf8').toString('hex').slice(0, 12)}.sqlite`; +const pre201FileName = (definitionId)=>`${definitionId.replace(/[^a-zA-Z0-9._-]+/gu, '-')}-${Buffer.from(definitionId, 'utf8').toString('hex').slice(0, 12)}.sqlite`; class SqliteConnection extends effect__rspack_import_9/* .Service */.kl()('@agent-bundle/runtime/state/SqliteConnection') { } class SqliteStore { @@ -3605,7 +1605,7 @@ class SqliteStore { if (void 0 !== row) return { kind: 'committed', record: recordFromRow(this.#definition.id, row), - resultStateText: row.result_state ?? row.state + resultStateText: row.result_state }; const pruned = this.#prepare(db, 'SELECT revision, canonical_input FROM agent_state_pruned_keys WHERE idempotency_key = ?').get(key); return void 0 === pruned ? void 0 : { @@ -3614,8 +1614,8 @@ class SqliteStore { revision: pruned.revision }; } - #committedState(db, committed) { - const raw = null !== committed.resultStateText ? parseStoredJson(this.#definition.id, 'result state', committed.record.revision, committed.resultStateText) : this.#replayTo(db, committed.record.revision); + #committedState(committed) { + const raw = parseStoredJson(this.#definition.id, 'result state', committed.record.revision, committed.resultStateText); const parsed = this.#definition.schema.safeParse(raw); if (!parsed.success) throw new _65_js__rspack_import_6/* .AgentStateError */.nk('corrupt', `State '${this.#definition.id}' committed result at revision ${String(committed.record.revision)} no longer satisfies the schema: ${(0,_65_js__rspack_import_6/* .describeSchemaIssues */.D2)(parsed.error)}`); return (0,_65_js__rspack_import_6/* .deepFreezeJson */.GX)(parsed.data); @@ -3696,7 +1696,7 @@ class SqliteStore { return Object.freeze({ replayed: true, revision: committed.record.revision, - state: this.#committedState(db, committed) + state: this.#committedState(committed) }); } const head = this.#headState(db, 'commit'); @@ -3873,7 +1873,7 @@ class SqliteStore { name TEXT, payload TEXT, state TEXT, - result_state TEXT, + result_state TEXT NOT NULL, to_version INTEGER, idempotency_key TEXT NOT NULL UNIQUE, committed_at TEXT NOT NULL @@ -3889,9 +1889,11 @@ class SqliteStore { canonical_input TEXT NOT NULL ); `); - const journalColumns = transactionDb.prepare('PRAGMA table_info(agent_state_journal)').all(); - if (!journalColumns.some((column)=>'result_state' === column.name)) transactionDb.exec('ALTER TABLE agent_state_journal ADD COLUMN result_state TEXT'); const definition = this.#definition; + for (const [table, columns] of Object.entries(TABLE_COLUMNS)){ + const actual = transactionDb.prepare(`PRAGMA table_info(${table})`).all().map(columnSignature); + if (actual.join(',') !== columns.join(',')) throw new _65_js__rspack_import_6/* .AgentStateError */.nk('corrupt', `State '${definition.id}' table ${table} at '${this.location}' does not match the current schema (has ${actual.join(', ')}; expected ${columns.join(', ')})`); + } const meta = transactionDb.prepare('SELECT definition_id, schema_version, kernel_format FROM agent_state_meta WHERE id = 1').get(); if (void 0 === meta) { transactionDb.prepare('INSERT INTO agent_state_meta (id, definition_id, schema_version, kernel_format) VALUES (1, ?, ?, ?)').run(definition.id, definition.version, KERNEL_FORMAT); @@ -3912,9 +1914,9 @@ class SqliteStore { if ((0,_65_js__rspack_import_6/* .canonicalJson */.dj)(replayed) !== (0,_65_js__rspack_import_6/* .canonicalJson */.dj)(rawHead)) throw new _65_js__rspack_import_6/* .AgentStateError */.nk('corrupt', `State '${definition.id}' head state at revision ${String(head.revision)} disagrees with journal replay`); return; } - const lastStateText = 0 === rows.length ? null : rows[rows.length - 1].state; - if (null !== lastStateText) { - const lastState = parseStoredJson(definition.id, 'state', journalHead, lastStateText); + const lastRow = rows[rows.length - 1]; + if (void 0 !== lastRow) { + const lastState = parseStoredJson(definition.id, 'result state', journalHead, lastRow.result_state); if ((0,_65_js__rspack_import_6/* .canonicalJson */.dj)(lastState) !== (0,_65_js__rspack_import_6/* .canonicalJson */.dj)(rawHead)) throw new _65_js__rspack_import_6/* .AgentStateError */.nk('corrupt', `State '${definition.id}' head state at revision ${String(head.revision)} disagrees with the journal`); } const migrated = (0,_158_js__rspack_import_8/* .runStateMigrations */.AC)(definition, meta.schema_version, rawHead); @@ -3922,14 +1924,8 @@ class SqliteStore { (0,_158_js__rspack_import_8/* .expectMigrationWithinStateBudget */.Lh)(definition, migratedStateText); const updateResult = transactionDb.prepare('UPDATE agent_state_journal SET result_state = ? WHERE revision = ?'); for (const row of rows){ - const storedResultText = row.result_state ?? row.state; - let migratedResult; - if (null !== storedResultText) { - const storedResult = parseStoredJson(definition.id, 'result state', row.revision, storedResultText); - migratedResult = (0,_158_js__rspack_import_8/* .runStateMigrations */.AC)(definition, meta.schema_version, storedResult); - } else if (row.revision === journalHead) migratedResult = migrated; - else throw new _65_js__rspack_import_6/* .AgentStateError */.nk('migration-failure', `State '${definition.id}' legacy journal row at revision ${String(row.revision)} has no recoverable committed result; restore a compatible backup or materialize the result with the version ${String(meta.schema_version)} definition before migrating to version ${String(definition.version)}`); - updateResult.run((0,_65_js__rspack_import_6/* .canonicalJson */.dj)(migratedResult), row.revision); + const storedResult = parseStoredJson(definition.id, 'result state', row.revision, row.result_state); + updateResult.run((0,_65_js__rspack_import_6/* .canonicalJson */.dj)((0,_158_js__rspack_import_8/* .runStateMigrations */.AC)(definition, meta.schema_version, storedResult)), row.revision); } const record = { committedAt: this.#now().toISOString(), @@ -3997,31 +1993,10 @@ const createSqliteStateDriver = (options)=>{ if (closed) throw new _65_js__rspack_import_6/* .AgentStateError */.nk('store-closed', `State '${definition.id}' cannot open on a closed driver`); if ('workspace-durable' !== definition.lifetime) throw new _65_js__rspack_import_6/* .AgentStateError */.nk('lifetime-mismatch', `State '${definition.id}' declares lifetime '${definition.lifetime}' but this driver provides 'workspace-durable'`); if (void 0 !== options.file) return (0,node_path__rspack_import_2.resolve)(options.file); - const root = options.root; - const currentFile = (0,node_path__rspack_import_2.resolve)((0,node_path__rspack_import_2.join)(root, sanitizedFileName(definition.id))); - const legacyFile = (0,node_path__rspack_import_2.resolve)((0,node_path__rspack_import_2.join)(root, legacySanitizedFileName(definition.id))); - (0,node_fs__rspack_import_1.mkdirSync)((0,node_path__rspack_import_2.dirname)(currentFile), { - recursive: true - }); - if (!(0,node_fs__rspack_import_1.existsSync)(currentFile) && (0,node_fs__rspack_import_1.existsSync)(legacyFile)) { - for (const suffix of [ - '-wal', - '-shm' - ]){ - const legacySidecar = `${legacyFile}${suffix}`; - if ((0,node_fs__rspack_import_1.existsSync)(legacySidecar)) try { - (0,node_fs__rspack_import_1.renameSync)(legacySidecar, `${currentFile}${suffix}`); - } catch (error) { - if ('ENOENT' !== error.code) throw error; - } - } - try { - (0,node_fs__rspack_import_1.renameSync)(legacyFile, currentFile); - } catch (error) { - if (!(0,node_fs__rspack_import_1.existsSync)(currentFile)) throw error; - } - } - return currentFile; + const current = (0,node_path__rspack_import_2.resolve)((0,node_path__rspack_import_2.join)(options.root, sanitizedFileName(definition.id))); + const pre201 = (0,node_path__rspack_import_2.resolve)((0,node_path__rspack_import_2.join)(options.root, pre201FileName(definition.id))); + if (!(0,node_fs__rspack_import_1.existsSync)(current) && (0,node_fs__rspack_import_1.existsSync)(pre201)) throw new _65_js__rspack_import_6/* .AgentStateError */.nk('corrupt', `State '${definition.id}' found a store at '${pre201}' under the pre-#201 file name, which this runtime no longer reads, and none at '${current}'. Move that file and its -wal/-shm sidecars out of the state root to keep a copy, or delete them; the next open then creates a fresh, empty store. It is not adopted or migrated.`); + return current; }, true)); const connection = effect__rspack_import_7/* .acquireRelease */.Q56(sqliteEffect(definition.id, 'open database', ()=>{ (0,node_fs__rspack_import_1.mkdirSync)((0,node_path__rspack_import_2.dirname)(file), { @@ -4065,16 +2040,14 @@ __webpack_require__.d(__webpack_exports__, { }, "./node_modules/effect/dist/Array.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) { -/* import */ var _Equal_js__rspack_import_6 = __webpack_require__("./node_modules/effect/dist/Equal.js"); -/* import */ var _Equivalence_js__rspack_import_9 = __webpack_require__("./node_modules/effect/dist/Equivalence.js"); -/* import */ var _Function_js__rspack_import_2 = __webpack_require__("./node_modules/effect/dist/Function.js"); -/* import */ var _Hash_js__rspack_import_5 = __webpack_require__("./node_modules/effect/dist/Hash.js"); -/* import */ var _internal_array_js__rspack_import_3 = __webpack_require__("./node_modules/effect/dist/internal/array.js"); -/* import */ var _Iterable_js__rspack_import_4 = __webpack_require__("./node_modules/effect/dist/Iterable.js"); +/* import */ var _Equivalence_js__rspack_import_7 = __webpack_require__("./node_modules/effect/dist/Equivalence.js"); +/* import */ var _Function_js__rspack_import_4 = __webpack_require__("./node_modules/effect/dist/Function.js"); +/* import */ var _internal_array_js__rspack_import_2 = __webpack_require__("./node_modules/effect/dist/internal/array.js"); +/* import */ var _Iterable_js__rspack_import_3 = __webpack_require__("./node_modules/effect/dist/Iterable.js"); /* import */ var _Option_js__rspack_import_1 = __webpack_require__("./node_modules/effect/dist/Option.js"); -/* import */ var _Order_js__rspack_import_8 = __webpack_require__("./node_modules/effect/dist/Order.js"); +/* import */ var _Order_js__rspack_import_6 = __webpack_require__("./node_modules/effect/dist/Order.js"); /* import */ var _Record_js__rspack_import_0 = __webpack_require__("./node_modules/effect/dist/Record.js"); -/* import */ var _Result_js__rspack_import_7 = __webpack_require__("./node_modules/effect/dist/Result.js"); +/* import */ var _Result_js__rspack_import_5 = __webpack_require__("./node_modules/effect/dist/Result.js"); /** * Works with JavaScript arrays, readonly arrays, and non-empty arrays. * @@ -4100,6 +2073,7 @@ __webpack_require__.d(__webpack_exports__, { + /** * Exposes the global array constructor. * @@ -4156,6 +2130,7 @@ const make = (...elements) => elements; * * **Details** * + * `n` is rounded down. `NaN` and non-positive values are treated as `0`. * Elements are typed as `A | undefined` because the slots are empty. * * **Example** (Allocating a fixed-size array) @@ -4171,7 +2146,7 @@ const make = (...elements) => elements; * @category constructors * @since 2.0.0 */ -const allocate = n => new Array(n); +const allocate = n => new Array(Count.normalize(n)); /** * Creates a `NonEmptyArray` of length `n` where element `i` is computed by `f(i)`. * @@ -4181,9 +2156,9 @@ const allocate = n => new Array(n); * * **Details** * - * `n` is normalized to an integer greater than or equal to 1, so this function - * always returns at least one element. Supports both data-first and data-last - * usage. + * `n` is rounded down and normalized to an integer greater than or equal to 1. + * `NaN` is treated as `1`, so this function always returns at least one + * element. Supports both data-first and data-last usage. * * **Example** (Generating values from indices) * @@ -4200,7 +2175,7 @@ const allocate = n => new Array(n); * @since 2.0.0 */ const makeBy = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (n, f) => { - const max = Math.max(1, Math.floor(n)); + const max = Count.normalizeNonEmpty(n); const out = new Array(max); for (let i = 0; i < max; i++) { out[i] = f(i); @@ -4576,7 +2551,7 @@ const append = /*#__PURE__*/(/* unused pure expression or super */ null && (dual * @category combining * @since 2.0.0 */ -const appendAll = /*#__PURE__*/(0,_Function_js__rspack_import_2/* .dual */.XY)(2, (self, that) => fromIterable(self).concat(fromIterable(that))); +const appendAll = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, that) => fromIterable(self).concat(fromIterable(that))))); /** * Folds left-to-right while keeping every intermediate accumulator value. * @@ -4739,7 +2714,7 @@ const isReadonlyArrayEmpty = (/* unused pure expression or super */ null && (isA * @category guards * @since 4.0.0 */ -const isArrayNonEmpty = _internal_array_js__rspack_import_3/* .isArrayNonEmpty */.C; +const isArrayNonEmpty = _internal_array_js__rspack_import_2/* .isArrayNonEmpty */.C; /** * Checks whether a `ReadonlyArray` is non-empty, narrowing the type to * `NonEmptyReadonlyArray`. @@ -4764,7 +2739,7 @@ const isArrayNonEmpty = _internal_array_js__rspack_import_3/* .isArrayNonEmpty * * @category guards * @since 4.0.0 */ -const isReadonlyArrayNonEmpty = _internal_array_js__rspack_import_3/* .isArrayNonEmpty */.C; +const isReadonlyArrayNonEmpty = _internal_array_js__rspack_import_2/* .isArrayNonEmpty */.C; /** * Returns the number of elements in a `ReadonlyArray`. * @@ -4784,11 +2759,21 @@ const isReadonlyArrayNonEmpty = _internal_array_js__rspack_import_3/* .isArrayNo * @since 2.0.0 */ const length = self => self.length; +/** + * Checks whether a string represents a JavaScript array index: a non-negative + * integer below `2 ** 32 - 1`, written without leading zeroes, a sign, or + * exponent notation. + * + * @internal + */ +function isCanonicalArrayIndex(key) { + const index = Number(key); + return String(index) === key && Number.isInteger(index) && index >= 0 && index < 2 ** 32 - 1; +} /** @internal */ function isOutOfBounds(i, as) { return !Number.isFinite(i) || i < 0 || i >= as.length; } -const clamp = (i, as) => Math.floor(Math.min(Math.max(0, i), as.length)); /** * Reads an element at the given index safely, returning `Option.some` or * `Option.none` if the index is out of bounds. @@ -5112,6 +3097,7 @@ function init(self) { * @since 2.0.0 */ const initNonEmpty = self => self.slice(0, -1); +const clampCount = (n, length) => Math.min(Count.normalize(n), length); /** * Keeps the first `n` elements, creating a new array. * @@ -5121,7 +3107,8 @@ const initNonEmpty = self => self.slice(0, -1); * * **Details** * - * `n` is clamped to `[0, length]`. Returns an empty array when `n <= 0`. + * `n` is rounded down and clamped to `[0, length]`. `NaN` is treated as `0`. + * Returns an empty array when `n <= 0`. * * **Example** (Taking from the start) * @@ -5140,7 +3127,7 @@ const initNonEmpty = self => self.slice(0, -1); */ const take = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { const input = fromIterable(self); - return input.slice(0, clamp(n, input)); + return input.slice(0, clampCount(n, input.length)); }))); /** * Keeps the last `n` elements, creating a new array. @@ -5151,7 +3138,8 @@ const take = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 * * **Details** * - * `n` is clamped to `[0, length]`. Returns an empty array when `n <= 0`. + * `n` is rounded down and clamped to `[0, length]`. `NaN` is treated as `0`. + * Returns an empty array when `n <= 0`. * * **Example** (Taking from the end) * @@ -5169,7 +3157,7 @@ const take = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 */ const takeRight = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { const input = fromIterable(self); - const i = clamp(n, input); + const i = clampCount(n, input.length); return i === 0 ? [] : input.slice(-i); }))); /** @@ -5299,8 +3287,8 @@ const span = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 * * **Details** * - * `n` is clamped to `[0, length]`. When `n <= 0`, this returns a copy of the - * full array. + * `n` is rounded down and clamped to `[0, length]`. `NaN` is treated as `0`. + * When `n <= 0`, this returns a copy of the full array. * * **Example** (Dropping from the start) * @@ -5319,7 +3307,7 @@ const span = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 */ const drop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { const input = fromIterable(self); - return input.slice(clamp(n, input), input.length); + return input.slice(clampCount(n, input.length), input.length); }))); /** * Removes the last `n` elements, creating a new array. @@ -5330,7 +3318,7 @@ const drop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 * * **Details** * - * `n` is clamped to `[0, length]`. + * `n` is rounded down and clamped to `[0, length]`. `NaN` is treated as `0`. * * **Example** (Dropping from the end) * @@ -5348,7 +3336,7 @@ const drop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 */ const dropRight = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { const input = fromIterable(self); - return input.slice(0, input.length - clamp(n, input)); + return input.slice(0, input.length - clampCount(n, input.length)); }))); /** * Drops elements from the start while the predicate holds, returning the rest. @@ -5510,7 +3498,7 @@ const findLastIndex = /*#__PURE__*/(/* unused pure expression or super */ null & * @category searching * @since 2.0.0 */ -const findFirst = _Iterable_js__rspack_import_4/* .findFirst */.i8; +const findFirst = _Iterable_js__rspack_import_3/* .findFirst */.i8; /** * Returns the first selected value together with its index, wrapped in an * `Option`. @@ -6249,8 +4237,8 @@ const chop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 * * **Details** * - * `n` can be `0`, in which case all elements are placed in the second array. - * The index is floored to an integer. + * `n` is rounded down and clamped to `[0, length]`. `NaN` is treated as `0`, + * which places all elements in the second array. * * **Example** (Splitting at an index) * @@ -6268,7 +4256,7 @@ const chop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2 */ const splitAt = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { const input = Array.from(self); - const _n = Math.floor(n); + const _n = Count.normalize(n); if (isReadonlyArrayNonEmpty(input)) { if (_n >= 1) { return splitAtNonEmpty(input, _n); @@ -6286,6 +4274,10 @@ const splitAt = /*#__PURE__*/(/* unused pure expression or super */ null && (dua * Use when downstream code requires the left side of the split to contain at * least one element. * + * **Details** + * + * `n` is rounded down and clamped to `[1, length]`. `NaN` is treated as `1`. + * * **Example** (Splitting a non-empty array) * * ```ts import.meta.vitest @@ -6300,7 +4292,7 @@ const splitAt = /*#__PURE__*/(/* unused pure expression or super */ null && (dua * @since 4.0.0 */ const splitAtNonEmpty = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { - const _n = Math.max(1, Math.floor(n)); + const _n = Count.normalizeNonEmpty(n); return _n >= self.length ? [copy(self), []] : [prepend(self.slice(1, _n), headNonEmpty(self)), self.slice(_n)]; }))); /** @@ -6312,7 +4304,8 @@ const splitAtNonEmpty = /*#__PURE__*/(/* unused pure expression or super */ null * * **Details** * - * Uses `chunksOf(ceil(length / n))` internally. The last chunk may be shorter. + * `n` is rounded down and normalized to at least `1`, with `NaN` treated as + * `1`. The last chunk may be shorter. * * **Example** (Splitting into groups) * @@ -6329,7 +4322,7 @@ const splitAtNonEmpty = /*#__PURE__*/(/* unused pure expression or super */ null */ const split = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { const input = fromIterable(self); - return chunksOf(input, Math.ceil(input.length / Math.floor(n))); + return chunksOf(input, Math.ceil(input.length / Count.normalizeNonEmpty(n))); }))); /** * Splits an iterable at the first element matching the predicate. The matching @@ -6396,7 +4389,8 @@ const copy = self => self.slice(); * * **Details** * - * Returns an empty array when `n <= 0`. + * `n` is rounded down. `NaN` and non-positive values are treated as `0`, which + * returns an empty array. * * **Example** (Padding an array) * @@ -6413,10 +4407,11 @@ const copy = self => self.slice(); * @since 3.8.4 */ const pad = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, (self, n, fill) => { - if (self.length >= n) { - return take(self, n); + const length = Count.normalize(n); + if (self.length >= length) { + return take(self, length); } - return appendAll(self, makeBy(n - self.length, () => fill)); + return appendAll(self, makeBy(length - self.length, () => fill)); }))); /** * Splits an iterable into chunks of length `n`. The last chunk may be shorter @@ -6429,8 +4424,10 @@ const pad = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(3, * * **Details** * - * `chunksOf(n)([])` is `[]`, not `[[]]`. Each chunk is a `NonEmptyArray`, and - * the outer return type preserves `NonEmptyArray`. + * `n` is rounded down and normalized to at least `1`; `NaN` and non-positive + * values therefore produce singleton chunks. `chunksOf(n)([])` is `[]`, not + * `[[]]`. Each chunk is a `NonEmptyArray`, and the outer return type preserves + * `NonEmptyArray`. * * **Example** (Chunking an array) * @@ -6462,8 +4459,9 @@ const chunksOf = /*#__PURE__*/(/* unused pure expression or super */ null && (du * * **Details** * - * Returns an empty array if `n <= 0` or the array has fewer than `n` elements. - * Each window is a tuple of exactly `n` elements. + * `n` is rounded down, with `NaN` and non-positive values treated as `0`. + * Returns an empty array if the normalized size is `0` or exceeds the array + * length. Each window is a tuple of exactly the normalized size. * * **Example** (Creating sliding windows) * @@ -6483,10 +4481,11 @@ const chunksOf = /*#__PURE__*/(/* unused pure expression or super */ null && (du */ const window = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { const input = fromIterable(self); - if (n > 0 && isReadonlyArrayNonEmpty(input)) { + const size = Count.normalize(n); + if (size > 0 && size <= input.length && isReadonlyArrayNonEmpty(input)) { return Array.from({ - length: input.length - (n - 1) - }, (_, index) => input.slice(index, index + n)); + length: input.length - (size - 1) + }, (_, index) => input.slice(index, index + size)); } return []; }))); @@ -6614,7 +4613,7 @@ const groupBy = /*#__PURE__*/(/* unused pure expression or super */ null && (dua return out; }))); const hashBucketsAdd = (buckets, value) => { - const hash = _Hash_js__rspack_import_5/* .hash */.tW(value); + const hash = Hash.hash(value); const bucket = buckets.get(hash); if (bucket === undefined) { buckets.set(hash, [value]); @@ -6622,7 +4621,7 @@ const hashBucketsAdd = (buckets, value) => { } // Hash collisions still require an Effect equality check. for (const previous of bucket) { - if (_Equal_js__rspack_import_6/* .equals */.aI(previous, value)) { + if (Equal.equals(previous, value)) { return false; } } @@ -6703,14 +4702,14 @@ const unionWith = /*#__PURE__*/(/* unused pure expression or super */ null && (d * @category set operations * @since 2.0.0 */ -const union = /*#__PURE__*/(0,_Function_js__rspack_import_2/* .dual */.XY)(2, (self, that) => { +const union = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, that) => { const a = fromIterable(self); const b = fromIterable(that); if (isReadonlyArrayNonEmpty(a)) { return isReadonlyArrayNonEmpty(b) ? dedupe(appendAll(a, b)) : a; } return b; -}); +}))); /** * Computes the intersection of two arrays using a custom equivalence. Order is * determined by the first array. @@ -7172,13 +5171,13 @@ const filter = /*#__PURE__*/(/* unused pure expression or super */ null && (dual * @category filtering * @since 2.0.0 */ -const partition = /*#__PURE__*/(0,_Function_js__rspack_import_2/* .dual */.XY)(2, (self, f) => { +const partition = /*#__PURE__*/(0,_Function_js__rspack_import_4/* .dual */.XY)(2, (self, f) => { const excluded = []; const satisfying = []; let i = 0; for (const a of self) { const result = f(a, i++); - if (_Result_js__rspack_import_7/* .isSuccess */.oJ(result)) { + if (_Result_js__rspack_import_5/* .isSuccess */.oJ(result)) { satisfying.push(result.success); } else { excluded.push(result.failure); @@ -7588,7 +5587,7 @@ const unfold = (b, f) => { * @category instances * @since 4.0.0 */ -const makeOrder = _Order_js__rspack_import_8/* .Array */.O3; +const makeOrder = _Order_js__rspack_import_6/* .Array */.O3; /** * Creates an `Equivalence` for arrays based on an element `Equivalence`. Two * arrays are equivalent when they have the same length and all elements are @@ -7609,7 +5608,7 @@ const makeOrder = _Order_js__rspack_import_8/* .Array */.O3; * @category instances * @since 4.0.0 */ -const makeEquivalence = _Equivalence_js__rspack_import_9/* .Array */.O3; +const makeEquivalence = _Equivalence_js__rspack_import_7/* .Array */.O3; /** * Runs a side-effect for each element. The callback receives `(element, index)`. * @@ -8050,7 +6049,6 @@ __webpack_require__.d(__webpack_exports__, { }, { CZ: isArrayNonEmpty, Ie: empty, - KC: union, Ts: fromIterable, jB: partition }); @@ -9702,7 +7700,7 @@ const Service = function () { }; const ServiceProto = { [ServiceTypeId]: ServiceTypeId, - ... /*#__PURE__*/_Effectable_js__rspack_import_0/* .Prototype */.b({ + ... /*#__PURE__*/_Effectable_js__rspack_import_0/* .Prototype */.bp({ label: "Service", evaluate(fiber) { return (0,_internal_core_js__rspack_import_1/* .exitSucceed */.xt)(get(fiber.context, this)); @@ -10504,6 +8502,11 @@ const DeferredProto = { return (0,_Pipeable_js__rspack_import_1/* .pipeArguments */.tT)(this, arguments); } }; +const DeferredImpl = function () { + this.resumes = undefined; + this.effect = undefined; +}; +DeferredImpl.prototype = DeferredProto; /** * Creates an empty `Deferred` synchronously outside the `Effect` runtime. * @@ -10524,12 +8527,7 @@ const DeferredProto = { * @category unsafe * @since 4.0.0 */ -const makeUnsafe = () => { - const self = Object.create(DeferredProto); - self.resumes = undefined; - self.effect = undefined; - return self; -}; +const makeUnsafe = () => new DeferredImpl(); /** * Creates a new `Deferred`. * @@ -11205,15 +9203,15 @@ __webpack_require__.d(__webpack_exports__, { -const TypeId = "~effect/time/Duration"; +const TypeId = "~effect/Duration"; const bigint0 = /*#__PURE__*/BigInt(0); const bigint1 = /*#__PURE__*/BigInt(1); const bigint2 = /*#__PURE__*/BigInt(2); const bigint10 = /*#__PURE__*/BigInt(10); -const bigint24 = /*#__PURE__*/(/* unused pure expression or super */ null && (BigInt(24))); -const bigint60 = /*#__PURE__*/(/* unused pure expression or super */ null && (BigInt(60))); +const bigint24 = /*#__PURE__*/BigInt(24); +const bigint60 = /*#__PURE__*/BigInt(60); const bigint1e3 = /*#__PURE__*/BigInt(1_000); -const bigint1e6 = /*#__PURE__*/(/* unused pure expression or super */ null && (BigInt(1_000_000))); +const bigint1e6 = /*#__PURE__*/BigInt(1_000_000); const bigint1e9 = /*#__PURE__*/(/* unused pure expression or super */ null && (BigInt(1_000_000_000))); const roundTiesAwayFromZero = input => BigInt(input < 0 ? Math.ceil(input - 0.5) : Math.floor(input + 0.5)); const roundMillisToNanos = millis => roundTiesAwayFromZero(millis * 1_000_000); @@ -12650,7 +10648,7 @@ const CombinerMin = /*#__PURE__*/(/* unused pure expression or super */ null && //# sourceMappingURL=Duration.js.map __webpack_require__.d(__webpack_exports__, { }, { - Tn: infinity, + GP: format, bN: fromInputUnsafe, cF: nanos, kE: toMillis, @@ -12813,7 +10811,7 @@ const isEffect = _internal_core_js__rspack_import_0/* .isEffect */.yw; * ``` * * @see {@link forEach} for iterating over elements and applying an effect. - * @category combining + * @category collecting * @since 2.0.0 */ const all = _internal_effect_js__rspack_import_1/* .all */.Q7R; @@ -12841,7 +10839,7 @@ const all = _internal_effect_js__rspack_import_1/* .all */.Q7R; * await Effect.runPromise(program) // => [['0 is even', '2 is even'], [1, 3]] * ``` * - * @category filtering + * @category collecting * @since 2.0.0 */ const partition = _internal_effect_js__rspack_import_1/* .partition */.jBG; @@ -12879,7 +10877,7 @@ const partition = _internal_effect_js__rspack_import_1/* .partition */.jBG; * output // => ["Adding 1 at index 0", "Adding 2 at index 1", "Adding 3 at index 2", 6] * ``` * - * @category folding + * @category collecting * @since 2.0.0 */ const reduce = _internal_effect_js__rspack_import_1/* .reduce */.TSs; @@ -12907,7 +10905,7 @@ const reduce = _internal_effect_js__rspack_import_1/* .reduce */.TSs; * await Effect.runPromiseExit(program) // => Exit.fail(["0 is even", "2 is even"]) * ``` * - * @category validation + * @category collecting * @since 2.0.0 */ const validate = _internal_effect_js__rspack_import_1/* .validate */.tfT; @@ -12929,7 +10927,7 @@ const validate = _internal_effect_js__rspack_import_1/* .validate */.tfT; * await Effect.runPromise(program) // => Option.some(3) * ``` * - * @category searching + * @category collecting * @since 2.0.0 */ const findFirst = _internal_effect_js__rspack_import_1/* .findFirst */.i8i; @@ -12948,7 +10946,7 @@ const findFirst = _internal_effect_js__rspack_import_1/* .findFirst */.i8i; * * @see {@link findFirst} for the simpler effectful predicate-based variant * - * @category searching + * @category collecting * @since 4.0.0 */ const findFirstFilter = _internal_effect_js__rspack_import_1/* .findFirstFilter */.kAe; @@ -13013,7 +11011,7 @@ const findFirstFilter = _internal_effect_js__rspack_import_1/* .findFirstFilter * ``` * * @see {@link all} for combining multiple effects into one. - * @category sequencing + * @category collecting * @since 2.0.0 */ const forEach = _internal_effect_js__rspack_import_1/* .forEach */.jJl; @@ -13038,7 +11036,7 @@ const forEach = _internal_effect_js__rspack_import_1/* .forEach */.jJl; * await Effect.runPromise(empty) // => Option.none() * ``` * - * @category getters + * @category collecting * @since 2.0.0 */ const head = _internal_effect_js__rspack_import_1/* .head */.d5f; @@ -13449,7 +11447,7 @@ const never = _internal_effect_js__rspack_import_1/* .never */.ZmZ; * Effect.runSync(program) // => { x: 2, y: 3, sum: 5 } * ``` * - * @category constructors + * @category do notation * @since 2.0.0 */ const Do = _internal_effect_js__rspack_import_1.Do; @@ -13465,7 +11463,7 @@ const Do = _internal_effect_js__rspack_import_1.Do; * @see {@link Do} for starting from an empty accumulated record * @see {@link bind} for adding fields produced by effects * - * @category mapping + * @category do notation * @since 2.0.0 */ const bindTo = _internal_effect_js__rspack_import_1/* .bindTo */.JrD; @@ -13495,7 +11493,7 @@ const let_ = _internal_effect_js__rspack_import_1/* ["let"] */.uVU; * @see {@link bindTo} for naming the success value of an existing effect * @see {@link gen} for generator-based sequencing without accumulating a record * - * @category sequencing + * @category do notation * @since 2.0.0 */ const bind = _internal_effect_js__rspack_import_1/* .bind */.oIE; @@ -13772,6 +11770,23 @@ const yieldNowWith = _internal_effect_js__rspack_import_1/* .yieldNowWith */.KN3 * @since 4.0.0 */ const withFiber = _internal_core_js__rspack_import_0/* .withFiber */.R6; +/** + * Accesses the current fiber to compute a successful value. + * + * **Example** (Computing a value from the current fiber) + * + * ```ts import.meta.vitest + * import { Effect } from "effect" + * + * const program = Effect.withFiberSucceed((fiber) => typeof fiber.id) + * + * Effect.runSync(program) // => "number" + * ``` + * + * @category constructors + * @since 4.0.0 + */ +const withFiberSucceed = _internal_core_js__rspack_import_0/* .withFiberSucceed */.Hq; // ----------------------------------------------------------------------------- // Conversions // ----------------------------------------------------------------------------- @@ -15149,7 +13164,7 @@ const orDie = _internal_effect_js__rspack_import_1/* .orDie */.QgK; * output // => ["expected error: NetworkError", Exit.fail("NetworkError")] * ``` * - * @category sequencing + * @category error handling * @since 2.0.0 */ const tapError = _internal_effect_js__rspack_import_1/* .tapError */.sFT; @@ -15187,7 +13202,7 @@ const tapError = _internal_effect_js__rspack_import_1/* .tapError */.sFT; * output // => ["expected error: 504", Exit.fail(new NetworkError({ statusCode: 504 }))] * ``` * - * @category sequencing + * @category error handling * @since 2.0.0 */ const tapErrorTag = _internal_effect_js__rspack_import_1/* .tapErrorTag */.k$L; @@ -15223,7 +13238,7 @@ const tapErrorTag = _internal_effect_js__rspack_import_1/* .tapErrorTag */.k$L; * output // => ["Logging cause: Something went wrong", Exit.fail("Something went wrong")] * ``` * - * @category sequencing + * @category error handling * @since 4.0.0 */ const tapCause = _internal_effect_js__rspack_import_1/* .tapCause */.dGm; @@ -15255,7 +13270,7 @@ const tapCause = _internal_effect_js__rspack_import_1/* .tapCause */.dGm; * output // => ["Logging failure cause: Network timeout", Exit.fail("Network timeout")] * ``` * - * @category sequencing + * @category error handling * @since 4.0.0 */ const tapCauseIf = _internal_effect_js__rspack_import_1/* .tapCauseIf */.cA6; @@ -15278,7 +13293,7 @@ const tapCauseIf = _internal_effect_js__rspack_import_1/* .tapCauseIf */.cA6; * @see {@link tapCause} for observing every failure cause * @see {@link catchCauseFilter} for recovering from selected causes instead of only observing them * - * @category sequencing + * @category error handling * @since 4.0.0 */ const tapCauseFilter = _internal_effect_js__rspack_import_1/* .tapCauseFilter */.bKC; @@ -15313,7 +13328,7 @@ const tapCauseFilter = _internal_effect_js__rspack_import_1/* .tapCauseFilter */ * output // => ["defect: Something went wrong", Exit.die("Something went wrong")] * ``` * - * @category sequencing + * @category error handling * @since 2.0.0 */ const tapDefect = _internal_effect_js__rspack_import_1/* .tapDefect */.nAi; @@ -15654,8 +13669,9 @@ const withErrorReporting = _internal_effect_js__rspack_import_1/* .withErrorRepo * **Details** * * If the source effect succeeds, its value is preserved. If it fails in the - * error channel, `orElseSucceed` evaluates the fallback and succeeds with that - * value, removing the typed error from the returned effect. + * error channel, `orElseSucceed` evaluates the fallback with that error and + * succeeds with the returned value, removing the typed error from the returned + * effect. * * Defects and interruptions are not recovered by this operator. * @@ -15674,9 +13690,9 @@ const withErrorReporting = _internal_effect_js__rspack_import_1/* .withErrorRepo * } * } * - * const program = Effect.orElseSucceed(validate(-1), () => 18) + * const program = Effect.orElseSucceed(validate(-1), (error) => error === "IllegalAgeError" ? 18 : 0) * - * Effect.runSyncExit(program) // => Exit.succeed(18) + * Effect.runSyncExit(program) // => Exit.succeed(0) * ``` * * @category error handling @@ -15800,21 +13816,8 @@ const timeout = _internal_effect_js__rspack_import_1/* .timeout */.wRz; */ const timeoutOption = _internal_effect_js__rspack_import_1/* .timeoutOption */.D52; /** - * Applies a timeout to an effect, with a fallback effect executed if the timeout is reached. - * - * **When to use** - * - * Use when a timeout of an `Effect` should switch to a fallback effect. - * - * **Details** - * - * The fallback effect is created lazily by `orElse` and may introduce its own - * success, failure, and requirement types. - * - * **Gotchas** - * - * If the timeout wins, the source effect is interrupted before the fallback is - * run. + * Applies a timeout to an effect, lazily evaluating `orElse` after interrupting + * the source if the timeout is reached. * * **Example** (Falling back on timeout) * @@ -16062,7 +14065,7 @@ const raceFirst = _internal_effect_js__rspack_import_1/* .raceFirst */.KT6; * output // => [[2, 4], [2, 3]] * ``` * - * @category filtering + * @category collecting * @since 2.0.0 */ const filter = _internal_effect_js__rspack_import_1/* .filter */.pbD; @@ -16082,7 +14085,7 @@ const filter = _internal_effect_js__rspack_import_1/* .filter */.pbD; * @see {@link filter} for keeping original elements with a boolean predicate, refinement, or effectful predicate * @see {@link filterMapEffect} for using an effectful `Filter` * - * @category filtering + * @category collecting * @since 2.0.0 */ const filterMap = _internal_effect_js__rspack_import_1/* .filterMap */.x1Q; @@ -16107,7 +14110,7 @@ const filterMap = _internal_effect_js__rspack_import_1/* .filterMap */.x1Q; * @see {@link filterMap} for using a synchronous `Filter` * @see {@link filter} for keeping original elements with a predicate * - * @category filtering + * @category collecting * @since 4.0.0 */ const filterMapEffect = _internal_effect_js__rspack_import_1/* .filterMapEffect */.E8K; @@ -17648,6 +15651,8 @@ const onExitPrimitive = _internal_effect_js__rspack_import_1/* .onExitPrimitive * Ensures that a cleanup function runs whether this effect succeeds, fails, or * is interrupted. * + * **Details** + * * If both the effect and the cleanup function fail, the two causes are merged. * * **Example** (Observing every exit) @@ -17777,8 +15782,8 @@ const onExitFilter = _internal_effect_js__rspack_import_1/* .onExitFilter */.uRq */ const cached = _internal_effect_js__rspack_import_1/* .cached */.PO3; /** - * Returns an effect that caches its result for a specified `Duration`, - * known as "timeToLive" (TTL). + * Returns an effect that caches its result for a fixed duration or a duration + * computed from its `Exit`, known as "timeToLive" (TTL). * * **When to use** * @@ -17797,6 +15802,17 @@ const cached = _internal_effect_js__rspack_import_1/* .cached */.PO3; * After the specified duration has passed, the cache expires, and the effect * will be recomputed upon the next evaluation. * + * `timeToLive` accepts a `Duration.Input` or a function from `Exit` to + * `Duration.Input`. The function runs once after each fresh computation, + * including failures, so successes and failures can have different TTLs. It + * does not run when the cache is created or when a cached result is reused. + * The callback also receives interruption exits, which are cached for the + * returned duration. + * + * The TTL starts when the computation completes. Concurrent callers share the + * pending computation. A zero TTL expires immediately, and an infinite TTL + * keeps the result indefinitely. + * * **Example** (Memoizing an effect with TTL) * * ```ts import.meta.vitest @@ -17821,6 +15837,26 @@ const cached = _internal_effect_js__rspack_import_1/* .cached */.PO3; * output // => ["expensive task...", "result 1", "result 1", "result 1"] * ``` * + * **Example** (Caching successes while retrying failures) + * + * ```ts import.meta.vitest + * import { Effect, Exit } from "effect" + * + * let attempts = 0 + * const task = Effect.suspend(() => + * ++attempts === 1 ? Effect.fail("temporary failure") : Effect.succeed(42) + * ) + * const program = Effect.gen(function*() { + * const cached = yield* task.pipe( + * Effect.cachedWithTTL((exit) => Exit.isSuccess(exit) ? "1 hour" : 0) + * ) + * yield* Effect.exit(cached) + * return yield* cached + * }) + * + * Effect.runSync(program) // => 42 + * ``` + * * @see {@link cached} for a similar function that caches the result * indefinitely. * @see {@link cachedInvalidateWithTTL} for a similar function that includes an @@ -18200,10 +16236,10 @@ const repeat = _internal_schedule_js__rspack_import_2/* .repeat */.ux; * const program = Effect.repeatOrElse( * task, * Schedule.recurs(3), - * (error, attempts) => + * (error, previous) => * Effect.sync(() => { output.push( * `Final failure: ${error}, after ${ - * Option.getOrElse(attempts, () => 0) + * Option.isSome(previous) ? previous.value.attempt : 0 * } attempts` * ) }).pipe(Effect.map(() => 0)) * ) @@ -18991,7 +17027,7 @@ const forkDetach = _internal_effect_js__rspack_import_1/* .forkDetach */.yxg; * @see {@link forkIn} for forking into an explicit scope * @see {@link forkScoped} for forking fibers tied to the current scope * - * @category sequencing + * @category forking * @since 2.0.0 */ const awaitAllChildren = _internal_effect_js__rspack_import_1/* .awaitAllChildren */.PCg; @@ -20145,14 +18181,10 @@ const withLogSpan = /*#__PURE__*/(/* unused pure expression or super */ null && // Metrics // ----------------------------------------------------------------------------- /** - * Updates the `Metric` every time the `Effect` is executed. - * - * **Details** + * Updates a metric after each effect execution, optionally mapping its `Exit` to + * the metric's input. * - * Also accepts an optional function which can be used to map the `Exit` value - * of the `Effect` into a valid `Input` for the `Metric`. - * - * **Example** (Incrementing a metric for each execution) + * **Example** (Counting executions) * * ```ts import.meta.vitest * import { Effect, Metric } from "effect" @@ -20169,12 +18201,11 @@ const withLogSpan = /*#__PURE__*/(/* unused pure expression or super */ null && * Effect.runSync(Metric.value(counter)).count // => 1 * ``` * - * **Example** (Mapping exits before updating a metric) + * **Example** (Mapping exits) * * ```ts import.meta.vitest * import { Effect, Exit, Metric } from "effect" * - * // Track different exit types with custom mapping * const exitTracker = Metric.frequency("exit_types", { * description: "Tracks success/failure/defect counts" * }) @@ -20434,7 +18465,7 @@ const trackDuration = /*#__PURE__*/(/* unused pure expression or super */ null & * Effect.runSync(runnable) // => "Transaction complete" * ``` * - * @category services + * @category transactions * @since 4.0.0 */ class Transaction extends /*#__PURE__*/(/* unused pure expression or super */ null && (Context.Service()("effect/Effect/Transaction"))) {} @@ -21050,6 +19081,7 @@ __webpack_require__.d(__webpack_exports__, { * When the effect is evaluated, it calls `evaluate` with the current fiber. * * @see {@link Class} for a class-based approach to defining custom Effect values + * @see {@link Mixin} for wrapping an existing class constructor * * @category prototypes * @since 4.0.0 @@ -21058,14 +19090,15 @@ const Prototype = options => (0,_internal_core_js__rspack_import_0/* .makePrimit op: options.label, [_internal_core_js__rspack_import_0/* .evaluate */._3]: options.evaluate }); +const proto = /*#__PURE__*/(/* unused pure expression or super */ null && (Prototype({ + label: "Effectable", + evaluate(_) { + return this.asEffect(); + } +}))); const Base = /*#__PURE__*/(/* unused pure expression or super */ null && ((() => { const Base = function () {}; - Base.prototype = /*#__PURE__*/Prototype({ - label: "Effectable", - evaluate(_) { - return this; - } - }); + Base.prototype = proto; return Base; })())); /** @@ -21077,14 +19110,64 @@ const Base = /*#__PURE__*/(/* unused pure expression or super */ null && ((() => * as `Effect` values. * * @see {@link Prototype} for a lower-level primitive approach to creating custom Effect-like values without a class + * @see {@link Mixin} for wrapping an existing class constructor * @category constructors * @since 2.0.0 */ class Class extends (/* unused pure expression or super */ null && (Base)) {} +/** + * Returns a subclass of the provided class that inserts the Effect prototype + * into the inheritance chain. + * + * **When to use** + * + * Use to make instances of an existing class behave as `Effect` values without + * extending {@link Class} or modifying the original prototype. + * + * **Details** + * + * Pass the class to wrap, then implement `asEffect` on the final class. The + * returned class is abstract, and the success, error, and service types are + * inferred from the concrete `asEffect` return type. Concrete and abstract base + * classes are supported. Constructor parameters and instance members are + * preserved, except that Effect's prototype members shadow base prototype + * members with the same name: `pipe`, `toString`, `toJSON`, `[Symbol.iterator]`, + * and `[Symbol.for("nodejs.util.inspect.custom")]`. + * + * **Example** (Evaluating a mixed-in class) + * + * ```ts import.meta.vitest + * import { Effect, Effectable } from "effect" + * + * class Box { + * constructor(readonly value: number) {} + * } + * + * class EffectBox extends Effectable.Mixin(Box) { + * asEffect() { + * return Effect.succeed(this.value) + * } + * } + * + * const box = new EffectBox(2) + * Effect.isEffect(box) // => true + * await Effect.runPromise(box) // => 2 + * ``` + * + * @see {@link Prototype} for a lower-level primitive approach to creating custom Effect-like values without a class + * @see {@link Class} for a base constructor to extend + * @category constructors + * @since 4.0.0 + */ +const Mixin = klass => { + class Mixed extends klass {} + Object.defineProperties(Mixed.prototype, Object.getOwnPropertyDescriptors(proto)); + return Mixed; +}; //# sourceMappingURL=Effectable.js.map __webpack_require__.d(__webpack_exports__, { }, { - b: Prototype + bp: Prototype }); @@ -21124,7 +19207,7 @@ __webpack_require__.d(__webpack_exports__, { * @category type IDs * @since 4.0.0 */ -const EncodingErrorTypeId = "~effect/encoding/EncodingError"; +const EncodingErrorTypeId = "~effect/Encoding/EncodingError"; /** * Error returned when an encoding or decoding operation cannot process its * input. @@ -21446,6 +19529,8 @@ const encodeHex = input => typeof input === "string" ? hexEncodeUint8Array(encod * Generates a random lowercase hexadecimal string, optimized for lengths that * are multiples of 8. * + * **Details** + * * `length` is not validated. The function generates `length >>> 3` random * 8-character words, so non-negative lengths below `2 ** 32` are rounded down * to a multiple of 8 and other values follow JavaScript's unsigned 32-bit @@ -21459,12 +19544,41 @@ const encodeHex = input => typeof input === "string" ? hexEncodeUint8Array(encod * @since 4.0.0 */ const randomHex = length => { - let result = ""; - for (let i = length >>> 3; i > 0; i--) { - const word = Math.random() * 0x100000000 >>> 0; - result += byteToHex[word >>> 24] + byteToHex[word >>> 16 & 0xff] + byteToHex[word >>> 8 & 0xff] + byteToHex[word & 0xff]; + switch (length) { + case 16: + return randomHex16(); + case 32: + return randomHex32(); + default: + { + let result = ""; + for (let i = length >>> 3; i > 0; i--) { + result += randomHex8(); + } + return result; + } } - return result; +}; +const hexCharCodes = /*#__PURE__*/Uint8Array.from("0123456789abcdef", c => c.charCodeAt(0)); +const randomWord = () => Math.random() * 0x100000000 >>> 0; +// Trace and span identifiers are the common lengths. A single +// String.fromCharCode call produces a flat string, which avoids rope +// flattening when the identifier is later serialized. +const randomHex8 = () => { + const a = randomWord(); + return String.fromCharCode(hexCharCodes[a >>> 28], hexCharCodes[a >>> 24 & 15], hexCharCodes[a >>> 20 & 15], hexCharCodes[a >>> 16 & 15], hexCharCodes[a >>> 12 & 15], hexCharCodes[a >>> 8 & 15], hexCharCodes[a >>> 4 & 15], hexCharCodes[a & 15]); +}; +const randomHex16 = () => { + const a = randomWord(); + const b = randomWord(); + return String.fromCharCode(hexCharCodes[a >>> 28], hexCharCodes[a >>> 24 & 15], hexCharCodes[a >>> 20 & 15], hexCharCodes[a >>> 16 & 15], hexCharCodes[a >>> 12 & 15], hexCharCodes[a >>> 8 & 15], hexCharCodes[a >>> 4 & 15], hexCharCodes[a & 15], hexCharCodes[b >>> 28], hexCharCodes[b >>> 24 & 15], hexCharCodes[b >>> 20 & 15], hexCharCodes[b >>> 16 & 15], hexCharCodes[b >>> 12 & 15], hexCharCodes[b >>> 8 & 15], hexCharCodes[b >>> 4 & 15], hexCharCodes[b & 15]); +}; +const randomHex32 = () => { + const a = randomWord(); + const b = randomWord(); + const c = randomWord(); + const d = randomWord(); + return String.fromCharCode(hexCharCodes[a >>> 28], hexCharCodes[a >>> 24 & 15], hexCharCodes[a >>> 20 & 15], hexCharCodes[a >>> 16 & 15], hexCharCodes[a >>> 12 & 15], hexCharCodes[a >>> 8 & 15], hexCharCodes[a >>> 4 & 15], hexCharCodes[a & 15], hexCharCodes[b >>> 28], hexCharCodes[b >>> 24 & 15], hexCharCodes[b >>> 20 & 15], hexCharCodes[b >>> 16 & 15], hexCharCodes[b >>> 12 & 15], hexCharCodes[b >>> 8 & 15], hexCharCodes[b >>> 4 & 15], hexCharCodes[b & 15], hexCharCodes[c >>> 28], hexCharCodes[c >>> 24 & 15], hexCharCodes[c >>> 20 & 15], hexCharCodes[c >>> 16 & 15], hexCharCodes[c >>> 12 & 15], hexCharCodes[c >>> 8 & 15], hexCharCodes[c >>> 4 & 15], hexCharCodes[c & 15], hexCharCodes[d >>> 28], hexCharCodes[d >>> 24 & 15], hexCharCodes[d >>> 20 & 15], hexCharCodes[d >>> 16 & 15], hexCharCodes[d >>> 12 & 15], hexCharCodes[d >>> 8 & 15], hexCharCodes[d >>> 4 & 15], hexCharCodes[d & 15]); }; /** * Decodes a hexadecimal string into bytes safely. @@ -21588,10 +19702,9 @@ const base64codes = (/* unused pure expression or super */ null && ([255, 255, 2 // Base64Url internals const base64UrlEncodeUint8Array = data => base64EncodeUint8Array(data).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_"); // Hex internals -const byteToHex = []; -for (let i = 0; i < 256; i++) { - byteToHex.push(i.toString(16).padStart(2, "0")); -} +const byteToHex = /*#__PURE__*/(/* unused pure expression or super */ null && (Array.from({ + length: 256 +}, (_, i) => i.toString(16).padStart(2, "0")))); const hexEncodeUint8Array = bytes => { let result = ""; for (let i = 0; i < bytes.length; i++) { @@ -21664,7 +19777,7 @@ __webpack_require__.d(__webpack_exports__, { * @category symbols * @since 2.0.0 */ -const symbol = "~effect/interfaces/Equal"; +const symbol = "~effect/Equal"; function equals() { if (arguments.length === 1) { return self => compareBoth(self, arguments[0]); @@ -22810,6 +20923,7 @@ const Proto = (/* unused pure expression or super */ null && ({ const self = this; return effect.contextWith(context => effect.succeed(makeProto(self.steps.map(step => ({ ...step, + while: step.while ? input => effect.provideContext(step.while(input), context) : undefined, provide: Layer.isLayer(step.provide) ? Layer.provide(step.provide, Layer.succeedContext(context)) : step.provide }))))); }, @@ -24643,6 +22757,7 @@ __webpack_require__.d(__webpack_exports__, { * - Handles `BigInt`, `Symbol`, `Set`, `Map`, `Date`, `RegExp`, and class * instances that `JSON.stringify` cannot represent. * - Circular references are shown as `"[Circular]"` instead of throwing. + * - Failures while inspecting a value are rendered as diagnostic placeholders instead of throwing. * - Primitives: stringified naturally (`null`, `undefined`, `123`, `true`). * Strings are JSON-quoted. * - Objects with a custom `toString` (not `Object.prototype.toString`): @@ -24707,6 +22822,14 @@ function format(input, options) { } }; function recur(v, d = 0) { + try { + return recurUnsafe(v, d); + } catch { + if (typeof v === "object" && v !== null || typeof v === "function") ancestors.delete(v); + return "[inspection threw]"; + } + } + function recurUnsafe(v, d = 0) { if (typeof v === "string") return JSON.stringify(v); if (typeof v === "number" || v == null || typeof v === "boolean" || typeof v === "symbol") return String(v); if (typeof v === "bigint") return String(v) + "n"; @@ -24722,16 +22845,16 @@ function format(input, options) { output = formatDate(v); } else if (!options?.ignoreToString && _Predicate_js__rspack_import_1/* .hasProperty */.i5(v, "toString") && typeof v["toString"] === "function" && v["toString"] !== Object.prototype.toString && v["toString"] !== Array.prototype.toString) { const s = safeToString(v); - output = v instanceof Error && v.cause ? `${s} (cause: ${recur(v.cause, d)})` : s; + output = v instanceof Error && v.cause !== undefined ? `${s} (cause: ${recur(v.cause, d)})` : s; } else if (Symbol.iterator in v) { output = `${v.constructor.name}(${recur(Array.from(v), d)})`; } else { const keys = ownKeys(v); if (!gap || keys.length <= 1) { - const body = `{${keys.map(k => `${formatPropertyKey(k)}:${recur(v[k], d)}`).join(",")}}`; + const body = `{${keys.map(k => `${formatPropertyKey(k)}:${recur(safeGet(v, k), d)}`).join(",")}}`; output = wrap(v, body); } else { - const body = `{\n${keys.map(k => `${ind(d + 1)}${formatPropertyKey(k)}: ${recur(v[k], d + 1)}`).join(",\n")}\n${ind(d)}}`; + const body = `{\n${keys.map(k => `${ind(d + 1)}${formatPropertyKey(k)}: ${recur(safeGet(v, k), d + 1)}`).join(",\n")}\n${ind(d)}}`; output = wrap(v, body); } } @@ -24778,6 +22901,13 @@ function safeToString(input) { return "[toString threw]"; } } +function safeGet(input, key) { + try { + return input[key]; + } catch { + return "[property access threw]"; + } +} /** * Stringifies a value to JSON safely, silently dropping circular references. * @@ -25514,7 +23644,7 @@ __webpack_require__.d(__webpack_exports__, { * @category symbols * @since 2.0.0 */ -const symbol = "~effect/interfaces/Hash"; +const symbol = "~effect/Hash"; /** * Computes a hash value for any given value. * @@ -25556,10 +23686,6 @@ const hash = self => { return number(self); case "bigint": return string(self.toString(10)); - case "boolean": - return string(String(self)); - case "symbol": - return string(String(self)); case "string": return string(self); case "undefined": @@ -25604,7 +23730,8 @@ const hash = self => { } } default: - throw new Error(`BUG: unhandled typeof ${typeof self} - please report an issue at https://github.com/Effect-TS/effect/issues`); + // The remaining primitive types are boolean and symbol. + return string(String(self)); } }; /** @@ -25759,14 +23886,8 @@ const isHash = u => (0,_Predicate_js__rspack_import_2/* .hasProperty */.i5)(u, s * @since 2.0.0 */ const number = n => { - if (n !== n) { - return string("NaN"); - } - if (n === Infinity) { - return string("Infinity"); - } - if (n === -Infinity) { - return string("-Infinity"); + if (n !== n || n === Infinity || n === -Infinity) { + return string(String(n)); } let h = n | 0; if (h !== n) { @@ -26226,14 +24347,15 @@ __webpack_require__.d(__webpack_exports__, { + /** * Creates an iterable by applying a function to consecutive integers. * * **Details** * - * The function is called with each index starting from `0`. If no length is - * specified, the iterable is infinite. This is useful for generating - * sequences, patterns, or any indexed data. + * The function is called with each index starting from `0`. If a length is + * provided, it is rounded down and normalized to at least `1`, with `NaN` + * treated as `1`. If no length is specified, the iterable is infinite. * * **Example** (Generating values by index) * @@ -26258,7 +24380,7 @@ __webpack_require__.d(__webpack_exports__, { * @since 2.0.0 */ const makeBy = (f, options) => { - const max = options?.length !== undefined ? Math.max(1, Math.floor(options.length)) : Infinity; + const max = options?.length !== undefined ? Count.normalizeNonEmpty(options.length) : Infinity; return { [Symbol.iterator]() { let i = 0; @@ -26312,7 +24434,8 @@ const range = (start, end) => { * * **Details** * - * `n` is normalized to an integer greater than or equal to `1`. + * `n` is rounded down and normalized to an integer greater than or equal to + * `1`. `NaN` is treated as `1`. * * **Example** (Repeating a value) * @@ -26338,7 +24461,8 @@ const replicate = /*#__PURE__*/(/* unused pure expression or super */ null && (d * * **Details** * - * The result is lazy. Each repetition obtains a new iterator from `self`. + * The result is lazy. `n` is rounded down and normalized to at least `1`, with + * `NaN` treated as `1`. Each repetition obtains a new iterator from `self`. * * @see {@link forever} for repeating without an upper bound * @see {@link replicate} for repeating a single value @@ -26711,7 +24835,8 @@ const headUnsafe = self => { * * **Details** * - * `n` is normalized to a non-negative integer. + * `n` is rounded down and normalized to a non-negative integer. `NaN` is + * treated as `0`. * * **Example** (Taking from the start) * @@ -26739,24 +24864,27 @@ const headUnsafe = self => { * @category getters * @since 2.0.0 */ -const take = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => ({ - [Symbol.iterator]() { - let i = 0; - const iterator = self[Symbol.iterator](); - return { - next() { - if (i < n) { - i++; - return iterator.next(); +const take = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { + const count = Count.normalize(n); + return { + [Symbol.iterator]() { + let i = 0; + const iterator = self[Symbol.iterator](); + return { + next() { + if (i < count) { + i++; + return iterator.next(); + } + return { + done: true, + value: undefined + }; } - return { - done: true, - value: undefined - }; - } - }; - } -})))); + }; + } + }; +}))); /** * Takes the longest initial `Iterable` prefix for which all elements satisfy the * specified predicate. @@ -26815,7 +24943,8 @@ const takeWhile = /*#__PURE__*/(/* unused pure expression or super */ null && (d * * **Details** * - * `n` is normalized to a non-negative integer. + * `n` is rounded down and normalized to a non-negative integer. `NaN` is + * treated as `0`. * * **Example** (Dropping from the start) * @@ -26842,27 +24971,30 @@ const takeWhile = /*#__PURE__*/(/* unused pure expression or super */ null && (d * @category getters * @since 2.0.0 */ -const drop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => ({ - [Symbol.iterator]() { - const iterator = self[Symbol.iterator](); - let i = 0; - return { - next() { - while (i < n) { - const result = iterator.next(); - if (result.done) { - return { - done: true, - value: undefined - }; +const drop = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { + const count = Count.normalize(n); + return { + [Symbol.iterator]() { + const iterator = self[Symbol.iterator](); + let i = 0; + return { + next() { + while (i < count) { + const result = iterator.next(); + if (result.done) { + return { + done: true, + value: undefined + }; + } + i++; } - i++; + return iterator.next(); } - return iterator.next(); - } - }; - } -})))); + }; + } + }; +}))); /** * Returns the first element that satisfies the specified * predicate, or `None` if no such element exists. @@ -27229,6 +25361,8 @@ const contains = /*#__PURE__*/(/* unused pure expression or super */ null && (co /** * Splits an `Iterable` into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of * the `Iterable`. + * `n` is rounded down and normalized to at least `1`; `NaN` and non-positive + * values therefore produce singleton pieces. * * **Example** (Chunking an iterable) * @@ -27263,7 +25397,7 @@ const contains = /*#__PURE__*/(/* unused pure expression or super */ null && (co * @since 2.0.0 */ const chunksOf = /*#__PURE__*/(/* unused pure expression or super */ null && (dual(2, (self, n) => { - const safeN = Math.max(1, Math.floor(n)); + const safeN = Count.normalizeNonEmpty(n); return { [Symbol.iterator]() { let iterator = self[Symbol.iterator](); @@ -29339,6 +27473,7 @@ const effectDiscard = effect => effectContext(internalEffect.as(effect, Context. * @since 2.0.0 */ const suspend = evaluate => fromBuildMemo((memoMap, scope) => internalEffect.suspend(() => evaluate().build(memoMap, scope))); +const unwrapKey = /*#__PURE__*/(/* unused pure expression or super */ null && (Context.Service("effect/Layer/unwrap"))); /** * Unwraps a `Layer` from an `Effect`, flattening the nested structure. * @@ -29373,10 +27508,7 @@ const suspend = evaluate => fromBuildMemo((memoMap, scope) => internalEffect.sus * @category converting * @since 4.0.0 */ -const unwrap = self => { - const service = Context.Service("effect/Layer/unwrap"); - return flatMap(effect(service)(self), Context.get(service)); -}; +const unwrap = self => flatMap(effect(unwrapKey)(self), Context.get(unwrapKey)); const mergeAllEffect = (layers, memoMap, scope) => { const parentScope = _Scope_js__rspack_import_3/* .forkUnsafe */.Fp(scope, "parallel"); return _internal_effect_js__rspack_import_0/* .forEach */.jJl(layers, layer => layer.build(memoMap, _Scope_js__rspack_import_3/* .forkUnsafe */.Fp(parentScope, "sequential")), { @@ -30418,9 +28550,9 @@ const withSpan = function () { const options = internalTracer.addSpanStackTrace(dataFirst ? arguments[2] : arguments[1]); if (dataFirst) { const self = arguments[0]; - return unwrap(internalEffect.map(options?.onEnd !== undefined ? internalEffect.tap(internalEffect.makeSpanScoped(name, options), span => internalEffect.addFinalizer(exit => options.onEnd(span, exit))) : internalEffect.makeSpanScoped(name, options), span => withParentSpan(self, span))); + return unwrap(internalEffect.map(options?.onEnd !== undefined ? internalEffect.tap(internalEffect.makeSpanScoped(name, options), span => internalEffect.addFinalizer(exit => options.onEnd(span, exit))) : internalEffect.makeSpanScoped(name, options), span => withParentSpan(self, span, options))); } - return self => unwrap(internalEffect.map(options?.onEnd !== undefined ? internalEffect.tap(internalEffect.makeSpanScoped(name, options), span => internalEffect.addFinalizer(exit => options.onEnd(span, exit))) : internalEffect.makeSpanScoped(name, options), span => withParentSpan(self, span))); + return self => unwrap(internalEffect.map(options?.onEnd !== undefined ? internalEffect.tap(internalEffect.makeSpanScoped(name, options), span => internalEffect.addFinalizer(exit => options.onEnd(span, exit))) : internalEffect.makeSpanScoped(name, options), span => withParentSpan(self, span, options))); }; /** * Wraps a layer so spans created during its construction use the supplied span @@ -30635,7 +28767,7 @@ const make = (layer, options) => { self.cachedContext = context; })), { ...defaultRunOptions, - scheduler: fiber.currentScheduler + scheduler: fiber.cache.scheduler }); } return _Effect_js__rspack_import_3/* .flatten */.Bqz(_Fiber_js__rspack_import_2/* ["await"] */.Tx(buildFiber)); @@ -30729,7 +28861,7 @@ __webpack_require__.r(__webpack_exports__); -const TypeId = "~effect/data/Option"; +const TypeId = "~effect/Option"; /** * Creates an `Option` representing the absence of a value. * @@ -33035,6 +31167,7 @@ function alwaysEqual() { * * Applies orders in iteration order and short-circuits on the first non-zero * result. It returns `0` only if all orders return `0`. + * The collection is materialized when the order is created, so it must be finite. * * **Example** (Combining multiple Orders) * @@ -33064,9 +31197,10 @@ function alwaysEqual() { * @since 2.0.0 */ function combineAll(collection) { + const orders = Array.from(collection); return make((a1, a2) => { let out = 0; - for (const O of collection) { + for (const O of orders) { out = O(a1, a2); if (out !== 0) { return out; @@ -37015,7 +35149,7 @@ __webpack_require__.d(__webpack_exports__, { -const TypeId = "~effect/data/Result"; +const TypeId = "~effect/Result"; /** * Creates a `Result` holding a `Success` value. * @@ -39369,15 +37503,6 @@ const Scheduler = /*#__PURE__*/_Context_js__rspack_import_0/* .Reference */.Or(" fiberCached: true, defaultValue: () => new MixedScheduler() }); -const setImmediate = "setImmediate" in globalThis ? f => { - // @ts-ignore - const timer = globalThis.setImmediate(f); - // @ts-ignore - return () => globalThis.clearImmediate(timer); -} : f => { - const timer = setTimeout(f, 0); - return () => clearTimeout(timer); -}; const setMicrotask = f => { let cancelled = false; Promise.resolve().then(() => { @@ -39387,6 +37512,24 @@ const setMicrotask = f => { cancelled = true; }; }; +const setTimer = "setImmediate" in globalThis ? f => { + // @ts-ignore + const timer = globalThis.setImmediate(f); + // @ts-ignore + return () => globalThis.clearImmediate(timer); +} : f => { + const timer = setTimeout(f, 0); + return () => clearTimeout(timer); +}; +// Some runtimes (e.g. Cloudflare Workers) throw when a timer is set in global +// scope. Fall back to a microtask so effects can still yield at module load. +const setImmediate = f => { + try { + return setTimer(f); + } catch { + return setMicrotask(f); + } +}; class PriorityBuckets { buckets = []; scheduleTask(task, priority) { @@ -39449,7 +37592,7 @@ class MixedScheduler { * @since 2.0.0 */ shouldYield(fiber) { - return fiber.currentOpCount >= fiber.maxOpsBeforeYield; + return fiber.currentOpCount >= fiber.cache.maxOpsBeforeYield; } /** * Creates a dispatcher that schedules work through this scheduler. @@ -40185,9 +38328,23 @@ const TracerKey = "effect/Tracer"; */ const Tracer = /*#__PURE__*/_Context_js__rspack_import_0/* .Reference */.Or(TracerKey, { fiberCached: true, - defaultValue: () => make({ - span: options => new NativeSpan(options) - }) + defaultValue: () => nativeTracer +}); +/** + * The default `Tracer` implementation backing the `Tracer` reference. It + * creates in-memory `NativeSpan` instances and does not export them anywhere. + * + * **Details** + * + * Runtime code can compare the active tracer against `nativeTracer` to detect + * that no tracing backend is installed and skip work that only a backend could + * observe, such as recording span attributes. + * + * @category references + * @since 4.0.0 + */ +const nativeTracer = /*#__PURE__*/make({ + span: options => new NativeSpan(options) }); /** * Default in-memory `Span` implementation used by the native tracer. It @@ -40196,9 +38353,11 @@ const Tracer = /*#__PURE__*/_Context_js__rspack_import_0/* .Reference */.Or(Trac * * **Details** * - * The constructor initializes the span with `Started` status, inherits the - * parent trace id or generates a new one, and always generates a new span id. - * Attributes, events, links, and status are then mutated through `Span` methods. + * The constructor initializes the span with `Started` status. Trace and span + * identifiers, the attribute map, and the event list are created lazily on + * first access, so spans that are never inspected allocate as little as + * possible. Attributes, events, links, and status are mutated through `Span` + * methods. * * @see {@link Span} for the interface implemented by native spans * @@ -40207,8 +38366,6 @@ const Tracer = /*#__PURE__*/_Context_js__rspack_import_0/* .Reference */.Or(Trac */ class NativeSpan { _tag = "Span"; - spanId; - traceId = "native"; sampled; name; parent; @@ -40217,8 +38374,10 @@ class NativeSpan { startTime; kind; status; - attributes; - events = []; + _traceId = undefined; + _spanId = undefined; + _attributes = undefined; + _events = undefined; constructor(options) { this.name = options.name; this.parent = options.parent; @@ -40231,9 +38390,18 @@ class NativeSpan { _tag: "Started", startTime: options.startTime }; - this.attributes = new Map(); - this.traceId = _Option_js__rspack_import_2.getOrUndefined(options.parent)?.traceId ?? _Encoding_js__rspack_import_3/* .randomHex */.nw(32); - this.spanId = _Encoding_js__rspack_import_3/* .randomHex */.nw(16); + } + get traceId() { + return this._traceId ??= _Option_js__rspack_import_2.getOrUndefined(this.parent)?.traceId ?? _Encoding_js__rspack_import_3/* .randomHex */.nw(32); + } + get spanId() { + return this._spanId ??= _Encoding_js__rspack_import_3/* .randomHex */.nw(16); + } + get attributes() { + return this._attributes ??= new Map(); + } + get events() { + return this._events ??= []; } end(endTime, exit) { this.status = { @@ -40269,6 +38437,8 @@ __webpack_require__.d(__webpack_exports__, { }, "./node_modules/effect/dist/Utils.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) { +/* import */ var _internal_stackTraceLimit_js__rspack_import_0 = __webpack_require__("./node_modules/effect/dist/internal/stackTraceLimit.js"); + /** * Yields its wrapped value exactly once through an `IterableIterator`. * @@ -40359,7 +38529,7 @@ const pickInternalCall = () => { } } }; - const isNotOptimizedAway = standard[InternalTypeId](() => new Error().stack)?.includes(InternalTypeId) === true; + const isNotOptimizedAway = (0,_internal_stackTraceLimit_js__rspack_import_0/* .getStackTraceLimit */.jt)() !== 0 && standard[InternalTypeId](() => new Error().stack)?.includes(InternalTypeId) === true; return isNotOptimizedAway ? standard[InternalTypeId] : forced[InternalTypeId]; }; /** @internal */ @@ -40379,6 +38549,12 @@ __webpack_require__.d(__webpack_exports__, { */ /** @internal */ const isArrayNonEmpty = self => self.length > 0; +/** @internal */ +function replaceAt(self, index, value) { + const out = self.slice(); + out[index] = value; + return out; +} //# sourceMappingURL=array.js.map __webpack_require__.d(__webpack_exports__, { }, { @@ -40500,8 +38676,6 @@ const isCause = self => (0,_Predicate_js__rspack_import_7/* .hasProperty */.i5)( const isCauseReason = self => (0,_Predicate_js__rspack_import_7/* .hasProperty */.i5)(self, CauseReasonTypeId); /** @internal */ class CauseImpl { - [CauseTypeId]; - reasons; constructor(failures) { this[CauseTypeId] = CauseTypeId; this.reasons = failures; @@ -40571,7 +38745,6 @@ class ReasonBase { const constEmptyAnnotations = /*#__PURE__*/new Map(); /** @internal */ class Fail extends ReasonBase { - error; constructor(error, annotations = constEmptyAnnotations) { super("Fail", annotations, error); this.error = error; @@ -40600,7 +38773,6 @@ const causeEmpty = /*#__PURE__*/new CauseImpl([]); const causeFail = error => new CauseImpl([new Fail(error)]); /** @internal */ class Die extends ReasonBase { - defect; constructor(defect, annotations = constEmptyAnnotations) { super("Die", annotations, defect); this.defect = defect; @@ -40649,10 +38821,12 @@ const makePrimitiveProto = options => ({ /** @internal */ const makePrimitive = options => { const Proto = makePrimitiveProto(options); - return function () { - const self = Object.create(Proto); - self[args] = options.single === false ? arguments : arguments[0]; - return self; + const PrimitiveImpl = function (value) { + this[args] = value; + }; + PrimitiveImpl.prototype = Proto; + return function (value) { + return new PrimitiveImpl(value); }; }; /** @internal */ @@ -40681,10 +38855,12 @@ const makeExit = options => { return _Hash_js__rspack_import_4/* .combine */.kg(_Hash_js__rspack_import_4/* .string */.Yj(options.op), _Hash_js__rspack_import_4/* .hash */.tW(this[args])); } }; + const ExitPrimitive = function (value) { + this[args] = value; + }; + ExitPrimitive.prototype = Proto; return function (value) { - const self = Object.create(Proto); - self[args] = value; - return self; + return new ExitPrimitive(value); }; }; /** @internal */ @@ -40711,9 +38887,9 @@ const exitFailCause = /*#__PURE__*/makeExit({ [evaluate](fiber) { let cause = this[args]; let annotated = false; - if (fiber.currentStackFrame) { + if (fiber.cache.stackFrame) { cause = causeAnnotate(cause, { - mapUnsafe: new Map([[StackTraceKey.key, fiber.currentStackFrame]]) + mapUnsafe: new Map([[StackTraceKey.key, fiber.cache.stackFrame]]) }); annotated = true; } @@ -40735,6 +38911,20 @@ const withFiber = /*#__PURE__*/makePrimitive({ return this[args](fiber); } }); +/** + * Accesses the current fiber to compute a value without a separate `succeed` + * operation. + * + * @internal + */ +const withFiberSucceed = /*#__PURE__*/makePrimitive({ + op: "WithFiberSucceed", + [evaluate](fiber) { + const value = this[args](fiber); + const cont = fiber.getCont(contA); + return cont ? cont[contA](value, fiber) : fiber.yieldWith(exitSucceed(value)); + } +}); /** @internal */ const YieldableError = /*#__PURE__*/function () { class YieldableError extends globalThis.Error {} @@ -40833,6 +39023,7 @@ __webpack_require__.d(__webpack_exports__, { DH: causeEmpty, Eh: causeAnnotate, GN: Yield, + Hq: withFiberSucceed, IH: ExitTypeId, In: StructuralProto, Iu: causeDie, @@ -40899,31 +39090,31 @@ __webpack_require__.d(__webpack_exports__, { }, "./node_modules/effect/dist/internal/effect.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) { -/* import */ var _Array_js__rspack_import_7 = __webpack_require__("./node_modules/effect/dist/Array.js"); +/* import */ var _Array_js__rspack_import_16 = __webpack_require__("./node_modules/effect/dist/Array.js"); /* import */ var _Context_js__rspack_import_5 = __webpack_require__("./node_modules/effect/dist/Context.js"); /* import */ var _Duration_js__rspack_import_20 = __webpack_require__("./node_modules/effect/dist/Duration.js"); /* import */ var _Equal_js__rspack_import_1 = __webpack_require__("./node_modules/effect/dist/Equal.js"); /* import */ var _Filter_js__rspack_import_4 = __webpack_require__("./node_modules/effect/dist/Filter.js"); -/* import */ var _Formatter_js__rspack_import_9 = __webpack_require__("./node_modules/effect/dist/Formatter.js"); +/* import */ var _Formatter_js__rspack_import_8 = __webpack_require__("./node_modules/effect/dist/Formatter.js"); /* import */ var _Function_js__rspack_import_6 = __webpack_require__("./node_modules/effect/dist/Function.js"); /* import */ var _Hash_js__rspack_import_2 = __webpack_require__("./node_modules/effect/dist/Hash.js"); /* import */ var _Inspectable_js__rspack_import_25 = __webpack_require__("./node_modules/effect/dist/Inspectable.js"); /* import */ var _Iterable_js__rspack_import_23 = __webpack_require__("./node_modules/effect/dist/Iterable.js"); /* import */ var _Option_js__rspack_import_17 = __webpack_require__("./node_modules/effect/dist/Option.js"); /* import */ var _Order_js__rspack_import_24 = __webpack_require__("./node_modules/effect/dist/Order.js"); -/* import */ var _Pipeable_js__rspack_import_12 = __webpack_require__("./node_modules/effect/dist/Pipeable.js"); -/* import */ var _Predicate_js__rspack_import_11 = __webpack_require__("./node_modules/effect/dist/Predicate.js"); -/* import */ var _Redactable_js__rspack_import_10 = __webpack_require__("./node_modules/effect/dist/Redactable.js"); +/* import */ var _Pipeable_js__rspack_import_11 = __webpack_require__("./node_modules/effect/dist/Pipeable.js"); +/* import */ var _Predicate_js__rspack_import_10 = __webpack_require__("./node_modules/effect/dist/Predicate.js"); +/* import */ var _Redactable_js__rspack_import_9 = __webpack_require__("./node_modules/effect/dist/Redactable.js"); /* import */ var _Result_js__rspack_import_3 = __webpack_require__("./node_modules/effect/dist/Result.js"); /* import */ var _Scheduler_js__rspack_import_13 = __webpack_require__("./node_modules/effect/dist/Scheduler.js"); -/* import */ var _Tracer_js__rspack_import_14 = __webpack_require__("./node_modules/effect/dist/Tracer.js"); +/* import */ var _Tracer_js__rspack_import_12 = __webpack_require__("./node_modules/effect/dist/Tracer.js"); /* import */ var _Utils_js__rspack_import_18 = __webpack_require__("./node_modules/effect/dist/Utils.js"); /* import */ var _core_js__rspack_import_0 = __webpack_require__("./node_modules/effect/dist/internal/core.js"); /* import */ var _doNotation_js__rspack_import_22 = __webpack_require__("./node_modules/effect/dist/internal/doNotation.js"); -/* import */ var _metric_js__rspack_import_16 = __webpack_require__("./node_modules/effect/dist/internal/metric.js"); +/* import */ var _metric_js__rspack_import_15 = __webpack_require__("./node_modules/effect/dist/internal/metric.js"); /* import */ var _record_js__rspack_import_21 = __webpack_require__("./node_modules/effect/dist/internal/record.js"); -/* import */ var _references_js__rspack_import_15 = __webpack_require__("./node_modules/effect/dist/internal/references.js"); -/* import */ var _stackTraceLimit_js__rspack_import_8 = __webpack_require__("./node_modules/effect/dist/internal/stackTraceLimit.js"); +/* import */ var _references_js__rspack_import_14 = __webpack_require__("./node_modules/effect/dist/internal/references.js"); +/* import */ var _stackTraceLimit_js__rspack_import_7 = __webpack_require__("./node_modules/effect/dist/internal/stackTraceLimit.js"); /* import */ var _tracer_js__rspack_import_19 = __webpack_require__("./node_modules/effect/dist/internal/tracer.js"); @@ -40956,7 +39147,6 @@ __webpack_require__.d(__webpack_exports__, { // ---------------------------------------------------------------------------- /** @internal */ class Interrupt extends _core_js__rspack_import_0/* .ReasonBase */.ET { - fiberId; constructor(fiberId, annotations = _core_js__rspack_import_0/* .constEmptyAnnotations */.dO) { super("Interrupt", annotations, "Interrupted"); this.fiberId = fiberId; @@ -41054,6 +39244,25 @@ const causeAnnotations = self => { } return _Context_js__rspack_import_5/* .makeUnsafe */.LZ(map); }; +const dedupeReasons = (self, that) => { + // Keep deduplication local so causeCombine does not retain Array.ts in the core bundle. + // Snapshot both arrays before invoking user-defined hash or equality methods. + const buckets = new Map(); + const out = []; + for (const reason of self.concat(that)) { + const hash = _Hash_js__rspack_import_2/* .hash */.tW(reason); + const bucket = buckets.get(hash); + if (bucket === undefined) { + buckets.set(hash, [reason]); + } else if (bucket.some(previous => _Equal_js__rspack_import_1/* .equals */.aI(previous, reason))) { + continue; + } else { + bucket.push(reason); + } + out.push(reason); + } + return out; +}; /** @internal */ const causeCombine = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, that) => { if (self.reasons.length === 0) { @@ -41061,7 +39270,7 @@ const causeCombine = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY } else if (that.reasons.length === 0) { return self; } - const newCause = new _core_js__rspack_import_0/* .CauseImpl */.s0(_Array_js__rspack_import_7/* .union */.KC(self.reasons, that.reasons)); + const newCause = new _core_js__rspack_import_0/* .CauseImpl */.s0(dedupeReasons(self.reasons, that.reasons)); return _Equal_js__rspack_import_1/* .equals */.aI(self, newCause) ? self : newCause; }); /** @internal */ @@ -41105,8 +39314,8 @@ const causePrettyErrors = (self, options) => { const errors = []; const interrupts = []; if (self.reasons.length === 0) return errors; - const prevStackLimit = (0,_stackTraceLimit_js__rspack_import_8/* .getStackTraceLimit */.jt)(); - (0,_stackTraceLimit_js__rspack_import_8/* .setStackTraceLimit */.ft)(1); + const prevStackLimit = (0,_stackTraceLimit_js__rspack_import_7/* .getStackTraceLimit */.jt)(); + if (prevStackLimit !== 0) (0,_stackTraceLimit_js__rspack_import_7/* .setStackTraceLimit */.ft)(1); for (const failure of self.reasons) { if (failure._tag === "Interrupt") { interrupts.push(failure); @@ -41125,7 +39334,7 @@ const causePrettyErrors = (self, options) => { error.stack = `${error.name}: ${error.message}`; errors.push(causePrettyError(error, interrupts[0].annotations, options)); } - (0,_stackTraceLimit_js__rspack_import_8/* .setStackTraceLimit */.ft)(prevStackLimit); + if (prevStackLimit !== 0) (0,_stackTraceLimit_js__rspack_import_7/* .setStackTraceLimit */.ft)(prevStackLimit); return errors; }; /** @internal */ @@ -41155,7 +39364,7 @@ const causePrettyError = (original, annotations, options) => { } } } else { - error = new globalThis.Error(!original ? `Unknown error: ${original}` : kind === "string" ? original : (0,_Formatter_js__rspack_import_9/* .formatJson */.IB)(original)); + error = new globalThis.Error(!original ? `Unknown error: ${original}` : kind === "string" ? original : (0,_Formatter_js__rspack_import_8/* .formatJson */.IB)(original)); } return error; }; @@ -41169,7 +39378,7 @@ const causePrettyMessage = u => { // something's off, rollback to json } } - return (0,_Formatter_js__rspack_import_9/* .formatJson */.IB)(u); + return (0,_Formatter_js__rspack_import_8/* .formatJson */.IB)(u); }; const locationRegExp = /\((.*)\)/g; const cleanErrorStack = (stack, error, annotations) => { @@ -41252,7 +39461,7 @@ const fiberIdStore = { id: 0 }; /** @internal */ -const getCurrentFiber = () => globalThis[_Redactable_js__rspack_import_10/* .currentFiberTypeId */.fL]; +const getCurrentFiber = () => globalThis[_Redactable_js__rspack_import_9/* .currentFiberTypeId */.fL]; /** @internal */ class FiberImpl { constructor(context, interruptible = true) { @@ -41262,14 +39471,15 @@ class FiberImpl { this.currentOpCount = 0; this.interruptible = interruptible; this._stack = []; - this._observers = []; + this._observers = undefined; this._exit = undefined; this._children = undefined; this._interruptedCause = undefined; this._yielded = undefined; this._running = false; this._deferredInterrupt = false; - this.runtimeMetrics?.recordFiberStart(this.context); + this._parent = undefined; + this.cache.runtimeMetrics?.recordFiberStart(this.context); } [FiberTypeId]; id; @@ -41283,20 +39493,13 @@ class FiberImpl { _yielded; _running; _deferredInterrupt; + _parent; // set in setContext context; - currentScheduler; - currentTracerContext; - currentSpan; - currentLogLevel; - minimumLogLevel; - currentStackFrame; - runtimeMetrics; - maxOpsBeforeYield; - currentPreventYield; + cache; _dispatcher = undefined; get currentDispatcher() { - return this._dispatcher ??= this.currentScheduler.makeDispatcher(); + return this._dispatcher ??= this.cache.scheduler.makeDispatcher(); } getRef(ref) { return _Context_js__rspack_import_5/* .get */.Jt(this.context, ref); @@ -41306,9 +39509,13 @@ class FiberImpl { cb(this._exit); return _Function_js__rspack_import_6/* .constVoid */.Yi; } - this._observers.push(cb); + if (this._observers === undefined) { + this._observers = [cb]; + } else { + this._observers.push(cb); + } return () => { - if (this._exit) return; + if (this._exit || this._observers === undefined) return; const index = this._observers.indexOf(cb); if (index >= 0) { this._observers.splice(index, 1); @@ -41320,8 +39527,8 @@ class FiberImpl { return; } let cause = causeInterrupt(fiberId); - if (this.currentStackFrame) { - cause = (0,_core_js__rspack_import_0/* .causeAnnotate */.Eh)(cause, _Context_js__rspack_import_5/* .make */.L8(_core_js__rspack_import_0/* .StackTraceKey */.z8, this.currentStackFrame)); + if (this.cache.stackFrame) { + cause = (0,_core_js__rspack_import_0/* .causeAnnotate */.Eh)(cause, _Context_js__rspack_import_5/* .make */.L8(_core_js__rspack_import_0/* .StackTraceKey */.z8, this.cache.stackFrame)); } if (annotations) { cause = (0,_core_js__rspack_import_0/* .causeAnnotate */.Eh)(cause, annotations); @@ -41357,18 +39564,25 @@ class FiberImpl { return this.evaluate(flatMap(interruptChildren, () => exit)); } this._exit = exit; - this.runtimeMetrics?.recordFiberEnd(this.context, this._exit); - for (let i = 0; i < this._observers.length; i++) { - this._observers[i](exit); + this.cache.runtimeMetrics?.recordFiberEnd(this.context, this._exit); + if (this._parent) { + this._parent._children?.delete(this); + this._parent = undefined; + } + if (this._observers !== undefined) { + const observers = this._observers; + this._observers = undefined; + for (let i = 0; i < observers.length; i++) { + observers[i](exit); + } } - this._observers.length = 0; this._stack.length = 0; this._children = undefined; this.context = _Context_js__rspack_import_5/* .empty */.Ie(); } runLoop(effect) { - const prevFiber = globalThis[_Redactable_js__rspack_import_10/* .currentFiberTypeId */.fL]; - globalThis[_Redactable_js__rspack_import_10/* .currentFiberTypeId */.fL] = this; + const prevFiber = globalThis[_Redactable_js__rspack_import_9/* .currentFiberTypeId */.fL]; + globalThis[_Redactable_js__rspack_import_9/* .currentFiberTypeId */.fL] = this; const prevRunning = this._running; this._running = true; let yielding = false; @@ -41381,12 +39595,14 @@ class FiberImpl { current = failCause(this._interruptedCause); } this.currentOpCount++; - if (!yielding && !this.currentPreventYield && this.currentScheduler.shouldYield(this)) { + // Refresh the cache because a primitive can replace the fiber context. + const cache = this.cache; + if (!yielding && !cache.preventYield && cache.scheduler.shouldYield(this)) { yielding = true; const prev = current; current = flatMap(yieldNow, () => prev); } - current = this.currentTracerContext ? this.currentTracerContext(current, this) : current[_core_js__rspack_import_0/* .evaluate */._3](this); + current = cache.tracerContext ? cache.tracerContext(current, this) : current[_core_js__rspack_import_0/* .evaluate */._3](this); if (current === _core_js__rspack_import_0/* .Yield */.GN) { const yielded = this._yielded; if (_core_js__rspack_import_0/* .ExitTypeId */.IH in yielded) { @@ -41402,13 +39618,13 @@ class FiberImpl { } } } catch (error) { - if (!(0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(current, _core_js__rspack_import_0/* .evaluate */._3)) { + if (!(0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(current, _core_js__rspack_import_0/* .evaluate */._3)) { return (0,_core_js__rspack_import_0/* .exitDie */.V2)(`Fiber.runLoop: Not a valid effect: ${String(current)}`); } return this.runLoop((0,_core_js__rspack_import_0/* .exitDie */.V2)(error)); } finally { this._running = prevRunning; - globalThis[_Redactable_js__rspack_import_10/* .currentFiberTypeId */.fL] = prevFiber; + globalThis[_Redactable_js__rspack_import_9/* .currentFiberTypeId */.fL] = prevFiber; } } getCont(symbol) { @@ -41419,11 +39635,14 @@ class FiberImpl { while (true) { const op = this._stack.pop(); if (!op) return undefined; - const cont = op[_core_js__rspack_import_0/* .contAll */.u4] && op[_core_js__rspack_import_0/* .contAll */.u4](this); - if (cont) { - ; - cont[symbol] = cont; - return cont; + const all = op[_core_js__rspack_import_0/* .contAll */.u4]; + if (all !== undefined) { + const cont = all.call(op, this); + if (cont) { + ; + cont[symbol] = cont; + return cont; + } } if (op[symbol]) return op; } @@ -41436,7 +39655,7 @@ class FiberImpl { return this._children ??= new Set(); } pipe() { - return (0,_Pipeable_js__rspack_import_12/* .pipeArguments */.tT)(this, arguments); + return (0,_Pipeable_js__rspack_import_11/* .pipeArguments */.tT)(this, arguments); } setContext(context) { const previous = this.context; @@ -41444,27 +39663,39 @@ class FiberImpl { // Every key cached below opts in to Context caching, so contexts related // only by non-caching adds cannot have changed any of them if (previous !== undefined && _Context_js__rspack_import_5/* .hasSameCache */.Pf(previous, context)) return; - const scheduler = this.getRef(_Scheduler_js__rspack_import_13/* .Scheduler */._F); - if (scheduler !== this.currentScheduler) { - this.currentScheduler = scheduler; + // Contexts sharing a cacheRoot resolve every cached key identically, so + // the derived cache object is computed once per root and shared by all + // fibers running with that root (forked fibers reuse the parent's). + const root = context.cacheRoot; + const cache = root._fiberCache ??= makeFiberContextCache(context); + if (this.cache !== undefined && this.cache.scheduler !== cache.scheduler) { this._dispatcher = undefined; } - // The string-keyed lookups keep the Tracer key values (and the native - // tracer behind Tracer.Tracer's default) out of every bundle - this.currentSpan = _Context_js__rspack_import_5/* .getOrUndefinedUnsafe */.Ub(context, _Tracer_js__rspack_import_14/* .ParentSpanKey */.WG); - this.currentLogLevel = this.getRef(_references_js__rspack_import_15/* .CurrentLogLevel */.Gl); - this.minimumLogLevel = this.getRef(_references_js__rspack_import_15/* .MinimumLogLevel */.zQ); - this.currentStackFrame = this.getRef(_references_js__rspack_import_15/* .CurrentStackFrame */.vA); - this.maxOpsBeforeYield = this.getRef(_Scheduler_js__rspack_import_13/* .MaxOpsBeforeYield */.Zm); - this.currentPreventYield = this.getRef(_Scheduler_js__rspack_import_13/* .PreventSchedulerYield */.hf); - this.runtimeMetrics = _Context_js__rspack_import_5/* .getOrUndefinedUnsafe */.Ub(context, _metric_js__rspack_import_16/* .FiberRuntimeMetricsKey */.F); - const currentTracer = _Context_js__rspack_import_5/* .getOrUndefinedUnsafe */.Ub(context, _Tracer_js__rspack_import_14/* .TracerKey */.RL); - this.currentTracerContext = currentTracer ? currentTracer["context"] : undefined; + this.cache = cache; } get currentSpanLocal() { - return this.currentSpan?._tag === "Span" ? this.currentSpan : undefined; + const span = this.cache.span; + return span?._tag === "Span" ? span : undefined; } } +const makeFiberContextCache = context => { + // The string-keyed lookups keep the Tracer key values (and the native + // tracer behind Tracer.Tracer's default) out of every bundle + const currentTracer = _Context_js__rspack_import_5/* .getOrUndefinedUnsafe */.Ub(context, _Tracer_js__rspack_import_12/* .TracerKey */.RL); + return { + scheduler: _Context_js__rspack_import_5/* .get */.Jt(context, _Scheduler_js__rspack_import_13/* .Scheduler */._F), + tracer: currentTracer, + tracerContext: currentTracer ? currentTracer["context"] : undefined, + tracerEnabled: _Context_js__rspack_import_5/* .get */.Jt(context, _references_js__rspack_import_14/* .TracerEnabled */.rf), + span: _Context_js__rspack_import_5/* .getOrUndefinedUnsafe */.Ub(context, _Tracer_js__rspack_import_12/* .ParentSpanKey */.WG), + logLevel: _Context_js__rspack_import_5/* .get */.Jt(context, _references_js__rspack_import_14/* .CurrentLogLevel */.Gl), + minimumLogLevel: _Context_js__rspack_import_5/* .get */.Jt(context, _references_js__rspack_import_14/* .MinimumLogLevel */.zQ), + stackFrame: _Context_js__rspack_import_5/* .get */.Jt(context, _references_js__rspack_import_14/* .CurrentStackFrame */.vA), + runtimeMetrics: _Context_js__rspack_import_5/* .getOrUndefinedUnsafe */.Ub(context, _metric_js__rspack_import_15/* .FiberRuntimeMetricsKey */.F), + maxOpsBeforeYield: _Context_js__rspack_import_5/* .get */.Jt(context, _Scheduler_js__rspack_import_13/* .MaxOpsBeforeYield */.Zm), + preventYield: _Context_js__rspack_import_5/* .get */.Jt(context, _Scheduler_js__rspack_import_13/* .PreventSchedulerYield */.hf) + }; +}; const deferredInterruptCont = { [_core_js__rspack_import_0/* .contA */.ee](_value, fiber) { return failCause(fiber._interruptedCause); @@ -41477,9 +39708,9 @@ const fiberMiddleware = { interruptChildren: undefined }; const fiberStackAnnotations = fiber => { - if (!fiber.currentStackFrame) return undefined; + if (!fiber.cache.stackFrame) return undefined; const annotations = new Map(); - annotations.set(_core_js__rspack_import_0/* .InterruptorStackTrace.key */.QJ.key, fiber.currentStackFrame); + annotations.set(_core_js__rspack_import_0/* .InterruptorStackTrace.key */.QJ.key, fiber.cache.stackFrame); return _Context_js__rspack_import_5/* .makeUnsafe */.LZ(annotations); }; const fiberInterruptChildren = fiber => { @@ -41533,9 +39764,9 @@ const fiberJoin = self => { /** @internal */ const fiberJoinAll = self => callback(resume => { const fibers = Array.from(self); - if (fibers.length === 0) return resume(succeed(_Array_js__rspack_import_7/* .empty */.Ie())); + if (fibers.length === 0) return resume(succeed(_Array_js__rspack_import_16/* .empty */.Ie())); const out = new Array(fibers.length); - const cancels = _Array_js__rspack_import_7/* .empty */.Ie(); + const cancels = _Array_js__rspack_import_16/* .empty */.Ie(); let done = 0; let failed = false; for (let i = 0; i < fibers.length; i++) { @@ -41561,7 +39792,7 @@ const fiberJoinAll = self => callback(resume => { /** @internal */ const fiberInterrupt = self => (0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => fiberInterruptAs(self, fiber.id)); /** @internal */ -const fiberInterruptAs = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(args[0], FiberTypeId), (self, fiberId, annotations) => (0,_core_js__rspack_import_0/* .withFiber */.R6)(parent => { +const fiberInterruptAs = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(args[0], FiberTypeId), (self, fiberId, annotations) => (0,_core_js__rspack_import_0/* .withFiber */.R6)(parent => { let ann = fiberStackAnnotations(parent); ann = ann && annotations ? _Context_js__rspack_import_5/* .merge */.h1(ann, annotations) : ann ?? annotations; self.interruptUnsafe(fiberId, ann); @@ -41570,7 +39801,7 @@ const fiberInterruptAs = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual * /** @internal */ const fiberInterruptAll = fibers => (0,_core_js__rspack_import_0/* .withFiber */.R6)(parent => { const annotations = fiberStackAnnotations(parent); - let fiberArr = _Array_js__rspack_import_7/* .empty */.Ie(); + let fiberArr = _Array_js__rspack_import_16/* .empty */.Ie(); for (const fiber of fibers) { fiber.interruptUnsafe(parent.id, annotations); fiberArr.push(fiber); @@ -41580,7 +39811,7 @@ const fiberInterruptAll = fibers => (0,_core_js__rspack_import_0/* .withFiber */ /** @internal */ const fiberInterruptAllAs = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (fibers, fiberId) => (0,_core_js__rspack_import_0/* .withFiber */.R6)(parent => { const annotations = fiberStackAnnotations(parent); - const fiberArr = _Array_js__rspack_import_7/* .empty */.Ie(); + const fiberArr = _Array_js__rspack_import_16/* .empty */.Ie(); for (const fiber of fibers) { fiber.interruptUnsafe(fiberId, annotations); fiberArr.push(fiber); @@ -41693,39 +39924,48 @@ const withFiberId = f => (0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber const fiber = /*#__PURE__*/(0,_core_js__rspack_import_0/* .withFiber */.R6)(succeed); /** @internal */ const fiberId = /*#__PURE__*/withFiberId(succeed); -const callbackOptions = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitive */.Uf)({ - op: "Async", - single: false, - [_core_js__rspack_import_0/* .evaluate */._3](fiber) { - const register = (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => this[_core_js__rspack_import_0/* .args */.a2][0].bind(fiber.currentScheduler)); - let resumed = false; - let yielded = false; - const controller = this[_core_js__rspack_import_0/* .args */.a2][1] ? new AbortController() : undefined; - const onCancel = register(effect => { - if (resumed) return; - resumed = true; - if (yielded) { - fiber.evaluate(effect); - } else { - yielded = effect; +const callbackOptions = /*#__PURE__*/function () { + const Proto = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitiveProto */.yj)({ + op: "Async", + [_core_js__rspack_import_0/* .evaluate */._3](fiber) { + const register = (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => this.register.bind(fiber.cache.scheduler)); + let resumed = false; + let yielded = false; + const controller = this.withSignal ? new AbortController() : undefined; + const onCancel = register(effect => { + if (resumed) return; + resumed = true; + if (yielded) { + fiber.evaluate(effect); + } else { + yielded = effect; + } + }, controller?.signal); + if (yielded !== false) return yielded; + yielded = true; + fiber._yielded = () => { + resumed = true; + }; + if (controller === undefined && onCancel === undefined) { + return _core_js__rspack_import_0/* .Yield */.GN; } - }, controller?.signal); - if (yielded !== false) return yielded; - yielded = true; - fiber._yielded = () => { - resumed = true; - }; - if (controller === undefined && onCancel === undefined) { + fiber._stack.push(asyncFinalizer(() => { + resumed = true; + controller?.abort(); + return onCancel ?? exitVoid; + })); return _core_js__rspack_import_0/* .Yield */.GN; } - fiber._stack.push(asyncFinalizer(() => { - resumed = true; - controller?.abort(); - return onCancel ?? exitVoid; - })); - return _core_js__rspack_import_0/* .Yield */.GN; - } -}); + }); + const AsyncImpl = function (register, withSignal) { + this.register = register; + this.withSignal = withSignal; + }; + AsyncImpl.prototype = Proto; + return function (register, withSignal) { + return new AsyncImpl(register, withSignal); + }; +}(); const asyncFinalizer = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitive */.Uf)({ op: "AsyncFinalizer", [_core_js__rspack_import_0/* .contAll */.u4](fiber) { @@ -41743,7 +39983,14 @@ const callback = register => callbackOptions(register, register.length >= 2); /** @internal */ const never = /*#__PURE__*/callback(_Function_js__rspack_import_6/* .constVoid */.Yi); /** @internal */ -const gen = (...args) => suspend(() => fromIteratorUnsafe(args.length === 1 ? args[0]() : args[1].call(args[0].self))); +const gen = (...args) => { + if (args.length === 1) { + const body = args[0]; + return suspend(() => fromIteratorUnsafe(body())); + } + const [options, body] = args; + return suspend(() => fromIteratorUnsafe(body.call(options.self))); +}; /** @internal */ const fnUntraced = (body, ...pipeables) => { const fn = pipeables.length === 0 ? function () { @@ -41767,10 +40014,13 @@ const fn = function () { const nameFirst = typeof arguments[0] === "string"; const name = nameFirst ? arguments[0] : "Effect.fn"; const spanOptions = nameFirst ? arguments[1] : undefined; - const prevLimit = (0,_stackTraceLimit_js__rspack_import_8/* .getStackTraceLimit */.jt)(); - (0,_stackTraceLimit_js__rspack_import_8/* .setStackTraceLimit */.ft)(2); - const defError = new globalThis.Error(); - (0,_stackTraceLimit_js__rspack_import_8/* .setStackTraceLimit */.ft)(prevLimit); + const prevLimit = (0,_stackTraceLimit_js__rspack_import_7/* .getStackTraceLimit */.jt)(); + let defError; + if (prevLimit !== 0) { + (0,_stackTraceLimit_js__rspack_import_7/* .setStackTraceLimit */.ft)(2); + defError = new globalThis.Error(); + (0,_stackTraceLimit_js__rspack_import_7/* .setStackTraceLimit */.ft)(prevLimit); + } if (nameFirst) { return (body, ...pipeables) => makeFn(name, body, defError, pipeables, nameFirst, spanOptions); } @@ -41789,16 +40039,19 @@ const makeFn = (name, bodyOrOptions, defError, pipeables, addSpan, spanOptions) if (!(0,_core_js__rspack_import_0/* .isEffect */.yw)(result)) { return result; } - const prevLimit = (0,_stackTraceLimit_js__rspack_import_8/* .getStackTraceLimit */.jt)(); - (0,_stackTraceLimit_js__rspack_import_8/* .setStackTraceLimit */.ft)(2); - const callError = new globalThis.Error(); - (0,_stackTraceLimit_js__rspack_import_8/* .setStackTraceLimit */.ft)(prevLimit); - return updateService(addSpan ? useSpan(name, spanOptions, span => provideParentSpan(result, span)) : result, _references_js__rspack_import_15/* .CurrentStackFrame */.vA, prev => ({ + const prevLimit = (0,_stackTraceLimit_js__rspack_import_7/* .getStackTraceLimit */.jt)(); + let callError; + if (prevLimit !== 0) { + (0,_stackTraceLimit_js__rspack_import_7/* .setStackTraceLimit */.ft)(2); + callError = new globalThis.Error(); + (0,_stackTraceLimit_js__rspack_import_7/* .setStackTraceLimit */.ft)(prevLimit); + } + return updateService(addSpan ? useSpan(name, spanOptions, span => provideParentSpan(result, span)) : result, _references_js__rspack_import_14/* .CurrentStackFrame */.vA, prev => ({ name, - stack: fnStackCleaner(() => callError.stack), + stack: callError ? fnStackCleaner(() => callError.stack) : _Function_js__rspack_import_6/* .constUndefined */.MN, parent: { name: `${name} (definition)`, - stack: fnStackCleaner(() => defError.stack), + stack: defError ? fnStackCleaner(() => defError.stack) : _Function_js__rspack_import_6/* .constUndefined */.MN, parent: prev } })); @@ -41810,7 +40063,7 @@ const fnUntracedEager = (body, ...pipeables) => defineFunctionLength(body.length } : function () { let effect = fromIteratorEagerUnsafe(() => body.apply(this, arguments)); for (const pipeable of pipeables) { - effect = pipeable(effect); + effect = pipeable(effect, ...arguments); } return effect; }); @@ -41846,35 +40099,82 @@ const fromIteratorEagerUnsafe = evaluate => { return die(error); } }; -const fromIteratorUnsafe = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitive */.Uf)({ - op: "Iterator", - single: false, - [_core_js__rspack_import_0/* .contA */.ee](value, fiber) { - const iter = this[_core_js__rspack_import_0/* .args */.a2][0]; - while (true) { - const state = iter.next(value); - if (state.done) return succeed(state.value); - if (!effectIsExit(state.value)) { - fiber._stack.push(this); - return state.value; - } else if (state.value._tag === "Failure") { - return state.value; +const fromIteratorUnsafe = /*#__PURE__*/function () { + const Proto = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitiveProto */.yj)({ + op: "Iterator", + [_core_js__rspack_import_0/* .contA */.ee](value, fiber) { + const iter = this.iterator; + while (true) { + const state = iter.next(value); + if (state.done) return succeed(state.value); + if (!effectIsExit(state.value)) { + fiber._stack.push(this); + return state.value; + } else if (state.value._tag === "Failure") { + return state.value; + } + value = state.value.value; } - value = state.value.value; + }, + [_core_js__rspack_import_0/* .evaluate */._3](fiber) { + return this[_core_js__rspack_import_0/* .contA */.ee](this.initial, fiber); } - }, - [_core_js__rspack_import_0/* .evaluate */._3](fiber) { - return this[_core_js__rspack_import_0/* .contA */.ee](this[_core_js__rspack_import_0/* .args */.a2][1], fiber); - } -}); + }); + const IteratorImpl = function (iterator, initial) { + this.iterator = iterator; + this.initial = initial; + }; + IteratorImpl.prototype = Proto; + return function (iterator, initial) { + return new IteratorImpl(iterator, initial); + }; +}(); // ---------------------------------------------------------------------------- // mapping & sequencing // ---------------------------------------------------------------------------- /** @internal */ -const as = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, value) => { - const b = succeed(value); - return flatMap(self, _ => b); +const as = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, value) => new ContImpl(self, returnPayload, succeed(value))); +const evaluateCont = function (fiber) { + fiber._stack.push(this); + return this[_core_js__rspack_import_0/* .args */.a2]; +}; +const OnSuccessProto = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitiveProto */.yj)({ + op: "OnSuccess", + [_core_js__rspack_import_0/* .evaluate */._3]: evaluateCont }); +const OnSuccessImpl = function (self, f) { + this[_core_js__rspack_import_0/* .args */.a2] = self; + this[_core_js__rspack_import_0/* .contA */.ee] = f; +}; +OnSuccessImpl.prototype = OnSuccessProto; +// A success continuation with an extra payload slot. The stored continuation +// receives the primitive as `this` and reads `this.payload`, so combinators +// like map / as / tap / andThen can share module-level continuation functions +// instead of allocating a closure per call. +const ContImpl = function (self, cont, payload) { + this[_core_js__rspack_import_0/* .args */.a2] = self; + this[_core_js__rspack_import_0/* .contA */.ee] = cont; + this.payload = payload; +}; +ContImpl.prototype = OnSuccessProto; +const returnPayload = function () { + return this.payload; +}; +const mapCont = function (value) { + const f = this.payload; + return succeed((0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => f(value))); +}; +const andThenCont = function (value) { + const f = this.payload; + return (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => f(value)); +}; +const tapCont = function (value) { + const f = this.payload; + return new ContImpl((0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => f(value)), returnPayload, (0,_core_js__rspack_import_0/* .exitSucceed */.xt)(value)); +}; +const tapEffectCont = function (value) { + return new ContImpl(this.payload, returnPayload, (0,_core_js__rspack_import_0/* .exitSucceed */.xt)(value)); +}; /** @internal */ const asSome = self => map(self, _Option_js__rspack_import_17.some); /** @internal */ @@ -41883,16 +40183,16 @@ const flip = self => matchEffect(self, { onSuccess: fail }); /** @internal */ -const andThen = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => flatMap(self, a => (0,_core_js__rspack_import_0/* .isEffect */.yw)(f) ? f : (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => f(a)))); +const andThen = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => new ContImpl(self, (0,_core_js__rspack_import_0/* .isEffect */.yw)(f) ? returnPayload : andThenCont, f)); /** @internal */ -const tap = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => flatMap(self, a => as((0,_core_js__rspack_import_0/* .isEffect */.yw)(f) ? f : (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => f(a)), a))); +const tap = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => new ContImpl(self, (0,_core_js__rspack_import_0/* .isEffect */.yw)(f) ? tapEffectCont : tapCont, f)); /** @internal */ -const asVoid = self => flatMap(self, _ => exitVoid); +const asVoid = self => new ContImpl(self, returnPayload, exitVoid); /** @internal */ const sandbox = self => catchCause(self, fail); /** @internal */ const raceAll = (all, options) => (0,_core_js__rspack_import_0/* .withFiber */.R6)(parent => callback(resume => { - const effects = _Array_js__rspack_import_7/* .fromIterable */.Ts(all); + const effects = _Array_js__rspack_import_16/* .fromIterable */.Ts(all); const len = effects.length; let doneCount = 0; let done = false; @@ -41963,19 +40263,7 @@ const race = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args = /** @internal */ const raceFirst = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[1]), (self, that, options) => raceAllFirst([self, that], options)); /** @internal */ -const flatMap = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => { - const onSuccess = Object.create(OnSuccessProto); - onSuccess[_core_js__rspack_import_0/* .args */.a2] = self; - onSuccess[_core_js__rspack_import_0/* .contA */.ee] = f.length !== 1 ? a => f(a) : f; - return onSuccess; -}); -const OnSuccessProto = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitiveProto */.yj)({ - op: "OnSuccess", - [_core_js__rspack_import_0/* .evaluate */._3](fiber) { - fiber._stack.push(this); - return this[_core_js__rspack_import_0/* .args */.a2]; - } -}); +const flatMap = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => new OnSuccessImpl(self, f.length !== 1 ? a => f(a) : f)); /** @internal */ const matchCauseEffectEager = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, options) => { if (effectIsExit(self)) { @@ -41984,7 +40272,7 @@ const matchCauseEffectEager = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .d return matchCauseEffect(self, options); }); /** @internal */ -const effectIsExit = effect => _core_js__rspack_import_0/* .ExitTypeId */.IH in effect; +const effectIsExit = effect => effect[_core_js__rspack_import_0/* .ExitTypeId */.IH] !== undefined; /** @internal */ const flatMapEager = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => { if (effectIsExit(self)) { @@ -41998,7 +40286,7 @@ const flatMapEager = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY /** @internal */ const flatten = self => flatMap(self, _Function_js__rspack_import_6/* .identity */.D_); /** @internal */ -const map = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => flatMap(self, a => succeed((0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => f(a))))); +const map = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => new ContImpl(self, mapCont, f)); /** @internal */ const mapEager = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => effectIsExit(self) ? exitMap(self, f) : map(self, f)); /** @internal */ @@ -42120,7 +40408,9 @@ const updateServiceScoped = (service, update, options) => uninterruptible((0,_co const updated = update(original); fiber.setContext(_Context_js__rspack_import_5/* .add */.WQ(fiber.context, service, updated)); return scopeAddFinalizerExit(_Context_js__rspack_import_5/* .getUnsafe */.fp(fiber.context, scopeTag), _ => { - const current = _Context_js__rspack_import_5/* .getUnsafe */.fp(fiber.context, service); + const currentOption = _Context_js__rspack_import_5/* .getOption */.om(fiber.context, service); + if (_Option_js__rspack_import_17.isNone(currentOption)) return void_; + const current = currentOption.value; let next; if (options?.reset === undefined) { if (current !== updated) return void_; @@ -42168,7 +40458,7 @@ const zipWith = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(arg // ---------------------------------------------------------------------------- // filtering & conditionals // ---------------------------------------------------------------------------- -/* @internal */ +/** @internal */ const filterOrFail = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (self, predicate, orFailWith) => filterOrElse(self, predicate, orFailWith ? a => fail(orFailWith(a)) : () => fail(new _core_js__rspack_import_0/* .NoSuchElementError */.Xm()))); /** @internal */ const when = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, condition) => flatMap(condition, pass => pass ? asSome(self) : succeedNone)); @@ -42191,19 +40481,16 @@ const forever = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(arg // error handling // ---------------------------------------------------------------------------- /** @internal */ -const catchCause = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => { - const onFailure = Object.create(OnFailureProto); - onFailure[_core_js__rspack_import_0/* .args */.a2] = self; - onFailure[_core_js__rspack_import_0/* .contE */.Sc] = f.length !== 1 ? cause => f(cause) : f; - return onFailure; -}); +const catchCause = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => new OnFailureImpl(self, f.length !== 1 ? cause => f(cause) : f)); const OnFailureProto = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitiveProto */.yj)({ op: "OnFailure", - [_core_js__rspack_import_0/* .evaluate */._3](fiber) { - fiber._stack.push(this); - return this[_core_js__rspack_import_0/* .args */.a2]; - } + [_core_js__rspack_import_0/* .evaluate */._3]: evaluateCont }); +const OnFailureImpl = function (self, f) { + this[_core_js__rspack_import_0/* .args */.a2] = self; + this[_core_js__rspack_import_0/* .contE */.Sc] = f; +}; +OnFailureImpl.prototype = OnFailureProto; /** @internal */ const catchCauseIf = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(3, (self, predicate, f) => catchCause(self, cause => { if (!predicate(cause)) { @@ -42241,7 +40528,7 @@ const tapCauseFilter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */. const tapError = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => tapCauseFilter(self, findError, e => f(e))); /** @internal */ const tapErrorTag = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(3, (self, k, f) => { - const predicate = Array.isArray(k) ? e => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(e, "_tag") && k.includes(e._tag) : (0,_Predicate_js__rspack_import_11/* .isTagged */.$J)(k); + const predicate = Array.isArray(k) ? e => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(e, "_tag") && k.includes(e._tag) : (0,_Predicate_js__rspack_import_10/* .isTagged */.$J)(k); return tapError(self, error => predicate(error) ? f(error) : void_); }); /** @internal */ @@ -42267,7 +40554,7 @@ const catchFilter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY) })); /** @internal */ const catchTag = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (self, k, f, orElse) => { - const pred = Array.isArray(k) ? e => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(e, "_tag") && k.includes(e._tag) : (0,_Predicate_js__rspack_import_11/* .isTagged */.$J)(k); + const pred = Array.isArray(k) ? e => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(e, "_tag") && k.includes(e._tag) : (0,_Predicate_js__rspack_import_10/* .isTagged */.$J)(k); return catchIf(self, pred, f, orElse); }); /** @internal */ @@ -42275,19 +40562,19 @@ const catchTags = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(a let keys; return catchFilter(self, e => { keys ??= Object.keys(cases); - return (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(e, "_tag") && (0,_Predicate_js__rspack_import_11/* .isString */.Kg)(e["_tag"]) && keys.includes(e["_tag"]) ? _Result_js__rspack_import_3/* .succeed */.Py(e) : _Result_js__rspack_import_3/* .fail */.fJ(e); + return (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(e, "_tag") && (0,_Predicate_js__rspack_import_10/* .isString */.Kg)(e["_tag"]) && keys.includes(e["_tag"]) ? _Result_js__rspack_import_3/* .succeed */.Py(e) : _Result_js__rspack_import_3/* .fail */.fJ(e); }, e => (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => cases[e["_tag"]](e)), orElse); }); /** @internal */ -const catchReason = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (self, errorTag, reasonTag, f, orElse) => catchIf(self, e => (0,_Predicate_js__rspack_import_11/* .isTagged */.$J)(e, errorTag) && (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(e, "reason"), e => { +const catchReason = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (self, errorTag, reasonTag, f, orElse) => catchIf(self, e => (0,_Predicate_js__rspack_import_10/* .isTagged */.$J)(e, errorTag) && (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(e, "reason") && (orElse !== undefined || (0,_Predicate_js__rspack_import_10/* .isTagged */.$J)(e.reason, reasonTag)), e => { const reason = e.reason; - if ((0,_Predicate_js__rspack_import_11/* .isTagged */.$J)(reason, reasonTag)) return f(reason, e); + if ((0,_Predicate_js__rspack_import_10/* .isTagged */.$J)(reason, reasonTag)) return f(reason, e); return orElse ? (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => orElse(reason, e)) : fail(e); })); /** @internal */ const catchReasons = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (self, errorTag, cases, orElse) => { let keys; - return catchIf(self, e => (0,_Predicate_js__rspack_import_11/* .isTagged */.$J)(e, errorTag) && (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(e, "reason") && (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(e.reason, "_tag") && (0,_Predicate_js__rspack_import_11/* .isString */.Kg)(e.reason._tag), e => { + return catchIf(self, e => (0,_Predicate_js__rspack_import_10/* .isTagged */.$J)(e, errorTag) && (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(e, "reason") && (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(e.reason, "_tag") && (0,_Predicate_js__rspack_import_10/* .isString */.Kg)(e.reason._tag) && (orElse !== undefined || (keys ??= Object.keys(cases)).includes(e.reason._tag)), e => { const reason = e.reason; keys ??= Object.keys(cases); if (keys.includes(reason._tag)) { @@ -42298,14 +40585,14 @@ const catchReasons = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY }); /** @internal */ const unwrapReason = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, errorTag) => catchFilter(self, e => { - if ((0,_Predicate_js__rspack_import_11/* .isTagged */.$J)(e, errorTag) && (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(e, "reason")) { + if ((0,_Predicate_js__rspack_import_10/* .isTagged */.$J)(e, errorTag) && (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(e, "reason")) { return _Result_js__rspack_import_3/* .succeed */.Py(e.reason); } return _Result_js__rspack_import_3/* .fail */.fJ(e); }, fail)); /** @internal */ const mapError = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => catch_(self, error => failSync(() => f(error)))); -/* @internal */ +/** @internal */ const mapBoth = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, options) => matchEffect(self, { onFailure: e => failSync(() => options.onFailure(e)), onSuccess: a => sync(() => options.onSuccess(a)) @@ -42313,7 +40600,7 @@ const mapBoth = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, /** @internal */ const orDie = self => catch_(self, die); /** @internal */ -const orElseSucceed = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => catch_(self, _ => sync(f))); +const orElseSucceed = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, f) => catch_(self, error => sync(() => f(error)))); /** @internal */ const firstSuccessOf = effects => suspend(() => { const iterator = effects[Symbol.iterator](); @@ -42375,20 +40662,17 @@ const result = self => matchEager(self, { // pattern matching // ---------------------------------------------------------------------------- /** @internal */ -const matchCauseEffect = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, options) => { - const primitive = Object.create(OnSuccessAndFailureProto); - primitive[_core_js__rspack_import_0/* .args */.a2] = self; - primitive[_core_js__rspack_import_0/* .contA */.ee] = options.onSuccess.length !== 1 ? a => options.onSuccess(a) : options.onSuccess; - primitive[_core_js__rspack_import_0/* .contE */.Sc] = options.onFailure.length !== 1 ? cause => options.onFailure(cause) : options.onFailure; - return primitive; -}); +const matchCauseEffect = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, options) => new OnSuccessAndFailureImpl(self, options.onSuccess.length !== 1 ? a => options.onSuccess(a) : options.onSuccess, options.onFailure.length !== 1 ? cause => options.onFailure(cause) : options.onFailure)); const OnSuccessAndFailureProto = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitiveProto */.yj)({ op: "OnSuccessAndFailure", - [_core_js__rspack_import_0/* .evaluate */._3](fiber) { - fiber._stack.push(this); - return this[_core_js__rspack_import_0/* .args */.a2]; - } + [_core_js__rspack_import_0/* .evaluate */._3]: evaluateCont }); +const OnSuccessAndFailureImpl = function (self, onSuccess, onFailure) { + this[_core_js__rspack_import_0/* .args */.a2] = self; + this[_core_js__rspack_import_0/* .contA */.ee] = onSuccess; + this[_core_js__rspack_import_0/* .contE */.Sc] = onFailure; +}; +OnSuccessAndFailureImpl.prototype = OnSuccessAndFailureProto; /** @internal */ const matchCause = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, options) => matchCauseEffect(self, { onFailure: cause => sync(() => options.onFailure(cause)), @@ -42459,12 +40743,17 @@ const isSuccess = /*#__PURE__*/matchEager({ /** @internal */ const delay = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, duration) => andThen(sleep(duration), self)); /** @internal */ -const timeoutOrElse = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, options) => raceFirst(self, flatMap(sleep(options.duration), options.orElse))); +const timeoutOrElse = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, options) => flatMap(timeoutOption(self, options.duration), option => _Option_js__rspack_import_17.isNone(option) ? options.orElse() : succeed(option.value))); /** @internal */ -const timeout = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, duration) => timeoutOrElse(self, { - duration, - orElse: () => fail(new TimeoutError()) -})); +const timeoutErrorFromDuration = duration => new TimeoutError(`Operation timed out after '${_Duration_js__rspack_import_20/* .format */.GP(duration)}'`); +/** @internal */ +const timeout = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, duration) => { + const decoded = _Duration_js__rspack_import_20/* .fromInputUnsafe */.bN(duration); + return timeoutOrElse(self, { + duration: decoded, + orElse: () => fail(timeoutErrorFromDuration(decoded)) + }); +}); /** @internal */ const timeoutOption = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, duration) => raceFirst(asSome(self), as(sleep(duration), _Option_js__rspack_import_17.none()))); /** @internal */ @@ -42628,30 +40917,40 @@ const acquireRelease = (acquire, release, options) => contextWith(context => uni /** @internal */ const addFinalizer = finalizer => flatMap(scope, scope => contextWith(context => scopeAddFinalizerExit(scope, exit => provideContext(finalizer(exit), context)))); /** @internal */ -const onExitPrimitive = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitive */.Uf)({ - op: "OnExit", - single: false, - [_core_js__rspack_import_0/* .evaluate */._3](fiber) { - fiber._stack.push(this); - return this[_core_js__rspack_import_0/* .args */.a2][0]; - }, - [_core_js__rspack_import_0/* .contAll */.u4](fiber) { - if (fiber.interruptible && this[_core_js__rspack_import_0/* .args */.a2][2] !== true) { - fiber._stack.push(setInterruptibleTrue); - fiber.interruptible = false; +const onExitPrimitive = /*#__PURE__*/function () { + const Proto = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitiveProto */.yj)({ + op: "OnExit", + [_core_js__rspack_import_0/* .evaluate */._3](fiber) { + fiber._stack.push(this); + return this.effect; + }, + [_core_js__rspack_import_0/* .contAll */.u4](fiber) { + if (fiber.interruptible && this.interruptible !== true) { + fiber._stack.push(setInterruptibleTrue); + fiber.interruptible = false; + } + }, + [_core_js__rspack_import_0/* .contA */.ee](value, _, exit) { + exit ??= (0,_core_js__rspack_import_0/* .exitSucceed */.xt)(value); + const eff = this.onExit(exit); + return eff ? flatMap(eff, _ => exit) : exit; + }, + [_core_js__rspack_import_0/* .contE */.Sc](cause, _, exit) { + exit ??= (0,_core_js__rspack_import_0/* .exitFailCause */.cb)(cause); + const eff = this.onExit(exit); + return eff ? flatMap(combineFinalizerCause(exit, eff), _ => exit) : exit; } - }, - [_core_js__rspack_import_0/* .contA */.ee](value, _, exit) { - exit ??= (0,_core_js__rspack_import_0/* .exitSucceed */.xt)(value); - const eff = this[_core_js__rspack_import_0/* .args */.a2][1](exit); - return eff ? flatMap(eff, _ => exit) : exit; - }, - [_core_js__rspack_import_0/* .contE */.Sc](cause, _, exit) { - exit ??= (0,_core_js__rspack_import_0/* .exitFailCause */.cb)(cause); - const eff = this[_core_js__rspack_import_0/* .args */.a2][1](exit); - return eff ? flatMap(combineFinalizerCause(exit, eff), _ => exit) : exit; - } -}); + }); + const OnExitImpl = function (effect, onExit, interruptible) { + this.effect = effect; + this.onExit = onExit; + this.interruptible = interruptible; + }; + OnExitImpl.prototype = Proto; + return function (effect, onExit, interruptible) { + return new OnExitImpl(effect, onExit, interruptible); + }; +}(); /** @internal */ const onExit = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, onExitPrimitive); /** @internal */ @@ -42688,16 +40987,15 @@ const onErrorFilter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.X /** @internal */ const onInterrupt = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, finalizer) => onErrorFilter(causeFilterInterruptors, finalizer)(self)); /** @internal */ -const acquireUseRelease = (acquire, use, release) => uninterruptibleMask(restore => flatMap(acquire, a => onExitPrimitive(restore(use(a)), exit => release(a, exit), true))); +const acquireUseRelease = (acquire, use, release) => uninterruptibleMask(restore => flatMap(acquire, a => onExitPrimitive(suspend(() => restore(use(a))), exit => release(a, exit), true))); /** @internal */ -const acquireDisposable = acquire => acquireRelease(acquire, resource => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(resource, Symbol.asyncDispose) ? promise(() => resource[Symbol.asyncDispose]()) : sync(() => resource[Symbol.dispose]())); +const acquireDisposable = acquire => acquireRelease(acquire, resource => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(resource, Symbol.asyncDispose) ? promise(() => resource[Symbol.asyncDispose]()) : sync(() => resource[Symbol.dispose]())); // ---------------------------------------------------------------------------- // Caching // ---------------------------------------------------------------------------- /** @internal */ const cachedInvalidateWithTTL = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, ttl) => sync(() => { - const ttlMillis = _Duration_js__rspack_import_20/* .toMillis */.kE(_Duration_js__rspack_import_20/* .fromInputUnsafe */.bN(ttl)); - const isFinite = Number.isFinite(ttlMillis); + const ttlMillis = typeof ttl === "function" ? exit => _Duration_js__rspack_import_20/* .toMillis */.kE(_Duration_js__rspack_import_20/* .fromInputUnsafe */.bN(ttl(exit))) : (0,_Function_js__rspack_import_6/* .constant */.dY)(_Duration_js__rspack_import_20/* .toMillis */.kE(_Duration_js__rspack_import_20/* .fromInputUnsafe */.bN(ttl))); const latch = makeLatchUnsafe(false); let expiresAt = 0; let running = false; @@ -42705,16 +41003,25 @@ const cachedInvalidateWithTTL = /*#__PURE__*/(0,_Function_js__rspack_import_6/* const wait = flatMap(latch.await, () => exit); return [(0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => { const clock = fiber.getRef(ClockRef); - const now = isFinite ? clock.currentTimeMillisUnsafe() : 0; + const now = expiresAt === Infinity ? 0 : clock.currentTimeMillisUnsafe(); if (running || now < expiresAt) return exit ?? wait; running = true; latch.closeUnsafe(); exit = undefined; return onExit(self, exit_ => sync(() => { - running = false; - expiresAt = clock.currentTimeMillisUnsafe() + ttlMillis; - exit = exit_; - latch.openUnsafe(); + try { + const duration = ttlMillis(exit_); + expiresAt = clock.currentTimeMillisUnsafe() + duration; + exit = exit_; + } catch (error) { + const cause = (0,_core_js__rspack_import_0/* .causeDie */.Iu)(error); + // Publish the same combined cause that onExit returns to the owner. + exit = (0,_core_js__rspack_import_0/* .exitFailCause */.cb)(exitIsFailure(exit_) ? causeCombine(exit_.cause, cause) : cause); + throw error; + } finally { + running = false; + latch.openUnsafe(); + } })); }), sync(() => { expiresAt = 0; @@ -42725,7 +41032,21 @@ const cachedInvalidateWithTTL = /*#__PURE__*/(0,_Function_js__rspack_import_6/* /** @internal */ const cachedWithTTL = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (self, timeToLive) => map(cachedInvalidateWithTTL(self, timeToLive), tuple => tuple[0])); /** @internal */ -const cached = self => cachedWithTTL(self, _Duration_js__rspack_import_20/* .infinity */.Tn); +const cached = self => sync(() => { + const latch = makeLatchUnsafe(false); + let started = false; + let exit; + const wait = flatMap(latch.await, () => exit); + return suspend(() => { + if (exit !== undefined) return exit; + if (started) return wait; + started = true; + return onExit(self, result => sync(() => { + exit = result; + latch.openUnsafe(); + })); + }); +}); // ---------------------------------------------------------------------------- // interruption // ---------------------------------------------------------------------------- @@ -42754,6 +41075,30 @@ const setFiberInterruptible = fiber => { fiber._stack.push(setInterruptibleFalse); if (fiber._interruptedCause) return failCause(fiber._interruptedCause); }; +/** + * Makes the current fiber uninterruptible for the returned effect without an + * extra primitive. Call only within `withFiber`. + * + * @internal + */ +const fiberEnterUninterruptibleUnsafe = fiber => { + const impl = fiber; + if (!impl.interruptible) return; + impl.interruptible = false; + impl._stack.push(setInterruptibleTrue); +}; +/** + * Makes the current fiber interruptible for the returned effect without an + * extra primitive. Call only within `withFiber` and return any pending + * interruption it produces. + * + * @internal + */ +const fiberEnterInterruptibleUnsafe = fiber => { + const impl = fiber; + if (impl.interruptible) return undefined; + return setFiberInterruptible(impl); +}; /** @internal */ const interruptible = self => (0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => { if (fiber.interruptible) return self; @@ -42780,7 +41125,7 @@ const abortSignal = /*#__PURE__*/map(/*#__PURE__*/acquireRelease(/*#__PURE__*/sy // ======================================================================== /** @internal */ const all = (arg, options) => { - if ((0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(arg)) { + if ((0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(arg)) { return options?.mode === "result" ? forEach(arg, result, options) : forEach(arg, _Function_js__rspack_import_6/* .identity */.D_, options); } else if (options?.discard) { return options.mode === "result" ? forEach(Object.values(arg), result, options) : forEach(Object.values(arg), _Function_js__rspack_import_6/* .identity */.D_, options); @@ -42796,10 +41141,10 @@ const all = (arg, options) => { }); }; /** @internal */ -const partition = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, f, options) => map(forEach(elements, (a, i) => result(f(a, i)), options), results => _Array_js__rspack_import_7/* .partition */.jB(results, _Function_js__rspack_import_6/* .identity */.D_))); +const partition = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, f, options) => map(forEach(elements, (a, i) => result(f(a, i)), options), results => _Array_js__rspack_import_16/* .partition */.jB(results, _Function_js__rspack_import_6/* .identity */.D_))); /** @internal */ const reduce = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(3, (elements, zero, f) => { - const arr = _Array_js__rspack_import_7/* .fromIterable */.Ts(elements); + const arr = _Array_js__rspack_import_16/* .fromIterable */.Ts(elements); if (arr.length === 0) return sync(zero); return suspend(() => { let index = 0; @@ -42815,16 +41160,16 @@ const reduce = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(3, ( }); }); /** @internal */ -const validate = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, f, options) => flatMap(partition(elements, f, { +const validate = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, f, options) => flatMap(partition(elements, f, { concurrency: options?.concurrency }), ([excluded, satisfying]) => { - if (_Array_js__rspack_import_7/* .isArrayNonEmpty */.CZ(excluded)) { + if (_Array_js__rspack_import_16/* .isArrayNonEmpty */.CZ(excluded)) { return fail(excluded); } return options?.discard ? void_ : succeed(satisfying); })); /** @internal */ -const findFirst = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, predicate) => suspend(() => { +const findFirst = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, predicate) => suspend(() => { const iterator = elements[Symbol.iterator](); const next = iterator.next(); if (!next.done) { @@ -42843,7 +41188,7 @@ const findFirstLoop = (iterator, index, predicate, value) => flatMap(predicate(v return succeed(_Option_js__rspack_import_17.none()); }); /** @internal */ -const findFirstFilter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, filter) => suspend(() => { +const findFirstFilter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, filter) => suspend(() => { const iterator = elements[Symbol.iterator](); const next = iterator.next(); if (!next.done) { @@ -42882,12 +41227,11 @@ const whileLoop = /*#__PURE__*/(0,_core_js__rspack_import_0/* .makePrimitive */. }); /** @internal */ const forEach = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => typeof args[1] === "function", (iterable, f, options) => suspend(() => { - const concurrencyOption = options?.concurrency ?? 1; - const concurrency = concurrencyOption === "unbounded" ? Number.POSITIVE_INFINITY : Math.max(1, concurrencyOption); + const concurrency = resolveConcurrency(options?.concurrency); if (concurrency === 1) { return forEachSequential(iterable, f, options); } - const items = _Array_js__rspack_import_7/* .fromIterable */.Ts(iterable); + const items = _Array_js__rspack_import_16/* .fromIterable */.Ts(iterable); let length = items.length; if (length === 0) { return options?.discard ? void_ : succeed([]); @@ -42920,10 +41264,13 @@ const forEachSequential = (iterable, f, options) => suspend(() => { } }), out); }); -const iterateEagerImpl = options => { +/** @internal */ +const resolveConcurrency = concurrency => concurrency === "unbounded" ? Number.POSITIVE_INFINITY : Math.max(1, concurrency ?? 1); +/** @internal */ +const iterateEager = () => options => { const onItem = options.onItem; const step = options.step; - const runSequential = (state, items, index, end) => { + const runSequential = (state, items, index = 0, end = items.length) => { for (; index < end; index++) { const item = items[index]; const effect = onItem(state, item, index); @@ -42934,14 +41281,15 @@ const iterateEagerImpl = options => { if (terminal) return terminal._tag === "Failure" ? terminal : undefined; } }; + return runSequential; +}; +const iterateConcurrentImpl = options => { + const onItem = options.onItem; + const step = options.step; return (state, items, opts) => { let index = 0; - const end = opts?.end ?? items.length; - const concurrency = opts?.concurrency ?? 1; - if (concurrency === 1) { - return runSequential(state, items, 0, end); - } - const orderedStep = opts?.orderedStep === true; + const end = opts.end ?? items.length; + const concurrency = opts.concurrency; let done = false; let parentFiber; let fibers; @@ -42949,8 +41297,6 @@ const iterateEagerImpl = options => { let interrupted = false; let terminal; let effect; - let nextIndex = index; - const exits = orderedStep ? new Array(end) : undefined; const failDefect = error => { const defect = (0,_core_js__rspack_import_0/* .exitDie */.V2)(error); terminal = defect; @@ -42958,19 +41304,6 @@ const iterateEagerImpl = options => { interrupted = true; return fibers && fibers.size > 0 ? flatMap(uninterruptible(fiberInterruptAll(Array.from(fibers))), () => defect) : defect; }; - const runStep = (item, exit, currentIndex) => { - if (!orderedStep) return step(state, item, exit, currentIndex); - if (terminal) return terminal; - exits[currentIndex] = exit; - while (nextIndex < end) { - const nextExit = exits[nextIndex]; - if (nextExit === undefined) return; - exits[nextIndex] = undefined; - const index = nextIndex++; - const result = step(state, items[index], nextExit, index); - if (result) return result; - } - }; const go = () => { let paused = false; for (; !terminal && index < end; index++) { @@ -42978,7 +41311,7 @@ const iterateEagerImpl = options => { const eff = effect ?? onItem(state, item, index); // fast case (already an exit) if (effectIsExit(eff)) { - terminal = runStep(item, eff, index); + terminal = step(state, item, eff, index); if (terminal) break; // We have an effect, so enter "async" mode } else if (!parentFiber) { @@ -43006,7 +41339,7 @@ const iterateEagerImpl = options => { effect = undefined; const fiber = forkUnsafe(parentFiber, eff, true, true, "inherit"); if (fiber._exit) { - terminal = runStep(item, fiber._exit, index); + terminal = step(state, item, fiber._exit, index); if (terminal) break; continue; } @@ -43028,7 +41361,7 @@ const iterateEagerImpl = options => { } } } else { - const result = runStep(item, exit, currentIndex); + const result = step(state, item, exit, currentIndex); if (result) { terminal = result._tag === "Failure" ? (0,_core_js__rspack_import_0/* .exitFailCause */.cb)((0,_core_js__rspack_import_0/* .causeFromReasons */.b5)(result.cause.reasons.slice())) : result; go(); @@ -43073,8 +41406,8 @@ const iterateEagerImpl = options => { }; }; /** @internal */ -const iterateEager = () => iterateEagerImpl; -const forEachConcurrent = /*#__PURE__*/iterateEagerImpl({ +const iterateConcurrent = () => options => iterateConcurrentImpl(options); +const forEachConcurrent = /*#__PURE__*/iterateConcurrentImpl({ onItem(state, item, index) { return state.f(item, index); }, @@ -43084,17 +41417,17 @@ const forEachConcurrent = /*#__PURE__*/iterateEagerImpl({ } } }); -/* @internal */ +/** @internal */ const filterOrElse = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(3, (self, predicate, orElse) => flatMap(self, a => predicate(a) ? succeed(a) : orElse(a))); /** @internal */ const filterMapOrElse = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(3, (self, filter, orElse) => flatMap(self, a => { const result = filter(a); return _Result_js__rspack_import_3/* .isFailure */.N6(result) ? orElse(result.failure) : succeed(result.success); })); -/* @internal */ +/** @internal */ const filterMapOrFail = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (self, filter, orFailWith) => filterMapOrElse(self, filter, orFailWith ? x => fail(orFailWith(x)) : () => fail(new _core_js__rspack_import_0/* .NoSuchElementError */.Xm()))); /** @internal */ -const filter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, predicate, options) => suspend(() => { +const filter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, predicate, options) => suspend(() => { const out = []; return as(forEach(elements, (a, i) => { const result = predicate(a, i); @@ -43113,7 +41446,7 @@ const filter = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args }), out); })); /** @internal */ -const filterMap = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, filter) => suspend(() => { +const filterMap = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, filter) => suspend(() => { const out = []; for (const a of elements) { const result = filter(a); @@ -43124,7 +41457,7 @@ const filterMap = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(a return succeed(out); })); /** @internal */ -const filterMapEffect = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_11/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, filter, options) => suspend(() => { +const filterMapEffect = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_Predicate_js__rspack_import_10/* .isIterable */.xZ)(args[0]) && !(0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (elements, filter, options) => suspend(() => { const out = []; return as(forEach(elements, a => map(filter(a), result => { if (_Result_js__rspack_import_3/* .isSuccess */.oJ(result)) { @@ -43168,7 +41501,7 @@ const forkUnsafe = (parent, effect, immediate = false, daemon = false, uninterru } if (!daemon && !child._exit) { parentRuntime.children().add(child); - child.addObserver(() => parentRuntime._children.delete(child)); + child._parent = parentRuntime; } return child; }; @@ -43399,13 +41732,13 @@ const makeLatch = open => sync(() => makeLatchUnsafe(open)); // Tracer // ---------------------------------------------------------------------------- /** @internal */ -const tracer = /*#__PURE__*/(0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => succeed(fiber.getRef(_Tracer_js__rspack_import_14/* .Tracer */.sh))); +const tracer = /*#__PURE__*/(0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => succeed(fiber.getRef(_Tracer_js__rspack_import_12/* .Tracer */.sh))); /** @internal */ -const withTracer = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (effect, tracer) => provideService(effect, _Tracer_js__rspack_import_14/* .Tracer */.sh, tracer)); +const withTracer = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(2, (effect, tracer) => provideService(effect, _Tracer_js__rspack_import_12/* .Tracer */.sh, tracer)); /** @internal */ -const withTracerEnabled = /*#__PURE__*/provideService(_references_js__rspack_import_15/* .TracerEnabled */.rf); +const withTracerEnabled = /*#__PURE__*/provideService(_references_js__rspack_import_14/* .TracerEnabled */.rf); /** @internal */ -const withTracerTiming = /*#__PURE__*/provideService(_references_js__rspack_import_15/* .TracerTimingEnabled */.nU); +const withTracerTiming = /*#__PURE__*/provideService(_references_js__rspack_import_14/* .TracerTimingEnabled */.nU); const bigint0 = /*#__PURE__*/BigInt(0); const NoopSpanProto = { _tag: "Span", @@ -43430,36 +41763,36 @@ const NoopSpanProto = { const noopSpan = options => Object.assign(Object.create(NoopSpanProto), options); const filterDisablePropagation = span => { if (!span) return _Option_js__rspack_import_17.none(); - return _Context_js__rspack_import_5/* .get */.Jt(span.annotations, _Tracer_js__rspack_import_14/* .DisablePropagation */.DW) ? span._tag === "Span" ? filterDisablePropagation(_Option_js__rspack_import_17.getOrUndefined(span.parent)) : _Option_js__rspack_import_17.none() : _Option_js__rspack_import_17.some(span); + return _Context_js__rspack_import_5/* .get */.Jt(span.annotations, _Tracer_js__rspack_import_12/* .DisablePropagation */.DW) ? span._tag === "Span" ? filterDisablePropagation(_Option_js__rspack_import_17.getOrUndefined(span.parent)) : _Option_js__rspack_import_17.none() : _Option_js__rspack_import_17.some(span); }; /** @internal */ const makeSpanUnsafe = (fiber, name, options) => { - const disablePropagation = !fiber.getRef(_references_js__rspack_import_15/* .TracerEnabled */.rf) || options?.annotations && _Context_js__rspack_import_5/* .get */.Jt(options.annotations, _Tracer_js__rspack_import_14/* .DisablePropagation */.DW); - const parent = options?.parent !== undefined ? _Option_js__rspack_import_17.some(options.parent) : options?.root ? _Option_js__rspack_import_17.none() : filterDisablePropagation(fiber.currentSpan); + const disablePropagation = !fiber.getRef(_references_js__rspack_import_14/* .TracerEnabled */.rf) || options?.annotations && _Context_js__rspack_import_5/* .get */.Jt(options.annotations, _Tracer_js__rspack_import_12/* .DisablePropagation */.DW); + const parent = options?.parent !== undefined ? _Option_js__rspack_import_17.some(options.parent) : options?.root ? _Option_js__rspack_import_17.none() : filterDisablePropagation(fiber.cache.span); let span; if (disablePropagation) { span = noopSpan({ name, parent, - annotations: _Context_js__rspack_import_5/* .add */.WQ(options?.annotations ?? _Context_js__rspack_import_5/* .empty */.Ie(), _Tracer_js__rspack_import_14/* .DisablePropagation */.DW, true) + annotations: _Context_js__rspack_import_5/* .add */.WQ(options?.annotations ?? _Context_js__rspack_import_5/* .empty */.Ie(), _Tracer_js__rspack_import_12/* .DisablePropagation */.DW, true) }); } else { - const tracer = fiber.getRef(_Tracer_js__rspack_import_14/* .Tracer */.sh); + const tracer = fiber.getRef(_Tracer_js__rspack_import_12/* .Tracer */.sh); const clock = fiber.getRef(ClockRef); - const timingEnabled = fiber.getRef(_references_js__rspack_import_15/* .TracerTimingEnabled */.nU); - const annotationsFromEnv = fiber.getRef(_references_js__rspack_import_15/* .TracerSpanAnnotations */.ce); - const linksFromEnv = fiber.getRef(_references_js__rspack_import_15/* .TracerSpanLinks */.ls); - const level = options?.level ?? fiber.getRef(_Tracer_js__rspack_import_14/* .CurrentTraceLevel */.pX); + const timingEnabled = fiber.getRef(_references_js__rspack_import_14/* .TracerTimingEnabled */.nU); + const annotationsFromEnv = fiber.getRef(_references_js__rspack_import_14/* .TracerSpanAnnotations */.ce); + const linksFromEnv = fiber.getRef(_references_js__rspack_import_14/* .TracerSpanLinks */.ls); + const level = options?.level ?? fiber.getRef(_Tracer_js__rspack_import_12/* .CurrentTraceLevel */.pX); const links = options?.links !== undefined ? [...linksFromEnv, ...options.links] : linksFromEnv.length === 0 ? [] : linksFromEnv.slice(); span = tracer.span({ name, parent, annotations: options?.annotations ?? _Context_js__rspack_import_5/* .empty */.Ie(), links, - startTime: timingEnabled ? clock.currentTimeNanosUnsafe() : BigInt(0), + startTime: timingEnabled ? clock.currentTimeNanosUnsafe() : bigint0, kind: options?.kind ?? "internal", root: options?.root ?? _Option_js__rspack_import_17.isNone(parent), - sampled: options?.sampled ?? (_Option_js__rspack_import_17.isSome(parent) && parent.value.sampled === false ? false : !isLogLevelGreaterThan(fiber.getRef(_Tracer_js__rspack_import_14/* .MinimumTraceLevel */.EW), level)) + sampled: options?.sampled ?? (_Option_js__rspack_import_17.isSome(parent) && parent.value.sampled === false ? false : !isLogLevelGreaterThan(fiber.getRef(_Tracer_js__rspack_import_12/* .MinimumTraceLevel */.EW), level)) }); for (const key in annotationsFromEnv) { span.attribute(key, annotationsFromEnv[key]); @@ -43479,7 +41812,7 @@ const makeSpanScoped = (name, options) => uninterruptible((0,_core_js__rspack_im const scope = _Context_js__rspack_import_5/* .getUnsafe */.fp(fiber.context, scopeTag); const span = makeSpanUnsafe(fiber, name, options ?? {}); const clock = fiber.getRef(ClockRef); - const timingEnabled = fiber.getRef(_references_js__rspack_import_15/* .TracerTimingEnabled */.nU); + const timingEnabled = fiber.getRef(_references_js__rspack_import_14/* .TracerTimingEnabled */.nU); return as(scopeAddFinalizerExit(scope, exit => endSpan(span, exit, clock, timingEnabled)), span); })); /** @internal */ @@ -43495,16 +41828,16 @@ const withSpanScoped = function () { }; const provideSpanStackFrame = (name, stack) => { stack = typeof stack === "function" ? stack : _Function_js__rspack_import_6/* .constUndefined */.MN; - return updateService(_references_js__rspack_import_15/* .CurrentStackFrame */.vA, parent => ({ + return updateService(_references_js__rspack_import_14/* .CurrentStackFrame */.vA, parent => ({ name, stack, parent })); }; /** @internal */ -const spanAnnotations = _references_js__rspack_import_15/* .TracerSpanAnnotations */.ce; +const spanAnnotations = _references_js__rspack_import_14/* .TracerSpanAnnotations */.ce; /** @internal */ -const spanLinks = _references_js__rspack_import_15/* .TracerSpanLinks */.ls; +const spanLinks = _references_js__rspack_import_14/* .TracerSpanLinks */.ls; /** @internal */ const linkSpans = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (self, span, attributes = {}) => { const spans = Array.isArray(span) ? span : [span]; @@ -43512,7 +41845,7 @@ const linkSpans = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(a span, attributes })); - return updateService(self, _references_js__rspack_import_15/* .TracerSpanLinks */.ls, current => [...current, ...links]); + return updateService(self, _references_js__rspack_import_14/* .TracerSpanLinks */.ls, current => [...current, ...links]); }); /** @internal */ const endSpan = (span, exit, clock, timingEnabled) => sync(() => { @@ -43526,11 +41859,11 @@ const useSpan = (name, ...args) => { return (0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => { const span = makeSpanUnsafe(fiber, name, options); const clock = fiber.getRef(ClockRef); - const timingEnabled = fiber.getRef(_references_js__rspack_import_15/* .TracerTimingEnabled */.nU); - return onExit((0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => evaluate(span)), exit => endSpan(span, exit, clock, timingEnabled)); + const timingEnabled = fiber.getRef(_references_js__rspack_import_14/* .TracerTimingEnabled */.nU); + return onExit(suspend(() => (0,_Utils_js__rspack_import_18/* .internalCall */.s)(() => evaluate(span))), exit => endSpan(span, exit, clock, timingEnabled)); }); }; -const provideParentSpan = /*#__PURE__*/provideService(_Tracer_js__rspack_import_14/* .ParentSpan */.Tv); +const provideParentSpan = /*#__PURE__*/provideService(_Tracer_js__rspack_import_12/* .ParentSpan */.Tv); /** @internal */ const withParentSpan = function () { const dataFirst = (0,_core_js__rspack_import_0/* .isEffect */.yw)(arguments[0]); @@ -43560,7 +41893,7 @@ const withSpan = function () { return (self, ...args) => useSpan(name, fnArg ? fnArg(...args) : options, span => withParentSpan(self, span, traceOptions)); }; /** @internal */ -const annotateSpans = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (effect, ...args) => updateService(effect, _references_js__rspack_import_15/* .TracerSpanAnnotations */.ce, annotations => { +const annotateSpans = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual */.XY)(args => (0,_core_js__rspack_import_0/* .isEffect */.yw)(args[0]), (effect, ...args) => updateService(effect, _references_js__rspack_import_14/* .TracerSpanAnnotations */.ce, annotations => { const newAnnotations = args.length === 1 ? { ...annotations, ...args[0] @@ -43594,7 +41927,7 @@ const currentSpan = /*#__PURE__*/(0,_core_js__rspack_import_0/* .withFiber */.R6 return span ? succeed(span) : fail(new _core_js__rspack_import_0/* .NoSuchElementError */.Xm()); }); /** @internal */ -const currentParentSpan = /*#__PURE__*/serviceOptional(_Tracer_js__rspack_import_14/* .ParentSpan */.Tv); +const currentParentSpan = /*#__PURE__*/serviceOptional(_Tracer_js__rspack_import_12/* .ParentSpan */.Tv); // ---------------------------------------------------------------------------- // Clock // ---------------------------------------------------------------------------- @@ -43680,7 +42013,7 @@ const monotonicTimeNanos = /*#__PURE__*/(/* unused pure expression or super */ n /** @internal */ const TimeoutErrorTypeId = "~effect/Cause/TimeoutError"; /** @internal */ -const isTimeoutError = u => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(u, TimeoutErrorTypeId); +const isTimeoutError = u => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(u, TimeoutErrorTypeId); /** @internal */ class TimeoutError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .TaggedError */.rN)("TimeoutError") { [TimeoutErrorTypeId] = TimeoutErrorTypeId; @@ -43693,7 +42026,7 @@ class TimeoutError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .TaggedEr /** @internal */ const IllegalArgumentErrorTypeId = "~effect/Cause/IllegalArgumentError"; /** @internal */ -const isIllegalArgumentError = u => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(u, IllegalArgumentErrorTypeId); +const isIllegalArgumentError = u => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(u, IllegalArgumentErrorTypeId); /** @internal */ class IllegalArgumentError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .TaggedError */.rN)("IllegalArgumentError") { [IllegalArgumentErrorTypeId] = IllegalArgumentErrorTypeId; @@ -43706,7 +42039,7 @@ class IllegalArgumentError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* . /** @internal */ const ExceededCapacityErrorTypeId = "~effect/Cause/ExceededCapacityError"; /** @internal */ -const isExceededCapacityError = u => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(u, ExceededCapacityErrorTypeId); +const isExceededCapacityError = u => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(u, ExceededCapacityErrorTypeId); /** @internal */ class ExceededCapacityError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .TaggedError */.rN)("ExceededCapacityError") { [ExceededCapacityErrorTypeId] = ExceededCapacityErrorTypeId; @@ -43719,7 +42052,7 @@ class ExceededCapacityError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* /** @internal */ const AsyncFiberErrorTypeId = "~effect/Cause/AsyncFiberError"; /** @internal */ -const isAsyncFiberError = u => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(u, AsyncFiberErrorTypeId); +const isAsyncFiberError = u => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(u, AsyncFiberErrorTypeId); /** @internal */ class AsyncFiberError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .TaggedError */.rN)("AsyncFiberError") { [AsyncFiberErrorTypeId] = AsyncFiberErrorTypeId; @@ -43733,7 +42066,7 @@ class AsyncFiberError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .Tagge /** @internal */ const UnknownErrorTypeId = "~effect/Cause/UnknownError"; /** @internal */ -const isUnknownError = u => (0,_Predicate_js__rspack_import_11/* .hasProperty */.i5)(u, UnknownErrorTypeId); +const isUnknownError = u => (0,_Predicate_js__rspack_import_10/* .hasProperty */.i5)(u, UnknownErrorTypeId); /** @internal */ class UnknownError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .TaggedError */.rN)("UnknownError") { [UnknownErrorTypeId] = UnknownErrorTypeId; @@ -43748,7 +42081,7 @@ class UnknownError extends /*#__PURE__*/(0,_core_js__rspack_import_0/* .TaggedEr // Console // ---------------------------------------------------------------------------- /** @internal */ -const ConsoleRef = /*#__PURE__*/_Context_js__rspack_import_5/* .Reference */.Or("effect/Console/CurrentConsole", { +const ConsoleRef = /*#__PURE__*/_Context_js__rspack_import_5/* .Reference */.Or("effect/Console", { defaultValue: () => globalThis.console }); // ---------------------------------------------------------------------------- @@ -43783,7 +42116,7 @@ const isLogLevelGreaterThan = /*#__PURE__*/_Order_js__rspack_import_24/* .isGrea // Logger // ---------------------------------------------------------------------------- /** @internal */ -const CurrentLoggers = /*#__PURE__*/_Context_js__rspack_import_5/* .Reference */.Or("effect/Loggers/CurrentLoggers", { +const CurrentLoggers = /*#__PURE__*/_Context_js__rspack_import_5/* .Reference */.Or("effect/Logger/CurrentLoggers", { defaultValue: () => new Set([defaultLogger, tracerLogger]) }); /** @internal */ @@ -43794,7 +42127,7 @@ const LogToStderr = /*#__PURE__*/_Context_js__rspack_import_5/* .Reference */.Or const annotateLogsScoped = function () { const entries = typeof arguments[0] === "string" ? [[arguments[0], arguments[1]]] : Object.entries(arguments[0]); return uninterruptible((0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => { - const prev = fiber.getRef(_references_js__rspack_import_15/* .CurrentLogAnnotations */.iL); + const prev = fiber.getRef(_references_js__rspack_import_14/* .CurrentLogAnnotations */.iL); const next = { ...prev }; @@ -43802,22 +42135,22 @@ const annotateLogsScoped = function () { const [key, value] = entries[i]; _record_js__rspack_import_21/* .assignProperty */.x(next, key, value); } - fiber.setContext(_Context_js__rspack_import_5/* .add */.WQ(fiber.context, _references_js__rspack_import_15/* .CurrentLogAnnotations */.iL, next)); + fiber.setContext(_Context_js__rspack_import_5/* .add */.WQ(fiber.context, _references_js__rspack_import_14/* .CurrentLogAnnotations */.iL, next)); return scopeAddFinalizerExit(_Context_js__rspack_import_5/* .getUnsafe */.fp(fiber.context, scopeTag), _ => { - const current = fiber.getRef(_references_js__rspack_import_15/* .CurrentLogAnnotations */.iL); + const current = fiber.getRef(_references_js__rspack_import_14/* .CurrentLogAnnotations */.iL); const next = { ...current }; for (let i = 0; i < entries.length; i++) { const [key, value] = entries[i]; - if (current[key] !== value) continue; + if (current[key] !== value && !Object.is(current[key], value)) continue; if (Object.hasOwn(prev, key)) { _record_js__rspack_import_21/* .assignProperty */.x(next, key, prev[key]); } else { delete next[key]; } } - fiber.setContext(_Context_js__rspack_import_5/* .add */.WQ(fiber.context, _references_js__rspack_import_15/* .CurrentLogAnnotations */.iL, next)); + fiber.setContext(_Context_js__rspack_import_5/* .add */.WQ(fiber.context, _references_js__rspack_import_14/* .CurrentLogAnnotations */.iL, next)); return void_; }); })); @@ -43830,7 +42163,7 @@ const LoggerProto = { _Output: _Function_js__rspack_import_6/* .identity */.D_ }, pipe() { - return (0,_Pipeable_js__rspack_import_12/* .pipeArguments */.tT)(this, arguments); + return (0,_Pipeable_js__rspack_import_11/* .pipeArguments */.tT)(this, arguments); } }; /** @internal */ @@ -43889,8 +42222,8 @@ const logWithLevel = level => (...message) => { cause = _core_js__rspack_import_0/* .causeEmpty */.DH; } return (0,_core_js__rspack_import_0/* .withFiber */.R6)(fiber => { - const logLevel = level ?? fiber.currentLogLevel; - if (isLogLevelGreaterThan(fiber.minimumLogLevel, logLevel)) { + const logLevel = level ?? fiber.cache.logLevel; + if (isLogLevelGreaterThan(fiber.cache.minimumLogLevel, logLevel)) { return void_; } const clock = fiber.getRef(ClockRef); @@ -43957,24 +42290,22 @@ const consolePretty = options => { // property accesses, which bundlers must retain as possible side effects const process = globalThis.process; const hasProcessStdout = typeof process?.stdout === "object" && process.stdout !== null; - const processStdoutIsTTY = hasProcessStdout && process.stdout.isTTY === true; - const hasProcessStdoutOrDeno = hasProcessStdout || "Deno" in globalThis; - const mode_ = options?.mode ?? "auto"; - const mode = mode_ === "auto" ? hasProcessStdoutOrDeno ? "tty" : "browser" : mode_; - const isBrowser = mode === "browser"; - const showColors = typeof options?.colors === "boolean" ? options.colors : processStdoutIsTTY || isBrowser; - const formatDate = options?.formatDate ?? defaultDateFormat; - return isBrowser ? prettyLoggerBrowser({ - colors: showColors, - formatDate - }) : prettyLoggerTty({ - colors: showColors, - formatDate - }); + const isDeno = "Deno" in globalThis; + const mode = options?.mode ?? "auto"; + const isTtyLogger = mode === "auto" ? hasProcessStdout || isDeno : mode === "tty"; + return isTtyLogger ? prettyLoggerTty(options) : prettyLoggerBrowser(options); }; +/** @internal */ const prettyLoggerTty = options => { - const processIsBun = globalThis.process?.isBun === true; - const color = options.colors ? withColor : withColorNoop; + const formatDate = options?.formatDate ?? defaultDateFormat; + // evaluated lazily so the module-level bundle stays free of `process` + // property accesses, which bundlers must retain as possible side effects + const process = globalThis.process; + const hasProcessStdout = typeof process?.stdout === "object" && process.stdout !== null; + const processStdoutIsTTY = hasProcessStdout && process.stdout.isTTY === true; + const showColors = typeof options?.colors === "boolean" ? options.colors : processStdoutIsTTY; + const color = showColors ? withColor : withColorNoop; + const processIsBun = process?.isBun === true; return loggerMake(({ cause, date, @@ -43986,7 +42317,7 @@ const prettyLoggerTty = options => { // oxlint-disable-next-line no-console const log = fiber.getRef(LogToStderr) ? console.error : console.log; const message = Array.isArray(message_) ? message_.slice() : [message_]; - let firstLine = color(`[${options.formatDate(date)}]`, colors.white) + ` ${color(logLevel.toUpperCase(), ...logLevelColors[logLevel])}` + ` (#${fiber.id})`; + let firstLine = color(`[${formatDate(date)}]`, colors.white) + ` ${color(logLevel.toUpperCase(), ...logLevelColors[logLevel])}` + ` (#${fiber.id})`; const now = date.getTime(); const spans = fiber.getRef(CurrentLogSpans); for (const span of spans) { @@ -44020,8 +42351,11 @@ const prettyLoggerTty = options => { if (!processIsBun) console.groupEnd(); }); }; +/** @internal */ const prettyLoggerBrowser = options => { - const color = options.colors ? "%c" : ""; + const showColors = options?.colors !== false; + const color = showColors ? "%c" : ""; + const formatDate = options?.formatDate ?? defaultDateFormat; return loggerMake(({ cause, date, @@ -44031,13 +42365,13 @@ const prettyLoggerBrowser = options => { }) => { const console = fiber.getRef(ConsoleRef); const message = Array.isArray(message_) ? message_.slice() : [message_]; - let firstLine = `${color}[${options.formatDate(date)}]`; + let firstLine = `${color}[${formatDate(date)}]`; const firstParams = []; - if (options.colors) { + if (showColors) { firstParams.push("color:gray"); } firstLine += ` ${color}${logLevel.toUpperCase()}${color} (#${fiber.id})`; - if (options.colors) { + if (showColors) { firstParams.push(logLevelStyle[logLevel], ""); } const now = date.getTime(); @@ -44051,7 +42385,7 @@ const prettyLoggerBrowser = options => { const firstMaybeString = structuredMessage(message[0]); if (typeof firstMaybeString === "string") { firstLine += ` ${color}${firstMaybeString}`; - if (options.colors) { + if (showColors) { firstParams.push("color:deepskyblue"); } messageIndex++; @@ -44072,7 +42406,7 @@ const prettyLoggerBrowser = options => { const annotations = fiber.getRef(CurrentLogAnnotations); for (const [key, value] of Object.entries(annotations)) { const redacted = redact(value); - if (options.colors) { + if (showColors) { // oxlint-disable-next-line no-console console.log(`%c${key}:`, "color:gray", redacted); } else { @@ -44097,12 +42431,12 @@ const defaultLogger = /*#__PURE__*/loggerMake(({ message_.push(causePretty(cause)); } const now = date.getTime(); - const spans = fiber.getRef(_references_js__rspack_import_15/* .CurrentLogSpans */.d8); + const spans = fiber.getRef(_references_js__rspack_import_14/* .CurrentLogSpans */.d8); let spanString = ""; for (const span of spans) { spanString += ` ${formatLogSpan(span, now)}`; } - const annotations = fiber.getRef(_references_js__rspack_import_15/* .CurrentLogAnnotations */.iL); + const annotations = fiber.getRef(_references_js__rspack_import_14/* .CurrentLogAnnotations */.iL); if (Object.keys(annotations).length > 0) { message_.push(annotations); } @@ -44119,8 +42453,8 @@ const tracerLogger = /*#__PURE__*/loggerMake(({ message }) => { const clock = fiber.getRef(ClockRef); - const annotations = fiber.getRef(_references_js__rspack_import_15/* .CurrentLogAnnotations */.iL); - const span = fiber.currentSpan; + const annotations = fiber.getRef(_references_js__rspack_import_14/* .CurrentLogAnnotations */.iL); + const span = fiber.cache.span; if (span === undefined || span._tag === "ExternalSpan") return; const attributes = {}; for (const [key, value] of Object.entries(annotations)) { @@ -44151,7 +42485,7 @@ const withErrorReporting = /*#__PURE__*/(0,_Function_js__rspack_import_6/* .dual }))); /** @internal */ const reportCauseUnsafe = (fiber, cause, defectsOnly) => { - const reporters = fiber.getRef(_references_js__rspack_import_15/* .CurrentErrorReporters */.oQ); + const reporters = fiber.getRef(_references_js__rspack_import_14/* .CurrentErrorReporters */.oQ); if (reporters.size === 0) return; if (defectsOnly && !hasDies(cause)) return; const opts = { @@ -44633,7 +42967,7 @@ __webpack_require__.d(__webpack_exports__, { }, "./node_modules/effect/dist/internal/metric.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) { /** @internal */ -const FiberRuntimeMetricsKey = "effect/observability/Metric/FiberRuntimeMetricsKey"; +const FiberRuntimeMetricsKey = "effect/Metric/FiberRuntimeMetrics"; //# sourceMappingURL=metric.js.map __webpack_require__.d(__webpack_exports__, { }, { @@ -44660,7 +42994,7 @@ __webpack_require__.d(__webpack_exports__, { -const TypeId = "~effect/data/Option"; +const TypeId = "~effect/Option"; const CommonProto = { [TypeId]: { _A: _ => _ @@ -44727,11 +43061,12 @@ const isSome = fa => fa._tag === "Some"; /** @internal */ const none = /*#__PURE__*/Object.create(NoneProto); /** @internal */ -const some = value => { - const a = Object.create(SomeProto); - a.value = value; - return a; +const SomeImpl = function (value) { + this.value = value; }; +SomeImpl.prototype = SomeProto; +/** @internal */ +const some = value => new SomeImpl(value); //# sourceMappingURL=option.js.map __webpack_require__.d(__webpack_exports__, { }, { @@ -44791,6 +43126,7 @@ const CurrentStackFrame = /*#__PURE__*/_Context_js__rspack_import_0/* .Reference }); /** @internal */ const TracerEnabled = /*#__PURE__*/_Context_js__rspack_import_0/* .Reference */.Or("effect/References/TracerEnabled", { + fiberCached: true, defaultValue: _Function_js__rspack_import_1/* .constTrue */.ue }); /** @internal */ @@ -44869,7 +43205,9 @@ const request = /*#__PURE__*/(0,_Function_js__rspack_import_0/* .dual */.XY)(2, const requestUnsafe = (self, options) => { const entry = addEntry(options.resolver, self, options.onExit, { context: options.context, - currentScheduler: _Context_js__rspack_import_3/* .get */.Jt(options.context, _Scheduler_js__rspack_import_4/* .Scheduler */._F) + cache: { + scheduler: _Context_js__rspack_import_3/* .get */.Jt(options.context, _Scheduler_js__rspack_import_4/* .Scheduler */._F) + } }); return () => removeEntryUnsafe(options.resolver, entry); }; @@ -44890,8 +43228,9 @@ const addEntry = (resolver, request, resume, fiber) => { completeUnsafe(effect) { if (completed) return; completed = true; + // Removed entries still notify resolver hooks, but not their cancelled callers. + if (batch && !batch.entrySet.delete(entry)) return; resume(effect); - batch?.entrySet.delete(entry); } }); if (resolver.preCheck !== undefined && !resolver.preCheck(entry)) { @@ -44935,7 +43274,7 @@ const addEntry = (resolver, request, resume, fiber) => { } batchMap.set(key, batch); batch.fiber = _effect_js__rspack_import_1/* .runForkWith */.eJC(fiber.context)(batch.delayEffect, { - scheduler: fiber.currentScheduler + scheduler: fiber.cache.scheduler }); } batch.entrySet.add(entry); @@ -44943,7 +43282,7 @@ const addEntry = (resolver, request, resume, fiber) => { if (batch.resolver.collectWhile(batch.entries)) return entry; batch.fiber.interruptUnsafe(fiber.id); batch.fiber = _effect_js__rspack_import_1/* .runForkWith */.eJC(fiber.context)(runBatch(batch), { - scheduler: fiber.currentScheduler + scheduler: fiber.cache.scheduler }); return entry; }; @@ -44954,12 +43293,16 @@ const removeEntryUnsafe = (resolver, entry) => { const key = resolver.batchKey(entry); const batch = batchMap.get(key); if (!batch) return; - batch.entries.delete(entry); + if (!batch.entries.delete(entry)) return; batch.entrySet.delete(entry); + let fiber; if (batch.entries.size === 0) { batchMap.delete(key); - batch.fiber?.interruptUnsafe(); + fiber = batch.fiber; } + // Delay finalizers may enqueue new requests, so complete the removed entry first. + entry.completeUnsafe(_effect_js__rspack_import_1/* .exitInterrupt */._sz()); + fiber?.interruptUnsafe(); }; const maybeRemoveEntry = (resolver, entry) => _effect_js__rspack_import_1/* .sync */.OH5(() => removeEntryUnsafe(resolver, entry)); function runBatch(batch) { @@ -44995,7 +43338,7 @@ __webpack_require__.d(__webpack_exports__, { -const TypeId = "~effect/data/Result"; +const TypeId = "~effect/Result"; const CommonProto = { [TypeId]: { /* v8 ignore next 2 */ @@ -45054,17 +43397,19 @@ const isFailure = result => result._tag === "Failure"; /** @internal */ const isSuccess = result => result._tag === "Success"; /** @internal */ -const fail = failure => { - const a = Object.create(FailureProto); - a.failure = failure; - return a; +const FailureImpl = function (failure) { + this.failure = failure; }; +FailureImpl.prototype = FailureProto; +/** @internal */ +const fail = failure => new FailureImpl(failure); /** @internal */ -const succeed = success => { - const a = Object.create(SuccessProto); - a.success = success; - return a; +const SuccessImpl = function (success) { + this.success = success; }; +SuccessImpl.prototype = SuccessProto; +/** @internal */ +const succeed = success => new SuccessImpl(success); /** @internal */ const getFailure = self => isSuccess(self) ? _option_js__rspack_import_7/* .none */.dv : _option_js__rspack_import_7/* .some */.zN(self.failure); /** @internal */ @@ -45246,6 +43591,12 @@ const addSpanStackTrace = options => { return options; } const limit = (0,_stackTraceLimit_js__rspack_import_0/* .getStackTraceLimit */.jt)(); + if (limit === 0 && options?.captureStackTrace !== true) { + return { + ...options, + captureStackTrace: false + }; + } (0,_stackTraceLimit_js__rspack_import_0/* .setStackTraceLimit */.ft)(3); const traceError = new Error(); (0,_stackTraceLimit_js__rspack_import_0/* .setStackTraceLimit */.ft)(limit); @@ -61196,14 +59547,6 @@ __webpack_require__.r = (exports) => { Object.defineProperty(exports, '__esModule', { value: true }); }; })(); -// webpack/runtime/node_module_decorator -(() => { -__webpack_require__.nmd = (module) => { - module.paths = []; - if (!module.children) module.children = []; - return module; -}; -})(); // module cache are used so entry inlining is disabled // startup // Load entry module and return exports diff --git a/package-lock.json b/package-lock.json index 4218cf8..6076a34 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,12 +14,12 @@ "grok-bot": "dist/bin/gbot.mjs" }, "devDependencies": { - "@agent-bundle/runtime": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@477abe956bdb1a862d957733c9d936580d65b5a9", + "@agent-bundle/runtime": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@4f62216f30", "@changesets/cli": "3.0.3", "@rstest/core": "0.11.12", "@types/node": "^24.0.0", "@types/react": "^19.2.18", - "agent-bundle": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/agent-bundle@477abe956bdb1a862d957733c9d936580d65b5a9", + "agent-bundle": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/agent-bundle@4f62216f30", "react": "19.3.0", "react-dom": "19.3.0", "typescript": "7.0.2", @@ -30,17 +30,17 @@ } }, "node_modules/@agent-bundle/runtime": { - "version": "0.0.0-preview-477abe9", - "resolved": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@477abe956bdb1a862d957733c9d936580d65b5a9", - "integrity": "sha512-FSC0YP2vXgZtBRfRIZzEtoexcvYKP39ziMckudo78D2HPd+PisVaNHEC1OhIPKTkp9Ovq/L4XmLktR3tQdb70w==", + "version": "0.0.0-preview-4f62216", + "resolved": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@4f62216f30", + "integrity": "sha512-q2u644blp60cHTkmrQVQwWKTtJN7xAl+PPgZ/eYHp51isjui6bD1Z1GF0vL8SgqVew3eu72mrnZuEW5X78Sjzg==", "dev": true, "license": "Apache-2.0", "dependencies": { "@modelcontextprotocol/server": "2.0.0", - "effect": "4.0.0-rc.112", + "effect": "4.0.0-rc.117", "flare-redact": "1.6.1", "react-server-dom-rspack": "0.1.0", - "rsc-markdown-stream": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/rsc-markdown-stream@477abe956bdb1a862d957733c9d936580d65b5a9" + "rsc-markdown-stream": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/rsc-markdown-stream@4f62216f307e3d70e82ac2c25bbd55e72c0880a8" }, "engines": { "node": ">=22.19.0" @@ -49,7 +49,7 @@ "@rspack/core": "^2.2.0-0", "react": "^19.2.0", "react-dom": "^19.2.0", - "zod": "^4.5.4" + "zod": "^4.6.4" }, "peerDependenciesMeta": { "@rspack/core": { @@ -517,9 +517,9 @@ } }, "node_modules/@effect/platform-node-shared": { - "version": "4.0.0-rc.112", - "resolved": "https://registry.npmjs.org/@effect/platform-node-shared/-/platform-node-shared-4.0.0-rc.112.tgz", - "integrity": "sha512-ttjz0xKamFN7vL8pNDYVwddJLjZvqKePc05djlz2VcdaKbLsnYbtMnL1rbOfHgEnIUSHGh7FkjaN4DM1Ov81sQ==", + "version": "4.0.0-rc.117", + "resolved": "https://registry.npmjs.org/@effect/platform-node-shared/-/platform-node-shared-4.0.0-rc.117.tgz", + "integrity": "sha512-GyRkEfLBG49MwJe+/XDPiXYcQ44RA9p2z0AurlsWhR1cd1PqOUMEZU1pORL+/R5hR8aH6ZuqoJYD8lAc6h+wlA==", "dev": true, "license": "MIT", "dependencies": { @@ -530,7 +530,7 @@ "node": ">=18.0.0" }, "peerDependencies": { - "effect": "^4.0.0-rc.112" + "effect": "^4.0.0-rc.117" } }, "node_modules/@emnapi/core": { @@ -690,90 +690,6 @@ "node": ">=20" } }, - "node_modules/@msgpackr-extract/msgpackr-extract-darwin-arm64": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-darwin-arm64/-/msgpackr-extract-darwin-arm64-3.0.4.tgz", - "integrity": "sha512-LCkGo6JDfaBhgST7UpPWgNgLINpcpabaHfyz5OBx75nUYxBsaEPxjnyNjWpeb/xBup/682QnBfRBy2/LvPutZQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@msgpackr-extract/msgpackr-extract-darwin-x64": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-darwin-x64/-/msgpackr-extract-darwin-x64-3.0.4.tgz", - "integrity": "sha512-zExlW9zUJKZH/tOtVMttwjKa4Xm/3KcNjnE3dPN92uCktwavMxpgCA3MoJK/DOnTWsQgo224OaST27/mPNAf+w==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@msgpackr-extract/msgpackr-extract-linux-arm": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-arm/-/msgpackr-extract-linux-arm-3.0.4.tgz", - "integrity": "sha512-Tg3yX65f5GbtXLkrYEHE5oibZG9epyYWas7FogTTEJeDEF9JlXJzKgXaNhT3UXlTOeA+AfZpYZYZ0uPj7Cfquw==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@msgpackr-extract/msgpackr-extract-linux-arm64": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-arm64/-/msgpackr-extract-linux-arm64-3.0.4.tgz", - "integrity": "sha512-dgX0P/9wGPJeHFBG+ZmhgE6bmtMt7NP5CRBGyyktpopdk/mW4POnrpQsSLtKI1dwpc+pPLuXHDh6vvskyQE/sw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@msgpackr-extract/msgpackr-extract-linux-x64": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-x64/-/msgpackr-extract-linux-x64-3.0.4.tgz", - "integrity": "sha512-8TNXMEjJc3QEy7R/x1INhgiU+XakDAFUzBhaz7+Rbrs8NH5UQeHQxxmzsSBJGyV6I1jW79undiQm8tOI+D+8FQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@msgpackr-extract/msgpackr-extract-win32-x64": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-win32-x64/-/msgpackr-extract-win32-x64-3.0.4.tgz", - "integrity": "sha512-CmCXPQrkbwExx3j946/PtHWHbYJiCRBRDl4BlkRQcJB/YOwQxJRTpoo7aTsortjgoJ1x7opzTSxn7C+ASSLVjQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, "node_modules/@napi-rs/wasm-runtime": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.6.tgz", @@ -1825,13 +1741,13 @@ } }, "node_modules/agent-bundle": { - "version": "0.0.0-preview-477abe9", - "resolved": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/agent-bundle@477abe956bdb1a862d957733c9d936580d65b5a9", - "integrity": "sha512-FNKUzdRgKlLzX/iRpJkgWGXi+meLoSVjXPYTJ/2q87ORXGPrqerXIuM5LmG4Gt7fVxCcMgD7DOXzn58nZIpCPw==", + "version": "0.0.0-preview-4f62216", + "resolved": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/agent-bundle@4f62216f30", + "integrity": "sha512-kn/oPCRyBeXzNBUqyzINcnlHJwInUlP0lS490FMOaPgeoQB6341MZkaA0T4nXUBCyeKF/kgjqlxiQCRNacCIhw==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@effect/platform-node-shared": "4.0.0-rc.112", + "@effect/platform-node-shared": "4.0.0-rc.117", "@modelcontextprotocol/client": "2.0.0", "@modelcontextprotocol/node": "2.0.0", "@modelcontextprotocol/server": "2.0.0", @@ -1845,7 +1761,7 @@ "ajv-formats": "3.0.1", "chokidar": "5.0.0", "commander": "15.0.0", - "effect": "4.0.0-rc.112", + "effect": "4.0.0-rc.117", "es-module-lexer": "3.0.2", "fast-glob": "3.3.3", "ignore": "7.0.9", @@ -1861,7 +1777,7 @@ "node": ">=22.19.0" }, "peerDependencies": { - "@agent-bundle/runtime": "0.0.0-preview-477abe9", + "@agent-bundle/runtime": "0.0.0-preview-4f62216", "@rstest/core": "^0.11.10", "react": "^19.2.0" }, @@ -2018,27 +1934,12 @@ "dev": true, "license": "MIT" }, - "node_modules/detect-libc": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", - "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", - "dev": true, - "license": "Apache-2.0", - "optional": true, - "engines": { - "node": ">=8" - } - }, "node_modules/effect": { - "version": "4.0.0-rc.112", - "resolved": "https://registry.npmjs.org/effect/-/effect-4.0.0-rc.112.tgz", - "integrity": "sha512-wXxwuh1Ywnv4cPRM3Wfa0vDwuOHnZ1TsTgHJkG9XgzND6inhBH9n1vBxhg3iIXOia/OrpmvVmd3lrD4vq6bF3A==", + "version": "4.0.0-rc.117", + "resolved": "https://registry.npmjs.org/effect/-/effect-4.0.0-rc.117.tgz", + "integrity": "sha512-UUyi9QiOW4nySFIBM3KnYbNMd9EZliOdKfBcyLD0mPMPheO2fkuXS5y0opjWc9oqzlJxPQICEGm8gGw3kh9j/w==", "dev": true, - "license": "MIT", - "dependencies": { - "fast-check": "^4.9.0", - "msgpackr": "^2.0.5" - } + "license": "MIT" }, "node_modules/es-module-lexer": { "version": "3.0.2", @@ -2070,29 +1971,6 @@ "node": ">=18.0.0" } }, - "node_modules/fast-check": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-4.10.0.tgz", - "integrity": "sha512-hhqQL+IJllZi3aM4TKvmCj3bywLEcycNTTLZeLhA9ttMxBrCqM07q7Di4kl+j9EWSTXvJH1+EpIgsDbF/+8H5Q==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/dubzzz" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/fast-check" - } - ], - "license": "MIT", - "dependencies": { - "pure-rand": "^8.0.0" - }, - "engines": { - "node": ">=12.17.0" - } - }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -2423,55 +2301,6 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/msgpackr": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/msgpackr/-/msgpackr-2.1.0.tgz", - "integrity": "sha512-p/pBCVO63CsvvpkomUnNNag6+n38rULuDA6HHe70o2gtC8ODI52foF/4ko2qQcp6OiErJXTmrZeXmsGGHsIQNQ==", - "dev": true, - "license": "MIT", - "optionalDependencies": { - "msgpackr-extract": "^3.0.4" - } - }, - "node_modules/msgpackr-extract": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/msgpackr-extract/-/msgpackr-extract-3.0.4.tgz", - "integrity": "sha512-4kmO/MdyUIkLIvTPr8VHLil4AtoKIoniWPIEk5+CDy0xnWC84azhSFmuJ7PxZdsYtiP5kEeQsORAVIeMgxT+Hw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "dependencies": { - "node-gyp-build-optional-packages": "5.2.2" - }, - "bin": { - "download-msgpackr-prebuilds": "bin/download-prebuilds.js" - }, - "optionalDependencies": { - "@msgpackr-extract/msgpackr-extract-darwin-arm64": "3.0.4", - "@msgpackr-extract/msgpackr-extract-darwin-x64": "3.0.4", - "@msgpackr-extract/msgpackr-extract-linux-arm": "3.0.4", - "@msgpackr-extract/msgpackr-extract-linux-arm64": "3.0.4", - "@msgpackr-extract/msgpackr-extract-linux-x64": "3.0.4", - "@msgpackr-extract/msgpackr-extract-win32-x64": "3.0.4" - } - }, - "node_modules/node-gyp-build-optional-packages": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.2.2.tgz", - "integrity": "sha512-s+w+rBWnpTMwSFbaE0UXsRlg7hU4FjekKU4eyAih5T8nJuNZT1nNsskXpxmeqSK9UzkBl6UgRlnKc8hz8IEqOw==", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "detect-libc": "^2.0.1" - }, - "bin": { - "node-gyp-build-optional-packages": "bin.js", - "node-gyp-build-optional-packages-optional": "optional.js", - "node-gyp-build-optional-packages-test": "build-test.js" - } - }, "node_modules/npm-package-arg": { "version": "14.0.0", "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-14.0.0.tgz", @@ -2545,23 +2374,6 @@ "node": "^22.22.2 || ^24.15.0 || >=26.0.0" } }, - "node_modules/pure-rand": { - "version": "8.4.2", - "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-8.4.2.tgz", - "integrity": "sha512-vvuOGgcuPJAirlHvuQw1TrOiw7ptaIXXmIbNuiNOY6lNGJJH49PQ1Kj4nd783nPdQhQdicgOjVI2yI/9BD6/Ng==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/dubzzz" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/fast-check" - } - ], - "license": "MIT" - }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -2693,9 +2505,9 @@ } }, "node_modules/rsc-markdown-stream": { - "version": "0.0.0-preview-477abe9", - "resolved": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/rsc-markdown-stream@477abe956bdb1a862d957733c9d936580d65b5a9", - "integrity": "sha512-9tQYPjUm7XrBTVdtPBOZYQtm2Y+Hc8tpD2s+NLDqsRfWzK4QTo80WDWO4KSTutc3Uoih/ZoccpVf1sU2MQqzlA==", + "version": "0.0.0-preview-4f62216", + "resolved": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/rsc-markdown-stream@4f62216f307e3d70e82ac2c25bbd55e72c0880a8", + "integrity": "sha512-FfxegZh5k9lKiC6dgmyXtd8oSFzpJCD6+81Lk6qDT7mxx53KQ4GhPxOdpF8f/GXJLYZiX0ea6v65N3flsJgRWQ==", "dev": true, "license": "Apache-2.0", "engines": { diff --git a/package.json b/package.json index 3107a2d..561e841 100644 --- a/package.json +++ b/package.json @@ -55,12 +55,12 @@ "LICENSE" ], "devDependencies": { - "@agent-bundle/runtime": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@477abe956bdb1a862d957733c9d936580d65b5a9", + "@agent-bundle/runtime": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@4f62216f30", "@changesets/cli": "3.0.3", "@rstest/core": "0.11.12", "@types/node": "^24.0.0", "@types/react": "^19.2.18", - "agent-bundle": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/agent-bundle@477abe956bdb1a862d957733c9d936580d65b5a9", + "agent-bundle": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/agent-bundle@4f62216f30", "react": "19.3.0", "react-dom": "19.3.0", "typescript": "7.0.2",