diff --git a/README.md b/README.md index 4dca925..2f2706b 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,92 @@ # ai-slackbot -[Vercel's AI SDK Slackbot](https://github.com/vercel-labs/ai-sdk-slackbot) on -**Cloudflare Workers**, deployed by [Orun](https://github.com/sourceplane/orun) to stage -and prod on every merge, and then packaged as an Orun baseline. - -This commit is the repository's frame: `intent.yaml` (with the placeholder -workspace `ws_CHANGE_ME`, so CI plans nothing until it is linked), the Orun -CI workflow, the shared TypeScript and ESLint configuration, and the spec -index. The work is tracked as an epic under [`specs/epics`](specs/epics/README.md). +Vercel's [AI SDK Slackbot](https://github.com/vercel-labs/ai-sdk-slackbot) +template — an AI chatbot for Slack that answers app mentions and direct +messages with an LLM and tools (weather, dice, a sandboxed bash, web search), +every tool call gated by an Open Policy Agent policy compiled to WebAssembly — +running natively as a **Cloudflare Worker**, deployed by +[Orun](https://github.com/sourceplane/orun) to stage and prod on every merge. +Packaging it as an Orun baseline is the next milestone (SB2). + +Upstream's `api/events.ts` (a Vercel function) is a [Hono](https://hono.dev) +route here, at the same path: Hono's `fetch` handler is the Worker's, no +adapter. It verifies Slack's signature with WebCrypto before anything else, +acknowledges at once and answers in `waitUntil`. The model is Workers AI +through the Worker's own `AI` binding, so a fresh bot needs no AI key; +upstream's OpenAI is used, directly, once its key is stored. The policy, the +agent loop and the tools are upstream's. The bot is born **not connected**: it +deploys and `/api/events` says so until its owner creates a Slack app and +stores its two keys. See +[`specs/epics/ai-slackbot`](specs/epics/ai-slackbot/README.md) for the +design, the milestones and the as-built status. + +## What is here (the product) + +| Surface | Where | +|---|---| +| The routes — Slack's events at `POST /api/events`; `GET /` a JSON welcome, `GET /health` the bot's name, environment and what it is connected to | `apps/api/src/index.ts` | +| Slack: the signature check, the client, mentions, assistant threads and DMs | `apps/api/src/lib/slack-utils.ts`, `apps/api/src/lib/handle-*.ts` | +| The agent, its tools and the model | `apps/api/src/lib/run-agent.ts`, `generate-response.ts`, `model.ts` | +| The tool-call policy (Rego, and the WASM the Worker bundles) and its loader | `apps/api/policies/`, `apps/api/src/lib/policy/` | +| just-bash's browser build for the Worker | `apps/api/src/vendor/just-bash.js` (`wrangler.jsonc` → `alias`) | +| The bot's name (the rename's seam; what `/` and `/health` answer with) | `apps/api/src/identity.ts` | +| The template's licence (MIT, as its README declares) | `apps/api/LICENSE.md` | +| Worker config (name, Workers AI binding, per-environment vars) | `apps/api/wrangler.jsonc` | +| Deploy contract (and the keys it pushes as Worker secrets) | `apps/api/component.yaml` (`cloudflare-worker-turbo`) | +| Tests | `tests/api` (vitest: the routes and Slack's events in-process against stand-ins for Slack and Workers AI, the signature check, every policy rule) | + +## Getting started + +```bash +pnpm install +pnpm typecheck +pnpm lint +pnpm test +pnpm build # wrangler deploy --dry-run → apps/api/dist (the bundle, no upload) +``` + +Run the Worker locally under workerd (Workers AI has no local mode, so +`wrangler dev` needs `wrangler login`; Slack's two keys go in +`apps/api/.dev.vars`): + +```bash +pnpm --filter @app/api dev # http://localhost:8787 +curl http://localhost:8787/health # {"status":"ok","name":"AI SDK Slackbot","environment":"local","slack":…} +``` + +Connecting Slack: create a Slack app, put its signing secret and bot token in +`apps/api/.dev.vars` for local work (or store them as the environment's Orun +secrets and redeploy), and set its Request URL to the Worker's `/api/events`. + +## How it maps to Vercel + +| Vercel | Here | +|---|---| +| `api/events.ts`, a Vercel function | A Hono route at the same path, `POST /api/events`, on a plain Worker: `export default app` is the module handler; wrangler bundles `src/index.ts` with `nodejs_compat` | +| `waitUntil` from `@vercel/functions`, `maxDuration: 60` | The Worker's own `c.executionCtx.waitUntil`, after an immediate acknowledgement. A Worker keeps that work alive for about 30 s after the response, not 60 | +| Slack's signature checked with `node:crypto` — and the result dropped (`verifyRequest` returned a 400 nobody returned), the URL verification answered before it | WebCrypto HMAC-SHA256 over `v0::`, a constant-time compare and a five-minute window, checked FIRST for every request, the challenge included; a refusal is a 400 before any work | +| The bot's own id (`auth.test`) looked up before acknowledging | Looked up after, in the background, so Slack's 3 s go to the acknowledgement | +| Slack's retries (`X-Slack-Retry-Num`) handled as new events | Acknowledged (`X-Slack-No-Retry: 1`) and not answered again | +| `process.env` read at import; one `WebClient` per process | The Worker's secrets per request; a `WebClient` per event | +| OpenAI `gpt-4o` by default (`OPENAI_API_KEY`), or a local Ollama | Workers AI (`@cf/moonshotai/kimi-k2.6`) through the `AI` binding by default, no key; OpenAI directly once `OPENAI_API_KEY` is stored. Ollama is not carried: a Worker cannot reach `localhost` | +| AI SDK 7 canaries (`ai` 7.0.0-canary.164, `@ai-sdk/policy-opa` 1.0.0-canary.1, `@ai-sdk/openai` 4.0.0-canary.67) | Their stable releases (`ai` 7.0.155, `@ai-sdk/policy-opa` 1.0.155, `@ai-sdk/openai` 4.0.104), which `workers-ai-provider` 4 supports | +| `policies/policy.wasm` read from disk (`node:fs`) and compiled at runtime | Imported as a `WebAssembly.Module` that wrangler compiles at upload — a Worker refuses to compile bytes at runtime | +| `bash-tool` over `just-bash`'s Node build | The same `bash-tool`, over `just-bash`'s browser build (`src/vendor/just-bash.js`): the Node build's `python3`/`js` commands need `worker_threads` and its decompressors native addons. Two classes only bash-tool's opt-in tee transform uses are stubs that refuse | +| `searchWeb` always offered (Exa) | Offered, and named in the prompt, only when `EXA_API_KEY` is stored | +| `/` redirected to the template's GitHub repository | A JSON welcome naming the bot and its endpoints | +| Env vars in the Vercel project | Orun secrets per environment, pushed to the Worker as Worker secrets after each deploy (`runtimeSecrets`) | +| `vc dev` · `vc deploy` | `wrangler dev` · `wrangler deploy --env ` | +| Deploy on push | Orun deploys `-api-{stage,prod}` on merge to `main` and smoke-tests `/health` and the signed events door (`apps/api/component.yaml`) | + +## CI + +| Workflow | What it runs | Ships to a bot | +|---|---|---| +| `ci.yml` | the Orun pipeline, and the only workflow a bot carries: `orun plan --changed`, then one job per lane. A pull request runs the verify lanes (the Worker built, type-checked and dry-deployed per environment; the tests' `quick-check` lane installs and checks the package, it does not run them), except the bootstrap's own landings (`orun/BASE-*`), where `plan` alone is the check; a merge deploys stage → prod. It plans nothing while `intent.yaml` names the placeholder workspace `ws_CHANGE_ME`, as this repository does. A manual run (Orunbase's Deploy button, or Run workflow on `main`) plans the environment and components it names under the push-to-main trigger, so they deploy as a merge deploys them | yes | + +## Credits + +The bot is Vercel's AI SDK Slackbot template +([vercel-labs/ai-sdk-slackbot](https://github.com/vercel-labs/ai-sdk-slackbot), +MIT as its README declares; the repository has no LICENSE file — +`apps/api/LICENSE.md`). diff --git a/apps/api/LICENSE.md b/apps/api/LICENSE.md new file mode 100644 index 0000000..b42450a --- /dev/null +++ b/apps/api/LICENSE.md @@ -0,0 +1,26 @@ +The bot in this directory is ported from Vercel's AI SDK Slackbot template, +[vercel-labs/ai-sdk-slackbot](https://github.com/vercel-labs/ai-sdk-slackbot). +That repository ships no LICENSE file; its README declares its licence as MIT +("## License — MIT"). Those terms follow, for the template's code here. + +MIT License + +Copyright (c) the ai-sdk-slackbot authors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/apps/api/component.yaml b/apps/api/component.yaml new file mode 100644 index 0000000..3d91227 --- /dev/null +++ b/apps/api/component.yaml @@ -0,0 +1,100 @@ +apiVersion: sourceplane.io/v1 +kind: Component +metadata: + name: api + description: The AI SDK Slackbot — Slack's Events API at /api/events on a plain Cloudflare Worker, answering with Workers AI and policy-gated tools (per environment) +spec: + type: cloudflare-worker-turbo + lifecycle: production + owner: platform + # Its pages, attached to it in the workspace's catalog: what the Docs + # library shows for it, and what the catalog's docs and runbook checks read. + # Generated from what this manifest and its sources declare. + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } + # `app`, not `api`: a domain and a component share one name space in the + # catalog, and a domain called `api` would take this component's place in + # it — the API missing from its own catalog. + domain: app + path: apps/api + # No dependsOn: the bot reads no wiring and binds nothing Terraform makes — + # its one binding, Workers AI (wrangler.jsonc), is the account's own. + # + # The bot's keys, stored per environment as the product's secrets of the + # same names (README → Connect Slack). The Worker reads them at request time + # (src/env.ts), so no build ever sees one: the composition's secrets-live + # step hands those that are set to the Worker as Worker SECRETS after the + # deploy (runtimeSecrets below). BEST-EFFORT references, + # wire-now-seed-later: a key nobody has stored is skipped when the job + # resolves its secrets (no env var, no failure), so a fresh product deploys, + # answers /health and says on /api/events that Slack is not connected, + # before its owner has created a Slack app at all. + optionalSecretEnv: + SLACK_SIGNING_SECRET: "secret://ai-slackbot/ai-slackbot/{{ .environment }}/SLACK_SIGNING_SECRET" + SLACK_BOT_TOKEN: "secret://ai-slackbot/ai-slackbot/{{ .environment }}/SLACK_BOT_TOKEN" + OPENAI_API_KEY: "secret://ai-slackbot/ai-slackbot/{{ .environment }}/OPENAI_API_KEY" + OPENAI_MODEL: "secret://ai-slackbot/ai-slackbot/{{ .environment }}/OPENAI_MODEL" + EXA_API_KEY: "secret://ai-slackbot/ai-slackbot/{{ .environment }}/EXA_API_KEY" + subscribe: + environments: + - name: dev + profile: verify + - name: stage + profile: verify + profileRules: + - profile: deploy + when: + triggerRef: github-push-main + - name: prod + profile: verify + profileRules: + - profile: deploy + when: + triggerRef: github-push-main + parameters: + nodeVersion: "22" + pnpmVersion: "10.12.1" + + workspaceDir: ../.. + appDir: . + + turboFilter: "@app/api" + # Committed, not rendered: the Worker's one binding (Workers AI) has no + # resource ID to wire, and the lanes' structure check (`test -f`, before + # any build) finds it in a fresh checkout. Per-env names come from `--env`: + # ai-slackbot-api-{stage,prod}. + wranglerConfig: wrangler.jsonc + + installCommand: pnpm install --frozen-lockfile + buildCommand: pnpm exec turbo run build --filter=@app/api + typecheckCommand: pnpm exec turbo run typecheck --filter=@app/api + + dryRunCommand: pnpm exec wrangler deploy --dry-run --config wrangler.jsonc --env prod + deployCommand: pnpm exec wrangler deploy --config wrangler.jsonc --env prod + + # The keys secrets-live pushes as Worker secrets after each deploy — the + # ones the environment has stored, named only in the log, never a value. + runtimeSecrets: SLACK_SIGNING_SECRET,SLACK_BOT_TOKEN,OPENAI_API_KEY,OPENAI_MODEL,EXA_API_KEY + + preDeployCommand: "echo 'No pre-deploy step configured.'" + migrationCommand: "echo 'No migrations configured.'" + # Smoke: /health answers `"status":"ok"` for THIS environment — the + # environment comes from the `env.` vars the deploy used, so a stale + # or wrong Worker fails it — and then Slack's door: POST /api/events with + # no signature must be REFUSED, a 400 once Slack is connected or a 503 + # before (never a 500, never a 200 — a door that answers an unsigned event + # would answer a forged one). Not the bot's name, which is the owner's to + # change. The Worker composition exports no deployed URL, so the command + # names its own workers.dev URL; ${DEPLOYED_URL} overrides it (a custom + # domain, or a local `wrangler dev`). ${ORUN_ENVIRONMENT} the runner sets + # for every step. Each body is buffered before grep so an early match + # cannot SIGPIPE curl. + smokeCommand: 'base="${DEPLOYED_URL:-https://ai-slackbot-api-${ORUN_ENVIRONMENT}.your-workers-subdomain.workers.dev}" && health="$(curl -sf --max-time 20 "${base}/health")" && echo "${health}" | grep -q "\"status\":\"ok\"" && echo "${health}" | grep -q "\"environment\":\"${ORUN_ENVIRONMENT}\"" && code="$(curl -s -o /dev/null -w "%{http_code}" --max-time 20 -X POST "${base}/api/events" -H "content-type: application/json" -d "{\"type\":\"url_verification\",\"challenge\":\"orun-smoke\"}")" && case "${code}" in 400|503) ;; *) echo "POST /api/events without a signature answered ${code}, not 400 or 503" >&2; false ;; esac' + labels: + team: platform + layer: runtime + surface: api + runtime: cloudflare diff --git a/apps/api/docs/architecture.md b/apps/api/docs/architecture.md new file mode 100644 index 0000000..aa9c5ae --- /dev/null +++ b/apps/api/docs/architecture.md @@ -0,0 +1,28 @@ +# api — architecture + +Built by the turbo pipeline from `apps/api` and deployed with wrangler. + +| | | +| ------------------- | ------------------------- | +| Worker config | `apps/api/wrangler.jsonc` | +| Entry | `src/index.ts` | +| Compatibility date | `2026-10-01` | +| Compatibility flags | `nodejs_compat` | + +## Bindings + +| Binding | Kind | Source | +| ------- | ---------- | --------------------------------------- | +| `AI` | Workers AI | account-level; no resource to provision | + +## Variables + +`ENVIRONMENT` — overridden per environment (`dev`, `prod`, `stage`). + +## Secrets resolved by the lane (names only) + +- `EXA_API_KEY` (optional) +- `OPENAI_API_KEY` (optional) +- `OPENAI_MODEL` (optional) +- `SLACK_BOT_TOKEN` (optional) +- `SLACK_SIGNING_SECRET` (optional) diff --git a/apps/api/docs/overview.md b/apps/api/docs/overview.md new file mode 100644 index 0000000..a423f75 --- /dev/null +++ b/apps/api/docs/overview.md @@ -0,0 +1,20 @@ +# api + +The AI SDK Slackbot — Slack's Events API at /api/events on a plain Cloudflare Worker, answering with Workers AI and policy-gated tools (per environment) + +A Cloudflare Worker, deployed per environment by its CI lane. + +| | | +| ------------ | ------------------------------------------------------------------------------------------------------------------ | +| Type | `cloudflare-worker-turbo` | +| Source | `apps/api` | +| Package | `@app/api` | +| Environments | `dev`: `verify` · `stage`: `verify`, `deploy` on a push to `main` · `prod`: `verify`, `deploy` on a push to `main` | + +## Depends on + +- (none) + +## Depended on by + +- (none) diff --git a/apps/api/docs/runbook.md b/apps/api/docs/runbook.md new file mode 100644 index 0000000..afb5a27 --- /dev/null +++ b/apps/api/docs/runbook.md @@ -0,0 +1,36 @@ +# api — runbook + +## How it runs + +Pull requests verify it; a merge to `main` deploys it to `stage`, `prod`. +CI plans what changed (`orun plan --changed`) and runs each lane with `orun run`; +the plan orders a component after everything it depends on. + +## Local commands + +```bash +pnpm --filter @app/api dev +pnpm --filter @app/api build +pnpm --filter @app/api typecheck +pnpm --filter @app/api lint +``` + +## Verify + +After a deploy the lane runs this smoke against the environment it +deployed (`ORUN_ENVIRONMENT`); `DEPLOYED_URL` overrides the URL: + +```bash +base="${DEPLOYED_URL:-https://ai-slackbot-api-${ORUN_ENVIRONMENT}.your-workers-subdomain.workers.dev}" && health="$(curl -sf --max-time 20 "${base}/health")" && echo "${health}" | grep -q "\"status\":\"ok\"" && echo "${health}" | grep -q "\"environment\":\"${ORUN_ENVIRONMENT}\"" && code="$(curl -s -o /dev/null -w "%{http_code}" --max-time 20 -X POST "${base}/api/events" -H "content-type: application/json" -d "{\"type\":\"url_verification\",\"challenge\":\"orun-smoke\"}")" && case "${code}" in 400|503) ;; *) echo "POST /api/events without a signature answered ${code}, not 400 or 503" >&2; false ;; esac +``` + +## Rollback + +Revert the commit on `main`. The next convergence applies the previous desired +state; nothing was changed out of band, so there is nothing else to undo. + +## Common failures + +- **The smoke fails right after a first deploy**: a new workers.dev route can + answer 4xx for a few seconds and the lane retries. A failure that persists + is a regression in the deployed code. diff --git a/apps/api/eslint.config.js b/apps/api/eslint.config.js new file mode 100644 index 0000000..2e905dc --- /dev/null +++ b/apps/api/eslint.config.js @@ -0,0 +1,2 @@ +import config from "../../tooling/eslint/index.js"; +export default config; diff --git a/apps/api/package.json b/apps/api/package.json new file mode 100644 index 0000000..d06f55d --- /dev/null +++ b/apps/api/package.json @@ -0,0 +1,36 @@ +{ + "name": "@app/api", + "version": "0.0.0", + "private": true, + "type": "module", + "scripts": { + "dev": "wrangler dev", + "build": "wrangler deploy --dry-run --outdir dist", + "deploy": "wrangler deploy", + "typecheck": "tsc --noEmit", + "lint": "eslint src", + "policy:build": "opa build -t wasm -e agent/call/decision -o policies/bundle.tar.gz policies/decision.rego && tar -xzf policies/bundle.tar.gz -C policies /policy.wasm && rm policies/bundle.tar.gz", + "policy:test": "opa test policies/" + }, + "dependencies": { + "@ai-sdk/openai": "4.0.104", + "@ai-sdk/policy-opa": "1.0.155", + "@open-policy-agent/opa": "2.0.0", + "@open-policy-agent/opa-wasm": "1.10.0", + "@slack/web-api": "7.16.0", + "ai": "7.0.155", + "bash-tool": "1.3.17", + "exa-js": "1.10.3", + "hono": "^4.13.0", + "just-bash": "3.0.1", + "workers-ai-provider": "4.0.1", + "zod": "4.4.3" + }, + "devDependencies": { + "@app/eslint-config": "workspace:*", + "@app/tsconfig": "workspace:*", + "@cloudflare/workers-types": "^5.20261006.1", + "typescript": "^5.8.3", + "wrangler": "^4.151.0" + } +} diff --git a/apps/api/policies/README.md b/apps/api/policies/README.md new file mode 100644 index 0000000..ca04ea1 --- /dev/null +++ b/apps/api/policies/README.md @@ -0,0 +1,112 @@ +# Slackbot policies + +This directory holds the Rego policies that decide whether the bot is allowed +to run a given tool call. You can edit `decision.rego` without touching any +TypeScript — the Worker bundles it as compiled WebAssembly (`policy.wasm`, +imported as a module by `src/lib/policy/load.ts`), or, while you iterate, +reads it live from a local OPA server. + +## Input shape + +Every tool call is evaluated as a separate decision. The `input` document +the policy sees looks like this: + +```jsonc +{ + "tool": { "name": "weather" }, // tool the model wants to run + "args": { "city": "San Francisco" }, // its inputSchema-typed args + "messages":[ // full chat history so far + { "role": "user", "content": "..." } + ], + "runtimeContext": { // set by the bot per request + "channelId": "C0B6YBUHMME", // raw Slack channel ID + "userId": "U0123ABCD" + } +} +``` + +The `throwDice` rule gates on the immutable `channelId`. Set `allowed_dice_channel` +in `decision.rego` to your channel's ID — right-click the channel in Slack → +"View channel details" → the ID is at the bottom (starts with `C` for public, +`G` for private). Matching by ID (not name) needs no extra Slack scope and no +per-request lookup. + +Return one of: + +| decision | effect | +|-----------------------|-------------------------------------------------------| +| `allow` | tool executes | +| `deny` | tool is blocked; `reason` shown to the model & user | +| `requires-approval` | bot pauses for a human (not wired up in this repo) | +| `not-applicable` | rule has no opinion; falls through to allow | + +## Adding a new rule + +Copy this skeleton into `decision.rego`: + +```rego +decision := { + "decision": "deny", + "reason": "short user-facing message" +} if { + input.tool.name == "yourToolName" + # ...your condition here... +} +``` + +Pair it with an allow rule (or rely on the `not-applicable` default). + +## Running tests + +```sh +opa test policies/ +``` + +Each rule should have at least one positive and one negative test in +`decision_test.rego`. Tests are pure Rego — no Node, no bot, no network. + +## Modes + +| `POLICY_MODE` | client | source of truth | reload | +|---------------|------------------------|---------------------------------|-----------| +| `wasm` (default) | `wasmPolicyClient` | `policies/policy.wasm`, bundled | rebuild + deploy | +| `http` | `httpPolicyClient` | OPA server at `OPA_URL` | live | + +### wasm (default — no extra process) + +```sh +pnpm --filter @app/api policy:build # opa build -t wasm -e agent/call/decision -> policies/policy.wasm +``` + +The committed `policy.wasm` is what the Worker bundles — the build does not +run `opa` (CI has none), so after editing `decision.rego`, run `policy:build` +and commit the new `policy.wasm` with it; the merge deploys it. The tests +(`tests/api`) evaluate the same file. + +### http (live policy reload during iteration) + +```sh +opa run --server --addr :8181 ./apps/api/policies +printf 'POLICY_MODE=http\nOPA_URL=http://localhost:8181\n' >> apps/api/.dev.vars +pnpm --filter @app/api dev +``` + +Edit `decision.rego`. The next tool call uses the new rule — no rebuild, +no restart. + +## Limitations + +These policies gate **tool calls** — whether a tool runs and with what input — +not the model's free-text output. A rule like `searchWeb` (only `vercel.com`) +guarantees the *search* is scoped, but it cannot stop the model from answering +from its own training knowledge if the scoped search returns nothing. The system +prompt asks the model to answer only from tool results; that's best-effort, not +enforced. A hard "only answer from allowed sources" guarantee needs output-side +validation (verifying the answer is supported by the tool results), which lives +above the policy layer. + +In short: this pattern is a strong fit for **deterministic, inspectable tool +calls** — `git`/`bash`, file writes, Slack/MCP actions — where allowing the call +fully bounds the effect. It's a weaker fit for **content-oriented tools** (web +search and similar) where the risk is in the nuanced text the model produces, not +in the call itself. diff --git a/apps/api/policies/decision.rego b/apps/api/policies/decision.rego new file mode 100644 index 0000000..e7065ab --- /dev/null +++ b/apps/api/policies/decision.rego @@ -0,0 +1,181 @@ +# Policy for the Slack bot's tool surface. +# +# Compiled to WASM with: +# opa build -t wasm -e 'agent/call/decision' -o policies/bundle.tar.gz policies/decision.rego +# tar -xzf policies/bundle.tar.gz -C policies/ /policy.wasm +# +# Input shape (set by the AI SDK's @ai-sdk/policy-opa adapter): +# { +# "tool": { "name": }, +# "args": , +# "messages":[...], +# "runtimeContext": { "channelId", "userId" }, +# # Only for the bash tool, added by toInput in lib/policy/load.ts: +# "bash": { "program": , "argv": [], "suspicious": } +# } +# +# Decision shape (consumed by normalizeOpaDecision): +# { "decision": "allow" | "deny" | "requires-approval" | "not-applicable", +# "reason": } + +package agent.call + +import rego.v1 + +# --------------------------------------------------------------------------- +# Configuration +# --------------------------------------------------------------------------- + +allowed_cities := {"san francisco", "austin", "new york", "london", "berlin"} + +allowed_domain := "vercel.com" + +# Display version of the city list, used in deny reasons. +allowed_cities_display := "San Francisco, Austin, New York, London, Berlin" + +# Slack channel ID where `throwDice` is permitted. Matched on the immutable +# channel ID (not the name) so it needs no extra Slack scope or lookup. Replace +# this with your channel's ID: right-click the channel in Slack → "View channel +# details" → the ID is at the bottom (starts with C for public, G for private). +allowed_dice_channel := "C0B6YBUHMME" + +# Bash commands the bot may run. Add or remove a command here to change what's +# allowed — everything not listed (rm, curl, git, mkdir, ...) is denied. +# +# Do NOT add commands that can launch or sequence other programs (env, find, +# xargs, sh, bash, awk, sed, python, ...): the policy gates on the program name +# (argv[0]) only, so a launcher would run an unlisted program past the gate. +allowed_bash_commands := { + "echo", "ls", "cat", "pwd", "date", "whoami", "head", "tail", "wc", + "grep", "sort", "uniq", "tree", "printf", "seq", + "stat", "which", "basename", "dirname", +} + +# --------------------------------------------------------------------------- +# Top-level entrypoint. Returns one decision object. +# Default-deny: any tool without an explicit rule below is denied, so adding a +# new tool to the bot requires consciously allowing it here. +# --------------------------------------------------------------------------- + +default decision := {"decision": "deny", "reason": "This tool is not permitted by policy."} + +decision := get_weather_decision if input.tool.name == "getWeather" + +decision := search_web_decision if input.tool.name == "searchWeb" + +decision := throw_dice_decision if input.tool.name == "throwDice" + +decision := bash_decision if input.tool.name == "bash" + +decision := read_file_decision if input.tool.name == "readFile" + +decision := write_file_decision if input.tool.name == "writeFile" + +# --------------------------------------------------------------------------- +# Rule 1 — getWeather: city must be in the allowlist (case-insensitive, +# trimmed). Personalized deny reason includes the offending city. +# --------------------------------------------------------------------------- + +get_weather_decision := {"decision": "allow"} if { + is_string(input.args.city) + lower(trim_space(input.args.city)) in allowed_cities +} else := { + "decision": "deny", + "reason": sprintf( + "Sorry, I can't get weather for %s — not allowed per policy. Allowed cities: %s.", + [city_label, allowed_cities_display], + ), +} + +city_label := input.args.city if is_string(input.args.city) + +city_label := "this location" if not is_string(input.args.city) + +# --------------------------------------------------------------------------- +# Rule 2 — searchWeb: Exa search must be scoped to vercel.com. We can't +# rewrite args from a Rego rule (the SDK has no rewrite decision), so a +# missing or wrong domain is a hard deny with a fixed reason. +# +# NOTE: this only scopes the *search*. It can't stop the model from answering +# from its own training knowledge if the vercel.com search returns nothing — +# the policy gates tool calls, not the model's free text. See README "What the +# policy does and does not guarantee". +# --------------------------------------------------------------------------- + +search_web_decision := {"decision": "allow"} if { + is_string(input.args.specificDomain) + lower(trim_space(input.args.specificDomain)) == allowed_domain +} else := { + "decision": "deny", + "reason": "I can only search vercel.com per policy.", +} + +# --------------------------------------------------------------------------- +# Rule 3 — throwDice: only permitted in the configured channel, matched on the +# immutable `runtimeContext.channelId` set by the Slack handler per request +# (see lib/policy/runtime-context.ts). +# --------------------------------------------------------------------------- + +throw_dice_decision := {"decision": "allow"} if { + input.runtimeContext.channelId == allowed_dice_channel +} else := { + "decision": "deny", + "reason": "Sorry, throwDice can only be used in the designated channel.", +} + +# --------------------------------------------------------------------------- +# Rule 4 — bash: allow only a single allowlisted command operating on relative, +# non-traversing paths. `suspicious` (chaining/piping/redirection/env-prefix) +# is flagged by toInput. The deny reason is selected by `bash_deny_reason`. +# --------------------------------------------------------------------------- + +bash_decision := {"decision": "allow"} if { + not input.bash.suspicious + input.bash.program in allowed_bash_commands + not bash_arg_escapes_workspace +} else := {"decision": "deny", "reason": bash_deny_reason} + +bash_deny_reason := "Only a single, simple command is allowed (no pipes, redirects, chaining, or variable assignments)." if input.bash.suspicious + +bash_deny_reason := sprintf( + "`%s` is not an allowed command. Allowed: %s.", + [input.bash.program, concat(", ", sort(allowed_bash_commands))], +) if { + not input.bash.suspicious + not input.bash.program in allowed_bash_commands +} + +bash_deny_reason := "Commands may only reference relative paths within the workspace." if { + not input.bash.suspicious + input.bash.program in allowed_bash_commands + bash_arg_escapes_workspace +} + +bash_arg_escapes_workspace if { + some arg in input.bash.argv + path_escapes_workspace(arg) +} + +# Shared path-safety check: absolute paths and `..` traversal escape the +# workspace. Used by both the bash rule above and the readFile rule below. +path_escapes_workspace(p) if startswith(p, "/") + +path_escapes_workspace(p) if contains(p, "..") + +# --------------------------------------------------------------------------- +# Rule 5 — file access: the bot is read-only. writeFile is always denied; +# readFile is allowed only for relative, non-traversing paths. +# --------------------------------------------------------------------------- + +write_file_decision := { + "decision": "deny", + "reason": "This bot is read-only; writing files is not permitted.", +} + +read_file_decision := {"decision": "allow"} if { + is_string(input.args.path) + not path_escapes_workspace(input.args.path) +} else := { + "decision": "deny", + "reason": "Only relative paths within the workspace can be read.", +} diff --git a/apps/api/policies/decision_test.rego b/apps/api/policies/decision_test.rego new file mode 100644 index 0000000..42f66c0 --- /dev/null +++ b/apps/api/policies/decision_test.rego @@ -0,0 +1,241 @@ +package agent.call_test + +import rego.v1 + +import data.agent.call + +# ---------- getWeather ---------- + +test_weather_allowed_city if { + call.decision.decision == "allow" with input as { + "tool": {"name": "getWeather"}, + "args": {"city": "San Francisco"}, + } +} + +test_weather_allowed_case_insensitive if { + call.decision.decision == "allow" with input as { + "tool": {"name": "getWeather"}, + "args": {"city": " berlin "}, + } +} + +test_weather_denied_city if { + d := call.decision with input as { + "tool": {"name": "getWeather"}, + "args": {"city": "Atlantis"}, + } + d.decision == "deny" + contains(d.reason, "Atlantis") + contains(d.reason, "San Francisco") +} + +test_weather_denied_non_string_city if { + d := call.decision with input as { + "tool": {"name": "getWeather"}, + "args": {"city": null}, + } + d.decision == "deny" + contains(d.reason, "this location") +} + +# ---------- searchWeb ---------- + +test_websearch_allowed_specific_domain if { + call.decision.decision == "allow" with input as { + "tool": {"name": "searchWeb"}, + "args": {"query": "AI SDK", "specificDomain": "vercel.com"}, + } +} + +test_websearch_allowed_case_insensitive if { + call.decision.decision == "allow" with input as { + "tool": {"name": "searchWeb"}, + "args": {"query": "AI SDK", "specificDomain": "VERCEL.COM"}, + } +} + +test_websearch_denied_null_domain if { + d := call.decision with input as { + "tool": {"name": "searchWeb"}, + "args": {"query": "premier league news", "specificDomain": null}, + } + d.decision == "deny" + contains(d.reason, "vercel.com") +} + +test_websearch_denied_wrong_domain if { + call.decision.decision == "deny" with input as { + "tool": {"name": "searchWeb"}, + "args": {"query": "news", "specificDomain": "bbc.com"}, + } +} + +# ---------- throwDice ---------- + +test_dice_allowed_channel if { + call.decision.decision == "allow" with input as { + "tool": {"name": "throwDice"}, + "args": {}, + "runtimeContext": {"channelId": "C0B6YBUHMME"}, + } +} + +test_dice_denied_channel if { + d := call.decision with input as { + "tool": {"name": "throwDice"}, + "args": {}, + "runtimeContext": {"channelId": "C0OTHER"}, + } + d.decision == "deny" + contains(d.reason, "designated channel") +} + +# ---------- bash ---------- + +test_bash_allowed_echo if { + call.decision.decision == "allow" with input as { + "tool": {"name": "bash"}, + "args": {"command": "echo hello"}, + "bash": {"program": "echo", "argv": ["echo", "hello"], "suspicious": false}, + } +} + +test_bash_allowed_ls if { + call.decision.decision == "allow" with input as { + "tool": {"name": "bash"}, + "args": {"command": "ls -la"}, + "bash": {"program": "ls", "argv": ["ls", "-la"], "suspicious": false}, + } +} + +test_bash_denied_rm if { + d := call.decision with input as { + "tool": {"name": "bash"}, + "args": {"command": "rm -rf ."}, + "bash": {"program": "rm", "argv": ["rm", "-rf", "."], "suspicious": false}, + } + d.decision == "deny" + contains(d.reason, "rm") +} + +test_bash_denied_curl if { + call.decision.decision == "deny" with input as { + "tool": {"name": "bash"}, + "args": {"command": "curl example.com"}, + "bash": {"program": "curl", "argv": ["curl", "example.com"], "suspicious": false}, + } +} + +test_bash_denied_git if { + d := call.decision with input as { + "tool": {"name": "bash"}, + "args": {"command": "git status"}, + "bash": {"program": "git", "argv": ["git", "status"], "suspicious": false}, + } + d.decision == "deny" + contains(d.reason, "git") +} + +test_bash_denied_chained if { + d := call.decision with input as { + "tool": {"name": "bash"}, + "args": {"command": "echo hi && rm -rf /"}, + "bash": {"program": "echo", "argv": ["echo", "hi"], "suspicious": true}, + } + d.decision == "deny" + contains(d.reason, "single") +} + +test_bash_denied_env_launcher if { + d := call.decision with input as { + "tool": {"name": "bash"}, + "args": {"command": "env FOO=bar rm -rf ."}, + "bash": {"program": "env", "argv": ["env", "FOO=bar", "rm", "-rf", "."], "suspicious": false}, + } + d.decision == "deny" + contains(d.reason, "env") +} + +test_bash_denied_find_launcher if { + d := call.decision with input as { + "tool": {"name": "bash"}, + "args": {"command": "find . -exec cat {} +"}, + "bash": {"program": "find", "argv": ["find", ".", "-exec", "cat", "{}", "+"], "suspicious": false}, + } + d.decision == "deny" + contains(d.reason, "find") +} + +test_bash_denied_absolute_path_arg if { + d := call.decision with input as { + "tool": {"name": "bash"}, + "args": {"command": "cat /etc/passwd"}, + "bash": {"program": "cat", "argv": ["cat", "/etc/passwd"], "suspicious": false}, + } + d.decision == "deny" + contains(d.reason, "relative paths") +} + +test_bash_denied_traversal_path_arg if { + d := call.decision with input as { + "tool": {"name": "bash"}, + "args": {"command": "cat ../secret"}, + "bash": {"program": "cat", "argv": ["cat", "../secret"], "suspicious": false}, + } + d.decision == "deny" + contains(d.reason, "relative paths") +} + +test_bash_allowed_relative_path_arg if { + call.decision.decision == "allow" with input as { + "tool": {"name": "bash"}, + "args": {"command": "cat notes.txt"}, + "bash": {"program": "cat", "argv": ["cat", "notes.txt"], "suspicious": false}, + } +} + +# ---------- file access ---------- + +test_read_file_allowed_relative if { + call.decision.decision == "allow" with input as { + "tool": {"name": "readFile"}, + "args": {"path": "notes.txt"}, + } +} + +test_read_file_denied_absolute if { + d := call.decision with input as { + "tool": {"name": "readFile"}, + "args": {"path": "/etc/passwd"}, + } + d.decision == "deny" +} + +test_read_file_denied_traversal if { + d := call.decision with input as { + "tool": {"name": "readFile"}, + "args": {"path": "../secret"}, + } + d.decision == "deny" +} + +test_write_file_denied if { + d := call.decision with input as { + "tool": {"name": "writeFile"}, + "args": {"path": "notes.txt", "content": "x"}, + } + d.decision == "deny" + contains(d.reason, "read-only") +} + +# ---------- default-deny ---------- + +test_unknown_tool_denied if { + d := call.decision with input as { + "tool": {"name": "somethingElse"}, + "args": {}, + } + d.decision == "deny" + contains(d.reason, "not permitted") +} diff --git a/apps/api/policies/policy.wasm b/apps/api/policies/policy.wasm new file mode 100644 index 0000000..6191516 Binary files /dev/null and b/apps/api/policies/policy.wasm differ diff --git a/apps/api/src/env.ts b/apps/api/src/env.ts new file mode 100644 index 0000000..b98c996 --- /dev/null +++ b/apps/api/src/env.ts @@ -0,0 +1,28 @@ +// What the Worker is given. `AI` is the account's Workers AI (wrangler.jsonc); +// ENVIRONMENT is the `vars` of the environment the deploy targeted. Every +// other key is a Worker SECRET the owner stores after the build (README → +// "Connect Slack"); none is required for the Worker to deploy and answer +// /health, and the bot says what is missing instead of failing. +export type Env = { + AI: Ai + ENVIRONMENT?: string + // Slack: the app's signing secret (verifies every request) and its bot + // token (posts the replies). Both are needed before /api/events answers. + SLACK_SIGNING_SECRET?: string + SLACK_BOT_TOKEN?: string + // The model: Workers AI by default; upstream's OpenAI when its key is set. + OPENAI_API_KEY?: string + OPENAI_MODEL?: string + // Web search (Exa): the searchWeb tool exists only when this is set. + EXA_API_KEY?: string + // The policy backend: the bundled WASM by default; a running OPA server + // when POLICY_MODE=http and OPA_URL are set. + POLICY_MODE?: string + OPA_URL?: string + // TEST ONLY — where the Slack Web API is. Unset, it is Slack's own + // (https://slack.com/api/); the e2e points it at a local stand-in. + SLACK_API_URL?: string +} + +/** Slack is connected when both of its keys are present. */ +export const slackConnected = (env: Env) => Boolean(env.SLACK_SIGNING_SECRET && env.SLACK_BOT_TOKEN) diff --git a/apps/api/src/identity.ts b/apps/api/src/identity.ts new file mode 100644 index 0000000..8a60558 --- /dev/null +++ b/apps/api/src/identity.ts @@ -0,0 +1,5 @@ +// The bot's identity, written once. GET / and GET /health answer with +// API_NAME, so a deploy's smoke, an operator's curl and the bootstrap's probe +// all see which bot answered. The Orun bootstrap that creates a product +// rewrites it to that product's name, so keep it literal and on one line. +export const API_NAME = "AI SDK Slackbot" diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts new file mode 100644 index 0000000..11f63f6 --- /dev/null +++ b/apps/api/src/index.ts @@ -0,0 +1,135 @@ +import { Hono } from 'hono' +import type { SlackEvent } from '@slack/web-api' +import { API_NAME } from './identity' +import { slackConnected, type Env } from './env' +import { botContext } from './lib/bot' +import { handleNewAppMention } from './lib/handle-app-mention' +import { assistantThreadMessage, handleNewAssistantMessage } from './lib/handle-messages' +import { modelFor } from './lib/model' +import { toolNames } from './lib/run-agent' +import { getBotId, isValidSlackRequest } from './lib/slack-utils' + +const app = new Hono<{ Bindings: Env }>() + +const NOT_CONNECTED = { + ok: false, + error: 'slack_not_connected', + message: + 'Slack is not connected yet: store SLACK_SIGNING_SECRET and SLACK_BOT_TOKEN as this environment’s secrets and redeploy (README → Connect Slack).', +} + +// Slack's Events API: every event the app subscribes to (app_mention, +// assistant_thread_started, message.im) is POSTed here. Upstream's +// api/events.ts, as a Hono route at the same path. +app.post('/api/events', async (c) => { + // Before Slack is connected there is nothing to verify a request against + // and nothing to answer with: say so, and do no work. + if (!slackConnected(c.env)) return c.json(NOT_CONNECTED, 503) + + // VERIFIED FIRST — every request Slack sends is signed, the URL + // verification included, and nothing is parsed, looked up or answered + // before its signature and timestamp check out. (Upstream answered the + // challenge before verifying, and dropped the result of the check, so a + // forged event was handled as a real one.) + const rawBody = await c.req.text() + const valid = await isValidSlackRequest({ + signingSecret: c.env.SLACK_SIGNING_SECRET as string, + timestamp: c.req.header('X-Slack-Request-Timestamp') ?? null, + signature: c.req.header('X-Slack-Signature') ?? null, + rawBody, + }) + if (!valid) return c.text('Invalid request', 400) + + let payload: { type?: string; challenge?: string; event?: SlackEvent } + try { + payload = JSON.parse(rawBody) + } catch { + return c.text('Invalid request', 400) + } + + // See https://api.slack.com/events/url_verification + if (payload.type === 'url_verification') { + return c.text(String(payload.challenge ?? ''), 200) + } + if (payload.type !== 'event_callback' || !payload.event) { + return c.text('Invalid request', 400) + } + + // A RETRY IS NOT A NEW EVENT. Slack re-sends an event it did not see + // acknowledged within 3 s; this route acknowledges at once and answers in + // the background, so a retry is the same event again — acknowledged, not + // answered twice. + if (c.req.header('X-Slack-Retry-Num')) { + c.header('X-Slack-No-Retry', '1') + return c.text('Success!', 200) + } + + // Acknowledge now; answer after. The bot's own user id (auth.test), the + // thread, the model and the reply all run in waitUntil — upstream looked + // the bot up before acknowledging, which spent Slack's 3 s on a round trip. + const event = payload.event + const bot = botContext(c.env) + c.executionCtx.waitUntil( + (async () => { + try { + const botUserId = await getBotId(bot.slack) + + if (event.type === 'app_mention') { + await handleNewAppMention(bot, event, botUserId) + } + + if (event.type === 'assistant_thread_started') { + await assistantThreadMessage(bot, event) + } + + if ( + event.type === 'message' && + !event.subtype && + event.channel_type === 'im' && + !event.bot_id && + !event.bot_profile && + event.bot_id !== botUserId + ) { + await handleNewAssistantMessage(bot, event, botUserId) + } + } catch (error) { + console.error('Error generating response', error) + } + })(), + ) + + return c.text('Success!', 200) +}) + +// What the bot is and where Slack talks to it. Upstream redirected / to its +// own GitHub repository; a product's root describes the product instead. +app.get('/', (c) => { + return c.json({ + message: `${API_NAME} — an AI chatbot for Slack`, + endpoints: { + events: '/api/events', + health: '/health', + }, + slack: slackConnected(c.env) ? 'connected' : 'not connected', + }) +}) + +// The operational contract: what the deploy's smoke and the bootstrap's probe +// read. It names the bot and the environment whose config the Worker runs, so +// a 200 here is this bot, deployed to that environment — not any page that +// happens to answer — and says what it is connected to, by NAME, never a +// value: Slack or not, which model, which tools. +app.get('/health', (c) => { + const env = c.env + const model = modelFor(env) + return c.json({ + status: 'ok', + name: API_NAME, + environment: env?.ENVIRONMENT ?? 'unknown', + slack: slackConnected(env) ? 'connected' : 'not connected', + model: { provider: model.provider, id: model.id }, + tools: toolNames({ search: Boolean(env?.EXA_API_KEY) }), + }) +}) + +export default app diff --git a/apps/api/src/lib/bot.ts b/apps/api/src/lib/bot.ts new file mode 100644 index 0000000..4d830f0 --- /dev/null +++ b/apps/api/src/lib/bot.ts @@ -0,0 +1,25 @@ +import type { LanguageModel } from "ai"; +import type { Env } from "../env"; +import { modelFor } from "./model"; +import { slackClient, type Slack } from "./slack-utils"; +import type { SearchWeb } from "./run-agent"; +import { exaSearch } from "./utils"; + +// Everything one Slack event is answered with, built from the Worker's own +// secrets for that request: upstream read process.env at import and kept one +// client per process; a Worker's environment arrives with the request. +export interface BotContext { + slack: Slack; + model: LanguageModel; + searchWeb?: SearchWeb; + policy: { mode?: string; opaUrl?: string }; +} + +export function botContext(env: Env): BotContext { + return { + slack: slackClient(env.SLACK_BOT_TOKEN as string, env.SLACK_API_URL), + model: modelFor(env).model, + searchWeb: exaSearch(env.EXA_API_KEY), + policy: { mode: env.POLICY_MODE, opaUrl: env.OPA_URL }, + }; +} diff --git a/apps/api/src/lib/generate-response.ts b/apps/api/src/lib/generate-response.ts new file mode 100644 index 0000000..6be6c3e --- /dev/null +++ b/apps/api/src/lib/generate-response.ts @@ -0,0 +1,99 @@ +import type { ModelMessage } from "ai"; +import { loadToolApproval } from "./policy/load"; +import { runAgent, type ToolOutcome } from "./run-agent"; +import type { SlackRuntimeContext } from "./policy/runtime-context"; +import type { BotContext } from "./bot"; + +// bash/readFile/writeFile run in an in-memory just-bash sandbox (offline, +// no host access). Seeded with a couple of files so ls/cat have content. +// Constructed once and reused. bash-tool is ESM-only, so it's pulled via a +// dynamic import(). +let bashToolsPromise: Promise> | undefined; +function getBashTools(): Promise> { + if (!bashToolsPromise) { + bashToolsPromise = import("bash-tool") + .then(({ createBashTool }) => + createBashTool({ + files: { + "README.md": "# Demo workspace\n\nThis is a sandboxed bash demo for the policy bot.\n", + "notes.txt": "line one\nline two\nline three\n", + }, + }), + ) + .then((r) => r.tools as Record); + // Don't cache a rejected import: reset so the next request retries instead + // of disabling the bot for the isolate's lifetime. + bashToolsPromise.catch(() => { + bashToolsPromise = undefined; + }); + } + return bashToolsPromise; +} + +export const generateResponse = async ( + bot: BotContext, + messages: ModelMessage[], + runtimeContext: SlackRuntimeContext, + updateStatus?: (status: string) => void, +): Promise => { + // Independent cold-start work; overlap it. + const [toolApproval, bashTools] = await Promise.all([ + loadToolApproval(bot.policy), + getBashTools(), + ]); + + const { text, outcomes } = await runAgent({ + model: bot.model, + messages, + runtimeContext, + toolApproval, + bashTools, + searchWeb: bot.searchWeb, + updateStatus, + }); + + return formatReply(text, outcomes); +}; + +// One consistent footer at the bottom, always present, listing every tool and +// its outcome (e.g. "🔧 getWeather" / "🔧 getWeather (blocked by policy)"). +// "🔧 none" when no tool ran, so a tool-less (possibly hallucinated) answer is +// never ambiguous. +export function formatReply(text: string, outcomes: ToolOutcome[]): string { + const footer = + outcomes.length > 0 + ? `\n\n_🔧 ${[...new Set(outcomes.map(toolLabel))].join(", ")}_` + : "\n\n_🔧 none_"; + + // Convert markdown to Slack mrkdwn format. + const answer = text + .replace(/\[(.*?)\]\((.*?)\)/g, "<$2|$1>") + .replace(/\*\*/g, "*"); + + // Policy denials / tool errors: surface the reason verbatim in the body. The + // tool name + status live in the footer, so the body stays just the reason. + const problems = outcomes.filter((o) => o.status !== "used"); + const problemNotes = problems.map( + (o) => o.reason ?? `${o.toolName} ${o.status}`, + ); + const anySuccess = outcomes.some((o) => o.status === "used"); + + // Nothing ran successfully → show only the reason(s), never the model's + // (possibly confabulated) text. + if (problemNotes.length > 0 && !anySuccess) { + return problemNotes.join("\n") + footer; + } + // A tool succeeded → keep the answer, and append any denial/error notes so a + // blocked call in a multi-tool turn isn't silently dropped. + if (problemNotes.length > 0) { + return [answer, ...problemNotes].join("\n\n") + footer; + } + + return answer + footer; +} + +function toolLabel(outcome: ToolOutcome): string { + if (outcome.status === "used") return outcome.toolName; + const suffix = outcome.status === "denied" ? "blocked by policy" : "failed"; + return `${outcome.toolName} (${suffix})`; +} diff --git a/apps/api/src/lib/handle-app-mention.ts b/apps/api/src/lib/handle-app-mention.ts new file mode 100644 index 0000000..d1b86df --- /dev/null +++ b/apps/api/src/lib/handle-app-mention.ts @@ -0,0 +1,60 @@ +import type { AppMentionEvent } from "@slack/web-api"; +import { getThread, type Slack } from "./slack-utils"; +import { generateResponse } from "./generate-response"; +import { runtimeContextFromEvent } from "./policy/runtime-context"; +import type { BotContext } from "./bot"; + +const updateStatusUtil = async ( + slack: Slack, + initialStatus: string, + event: AppMentionEvent, +) => { + const initialMessage = await slack.chat.postMessage({ + channel: event.channel, + thread_ts: event.thread_ts ?? event.ts, + text: initialStatus, + }); + + if (!initialMessage || !initialMessage.ts) + throw new Error("Failed to post initial message"); + + const updateMessage = async (status: string) => { + await slack.chat.update({ + channel: event.channel, + ts: initialMessage.ts as string, + text: status, + }); + }; + return updateMessage; +}; + +export async function handleNewAppMention( + bot: BotContext, + event: AppMentionEvent, + botUserId: string, +) { + console.log("Handling app mention"); + if (event.bot_id || event.bot_id === botUserId || event.bot_profile) { + console.log("Skipping app mention"); + return; + } + + const { thread_ts, channel } = event; + // Post the status first so we hold the updater and can surface any failure + // below (e.g. getThread hitting a missing channels:history scope) instead of + // leaving an orphaned "is thinking..." message. + const updateMessage = await updateStatusUtil(bot.slack, "is thinking...", event); + const runtimeContext = runtimeContextFromEvent({ channel, user: event.user }); + try { + const messages = thread_ts + ? await getThread(bot.slack, channel, thread_ts, botUserId) + : [{ role: "user" as const, content: event.text }]; + const result = await generateResponse(bot, messages, runtimeContext, updateMessage); + await updateMessage(result); + } catch (error) { + console.error("Error handling app mention", error); + await updateMessage( + "⚠️ Something went wrong handling that — check the bot logs (a missing Slack scope is the usual cause).", + ); + } +} diff --git a/apps/api/src/lib/handle-messages.ts b/apps/api/src/lib/handle-messages.ts new file mode 100644 index 0000000..a967ec7 --- /dev/null +++ b/apps/api/src/lib/handle-messages.ts @@ -0,0 +1,86 @@ +import type { + AssistantThreadStartedEvent, + GenericMessageEvent, +} from "@slack/web-api"; +import { getThread, updateStatusUtil } from "./slack-utils"; +import { generateResponse } from "./generate-response"; +import { runtimeContextFromEvent } from "./policy/runtime-context"; +import type { BotContext } from "./bot"; + +export async function assistantThreadMessage( + bot: BotContext, + event: AssistantThreadStartedEvent, +) { + const { channel_id, thread_ts } = event.assistant_thread; + console.log(`Thread started: ${channel_id} ${thread_ts}`); + + await bot.slack.chat.postMessage({ + channel: channel_id, + thread_ts: thread_ts, + text: "Hello, I'm an AI assistant built with the AI SDK by Vercel!", + }); + + await bot.slack.assistant.threads.setSuggestedPrompts({ + channel_id: channel_id, + thread_ts: thread_ts, + prompts: [ + { + title: "Get the weather", + message: "What is the current weather in London?", + }, + { + title: "Get the news", + message: "What is the latest Premier League news from the BBC?", + }, + ], + }); +} + +export async function handleNewAssistantMessage( + bot: BotContext, + event: GenericMessageEvent, + botUserId: string, +) { + if ( + event.bot_id || + event.bot_id === botUserId || + event.bot_profile || + !event.thread_ts + ) + return; + + const { thread_ts, channel } = event; + const updateStatus = updateStatusUtil(bot.slack, channel, thread_ts); + const runtimeContext = runtimeContextFromEvent({ channel, user: event.user }); + await updateStatus("is thinking..."); + try { + const messages = await getThread(bot.slack, channel, thread_ts, botUserId); + const result = await generateResponse(bot, messages, runtimeContext, updateStatus); + + await bot.slack.chat.postMessage({ + channel: channel, + thread_ts: thread_ts, + text: result, + unfurl_links: false, + blocks: [ + { + type: "section", + text: { + type: "mrkdwn", + text: result, + }, + }, + ], + }); + } catch (error) { + console.error("Error handling assistant message", error); + await bot.slack.chat.postMessage({ + channel, + thread_ts, + text: "⚠️ Something went wrong handling that — check the bot logs (a missing Slack scope is the usual cause).", + }); + } finally { + // Always clear the "is thinking..." status, even on failure. + await updateStatus(""); + } +} diff --git a/apps/api/src/lib/model.ts b/apps/api/src/lib/model.ts new file mode 100644 index 0000000..1edfcc1 --- /dev/null +++ b/apps/api/src/lib/model.ts @@ -0,0 +1,32 @@ +import { createOpenAI } from '@ai-sdk/openai' +import type { LanguageModel } from 'ai' +import { createWorkersAI } from 'workers-ai-provider' +import type { Env } from '../env' + +// THE MODEL THE BOT USES. Upstream defaulted to OpenAI (`gpt-4o`), which +// needs a key nobody brokers, or a local Ollama, which a Worker cannot reach +// (it serves on localhost). Here the default is Workers AI through the +// Worker's own `AI` binding — no key, so a fresh deployment answers with +// nothing configured — with a model that calls tools. Upstream's OpenAI is +// used, direct (never through an AI gateway), once OPENAI_API_KEY is stored +// as a Worker secret; OPENAI_MODEL picks its model, as upstream. +export const WORKERS_AI_MODEL = '@cf/moonshotai/kimi-k2.6' +export const OPENAI_DEFAULT_MODEL = 'gpt-4o' + +export type ModelChoice = { + model: LanguageModel + provider: 'workers-ai' | 'openai' + id: string +} + +export function modelFor(env: Env): ModelChoice { + if (env.OPENAI_API_KEY) { + const id = env.OPENAI_MODEL || OPENAI_DEFAULT_MODEL + return { model: createOpenAI({ apiKey: env.OPENAI_API_KEY })(id), provider: 'openai', id } + } + return { + model: createWorkersAI({ binding: env.AI })(WORKERS_AI_MODEL), + provider: 'workers-ai', + id: WORKERS_AI_MODEL, + } +} diff --git a/apps/api/src/lib/policy/load.ts b/apps/api/src/lib/policy/load.ts new file mode 100644 index 0000000..a42877e --- /dev/null +++ b/apps/api/src/lib/policy/load.ts @@ -0,0 +1,79 @@ +import { + opaPolicy, + httpPolicyClient, + wasmPolicyClient, + type PolicyClient, +} from "@ai-sdk/policy-opa"; +// The compiled policy, bundled with the Worker as a WebAssembly.Module: +// wrangler turns a `.wasm` import into a module compiled at upload, which is +// the only way a Worker may run WebAssembly (it refuses to compile bytes at +// runtime). Upstream read the same file from disk with node:fs. Rebuild it +// with `pnpm --filter @app/api policy:build` after editing decision.rego. +import policyWasm from "../../../policies/policy.wasm"; + +const POLICY_PATH = "agent/call/decision"; + +const cached = new Map>(); + +/** + * The tool-approval function every tool call goes through: the bundled WASM + * by default, or a running OPA server when POLICY_MODE=http and OPA_URL are + * set (live policy reloads while iterating, as upstream). One per isolate + * and mode; a rejected load is not cached, so the next request retries. + */ +export function loadToolApproval(opts: { mode?: string; opaUrl?: string } = {}): Promise { + const mode = opts.mode === "http" && opts.opaUrl ? "http" : "wasm"; + const key = mode === "http" ? `http:${opts.opaUrl}` : "wasm"; + let p = cached.get(key); + if (!p) { + p = build(mode, opts.opaUrl); + cached.set(key, p); + p.catch(() => cached.delete(key)); + } + return p; +} + +/** The policy client itself: what every tool call's input is evaluated by. */ +export async function policyClient(mode: "wasm" | "http" = "wasm", opaUrl?: string): Promise { + if (mode === "http") return httpPolicyClient({ url: opaUrl as string }); + // Typed as bytes, but handed unchanged to opa-wasm's loadPolicy, which + // takes a compiled WebAssembly.Module too — the only form a Worker runs. + return wasmPolicyClient({ wasm: policyWasm as unknown as ArrayBuffer }); +} + +async function build(mode: "wasm" | "http", opaUrl?: string): Promise { + const client = await policyClient(mode, opaUrl); + return opaPolicy({ client, path: POLICY_PATH, toInput }); +} + +// Shell operators (and newlines) that let one call run a second command. Their +// presence means we can't reason about the call from its first token alone, so +// we flag it and let the policy reject it wholesale. +const SHELL_OPERATORS = /[;&|`\n\r]|\|\||&&|\$\(|[<>]/; +const LEADING_ENV_ASSIGNMENT = /^\s*\w+=/; + +// Default OPA input shape (mirrors @ai-sdk/policy-opa's DefaultOpaInput). For +// the bash tool we additionally tokenize the command into { program, argv, +// suspicious } so the Rego allowlist can gate it without parsing strings. +export function toInput(args: { + toolCall: { toolName: string; input: unknown }; + runtimeContext: unknown; + messages: unknown; +}) { + const { toolCall, runtimeContext, messages } = args; + const base = { + tool: { name: toolCall.toolName }, + args: toolCall.input, + messages, + runtimeContext, + }; + + if (toolCall.toolName !== "bash") return base; + + const command = String((toolCall.input as { command?: unknown })?.command ?? ""); + const suspicious = + SHELL_OPERATORS.test(command) || LEADING_ENV_ASSIGNMENT.test(command); + const argv = command.trim().split(/\s+/).filter(Boolean); + + return { ...base, bash: { program: argv[0] ?? "", argv, suspicious } }; +} diff --git a/apps/api/src/lib/policy/runtime-context.ts b/apps/api/src/lib/policy/runtime-context.ts new file mode 100644 index 0000000..0d433d1 --- /dev/null +++ b/apps/api/src/lib/policy/runtime-context.ts @@ -0,0 +1,14 @@ +export interface SlackRuntimeContext { + channelId: string; + userId: string | undefined; +} + +export function runtimeContextFromEvent(event: { + channel: string; + user?: string; +}): SlackRuntimeContext { + return { + channelId: event.channel, + userId: event.user, + }; +} diff --git a/apps/api/src/lib/run-agent.ts b/apps/api/src/lib/run-agent.ts new file mode 100644 index 0000000..c79a122 --- /dev/null +++ b/apps/api/src/lib/run-agent.ts @@ -0,0 +1,166 @@ +import { generateText, stepCountIs, tool, type LanguageModel, type ModelMessage } from "ai"; +import { z } from "zod"; + +export type ToolStatus = "used" | "denied" | "failed"; + +export interface ToolOutcome { + toolName: string; + status: ToolStatus; + /** Policy reason (denied) or error text (failed). */ + reason?: string; +} + +export interface AgentResult { + text: string; + /** One entry per tool call, in order, with its outcome. */ + outcomes: ToolOutcome[]; +} + +/** Searches the web; present only when an Exa key is stored (lib/utils.ts). */ +export type SearchWeb = ( + query: string, + specificDomain: string | null, +) => Promise<{ title: string | null; url: string; snippet: string }[]>; + +// The tools the bot has: the template's, less the one whose key is missing. +// searchWeb needs Exa's key, so without it the model is never offered it (and +// the prompt never names it) rather than offered a tool that fails. +export function toolNames(opts: { search: boolean }): string[] { + return ["getWeather", ...(opts.search ? ["searchWeb"] : []), "throwDice", "bash", "readFile", "writeFile"]; +} + +export function systemPrompt(opts: { search: boolean; today: string }): string { + const { search, today } = opts; + return `You are a Slack bot assistant. Keep responses concise and to the point. + - Only call a tool when the user's request clearly requires it. For greetings, small talk, or anything you can answer directly, just reply — do NOT call any tool. + - Choose the right tool for the request:${search ? ` + - searchWeb: questions needing information, documentation, or current facts ("how do I…", "what's the best way to…", news). Use this for any informational/how-to question. (Web search is restricted to vercel.com.)` : ""} + - getWeather: the current weather for a city. + - throwDice: roll a die. + - bash / readFile / writeFile: ONLY when the user explicitly asks to run a shell command or read/write a file. NEVER use bash to answer an informational or how-to question${search ? " — use searchWeb instead" : ""}. + - For weather${search ? " and web" : ""} questions you MUST use getWeather${search ? " / searchWeb" : ""} and base your answer ONLY on the tool's result. NEVER answer from your own knowledge.${search ? " If the web search returns nothing relevant, say you couldn't find it on vercel.com and stop — do NOT fill in the answer from your own knowledge." : ""} If a tool call is denied by policy, relay the denial reason — do not substitute your own answer. + - Never invent facts or sources.${search ? " Only cite a source when it came from an actual web-search tool result, using the real URL from that result." : ""} + - Do not tag users. + - Current date is: ${today} + - If a tool call is denied by policy, surface the reason text to the user verbatim.`; +} + +export async function runAgent(opts: { + model: LanguageModel; + messages: ModelMessage[]; + runtimeContext: unknown; + // The OPA-backed approval fn is loaded dynamically (lib/policy/load.ts), so + // it's untyped at this boundary; generateText expects ToolApprovalConfiguration. + toolApproval: any; + bashTools: Record; + searchWeb?: SearchWeb; + updateStatus?: (status: string) => void; +}): Promise { + const { model, messages, runtimeContext, toolApproval, bashTools, searchWeb, updateStatus } = opts; + + const result = await generateText({ + model, + system: systemPrompt({ search: Boolean(searchWeb), today: new Date().toISOString().split("T")[0]! }), + messages, + stopWhen: stepCountIs(10), + runtimeContext, + toolApproval, + tools: { + getWeather: tool({ + description: + "Get the current weather for a city. Only requires the city name — coordinates are looked up server-side.", + inputSchema: z.object({ + city: z.string().describe("City name only, e.g. 'San Francisco'."), + }), + execute: async ({ city }) => { + updateStatus?.(`is getting weather for ${city}...`); + + // Policy already restricts which cities reach here; we only need to + // geocode for the allowlist. + const geo: any = await fetch( + `https://geocoding-api.open-meteo.com/v1/search?count=1&name=${encodeURIComponent(city)}`, + ).then((r) => r.json()); + const hit = geo?.results?.[0]; + if (!hit) { + return { error: `Could not geocode "${city}".`, city }; + } + + const response = await fetch( + `https://api.open-meteo.com/v1/forecast?latitude=${hit.latitude}&longitude=${hit.longitude}¤t=temperature_2m,weathercode,relativehumidity_2m&timezone=auto`, + ); + + const weatherData: any = await response.json(); + return { + temperature: weatherData.current.temperature_2m, + weatherCode: weatherData.current.weathercode, + humidity: weatherData.current.relativehumidity_2m, + city, + }; + }, + }), + ...(searchWeb + ? { + searchWeb: tool({ + description: "Use this to search the web for information", + inputSchema: z.object({ + query: z.string(), + specificDomain: z + .string() + .nullable() + .describe( + "a domain to search if the user specifies e.g. bbc.com. Should be only the domain name without the protocol", + ), + }), + execute: async ({ query, specificDomain }) => { + updateStatus?.(`is searching the web for ${query}...`); + return { results: await searchWeb(query, specificDomain) }; + }, + }), + } + : {}), + throwDice: tool({ + description: "Roll a six-sided die and return a number between 1 and 6", + inputSchema: z.object({}), + execute: async () => { + updateStatus?.("is rolling a die..."); + return { roll: Math.floor(Math.random() * 6) + 1 }; + }, + }), + ...bashTools, + }, + }); + + // Classify every tool outcome across all steps. We walk `step.content` (the + // complete per-step part list) rather than `result.response.messages`, which + // only holds the final step's text. The shapes differ by outcome: + // - success: a `tool-result` part (output.type json/text/...) + // - tool error: a `tool-result` part with output.type error-text/error-json + // - policy denial: a `tool-approval-response` part with approved === false + // (no tool-result is produced) — carries the policy reason. + const outcomes: ToolOutcome[] = []; + for (const step of result.steps ?? []) { + for (const part of (step.content ?? []) as any[]) { + if (part?.type === "tool-result") { + const outputType = part.output?.type; + if (outputType === "error-text" || outputType === "error-json") { + const value = part.output.value ?? "unknown error"; + outcomes.push({ + toolName: part.toolName, + status: "failed", + reason: typeof value === "string" ? value : JSON.stringify(value), + }); + } else { + outcomes.push({ toolName: part.toolName, status: "used" }); + } + } else if (part?.type === "tool-approval-response" && part.approved === false) { + outcomes.push({ + toolName: part.toolCall?.toolName ?? "tool", + status: "denied", + reason: part.reason, + }); + } + } + } + + return { text: result.text, outcomes }; +} diff --git a/apps/api/src/lib/slack-utils.ts b/apps/api/src/lib/slack-utils.ts new file mode 100644 index 0000000..78f3a87 --- /dev/null +++ b/apps/api/src/lib/slack-utils.ts @@ -0,0 +1,119 @@ +import { WebClient } from '@slack/web-api' +import type { ModelMessage } from 'ai' + +// One WebClient per request, from the Worker's own secrets: a Worker's +// environment is the request's, so nothing is read at module load (upstream +// built one client from process.env at import). `slackApiUrl` is Slack's own +// unless the e2e points SLACK_API_URL at its stand-in. +export function slackClient(token: string, apiUrl?: string) { + return new WebClient(token, apiUrl ? { slackApiUrl: apiUrl } : {}) +} + +export type Slack = WebClient + +const encoder = new TextEncoder() + +function hex(bytes: ArrayBuffer) { + return [...new Uint8Array(bytes)].map((b) => b.toString(16).padStart(2, '0')).join('') +} + +// Constant-time over the two strings' bytes: the length is not a secret (a +// v0= signature is always 67 characters), the content is. +function timingSafeEqual(a: string, b: string) { + const x = encoder.encode(a) + const y = encoder.encode(b) + if (x.length !== y.length) return false + let diff = 0 + for (let i = 0; i < x.length; i++) diff |= x[i]! ^ y[i]! + return diff === 0 +} + +// See https://api.slack.com/authentication/verifying-requests-from-slack — +// HMAC-SHA256 over `v0::` with the app's signing secret, +// with WebCrypto (upstream's node:crypto), refused when the timestamp is more +// than five minutes from now. `now` is a parameter so the tests can pin it. +export async function isValidSlackRequest({ + signingSecret, + timestamp, + signature, + rawBody, + now = Date.now(), +}: { + signingSecret: string + timestamp: string | null + signature: string | null + rawBody: string + now?: number +}): Promise { + if (!timestamp || !signature) return false + if (!/^\d+$/.test(timestamp)) return false + // Prevent replay attacks on the order of 5 minutes + if (Math.abs(now / 1000 - Number(timestamp)) > 60 * 5) return false + + const key = await crypto.subtle.importKey( + 'raw', + encoder.encode(signingSecret), + { name: 'HMAC', hash: 'SHA-256' }, + false, + ['sign'], + ) + const mac = await crypto.subtle.sign('HMAC', key, encoder.encode(`v0:${timestamp}:${rawBody}`)) + return timingSafeEqual(`v0=${hex(mac)}`, signature) +} + +export const updateStatusUtil = (slack: Slack, channel: string, thread_ts: string) => { + return async (status: string) => { + await slack.assistant.threads.setStatus({ + channel_id: channel, + thread_ts: thread_ts, + status: status, + }) + } +} + +export async function getThread( + slack: Slack, + channel_id: string, + thread_ts: string, + botUserId: string, +): Promise { + const { messages } = await slack.conversations.replies({ + channel: channel_id, + ts: thread_ts, + limit: 50, + }) + + // Ensure we have messages + + if (!messages) throw new Error('No messages found in thread') + + const result = messages + .map((message) => { + const isBot = !!message.bot_id + if (!message.text) return null + + // For app mentions, remove the mention prefix + // For IM messages, keep the full text + let content = message.text + if (!isBot && content.includes(`<@${botUserId}>`)) { + content = content.replace(`<@${botUserId}> `, '') + } + + return { + role: isBot ? 'assistant' : 'user', + content: content, + } as ModelMessage + }) + .filter((msg): msg is ModelMessage => msg !== null) + + return result +} + +export const getBotId = async (slack: Slack) => { + const { user_id: botUserId } = await slack.auth.test() + + if (!botUserId) { + throw new Error('botUserId is undefined') + } + return botUserId +} diff --git a/apps/api/src/lib/utils.ts b/apps/api/src/lib/utils.ts new file mode 100644 index 0000000..d4b09e8 --- /dev/null +++ b/apps/api/src/lib/utils.ts @@ -0,0 +1,22 @@ +import type { SearchWeb } from "./run-agent"; + +// Exa's web search, built only when its key is stored (EXA_API_KEY). Upstream +// constructed the client at import from process.env; a Worker's secrets are +// the request's, so it is built per request, and exa-js is imported then. +export function exaSearch(apiKey: string | undefined): SearchWeb | undefined { + if (!apiKey) return undefined; + return async (query, specificDomain) => { + const { default: Exa } = await import("exa-js"); + const exa = new Exa(apiKey); + const { results } = await exa.searchAndContents(query, { + livecrawl: "always", + numResults: 3, + includeDomains: specificDomain ? [specificDomain] : undefined, + }); + return results.map((result) => ({ + title: result.title, + url: result.url, + snippet: result.text.slice(0, 1000), + })); + }; +} diff --git a/apps/api/src/vendor/just-bash.js b/apps/api/src/vendor/just-bash.js new file mode 100644 index 0000000..6a26358 --- /dev/null +++ b/apps/api/src/vendor/just-bash.js @@ -0,0 +1,21 @@ +// What `import … from "just-bash"` resolves to inside the Worker +// (wrangler.jsonc → alias). just-bash ships two builds: a Node one, whose +// python3 and js commands need node:worker_threads and whose decompressors +// load native addons — none of which a Worker can run — and a browser one, +// which is the same in-memory bash without them. The Worker takes the browser +// build. bash-tool imports two more classes from the package root, +// BashTransformPipeline and TeePlugin; the browser build has neither, and +// bash-tool uses them only for its opt-in `experimentalTeeTransform`, which +// this bot never turns on — so they are stubs that refuse, loudly, if it is. +// (The tests run under Node, where the package's Node build is the one used.) +export * from "../../node_modules/just-bash/dist/bundle/browser.js"; + +class NotInTheBrowserBuild { + constructor() { + throw new Error( + "just-bash's transform plugins are not in its browser build, the one a Worker runs: bash-tool's experimentalTeeTransform is not available here", + ); + } +} +export class BashTransformPipeline extends NotInTheBrowserBuild {} +export class TeePlugin extends NotInTheBrowserBuild {} diff --git a/apps/api/src/wasm.d.ts b/apps/api/src/wasm.d.ts new file mode 100644 index 0000000..7c86014 --- /dev/null +++ b/apps/api/src/wasm.d.ts @@ -0,0 +1,5 @@ +// A `.wasm` import is a WebAssembly.Module, compiled by wrangler at upload. +declare module "*.wasm" { + const module: WebAssembly.Module; + export default module; +} diff --git a/apps/api/tsconfig.json b/apps/api/tsconfig.json new file mode 100644 index 0000000..c8ccbde --- /dev/null +++ b/apps/api/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tooling/tsconfig/worker.json", + "compilerOptions": { + "composite": false, + "noEmit": true, + "jsx": "react-jsx", + "jsxImportSource": "hono/jsx" + }, + "include": ["src/**/*.ts", "src/**/*.tsx"], + "exclude": ["node_modules", "dist"] +} diff --git a/apps/api/wrangler.jsonc b/apps/api/wrangler.jsonc new file mode 100644 index 0000000..e24fa68 --- /dev/null +++ b/apps/api/wrangler.jsonc @@ -0,0 +1,49 @@ +// Committed as-is (no wiring template): the Worker's one binding is the +// account's Workers AI, which has no resource id to wire. Orun deploys with +// `--env stage` / `--env prod`; wrangler names the Worker +// ai-slackbot-api- from the top-level name. Each environment's +// ENVIRONMENT var is what GET /health reports. A binding is not inherited by +// a named environment, so `ai` is declared in each. +// +// The bot's keys (Slack's two, and any model or search key) are Worker +// SECRETS, never vars: the deploy pushes the ones the environment has stored +// (component.yaml → runtimeSecrets), and `wrangler secret put` sets one by +// hand. +{ + "$schema": "node_modules/wrangler/config-schema.json", + "name": "ai-slackbot-api", + "main": "src/index.ts", + "compatibility_date": "2026-10-01", + "compatibility_flags": ["nodejs_compat"], + "observability": { + "enabled": true + }, + // just-bash's browser build, the one a Worker can run (src/vendor/just-bash.js). + "alias": { + "just-bash": "./src/vendor/just-bash.js" + }, + "ai": { "binding": "AI" }, + "vars": { + "ENVIRONMENT": "local" + }, + "env": { + "dev": { + "ai": { "binding": "AI" }, + "vars": { + "ENVIRONMENT": "dev" + } + }, + "stage": { + "ai": { "binding": "AI" }, + "vars": { + "ENVIRONMENT": "stage" + } + }, + "prod": { + "ai": { "binding": "AI" }, + "vars": { + "ENVIRONMENT": "prod" + } + } + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 556857a..0143918 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -24,6 +24,82 @@ importers: specifier: ^5.8.3 version: 5.9.3 + apps/api: + dependencies: + '@ai-sdk/openai': + specifier: 4.0.104 + version: 4.0.104(zod@4.4.3) + '@ai-sdk/policy-opa': + specifier: 1.0.155 + version: 1.0.155(@open-policy-agent/opa-wasm@1.10.0)(@open-policy-agent/opa@2.0.0(zod@4.4.3))(ai@7.0.155(zod@4.4.3))(zod@4.4.3) + '@open-policy-agent/opa': + specifier: 2.0.0 + version: 2.0.0(zod@4.4.3) + '@open-policy-agent/opa-wasm': + specifier: 1.10.0 + version: 1.10.0 + '@slack/web-api': + specifier: 7.16.0 + version: 7.16.0 + ai: + specifier: 7.0.155 + version: 7.0.155(zod@4.4.3) + bash-tool: + specifier: 1.3.17 + version: 1.3.17(ai@7.0.155(zod@4.4.3))(just-bash@3.0.1) + exa-js: + specifier: 1.10.3 + version: 1.10.3(ws@8.21.0) + hono: + specifier: ^4.13.0 + version: 4.13.14 + just-bash: + specifier: 3.0.1 + version: 3.0.1 + workers-ai-provider: + specifier: 4.0.1 + version: 4.0.1(@ai-sdk/openai@4.0.104(zod@4.4.3))(@ai-sdk/provider@4.0.34)(ai@7.0.155(zod@4.4.3)) + zod: + specifier: 4.4.3 + version: 4.4.3 + devDependencies: + '@app/eslint-config': + specifier: workspace:* + version: link:../../tooling/eslint + '@app/tsconfig': + specifier: workspace:* + version: link:../../tooling/tsconfig + '@cloudflare/workers-types': + specifier: ^5.20261006.1 + version: 5.20261028.1 + typescript: + specifier: ^5.8.3 + version: 5.9.3 + wrangler: + specifier: ^4.151.0 + version: 4.154.0(@cloudflare/workers-types@5.20261028.1) + + tests/api: + devDependencies: + '@app/eslint-config': + specifier: workspace:* + version: link:../../tooling/eslint + '@app/tsconfig': + specifier: workspace:* + version: link:../../tooling/tsconfig + '@cloudflare/workers-types': + specifier: ^5.20261006.1 + version: 5.20261028.1 + '@types/node': + specifier: ^22.9.0 + version: 22.20.5 + typescript: + specifier: ^5.8.3 + version: 5.9.3 + vitest: + specifier: ^3.2.4 + version: 3.2.7(@types/node@22.20.5)(yaml@2.9.1) + tooling/eslint: devDependencies: '@typescript-eslint/eslint-plugin': @@ -40,6 +116,253 @@ importers: packages: + '@ai-sdk/gateway@4.0.128': + resolution: {integrity: sha512-vAEUQPql1k+wyU3JUEosUupdwnwFD7Sts05EcxAYifY4Z1+dl+rD88y4gz8QZOnOidxzYZe2gPSBsWlo/ZahOw==} + engines: {node: '>=22'} + peerDependencies: + zod: ^3.25.76 || ^4.1.8 + + '@ai-sdk/openai@4.0.104': + resolution: {integrity: sha512-8oPwGh/zAdFrgyeGjTHlJMRm+DBwby3GkdGzN3vcNv4OwVtc1767mcM+7B2+gOxtloasZH+03gl+HPngQyQTMg==} + engines: {node: '>=22'} + peerDependencies: + zod: ^3.25.76 || ^4.1.8 + + '@ai-sdk/policy-opa@1.0.155': + resolution: {integrity: sha512-eMgWhauxPWH6idN/w1alm1Ai/bgc3vQAyql62p9mAf/F86rQWIZazlS6R8ZZ4QNGE8mQK7ycDJVx3b/Enur8pA==} + engines: {node: '>=22'} + peerDependencies: + '@open-policy-agent/opa': ^1.0.0 + '@open-policy-agent/opa-wasm': ^1.0.0 + ai: 7.0.155 + peerDependenciesMeta: + '@open-policy-agent/opa': + optional: true + '@open-policy-agent/opa-wasm': + optional: true + + '@ai-sdk/provider-utils@5.0.70': + resolution: {integrity: sha512-nU213UNVHWDoEKIZ5Hm3uGPmfW7EBHC2GkIJJEDKh4HLQWgh/eizrW2jmY4efxWf7Tf/yTzKD0t6sd4kVUKlyQ==} + engines: {node: '>=22'} + peerDependencies: + zod: ^3.25.76 || ^4.1.8 + + '@ai-sdk/provider@4.0.34': + resolution: {integrity: sha512-Ip7ZQBq/FiGpM1mmOVseTtX9PBjnzo0bLC41WTgBSBBRUBz6LhNFGbYaNUzI6hPm6ll1oNSPOAZc/q/z+3QZEQ==} + engines: {node: '>=22'} + + '@borewit/text-codec@0.2.2': + resolution: {integrity: sha512-DDaRehssg1aNrH4+2hnj1B7vnUGEjU6OIlyRdkMd0aUdIUvKXrJfXsy8LVtXAy7DRvYVluWbMspsRhz2lcW0mQ==} + + '@cloudflare/kv-asset-handler@0.5.0': + resolution: {integrity: sha512-jxQYkj8dSIzc0cD6cMMNdOc1UVjqSqu8BZdor5s8cGjW2I8BjODt/kWPVdY+u9zj3ms75Q5qaZgnxUad83+eAg==} + engines: {node: '>=22.0.0'} + + '@cloudflare/unenv-preset@2.16.2': + resolution: {integrity: sha512-JBP1+Z7ZSNG/d4mRP+y8VC5dka3tZVMLEZRvS+rzQ4DGV1EoxRFQckcJTTkXbHSQiTj0DtNI01Zwb/V2fX0mvQ==} + peerDependencies: + unenv: 2.0.0-rc.24 + workerd: '>1.20260305.0 <2.0.0-0' + peerDependenciesMeta: + workerd: + optional: true + + '@cloudflare/workerd-darwin-64@1.20261023.1': + resolution: {integrity: sha512-lsEx0i7nR0PNG/erUFFHmQmiidEhLfDE5uQmAL9421/y4/ycuxDDOSaxu3VGGYFFPK5sduyUeMmjIlX4CwOBFg==} + engines: {node: '>=16'} + cpu: [x64] + os: [darwin] + + '@cloudflare/workerd-darwin-arm64@1.20261023.1': + resolution: {integrity: sha512-5e79fHgabdDD8EgmjOhJ1S+xMsf6DbC7fL7IgTBizMnzOp0P2isDn7pYmUxI9AJZE9FVQ4RUilH/I36YNg+GQQ==} + engines: {node: '>=16'} + cpu: [arm64] + os: [darwin] + + '@cloudflare/workerd-linux-64@1.20261023.1': + resolution: {integrity: sha512-VHQ6jKFSihjR2+x1buby8XTdBLLJztVnYiB7OLOTYO8aDXB+c1Rd2410PdgFuFYc4AgFEk6PCJLyCLL5L1KBnw==} + engines: {node: '>=16'} + cpu: [x64] + os: [linux] + + '@cloudflare/workerd-linux-arm64@1.20261023.1': + resolution: {integrity: sha512-ilpRHzfDN8YFRM5CLRKuFw40x/LJBS89yVdhdQmxehlVDuBqjKpJB++zPFbTgKRRFaNupgnXc8RHktXAIhgCmQ==} + engines: {node: '>=16'} + cpu: [arm64] + os: [linux] + + '@cloudflare/workerd-windows-64@1.20261023.1': + resolution: {integrity: sha512-279WLVjNsMycAwr0EZNiNEf0l2SY6NUtsN80NwZzbTHzakmiN+WSx4w38muxPm+PAU0oSPPAPXKVD+H6Hya8xw==} + engines: {node: '>=16'} + cpu: [x64] + os: [win32] + + '@cloudflare/workers-types@5.20261028.1': + resolution: {integrity: sha512-a0Ceo9MtNZej9s7iZAvYD0txFXlFb1le4rhJ+x4mrC02hsXy4T0RHCqpX1zEOnrI1504Ro8HwJQtKMh2/MVDCw==} + + '@cspotcode/source-map-support@0.8.1': + resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} + engines: {node: '>=12'} + + '@emnapi/runtime@1.11.3': + resolution: {integrity: sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==} + + '@esbuild/aix-ppc64@0.28.2': + resolution: {integrity: sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + + '@esbuild/android-arm64@0.28.2': + resolution: {integrity: sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm@0.28.2': + resolution: {integrity: sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + + '@esbuild/android-x64@0.28.2': + resolution: {integrity: sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + + '@esbuild/darwin-arm64@0.28.2': + resolution: {integrity: sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-x64@0.28.2': + resolution: {integrity: sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + + '@esbuild/freebsd-arm64@0.28.2': + resolution: {integrity: sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.28.2': + resolution: {integrity: sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + + '@esbuild/linux-arm64@0.28.2': + resolution: {integrity: sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm@0.28.2': + resolution: {integrity: sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-ia32@0.28.2': + resolution: {integrity: sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-loong64@0.28.2': + resolution: {integrity: sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-mips64el@0.28.2': + resolution: {integrity: sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-ppc64@0.28.2': + resolution: {integrity: sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-riscv64@0.28.2': + resolution: {integrity: sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-s390x@0.28.2': + resolution: {integrity: sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-x64@0.28.2': + resolution: {integrity: sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + + '@esbuild/netbsd-arm64@0.28.2': + resolution: {integrity: sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.28.2': + resolution: {integrity: sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + + '@esbuild/openbsd-arm64@0.28.2': + resolution: {integrity: sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.28.2': + resolution: {integrity: sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + + '@esbuild/openharmony-arm64@0.28.2': + resolution: {integrity: sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openharmony] + + '@esbuild/sunos-x64@0.28.2': + resolution: {integrity: sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + + '@esbuild/win32-arm64@0.28.2': + resolution: {integrity: sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-ia32@0.28.2': + resolution: {integrity: sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-x64@0.28.2': + resolution: {integrity: sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + '@eslint-community/eslint-utils@4.10.1': resolution: {integrity: sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -98,6 +421,379 @@ packages: resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==} engines: {node: '>=18.18'} + '@img/colour@1.1.0': + resolution: {integrity: sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==} + engines: {node: '>=18'} + + '@img/sharp-darwin-arm64@0.35.5': + resolution: {integrity: sha512-QRUlFQ0WxvdWyqqG/WtI3iupfD5rBzmCHXSdPsY91sAtVtTo7Q4cb6zOccZ3gqEqkr0f1As1ehLqmEpDsRf+lg==} + engines: {node: '>=20.9.0'} + cpu: [arm64] + os: [darwin] + + '@img/sharp-darwin-x64@0.35.5': + resolution: {integrity: sha512-+BR255RhDlpygUpOc/Jdt1nT6DQ3XG/ERo5wbcdOf5Q320dKtPCKPLR1LJs9VGXRaMa8l1uUa0tkCNOXiAxZUw==} + engines: {node: '>=20.9.0'} + cpu: [x64] + os: [darwin] + + '@img/sharp-freebsd-wasm32@0.35.5': + resolution: {integrity: sha512-Y/z91nEZ4uIBX5X3nfTovjU9lHNKFYbL2lpHCLVNmXQK03VIZvXBBt0KxbPGp2SdGSF+2mQU4e+hQaWOt86iAw==} + engines: {node: '>=20.9.0'} + os: [freebsd] + + '@img/sharp-libvips-darwin-arm64@1.3.4': + resolution: {integrity: sha512-5R89nBYiRdUlSWJxPhO+GVtaXzXSxKnRu/xqMn3KTA3L9EB9Oy/P+Nn2f2vlhPuUdy/Zusb2DarbyTpGCfEDuw==} + cpu: [arm64] + os: [darwin] + + '@img/sharp-libvips-darwin-x64@1.3.4': + resolution: {integrity: sha512-iR2OKH80yi0U+dUplyh3/xdpFvps6YkCwsXenIJxqxR1v9o+xtKTGbS9H7cps+2Vxjc8B1j96p75NmTGjIhtpQ==} + cpu: [x64] + os: [darwin] + + '@img/sharp-libvips-linux-arm64@1.3.4': + resolution: {integrity: sha512-Y3dgX/6lE2QhQb+Gxy0WZxfg9MEm/JBjamZpS2IklP7xIQoKN4hzAm7KcMVGtaVDt3neE9OKBC7vAfonA/Lr1A==} + cpu: [arm64] + os: [linux] + + '@img/sharp-libvips-linux-arm@1.3.4': + resolution: {integrity: sha512-LmRtTsOHuvM2+wlO2Db37dx5MiZhB0FvSunciw48YjdOkZz9KAiRbm8ujeMOA1INqmei5NapFxYEK1D1ZSidmw==} + cpu: [arm] + os: [linux] + + '@img/sharp-libvips-linux-ppc64@1.3.4': + resolution: {integrity: sha512-Le6boB8Tai0Nis+gIxIpKx68UDVVIqdR8Tin5Yf1z2LJJQLDJvCDRqRu+jC2qCoD+eIomonmOwB4smBRxfVpYQ==} + cpu: [ppc64] + os: [linux] + + '@img/sharp-libvips-linux-riscv64@1.3.4': + resolution: {integrity: sha512-aHkkIEHPRdQEegJN20MLmGtxYD9R2wQr3Cwpddnu5+YKMt6Uzax7S9h5gpZTo8wyrGuZSlfQ63OevL5mTyOC7Q==} + cpu: [riscv64] + os: [linux] + + '@img/sharp-libvips-linux-s390x@1.3.4': + resolution: {integrity: sha512-ra/mB6MikESDUO7Yg+Mi95bFBb9GsObURuhnOv3OqknjGe9sZrG8tCe9q0xSIGrtLgvgw0gKnFWcK4blSgQOuQ==} + cpu: [s390x] + os: [linux] + + '@img/sharp-libvips-linux-x64@1.3.4': + resolution: {integrity: sha512-GJ//SSXbnwSDes02umB3nDJLFcQzw8a18V8fyhqr6tV515tOEMdImjjxj1AoafMRz56F3PHgftnj1QEKSU1zkw==} + cpu: [x64] + os: [linux] + + '@img/sharp-libvips-linuxmusl-arm64@1.3.4': + resolution: {integrity: sha512-hvulFwtjUcagsis6BBxHwGFwWoNZjgYmULGVrZcyfNbjA8hKILbRxGg15/7w5HDyXHXUos/j6baAWqnCyQ2DWA==} + cpu: [arm64] + os: [linux] + + '@img/sharp-libvips-linuxmusl-x64@1.3.4': + resolution: {integrity: sha512-6zXKeE/p39I1AmA3cJG35eyBGNqNddLnUXjhwBnsGjFPWqf5VKkDBEqaEkPDoTEtkxwi2vv8Tcr2mDyP4So7Fg==} + cpu: [x64] + os: [linux] + + '@img/sharp-linux-arm64@0.35.5': + resolution: {integrity: sha512-LYVx5JTsOM2CBzmxreh+nl64/3H6Xb09iSLknqH47z2T2DFFxDeFLP5y4dJwe6H7uGQlHPyEEtIqyo3DYsRwdQ==} + engines: {node: '>=20.9.0'} + cpu: [arm64] + os: [linux] + + '@img/sharp-linux-arm@0.35.5': + resolution: {integrity: sha512-LEaXK2WdXVK5ykcw0buWyPMsmLLL2vpHLD6yrNSW+JGEL3BZPA4tpKN6iaMc4AxTTAoaX/sU1rOL51lcIz48ZQ==} + engines: {node: '>=20.9.0'} + cpu: [arm] + os: [linux] + + '@img/sharp-linux-ppc64@0.35.5': + resolution: {integrity: sha512-QVxAAq8evVRI9ia2vqgwrmWucn5Dfv+JdWzj75pD8omHLPSP7f8p20O8jxzjCcuCEQEOtYOZUmX1hkiZ0kdevA==} + engines: {node: '>=20.9.0'} + cpu: [ppc64] + os: [linux] + + '@img/sharp-linux-riscv64@0.35.5': + resolution: {integrity: sha512-LtdreXguaavKODPIfzJ4kffx7UNt1omwtK0rch4EBbbSTXPnxWmYSayXdLJw0fJzQ97kHt1gL/yh4tvU+nCyRQ==} + engines: {node: '>=20.9.0'} + cpu: [riscv64] + os: [linux] + + '@img/sharp-linux-s390x@0.35.5': + resolution: {integrity: sha512-UZasTOFiYzotTsGOCu42BfUzP6Tu6Do/947iRm1RsLKvlllxwGcn4RN27LibGWceix4Y+Pmw3jsnTcCQIgWjqA==} + engines: {node: '>=20.9.0'} + cpu: [s390x] + os: [linux] + + '@img/sharp-linux-x64@0.35.5': + resolution: {integrity: sha512-SxFtLTeJInhAA9Q836kux2vZNeOBQEx658qvbboZScr0wIARym3IcGmW7KpVD5sbVg0Ojy+udFQdayYIZyoNog==} + engines: {node: '>=20.9.0'} + cpu: [x64] + os: [linux] + + '@img/sharp-linuxmusl-arm64@0.35.5': + resolution: {integrity: sha512-9HbMclmI1zlNkFRs3z9/eBtDjfD0sGlrX1z6b1qwmiFY5ElDLh4BC0LPBdVp7z1DXFiKlIcznf+ZlsuZzLxQqg==} + engines: {node: '>=20.9.0'} + cpu: [arm64] + os: [linux] + + '@img/sharp-linuxmusl-x64@0.35.5': + resolution: {integrity: sha512-4KOphqB035HrVdqLZfCgMzzERrQkkzOwRhl4OAkRO1YCldbaFjySXMaK534Mo0V+LndnlJk+sbUyLeU0ULyD1A==} + engines: {node: '>=20.9.0'} + cpu: [x64] + os: [linux] + + '@img/sharp-wasm32@0.35.5': + resolution: {integrity: sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ==} + engines: {node: '>=20.9.0'} + + '@img/sharp-webcontainers-wasm32@0.35.5': + resolution: {integrity: sha512-hfhF/FmoQyTUkA0bIKFOtw536BQSeBMe6BF6QyWlrPxT754+TFLaZ7sKKTfvvM0yJgKgaYTwnFCIZ/GuDw5SUA==} + engines: {node: '>=20.9.0'} + cpu: [wasm32] + + '@img/sharp-win32-arm64@0.35.5': + resolution: {integrity: sha512-X4t7g+7ZA5DKblCBEXGjUqqemj4vczING/5viFwAL8h4N3qYeyjwdCvRLHi4EdOUI+2Z7UFlp1VM+p/AuEtm6Q==} + engines: {node: '>=20.9.0'} + cpu: [arm64] + os: [win32] + + '@img/sharp-win32-ia32@0.35.5': + resolution: {integrity: sha512-5Zm82LoBc43nhwNybZlG7Y1KO//Zhsn306fQl29ZOuStHLGTo3BWL83q3cznX0poxSAMuYL1On/BHBxkBeKr6A==} + engines: {node: ^20.9.0} + cpu: [ia32] + os: [win32] + + '@img/sharp-win32-x64@0.35.5': + resolution: {integrity: sha512-x76eH0vEiHlcMQu8Y8IenntaACtddpT6W0wmXtWrnKcnKI7ME5DdgqhAD6SEWOEl1v2zDvkZDhFA9KnURwpfqg==} + engines: {node: '>=20.9.0'} + cpu: [x64] + os: [win32] + + '@jitl/quickjs-ffi-types@0.32.0': + resolution: {integrity: sha512-v9T+GQpmk43VDJ7d72sf0Nexhk+ArvtUihW27dy7lqAl0zBObFKtSBBIm5RBjwIhE8VwsPPm9PNuvPvNqLWUEg==} + + '@jitl/quickjs-wasmfile-debug-asyncify@0.32.0': + resolution: {integrity: sha512-EX8zbXwGqCgAE764M+qvkHtyXDi/FUoMBea0JnES7vCM3P7a2+EOZOjGv85wtZ2sJhI1oJ+nekmqpOODFDY+hw==} + + '@jitl/quickjs-wasmfile-debug-sync@0.32.0': + resolution: {integrity: sha512-LeYWrPGC1uNCTBWvibo3ZLJj0CSVNYUXvJpXMCmuQ5Sap2cCACc3uvGvYV4homHHBAzfw5akoTqMMS4YFRtw+Q==} + + '@jitl/quickjs-wasmfile-release-asyncify@0.32.0': + resolution: {integrity: sha512-3oSwPfja12ICz4aIblB58cuY8JlEq5Txt8Cut4VLo+LH47QN+mzCnSgnbB03hWzg1LBcc+VyyI9UOag7a1NF+Q==} + + '@jitl/quickjs-wasmfile-release-sync@0.32.0': + resolution: {integrity: sha512-BKNDI/TPBfGlLNGYpLrhcDGXmIk4xHm4MRAisOBnOzpXVn9HZWsfmMAc9WMBrAHjvvds6HOikKeaOBKdPdpVrg==} + + '@jridgewell/resolve-uri@3.1.2': + resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} + engines: {node: '>=6.0.0'} + + '@jridgewell/sourcemap-codec@1.6.0': + resolution: {integrity: sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==} + + '@jridgewell/trace-mapping@0.3.9': + resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} + + '@mixmark-io/domino@2.2.0': + resolution: {integrity: sha512-Y28PR25bHXUg88kCV7nivXrP2Nj2RueZ3/l/jdx6J9f8J4nsEGcgX0Qe6lt7Pa+J79+kPiJU3LguR6O/6zrLOw==} + + '@mongodb-js/zstd@7.0.0': + resolution: {integrity: sha512-mQ2s0pYYiav+tzCDR05Zptem8Ey2v8s11lri5RKGhTtL4COVCvVCk5vtyRYNT+9L8qSfyOqqefF9UtnW8mC5jA==} + engines: {node: '>= 20.19.0'} + + '@napi-rs/lzma-linux-x64-gnu@1.5.1': + resolution: {integrity: sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==} + engines: {node: ^22.20 || ^24.12 || >=25} + cpu: [x64] + os: [linux] + + '@nodable/entities@3.1.0': + resolution: {integrity: sha512-LsS/DjHr+uDM647Gru/cA8+J3a3HfhttwCKLyuoyN7yXTFCxKBtSgMQBvrW9yNPa2/zDRUNuGPaH5QUFoa4arQ==} + + '@nodelib/fs.scandir@2.1.5': + resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} + engines: {node: '>= 8'} + + '@nodelib/fs.stat@2.0.5': + resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} + engines: {node: '>= 8'} + + '@nodelib/fs.walk@1.2.8': + resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} + engines: {node: '>= 8'} + + '@open-policy-agent/opa-wasm@1.10.0': + resolution: {integrity: sha512-ymR/nFS3nO9o24j9xowGGQaf+Gmb813QcxUpVZkfRlJkawKWqSIllnEH15agyWjijmOIyhA+OBErenx6N3jphw==} + + '@open-policy-agent/opa@2.0.0': + resolution: {integrity: sha512-gtSZKm9eWU9FC7lJ7A2sbyNc+ukTddZ2t6WtJGCtHc+ze6tvhJ7xtLQmlCWLmkyIu+6TGVRn/fr2JGdKgVLdtQ==} + peerDependencies: + zod: ^3.25.0 || ^4.0.0 + + '@open-policy-agent/ucast-prisma@0.1.6': + resolution: {integrity: sha512-4bnz9aZzQQyfoo6OrXCWA8IH6Kp6pB34e4A2vGv2B0S/dbfFVN8TzmUn+WTJg7Eyr/NiF2EPFShiFgBwbUhhrA==} + + '@poppinss/colors@4.1.6': + resolution: {integrity: sha512-H9xkIdFswbS8n1d6vmRd8+c10t2Qe+rZITbbDHHkQixH5+2x1FDGmi/0K+WgWiqQFKPSlIYB7jlH6Kpfn6Fleg==} + + '@poppinss/dumper@0.6.5': + resolution: {integrity: sha512-NBdYIb90J7LfOI32dOewKI1r7wnkiH6m920puQ3qHUeZkxNkQiFnXVWoE6YtFSv6QOiPPf7ys6i+HWWecDz7sw==} + + '@poppinss/exception@1.2.3': + resolution: {integrity: sha512-dCED+QRChTVatE9ibtoaxc+WkdzOSjYTKi/+uacHWIsfodVfpsueo3+DKpgU5Px8qXjgmXkSvhXvSCz3fnP9lw==} + + '@rollup/rollup-android-arm-eabi@4.66.0': + resolution: {integrity: sha512-7y4XeoUHPecjfUDRmap8U0q6bjfLAPn7uOGT8BKyqy8uNDOjsGS8rlBhOx6sZLVwwjN6hapvGl2mW9/IS6UNww==} + cpu: [arm] + os: [android] + + '@rollup/rollup-android-arm64@4.66.0': + resolution: {integrity: sha512-e8WugYZXpgqrlMXLCudYVRAxAcK7AIY36JxRDwFRD38L9q62G1VsEUW6ijXxzjxYjNB8i1zo3B/ycIQ/qjLC/Q==} + cpu: [arm64] + os: [android] + + '@rollup/rollup-darwin-arm64@4.66.0': + resolution: {integrity: sha512-6vkDCfyDjNLokh+Rt1D2KtNgFFMEPdkWha/mbtP4cSjh9xiN8T/JBS/A7nDYKjmMAXHrvR9J3AzUk2LtFbIBLg==} + cpu: [arm64] + os: [darwin] + + '@rollup/rollup-darwin-x64@4.66.0': + resolution: {integrity: sha512-/mzZAX0+Q6eXxvkR0HB0RZCCrsbmFD8DpsvCQoMYABDfq/DjqkbfytuJ7GvZ4AhR/Mgis2fXbZrGqfbcK2Z5fA==} + cpu: [x64] + os: [darwin] + + '@rollup/rollup-freebsd-arm64@4.66.0': + resolution: {integrity: sha512-JQJx9E8tUjGqed1RevDmoHaS3V30ODdV8uyvGxlwd4K5se6bkPrMeltSybqAtpJ+ltDRfo7FORQaJG2Hd5nGog==} + cpu: [arm64] + os: [freebsd] + + '@rollup/rollup-freebsd-x64@4.66.0': + resolution: {integrity: sha512-GEaUQQjMaG7X1304qMgqLjzCKv6CdDirzJSS+UqUs3xhJ9X2Kjzu0JDbLoUU42FWxwmZqz+SsgU1SlQv9GNRVA==} + cpu: [x64] + os: [freebsd] + + '@rollup/rollup-linux-arm-gnueabihf@4.66.0': + resolution: {integrity: sha512-DgmAU9N0NhDQDzHgFUocDio7zRO8jR/nY/obDGvCR8zbJ6J77Fg6X49yPuExJUpYPbC82EOaRhG969pWzUSnHQ==} + cpu: [arm] + os: [linux] + + '@rollup/rollup-linux-arm-musleabihf@4.66.0': + resolution: {integrity: sha512-zG09YZ+sk/HoHq+P9gYB0EseQ3M20RbDuKGWey6fbiMDV1LxfXvhgSW9jDaCcvFPMgfLXpimzXY+UYvA8R2mLQ==} + cpu: [arm] + os: [linux] + + '@rollup/rollup-linux-arm64-gnu@4.66.0': + resolution: {integrity: sha512-vlArhgyXbcVc1D4WZPoiYuqJIaMiSHBj6etRXua0KlfjlZeuiQyVAPYi0/N49O4mSp3u1iGUBLEjNa8ec81XZg==} + cpu: [arm64] + os: [linux] + + '@rollup/rollup-linux-arm64-musl@4.66.0': + resolution: {integrity: sha512-RxJZtk0G87YPotDaRDvRqStV8cbqLSC5TroHvQHHKsqBg0ok64RxKgtXeFsa7FBcy7mb4crBrG3xK8USWIqWNA==} + cpu: [arm64] + os: [linux] + + '@rollup/rollup-linux-loong64-gnu@4.66.0': + resolution: {integrity: sha512-qlGcw959PrLLkZhiBxF3OZ6SQvj+OKY85mCqGNgSRs4LZlDJ6ICqmz6UdxtINdhcXYwNIbZoapQVBAmZlD2hUQ==} + cpu: [loong64] + os: [linux] + + '@rollup/rollup-linux-loong64-musl@4.66.0': + resolution: {integrity: sha512-TvTI/7Cy0WvRA1SXgwzu6bwXBnMpmeT/ln5q7WvSpqmXy1VbmEnY8HVIDQNBiaHJvoWqRr0M4FNo7qiqtyMaFw==} + cpu: [loong64] + os: [linux] + + '@rollup/rollup-linux-ppc64-gnu@4.66.0': + resolution: {integrity: sha512-UZEDkSoDRZ50NyLj70nO6mpIK3dvs2cPTTvQb1bA/PBDmr9fvn5KiESuGfh6srd7Zi6Lt9Sv2sVrFr1QoHLvPQ==} + cpu: [ppc64] + os: [linux] + + '@rollup/rollup-linux-ppc64-musl@4.66.0': + resolution: {integrity: sha512-VRbxTvagLh3HRcysx1CNq+HHcvJbSebNI6fCbk7jwmmWHkXjrSIV3igXBpRHUTFdg0pagWGu50xoSZXnrZHjVQ==} + cpu: [ppc64] + os: [linux] + + '@rollup/rollup-linux-riscv64-gnu@4.66.0': + resolution: {integrity: sha512-uWdJpvYqh0LE/i+YBL3sMX0a2kUkICENjmrPmyBmMOFc3jMrs6MSQH/pMD+VIpGEoUcr3XkHGLLfymzIqPSRRg==} + cpu: [riscv64] + os: [linux] + + '@rollup/rollup-linux-riscv64-musl@4.66.0': + resolution: {integrity: sha512-3FUd88pxgWAjK60OgCrika1AcNG+u8zaCdWjg4TlcZTDkt5TGyci8ZU64l3OJ9ax0MEjw3P80B/3PoSQDCLwJQ==} + cpu: [riscv64] + os: [linux] + + '@rollup/rollup-linux-s390x-gnu@4.66.0': + resolution: {integrity: sha512-qT2rMmgyej62g5AdwktK+Bt2lBu497pzWZe12TTQ5JmZjOYPnEwcPEAOSLTBxBV+6gIES75rXm219v/QkT397A==} + cpu: [s390x] + os: [linux] + + '@rollup/rollup-linux-x64-gnu@4.66.0': + resolution: {integrity: sha512-E46rnZgp7J84Qwe8RMlF+rgimnDo/9fuiGbUArGB0ZkMWf97O7yeSCfKls5x/YJOF0RcuSe9RctuKe1hlxICiA==} + cpu: [x64] + os: [linux] + + '@rollup/rollup-linux-x64-musl@4.66.0': + resolution: {integrity: sha512-Uz1HiZe+qBzqgdPsON+z0wRx3WdATuyzwvGT6cr2VZVrqqko0ZJVfkrQJtwDMuDcAfXYdo7XucaxJ7lTLjEcgg==} + cpu: [x64] + os: [linux] + + '@rollup/rollup-openbsd-x64@4.66.0': + resolution: {integrity: sha512-Ph7TX3Ex5qdfcb7Tc6eEPugVkRfJ501eTovO4T5029YObfpZ7dzn3RiwpFvGp50nk2QUhvBMZ0PFGlEj6pOYTg==} + cpu: [x64] + os: [openbsd] + + '@rollup/rollup-openharmony-arm64@4.66.0': + resolution: {integrity: sha512-nZYPEya7ZkeNxUEiF7qmNZbyLTyRN3MK5cO22KqsaoneUzXJuzBIQRw+7BEQy9LGj2O5vrCE9V3EpK06FYo1tQ==} + cpu: [arm64] + os: [openharmony] + + '@rollup/rollup-win32-arm64-msvc@4.66.0': + resolution: {integrity: sha512-u7aTfS3R6C4hRsqXSzaO6qLZYLVuMkHMvcWlux4IM8IJif1VCl2cgPBSo5gSNoFoStQypQP+qwq8W1IyFBf1QQ==} + cpu: [arm64] + os: [win32] + + '@rollup/rollup-win32-ia32-msvc@4.66.0': + resolution: {integrity: sha512-e+i9ueHrH1Bafb0cf0woAIVJbYcoC8vRaD+vz+Xi8w6jz9cYJSV3vyKO6ELGSZ6g4W4MJOm2WPLN4/nQf77h7w==} + cpu: [ia32] + os: [win32] + + '@rollup/rollup-win32-x64-gnu@4.66.0': + resolution: {integrity: sha512-KfTCbrtr2zXTqH2E1F+uYlFTrYibxHKqPAHobpd8Kfg49cEHmuHebOidCTDRgqG1suaPFX7oejFQeGE71zWKfA==} + cpu: [x64] + os: [win32] + + '@rollup/rollup-win32-x64-msvc@4.66.0': + resolution: {integrity: sha512-xA+neBh1bqkqaS3b48T2UHZnDsTIpb9B0h+TdBzynjF/ymCpYndhfY10RqW0qSKB1HqqQA83mINVhAdwA+mETg==} + cpu: [x64] + os: [win32] + + '@sindresorhus/is@7.2.0': + resolution: {integrity: sha512-P1Cz1dWaFfR4IR+U13mqqiGsLFf1KbayybWwdd2vfctdV6hDpUkgCY0nKOLLTMSoRd/jJNjtbqzf13K8DCCXQw==} + engines: {node: '>=18'} + + '@slack/logger@4.0.1': + resolution: {integrity: sha512-6cmdPrV/RYfd2U0mDGiMK8S7OJqpCTm7enMLRR3edccsPX8j7zXTLnaEF4fhxxJJTAIOil6+qZrnUPTuaLvwrQ==} + engines: {node: '>= 18', npm: '>= 8.6.0'} + + '@slack/types@2.22.0': + resolution: {integrity: sha512-sZ9lIgJhPX2qft/tKWiklFlc0o1FWeI7QtciZJfW1+ErH1eGGHvOZ8e73sleTCFEFJp1q/R0WeS8Oa7AsiDprg==} + engines: {node: '>= 12.13.0', npm: '>= 6.12.0'} + + '@slack/web-api@7.16.0': + resolution: {integrity: sha512-68SAV77uuGKuhyyaRytX8UijVnqSLsTSKslGXw17cjQYXn+jtNl7gbaEjHgC5x2rhCuFdahBrEC2VCLppbzReg==} + engines: {node: '>= 18', npm: '>= 8.6.0'} + + '@speed-highlight/core@1.2.24': + resolution: {integrity: sha512-qeW2e1l78afw8VhRPfPQ1Gjj+KU5XFQ/OFV5ti6eTa9bruO7mJyZtA4vw0ofqmA3tKCkROE9xLk3VZoeRc98nw==} + + '@standard-schema/spec@1.1.0': + resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==} + + '@tokenizer/inflate@0.4.1': + resolution: {integrity: sha512-2mAv+8pkG6GIZiF1kNg1jAjh27IDxEPKwdGul3snfztFerfPGI1LjDezZp3i7BElXompqEtPmoPx6c2wgtWsOA==} + engines: {node: '>=18'} + + '@tokenizer/token@0.3.0': + resolution: {integrity: sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==} + '@turbo/darwin-64@2.11.10': resolution: {integrity: sha512-By4idRap5+nLnMuRzLB4qkOPRlvNdyY1ne4VJYDyUoUB11H94k7uif9mbe3JT8JSNXs1D68uMcBj6hJ/jMQRvA==} cpu: [x64] @@ -128,12 +824,24 @@ packages: cpu: [arm64] os: [win32] + '@types/chai@5.2.3': + resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==} + + '@types/deep-eql@4.0.2': + resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} + '@types/estree@1.0.9': resolution: {integrity: sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==} '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + '@types/node@22.20.5': + resolution: {integrity: sha512-U2+DNr+wSjpsTS/wZGYHq7GcwfuSmKiKvoPvK22zwTlRhU91yOniN4qRR5KhIjvif7ysw/dz/hKmfDH0Ris4aA==} + + '@types/retry@0.12.0': + resolution: {integrity: sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==} + '@typescript-eslint/eslint-plugin@8.72.1': resolution: {integrity: sha512-5CokTWXpmbylfFabsbvHC0CAw3XLaGnoa+nFJX5FR592h/LoZsENUE6p/rg5xvkKrFEXz6pYmgI29AgXc2N3BQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -193,6 +901,45 @@ packages: resolution: {integrity: sha512-SB8xqipSzZHUePCCLNeYxqnxq83X61/qzNhjQGbTfjxGZIeOEP7tBgWYX05Tcd6CgE02WdTJnh5b8kMZJ/+bnQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@ucast/core@1.10.2': + resolution: {integrity: sha512-ons5CwXZ/51wrUPfoduC+cO7AS1/wRb0ybpQJ9RrssossDxVy4t49QxWoWgfBDvVKsz9VXzBk9z0wqTdZ+Cq8g==} + + '@vercel/oidc@3.2.0': + resolution: {integrity: sha512-UycprH3T6n3jH0k44NHMa7pnFHGu/N05MjojYr+Mc6I7obkoLIJujSWwin1pCvdy/eOxrI/l3uDLQsmcrOb4ug==} + engines: {node: '>= 20'} + + '@vitest/expect@3.2.7': + resolution: {integrity: sha512-E8eBXaKibuvH2pSZErOjdVb5vF4PbKYcrnluBTYxEk1l/VhhwZg1kZQsdtjq+CsF5CFydf2Rdkz7jDHKSisi3w==} + + '@vitest/mocker@3.2.7': + resolution: {integrity: sha512-Trr0hYO9CM3Wj6ksWHRhK9IZpIY6wTMO5u/MqXurMxT57sWBaOPEtP3Oq60ihZuh5JsiagKfz95OcxdEP6dBrA==} + peerDependencies: + msw: ^2.4.9 + vite: ^5.0.0 || ^6.0.0 || ^7.0.0-0 + peerDependenciesMeta: + msw: + optional: true + vite: + optional: true + + '@vitest/pretty-format@3.2.7': + resolution: {integrity: sha512-KUHlwqVu0sRlhCdyPdQ/wBoTfRahjUky1MubOmYw9fWfIZy1gNoHpuaaQBPAaMaVYdQYHJLurzj8ECCj5OwTqA==} + + '@vitest/runner@3.2.7': + resolution: {integrity: sha512-sB9y4ovltoQP+WaUPwmSxO9WIg9Ig694Di5PalVPsYHklAdE027mehpWF2SQSVq+k6sFgaivbTjTJwZLSHbedA==} + + '@vitest/snapshot@3.2.7': + resolution: {integrity: sha512-7C+MwShwtBSI5Buwoyg3s/iY1eHL9PKAf+O1wVh/TdnjXUtkoL/9YQtre90i4MtNXM6edP1wJ2zOBpfCyhIS7g==} + + '@vitest/spy@3.2.7': + resolution: {integrity: sha512-Q2eQGI6d2L/hBtZ0qNuKcAGid68XK6cv1xsoaIma6PaJhHPoqcEJhYpXZ/5myCMqkNgtP6UKuBhbc0nHKnrkuQ==} + + '@vitest/utils@3.2.7': + resolution: {integrity: sha512-x6BDOd7dyo3PFLY3I9/HJ25X/6OurhGXk2/B9gOZNPF7XDVjeBK4k01lQE5uvDpbuheErh91qYuE1E2OEjK3Rw==} + + '@workflow/serde@4.1.0': + resolution: {integrity: sha512-pav4F2BoirECWR7Nf1TKt+2eETcBj7jj4cBefQ8VXQCA6NPkaKeLfj/zMgi+3zYV5ZIBT4GuUiphsj0/b9hPQQ==} + acorn-jsx@5.3.2: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: @@ -203,16 +950,39 @@ packages: engines: {node: '>=0.4.0'} hasBin: true - ajv@6.15.0: - resolution: {integrity: sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==} + agent-base@6.0.2: + resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} + engines: {node: '>= 6.0.0'} + + ai@7.0.155: + resolution: {integrity: sha512-df/UwKgOix8Vc+dj684bQlHCClNojrG5T7Jr5aJvFyz+PlBo7gEgMALPzP7LdeD12Gxc6i0pzpboEszDh9V1wA==} + engines: {node: '>=22'} + peerDependencies: + zod: ^3.25.76 || ^4.1.8 + + ajv@6.15.0: + resolution: {integrity: sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==} ansi-styles@4.3.0: resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} engines: {node: '>=8'} + anynum@1.0.1: + resolution: {integrity: sha512-N6//FLET/tXYNM/F6ABca1oH6fWB+KlTt909Le28WMDBk8oaT4vY17DCrwg2MvmuqUKt3Ni4N5dGJ/EoBgcO6A==} + argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + assertion-error@2.0.1: + resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} + engines: {node: '>=12'} + + asynckit@0.4.0: + resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + + axios@1.21.0: + resolution: {integrity: sha512-YCzXMB53Q9PZBsh7yN7wtapit4WepwcHS2fP8QhGsBxSz5YtgYobV7GGlWlAJi+RxfU77GQTQi2DSLUma42EYA==} + balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} @@ -220,6 +990,28 @@ packages: resolution: {integrity: sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==} engines: {node: 18 || 20 || >=22} + base64-js@1.5.1: + resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} + + bash-tool@1.3.17: + resolution: {integrity: sha512-Pgmiu85adxMsNX5q/6dK4kPfPvOkuZX0nH1OOoVv7xqK1NegFQZzlWEqOZlCZuYxC+DFqiJ0V26bOGbdtoZTpA==} + engines: {node: '>=18'} + peerDependencies: + '@vercel/sandbox': '*' + ai: ^6.0.0 + just-bash: ^2.9.3 || ^3.0.0 + peerDependenciesMeta: + '@vercel/sandbox': + optional: true + just-bash: + optional: true + + bl@4.1.0: + resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==} + + blake3-wasm@2.1.5: + resolution: {integrity: sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==} + brace-expansion@1.1.21: resolution: {integrity: sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==} @@ -227,14 +1019,40 @@ packages: resolution: {integrity: sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==} engines: {node: 20 || >=22} + braces@3.0.3: + resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} + engines: {node: '>=8'} + + buffer@5.7.1: + resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} + + cac@6.7.14: + resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} + engines: {node: '>=8'} + + call-bind-apply-helpers@1.0.2: + resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==} + engines: {node: '>= 0.4'} + callsites@3.1.0: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} engines: {node: '>=6'} + chai@5.3.3: + resolution: {integrity: sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==} + engines: {node: '>=18'} + chalk@4.1.2: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} engines: {node: '>=10'} + check-error@2.1.3: + resolution: {integrity: sha512-PAJdDJusoxnwm1VwW07VWwUN1sl7smmC3OKggvndJFadxxDRyFJBX/ggnu/KE4kQAB7a3Dp8f/YXC1FlUprWmA==} + engines: {node: '>= 16'} + + chownr@1.1.4: + resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==} + color-convert@2.0.1: resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} engines: {node: '>=7.0.0'} @@ -242,9 +1060,24 @@ packages: color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + combined-stream@1.0.8: + resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} + engines: {node: '>= 0.8'} + + commander@6.2.1: + resolution: {integrity: sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==} + engines: {node: '>= 6'} + concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + cookie@1.1.1: + resolution: {integrity: sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==} + engines: {node: '>=18'} + + cross-fetch@4.1.0: + resolution: {integrity: sha512-uKm5PU+MHTootlWEY+mZ4vvXoCn4fLQxT9dSc1sXVMSFkINTJVN8cAQROpwcKm8bJ/c7rgZVIBWzH5T78sNZZw==} + cross-spawn@7.0.6: resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} @@ -258,9 +1091,71 @@ packages: supports-color: optional: true + decompress-response@6.0.0: + resolution: {integrity: sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==} + engines: {node: '>=10'} + + deep-eql@5.0.2: + resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} + engines: {node: '>=6'} + + deep-extend@0.6.0: + resolution: {integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==} + engines: {node: '>=4.0.0'} + deep-is@0.1.4: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} + delayed-stream@1.0.0: + resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} + engines: {node: '>=0.4.0'} + + detect-libc@2.1.2: + resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} + engines: {node: '>=8'} + + diff@8.0.4: + resolution: {integrity: sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw==} + engines: {node: '>=0.3.1'} + + dotenv@16.4.7: + resolution: {integrity: sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==} + engines: {node: '>=12'} + + dunder-proto@1.0.1: + resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} + engines: {node: '>= 0.4'} + + end-of-stream@1.4.5: + resolution: {integrity: sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==} + + error-stack-parser-es@1.0.5: + resolution: {integrity: sha512-5qucVt2XcuGMcEGgWI7i+yZpmpByQ8J1lHhcL7PwqCwu9FPP3VUXzT4ltHe5i2z9dePwEHcDVOAfSnHsOlCXRA==} + + es-define-property@1.0.1: + resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==} + engines: {node: '>= 0.4'} + + es-errors@1.3.0: + resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} + engines: {node: '>= 0.4'} + + es-module-lexer@1.7.0: + resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==} + + es-object-atoms@1.1.2: + resolution: {integrity: sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==} + engines: {node: '>= 0.4'} + + es-set-tostringtag@2.1.0: + resolution: {integrity: sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==} + engines: {node: '>= 0.4'} + + esbuild@0.28.2: + resolution: {integrity: sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==} + engines: {node: '>=18'} + hasBin: true + escape-string-regexp@4.0.0: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} @@ -308,19 +1203,57 @@ packages: resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} engines: {node: '>=4.0'} + estree-walker@3.0.3: + resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + esutils@2.0.3: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} engines: {node: '>=0.10.0'} + eventemitter3@4.0.7: + resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==} + + eventemitter3@5.0.4: + resolution: {integrity: sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==} + + eventsource-parser@3.1.1: + resolution: {integrity: sha512-EKN1vKAMcZ8MlYMpaNuxN6R9yakzH6uajHcHVTqWJzvu5pWw9DyhbP35HH8MVBQ+dZjAfDxk+A8NiR9KWaXiyQ==} + engines: {node: '>=18.0.0'} + + exa-js@1.10.3: + resolution: {integrity: sha512-jIcaMTTBrLg1uJ0IPmZvhZjhgTqJjD6ea4+iO2ugOecAxh4+YAqm9dztBfAt7mQqE0p5edaAqlV7pSQX/qOytw==} + + expand-template@2.0.3: + resolution: {integrity: sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==} + engines: {node: '>=6'} + + expect-type@1.4.0: + resolution: {integrity: sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==} + engines: {node: '>=12.0.0'} + fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + fast-glob@3.3.3: + resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==} + engines: {node: '>=8.6.0'} + fast-json-stable-stringify@2.1.0: resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} fast-levenshtein@2.0.6: resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} + fast-xml-builder@1.3.1: + resolution: {integrity: sha512-pIM/1n3ntFXKYrUZwW7QCK0gAW7XY+wzj1YMIV3tLDvPj/V+zTGJK5e3/4WJfwj0qWw2ElNXiTixda/R+3YSug==} + + fast-xml-parser@5.11.2: + resolution: {integrity: sha512-R9iDuNrQYeQut46cn2r2wHKn4HYzVDvDm5J1wW+koZewykv0yuO2HChTYeZtrULyHIDM9cj9TUXloCsueCQUog==} + hasBin: true + + fastq@1.20.3: + resolution: {integrity: sha512-XKv5nnLs6nLF71NgiKJLIZFLkPyIEuOselLG7ujZnGrRfQK8HpvY+WqKhAJUAdLomwVHErVS4LfxFlPq0/FTAw==} + fdir@6.5.0: resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} engines: {node: '>=12.0.0'} @@ -334,6 +1267,14 @@ packages: resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==} engines: {node: '>=16.0.0'} + file-type@21.3.4: + resolution: {integrity: sha512-Ievi/yy8DS3ygGvT47PjSfdFoX+2isQueoYP1cntFW1JLYAuS4GD7NUPGg4zv2iZfV52uDyk5w5Z0TdpRS6Q1g==} + engines: {node: '>=20'} + + fill-range@7.1.1: + resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} + engines: {node: '>=8'} + find-up@5.0.0: resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} engines: {node: '>=10'} @@ -345,6 +1286,45 @@ packages: flatted@3.4.4: resolution: {integrity: sha512-5+ybhBZANEJxaH3X5evAFatUxLfEHSr7n6kYJ+1Qd0mUqr4eu9gIf6GDbWHf8RJijHrjjO8G+la14SlL2SeS1Q==} + follow-redirects@1.16.2: + resolution: {integrity: sha512-/kVP2U8z596Ia0gwFrwyIeo74ta5aVmSeU1FfAUMAmcEP5EP7zydmag3SLiN64NaRKef3lxsq7i/g7ltJQDGow==} + engines: {node: '>=4.0'} + peerDependencies: + debug: '*' + peerDependenciesMeta: + debug: + optional: true + + form-data@4.0.6: + resolution: {integrity: sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ==} + engines: {node: '>= 6'} + + fs-constants@1.0.0: + resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==} + + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + function-bind@1.1.2: + resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + + get-intrinsic@1.3.0: + resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==} + engines: {node: '>= 0.4'} + + get-proto@1.0.1: + resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==} + engines: {node: '>= 0.4'} + + github-from-package@0.0.0: + resolution: {integrity: sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==} + + glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} + glob-parent@6.0.2: resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} engines: {node: '>=10.13.0'} @@ -353,10 +1333,37 @@ packages: resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} engines: {node: '>=18'} + gopd@1.2.0: + resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} + engines: {node: '>= 0.4'} + has-flag@4.0.0: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} + has-symbols@1.1.0: + resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==} + engines: {node: '>= 0.4'} + + has-tostringtag@1.0.2: + resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} + engines: {node: '>= 0.4'} + + hasown@2.0.4: + resolution: {integrity: sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==} + engines: {node: '>= 0.4'} + + hono@4.13.14: + resolution: {integrity: sha512-yhRLQ21U6qa9Hsu2N7Qcbh8tE+WKEcoErjIo56LeSGiGXGp9sA7UpE86Ui9uexb61KakiGwuHMn2QdV7w6i6kQ==} + engines: {node: '>=16.9.0'} + + https-proxy-agent@5.0.1: + resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==} + engines: {node: '>= 6'} + + ieee754@1.2.1: + resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + ignore@5.3.2: resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} engines: {node: '>= 4'} @@ -373,6 +1380,19 @@ packages: resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} engines: {node: '>=0.8.19'} + inherits@2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + + ini@1.3.8: + resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==} + + ini@6.0.0: + resolution: {integrity: sha512-IBTdIkzZNOpqm7q3dRqJvMaldXjDHWkEDfrwGEQTs5eaQMWV+djAhR+wahyNNMAa+qpbDUhBMVt4ZKNwpPm7xQ==} + engines: {node: ^20.17.0 || >=22.9.0} + + is-electron@2.2.2: + resolution: {integrity: sha512-FO/Rhvz5tuw4MCWkpMzHFKWD2LsfHzIb7i6MdPYZ/KW7AlxawyLkqdy+jPZP1WubqEADE3O4FUENlJHDfQASRg==} + is-extglob@2.1.1: resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} engines: {node: '>=0.10.0'} @@ -381,9 +1401,23 @@ packages: resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} engines: {node: '>=0.10.0'} + is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + + is-stream@2.0.1: + resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} + engines: {node: '>=8'} + + is-unsafe@2.0.2: + resolution: {integrity: sha512-HgbIHPBH0KHHCcjLfGsCvhtPTVxjaAZlXjwdz7/GQC40SjSe4sfQsar8J5VFo8JOSbarkpV0OLG95bbaNd9aAQ==} + isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + js-tokens@9.0.1: + resolution: {integrity: sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==} + js-yaml@4.3.2: resolution: {integrity: sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==} hasBin: true @@ -394,12 +1428,23 @@ packages: json-schema-traverse@0.4.1: resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} + json-schema@0.4.0: + resolution: {integrity: sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==} + json-stable-stringify-without-jsonify@1.0.1: resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} + just-bash@3.0.1: + resolution: {integrity: sha512-YVyzCN08fKarUnwqy7rKOAcX+2MLYLnYInuowmUXn3mqhrtd4ieZNBuzdQG+qYV9DqnIWuv9Whiph0WRIWsBtw==} + hasBin: true + keyv@4.5.4: resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} + kleur@4.1.5: + resolution: {integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==} + engines: {node: '>=6'} + levn@0.4.1: resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} engines: {node: '>= 0.8.0'} @@ -411,6 +1456,40 @@ packages: lodash.merge@4.6.2: resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} + loupe@3.2.1: + resolution: {integrity: sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==} + + magic-string@0.30.21: + resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==} + + math-intrinsics@1.1.0: + resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} + engines: {node: '>= 0.4'} + + merge2@1.4.1: + resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} + engines: {node: '>= 8'} + + micromatch@4.0.8: + resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} + engines: {node: '>=8.6'} + + mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + + mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} + + mimic-response@3.1.0: + resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==} + engines: {node: '>=10'} + + miniflare@5.20261023.1-beta: + resolution: {integrity: sha512-hgm1AJhwC6W+iaRhvMnfs7bPOsxjKa8LXTFR2WVPA5qA9KhpyBd2LddmT+9M9tm65VZ8YWkwQGvB+cKbqJoKeA==} + engines: {node: '>=22.0.0'} + minimatch@10.2.6: resolution: {integrity: sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==} engines: {node: 18 || 20 || >=22} @@ -418,16 +1497,79 @@ packages: minimatch@3.1.5: resolution: {integrity: sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==} + minimist@1.2.8: + resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + + mkdirp-classic@0.5.3: + resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==} + + modern-tar@0.7.7: + resolution: {integrity: sha512-t9VmxaqrmANnEOBhpSDI6HD192Ge48k8vmWqQQL7hSFEqHEYwZbbsu49+aKLWZeRvFs3j1pMhXOqqF4kPlvjkQ==} + engines: {node: '>=18.0.0'} + ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + nanoid@3.3.20: + resolution: {integrity: sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + + napi-build-utils@2.0.0: + resolution: {integrity: sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==} + natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} + node-abi@3.101.0: + resolution: {integrity: sha512-bkb/RkuWCE64eWu1PCh3Fu2pGc9mKRs+kOE+FU2bGHRYlQa86/D321DSATV54AsCQMKz3/xSt9sRgraZTpqdhQ==} + engines: {node: '>=10'} + + node-addon-api@8.9.2: + resolution: {integrity: sha512-VijLXbi3UACN69I0JVXJsX4tjACjNoQDgv2gTF6sx2wWEi8tkSg2eX8p5gSIFi8z2+DL3oHmY6OyKce38SDolg==} + engines: {node: ^18 || ^20 || >= 21} + + node-fetch@2.7.0: + resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + + node-gyp-build@4.8.4: + resolution: {integrity: sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==} + hasBin: true + + node-liblzma@2.2.0: + resolution: {integrity: sha512-s0KzNOWwOJJgPG6wxg6cKohnAl9Wk/oW1KrQaVzJBjQwVcUGPQCzpR46Ximygjqj/3KhOrtJXnYMp/xYAXp75g==} + engines: {node: '>=16.0.0'} + hasBin: true + + once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + + openai@5.23.2: + resolution: {integrity: sha512-MQBzmTulj+MM5O8SKEk/gL8a7s5mktS9zUtAkU257WjvobGc9nKcBuVwjyEEcb9SI8a8Y2G/mzn3vm9n1Jlleg==} + hasBin: true + peerDependencies: + ws: ^8.18.0 + zod: ^3.23.8 + peerDependenciesMeta: + ws: + optional: true + zod: + optional: true + optionator@0.9.4: resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} engines: {node: '>= 0.8.0'} + p-finally@1.0.0: + resolution: {integrity: sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==} + engines: {node: '>=4'} + p-limit@3.1.0: resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} engines: {node: '>=10'} @@ -436,6 +1578,21 @@ packages: resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} engines: {node: '>=10'} + p-queue@6.6.2: + resolution: {integrity: sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ==} + engines: {node: '>=8'} + + p-retry@4.6.2: + resolution: {integrity: sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==} + engines: {node: '>=8'} + + p-timeout@3.2.0: + resolution: {integrity: sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==} + engines: {node: '>=8'} + + papaparse@5.7.0: + resolution: {integrity: sha512-qBGxg/7Q3Kl9Wfhrz2Z74UnvnHTXLNG6jmKJFeBvP2+y4lV7So+7SR62+Zd47JvdrCkX+nDcnr0ObPzek/+6RA==} + parent-module@1.0.1: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} @@ -444,31 +1601,122 @@ packages: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} + path-expression-matcher@1.6.2: + resolution: {integrity: sha512-enSlaiat05iasnzmgNxRj8reFdj3puY2QpNgP1aPIaVfT6nn9ICuPoFlKHk8EN22HcwewshO+mN2DGbkCEOtqQ==} + engines: {node: '>=14.0.0'} + path-key@3.1.1: resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} engines: {node: '>=8'} + path-to-regexp@6.3.0: + resolution: {integrity: sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==} + + pathe@2.0.3: + resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} + + pathval@2.0.1: + resolution: {integrity: sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==} + engines: {node: '>= 14.16'} + + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + + picomatch@2.3.2: + resolution: {integrity: sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==} + engines: {node: '>=8.6'} + picomatch@4.0.7: resolution: {integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==} engines: {node: '>=12'} + postcss@8.5.32: + resolution: {integrity: sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==} + engines: {node: ^10 || ^12 || >=14} + + prebuild-install@7.1.3: + resolution: {integrity: sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==} + engines: {node: '>=10'} + deprecated: No longer maintained. Please contact the author of the relevant native addon; alternatives are available. + hasBin: true + prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} + proxy-from-env@2.1.0: + resolution: {integrity: sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA==} + engines: {node: '>=10'} + + pump@3.0.4: + resolution: {integrity: sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==} + punycode@2.3.1: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} + queue-microtask@1.2.3: + resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + + quickjs-emscripten-core@0.32.0: + resolution: {integrity: sha512-QFnPfjFey8EqknSrSxe1hZrf1/8z7/6s1QzGOmKo6++02r7QRRX7ZoyNaZh7JuVjWsVW87KnQrbZqnHkOAzUyg==} + + quickjs-emscripten@0.32.0: + resolution: {integrity: sha512-So0Sqw869y/S2oE3Nuc0uT3Dhqgvsj8FSrwBdsuTosVsG8ME5/OcudU1GxsrIFdFABgy17GHnTVO9TYV/bLQcA==} + engines: {node: '>=16.0.0'} + + rc@1.2.8: + resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==} + hasBin: true + + re2js@1.3.3: + resolution: {integrity: sha512-s/I5zEAo79SUK0Qw4dpZKpiMwbQ6Gz0KU2NRr7eaO4x/p2g7Vvmn3hdeXDg8VsaUjfj/ora+e9oi27LX/C9+mw==} + + readable-stream@3.6.2: + resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} + engines: {node: '>= 6'} + resolve-from@4.0.0: resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} engines: {node: '>=4'} + retry@0.13.1: + resolution: {integrity: sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==} + engines: {node: '>= 4'} + + reusify@1.1.0: + resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} + engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + + rollup@4.66.0: + resolution: {integrity: sha512-Onq6/qO4ARhxIs+jYiHE0pYehadLyMECAiGEqQ+0/aWND3+2PmifJIIqBLYtuBODqHTlOUEQFtIVPyCy0Lck7A==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} + hasBin: true + + run-parallel@1.2.0: + resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} + + safe-buffer@5.2.1: + resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} + + seek-bzip@2.0.0: + resolution: {integrity: sha512-SMguiTnYrhpLdk3PwfzHeotrcwi8bNV4iemL9tx9poR/yeaMYwB9VzR1w7b57DuWpuqR8n6oZboi0hj3AxZxQg==} + hasBin: true + semver@7.8.5: resolution: {integrity: sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==} engines: {node: '>=10'} hasBin: true + sharp@0.35.5: + resolution: {integrity: sha512-Ywn4OnzGukp7CDMrp08RQ50YKmuwG47brZgIVPTvBaaAfQlRlygrRqSrxdCiL9M+LlzLBiJ68IR1QqvzHyjC7g==} + engines: {node: '>=20.9.0'} + peerDependencies: + '@types/node': '*' + peerDependenciesMeta: + '@types/node': + optional: true + shebang-command@2.0.0: resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} engines: {node: '>=8'} @@ -477,28 +1725,124 @@ packages: resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} engines: {node: '>=8'} + siginfo@2.0.0: + resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} + + simple-concat@1.0.1: + resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==} + + simple-get@4.0.1: + resolution: {integrity: sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==} + + smol-toml@1.9.1: + resolution: {integrity: sha512-j7WyPdf0CJoutMzMoPLF/bVXHtKZIT9Rb4eGeEbWw8X2t5oirjPgpL+OpaENZrILYaXqYwnVH+qgUwVbl+pUJQ==} + engines: {node: '>= 18'} + + source-map-js@1.2.2: + resolution: {integrity: sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==} + engines: {node: '>=0.10.0'} + + sprintf-js@1.1.3: + resolution: {integrity: sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==} + + sql.js@1.15.2: + resolution: {integrity: sha512-ZmMYFsZPZWDKIJUh3A5rdnpRV3hB/r7AijwAzSzLnfv/9CSx4obUmDtA8brAjWJWjGtUVh43nIEJ+6nl6HuOUg==} + + stackback@0.0.2: + resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} + + std-env@3.10.0: + resolution: {integrity: sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==} + + string_decoder@1.3.0: + resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} + + strip-json-comments@2.0.1: + resolution: {integrity: sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==} + engines: {node: '>=0.10.0'} + strip-json-comments@3.1.1: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} + strip-literal@3.1.0: + resolution: {integrity: sha512-8r3mkIM/2+PpjHoOtiAW8Rg3jJLHaV7xPwG+YRGrv6FP0wwk/toTpATxWYOW0BKdWwl82VT2tFYi5DlROa0Mxg==} + + strnum@2.5.1: + resolution: {integrity: sha512-UM4nTLWzQiDBseVxUGxN0wJzIk0UU89Qi7pKXz9qISo+lhviJikTuikBsK/oFRlpvYHvSdz0TVoLyQ+sEpYwxA==} + + strtok3@10.6.3: + resolution: {integrity: sha512-MD8mENgyXMr2mDaDfzP3RWYDSyYQxIIou7HhCiCJiBekrsoDtUG0id3vYnjDfY9ndOEbazFXe13Qw6u/1AB8ew==} + engines: {node: '>=18'} + + supports-color@10.2.2: + resolution: {integrity: sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==} + engines: {node: '>=18'} + supports-color@7.2.0: resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} engines: {node: '>=8'} + tar-fs@2.1.5: + resolution: {integrity: sha512-OboTd8mmMhZDNPV+UjQcK9yKAatXu2aJ+r1w4im1Otd4M4fl2hwvdoXUxIYHFTHWK/3y3FarBP70v3vwmGlOxw==} + + tar-stream@2.2.0: + resolution: {integrity: sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==} + engines: {node: '>=6'} + + tinybench@2.9.0: + resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} + + tinyexec@0.3.2: + resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==} + tinyglobby@0.2.17: resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==} engines: {node: '>=12.0.0'} + tinypool@1.1.1: + resolution: {integrity: sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==} + engines: {node: ^18.0.0 || >=20.0.0} + + tinyrainbow@2.0.0: + resolution: {integrity: sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==} + engines: {node: '>=14.0.0'} + + tinyspy@4.0.6: + resolution: {integrity: sha512-u8KszXvGfU68hVcZpRHKG28T0krMuv2G5nDhiHaMLen/gIuFEgIJhaJuO69qjnXg5paSrbPMFfx3brNuN8eVSg==} + engines: {node: '>=14.0.0'} + + to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + + token-types@6.1.2: + resolution: {integrity: sha512-dRXchy+C0IgK8WPC6xvCHFRIWYUbqqdEIKPaKo/AcTUNzwLTK6AH7RjdLWsEZcAN/TBdtfUw3PYEgPr5VPr6ww==} + engines: {node: '>=14.16'} + + tr46@0.0.3: + resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + ts-api-utils@2.5.0: resolution: {integrity: sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==} engines: {node: '>=18.12'} peerDependencies: typescript: '>=4.8.4' + tslib@2.8.1: + resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + + tunnel-agent@0.6.0: + resolution: {integrity: sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==} + turbo@2.11.10: resolution: {integrity: sha512-3GJYwig8ygEI89oaOZdduJX8/aw6O9eRPYHoIt6T3FZl9hkKjiyIspufJoVgqXihPoJu8M5CSV0DlZvzfohBCw==} hasBin: true + turndown@7.2.4: + resolution: {integrity: sha512-I8yFsfRzmzK0WV1pNNOA4A7y4RDfFxPRxb3t+e3ui14qSGOxGtiSP6GjeX+Y6CHb7HYaFj7ECUD7VE5kQMZWGQ==} + engines: {node: '>=18', npm: '>=9'} + type-check@0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} @@ -508,44 +1852,375 @@ packages: engines: {node: '>=14.17'} hasBin: true - uri-js@4.4.1: - resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} - - which@2.0.2: - resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} - engines: {node: '>= 8'} - hasBin: true - - word-wrap@1.2.5: - resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} - engines: {node: '>=0.10.0'} + uint8array-extras@1.6.0: + resolution: {integrity: sha512-8iAasVS4wUx0gPLjH8Xtz2PeDzTSiy8QiLGu2DT3X5GU+egFEQhpnbtkehbAwjvDcxIERmCYcysiODFmE3Ud0Q==} + engines: {node: '>=18'} - yocto-queue@0.1.0: - resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} - engines: {node: '>=10'} + undici-types@6.21.0: + resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==} -snapshots: + undici@7.30.1: + resolution: {integrity: sha512-03KrMbjIFDWQR5RNPrSw3bd1r12JpyFQl9/yxjUbJtqkjmllqC5lFjZh6ujeuJCKr8EOQvRW872Oy/az+nLYxg==} + engines: {node: '>=20.18.1'} - '@eslint-community/eslint-utils@4.10.1(eslint@9.39.5)': - dependencies: - eslint: 9.39.5 - eslint-visitor-keys: 3.4.3 + unenv@2.0.0-rc.24: + resolution: {integrity: sha512-i7qRCmY42zmCwnYlh9H2SvLEypEFGye5iRmEMKjcGi7zk9UquigRjFtTLz0TYqr0ZGLZhaMHl/foy1bZR+Cwlw==} - '@eslint-community/regexpp@4.12.2': {} + uri-js@4.4.1: + resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} - '@eslint/config-array@0.21.2': - dependencies: - '@eslint/object-schema': 2.1.7 - debug: 4.4.3 - minimatch: 3.1.5 - transitivePeerDependencies: - - supports-color + util-deprecate@1.0.2: + resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} - '@eslint/config-helpers@0.4.2': - dependencies: - '@eslint/core': 0.17.0 + vite-node@3.2.4: + resolution: {integrity: sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} + hasBin: true - '@eslint/core@0.17.0': + vite@7.3.7: + resolution: {integrity: sha512-AHEzTORMbi7/7aXp7w7KZ5+DCUdSeLsJz0grY8xHpc9DHdYb0vQu6DqJfm2tOw3gDExNgPgnJTXxM6syYFHaCA==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + '@types/node': ^20.19.0 || >=22.12.0 + jiti: '>=1.21.0' + less: ^4.0.0 + lightningcss: ^1.21.0 + sass: ^1.70.0 + sass-embedded: ^1.70.0 + stylus: '>=0.54.8' + sugarss: ^5.0.0 + terser: ^5.16.0 + tsx: ^4.8.1 + yaml: ^2.4.2 + peerDependenciesMeta: + '@types/node': + optional: true + jiti: + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + sass-embedded: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + tsx: + optional: true + yaml: + optional: true + + vitest@3.2.7: + resolution: {integrity: sha512-KrxIJ62Fd89gfysR4WotlgZABiz2dqFPgqGzX7s+CwsqLFomRH7777ZcrOD6+WVAh7khPQP41A+BKbpcJFrdEg==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} + hasBin: true + peerDependencies: + '@edge-runtime/vm': '*' + '@types/debug': ^4.1.12 + '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0 + '@vitest/browser': 3.2.7 + '@vitest/ui': 3.2.7 + happy-dom: '*' + jsdom: '*' + peerDependenciesMeta: + '@edge-runtime/vm': + optional: true + '@types/debug': + optional: true + '@types/node': + optional: true + '@vitest/browser': + optional: true + '@vitest/ui': + optional: true + happy-dom: + optional: true + jsdom: + optional: true + + webidl-conversions@3.0.1: + resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + + whatwg-url@5.0.0: + resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + + which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + + why-is-node-running@2.3.0: + resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==} + engines: {node: '>=8'} + hasBin: true + + word-wrap@1.2.5: + resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} + engines: {node: '>=0.10.0'} + + workerd@1.20261023.1: + resolution: {integrity: sha512-NeofJFyaYNpqKpFRJW3ApuonaerPd6/JWlfTtLDYf2A6ygqrDEFnYgEXmc0hhOxqnJsSM+kXJN6VebPojzRrsg==} + engines: {node: '>=16'} + hasBin: true + + workers-ai-provider@4.0.1: + resolution: {integrity: sha512-PDznmd1A6g058FGWDjQ6Io1LlV51gGQ7pze7y/rnsdxLnNgjqQf8zRHoKjJv3RPoU5cU4QT4TX7lZ2kxX2x73g==} + deprecated: |- + Deprecated. Use createAI from agents/models/ai-sdk, or + ai-search-provider for AI Search: https://developers.cloudflare.com/agents/models/ai-sdk/ + peerDependencies: + '@ai-sdk/anthropic': ^4.0.0 + '@ai-sdk/google': ^4.0.0 + '@ai-sdk/openai': ^4.0.0 + '@ai-sdk/provider': ^4.0.0 + ai: ^7.0.0 + peerDependenciesMeta: + '@ai-sdk/anthropic': + optional: true + '@ai-sdk/google': + optional: true + '@ai-sdk/openai': + optional: true + + wrangler@4.154.0: + resolution: {integrity: sha512-duA4dckBE/51ibAlGh2mUYcvGiu7sZFcn61I+KfNEeK5KQzKKEth9Xf5ROatoPBOebYPz0gfknXOCjBhwLOo8Q==} + engines: {node: '>=22.0.0'} + hasBin: true + peerDependencies: + '@cloudflare/workers-types': ^5.20261023.1 + peerDependenciesMeta: + '@cloudflare/workers-types': + optional: true + + wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + + ws@8.21.0: + resolution: {integrity: sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + + xml-naming@0.3.0: + resolution: {integrity: sha512-ghig2TBE/H11aOVgmahA3MhimvkBr6JIYknH/Dhdk10nXwdbIqBJsbfMxpvFPG8bAw77gN29aQWvKpmVoPlvPQ==} + engines: {node: '>=16.0.0'} + + yaml@1.10.3: + resolution: {integrity: sha512-vIYeF1u3CjlhAFekPPAk2h/Kv4T3mAkMox5OymRiJQB0spDP10LHvt+K7G9Ny6NuuMAb25/6n1qyUjAcGNf/AA==} + engines: {node: '>= 6'} + + yaml@2.9.1: + resolution: {integrity: sha512-3NxN8+78OdzbT7C/WjGsyfPAtJaN3FNDsWxv7Y7mcDsT/oOmgW8BpyQQFFBnvZE3j9Y2Sdz1ULFLezL7Eb2yFw==} + engines: {node: '>= 14.6'} + hasBin: true + + yocto-queue@0.1.0: + resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} + engines: {node: '>=10'} + + youch-core@0.3.3: + resolution: {integrity: sha512-ho7XuGjLaJ2hWHoK8yFnsUGy2Y5uDpqSTq1FkHLK4/oqKtyUU1AFbOOxY4IpC9f0fTLjwYbslUz0Po5BpD1wrA==} + + youch@4.1.0-beta.10: + resolution: {integrity: sha512-rLfVLB4FgQneDr0dv1oddCVZmKjcJ6yX6mS4pU82Mq/Dt9a3cLZQ62pDBL4AUO+uVrCvtWz3ZFUL2HFAFJ/BXQ==} + + zod-to-json-schema@3.25.2: + resolution: {integrity: sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA==} + peerDependencies: + zod: ^3.25.28 || ^4 + + zod@3.25.76: + resolution: {integrity: sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==} + + zod@4.4.3: + resolution: {integrity: sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==} + +snapshots: + + '@ai-sdk/gateway@4.0.128(zod@4.4.3)': + dependencies: + '@ai-sdk/provider': 4.0.34 + '@ai-sdk/provider-utils': 5.0.70(zod@4.4.3) + '@vercel/oidc': 3.2.0 + zod: 4.4.3 + + '@ai-sdk/openai@4.0.104(zod@4.4.3)': + dependencies: + '@ai-sdk/provider': 4.0.34 + '@ai-sdk/provider-utils': 5.0.70(zod@4.4.3) + zod: 4.4.3 + + '@ai-sdk/policy-opa@1.0.155(@open-policy-agent/opa-wasm@1.10.0)(@open-policy-agent/opa@2.0.0(zod@4.4.3))(ai@7.0.155(zod@4.4.3))(zod@4.4.3)': + dependencies: + '@ai-sdk/provider': 4.0.34 + '@ai-sdk/provider-utils': 5.0.70(zod@4.4.3) + ai: 7.0.155(zod@4.4.3) + optionalDependencies: + '@open-policy-agent/opa': 2.0.0(zod@4.4.3) + '@open-policy-agent/opa-wasm': 1.10.0 + transitivePeerDependencies: + - zod + + '@ai-sdk/provider-utils@5.0.70(zod@4.4.3)': + dependencies: + '@ai-sdk/provider': 4.0.34 + '@standard-schema/spec': 1.1.0 + '@workflow/serde': 4.1.0 + eventsource-parser: 3.1.1 + undici: 7.30.1 + zod: 4.4.3 + + '@ai-sdk/provider@4.0.34': + dependencies: + json-schema: 0.4.0 + + '@borewit/text-codec@0.2.2': {} + + '@cloudflare/kv-asset-handler@0.5.0': {} + + '@cloudflare/unenv-preset@2.16.2(unenv@2.0.0-rc.24)(workerd@1.20261023.1)': + dependencies: + unenv: 2.0.0-rc.24 + optionalDependencies: + workerd: 1.20261023.1 + + '@cloudflare/workerd-darwin-64@1.20261023.1': + optional: true + + '@cloudflare/workerd-darwin-arm64@1.20261023.1': + optional: true + + '@cloudflare/workerd-linux-64@1.20261023.1': + optional: true + + '@cloudflare/workerd-linux-arm64@1.20261023.1': + optional: true + + '@cloudflare/workerd-windows-64@1.20261023.1': + optional: true + + '@cloudflare/workers-types@5.20261028.1': {} + + '@cspotcode/source-map-support@0.8.1': + dependencies: + '@jridgewell/trace-mapping': 0.3.9 + + '@emnapi/runtime@1.11.3': + dependencies: + tslib: 2.8.1 + optional: true + + '@esbuild/aix-ppc64@0.28.2': + optional: true + + '@esbuild/android-arm64@0.28.2': + optional: true + + '@esbuild/android-arm@0.28.2': + optional: true + + '@esbuild/android-x64@0.28.2': + optional: true + + '@esbuild/darwin-arm64@0.28.2': + optional: true + + '@esbuild/darwin-x64@0.28.2': + optional: true + + '@esbuild/freebsd-arm64@0.28.2': + optional: true + + '@esbuild/freebsd-x64@0.28.2': + optional: true + + '@esbuild/linux-arm64@0.28.2': + optional: true + + '@esbuild/linux-arm@0.28.2': + optional: true + + '@esbuild/linux-ia32@0.28.2': + optional: true + + '@esbuild/linux-loong64@0.28.2': + optional: true + + '@esbuild/linux-mips64el@0.28.2': + optional: true + + '@esbuild/linux-ppc64@0.28.2': + optional: true + + '@esbuild/linux-riscv64@0.28.2': + optional: true + + '@esbuild/linux-s390x@0.28.2': + optional: true + + '@esbuild/linux-x64@0.28.2': + optional: true + + '@esbuild/netbsd-arm64@0.28.2': + optional: true + + '@esbuild/netbsd-x64@0.28.2': + optional: true + + '@esbuild/openbsd-arm64@0.28.2': + optional: true + + '@esbuild/openbsd-x64@0.28.2': + optional: true + + '@esbuild/openharmony-arm64@0.28.2': + optional: true + + '@esbuild/sunos-x64@0.28.2': + optional: true + + '@esbuild/win32-arm64@0.28.2': + optional: true + + '@esbuild/win32-ia32@0.28.2': + optional: true + + '@esbuild/win32-x64@0.28.2': + optional: true + + '@eslint-community/eslint-utils@4.10.1(eslint@9.39.5)': + dependencies: + eslint: 9.39.5 + eslint-visitor-keys: 3.4.3 + + '@eslint-community/regexpp@4.12.2': {} + + '@eslint/config-array@0.21.2': + dependencies: + '@eslint/object-schema': 2.1.7 + debug: 4.4.3 + minimatch: 3.1.5 + transitivePeerDependencies: + - supports-color + + '@eslint/config-helpers@0.4.2': + dependencies: + '@eslint/core': 0.17.0 + + '@eslint/core@0.17.0': dependencies: '@types/json-schema': 7.0.15 @@ -588,6 +2263,305 @@ snapshots: '@humanwhocodes/retry@0.4.3': {} + '@img/colour@1.1.0': {} + + '@img/sharp-darwin-arm64@0.35.5': + optionalDependencies: + '@img/sharp-libvips-darwin-arm64': 1.3.4 + optional: true + + '@img/sharp-darwin-x64@0.35.5': + optionalDependencies: + '@img/sharp-libvips-darwin-x64': 1.3.4 + optional: true + + '@img/sharp-freebsd-wasm32@0.35.5': + dependencies: + '@img/sharp-wasm32': 0.35.5 + optional: true + + '@img/sharp-libvips-darwin-arm64@1.3.4': + optional: true + + '@img/sharp-libvips-darwin-x64@1.3.4': + optional: true + + '@img/sharp-libvips-linux-arm64@1.3.4': + optional: true + + '@img/sharp-libvips-linux-arm@1.3.4': + optional: true + + '@img/sharp-libvips-linux-ppc64@1.3.4': + optional: true + + '@img/sharp-libvips-linux-riscv64@1.3.4': + optional: true + + '@img/sharp-libvips-linux-s390x@1.3.4': + optional: true + + '@img/sharp-libvips-linux-x64@1.3.4': + optional: true + + '@img/sharp-libvips-linuxmusl-arm64@1.3.4': + optional: true + + '@img/sharp-libvips-linuxmusl-x64@1.3.4': + optional: true + + '@img/sharp-linux-arm64@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linux-arm64': 1.3.4 + optional: true + + '@img/sharp-linux-arm@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linux-arm': 1.3.4 + optional: true + + '@img/sharp-linux-ppc64@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linux-ppc64': 1.3.4 + optional: true + + '@img/sharp-linux-riscv64@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linux-riscv64': 1.3.4 + optional: true + + '@img/sharp-linux-s390x@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linux-s390x': 1.3.4 + optional: true + + '@img/sharp-linux-x64@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linux-x64': 1.3.4 + optional: true + + '@img/sharp-linuxmusl-arm64@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linuxmusl-arm64': 1.3.4 + optional: true + + '@img/sharp-linuxmusl-x64@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linuxmusl-x64': 1.3.4 + optional: true + + '@img/sharp-wasm32@0.35.5': + dependencies: + '@emnapi/runtime': 1.11.3 + optional: true + + '@img/sharp-webcontainers-wasm32@0.35.5': + dependencies: + '@img/sharp-wasm32': 0.35.5 + optional: true + + '@img/sharp-win32-arm64@0.35.5': + optional: true + + '@img/sharp-win32-ia32@0.35.5': + optional: true + + '@img/sharp-win32-x64@0.35.5': + optional: true + + '@jitl/quickjs-ffi-types@0.32.0': {} + + '@jitl/quickjs-wasmfile-debug-asyncify@0.32.0': + dependencies: + '@jitl/quickjs-ffi-types': 0.32.0 + + '@jitl/quickjs-wasmfile-debug-sync@0.32.0': + dependencies: + '@jitl/quickjs-ffi-types': 0.32.0 + + '@jitl/quickjs-wasmfile-release-asyncify@0.32.0': + dependencies: + '@jitl/quickjs-ffi-types': 0.32.0 + + '@jitl/quickjs-wasmfile-release-sync@0.32.0': + dependencies: + '@jitl/quickjs-ffi-types': 0.32.0 + + '@jridgewell/resolve-uri@3.1.2': {} + + '@jridgewell/sourcemap-codec@1.6.0': {} + + '@jridgewell/trace-mapping@0.3.9': + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.6.0 + + '@mixmark-io/domino@2.2.0': {} + + '@mongodb-js/zstd@7.0.0': + dependencies: + node-addon-api: 8.9.2 + prebuild-install: 7.1.3 + optional: true + + '@napi-rs/lzma-linux-x64-gnu@1.5.1': + optional: true + + '@nodable/entities@3.1.0': {} + + '@nodelib/fs.scandir@2.1.5': + dependencies: + '@nodelib/fs.stat': 2.0.5 + run-parallel: 1.2.0 + + '@nodelib/fs.stat@2.0.5': {} + + '@nodelib/fs.walk@1.2.8': + dependencies: + '@nodelib/fs.scandir': 2.1.5 + fastq: 1.20.3 + + '@open-policy-agent/opa-wasm@1.10.0': + dependencies: + sprintf-js: 1.1.3 + yaml: 1.10.3 + + '@open-policy-agent/opa@2.0.0(zod@4.4.3)': + dependencies: + '@open-policy-agent/ucast-prisma': 0.1.6 + zod: 4.4.3 + + '@open-policy-agent/ucast-prisma@0.1.6': + dependencies: + '@ucast/core': 1.10.2 + lodash.merge: 4.6.2 + + '@poppinss/colors@4.1.6': + dependencies: + kleur: 4.1.5 + + '@poppinss/dumper@0.6.5': + dependencies: + '@poppinss/colors': 4.1.6 + '@sindresorhus/is': 7.2.0 + supports-color: 10.2.2 + + '@poppinss/exception@1.2.3': {} + + '@rollup/rollup-android-arm-eabi@4.66.0': + optional: true + + '@rollup/rollup-android-arm64@4.66.0': + optional: true + + '@rollup/rollup-darwin-arm64@4.66.0': + optional: true + + '@rollup/rollup-darwin-x64@4.66.0': + optional: true + + '@rollup/rollup-freebsd-arm64@4.66.0': + optional: true + + '@rollup/rollup-freebsd-x64@4.66.0': + optional: true + + '@rollup/rollup-linux-arm-gnueabihf@4.66.0': + optional: true + + '@rollup/rollup-linux-arm-musleabihf@4.66.0': + optional: true + + '@rollup/rollup-linux-arm64-gnu@4.66.0': + optional: true + + '@rollup/rollup-linux-arm64-musl@4.66.0': + optional: true + + '@rollup/rollup-linux-loong64-gnu@4.66.0': + optional: true + + '@rollup/rollup-linux-loong64-musl@4.66.0': + optional: true + + '@rollup/rollup-linux-ppc64-gnu@4.66.0': + optional: true + + '@rollup/rollup-linux-ppc64-musl@4.66.0': + optional: true + + '@rollup/rollup-linux-riscv64-gnu@4.66.0': + optional: true + + '@rollup/rollup-linux-riscv64-musl@4.66.0': + optional: true + + '@rollup/rollup-linux-s390x-gnu@4.66.0': + optional: true + + '@rollup/rollup-linux-x64-gnu@4.66.0': + optional: true + + '@rollup/rollup-linux-x64-musl@4.66.0': + optional: true + + '@rollup/rollup-openbsd-x64@4.66.0': + optional: true + + '@rollup/rollup-openharmony-arm64@4.66.0': + optional: true + + '@rollup/rollup-win32-arm64-msvc@4.66.0': + optional: true + + '@rollup/rollup-win32-ia32-msvc@4.66.0': + optional: true + + '@rollup/rollup-win32-x64-gnu@4.66.0': + optional: true + + '@rollup/rollup-win32-x64-msvc@4.66.0': + optional: true + + '@sindresorhus/is@7.2.0': {} + + '@slack/logger@4.0.1': + dependencies: + '@types/node': 22.20.5 + + '@slack/types@2.22.0': {} + + '@slack/web-api@7.16.0': + dependencies: + '@slack/logger': 4.0.1 + '@slack/types': 2.22.0 + '@types/node': 22.20.5 + '@types/retry': 0.12.0 + axios: 1.21.0 + eventemitter3: 5.0.4 + form-data: 4.0.6 + is-electron: 2.2.2 + is-stream: 2.0.1 + p-queue: 6.6.2 + p-retry: 4.6.2 + retry: 0.13.1 + transitivePeerDependencies: + - debug + - supports-color + + '@speed-highlight/core@1.2.24': {} + + '@standard-schema/spec@1.1.0': {} + + '@tokenizer/inflate@0.4.1': + dependencies: + debug: 4.4.3 + token-types: 6.1.2 + transitivePeerDependencies: + - supports-color + + '@tokenizer/token@0.3.0': {} + '@turbo/darwin-64@2.11.10': optional: true @@ -606,10 +2580,23 @@ snapshots: '@turbo/windows-arm64@2.11.10': optional: true + '@types/chai@5.2.3': + dependencies: + '@types/deep-eql': 4.0.2 + assertion-error: 2.0.1 + + '@types/deep-eql@4.0.2': {} + '@types/estree@1.0.9': {} '@types/json-schema@7.0.15': {} + '@types/node@22.20.5': + dependencies: + undici-types: 6.21.0 + + '@types/retry@0.12.0': {} + '@typescript-eslint/eslint-plugin@8.72.1(@typescript-eslint/parser@8.72.1(eslint@9.39.5)(typescript@5.9.3))(eslint@9.39.5)(typescript@5.9.3)': dependencies: '@eslint-community/regexpp': 4.12.2 @@ -701,12 +2688,73 @@ snapshots: '@typescript-eslint/types': 8.72.1 eslint-visitor-keys: 5.0.1 + '@ucast/core@1.10.2': {} + + '@vercel/oidc@3.2.0': {} + + '@vitest/expect@3.2.7': + dependencies: + '@types/chai': 5.2.3 + '@vitest/spy': 3.2.7 + '@vitest/utils': 3.2.7 + chai: 5.3.3 + tinyrainbow: 2.0.0 + + '@vitest/mocker@3.2.7(vite@7.3.7(@types/node@22.20.5)(yaml@2.9.1))': + dependencies: + '@vitest/spy': 3.2.7 + estree-walker: 3.0.3 + magic-string: 0.30.21 + optionalDependencies: + vite: 7.3.7(@types/node@22.20.5)(yaml@2.9.1) + + '@vitest/pretty-format@3.2.7': + dependencies: + tinyrainbow: 2.0.0 + + '@vitest/runner@3.2.7': + dependencies: + '@vitest/utils': 3.2.7 + pathe: 2.0.3 + strip-literal: 3.1.0 + + '@vitest/snapshot@3.2.7': + dependencies: + '@vitest/pretty-format': 3.2.7 + magic-string: 0.30.21 + pathe: 2.0.3 + + '@vitest/spy@3.2.7': + dependencies: + tinyspy: 4.0.6 + + '@vitest/utils@3.2.7': + dependencies: + '@vitest/pretty-format': 3.2.7 + loupe: 3.2.1 + tinyrainbow: 2.0.0 + + '@workflow/serde@4.1.0': {} + acorn-jsx@5.3.2(acorn@8.19.0): dependencies: acorn: 8.19.0 acorn@8.19.0: {} + agent-base@6.0.2: + dependencies: + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + + ai@7.0.155(zod@4.4.3): + dependencies: + '@ai-sdk/gateway': 4.0.128(zod@4.4.3) + '@ai-sdk/provider': 4.0.34 + '@ai-sdk/provider-utils': 5.0.70(zod@4.4.3) + zod: 4.4.3 + ajv@6.15.0: dependencies: fast-deep-equal: 3.1.3 @@ -718,12 +2766,49 @@ snapshots: dependencies: color-convert: 2.0.1 + anynum@1.0.1: {} + argparse@2.0.1: {} + assertion-error@2.0.1: {} + + asynckit@0.4.0: {} + + axios@1.21.0: + dependencies: + follow-redirects: 1.16.2 + form-data: 4.0.6 + https-proxy-agent: 5.0.1 + proxy-from-env: 2.1.0 + transitivePeerDependencies: + - debug + - supports-color + balanced-match@1.0.2: {} balanced-match@4.0.4: {} + base64-js@1.5.1: + optional: true + + bash-tool@1.3.17(ai@7.0.155(zod@4.4.3))(just-bash@3.0.1): + dependencies: + ai: 7.0.155(zod@4.4.3) + fast-glob: 3.3.3 + yaml: 2.9.1 + zod: 3.25.76 + optionalDependencies: + just-bash: 3.0.1 + + bl@4.1.0: + dependencies: + buffer: 5.7.1 + inherits: 2.0.4 + readable-stream: 3.6.2 + optional: true + + blake3-wasm@2.1.5: {} + brace-expansion@1.1.21: dependencies: balanced-match: 1.0.2 @@ -733,21 +2818,65 @@ snapshots: dependencies: balanced-match: 4.0.4 + braces@3.0.3: + dependencies: + fill-range: 7.1.1 + + buffer@5.7.1: + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + optional: true + + cac@6.7.14: {} + + call-bind-apply-helpers@1.0.2: + dependencies: + es-errors: 1.3.0 + function-bind: 1.1.2 + callsites@3.1.0: {} + chai@5.3.3: + dependencies: + assertion-error: 2.0.1 + check-error: 2.1.3 + deep-eql: 5.0.2 + loupe: 3.2.1 + pathval: 2.0.1 + chalk@4.1.2: dependencies: ansi-styles: 4.3.0 supports-color: 7.2.0 + check-error@2.1.3: {} + + chownr@1.1.4: + optional: true + color-convert@2.0.1: dependencies: color-name: 1.1.4 color-name@1.1.4: {} + combined-stream@1.0.8: + dependencies: + delayed-stream: 1.0.0 + + commander@6.2.1: {} + concat-map@0.0.1: {} + cookie@1.1.1: {} + + cross-fetch@4.1.0: + dependencies: + node-fetch: 2.7.0 + transitivePeerDependencies: + - encoding + cross-spawn@7.0.6: dependencies: path-key: 3.1.1 @@ -758,8 +2887,85 @@ snapshots: dependencies: ms: 2.1.3 + decompress-response@6.0.0: + dependencies: + mimic-response: 3.1.0 + optional: true + + deep-eql@5.0.2: {} + + deep-extend@0.6.0: + optional: true + deep-is@0.1.4: {} + delayed-stream@1.0.0: {} + + detect-libc@2.1.2: {} + + diff@8.0.4: {} + + dotenv@16.4.7: {} + + dunder-proto@1.0.1: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-errors: 1.3.0 + gopd: 1.2.0 + + end-of-stream@1.4.5: + dependencies: + once: 1.4.0 + optional: true + + error-stack-parser-es@1.0.5: {} + + es-define-property@1.0.1: {} + + es-errors@1.3.0: {} + + es-module-lexer@1.7.0: {} + + es-object-atoms@1.1.2: + dependencies: + es-errors: 1.3.0 + + es-set-tostringtag@2.1.0: + dependencies: + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + has-tostringtag: 1.0.2 + hasown: 2.0.4 + + esbuild@0.28.2: + optionalDependencies: + '@esbuild/aix-ppc64': 0.28.2 + '@esbuild/android-arm': 0.28.2 + '@esbuild/android-arm64': 0.28.2 + '@esbuild/android-x64': 0.28.2 + '@esbuild/darwin-arm64': 0.28.2 + '@esbuild/darwin-x64': 0.28.2 + '@esbuild/freebsd-arm64': 0.28.2 + '@esbuild/freebsd-x64': 0.28.2 + '@esbuild/linux-arm': 0.28.2 + '@esbuild/linux-arm64': 0.28.2 + '@esbuild/linux-ia32': 0.28.2 + '@esbuild/linux-loong64': 0.28.2 + '@esbuild/linux-mips64el': 0.28.2 + '@esbuild/linux-ppc64': 0.28.2 + '@esbuild/linux-riscv64': 0.28.2 + '@esbuild/linux-s390x': 0.28.2 + '@esbuild/linux-x64': 0.28.2 + '@esbuild/netbsd-arm64': 0.28.2 + '@esbuild/netbsd-x64': 0.28.2 + '@esbuild/openbsd-arm64': 0.28.2 + '@esbuild/openbsd-x64': 0.28.2 + '@esbuild/openharmony-arm64': 0.28.2 + '@esbuild/sunos-x64': 0.28.2 + '@esbuild/win32-arm64': 0.28.2 + '@esbuild/win32-ia32': 0.28.2 + '@esbuild/win32-x64': 0.28.2 + escape-string-regexp@4.0.0: {} eslint-scope@8.4.0: @@ -826,16 +3032,68 @@ snapshots: dependencies: estraverse: 5.3.0 - estraverse@5.3.0: {} + estraverse@5.3.0: {} + + estree-walker@3.0.3: + dependencies: + '@types/estree': 1.0.9 + + esutils@2.0.3: {} + + eventemitter3@4.0.7: {} + + eventemitter3@5.0.4: {} + + eventsource-parser@3.1.1: {} + + exa-js@1.10.3(ws@8.21.0): + dependencies: + cross-fetch: 4.1.0 + dotenv: 16.4.7 + openai: 5.23.2(ws@8.21.0)(zod@3.25.76) + zod: 3.25.76 + zod-to-json-schema: 3.25.2(zod@3.25.76) + transitivePeerDependencies: + - encoding + - ws + + expand-template@2.0.3: + optional: true - esutils@2.0.3: {} + expect-type@1.4.0: {} fast-deep-equal@3.1.3: {} + fast-glob@3.3.3: + dependencies: + '@nodelib/fs.stat': 2.0.5 + '@nodelib/fs.walk': 1.2.8 + glob-parent: 5.1.2 + merge2: 1.4.1 + micromatch: 4.0.8 + fast-json-stable-stringify@2.1.0: {} fast-levenshtein@2.0.6: {} + fast-xml-builder@1.3.1: + dependencies: + path-expression-matcher: 1.6.2 + xml-naming: 0.3.0 + + fast-xml-parser@5.11.2: + dependencies: + '@nodable/entities': 3.1.0 + fast-xml-builder: 1.3.1 + is-unsafe: 2.0.2 + path-expression-matcher: 1.6.2 + strnum: 2.5.1 + xml-naming: 0.3.0 + + fastq@1.20.3: + dependencies: + reusify: 1.1.0 + fdir@6.5.0(picomatch@4.0.7): optionalDependencies: picomatch: 4.0.7 @@ -844,6 +3102,19 @@ snapshots: dependencies: flat-cache: 4.0.1 + file-type@21.3.4: + dependencies: + '@tokenizer/inflate': 0.4.1 + strtok3: 10.6.3 + token-types: 6.1.2 + uint8array-extras: 1.6.0 + transitivePeerDependencies: + - supports-color + + fill-range@7.1.1: + dependencies: + to-regex-range: 5.0.1 + find-up@5.0.0: dependencies: locate-path: 6.0.0 @@ -856,14 +3127,80 @@ snapshots: flatted@3.4.4: {} + follow-redirects@1.16.2: {} + + form-data@4.0.6: + dependencies: + asynckit: 0.4.0 + combined-stream: 1.0.8 + es-set-tostringtag: 2.1.0 + hasown: 2.0.4 + mime-types: 2.1.35 + + fs-constants@1.0.0: + optional: true + + fsevents@2.3.3: + optional: true + + function-bind@1.1.2: {} + + get-intrinsic@1.3.0: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-define-property: 1.0.1 + es-errors: 1.3.0 + es-object-atoms: 1.1.2 + function-bind: 1.1.2 + get-proto: 1.0.1 + gopd: 1.2.0 + has-symbols: 1.1.0 + hasown: 2.0.4 + math-intrinsics: 1.1.0 + + get-proto@1.0.1: + dependencies: + dunder-proto: 1.0.1 + es-object-atoms: 1.1.2 + + github-from-package@0.0.0: + optional: true + + glob-parent@5.1.2: + dependencies: + is-glob: 4.0.3 + glob-parent@6.0.2: dependencies: is-glob: 4.0.3 globals@14.0.0: {} + gopd@1.2.0: {} + has-flag@4.0.0: {} + has-symbols@1.1.0: {} + + has-tostringtag@1.0.2: + dependencies: + has-symbols: 1.1.0 + + hasown@2.0.4: + dependencies: + function-bind: 1.1.2 + + hono@4.13.14: {} + + https-proxy-agent@5.0.1: + dependencies: + agent-base: 6.0.2 + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + + ieee754@1.2.1: {} + ignore@5.3.2: {} ignore@7.0.14: {} @@ -875,14 +3212,32 @@ snapshots: imurmurhash@0.1.4: {} + inherits@2.0.4: + optional: true + + ini@1.3.8: + optional: true + + ini@6.0.0: {} + + is-electron@2.2.2: {} + is-extglob@2.1.1: {} is-glob@4.0.3: dependencies: is-extglob: 2.1.1 + is-number@7.0.0: {} + + is-stream@2.0.1: {} + + is-unsafe@2.0.2: {} + isexe@2.0.0: {} + js-tokens@9.0.1: {} + js-yaml@4.3.2: dependencies: argparse: 2.0.1 @@ -891,12 +3246,39 @@ snapshots: json-schema-traverse@0.4.1: {} + json-schema@0.4.0: {} + json-stable-stringify-without-jsonify@1.0.1: {} + just-bash@3.0.1: + dependencies: + diff: 8.0.4 + fast-xml-parser: 5.11.2 + file-type: 21.3.4 + ini: 6.0.0 + minimatch: 10.2.6 + modern-tar: 0.7.7 + papaparse: 5.7.0 + quickjs-emscripten: 0.32.0 + re2js: 1.3.3 + seek-bzip: 2.0.0 + smol-toml: 1.9.1 + sprintf-js: 1.1.3 + sql.js: 1.15.2 + turndown: 7.2.4 + yaml: 2.9.1 + optionalDependencies: + '@mongodb-js/zstd': 7.0.0 + node-liblzma: 2.2.0 + transitivePeerDependencies: + - supports-color + keyv@4.5.4: dependencies: json-buffer: 3.0.1 + kleur@4.1.5: {} + levn@0.4.1: dependencies: prelude-ls: 1.2.1 @@ -908,6 +3290,43 @@ snapshots: lodash.merge@4.6.2: {} + loupe@3.2.1: {} + + magic-string@0.30.21: + dependencies: + '@jridgewell/sourcemap-codec': 1.6.0 + + math-intrinsics@1.1.0: {} + + merge2@1.4.1: {} + + micromatch@4.0.8: + dependencies: + braces: 3.0.3 + picomatch: 2.3.2 + + mime-db@1.52.0: {} + + mime-types@2.1.35: + dependencies: + mime-db: 1.52.0 + + mimic-response@3.1.0: + optional: true + + miniflare@5.20261023.1-beta: + dependencies: + '@cspotcode/source-map-support': 0.8.1 + sharp: 0.35.5 + undici: 7.30.1 + workerd: 1.20261023.1 + ws: 8.21.0 + youch: 4.1.0-beta.10 + transitivePeerDependencies: + - '@types/node' + - bufferutil + - utf-8-validate + minimatch@10.2.6: dependencies: brace-expansion: 5.0.12 @@ -916,10 +3335,54 @@ snapshots: dependencies: brace-expansion: 1.1.21 + minimist@1.2.8: + optional: true + + mkdirp-classic@0.5.3: + optional: true + + modern-tar@0.7.7: {} + ms@2.1.3: {} + nanoid@3.3.20: {} + + napi-build-utils@2.0.0: + optional: true + natural-compare@1.4.0: {} + node-abi@3.101.0: + dependencies: + semver: 7.8.5 + optional: true + + node-addon-api@8.9.2: + optional: true + + node-fetch@2.7.0: + dependencies: + whatwg-url: 5.0.0 + + node-gyp-build@4.8.4: + optional: true + + node-liblzma@2.2.0: + dependencies: + node-addon-api: 8.9.2 + node-gyp-build: 4.8.4 + optional: true + + once@1.4.0: + dependencies: + wrappy: 1.0.2 + optional: true + + openai@5.23.2(ws@8.21.0)(zod@3.25.76): + optionalDependencies: + ws: 8.21.0 + zod: 3.25.76 + optionator@0.9.4: dependencies: deep-is: 0.1.4 @@ -929,6 +3392,8 @@ snapshots: type-check: 0.4.0 word-wrap: 1.2.5 + p-finally@1.0.0: {} + p-limit@3.1.0: dependencies: yocto-queue: 0.1.0 @@ -937,45 +3402,306 @@ snapshots: dependencies: p-limit: 3.1.0 + p-queue@6.6.2: + dependencies: + eventemitter3: 4.0.7 + p-timeout: 3.2.0 + + p-retry@4.6.2: + dependencies: + '@types/retry': 0.12.0 + retry: 0.13.1 + + p-timeout@3.2.0: + dependencies: + p-finally: 1.0.0 + + papaparse@5.7.0: {} + parent-module@1.0.1: dependencies: callsites: 3.1.0 path-exists@4.0.0: {} + path-expression-matcher@1.6.2: {} + path-key@3.1.1: {} + path-to-regexp@6.3.0: {} + + pathe@2.0.3: {} + + pathval@2.0.1: {} + + picocolors@1.1.1: {} + + picomatch@2.3.2: {} + picomatch@4.0.7: {} + postcss@8.5.32: + dependencies: + nanoid: 3.3.20 + picocolors: 1.1.1 + source-map-js: 1.2.2 + + prebuild-install@7.1.3: + dependencies: + detect-libc: 2.1.2 + expand-template: 2.0.3 + github-from-package: 0.0.0 + minimist: 1.2.8 + mkdirp-classic: 0.5.3 + napi-build-utils: 2.0.0 + node-abi: 3.101.0 + pump: 3.0.4 + rc: 1.2.8 + simple-get: 4.0.1 + tar-fs: 2.1.5 + tunnel-agent: 0.6.0 + optional: true + prelude-ls@1.2.1: {} + proxy-from-env@2.1.0: {} + + pump@3.0.4: + dependencies: + end-of-stream: 1.4.5 + once: 1.4.0 + optional: true + punycode@2.3.1: {} + queue-microtask@1.2.3: {} + + quickjs-emscripten-core@0.32.0: + dependencies: + '@jitl/quickjs-ffi-types': 0.32.0 + + quickjs-emscripten@0.32.0: + dependencies: + '@jitl/quickjs-wasmfile-debug-asyncify': 0.32.0 + '@jitl/quickjs-wasmfile-debug-sync': 0.32.0 + '@jitl/quickjs-wasmfile-release-asyncify': 0.32.0 + '@jitl/quickjs-wasmfile-release-sync': 0.32.0 + quickjs-emscripten-core: 0.32.0 + + rc@1.2.8: + dependencies: + deep-extend: 0.6.0 + ini: 1.3.8 + minimist: 1.2.8 + strip-json-comments: 2.0.1 + optional: true + + re2js@1.3.3: {} + + readable-stream@3.6.2: + dependencies: + inherits: 2.0.4 + string_decoder: 1.3.0 + util-deprecate: 1.0.2 + optional: true + resolve-from@4.0.0: {} + retry@0.13.1: {} + + reusify@1.1.0: {} + + rollup@4.66.0: + dependencies: + '@types/estree': 1.0.9 + optionalDependencies: + '@napi-rs/lzma-linux-x64-gnu': 1.5.1 + '@rollup/rollup-android-arm-eabi': 4.66.0 + '@rollup/rollup-android-arm64': 4.66.0 + '@rollup/rollup-darwin-arm64': 4.66.0 + '@rollup/rollup-darwin-x64': 4.66.0 + '@rollup/rollup-freebsd-arm64': 4.66.0 + '@rollup/rollup-freebsd-x64': 4.66.0 + '@rollup/rollup-linux-arm-gnueabihf': 4.66.0 + '@rollup/rollup-linux-arm-musleabihf': 4.66.0 + '@rollup/rollup-linux-arm64-gnu': 4.66.0 + '@rollup/rollup-linux-arm64-musl': 4.66.0 + '@rollup/rollup-linux-loong64-gnu': 4.66.0 + '@rollup/rollup-linux-loong64-musl': 4.66.0 + '@rollup/rollup-linux-ppc64-gnu': 4.66.0 + '@rollup/rollup-linux-ppc64-musl': 4.66.0 + '@rollup/rollup-linux-riscv64-gnu': 4.66.0 + '@rollup/rollup-linux-riscv64-musl': 4.66.0 + '@rollup/rollup-linux-s390x-gnu': 4.66.0 + '@rollup/rollup-linux-x64-gnu': 4.66.0 + '@rollup/rollup-linux-x64-musl': 4.66.0 + '@rollup/rollup-openbsd-x64': 4.66.0 + '@rollup/rollup-openharmony-arm64': 4.66.0 + '@rollup/rollup-win32-arm64-msvc': 4.66.0 + '@rollup/rollup-win32-ia32-msvc': 4.66.0 + '@rollup/rollup-win32-x64-gnu': 4.66.0 + '@rollup/rollup-win32-x64-msvc': 4.66.0 + fsevents: 2.3.3 + + run-parallel@1.2.0: + dependencies: + queue-microtask: 1.2.3 + + safe-buffer@5.2.1: + optional: true + + seek-bzip@2.0.0: + dependencies: + commander: 6.2.1 + semver@7.8.5: {} + sharp@0.35.5: + dependencies: + '@img/colour': 1.1.0 + detect-libc: 2.1.2 + semver: 7.8.5 + optionalDependencies: + '@img/sharp-darwin-arm64': 0.35.5 + '@img/sharp-darwin-x64': 0.35.5 + '@img/sharp-freebsd-wasm32': 0.35.5 + '@img/sharp-libvips-darwin-arm64': 1.3.4 + '@img/sharp-libvips-darwin-x64': 1.3.4 + '@img/sharp-libvips-linux-arm': 1.3.4 + '@img/sharp-libvips-linux-arm64': 1.3.4 + '@img/sharp-libvips-linux-ppc64': 1.3.4 + '@img/sharp-libvips-linux-riscv64': 1.3.4 + '@img/sharp-libvips-linux-s390x': 1.3.4 + '@img/sharp-libvips-linux-x64': 1.3.4 + '@img/sharp-libvips-linuxmusl-arm64': 1.3.4 + '@img/sharp-libvips-linuxmusl-x64': 1.3.4 + '@img/sharp-linux-arm': 0.35.5 + '@img/sharp-linux-arm64': 0.35.5 + '@img/sharp-linux-ppc64': 0.35.5 + '@img/sharp-linux-riscv64': 0.35.5 + '@img/sharp-linux-s390x': 0.35.5 + '@img/sharp-linux-x64': 0.35.5 + '@img/sharp-linuxmusl-arm64': 0.35.5 + '@img/sharp-linuxmusl-x64': 0.35.5 + '@img/sharp-webcontainers-wasm32': 0.35.5 + '@img/sharp-win32-arm64': 0.35.5 + '@img/sharp-win32-ia32': 0.35.5 + '@img/sharp-win32-x64': 0.35.5 + shebang-command@2.0.0: dependencies: shebang-regex: 3.0.0 shebang-regex@3.0.0: {} + siginfo@2.0.0: {} + + simple-concat@1.0.1: + optional: true + + simple-get@4.0.1: + dependencies: + decompress-response: 6.0.0 + once: 1.4.0 + simple-concat: 1.0.1 + optional: true + + smol-toml@1.9.1: {} + + source-map-js@1.2.2: {} + + sprintf-js@1.1.3: {} + + sql.js@1.15.2: {} + + stackback@0.0.2: {} + + std-env@3.10.0: {} + + string_decoder@1.3.0: + dependencies: + safe-buffer: 5.2.1 + optional: true + + strip-json-comments@2.0.1: + optional: true + strip-json-comments@3.1.1: {} + strip-literal@3.1.0: + dependencies: + js-tokens: 9.0.1 + + strnum@2.5.1: + dependencies: + anynum: 1.0.1 + + strtok3@10.6.3: + dependencies: + '@tokenizer/token': 0.3.0 + + supports-color@10.2.2: {} + supports-color@7.2.0: dependencies: has-flag: 4.0.0 + tar-fs@2.1.5: + dependencies: + chownr: 1.1.4 + mkdirp-classic: 0.5.3 + pump: 3.0.4 + tar-stream: 2.2.0 + optional: true + + tar-stream@2.2.0: + dependencies: + bl: 4.1.0 + end-of-stream: 1.4.5 + fs-constants: 1.0.0 + inherits: 2.0.4 + readable-stream: 3.6.2 + optional: true + + tinybench@2.9.0: {} + + tinyexec@0.3.2: {} + tinyglobby@0.2.17: dependencies: fdir: 6.5.0(picomatch@4.0.7) picomatch: 4.0.7 + tinypool@1.1.1: {} + + tinyrainbow@2.0.0: {} + + tinyspy@4.0.6: {} + + to-regex-range@5.0.1: + dependencies: + is-number: 7.0.0 + + token-types@6.1.2: + dependencies: + '@borewit/text-codec': 0.2.2 + '@tokenizer/token': 0.3.0 + ieee754: 1.2.1 + + tr46@0.0.3: {} + ts-api-utils@2.5.0(typescript@5.9.3): dependencies: typescript: 5.9.3 + tslib@2.8.1: + optional: true + + tunnel-agent@0.6.0: + dependencies: + safe-buffer: 5.2.1 + optional: true + turbo@2.11.10: optionalDependencies: '@turbo/darwin-64': 2.11.10 @@ -985,20 +3711,189 @@ snapshots: '@turbo/windows-64': 2.11.10 '@turbo/windows-arm64': 2.11.10 + turndown@7.2.4: + dependencies: + '@mixmark-io/domino': 2.2.0 + type-check@0.4.0: dependencies: prelude-ls: 1.2.1 typescript@5.9.3: {} + uint8array-extras@1.6.0: {} + + undici-types@6.21.0: {} + + undici@7.30.1: {} + + unenv@2.0.0-rc.24: + dependencies: + pathe: 2.0.3 + uri-js@4.4.1: dependencies: punycode: 2.3.1 + util-deprecate@1.0.2: + optional: true + + vite-node@3.2.4(@types/node@22.20.5)(yaml@2.9.1): + dependencies: + cac: 6.7.14 + debug: 4.4.3 + es-module-lexer: 1.7.0 + pathe: 2.0.3 + vite: 7.3.7(@types/node@22.20.5)(yaml@2.9.1) + transitivePeerDependencies: + - '@types/node' + - jiti + - less + - lightningcss + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + - tsx + - yaml + + vite@7.3.7(@types/node@22.20.5)(yaml@2.9.1): + dependencies: + esbuild: 0.28.2 + fdir: 6.5.0(picomatch@4.0.7) + picomatch: 4.0.7 + postcss: 8.5.32 + rollup: 4.66.0 + tinyglobby: 0.2.17 + optionalDependencies: + '@types/node': 22.20.5 + fsevents: 2.3.3 + yaml: 2.9.1 + + vitest@3.2.7(@types/node@22.20.5)(yaml@2.9.1): + dependencies: + '@types/chai': 5.2.3 + '@vitest/expect': 3.2.7 + '@vitest/mocker': 3.2.7(vite@7.3.7(@types/node@22.20.5)(yaml@2.9.1)) + '@vitest/pretty-format': 3.2.7 + '@vitest/runner': 3.2.7 + '@vitest/snapshot': 3.2.7 + '@vitest/spy': 3.2.7 + '@vitest/utils': 3.2.7 + chai: 5.3.3 + debug: 4.4.3 + expect-type: 1.4.0 + magic-string: 0.30.21 + pathe: 2.0.3 + picomatch: 4.0.7 + std-env: 3.10.0 + tinybench: 2.9.0 + tinyexec: 0.3.2 + tinyglobby: 0.2.17 + tinypool: 1.1.1 + tinyrainbow: 2.0.0 + vite: 7.3.7(@types/node@22.20.5)(yaml@2.9.1) + vite-node: 3.2.4(@types/node@22.20.5)(yaml@2.9.1) + why-is-node-running: 2.3.0 + optionalDependencies: + '@types/node': 22.20.5 + transitivePeerDependencies: + - jiti + - less + - lightningcss + - msw + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + - tsx + - yaml + + webidl-conversions@3.0.1: {} + + whatwg-url@5.0.0: + dependencies: + tr46: 0.0.3 + webidl-conversions: 3.0.1 + which@2.0.2: dependencies: isexe: 2.0.0 + why-is-node-running@2.3.0: + dependencies: + siginfo: 2.0.0 + stackback: 0.0.2 + word-wrap@1.2.5: {} + workerd@1.20261023.1: + optionalDependencies: + '@cloudflare/workerd-darwin-64': 1.20261023.1 + '@cloudflare/workerd-darwin-arm64': 1.20261023.1 + '@cloudflare/workerd-linux-64': 1.20261023.1 + '@cloudflare/workerd-linux-arm64': 1.20261023.1 + '@cloudflare/workerd-windows-64': 1.20261023.1 + + workers-ai-provider@4.0.1(@ai-sdk/openai@4.0.104(zod@4.4.3))(@ai-sdk/provider@4.0.34)(ai@7.0.155(zod@4.4.3)): + dependencies: + '@ai-sdk/provider': 4.0.34 + ai: 7.0.155(zod@4.4.3) + optionalDependencies: + '@ai-sdk/openai': 4.0.104(zod@4.4.3) + + wrangler@4.154.0(@cloudflare/workers-types@5.20261028.1): + dependencies: + '@cloudflare/kv-asset-handler': 0.5.0 + '@cloudflare/unenv-preset': 2.16.2(unenv@2.0.0-rc.24)(workerd@1.20261023.1) + blake3-wasm: 2.1.5 + esbuild: 0.28.2 + miniflare: 5.20261023.1-beta + path-to-regexp: 6.3.0 + unenv: 2.0.0-rc.24 + workerd: 1.20261023.1 + optionalDependencies: + '@cloudflare/workers-types': 5.20261028.1 + fsevents: 2.3.3 + transitivePeerDependencies: + - '@types/node' + - bufferutil + - utf-8-validate + + wrappy@1.0.2: + optional: true + + ws@8.21.0: {} + + xml-naming@0.3.0: {} + + yaml@1.10.3: {} + + yaml@2.9.1: {} + yocto-queue@0.1.0: {} + + youch-core@0.3.3: + dependencies: + '@poppinss/exception': 1.2.3 + error-stack-parser-es: 1.0.5 + + youch@4.1.0-beta.10: + dependencies: + '@poppinss/colors': 4.1.6 + '@poppinss/dumper': 0.6.5 + '@speed-highlight/core': 1.2.24 + cookie: 1.1.1 + youch-core: 0.3.3 + + zod-to-json-schema@3.25.2(zod@3.25.76): + dependencies: + zod: 3.25.76 + + zod@3.25.76: {} + + zod@4.4.3: {} diff --git a/specs/epics/README.md b/specs/epics/README.md index 3d43cc9..b869d61 100644 --- a/specs/epics/README.md +++ b/specs/epics/README.md @@ -7,6 +7,6 @@ folder is the adoption; the merge creates the epic in the workspace. | Epic | Cluster | Status | What it is | |------|---------|--------|------------| -| [`ai-slackbot/`](./ai-slackbot/) | **SB** | In progress (SB0) | Vercel's AI SDK Slackbot — an AI chatbot for Slack whose every tool call an Open Policy Agent policy gates — as one Cloudflare Worker answering Slack's Events API with Workers AI, and an Orun baseline that instantiates it in one landing (SB2) | +| [`ai-slackbot/`](./ai-slackbot/) | **SB** | In progress (SB1: the site on Workers) | Vercel's AI SDK Slackbot — an AI chatbot for Slack whose every tool call an Open Policy Agent policy gates — as one Cloudflare Worker answering Slack's Events API with Workers AI, and an Orun baseline that instantiates it in one landing (SB2) | As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`. diff --git a/specs/epics/ai-slackbot/IMPLEMENTATION-STATUS.md b/specs/epics/ai-slackbot/IMPLEMENTATION-STATUS.md index ce4cdd6..a05f3e5 100644 --- a/specs/epics/ai-slackbot/IMPLEMENTATION-STATUS.md +++ b/specs/epics/ai-slackbot/IMPLEMENTATION-STATUS.md @@ -3,9 +3,43 @@ | Milestone | State | Landed | |---|---|---| | SB0 — the spec | ✅ | SB-1 | -| SB1 — the Slack bot on Workers | planned | SB-2 | +| SB1 — the Slack bot on Workers | ✅ | SB-2 | | SB2 — a baseline | planned | SB-3 | ## Departures from the upstream template -Recorded as they land, from SB1 on. +Everything not listed here is the template as it is upstream at `7d84809`. + +| # | What | Why | +|---|---|---| +| 1 | The app lives in `apps/api` of a pnpm workspace (`@app/api`); `api/events.ts` is a Hono route at the same path (`src/index.ts`), `lib/` is `src/lib/`, `policies/` is `apps/api/policies/` | The workspace's shape (hono-api's); a plain Worker | +| 2 | Every request is verified first, the URL verification included; a failure is a `400` before any work (upstream answered the challenge first and dropped the check's result) | A forged event must not be handled | +| 3 | The signature is checked with WebCrypto (`crypto.subtle` HMAC-SHA256, a constant-time compare); the timestamp must be digits | `node:crypto` is not the Worker's API for this; a malformed header is refused, not parsed | +| 4 | The event is acknowledged at once; `auth.test`, the handlers and the reply run in `c.executionCtx.waitUntil` (upstream awaited `auth.test` first, then `@vercel/functions`' `waitUntil`) | Slack's 3 s go to the acknowledgement | +| 5 | A retry (`X-Slack-Retry-Num`) is acknowledged with `X-Slack-No-Retry: 1` and not handled | Upstream answered every retry again | +| 6 | Before both Slack keys are set, `/api/events` answers `503 slack_not_connected` | A product deploys before its owner has a Slack app | +| 7 | The Slack client, the model and the search are built per request from the Worker's env (`src/lib/bot.ts`), passed to the handlers; upstream read `process.env` at import | A Worker's secrets arrive with the request | +| 8 | The model is Workers AI (`@cf/moonshotai/kimi-k2.6`, `workers-ai-provider` 4.0.1 over the `AI` binding) unless `OPENAI_API_KEY` is set, then OpenAI (`OPENAI_MODEL`, default `gpt-4o`) directly; Ollama (`MODEL_PROVIDER=ollama`) is not carried | No key by default; a Worker cannot reach `localhost` | +| 9 | `ai` 7.0.0-canary.164 → 7.0.155, `@ai-sdk/policy-opa` 1.0.0-canary.1 → 1.0.155, `@ai-sdk/openai` 4.0.0-canary.67 → 4.0.104 (the stable releases, one provider core); `ai-sdk-ollama`, `@vercel/functions`, `@ai-sdk/provider-utils` dropped; everything else at upstream's locked versions (`@slack/web-api` 7.16.0, `bash-tool` 1.3.17, `just-bash` 3.0.1, `exa-js` 1.10.3, OPA 2.0.0 / opa-wasm 1.10.0, `zod` 4.4.3) | `workers-ai-provider` 4 supports AI SDK 7 stable; `policy-opa` pins `ai` exactly | +| 10 | `policy.wasm` is imported as a `WebAssembly.Module` (`src/lib/policy/load.ts`, `src/wasm.d.ts`), not read from disk; `POLICY_MODE=http` needs `OPA_URL` (upstream defaulted to `localhost:8181`) | A Worker cannot compile bytes at runtime, and has no disk | +| 11 | `just-bash` resolves, in the Worker, to `src/vendor/just-bash.js` — its browser build, with `BashTransformPipeline` and `TeePlugin` as stubs that throw (wrangler `alias`) | The Node build needs `worker_threads` and native addons; bash-tool uses those two only for its opt-in tee transform | +| 12 | `searchWeb` is offered, and named in the system prompt, only when `EXA_API_KEY` is set (`toolNames`, `systemPrompt` in `run-agent.ts`) | A tool that can only fail is not offered | +| 13 | `GET /` is a JSON welcome (upstream's `vercel.json` redirected `/` to its GitHub repository); `GET /health` added: `status`, `name`, `environment`, `slack`, `model`, `tools` — names only | The deploy's smoke and the bootstrap's probes read it | +| 14 | `src/identity.ts`: `API_NAME = "AI SDK Slackbot"`, the one rename seam | One seam; Slack shows the Slack app's own name | +| 15 | `assistantThreadMessage` no longer logs the whole event (`JSON.stringify(event)`) | It carried user ids and channel ids into every log line | +| 16 | `wrangler.jsonc` (`-api`, `nodejs_compat`, the `AI` binding in every environment, the alias) and `component.yaml` (`cloudflare-worker-turbo`, five optional secrets pushed by `runtimeSecrets`, a smoke over `/health` and the events door) | The Worker's config and the deploy contract replace Vercel's | +| 17 | `policy:build` / `policy:test` run from `apps/api`; the policies README says the committed `policy.wasm` is what deploys (upstream claimed `pnpm build` rebuilt it, which its build script did not) | Accuracy; CI has no `opa` | +| 18 | `apps/api/LICENSE.md`: the MIT terms upstream's README declares, and that the repository ships no LICENSE file | The product carries the template's licence | +| 19 | Tests: `tests/api` (vitest, in-process) — the routes and every Slack event against stand-ins for Slack's Web API and the AI binding, the signature check against Node's HMAC, every rule of the shipped `policy.wasm`, the reply format, the model choice, the name seam | The template ships only the policy's Rego tests | + +## Verified + +- `pnpm typecheck`, `lint`, `test` (tests/api 29) and `build` green; the + Worker is 1.03 MiB gzipped (5.3 MiB raw), with `policy.wasm` (143 KiB) its + own module — Workers Free. +- Every Baseline CI tier passes locally on orun v2.89.0, and under + `wrangler dev` the staged Worker answered as born (`503` on the events + door) and connected: the signed challenge, refusals of unsigned, forged, + stale and wrongly-keyed requests with no call made, a retry acknowledged + only, a mention answered through the policy and just-bash (`ls`), a + refusal relayed (`rm`), a DM from its thread, a new thread greeted. diff --git a/specs/epics/ai-slackbot/README.md b/specs/epics/ai-slackbot/README.md index e9e1acf..4572bcf 100644 --- a/specs/epics/ai-slackbot/README.md +++ b/specs/epics/ai-slackbot/README.md @@ -10,7 +10,7 @@ baseline that makes a copy of it somebody else's bot in one landing.** | | | |---|---| -| Status | In progress — SB0 on main | +| Status | In progress — SB1 on main: the site runs on Workers | | Upstream | [vercel-labs/ai-sdk-slackbot](https://github.com/vercel-labs/ai-sdk-slackbot) (MIT, as its README declares; no LICENSE file), at `7d84809` | | Reference | [hono-api](https://github.com/sourceplane/hono-api) and hono-mcp — the same plain Worker, scaffolding, tests and bootstrap | | Key | `SB` | diff --git a/tests/api/component.yaml b/tests/api/component.yaml new file mode 100644 index 0000000..e3b4fc8 --- /dev/null +++ b/tests/api/component.yaml @@ -0,0 +1,31 @@ +apiVersion: sourceplane.io/v1 +kind: Component +metadata: + name: api-tests + description: The API's vitest suite (the welcome route, /health and its environment, a 404, the API's name), driven in-process with app.request() and run with pnpm test +spec: + type: turbo-package + lifecycle: production + owner: platform + # Its pages, attached to it in the workspace's catalog: what the Docs + # library shows for it, and what the catalog's docs and runbook checks read. + # Generated from what this manifest and its sources declare. + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } + domain: tests + subscribe: + environments: + - name: dev + profile: quick-check + parameters: + nodeVersion: "22" + pnpmVersion: "10.12.1" + buildCommand: pnpm exec turbo run build --filter=./ + typecheckCommand: pnpm exec turbo run typecheck --filter=./ + preBuildCommand: pnpm exec turbo run test --filter=./ + labels: + team: platform + layer: test diff --git a/tests/api/docs/architecture.md b/tests/api/docs/architecture.md new file mode 100644 index 0000000..b9e401a --- /dev/null +++ b/tests/api/docs/architecture.md @@ -0,0 +1,11 @@ +# api-tests — architecture + +A test package at `tests/api`. Its lane runs the suite before it builds. + +## Suites (5) + +- `events.test.ts` +- `identity.test.ts` +- `policy.test.ts` +- `reply.test.ts` +- `slack.test.ts` diff --git a/tests/api/docs/overview.md b/tests/api/docs/overview.md new file mode 100644 index 0000000..bf8f705 --- /dev/null +++ b/tests/api/docs/overview.md @@ -0,0 +1,20 @@ +# api-tests + +The API's vitest suite (the welcome route, /health and its environment, a 404, the API's name), driven in-process with app.request() and run with pnpm test + +The test suite for **api**. It deploys nothing: its lane installs, builds and runs the tests. + +| | | +| ------------ | -------------------- | +| Type | `turbo-package` | +| Source | `tests/api` | +| Package | `@app/api-tests` | +| Environments | `dev`: `quick-check` | + +## Depends on + +- (none) + +## Depended on by + +- (none) diff --git a/tests/api/docs/runbook.md b/tests/api/docs/runbook.md new file mode 100644 index 0000000..4b40103 --- /dev/null +++ b/tests/api/docs/runbook.md @@ -0,0 +1,26 @@ +# api-tests — runbook + +## How it runs + +Its lane runs on every pull request that changes it; it has no deployed surface. +CI plans what changed (`orun plan --changed`) and runs each lane with `orun run`; +the plan orders a component after everything it depends on. + +## Local commands + +```bash +pnpm --filter @app/api-tests build +pnpm --filter @app/api-tests test +pnpm --filter @app/api-tests typecheck +pnpm --filter @app/api-tests lint +``` + +## Rollback + +Revert the commit on `main`. The next convergence applies the previous desired +state; nothing was changed out of band, so there is nothing else to undo. + +## Common failures + +- **A dependent fails to build after a change here**: run `pnpm typecheck` + across the workspace before merging. diff --git a/tests/api/eslint.config.js b/tests/api/eslint.config.js new file mode 100644 index 0000000..2e905dc --- /dev/null +++ b/tests/api/eslint.config.js @@ -0,0 +1,2 @@ +import config from "../../tooling/eslint/index.js"; +export default config; diff --git a/tests/api/package.json b/tests/api/package.json new file mode 100644 index 0000000..60fecb9 --- /dev/null +++ b/tests/api/package.json @@ -0,0 +1,20 @@ +{ + "name": "@app/api-tests", + "version": "0.0.0", + "private": true, + "type": "module", + "scripts": { + "build": "tsc --noEmit", + "typecheck": "tsc --noEmit", + "test": "vitest run", + "lint": "eslint src" + }, + "devDependencies": { + "@app/eslint-config": "workspace:*", + "@app/tsconfig": "workspace:*", + "@types/node": "^22.9.0", + "typescript": "^5.8.3", + "vitest": "^3.2.4", + "@cloudflare/workers-types": "^5.20261006.1" + } +} diff --git a/tests/api/src/events.test.ts b/tests/api/src/events.test.ts new file mode 100644 index 0000000..c9f6b37 --- /dev/null +++ b/tests/api/src/events.test.ts @@ -0,0 +1,200 @@ +import { afterEach, describe, expect, it } from "vitest"; +import app from "@/index"; +import { API_NAME } from "@/identity"; +import { aiStandIn, executionCtx, signed, slackStandIn, SECRET, TOKEN } from "./helpers"; + +// The router as the Worker runs it (Hono's app.request with the Worker's env +// and an ExecutionContext whose waitUntil is kept and awaited), against an +// in-process Slack Web API and AI binding. The real AI SDK, workers-ai-provider, +// OPA policy and just-bash run; only the network ends are stood in for. + +let closeSlack: (() => Promise) | undefined; +afterEach(async () => { + await closeSlack?.(); + closeSlack = undefined; +}); + +const mention = (text: string, ts = "1700000000.000001") => + JSON.stringify({ type: "event_callback", event: { type: "app_mention", channel: "C123", user: "U1", text: `<@UBOT> ${text}`, ts } }); + +async function connected(threads: Record = {}) { + const slack = await slackStandIn(threads); + closeSlack = slack.close; + const ai = aiStandIn(); + const env = { AI: ai.AI, ENVIRONMENT: "test", SLACK_SIGNING_SECRET: SECRET, SLACK_BOT_TOKEN: TOKEN, SLACK_API_URL: slack.url }; + return { slack, ai, env }; +} + +describe("GET /health and GET /", () => { + it("names the bot and the environment, and what it is connected to — never a value", async () => { + const { AI } = aiStandIn(); + const res = await app.request("/health", {}, { AI, ENVIRONMENT: "stage" }); + expect(res.status).toBe(200); + expect(await res.json()).toEqual({ + status: "ok", + name: API_NAME, + environment: "stage", + slack: "not connected", + model: { provider: "workers-ai", id: "@cf/moonshotai/kimi-k2.6" }, + tools: ["getWeather", "throwDice", "bash", "readFile", "writeFile"], + }); + }); + + it("reports Slack connected, OpenAI and web search once their keys are stored", async () => { + const { AI } = aiStandIn(); + const env = { AI, SLACK_SIGNING_SECRET: "s", SLACK_BOT_TOKEN: "t", OPENAI_API_KEY: "sk-test", EXA_API_KEY: "exa-test" }; + const body = (await (await app.request("/health", {}, env)).json()) as Record; + expect(body.slack).toBe("connected"); + expect(body.model).toEqual({ provider: "openai", id: "gpt-4o" }); + expect(body.tools).toContain("searchWeb"); + expect(JSON.stringify(body)).not.toMatch(/sk-test|exa-test|"t"|"s"/); + }); + + it("answers / with the bot and where Slack talks to it", async () => { + const { AI } = aiStandIn(); + const res = await app.request("/", {}, { AI }); + expect(await res.json()).toEqual({ + message: `${API_NAME} — an AI chatbot for Slack`, + endpoints: { events: "/api/events", health: "/health" }, + slack: "not connected", + }); + }); +}); + +describe("POST /api/events — before Slack is connected", () => { + it("says so with a 503 and does no work", async () => { + const { AI, asked } = aiStandIn(); + const { ctx, pending } = executionCtx(); + const res = await app.request("/api/events", signed(mention("hi")), { AI }, ctx); + expect(res.status).toBe(503); + expect(await res.json()).toMatchObject({ ok: false, error: "slack_not_connected" }); + expect(pending).toHaveLength(0); + expect(asked).toHaveLength(0); + }); +}); + +describe("POST /api/events — what is refused before any work", () => { + it("refuses unsigned, forged, stale and wrongly-keyed requests with a 400", async () => { + const { slack, ai, env } = await connected(); + const challenge = JSON.stringify({ type: "url_verification", challenge: "abc" }); + const cases = [ + { method: "POST", body: challenge, headers: { "content-type": "application/json" } }, + { ...signed(challenge), headers: { ...signed(challenge).headers, "x-slack-signature": "v0=" + "0".repeat(64) } }, + signed(challenge, { ts: Math.floor(Date.now() / 1000) - 600 }), + signed(challenge, { secret: "another-apps-secret" }), + signed(mention("hi"), { secret: "another-apps-secret" }), + ]; + for (const req of cases) { + const { ctx, pending } = executionCtx(); + const res = await app.request("/api/events", req, env, ctx); + expect(res.status).toBe(400); + expect(await res.text()).toBe("Invalid request"); + expect(pending).toHaveLength(0); + } + expect(slack.calls).toHaveLength(0); + expect(ai.asked).toHaveLength(0); + }); + + it("answers Slack's URL verification with its challenge, once signed", async () => { + const { env } = await connected(); + const res = await app.request("/api/events", signed(JSON.stringify({ type: "url_verification", challenge: "3eZbrw1aBm2rZgRNFdxV2595E9CY3gmdALWMmHkvFXO7tYXAYM8P" })), env); + expect(res.status).toBe(200); + expect(await res.text()).toBe("3eZbrw1aBm2rZgRNFdxV2595E9CY3gmdALWMmHkvFXO7tYXAYM8P"); + }); + + it("refuses a signed body that is not JSON, and a payload type it does not handle", async () => { + const { env } = await connected(); + expect((await app.request("/api/events", signed("not json"), env)).status).toBe(400); + expect((await app.request("/api/events", signed(JSON.stringify({ type: "app_rate_limited" })), env)).status).toBe(400); + }); + + it("acknowledges a retry without answering it twice", async () => { + const { slack, ai, env } = await connected(); + const { ctx, pending } = executionCtx(); + const res = await app.request("/api/events", signed(mention("hi"), { headers: { "x-slack-retry-num": "1", "x-slack-retry-reason": "http_timeout" } }), env, ctx); + expect(res.status).toBe(200); + expect(res.headers.get("x-slack-no-retry")).toBe("1"); + expect(pending).toHaveLength(0); + expect(slack.calls).toHaveLength(0); + expect(ai.asked).toHaveLength(0); + }); +}); + +describe("POST /api/events — answering after the acknowledgement", () => { + it("acknowledges an app mention at once, then answers it in the thread through the policy-gated agent", async () => { + const { slack, ai, env } = await connected(); + const { ctx, pending } = executionCtx(); + const res = await app.request("/api/events", signed(mention("please run `ls`")), env, ctx); + expect(res.status).toBe(200); + expect(await res.text()).toBe("Success!"); + // Nothing was asked of Slack or the model before the acknowledgement… + expect(slack.calls).toHaveLength(0); + expect(pending).toHaveLength(1); + await Promise.all(pending); + // …and afterwards: who the bot is, a status message, the answer in its place. + expect(slack.calls.map((c) => c.method)).toEqual(["auth.test", "chat.postMessage", "chat.update"]); + expect(slack.calls.every((c) => c.auth === `Bearer ${TOKEN}`)).toBe(true); + expect(slack.calls[1]?.args).toMatchObject({ channel: "C123", thread_ts: "1700000000.000001", text: "is thinking..." }); + const answer = String(slack.calls[2]?.args.text); + expect(answer).toContain("README.md"); + expect(answer).toContain("notes.txt"); + expect(answer.endsWith("_🔧 bash_")).toBe(true); + expect(ai.asked.map((a) => a.roles.join(","))).toEqual(["system,user", "system,user,assistant,tool"]); + expect(ai.asked[0]?.model).toBe("@cf/moonshotai/kimi-k2.6"); + expect(ai.asked[0]?.tools).not.toContain("searchWeb"); + }); + + it("relays a policy refusal verbatim instead of the model's text", async () => { + const { slack, env } = await connected(); + const { ctx, pending } = executionCtx(); + await app.request("/api/events", signed(mention("please run `rm notes.txt`")), env, ctx); + await Promise.all(pending); + const answer = String(slack.calls.at(-1)?.args.text); + expect(answer).toMatch(/^`rm` is not an allowed command\. Allowed: /); + expect(answer.endsWith("_🔧 bash (blocked by policy)_")).toBe(true); + }); + + it("answers a direct message in its assistant thread, from the thread's history", async () => { + const { slack, ai, env } = await connected({ + "1700000000.000500": [ + { user: "U1", text: "first question", ts: "1700000000.000500" }, + { bot_id: "BBOT", text: "first answer", ts: "1700000000.000501" }, + { user: "U1", text: "hello there", ts: "1700000000.000502" }, + ], + }); + const { ctx, pending } = executionCtx(); + const dm = JSON.stringify({ + type: "event_callback", + event: { type: "message", channel_type: "im", channel: "D1", user: "U1", text: "hello there", ts: "1700000000.000502", thread_ts: "1700000000.000500" }, + }); + expect((await app.request("/api/events", signed(dm), env, ctx)).status).toBe(200); + await Promise.all(pending); + expect(slack.calls.map((c) => c.method)).toEqual(["auth.test", "assistant.threads.setStatus", "conversations.replies", "chat.postMessage", "assistant.threads.setStatus"]); + expect(slack.calls[3]?.args).toMatchObject({ channel: "D1", thread_ts: "1700000000.000500", text: "Echo: hello there\n\n_🔧 none_" }); + expect(slack.calls[4]?.args.status).toBe(""); + expect(ai.asked[0]?.roles).toEqual(["system", "user", "assistant", "user"]); + }); + + it("greets a new assistant thread with the template's suggested prompts", async () => { + const { slack, env } = await connected(); + const { ctx, pending } = executionCtx(); + const started = JSON.stringify({ type: "event_callback", event: { type: "assistant_thread_started", assistant_thread: { channel_id: "D1", thread_ts: "1700000000.000900" } } }); + await app.request("/api/events", signed(started), env, ctx); + await Promise.all(pending); + expect(slack.calls.map((c) => c.method)).toEqual(["auth.test", "chat.postMessage", "assistant.threads.setSuggestedPrompts"]); + expect(slack.calls[2]?.args.prompts).toEqual([ + { title: "Get the weather", message: "What is the current weather in London?" }, + { title: "Get the news", message: "What is the latest Premier League news from the BBC?" }, + ]); + }); + + it("ignores the bot's own messages and other bots'", async () => { + const { slack, ai, env } = await connected(); + const { ctx, pending } = executionCtx(); + const own = JSON.stringify({ type: "event_callback", event: { type: "message", channel_type: "im", channel: "D1", bot_id: "BBOT", text: "x", ts: "1", thread_ts: "1" } }); + await app.request("/api/events", signed(own), env, ctx); + await Promise.all(pending); + expect(slack.calls.map((c) => c.method)).toEqual(["auth.test"]); + expect(ai.asked).toHaveLength(0); + }); +}); diff --git a/tests/api/src/helpers.ts b/tests/api/src/helpers.ts new file mode 100644 index 0000000..5ad8856 --- /dev/null +++ b/tests/api/src/helpers.ts @@ -0,0 +1,102 @@ +import { createHmac } from "node:crypto"; +import { createServer, type Server } from "node:http"; +import type { AddressInfo } from "node:net"; + +export const SECRET = "test-signing-secret"; +export const TOKEN = "xoxb-test-token"; + +/** A signed Slack request for `body`, as Slack signs it (v0:ts:body). */ +export function signed(body: string, opts: { secret?: string; ts?: number; headers?: Record } = {}) { + const ts = String(opts.ts ?? Math.floor(Date.now() / 1000)); + const sig = "v0=" + createHmac("sha256", opts.secret ?? SECRET).update(`v0:${ts}:${body}`).digest("hex"); + return { + method: "POST", + headers: { "content-type": "application/json", "x-slack-request-timestamp": ts, "x-slack-signature": sig, ...(opts.headers ?? {}) }, + body, + }; +} + +/** What a Worker's ExecutionContext is to a route: a waitUntil that is kept. */ +export function executionCtx() { + const pending: Promise[] = []; + return { + pending, + ctx: { + waitUntil: (p: Promise) => void pending.push(p), + passThroughOnException: () => {}, + props: {}, + } as unknown as ExecutionContext, + }; +} + +export type SlackCall = { method: string; args: Record; auth: string }; + +/** The slice of Slack's Web API the bot calls, in process, recording every call and its token. */ +export async function slackStandIn(threads: Record = {}) { + const calls: SlackCall[] = []; + let ts = 1700000000; + const server: Server = createServer((req, res) => { + let raw = ""; + req.on("data", (c) => (raw += c)); + req.on("end", () => { + const method = (req.url ?? "").replace(/^\/api\//, "").split("?")[0] ?? ""; + const form = new URLSearchParams(raw); + const args: Record = {}; + for (const [k, v] of form) { + try { + args[k] = v.startsWith("[") || v.startsWith("{") ? JSON.parse(v) : v; + } catch { + args[k] = v; + } + } + calls.push({ method, args, auth: String(req.headers.authorization ?? "") }); + const reply = (body: unknown) => { + res.setHeader("content-type", "application/json"); + res.end(JSON.stringify(body)); + }; + if (req.headers.authorization !== `Bearer ${TOKEN}`) return reply({ ok: false, error: "invalid_auth" }); + if (method === "auth.test") return reply({ ok: true, user_id: "UBOT" }); + if (method === "chat.postMessage" || method === "chat.update") return reply({ ok: true, ts: args.ts ?? `${++ts}.000100` }); + if (method === "conversations.replies") return reply({ ok: true, messages: threads[String(args.ts)] ?? [] }); + return reply({ ok: true }); + }); + }); + await new Promise((r) => server.listen(0, "127.0.0.1", r)); + const { port } = server.address() as AddressInfo; + return { url: `http://127.0.0.1:${port}/api/`, calls, close: () => new Promise((r) => server.close(() => r())) }; +} + +const text = (c: unknown) => (typeof c === "string" ? c : Array.isArray(c) ? c.map((p) => (p as { text?: string })?.text ?? "").join("") : ""); + +/** + * The Worker's AI binding, in process: workers-ai-provider calls + * `AI.run(model, inputs)`. It answers deterministically, with no network: + * a tool result is quoted, `run \`\`` becomes a bash call, anything + * else is echoed — and records what it was asked. + */ +export function aiStandIn() { + const asked: { model: string; tools: string[]; roles: string[] }[] = []; + const AI = { + async run(model: string, inputs: { messages?: { role: string; content: unknown }[]; tools?: { function?: { name?: string } }[] }) { + const messages = inputs.messages ?? []; + const tools = (inputs.tools ?? []).map((t) => t.function?.name ?? "").filter(Boolean); + asked.push({ model, tools, roles: messages.map((m) => m.role) }); + const last = messages[messages.length - 1]; + const lastUser = [...messages].reverse().find((m) => m.role === "user"); + if (last?.role === "tool") return { choices: [{ message: { role: "assistant", content: `Tool said: ${text(last.content)}` }, finish_reason: "stop" }] }; + const ask = /run `([^`]+)`/.exec(text(lastUser?.content)); + if (ask && tools.includes("bash")) { + return { + choices: [ + { + message: { role: "assistant", content: "", tool_calls: [{ id: `call_${messages.length}`, type: "function", function: { name: "bash", arguments: JSON.stringify({ command: ask[1] }) } }] }, + finish_reason: "tool_calls", + }, + ], + }; + } + return { choices: [{ message: { role: "assistant", content: `Echo: ${text(lastUser?.content)}` }, finish_reason: "stop" }] }; + }, + }; + return { AI: AI as unknown as Ai, asked }; +} diff --git a/tests/api/src/identity.test.ts b/tests/api/src/identity.test.ts new file mode 100644 index 0000000..051be3b --- /dev/null +++ b/tests/api/src/identity.test.ts @@ -0,0 +1,20 @@ +import { readFileSync } from "node:fs"; +import { resolve } from "node:path"; +import { describe, expect, it } from "vitest"; + +// The bot's name is ONE literal line the Orun bootstrap rewrites to the +// product's name when it creates a product. Its shape is the contract, not +// its value, so a renamed product passes this as the baseline does. +describe("the name seam (apps/api/src/identity.ts)", () => { + it("is one literal, double-quoted API_NAME line, and the exported value matches it", async () => { + const src = readFileSync(resolve(__dirname, "../../../apps/api/src/identity.ts"), "utf8"); + const lines = src.split("\n").filter((l) => /API_NAME =/.test(l)); + expect(lines).toHaveLength(1); + const m = /^export const API_NAME = (".*")$/.exec(lines[0] ?? ""); + expect(m).not.toBeNull(); + const literal = JSON.parse(m?.[1] ?? '""') as string; + expect(literal.trim()).not.toBe(""); + const { API_NAME } = await import("@/identity"); + expect(API_NAME).toBe(literal); + }); +}); diff --git a/tests/api/src/policy.test.ts b/tests/api/src/policy.test.ts new file mode 100644 index 0000000..05b54f8 --- /dev/null +++ b/tests/api/src/policy.test.ts @@ -0,0 +1,54 @@ +import { describe, expect, it } from "vitest"; +import { policyClient, toInput } from "@/lib/policy/load"; + +// The compiled policy the Worker ships (apps/api/policies/policy.wasm, built +// from decision.rego), evaluated on the input the bot hands it (toInput) — +// every rule of the template's policy, allow and deny. +const client = await policyClient(); +const decide = async (toolName: string, input: unknown, channelId = "C0OTHER") => + (await client.evaluate("agent/call/decision", toInput({ toolCall: { toolName, input }, runtimeContext: { channelId, userId: "U1" }, messages: [] }))) as { + decision: string; + reason?: string; + }; + +describe("the tool-call policy (apps/api/policies/decision.rego → policy.wasm)", () => { + it("allows the weather for an allowed city only", async () => { + expect((await decide("getWeather", { city: " London " })).decision).toBe("allow"); + const paris = await decide("getWeather", { city: "Paris" }); + expect(paris.decision).toBe("deny"); + expect(paris.reason).toContain("Paris"); + }); + + it("allows a web search on vercel.com only", async () => { + expect((await decide("searchWeb", { query: "x", specificDomain: "vercel.com" })).decision).toBe("allow"); + expect((await decide("searchWeb", { query: "x", specificDomain: "bbc.com" })).reason).toBe("I can only search vercel.com per policy."); + expect((await decide("searchWeb", { query: "x", specificDomain: null })).decision).toBe("deny"); + }); + + it("allows the dice in the designated channel only", async () => { + expect((await decide("throwDice", {}, "C0B6YBUHMME")).decision).toBe("allow"); + expect((await decide("throwDice", {})).decision).toBe("deny"); + }); + + it("allows one simple, allow-listed, workspace-relative bash command", async () => { + expect((await decide("bash", { command: "ls" })).decision).toBe("allow"); + expect((await decide("bash", { command: "cat notes.txt" })).decision).toBe("allow"); + expect((await decide("bash", { command: "rm notes.txt" })).reason).toMatch(/^`rm` is not an allowed command/); + for (const command of ["ls; rm notes.txt", "ls | wc", "echo $(id)", "X=1 ls", "ls > out"]) { + expect((await decide("bash", { command })).reason, command).toMatch(/^Only a single, simple command/); + } + expect((await decide("bash", { command: "cat /etc/passwd" })).reason).toMatch(/relative paths within the workspace/); + expect((await decide("bash", { command: "cat ../x" })).decision).toBe("deny"); + }); + + it("refuses every write, and reads outside the workspace", async () => { + expect((await decide("writeFile", { path: "a.txt", content: "x" })).decision).toBe("deny"); + expect((await decide("readFile", { path: "notes.txt" })).decision).toBe("allow"); + expect((await decide("readFile", { path: "/etc/passwd" })).decision).toBe("deny"); + expect((await decide("readFile", { path: "../secret" })).decision).toBe("deny"); + }); + + it("denies a tool the policy does not name", async () => { + expect(await decide("deleteEverything", {})).toEqual({ decision: "deny", reason: "This tool is not permitted by policy." }); + }); +}); diff --git a/tests/api/src/reply.test.ts b/tests/api/src/reply.test.ts new file mode 100644 index 0000000..64cd28e --- /dev/null +++ b/tests/api/src/reply.test.ts @@ -0,0 +1,44 @@ +import { describe, expect, it } from "vitest"; +import { formatReply } from "@/lib/generate-response"; +import { modelFor, OPENAI_DEFAULT_MODEL, WORKERS_AI_MODEL } from "@/lib/model"; +import { systemPrompt, toolNames } from "@/lib/run-agent"; + +describe("formatReply (apps/api/src/lib/generate-response.ts)", () => { + it("always ends with the tools footer, and converts markdown to Slack mrkdwn", () => { + expect(formatReply("**Hi** see [docs](https://vercel.com/docs)", [])).toBe("*Hi* see \n\n_🔧 none_"); + expect(formatReply("ok", [{ toolName: "getWeather", status: "used" }, { toolName: "getWeather", status: "used" }])).toBe("ok\n\n_🔧 getWeather_"); + }); + + it("shows only the reasons when nothing ran, never the model's text", () => { + expect(formatReply("London is sunny", [{ toolName: "getWeather", status: "denied", reason: "Not allowed." }])).toBe( + "Not allowed.\n\n_🔧 getWeather (blocked by policy)_", + ); + }); + + it("keeps the answer and appends a refusal when another tool succeeded", () => { + expect( + formatReply("Rolled a 4.", [ + { toolName: "throwDice", status: "used" }, + { toolName: "bash", status: "failed", reason: "boom" }, + ]), + ).toBe("Rolled a 4.\n\nboom\n\n_🔧 throwDice, bash (failed)_"); + }); +}); + +describe("the model and the tools", () => { + const AI = {} as Ai; + it("is Workers AI with no key, and upstream's OpenAI once its key is stored", () => { + expect(modelFor({ AI })).toMatchObject({ provider: "workers-ai", id: WORKERS_AI_MODEL }); + expect(modelFor({ AI, OPENAI_API_KEY: "sk-x" })).toMatchObject({ provider: "openai", id: OPENAI_DEFAULT_MODEL }); + expect(modelFor({ AI, OPENAI_API_KEY: "sk-x", OPENAI_MODEL: "gpt-4.1-mini" })).toMatchObject({ provider: "openai", id: "gpt-4.1-mini" }); + }); + + it("offers web search, and names it in the prompt, only with Exa's key", () => { + expect(toolNames({ search: false })).not.toContain("searchWeb"); + expect(toolNames({ search: true })).toContain("searchWeb"); + expect(systemPrompt({ search: false, today: "2026-10-28" })).not.toContain("searchWeb"); + const withSearch = systemPrompt({ search: true, today: "2026-10-28" }); + expect(withSearch).toContain("searchWeb"); + expect(withSearch).toContain("Current date is: 2026-10-28"); + }); +}); diff --git a/tests/api/src/slack.test.ts b/tests/api/src/slack.test.ts new file mode 100644 index 0000000..f5a5d90 --- /dev/null +++ b/tests/api/src/slack.test.ts @@ -0,0 +1,41 @@ +import { createHmac } from "node:crypto"; +import { describe, expect, it } from "vitest"; +import { isValidSlackRequest } from "@/lib/slack-utils"; + +// Slack's request signing (https://api.slack.com/authentication/verifying-requests-from-slack), +// checked with WebCrypto in the Worker. The expected signature is computed +// here with Node's own HMAC, so the two implementations are held to each other. +const secret = "8f742231b10e8888abcd99yyyzzz85a5"; +const body = "token=xyzz0WbapA4vBCDEFasx0q6G&team_id=T1DC2JH3J&command=%2Fweather"; +const now = 1531420618 * 1000; +const sign = (ts: string, b = body, s = secret) => "v0=" + createHmac("sha256", s).update(`v0:${ts}:${b}`).digest("hex"); + +describe("isValidSlackRequest (apps/api/src/lib/slack-utils.ts)", () => { + it("accepts Slack's own signature", async () => { + const ts = "1531420618"; + expect(await isValidSlackRequest({ signingSecret: secret, timestamp: ts, signature: sign(ts), rawBody: body, now })).toBe(true); + }); + + it("refuses a signature made with another secret, or over another body", async () => { + const ts = "1531420618"; + expect(await isValidSlackRequest({ signingSecret: secret, timestamp: ts, signature: sign(ts, body, "other"), rawBody: body, now })).toBe(false); + expect(await isValidSlackRequest({ signingSecret: secret, timestamp: ts, signature: sign(ts), rawBody: body + "&x=1", now })).toBe(false); + }); + + it("refuses a timestamp more than five minutes from now, either way", async () => { + for (const offset of [-301, 301]) { + const ts = String(1531420618 + offset); + expect(await isValidSlackRequest({ signingSecret: secret, timestamp: ts, signature: sign(ts), rawBody: body, now })).toBe(false); + } + const edge = String(1531420618 - 300); + expect(await isValidSlackRequest({ signingSecret: secret, timestamp: edge, signature: sign(edge), rawBody: body, now })).toBe(true); + }); + + it("refuses a missing header, a non-numeric timestamp and a truncated signature", async () => { + const ts = "1531420618"; + expect(await isValidSlackRequest({ signingSecret: secret, timestamp: null, signature: sign(ts), rawBody: body, now })).toBe(false); + expect(await isValidSlackRequest({ signingSecret: secret, timestamp: ts, signature: null, rawBody: body, now })).toBe(false); + expect(await isValidSlackRequest({ signingSecret: secret, timestamp: "1531420618.5", signature: sign("1531420618.5"), rawBody: body, now })).toBe(false); + expect(await isValidSlackRequest({ signingSecret: secret, timestamp: ts, signature: sign(ts).slice(0, -1), rawBody: body, now })).toBe(false); + }); +}); diff --git a/tests/api/tsconfig.json b/tests/api/tsconfig.json new file mode 100644 index 0000000..4ac65d5 --- /dev/null +++ b/tests/api/tsconfig.json @@ -0,0 +1,22 @@ +{ + "extends": "../../tooling/tsconfig/web.json", + "compilerOptions": { + "composite": false, + "declaration": false, + "declarationMap": false, + "noEmit": true, + "types": [ + "node", + "@cloudflare/workers-types" + ], + "paths": { + "@/*": [ + "../../apps/api/src/*" + ] + } + }, + "include": [ + "src/**/*.ts", + "../../apps/api/src/wasm.d.ts" + ] +} diff --git a/tests/api/vitest.config.ts b/tests/api/vitest.config.ts new file mode 100644 index 0000000..f6737b8 --- /dev/null +++ b/tests/api/vitest.config.ts @@ -0,0 +1,31 @@ +import { defineConfig, type Plugin } from "vitest/config"; +import * as path from "node:path"; +import { readFileSync } from "node:fs"; + +// The Worker imports its compiled policy as a WebAssembly.Module (wrangler +// compiles a `.wasm` import at upload). Under Node the same import becomes the +// same module, compiled from the same file, so the tests run the policy the +// Worker ships — not a copy of its rules. +const wasmModule = (): Plugin => ({ + name: "wasm-module", + enforce: "pre", + load(id) { + if (!id.endsWith(".wasm")) return null; + const b64 = readFileSync(id).toString("base64"); + return `export default new WebAssembly.Module(Buffer.from(${JSON.stringify(b64)}, "base64"));`; + }, +}); + +export default defineConfig({ + plugins: [wasmModule()], + resolve: { + alias: { + "@": path.resolve(__dirname, "../../apps/api/src"), + }, + }, + test: { + include: ["src/**/*.test.ts"], + environment: "node", + testTimeout: 30_000, + }, +}); diff --git a/tooling/catalog/gen-component-docs.py b/tooling/catalog/gen-component-docs.py new file mode 100644 index 0000000..743782b --- /dev/null +++ b/tooling/catalog/gen-component-docs.py @@ -0,0 +1,550 @@ +#!/usr/bin/env python3 +"""Generate each component's docs (overview / architecture / runbook). + + python3 tooling/catalog/gen-component-docs.py # write + python3 tooling/catalog/gen-component-docs.py --check # fail on drift (CI) + +Every `component.yaml` attaches its `docs/` folder in `spec.docs` (overview, +architecture, runbook), which is what the Orun workspace's Docs library shows +and what the catalog's docs and runbook checks read; a folder nothing declares +is never attached (testing/coverage.test.sh holds the rule). These pages are +generated, not hand-written, because almost +everything in them is already declared somewhere CI validates: the component's +manifest (type, description, dependencies, environments, the secrets a lane +resolves, the smoke), its Worker config (bindings, triggers, the wiring the +deploy fills in), its Terraform (resources and outputs), its migrations and its +package scripts. A hand-written copy of those facts drifts the first time one +changes; a generated one cannot, because `--check` fails the pull request that +changes the fact without the page. + +What is NOT derivable (why a component exists, what a failure means for this +product in particular) belongs in the component's `description` and in the +product's own docs, not here. + +The pages ship with the component into every product built from this tree, so +they say nothing about where they came from: no factory paths, no generator +path, no provenance. Zero dependencies beyond PyYAML. +""" + +from __future__ import annotations + +import json +import pathlib +import re +import sys + +try: + import yaml +except ImportError: # pragma: no cover - the contract job installs it + sys.exit("gen-component-docs needs PyYAML (pip install pyyaml)") + +ROOT = pathlib.Path(__file__).resolve().parents[2] +ROOTS = ("apps", "packages", "infra", "tests") +SKIP_DIRS = {"node_modules", "dist", ".turbo", "docs", ".next", ".open-next", + ".wrangler", ".svelte-kit", ".nuxt", ".output", ".astro", "coverage"} + +# Paths a shipped page must never name: products are not placed with them. +FACTORY = re.compile( + r"repo-blueprint|BOOTSTRAP\.md|(? str: + """JSONC → JSON: drop comments outside strings, then trailing commas.""" + out, i, n, in_str = [], 0, len(text), False + while i < n: + c = text[i] + if in_str: + out.append(c) + if c == "\\" and i + 1 < n: + out.append(text[i + 1]) + i += 2 + continue + if c == '"': + in_str = False + i += 1 + continue + if c == '"': + in_str = True + out.append(c) + i += 1 + elif text.startswith("//", i): + j = text.find("\n", i) + i = n if j < 0 else j + elif text.startswith("/*", i): + j = text.find("*/", i + 2) + i = n if j < 0 else j + 2 + else: + out.append(c) + i += 1 + return re.sub(r",(\s*[}\]])", r"\1", "".join(out)) + + +def read_json(path: pathlib.Path) -> dict | None: + try: + return json.loads(strip_jsonc(path.read_text(encoding="utf-8"))) + except (OSError, ValueError): + return None + + +def rel(p: pathlib.Path) -> str: + return p.relative_to(ROOT).as_posix() + + +def discover() -> list[dict]: + found = [] + for root in ROOTS: + base = ROOT / root + if not base.is_dir(): + continue + stack = [base] + while stack: + d = stack.pop() + for entry in sorted(d.iterdir()): + if entry.is_dir(): + if entry.name in SKIP_DIRS or entry.name.startswith("."): + continue + if (entry / "main.tf").exists() and not (entry / "component.yaml").exists(): + continue + if len(entry.relative_to(base).parts) <= 3: + stack.append(entry) + elif entry.name == "component.yaml": + found.append(read_component(entry)) + comps = [c for c in found if c["name"] and c["type"]] + return sorted(comps, key=lambda c: c["name"]) + + +def read_component(file: pathlib.Path) -> dict: + doc = yaml.safe_load(file.read_text(encoding="utf-8")) or {} + meta, spec = doc.get("metadata") or {}, doc.get("spec") or {} + params = spec.get("parameters") or {} + deps = [d.get("component") for d in (spec.get("dependsOn") or []) if isinstance(d, dict)] + envs = [] + # Secrets may be declared for the whole component or per environment + # (`subscribe.environments[].secretEnv`); a page lists both. + req_env = set((spec.get("secretEnv") or {}).keys()) + opt_env = set((spec.get("optionalSecretEnv") or {}).keys()) + for e in ((spec.get("subscribe") or {}).get("environments") or []): + req_env |= set((e.get("secretEnv") or {}).keys()) + opt_env |= set((e.get("optionalSecretEnv") or {}).keys()) + rules = [(r.get("profile"), ((r.get("when") or {}).get("triggerRef"))) + for r in (e.get("profileRules") or [])] + envs.append({"name": e.get("name"), "profile": e.get("profile"), "rules": rules}) + return { + "dir": file.parent, + "path": rel(file.parent), + "name": meta.get("name"), + "description": (meta.get("description") or "").strip(), + "type": spec.get("type"), + "deps": [d for d in deps if d], + "secret_env": sorted(req_env), + "optional_env": sorted(opt_env - req_env), + "envs": envs, + "params": params, + "migrations_path": spec.get("path") if spec.get("type") == "db-migrate" else None, + } + + +def package_of(c: dict) -> dict | None: + return read_json(c["dir"] / "package.json") + + +def worker_config(c: dict) -> tuple[str | None, dict | None]: + """The config a deploy uses: the template when wiring renders one.""" + names = ["wrangler.template.jsonc", c["params"].get("wranglerConfig") or "", + "wrangler.jsonc", "wrangler.json"] + for name in names: + if name and (c["dir"] / name).is_file(): + return name, read_json(c["dir"] / name) + return None, None + + +WIRING = re.compile(r"@@wiring\(([^/)]+)/__ENV__:([^)]+)\)@@") + + +def wired(value) -> str | None: + m = WIRING.search(str(value)) if value is not None else None + return f"`{m.group(2)}` from `{m.group(1)}`" if m else None + + +def bindings(cfg: dict) -> list[tuple[str, str, str]]: + rows = [] + for kv in cfg.get("kv_namespaces") or []: + rows.append((kv.get("binding"), "Workers KV namespace", wired(kv.get("id")) or "declared in the config")) + for b in cfg.get("r2_buckets") or []: + rows.append((b.get("binding"), "R2 bucket", wired(b.get("bucket_name")) or f"`{b.get('bucket_name')}`")) + for d in cfg.get("d1_databases") or []: + rows.append((d.get("binding"), "D1 database", wired(d.get("database_id")) or "declared in the config")) + for h in cfg.get("hyperdrive") or []: + rows.append((h.get("binding"), "Hyperdrive (pooled Postgres)", wired(h.get("id")) or "declared in the config")) + if isinstance(cfg.get("ai"), dict) and cfg["ai"].get("binding"): + rows.append((cfg["ai"]["binding"], "Workers AI", "account-level; no resource to provision")) + for d in ((cfg.get("durable_objects") or {}).get("bindings") or []): + rows.append((d.get("name"), "Durable Object", f"class `{d.get('class_name')}`")) + for s in cfg.get("services") or []: + rows.append((s.get("binding"), "Service binding", f"Worker `{s.get('service')}`")) + for q in ((cfg.get("queues") or {}).get("producers") or []): + rows.append((q.get("binding"), "Queue producer", f"queue `{q.get('queue')}`")) + for r in cfg.get("ratelimits") or []: + simple = r.get("simple") or {} + rows.append((r.get("name"), "Rate limiter", + f"{simple.get('limit')} requests / {simple.get('period')}s per location")) + assets = cfg.get("assets") or {} + if assets.get("binding"): + rows.append((assets["binding"], "Static assets", f"`{assets.get('directory')}`")) + return [r for r in rows if r[0]] + + +def tf_facts(c: dict) -> dict: + tf_dir = c["dir"] / (c["params"].get("terraformDir") or "terraform") + resources, outputs, variables, backend = [], [], [], None + for f in sorted(tf_dir.glob("*.tf")) if tf_dir.is_dir() else []: + text = f.read_text(encoding="utf-8") + resources += [f"{t}.{n}" for t, n in re.findall(r'^resource\s+"([^"]+)"\s+"([^"]+)"', text, re.M)] + outputs += re.findall(r'^output\s+"([^"]+)"', text, re.M) + variables += re.findall(r'^variable\s+"([^"]+)"', text, re.M) + m = re.search(r'backend\s+"([^"]+)"', text) + backend = backend or (m.group(1) if m else None) + imports = (tf_dir / "adopt.tf").is_file() if tf_dir.is_dir() else False + return {"dir": rel(tf_dir) if tf_dir.is_dir() else None, "resources": resources, + "outputs": outputs, "variables": variables, "backend": backend, "adopt": imports} + + +def published(c: dict) -> list[tuple[str, str]]: + spec = c["params"].get("secretOutputs") or "" + pairs = [] + for part in str(spec).split(","): + if "=" in part: + k, v = part.split("=", 1) + pairs.append((k.strip(), v.strip())) + return pairs + + +def test_files(c: dict) -> list[str]: + out = [] + for p in sorted(c["dir"].rglob("*")): + if any(part in SKIP_DIRS for part in p.relative_to(c["dir"]).parts): + continue + if p.is_file() and re.search(r"\.(test|spec)\.(ts|tsx|js|mjs|cjs)$", p.name): + out.append(p.name) + return out + + +def migrations(c: dict) -> list[str]: + path = c["migrations_path"] + if not path: + return [] + d = ROOT / path + if not d.is_dir(): + return [] + return sorted(p.name for p in d.iterdir() if p.is_dir() or p.suffix == ".sql") + + +# ── markdown ───────────────────────────────────────────────────────────── + +def md_table(header: list[str], rows: list[list[str]]) -> list[str]: + """A table laid out the way prettier lays it out, so a repo whose lint is + `prettier --check` accepts the page as written.""" + cols = len(header) + width = [max(3, len(header[i]), *(len(r[i]) for r in rows)) for i in range(cols)] + def line(cells): + return "| " + " | ".join(c.ljust(width[i]) for i, c in enumerate(cells)) + " |" + return [line(header), "| " + " | ".join("-" * w for w in width) + " |", *(line(r) for r in rows)] + + +# ── phrasing ───────────────────────────────────────────────────────────── + +KIND = { + "cloudflare-worker-turbo": "A Cloudflare Worker, deployed per environment by its CI lane.", + "cloudflare-workers-assets-turbo": "A Cloudflare Worker with Static Assets (server rendering plus " + "static files), deployed per environment by its CI lane.", + "terraform": "Terraform-managed infrastructure, planned and applied per environment by its CI lane.", + "db-migrate": "Applies this repository's ordered database migrations per environment: " + "plan on pull requests, apply on merge to `main`.", + "turbo-package": "A workspace package built by the turbo pipeline. It deploys nothing itself: " + "its lane type-checks, lints, tests and builds it.", +} + +TRIGGER = {"github-push-main": "a push to `main`", "github-pull-request": "a pull request"} + + +def env_line(e: dict) -> str: + s = f"`{e['name']}`: `{e['profile']}`" + for profile, ref in e["rules"]: + s += f", `{profile}` on {TRIGGER.get(ref, f'`{ref}`')}" + return s + + +def is_tests(c: dict) -> bool: + return c["name"].endswith("-tests") or c["path"].startswith("tests/") + + +def subject_of(c: dict, by_name: dict) -> str | None: + if c["name"].endswith("-tests"): + s = c["name"][: -len("-tests")] + return s if s in by_name else None + return None + + +def names_list(c: dict, keep) -> list[str]: + """Secret names a lane resolves, required first; an optional one (from + `optionalSecretEnv`) is resolved when it exists and skipped when not.""" + req = [f"- `{k}`" for k in c["secret_env"] if keep(k)] + opt = [f"- `{k}` (optional)" for k in c["optional_env"] if keep(k)] + return req + opt + + +def bullet_list(names: list[str], by_name: dict) -> list[str]: + if not names: + return ["- (none)"] + out = [] + for n in names: + d = by_name.get(n) + out.append(f"- **{n}** — {d['description']}" if d and d["description"] else f"- **{n}**") + return out + + +# ── pages ──────────────────────────────────────────────────────────────── + +def overview(c: dict, by_name: dict, dependents: list[str]) -> str: + pkg = package_of(c) + kind = KIND.get(c["type"], f"A `{c['type']}` component.") + subject = subject_of(c, by_name) + if is_tests(c): + kind = (f"The test suite for **{subject}**. " if subject else "A test suite. ") + \ + "It deploys nothing: its lane installs, builds and runs the tests." + lines = [f"# {c['name']}", ""] + if c["description"]: + lines += [c["description"], ""] + facts = [["Type", f"`{c['type']}`"], ["Source", f"`{c['path']}`"]] + if pkg and pkg.get("name"): + facts.append(["Package", f"`{pkg['name']}`"]) + if c["envs"]: + facts.append(["Environments", " · ".join(env_line(e) for e in c["envs"])]) + lines += [kind, "", *md_table(["", ""], facts)] + lines += ["", "## Depends on", "", *bullet_list(c["deps"], by_name), + "", "## Depended on by", "", *bullet_list(dependents, by_name), ""] + return "\n".join(lines) + + +def architecture(c: dict, by_name: dict) -> str: + lines = [f"# {c['name']} — architecture", ""] + t = c["type"] + + if t == "terraform": + f = tf_facts(c) + lines += [f"A `terraform` root at `{f['dir'] or c['path']}`.", ""] + if f["backend"] == "http": + lines += ["- **State** lives in the Orun Cloud HTTP state backend — no local state and", + " no state bucket to manage."] + lines += ["- **Credentials are brokered per run** from the workspace's provider", + " connections and resolved by name; none is stored in this repository."] + if f["adopt"]: + lines += ["- **Adoption** (`adopt.tf`): when state is empty but the resource already", + " exists, plan-time import adopts it instead of failing."] + lines.append("") + if f["resources"]: + lines += ["## Resources", "", *[f"- `{r}`" for r in f["resources"]], ""] + pub = published(c) + if pub: + lines += ["## Published outputs", "", + "Written as job-output secrets on each environment after an apply; deploy", + "lanes downstream resolve them by name.", "", + *md_table(["Secret", "Terraform output"], [[f"`{k}`", f"`{v}`"] for k, v in pub]), ""] + elif f["outputs"]: + lines += ["## Outputs", "", *[f"- `{o}`" for o in f["outputs"]], ""] + if c["secret_env"] or c["optional_env"]: + lines += ["## Resolved at run time (names only)", "", *names_list(c, lambda k: True), ""] + return "\n".join(lines) + + if t == "db-migrate": + migs = migrations(c) + lines += [f"Applies the migrations under `{c['migrations_path']}` in order, recording each one", + "it applies so a run only ever applies what is new. An already-applied migration", + "is never edited: a change is a new, later migration.", ""] + if migs: + lines += ["## Migrations", "", *[f"- `{m}`" for m in migs], ""] + if c["secret_env"] or c["optional_env"]: + lines += ["## Resolved at run time (names only)", "", *names_list(c, lambda k: True), ""] + return "\n".join(lines) + + pkg = package_of(c) + if t.startswith("cloudflare-"): + cfg_name, cfg = worker_config(c) + lines += [f"Built by the turbo pipeline from `{c['path']}` and deployed with wrangler.", ""] + if cfg: + facts = [["Worker config", f"`{c['path']}/{cfg_name}`"]] + if cfg.get("main"): + facts.append(["Entry", f"`{cfg['main']}`"]) + if cfg.get("compatibility_date"): + facts.append(["Compatibility date", f"`{cfg['compatibility_date']}`"]) + if cfg.get("compatibility_flags"): + facts.append(["Compatibility flags", ", ".join(f"`{x}`" for x in cfg["compatibility_flags"])]) + lines += [*md_table(["", ""], facts), ""] + rows = bindings(cfg) + lines += ["## Bindings", ""] + if rows: + lines += [*md_table(["Binding", "Kind", "Source"], [[f"`{b}`", k, s] for b, k, s in rows]), ""] + if any("from `" in s for _, _, s in rows): + lines += ["Identifiers marked _from_ a component are filled in at deploy time from", + "that component's published outputs for the environment being deployed.", ""] + else: + lines += ["None: the Worker binds no storage or service.", ""] + crons = (cfg.get("triggers") or {}).get("crons") or [] + if crons: + lines += ["## Scheduled triggers", "", *[f"- `{x}`" for x in crons], ""] + env_names = sorted((cfg.get("env") or {}).keys()) + var_names = sorted((cfg.get("vars") or {}).keys()) + if var_names: + lines += ["## Variables", "", ", ".join(f"`{v}`" for v in var_names) + + (f" — overridden per environment ({', '.join(f'`{e}`' for e in env_names)})." + if env_names else "."), ""] + wiring = names_list(c, lambda k: k.startswith("WIRING_")) + others = names_list(c, lambda k: not k.startswith("WIRING_")) + if wiring: + lines += ["## Wiring", "", + "Resolved at deploy time from secrets the infrastructure lanes publish (names only):", + "", *wiring, ""] + if others: + lines += ["## Secrets resolved by the lane (names only)", "", *others, ""] + return "\n".join(lines) + + # turbo-package + if is_tests(c): + files = test_files(c) + lines += [f"A test package at `{c['path']}`. Its lane runs the suite before it builds.", ""] + if files: + lines += [f"## Suites ({len(files)})", "", *[f"- `{f}`" for f in files], ""] + return "\n".join(lines) + lines += [f"A workspace package at `{c['path']}`, consumed by the components that depend", + "on it. It has no deployed surface of its own.", ""] + if pkg and pkg.get("exports"): + ex = pkg["exports"] + keys = sorted(ex.keys()) if isinstance(ex, dict) else ["."] + lines += ["## Exports", "", *[f"- `{k}`" for k in keys], ""] + return "\n".join(lines) + + +def runbook(c: dict, by_name: dict) -> str: + t = c["type"] + pkg = package_of(c) + lines = [f"# {c['name']} — runbook", "", "## How it runs", ""] + deploys = [e["name"] for e in c["envs"] + if any(ref == "github-push-main" for _, ref in e["rules"])] + if deploys and t in ("terraform", "db-migrate"): + lines += [f"Pull requests plan it; a merge to `main` applies it to " + f"{', '.join(f'`{e}`' for e in deploys)}."] + elif deploys: + lines += [f"Pull requests verify it; a merge to `main` deploys it to " + f"{', '.join(f'`{e}`' for e in deploys)}."] + else: + lines += ["Its lane runs on every pull request that changes it; it has no deployed surface."] + lines += ["CI plans what changed (`orun plan --changed`) and runs each lane with `orun run`;", + "the plan orders a component after everything it depends on.", ""] + + if pkg and pkg.get("scripts"): + name = pkg.get("name") + wanted = [s for s in ("dev", "build", "test", "typecheck", "lint", "preview") if s in pkg["scripts"]] + if name and wanted: + lines += ["## Local commands", "", "```bash", + *[f"pnpm --filter {name} {s}" for s in wanted], "```", ""] + + smoke = c["params"].get("smokeCommand") + if smoke and "No smoke" not in str(smoke): + lines += ["## Verify", "", "After a deploy the lane runs this smoke against the environment it", + "deployed (`ORUN_ENVIRONMENT`); `DEPLOYED_URL` overrides the URL:", "", + "```bash", str(smoke).strip(), "```", ""] + + lines += ["## Rollback", "", + "Revert the commit on `main`. The next convergence applies the previous desired", + "state; nothing was changed out of band, so there is nothing else to undo.", "", + "## Common failures", ""] + if t == "terraform": + lines += ["- **Provider authentication fails**: the workspace's provider connection is", + " missing or revoked. Reconnect it in the console; credentials are brokered", + " from it per run.", + "- **\"Already exists\" on a first apply**: state is empty but the resource is", + " not." + (" `adopt.tf` imports it at plan time; if it still fails, the resource" + " was renamed outside Terraform." if tf_facts(c)["adopt"] else + " Import it, or delete the stray resource, then re-run."), ""] + elif t == "db-migrate": + lines += ["- **An applied migration's file changed**: the run stops rather than guess.", + " Restore the file and write the change as a new migration.", + "- **The database is unreachable**: the infrastructure lane it depends on has", + " not applied for this environment; that lane runs first in a convergence.", ""] + elif t.startswith("cloudflare-"): + _, cfg = worker_config(c) + takes_wiring = any(k.startswith("WIRING_") for k in c["secret_env"] + c["optional_env"]) or \ + bool(cfg and WIRING.search(json.dumps(cfg))) + if takes_wiring: + lines += ["- **A `WIRING_*` secret is missing at deploy**: an infrastructure lane upstream", + " has not applied for this environment yet. Within one convergence the plan", + " runs it first; on its own, re-run that lane."] + lines += ["- **The smoke fails right after a first deploy**: a new workers.dev route can", + " answer 4xx for a few seconds and the lane retries. A failure that persists", + " is a regression in the deployed code.", ""] + else: + lines += ["- **A dependent fails to build after a change here**: run `pnpm typecheck`", + " across the workspace before merging.", ""] + return "\n".join(lines) + + +# ── main ───────────────────────────────────────────────────────────────── + +def main() -> int: + check = "--check" in sys.argv[1:] + comps = discover() + if not comps: + print("no component.yaml found", file=sys.stderr) + return 1 + by_name = {c["name"]: c for c in comps} + dependents: dict[str, list[str]] = {c["name"]: [] for c in comps} + for c in comps: + for d in c["deps"]: + dependents.setdefault(d, []).append(c["name"]) + + drifted, written, leaks = [], 0, [] + for c in comps: + pages = { + "overview.md": overview(c, by_name, sorted(dependents.get(c["name"], []))), + "architecture.md": architecture(c, by_name), + "runbook.md": runbook(c, by_name), + } + for fname, body in pages.items(): + target = c["dir"] / "docs" / fname + for n, line in enumerate(body.splitlines(), 1): + m = FACTORY.search(line) + if m: + leaks.append(f"{rel(target)}:{n} would name {m.group(0)!r}") + current = target.read_text(encoding="utf-8") if target.exists() else None + if current == body: + continue + if check: + drifted.append(rel(target)) + continue + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text(body, encoding="utf-8") + written += 1 + + if leaks: + print("✗ a generated page would name a path products do not have:", file=sys.stderr) + for l in leaks: + print(f" {l}", file=sys.stderr) + return 1 + if check: + if drifted: + print(f"✗ {len(drifted)} component doc(s) differ from what the manifests say:", file=sys.stderr) + for f in drifted: + print(f" {f}", file=sys.stderr) + print("\nRun: python3 tooling/catalog/gen-component-docs.py", file=sys.stderr) + return 1 + print(f"✓ component docs match {len(comps)} component.yaml file(s)") + return 0 + print(f"✓ wrote {written} page(s) for {len(comps)} component(s)") + return 0 + + +if __name__ == "__main__": + sys.exit(main())