Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
feat(community): add agent cli bridge
Gusd3ad2523ac62
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex e19f4528b..dc472f226 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -3,10 +3,10 @@ name: CIon:push:branches: [main]- paths-ignore: ['**/*.md']+ paths-ignore: ["**/*.md"]pull_request:branches: [main]- paths-ignore: ['**/*.md']+ paths-ignore: ["**/*.md"]concurrency:group: ${{ github.workflow }}-${{ github.ref }}@@ -40,7 +40,7 @@ jobs:strategy:fail-fast: falsematrix:- module: [app, cli, email-worker, shared, web, ws-do]+ module: [app, cli, email-worker, shared, wake-worker, web, ws-do]steps:- uses: actions/checkout@v7- uses: pnpm/action-setup@v6@@ -145,7 +145,7 @@ jobs:node-version: 22cache: pnpm- run: pnpm install --frozen-lockfile- - run: pnpm build --filter=@alook/shared --filter=@alook/web --filter=@alook/cli --filter=@alook/email-worker --filter=@alook/ws-do+ - run: pnpm build --filter=@alook/shared --filter=@alook/web --filter=@alook/cli --filter=@alook/email-worker --filter=@alook/ws-do --filter=@alook/wake-workercoverage:name: Coveragediff --git a/.github/workflows/publish-app.yml b/.github/workflows/publish-app.ymlindex 40bd2bd0c..983337f65 100644--- a/.github/workflows/publish-app.yml+++ b/.github/workflows/publish-app.yml@@ -59,7 +59,7 @@ jobs:- name: Build packagesif: steps.check.outputs.skip == 'false'- run: pnpm build --filter=@alook/shared --filter=@alook/web --filter=@alook/cli --filter=@alook/email-worker --filter=@alook/ws-do+ run: pnpm build --filter=@alook/shared --filter=@alook/web --filter=@alook/cli --filter=@alook/email-worker --filter=@alook/ws-do --filter=@alook/wake-worker- name: Bundle app (pre-build workers)if: steps.check.outputs.skip == 'false'diff --git a/package.json b/package.jsonindex 288ec4b92..776632a69 100644--- a/package.json+++ b/package.json@@ -33,6 +33,7 @@"deploy:web": "pnpm db:migrate:remote && cd src/web && npx opennextjs-cloudflare build && npx opennextjs-cloudflare deploy","deploy:ws-do": "cd src/ws-do && npx wrangler deploy","deploy:email": "cd src/email-worker && npx wrangler deploy",+ "deploy:wake-worker": "cd src/wake-worker && npx wrangler deploy","db:migrate:remote": "pnpm --filter @alook/web exec wrangler d1 migrations apply alook-app --remote","bump": "node scripts/bump-version.mjs","typegrep:ws": "node scripts/lint-ws-events.mjs",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 4a317b1ad..7e27952b1 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -16,7 +16,7 @@ importers:version: 2.13.1turbo:specifier: ^2.10.3- version: 2.10.3+ version: 2.10.4typescript:specifier: ^6.0.3version: 6.0.3@@ -62,7 +62,7 @@ importers:version: 6.0.3typescript-eslint:specifier: ^8.62.1vitest:specifier: ^4.1.9version: 4.1.9(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))@@ -102,13 +102,16 @@ importers:version: 6.0.3typescript-eslint:specifier: ^8.62.1vitest:specifier: ^4.1.9version: 4.1.9(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))src/daemon:dependencies:+ '@alook/shared':+ specifier: workspace:*+ version: link:../sharedcommander:specifier: ^15.0.0version: 15.0.0@@ -127,16 +130,16 @@ importers:version: 10.3.0([email protected])tsx:specifier: ^4.22.4- version: 4.23.0+ version: 4.22.4typescript:specifier: ^6.0.3version: 6.0.3typescript-eslint:specifier: ^8.61.1vitest:specifier: ^4.1.9- version: 4.1.9(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))+ version: 4.1.9(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))src/desktop:dependencies:@@ -231,6 +234,31 @@ importers:specifier: ^4.1.9version: 4.1.9(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))+ src/wake-worker:+ dependencies:+ '@alook/shared':+ specifier: workspace:*+ version: link:../shared+ devDependencies:+ '@cloudflare/workers-types':+ specifier: ^4.20260621.1+ version: 4.20260621.1+ '@types/node':+ specifier: ^25.9.4+ version: 25.9.4+ knip:+ specifier: ^6.17.1+ version: 6.17.1+ typescript:+ specifier: ^6.0.3+ version: 6.0.3+ vitest:+ specifier: ^4.1.9+ version: 4.1.9(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))+ wrangler:+ specifier: ^4.103.0+ version: 4.103.0(@cloudflare/[email protected])+src/web:dependencies:'@alook/shared':@@ -328,7 +356,7 @@ importers:version: 2.0.14'@xyflow/react':specifier: ^12.11.1- version: 12.11.1(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])+ version: 12.11.2(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])better-auth:specifier: ^1.6.23version: 1.6.23(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected])([email protected](@cloudflare/[email protected])(@opentelemetry/[email protected])(@types/[email protected])([email protected])([email protected])([email protected]))([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])([email protected])@@ -431,7 +459,7 @@ importers:version: 4.3.2'@tailwindcss/postcss':specifier: ^4- version: 4.3.2+ version: 4.3.1'@tanstack/react-query-devtools':specifier: ^5.101.2@@ -461,7 +489,7 @@ importers:version: 6.24.0tailwindcss:specifier: ^4- version: 4.3.2+ version: 4.3.1tsx:specifier: ^4.23.0version: 4.23.0@@ -613,10 +641,6 @@ packages:'@aws-crypto/[email protected]':resolution: {integrity: sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ==}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-v0U9S7gBIme3OTgt1LdbAF4RpvavCc+4GK1+1xqAcqtbrHsEhjQo6R45LKcjhs/+WrRJij1Y0Gztw7QPAIeUfA==}- engines: {node: '>=20.0.0'}-'@aws-sdk/[email protected]':resolution: {integrity: sha512-couDuDLpJtoeWne/nYyJ+I+5ntBVdNgBVRTCoDaXuVV7OC3u/wz5Ps0+GogspEwMLEFoOJ8t691h3YXQtnpQTw==}engines: {node: '>=20.0.0'}@@ -637,139 +661,143 @@ packages:resolution: {integrity: sha512-TDvHpOUWlpanc3xQ5Xw0y8L2hoojBFCCSmXQ/6rKqGOf1ScX3dMA+K9aF0Zp0iwjhSh4VvsHD42esl8XwQZDjA==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-MiWR/uWjxjFXGzrE0Ghc5lWxUxzHsUWFhV+OX7M4cR9SrmrnZs6TXavnCWnzzdwJeFri34xQo81rvGNzK3c4BQ==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-+Y5/4tHki0uYgyx8eun146DegRVQBpdKGK5RbV0FTKJPpaKTchvqVxrrRFK6Wk0JksO4iAZKw3eqxGEIwtO98w==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-liB3yQNHCM9k/gu/w36XHMKPluT7HTlnGUhRbBGSISDQkcr/Sy1zsZabiuvQj8WG5yW573u9RehrBvvnIQ9OEQ==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-P+QGozmXn2mZZI7sDgk+aUm+RTI61MPSFB+Ir2vjEjEbEsE4e7hYtzrDvAUxZy9ko81h53e11+F/GYlvwDkaOQ==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-XET0H2oofciJ5lMRWNIvRjAP7Q3wv2XT+JtJJEdhPWUMwe3TvQ9qcxonpu7vXmNngncvFpi4E2It+Tamas/naA==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-29wX9zpAvEt1vcj0psha+y6ygBHy2V/S72mp6e7q0KARLWXq+pwE/lR6qGkwknQvruh52lXvlqZIga8Hdxkucw==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-IAmc61hbgQiHht9U3x0tnRwz0lzdwOwD/i9voRgdJrKamF+JtmrBOsW9GwB7mfFonNWOWL4qARWYrF8veEMe3w==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-IA3CQTjtJkb6u1H4mE4936c8OPBMa9Jggtwe8U2Mqw/vvb/tZ5Ebd0mcZcX0uKWQhOyYo/+qNIwkV5Xh+FeJJA==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-hBBkANo3cDn+h2qxxzER4a+J8JCO9o9Z/YYmU7iky6AcaarX5RRdRcHNC6SLdwY0vAXQygn6soUbDqPn3GghaA==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-4mzII+3mZEVXXE1xzrLQrCJL7/r62A63bA6SVzZoNL5rqCJghpf+xgGltVrIBBs0n+mOZBKrQl2tRREtvZ5l6A==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-OyCLVmSI7pZO8hxwNVX6pXhTVlJqRBTp+ijdEfJSUj0RyjHnF602OfAarOzGq6wkGodeFkYBt8MmJ6A6ycRgWw==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-HG7kQCwXtbv3oBV61Ins0oNX8KKyvrMqqRkb6ZiAfQHbMuHaiNaEb2KnpKLPkNpqImSBK82UkVE/kaY6IfWikA==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-C8h36lBuC/RnBSsjlO+dn6xZm3KbAl5vpJaVPAfQnMmz2/OISmKOc8XZcqMQgO2ADwBYNRMM6Kf3vz9G/TulMQ==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-sDaBIT0yrNNIPfvlsiTCmANm07zKju+ipWODjEXgZlsjMeIJR3LVp7RDyAOzUoAsTbDfYKDWp+i5WrFiQP6rmQ==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-1FkOz74Ea5QGS9jtIoXp55T/IkSS3spv+nLTT07fRY/+T5xmEOqaYBVIaEmX4zTNvbV6g2lrtlaVKWEoNyJt3w==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-2k/amBifLd75eXNwgvPw/2lKYSQ3NhvHQgkVKVjfUq13/eJ3JRtHmznuFenn74OK3sSfp4SMy1YB2w+UVXoKqA==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-g2BoECD1q01kTPByi56+VLVvdWDzMkKIcr77qixpqH0okw2t0U5CoPv+6S8v/D1Y2Wa6QKKtn6XAtDzP+Kfpvg==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-LPc3+Y4vhH1T4x6CMqwCM6hk5+SRf/Lwmgm8INm95wxTtIRHcMwQUVkDzWu4Iw/RSncxYM2BC01OrYbxOPZvyg==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-GFfrjNXw+QteWbum8jD22G3T0FD/XiJEGp6r1CoqndMc6pxyQFoQ8nqTuNn1rbqYwqv4iCTl7GYoB9H17REKzw==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-wQtL34lUD/09VXjwAUo2T+I3aEXRDxMB3DKmTJL/Zj0Gi6sLDTrVhae1XVt01yzkquOWajI/sZW72JGDZ1ciTw==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-bBmkG0Dnhfq0/T4Z0PpUr7HkncBVaWvvCbvafeaUM+yC9wa8GGjLJmonq0QL17REB9WivgGeYgWQ5A80Uw5UnQ==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-UPiKWOcjAZcj5/t6l8vxcfkPCDubTKvwtx6yvZeylEg1nMlIi7QzGnuJkf+WFumQmAaN/6GtBjA84gLvdFr5XA==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-mqk95IBcyNViW9coBpx09jaSLOqlTn0ACVc3ItLvgcWvIi9mJHXyEBIXSt5R6lLQH0h5y+ew6fmks7zzSWm3GQ==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-itVdge0NozgtgmtbZ25FVwWU3vGlE7x7feE/aOEJNkQfEpbkrF8Rj1QmnK+2blFfYE1xWt/iU+6/jUp/pv1+MA==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-FMgyzUq3Jh+ONRYxryBRNdBd+FUX8PwRl07ccQknNdoms6KCeAEusCkl6whqpDrPQ6OH0ddeSifKyqYSs2DLIw==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-O2HDANa+MrvbxpaRVQDiH3T13uAa9AkMjKyZmDygwauAmmvqZ5B0iRmKW+fuVGW6NPXuyXurFgIx69lSvmAWGA==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-4ZrqJMJgJA5nMl6T73VxWCUtlmUjFqlleFB5Z6gq0xoxNABLqqfloN4N5prF81S/+jI3mUwt5vbOFyfDQOHzeg==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-wRIopAjPr4hUT1SnaM+pf4A3M90NjGDEMnmDf/rRN2P99sPRB/fnxllIVJcfAIwvFdK8nQLllYZt6V6k/5maBQ==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-qMgQSPemQq2/eW/e/0+SpY4kYR5L7dUgBiVdEc5bd+ztHNv07ZMYiI+sTiir3TgKndFfglSw/VFi7oZJ6bZ63g==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-sHiqIFg8o2ipT7t40B89Vj0ubSUtY6OSt/+Ee/OXhHch5K4+81zP2+QX8Lkc/nJ2QSmCySxOke7TEbmX69fe2g==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-POID/GDbM0tuuKT3IwMw+xnZcz8n8TQT+lOf478erp+QoK5VxI7kPpfIhnDZRJL39SryJvf8Y5BJxBc/+boiIQ==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-alAu9heyiBK/OmRNXVxq8mmPTgeW2AQ6EYjRsI38kPZa1MZvt2Jh+BlGq7/GG9OVXOaEgD7DlGj/Lzfy5OmuEg==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-gySy4PB75qf5x7WeAPWDeM2ISgqvdIkOz9+XmADrZOZEieXJ6uEVNWZybCwbT6PkAtBvetRdZKRb6gWzat7oJw==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-Q1wVLhOwOiifMJt12IK/reHZpGERbeom8QirjX4JxfxYYqhSjBR50JSZAXhrheI1pSYkL5wLGXJLUMJLdyS75g==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-+7IHKSEgEnkbVtM7fP+n0hh5wdOE6yt61kjAec+AXlNei6Xnh3u90Zwu2Amvgx80khpS3+YyUxzMDTBc5s6sew==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-hkfspNUP4criAH6ton6BGKgnm5dZx+7bUOy1YqlTfejDeUPAM23D81q/IX+hdlS3KUsfwGz5ADTqZWKBEUpf4A==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-sHrFs/rGno1LGLnQwia6XfWTEumZtZCjeCVOlzP13tdzfLHZ1t4hAe1LLP9jZXndguQjAaJq3QlAtwNVUD2QLg==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-uvoAP8dpzA2tAYek8fKaP9iGOYmrnZzWPlWAAs74gQdF0YbixpXE1ZOSClKq4PB5VADiVIIB43Vjc5rdOrw10A==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-GDfDQ0gwLFRKN9gWIKcmVrHJ3e7XagnY7N1LLzMVNgnOnuY7f/ALgmy3CuBjosWD95T/Z6e+gs1IeWmLPkyLKQ==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-VDMUHLeQ/yTr658HMm2eWS7e6qIFSxUeVbSA5zh4SNfSQ7ygIkJ0WeBoCnefw00Nsr5wNT8FIiAknJRTt058iw==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-56ifsBmK9bLn5EE/t6c0nmjOB1BO8cJDLkA1VOlsN1GR85ROqnaCwVDspqcwsLaBDgPlwyYNedoDIoT3t6Ho1A==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-/xNqNGXv9LaxZd25L9VV4pnSOw9OdDNO4rAHamM+h3KQBSITljIH9vk3dveGga1I2j36lQd0rdG3gjNEXvtNew==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-anh9EQWeOV11F/e5K8mej/Sfez2hzO5+cUaH4mbZRWEM+zLnfxbMOwo9YNwIWJhxf90J6QEFIDZljKfUlHhD+A==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-xn/GUO23lRdeyDsOUvUpgzOMTKlHt0U4F2L0vCqUzyunKILoWuxspi36hfP7GinIrnIcudI4zLFD5+7fiIP3SA==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-k9TiIMp9XT4x05pTROTXKwlP9M0/xaIxh31sRYejWU1cFvi6yr85JdPYiFhlZtPw701fT7tRTpPykuoinSjjGg==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-7PQvGNhtveKlvVqNahqWx5yrwxP7ecwAoB1dYBf8eKwfo2tzzCbNnW+q2nO3N066ktQaB4iBQbDRWtizm+amoQ==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-gO93ZPsI2bxeFZD42f1/qjDw6FAZkNZcKRO94LIiT03fzOmcJ9e/tunxjVjA1Rl69ClmVJzz8H3G9CdKef10PA==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-zXD7MSFgaxGi2CeURo9ZWKLNyXtfBUF0ByCHu4fdWa3WMu3YI8L0Mv3JHEDYBbYrUBPWBqSYhaXotxq0ADAGJg==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-1/wB+OZcNXM+OrEGLk3e7uF3xaTeNjWHXvpvMQx6XmL3o8JaJnn25zOTRh0PMWRYRxUQvXda6T1bXO1HVSqnNA==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-nWXXJ1r/r8N2Gw1pWolRgED38/A9A8DHR2ETWIv220zh4PZHcybbR4hUVWWktmNXTRHzDJwRluapHn0rZxuoqA==}+ engines: {node: '>=20.0.0'}++ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-Jz0mg/eqfChGZm0G4bzm6CpyEEtu9ThG1WHY3uE/hGjIUIXPsyVyTuQOetUsrU9QiYWMknmyIKIEHpZ69BHzrA==}engines: {node: '>=20.0.0'}'@aws-sdk/[email protected]':resolution: {integrity: sha512-TaWbfYCwnuOSvDSrgs7QgoaoXse49E7LzUkVOUhoezwB7bkmhp+iojADm7UepCEu4021SquD7NG1xA+WCvmldA==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-6L/VWs+Wch2stHemCGTmUNqKLMzURxQDK5boNG3Jn3kAOp71meDUuS5sbObpEvFxHDq0uWeSLFDNSYsjNt+Dlg==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-qs9z5LqXO/CZC2Lg9SGKpoLU8Rhi+m2pFKZqfO9pytX1clc0katqtsDNupJxFy0xT9wsZSPzM2v1y+/H/zfp5Q==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-pv80IzgGW4RnXWtft692chZOM9i6PhebVsLCcnaM4dBEPZva2fE6FXAHs76G7Rc7s3yGyX/68G0nZMrUy+Vmpg==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-QqZNB3so7UIDxZtroc85TQaLVxdZRFm0eWM1CSR2N+b06as9TOrilvrlTZuj3guYlxMs6yLOgGxnklJ5qMYtTw==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-pEHZqRkAlHfnfAU9tK+WpKv/gBNjGJrHMgA3A0iYRGyswBS2t0pfez+lWlwktb3Bqa0ovh7w/QJTFwp3fDxLNg==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-kuBfgQVdcz5Bmapc4A13YbpVw/pXkesfhetcFYwbntqas8sF41OHyd4o28+/TG2ZQdHBsv90Lsu5y6oitvYCdg==}engines: {node: '>=20.0.0'}'@aws-sdk/[email protected]':resolution: {integrity: sha512-9ebjLA0hMKHeVvXEtTDCCOBtwjb0bOXiuUV06HNeVdgAjH6gj4x4Zwt4IBti83TiyTGOCl5YfZqGx4ehVsasbQ==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-uUbMs1cBZPafD0ohUj6EwNf0fPZ534NvBxHox4hjX+0Rxq5paSYUem7+hi833pYrzrcnBATKIYpR02MDXT5M9g==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-WhlJNNINQB+9qtLtZJcpQdgZw3SCDCpXdUJP7cToGwHbCWCnRckGlc6Bx/OhWwIYFNAn+FIydY8SZ0QmVu3xTQ==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-VovINOiescSQAtKW5FMNi4pUr2sOufwuU0oingKLWuFIxIQL8U5qZJEW7/YV8goXRSMLhZ/3u2G2KbGxczAmGA==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-LiMxdKWw55ZJP4iABqeIuF3RPgWMa2Uc9ZXjZRXZywStvH1IlzU6t+dKzcjS5ZQpHsl2A0G8UXxuy1zDY93YTQ==}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-xMPFpAsNPks/EmVQjAyw57V9co/bqTk8Q3A3g8tAe9XVpisLj8fvJoqfxLF9UPhj3mblxorXs2HT2Z45FskYxA==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-sVUv711QtRMT8NYql9elQaAKCz8qopg+Y2Vf5ROLXeOqEWdYZp2g+9HBesTmLn48jDvI0i1khxPFKSwCjWaawA==}engines: {node: '>=20.0.0'}- '@aws-sdk/[email protected]':- resolution: {integrity: sha512-SzE4Pgyl+hDF+BuyuzxUSpwnuUu9lJuO1YGgteG89/4Qv0+2IQiVQqdbPV32IozLvXWQChPQcdkk/sKvb1QHiQ==}+ '@aws-sdk/[email protected]':+ resolution: {integrity: sha512-GH+Kjz4nPKWKHnsiQpnhP1MJdTGIcK4rAka6tzakgjjUkVgNsmPeEbbRAf09SzS1hjGu6duGHCBsxYke0BhHjQ==}engines: {node: '>=20.0.0'}'@aws/[email protected]':@@ -1050,36 +1078,69 @@ packages:workerd:optional: true+ '@cloudflare/[email protected]':+ resolution: {integrity: sha512-jWwmgEVVWbsHNrLSNXzwjJaH90VzRxq1cWkQFUidxyeUPnMxemeNE8I9qFAfrpzGgE11e9sKDcE3ettJW08swQ==}+ engines: {node: '>=16'}+ cpu: [x64]+ os: [darwin]+'@cloudflare/[email protected]':resolution: {integrity: sha512-Zd9Y1bah6DwwBN2RW8vJohffQrIUazb8UXnqSNecOxM+jJLhUuvv5IOG8dbHcV83TyZAubea6gsQXo2yH1lDdw==}engines: {node: '>=16'}cpu: [x64]os: [darwin]+ '@cloudflare/[email protected]':+ resolution: {integrity: sha512-LHH7b565g9znfCUOkwbec6FG2rmRbsgCy6aJiU9KN662mNheWl5sw/iKleiFSiljPKQQP3HkjnC/NSkdgi/aSA==}+ engines: {node: '>=16'}+ cpu: [arm64]+ os: [darwin]+'@cloudflare/[email protected]':resolution: {integrity: sha512-yBLsjS1qCWqFyCY37qRUrYfzHHvMGvjh8zRKJ6MvUivYDhkZTzqduppK38FoqYvayLJ5KbcxH7zo5rkxGqbsaA==}engines: {node: '>=16'}cpu: [arm64]os: [darwin]+ '@cloudflare/[email protected]':+ resolution: {integrity: sha512-FMnaAKXe4Cfd8TQurCVd9fs2XQVBFRCsP+Id/SRdUv89MlwYu9zXfoyx6BxM+brPTIUK38SHbo8iaxiwzLi9JQ==}+ engines: {node: '>=16'}+ cpu: [x64]+ os: [linux]+'@cloudflare/[email protected]':resolution: {integrity: sha512-vMfqSIMfoo4xmZXEuUVqLpSFS921YKjiR9q7kDXPi6Vld1PK74UHg9LZuBavT2KSyemHUCTpj9y/4JSYOEyQbQ==}engines: {node: '>=16'}cpu: [x64]os: [linux]+ '@cloudflare/[email protected]':+ resolution: {integrity: sha512-MRoifFYcqbxxIIQy7PqO5tFY/qPFSnjXzakWl0sO93l+HLyG35jRAgOi6jfqa4kBxc7gKKtH861DcewjxUfkjA==}+ engines: {node: '>=16'}+ cpu: [arm64]+ os: [linux]+'@cloudflare/[email protected]':resolution: {integrity: sha512-HRfwbKU2pK44V2NhoM0+iH0JJSj7nQ9Wv13ifIiGYCmTtDL8/zKtEhX7kQ3D4Vy/Cpjhttl0FkfqXj1aqLDPPg==}engines: {node: '>=16'}cpu: [arm64]os: [linux]+ '@cloudflare/[email protected]':+ resolution: {integrity: sha512-rgBV9wQrv0OSKgCTTbhFUFY3sLGNANZ88aqaLvtmEn2gmbFVb1J4PDGochVUdB7NSEp4D/ghHva6/8SZmbONpw==}+ engines: {node: '>=16'}+ cpu: [x64]+ os: [win32]+'@cloudflare/[email protected]':resolution: {integrity: sha512-ngxCiIN9s/fM2o1IBMD0o1/mcXrv2NJVdyznh51UH8sQuvrTrXvV2nM0Uj/qU2wMwF6prgNBcdcd7AZeZGiBQA==}engines: {node: '>=16'}cpu: [x64]os: [win32]+ '@cloudflare/[email protected]':+ resolution: {integrity: sha512-c4xrf4shZdDOK1ihh1UKzlS/3MDYiGThT/Oqr4Y3qR9NLCSNzHB7rt+Vk/LOp0ZSNjA+7WNJEQsOhpiQtpT2GA==}+'@cloudflare/[email protected]':resolution: {integrity: sha512-mOhf5TUEB1m2vPrxtqoIGfz0fUC9xyxRDx5gWHy5s+OCo6dcV+g7wI1R7gYCMFohhqF/2y2xeKVwMwCJjfn/WA==}@@ -1128,13 +1189,10 @@ packages:resolution: {integrity: sha512-GeDxvtjiRuoyWVU9nQneId879zIyNdL05bS7RKiqMkfBSKpHMWHLoRyRqjYWLaXmX/llKO1hTlqHDmatkQAjPA==}hasBin: true- '@dotenvx/[email protected]':- resolution: {integrity: sha512-/BITOC9dmS/edY2zQwZNicQ059O6RKabtQfyEafV0nGtfYRNHYy1DIPiYVcov40+tob9hfmBnbR963dS+EQ1DQ==}+ '@dotenvx/[email protected]':+ resolution: {integrity: sha512-WSmox5aD+XxJEUEOTk7gKLpd5+Iz9Nik89Zpbu5DijMln6LsFiv3xpNKBMc/b9sSkUlKvAblzrhik2TqKFE7NA==}hasBin: true- '@dotenvx/[email protected]':- resolution: {integrity: sha512-VYJy0uhFm9zTJ1TxBaW/pA8bjbOM/OttaNMwZ1RHG4JKyRG7DhSdiqD1ipQoAyoD22olUtxbP78W9xY3Wd11bg==}-'@ecies/[email protected]':resolution: {integrity: sha512-patgsRPKGkhhoBjETV4XxD0En4ui5fbX0hzayqI3M8tvNMGUoUvmyYAIWwlxBc1KX5cturfqByYdj5bYGRpN9g==}engines: {bun: '>=1', deno: '>=2.7.10', node: '>=16'}@@ -1162,9 +1220,6 @@ packages:'@emnapi/[email protected]':resolution: {integrity: sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw==}- '@emnapi/[email protected]':- resolution: {integrity: sha512-kyOl3X0DuTiT1h2ft8r2fYO8JYtU9a9Xis/zBSiGArNaagCOWx90N1k2wxp18czFDH+OgcWGb5ZP/XMt3dcyPA==}-'@emnapi/[email protected]':resolution: {integrity: sha512-3U4+MIWHImeyu1wnmVygh5WlgfYDtyf0k8AbLhMFxOipihf6nrWC4syIm/SwEeec0mNSafiiNnMJwbza/Is6Lw==}@@ -1189,6 +1244,12 @@ packages:cpu: [ppc64]os: [aix]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-lhRUCeuOyJQURhTxl4WkpFTjIsbDayJHih5kZC1giwE+MhIzAb7mEsQMqMf18rHLsrb5qI1tafG20mLxEWcWlA==}+ engines: {node: '>=18'}+ cpu: [ppc64]+ os: [aix]+'@esbuild/[email protected]':resolution: {integrity: sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==}engines: {node: '>=18'}@@ -1201,6 +1262,12 @@ packages:cpu: [arm64]os: [android]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-+WzIXQOSaGs33tLEgYPYe/yQHf0WTU0X42Jca3y8NWMbUVhp7rUnw+vAsRC/QiDrdD31IszMrZy+qwPOPjd+rw==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [android]+'@esbuild/[email protected]':resolution: {integrity: sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==}engines: {node: '>=18'}@@ -1213,6 +1280,12 @@ packages:cpu: [arm]os: [android]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-wqh0ByljabXLKHeWXYLqoJ5jKC4XBaw6Hk08OfMrCRd2nP2ZQ5eleDZC41XHyCNgktBGYMbqnrJKq/K/lzPMSQ==}+ engines: {node: '>=18'}+ cpu: [arm]+ os: [android]+'@esbuild/[email protected]':resolution: {integrity: sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==}engines: {node: '>=18'}@@ -1225,6 +1298,12 @@ packages:cpu: [x64]os: [android]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-+VJggoaKhk2VNNqVL7f6S189UzShHC/mR9EE8rDdSkdpN0KflSwWY/gWjDrNxxisg8Fp1ZCD9jLMo4m0OUfeUA==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [android]+'@esbuild/[email protected]':resolution: {integrity: sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==}engines: {node: '>=18'}@@ -1237,6 +1316,12 @@ packages:cpu: [arm64]os: [darwin]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-0T+A9WZm+bZ84nZBtk1ckYsOvyA3x7e2Acj1KdVfV4/2tdG4fzUp91YHx+GArWLtwqp77pBXVCPn2We7Letr0Q==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [darwin]+'@esbuild/[email protected]':resolution: {integrity: sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==}engines: {node: '>=18'}@@ -1249,6 +1334,12 @@ packages:cpu: [x64]os: [darwin]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-fyzLm/DLDl/84OCfp2f/XQ4flmORsjU7VKt8HLjvIXChJoFFOIL6pLJPH4Yhd1n1gGFF9mPwtlN5Wf82DZs+LQ==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [darwin]+'@esbuild/[email protected]':resolution: {integrity: sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==}engines: {node: '>=18'}@@ -1261,6 +1352,12 @@ packages:cpu: [arm64]os: [freebsd]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-l9GeW5UZBT9k9brBYI+0WDffcRxgHQD8ShN2Ur4xWq/NFzUKm3k5lsH4PdaRgb2w7mI9u61nr2gI2mLI27Nh3Q==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [freebsd]+'@esbuild/[email protected]':resolution: {integrity: sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==}engines: {node: '>=18'}@@ -1273,6 +1370,12 @@ packages:cpu: [x64]os: [freebsd]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-BXoQai/A0wPO6Es3yFJ7APCiKGc1tdAEOgeTNy3SsB491S3aHn4S4r3e976eUnPdU+NbdtmBuLncYir2tMU9Nw==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [freebsd]+'@esbuild/[email protected]':resolution: {integrity: sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==}engines: {node: '>=18'}@@ -1285,6 +1388,12 @@ packages:cpu: [arm64]os: [linux]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-RVyzfb3FWsGA55n6WY0MEIEPURL1FcbhFE6BffZEMEekfCzCIMtB5yyDcFnVbTnwk+CLAgTujmV/Lgvih56W+A==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [linux]+'@esbuild/[email protected]':resolution: {integrity: sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==}engines: {node: '>=18'}@@ -1297,6 +1406,12 @@ packages:cpu: [arm]os: [linux]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-CjaaREJagqJp7iTaNQjjidaNbCKYcd4IDkzbwwxtSvjI7NZm79qiHc8HqciMddQ6CKvJT6aBd8lO9kN/ZudLlw==}+ engines: {node: '>=18'}+ cpu: [arm]+ os: [linux]+'@esbuild/[email protected]':resolution: {integrity: sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==}engines: {node: '>=18'}@@ -1309,6 +1424,12 @@ packages:cpu: [ia32]os: [linux]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-KBnSTt1kxl9x70q+ydterVdl+Cn0H18ngRMRCEQfrbqdUuntQQ0LoMZv47uB97NljZFzY6HcfqEZ2SAyIUTQBQ==}+ engines: {node: '>=18'}+ cpu: [ia32]+ os: [linux]+'@esbuild/[email protected]':resolution: {integrity: sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==}engines: {node: '>=18'}@@ -1321,6 +1442,12 @@ packages:cpu: [loong64]os: [linux]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-zpSlUce1mnxzgBADvxKXX5sl8aYQHo2ezvMNI8I0lbblJtp8V4odlm3Yzlj7gPyt3T8ReksE6bK+pT3WD+aJRg==}+ engines: {node: '>=18'}+ cpu: [loong64]+ os: [linux]+'@esbuild/[email protected]':resolution: {integrity: sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==}engines: {node: '>=18'}@@ -1333,6 +1460,12 @@ packages:cpu: [mips64el]os: [linux]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-2jIfP6mmjkdmeTlsX/9vmdmhBmKADrWqN7zcdtHIeNSCH1SqIoNI63cYsjQR8J+wGa4Y5izRcSHSm8K3QWmk3w==}+ engines: {node: '>=18'}+ cpu: [mips64el]+ os: [linux]+'@esbuild/[email protected]':resolution: {integrity: sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==}engines: {node: '>=18'}@@ -1345,6 +1478,12 @@ packages:cpu: [ppc64]os: [linux]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-bc0FE9wWeC0WBm49IQMPSPILRocGTQt3j5KPCA8os6VprfuJ7KD+5PzESSrJ6GmPIPJK965ZJHTUlSA6GNYEhg==}+ engines: {node: '>=18'}+ cpu: [ppc64]+ os: [linux]+'@esbuild/[email protected]':resolution: {integrity: sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==}engines: {node: '>=18'}@@ -1357,6 +1496,12 @@ packages:cpu: [riscv64]os: [linux]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-SQPZOwoTTT/HXFXQJG/vBX8sOFagGqvZyXcgLA3NhIqcBv1BJU1d46c0rGcrij2B56Z2rNiSLaZOYW5cUk7yLQ==}+ engines: {node: '>=18'}+ cpu: [riscv64]+ os: [linux]+'@esbuild/[email protected]':resolution: {integrity: sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==}engines: {node: '>=18'}@@ -1369,6 +1514,12 @@ packages:cpu: [s390x]os: [linux]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-SCfR0HN8CEEjnYnySJTd2cw0k9OHB/YFzt5zgJEwa+wL/T/raGWYMBqwDNAC6dqFKmJYZoQBRfHjgwLHGSrn3Q==}+ engines: {node: '>=18'}+ cpu: [s390x]+ os: [linux]+'@esbuild/[email protected]':resolution: {integrity: sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==}engines: {node: '>=18'}@@ -1381,6 +1532,12 @@ packages:cpu: [x64]os: [linux]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-us0dSb9iFxIi8srnpl931Nvs65it/Jd2a2K3qs7fz2WfGPHqzfzZTfec7oxZJRNPXPnNYZtanmRc4AL/JwVzHQ==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [linux]+'@esbuild/[email protected]':resolution: {integrity: sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==}engines: {node: '>=18'}@@ -1393,6 +1550,12 @@ packages:cpu: [arm64]os: [netbsd]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-CR/RYotgtCKwtftMwJlUU7xCVNg3lMYZ0RzTmAHSfLCXw3NtZtNpswLEj/Kkf6kEL3Gw+BpOekRX0BYCtklhUw==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [netbsd]+'@esbuild/[email protected]':resolution: {integrity: sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==}engines: {node: '>=18'}@@ -1405,6 +1568,12 @@ packages:cpu: [x64]os: [netbsd]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-nU1yhmYutL+fQ71Kxnhg8uEOdC0pwEW9entHykTgEbna2pw2dkbFSMeqjjyHZoCmt8SBkOSvV+yNmm94aUrrqw==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [netbsd]+'@esbuild/[email protected]':resolution: {integrity: sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==}engines: {node: '>=18'}@@ -1417,6 +1586,12 @@ packages:cpu: [arm64]os: [openbsd]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-cXb5vApOsRsxsEl4mcZ1XY3D4DzcoMxR/nnc4IyqYs0rTI8ZKmW6kyyg+11Z8yvgMfAEldKzP7AdP64HnSC/6g==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [openbsd]+'@esbuild/[email protected]':resolution: {integrity: sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==}engines: {node: '>=18'}@@ -1429,12 +1604,24 @@ packages:cpu: [x64]os: [openbsd]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-8wZM2qqtv9UP3mzy7HiGYNH/zjTA355mpeuA+859TyR+e+Tc08IHYpLJuMsfpDJwoLo1ikIJI8jC3GFjnRClzA==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [openbsd]+'@esbuild/[email protected]':resolution: {integrity: sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==}engines: {node: '>=18'}cpu: [x64]os: [openbsd]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-FLGfyizszcef5C3YtoyQDACyg95+dndv79i2EekILBofh5wpCa1KuBqOWKrEHZg3zrL3t5ouE5jgr94vA+Wb2w==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [openharmony]+'@esbuild/[email protected]':resolution: {integrity: sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==}engines: {node: '>=18'}@@ -1447,6 +1634,12 @@ packages:cpu: [x64]os: [sunos]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-1ZgjUoEdHZZl/YlV76TSCz9Hqj9h9YmMGAgAPYd+q4SicWNX3G5GCyx9uhQWSLcbvPW8Ni7lj4gDa1T40akdlw==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [sunos]+'@esbuild/[email protected]':resolution: {integrity: sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==}engines: {node: '>=18'}@@ -1459,6 +1652,12 @@ packages:cpu: [arm64]os: [win32]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-Q9StnDmQ/enxnpxCCLSg0oo4+34B9TdXpuyPeTedN/6+iXBJ4J+zwfQI28u/Jl40nOYAxGoNi7mFP40RUtkmUA==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [win32]+'@esbuild/[email protected]':resolution: {integrity: sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==}engines: {node: '>=18'}@@ -1471,6 +1670,12 @@ packages:cpu: [ia32]os: [win32]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-zF3ag/gfiCe6U2iczcRzSYJKH1DCI+ByzSENHlM2FcDbEeo5Zd2C86Aq0tKUYAJJ1obRP84ymxIAksZUcdztHA==}+ engines: {node: '>=18'}+ cpu: [ia32]+ os: [win32]+'@esbuild/[email protected]':resolution: {integrity: sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==}engines: {node: '>=18'}@@ -1483,6 +1688,12 @@ packages:cpu: [x64]os: [win32]+ '@esbuild/[email protected]':+ resolution: {integrity: sha512-pEl1bO9mfAmIC+tW5btTmrKaujg3zGtUmWNdCw/xs70FBjwAL3o9OEKNHvNmnyylD6ubxUERiEhdsL0xBQ9efw==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [win32]+'@esbuild/[email protected]':resolution: {integrity: sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==}engines: {node: '>=18'}@@ -2030,8 +2241,8 @@ packages:resolution: {integrity: sha512-VVPPgHyQ6ShqnrmDWuxjmUIsO9gWyOZFmuOfLd9LfBGQJwZfy0gvv9pbHSJuoFNIYC7ZDX9aoFwowjcdSC4E8w==}engines: {node: '>=18'}- '@napi-rs/[email protected]':- resolution: {integrity: sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg==}+ '@napi-rs/[email protected]':+ resolution: {integrity: sha512-AWPoBRJ9tsnVhor4sjO7rkni+7p+2IAEFj6cx06UgP10jkQHqay/36uRV/bFkgrh18D9vb4cr8Q0Pthskgzy+Q==}peerDependencies:'@emnapi/core': ^1.7.1'@emnapi/runtime': ^1.7.1@@ -2131,6 +2342,9 @@ packages:resolution: {integrity: sha512-IYqDGiTXab6FniAgnSdZwgWbomxpy9FtYvLKs7wCUs2a8RkITG+DFGO1DM9cr+E3/RgADRpFjrKVaJ1z6sjtEg==}engines: {node: '>= 20.19.0'}+ '@nodable/[email protected]':+ resolution: {integrity: sha512-nyT7T3nbMyBI/lvr6L5TyWbFJAI9FTgVRakNoBqCD+PmID8DzFrrNdLLtHMwMszOtqZa8PAOV24ZqDnQrhQINA==}+'@node-minify/[email protected]':resolution: {integrity: sha512-/vxN46ieWDLU67CmgbArEvOb41zlYFOkOtr9QW9CnTrBLuTyGgkyNWC2y5+khvRw3Br58p2B5ZVSx/PxCTru6g==}engines: {node: '>=16.0.0'}@@ -2196,48 +2410,97 @@ packages:resolution: {integrity: sha512-/UhIkaZgPutTFmQ7RnIJGgDXZmtEJ7Dvi86xNTFWcnRxVRNk/aotsqDJYeEvDP+FSMB2SdW+pQzNMcWP0rwuNA==}engines: {node: '>=14'}+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-sHeZItACNcA5WRAWqF6ixriR4GkZDyY10gVgnZU7pXku1DjHFATSqnwZM809jl0gXPHxb6fKzYQCK7bNK5cACQ==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [arm]+ os: [android]+'@oxc-parser/[email protected]':resolution: {integrity: sha512-KDs+0VPdEmasOkpuJHW9V5WCF+cvYdMQv2Jd+aJXt+cxIx12NToRQRbXaRwUEDsZw+/jMk81Ve8ZFbjUkJTOwA==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm]os: [android]+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-wPte+SzgzWWFgMSF8YZDNM+tBXtJg0AXBi7+tU3yS2z1f2Af9kRLZLKuJojADmuD/cZexmnMHHC3SDItTW77Iw==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [arm64]+ os: [android]+'@oxc-parser/[email protected]':resolution: {integrity: sha512-WhALNzfy3x/RfC6bsqX+csavuUY0yHHE7XfgPE5M542uhoBZUUoGTPG+nkMbGoG4+gcfss5s7urMyn5QBHu0sw==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [android]+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-BmKz3lHIsqVos+9aPcdYCT9MG3APoUyM43KlEFhJMWNVDOGG8FKyiFz81Bc+mGz2o0hpuQ3PfXLfVWJrKXjo2g==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [arm64]+ os: [darwin]+'@oxc-parser/[email protected]':resolution: {integrity: sha512-bFPr5hgmNMOMoyPTGtdsK4Ug21RovIPojRMgDDhSp1LtCnc/DkLwGONKjgRjszg677RlGnkYSviQ8hHaUPOVYA==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [darwin]+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-dM8BS+8+Br1fNvmh2QZbGiHaYttwLebRa6J4Uz9vuFzMNmvsdRYwf7993ptOaV0JTrR63AaoVLjX7nhWbijxjQ==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [x64]+ os: [darwin]+'@oxc-parser/[email protected]':resolution: {integrity: sha512-CL5dMm1asqXIDZHg14FLxj3Mc36w8PI7xCWh1uA4is6z8g2XrIILoTcQYOxDbwzuk34RDPX5IAGUxZr6LA9KAg==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [x64]os: [darwin]+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-xlZnvvJdR9bGu2pOhvR5hMuKPHCE6Sa9owK5A484mzjHdm75VRV5nCs5w/jkmGODMMTFc+KN7EnZqEieM813kw==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [x64]+ os: [freebsd]+'@oxc-parser/[email protected]':resolution: {integrity: sha512-79h8rYGnSlKPGWo7mHr2ixO6ea7aW8B0CT965SZ8SLbNnCOH5aOYBTeVXUY6eMvEaiLyWr8Skuiugr5pDYgLGw==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [x64]os: [freebsd]+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-PSR8LmBK/H/PQRiN8g7RebQgZX/ntVCrdT/JBfNxE5ezdHG1s2i4rbazsRJYD83TTI1MmgTpC0MGL42PLtskQQ==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [arm]+ os: [linux]+'@oxc-parser/[email protected]':resolution: {integrity: sha512-ASgmlSimhGyr0lksgVIo6hibz1obnDq4qJbiMX/AzltfgPnanRrzG1Q+23g8ljOHOjv6dsznkUuCYL3gg0sY1Q==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm]os: [linux]+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-I85GJXzfUsigkkk7Ngdz95C217M4FdUi1Z2HrX5UyPmURobwQZ7m2bbUvwFkz4VGZd+lymFGKHvDZ3RQC9qOzA==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [arm]+ os: [linux]+'@oxc-parser/[email protected]':resolution: {integrity: sha512-AU2J9aa22Sx32wRGnDjybOU9TQXXQUud5sdUi+ZB0XxwM8aToWLweV+yA0wlQm0yIUVqljquqoHCYEq9II8gJQ==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm]os: [linux]+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-zqEY0npz0g0aGZj/8a5BclunjVDytsBQHYtIC10Gd26HcrLwbVF6YDbqRQjunMGYdSo97u6xOBl05aTDI2diDQ==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [arm64]+ os: [linux]+ libc: [glibc]+'@oxc-parser/[email protected]':resolution: {integrity: sha512-GdEtiG89yMr7XkUGxifgodXEEm2f+xW2f9CpDjlgAnBOwhTmrpQMvhOGobLVKUyzf/qHBXW16smk5zbF3nZU6w==}engines: {node: ^20.19.0 || >=22.12.0}@@ -2245,6 +2508,13 @@ packages:os: [linux]libc: [glibc]+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-mWAfprP819gQ2qYst1RxgTI8b/z0b29OpoKfRflIXLHde2dZLihQD4g47Onuvtpo5GPIkMYPRlX9QoeZfs/GnQ==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [arm64]+ os: [linux]+ libc: [musl]+'@oxc-parser/[email protected]':resolution: {integrity: sha512-EGJ+Bs8iXx8KBH8DQ5BLoEm5lnHaYjlh4/8j8vFhrr/6z4tqONy5BZDzLpKmmNWlN6Hlc5r8YOuBVHqZ9vRFEQ==}engines: {node: ^20.19.0 || >=22.12.0}@@ -2252,6 +2522,13 @@ packages:os: [linux]libc: [musl]+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-gri8c2AOmJKJwOux2KTHFBfUaXoJURuVMKhmKEi/2hTF55cQteTDV2XNfTiE5oCC+Tnem1Y4/MWzcyDadtsSag==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [ppc64]+ os: [linux]+ libc: [glibc]+'@oxc-parser/[email protected]':resolution: {integrity: sha512-vzFUQENy/fnbSe5DZWovq6tIBc1uhuMztanSW6rz1e9WdQE4gHwYuD7ZII6JnrJifd1R3RSoqiZbgRFlVL2tYQ==}engines: {node: ^20.19.0 || >=22.12.0}@@ -2259,6 +2536,13 @@ packages:os: [linux]libc: [glibc]+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-Y2tkupCG5wo0SxH2rMLG4d4Kmv6DaM3sBp+GuM5lox0S8Za6VxKgQrY2Mut088QQxKkEE89n/4CCCgmw2o0e3Q==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [riscv64]+ os: [linux]+ libc: [glibc]+'@oxc-parser/[email protected]':resolution: {integrity: sha512-SfVI14HBQs9gtLcUD5hTt5hsNbdrqSUNg9S8muN+LhVQ5nf1WwH3hAoK6B9NKgdYgWAQSXFXGiiBedQ4r/BKuw==}engines: {node: ^20.19.0 || >=22.12.0}@@ -2266,6 +2550,13 @@ packages:os: [linux]libc: [glibc]+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-xDRJq6i6WTynjeP+ISbDpyH4p9BaJ0wuQcL0lCSDkt9qOXC9dmwpOu1VG/TlwmPI3KpYntmO9nJCuc3TMTsNBA==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [riscv64]+ os: [linux]+ libc: [musl]+'@oxc-parser/[email protected]':resolution: {integrity: sha512-e7Ppy4FCIFNQxT/ikSeIWFoQ0l+N9vgtRBtLcyZXeolTzApyVoPqEXsYPrcdM/9i0Bwk8knvYd37vaEMxHyi6g==}engines: {node: ^20.19.0 || >=22.12.0}@@ -2273,6 +2564,13 @@ packages:os: [linux]libc: [musl]+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-V4MoUuiCRNvihxhIufRxvK+ka013V4joTSK0FAGA1KEjLuNprfH6N/Qw2uxQEVIFuNYMhD/hV6xJ/ptbzlKdHg==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [s390x]+ os: [linux]+ libc: [glibc]+'@oxc-parser/[email protected]':resolution: {integrity: sha512-Bho5qFwdhqsIFR7gipYEUlqvi3SRrY8sugxXig380MIaakBB1PyU9+7dBiBVScfImTNWhijUxdBwqrprGdq5WA==}engines: {node: ^20.19.0 || >=22.12.0}@@ -2280,6 +2578,13 @@ packages:os: [linux]libc: [glibc]+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-JCFZ7zM7KXOKoPAbK/ZB4wY0M1jxRECiem2UQuiXLjzGqS9+hno7mtX+qyK2F7HWK2xPhyJb+frpcOtk5DKOtg==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [x64]+ os: [linux]+ libc: [glibc]+'@oxc-parser/[email protected]':resolution: {integrity: sha512-36mGWtg7PyFzjJwGDkH6/F4o2nIDEoKXLPr/X/lwqklkomQwJJt1I5GJVmGhovUEmgPK5WAeAZMqlFCehwiy9Q==}engines: {node: ^20.19.0 || >=22.12.0}@@ -2287,6 +2592,13 @@ packages:os: [linux]libc: [glibc]+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-9jSVS1b3hOV7sdKH4aA2DFfnTz0RgQd0v2BefR+LYbH8yIlmSM22JJZbAAjVeVXmFgUAk3zJQ1tpE/Nd+Vi2YQ==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [x64]+ os: [linux]+ libc: [musl]+'@oxc-parser/[email protected]':resolution: {integrity: sha512-/Jqx6+N7A44n2BdvUr7pXhVr2vFjs6WGH3unZRczwrfiH0H1zY0QwKQMG/dtRiTlKGDKGukznPT8lx84/oEsZg==}engines: {node: ^20.19.0 || >=22.12.0}@@ -2294,29 +2606,58 @@ packages:os: [linux]libc: [musl]+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-M857ZLBSdn1Uy/SJJz5zh0qGu67B4P9omCgXGBU2LLqTzraX6ZjVNaKq5yW1PDw/LgJXDXR/dbZfgmB310f11Q==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [arm64]+ os: [openharmony]+'@oxc-parser/[email protected]':resolution: {integrity: sha512-9Uj0qHNNl+OgT1UTGwF7ixIXU6T1u2SbMidmgPy/h1h/fl2gRS6YpAxxY1gwHofcWjoTwkoMFd8xs5Vuj6GOFA==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [openharmony]+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-2w6DVcntQZX9U5RhXtgiWb3FLWFB5EcwI1U8yr3htOCJUJjagN4BFUHz/Y/d9ZsumndZ6ByxxWEtbUZNE1bfFw==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [wasm32]+'@oxc-parser/[email protected]':resolution: {integrity: sha512-gW2vfkytNGgMVADiuzdvOfw0mWG9za20F/1fCJsif5aBMAvWJTSbpIXbIe0XkOe0VENk+PadpQ7cZgUy2sUJcA==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [wasm32]+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-rX1U8+IH2Z37EJjDXKa1iifvUQAdba+vZ4Ewj1iaG5eA/QaSybzclCOwtWa0/5BuUQnnK/T2JHUEFrwhL6Ck2Q==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [arm64]+ os: [win32]+'@oxc-parser/[email protected]':resolution: {integrity: sha512-x+pFANF0yL5uK/6T7lu6SlR5qid6sp//eZXKLq5iNsIE+EQg6EaS8/wsW7E91nXXjpnPhSoMOHXShSVhGRdn8w==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [win32]+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-9FAisBbH1QICGAjlJobiuKGd/jOuVmyqniWdQMwTa5SkCl6hhuotBCJf1n46B0flYbSOR5TzfV9HZCWSyb3c/Q==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [ia32]+ os: [win32]+'@oxc-parser/[email protected]':resolution: {integrity: sha512-sQUqym80PFi6McRsIqfJrSu2JrSClEZIXXD+/FjAFoULEKzOPsldIdFBG96xdX8aVMzCNQ9792FPx3MfkEIrFA==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [ia32]os: [win32]+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-wYF+A2AzJ2n7ul6q+Z2G/ia0S2+8cUp0AgWZzoFvF4WmUcl1P7p+o6se1Gdr5wGnWuF0iAMIkGddrjCarNr2yA==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [x64]+ os: [win32]+'@oxc-parser/[email protected]':resolution: {integrity: sha512-2AsevxlvNN4WKxpEn3RtqD5zbqMaXF+T7JXblsP4gVuY+vC9dXS4ED/PwfRCliFqoeisYS3Iro4DHzxr0TEvVA==}engines: {node: ^20.19.0 || >=22.12.0}@@ -2326,6 +2667,9 @@ packages:'@oxc-project/[email protected]':resolution: {integrity: sha512-VBFWMTBvHxS11Z5Lvlr3IWgrwhMTXV+Md+EQF0Xf60+wAdsGFTBx7X7K/hP4pi8N7dcm1RvcHwDxZ16Qx8keUg==}+ '@oxc-project/[email protected]':+ resolution: {integrity: sha512-wR+xRdFkUBMvcAjBJ2q2kcZM6d+DKu2NgoOyxZgYwZdLhmiv6+rnO8PZ/P68kMiZtIKm+pW7zyEJ4kSOs0vo+Q==}+'@oxc-project/[email protected]':resolution: {integrity: sha512-WT+Gb24i8hmvo85AIv2oEYouEXkRlKAlT9WaCa3TfLgNCN+GhrJOGZuIlMouAh38Qe4QOx26eUOVsq70qXrywA==}@@ -2620,156 +2964,156 @@ packages:resolution: {integrity: sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ==}engines: {node: '>=18'}- '@smithy/[email protected]':- resolution: {integrity: sha512-kUY1m60FASy0ijf+0vEuZ7v+WqFlCAyyhvLkO/A15wY0hK2BLEN9Wszf/Uc3PDJWlqnrwRf+lNXOmzyds3Eflw==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-jqADOFCkuSqluoEPjxWTFQ/6Xfsmt4Xi3IelA+c+4WdavqCijGGfWi873VqfIZeSFvaBpYeH+PKHC3POE98KlQ==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-mLUktFAn+Pa2agl1J7VgtYNFWCX8/b4GMJSK1hCu4YCvtBfM6F8Os3EP4ry+DFFlXOf3wyvlgXhuUdFoy52D3g==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-3UNRKEyQyAgVgM0LGlerCLm+ChZWZ1GPfde+jBEW6bm6bSBGU1p0EbblaUV3unbhwvidjLA5Zs3sOs7mnZwvAw==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-18UMDMyrAbDcpmL1gLUA7ww0fRTcdCrSjSJOi2Sbld+tVjwD/pW+OAwjlScFLR7vvBnhZrIPQ7kVuTf1mnJLug==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-vKW0MEFRU4Y3MkVZUkpJm+g9qyPGLCXhc0YLggUdSdBB4g7IaSSsCE75P9rBXyWHrXY1UYSQUl8/DwsTR7QciA==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-xXAIZfacQ2FIVVyeGndsTI41xhuiMtWJfYrtGLbQJVLNylJQ97IzwtTekZrNWep0aXVqtHrHeWA02tOb+ordiA==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-9szC3PfHhYSvWA98CIrD6rB8jS60tfKOPvDlzyD87gsDm8KDnsSpXnwPO1J3bPxg0tWE6Ljzk2YzZV2GBe3nUQ==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-6G9r/ohzSuPYFw7ZCxllFedhIHzeFN2xPF6IJS7AzsNoM01shAYivpiLTMyc4/6efiDr7dgHuHkFZNPH5d9cmQ==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-Q28S5qVeHIGXY4xCO43IFglVCc11HXZlxdhUhcNgiI/ArVDi6SWOMLvWEq1woUQtThNxH3CPbz6l1Z2PT6gl8A==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-fqCyZy09BYiow3pEQpNc4NMRElo6P92bOCwjixvkhjFFmnG7zXbinKooXhZLvR39osfFCn35Jdt1Ax2GtY/Yqw==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-QxrsfEjVwpx2rzu0ZRc+F1MFSVh9pnjJayHzxjy3l3ru2zp7yt9FsYnDBHmdZV7389wqc1poK84vf5v3lArSaw==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-Ei/UK/QMhq0rKaMqGPlOAkE2yS9DZeYmZdk1RAKc3vp3zxgleZHZyBLlZv8yLsxljX4svCRuMTD6u3LLIcU4Bg==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-qM7AUKI4G6d7lNgaZD3lA1tWSolh5r6gcixfTZAPstVURfjIbvreVTPz+994M0yC3HbX4YYhDRgr31Xy3XwWOQ==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-/LxWIgg/8MLmg79n0Ki/yMDZREBlk8BqB0amIj3PMTPzWSAqgsHzbbRUeTFRBKhgB299dmCALp4CIpViYVb82w==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-HQw/cCLjoAatHffbVQxanPfDRYFt3NMhAENub1/Pw0iftGYGSS4+4C+G1D7CCJXW5/wR6AIhLT7xPusMqy7qjg==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-M/8PUgwzekn0GcMBjcrTXV4PGFIe1AKuMuHjkHNBfofCPQ9+9Nr35lCvRfQK9BwYHQM+LKiKj8GY0pXSwYm6qQ==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-LfXN/tUjjmUkEaMWto96a3Xetk7u4WMruzFop7mtsIYY2njTvTQm/zsok9KpwztzOL3WSBfv+hikxkJhArv8xQ==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-/Wwc5EGfrThispagO3GI2WUhfEWJp8X7Dkyy7X5r4tvWYlw32rsXlj/yqxfLbCXiAFBBFym0+1umoKpXJclpqg==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-wuwVYqGNP9RwLs5hU2nTg8ajL16lA27VX7oGrsarghiqOhAtGYWQQ2VNtotKCBra5t4Od+Epi5jYktm0JwDuIQ==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-GjmewKjtK4GQlWmKTIXABHTCW6z14kebGnW1P3CTvP9WWp0nmydkb4yhjkuIWlpXkAJfcAO3cEfRLeSATaEKSQ==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-lByqayJi0EC8wAysIA93QwN4C1ofppNk5YXt8QS4Zo2AVHxGWspkwvYGP/5WLO4jsdHDsEc+KAdmqJBP9eN46g==}engines: {node: '>=18.0.0'}'@smithy/[email protected]':resolution: {integrity: sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==}engines: {node: '>=14.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-5unOz42+nG/XkoIb0Kqzi+PGrHIaQaMYJTv8XHQdPSxENPK5TzIAmdBkjMA1L5yc41qMXUSMaHZpNuE7K3qbiQ==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-drsFcLEIjFtmDF8Ta5STY7zTc89L24qL+G2f+YGo2oeoB3OW/6zjhKwW8/nCTS45AAFSyh81UgJ+Jl+Gs0ovnQ==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-yaZdk8sbKxDell/mN1OPwEwnZ0m7sTGkUK6OKlvWyCvPykAqojHEMjfLZlHdaMhIaJ2E4Jr2qMzLQHn9gp02DA==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-dI6ysYleXIHUDVsJ8JKR8m9zUNo29y43D6/evJcfY/JREgBrXpWbBavs1EAJIPA5+d7DBlepqSCIWveWiyO1jw==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-uCYuVrw65beEpzQszGK7uiDK3Gk0HlzsZuN3JNjDM05/dwwEheg7gF4DKYWH8dpXK7c634GUfkH/vG5XuR9z2w==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-vfaUGI2plIGPeiYlUwtC2IccLKR5XwPLCPzMwRF/dDlvMtVuy6L7Klx2LThoU3nENR294j/48Tn9alg/3teV1Q==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-QldB+7GcqKGVyjxTq5tpuHRFQKQJRnIETx8tdpEwYu5fHZR7z5+SM5eGd/TZqkUkV/6vUHgiiDVmmqjsobzPLg==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-KOAlkv0/6yYLLXcJNTWq116q+ezv3i0+TQNg13hExZLUBwLvBj9ipP7f1+sAfVUsfYG/BFuF2nX6BRoKHFqt1Q==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-Nx6wuSMasSazyIC02cmmSF+jEGnBpVL6u/Ra9J+AoKQyX1Uwxqf96fSoD6G+D1SKqw51GVNC1V08GtJPe8Yhaw==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-J6JfVBmp3Z8ALEnIVJOyuBYr+xl/oIEvDY4qc9vbGXdgPZRYEYOrenXGhH7NnC2SDOWtkg8pIGw/yaTZTYDzrA==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-yWvlZxqgmk0ZiRd0QVzSAqvdkREeiw2boqT+DTbyi03ylx3LyYGs5hNvRjks5ay0cDotZ7H0AdG2tJDMy+IxgA==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-fMuimMAsXCcDjWSNXeVitzQeWYKxvFmBbWVnYf1qLC5PaFbDBF0DcWQKSnqDY+QaaSzLIh+iAU3TaEWdGEeCfA==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-kGnGhU7v/VSlKjcUHUNhMQ1eDiGKjDF6OlGlOWcilgsyR6Yyq4sDbEV6vs1RD8+xqj1OPpCYt817KAM44ymweQ==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-mD/K1A5WrTZh6I23x1ScYo3K7/+Ujvp/zvLtaZT+xkDeXksWAQ/fKp60SudeUHUHQe/3Q3rgnfedJDqnxSKdpA==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-wfl1uwrAqMH9/pi4kqBo5LBcFwrJLxuDLqL7p7qNcJIFcyZDUc6pzhYk4CYv+DP7fIUpQCZumwNnkhPKS52osQ==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-HIeF+1vrDGzPkkv39Hj2vlHSXHY3p958jd/8ZnePIY6+ZOsQX8coyEUKO5yQu4r0bQIVsbpotVIrXXwyycMStQ==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-ZCQGk/UNS+YF5D+Jmhr8+PQX2PJKe4QzR6zuOR5sUinxO/ZiKNA7nyrbeO/Ds2hXLts3fZAtgLPKLJgvjCX9uQ==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-5VdJYIYsVt2GT+i0fp5gvWoJNrdFEFN16TrpNnAZHngYC/xgk5yni6O/qV3WlIpJjeLC8RfwoQiNTljCdbNXgw==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-7xHpmPY4rt0IOmeAA8EfjgEH8isT+587TCdy9H6a7d4OMi5CQ0oEHhWllunvPu4j4Cq0vTFwdxXN/kABWPjdyA==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-e5UtkMvsatzBfbeBZjEOt0k0Z3BEsjTFL/n6fdO5vtBLe67tdy0dX7xw2DU7uZ3acwoHyeCqpU2Fzb7pxwHb6Q==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-H3fp0F/IhG8a6qnoWHeGTH1qDPRR9VVZjcxM9NMXPB6nqzaqcoYIX8D4FFI1Ap2siGr+yvYgKqHC76+afBgF1A==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-Lg3hCVv8oVYlnQus1x+1hlNoLSrcdOhkg2+Be5YUxkI1LbCEPpcwEdYfz+0j1sQSmEixA/UUbxW41CiN/+aigA==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-Z5TAOxygoFvybJV3igo5SloFflSokHx2hu1eFA+DxDTcn+FtKxUSui+rbTRG1pAafMA888Z3MVvCWUuvCrTXjg==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-P+otAxbV4CqBybp7EkcJCrig63yE2E7PuNVOmilVMRcx/O+QDzGULTrKsq4DV13gSfak9ObPrWaHl/9bL5YcWw==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-vx7FUYJMRfQqdqPRLYwpisOuYU6e1PaabcPUTEc7xG6X0VEr4B6PnjZloHz67qva0pQ9/eNs3xPxvQ6w5gRGAw==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-Acgxr0W3vdmDNZKafjpDFaG2t32zNYVd7B5D3Y9LQep264+6pP/K/4ZXiAfW+ztMYB0iBG1kZx19EmRBd9zA/g==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-OQKnJft8J4KPJyL4K3w3XpOvstpZUbPdcs840dH+JTp2w+v8Lce8nxzUoeOiAIRIhnWFQd7FxAjkZ0OkpX6jzw==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-f3zLXiAzY3oYDdubxW//QLk5KEngThcNQhKvcLGGiYNEzYD7B2PXwLjUZO7joB9wfvihflzPJilMest9Q9bj4Q==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-PTdWf5ApVEJQvnCaAJJPFHkJcUUY5yImYEcfzPqFP8ytet2oI0P/2nCF2t0600MkAH/MC9ne8SvgcRKh8Ooqhw==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-ddbTlVHnjDflrReo1VlhPpomb0DlgqEhk/I++OS44Y4PEE0QnzOdJemUo439vNYEFjtJvZd1p9CBe/lcxpontg==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-KaT3bRb0khPrjXsXzyAi47F5aKOqBLypDhhvVC7p65AoZCPPAQ4j8KB1oaK+TKf6k5XFgkAY4gMK1EFr7xh5Wg==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-e3pKOHP/UjTV4/2gMdjcgelvX8DGS6Yy3jSLWh47HvsyeD0fc/V4kkSYfhOjEnV4CizPn9gQojj2q9MiZQcJDg==}engines: {node: '>=18.0.0'}'@smithy/[email protected]':resolution: {integrity: sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==}engines: {node: '>=14.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-VexZx4D0vhOeXNLpmxgXK0s9CNV/jCSfjBDWS7YNjZ47K87rTzmgovr8s0CgOLASIkCAS4aAbTqIG4YzU6zduA==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-/TWNfyCtJHHIS5taeOQ1qcMUCr5xPqdFntDL5+Sp8sjGj29ZaFUUxlCP+6V//J7MhHZZ2PIe2kMh1YdOpaEPnA==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-nhmz4D2s2FGFTgWf8M2bQHCLKjJbCQBS91waDofexbptBESTExtpEgiaI0rWIP4MhAarCCdFapHdvlCoknBE6w==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-kFGsCILX13YE8troSVPB6AdEAzjbhJ/XFCaEgFGEBz1I17+wMVMBO1WxKxU27GlxBFQy643Jy42RgT8wf8X++g==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-K50/sbl8HRnBJt5+UYvIG8HCdEDNA9rhCmkWTDftzGMlJ4XlPgtqI1V6jTSi9tmK7MLfgw7CfGvzSKFSWOteOQ==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-RtzPUniH4R49dG8X2MeOi9UzcNwh8C8lEADOGItnAMifxljQgCbuUOpvciX7EnEEJ5H2T2AXvEdOuXSe0bKdaQ==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-Xk039bCOxEZfasaHSHPj0QS8EY2npd0z3nxLkDvczg9ueF7eboiKw0HEa5pILLwjb+sjSlgzSjoCOVAM715TzA==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-jzWo5fD5FYdGlfqx+kpp5BoOSG+TYQczYY6Ue2QX4linDq+5q6t2/RtO53nABOZjD+qYSSaVd9RalyMIPbxk9Q==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-iinqHq7WnWWKQUCObyu4YBzXROJO8dHMQrM+pvut92rKgjhcLNHel8QVJNsIswjPLOEJffq6sYjOdq/ndOrIAA==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-4upfJJ+jayyqd523zopC5Ad7XxMp+rpeiqh0QtiZGBvdBB7KBBtHVEtraHNnlzkQuytvkU5yyg6Ckf3ApJ3A5Q==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-/JZLMlF/pzY7QIA5M70bKSq5Bz/JpGLHiLlttvrcZpfLyGSCR3BvIebbipmCvSsnLXnU2pGDsDgD513N1/GGVg==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-mkc/JN/fPiaHBAhhp7LbwAQz6RFjrCkYZ4F3OK2ZAWbmkjDQmAyNUmoDcQDVGWF9U+13+fWPszCXFHLP/8NnAA==}engines: {node: '>=18.0.0'}'@smithy/[email protected]':resolution: {integrity: sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==}engines: {node: '>=14.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-N5CpfaL+/LPQU9PFdOT55ayUo5T0QypG4Almzd1/efJvoDypuT1shkgJk1+hhg/02scYluW6Q2JGnSHIPwCEGQ==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-s8lfXcv+5C2GjBwGUBqFLgNmhyp9/n4TSKbOzKlIqJ/x0L/zwIxjNBC6DN4xUy59NvOrsiZI1t3tWi4ADUDyNw==}engines: {node: '>=18.0.0'}- '@smithy/[email protected]':- resolution: {integrity: sha512-T3ufepn0F6XHrBAIVictKbn2mgttM6bNWRvhYdy2UJtaMEhdKnvDWJ4aoTY4nVF+yLhPETFMMLy1cn36rxOWOg==}+ '@smithy/[email protected]':+ resolution: {integrity: sha512-Qt+W1pLeV/gmsXXUKbcolZqSGwnEdcxM7tqZjtGazkJ4feMUX0Vy+mCZGyhCwLvO8qxsrhYlmRZ7FLGUxJ4Scg==}engines: {node: '>=18.0.0'}'@speed-highlight/[email protected]':@@ -2796,69 +3140,72 @@ packages:'@swc/[email protected]':resolution: {integrity: sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==}+ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-6NDaqRoAMSXD1mr/RXu0HBvNE9a2n5tHPsxu9XHLws8o4Twes5rBM2205SUUiJ9goAtadrN6xTGX0UDEwp/N4A==}+'@tailwindcss/[email protected]':resolution: {integrity: sha512-yWP/sqEcBLaD8JuA6zNwxoYKr75qxTioYwlRwekj5Jr/I5GXnoJfjetH/psLUIv74cYTH2lBUEzBkinthoYcBg==}- '@tailwindcss/[email protected]':- resolution: {integrity: sha512-WHxqIuHpvZ5VtdX6GTl1Ik/Vp2YuN42Et+0CdeaVd/frQ9jAvGmvR8vLT+jk3e8/Q3x8kECB9+R17pgpp2BulA==}+ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-SVlyf61g374l5cHyg8x9kf5xmLcOaxvOTsbsqDnSsDJaKOEFZ7GCvi84VAVGpxojYOs1+3K6M0UjXfqPU8vmOQ==}engines: {node: '>= 20'}cpu: [arm64]os: [android]- '@tailwindcss/[email protected]':- resolution: {integrity: sha512-GZypeUY/IDJW3877KeM+O67vbXr3MBnbtEL4aYhNErv/JWZhye2vGSWWG9tB6iiqR2MqRNkY8IOUy4NdSZV26w==}+ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-hVnWLwv+e/l7c4WKyVtHVrIPvYdqWHjRB3MDIqARynzFtnQg85kmQEFCbV9Ja0VVx4xXTIiDWY60Y7iz/iNoDA==}engines: {node: '>= 20'}cpu: [arm64]os: [darwin]- '@tailwindcss/[email protected]':- resolution: {integrity: sha512-UIIzmefR6KO1sDU7MzRqAxC8iBpft/VhkGjTjnhoS6k7Z3rQ9wEgA1ODSiyH/tcSYssulNm4Ci3hOeK1jH7ccQ==}+ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-Cf7abu0WVgbhU7ANgPUnSAvm7nCvMweusHb8FnaHlLfv/Caq4GYaEZg7ZImzzmjx4lIAfuS8q+eLIS7A7IzxIg==}engines: {node: '>= 20'}cpu: [x64]os: [darwin]- '@tailwindcss/[email protected]':- resolution: {integrity: sha512-GN+uAmcI6DNspnCDwtOAZrTz6oukJnp337qZvxqCGLd3BHBzJpO0ZbTLRvJNdztOeAmTzewewGIMPb0tk2R4WA==}+ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-ZZqzX2Y+GXtXXfqSfpJhDm60OoZfvLHLCgm+J7NVqgHHJjG/m9ugZI77RwTsVd4fnBJuCFP6Ae6kTJb71UdS8g==}engines: {node: '>= 20'}cpu: [x64]os: [freebsd]- '@tailwindcss/[email protected]':- resolution: {integrity: sha512-4ABn7qSbdHRwTiDiuWNegCyb5+2FJ4vKIKc3DmKrvAFw7MU1Lm11dIkTPwUaFdTzc7IsOpDbqBrlh0x6y36U/w==}+ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-/Ah/xik0LaMYfv9DZ0S/t4pBlBNYOcqtRwusjgovHkvT8ixueWCLyJjsaF5kQIckjb4IT8Q6K6p/iPmZMixYgg==}engines: {node: '>= 20'}cpu: [arm]os: [linux]- '@tailwindcss/[email protected]':- resolution: {integrity: sha512-wDgEIGwoM8w8pufh9LVt1PahDgNdKXrLC2qfAnV3vAmococ9RWbxeAw4pxPttd/TsJfwjyLf90Dg1y9y8I6Emw==}+ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-gqdFoVJlw444GvpnheZLHmvTzSxI/cOUUh2KSNejQjTcYkW062SVD+En0rUgD+QV91bz1XGIGtt1HJd48xUGbQ==}engines: {node: '>= 20'}cpu: [arm64]os: [linux]libc: [glibc]- '@tailwindcss/[email protected]':- resolution: {integrity: sha512-J5Nuk0uZQIiMTJj3LEx4sAA9tMFUoXQZFv1J6An+QGYe53HKRJuFDi0rpq/tuouCZeAbOBY3kQ6g8qeD4TUjtA==}+ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-Bwv9KwOvE0VKa86xPFif9b9c3Y1NxOV1P0gLti/IYaWEsQYZXDlxfGEtA8mdDZ7SG3wyNXAWYT5SIn3giL57oA==}engines: {node: '>= 20'}cpu: [arm64]os: [linux]libc: [musl]- '@tailwindcss/[email protected]':- resolution: {integrity: sha512-kqCZpSKOBEJO4mz7OqWoofBZeXTAwaVGPj0ErAj7CojmhKpWVWVOnrt9dE8odoIraZq4oj3ausM37kXi+Tow8w==}+ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-Ymi8O8T15HYQdOUWUtTI6ldN0neHP85FC+Qz32xTcZ7iJXtem/x8ITev0o1e9e5rkqj4lONZfTRLvkmin1+tKg==}engines: {node: '>= 20'}cpu: [x64]os: [linux]libc: [glibc]- '@tailwindcss/[email protected]':- resolution: {integrity: sha512-cixpqbh2toJDmkuCRI68nXA8ZxNmdK9Y+9v5h3MC3ZQKy/0BO8AWzlkWyRM7JAFSGBlfig4YVTPsK6MVgqz1uw==}+ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-M+P/91qJ6uILLw4k2G93GMDRAXj61SMvFQYt39AqvUqYgExXpLL5aepfns7sj4HiAQeolirQF9E0lzRvdf4zPQ==}engines: {node: '>= 20'}cpu: [x64]os: [linux]libc: [musl]- '@tailwindcss/[email protected]':- resolution: {integrity: sha512-4ec2Z/LOmRsAgU23CS4xeJfcJlmRg94A/XrbGRCF1gyU/zdDfRLYDVsS+ynSZCmGNxQ1jQriQOKMQeQxBA3Isw==}+ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-zsM8uOeqvVGHsAXsJxsT28ttosFahLJKCLOTUBqRAtKnVgGSRitds9T432QiT8b77Yga7JIBkulIRRlJPtYhRA==}engines: {node: '>=14.0.0'}cpu: [wasm32]bundledDependencies:@@ -2869,24 +3216,24 @@ packages:- '@emnapi/wasi-threads'- tslib- '@tailwindcss/[email protected]':- resolution: {integrity: sha512-Zyr/M0+XcYZu3bZrUytc7TXvrk0ftWfl8gN2MwekNDzhqhKRUucMPSeOzM0o0wH5AWOU49BsKRrfKxI2atCPMQ==}+ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-aiNvSq9BsVk8V513lDKlrCFAgf8qBMPZTpgEhInL+NwQqs97mYmupVMrPrgBBSL8Pv/0zXu9MrMF9rMun1ZeNg==}engines: {node: '>= 20'}cpu: [arm64]os: [win32]- '@tailwindcss/[email protected]':- resolution: {integrity: sha512-QI9BO7KlNZsp2GuO0jwAAj5jCDABOKXRkCk2XuKTSaNEFSdfzqswYVTtCHBNKHLsqyjFyFkqlDiwkNbTYSssMQ==}+ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-xDEyu1rg290472FEGaKHnzyDyh5QH+AlWvsU5hMoMtPpzmKlRI0jaYKCgSHDYtaQWZOYbMaduSyCwFwY4n1HmA==}engines: {node: '>= 20'}cpu: [x64]os: [win32]- '@tailwindcss/[email protected]':- resolution: {integrity: sha512-z8ZgnzX8gdNoWLBLqBPoh/sjnxkwvf9ZuWjnO0l0yIzbLa5/9S+eC5QxGZKRobVHIC3/1BoMWjHblqWjcgFgag==}+ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-yVPyo8RNkabVr3O2EhHEE0Rewu7YKzc1DhIqfL46LKveFrmu9XbDazNOJY7/GRuvw1h6u3utWnR29H/p5JPlgA==}engines: {node: '>= 20'}- '@tailwindcss/[email protected]':- resolution: {integrity: sha512-rjVWYCa7Ngbi5AarT6k8TkxUG3Wl1QKzHdIZVsjZSzf36Jmo2IKZt/NHRAwly8oDkbBOH0YTu+CHuf9jPxMc+g==}+ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-dNJuNbdEJT/SWRuXTYP1WSamelsz3ztkUsdtWQPjrexysrTpaEPM40P/71knXiXLYEojqPOEGitVLLpPMS5T6A==}'@tanstack/[email protected]':resolution: {integrity: sha512-hH5MLoJhF7KaIGd7q3xTXGXvslI+GYlM1Z/35aSHHWaCJWB7XvTSHYuV3eM7tw+aE0mT/xMro4M4Q9rCGHT0lw==}@@ -3204,38 +3551,38 @@ packages:'@tsconfig/[email protected]':resolution: {integrity: sha512-RbwvSJQsuN9TB04AQbGULYfOGE/RnSFk/FLQ5b0NmDf5Kx2q/lABZbHQPKCO1vZ6Fiwkplu+yb9pGdLy1iGseQ==}- '@turbo/[email protected]':- resolution: {integrity: sha512-guuiO2kKc7yUQFU2jhWyM/BrYGD/brqb0+JvJIXTQ/QI1NlWfHZ1id50kkkOWqxmBiDc8DgW2orfY85pQIc7gw==}+ '@turbo/[email protected]':+ resolution: {integrity: sha512-m1MUEI4MJ69r5CwfMYxmHi0H0rrgiYCBOp0tgBZ9x/YVvOb5uu/lRIDyDwdtH054R2yWeQaIigUGu6aCX9f8cA==}cpu: [x64]os: [darwin]- '@turbo/[email protected]':- resolution: {integrity: sha512-UglEDl/r1/h5Vw6oS6cEE29Jugz2sDLxHCSupNznKatj1fDMRXFqYKFcbvm8RTFhtYPI45NxkrPNo9BqNychBg==}+ '@turbo/[email protected]':+ resolution: {integrity: sha512-VQ1Yxs5zkPT+2z7t1P4mvn6JmcKLkOCAsPuK9XbOvuVj0DlTlETfIXNisX0771v/vTWHOQqiwoGi+TtAUq8efw==}cpu: [arm64]os: [darwin]- '@turbo/[email protected]':- resolution: {integrity: sha512-KuQxaPWD7OBmwEZqO0sgijwcuXR5eMWbo7BEt2m1D2Q3RylJDj7WMcJ0Btv2VJA0QC+khzAaTAm1yWowJ0CWAw==}+ '@turbo/[email protected]':+ resolution: {integrity: sha512-IzV1QovmwX7mfGnVinmE++2IB8tbeo38weltiuH5zNqwCTBjLs/DytyRKx+bmnhHdXIq9SheR8p0Nip/LBUPHg==}cpu: [x64]os: [linux]- '@turbo/[email protected]':- resolution: {integrity: sha512-DPkIKQ+6p0sho3Cx/e/A3F+AKgXQJA+z//cHsTcyyM1YWRGSYA0UTP8NUpb4iS2tVBSniGwmjRUr73hpq8kcDg==}+ '@turbo/[email protected]':+ resolution: {integrity: sha512-rfujSQkP5aYiRn0PgTM7F00WkJCP/bKDVZbOx3WmrZwa/vHA0bplhCl328kpX7VI9HH2vI90ISGwuSVgJgoqTw==}cpu: [arm64]os: [linux]- '@turbo/[email protected]':- resolution: {integrity: sha512-8NvFAze9D4PsosZAnK3aGqHz2vLzREz9lNIxLgfE0jRchq2sZQE190cwFm7WX17yg3ftPvwCvWH3rhLbG1UHCQ==}+ '@turbo/[email protected]':+ resolution: {integrity: sha512-NnspP7Wd5fa3Wwnqv9bKfhegqZzuHBgbPxdZU/idTLQcazx/vgKu95JlCx2YHY0hdvKCnPcARrDwM+KEUmaO7A==}cpu: [x64]os: [win32]- '@turbo/[email protected]':- resolution: {integrity: sha512-AqjqV5cHbFa0YRaQ+Dyw6lSm6as4h/Uf8LcZ7VN8i+Odr23ShFD5SUvVAR1d3rZqibFVs9c0VdtXdfQfkdcs3A==}+ '@turbo/[email protected]':+ resolution: {integrity: sha512-Iv02YgOpaEShc2OkG7mgCJ2pEw1RUKiKbs0h8W5wAf4jZ5vpmraTEjuGTgHRuOORQnC1GN3KHo5WB+hu1abRMA==}cpu: [arm64]os: [win32]- '@tybys/[email protected]':- resolution: {integrity: sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==}+ '@tybys/[email protected]':+ resolution: {integrity: sha512-RoBvJ2X0wuKlWFIjrwffGw1IqZHKQqzIchKaadZZfnNpsAYp2mM0h36JtPCjNDAHGgYez/15uMBpfGwchhiMgg==}'@types/[email protected]':resolution: {integrity: sha512-NMv9ASNARoKksWtsq/SHakpYAYnhBrQgGD8zkLYk/jaK8jUGn08CfEdTRgYhMypUQAfzSP8W6gNLe0q19/t4VA==}@@ -3431,63 +3778,122 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==}- '@typescript-eslint/[email protected]':- resolution: {integrity: sha512-4EQM77WgVNxj7OkL/5b/D/xZsw00G577+UriYTC7JF5opcF3T2AuoeY7ueLaZgSVjSgCS6yOAJB5bRGLPSJUzA==}+ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-ZPlVl3PB3et/59Ne0fv/sci6ZXz4T4Hp4nTJ56i/Y0gR89ARb+KphojTq6j+56E5PIezmOIOOWyY+aWQFd+IkQ==}engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}peerDependencies:- '@typescript-eslint/parser': ^8.62.1+ '@typescript-eslint/parser': ^8.61.1eslint: ^8.57.0 || ^9.0.0 || ^10.0.0typescript: '>=4.8.4 <6.1.0'- '@typescript-eslint/[email protected]':- resolution: {integrity: sha512-sPhE4iHuJDSvoAiec+Ro8JyXw8f0ql13HFR82P99nCm9GwTEKG0KYLvDe6REk8BCXuit6vJAv/Yxg5ABaNS2rA==}+ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-rvwSgqT+DHpWdzfSzPatRLm02a0GlESt++9iy3hLCDY4BgkaLcl8LBi9Yh7XGFBpwcBE/K3024QuXWTpbz4FfQ==}engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}peerDependencies:+ '@typescript-eslint/parser': ^8.63.0eslint: ^8.57.0 || ^9.0.0 || ^10.0.0typescript: '>=4.8.4 <6.1.0'- '@typescript-eslint/[email protected]':- resolution: {integrity: sha512-yQ3RgY5RkSBpsNS1Bx/JQEcA24FOSdfGktoyprAr5u18390UQdtVcfnEv4nIrIshNnavlVyZBKxQwT1fIAE6cg==}+ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-PJ5vePq5/ognBbrIcoC5+SHO5dfpeLPzP9FpLkzWrguoYQEeeSjlJpVwOpo1JRSTEi7dRcwNy4h4dzV70PqHcg==}engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}peerDependencies:+ eslint: ^8.57.0 || ^9.0.0 || ^10.0.0+ typescript: '>=4.8.4 <6.1.0'++ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-gwh4gvvlaVDKKxyfxMG+Gnu1u9X0OQBwyGLkbwB65dIzBKnxeRiJlNFqlI3zwVhNXJIs6qV7mlFCn/BIajlVig==}+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}+ peerDependencies:+ eslint: ^8.57.0 || ^9.0.0 || ^10.0.0typescript: '>=4.8.4 <6.1.0'- '@typescript-eslint/[email protected]':- resolution: {integrity: sha512-r4d249KbQ1SFdpeStvob8Ih6aPPIzfqllPVOtvhve6ZcpuVcYo5/7zUWckKpHE7StASX4kTKZTLf0WQm/wPkcg==}+ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-PrC4JYGmR241lYnfhmKGTXkFqv8+ymbTFgSAY0fVXpY82/QkMw5TZPl+vGzuDDU2QYJk9fIDOBTntF+yDv9LEA==}engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}+ peerDependencies:+ typescript: '>=4.8.4 <6.1.0'- '@typescript-eslint/[email protected]':- resolution: {integrity: sha512-xadytJqX9vJVQ2fdQjkcIVigwaOJNWkpjdLt6cEQ+xPnrI1fkp+/jZE/I97k9KUjqtpd25i0HeyZf3T6dutv2g==}+ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-e5dh0/UI0ok53AlZ5wRkXCB32z/f2jUZqPR/ygAw5WYaSw8j9EoJWlS7wQjr/dmOaqWjnPIn2m+HhVPCMWGZVQ==}engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}peerDependencies:typescript: '>=4.8.4 <6.1.0'- '@typescript-eslint/[email protected]':- resolution: {integrity: sha512-aXM5xlqXiTxPibXB93cLAURfT3rlizf7uMXISCXy66Isr/9hISJx3yDsKl0L7lKa51b8JpFuNKby0/O0pEm9jg==}+ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-L2bdIeoQS8FlKAvONAr20w6OcLXeB+qiDKbAooS9A0Ben+iSIkBef0FxqwKWYqt5sa0i4KJtxVyVmhMylKzF5w==}+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}++ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-uUyfMWCnDSN8bCpcrY8nGP2BLkQ9Xn0GsipcONcpIDWhwhO4ZSyHvyS14U3X75mzxWxL3I2UZIrenTzdzcJO8A==}+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}++ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-UN/H4di+OO7EWx2ovME+8t31YO+KVnK0RRKEHR3kOt21/Ay8BOq3M1OMvWs5vNiqcFCYGYoxK3MXPZzmMUE+yg==}+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}+ peerDependencies:+ typescript: '>=4.8.4 <6.1.0'++ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-sUAbkulqBAsncKnbRP3+7CtQFRKicexnj7ZwNC6ddCR7EmrXvjvdCYMJbUIqMd6lwoEriZjwLo08aS5tSjVMHg==}+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}+ peerDependencies:+ typescript: '>=4.8.4 <6.1.0'++ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-GYRicKmVK0C4fsKgaACaknOUAq9Oa2kwsjnpFhFcS/5p4Ht5IP9OVLbgIgcK4SRk92nVHFluurg1lumD9dBcLw==}engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}peerDependencies:eslint: ^8.57.0 || ^9.0.0 || ^10.0.0typescript: '>=4.8.4 <6.1.0'- '@typescript-eslint/[email protected]':- resolution: {integrity: sha512-ooCzJFaf+Hg+uG6fA3NRFGuFjlfNlDhBthbv4ZPU/0elCAFUfnyXUvf/WOpHz/jYwSmvU2GkR2LtyUfy1AxZ1Q==}+ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-Nzzh/OGxVCOjObjaj1CQF2RUasyYy2Jfuh+zZ3PjLzG2fYRriAiZLib9UKtO+CpQAS3YHiAS+ckZDclwqI1TPA==}engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}+ peerDependencies:+ eslint: ^8.57.0 || ^9.0.0 || ^10.0.0+ typescript: '>=4.8.4 <6.1.0'- '@typescript-eslint/[email protected]':- resolution: {integrity: sha512-xMcW9oP9u7fAMXYs9A65CVmtLQe2r//oXINHfi8HV+oiqhih17sbLdhXr4540YWlgpDKQdY854OL5ZrdCiQsAA==}+ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-G+CRlPqLv7Bz1IZVs03x5K59F1veqL0EJUROAdGhKsEq8qOiRiZbI+HUojPq5l0fEGOKModD9br6lObhB8zkoA==}+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}++ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-xyLtl9DUBBFrcJS4x2pIqGLH68/tC2uOa4Z7pUteW09D3bXnnXUom4dyPikzWgB7llmIc1zoeI3aoUdC4rPK/Q==}+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}++ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-u+oQD3BqYWPc8YV9Zab4vaJElJuwOLPRc10Jm1o/qS+6Qwen14HCWwx0Seo4LnSn2wxea2Ik8DxPt2/FHmuhrg==}+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}+ peerDependencies:+ typescript: '>=4.8.4 <6.1.0'++ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-ygBkU+B7ex5UI/gKhaqexWev79uISfIv7XQCRNYO/jmD8rGLPyWLAb3KMRT6nd8Gt9bmUBi9+iX6tBdYfOY81Q==}+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}+ peerDependencies:+ typescript: '>=4.8.4 <6.1.0'++ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-1+P/3Dj6jvtybE1q0HQ6yBt/gq+oKJyLdEv4HdnqasaEXRSYCAsD59mXEVQnM/ULNdQxbX77tdG4jPRjIS6knA==}engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}peerDependencies:+ eslint: ^8.57.0 || ^9.0.0 || ^10.0.0typescript: '>=4.8.4 <6.1.0'- '@typescript-eslint/[email protected]':- resolution: {integrity: sha512-sHtbPfuKNZCG+ih8SyjjucqRntSVmp8XgL5u6o9mAhiSn8ds5o/M/XdM0abweme2Tln3szOstOrZ9OXitvPh0g==}+ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-fUKaeAvrTuQg/Tgt3nliAUSZHJM6DlCcfyEmxCvlX8kieWSStBX+5O5Fnidtc3i2JrH+9c/GL4RY2iasd/GPTA==}engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}peerDependencies:eslint: ^8.57.0 || ^9.0.0 || ^10.0.0typescript: '>=4.8.4 <6.1.0'- '@typescript-eslint/[email protected]':- resolution: {integrity: sha512-4g3BLxfdTMy8iZG0MaBkadnlRrCJ74cQiFbyEVMrkwIoqdyaXXQM22cotDvrl4x28wgIZ9rEJRoM+mmhSJpJ1g==}+ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-6fJ9MHWtK14C1DSkiMlHUSOmrVebL7150xZJBlJiL62jjhIA4JmOq6flwBgDxIdBKKdoiZRel+dfPD5MLfny3w==}+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}++ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-UexrHGnGTpbuQHct2ExOc2ZcFbGUS9FOesCxxqdBGcpI1BxYu/LZ6U8Aq6/72XtF/qRBk9nhuGHFJIXXMhPMdw==}engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}'@ungap/[email protected]':@@ -3655,8 +4061,8 @@ packages:'@vitest/[email protected]':resolution: {integrity: sha512-A51o8ymO5PpqlWNnBP9ZHPXDIpuMtTLlGSjN7la4US+LJzoUMyhwjA5QXlm39JexgwHKW4Xjs8Z2d3dLCXOeuA==}- '@xyflow/[email protected]':- resolution: {integrity: sha512-L+zBoLGSXham0MnlY8QqjfR7/C5JNw0zxkaey5aZ5XmCgJBAdH4+WRIu8CR40d3l/BdU635V6YbhBK1jMo8/6Q==}+ '@xyflow/[email protected]':+ resolution: {integrity: sha512-eLAlDWJfWnQEhJwGMjlWdAXO9eYllKpliUmPQlAmOLxz6mExXuzMVDUKLMquixgkrtmMFFtug3jGKmYYld12cA==}peerDependencies:'@types/react': '>=17''@types/react-dom': '>=17'@@ -3668,8 +4074,8 @@ packages:'@types/react-dom':optional: true- '@xyflow/[email protected]':- resolution: {integrity: sha512-lY0z2qP33fUhTva9Vaxrk0lqZta2pkbxB1trHAx1omnJqRtPvDlAQYV2r5fhS6AdpkulYmbNW0svy+A4/t4B/g==}+ '@xyflow/[email protected]':+ resolution: {integrity: sha512-czLyOh91NF0hIzbNzwi8I6GlqG23BHh2435OddfI6uiaLH3xdrdygO93gqgH1Bv9mhy8XPFQJOBn1FTq4LvEWA==}resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==}@@ -3693,11 +4099,6 @@ packages:engines: {node: '>=0.4.0'}hasBin: true- resolution: {integrity: sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg==}- engines: {node: '>=0.4.0'}- hasBin: true-resolution: {integrity: sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==}engines: {node: '>= 14'}@@ -3706,14 +4107,6 @@ packages:resolution: {integrity: sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==}engines: {node: '>= 8.0.0'}- resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==}- peerDependencies:- ajv: ^8.0.0- peerDependenciesMeta:- ajv:- optional: true-resolution: {integrity: sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==}peerDependencies:@@ -3841,10 +4234,6 @@ packages:resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}- resolution: {integrity: sha512-Xcz9l0z7y9yQ9rdDaxlmaI4uJHf/T8g9hOEzJcsEqX2SjCj4J20uK7+ldkDHMbpJDK76wF7xEIgxc/vSlsfw5w==}- engines: {node: '>=10.12.0'}-resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==}engines: {node: '>= 0.4'}@@ -3926,8 +4315,8 @@ packages:resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}- resolution: {integrity: sha512-c/jurFrDLyui7o1J86yLkRu4LMsTYcBohveus7/I2Hzdn9KIP2bdJPTue/lR1KH46enoPbD77GKeSYNdyPoD3Q==}+ resolution: {integrity: sha512-girxaJ7WZssDOFhzCGZTDKoTa1gk6A1TbflaYTpykLJ4UU9Fz9kx1aREM8JCuoVHbL8X8T/mJg7w2oYSq72Oig==}engines: {node: '>=6.0.0'}hasBin: true@@ -4022,8 +4411,8 @@ packages:resolution: {integrity: sha512-3grm+/2tUOvu2cjJkvsIxrv/wVpfXQW4PsQHYm7yk4vfpu7Ekl6nEsYBoJUL6qDwZUx8wUhQ8tR2qz+ad9c9OA==}engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16}- resolution: {integrity: sha512-2cGmJupaNgg+QUwVLAucDuWuoMZ6EX9iHDRswZ5lsNYEmwPaRknMPCLZz07yTzVq/83p4o/wzbDZbBrTvGGTIw==}+ resolution: {integrity: sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==}engines: {node: '>=18'}@@ -4032,8 +4421,8 @@ packages:resolution: {integrity: sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g==}- resolution: {integrity: sha512-WR1cURNjuvBLMZBMbqM0UoE+WAfdUcEV1ccD8PVBVOI+Z3ND4+SZbN8RsfT2bMuG1qwz5RFvPukSZm5fF2D5eA==}+ resolution: {integrity: sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w==}resolution: {integrity: sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==}@@ -4043,8 +4432,8 @@ packages:resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==}engines: {node: '>=8'}- resolution: {integrity: sha512-MTc8i/x9jBQd1iMw2CFGS+rwMa07eYjLR0CCTLDACl9xhxy+nIs3KeML/biicXtk9JrZ6dnnTatmc7ErPXIxqw==}+ resolution: {integrity: sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==}engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}hasBin: true@@ -4088,8 +4477,8 @@ packages:resolution: {integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==}engines: {node: '>=6'}- resolution: {integrity: sha512-MMHtuAz9Ys840zAY5F4k6fV5GaivZ9sPk+nz0mY+GYVzRBnYkN0mpqkSR92oWRQ19yQWo4HvBV/FnC16AJX8MA==}+ resolution: {integrity: sha512-hG1bReV+OUU+MOqK4t/ZWI0tZOyz3rqS9XuhOUz1cIcbwBKjOyJEJuw9ER5JuNyqxNk8u/JUVbGibBOL1yrjFw==}resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==}@@ -4267,10 +4656,6 @@ packages:resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}- resolution: {integrity: sha512-8fLl9F04EJqjSqH+QjITQfJF8BrOVaYr1jewVgSRAEWePfxT0sku4w2hrGQ60BC/TNLGQ2pgxNlTbWQmMPFvXg==}- engines: {node: '>=12'}-resolution: {integrity: sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==}@@ -4531,10 +4916,6 @@ packages:resolution: {integrity: sha512-YbwwqR/uYpeoP4pu043q+LTDLFBLApUP6VxRihdfNTqu4ubqMlGDLd6ErXhEgsyvY0K6nCs7nggYumAN+9uEuQ==}- resolution: {integrity: sha512-8pYCQiL9Xdcg0UPSD3d+0KMlOjp+KGU5EPwYddgzQ7DATsg4fuUDjQtsYLmWjnk2obnNHgV3vE2Y4jejSOJVBQ==}- engines: {node: '>=10'}-resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==}peerDependencies:@@ -4671,10 +5052,6 @@ packages:resolution: {integrity: sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==}engines: {node: '>=8'}- resolution: {integrity: sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA==}- engines: {node: '>=10'}-resolution: {integrity: sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==}engines: {node: '>=12'}@@ -4792,8 +5169,8 @@ packages:resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==}- resolution: {integrity: sha512-TaxwufTFDufvPEoXdhwVrA3UdFWBeWGkYoJ1K8ldF1xe6gKfth6iRNS5lTQ5JPNOHdGQm8PT1QYKUqFLCiUefQ==}+ resolution: {integrity: sha512-M3yhbAlilnwqC8D21t28UCDGHyitShTmmLRU/H+b74P6Ski16Nb9HONYEaVpMj/pwC7BEo5B95FpjODLCWbtfA==}resolution: {integrity: sha512-eJp3QRe79pjwa+duv+n7+5YsNhRcMl812EcFVwrnRvYKoNPoQb5qxU8DG6Bgwji0akHdp6D4Ln6tYLG58MFSow==}@@ -4836,10 +5213,6 @@ packages:resolution: {integrity: sha512-5qucVt2XcuGMcEGgWI7i+yZpmpByQ8J1lHhcL7PwqCwu9FPP3VUXzT4ltHe5i2z9dePwEHcDVOAfSnHsOlCXRA==}- resolution: {integrity: sha512-6PMWXpdhshVvFp+FoWYs1EvG1Nj0tvk0dZM+XcK0xMEM1czRVcP6ohqPWHy6qPagSpC8j4+p89WXlT+xXJs/fg==}- engines: {node: '>= 0.4'}-resolution: {integrity: sha512-2FpH9Q5i2RRwyEP1AylXe6nYLR5OhaJTZwmlcP0dL/+JCbgg7yyEo/sEK6HeGZRf3dFpWwThaRHVApXSkW3xeg==}engines: {node: '>= 0.4'}@@ -4871,8 +5244,8 @@ packages:resolution: {integrity: sha512-d9T8ucsEhh8Bi1woXCf+TIKDIROLG5WCkxg8geBCbvk22kzwC5G2OnXVMO6FUsvQlgUUXQ2itephWDLqDzbeCw==}engines: {node: '>= 0.4'}- resolution: {integrity: sha512-yPDz7wqpg1/mmHLmS3tcfTfbw5f1eryXvyghYBffGdERwe+mV7ZcWzTR8LR17Kvqt3qfPurjlonmnq3MKXIOXw==}+ resolution: {integrity: sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g==}engines: {node: '>= 0.4'}@@ -4886,6 +5259,11 @@ packages:engines: {node: '>=18'}hasBin: true+ resolution: {integrity: sha512-sNR9MHpXSUV/XB4zmsFKN+QgVG82Cc7+/aaxJ8Adi8hyOac+EXptIp45QBPaVyX3N70664wRbTcLTOemCAnyqw==}+ engines: {node: '>=18'}+ hasBin: true+resolution: {integrity: sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==}engines: {node: '>=18'}@@ -4940,8 +5318,8 @@ packages:eslint-plugin-import-x:optional: true- resolution: {integrity: sha512-W2WCRZ9Dqntd+2u8jJcVMV2PKulc6RdLgUUoh/yQr3uB6lo/ZOeGx11sv60/8S4QFFKNslAlWhr9u0Ef7ZW6Ig==}+ resolution: {integrity: sha512-bLohSkT6469rRs8czj0tLTD8vaeIS/whvPRJVjDr7IuoTT1k5DYDERlNycjDj/HkOlvQdYurmfZ/g3fG5bgeLQ==}engines: {node: '>=4'}peerDependencies:'@typescript-eslint/parser': '*'@@ -5180,12 +5558,19 @@ packages:resolution: {integrity: sha512-gX8LrtNEI5hq8DVUfRQMbr5lpaS4nMIWV+7XEbXk2b8kiQIizgnlr12B4dA3ZEx3308ze0O4Q1R+cHts8kyUJg==}- resolution: {integrity: sha512-i70LwGWUduXqzicKXWshooq+sWL1K3WUU5rKZNG/0i3a1OSoX3HqhH5WbWwTmqWfor4urUakGPiRQcleRZTwOg==}+ resolution: {integrity: sha512-rVjf7ArG3LTk+FS6Yw81V1DLuZl1bRbNrev6Tmd/9RaroeeRRJhAt7jg/6YFxbvAQXUCavSoZhPPj6oOx+5KjQ==}resolution: {integrity: sha512-7F2Fl+TjRSenLqlU3UjSH0iyqopqoZIu7eZVpEirP2g1GtWa2G/ecEmBdgz31+Mxr+ELclgg6sokpSFIQiZ02Q==}+ resolution: {integrity: sha512-00aAWieqff+ZJhsXA4g1g7M8k+7AYoMUUHF+/zFb5U6Uv/P0Vl4QZo84/IcufzYalLuEj9928bXN9PbbFzMF0Q==}++ resolution: {integrity: sha512-C0AaNuC+mscy6vrAQKAc/rMq+zAPHodfHGZu4sGVehvAQt/JLG1O5zEcYcXSY5zSqr4YVgxsB+pHXTq0i7eDlg==}+ hasBin: true+resolution: {integrity: sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==}@@ -5231,10 +5616,6 @@ packages:resolution: {integrity: sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==}engines: {node: '>= 18.0.0'}- resolution: {integrity: sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==}- engines: {node: '>=6'}-resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==}engines: {node: '>=8'}@@ -5261,8 +5642,8 @@ packages:resolution: {integrity: sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==}- resolution: {integrity: sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ==}+ resolution: {integrity: sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==}engines: {node: '>= 6'}@@ -5289,8 +5670,8 @@ packages:resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==}- resolution: {integrity: sha512-w8ZNZr2mKIc7qeNaQ9AVPT1+iFaI+Avd4xudVOvdDJ8VytREi1Ft5Ih7hd9jjehod8vAM5GMsfQ/TpPf4EyoEA==}+ resolution: {integrity: sha512-eKpRKAovdpZtR1WopLHxlBWvAgPny3c4gX1G5Jhwmmw4XJj0ifSD5qB5TOo8hmA0wlRKDAOAhEE1yVPgs6Fgcg==}engines: {node: '>=14.14'}@@ -5517,8 +5898,8 @@ packages:resolution: {integrity: sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA==}- resolution: {integrity: sha512-1yrb/+w6HWQJrUCLkJ2IF5jNIPvvFkblV5RNOYl6bV+OA6p9GLcMpHFFGTosSvHvcAUibuUukRqhlYI4z32C7Q==}+ resolution: {integrity: sha512-2NFaIyNVgJmBs/ecmtGzlmluTFs5cHEWGTdu0t1HBwYzoGXOL5nUQBRMXsXWla5i4KkG//QMzVP88m1+I3fdAQ==}engines: {node: '>=16.9.0'}@@ -5565,8 +5946,8 @@ packages:resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==}engines: {node: '>=0.10.0'}- resolution: {integrity: sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ==}+ resolution: {integrity: sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==}engines: {node: '>=0.10.0'}@@ -5909,8 +6290,8 @@ packages:resolution: {integrity: sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==}hasBin: true- resolution: {integrity: sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==}+ resolution: {integrity: sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==}hasBin: true@@ -5930,9 +6311,6 @@ packages:resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==}- resolution: {integrity: sha512-7DE8mpG+/fVw+dTpjbxnx47TaMnDfOI1jwft9g1VybltZCduyRQPJPvc+zzKY9WPHxhPWczyFuYa6I8Mw4iU5A==}-resolution: {integrity: sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==}@@ -5977,6 +6355,11 @@ packages:resolution: {integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==}engines: {node: '>=6'}+ resolution: {integrity: sha512-HcQsZSQ4Ymhuay4BVzJtM5pFZNDSomYYqcNCZOSITPQh9g18a09DqziWAxSt2G+BH9wGlG+0ZjWpEnaFlnKseQ==}+ engines: {node: ^20.19.0 || >=22.12.0}+ hasBin: true+resolution: {integrity: sha512-PokLlgeEjLh1rAsB7ts+52wZ37HBr1nDhE6NNONwEaXdeZGCJOkP7ZlIAI2Gtu8xohquzTWy75bc/1diI9shQw==}engines: {node: ^20.19.0 || >=22.12.0}@@ -6110,10 +6493,6 @@ packages:resolution: {integrity: sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==}- resolution: {integrity: sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==}- engines: {node: '>=6'}-resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==}engines: {node: '>=8'}@@ -6148,8 +6527,8 @@ packages:resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==}- resolution: {integrity: sha512-RPimw/7aMdv2oqRrxKwvZXcPfwBrn/JZ2xYcY9Hus/6LaS3VOAKVWKWgNLCFSiOm1ESXinjsDlidVU7JlnCN2A==}+ resolution: {integrity: sha512-5YgH9UJd7wVb9hIouI2adWpgqrrICkt070Dnj8EUY1+B4B2P9eRLPAkAAo6NICA7CEhOIeBHl46u9zSNpNu7zA==}engines: {node: 20 || >=22}@@ -6455,10 +6834,6 @@ packages:resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==}engines: {node: '>=6'}- resolution: {integrity: sha512-Ysbi9uYW9hFyfrThdDEQuykN4Ey6BuwPD2kpI5ES/nFTDn/98yxYNLZJcgUAKPT/mcrLLKaGzJR9YVxJrIdASQ==}- engines: {node: '>=8'}-resolution: {integrity: sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==}engines: {node: '>=18'}@@ -6467,6 +6842,11 @@ packages:resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==}engines: {node: '>=10'}+ resolution: {integrity: sha512-Go3/gzStm99QHptsSgU+q1S+xDfLoRgwjJNY80kaTVi0ENhTyqKq+sc4xZiWBSbM7uUcJwmzm8+QFKtcYLJ9nw==}+ engines: {node: '>=22.0.0'}+ hasBin: true+resolution: {integrity: sha512-L6eAAi6IKtyb/7J6L+YsH2vb1yBrJWKRXI293JYDiMl70+6nncdAgigex58w6WBd+CwvdMsqOyNyGs95Op5gWQ==}engines: {node: '>=22.0.0'}@@ -6538,8 +6918,8 @@ packages:resolution: {integrity: sha512-dkEJPVvun4FryqBmZ5KhDo0K9iDXAwn08tMLDinNdRBNPcYEDiWYysLcc6k3mjTMlbP9KyylvRpd4wFtwrT9rw==}engines: {node: ^20.17.0 || >=22.9.0}- resolution: {integrity: sha512-y7Wygv/7mEOvxTuEQDB8StXdMRBWf1kR/tlhAzBRUFkB2jfcLOAxO/SHmOO2zgz1pVgK29/kyupn059/bCHdjA==}+ resolution: {integrity: sha512-U9kYi5bpVMEI31yC8iw4bJJp0avcHXA0W8/wNfLfnvJYzihQo2ZRPYPvpAAd570HAcCBjCTN7vnr+v4StKl1IQ==}engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}hasBin: true@@ -6548,8 +6928,8 @@ packages:engines: {node: ^18 || >=20}hasBin: true- resolution: {integrity: sha512-i0tloweeudshAEuddpDxcg9Ik6pkPfVsHIgKyf143JrgG7/MOh0+q7BypdLXZPoOP7fOYt1eTcwGkyiVmhJFkA==}+ resolution: {integrity: sha512-XPUa/jz+P1oJvN9VBxw4L9MtdFfaH3DAryqPssqhb2kXjmb9npz0dly6rCsgFWOPr4Yg9mTfM3MDZgZZ+7A3lA==}engines: {node: ^20.0.0 || >=22.0.0}@@ -6615,8 +6995,8 @@ packages:engines: {node: '>=10.5.0'}deprecated: Use your platform's native DOMException instead- resolution: {integrity: sha512-kXs9Go0cah0qHVV2v389IXQLdLCeE1xfFtjOAF+iobu0OIoG1pje8At2vMHyaPMiPMnG/LWP50twML21eMcAag==}+ resolution: {integrity: sha512-pyFS63ptit/P5WqUkt+UUfe+4oevH+bFeIiPPdfb0pFeYEu/1ELnJu5l+5EcTKYL5M7zaAa7S8ddywgXypqKCw==}engines: {node: '>= 0.4'}@@ -6628,8 +7008,8 @@ packages:encoding:optional: true- resolution: {integrity: sha512-J6l92tKHX6w8Jy5nO1Vuc01NoIiRGi/d6qBKVxh+IQ8Cr3b6HbVNfKiF8ZpFKufTwpwxMmce2W3iQZ861ZRyTg==}+ resolution: {integrity: sha512-Uzmd6LXpouKo8EUK68IjH4+E01w/hXyV3R3g/geCJo+rXLNfh1xucB+LOzYEOQPSiUK3h/xZf0cQGcSsmyL2Og==}engines: {node: '>=18'}@@ -6746,6 +7126,10 @@ packages:resolution: {integrity: sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==}engines: {node: '>= 0.4'}+ resolution: {integrity: sha512-/DaPStu0s2zzNSRRniKyTPM6Z/o+DapOp2JYNKDL8AsgaBGPK2IdZyB87SQjVH+xeQPz+Qr9mrjglfkYgtbVRA==}+ engines: {node: ^20.19.0 || >=22.12.0}+resolution: {integrity: sha512-yFImD+WLElJpLKy8llG1qe4DCmMsL18peRp8XP1JKfig/gISbJkglnpDtX2aTmAn10kZF7164HbN2H8QPsXxGg==}engines: {node: ^20.19.0 || >=22.12.0}@@ -6761,10 +7145,6 @@ packages:resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==}engines: {node: '>=10'}- resolution: {integrity: sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==}- engines: {node: '>=6'}-resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==}engines: {node: '>=8'}@@ -6825,14 +7205,14 @@ packages:resolution: {integrity: sha512-NOnmBpt5Y2RWbuv0LMzsayp3lVylAHLPUTut412ZA3l+C4uw4ZVkQbjShYCQ8TCpUMdPapr4YjUqLYD6v68j+w==}- resolution: {integrity: sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==}- engines: {node: '>=4'}-resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==}engines: {node: '>=8'}+ resolution: {integrity: sha512-cbrerZV+6rvdQrrD+iGMcZFEiiSrbv9Tfdkvnusy6y0x0GKBXREFg/Y65GhIfm0tnLntThhzCnfKwp1WRjeCyQ==}+ engines: {node: '>=14.0.0'}+resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==}engines: {node: '>=0.10.0'}@@ -6882,10 +7262,6 @@ packages:resolution: {integrity: sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==}engines: {node: '>=12'}- resolution: {integrity: sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==}- engines: {node: '>=12'}-resolution: {integrity: sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==}engines: {node: '>=16.20.0'}@@ -6893,10 +7269,6 @@ packages:resolution: {integrity: sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==}- resolution: {integrity: sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==}- engines: {node: '>=8'}-resolution: {integrity: sha512-h7Qlt6m4REp25qvIdvbDtVmD4LqVXfpRxhORv9L0jzETM05p4fuPJ3dKyuSXQxDSbXnmS79HAgi9589lGSpLkg==}engines: {node: '>=18'}@@ -6923,8 +7295,8 @@ packages:resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==}engines: {node: ^10 || ^12 || >=14}- resolution: {integrity: sha512-vuwillviilfKZsg0VGj5R/YwwcHx4SLsIOI/7K6mQkWx+l5cUHTjj5g0AasTBcyXsbfTgrwsUNmVUb5xVwyPwg==}+ resolution: {integrity: sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==}engines: {node: ^10 || ^12 || >=14}@@ -7031,8 +7403,8 @@ packages:resolution: {integrity: sha512-6YHEFRL9mfgcAvql/XhwTvf5jKcOiiupt2FiJxHkiX1z4j7WL8J/jRHYLluORvc1XxB5rV20KoeK00gVJamspg==}engines: {node: '>=0.6'}- resolution: {integrity: sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A==}+ resolution: {integrity: sha512-Rzq0KEyX/w/tEybncDgdkZrJgVUsUMk3xjh3t5bv3S1HTAtg+uOYt72+ZfwiQwKdysThkTBdL/rTi6HDmX9Ddw==}engines: {node: '>=0.6'}@@ -7042,10 +7414,6 @@ packages:resolution: {integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==}engines: {node: '>= 0.6'}- resolution: {integrity: sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw==}- engines: {node: '>= 0.6'}-resolution: {integrity: sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==}engines: {node: '>= 0.8'}@@ -7080,8 +7448,8 @@ packages:resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==}engines: {node: '>= 6'}- resolution: {integrity: sha512-dEWRjcINDu/F4l2dYx57ugBtD7HV9KXESyxhzw/MqWLeglJrsjJKqACPyUPg+6AF8mIgm+Zi0dZ3ACoIg+QtpA==}+ resolution: {integrity: sha512-YTUo+Flmw4ZXiWfQKGcwwc11KnoRAYgzAE2E7mXKCjSviTKShtxBsN6YUUBB2gtaBzKzeKunxhUwNHQuRryhWA==}engines: {node: '>= 4'}@@ -7336,8 +7704,8 @@ packages:resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==}- resolution: {integrity: sha512-vM9SUhjsUYs6UeJUmygc5Ofm5eQGe85riob5ju6XCgFGJI5PLV4nrDAQpQjd+LkFBpAkADn5BQQpZ9EUNkyLuA==}+ resolution: {integrity: sha512-kjnC1DXBHcxaOaOXBHBeRtltsDG2nUiUni+jP92M9gYdW12rsmx92UsfpH7o5tDRs7I1ZZPSQJQGv3UaRfCiuw==}resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==}@@ -7431,8 +7799,8 @@ packages:resolution: {integrity: sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==}engines: {node: '>= 6.0.0', npm: '>= 3.0.0'}- resolution: {integrity: sha512-aqVvWoyO21L23mb+drl4RmMXbf6N7FdHjAhTRA9ZBL7apWBgfWC16KjrASI+1p9GAroljyMHj6fK67i0UiTNvQ==}+ resolution: {integrity: sha512-dWUG8F5sIIARXih1DTaQAX4SsiTXhInKf1buxdY9DIg4ZYPZK5nGM1VRIYmEbDbsHt7USo99xSLFu5Q1IqTmsg==}engines: {node: '>= 18'}@@ -7592,6 +7960,9 @@ packages:resolution: {integrity: sha512-1tB5mhVo7U+ETBKNf92xT4hrQa3pm0MZ0PQvuDnWgAAGHDsfp4lPSpiS6psrSiet87wyGPh9ft6wmhOMQ0hDiw==}engines: {node: '>=14.16'}+ resolution: {integrity: sha512-ums3KNd42PGyx5xaoVTO1mjU1bH3NpY4vsrVlnv9PNGqQj8wd7rJ6nEypLrJ7z5vxK5RP0yMLo6J/Gsm62DI5Q==}+resolution: {integrity: sha512-RjQetxJrrUJLQPHbLku6U/ocGtzyjbJMP9lCNK7Ag0CNh690nSH8woqWH9u16nMjYBAok+i7JO1NP2pOy8IsPQ==}@@ -7634,12 +8005,6 @@ packages:resolution: {integrity: sha512-JJoOEKTfL1urb1mDoEblhD9NhEbWmq9jHEMEnxoC4ujUaZ4itA8vKgwkFAyNClgxplLi9tsUKX+EduK0p/l7sg==}engines: {node: ^14.18.0 || >=16.0.0}- resolution: {integrity: sha512-iUJXJoKzm4vtLSeT3nwe2s9QjoJAxHg7wYJ0KaQ54Xy2u9jsTq0ULWQQ0+T72FXjX2XnGqubazNx9lUfng7ELw==}- engines: {node: '>=8.0.0'}- os: [darwin, linux, win32, freebsd, openbsd, netbsd, sunos, android]- hasBin: true-resolution: {integrity: sha512-yEFYrVhod+hdNyx7g5Bnkkb0G6si8HJurOoOEgC8B/O0uXLHlaey/65KRv6cuWBNhBgHKAROVpc7QyYqE5gFng==}engines: {node: '>=20'}@@ -7647,6 +8012,9 @@ packages:resolution: {integrity: sha512-uxL7qAVQriqRQPAyK3pj66VqskWqoZ37PW94jwOTwNfq/z9oyu1V+eqrZqtR2+fCiXdYOZe/Modt8GtvqNzu+w==}+ resolution: {integrity: sha512-hk+TB1m+K8CYNrP6rjQaq/Y+4Zylwpa87mLYBKCunwnnQ9p+fHb7kmSfGqyEJoxF/O6CDyABWVFEafNSYKll+Q==}+resolution: {integrity: sha512-WtctNNSH8A9jlMIqxzuYumOHU5uGZyRv0Q5svQl+oEPy5w84YpBxdb7MdqyiSPQge5jTJ6zFQLq0PFygdccSBA==}@@ -7711,14 +8079,14 @@ packages:resolution: {integrity: sha512-Je6p7pkk+KMzMv2XXKmAE3McmolOQFdxkKw0R8EYNr7sELW46JqnNeTX8ybPiQgvg1ymCoF8LXs5fzFaZvJPTA==}- resolution: {integrity: sha512-TkQNGJIhlEphpHCjKodMTSe23egUZr/g+flI2qkLgiJ/maAzSgXypSLRTNH3nCmqgayEmtcJBiLcfODSAr1xoA==}+ resolution: {integrity: sha512-27ep5H9PzdBrNd5OFM/j3WCU8F3kPwM9D0BOaOf7uYfxMJfyr0K5Tjj69Gri+sZlh2WXd5buIm47NuPF29CDiw==}resolution: {integrity: sha512-NFxmRT2lAEMcCOBgeZ0NuM0zsK/xgmNajnY6n4S1mwAKocft2s2ise1O3nQxrH3c+uY6hgHUV9GGNVp7tUE4Sg==}- resolution: {integrity: sha512-rbP0Gyx8b3Ae9yO//CU2wbSnQNoQ66m1nJdSbSHmnwKwzkkz/u8mERYU8T2rmlmy+bJvRNn84yNCW8gYqox44Q==}+ resolution: {integrity: sha512-A3BDQBeeukYPzB4QdQ1DtdlUmp4x2OCH8n5UVhEWbyANxNep8GavottKzd1xYKFJKjUgMyPT7EzOfnBO55s8Sg==}hasBin: true@@ -7783,6 +8151,11 @@ packages:resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}+ resolution: {integrity: sha512-X8EX+XV4QR5xCsrgxaED954zTDfY8KqlDtskKEL0cHhyS/P8b4IFOvGDQpsC9Q1XnLq915wEfwwY/zzskCtmhg==}+ engines: {node: '>=18.0.0'}+ hasBin: true+resolution: {integrity: sha512-eUdUIaCr963q2h5u3+QwvYp0+eqPvn+egeqZUm0hwERCqqx1E3kK5ehbGCvqSE5MQAULr67ww0cA3jKc3YkM1w==}engines: {node: '>=18.0.0'}@@ -7791,8 +8164,8 @@ packages:resolution: {integrity: sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==}- resolution: {integrity: sha512-uZIqzfgtWbyqu1Tqwdd0giRnPGgL0ejbcdF8eZLJhtTTVSrOgArZGzYeXTD6XNcc7ANgdhqex11Y9bHBeyiQLQ==}+ resolution: {integrity: sha512-GQpduILaKjoaGljw097ScsSyKTtZSY7cZ3bJktzfTkPMyCf3ShKLuXK2IaOEN2Plziml+ArR7WJ1m+V4VbnaKQ==}hasBin: true@@ -7802,8 +8175,8 @@ packages:resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}engines: {node: '>= 0.8.0'}- resolution: {integrity: sha512-YGYEVz3Fm5iy/AybuA0oyNFq7H4CgQNfRp/qfe8nurE1kuCeNm3/vfm9X4Mtl+qLyaKJUh5xrFZwogr41SMjYA==}+ resolution: {integrity: sha512-1URUxUqfHFM1c+zfSPsa3gnkO7Aq21qyH75SIduNYz4SzY964rn1X2vCMQaHSHhktiw+0kPa2iyb6PUpXqB6Vg==}engines: {node: '>=20'}@@ -7836,8 +8209,15 @@ packages:resolution: {integrity: sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==}- resolution: {integrity: sha512-vymnnM5g0AKQDSAyfP12nMIBvgwgA42syg74kkuZ4x1VuTzwQKwc5h9rGxeShCjny5o+zWAb6OEoz7XLgrIkIw==}+ resolution: {integrity: sha512-V7PayAfJokV3pEHgN7/v03D1SpujhRfQtYLbLIiBfDDncdg4PAiRBfoS4cnCANK4jmAPncczi59QO3afiXUlNw==}+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}+ peerDependencies:+ eslint: ^8.57.0 || ^9.0.0 || ^10.0.0+ typescript: '>=4.8.4 <6.1.0'++ resolution: {integrity: sha512-xgwXyzG4sK9ALkBxbyGkTMMOS+imnW65iPhxCQMK83KhxyoDNW7l+IDqEf9vMdoUidHpOoS967RCq4eMiTexwQ==}engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}peerDependencies:eslint: ^8.57.0 || ^9.0.0 || ^10.0.0@@ -7851,8 +8231,8 @@ packages:resolution: {integrity: sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==}- resolution: {integrity: sha512-8gwNZ29+0/3zmXw7ToIHZtg6wK37xnniRUdBt7B27xZxaxfgR5tGMaGHT0t0dLtBV9fXE7zurh0s6Z1DHVjfWg==}+ resolution: {integrity: sha512-1ajSo3813sDoVIHx4inJdUS4l5L2ic5cFiddemPiyjb/PZEoBAhFwHtbaEdRDFxbAKy7FCG7s5ww3/uCFawuIA==}engines: {node: '>=14'}@@ -8152,11 +8532,26 @@ packages:resolution: {integrity: sha512-gS2ei/mrpRqNs+AHmqxhT6vFPwCLw2qnz5ShmyGD0ULaU0Q9hxnFAcx9jhAip/MnD6+MjgnQu6hQQgA8mlOkVA==}+ resolution: {integrity: sha512-Re5pl6pdowt3ZmWUzGlOuB7jbRIIPetgKalmo4cYmucQnVhpo7/3e4MfpekbhLi2EhZZz5EY9NWRu8zFzuEZew==}+ engines: {node: '>=16'}+ hasBin: true+resolution: {integrity: sha512-uF813NG09JwNRRUfJ0zBomyTslSPM810dMj9LVvkQ7RAkLrQLzAlPU8Xh/3dIqZDo2bfd7tChbf2PtqLRARRJQ==}engines: {node: '>=16'}hasBin: true+ resolution: {integrity: sha512-3Lv1P5t2xcSEkSTKtG+Lz+3JFryuU7YPLkaCUj7gNe+CJsjZJLtUwqsh1x595QBxkIbCE0GAvDx2DCJUU4+oqw==}+ engines: {node: '>=22.0.0'}+ hasBin: true+ peerDependencies:+ '@cloudflare/workers-types': ^4.20260617.1+ peerDependenciesMeta:+ '@cloudflare/workers-types':+ optional: true+resolution: {integrity: sha512-fw69ThymNitZ0oIEBU2yNeq3kK59UKz/jyA3udwRrQIAIsxX57q5qLOpPTN7qc5t8n9pnUeofe0uxtMuhQZW8w==}engines: {node: '>=22.0.0'}@@ -8217,6 +8612,10 @@ packages:resolution: {integrity: sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==}engines: {node: '>=8'}+ resolution: {integrity: sha512-k8KO9hrMyNk6tUWqUfkTEZbezRRpONVOzUTnc97VnCvyj6Tf9lyUR9EDAIeiVLv56jsMcoXEwjW8Kv5yPY52lw==}+ engines: {node: '>=16.0.0'}+resolution: {integrity: sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==}@@ -8251,6 +8650,10 @@ packages:resolution: {integrity: sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==}engines: {node: '>=8'}+ resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==}+ engines: {node: '>=12'}+resolution: {integrity: sha512-GZtjxm/J/4TSxuL3FNYjCmLktBTnIw/rVmKSIyKeYAZpmJB2ig9VauCC5xsa82GNKVKDAqpOn3KVzNt0zmrU0g==}engines: {node: '>=12'}@@ -8366,21 +8769,21 @@ snapshots:'@aws-crypto/[email protected]':dependencies:'@aws-crypto/util': 5.2.0- '@aws-sdk/types': 3.973.13+ '@aws-sdk/types': 3.973.9tslib: 2.8.1'@aws-crypto/[email protected]':dependencies:'@aws-crypto/util': 5.2.0- '@aws-sdk/types': 3.973.13+ '@aws-sdk/types': 3.973.9tslib: 2.8.1'@aws-crypto/[email protected]':dependencies:'@aws-crypto/supports-web-crypto': 5.2.0'@aws-crypto/util': 5.2.0- '@aws-sdk/types': 3.973.13- '@aws-sdk/util-locate-window': 3.965.8+ '@aws-sdk/types': 3.973.9+ '@aws-sdk/util-locate-window': 3.965.5'@smithy/util-utf8': 2.3.0tslib: 2.8.1@@ -8389,15 +8792,15 @@ snapshots:'@aws-crypto/sha256-js': 5.2.0'@aws-crypto/supports-web-crypto': 5.2.0'@aws-crypto/util': 5.2.0- '@aws-sdk/types': 3.973.13- '@aws-sdk/util-locate-window': 3.965.8+ '@aws-sdk/types': 3.973.9+ '@aws-sdk/util-locate-window': 3.965.5'@smithy/util-utf8': 2.3.0tslib: 2.8.1'@aws-crypto/[email protected]':dependencies:'@aws-crypto/util': 5.2.0- '@aws-sdk/types': 3.973.13+ '@aws-sdk/types': 3.973.9tslib: 2.8.1'@aws-crypto/[email protected]':@@ -8406,155 +8809,144 @@ snapshots:'@aws-crypto/[email protected]':dependencies:- '@aws-sdk/types': 3.973.13+ '@aws-sdk/types': 3.973.9'@smithy/util-utf8': 2.3.0tslib: 2.8.1- '@aws-sdk/[email protected]':- dependencies:- '@aws-crypto/crc32': 5.2.0- '@aws-crypto/crc32c': 5.2.0- '@aws-crypto/util': 5.2.0- '@aws-sdk/core': 3.974.23- '@aws-sdk/types': 3.973.13- '@smithy/core': 3.26.0- '@smithy/types': 4.15.0- tslib: 2.8.1-'@aws-sdk/[email protected]':dependencies:'@aws-crypto/sha256-browser': 5.2.0'@aws-crypto/sha256-js': 5.2.0- '@aws-sdk/core': 3.974.23- '@aws-sdk/credential-provider-node': 3.972.58- '@aws-sdk/middleware-host-header': 3.972.24- '@aws-sdk/middleware-logger': 3.972.23- '@aws-sdk/middleware-recursion-detection': 3.972.25- '@aws-sdk/middleware-user-agent': 3.972.53- '@aws-sdk/region-config-resolver': 3.972.27- '@aws-sdk/types': 3.973.13+ '@aws-sdk/core': 3.974.13+ '@aws-sdk/credential-provider-node': 3.972.44+ '@aws-sdk/middleware-host-header': 3.972.14+ '@aws-sdk/middleware-logger': 3.972.13+ '@aws-sdk/middleware-recursion-detection': 3.972.15+ '@aws-sdk/middleware-user-agent': 3.972.43+ '@aws-sdk/region-config-resolver': 3.972.17+ '@aws-sdk/types': 3.973.9'@aws-sdk/util-endpoints': 3.984.0- '@aws-sdk/util-user-agent-browser': 3.972.24- '@aws-sdk/util-user-agent-node': 3.973.39- '@smithy/config-resolver': 4.6.2- '@smithy/core': 3.26.0- '@smithy/fetch-http-handler': 5.5.2- '@smithy/hash-node': 4.4.2- '@smithy/invalid-dependency': 4.4.2- '@smithy/middleware-content-length': 4.4.2- '@smithy/middleware-endpoint': 4.6.2- '@smithy/middleware-retry': 4.7.2- '@smithy/middleware-serde': 4.4.2- '@smithy/middleware-stack': 4.4.2- '@smithy/node-config-provider': 4.5.2- '@smithy/node-http-handler': 4.8.2- '@smithy/protocol-http': 5.5.2- '@smithy/smithy-client': 4.14.2- '@smithy/types': 4.15.0- '@smithy/url-parser': 4.4.2- '@smithy/util-base64': 4.5.2- '@smithy/util-body-length-browser': 4.4.2- '@smithy/util-body-length-node': 4.4.2- '@smithy/util-defaults-mode-browser': 4.5.2- '@smithy/util-defaults-mode-node': 4.4.2- '@smithy/util-endpoints': 3.6.2- '@smithy/util-middleware': 4.4.2- '@smithy/util-retry': 4.5.2- '@smithy/util-stream': 4.7.2- '@smithy/util-utf8': 4.4.2- '@smithy/util-waiter': 4.5.2+ '@aws-sdk/util-user-agent-browser': 3.972.14+ '@aws-sdk/util-user-agent-node': 3.973.29+ '@smithy/config-resolver': 4.5.4+ '@smithy/core': 3.24.4+ '@smithy/fetch-http-handler': 5.4.4+ '@smithy/hash-node': 4.3.4+ '@smithy/invalid-dependency': 4.3.4+ '@smithy/middleware-content-length': 4.3.4+ '@smithy/middleware-endpoint': 4.5.4+ '@smithy/middleware-retry': 4.6.4+ '@smithy/middleware-serde': 4.3.4+ '@smithy/middleware-stack': 4.3.4+ '@smithy/node-config-provider': 4.4.4+ '@smithy/node-http-handler': 4.7.4+ '@smithy/protocol-http': 5.4.4+ '@smithy/smithy-client': 4.13.4+ '@smithy/types': 4.14.2+ '@smithy/url-parser': 4.3.4+ '@smithy/util-base64': 4.4.4+ '@smithy/util-body-length-browser': 4.3.4+ '@smithy/util-body-length-node': 4.3.4+ '@smithy/util-defaults-mode-browser': 4.4.4+ '@smithy/util-defaults-mode-node': 4.3.4+ '@smithy/util-endpoints': 3.5.4+ '@smithy/util-middleware': 4.3.4+ '@smithy/util-retry': 4.4.4+ '@smithy/util-stream': 4.6.4+ '@smithy/util-utf8': 4.3.4+ '@smithy/util-waiter': 4.4.4tslib: 2.8.1'@aws-sdk/[email protected]':dependencies:'@aws-crypto/sha256-browser': 5.2.0'@aws-crypto/sha256-js': 5.2.0- '@aws-sdk/core': 3.974.23- '@aws-sdk/credential-provider-node': 3.972.58- '@aws-sdk/dynamodb-codec': 3.973.23- '@aws-sdk/middleware-endpoint-discovery': 3.972.19- '@aws-sdk/middleware-host-header': 3.972.24- '@aws-sdk/middleware-logger': 3.972.23- '@aws-sdk/middleware-recursion-detection': 3.972.25- '@aws-sdk/middleware-user-agent': 3.972.53- '@aws-sdk/region-config-resolver': 3.972.27- '@aws-sdk/types': 3.973.13+ '@aws-sdk/core': 3.974.13+ '@aws-sdk/credential-provider-node': 3.972.44+ '@aws-sdk/dynamodb-codec': 3.973.13+ '@aws-sdk/middleware-endpoint-discovery': 3.972.14+ '@aws-sdk/middleware-host-header': 3.972.14+ '@aws-sdk/middleware-logger': 3.972.13+ '@aws-sdk/middleware-recursion-detection': 3.972.15+ '@aws-sdk/middleware-user-agent': 3.972.43+ '@aws-sdk/region-config-resolver': 3.972.17+ '@aws-sdk/types': 3.973.9'@aws-sdk/util-endpoints': 3.984.0- '@aws-sdk/util-user-agent-browser': 3.972.24- '@aws-sdk/util-user-agent-node': 3.973.39- '@smithy/config-resolver': 4.6.2- '@smithy/core': 3.26.0- '@smithy/fetch-http-handler': 5.5.2- '@smithy/hash-node': 4.4.2- '@smithy/invalid-dependency': 4.4.2- '@smithy/middleware-content-length': 4.4.2- '@smithy/middleware-endpoint': 4.6.2- '@smithy/middleware-retry': 4.7.2- '@smithy/middleware-serde': 4.4.2- '@smithy/middleware-stack': 4.4.2- '@smithy/node-config-provider': 4.5.2- '@smithy/node-http-handler': 4.8.2- '@smithy/protocol-http': 5.5.2- '@smithy/smithy-client': 4.14.2- '@smithy/types': 4.15.0- '@smithy/url-parser': 4.4.2- '@smithy/util-base64': 4.5.2- '@smithy/util-body-length-browser': 4.4.2- '@smithy/util-body-length-node': 4.4.2- '@smithy/util-defaults-mode-browser': 4.5.2- '@smithy/util-defaults-mode-node': 4.4.2- '@smithy/util-endpoints': 3.6.2- '@smithy/util-middleware': 4.4.2- '@smithy/util-retry': 4.5.2- '@smithy/util-utf8': 4.4.2- '@smithy/util-waiter': 4.5.2+ '@aws-sdk/util-user-agent-browser': 3.972.14+ '@aws-sdk/util-user-agent-node': 3.973.29+ '@smithy/config-resolver': 4.5.4+ '@smithy/core': 3.24.4+ '@smithy/fetch-http-handler': 5.4.4+ '@smithy/hash-node': 4.3.4+ '@smithy/invalid-dependency': 4.3.4+ '@smithy/middleware-content-length': 4.3.4+ '@smithy/middleware-endpoint': 4.5.4+ '@smithy/middleware-retry': 4.6.4+ '@smithy/middleware-serde': 4.3.4+ '@smithy/middleware-stack': 4.3.4+ '@smithy/node-config-provider': 4.4.4+ '@smithy/node-http-handler': 4.7.4+ '@smithy/protocol-http': 5.4.4+ '@smithy/smithy-client': 4.13.4+ '@smithy/types': 4.14.2+ '@smithy/url-parser': 4.3.4+ '@smithy/util-base64': 4.4.4+ '@smithy/util-body-length-browser': 4.3.4+ '@smithy/util-body-length-node': 4.3.4+ '@smithy/util-defaults-mode-browser': 4.4.4+ '@smithy/util-defaults-mode-node': 4.3.4+ '@smithy/util-endpoints': 3.5.4+ '@smithy/util-middleware': 4.3.4+ '@smithy/util-retry': 4.4.4+ '@smithy/util-utf8': 4.3.4+ '@smithy/util-waiter': 4.4.4tslib: 2.8.1'@aws-sdk/[email protected]':dependencies:'@aws-crypto/sha256-browser': 5.2.0'@aws-crypto/sha256-js': 5.2.0- '@aws-sdk/core': 3.974.23- '@aws-sdk/credential-provider-node': 3.972.58- '@aws-sdk/middleware-host-header': 3.972.24- '@aws-sdk/middleware-logger': 3.972.23- '@aws-sdk/middleware-recursion-detection': 3.972.25- '@aws-sdk/middleware-user-agent': 3.972.53- '@aws-sdk/region-config-resolver': 3.972.27- '@aws-sdk/types': 3.973.13+ '@aws-sdk/core': 3.974.13+ '@aws-sdk/credential-provider-node': 3.972.44+ '@aws-sdk/middleware-host-header': 3.972.14+ '@aws-sdk/middleware-logger': 3.972.13+ '@aws-sdk/middleware-recursion-detection': 3.972.15+ '@aws-sdk/middleware-user-agent': 3.972.43+ '@aws-sdk/region-config-resolver': 3.972.17+ '@aws-sdk/types': 3.973.9'@aws-sdk/util-endpoints': 3.984.0- '@aws-sdk/util-user-agent-browser': 3.972.24- '@aws-sdk/util-user-agent-node': 3.973.39- '@smithy/config-resolver': 4.6.2- '@smithy/core': 3.26.0- '@smithy/eventstream-serde-browser': 4.4.2- '@smithy/eventstream-serde-config-resolver': 4.5.2- '@smithy/eventstream-serde-node': 4.4.2- '@smithy/fetch-http-handler': 5.5.2- '@smithy/hash-node': 4.4.2- '@smithy/invalid-dependency': 4.4.2- '@smithy/middleware-content-length': 4.4.2- '@smithy/middleware-endpoint': 4.6.2- '@smithy/middleware-retry': 4.7.2- '@smithy/middleware-serde': 4.4.2- '@smithy/middleware-stack': 4.4.2- '@smithy/node-config-provider': 4.5.2- '@smithy/node-http-handler': 4.8.2- '@smithy/protocol-http': 5.5.2- '@smithy/smithy-client': 4.14.2- '@smithy/types': 4.15.0- '@smithy/url-parser': 4.4.2- '@smithy/util-base64': 4.5.2- '@smithy/util-body-length-browser': 4.4.2- '@smithy/util-body-length-node': 4.4.2- '@smithy/util-defaults-mode-browser': 4.5.2- '@smithy/util-defaults-mode-node': 4.4.2- '@smithy/util-endpoints': 3.6.2- '@smithy/util-middleware': 4.4.2- '@smithy/util-retry': 4.5.2- '@smithy/util-stream': 4.7.2- '@smithy/util-utf8': 4.4.2- '@smithy/util-waiter': 4.5.2+ '@aws-sdk/util-user-agent-browser': 3.972.14+ '@aws-sdk/util-user-agent-node': 3.973.29+ '@smithy/config-resolver': 4.5.4+ '@smithy/core': 3.24.4+ '@smithy/eventstream-serde-browser': 4.3.4+ '@smithy/eventstream-serde-config-resolver': 4.4.4+ '@smithy/eventstream-serde-node': 4.3.4+ '@smithy/fetch-http-handler': 5.4.4+ '@smithy/hash-node': 4.3.4+ '@smithy/invalid-dependency': 4.3.4+ '@smithy/middleware-content-length': 4.3.4+ '@smithy/middleware-endpoint': 4.5.4+ '@smithy/middleware-retry': 4.6.4+ '@smithy/middleware-serde': 4.3.4+ '@smithy/middleware-stack': 4.3.4+ '@smithy/node-config-provider': 4.4.4+ '@smithy/node-http-handler': 4.7.4+ '@smithy/protocol-http': 5.4.4+ '@smithy/smithy-client': 4.13.4+ '@smithy/types': 4.14.2+ '@smithy/url-parser': 4.3.4+ '@smithy/util-base64': 4.4.4+ '@smithy/util-body-length-browser': 4.3.4+ '@smithy/util-body-length-node': 4.3.4+ '@smithy/util-defaults-mode-browser': 4.4.4+ '@smithy/util-defaults-mode-node': 4.3.4+ '@smithy/util-endpoints': 3.5.4+ '@smithy/util-middleware': 4.3.4+ '@smithy/util-retry': 4.4.4+ '@smithy/util-stream': 4.6.4+ '@smithy/util-utf8': 4.3.4+ '@smithy/util-waiter': 4.4.4tslib: 2.8.1'@aws-sdk/[email protected]':@@ -8562,352 +8954,375 @@ snapshots:'@aws-crypto/sha1-browser': 5.2.0'@aws-crypto/sha256-browser': 5.2.0'@aws-crypto/sha256-js': 5.2.0- '@aws-sdk/core': 3.974.23- '@aws-sdk/credential-provider-node': 3.972.58- '@aws-sdk/middleware-bucket-endpoint': 3.972.27- '@aws-sdk/middleware-expect-continue': 3.972.23- '@aws-sdk/middleware-flexible-checksums': 3.974.33- '@aws-sdk/middleware-host-header': 3.972.24- '@aws-sdk/middleware-location-constraint': 3.972.20- '@aws-sdk/middleware-logger': 3.972.23- '@aws-sdk/middleware-recursion-detection': 3.972.25- '@aws-sdk/middleware-sdk-s3': 3.972.54- '@aws-sdk/middleware-ssec': 3.972.20- '@aws-sdk/middleware-user-agent': 3.972.53- '@aws-sdk/region-config-resolver': 3.972.27+ '@aws-sdk/core': 3.974.13+ '@aws-sdk/credential-provider-node': 3.972.44+ '@aws-sdk/middleware-bucket-endpoint': 3.972.15+ '@aws-sdk/middleware-expect-continue': 3.972.13+ '@aws-sdk/middleware-flexible-checksums': 3.974.21+ '@aws-sdk/middleware-host-header': 3.972.14+ '@aws-sdk/middleware-location-constraint': 3.972.11+ '@aws-sdk/middleware-logger': 3.972.13+ '@aws-sdk/middleware-recursion-detection': 3.972.15+ '@aws-sdk/middleware-sdk-s3': 3.972.42+ '@aws-sdk/middleware-ssec': 3.972.11+ '@aws-sdk/middleware-user-agent': 3.972.43+ '@aws-sdk/region-config-resolver': 3.972.17'@aws-sdk/signature-v4-multi-region': 3.984.0- '@aws-sdk/types': 3.973.13+ '@aws-sdk/types': 3.973.9'@aws-sdk/util-endpoints': 3.984.0- '@aws-sdk/util-user-agent-browser': 3.972.24- '@aws-sdk/util-user-agent-node': 3.973.39- '@smithy/config-resolver': 4.6.2- '@smithy/core': 3.26.0- '@smithy/eventstream-serde-browser': 4.4.2- '@smithy/eventstream-serde-config-resolver': 4.5.2- '@smithy/eventstream-serde-node': 4.4.2- '@smithy/fetch-http-handler': 5.5.2- '@smithy/hash-blob-browser': 4.4.2- '@smithy/hash-node': 4.4.2- '@smithy/hash-stream-node': 4.4.2- '@smithy/invalid-dependency': 4.4.2- '@smithy/md5-js': 4.4.2- '@smithy/middleware-content-length': 4.4.2- '@smithy/middleware-endpoint': 4.6.2- '@smithy/middleware-retry': 4.7.2- '@smithy/middleware-serde': 4.4.2- '@smithy/middleware-stack': 4.4.2- '@smithy/node-config-provider': 4.5.2- '@smithy/node-http-handler': 4.8.2- '@smithy/protocol-http': 5.5.2- '@smithy/smithy-client': 4.14.2- '@smithy/types': 4.15.0- '@smithy/url-parser': 4.4.2- '@smithy/util-base64': 4.5.2- '@smithy/util-body-length-browser': 4.4.2- '@smithy/util-body-length-node': 4.4.2- '@smithy/util-defaults-mode-browser': 4.5.2- '@smithy/util-defaults-mode-node': 4.4.2- '@smithy/util-endpoints': 3.6.2- '@smithy/util-middleware': 4.4.2- '@smithy/util-retry': 4.5.2- '@smithy/util-stream': 4.7.2- '@smithy/util-utf8': 4.4.2- '@smithy/util-waiter': 4.5.2+ '@aws-sdk/util-user-agent-browser': 3.972.14+ '@aws-sdk/util-user-agent-node': 3.973.29+ '@smithy/config-resolver': 4.5.4+ '@smithy/core': 3.24.4+ '@smithy/eventstream-serde-browser': 4.3.4+ '@smithy/eventstream-serde-config-resolver': 4.4.4+ '@smithy/eventstream-serde-node': 4.3.4+ '@smithy/fetch-http-handler': 5.4.4+ '@smithy/hash-blob-browser': 4.3.4+ '@smithy/hash-node': 4.3.4+ '@smithy/hash-stream-node': 4.3.4+ '@smithy/invalid-dependency': 4.3.4+ '@smithy/md5-js': 4.3.4+ '@smithy/middleware-content-length': 4.3.4+ '@smithy/middleware-endpoint': 4.5.4+ '@smithy/middleware-retry': 4.6.4+ '@smithy/middleware-serde': 4.3.4+ '@smithy/middleware-stack': 4.3.4+ '@smithy/node-config-provider': 4.4.4+ '@smithy/node-http-handler': 4.7.4+ '@smithy/protocol-http': 5.4.4+ '@smithy/smithy-client': 4.13.4+ '@smithy/types': 4.14.2+ '@smithy/url-parser': 4.3.4+ '@smithy/util-base64': 4.4.4+ '@smithy/util-body-length-browser': 4.3.4+ '@smithy/util-body-length-node': 4.3.4+ '@smithy/util-defaults-mode-browser': 4.4.4+ '@smithy/util-defaults-mode-node': 4.3.4+ '@smithy/util-endpoints': 3.5.4+ '@smithy/util-middleware': 4.3.4+ '@smithy/util-retry': 4.4.4+ '@smithy/util-stream': 4.6.4+ '@smithy/util-utf8': 4.3.4+ '@smithy/util-waiter': 4.4.4tslib: 2.8.1'@aws-sdk/[email protected]':dependencies:'@aws-crypto/sha256-browser': 5.2.0'@aws-crypto/sha256-js': 5.2.0- '@aws-sdk/core': 3.974.23- '@aws-sdk/credential-provider-node': 3.972.58- '@aws-sdk/middleware-host-header': 3.972.24- '@aws-sdk/middleware-logger': 3.972.23- '@aws-sdk/middleware-recursion-detection': 3.972.25- '@aws-sdk/middleware-sdk-sqs': 3.972.31- '@aws-sdk/middleware-user-agent': 3.972.53- '@aws-sdk/region-config-resolver': 3.972.27- '@aws-sdk/types': 3.973.13+ '@aws-sdk/core': 3.974.13+ '@aws-sdk/credential-provider-node': 3.972.44+ '@aws-sdk/middleware-host-header': 3.972.14+ '@aws-sdk/middleware-logger': 3.972.13+ '@aws-sdk/middleware-recursion-detection': 3.972.15+ '@aws-sdk/middleware-sdk-sqs': 3.972.25+ '@aws-sdk/middleware-user-agent': 3.972.43+ '@aws-sdk/region-config-resolver': 3.972.17+ '@aws-sdk/types': 3.973.9'@aws-sdk/util-endpoints': 3.984.0- '@aws-sdk/util-user-agent-browser': 3.972.24- '@aws-sdk/util-user-agent-node': 3.973.39- '@smithy/config-resolver': 4.6.2- '@smithy/core': 3.26.0- '@smithy/fetch-http-handler': 5.5.2- '@smithy/hash-node': 4.4.2- '@smithy/invalid-dependency': 4.4.2- '@smithy/md5-js': 4.4.2- '@smithy/middleware-content-length': 4.4.2- '@smithy/middleware-endpoint': 4.6.2- '@smithy/middleware-retry': 4.7.2- '@smithy/middleware-serde': 4.4.2- '@smithy/middleware-stack': 4.4.2- '@smithy/node-config-provider': 4.5.2- '@smithy/node-http-handler': 4.8.2- '@smithy/protocol-http': 5.5.2- '@smithy/smithy-client': 4.14.2- '@smithy/types': 4.15.0- '@smithy/url-parser': 4.4.2- '@smithy/util-base64': 4.5.2- '@smithy/util-body-length-browser': 4.4.2- '@smithy/util-body-length-node': 4.4.2- '@smithy/util-defaults-mode-browser': 4.5.2- '@smithy/util-defaults-mode-node': 4.4.2- '@smithy/util-endpoints': 3.6.2- '@smithy/util-middleware': 4.4.2- '@smithy/util-retry': 4.5.2- '@smithy/util-utf8': 4.4.2+ '@aws-sdk/util-user-agent-browser': 3.972.14+ '@aws-sdk/util-user-agent-node': 3.973.29+ '@smithy/config-resolver': 4.5.4+ '@smithy/core': 3.24.4+ '@smithy/fetch-http-handler': 5.4.4+ '@smithy/hash-node': 4.3.4+ '@smithy/invalid-dependency': 4.3.4+ '@smithy/md5-js': 4.3.4+ '@smithy/middleware-content-length': 4.3.4+ '@smithy/middleware-endpoint': 4.5.4+ '@smithy/middleware-retry': 4.6.4+ '@smithy/middleware-serde': 4.3.4+ '@smithy/middleware-stack': 4.3.4+ '@smithy/node-config-provider': 4.4.4+ '@smithy/node-http-handler': 4.7.4+ '@smithy/protocol-http': 5.4.4+ '@smithy/smithy-client': 4.13.4+ '@smithy/types': 4.14.2+ '@smithy/url-parser': 4.3.4+ '@smithy/util-base64': 4.4.4+ '@smithy/util-body-length-browser': 4.3.4+ '@smithy/util-body-length-node': 4.3.4+ '@smithy/util-defaults-mode-browser': 4.4.4+ '@smithy/util-defaults-mode-node': 4.3.4+ '@smithy/util-endpoints': 3.5.4+ '@smithy/util-middleware': 4.3.4+ '@smithy/util-retry': 4.4.4+ '@smithy/util-utf8': 4.3.4tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/types': 3.973.13- '@aws-sdk/xml-builder': 3.972.31+ '@aws-sdk/types': 3.973.9+ '@aws-sdk/xml-builder': 3.972.25'@aws/lambda-invoke-store': 0.2.4- '@smithy/core': 3.26.0- '@smithy/signature-v4': 5.5.2- '@smithy/types': 4.15.0+ '@smithy/core': 3.24.4+ '@smithy/signature-v4': 5.4.4+ '@smithy/types': 4.14.2bowser: 2.14.1tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/core': 3.974.23- '@aws-sdk/types': 3.973.13- '@smithy/core': 3.26.0- '@smithy/types': 4.15.0+ '@smithy/types': 4.14.2tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/core': 3.974.23- '@aws-sdk/types': 3.973.13- '@smithy/core': 3.26.0- '@smithy/fetch-http-handler': 5.5.2- '@smithy/node-http-handler': 4.8.2- '@smithy/types': 4.15.0+ '@aws-sdk/core': 3.974.13+ '@aws-sdk/types': 3.973.9+ '@smithy/core': 3.24.4+ '@smithy/types': 4.14.2tslib: 2.8.1- '@aws-sdk/[email protected]':- dependencies:- '@aws-sdk/core': 3.974.23- '@aws-sdk/credential-provider-env': 3.972.49- '@aws-sdk/credential-provider-http': 3.972.51- '@aws-sdk/credential-provider-login': 3.972.55- '@aws-sdk/credential-provider-process': 3.972.49- '@aws-sdk/credential-provider-sso': 3.972.55- '@aws-sdk/credential-provider-web-identity': 3.972.55- '@aws-sdk/nested-clients': 3.997.23- '@aws-sdk/types': 3.973.13- '@smithy/core': 3.26.0- '@smithy/credential-provider-imds': 4.4.2- '@smithy/types': 4.15.0+ '@aws-sdk/[email protected]':+ dependencies:+ '@aws-sdk/core': 3.974.13+ '@aws-sdk/types': 3.973.9+ '@smithy/core': 3.24.4+ '@smithy/fetch-http-handler': 5.4.4+ '@smithy/node-http-handler': 4.7.4+ '@smithy/types': 4.14.2+ tslib: 2.8.1++ '@aws-sdk/[email protected]':+ dependencies:+ '@aws-sdk/core': 3.974.13+ '@aws-sdk/credential-provider-env': 3.972.39+ '@aws-sdk/credential-provider-http': 3.972.41+ '@aws-sdk/credential-provider-login': 3.972.43+ '@aws-sdk/credential-provider-process': 3.972.39+ '@aws-sdk/credential-provider-sso': 3.972.43+ '@aws-sdk/credential-provider-web-identity': 3.972.43+ '@aws-sdk/nested-clients': 3.997.11+ '@aws-sdk/types': 3.973.9+ '@smithy/core': 3.24.4+ '@smithy/credential-provider-imds': 4.3.4+ '@smithy/types': 4.14.2tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/core': 3.974.23- '@aws-sdk/nested-clients': 3.997.23- '@aws-sdk/types': 3.973.13- '@smithy/core': 3.26.0- '@smithy/types': 4.15.0+ '@aws-sdk/core': 3.974.13+ '@aws-sdk/nested-clients': 3.997.11+ '@aws-sdk/types': 3.973.9+ '@smithy/core': 3.24.4+ '@smithy/types': 4.14.2tslib: 2.8.1- '@aws-sdk/[email protected]':- dependencies:- '@aws-sdk/credential-provider-env': 3.972.49- '@aws-sdk/credential-provider-http': 3.972.51- '@aws-sdk/credential-provider-ini': 3.972.56- '@aws-sdk/credential-provider-process': 3.972.49- '@aws-sdk/credential-provider-sso': 3.972.55- '@aws-sdk/credential-provider-web-identity': 3.972.55- '@aws-sdk/types': 3.973.13- '@smithy/core': 3.26.0- '@smithy/credential-provider-imds': 4.4.2- '@smithy/types': 4.15.0+ '@aws-sdk/[email protected]':+ dependencies:+ '@aws-sdk/credential-provider-env': 3.972.39+ '@aws-sdk/credential-provider-http': 3.972.41+ '@aws-sdk/credential-provider-ini': 3.972.43+ '@aws-sdk/credential-provider-process': 3.972.39+ '@aws-sdk/credential-provider-sso': 3.972.43+ '@aws-sdk/credential-provider-web-identity': 3.972.43+ '@aws-sdk/types': 3.973.9+ '@smithy/core': 3.24.4+ '@smithy/credential-provider-imds': 4.3.4+ '@smithy/types': 4.14.2tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/core': 3.974.23- '@aws-sdk/types': 3.973.13- '@smithy/core': 3.26.0- '@smithy/types': 4.15.0+ '@aws-sdk/core': 3.974.13+ '@aws-sdk/types': 3.973.9+ '@smithy/core': 3.24.4+ '@smithy/types': 4.14.2tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/core': 3.974.23- '@aws-sdk/nested-clients': 3.997.23- '@aws-sdk/token-providers': 3.1074.0- '@aws-sdk/types': 3.973.13- '@smithy/core': 3.26.0- '@smithy/types': 4.15.0+ '@aws-sdk/core': 3.974.13+ '@aws-sdk/nested-clients': 3.997.11+ '@aws-sdk/token-providers': 3.1052.0+ '@aws-sdk/types': 3.973.9+ '@smithy/core': 3.24.4+ '@smithy/types': 4.14.2tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/core': 3.974.23- '@aws-sdk/nested-clients': 3.997.23- '@aws-sdk/types': 3.973.13- '@smithy/core': 3.26.0- '@smithy/types': 4.15.0+ '@aws-sdk/core': 3.974.13+ '@aws-sdk/nested-clients': 3.997.11+ '@aws-sdk/types': 3.973.9+ '@smithy/core': 3.24.4+ '@smithy/types': 4.14.2tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/core': 3.974.23- '@smithy/core': 3.26.0- '@smithy/types': 4.15.0+ '@aws-sdk/core': 3.974.13+ '@smithy/core': 3.24.4+ '@smithy/types': 4.14.2tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:mnemonist: 0.38.3tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/middleware-sdk-s3': 3.972.54+ '@aws-sdk/core': 3.974.13+ '@aws-sdk/types': 3.973.9+ '@smithy/core': 3.24.4+ '@smithy/types': 4.14.2tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/endpoint-cache': 3.972.8- '@aws-sdk/types': 3.973.13- '@smithy/core': 3.26.0- '@smithy/types': 4.15.0+ '@aws-sdk/endpoint-cache': 3.972.5+ '@aws-sdk/types': 3.973.9+ '@smithy/core': 3.24.4+ '@smithy/types': 4.14.2tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/middleware-sdk-s3': 3.972.54+ '@aws-sdk/types': 3.973.9+ '@smithy/core': 3.24.4+ '@smithy/types': 4.14.2tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/checksums': 3.1000.8+ '@aws-crypto/crc32': 5.2.0+ '@aws-crypto/crc32c': 5.2.0+ '@aws-crypto/util': 5.2.0+ '@aws-sdk/core': 3.974.13+ '@aws-sdk/crc64-nvme': 3.972.9+ '@aws-sdk/types': 3.973.9+ '@smithy/core': 3.24.4+ '@smithy/types': 4.14.2tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/core': 3.974.23+ '@aws-sdk/core': 3.974.13tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/middleware-sdk-s3': 3.972.54+ '@aws-sdk/types': 3.973.9+ '@smithy/types': 4.14.2tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/core': 3.974.23+ '@aws-sdk/core': 3.974.13tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/core': 3.974.23+ '@aws-sdk/core': 3.974.13tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/core': 3.974.23- '@aws-sdk/signature-v4-multi-region': 3.996.35- '@aws-sdk/types': 3.973.13- '@smithy/core': 3.26.0- '@smithy/types': 4.15.0+ '@aws-sdk/core': 3.974.13+ '@aws-sdk/signature-v4-multi-region': 3.996.28+ '@aws-sdk/types': 3.973.9+ '@smithy/core': 3.24.4+ '@smithy/signature-v4': 5.4.4+ '@smithy/types': 4.14.2tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/types': 3.973.13- '@smithy/core': 3.26.0- '@smithy/types': 4.15.0+ '@aws-sdk/types': 3.973.9+ '@smithy/core': 3.24.4+ '@smithy/types': 4.14.2tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/middleware-sdk-s3': 3.972.54+ '@aws-sdk/types': 3.973.9+ '@smithy/types': 4.14.2tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/core': 3.974.23+ '@aws-sdk/core': 3.974.13tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:'@aws-crypto/sha256-browser': 5.2.0'@aws-crypto/sha256-js': 5.2.0- '@aws-sdk/core': 3.974.23- '@aws-sdk/signature-v4-multi-region': 3.996.35- '@aws-sdk/types': 3.973.13- '@smithy/core': 3.26.0- '@smithy/fetch-http-handler': 5.5.2- '@smithy/node-http-handler': 4.8.2- '@smithy/types': 4.15.0+ '@aws-sdk/core': 3.974.13+ '@aws-sdk/signature-v4-multi-region': 3.996.28+ '@aws-sdk/types': 3.973.9+ '@smithy/core': 3.24.4+ '@smithy/fetch-http-handler': 5.4.4+ '@smithy/node-http-handler': 4.7.4+ '@smithy/types': 4.14.2tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/core': 3.974.23+ '@aws-sdk/core': 3.974.13tslib: 2.8.1'@aws-sdk/[email protected]':dependencies:- '@aws-sdk/middleware-sdk-s3': 3.972.54- '@aws-sdk/types': 3.973.13- '@smithy/protocol-http': 5.5.2- '@smithy/signature-v4': 5.5.2- '@smithy/types': 4.15.0+ '@aws-sdk/middleware-sdk-s3': 3.972.42+ '@aws-sdk/types': 3.973.9+ '@smithy/protocol-http': 5.4.4+ '@smithy/signature-v4': 5.4.4+ '@smithy/types': 4.14.2tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/types': 3.973.13- '@smithy/signature-v4': 5.5.2- '@smithy/types': 4.15.0+ '@aws-sdk/types': 3.973.9+ '@smithy/core': 3.24.4+ '@smithy/signature-v4': 5.4.4+ '@smithy/types': 4.14.2tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/core': 3.974.23- '@aws-sdk/nested-clients': 3.997.23- '@aws-sdk/types': 3.973.13- '@smithy/core': 3.26.0- '@smithy/types': 4.15.0+ '@aws-sdk/core': 3.974.13+ '@aws-sdk/nested-clients': 3.997.11+ '@aws-sdk/types': 3.973.9+ '@smithy/core': 3.24.4+ '@smithy/types': 4.14.2tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@smithy/types': 4.15.0+ '@smithy/types': 4.14.2tslib: 2.8.1'@aws-sdk/[email protected]':dependencies:- '@aws-sdk/types': 3.973.13- '@smithy/types': 4.15.0- '@smithy/url-parser': 4.4.2- '@smithy/util-endpoints': 3.6.2+ '@aws-sdk/types': 3.973.9+ '@smithy/types': 4.14.2+ '@smithy/url-parser': 4.3.4+ '@smithy/util-endpoints': 3.5.4tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/core': 3.974.23+ '@aws-sdk/core': 3.974.13tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@aws-sdk/core': 3.974.23+ '@aws-sdk/core': 3.974.13tslib: 2.8.1- '@aws-sdk/[email protected]':+ '@aws-sdk/[email protected]':dependencies:- '@smithy/types': 4.15.0+ '@nodable/entities': 2.1.0+ '@smithy/types': 4.14.2+ fast-xml-parser: 5.7.3tslib: 2.8.1'@aws/[email protected]': {}@@ -8956,7 +9371,7 @@ snapshots:dependencies:'@babel/compat-data': 7.29.7'@babel/helper-validator-option': 7.29.7- browserslist: 4.28.4+ browserslist: 4.28.2lru-cache: 5.1.1semver: 6.3.1@@ -9127,7 +9542,7 @@ snapshots:'@bcoe/[email protected]': {}- '@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])':+ '@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])':dependencies:'@better-auth/utils': 0.4.2'@better-fetch/fetch': 1.3.1@@ -9136,44 +9551,44 @@ snapshots:better-call: 1.3.7([email protected])jose: 6.2.3kysely: 0.29.2- nanostores: 1.4.0+ nanostores: 1.3.0zod: 4.4.3optionalDependencies:'@cloudflare/workers-types': 4.20260702.1'@opentelemetry/api': 1.9.1- '@better-auth/[email protected](@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])([email protected](@cloudflare/[email protected])(@opentelemetry/[email protected])(@types/[email protected])([email protected])([email protected])([email protected]))':+ '@better-auth/[email protected](@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])([email protected](@cloudflare/[email protected])(@opentelemetry/[email protected])(@types/[email protected])([email protected])([email protected])([email protected]))':dependencies:- '@better-auth/core': 1.6.23(@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])+ '@better-auth/core': 1.6.23(@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])'@better-auth/utils': 0.4.2optionalDependencies:drizzle-orm: 0.45.2(@cloudflare/[email protected])(@opentelemetry/[email protected])(@types/[email protected])([email protected])([email protected])([email protected])- '@better-auth/[email protected](@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])([email protected])':+ '@better-auth/[email protected](@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])([email protected])':dependencies:- '@better-auth/core': 1.6.23(@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])+ '@better-auth/core': 1.6.23(@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])'@better-auth/utils': 0.4.2optionalDependencies:kysely: 0.29.2- '@better-auth/[email protected](@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])':+ '@better-auth/[email protected](@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])':dependencies:- '@better-auth/core': 1.6.23(@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])+ '@better-auth/core': 1.6.23(@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])'@better-auth/utils': 0.4.2- '@better-auth/[email protected](@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])':+ '@better-auth/[email protected](@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])':dependencies:- '@better-auth/core': 1.6.23(@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])+ '@better-auth/core': 1.6.23(@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])'@better-auth/utils': 0.4.2- '@better-auth/[email protected](@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])':+ '@better-auth/[email protected](@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])':dependencies:- '@better-auth/core': 1.6.23(@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])+ '@better-auth/core': 1.6.23(@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])'@better-auth/utils': 0.4.2- '@better-auth/[email protected](@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])(@better-fetch/[email protected])':+ '@better-auth/[email protected](@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])(@better-fetch/[email protected])':dependencies:- '@better-auth/core': 1.6.23(@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])+ '@better-auth/core': 1.6.23(@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])'@better-auth/utils': 0.4.2'@better-fetch/fetch': 1.3.1@@ -9202,27 +9617,50 @@ snapshots:'@cloudflare/[email protected]': {}+ dependencies:+ unenv: 2.0.0-rc.24+ optionalDependencies:+ workerd: 1.20260617.1+dependencies:unenv: 2.0.0-rc.24optionalDependencies:workerd: 1.20260701.1+ '@cloudflare/[email protected]':+ optional: true+'@cloudflare/[email protected]':optional: true+ '@cloudflare/[email protected]':+ optional: true+'@cloudflare/[email protected]':optional: true+ '@cloudflare/[email protected]':+ optional: true+'@cloudflare/[email protected]':optional: true+ '@cloudflare/[email protected]':+ optional: true+'@cloudflare/[email protected]':optional: true+ '@cloudflare/[email protected]':+ optional: true+'@cloudflare/[email protected]':optional: true+ '@cloudflare/[email protected]': {}+'@cloudflare/[email protected]': {}'@cspotcode/[email protected]':@@ -9276,33 +9714,26 @@ snapshots:dotenv: 16.6.1eciesjs: 0.4.18execa: 5.1.1- fdir: 6.5.0([email protected])+ fdir: 6.5.0([email protected])ignore: 5.3.2object-treeify: 1.1.33- picomatch: 4.0.5+ picomatch: 4.0.4which: 4.0.0- '@dotenvx/[email protected]':+ '@dotenvx/[email protected]':dependencies:- '@dotenvx/primitives': 0.8.0commander: 11.1.0- conf: 10.2.0dotenv: 17.4.2+ eciesjs: 0.4.18enquirer: 2.4.1- env-paths: 2.2.1execa: 5.1.1- fdir: 6.5.0([email protected])+ fdir: 6.5.0([email protected])ignore: 5.3.2object-treeify: 1.1.33- open: 8.4.2- picomatch: 4.0.5- systeminformation: 5.31.13- undici: 7.28.0+ picomatch: 4.0.4which: 4.0.0yocto-spinner: 1.2.0- '@dotenvx/[email protected]': {}-'@ecies/[email protected](@noble/[email protected])':dependencies:'@noble/ciphers': 1.3.0@@ -9346,11 +9777,6 @@ snapshots:tslib: 2.8.1optional: true- '@emnapi/[email protected]':- dependencies:- tslib: 2.8.1- optional: true-'@emnapi/[email protected]':dependencies:tslib: 2.8.1@@ -9376,100 +9802,151 @@ snapshots:'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':+ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':optional: true'@esbuild/[email protected]':@@ -9478,51 +9955,78 @@ snapshots:'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true+ '@esbuild/[email protected]':+ optional: true+'@esbuild/[email protected]':optional: true@@ -9648,9 +10152,9 @@ snapshots:gsap: 3.15.0react: 19.2.7- '@hono/[email protected]([email protected])':+ '@hono/[email protected]([email protected])':dependencies:- hono: 4.12.27+ hono: 4.12.25'@humanfs/[email protected]': {}@@ -9844,12 +10348,12 @@ snapshots:'@img/[email protected]':dependencies:- '@emnapi/runtime': 1.11.2+ '@emnapi/runtime': 1.11.1optional: true'@img/[email protected]':dependencies:- '@emnapi/runtime': 1.11.2+ '@emnapi/runtime': 1.11.1optional: true'@img/[email protected]':@@ -10081,7 +10585,7 @@ snapshots:'@modelcontextprotocol/[email protected]([email protected])':dependencies:- '@hono/node-server': 1.19.14([email protected])+ '@hono/node-server': 1.19.14([email protected])ajv: 8.20.0ajv-formats: 3.0.1([email protected])content-type: 1.0.5@@ -10091,7 +10595,7 @@ snapshots:eventsource-parser: 3.1.0express: 5.2.1express-rate-limit: 8.5.2([email protected])- hono: 4.12.27+ hono: 4.12.25jose: 6.2.3json-schema-typed: 8.0.2pkce-challenge: 5.0.1@@ -10111,32 +10615,32 @@ snapshots:strict-event-emitter: 0.5.1optional: truedependencies:'@emnapi/core': 1.10.0'@emnapi/runtime': 1.10.0- '@tybys/wasm-util': 0.10.3+ '@tybys/wasm-util': 0.10.2optional: truedependencies:'@emnapi/core': 1.11.0'@emnapi/runtime': 1.11.0- '@tybys/wasm-util': 0.10.3+ '@tybys/wasm-util': 0.10.2optional: truedependencies:'@emnapi/core': 1.11.1'@emnapi/runtime': 1.11.1- '@tybys/wasm-util': 0.10.3+ '@tybys/wasm-util': 0.10.2optional: truedependencies:'@emnapi/core': 1.9.2'@emnapi/runtime': 1.9.2- '@tybys/wasm-util': 0.10.3+ '@tybys/wasm-util': 0.10.2optional: true'@next/[email protected]': {}@@ -10194,6 +10698,8 @@ snapshots:'@noble/[email protected]': {}+ '@nodable/[email protected]': {}+'@node-minify/[email protected]':dependencies:'@node-minify/utils': 8.0.6@@ -10284,72 +10790,138 @@ snapshots:'@opentelemetry/[email protected]': {}+ '@oxc-parser/[email protected]':+ optional: true+'@oxc-parser/[email protected]':optional: true+ '@oxc-parser/[email protected]':+ optional: true+'@oxc-parser/[email protected]':optional: true+ '@oxc-parser/[email protected]':+ optional: true+'@oxc-parser/[email protected]':optional: true+ '@oxc-parser/[email protected]':+ optional: true+'@oxc-parser/[email protected]':optional: true+ '@oxc-parser/[email protected]':+ optional: true+'@oxc-parser/[email protected]':optional: true+ '@oxc-parser/[email protected]':+ optional: true+'@oxc-parser/[email protected]':optional: true+ '@oxc-parser/[email protected]':+ optional: true+'@oxc-parser/[email protected]':optional: true+ '@oxc-parser/[email protected]':+ optional: true+'@oxc-parser/[email protected]':optional: true+ '@oxc-parser/[email protected]':+ optional: true+'@oxc-parser/[email protected]':optional: true+ '@oxc-parser/[email protected]':+ optional: true+'@oxc-parser/[email protected]':optional: true+ '@oxc-parser/[email protected]':+ optional: true+'@oxc-parser/[email protected]':optional: true+ '@oxc-parser/[email protected]':+ optional: true+'@oxc-parser/[email protected]':optional: true+ '@oxc-parser/[email protected]':+ optional: true+'@oxc-parser/[email protected]':optional: true+ '@oxc-parser/[email protected]':+ optional: true+'@oxc-parser/[email protected]':optional: true+ '@oxc-parser/[email protected]':+ optional: true+'@oxc-parser/[email protected]':optional: true+ '@oxc-parser/[email protected]':+ optional: true+'@oxc-parser/[email protected]':optional: true+ '@oxc-parser/[email protected]':+ dependencies:+ '@emnapi/core': 1.10.0+ '@emnapi/runtime': 1.10.0+ '@napi-rs/wasm-runtime': 1.1.5(@emnapi/[email protected])(@emnapi/[email protected])+ optional: true+'@oxc-parser/[email protected]':dependencies:'@emnapi/core': 1.11.1'@emnapi/runtime': 1.11.1- '@napi-rs/wasm-runtime': 1.1.6(@emnapi/[email protected])(@emnapi/[email protected])+ '@napi-rs/wasm-runtime': 1.1.5(@emnapi/[email protected])(@emnapi/[email protected])+ optional: true++ '@oxc-parser/[email protected]':optional: true'@oxc-parser/[email protected]':optional: true+ '@oxc-parser/[email protected]':+ optional: true+'@oxc-parser/[email protected]':optional: true+ '@oxc-parser/[email protected]':+ optional: true+'@oxc-parser/[email protected]':optional: true'@oxc-project/[email protected]': {}+ '@oxc-project/[email protected]': {}+'@oxc-project/[email protected]': {}'@oxc-resolver/[email protected]':@@ -10404,7 +10976,7 @@ snapshots:dependencies:'@emnapi/core': 1.11.0'@emnapi/runtime': 1.11.0- '@napi-rs/wasm-runtime': 1.1.6(@emnapi/[email protected])(@emnapi/[email protected])+ '@napi-rs/wasm-runtime': 1.1.5(@emnapi/[email protected])(@emnapi/[email protected])optional: true'@oxc-resolver/[email protected]':@@ -10440,7 +11012,7 @@ snapshots:proxy-agent: 6.5.0semver: 7.8.5tar-fs: 3.1.2- yargs: 17.7.3+ yargs: 17.7.2transitivePeerDependencies:- bare-abort-controller- bare-buffer@@ -10487,7 +11059,7 @@ snapshots:dependencies:'@emnapi/core': 1.9.2'@emnapi/runtime': 1.9.2- '@napi-rs/wasm-runtime': 1.1.6(@emnapi/[email protected])(@emnapi/[email protected])+ '@napi-rs/wasm-runtime': 1.1.5(@emnapi/[email protected])(@emnapi/[email protected])optional: true'@rolldown/[email protected]':@@ -10578,148 +11150,148 @@ snapshots:'@sindresorhus/[email protected]': {}- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:'@aws-crypto/crc32': 5.2.0- '@smithy/types': 4.15.0+ '@smithy/types': 4.14.2tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0- '@smithy/types': 4.15.0+ '@smithy/core': 3.24.4+ '@smithy/types': 4.14.2tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0- '@smithy/types': 4.15.0+ '@smithy/core': 3.24.4+ '@smithy/types': 4.14.2tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1'@smithy/[email protected]':dependencies:tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0- '@smithy/types': 4.15.0+ '@smithy/core': 3.24.4+ '@smithy/types': 4.14.2tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0- '@smithy/types': 4.15.0+ '@smithy/core': 3.24.4+ '@smithy/types': 4.14.2tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0- '@smithy/types': 4.15.0+ '@smithy/core': 3.24.4+ '@smithy/types': 4.14.2tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1'@smithy/[email protected]':@@ -10727,34 +11299,34 @@ snapshots:'@smithy/is-array-buffer': 2.2.0tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1'@smithy/[email protected]':@@ -10762,14 +11334,14 @@ snapshots:'@smithy/util-buffer-from': 2.2.0tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1- '@smithy/[email protected]':+ '@smithy/[email protected]':dependencies:- '@smithy/core': 3.26.0+ '@smithy/core': 3.24.4tslib: 2.8.1'@speed-highlight/[email protected]': {}@@ -10806,6 +11378,16 @@ snapshots:dependencies:tslib: 2.8.1+ '@tailwindcss/[email protected]':+ dependencies:+ '@jridgewell/remapping': 2.3.5+ enhanced-resolve: 5.21.6+ jiti: 2.7.0+ lightningcss: 1.32.0+ magic-string: 0.30.21+ source-map-js: 1.2.1+ tailwindcss: 4.3.1+'@tailwindcss/[email protected]':dependencies:'@jridgewell/remapping': 2.3.5@@ -10816,64 +11398,64 @@ snapshots:source-map-js: 1.2.1tailwindcss: 4.3.2- '@tailwindcss/[email protected]':+ '@tailwindcss/[email protected]':optional: true- '@tailwindcss/[email protected]':+ '@tailwindcss/[email protected]':optional: true- '@tailwindcss/[email protected]':+ '@tailwindcss/[email protected]':optional: true- '@tailwindcss/[email protected]':+ '@tailwindcss/[email protected]':optional: true- '@tailwindcss/[email protected]':+ '@tailwindcss/[email protected]':optional: true- '@tailwindcss/[email protected]':+ '@tailwindcss/[email protected]':optional: true- '@tailwindcss/[email protected]':+ '@tailwindcss/[email protected]':optional: true- '@tailwindcss/[email protected]':+ '@tailwindcss/[email protected]':optional: true- '@tailwindcss/[email protected]':+ '@tailwindcss/[email protected]':optional: true- '@tailwindcss/[email protected]':+ '@tailwindcss/[email protected]':optional: true- '@tailwindcss/[email protected]':+ '@tailwindcss/[email protected]':optional: true- '@tailwindcss/[email protected]':+ '@tailwindcss/[email protected]':optional: true- '@tailwindcss/[email protected]':+ '@tailwindcss/[email protected]':optionalDependencies:- '@tailwindcss/oxide-android-arm64': 4.3.2- '@tailwindcss/oxide-darwin-arm64': 4.3.2- '@tailwindcss/oxide-darwin-x64': 4.3.2- '@tailwindcss/oxide-freebsd-x64': 4.3.2- '@tailwindcss/oxide-linux-arm-gnueabihf': 4.3.2- '@tailwindcss/oxide-linux-arm64-gnu': 4.3.2- '@tailwindcss/oxide-linux-arm64-musl': 4.3.2- '@tailwindcss/oxide-linux-x64-gnu': 4.3.2- '@tailwindcss/oxide-linux-x64-musl': 4.3.2- '@tailwindcss/oxide-wasm32-wasi': 4.3.2- '@tailwindcss/oxide-win32-arm64-msvc': 4.3.2- '@tailwindcss/oxide-win32-x64-msvc': 4.3.2-- '@tailwindcss/[email protected]':+ '@tailwindcss/oxide-android-arm64': 4.3.1+ '@tailwindcss/oxide-darwin-arm64': 4.3.1+ '@tailwindcss/oxide-darwin-x64': 4.3.1+ '@tailwindcss/oxide-freebsd-x64': 4.3.1+ '@tailwindcss/oxide-linux-arm-gnueabihf': 4.3.1+ '@tailwindcss/oxide-linux-arm64-gnu': 4.3.1+ '@tailwindcss/oxide-linux-arm64-musl': 4.3.1+ '@tailwindcss/oxide-linux-x64-gnu': 4.3.1+ '@tailwindcss/oxide-linux-x64-musl': 4.3.1+ '@tailwindcss/oxide-wasm32-wasi': 4.3.1+ '@tailwindcss/oxide-win32-arm64-msvc': 4.3.1+ '@tailwindcss/oxide-win32-x64-msvc': 4.3.1++ '@tailwindcss/[email protected]':dependencies:'@alloc/quick-lru': 5.2.0- '@tailwindcss/node': 4.3.2- '@tailwindcss/oxide': 4.3.2- postcss: 8.5.16- tailwindcss: 4.3.2+ '@tailwindcss/node': 4.3.1+ '@tailwindcss/oxide': 4.3.1+ postcss: 8.5.15+ tailwindcss: 4.3.1'@tanstack/[email protected]': {}@@ -11183,25 +11765,25 @@ snapshots:'@tsconfig/[email protected]': {}- '@turbo/[email protected]':+ '@turbo/[email protected]':optional: true- '@turbo/[email protected]':+ '@turbo/[email protected]':optional: true- '@turbo/[email protected]':+ '@turbo/[email protected]':optional: true- '@turbo/[email protected]':+ '@turbo/[email protected]':optional: true- '@turbo/[email protected]':+ '@turbo/[email protected]':optional: true- '@turbo/[email protected]':+ '@turbo/[email protected]':optional: true- '@tybys/[email protected]':+ '@tybys/[email protected]':dependencies:tslib: 2.8.1optional: true@@ -11375,7 +11957,7 @@ snapshots:'@types/[email protected]':dependencies:'@types/node': 25.9.4- form-data: 4.0.6+ form-data: 4.0.5'@types/[email protected]':dependencies:@@ -11430,14 +12012,30 @@ snapshots:'@types/node': 25.9.4optional: true- '@typescript-eslint/[email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])':+ '@typescript-eslint/[email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])':+ dependencies:+ '@eslint-community/regexpp': 4.12.2+ '@typescript-eslint/scope-manager': 8.61.1+ '@typescript-eslint/visitor-keys': 8.61.1+ eslint: 10.3.0([email protected])+ ignore: 7.0.5+ natural-compare: 1.4.0+ ts-api-utils: 2.5.0([email protected])+ typescript: 6.0.3+ transitivePeerDependencies:+ - supports-color++ '@typescript-eslint/[email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])':dependencies:'@eslint-community/regexpp': 4.12.2- '@typescript-eslint/scope-manager': 8.62.1- '@typescript-eslint/visitor-keys': 8.62.1+ '@typescript-eslint/scope-manager': 8.63.0+ '@typescript-eslint/visitor-keys': 8.63.0eslint: 10.3.0([email protected])ignore: 7.0.5natural-compare: 1.4.0@@ -11446,14 +12044,14 @@ snapshots:transitivePeerDependencies:- supports-color- '@typescript-eslint/[email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])':+ '@typescript-eslint/[email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])':dependencies:'@eslint-community/regexpp': 4.12.2- '@typescript-eslint/scope-manager': 8.62.1- '@typescript-eslint/visitor-keys': 8.62.1+ '@typescript-eslint/scope-manager': 8.63.0+ '@typescript-eslint/visitor-keys': 8.63.0eslint: 9.39.4([email protected])ignore: 7.0.5natural-compare: 1.4.0@@ -11462,53 +12060,95 @@ snapshots:transitivePeerDependencies:- supports-color+ dependencies:+ '@typescript-eslint/scope-manager': 8.61.1+ '@typescript-eslint/types': 8.61.1+ '@typescript-eslint/typescript-estree': 8.61.1([email protected])+ '@typescript-eslint/visitor-keys': 8.61.1+ debug: 4.4.3+ eslint: 10.3.0([email protected])+ typescript: 6.0.3+ transitivePeerDependencies:+ - supports-color+dependencies:- '@typescript-eslint/scope-manager': 8.62.1- '@typescript-eslint/types': 8.62.1- '@typescript-eslint/typescript-estree': 8.62.1([email protected])- '@typescript-eslint/visitor-keys': 8.62.1+ '@typescript-eslint/scope-manager': 8.63.0+ '@typescript-eslint/types': 8.63.0+ '@typescript-eslint/typescript-estree': 8.63.0([email protected])+ '@typescript-eslint/visitor-keys': 8.63.0debug: 4.4.3eslint: 10.3.0([email protected])typescript: 6.0.3transitivePeerDependencies:- supports-colordependencies:- '@typescript-eslint/scope-manager': 8.62.1- '@typescript-eslint/types': 8.62.1- '@typescript-eslint/typescript-estree': 8.62.1([email protected])- '@typescript-eslint/visitor-keys': 8.62.1+ '@typescript-eslint/scope-manager': 8.63.0+ '@typescript-eslint/types': 8.63.0+ '@typescript-eslint/typescript-estree': 8.63.0([email protected])+ '@typescript-eslint/visitor-keys': 8.63.0debug: 4.4.3eslint: 9.39.4([email protected])typescript: 6.0.3transitivePeerDependencies:- supports-color- '@typescript-eslint/[email protected]([email protected])':+ '@typescript-eslint/[email protected]([email protected])':+ dependencies:+ '@typescript-eslint/tsconfig-utils': 8.61.1([email protected])+ '@typescript-eslint/types': 8.61.1+ debug: 4.4.3+ typescript: 6.0.3+ transitivePeerDependencies:+ - supports-color++ '@typescript-eslint/[email protected]([email protected])':dependencies:- '@typescript-eslint/tsconfig-utils': 8.62.1([email protected])- '@typescript-eslint/types': 8.62.1+ '@typescript-eslint/tsconfig-utils': 8.63.0([email protected])+ '@typescript-eslint/types': 8.63.0debug: 4.4.3typescript: 6.0.3transitivePeerDependencies:- supports-color- '@typescript-eslint/[email protected]':+ '@typescript-eslint/[email protected]':+ dependencies:+ '@typescript-eslint/types': 8.61.1+ '@typescript-eslint/visitor-keys': 8.61.1++ '@typescript-eslint/[email protected]':+ dependencies:+ '@typescript-eslint/types': 8.63.0+ '@typescript-eslint/visitor-keys': 8.63.0++ '@typescript-eslint/[email protected]([email protected])':dependencies:- '@typescript-eslint/types': 8.62.1- '@typescript-eslint/visitor-keys': 8.62.1+ typescript: 6.0.3++ '@typescript-eslint/[email protected]([email protected])':+ dependencies:+ typescript: 6.0.3- '@typescript-eslint/[email protected]([email protected])':dependencies:+ '@typescript-eslint/types': 8.61.1+ '@typescript-eslint/typescript-estree': 8.61.1([email protected])+ debug: 4.4.3+ eslint: 10.3.0([email protected])+ ts-api-utils: 2.5.0([email protected])typescript: 6.0.3+ transitivePeerDependencies:+ - supports-colordependencies:- '@typescript-eslint/types': 8.62.1- '@typescript-eslint/typescript-estree': 8.62.1([email protected])+ '@typescript-eslint/types': 8.63.0+ '@typescript-eslint/typescript-estree': 8.63.0([email protected])debug: 4.4.3eslint: 10.3.0([email protected])ts-api-utils: 2.5.0([email protected])@@ -11516,11 +12156,11 @@ snapshots:transitivePeerDependencies:- supports-colordependencies:- '@typescript-eslint/types': 8.62.1- '@typescript-eslint/typescript-estree': 8.62.1([email protected])+ '@typescript-eslint/types': 8.63.0+ '@typescript-eslint/typescript-estree': 8.63.0([email protected])debug: 4.4.3eslint: 9.39.4([email protected])ts-api-utils: 2.5.0([email protected])@@ -11528,14 +12168,31 @@ snapshots:transitivePeerDependencies:- supports-color- '@typescript-eslint/[email protected]': {}+ '@typescript-eslint/[email protected]': {}++ '@typescript-eslint/[email protected]': {}++ '@typescript-eslint/[email protected]([email protected])':+ dependencies:+ '@typescript-eslint/project-service': 8.61.1([email protected])+ '@typescript-eslint/tsconfig-utils': 8.61.1([email protected])+ '@typescript-eslint/types': 8.61.1+ '@typescript-eslint/visitor-keys': 8.61.1+ debug: 4.4.3+ minimatch: 10.2.5+ semver: 7.8.5+ tinyglobby: 0.2.17+ ts-api-utils: 2.5.0([email protected])+ typescript: 6.0.3+ transitivePeerDependencies:+ - supports-color- '@typescript-eslint/[email protected]([email protected])':+ '@typescript-eslint/[email protected]([email protected])':dependencies:- '@typescript-eslint/project-service': 8.62.1([email protected])- '@typescript-eslint/tsconfig-utils': 8.62.1([email protected])- '@typescript-eslint/types': 8.62.1- '@typescript-eslint/visitor-keys': 8.62.1+ '@typescript-eslint/project-service': 8.63.0([email protected])+ '@typescript-eslint/tsconfig-utils': 8.63.0([email protected])+ '@typescript-eslint/types': 8.63.0+ '@typescript-eslint/visitor-keys': 8.63.0debug: 4.4.3minimatch: 10.2.5semver: 7.8.5@@ -11545,31 +12202,47 @@ snapshots:transitivePeerDependencies:- supports-color+ dependencies:+ '@eslint-community/eslint-utils': 4.9.1([email protected]([email protected]))+ '@typescript-eslint/scope-manager': 8.61.1+ '@typescript-eslint/types': 8.61.1+ '@typescript-eslint/typescript-estree': 8.61.1([email protected])+ eslint: 10.3.0([email protected])+ typescript: 6.0.3+ transitivePeerDependencies:+ - supports-color+dependencies:'@eslint-community/eslint-utils': 4.9.1([email protected]([email protected]))- '@typescript-eslint/scope-manager': 8.62.1- '@typescript-eslint/types': 8.62.1- '@typescript-eslint/typescript-estree': 8.62.1([email protected])+ '@typescript-eslint/scope-manager': 8.63.0+ '@typescript-eslint/types': 8.63.0+ '@typescript-eslint/typescript-estree': 8.63.0([email protected])eslint: 10.3.0([email protected])typescript: 6.0.3transitivePeerDependencies:- supports-colordependencies:'@eslint-community/eslint-utils': 4.9.1([email protected]([email protected]))- '@typescript-eslint/scope-manager': 8.62.1- '@typescript-eslint/types': 8.62.1- '@typescript-eslint/typescript-estree': 8.62.1([email protected])+ '@typescript-eslint/scope-manager': 8.63.0+ '@typescript-eslint/types': 8.63.0+ '@typescript-eslint/typescript-estree': 8.63.0([email protected])eslint: 9.39.4([email protected])typescript: 6.0.3transitivePeerDependencies:- supports-color- '@typescript-eslint/[email protected]':+ '@typescript-eslint/[email protected]':+ dependencies:+ '@typescript-eslint/types': 8.61.1+ eslint-visitor-keys: 5.0.1++ '@typescript-eslint/[email protected]':dependencies:- '@typescript-eslint/types': 8.62.1+ '@typescript-eslint/types': 8.63.0eslint-visitor-keys: 5.0.1'@ungap/[email protected]': {}@@ -11632,7 +12305,7 @@ snapshots:dependencies:'@emnapi/core': 1.10.0'@emnapi/runtime': 1.10.0- '@napi-rs/wasm-runtime': 1.1.6(@emnapi/[email protected])(@emnapi/[email protected])+ '@napi-rs/wasm-runtime': 1.1.5(@emnapi/[email protected])(@emnapi/[email protected])optional: true'@unrs/[email protected]':@@ -11672,14 +12345,14 @@ snapshots:chai: 6.2.2tinyrainbow: 3.1.0- '@vitest/[email protected]([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))':+ '@vitest/[email protected]([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))':dependencies:'@vitest/spy': 4.1.9estree-walker: 3.0.3magic-string: 0.30.21optionalDependencies:msw: 2.14.6(@types/[email protected])([email protected])- vite: 8.0.8(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])+ vite: 8.0.8(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])'@vitest/[email protected]([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))':dependencies:@@ -11723,9 +12396,9 @@ snapshots:convert-source-map: 2.0.0tinyrainbow: 3.1.0- '@xyflow/[email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])':+ '@xyflow/[email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])':dependencies:- '@xyflow/system': 0.0.78+ '@xyflow/system': 0.0.79classcat: 5.0.5react: 19.2.7react-dom: 19.2.7([email protected])@@ -11736,7 +12409,7 @@ snapshots:transitivePeerDependencies:- immer- '@xyflow/[email protected]':+ '@xyflow/[email protected]':dependencies:'@types/d3-drag': 3.0.7'@types/d3-interpolate': 3.0.4@@ -11768,18 +12441,12 @@ snapshots:- [email protected]: {}-dependencies:humanize-ms: 1.2.1- optionalDependencies:- ajv: 8.20.0-optionalDependencies:ajv: 8.20.0@@ -11794,7 +12461,7 @@ snapshots:dependencies:fast-deep-equal: 3.1.3- fast-uri: 3.1.3+ fast-uri: 3.1.2json-schema-traverse: 1.0.0require-from-string: 2.0.2@@ -11923,8 +12590,6 @@ snapshots:- [email protected]: {}-dependencies:possible-typed-array-names: 1.1.0@@ -11979,19 +12644,19 @@ snapshots:- [email protected]: {}+ [email protected]: {}[email protected](@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected])([email protected](@cloudflare/[email protected])(@opentelemetry/[email protected])(@types/[email protected])([email protected])([email protected])([email protected]))([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])([email protected]):dependencies:- '@better-auth/core': 1.6.23(@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])- '@better-auth/drizzle-adapter': 1.6.23(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])([email protected](@cloudflare/[email protected])(@opentelemetry/[email protected])(@types/[email protected])([email protected])([email protected])([email protected]))- '@better-auth/kysely-adapter': 1.6.23(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])([email protected])- '@better-auth/memory-adapter': 1.6.23(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])- '@better-auth/mongo-adapter': 1.6.23(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])- '@better-auth/prisma-adapter': 1.6.23(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])- '@better-auth/telemetry': 1.6.23(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])(@better-fetch/[email protected])+ '@better-auth/core': 1.6.23(@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])+ '@better-auth/drizzle-adapter': 1.6.23(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])([email protected](@cloudflare/[email protected])(@opentelemetry/[email protected])(@types/[email protected])([email protected])([email protected])([email protected]))+ '@better-auth/kysely-adapter': 1.6.23(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])([email protected])+ '@better-auth/memory-adapter': 1.6.23(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])+ '@better-auth/mongo-adapter': 1.6.23(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])+ '@better-auth/prisma-adapter': 1.6.23(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])+ '@better-auth/telemetry': 1.6.23(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])(@better-fetch/[email protected])'@better-auth/utils': 0.4.2'@better-fetch/fetch': 1.3.1'@noble/ciphers': 2.2.0@@ -12000,7 +12665,7 @@ snapshots:defu: 6.1.7jose: 6.2.3kysely: 0.29.2- nanostores: 1.4.0+ nanostores: 1.3.0zod: 4.4.3optionalDependencies:better-sqlite3: 12.11.1@@ -12018,7 +12683,7 @@ snapshots:'@better-auth/utils': 0.4.2'@better-fetch/fetch': 1.3.1rou3: 0.7.12- set-cookie-parser: 3.1.1+ set-cookie-parser: 3.1.0optionalDependencies:zod: 4.4.3@@ -12056,15 +12721,15 @@ snapshots:transitivePeerDependencies:- supports-colordependencies:bytes: 3.1.2- content-type: 2.0.0+ content-type: 1.0.5debug: 4.4.3http-errors: 2.0.1- iconv-lite: 0.7.3+ iconv-lite: 0.7.2on-finished: 2.4.1- qs: 6.15.3+ qs: 6.15.2raw-body: 3.0.2type-is: 2.1.0transitivePeerDependencies:@@ -12077,7 +12742,7 @@ snapshots:balanced-match: 1.0.2concat-map: 0.0.1dependencies:balanced-match: 1.0.2@@ -12089,13 +12754,13 @@ snapshots:dependencies:fill-range: 7.1.1dependencies:- baseline-browser-mapping: 2.10.42- caniuse-lite: 1.0.30001800- electron-to-chromium: 1.5.387- node-releases: 2.0.50- update-browserslist-db: 1.2.3([email protected])+ baseline-browser-mapping: 2.10.37+ caniuse-lite: 1.0.30001799+ electron-to-chromium: 1.5.372+ node-releases: 2.0.47+ update-browserslist-db: 1.2.3([email protected])@@ -12137,7 +12802,7 @@ snapshots:- [email protected]: {}+ [email protected]: {}@@ -12323,19 +12988,6 @@ snapshots:- dependencies:- ajv: 8.20.0- ajv-formats: 2.1.1([email protected])- atomically: 1.7.0- debounce-fn: 4.0.0- dot-prop: 6.0.1- env-paths: 2.2.1- json-schema-typed: 7.0.3- onetime: 5.1.2- pkg-up: 3.1.0- semver: 7.8.5-@@ -12384,7 +13036,7 @@ snapshots:dependencies:env-paths: 2.2.1import-fresh: 3.3.1- js-yaml: 4.3.0+ js-yaml: 4.2.0parse-json: 5.2.0optionalDependencies:typescript: 6.0.3@@ -12614,10 +13266,6 @@ snapshots:- dependencies:- mimic-fn: 3.1.0-dependencies:ms: 2.0.0@@ -12717,10 +13365,6 @@ snapshots:dependencies:is-obj: 2.0.0- dependencies:- is-obj: 2.0.0-@@ -12753,7 +13397,7 @@ snapshots:- [email protected]: {}+ [email protected]: {}@@ -12789,13 +13433,6 @@ snapshots:- dependencies:- es-errors: 1.3.0- es-object-atoms: 1.1.2- is-callable: 1.2.7- object-inspect: 1.13.4-dependencies:array-buffer-byte-length: 1.0.2@@ -12810,7 +13447,7 @@ snapshots:es-errors: 1.3.0es-object-atoms: 1.1.2es-set-tostringtag: 2.1.0- es-to-primitive: 1.3.4+ es-to-primitive: 1.3.0function.prototype.name: 1.2.0get-intrinsic: 1.3.0get-proto: 1.0.1@@ -12893,11 +13530,8 @@ snapshots:dependencies:hasown: 2.0.4dependencies:- es-abstract-get: 1.0.0- es-define-property: 1.0.1- es-errors: 1.3.0is-callable: 1.2.7is-date-object: 1.1.0is-symbol: 1.1.1@@ -12912,7 +13546,7 @@ snapshots:dependencies:'@types/estree-jsx': 1.0.5- acorn: 8.17.0+ acorn: 8.16.0esast-util-from-estree: 2.0.0vfile-message: 4.0.3@@ -12944,6 +13578,35 @@ snapshots:'@esbuild/win32-ia32': 0.25.4'@esbuild/win32-x64': 0.25.4+ optionalDependencies:+ '@esbuild/aix-ppc64': 0.28.0+ '@esbuild/android-arm': 0.28.0+ '@esbuild/android-arm64': 0.28.0+ '@esbuild/android-x64': 0.28.0+ '@esbuild/darwin-arm64': 0.28.0+ '@esbuild/darwin-x64': 0.28.0+ '@esbuild/freebsd-arm64': 0.28.0+ '@esbuild/freebsd-x64': 0.28.0+ '@esbuild/linux-arm': 0.28.0+ '@esbuild/linux-arm64': 0.28.0+ '@esbuild/linux-ia32': 0.28.0+ '@esbuild/linux-loong64': 0.28.0+ '@esbuild/linux-mips64el': 0.28.0+ '@esbuild/linux-ppc64': 0.28.0+ '@esbuild/linux-riscv64': 0.28.0+ '@esbuild/linux-s390x': 0.28.0+ '@esbuild/linux-x64': 0.28.0+ '@esbuild/netbsd-arm64': 0.28.0+ '@esbuild/netbsd-x64': 0.28.0+ '@esbuild/openbsd-arm64': 0.28.0+ '@esbuild/openbsd-x64': 0.28.0+ '@esbuild/openharmony-arm64': 0.28.0+ '@esbuild/sunos-x64': 0.28.0+ '@esbuild/win32-arm64': 0.28.0+ '@esbuild/win32-ia32': 0.28.0+ '@esbuild/win32-x64': 0.28.0+optionalDependencies:'@esbuild/aix-ppc64': 0.28.1@@ -12997,12 +13660,12 @@ snapshots:eslint: 9.39.4([email protected])eslint-import-resolver-node: 0.3.10eslint-import-resolver-typescript: 3.10.1([email protected]([email protected]([email protected])))([email protected]([email protected]))- eslint-plugin-import: 2.32.0([email protected]([email protected]([email protected]([email protected])))([email protected]([email protected])))([email protected]([email protected]))eslint-plugin-jsx-a11y: 6.10.2([email protected]([email protected]))eslint-plugin-react: 7.37.5([email protected]([email protected]))eslint-plugin-react-hooks: 7.1.1([email protected]([email protected]))globals: 16.4.0optionalDependencies:typescript: 6.0.3transitivePeerDependencies:@@ -13030,11 +13693,11 @@ snapshots:tinyglobby: 0.2.17unrs-resolver: 1.12.2optionalDependencies:- eslint-plugin-import: 2.32.0([email protected]([email protected]([email protected]([email protected])))([email protected]([email protected])))([email protected]([email protected]))transitivePeerDependencies:- supports-color- [email protected]([email protected])([email protected]([email protected]([email protected]([email protected])))([email protected]([email protected])))([email protected]([email protected])):+ [email protected]([email protected])([email protected]([email protected]([email protected]([email protected])))([email protected]([email protected])))([email protected]([email protected])):dependencies:debug: 3.2.7optionalDependencies:@@ -13044,7 +13707,7 @@ snapshots:transitivePeerDependencies:- supports-color- [email protected]([email protected]([email protected]([email protected]([email protected])))([email protected]([email protected])))([email protected]([email protected])):dependencies:'@rtsao/scc': 1.1.0array-includes: 3.1.9@@ -13055,7 +13718,7 @@ snapshots:doctrine: 2.1.0eslint: 9.39.4([email protected])eslint-import-resolver-node: 0.3.10- eslint-module-utils: 2.14.0([email protected])([email protected]([email protected]([email protected]([email protected])))([email protected]([email protected])))([email protected]([email protected]))+ eslint-module-utils: 2.13.0([email protected])([email protected]([email protected]([email protected]([email protected])))([email protected]([email protected])))([email protected]([email protected]))hasown: 2.0.4is-core-module: 2.16.2is-glob: 4.0.3@@ -13375,7 +14038,7 @@ snapshots:dependencies:accepts: 2.0.0- body-parser: 2.3.0+ body-parser: 2.2.2content-disposition: 1.1.0content-type: 1.0.5cookie: 0.7.2@@ -13394,8 +14057,8 @@ snapshots:once: 1.4.0parseurl: 1.3.3proxy-addr: 2.0.7- qs: 6.15.3- range-parser: 1.3.0+ qs: 6.15.2+ range-parser: 1.2.1router: 2.2.0send: 1.2.1serve-static: 2.2.1@@ -13459,13 +14122,25 @@ snapshots:fast-string-truncated-width: 3.0.3optional: true- [email protected]: {}+ [email protected]: {}dependencies:fast-string-width: 3.0.2optional: true+ dependencies:+ path-expression-matcher: 1.5.0+ xml-naming: 0.1.0++ dependencies:+ '@nodable/entities': 2.1.0+ fast-xml-builder: 1.2.0+ path-expression-matcher: 1.5.0+ strnum: 2.3.0+dependencies:reusify: 1.1.0@@ -13478,9 +14153,9 @@ snapshots:dependencies:pend: 1.2.0optionalDependencies:- picomatch: 4.0.5+ picomatch: 4.0.4dependencies:@@ -13523,10 +14198,6 @@ snapshots:transitivePeerDependencies:- supports-color- dependencies:- locate-path: 3.0.0-dependencies:locate-path: 5.0.0@@ -13555,7 +14226,7 @@ snapshots:dependencies:asynckit: 0.4.0combined-stream: 1.0.8@@ -13580,7 +14251,7 @@ snapshots:dependencies:graceful-fs: 4.2.11jsonfile: 6.2.1@@ -13909,7 +14580,7 @@ snapshots:dependencies:'@types/set-cookie-parser': 2.4.10- set-cookie-parser: 3.1.1+ set-cookie-parser: 3.1.0optional: true@@ -13918,7 +14589,7 @@ snapshots:dependencies:hermes-estree: 0.25.1- [email protected]: {}+ [email protected]: {}@@ -13966,7 +14637,7 @@ snapshots:dependencies:safer-buffer: 2.1.2dependencies:safer-buffer: 2.1.2@@ -14280,7 +14951,7 @@ snapshots:dependencies:argparse: 2.0.1dependencies:argparse: 2.0.1@@ -14294,8 +14965,6 @@ snapshots:- [email protected]: {}-@@ -14337,19 +15006,35 @@ snapshots:+ dependencies:+ fdir: 6.5.0([email protected])+ formatly: 0.3.0+ get-tsconfig: 4.14.0+ jiti: 2.7.0+ oxc-parser: 0.135.0+ oxc-resolver: 11.21.3+ picomatch: 4.0.4+ smol-toml: 1.6.1+ strip-json-comments: 5.0.3+ tinyglobby: 0.2.17+ unbash: 4.0.1+ yaml: 2.9.0+ zod: 4.4.3+dependencies:- fdir: 6.5.0([email protected])+ fdir: 6.5.0([email protected])formatly: 0.3.0get-tsconfig: 4.14.0jiti: 2.7.0oxc-parser: 0.137.0oxc-resolver: 11.21.3- picomatch: 4.0.5- smol-toml: 1.7.0+ picomatch: 4.0.4+ smol-toml: 1.6.1strip-json-comments: 5.0.3tinyglobby: 0.2.17- unbash: 4.0.2+ unbash: 4.0.1yaml: 2.9.0zod: 4.4.3@@ -14429,7 +15114,7 @@ snapshots:third-party-web: 0.26.7tldts-icann: 6.1.86ws: 7.5.10- yargs: 17.7.3+ yargs: 17.7.2yargs-parser: 21.1.1transitivePeerDependencies:- bare-abort-controller@@ -14496,11 +15181,6 @@ snapshots:dependencies:lie: 3.1.1- dependencies:- p-locate: 3.0.0- path-exists: 3.0.0-dependencies:p-locate: 4.1.0@@ -14530,7 +15210,7 @@ snapshots:- [email protected]: {}+ [email protected]: {}dependencies:@@ -15116,12 +15796,22 @@ snapshots:- [email protected]: {}-+ dependencies:+ '@cspotcode/source-map-support': 0.8.1+ sharp: 0.34.5+ undici: 7.28.0+ workerd: 1.20260617.1+ ws: 8.21.0+ youch: 4.1.0-beta.10+ transitivePeerDependencies:+ - bufferutil+ - utf-8-validate+dependencies:'@cspotcode/source-map-support': 0.8.1@@ -15144,7 +15834,7 @@ snapshots:dependencies:- brace-expansion: 2.1.1+ brace-expansion: 2.1.0@@ -15194,7 +15884,7 @@ snapshots:statuses: 2.0.2strict-event-emitter: 0.5.1tough-cookie: 6.0.1- type-fest: 5.8.0+ type-fest: 5.7.0until-async: 3.0.2yargs: 17.7.3optionalDependencies:@@ -15220,7 +15910,7 @@ snapshots:statuses: 2.0.2strict-event-emitter: 0.5.1tough-cookie: 6.0.1- type-fest: 5.8.0+ type-fest: 5.7.0until-async: 3.0.2yargs: 17.7.3optionalDependencies:@@ -15246,7 +15936,7 @@ snapshots:statuses: 2.0.2strict-event-emitter: 0.5.1tough-cookie: 6.0.1- type-fest: 5.8.0+ type-fest: 5.7.0until-async: 3.0.2yargs: 17.7.3optionalDependencies:@@ -15260,11 +15950,11 @@ snapshots:optional: true- [email protected]: {}+ [email protected]: {}- [email protected]: {}+ [email protected]: {}@@ -15289,8 +15979,8 @@ snapshots:dependencies:'@next/env': 16.2.10'@swc/helpers': 0.5.15- baseline-browser-mapping: 2.10.42- caniuse-lite: 1.0.30001800+ baseline-browser-mapping: 2.10.37+ caniuse-lite: 1.0.30001799postcss: 8.4.31react: 19.2.7react-dom: 19.2.7([email protected])@@ -15316,7 +16006,7 @@ snapshots:dependencies:array.prototype.flatmap: 1.3.3es-errors: 1.3.0@@ -15327,7 +16017,7 @@ snapshots:dependencies:whatwg-url: 5.0.0- [email protected]: {}+ [email protected]: {}dependencies:@@ -15470,6 +16160,31 @@ snapshots:object-keys: 1.1.1safe-push-apply: 1.0.0+ dependencies:+ '@oxc-project/types': 0.135.0+ optionalDependencies:+ '@oxc-parser/binding-android-arm-eabi': 0.135.0+ '@oxc-parser/binding-android-arm64': 0.135.0+ '@oxc-parser/binding-darwin-arm64': 0.135.0+ '@oxc-parser/binding-darwin-x64': 0.135.0+ '@oxc-parser/binding-freebsd-x64': 0.135.0+ '@oxc-parser/binding-linux-arm-gnueabihf': 0.135.0+ '@oxc-parser/binding-linux-arm-musleabihf': 0.135.0+ '@oxc-parser/binding-linux-arm64-gnu': 0.135.0+ '@oxc-parser/binding-linux-arm64-musl': 0.135.0+ '@oxc-parser/binding-linux-ppc64-gnu': 0.135.0+ '@oxc-parser/binding-linux-riscv64-gnu': 0.135.0+ '@oxc-parser/binding-linux-riscv64-musl': 0.135.0+ '@oxc-parser/binding-linux-s390x-gnu': 0.135.0+ '@oxc-parser/binding-linux-x64-gnu': 0.135.0+ '@oxc-parser/binding-linux-x64-musl': 0.135.0+ '@oxc-parser/binding-openharmony-arm64': 0.135.0+ '@oxc-parser/binding-wasm32-wasi': 0.135.0+ '@oxc-parser/binding-win32-arm64-msvc': 0.135.0+ '@oxc-parser/binding-win32-ia32-msvc': 0.135.0+ '@oxc-parser/binding-win32-x64-msvc': 0.135.0+dependencies:'@oxc-project/types': 0.137.0@@ -15525,10 +16240,6 @@ snapshots:dependencies:yocto-queue: 0.1.0- dependencies:- p-limit: 2.3.0-dependencies:p-limit: 2.3.0@@ -15598,10 +16309,10 @@ snapshots:- [email protected]: {}-+ [email protected]: {}+@@ -15617,7 +16328,7 @@ snapshots:dependencies:- lru-cache: 11.5.1+ lru-cache: 11.5.0minipass: 7.1.3@@ -15636,8 +16347,6 @@ snapshots:- [email protected]: {}-@@ -15646,10 +16355,6 @@ snapshots:mlly: 1.8.2pathe: 2.0.3- dependencies:- find-up: 3.0.0-@@ -15670,13 +16375,13 @@ snapshots:dependencies:- nanoid: 3.3.15+ nanoid: 3.3.14picocolors: 1.1.1source-map-js: 1.2.1dependencies:- nanoid: 3.3.15+ nanoid: 3.3.14picocolors: 1.1.1source-map-js: 1.2.1@@ -15846,17 +16551,14 @@ snapshots:dependencies:side-channel: 1.1.1dependencies:- es-define-property: 1.0.1side-channel: 1.1.1- [email protected]: {}-dependencies:bytes: 3.1.2@@ -15868,7 +16570,7 @@ snapshots:dependencies:bytes: 3.1.2http-errors: 2.0.1- iconv-lite: 0.7.3+ iconv-lite: 0.7.2unpipe: 1.0.0@@ -15898,7 +16600,7 @@ snapshots:string_decoder: 1.3.0util-deprecate: 1.0.2dependencies:ast-types: 0.16.1esprima: 4.0.1@@ -16128,7 +16830,7 @@ snapshots:dependencies:es-errors: 1.3.0is-core-module: 2.16.2- node-exports-info: 1.6.2+ node-exports-info: 1.6.0object-keys: 1.1.1path-parse: 1.0.7supports-preserve-symlinks-flag: 1.0.0@@ -16276,7 +16978,7 @@ snapshots:mime-types: 3.0.2ms: 2.1.3on-finished: 2.4.1- range-parser: 1.3.0+ range-parser: 1.2.1statuses: 2.0.2transitivePeerDependencies:- supports-color@@ -16301,7 +17003,7 @@ snapshots:- [email protected]: {}+ [email protected]: {}dependencies:@@ -16333,10 +17035,10 @@ snapshots:'@babel/parser': 7.29.7'@babel/plugin-transform-typescript': 7.29.7(@babel/[email protected])'@babel/preset-typescript': 7.29.7(@babel/[email protected])- '@dotenvx/dotenvx': 1.75.1+ '@dotenvx/dotenvx': 1.71.3'@modelcontextprotocol/sdk': 1.29.0([email protected])'@types/validate-npm-package-name': 4.0.2- browserslist: 4.28.4+ browserslist: 4.28.2commander: 14.0.3cosmiconfig: 9.0.2([email protected])dedent: 1.7.2@@ -16344,15 +17046,15 @@ snapshots:diff: 8.0.4execa: 9.6.1fast-glob: 3.3.3- fs-extra: 11.3.6+ fs-extra: 11.3.5fuzzysort: 3.1.0kleur: 4.1.5open: 11.0.0ora: 8.2.0- postcss: 8.5.16+ postcss: 8.5.15postcss-selector-parser: 7.1.4prompts: 2.4.2- recast: 0.23.12+ recast: 0.23.11stringify-object: 5.0.0tailwind-merge: 3.6.0ts-morph: 26.0.0@@ -16504,7 +17206,7 @@ snapshots:- [email protected]: {}+ [email protected]: {}dependencies:@@ -16706,6 +17408,8 @@ snapshots:+ [email protected]: {}+dependencies:style-to-object: 1.0.14@@ -16740,13 +17444,13 @@ snapshots:'@pkgr/core': 0.1.2tslib: 2.8.1- [email protected]: {}-optional: true+ [email protected]: {}+@@ -16799,7 +17503,7 @@ snapshots:dependencies:'@jridgewell/source-map': 0.3.11- acorn: 8.17.0+ acorn: 8.16.0commander: 2.20.3source-map-support: 0.5.21@@ -16825,23 +17529,23 @@ snapshots:dependencies:- fdir: 6.5.0([email protected])- picomatch: 4.0.5+ fdir: 6.5.0([email protected])+ picomatch: 4.0.4optional: truedependencies:tldts-core: 6.1.86dependencies:- tldts-core: 7.4.6+ tldts-core: 7.4.3optional: true@@ -16860,7 +17564,7 @@ snapshots:dependencies:- tldts: 7.4.6+ tldts: 7.4.3optional: true@@ -16901,6 +17605,12 @@ snapshots:+ dependencies:+ esbuild: 0.28.0+ optionalDependencies:+ fsevents: 2.3.3+dependencies:esbuild: 0.28.1@@ -16911,14 +17621,14 @@ snapshots:dependencies:safe-buffer: 5.2.1optionalDependencies:- '@turbo/darwin-64': 2.10.3- '@turbo/darwin-arm64': 2.10.3- '@turbo/linux-64': 2.10.3- '@turbo/linux-arm64': 2.10.3- '@turbo/windows-64': 2.10.3- '@turbo/windows-arm64': 2.10.3+ '@turbo/darwin-64': 2.10.4+ '@turbo/darwin-arm64': 2.10.4+ '@turbo/linux-64': 2.10.4+ '@turbo/linux-arm64': 2.10.4+ '@turbo/windows-64': 2.10.4+ '@turbo/windows-arm64': 2.10.4@@ -16926,7 +17636,7 @@ snapshots:dependencies:prelude-ls: 1.2.1dependencies:tagged-tag: 1.0.0optional: true@@ -16981,23 +17691,34 @@ snapshots:dependencies:is-typedarray: 1.0.0+ dependencies:+ '@typescript-eslint/eslint-plugin': 8.61.1(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])+ '@typescript-eslint/typescript-estree': 8.61.1([email protected])+ eslint: 10.3.0([email protected])+ typescript: 6.0.3+ transitivePeerDependencies:+ - supports-color+dependencies:- '@typescript-eslint/eslint-plugin': 8.62.1(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])- '@typescript-eslint/typescript-estree': 8.62.1([email protected])+ '@typescript-eslint/eslint-plugin': 8.63.0(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])+ '@typescript-eslint/typescript-estree': 8.63.0([email protected])eslint: 10.3.0([email protected])typescript: 6.0.3transitivePeerDependencies:- supports-colordependencies:- '@typescript-eslint/eslint-plugin': 8.62.1(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])- '@typescript-eslint/typescript-estree': 8.62.1([email protected])+ '@typescript-eslint/eslint-plugin': 8.63.0(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])+ '@typescript-eslint/typescript-estree': 8.63.0([email protected])eslint: 9.39.4([email protected])typescript: 6.0.3transitivePeerDependencies:@@ -17007,7 +17728,7 @@ snapshots:- [email protected]: {}+ [email protected]: {}dependencies:@@ -17120,9 +17841,9 @@ snapshots:optional: truedependencies:- browserslist: 4.28.4+ browserslist: 4.28.2escalade: 3.2.0picocolors: 1.1.1@@ -17163,11 +17884,11 @@ snapshots:'@types/unist': 3.0.3vfile-message: 4.0.3- [email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected]):+ [email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected]):dependencies:lightningcss: 1.32.0- picomatch: 4.0.5- postcss: 8.5.16+ picomatch: 4.0.4+ postcss: 8.5.15rolldown: 1.0.0-rc.15tinyglobby: 0.2.17optionalDependencies:@@ -17176,14 +17897,14 @@ snapshots:fsevents: 2.3.3jiti: 2.7.0terser: 5.16.9- tsx: 4.23.0+ tsx: 4.22.4yaml: 2.9.0[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected]):dependencies:lightningcss: 1.32.0- picomatch: 4.0.5- postcss: 8.5.16+ picomatch: 4.0.4+ postcss: 8.5.15rolldown: 1.0.0-rc.15tinyglobby: 0.2.17optionalDependencies:@@ -17198,8 +17919,8 @@ snapshots:[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected]):dependencies:lightningcss: 1.32.0- picomatch: 4.0.5- postcss: 8.5.16+ picomatch: 4.0.4+ postcss: 8.5.15rolldown: 1.0.0-rc.15tinyglobby: 0.2.17optionalDependencies:@@ -17211,10 +17932,10 @@ snapshots:tsx: 4.23.0yaml: 2.9.0- [email protected](@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])):+ [email protected](@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])):dependencies:'@vitest/expect': 4.1.9- '@vitest/mocker': 4.1.9([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))+ '@vitest/mocker': 4.1.9([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))'@vitest/pretty-format': 4.1.9'@vitest/runner': 4.1.9'@vitest/snapshot': 4.1.9@@ -17231,7 +17952,7 @@ snapshots:tinyexec: 1.2.4tinyglobby: 0.2.17tinyrainbow: 3.1.0- vite: 8.0.8(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])+ vite: 8.0.8(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])why-is-node-running: 2.3.0optionalDependencies:'@opentelemetry/api': 1.9.1@@ -17394,6 +18115,14 @@ snapshots:+ optionalDependencies:+ '@cloudflare/workerd-darwin-64': 1.20260617.1+ '@cloudflare/workerd-darwin-arm64': 1.20260617.1+ '@cloudflare/workerd-linux-64': 1.20260617.1+ '@cloudflare/workerd-linux-arm64': 1.20260617.1+ '@cloudflare/workerd-windows-64': 1.20260617.1+optionalDependencies:'@cloudflare/workerd-darwin-64': 1.20260701.1@@ -17402,6 +18131,23 @@ snapshots:'@cloudflare/workerd-linux-arm64': 1.20260701.1'@cloudflare/workerd-windows-64': 1.20260701.1+ [email protected](@cloudflare/[email protected]):+ dependencies:+ '@cloudflare/kv-asset-handler': 0.5.0+ '@cloudflare/unenv-preset': 2.16.1([email protected])([email protected])+ blake3-wasm: 2.1.5+ esbuild: 0.28.1+ miniflare: 4.20260617.1+ path-to-regexp: 6.3.0+ unenv: 2.0.0-rc.24+ workerd: 1.20260617.1+ optionalDependencies:+ '@cloudflare/workers-types': 4.20260621.1+ fsevents: 2.3.3+ transitivePeerDependencies:+ - bufferutil+ - utf-8-validate+[email protected](@cloudflare/[email protected]):dependencies:'@cloudflare/kv-asset-handler': 0.5.0@@ -17457,6 +18203,8 @@ snapshots:+ [email protected]: {}+@@ -17493,6 +18241,16 @@ snapshots:y18n: 4.0.3yargs-parser: 18.1.3+ dependencies:+ cliui: 8.0.1+ escalade: 3.2.0+ get-caller-file: 2.0.5+ require-directory: 2.1.1+ string-width: 4.2.3+ y18n: 5.0.8+ yargs-parser: 21.1.1+dependencies:cliui: 8.0.1@@ -17502,6 +18260,7 @@ snapshots:string-width: 4.2.3y18n: 5.0.8yargs-parser: 21.1.1+ optional: truedependencies:diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yamlindex cccf9c906..f8085125b 100644--- a/pnpm-workspace.yaml+++ b/pnpm-workspace.yaml@@ -5,6 +5,7 @@ packages:- "src/web"- "src/email-worker"- "src/ws-do"+ - "src/wake-worker"- "src/app"- "src/desktop"- "tests/utils"diff --git a/src/daemon/package.json b/src/daemon/package.jsonindex c83d42853..d2e2b67e6 100644--- a/src/daemon/package.json+++ b/src/daemon/package.json@@ -32,6 +32,7 @@"license": "Apache-2.0","private": true,"dependencies": {+ "@alook/shared": "workspace:*","commander": "^15.0.0","ws": "^8.21.0"},@@ -44,4 +45,4 @@"typescript-eslint": "^8.61.1","vitest": "^4.1.9"}-}+}\ No newline at end of filediff --git a/src/daemon/src/credentials/credentialProxy.test.ts b/src/daemon/src/credentials/credentialProxy.test.tsindex 09e02c1c2..08fb412df 100644--- a/src/daemon/src/credentials/credentialProxy.test.ts+++ b/src/daemon/src/credentials/credentialProxy.test.ts@@ -10,9 +10,10 @@ interface SeenRequest {agentId?: string;client?: string;capabilities?: string;+ path?: string;}-/** A throwaway upstream that records what headers the proxy forwards. */+/** A throwaway upstream that records what headers + path the proxy forwards. */async function startUpstream(): Promise<{ url: string; seen: SeenRequest[]; close: () => Promise<void> }> {const seen: SeenRequest[] = [];const server = http.createServer((req, res) => {@@ -21,6 +22,7 @@ async function startUpstream(): Promise<{ url: string; seen: SeenRequest[]; closagentId: req.headers["x-agent-id"] as string | undefined,client: req.headers["x-client"] as string | undefined,capabilities: req.headers["x-agent-active-capabilities"] as string | undefined,+ path: req.url,});res.writeHead(200, { "content-type": "application/json" });res.end(JSON.stringify({ ok: true }));@@ -170,6 +172,34 @@ describe("startCredentialProxy (zero-trust end to end)", () => {expect(upstream.seen.length).toBe(0);});+ it("rewrites /api/* to /api/community/agent/* (design §9)", async () => {+ const upstream = await startUpstream();+ upstreamClose = upstream.close;+ const broker = new CredentialBroker({ upstreamBaseUrl: upstream.url });+ proxy = await startCredentialProxy(broker);+ const reg = broker.mint("agent-1", "l", ["send", "read"], REAL_KEY);++ await post(proxy.url, reg.voucher, "/api/send");+ expect(upstream.seen.at(-1)!.path).toBe("/api/community/agent/send");++ await post(proxy.url, reg.voucher, "/api/inboxPull?max=10");+ expect(upstream.seen.at(-1)!.path).toBe("/api/community/agent/inboxPull?max=10");++ await post(proxy.url, reg.voucher, "/api");+ expect(upstream.seen.at(-1)!.path).toBe("/api/community/agent");+ });++ it("leaves non-/api paths untouched", async () => {+ const upstream = await startUpstream();+ upstreamClose = upstream.close;+ const broker = new CredentialBroker({ upstreamBaseUrl: upstream.url });+ proxy = await startCredentialProxy(broker);+ const reg = broker.mint("agent-1", "l", ["send"], REAL_KEY);++ await post(proxy.url, reg.voucher, "/send");+ expect(upstream.seen.at(-1)!.path).toBe("/send");+ });+it("a revoked voucher stops working", async () => {const upstream = await startUpstream();upstreamClose = upstream.close;diff --git a/src/daemon/src/credentials/credentialProxy.ts b/src/daemon/src/credentials/credentialProxy.tsindex 7958521e3..82643125d 100644--- a/src/daemon/src/credentials/credentialProxy.ts+++ b/src/daemon/src/credentials/credentialProxy.ts@@ -315,7 +315,7 @@ export async function startCredentialProxy(hostname: upstream.hostname,port: upstream.port || (upstream.protocol === "https:" ? 443 : 80),method: req.method,- path: joinPath(upstream.pathname, req.url ?? "/"),+ path: joinPath(upstream.pathname, rewriteAgentPath(req.url ?? "/")),headers: outHeaders,},(upstreamRes) => {@@ -373,3 +373,18 @@ function joinPath(basePath: string, reqUrl: string): string {const reqPath = reqUrl.startsWith("/") ? reqUrl : `/${reqUrl}`;return (base + reqPath) || "/";}++/**+ * Rewrite the CLI's bare `/api/*` ops (`/api/send`, `/api/inboxPull`, …) onto+ * the real server surface at `/api/community/agent/*` (design §9). This is a+ * brand-new API — no prior contract to preserve back-compat for — so the+ * rewrite is unconditional for anything under `/api/`; every other path+ * passes through untouched.+ */+function rewriteAgentPath(reqUrl: string): string {+ const url = new URL(reqUrl, "http://placeholder");+ if (url.pathname === "/api" || url.pathname.startsWith("/api/")) {+ url.pathname = `/api/community/agent${url.pathname.slice("/api".length)}`;+ }+ return url.pathname + url.search;+}diff --git a/src/daemon/src/runtimeConfig.ts b/src/daemon/src/runtimeConfig.tsindex de300fe4c..0de510dc1 100644--- a/src/daemon/src/runtimeConfig.ts+++ b/src/daemon/src/runtimeConfig.ts@@ -1,87 +1,33 @@/*** RuntimeConfig — the structured, versioned agent runtime configuration.*- * This is what the server stores per agent and pushes down in `agent:start`'s- * `config`. It captures the FULL config surface — which runtime, which model,- * which provider/endpoint, mode, reasoning effort — as structured data (not bare- * strings), mirroring how a production daemon models it.+ * The canonical `RuntimeConfig`/`makeRuntimeConfig` now live in+ * `@alook/shared/runtime-config` (lifted there so the `src/web` wake producer,+ * which cannot depend on this CLI/daemon package, can construct a `config` for+ * `agent:start` — see `plans/community-agent-cli-bridge.md` §1). Re-exported+ * here so existing daemon call sites keep importing from `./runtimeConfig.js`+ * unchanged.*- * The host doesn't act on `RuntimeConfig` directly; it `resolveLaunchFields()`s- * it into flat launch fields (CLI args + env) that each driver consumes. Config- * is start-time: changing it means relaunching the agent with a new RuntimeConfig- * (there is no live-reconfigure path — model/effort are spawn-time args).+ * This file keeps `resolveLaunchFields`/`ResolvedLaunchFields` — daemon-only,+ * host-side resolution of a `RuntimeConfig` into flat launch fields (CLI args ++ * env) that each driver consumes. Config is start-time: changing it means+ * relaunching the agent with a new RuntimeConfig (there is no live-reconfigure+ * path — model/effort are spawn-time args).*/-export const RUNTIME_CONFIG_VERSION = 1;--/** Reasoning/thinking effort. */-export type ReasoningEffort = "low" | "medium" | "high";--/** Model selection — structured, not a bare string. */-export type ModelConfig =- | { kind: "default" } // use the runtime's default model- | { kind: "named"; name: string } // a specific catalog model- | { kind: "custom"; name: string }; // a custom/BYO model id--/**- * Provider / endpoint selection — distinct from model. Lets a host point a- * runtime at a custom endpoint or a built-in multi-provider (Pi).- */-export type ProviderConfig =- | { kind: "default" }- | { kind: "custom"; apiUrl: string; apiKey: string } // e.g. Claude-compatible endpoint- | { kind: "pi-builtin"; providerId: string; apiKey: string }; // Pi multi-provider--/** Execution mode (e.g. fast lane). */-export type ModeConfig = { kind: "default" | "fast" };--export interface RuntimeConfig {- version: number;- /** "claude" | "codex" | "gemini" | "kimi" | "pi" | "copilot" | "cursor" | "opencode" | "antigravity" | "mock" */- runtime: string;- model: ModelConfig;- mode: ModeConfig;- reasoningEffort?: ReasoningEffort;- provider?: ProviderConfig;- /** Override the runtime's default executable path. */- command?: string;- /** Override the runtime's disallowed-tools list. */- disallowedTools?: string;- /** Extra host-supplied env vars (controlled keys are stripped on resolve). */- envVars?: Record<string, string>;- /**- * Agent identity — the SERVER's truth about who this agent is, carried in the- * same config the server downlinks via `agent:start`. The daemon does not- * invent these; it fills the LaunchContext from them.- */- agentName?: string;- /** The agent's @mention handle (e.g. "@cindy"). */- agentHandle?: string;- /** The agent's standing instruction / role (becomes the standing prompt). */- instruction?: string;-}--/* ------------------------------------------------------------------ */-/* Construction / normalization */-/* ------------------------------------------------------------------ */--/** Build a fully-defaulted RuntimeConfig from a partial input. */-export function makeRuntimeConfig(input: Partial<RuntimeConfig> & { runtime: string }): RuntimeConfig {- return {- version: RUNTIME_CONFIG_VERSION,- runtime: input.runtime,- model: input.model ?? { kind: "default" },- mode: input.mode ?? { kind: "default" },- reasoningEffort: input.reasoningEffort,- provider: input.provider,- command: input.command,- disallowedTools: input.disallowedTools,- envVars: input.envVars,- agentName: input.agentName,- agentHandle: input.agentHandle,- instruction: input.instruction,- };-}+export {+ RUNTIME_CONFIG_VERSION,+ makeRuntimeConfig,+} from "@alook/shared/runtime-config";+export type {+ ReasoningEffort,+ ModelConfig,+ ProviderConfig,+ ModeConfig,+ RuntimeConfig,+} from "@alook/shared/runtime-config";++import type { ReasoningEffort, RuntimeConfig } from "@alook/shared/runtime-config";/* ------------------------------------------------------------------ *//* Resolution — RuntimeConfig → flat launch fields */diff --git a/src/daemon/src/server/contract.ts b/src/daemon/src/server/contract.tsindex d0109c442..433ad860d 100644--- a/src/daemon/src/server/contract.ts+++ b/src/daemon/src/server/contract.ts@@ -1,660 +1,64 @@/*** Server API contract — the agent ⇄ server boundary.*- * This is the single shared contract that BOTH sides implement against:- * - the **agent CLI** (the client) calls these methods;- * - a **server** (real Alook, or the local mock for tests) answers them.- *- * Defining it here lets the CLI and the mock server be built independently and- * integration-tested against the same types.- *- * Domain model (server/channel/message hierarchy):- * User ──< Agent ──< (participates in) Server/workspace ──< Channel ──< Message- * - one User owns many Agents;- * - one Agent participates in many Servers (workspaces);- * - one Server has many Channels (+ DMs + threads);- * => because an agent spans multiple servers, **every Target carries a- * `server` reference** (a bare `#channel` would be ambiguous across servers).- *- * IDs are **nanoid** strings (not UUIDs).- */--/* ------------------------------------------------------------------ */-/* Identifiers */-/* ------------------------------------------------------------------ */--/** All ids are nanoid strings. Aliased for intent at call sites. */-export type Id = string;-export type UserId = Id;-export type AgentId = Id;-export type ServerId = Id;-export type ChannelId = Id;-export type MessageId = Id;--/**- * Per-target monotonically increasing sequence number. Unique and ordered- * WITHIN a target (channel/dm/thread), not globally. Used for ordering,- * pagination anchors, and ack waterlines.- */-export type Seq = number;--/* ------------------------------------------------------------------ */-/* Entity hierarchy */-/* ------------------------------------------------------------------ */--export interface User {- id: UserId;- name: string;-}--export interface Agent {- id: AgentId;- name: string;- /** The User that owns this agent. */- userId: UserId;-}--/** A server == a workspace. An agent participates in many of these. */-export interface Server {- id: ServerId;- name: string;-}--export type ChannelKind = "channel" | "dm";--export interface Channel {- id: ChannelId;- /** The server this channel belongs to — always present. */- serverId: ServerId;- name: string;- kind: ChannelKind;- visibility?: "public" | "private";- description?: string;-}--export type SenderType = "human" | "agent" | "system";--export interface Sender {- id: Id;- type: SenderType;- name: string;- /** Optional title/role text. */- description?: string;-}--/* ------------------------------------------------------------------ */-/* Target — path-style, server-scoped addressing */-/* ------------------------------------------------------------------ */--/**- * The DM pseudo-server segment. DMs are standalone and global — not under any- * real server. In a path ref the DM "server" segment is `.dm`.- */-export const DM_SERVER = ".dm";--/**- * A path-style channel/target ref string — the ONE addressing grammar exposed- * to the agent. Plain and direct:- *- * /<server>/<channel> a channel- * /<server>/<channel>#N the N-th message (seq) in that channel- * /<server>/<channel>/#N the thread rooted at message #N- * /.dm/<peer> a DM (DM is the standalone `.dm` server)- * /.dm/<peer>#N , /.dm/<peer>/#N a DM message / DM thread- *- * A message is located by **channel + seq** (`<channelRef>#N`) — there is no id.- */-export type ChannelRef = string;--/**- * Structured form of a target, kept for internal routing/resolution. The wire/- * agent-facing form is the `ChannelRef` path string above; `parseRef`/`formatRef`- * convert between them.- */-export type Target =- | { server: ServerId; kind: "channel"; channel: ChannelId | string }- | { server: typeof DM_SERVER; kind: "dm"; peer: AgentId | UserId | string }- | {- server: ServerId | typeof DM_SERVER;- kind: "thread";- /** The parent channel (or DM peer) the thread hangs under. */- parentChannel: ChannelId | string;- /** Seq of the root message the thread is rooted at. */- rootSeq: Seq;- };--/* ------------------------------------------------------------------ */-/* Message */-/* ------------------------------------------------------------------ */--/**- * The flat, agent-facing message. This is exactly what the agent sees (one JSON- * object per line, JSONL). Deliberately minimal:- * - `seq` — "#N", the per-channel sequence (locate via channel + seq).- * - `channel` — the path ref, e.g. "/demo-workspace/general" or "/.dm/gustavo".- * - `sender` — "@handle" (no id, no human/agent/system type).- * - `content` — `{ text }` today; an object (not a bare string) so future- * content kinds (attachments, embeds, …) can be added without- * breaking the shape.- * - `time` — ISO-8601 timestamp.- * No `id`, no `type`.- */-export interface MessageContent {- text: string;- /** Future: attachments, embeds, etc. — added without breaking `text`. */- [extra: string]: unknown;-}--export interface Message {- /** Per-channel sequence in display form, e.g. "#12". */- seq: string;- /** Path ref of the containing channel/DM. */- channel: ChannelRef;- /** Sender handle, e.g. "@gustavo". */- sender: string;- content: MessageContent;- /** ISO-8601. */- time: string;-}--/* ------------------------------------------------------------------ */-/* Cursors & pagination */-/* ------------------------------------------------------------------ */--/**- * Per-channel read/ack waterline. `channel` is the path ref; `seq` is the- * numeric high-water mark consumed.- */-export interface Cursor {- channel: ChannelRef;- seq: Seq;-}--export interface Page<T> {- items: T[];- hasMore: boolean;- /** Seq of the newest item in this page, for advancing a cursor. */- latestSeq?: Seq;-}--/* ------------------------------------------------------------------ */-/* Inbox projection */-/* ------------------------------------------------------------------ */--export type InboxFlag = "dm" | "thread" | "mention" | "task";--/** One per channel with pending unread, summarizing the unread without bodies. */-export interface InboxRow {- channel: ChannelRef;- pendingCount: number;- firstPendingSeq?: Seq;- latestSeq?: Seq;- latestSender?: string;- flags: InboxFlag[];-}--export interface InboxSnapshot {- rows: InboxRow[];- /** rows.length. */- pendingChannels: number;- /** Sum of pendingCount across rows. */- pendingMessages: number;-}--/* ------------------------------------------------------------------ */-/* Request / response shapes */-/* ------------------------------------------------------------------ */--export interface InboxPullRequest {- agentId: AgentId;- /** Optional: limit how many full messages to drain (inbox notice is unbounded). */- max?: number;-}-export interface InboxPullResponse {- /** Flat agent-facing messages drained this pull (JSONL on the wire). */- messages: Message[];- /** Whether more unread remain beyond `max`. */- hasMore: boolean;-}--export interface AckRequest {- agentId: AgentId;- /** Per-channel waterlines consumed; server advances each channel's read marker. */- cursors: Cursor[];-}--export interface SendRequest {- agentId: AgentId;- /** Path ref of the destination channel/DM/thread. */- channel: ChannelRef;- content: MessageContent;- /**- * Last seq the agent had seen for this channel — the CHANNEL ALIGNMENT signal.- * If the server has newer messages the agent hasn't seen, the send is BLOCKED- * (see below): the agent must `inboxPull`/`read` to align, then resend. There- * is no bypass — alignment is a hard precondition, so a blanket "force" flag- * can't render it moot.- */- seenUpToSeq?: Seq;-}--/**- * Sent: the message landed. Blocked: the channel has unseen messages the agent- * must align to first (pull, then resend) — `latestSeq` is the current waterline.- */-export type SendResponse =- | { state: "sent"; message: Message }- | { state: "blocked"; reason: "unaligned"; unreadCount: number; latestSeq: Seq };--export interface ReadRequest {- agentId: AgentId;- channel: ChannelRef;- /** Anchor by seq; pick at most one of before/after/around. */- before?: Seq;- after?: Seq;- around?: Seq;- limit?: number;-}--/** Locate one message by channel + seq (there is no message id). */-export interface ResolveRequest {- agentId: AgentId;- channel: ChannelRef;- seq: Seq;-}--export interface ListChannelsRequest {- agentId: AgentId;- /** Restrict to one server; omit to list across all servers the agent is in. */- server?: ServerId;-}--/* ------------------------------------------------------------------ */-/* The ServerApi contract */-/* ------------------------------------------------------------------ */--/**- * What the CLI calls and the (real or mock) server implements. All methods are- * async (network on the real side, in-memory on the mock).- *- * MVP = inboxPull / ack / send / read / listServers / listChannels.- * Everything else (tasks, attachments, reminders, search, profile, reactions)- * is deferred — add to this interface as needed.- *- * Channels are addressed by `ChannelRef` path strings (see `parseRef`/`formatRef`);- * messages by channel + seq. No structured Target or message id crosses the wire.- */-export interface ServerApi {- /** Which servers/workspaces this agent participates in. */- listServers(req: { agentId: AgentId }): Promise<{ servers: Server[] }>;-- /** Channels (and DMs) visible to the agent, optionally scoped to one server. */- listChannels(req: ListChannelsRequest): Promise<{ channels: Channel[] }>;-- /** Drain unread messages for this agent (across all its servers), flat JSONL. */- inboxPull(req: InboxPullRequest): Promise<InboxPullResponse>;-- /** A bodiless summary of pending unread, bucketed per channel. */- inboxSnapshot(req: { agentId: AgentId }): Promise<InboxSnapshot>;-- /** Advance per-channel read waterlines (so drained messages stop reappearing). */- ack(req: AckRequest): Promise<void>;-- /** Send a message to a channel ref. May be held by the freshness guard. */- send(req: SendRequest): Promise<SendResponse>;-- /** Read history for a channel with seq-anchored pagination. */- read(req: ReadRequest): Promise<Page<Message>>;-- /** Look up a single message by channel + seq. */- resolve(req: ResolveRequest): Promise<{ message: Message }>;-}--/* ------------------------------------------------------------------ */-/* Control plane — server → host commands */-/* ------------------------------------------------------------------ */--/**- * Commands the SERVER pushes DOWN to a host (daemon). This is the control plane —- * distinct from the agent-initiated data plane (`ServerApi`). The server owns- * ADDRESSING: every `agent:deliver` already names its recipient `agentId`; the- * host never fans out by channel membership.- */-export type HostCommand =- | {- type: "agent:start";- agentId: AgentId;- /**- * The full structured runtime configuration the server stores for this- * agent (runtime / model / provider / mode / effort). The host resolves it- * into launch fields — see `src/runtimeConfig.ts`.- */- config: import("../runtimeConfig").RuntimeConfig;- /** Resume an existing runtime session, if any (separate from RuntimeConfig). */- sessionId?: string;- /** Optional triggering message delivered with the start. */- wakeMessage?: Message;- /**- * Delivery id for `wakeMessage` (when present), so the host can ack it and- * the server can redeliver the same id on no-ack (at-least-once + dedup).- */- deliveryId?: string;- /** Unique id for this launch (correlates host↔server). */- launchId: string;- }- | { type: "agent:stop"; agentId: AgentId }- | {- type: "agent:deliver";- /** Pre-addressed by the server — host delivers to exactly this agent. */- agentId: AgentId;- message: Message;- /**- * At-least-once delivery id. The host acks it (`agent:deliver:ack`) once the- * message is accepted; the server redelivers the SAME id until acked, and the- * host dedups by id so the agent never sees a duplicate wake.- */- deliveryId: string;- }- // ─── Bot lifecycle events (server → daemon) ────────────────────────────- // Colon-namespaced to match the agent:* naming convention. Delivered to- // the specific machine's daemon connection via the WS DO. On the daemon,- // these mutate the in-memory `botsById` cache and trigger `manager.stop`- // when a running bot's config changes.- | {- type: "bot:added";- botId: AgentId;- name: string;- description?: string;- }- | {- type: "bot:updated";- botId: AgentId;- name: string;- description?: string;- }- | {- type: "bot:removed";- botId: AgentId;- };--/**- * Runtime descriptor carried by every `ready` frame. `status` defaults to- * "healthy" on the wire schema (see CommunityMachineRuntimeSchema) so an- * older daemon that only sends {id, version} still parses; a newer daemon- * carries per-runtime health so /community can flag broken runtimes without- * a machine-level offline signal.- */-export interface HostReadyRuntime {- id: string;- version?: string;- status?: "healthy" | "unhealthy";- lastError?: string;- lastErrorAt?: string;-}--/** What the host reports to the server on connect (the registration handshake). */-export interface HostReady {- /**- * Runtime descriptors. Legacy `runtimes: string[]` has been dropped from- * the wire — `MIN_CLI_VERSION` gates old daemons off. The daemon MUST ship- * every runtime it knows about (healthy AND unhealthy) — filtering is a- * reader-side concern (server-side bot-create validator, client picker).- */- runtimeReport: HostReadyRuntime[];- /** Agents currently running on this host. */- runningAgents: AgentId[];- hostname?: string;- /** `process.platform` value (darwin/linux/win32). Named `platform` to match the shared wire schema. */- platform?: string;- arch?: string;- osRelease?: string;- daemonVersion?: string;-}--/**- * `session.error` frame — daemon → server. Currently used by the daemon's- * agent router when a runtime isn't available on the host.- */-export interface SessionErrorFrame {- type: "session.error";- code: "runtime_not_available";- agentId?: AgentId;- payload?: Record<string, unknown>;-}--/**- * The host's view of the control connection: subscribe to server commands, and- * report readiness / session state up. A local mock host and a real WebSocket- * host both implement this.- */-export interface HostControlChannel {- /** Register the handler for inbound server→host commands. */- onCommand(cb: (cmd: HostCommand) => void | Promise<void>): void;- /** Announce this host + its agents to the server (on connect AND on reconnect). */- reportReady(ready: HostReady): Promise<void>;- /**- * On-demand resend of the current `ready` snapshot. Used by AgentRouter's- * runtime-health mutations to push an updated report without waiting for a- * reconnect. No-ops when the socket isn't open — the next resyncOnConnect- * emits the live snapshot anyway. Optional so LocalControlChannel can omit.- */- sendReady?(ready: HostReady): void;- /** Report an agent's runtime session id (after it starts / resumes). */- reportAgentSession(info: { agentId: AgentId; sessionId: string; launchId: string }): Promise<void>;- /**- * Acknowledge an at-least-once delivery so the server stops redelivering it.- * `status`/`error` are additive — existing callers passing only- * `{ agentId, deliveryId }` still work; the server side reads them when- * present to report an error inline.- */- reportDeliverAck(info: {- agentId: AgentId;- deliveryId: string;- status?: "ok" | "error";- error?: { code: string; message: string };- }): Promise<void>;- /**- * Reply to an `agent:start` command with the launch outcome. New in v0.2.- * Optional so the local mock channel can omit it.- */- reportStartedAck?(info: {- agentId: AgentId;- launchId: string;- status: "ok" | "error";- error?: { code: string; message: string };- }): Promise<void>;- /**- * Reply to an `agent:stop` command with the stop outcome. New in v0.2.- */- reportStoppedAck?(info: {- agentId: AgentId;- status: "ok" | "error";- error?: { code: string; message: string };- }): Promise<void>;- /**- * Report a `session.error` upward. Used by `AgentRouter` when a driver- * can't fulfil an `agent:start` (e.g. runtime not installed) — the server- * routes the frame through the machine DO which stashes it as an overlay- * on the machine summary so the web card renders it inline.- */- reportSessionError?(frame: SessionErrorFrame): Promise<void>;- /**- * Register a resync provider invoked on every (re)connect: it returns the- * host's current `ready` snapshot + live agent sessions, which the channel- * re-sends so the server can recover this host's state after a drop. Optional- * so the in-process `LocalControlChannel` (no reconnect) can omit it.- */- onResync?(provider: () => { ready: HostReady; sessions: AgentSessionReport[] }): void;-}--/** A live agent session the host replays to the server on (re)connect. */-export interface AgentSessionReport {- agentId: AgentId;- sessionId: string;- launchId: string;-}--/* ------------------------------------------------------------------ */-/* WebSocket transport shim (shared by the ws control channel/server) */-/* ------------------------------------------------------------------ */--/**- * The minimal subset of a WebSocket both ws transports use — a single canonical- * shape so the channel (client) and server side don't each redeclare it. Matches- * the `ws` package's socket. `open`/`pong`/`ping` are only used by the client- * side; a server-accepted socket simply never emits/needs them.- */-export interface WebSocketLike {- on(- event: "open" | "close" | "error" | "message" | "pong" | "unexpected-response",- cb: (...args: any[]) => void- ): void;- send(data: string): void;- close(): void;- ping?(): void;-}--/** Builds a client `WebSocketLike` for a url + headers (injected; no hard `ws` dep). */-export type WebSocketFactory = (url: string, headers: Record<string, string>) => WebSocketLike;--/* ------------------------------------------------------------------ */-/* Admin / test surface — provisioning (server-side) */-/* ------------------------------------------------------------------ */--/**- * Server-side provisioning, separate from the agent's daily `ServerApi`. Used by- * the test-server command surface (and, in production, by privileged callers) to- * create servers/agents/channels and inject messages. `postMessage` is what- * drives the control plane: the server computes recipients and emits- * `agent:deliver` (preceded by `agent:start` for any agent not yet running).- */-export interface AdminApi {- /** Create a user (owner of agents). */- createUser(req: { name: string }): Promise<{ user: User }>;- /**- * Create an agent. An agent is a USER's asset and exists independently of any- * server — it joins servers later via `addAgentToServer`. No server here.- */- createAgent(req: { userId: UserId; name: string; runtime?: string; instruction?: string }): Promise<{ agent: Agent }>;- createServer(req: { name: string }): Promise<{ server: Server }>;- /** Membership is a separate agent↔server relation; an agent may join many. */- addAgentToServer(req: { agentId: AgentId; server: ServerId }): Promise<void>;- createChannel(req: { server: ServerId; name: string; kind?: ChannelKind }): Promise<{ channel: Channel }>;- /** Inject a message into a channel (as a human/agent), triggering delivery. */- postMessage(req: { channel: ChannelRef; sender: string; text: string }): Promise<{ message: Message }>;- /**- * Observability-only read of a channel's transcript, for test/provisioning- * tooling (e.g. asserting what agents replied). This is NOT an agent action:- * it carries no agent identity, advances no read waterline, and is unaffected- * by channel alignment. It lives on the admin plane precisely so the agent- * data plane (`ServerApi`) can stay "identity must come through the proxy" —- * a test harness peeking at a transcript must not self-assert an agentId.- */- readChannel(req: { channel: ChannelRef; limit?: number }): Promise<Page<Message>>;-}--/* ------------------------------------------------------------------ */-/* Enrollment — the MACHINE credential surface (server-side) */-/* ------------------------------------------------------------------ */--/**- * The third server-side surface, distinct from `AdminApi` (administrator, creates- * resources) and `ServerApi` (agent, authed by voucher). The caller here is a- * **machine/daemon**, authed by its `machineKey`. It exists for the credential- * bootstrap: an agent has no credential yet, and a daemon must not hold admin- * powers — so a machine exchanges its machineKey for a per-agent **runner key**- * (tier 2) for an agent it runs. The daemon feeds that runner key to its local- * `CredentialBroker`, which mints the per-launch voucher (tier 3).- *- * Trust tiers: machine master key (tier 1, server-issued on enrollment) →- * per-agent runner key (tier 2, this surface) → voucher (tier 3, broker).- */-export interface EnrollmentApi {- /**- * Exchange a valid machine key for a per-agent runner credential. Validates the- * machineKey (401 if unknown) and that the agent exists (404 if not). Returns a- * scoped, revocable `sk_agent_` runner key the daemon's proxy swaps in.- *- * MVP: does NOT yet enforce that `agentId` is bound to this machine (no- * machine↔agent assignment table) — TODO once that ownership model exists.- */- mintAgentCredential(req: { machineKey: string; agentId: AgentId }): Promise<{ runnerKey: string; expiresAt?: number }>;-}--/* ------------------------------------------------------------------ */-/* Errors */-/* ------------------------------------------------------------------ */--export interface ServerApiError {- /** Stable machine code, e.g. "NOT_FOUND", "AMBIGUOUS_REF", "FORBIDDEN". */- code: string;- message: string;- /** Optional recovery hint. */- suggestedNextAction?: string;-}--/* ------------------------------------------------------------------ */-/* ChannelRef <-> structured parsing */-/* ------------------------------------------------------------------ */--/** A parsed channel ref: the channel location + an optional message seq (`#N`). */-export interface ParsedRef {- /** Server segment (a real server id/name, or `.dm`). */- server: string;- /** Channel name (or DM peer when `server === DM_SERVER`). */- channel: string;- /** Thread root seq when the ref points into a thread (`/server/channel/#N`). */- threadRootSeq?: Seq;- /** Message seq when the ref pins a specific message (`/server/channel#N`). */- seq?: Seq;-}--/**- * Parse a path ref into its parts. Grammar:- * /<server>/<channel> → { server, channel }- * /<server>/<channel>#N → { server, channel, seq:N }- * /<server>/<channel>/#N → { server, channel, threadRootSeq:N }- * /.dm/<peer>[...] → DM (server = ".dm", channel = peer)- */-export function parseRef(ref: ChannelRef): ParsedRef {- if (!ref.startsWith("/")) throw new Error(`ref must start with "/": ${ref}`);- const body = ref.slice(1);- const parts = body.split("/");- if (parts.length < 2) throw new Error(`ref needs /<server>/<channel>: ${ref}`);- const server = parts[0];- // Trailing "#N" on the last segment pins a message seq.- let seq: Seq | undefined;- let threadRootSeq: Seq | undefined;-- // Thread form: /server/channel/#N → last part is "#N".- if (parts.length >= 3 && parts[parts.length - 1].startsWith("#")) {- threadRootSeq = parseSeq(parts[parts.length - 1]);- return { server, channel: parts[1], threadRootSeq };- }- // Message form: /server/channel#N (channel segment carries the #N).- const chSeg = parts[1];- const hashIdx = chSeg.indexOf("#");- if (hashIdx >= 0) {- seq = parseSeq(chSeg.slice(hashIdx));- return { server, channel: chSeg.slice(0, hashIdx), seq };- }- return { server, channel: chSeg };-}--/** Format the channel portion of a ParsedRef back to a path ref (no #seq). */-export function formatRef(p: { server: string; channel: string; threadRootSeq?: Seq }): ChannelRef {- const base = `/${p.server}/${p.channel}`;- return p.threadRootSeq !== undefined ? `${base}/#${p.threadRootSeq}` : base;-}--/** "#12" → 12 ; "12" → 12. */-export function parseSeq(s: string): Seq {- const n = Number(s.startsWith("#") ? s.slice(1) : s);- if (!Number.isFinite(n)) throw new Error(`bad seq: ${s}`);- return n;-}--/** 12 → "#12". */-export function formatSeq(seq: Seq): string {- return `#${seq}`;-}+ * This file is now a thin re-export shim. The canonical definitions live in+ * `@alook/shared`'s `community-cli-contract.ts` (lifted there so the real+ * server routes and the wake producer/consumer can share the exact same+ * types this CLI/mock-server pair implements against — see+ * `plans/community-agent-cli-bridge.md` §1). Keep importing from+ * `./contract.js` at existing daemon call sites; nothing else changes.+ */+export type {+ Id,+ UserId,+ AgentId,+ ServerId,+ ChannelId,+ MessageId,+ Seq,+ User,+ Agent,+ Server,+ ChannelKind,+ Channel,+ SenderType,+ Sender,+ ChannelRef,+ Target,+ MessageContent,+ Message,+ Cursor,+ Page,+ InboxFlag,+ InboxRow,+ InboxSnapshot,+ InboxPullRequest,+ InboxPullResponse,+ AckRequest,+ SendRequest,+ SendResponse,+ ReadRequest,+ ResolveRequest,+ ListChannelsRequest,+ ServerApi,+ HostCommand,+ HostReadyRuntime,+ HostReady,+ SessionErrorFrame,+ HostControlChannel,+ AgentSessionReport,+ WebSocketLike,+ WebSocketFactory,+ AdminApi,+ EnrollmentApi,+ ServerApiError,+ ParsedRef,+} from "@alook/shared/community-cli-contract";++export {+ DM_SERVER,+ parseRef,+ formatRef,+ parseSeq,+ formatSeq,+} from "@alook/shared/community-cli-contract";diff --git a/src/daemon/test/e2e/credentialChain.e2e.test.ts b/src/daemon/test/e2e/credentialChain.e2e.test.tsindex 5e21f0bed..f8986725e 100644--- a/src/daemon/test/e2e/credentialChain.e2e.test.ts+++ b/src/daemon/test/e2e/credentialChain.e2e.test.ts@@ -19,7 +19,10 @@ function startBridge(server: MockServer): Promise<{ url: string; seenAgentIds: sconst seenAgentIds: string[] = [];const httpServer = http.createServer((req, res) => {void (async () => {- const m = /^\/api\/(\w+)$/.exec(req.url ?? "");+ // The credential proxy rewrites the CLI's bare `/api/*` ops onto the+ // real server surface at `/api/community/agent/*` (plan §9) before+ // forwarding upstream — match that rewritten path here.+ const m = /^\/api\/community\/agent\/(\w+)$/.exec(req.url ?? "");if (!m) {res.writeHead(404).end();return;diff --git a/src/shared/package.json b/src/shared/package.jsonindex aee5f51c4..3bdf0ded8 100644--- a/src/shared/package.json+++ b/src/shared/package.json@@ -5,7 +5,9 @@"exports": {".": "./src/index.ts","./crypto": "./src/utils/crypto.ts",- "./browser": "./src/browser/index.ts"+ "./browser": "./src/browser/index.ts",+ "./community-cli-contract": "./src/community-cli-contract.ts",+ "./runtime-config": "./src/runtime-config.ts"},"scripts": {"knip": "knip",@@ -25,4 +27,4 @@"typescript": "^6.0.3","vitest": "^4.1.9"}-}+}\ No newline at end of filediff --git a/src/shared/src/community-cli-contract.ts b/src/shared/src/community-cli-contract.tsnew file mode 100644index 000000000..a3d6345d5--- /dev/null+++ b/src/shared/src/community-cli-contract.ts@@ -0,0 +1,665 @@+/**+ * Server API contract — the agent ⇄ server boundary.+ *+ * This is the single shared contract that BOTH sides implement against:+ * - the **agent CLI** (the client) calls these methods;+ * - a **server** (real Alook, or the local mock for tests) answers them.+ *+ * Lifted from `src/daemon/src/server/contract.ts` into `@alook/shared` so the+ * real server routes (`src/web`) and the wake producer/consumer+ * (`src/web`, `src/wake-worker`) can share the exact same types the daemon's+ * CLI and mock server already implement against. `src/daemon`'s+ * `contract.ts` re-exports everything from here — see that file.+ *+ * Domain model (Alook is Discord-like):+ * User ──< Agent ──< (participates in) Server/workspace ──< Channel ──< Message+ * - one User owns many Agents;+ * - one Agent participates in many Servers (workspaces);+ * - one Server has many Channels (+ DMs + threads);+ * => because an agent spans multiple servers, **every Target carries a+ * `server` reference** (a bare `#channel` would be ambiguous across servers).+ *+ * IDs are **nanoid** strings (not UUIDs).+ */++import type { RuntimeConfig } from "./runtime-config";++/* ------------------------------------------------------------------ */+/* Identifiers */+/* ------------------------------------------------------------------ */++/** All ids are nanoid strings. Aliased for intent at call sites. */+export type Id = string;+export type UserId = Id;+export type AgentId = Id;+export type ServerId = Id;+export type ChannelId = Id;+export type MessageId = Id;++/**+ * Per-target monotonically increasing sequence number. Unique and ordered+ * WITHIN a target (channel/dm/thread), not globally. Used for ordering,+ * pagination anchors, and ack waterlines.+ */+export type Seq = number;++/* ------------------------------------------------------------------ */+/* Entity hierarchy */+/* ------------------------------------------------------------------ */++export interface User {+ id: UserId;+ name: string;+}++export interface Agent {+ id: AgentId;+ name: string;+ /** The User that owns this agent. */+ userId: UserId;+}++/** A server == a workspace. An agent participates in many of these. */+export interface Server {+ id: ServerId;+ name: string;+}++export type ChannelKind = "channel" | "dm";++export interface Channel {+ id: ChannelId;+ /** The server this channel belongs to — always present. */+ serverId: ServerId;+ name: string;+ kind: ChannelKind;+ visibility?: "public" | "private";+ description?: string;+}++export type SenderType = "human" | "agent" | "system";++export interface Sender {+ id: Id;+ type: SenderType;+ name: string;+ /** Optional title/role text. */+ description?: string;+}++/* ------------------------------------------------------------------ */+/* Target — path-style, server-scoped addressing */+/* ------------------------------------------------------------------ */++/**+ * The DM pseudo-server segment. DMs are standalone and global (Discord-style) —+ * not under any real server. In a path ref the DM "server" segment is `.dm`.+ */+export const DM_SERVER = ".dm";++/**+ * A path-style channel/target ref string — the ONE addressing grammar exposed+ * to the agent. Plain and direct:+ *+ * /<server>/<channel> a channel+ * /<server>/<channel>#N the N-th message (seq) in that channel+ * /<server>/<channel>/#N the thread rooted at message #N+ * /.dm/<peer> a DM (DM is the standalone `.dm` server)+ * /.dm/<peer>#N , /.dm/<peer>/#N a DM message / DM thread+ *+ * A message is located by **channel + seq** (`<channelRef>#N`) — there is no id.+ */+export type ChannelRef = string;++/**+ * Structured form of a target, kept for internal routing/resolution. The wire/+ * agent-facing form is the `ChannelRef` path string above; `parseRef`/`formatRef`+ * convert between them.+ */+export type Target =+ | { server: ServerId; kind: "channel"; channel: ChannelId | string }+ | { server: typeof DM_SERVER; kind: "dm"; peer: AgentId | UserId | string }+ | {+ server: ServerId | typeof DM_SERVER;+ kind: "thread";+ /** The parent channel (or DM peer) the thread hangs under. */+ parentChannel: ChannelId | string;+ /** Seq of the root message the thread is rooted at. */+ rootSeq: Seq;+ };++/* ------------------------------------------------------------------ */+/* Message */+/* ------------------------------------------------------------------ */++/**+ * The flat, agent-facing message. This is exactly what the agent sees (one JSON+ * object per line, JSONL). Deliberately minimal:+ * - `seq` — "#N", the per-channel sequence (locate via channel + seq).+ * - `channel` — the path ref, e.g. "/demo-workspace/general" or "/.dm/gustavo".+ * - `sender` — "@handle" (no id, no human/agent/system type).+ * - `content` — `{ text }` today; an object (not a bare string) so future+ * content kinds (attachments, embeds, …) can be added without+ * breaking the shape.+ * - `time` — ISO-8601 timestamp.+ * No `id`, no `type`.+ */+export interface MessageContent {+ text: string;+ /** Future: attachments, embeds, etc. — added without breaking `text`. */+ [extra: string]: unknown;+}++export interface Message {+ /** Per-channel sequence in display form, e.g. "#12". */+ seq: string;+ /** Path ref of the containing channel/DM. */+ channel: ChannelRef;+ /** Sender handle, e.g. "@gustavo". */+ sender: string;+ content: MessageContent;+ /** ISO-8601. */+ time: string;+}++/* ------------------------------------------------------------------ */+/* Cursors & pagination */+/* ------------------------------------------------------------------ */++/**+ * Per-channel read/ack waterline. `channel` is the path ref; `seq` is the+ * numeric high-water mark consumed.+ */+export interface Cursor {+ channel: ChannelRef;+ seq: Seq;+}++export interface Page<T> {+ items: T[];+ hasMore: boolean;+ /** Seq of the newest item in this page, for advancing a cursor. */+ latestSeq?: Seq;+}++/* ------------------------------------------------------------------ */+/* Inbox projection */+/* ------------------------------------------------------------------ */++export type InboxFlag = "dm" | "thread" | "mention" | "task";++/** One per channel with pending unread, summarizing the unread without bodies. */+export interface InboxRow {+ channel: ChannelRef;+ pendingCount: number;+ firstPendingSeq?: Seq;+ latestSeq?: Seq;+ latestSender?: string;+ flags: InboxFlag[];+}++export interface InboxSnapshot {+ rows: InboxRow[];+ /** rows.length. */+ pendingChannels: number;+ /** Sum of pendingCount across rows. */+ pendingMessages: number;+}++/* ------------------------------------------------------------------ */+/* Request / response shapes */+/* ------------------------------------------------------------------ */++export interface InboxPullRequest {+ agentId: AgentId;+ /** Optional: limit how many full messages to drain (inbox notice is unbounded). */+ max?: number;+}+export interface InboxPullResponse {+ /** Flat agent-facing messages drained this pull (JSONL on the wire). */+ messages: Message[];+ /** Whether more unread remain beyond `max`. */+ hasMore: boolean;+}++export interface AckRequest {+ agentId: AgentId;+ /** Per-channel waterlines consumed; server advances each channel's read marker. */+ cursors: Cursor[];+}++export interface SendRequest {+ agentId: AgentId;+ /** Path ref of the destination channel/DM/thread. */+ channel: ChannelRef;+ content: MessageContent;+ /**+ * Last seq the agent had seen for this channel — the CHANNEL ALIGNMENT signal.+ * If the server has newer messages the agent hasn't seen, the send is BLOCKED+ * (see below): the agent must `inboxPull`/`read` to align, then resend. There+ * is no bypass — alignment is a hard precondition, so a blanket "force" flag+ * can't render it moot.+ */+ seenUpToSeq?: Seq;+}++/**+ * Sent: the message landed. Blocked: the channel has unseen messages the agent+ * must align to first (pull, then resend) — `latestSeq` is the current waterline.+ */+export type SendResponse =+ | { state: "sent"; message: Message }+ | { state: "blocked"; reason: "unaligned"; unreadCount: number; latestSeq: Seq };++export interface ReadRequest {+ agentId: AgentId;+ channel: ChannelRef;+ /** Anchor by seq; pick at most one of before/after/around. */+ before?: Seq;+ after?: Seq;+ around?: Seq;+ limit?: number;+}++/** Locate one message by channel + seq (there is no message id). */+export interface ResolveRequest {+ agentId: AgentId;+ channel: ChannelRef;+ seq: Seq;+}++export interface ListChannelsRequest {+ agentId: AgentId;+ /** Restrict to one server; omit to list across all servers the agent is in. */+ server?: ServerId;+}++/* ------------------------------------------------------------------ */+/* The ServerApi contract */+/* ------------------------------------------------------------------ */++/**+ * What the CLI calls and the (real or mock) server implements. All methods are+ * async (network on the real side, in-memory on the mock).+ *+ * MVP = inboxPull / ack / send / read / listServers / listChannels.+ * Everything else (tasks, attachments, reminders, search, profile, reactions)+ * is deferred — add to this interface as needed.+ *+ * Channels are addressed by `ChannelRef` path strings (see `parseRef`/`formatRef`);+ * messages by channel + seq. No structured Target or message id crosses the wire.+ */+export interface ServerApi {+ /** Which servers/workspaces this agent participates in. */+ listServers(req: { agentId: AgentId }): Promise<{ servers: Server[] }>;++ /** Channels (and DMs) visible to the agent, optionally scoped to one server. */+ listChannels(req: ListChannelsRequest): Promise<{ channels: Channel[] }>;++ /** Drain unread messages for this agent (across all its servers), flat JSONL. */+ inboxPull(req: InboxPullRequest): Promise<InboxPullResponse>;++ /** A bodiless summary of pending unread, bucketed per channel. */+ inboxSnapshot(req: { agentId: AgentId }): Promise<InboxSnapshot>;++ /** Advance per-channel read waterlines (so drained messages stop reappearing). */+ ack(req: AckRequest): Promise<void>;++ /** Send a message to a channel ref. May be held by the freshness guard. */+ send(req: SendRequest): Promise<SendResponse>;++ /** Read history for a channel with seq-anchored pagination. */+ read(req: ReadRequest): Promise<Page<Message>>;++ /** Look up a single message by channel + seq. */+ resolve(req: ResolveRequest): Promise<{ message: Message }>;+}++/* ------------------------------------------------------------------ */+/* Control plane — server → host commands */+/* ------------------------------------------------------------------ */++/**+ * Commands the SERVER pushes DOWN to a host (daemon). This is the control plane —+ * distinct from the agent-initiated data plane (`ServerApi`). The server owns+ * ADDRESSING: every `agent:deliver` already names its recipient `agentId`; the+ * host never fans out by channel membership.+ */+export type HostCommand =+ | {+ type: "agent:start";+ agentId: AgentId;+ /**+ * The full structured runtime configuration the server stores for this+ * agent (runtime / model / provider / mode / effort). The host resolves it+ * into launch fields — see `runtime-config.ts`.+ */+ config: RuntimeConfig;+ /** Resume an existing runtime session, if any (separate from RuntimeConfig). */+ sessionId?: string;+ /** Optional triggering message delivered with the start. */+ wakeMessage?: Message;+ /**+ * Delivery id for `wakeMessage` (when present), so the host can ack it and+ * the server can redeliver the same id on no-ack (at-least-once + dedup).+ */+ deliveryId?: string;+ /** Unique id for this launch (correlates host↔server). */+ launchId: string;+ }+ | { type: "agent:stop"; agentId: AgentId }+ | {+ type: "agent:deliver";+ /** Pre-addressed by the server — host delivers to exactly this agent. */+ agentId: AgentId;+ message: Message;+ /**+ * At-least-once delivery id. The host acks it (`agent:deliver:ack`) once the+ * message is accepted; the server redelivers the SAME id until acked, and the+ * host dedups by id so the agent never sees a duplicate wake.+ */+ deliveryId: string;+ }+ // ─── Bot lifecycle events (server → daemon) ────────────────────────────+ // Colon-namespaced to match the agent:* naming convention. Delivered to+ // the specific machine's daemon connection via the WS DO. On the daemon,+ // these mutate the in-memory `botsById` cache and trigger `manager.stop`+ // when a running bot's config changes.+ | {+ type: "bot:added";+ botId: AgentId;+ name: string;+ description?: string;+ }+ | {+ type: "bot:updated";+ botId: AgentId;+ name: string;+ description?: string;+ }+ | {+ type: "bot:removed";+ botId: AgentId;+ };++/**+ * Runtime descriptor carried by every `ready` frame. `status` defaults to+ * "healthy" on the wire schema (see CommunityMachineRuntimeSchema) so an+ * older daemon that only sends {id, version} still parses; a newer daemon+ * carries per-runtime health so /community can flag broken runtimes without+ * a machine-level offline signal.+ */+export interface HostReadyRuntime {+ id: string;+ version?: string;+ status?: "healthy" | "unhealthy";+ lastError?: string;+ lastErrorAt?: string;+}++/** What the host reports to the server on connect (the registration handshake). */+export interface HostReady {+ /**+ * Runtime descriptors. Legacy `runtimes: string[]` has been dropped from+ * the wire — `MIN_CLI_VERSION` gates old daemons off. The daemon MUST ship+ * every runtime it knows about (healthy AND unhealthy) — filtering is a+ * reader-side concern (server-side bot-create validator, client picker).+ */+ runtimeReport: HostReadyRuntime[];+ /** Agents currently running on this host. */+ runningAgents: AgentId[];+ hostname?: string;+ /** `process.platform` value (darwin/linux/win32). Named `platform` to match the shared wire schema. */+ platform?: string;+ arch?: string;+ osRelease?: string;+ daemonVersion?: string;+}++/**+ * `session.error` frame — daemon → server. Currently used by the daemon's+ * agent router when a runtime isn't available on the host.+ */+export interface SessionErrorFrame {+ type: "session.error";+ code: "runtime_not_available";+ agentId?: AgentId;+ payload?: Record<string, unknown>;+}++/**+ * The host's view of the control connection: subscribe to server commands, and+ * report readiness / session state up. A local mock host and a real WebSocket+ * host both implement this.+ */+export interface HostControlChannel {+ /** Register the handler for inbound server→host commands. */+ onCommand(cb: (cmd: HostCommand) => void | Promise<void>): void;+ /** Announce this host + its agents to the server (on connect AND on reconnect). */+ reportReady(ready: HostReady): Promise<void>;+ /**+ * On-demand resend of the current `ready` snapshot. Used by AgentRouter's+ * runtime-health mutations to push an updated report without waiting for a+ * reconnect. No-ops when the socket isn't open — the next resyncOnConnect+ * emits the live snapshot anyway. Optional so LocalControlChannel can omit.+ */+ sendReady?(ready: HostReady): void;+ /** Report an agent's runtime session id (after it starts / resumes). */+ reportAgentSession(info: { agentId: AgentId; sessionId: string; launchId: string }): Promise<void>;+ /**+ * Acknowledge an at-least-once delivery so the server stops redelivering it.+ * `status`/`error` are additive — existing callers passing only+ * `{ agentId, deliveryId }` still work; the server side reads them when+ * present to report an error inline.+ */+ reportDeliverAck(info: {+ agentId: AgentId;+ deliveryId: string;+ status?: "ok" | "error";+ error?: { code: string; message: string };+ }): Promise<void>;+ /**+ * Reply to an `agent:start` command with the launch outcome. New in v0.2.+ * Optional so the local mock channel can omit it.+ */+ reportStartedAck?(info: {+ agentId: AgentId;+ launchId: string;+ status: "ok" | "error";+ error?: { code: string; message: string };+ }): Promise<void>;+ /**+ * Reply to an `agent:stop` command with the stop outcome. New in v0.2.+ */+ reportStoppedAck?(info: {+ agentId: AgentId;+ status: "ok" | "error";+ error?: { code: string; message: string };+ }): Promise<void>;+ /**+ * Report a `session.error` upward. Used by `AgentRouter` when a driver+ * can't fulfil an `agent:start` (e.g. runtime not installed) — the server+ * routes the frame through the machine DO which stashes it as an overlay+ * on the machine summary so the web card renders it inline.+ */+ reportSessionError?(frame: SessionErrorFrame): Promise<void>;+ /**+ * Register a resync provider invoked on every (re)connect: it returns the+ * host's current `ready` snapshot + live agent sessions, which the channel+ * re-sends so the server can recover this host's state after a drop. Optional+ * so the in-process `LocalControlChannel` (no reconnect) can omit it.+ */+ onResync?(provider: () => { ready: HostReady; sessions: AgentSessionReport[] }): void;+}++/** A live agent session the host replays to the server on (re)connect. */+export interface AgentSessionReport {+ agentId: AgentId;+ sessionId: string;+ launchId: string;+}++/* ------------------------------------------------------------------ */+/* WebSocket transport shim (shared by the ws control channel/server) */+/* ------------------------------------------------------------------ */++/**+ * The minimal subset of a WebSocket both ws transports use — a single canonical+ * shape so the channel (client) and server side don't each redeclare it. Matches+ * the `ws` package's socket. `open`/`pong`/`ping` are only used by the client+ * side; a server-accepted socket simply never emits/needs them.+ */+export interface WebSocketLike {+ on(+ event: "open" | "close" | "error" | "message" | "pong" | "unexpected-response",+ cb: (...args: any[]) => void+ ): void;+ send(data: string): void;+ close(): void;+ ping?(): void;+}++/** Builds a client `WebSocketLike` for a url + headers (injected; no hard `ws` dep). */+export type WebSocketFactory = (url: string, headers: Record<string, string>) => WebSocketLike;++/* ------------------------------------------------------------------ */+/* Admin / test surface — provisioning (server-side) */+/* ------------------------------------------------------------------ */++/**+ * Server-side provisioning, separate from the agent's daily `ServerApi`. Used by+ * the test-server command surface (and, in production, by privileged callers) to+ * create servers/agents/channels and inject messages. `postMessage` is what+ * drives the control plane: the server computes recipients and emits+ * `agent:deliver` (preceded by `agent:start` for any agent not yet running).+ */+export interface AdminApi {+ /** Create a user (owner of agents). */+ createUser(req: { name: string }): Promise<{ user: User }>;+ /**+ * Create an agent. An agent is a USER's asset and exists independently of any+ * server — it joins servers later via `addAgentToServer`. No server here.+ */+ createAgent(req: { userId: UserId; name: string; runtime?: string; instruction?: string }): Promise<{ agent: Agent }>;+ createServer(req: { name: string }): Promise<{ server: Server }>;+ /** Membership is a separate agent↔server relation; an agent may join many. */+ addAgentToServer(req: { agentId: AgentId; server: ServerId }): Promise<void>;+ createChannel(req: { server: ServerId; name: string; kind?: ChannelKind }): Promise<{ channel: Channel }>;+ /** Inject a message into a channel (as a human/agent), triggering delivery. */+ postMessage(req: { channel: ChannelRef; sender: string; text: string }): Promise<{ message: Message }>;+ /**+ * Observability-only read of a channel's transcript, for test/provisioning+ * tooling (e.g. asserting what agents replied). This is NOT an agent action:+ * it carries no agent identity, advances no read waterline, and is unaffected+ * by channel alignment. It lives on the admin plane precisely so the agent+ * data plane (`ServerApi`) can stay "identity must come through the proxy" —+ * a test harness peeking at a transcript must not self-assert an agentId.+ */+ readChannel(req: { channel: ChannelRef; limit?: number }): Promise<Page<Message>>;+}++/* ------------------------------------------------------------------ */+/* Enrollment — the MACHINE credential surface (server-side) */+/* ------------------------------------------------------------------ */++/**+ * The third server-side surface, distinct from `AdminApi` (administrator, creates+ * resources) and `ServerApi` (agent, authed by voucher). The caller here is a+ * **machine/daemon**, authed by its `machineKey`. It exists for the credential+ * bootstrap: an agent has no credential yet, and a daemon must not hold admin+ * powers — so a machine exchanges its machineKey for a per-agent **runner key**+ * (tier 2) for an agent it runs. The daemon feeds that runner key to its local+ * `CredentialBroker`, which mints the per-launch voucher (tier 3).+ *+ * Trust tiers: machine master key (tier 1, server-issued on enrollment) →+ * per-agent runner key (tier 2, this surface) → voucher (tier 3, broker).+ */+export interface EnrollmentApi {+ /**+ * Exchange a valid machine key for a per-agent runner credential. Validates the+ * machineKey (401 if unknown) and that the agent exists (404 if not). Returns a+ * scoped, revocable `sk_agent_` runner key the daemon's proxy swaps in.+ *+ * MVP: does NOT yet enforce that `agentId` is bound to this machine (no+ * machine↔agent assignment table) — TODO once that ownership model exists.+ */+ mintAgentCredential(req: { machineKey: string; agentId: AgentId }): Promise<{ runnerKey: string; expiresAt?: number }>;+}++/* ------------------------------------------------------------------ */+/* Errors */+/* ------------------------------------------------------------------ */++export interface ServerApiError {+ /** Stable machine code, e.g. "NOT_FOUND", "AMBIGUOUS_REF", "FORBIDDEN". */+ code: string;+ message: string;+ /** Optional recovery hint. */+ suggestedNextAction?: string;+}++/* ------------------------------------------------------------------ */+/* ChannelRef <-> structured parsing */+/* ------------------------------------------------------------------ */++/** A parsed channel ref: the channel location + an optional message seq (`#N`). */+export interface ParsedRef {+ /** Server segment (a real server id/name, or `.dm`). */+ server: string;+ /** Channel name (or DM peer when `server === DM_SERVER`). */+ channel: string;+ /** Thread root seq when the ref points into a thread (`/server/channel/#N`). */+ threadRootSeq?: Seq;+ /** Message seq when the ref pins a specific message (`/server/channel#N`). */+ seq?: Seq;+}++/**+ * Parse a path ref into its parts. Grammar:+ * /<server>/<channel> → { server, channel }+ * /<server>/<channel>#N → { server, channel, seq:N }+ * /<server>/<channel>/#N → { server, channel, threadRootSeq:N }+ * /.dm/<peer>[...] → DM (server = ".dm", channel = peer)+ */+export function parseRef(ref: ChannelRef): ParsedRef {+ if (!ref.startsWith("/")) throw new Error(`ref must start with "/": ${ref}`);+ const body = ref.slice(1);+ const parts = body.split("/");+ if (parts.length < 2) throw new Error(`ref needs /<server>/<channel>: ${ref}`);+ const server = parts[0];+ // Trailing "#N" on the last segment pins a message seq.+ let seq: Seq | undefined;+ let threadRootSeq: Seq | undefined;++ // Thread form: /server/channel/#N → last part is "#N".+ if (parts.length >= 3 && parts[parts.length - 1].startsWith("#")) {+ threadRootSeq = parseSeq(parts[parts.length - 1]);+ return { server, channel: parts[1], threadRootSeq };+ }+ // Message form: /server/channel#N (channel segment carries the #N).+ const chSeg = parts[1];+ const hashIdx = chSeg.indexOf("#");+ if (hashIdx >= 0) {+ seq = parseSeq(chSeg.slice(hashIdx));+ return { server, channel: chSeg.slice(0, hashIdx), seq };+ }+ return { server, channel: chSeg };+}++/** Format the channel portion of a ParsedRef back to a path ref (no #seq). */+export function formatRef(p: { server: string; channel: string; threadRootSeq?: Seq }): ChannelRef {+ const base = `/${p.server}/${p.channel}`;+ return p.threadRootSeq !== undefined ? `${base}/#${p.threadRootSeq}` : base;+}++/** "#12" → 12 ; "12" → 12. */+export function parseSeq(s: string): Seq {+ const n = Number(s.startsWith("#") ? s.slice(1) : s);+ if (!Number.isFinite(n)) throw new Error(`bad seq: ${s}`);+ return n;+}++/** 12 → "#12". */+export function formatSeq(seq: Seq): string {+ return `#${seq}`;+}diff --git a/src/shared/src/community/wake-dispatch.ts b/src/shared/src/community/wake-dispatch.tsnew file mode 100644index 000000000..f1807ecb7--- /dev/null+++ b/src/shared/src/community/wake-dispatch.ts@@ -0,0 +1,71 @@+import type { HostCommand } from "../community-cli-contract";++/**+ * Deliberately NOT `@cloudflare/workers-types`' `Fetcher` — this module is+ * imported (transitively, via the `@alook/shared` barrel) by non-Workers+ * consumers too (`@alook/cli`, `@alook/daemon`), whose tsconfigs don't+ * include `@cloudflare/workers-types` in `types`. A real `Fetcher` service+ * binding satisfies this structurally at the two real call sites+ * (`src/web`, `src/wake-worker`, both of which DO have workers-types).+ */+interface FetcherLike {+ fetch(input: string, init?: RequestInit): Promise<Response>;+}++/** One `WAKE_QUEUE` message — the producer (`src/web`'s `enqueueBotWakes`)+ * builds the full `HostCommand` up front (it has D1 access); the consumer+ * (`src/wake-worker`) is a dumb, stateless forwarder that never touches D1. */+export interface WakePayload {+ botUserId: string;+ machineId: string;+ command: HostCommand;+}++/**+ * Thin wake-dispatch seam (plan §8/#13). Lives in `src/shared` (not+ * `src/web`) because BOTH the `src/web` wake producer AND the+ * `src/wake-worker` queue consumer need it, and the consumer has no+ * `@opennextjs/cloudflare` / Next.js context — this module does a plain+ * `Fetcher.fetch`, nothing CF-Workers-Next.js-specific.+ *+ * `env.WS_DO_WORKER` is a service binding to the `alook-ws-do` worker's HTTP+ * surface (never a raw DO namespace — `src/web`/`src/wake-worker` cannot+ * fetch a DO stub directly). This function POSTs an already-fully-built+ * `HostCommand` to that worker's `/community-machine/by-id/<machineId>/forward-agent-start`+ * route and normalizes the response to a boolean — it never inspects,+ * validates, or constructs any part of `command`, and it never exposes the+ * DO-naming mechanics (no public `getMachineDoName` here or anywhere else).+ *+ * Error contract (load-bearing for the queue consumer's retry semantics):+ * - `{ sent: true }` — at least one live doName's DO forwarded the command+ * to an authenticated daemon WebSocket.+ * - `{ sent: false }` — the ws-do route responded 200 with `{ sent: 0 }`:+ * no active credential for this machine, or a live credential but no open+ * WS (daemon offline). This is a known-permanent state for this attempt —+ * the consumer must `ack()`, not `retry()`. Daemon reconnect warmup+ * recovers on its own.+ * - throws — the ws-do route (or the service-binding fetch itself) returned+ * non-2xx, or the fetch itself threw (network error/timeout). This is+ * transient — the consumer must `retry()`. Never swallowed into+ * `{ sent: false }`, or a real outage would look identical to "daemon is+ * just offline" and stop retrying.+ */+export async function sendWakeToMachine(+ env: { WS_DO_WORKER: FetcherLike },+ machineId: string,+ command: HostCommand+): Promise<{ sent: boolean }> {+ const path = `/community-machine/by-id/${encodeURIComponent(machineId)}/forward-agent-start`;+ const res = await env.WS_DO_WORKER.fetch(`http://internal${path}`, {+ method: "POST",+ headers: { "content-type": "application/json" },+ body: JSON.stringify(command),+ });++ if (!res.ok) {+ throw new Error(`sendWakeToMachine: ws-do route returned ${res.status} for machine ${machineId}`);+ }++ const data = (await res.json()) as { sent?: number };+ return { sent: (data.sent ?? 0) > 0 };+}diff --git a/src/shared/src/db/community-schema.ts b/src/shared/src/db/community-schema.tsindex 2024122e9..0efa667c2 100644--- a/src/shared/src/db/community-schema.ts+++ b/src/shared/src/db/community-schema.ts@@ -115,6 +115,12 @@ export const communityMessage = sqliteTable(() => communityDmConversation.id,{ onDelete: "cascade" }),+ // Per-scope (channel or DM) monotonic sequence, assigned atomically via+ // `community_message_seq` (see queries/community/message.ts `createMessage`).+ // 0 is a legacy sentinel for pre-migration rows — never addressable by+ // seq. Uniqueness enforced by partial indexes in migration 0052 (excluded+ // here since Drizzle doesn't support partial indexes in the schema DSL).+ seq: integer("seq").notNull().default(0),},(t) => [index("idx_message_channel_created").on(t.channelId, t.createdAt),@@ -127,6 +133,14 @@ export const communityMessage = sqliteTable(]);+// 6. community_message_seq — atomic per-scope sequence counter.+// See plans/community-agent-cli-bridge.md design §3. `nextSeq` holds the most+// recently issued value (not "the next value to hand out" despite the name).+export const communityMessageSeq = sqliteTable("community_message_seq", {+ scopeKey: text("scope_key").primaryKey(), // 'channel:<id>' or 'dm:<id>'+ nextSeq: integer("next_seq").notNull(),+});+// 7. community_server_memberexport const communityServerMember = sqliteTable("community_server_member",@@ -264,6 +278,13 @@ export const communityReadState = sqliteTable(// INVARIANT: non-null whenever the row exists. Route writes through// `markReadToMessageBuilder` — never null out.lastReadMessageId: text("last_read_message_id"),+ // Shared per-user cursor for humans AND bots (bots ARE users invariant).+ // Populated by: the author read-watermark upsert inside `createMessage`+ // (every author, bot or human), and `bumpReadCursor` (agent `ack` route+ // only). NOT maintained by the human-only read routes+ // (`markReadToMessageBuilder`/`markReadToMessage`/`markAllServerChannelsRead`)+ // — an explicit, documented gap, see plans/community-agent-cli-bridge.md §4.+ lastReadSeq: integer("last_read_seq").notNull().default(0),},(t) => [index("idx_read_state_user").on(t.userId)]);diff --git a/src/shared/src/db/queries-index.ts b/src/shared/src/db/queries-index.tsindex 4288e9636..cd1aa337d 100644--- a/src/shared/src/db/queries-index.ts+++ b/src/shared/src/db/queries-index.ts@@ -51,3 +51,4 @@ export * as communityServerFolder from "./queries/community/server-folder";export * as communityInbox from "./queries/community/inbox";export * as communityMachine from "./queries/community/machine";export * as communityBot from "./queries/community/bot";+export * as communityAgentInbox from "./queries/community/agent-inbox";diff --git a/src/shared/src/db/queries/community/agent-inbox.ts b/src/shared/src/db/queries/community/agent-inbox.tsnew file mode 100644index 000000000..58bf01c61--- /dev/null+++ b/src/shared/src/db/queries/community/agent-inbox.ts@@ -0,0 +1,464 @@+/**+ * Seq-based queries powering the `/api/community/agent/*` CLI bridge routes+ * (plans/community-agent-cli-bridge.md §7) plus `toAgentMessages`, the+ * DB-row → wire-`Message` projector every route that returns message bodies+ * uses (mirrors `src/daemon/src/server/mockServer.ts:548`'s `toAgentMessage`).+ *+ * Kept in its own module (rather than folded into `message.ts`) because+ * every function here is agent-CLI-specific (seq-ordered, ref-formatted,+ * self-message-excluding) — a different shape from `message.ts`'s+ * `createdAt`-ordered, DB-shaped human-UI queries.+ */+import { eq, and, or, inArray, gt, lt, ne, asc, desc, sql, isNotNull } from "drizzle-orm";+import {+ communityMessage,+ communityChannel,+ communityDmConversation,+ communityServer,+ communityReadState,+ communityMessageSeq,+ communityServerMember,+} from "../../community-schema";+import { user } from "../../schema";+import type { Database } from "../../index";+import { formatRef, formatSeq, DM_SERVER, type Message, type Seq } from "../../../community-cli-contract";++type RawAgentMessage = {+ id: string;+ authorId: string;+ content: string;+ createdAt: string;+ channelId: string | null;+ dmConversationId: string | null;+ seq: number;+};++const AGENT_MESSAGE_COLUMNS = {+ id: communityMessage.id,+ authorId: communityMessage.authorId,+ content: communityMessage.content,+ createdAt: communityMessage.createdAt,+ channelId: communityMessage.channelId,+ dmConversationId: communityMessage.dmConversationId,+ seq: communityMessage.seq,+} as const;++/** One entry per distinct scope (channel or DM) needing a `ChannelRef`. */+type ScopeInfo = { ref: string; isThread: boolean };++/**+ * Batch-resolve a set of channel/DM scopes into their `ChannelRef` path+ * strings — the shared plumbing behind `toAgentMessages` (per-message refs)+ * AND `getInboxSnapshotForAgent` (per-scope `InboxRow.channel` + `thread`+ * flag), so both hydrate refs identically instead of two divergent+ * implementations. Keyed by `channelId` for channel/thread scopes, or+ * `` `dm:${dmConversationId}` `` for DM scopes (channel ids and DM ids are+ * both nanoids from the same id-space, so the `dm:` prefix avoids an+ * accidental collision between the two key spaces).+ */+async function resolveScopeRefs(+ db: Database,+ scopes: Array<{ channelId: string | null; dmConversationId: string | null }>,+ viewerId: string+): Promise<Map<string, ScopeInfo>> {+ const channelIds = [...new Set(scopes.map((s) => s.channelId).filter((x): x is string => !!x))];+ const dmIds = [...new Set(scopes.map((s) => s.dmConversationId).filter((x): x is string => !!x))];++ const [channels, dms] = await Promise.all([+ channelIds.length+ ? db+ .select({+ id: communityChannel.id,+ name: communityChannel.name,+ serverId: communityChannel.serverId,+ parentChannelId: communityChannel.parentChannelId,+ parentMessageId: communityChannel.parentMessageId,+ })+ .from(communityChannel)+ .where(inArray(communityChannel.id, channelIds))+ : Promise.resolve([]),+ dmIds.length+ ? db.select().from(communityDmConversation).where(inArray(communityDmConversation.id, dmIds))+ : Promise.resolve([]),+ ]);++ const channelById = new Map(channels.map((c) => [c.id, c]));+ const dmById = new Map(dms.map((d) => [d.id, d]));++ const parentChannelIds = [+ ...new Set(channels.map((c) => c.parentChannelId).filter((x): x is string => !!x)),+ ];+ const parentMessageIds = [+ ...new Set(channels.map((c) => c.parentMessageId).filter((x): x is string => !!x)),+ ];+ const serverIds = [...new Set(channels.map((c) => c.serverId))];++ const [parentChannels, servers, parentMessages] = await Promise.all([+ parentChannelIds.length+ ? db+ .select({ id: communityChannel.id, name: communityChannel.name })+ .from(communityChannel)+ .where(inArray(communityChannel.id, parentChannelIds))+ : Promise.resolve([]),+ serverIds.length+ ? db.select({ id: communityServer.id, name: communityServer.name }).from(communityServer).where(inArray(communityServer.id, serverIds))+ : Promise.resolve([]),+ parentMessageIds.length+ ? db.select({ id: communityMessage.id, seq: communityMessage.seq }).from(communityMessage).where(inArray(communityMessage.id, parentMessageIds))+ : Promise.resolve([]),+ ]);++ const parentChannelById = new Map(parentChannels.map((c) => [c.id, c]));+ const serverNameById = new Map(servers.map((s) => [s.id, s.name]));+ const parentSeqById = new Map(parentMessages.map((m) => [m.id, m.seq]));++ const out = new Map<string, ScopeInfo>();+ for (const ch of channels) {+ const serverName = serverNameById.get(ch.serverId) ?? ch.serverId;+ if (ch.parentChannelId && ch.parentMessageId) {+ const parent = parentChannelById.get(ch.parentChannelId);+ const rootSeq = parentSeqById.get(ch.parentMessageId);+ if (parent && rootSeq !== undefined) {+ out.set(ch.id, {+ ref: formatRef({ server: serverName, channel: parent.name, threadRootSeq: rootSeq }),+ isThread: true,+ });+ continue;+ }+ }+ out.set(ch.id, { ref: formatRef({ server: serverName, channel: ch.name }), isThread: false });+ }+ for (const dm of dms) {+ const peerId = dm.user1Id === viewerId ? dm.user2Id : dm.user1Id;+ out.set(`dm:${dm.id}`, { ref: formatRef({ server: DM_SERVER, channel: peerId || "unknown" }), isThread: false });+ }+ return out;+}++function scopeRefKey(scope: { channelId: string | null; dmConversationId: string | null }): string {+ return scope.channelId ?? `dm:${scope.dmConversationId}`;+}++/**+ * Batch-hydrate raw message rows into wire `Message`s. `viewerId` is+ * required to resolve DM peer segments — `/.dm/<peer>` is always the OTHER+ * party relative to whichever bot identity is being served (every route+ * that returns messages serves exactly one bot identity per call, so this+ * is unambiguous). No `id` field is ever included on the wire — messages+ * are addressed by channel + seq only (contract doc, `community-cli-contract.ts`).+ */+export async function toAgentMessages(+ db: Database,+ rows: RawAgentMessage[],+ viewerId: string+): Promise<Message[]> {+ if (rows.length === 0) return [];++ const [refs, users] = await Promise.all([+ resolveScopeRefs(db, rows, viewerId),+ db+ .select({ id: user.id, name: user.name })+ .from(user)+ .where(inArray(user.id, [...new Set(rows.map((r) => r.authorId))])),+ ]);+ const userNameById = new Map(users.map((u) => [u.id, u.name]));++ return rows.map((r) => {+ const scope = refs.get(scopeRefKey(r));+ const channel = scope?.ref ?? `/unknown/${scopeRefKey(r)}`;+ const senderName = userNameById.get(r.authorId) ?? r.authorId;+ return {+ seq: formatSeq(r.seq),+ channel,+ sender: `@${senderName}`,+ content: { text: r.content },+ time: r.createdAt,+ };+ });+}++/** Single-row convenience wrapper around `toAgentMessages`. */+export async function toAgentMessage(db: Database, row: RawAgentMessage, viewerId: string): Promise<Message> {+ const [msg] = await toAgentMessages(db, [row], viewerId);+ return msg!;+}++/**+ * The counter's `next_seq` holds the most recently issued value (NOT "the+ * next value to hand out" despite the column name) — 0 if no message has+ * ever been sent in this scope. Used by the `send` route's alignment gate.+ */+export async function getLatestSeqForScope(db: Database, scopeKey: string): Promise<Seq> {+ const rows = await db+ .select({ nextSeq: communityMessageSeq.nextSeq })+ .from(communityMessageSeq)+ .where(eq(communityMessageSeq.scopeKey, scopeKey));+ return rows[0]?.nextSeq ?? 0;+}++/**+ * Cross-channel unread fill for `inboxPull`, grouped by channel/DM (not+ * global seq order — `seq` is a per-scope counter, comparing raw values+ * across scopes is meaningless, see plan §7 v4). Always drains one channel's+ * unread completely (in seq order) before starting the next. Excludes the+ * bot's own authored messages (mirrors `mockServer.ts:391`). Never mutates+ * read state. Scope checks happen in SQL before returning rows: channel+ * messages require server membership, and DM messages require participation.+ */+export async function listUnreadMessagesForAgent(+ db: Database,+ botUserId: string,+ opts: { max: number }+): Promise<RawAgentMessage[]> {+ const rows = await db+ .select({+ ...AGENT_MESSAGE_COLUMNS,+ lastReadSeq: sql<number>`COALESCE(${communityReadState.lastReadSeq}, 0)`,+ })+ .from(communityMessage)+ .leftJoin(communityChannel, eq(communityChannel.id, communityMessage.channelId))+ .leftJoin(+ communityServerMember,+ and(eq(communityServerMember.serverId, communityChannel.serverId), eq(communityServerMember.userId, botUserId))+ )+ .leftJoin(communityDmConversation, eq(communityDmConversation.id, communityMessage.dmConversationId))+ .leftJoin(+ communityReadState,+ and(+ eq(communityReadState.userId, botUserId),+ or(+ eq(communityReadState.channelId, communityMessage.channelId),+ eq(communityReadState.dmConversationId, communityMessage.dmConversationId)+ )+ )+ )+ .where(+ and(+ ne(communityMessage.authorId, botUserId),+ sql`${communityMessage.seq} > COALESCE(${communityReadState.lastReadSeq}, 0)`,+ or(+ and(isNotNull(communityMessage.channelId), eq(communityServerMember.userId, botUserId)),+ and(+ isNotNull(communityMessage.dmConversationId),+ or(eq(communityDmConversation.user1Id, botUserId), eq(communityDmConversation.user2Id, botUserId))+ )+ )+ )+ )+ .orderBy(asc(communityMessage.channelId), asc(communityMessage.dmConversationId), asc(communityMessage.seq))+ .limit(opts.max);++ return rows.map(({ lastReadSeq: _lastReadSeq, ...rest }) => rest);+}++export type InboxSnapshotRow = {+ channelId: string | null;+ dmConversationId: string | null;+ pendingCount: number;+ firstPendingSeq: number;+ latestSeq: number;+ latestSender: string;+ hasMention: boolean;+};++/**+ * Per-channel/DM unread summary for `inboxSnapshot` — non-consuming, no read-+ * state mutation. One row per scope with pending unread. Scope checks happen+ * in SQL before aggregation. `hasMention` powers+ * the `InboxRow.flags` "mention" flag: true iff any of the scope's PENDING+ * (still-unread) messages carries a `kind: "mention"` row for this bot.+ */+export async function getInboxSnapshotForAgent(db: Database, botUserId: string): Promise<InboxSnapshotRow[]> {+ const rows = await db+ .select({+ channelId: communityMessage.channelId,+ dmConversationId: communityMessage.dmConversationId,+ pendingCount: sql<number>`COUNT(*)`,+ firstPendingSeq: sql<number>`MIN(${communityMessage.seq})`,+ latestSeq: sql<number>`MAX(${communityMessage.seq})`,+ latestSenderId: sql<string>`(SELECT author_id FROM community_message m2+ WHERE (m2.channel_id = ${communityMessage.channelId} OR m2.dm_conversation_id = ${communityMessage.dmConversationId})+ ORDER BY m2.seq DESC LIMIT 1)`,+ mentionCount: sql<number>`(SELECT COUNT(*) FROM community_mention cm+ INNER JOIN community_message m3 ON m3.id = cm.message_id+ WHERE cm.user_id = ${botUserId} AND cm.kind = 'mention'+ AND (m3.channel_id = ${communityMessage.channelId} OR m3.dm_conversation_id = ${communityMessage.dmConversationId})+ AND m3.seq > COALESCE(${communityReadState.lastReadSeq}, 0))`,+ })+ .from(communityMessage)+ .leftJoin(communityChannel, eq(communityChannel.id, communityMessage.channelId))+ .leftJoin(+ communityServerMember,+ and(eq(communityServerMember.serverId, communityChannel.serverId), eq(communityServerMember.userId, botUserId))+ )+ .leftJoin(communityDmConversation, eq(communityDmConversation.id, communityMessage.dmConversationId))+ .leftJoin(+ communityReadState,+ and(+ eq(communityReadState.userId, botUserId),+ or(+ eq(communityReadState.channelId, communityMessage.channelId),+ eq(communityReadState.dmConversationId, communityMessage.dmConversationId)+ )+ )+ )+ .where(+ and(+ ne(communityMessage.authorId, botUserId),+ sql`${communityMessage.seq} > COALESCE(${communityReadState.lastReadSeq}, 0)`,+ or(+ and(isNotNull(communityMessage.channelId), eq(communityServerMember.userId, botUserId)),+ and(+ isNotNull(communityMessage.dmConversationId),+ or(eq(communityDmConversation.user1Id, botUserId), eq(communityDmConversation.user2Id, botUserId))+ )+ )+ )+ )+ .groupBy(communityMessage.channelId, communityMessage.dmConversationId);++ if (rows.length === 0) return [];++ const senderIds = [...new Set(rows.map((r) => r.latestSenderId).filter(Boolean))];+ const users = senderIds.length+ ? await db.select({ id: user.id, name: user.name }).from(user).where(inArray(user.id, senderIds))+ : [];+ const nameById = new Map(users.map((u) => [u.id, u.name]));++ return rows.map((r) => ({+ channelId: r.channelId,+ dmConversationId: r.dmConversationId,+ pendingCount: r.pendingCount,+ firstPendingSeq: r.firstPendingSeq,+ latestSeq: r.latestSeq,+ latestSender: `@${nameById.get(r.latestSenderId) ?? r.latestSenderId}`,+ hasMention: r.mentionCount > 0,+ }));+}++/**+ * Hydrate `getInboxSnapshotForAgent`'s DB-shaped rows into wire `InboxRow`s+ * (`channel: ChannelRef`, `flags`) for the `inboxSnapshot` route. Separate+ * from the DB query itself so the aggregation and the ref/flag projection+ * (which needs `resolveScopeRefs`' extra round trip) stay independently+ * testable, mirroring `toAgentMessage(s)`'s split for message rows.+ */+export async function toInboxRows(+ db: Database,+ rows: InboxSnapshotRow[],+ viewerId: string+): Promise<Array<{+ channel: string;+ pendingCount: number;+ firstPendingSeq: number;+ latestSeq: number;+ latestSender: string;+ flags: Array<"dm" | "thread" | "mention">;+}>> {+ if (rows.length === 0) return [];+ const refs = await resolveScopeRefs(db, rows, viewerId);+ return rows.map((r) => {+ const scope = refs.get(scopeRefKey(r));+ const flags: Array<"dm" | "thread" | "mention"> = [];+ if (r.dmConversationId) flags.push("dm");+ if (scope?.isThread) flags.push("thread");+ if (r.hasMention) flags.push("mention");+ return {+ channel: scope?.ref ?? `/unknown/${scopeRefKey(r)}`,+ pendingCount: r.pendingCount,+ firstPendingSeq: r.firstPendingSeq,+ latestSeq: r.latestSeq,+ latestSender: r.latestSender,+ flags,+ };+ });+}++/**+ * Seq-anchored pagination for `read` — the existing `listMessages` orders by+ * `createdAt` and has no `around` support, so this is a dedicated query.+ * Exactly one of `before`/`after`/`around` should be set (validated at the+ * Zod layer); `around` centers the window and ignores the other two.+ */+export async function listMessagesBySeq(+ db: Database,+ target: { channelId?: string; dmConversationId?: string },+ opts: { before?: Seq; after?: Seq; around?: Seq; limit?: number }+): Promise<{ items: RawAgentMessage[]; hasMore: boolean; latestSeq?: Seq }> {+ const limit = Math.min(opts.limit ?? 50, 200);+ const scopeCond = target.channelId+ ? eq(communityMessage.channelId, target.channelId)+ : eq(communityMessage.dmConversationId, target.dmConversationId!);+ const excludeSentinel = gt(communityMessage.seq, 0);++ let items: RawAgentMessage[];+ if (opts.around !== undefined) {+ const at = await db+ .select(AGENT_MESSAGE_COLUMNS)+ .from(communityMessage)+ .where(and(scopeCond, excludeSentinel, eq(communityMessage.seq, opts.around)));+ const includesAnchor = at.length > 0;+ const beforeLimit = Math.floor((limit - (includesAnchor ? 1 : 0)) / 2);+ const afterLimit = limit - (includesAnchor ? 1 : 0) - beforeLimit;+ const before = await db+ .select(AGENT_MESSAGE_COLUMNS)+ .from(communityMessage)+ .where(and(scopeCond, excludeSentinel, lt(communityMessage.seq, opts.around)))+ .orderBy(desc(communityMessage.seq))+ .limit(beforeLimit + 1);+ const after = await db+ .select(AGENT_MESSAGE_COLUMNS)+ .from(communityMessage)+ .where(and(scopeCond, excludeSentinel, gt(communityMessage.seq, opts.around)))+ .orderBy(asc(communityMessage.seq))+ .limit(afterLimit + 1);+ const hasMoreBefore = before.length > beforeLimit;+ const hasMoreAfter = after.length > afterLimit;+ items = [...before.slice(0, beforeLimit).reverse(), ...at, ...after.slice(0, afterLimit)];+ return {+ items,+ hasMore: hasMoreBefore || hasMoreAfter,+ latestSeq: items.length > 0 ? items[items.length - 1]!.seq : undefined,+ };+ } else if (opts.after !== undefined) {+ items = await db+ .select(AGENT_MESSAGE_COLUMNS)+ .from(communityMessage)+ .where(and(scopeCond, excludeSentinel, gt(communityMessage.seq, opts.after)))+ .orderBy(asc(communityMessage.seq))+ .limit(limit + 1);+ } else if (opts.before !== undefined) {+ items = await db+ .select(AGENT_MESSAGE_COLUMNS)+ .from(communityMessage)+ .where(and(scopeCond, excludeSentinel, lt(communityMessage.seq, opts.before)))+ .orderBy(desc(communityMessage.seq))+ .limit(limit + 1);+ items.reverse();+ } else {+ items = await db+ .select(AGENT_MESSAGE_COLUMNS)+ .from(communityMessage)+ .where(and(scopeCond, excludeSentinel))+ .orderBy(desc(communityMessage.seq))+ .limit(limit + 1);+ items.reverse();+ }++ const hasMore = items.length > limit;+ if (hasMore) {+ // Trim the extra probe row from whichever end we over-fetched from.+ if (opts.after !== undefined) items = items.slice(0, limit);+ else items = items.slice(items.length - limit);+ }++ // `Page.latestSeq` is documented as "seq of the newest item in THIS page,+ // for advancing a cursor" (`community-cli-contract.ts`) — not the scope's+ // global latest (that's `getLatestSeqForScope`, a different call for a+ // different purpose: the `send` route's alignment gate). `items` is always+ // seq-ascending by construction above (all four branches sort/reverse to+ // ascending before returning), so the newest item is the last one.+ const latestSeq = items.length > 0 ? items[items.length - 1]!.seq : undefined;++ return { items, hasMore, latestSeq };+}diff --git a/src/shared/src/db/queries/community/bot.ts b/src/shared/src/db/queries/community/bot.tsindex 04de6673b..c9ea68525 100644--- a/src/shared/src/db/queries/community/bot.ts+++ b/src/shared/src/db/queries/community/bot.ts@@ -30,6 +30,7 @@ import {communityMessage,communityFriendship,communityUserProfile,+ communityReadState,} from "../../community-schema";import { communityMachine } from "../../community-machine-schema";import type { Database } from "../../index";@@ -196,6 +197,55 @@ export async function getBotBinding(return rows[0] ?? null;}+/**+ * Wake-dispatch candidate filter (plan §8) — one D1 hit. Given a message's+ * `recipients` (all fanout recipients, human + bot) and the scope it landed+ * in (exactly one of `channelId`/`dmConversationId`), returns only the bots+ * among them that are (a) live (`!deletedAt`), (b) bound to a machine, and+ * (c) actually behind `newSeq` per their own `lastReadSeq` for that scope+ * (`NULL` read-state row counts as "never read", i.e. behind). A bot that's+ * already caught up (e.g. it just authored `newSeq` itself, or acked+ * out-of-band) is filtered out here so the producer never enqueues a wasted+ * wake.+ */+export async function findWakeCandidates(+ db: Database,+ opts: {+ recipients: string[];+ channelId?: string;+ dmConversationId?: string;+ newSeq: number;+ }+): Promise<Array<{ botUserId: string; name: string | null; machineId: string; runtime: string }>> {+ if (opts.recipients.length === 0) return [];+ const scopeCond = opts.channelId+ ? eq(communityReadState.channelId, opts.channelId)+ : eq(communityReadState.dmConversationId, opts.dmConversationId!);++ const rows = await db+ .select({+ botUserId: user.id,+ name: user.name,+ machineId: communityBotBinding.machineId,+ runtime: communityBotBinding.runtime,+ lastReadSeq: communityReadState.lastReadSeq,+ })+ .from(user)+ .innerJoin(communityBotBinding, eq(communityBotBinding.userId, user.id))+ .leftJoin(communityReadState, and(eq(communityReadState.userId, user.id), scopeCond))+ .where(+ and(+ inArray(user.id, opts.recipients),+ eq(user.isBot, true),+ isNull(user.deletedAt)+ )+ );++ return rows+ .filter((r) => (r.lastReadSeq ?? 0) < opts.newSeq)+ .map((r) => ({ botUserId: r.botUserId, name: r.name, machineId: r.machineId, runtime: r.runtime }));+}+/** Bots bound to this machine — daemon cold-start warmup uses this. */export async function listBotsForMachine(db: Database,diff --git a/src/shared/src/db/queries/community/channel.ts b/src/shared/src/db/queries/community/channel.tsindex 46da372c7..e896aa44d 100644--- a/src/shared/src/db/queries/community/channel.ts+++ b/src/shared/src/db/queries/community/channel.ts@@ -2,6 +2,7 @@ import { eq, and, asc, desc, isNull, max, inArray } from "drizzle-orm";import {communityChannel,communityServerMember,+ communityMessage,} from "../../community-schema";import type { Database } from "../../index";import { createLogger } from "../../../logger";@@ -146,6 +147,150 @@ export async function listServerChannels(db: Database, serverId: string) {return rows.map(mapChannelRow);}+/**+ * `resolveTargetForMember`'s channel-name resolver: matches by ID or NAME+ * within one server, visibility-scoped to `userId`'s membership in that+ * server (same gate as `getChannelForMember`). Returns an ARRAY — like+ * `resolveServerByNameForMember`, ambiguity (2+ name matches) is not an+ * error; the caller returns a hint list (debt #5).+ */+export async function resolveChannelByNameForMember(+ db: Database,+ serverId: string,+ userId: string,+ nameOrId: string+) {+ const byId = await db+ .select(CHANNEL_COLUMNS)+ .from(communityChannel)+ .innerJoin(+ communityServerMember,+ and(+ eq(communityServerMember.serverId, communityChannel.serverId),+ eq(communityServerMember.userId, userId)+ )+ )+ .where(and(eq(communityChannel.serverId, serverId), eq(communityChannel.id, nameOrId)));+ if (byId.length > 0) return byId.map(mapChannelRow);++ const byName = await db+ .select(CHANNEL_COLUMNS)+ .from(communityChannel)+ .innerJoin(+ communityServerMember,+ and(+ eq(communityServerMember.serverId, communityChannel.serverId),+ eq(communityServerMember.userId, userId)+ )+ )+ .where(and(eq(communityChannel.serverId, serverId), eq(communityChannel.name, nameOrId)));+ return byName.map(mapChannelRow);+}++/**+ * Top-level channels (no threads — `parentChannelId IS NULL`, mirroring+ * `listServerChannels`) a bot can see via `listChannels`, scoped to server+ * membership only — same visibility rule the human server-channels route+ * uses (no extra private-category filter on read; decided in plan §7 v3).+ */+export async function listChannelsForMember(db: Database, serverId: string, userId: string) {+ const rows = await db+ .select(CHANNEL_COLUMNS)+ .from(communityChannel)+ .innerJoin(+ communityServerMember,+ and(+ eq(communityServerMember.serverId, communityChannel.serverId),+ eq(communityServerMember.userId, userId)+ )+ )+ .where(and(eq(communityChannel.serverId, serverId), isNull(communityChannel.parentChannelId)))+ .orderBy(asc(communityChannel.position));+ return rows.map(mapChannelRow);+}++/**+ * Look up an existing thread channel by its `(parentChannelId,+ * parentMessageId)` pair — the partial UNIQUE index this pair is enforced+ * against (migration 0052). Used by `resolveTargetForMember`'s thread+ * resolution (debt #10) both for the initial lookup and, on a+ * `createThreadChannel` unique-conflict, to fetch the concurrent winner.+ */+export async function getThreadChannelByParentMessage(+ db: Database,+ parentChannelId: string,+ parentMessageId: string+) {+ const rows = await db+ .select(CHANNEL_COLUMNS)+ .from(communityChannel)+ .where(+ and(+ eq(communityChannel.parentChannelId, parentChannelId),+ eq(communityChannel.parentMessageId, parentMessageId)+ )+ );+ const row = rows[0];+ return row ? mapChannelRow(row) : null;+}++/**+ * Auto-create a thread channel rooted at `parentMessageId` inside+ * `parentChannelId` (debt #10 — threads ARE channels). `type: "thread"` is+ * REQUIRED — the column defaults to `"text"` otherwise, which would silently+ * hide the thread from the human web UI's `listChildChannels(..., {type:+ * "thread"})` query. `name` is NOT NULL with no human-supplied value here, so+ * it's derived from the parent message's own content: its first 40+ * characters, trimmed, falling back to the literal string `"Thread"` when+ * the parent message has no usable text (empty/attachment-only).+ *+ * Concurrency: relies on the partial UNIQUE index+ * `uq_community_channel_parent_message` (migration 0052) — callers must+ * catch the unique-conflict error and re-`SELECT` the winner; this function+ * does not retry internally (see `resolveTargetForMember`).+ */+export async function createThreadChannel(+ db: Database,+ parentChannelId: string,+ parentMessageId: string,+ creatorId: string+) {+ const [parentServer, parentMessage] = await Promise.all([+ db+ .select({ serverId: communityChannel.serverId })+ .from(communityChannel)+ .where(eq(communityChannel.id, parentChannelId)),+ db+ .select({ content: communityMessage.content })+ .from(communityMessage)+ .where(eq(communityMessage.id, parentMessageId)),+ ]);+ const serverId = parentServer[0]?.serverId;+ if (!serverId) throw new Error(`createThreadChannel: parent channel ${parentChannelId} not found`);++ const rawContent = parentMessage[0]?.content?.trim() ?? "";+ const name = rawContent.length > 0 ? rawContent.slice(0, 40) : "Thread";++ // `communityChannel` is typed as `SQLiteTableWithColumns<any>` (schema+ // file), so `.returning()` without an explicit column set loses all type+ // info. Return just the new id, then re-fetch through `getChannel`'s+ // properly-typed `CHANNEL_COLUMNS` select instead of casting `any`.+ const inserted = await db+ .insert(communityChannel)+ .values({+ serverId,+ name,+ type: "thread",+ parentChannelId,+ parentMessageId,+ creatorId,+ })+ .returning({ id: communityChannel.id });+ const created = await getChannel(db, inserted[0]!.id);+ if (!created) throw new Error(`createThreadChannel: failed to re-fetch created channel ${inserted[0]!.id}`);+ return created;+}+export async function listChildChannels(db: Database,parentChannelId: string,diff --git a/src/shared/src/db/queries/community/dm.ts b/src/shared/src/db/queries/community/dm.tsindex 6fc34f71e..839ed5159 100644--- a/src/shared/src/db/queries/community/dm.ts+++ b/src/shared/src/db/queries/community/dm.ts@@ -86,3 +86,23 @@ export async function getDM(db: Database, dmId: string) {.where(eq(communityDmConversation.id, dmId));return rows[0] ?? null;}++/**+ * Read-only lookup of an existing DM between two users, in either+ * user1/user2 order. Returns `null` if the pair has never opened a DM — does+ * NOT create one (that's `createOrGetDM`). Used by `resolveTargetForMember`+ * when `createDmIfMissing: false` (every agent route except `send`).+ */+export async function getDMBetween(db: Database, userAId: string, userBId: string) {+ const [user1Id, user2Id] = [userAId, userBId].sort() as [string, string];+ const rows = await db+ .select()+ .from(communityDmConversation)+ .where(+ and(+ eq(communityDmConversation.user1Id, user1Id),+ eq(communityDmConversation.user2Id, user2Id)+ )+ );+ return rows[0] ?? null;+}diff --git a/src/shared/src/db/queries/community/message.ts b/src/shared/src/db/queries/community/message.tsindex 626dbaebb..76543530a 100644--- a/src/shared/src/db/queries/community/message.ts+++ b/src/shared/src/db/queries/community/message.ts@@ -4,11 +4,38 @@ import {communityChannel,communityDmConversation,communityReadState,+ communityMessageSeq,} from "../../community-schema";import { user } from "../../schema";import type { Database } from "../../index";import { createLogger } from "../../../logger";+/** `'channel:<id>'` or `'dm:<id>'` — the `community_message_seq` PK. */+export function scopeKeyForTarget(target: { channelId?: string; dmConversationId?: string }): string {+ if (target.channelId) return `channel:${target.channelId}`;+ if (target.dmConversationId) return `dm:${target.dmConversationId}`;+ throw new Error("scopeKeyForTarget: neither channelId nor dmConversationId provided");+}++/**+ * Atomically claim the next seq value for a scope (channel or DM). A single+ * top-level UPSERT — D1's single-writer serialization makes this race-free+ * for uniqueness on its own, no CTE/transaction needed (see+ * plans/community-agent-cli-bridge.md design §3 for why the CTE-fusion+ * approach is not valid SQLite and was rejected).+ */+async function claimNextSeq(db: Database, scopeKey: string): Promise<number> {+ const rows = await db+ .insert(communityMessageSeq)+ .values({ scopeKey, nextSeq: 1 })+ .onConflictDoUpdate({+ target: communityMessageSeq.scopeKey,+ set: { nextSeq: sql`${communityMessageSeq.nextSeq} + 1` },+ })+ .returning({ nextSeq: communityMessageSeq.nextSeq });+ return rows[0]!.nextSeq;+}+const DEFAULT_LIMIT = 50;// Module-level logger so every parse failure lands on the same service tag.@@ -43,6 +70,16 @@ export async function createMessage() {const now = new Date().toISOString();+ // Step 0: atomically claim this scope's next seq (own top-level statement —+ // see design §3 for why this can't be fused into the INSERT below via a+ // CTE). Accepted trade-off: if the INSERT below fails after this succeeds,+ // the counter has a harmless gap — no duplicate seq is ever possible since+ // this claim is independently atomic under D1's single-writer serialization.+ // Do NOT wrap these two statements in a transaction to "fix" this — D1+ // doesn't support one that could express it.+ const scopeKey = scopeKeyForTarget(data);+ const seq = await claimNextSeq(db, scopeKey);+// Pass `createdAt: now` explicitly so `msg.createdAt` matches the exact// string we write to `channel.lastMessageAt` / `dmConversation.lastMessageAt`// and to the author's read-state watermark below. Without this, the schema@@ -61,6 +98,7 @@ export async function createMessage(replyToId: data.replyToId ?? null,embeds: data.embeds ?? null,createdAt: now,+ seq,}).returning();@@ -80,7 +118,10 @@ export async function createMessage(// never surfaces the channel the author just sent in. Keep this inline —// future readers should see the invariant next to the `lastMessageAt`// bump. Upsert against the `idx_read_state_user_channel` partial-unique- // index (same shape as `markReadToMessageBuilder`).+ // index (same shape as `markReadToMessageBuilder`). `lastReadSeq` is+ // extended here too (design §4) — required for wake-filter correctness:+ // every author (bot or human) must have its own `lastReadSeq` stay in+ // lockstep with its sends, or `enqueueBotWakes` sees a stale watermark.await db.insert(communityReadState).values({@@ -89,11 +130,13 @@ export async function createMessage(dmConversationId: null,lastReadAt: now,lastReadMessageId: msg.id,+ lastReadSeq: seq,}).onConflictDoUpdate({target: [communityReadState.userId, communityReadState.channelId],targetWhere: sql`${communityReadState.channelId} IS NOT NULL`,- set: { lastReadAt: now, lastReadMessageId: msg.id },+ set: { lastReadAt: now, lastReadMessageId: msg.id, lastReadSeq: seq },+ setWhere: sql`${communityReadState.lastReadSeq} < ${seq}`,});}@@ -106,7 +149,8 @@ export async function createMessage(// Author read-watermark (DM path). Upsert against the// `idx_read_state_user_dm` partial-unique index. Same invariant as the// channel branch: keep the sender's watermark equal to the message they- // just sent so their inbox does not flag it as unread.+ // just sent so their inbox does not flag it as unread. `lastReadSeq`+ // extended per design §4 — see the channel branch comment above.await db.insert(communityReadState).values({@@ -115,11 +159,13 @@ export async function createMessage(dmConversationId: data.dmConversationId,lastReadAt: now,lastReadMessageId: msg.id,+ lastReadSeq: seq,}).onConflictDoUpdate({target: [communityReadState.userId, communityReadState.dmConversationId],targetWhere: sql`${communityReadState.dmConversationId} IS NOT NULL`,- set: { lastReadAt: now, lastReadMessageId: msg.id },+ set: { lastReadAt: now, lastReadMessageId: msg.id, lastReadSeq: seq },+ setWhere: sql`${communityReadState.lastReadSeq} < ${seq}`,});}@@ -322,6 +368,36 @@ export async function getFirstMessageByChannelIds(db: Database, channelIds: stri});}+/**+ * Look up a single message by (channel-or-DM scope, seq). `seq === 0` is the+ * legacy pre-migration sentinel — callers must reject it before calling this+ * (see `resolve`/`bumpReadCursor` routes), it is never a real, addressable+ * message.+ */+export async function getMessageByChannelAndSeq(+ db: Database,+ target: { channelId?: string; dmConversationId?: string },+ seq: number+) {+ const scopeCond = target.channelId+ ? eq(communityMessage.channelId, target.channelId)+ : eq(communityMessage.dmConversationId, target.dmConversationId!);++ const rows = await db+ .select({+ id: communityMessage.id,+ authorId: communityMessage.authorId,+ content: communityMessage.content,+ createdAt: communityMessage.createdAt,+ channelId: communityMessage.channelId,+ dmConversationId: communityMessage.dmConversationId,+ seq: communityMessage.seq,+ })+ .from(communityMessage)+ .where(and(scopeCond, eq(communityMessage.seq, seq)));+ return rows[0] ?? null;+}+export async function getMessage(db: Database, messageId: string) {const rows = await db.select({@@ -336,6 +412,10 @@ export async function getMessage(db: Database, messageId: string) {createdAt: communityMessage.createdAt,channelId: communityMessage.channelId,dmConversationId: communityMessage.dmConversationId,+ // Needed by the wake producer's `toAgentMessage(messageRow)` (plan §8) —+ // `enqueueBotWakes` is called from `message-handler.ts` with this exact+ // row, no separate re-fetch.+ seq: communityMessage.seq,authorName: user.name,authorEmail: user.email,authorImage: user.image,diff --git a/src/shared/src/db/queries/community/read-state.ts b/src/shared/src/db/queries/community/read-state.tsindex 3d8db4d52..6318b997a 100644--- a/src/shared/src/db/queries/community/read-state.ts+++ b/src/shared/src/db/queries/community/read-state.ts@@ -5,7 +5,7 @@ import {communityServerMember,} from "../../community-schema";import type { Database } from "../../index";-import { getLatestMessagesByChannelIds } from "./message";+import { getLatestMessagesByChannelIds, getMessageByChannelAndSeq } from "./message";/*** # Community read-state invariant@@ -69,6 +69,10 @@ function buildTargetFilter(data: {* upsert targets the matching partial-unique index* (`idx_read_state_user_channel` or `idx_read_state_user_dm`).*/+// lastReadSeq intentionally not maintained here — humans only, bot-wake+// filter never reads a human's row (see plans/community-agent-cli-bridge.md+// design §4 for the full accounting of which of the four read-state writers+// do/don't need to thread `lastReadSeq` through).export function markReadToMessageBuilder(db: Database,data: {@@ -135,6 +139,8 @@ export function markReadToMessageBuilder(* The routes don't consume the returned row today — see `PUT /dm/:id/read`* and `PUT /threads/:id/read` which respond `{ ok: true }`.*/+// lastReadSeq intentionally not maintained here — see comment on+// `markReadToMessageBuilder` above.export async function markReadToMessage(db: Database,data: {@@ -161,6 +167,8 @@ export async function markReadToMessage(* channels stay empty in `communityReadState` because the invariant* forbids `lastReadMessageId = null` rows.*/+// lastReadSeq intentionally not maintained here — see comment on+// `markReadToMessageBuilder` above.export async function markAllServerChannelsRead(db: Database,userId: string@@ -245,6 +253,81 @@ export async function markAllServerChannelsRead(return latest.length;}+/**+ * The agent `ack` route's cursor-advance — the ONLY writer of `lastReadSeq`+ * outside `createMessage`'s author-watermark upsert (design §4). `Cursor =+ * { channel, seq }` carries no message id, so this first resolves+ * `(target, seq) → { id, createdAt }` via `getMessageByChannelAndSeq`, then+ * upserts all three of `lastReadSeq`/`lastReadMessageId`/`lastReadAt`+ * together — NEVER bump `lastReadSeq` alone, or the table's documented+ * invariant (`lastReadAt === getMessage(lastReadMessageId).createdAt`)+ * breaks for any row this touches.+ *+ * `MAX(existing, incoming)` semantics on the agent cursor, applied together:+ * if the resolved message's `seq` is not ahead of the row's current+ * `lastReadSeq`, the whole bump is a no-op; the existing pointer wins. Never+ * regress `lastReadSeq`, `lastReadMessageId`, and `lastReadAt` independently+ * of one another.+ *+ * Returns `null` if `seq` doesn't resolve to a real message in that scope+ * (caller returns 404/ignores per §7's `ack` route spec).+ */+export async function bumpReadCursor(+ db: Database,+ userId: string,+ target: { channelId?: string; dmConversationId?: string },+ seq: number+): Promise<{ id: string; createdAt: string; seq: number } | null> {+ const message = await getMessageByChannelAndSeq(db, target, seq);+ if (!message) return null;++ const existing = await getReadState(db, { userId, ...target });++ // MAX semantics: if the resolved seq is not ahead of what's already+ // recorded, this is a no-op — never regress any of the three fields.+ if (existing && existing.lastReadSeq >= seq && existing.lastReadMessageId) {+ return { id: existing.lastReadMessageId!, createdAt: existing.lastReadAt, seq: existing.lastReadSeq };+ }++ if (target.channelId) {+ await db+ .insert(communityReadState)+ .values({+ userId,+ channelId: target.channelId,+ dmConversationId: null,+ lastReadAt: message.createdAt,+ lastReadMessageId: message.id,+ lastReadSeq: seq,+ })+ .onConflictDoUpdate({+ target: [communityReadState.userId, communityReadState.channelId],+ targetWhere: sql`${communityReadState.channelId} IS NOT NULL`,+ set: { lastReadAt: message.createdAt, lastReadMessageId: message.id, lastReadSeq: seq },+ setWhere: sql`${communityReadState.lastReadSeq} < ${seq}`,+ });+ } else {+ await db+ .insert(communityReadState)+ .values({+ userId,+ channelId: null,+ dmConversationId: target.dmConversationId!,+ lastReadAt: message.createdAt,+ lastReadMessageId: message.id,+ lastReadSeq: seq,+ })+ .onConflictDoUpdate({+ target: [communityReadState.userId, communityReadState.dmConversationId],+ targetWhere: sql`${communityReadState.dmConversationId} IS NOT NULL`,+ set: { lastReadAt: message.createdAt, lastReadMessageId: message.id, lastReadSeq: seq },+ setWhere: sql`${communityReadState.lastReadSeq} < ${seq}`,+ });+ }++ return { id: message.id, createdAt: message.createdAt, seq };+}+export async function getReadState(db: Database,data: {diff --git a/src/shared/src/db/queries/community/server.ts b/src/shared/src/db/queries/community/server.tsindex a6544a714..cb3abc007 100644--- a/src/shared/src/db/queries/community/server.ts+++ b/src/shared/src/db/queries/community/server.ts@@ -168,6 +168,51 @@ export async function listUserServers(db: Database, userId: string) {.orderBy(asc(communityServerMember.railOrder));}+/**+ * Resolve a server by ID or NAME, scoped to servers `userId` is a member of.+ * Returns an ARRAY — the caller decides what "ambiguous" means (0 = not+ * found/not a member, 1 = resolved, 2+ = ambiguous name — ids are always+ * unique so only the name-match branch can return >1). Used by+ * `resolveTargetForMember` (debt #5 — ambiguity is not a hard error, the+ * agent picks from a hint list).+ */+export async function resolveServerByNameForMember(+ db: Database,+ userId: string,+ nameOrId: string+) {+ const rows = await db+ .select({+ id: communityServer.id,+ name: communityServer.name,+ })+ .from(communityServer)+ .innerJoin(+ communityServerMember,+ and(+ eq(communityServerMember.serverId, communityServer.id),+ eq(communityServerMember.userId, userId)+ )+ )+ .where(eq(communityServer.id, nameOrId));+ if (rows.length > 0) return rows;++ return db+ .select({+ id: communityServer.id,+ name: communityServer.name,+ })+ .from(communityServer)+ .innerJoin(+ communityServerMember,+ and(+ eq(communityServerMember.serverId, communityServer.id),+ eq(communityServerMember.userId, userId)+ )+ )+ .where(eq(communityServer.name, nameOrId));+}+export async function getServersByIds(db: Database, serverIds: string[]) {if (serverIds.length === 0) return [];return db.select().from(communityServer).where(inArray(communityServer.id, serverIds));diff --git a/src/shared/src/index.ts b/src/shared/src/index.tsindex 68cb5e249..2fc4c12bc 100644--- a/src/shared/src/index.ts+++ b/src/shared/src/index.ts@@ -247,6 +247,13 @@ export {CommunityBotPatchRequestSchema,CommunityBotAddToServerRequestSchema,CommunityDaemonSendAsBotRequestSchema,+ CommunityAgentCursorSchema,+ CommunityAgentSendRequestSchema,+ CommunityAgentInboxPullRequestSchema,+ CommunityAgentAckRequestSchema,+ CommunityAgentReadRequestSchema,+ CommunityAgentResolveRequestSchema,+ CommunityAgentListChannelsRequestSchema,} from "./schemas";export type {@@ -310,8 +317,74 @@ export type {CommunityBotPatchRequest,CommunityBotAddToServerRequest,CommunityDaemonSendAsBotRequest,+ CommunityAgentCursor,+ CommunityAgentSendRequest,+ CommunityAgentInboxPullRequest,+ CommunityAgentAckRequest,+ CommunityAgentReadRequest,+ CommunityAgentResolveRequest,+ CommunityAgentListChannelsRequest,} from "./schemas";+// Community agent CLI bridge contract — lifted from `src/daemon/src/server/contract.ts`.+// `Message`/`Channel` collide with unrelated `./types` exports above, so those two+// (plus anything else that could collide) are re-exported under `CommunityCli*`+// aliases; everything else with no existing collision keeps its bare name.+export type {+ Id as CommunityCliId,+ UserId as CommunityCliUserId,+ AgentId as CommunityCliAgentId,+ ServerId as CommunityCliServerId,+ ChannelId as CommunityCliChannelId,+ MessageId as CommunityCliMessageId,+ Seq as CommunityCliSeq,+ User as CommunityCliUser,+ Agent as CommunityCliAgent,+ Server as CommunityCliServer,+ ChannelKind as CommunityCliChannelKind,+ Channel as CommunityCliChannel,+ SenderType as CommunityCliSenderType,+ Sender as CommunityCliSender,+ ChannelRef as CommunityCliChannelRef,+ Target as CommunityCliTarget,+ MessageContent as CommunityCliMessageContent,+ Message as CommunityCliMessage,+ Cursor as CommunityCliCursor,+ Page as CommunityCliPage,+ InboxFlag as CommunityCliInboxFlag,+ InboxRow as CommunityCliInboxRow,+ InboxSnapshot as CommunityCliInboxSnapshot,+ InboxPullRequest as CommunityCliInboxPullRequest,+ InboxPullResponse as CommunityCliInboxPullResponse,+ AckRequest as CommunityCliAckRequest,+ SendRequest as CommunityCliSendRequest,+ SendResponse as CommunityCliSendResponse,+ ReadRequest as CommunityCliReadRequest,+ ResolveRequest as CommunityCliResolveRequest,+ ListChannelsRequest as CommunityCliListChannelsRequest,+ ServerApi as CommunityCliServerApi,+ HostCommand,+ HostReadyRuntime,+ HostReady,+ SessionErrorFrame as CommunityCliSessionErrorFrame,+ HostControlChannel,+ AgentSessionReport,+ ParsedRef as CommunityCliParsedRef,+} from "./community-cli-contract";+export { DM_SERVER, parseRef, formatRef, parseSeq, formatSeq } from "./community-cli-contract";++export type {+ ReasoningEffort,+ ModelConfig,+ ProviderConfig,+ ModeConfig,+ RuntimeConfig,+} from "./runtime-config";+export { RUNTIME_CONFIG_VERSION, makeRuntimeConfig } from "./runtime-config";++export { sendWakeToMachine } from "./community/wake-dispatch";+export type { WakePayload } from "./community/wake-dispatch";+export type { CommunityMachineSummary, CommunityMachineRuntime } from "./community-ws-events";export type {BotAddedFrame,diff --git a/src/shared/src/runtime-config.ts b/src/shared/src/runtime-config.tsnew file mode 100644index 000000000..db47ebfd7--- /dev/null+++ b/src/shared/src/runtime-config.ts@@ -0,0 +1,91 @@+/**+ * RuntimeConfig — the structured, versioned agent runtime configuration.+ *+ * This is what the server stores per agent and pushes down in `agent:start`'s+ * `config`. It captures the FULL config surface — which runtime, which model,+ * which provider/endpoint, mode, reasoning effort — as structured data (not bare+ * strings), mirroring how a production daemon models it.+ *+ * Lifted from `src/daemon/src/runtimeConfig.ts` into `@alook/shared` because+ * `HostCommand`'s `agent:start.config` field needs this type, and the wake+ * producer (`src/web`, a Worker) has no path to import from the CLI/daemon+ * package. `src/daemon` re-exports `RuntimeConfig`/`makeRuntimeConfig` from+ * here; `resolveLaunchFields`/`ResolvedLaunchFields` stay daemon-only+ * (host-side launch resolution, not needed server-side).+ *+ * The host doesn't act on `RuntimeConfig` directly; it `resolveLaunchFields()`s+ * it into flat launch fields (CLI args + env) that each driver consumes. Config+ * is start-time: changing it means relaunching the agent with a new RuntimeConfig+ * (there is no live-reconfigure path — model/effort are spawn-time args).+ */++export const RUNTIME_CONFIG_VERSION = 1;++/** Reasoning/thinking effort. */+export type ReasoningEffort = "low" | "medium" | "high";++/** Model selection — structured, not a bare string. */+export type ModelConfig =+ | { kind: "default" } // use the runtime's default model+ | { kind: "named"; name: string } // a specific catalog model+ | { kind: "custom"; name: string }; // a custom/BYO model id++/**+ * Provider / endpoint selection — distinct from model. Lets a host point a+ * runtime at a custom endpoint or a built-in multi-provider (Pi).+ */+export type ProviderConfig =+ | { kind: "default" }+ | { kind: "custom"; apiUrl: string; apiKey: string } // e.g. Claude-compatible endpoint+ | { kind: "pi-builtin"; providerId: string; apiKey: string }; // Pi multi-provider++/** Execution mode (e.g. fast lane). */+export type ModeConfig = { kind: "default" | "fast" };++export interface RuntimeConfig {+ version: number;+ /** "claude" | "codex" | "gemini" | "kimi" | "pi" | "copilot" | "cursor" | "opencode" | "antigravity" | "mock" */+ runtime: string;+ model: ModelConfig;+ mode: ModeConfig;+ reasoningEffort?: ReasoningEffort;+ provider?: ProviderConfig;+ /** Override the runtime's default executable path. */+ command?: string;+ /** Override the runtime's disallowed-tools list. */+ disallowedTools?: string;+ /** Extra host-supplied env vars (controlled keys are stripped on resolve). */+ envVars?: Record<string, string>;+ /**+ * Agent identity — the SERVER's truth about who this agent is, carried in the+ * same config the server downlinks via `agent:start`. The daemon does not+ * invent these; it fills the LaunchContext from them.+ */+ agentName?: string;+ /** The agent's @mention handle (e.g. "@cindy"). */+ agentHandle?: string;+ /** The agent's standing instruction / role (becomes the standing prompt). */+ instruction?: string;+}++/* ------------------------------------------------------------------ */+/* Construction / normalization */+/* ------------------------------------------------------------------ */++/** Build a fully-defaulted RuntimeConfig from a partial input. */+export function makeRuntimeConfig(input: Partial<RuntimeConfig> & { runtime: string }): RuntimeConfig {+ return {+ version: RUNTIME_CONFIG_VERSION,+ runtime: input.runtime,+ model: input.model ?? { kind: "default" },+ mode: input.mode ?? { kind: "default" },+ reasoningEffort: input.reasoningEffort,+ provider: input.provider,+ command: input.command,+ disallowedTools: input.disallowedTools,+ envVars: input.envVars,+ agentName: input.agentName,+ agentHandle: input.agentHandle,+ instruction: input.instruction,+ };+}diff --git a/src/shared/src/schemas.ts b/src/shared/src/schemas.tsindex e72ca125a..83a4aac2c 100644--- a/src/shared/src/schemas.ts+++ b/src/shared/src/schemas.ts@@ -1,5 +1,6 @@import { z } from "zod";import { IssueStatus, TASK_TYPES } from "./constants";+import { MAX_MESSAGE_CONTENT_LENGTH } from "./constants/community";// ---------------------------------------------------------------------------// Task status@@ -1037,3 +1038,68 @@ export const CommunityDaemonSendAsBotRequestSchema = z.object({export type CommunityDaemonSendAsBotRequest = z.infer<typeof CommunityDaemonSendAsBotRequestSchema>;++// ---------------------------------------------------------------------------+// Community agent CLI bridge — `withAgentRunnerAuth`-mounted `/api/community/agent/*`+// request/response validators. Mirror the lifted `@alook/shared/community-cli-contract`+// wire types verbatim (see `community-cli-contract.ts`). `agentId` is deliberately+// OMITTED from every request schema below — identity comes from the `crk_` bearer+// via `withAgentRunnerAuth`, never a client-supplied field (see plan §2/§7).+// ---------------------------------------------------------------------------++const CommunityAgentMessageContentSchema = z+ .object({ text: z.string().min(1).max(MAX_MESSAGE_CONTENT_LENGTH) })+ .catchall(z.unknown());++const CommunityAgentSeqSchema = z.number().int().min(0);+const CommunityAgentPositiveSeqSchema = z.number().int().min(1);++export const CommunityAgentCursorSchema = z.object({+ channel: z.string().min(1),+ seq: CommunityAgentPositiveSeqSchema,+});+export type CommunityAgentCursor = z.infer<typeof CommunityAgentCursorSchema>;++export const CommunityAgentSendRequestSchema = z.object({+ channel: z.string().min(1),+ content: CommunityAgentMessageContentSchema,+ seenUpToSeq: CommunityAgentSeqSchema.optional(),+});+export type CommunityAgentSendRequest = z.infer<typeof CommunityAgentSendRequestSchema>;++export const CommunityAgentInboxPullRequestSchema = z.object({+ max: z.number().int().min(1).max(200).optional(),+});+export type CommunityAgentInboxPullRequest = z.infer<typeof CommunityAgentInboxPullRequestSchema>;++export const CommunityAgentAckRequestSchema = z.object({+ cursors: z.array(CommunityAgentCursorSchema).min(1),+});+export type CommunityAgentAckRequest = z.infer<typeof CommunityAgentAckRequestSchema>;++export const CommunityAgentReadRequestSchema = z+ .object({+ channel: z.string().min(1),+ before: CommunityAgentSeqSchema.optional(),+ after: CommunityAgentSeqSchema.optional(),+ around: CommunityAgentSeqSchema.optional(),+ limit: z.number().int().min(1).max(200).optional(),+ })+ .refine(+ (v) => [v.before, v.after, v.around].filter((x) => x !== undefined).length <= 1,+ { message: "at most one of before/after/around may be supplied" }+ );+export type CommunityAgentReadRequest = z.infer<typeof CommunityAgentReadRequestSchema>;++export const CommunityAgentResolveRequestSchema = z.object({+ channel: z.string().min(1),+ seq: CommunityAgentSeqSchema,+});+export type CommunityAgentResolveRequest = z.infer<typeof CommunityAgentResolveRequestSchema>;++export const CommunityAgentListChannelsRequestSchema = z.object({+ server: z.string().min(1).optional(),+});+export type CommunityAgentListChannelsRequest = z.infer<+ typeof CommunityAgentListChannelsRequestSchema+>;diff --git a/src/shared/test/community-cli-contract.test.ts b/src/shared/test/community-cli-contract.test.tsnew file mode 100644index 000000000..df626e5d9--- /dev/null+++ b/src/shared/test/community-cli-contract.test.ts@@ -0,0 +1,69 @@+import { describe, it, expect } from "vitest";+import { parseRef, formatRef, formatSeq, parseSeq, DM_SERVER } from "../src/community-cli-contract";++describe("parseRef", () => {+ it('parses "/studio/general" as a plain channel ref', () => {+ expect(parseRef("/studio/general")).toEqual({ server: "studio", channel: "general" });+ });++ it('parses "/studio/general#42" as a pinned-message ref (seq)', () => {+ expect(parseRef("/studio/general#42")).toEqual({ server: "studio", channel: "general", seq: 42 });+ });++ it('parses "/studio/general/#42" as a thread ref (threadRootSeq)', () => {+ expect(parseRef("/studio/general/#42")).toEqual({+ server: "studio",+ channel: "general",+ threadRootSeq: 42,+ });+ });++ it('parses "/.dm/user_123" as a DM ref (server === DM_SERVER)', () => {+ const parsed = parseRef("/.dm/user_123");+ expect(parsed).toEqual({ server: DM_SERVER, channel: "user_123" });+ expect(parsed.server).toBe(".dm");+ });++ it("throws when the ref doesn't start with /", () => {+ expect(() => parseRef("studio/general")).toThrow();+ });++ it("throws when the ref has fewer than 2 segments", () => {+ expect(() => parseRef("/studio")).toThrow();+ });+});++describe("formatRef", () => {+ it("formats a plain channel", () => {+ expect(formatRef({ server: "studio", channel: "general" })).toBe("/studio/general");+ });++ it("formats a thread ref with threadRootSeq", () => {+ expect(formatRef({ server: "studio", channel: "general", threadRootSeq: 42 })).toBe(+ "/studio/general/#42"+ );+ });++ it("round-trips through parseRef for the thread form", () => {+ const ref = formatRef({ server: "studio", channel: "general", threadRootSeq: 7 });+ expect(parseRef(ref)).toEqual({ server: "studio", channel: "general", threadRootSeq: 7 });+ });+});++describe("formatSeq / parseSeq", () => {+ it("formatSeq prefixes with #", () => {+ expect(formatSeq(12)).toBe("#12");+ });++ it("parseSeq strips a leading # if present", () => {+ expect(parseSeq("#12")).toBe(12);+ });++ it("parseSeq accepts a bare number string too", () => {+ expect(parseSeq("12")).toBe(12);+ });++ it("parseSeq throws on a non-numeric value", () => {+ expect(() => parseSeq("#abc")).toThrow();+ });+});diff --git a/src/shared/test/community/wake-dispatch.test.ts b/src/shared/test/community/wake-dispatch.test.tsnew file mode 100644index 000000000..2ff149baf--- /dev/null+++ b/src/shared/test/community/wake-dispatch.test.ts@@ -0,0 +1,71 @@+import { describe, it, expect, vi } from "vitest";+import { sendWakeToMachine } from "../../src/community/wake-dispatch";+import type { HostCommand } from "../../src/community-cli-contract";++const dummyCommand = {+ type: "agent:start",+ agentId: "bot-1",+ config: { version: 1, runtime: "claude" },+ launchId: "launch-1",+} as unknown as HostCommand;++function makeEnv(fetchImpl: (url: string, init?: RequestInit) => Promise<Response>) {+ return { WS_DO_WORKER: { fetch: vi.fn(fetchImpl) } as unknown as Fetcher };+}++describe("sendWakeToMachine", () => {+ it("POSTs the command verbatim to the ws-do forward-agent-start route", async () => {+ const fetchMock = vi.fn(async (url: string, init?: RequestInit) => {+ expect(url).toBe("http://internal/community-machine/by-id/machine-1/forward-agent-start");+ expect(init?.method).toBe("POST");+ expect(JSON.parse(init!.body as string)).toEqual(dummyCommand);+ return new Response(JSON.stringify({ sent: 1 }), { status: 200 });+ });+ const env = makeEnv(fetchMock);++ const result = await sendWakeToMachine(env, "machine-1", dummyCommand);++ expect(result).toEqual({ sent: true });+ expect(fetchMock).toHaveBeenCalledTimes(1);+ });++ it("normalizes { sent: 0 } (daemon offline) to { sent: false }", async () => {+ const env = makeEnv(async () => new Response(JSON.stringify({ sent: 0 }), { status: 200 }));++ const result = await sendWakeToMachine(env, "machine-1", dummyCommand);++ expect(result).toEqual({ sent: false });+ });++ it("normalizes any positive sent count to { sent: true }", async () => {+ const env = makeEnv(async () => new Response(JSON.stringify({ sent: 3 }), { status: 200 }));++ const result = await sendWakeToMachine(env, "machine-1", dummyCommand);++ expect(result).toEqual({ sent: true });+ });++ it("throws on non-2xx response (transient — consumer must retry)", async () => {+ const env = makeEnv(async () => new Response("boom", { status: 500 }));++ await expect(sendWakeToMachine(env, "machine-1", dummyCommand)).rejects.toThrow();+ });++ it("throws when the underlying fetch itself rejects (network error)", async () => {+ const env = makeEnv(async () => {+ throw new Error("network unreachable");+ });++ await expect(sendWakeToMachine(env, "machine-1", dummyCommand)).rejects.toThrow("network unreachable");+ });++ it("encodes the machineId in the URL path", async () => {+ const fetchMock = vi.fn(async (url: string) => {+ expect(url).toBe("http://internal/community-machine/by-id/machine%2Fwith%2Fslash/forward-agent-start");+ return new Response(JSON.stringify({ sent: 0 }), { status: 200 });+ });+ const env = makeEnv(fetchMock);++ await sendWakeToMachine(env, "machine/with/slash", dummyCommand);+ });+});diff --git a/src/shared/test/queries/community-agent-inbox.test.ts b/src/shared/test/queries/community-agent-inbox.test.tsnew file mode 100644index 000000000..d1d556a01--- /dev/null+++ b/src/shared/test/queries/community-agent-inbox.test.ts@@ -0,0 +1,390 @@+import { describe, it, expect, vi } from "vitest";+import * as agentInbox from "../../src/db/queries/community/agent-inbox";+import { formatRef, formatSeq, DM_SERVER } from "../../src/community-cli-contract";++/**+ * Generic chainable + thenable mock. Every builder method (`select`, `from`,+ * `where`, `leftJoin`, `orderBy`, `limit`, `groupBy`, ...) returns the same+ * chain object, and the chain itself is a thenable — `await`/`Promise.all`+ * calls `.then()` on it regardless of which method was "last" in the chain,+ * so this one mock covers every shape `agent-inbox.ts` builds (`.where()`+ * terminal, `.limit()` terminal, `.groupBy()` terminal, ...).+ *+ * `db.select()` calls consume `responses` in FIFO call order — i.e. the Nth+ * `db.select(...)` call anywhere in the exercised code resolves to+ * `responses[N]`. See the query module's internal `Promise.all` construction+ * order (documented per-test below) for why this order is deterministic.+ */+function createSequentialDb(responses: unknown[][]) {+ let call = 0;+ const methods = ["from", "where", "leftJoin", "innerJoin", "orderBy", "limit", "groupBy", "as"];+ const select = vi.fn(() => {+ const idx = call++;+ const chain: any = {};+ for (const m of methods) chain[m] = vi.fn(() => chain);+ chain.then = (resolve: any, reject: any) =>+ Promise.resolve(responses[idx] ?? []).then(resolve, reject);+ return chain;+ });+ return { select } as any;+}++describe("getLatestSeqForScope", () => {+ it("returns the counter's nextSeq when a row exists", async () => {+ const db = createSequentialDb([[{ nextSeq: 42 }]]);+ const result = await agentInbox.getLatestSeqForScope(db, "channel:c1");+ expect(result).toBe(42);+ });++ it("returns 0 when no counter row exists yet (scope never messaged in)", async () => {+ const db = createSequentialDb([[]]);+ const result = await agentInbox.getLatestSeqForScope(db, "channel:new");+ expect(result).toBe(0);+ });+});++function rawMsg(overrides: Partial<Record<string, unknown>> = {}) {+ return {+ id: "m_1",+ authorId: "u_1",+ content: "hello",+ createdAt: "2026-07-01T00:00:00.000Z",+ channelId: "ch_1",+ dmConversationId: null,+ seq: 1,+ ...overrides,+ };+}++describe("toAgentMessages", () => {+ it("returns [] and never touches the db for an empty row list", async () => {+ const db = createSequentialDb([]);+ const result = await agentInbox.toAgentMessages(db, [], "viewer_1");+ expect(result).toEqual([]);+ expect(db.select).not.toHaveBeenCalled();+ });++ it("hydrates a plain channel message: ref, sender, content, seq, time", async () => {+ // Call order (all non-empty-guarded selects, in construction order):+ // 1. resolveScopeRefs' `channels` query (channelIds=[ch_1])+ // 2. toAgentMessages' own author-name query (outer Promise.all's 2nd slot)+ // 3. resolveScopeRefs' `servers` query (serverIds=[srv_1]; parentChannelIds/+ // parentMessageIds/dmIds are all empty here, so those selects are skipped)+ const db = createSequentialDb([+ [{ id: "ch_1", name: "general", serverId: "srv_1", parentChannelId: null, parentMessageId: null }],+ [{ id: "u_1", name: "Alice" }],+ [{ id: "srv_1", name: "studio" }],+ ]);+ const [msg] = await agentInbox.toAgentMessages(db, [rawMsg()], "viewer_1");+ expect(msg).toEqual({+ seq: formatSeq(1),+ channel: formatRef({ server: "studio", channel: "general" }),+ sender: "@Alice",+ content: { text: "hello" },+ time: "2026-07-01T00:00:00.000Z",+ });+ });++ it("hydrates a thread message with the thread-form ref (/server/parent/#rootSeq)", async () => {+ // Call order: 1. channels (thread channel itself), 2. author names,+ // 3. parentChannels, 4. servers, 5. parentMessages (root seq lookup).+ // dmIds empty throughout → dm query + dmPeer users query both skipped.+ const db = createSequentialDb([+ [{ id: "thread_1", name: "thread-x", serverId: "srv_1", parentChannelId: "ch_parent", parentMessageId: "m_root" }],+ [{ id: "u_1", name: "Alice" }],+ [{ id: "ch_parent", name: "general" }],+ [{ id: "srv_1", name: "studio" }],+ [{ id: "m_root", seq: 7 }],+ ]);+ const [msg] = await agentInbox.toAgentMessages(+ db,+ [rawMsg({ channelId: "thread_1" })],+ "viewer_1"+ );+ expect(msg!.channel).toBe(formatRef({ server: "studio", channel: "general", threadRootSeq: 7 }));+ });++ it("hydrates a DM message, addressing the OTHER party relative to viewerId", async () => {+ // Call order: 1. dms query (channels query skipped, channelIds empty),+ // 2. author names (parentChannels/servers/parentMessages all skipped —+ // no channel scopes at all).+ const db = createSequentialDb([+ [{ id: "dm_1", user1Id: "viewer_1", user2Id: "peer_1" }],+ [{ id: "u_1", name: "Alice" }],+ ]);+ const [msg] = await agentInbox.toAgentMessages(+ db,+ [rawMsg({ channelId: null, dmConversationId: "dm_1" })],+ "viewer_1"+ );+ expect(msg!.channel).toBe(formatRef({ server: DM_SERVER, channel: "peer_1" }));+ });++ it("falls back to /unknown/<key> when the scope can't be resolved (e.g. deleted channel)", async () => {+ const db = createSequentialDb([+ [], // channels query returns nothing for a stale/deleted channelId+ [{ id: "u_1", name: "Alice" }],+ [], // serverIds ends up empty since no channel row was found+ ]);+ const [msg] = await agentInbox.toAgentMessages(db, [rawMsg({ channelId: "ch_gone" })], "viewer_1");+ expect(msg!.channel).toBe("/unknown/ch_gone");+ });++ it("falls back to the raw authorId as sender when the user row is missing", async () => {+ const db = createSequentialDb([+ [{ id: "ch_1", name: "general", serverId: "srv_1", parentChannelId: null, parentMessageId: null }],+ [], // author lookup misses+ [{ id: "srv_1", name: "studio" }],+ ]);+ const [msg] = await agentInbox.toAgentMessages(db, [rawMsg({ authorId: "u_ghost" })], "viewer_1");+ expect(msg!.sender).toBe("@u_ghost");+ });+});++describe("toAgentMessage", () => {+ it("returns the single hydrated message (convenience wrapper)", async () => {+ const db = createSequentialDb([+ [{ id: "ch_1", name: "general", serverId: "srv_1", parentChannelId: null, parentMessageId: null }],+ [{ id: "u_1", name: "Alice" }],+ [{ id: "srv_1", name: "studio" }],+ ]);+ const msg = await agentInbox.toAgentMessage(db, rawMsg(), "viewer_1");+ expect(msg.sender).toBe("@Alice");+ });+});++describe("listUnreadMessagesForAgent", () => {+ it("strips the internal lastReadSeq column before returning rows", async () => {+ const db = createSequentialDb([+ [{ ...rawMsg(), lastReadSeq: 0 }],+ ]);+ const result = await agentInbox.listUnreadMessagesForAgent(db, "bot_1", { max: 50 });+ expect(result).toEqual([rawMsg()]);+ expect(result[0]).not.toHaveProperty("lastReadSeq");+ });++ it("passes opts.max through to .limit()", async () => {+ const db = createSequentialDb([[]]);+ await agentInbox.listUnreadMessagesForAgent(db, "bot_1", { max: 17 });+ // The final chain instance's `.limit` mock recorded the call.+ const chainResult = db.select.mock.results[0]!.value;+ expect(chainResult.limit).toHaveBeenCalledWith(17);+ });++ it("joins scope tables before unread filtering", async () => {+ const db = createSequentialDb([[]]);+ await agentInbox.listUnreadMessagesForAgent(db, "bot_1", { max: 50 });++ const chainResult = db.select.mock.results[0]!.value;+ expect(chainResult.leftJoin).toHaveBeenCalledTimes(4);+ expect(chainResult.leftJoin.mock.invocationCallOrder[0]).toBeLessThan(+ chainResult.where.mock.invocationCallOrder[0]+ );+ });+});++describe("getInboxSnapshotForAgent", () => {+ it("returns [] and skips the user-name lookup when there's no pending unread", async () => {+ const db = createSequentialDb([[]]);+ const result = await agentInbox.getInboxSnapshotForAgent(db, "bot_1");+ expect(result).toEqual([]);+ expect(db.select).toHaveBeenCalledTimes(1);+ });++ it("hydrates latestSender from the user table and sets hasMention from mentionCount", async () => {+ const db = createSequentialDb([+ [+ {+ channelId: "ch_1",+ dmConversationId: null,+ pendingCount: 3,+ firstPendingSeq: 5,+ latestSeq: 7,+ latestSenderId: "u_1",+ mentionCount: 1,+ },+ {+ channelId: "ch_2",+ dmConversationId: null,+ pendingCount: 1,+ firstPendingSeq: 9,+ latestSeq: 9,+ latestSenderId: "u_2",+ mentionCount: 0,+ },+ ],+ [+ { id: "u_1", name: "Alice" },+ { id: "u_2", name: "Bob" },+ ],+ ]);+ const result = await agentInbox.getInboxSnapshotForAgent(db, "bot_1");+ expect(result).toEqual([+ {+ channelId: "ch_1",+ dmConversationId: null,+ pendingCount: 3,+ firstPendingSeq: 5,+ latestSeq: 7,+ latestSender: "@Alice",+ hasMention: true,+ },+ {+ channelId: "ch_2",+ dmConversationId: null,+ pendingCount: 1,+ firstPendingSeq: 9,+ latestSeq: 9,+ latestSender: "@Bob",+ hasMention: false,+ },+ ]);+ });++ it("joins scope tables before unread aggregation", async () => {+ const db = createSequentialDb([[]]);+ await agentInbox.getInboxSnapshotForAgent(db, "bot_1");++ const chainResult = db.select.mock.results[0]!.value;+ expect(chainResult.leftJoin).toHaveBeenCalledTimes(4);+ expect(chainResult.leftJoin.mock.invocationCallOrder[0]).toBeLessThan(+ chainResult.where.mock.invocationCallOrder[0]+ );+ });+});++describe("toInboxRows", () => {+ it("returns [] and never touches the db for an empty row list", async () => {+ const db = createSequentialDb([]);+ const result = await agentInbox.toInboxRows(db, [], "viewer_1");+ expect(result).toEqual([]);+ expect(db.select).not.toHaveBeenCalled();+ });++ it("sets dm/thread/mention flags based on the row shape", async () => {+ // Row 1: a DM row with a mention. Row 2: a thread-channel row, no mention.+ const rows: agentInbox.InboxSnapshotRow[] = [+ {+ channelId: null,+ dmConversationId: "dm_1",+ pendingCount: 2,+ firstPendingSeq: 1,+ latestSeq: 2,+ latestSender: "@Bob",+ hasMention: true,+ },+ {+ channelId: "thread_1",+ dmConversationId: null,+ pendingCount: 1,+ firstPendingSeq: 10,+ latestSeq: 10,+ latestSender: "@Alice",+ hasMention: false,+ },+ ];+ // Call order: 1. channels query (channelIds=[thread_1]), 2. dms query+ // (dmIds=[dm_1]), 3. parentChannels, 4. servers, 5. parentMessages.+ const db = createSequentialDb([+ [{ id: "thread_1", name: "thread-x", serverId: "srv_1", parentChannelId: "ch_parent", parentMessageId: "m_root" }],+ [{ id: "dm_1", user1Id: "viewer_1", user2Id: "peer_1" }],+ [{ id: "ch_parent", name: "general" }],+ [{ id: "srv_1", name: "studio" }],+ [{ id: "m_root", seq: 3 }],+ ]);+ const result = await agentInbox.toInboxRows(db, rows, "viewer_1");+ expect(result[0]).toMatchObject({+ channel: formatRef({ server: DM_SERVER, channel: "peer_1" }),+ flags: ["dm", "mention"],+ });+ expect(result[1]).toMatchObject({+ channel: formatRef({ server: "studio", channel: "general", threadRootSeq: 3 }),+ flags: ["thread"],+ });+ });+});++describe("listMessagesBySeq", () => {+ it("default (no cursor): fetches latest page desc then reverses to ascending", async () => {+ const db = createSequentialDb([+ [rawMsg({ id: "m_3", seq: 3 }), rawMsg({ id: "m_2", seq: 2 }), rawMsg({ id: "m_1", seq: 1 })],+ ]);+ const result = await agentInbox.listMessagesBySeq(db, { channelId: "ch_1" }, { limit: 50 });+ expect(result.items.map((m) => m.seq)).toEqual([1, 2, 3]);+ expect(result.hasMore).toBe(false);+ expect(result.latestSeq).toBe(3);+ });++ it("after cursor: ascending order, trims the probe row and reports hasMore", async () => {+ // limit=2 → fetches limit+1=3 rows to probe for more.+ const db = createSequentialDb([+ [rawMsg({ id: "m_2", seq: 2 }), rawMsg({ id: "m_3", seq: 3 }), rawMsg({ id: "m_4", seq: 4 })],+ ]);+ const result = await agentInbox.listMessagesBySeq(db, { channelId: "ch_1" }, { after: 1, limit: 2 });+ expect(result.items.map((m) => m.seq)).toEqual([2, 3]);+ expect(result.hasMore).toBe(true);+ expect(result.latestSeq).toBe(3);+ });++ it("before cursor: fetched desc, reversed to ascending, probe row trimmed off the OLD end", async () => {+ const db = createSequentialDb([+ [rawMsg({ id: "m_9", seq: 9 }), rawMsg({ id: "m_8", seq: 8 }), rawMsg({ id: "m_7", seq: 7 })],+ ]);+ const result = await agentInbox.listMessagesBySeq(db, { channelId: "ch_1" }, { before: 10, limit: 2 });+ expect(result.items.map((m) => m.seq)).toEqual([8, 9]);+ expect(result.hasMore).toBe(true);+ });++ it("around cursor: merges before/at/after into one ascending window", async () => {+ // 3 selects: at (exact match), before (desc, reversed), after (asc).+ const db = createSequentialDb([+ [rawMsg({ id: "m_5", seq: 5 })],+ [rawMsg({ id: "m_4", seq: 4 })],+ [rawMsg({ id: "m_6", seq: 6 })],+ ]);+ const result = await agentInbox.listMessagesBySeq(db, { channelId: "ch_1" }, { around: 5, limit: 10 });+ expect(result.items.map((m) => m.seq)).toEqual([4, 5, 6]);+ });++ it("around cursor: probes both sides for hasMore and trims back to limit", async () => {+ const db = createSequentialDb([+ [rawMsg({ id: "m_5", seq: 5 })],+ [rawMsg({ id: "m_4", seq: 4 }), rawMsg({ id: "m_3", seq: 3 })],+ [rawMsg({ id: "m_6", seq: 6 }), rawMsg({ id: "m_7", seq: 7 })],+ ]);++ const result = await agentInbox.listMessagesBySeq(db, { channelId: "ch_1" }, { around: 5, limit: 3 });++ expect(result.items.map((m) => m.seq)).toEqual([4, 5, 6]);+ expect(result.hasMore).toBe(true);+ expect(result.latestSeq).toBe(6);+ });++ it("around cursor: excludes legacy seq 0 from the anchor query", async () => {+ const db = createSequentialDb([+ [], // at seq 0 is intentionally filtered out by excludeSentinel+ [],+ [rawMsg({ id: "m_1", seq: 1 })],+ ]);++ const result = await agentInbox.listMessagesBySeq(db, { channelId: "ch_1" }, { around: 0, limit: 10 });++ expect(result.items.map((m) => m.seq)).toEqual([1]);+ expect(result.hasMore).toBe(false);+ });++ it("returns latestSeq undefined for an empty page", async () => {+ const db = createSequentialDb([[]]);+ const result = await agentInbox.listMessagesBySeq(db, { channelId: "ch_empty" }, {});+ expect(result.items).toEqual([]);+ expect(result.hasMore).toBe(false);+ expect(result.latestSeq).toBeUndefined();+ });++ it("caps limit at 200 even when a larger value is requested", async () => {+ const db = createSequentialDb([[]]);+ await agentInbox.listMessagesBySeq(db, { channelId: "ch_1" }, { limit: 9999 });+ const chainResult = db.select.mock.results[0]!.value;+ expect(chainResult.limit).toHaveBeenCalledWith(201);+ });+});diff --git a/src/shared/test/queries/community-channel-threads.test.ts b/src/shared/test/queries/community-channel-threads.test.tsnew file mode 100644index 000000000..37dd19558--- /dev/null+++ b/src/shared/test/queries/community-channel-threads.test.ts@@ -0,0 +1,104 @@+import { describe, it, expect, vi } from "vitest";+import { createThreadChannel } from "../../src/db/queries/community/channel";++/**+ * `createThreadChannel` mixes two `db.select()` round trips (parent-channel+ * lookup, parent-message lookup, run via `Promise.all`) with one `db.insert()`+ * and a final `db.select()` re-fetch (via `getChannel`). The thenable-chain+ * trick from `community-agent-inbox.test.ts` covers the selects (FIFO by+ * call order); `insert` is mocked separately since its shape+ * (`.values().returning()`) never varies here.+ */+function createMockDb(opts: {+ selectResponses: unknown[][];+ insertedId: string;+}) {+ let call = 0;+ const methods = ["from", "where"];+ const select = vi.fn(() => {+ const idx = call++;+ const chain: any = {};+ for (const m of methods) chain[m] = vi.fn(() => chain);+ chain.then = (resolve: any, reject: any) =>+ Promise.resolve(opts.selectResponses[idx] ?? []).then(resolve, reject);+ return chain;+ });+ const insertValues = vi.fn();+ const insert = vi.fn(() => ({+ values: vi.fn((v: any) => {+ insertValues(v);+ return { returning: vi.fn(() => Promise.resolve([{ id: opts.insertedId }])) };+ }),+ }));+ return { select, insert, __insertValues: insertValues } as any;+}++describe("createThreadChannel", () => {+ it("derives the thread name from the parent message's first 40 chars, trimmed", async () => {+ const longContent = " " + "x".repeat(60) + " ";+ const db = createMockDb({+ selectResponses: [+ [{ serverId: "srv_1" }], // parent channel lookup+ [{ content: longContent }], // parent message lookup+ [{ id: "thread_1", serverId: "srv_1", name: "x".repeat(40), type: "thread", forumTags: null }], // getChannel re-fetch+ ],+ insertedId: "thread_1",+ });+ await createThreadChannel(db, "ch_parent", "m_root", "u_1");+ expect(db.__insertValues).toHaveBeenCalledWith(+ expect.objectContaining({ name: "x".repeat(40), type: "thread" })+ );+ });++ it("falls back to the literal 'Thread' when the parent message has no usable text", async () => {+ const db = createMockDb({+ selectResponses: [+ [{ serverId: "srv_1" }],+ [{ content: " " }], // whitespace-only → trims to empty+ [{ id: "thread_1", serverId: "srv_1", name: "Thread", type: "thread", forumTags: null }],+ ],+ insertedId: "thread_1",+ });+ await createThreadChannel(db, "ch_parent", "m_root", "u_1");+ expect(db.__insertValues).toHaveBeenCalledWith(expect.objectContaining({ name: "Thread" }));+ });++ it("always sets type: 'thread' — never inherits the parent's own type", async () => {+ const db = createMockDb({+ selectResponses: [+ [{ serverId: "srv_1" }],+ [{ content: "hello" }],+ [{ id: "thread_1", serverId: "srv_1", name: "hello", type: "thread", forumTags: null }],+ ],+ insertedId: "thread_1",+ });+ await createThreadChannel(db, "ch_parent", "m_root", "u_1");+ expect(db.__insertValues).toHaveBeenCalledWith(expect.objectContaining({ type: "thread" }));+ });++ it("sets parentChannelId/parentMessageId/creatorId on the insert, and returns the re-fetched channel", async () => {+ const db = createMockDb({+ selectResponses: [+ [{ serverId: "srv_1" }],+ [{ content: "hello" }],+ [{ id: "thread_1", serverId: "srv_1", name: "hello", type: "thread", forumTags: null }],+ ],+ insertedId: "thread_1",+ });+ const created = await createThreadChannel(db, "ch_parent", "m_root", "u_creator");+ expect(db.__insertValues).toHaveBeenCalledWith(+ expect.objectContaining({+ parentChannelId: "ch_parent",+ parentMessageId: "m_root",+ creatorId: "u_creator",+ serverId: "srv_1",+ })+ );+ expect(created).toMatchObject({ id: "thread_1", serverId: "srv_1" });+ });++ it("throws if the parent channel can't be found (defensive — resolver should never call it this way)", async () => {+ const db = createMockDb({ selectResponses: [[], [{ content: "hi" }]], insertedId: "x" });+ await expect(createThreadChannel(db, "ch_missing", "m_root", "u_1")).rejects.toThrow(/not found/);+ });+});diff --git a/src/shared/test/queries/community-message.test.ts b/src/shared/test/queries/community-message.test.tsindex 6df4c20cd..9e64ae706 100644--- a/src/shared/test/queries/community-message.test.ts+++ b/src/shared/test/queries/community-message.test.ts@@ -5,6 +5,7 @@ import {communityChannel,communityDmConversation,communityReadState,+ communityMessageSeq,} from "../../src/db/community-schema";describe("community/message exports", () => {@@ -106,25 +107,45 @@ describe("getMessagesByIds", () => {** `insert(table).values(v).returning()` resolves to `[{...v, id: v.id ?? generatedId}]`* so the caller can read `msg.createdAt` and `msg.id` off the inserted row.- * `insert(table).values(v).onConflictDoUpdate(cfg)` resolves to void — the- * common upsert shape used by the author-read-watermark writes.+ * `insert(table).values(v).onConflictDoUpdate(cfg)` resolves to void for+ * every table EXCEPT `communityMessageSeq`, whose upsert is followed by a+ * `.returning({ nextSeq })` (`claimNextSeq`) — that one resolves to an+ * incrementing per-scopeKey counter (starting at 1), mirroring the real+ * `INSERT ... ON CONFLICT DO UPDATE SET next_seq = next_seq + 1` semantics.*/function createCreateMessageDbMock(opts?: { messageId?: string }) {const inserts: Array<{ table: unknown; values?: any; onConflict?: any }> = [];const updates: Array<{ table: unknown; set?: any; where?: any }> = [];const generatedId = opts?.messageId ?? "m_generated";+ const seqByScope = new Map<string, number>();const db: any = {insert: vi.fn((table: unknown) => {+ // `claimNextSeq`'s counter-row upsert (`communityMessageSeq`) is+ // intentionally NOT recorded into `__inserts` — every existing+ // assertion below indexes `__inserts[0]`/`[1]` assuming exactly the+ // message row then the read-state upsert, and this call always+ // precedes both (see `createMessage`'s "Step 0").+ if (table === communityMessageSeq) {+ return {+ values: vi.fn((v: any) => ({+ onConflictDoUpdate: vi.fn(() => ({+ returning: vi.fn(() => {+ const next = (seqByScope.get(v.scopeKey) ?? 0) + 1;+ seqByScope.set(v.scopeKey, next);+ return Promise.resolve([{ nextSeq: next }]);+ }),+ })),+ })),+ };+ }const rec: { table: unknown; values?: any; onConflict?: any } = { table };inserts.push(rec);return {values: vi.fn((v: any) => {rec.values = v;return {- returning: vi.fn(() =>- Promise.resolve([{ ...v, id: v.id ?? generatedId }])- ),+ returning: vi.fn(() => Promise.resolve([{ ...v, id: v.id ?? generatedId }])),onConflictDoUpdate: vi.fn((cfg: any) => {rec.onConflict = cfg;return Promise.resolve();@@ -192,6 +213,7 @@ describe("createMessage — channel path", () => {lastReadAt: msg.createdAt,lastReadMessageId: msg.id,});+ expect(db.__inserts[1].onConflict.setWhere).toBeDefined();// targetWhere pins the partial-unique-index shape so this upsert lands on// the channel row, not the DM row (they share `(userId, ...)`).expect(db.__inserts[1].onConflict.targetWhere).toBeDefined();@@ -298,6 +320,7 @@ describe("createMessage — DM path", () => {lastReadAt: msg.createdAt,lastReadMessageId: msg.id,});+ expect(db.__inserts[1].onConflict.setWhere).toBeDefined();expect(db.__inserts[1].onConflict.targetWhere).toBeDefined();});@@ -314,6 +337,139 @@ describe("createMessage — DM path", () => {});});+describe("scopeKeyForTarget", () => {+ it("prefixes a channelId with 'channel:'", () => {+ expect(messageQueries.scopeKeyForTarget({ channelId: "c_1" })).toBe("channel:c_1");+ });++ it("prefixes a dmConversationId with 'dm:'", () => {+ expect(messageQueries.scopeKeyForTarget({ dmConversationId: "dm_1" })).toBe("dm:dm_1");+ });++ it("channelId takes precedence when both are somehow set", () => {+ expect(messageQueries.scopeKeyForTarget({ channelId: "c_1", dmConversationId: "dm_1" })).toBe(+ "channel:c_1"+ );+ });++ it("throws when neither is provided", () => {+ expect(() => messageQueries.scopeKeyForTarget({})).toThrow();+ });+});++describe("createMessage — seq assignment", () => {+ /**+ * Records every `insert(communityMessageSeq).values(v).onConflictDoUpdate(cfg)`+ * call so tests can assert the scope key and upsert shape `claimNextSeq`+ * sends, independent of the generic `createCreateMessageDbMock` helper+ * (which only exposes the DERIVED seq number, not the raw upsert args).+ */+ function createSeqSpyDbMock(opts?: { messageId?: string; seqSequence?: number[] }) {+ const base = createCreateMessageDbMock(opts);+ const seqCalls: Array<{ values: any; onConflict: any }> = [];+ let seqIdx = 0;+ const seqSequence = opts?.seqSequence;+ const originalInsert = base.insert;+ base.insert = vi.fn((table: unknown) => {+ if (table === communityMessageSeq) {+ const rec: { values: any; onConflict: any } = { values: undefined, onConflict: undefined };+ seqCalls.push(rec);+ return {+ values: vi.fn((v: any) => {+ rec.values = v;+ return {+ onConflictDoUpdate: vi.fn((cfg: any) => {+ rec.onConflict = cfg;+ return {+ returning: vi.fn(() => {+ const next = seqSequence ? seqSequence[seqIdx++] : 1;+ return Promise.resolve([{ nextSeq: next }]);+ }),+ };+ }),+ };+ }),+ };+ }+ return originalInsert(table);+ });+ base.__seqCalls = seqCalls;+ return base;+ }++ it("claims the seq scoped to 'channel:<id>' for a channel send", async () => {+ const db = createSeqSpyDbMock();+ await messageQueries.createMessage(db, { authorId: "u_1", content: "hi", channelId: "ch_1" });+ expect(db.__seqCalls).toHaveLength(1);+ expect(db.__seqCalls[0].values).toEqual({ scopeKey: "channel:ch_1", nextSeq: 1 });+ expect(db.__seqCalls[0].onConflict.target).toBe(communityMessageSeq.scopeKey);+ });++ it("claims the seq scoped to 'dm:<id>' for a DM send", async () => {+ const db = createSeqSpyDbMock();+ await messageQueries.createMessage(db, { authorId: "u_1", content: "hi", dmConversationId: "dm_1" });+ expect(db.__seqCalls[0].values).toEqual({ scopeKey: "dm:dm_1", nextSeq: 1 });+ });++ it("passes the claimed seq through to the message row AND the read-state watermark", async () => {+ const db = createSeqSpyDbMock({ seqSequence: [5] });+ const msg = await messageQueries.createMessage(db, {+ authorId: "u_1",+ content: "hi",+ channelId: "ch_1",+ });+ expect(msg.seq).toBe(5);+ expect(db.__inserts[0].values.seq).toBe(5);+ expect(db.__inserts[1].values.lastReadSeq).toBe(5);+ expect(db.__inserts[1].onConflict.set.lastReadSeq).toBe(5);+ });++ it("passes the claimed seq through for the DM read-state watermark too", async () => {+ const db = createSeqSpyDbMock({ seqSequence: [9] });+ const msg = await messageQueries.createMessage(db, {+ authorId: "u_1",+ content: "hi",+ dmConversationId: "dm_1",+ });+ expect(msg.seq).toBe(9);+ expect(db.__inserts[1].values.lastReadSeq).toBe(9);+ expect(db.__inserts[1].onConflict.set.lastReadSeq).toBe(9);+ });++ it("consecutive sends in the same channel scope get strictly increasing seqs", async () => {+ const db = createSeqSpyDbMock({ seqSequence: [1, 2, 3] });+ const first = await messageQueries.createMessage(db, {+ authorId: "u_1",+ content: "one",+ channelId: "ch_1",+ });+ const second = await messageQueries.createMessage(db, {+ authorId: "u_1",+ content: "two",+ channelId: "ch_1",+ });+ const third = await messageQueries.createMessage(db, {+ authorId: "u_1",+ content: "three",+ channelId: "ch_1",+ });+ expect([first.seq, second.seq, third.seq]).toEqual([1, 2, 3]);+ });++ it("the seq claim (insert into communityMessageSeq) happens before the message row insert", async () => {+ const order: string[] = [];+ const db = createSeqSpyDbMock();+ const originalInsert = db.insert;+ db.insert = vi.fn((table: unknown) => {+ order.push(table === communityMessageSeq ? "seq" : "message-or-other");+ return originalInsert(table);+ });+ await messageQueries.createMessage(db, { authorId: "u_1", content: "hi", channelId: "ch_1" });+ expect(order[0]).toBe("seq");+ expect(order[1]).toBe("message-or-other");+ });+});+// ── getLatestMessage / getLatestMessagesByChannelIds ──────────────────────//// These feed the invariant unification (plan #4) — every mark-read path that@@ -445,9 +601,19 @@ describe("read-state invariant property — every write path", () => {const writes: Capture[] = [];function makePropertyDb() {+ let seqCounter = 0;const db: any = {- insert: vi.fn(() => ({+ insert: vi.fn((table: unknown) => ({values: vi.fn((v: any) => {+ if (table === communityMessageSeq) {+ // `claimNextSeq`'s counter row — not a read-state write, doesn't+ // carry lastReadAt/lastReadMessageId, so it's a no-op for `writes`.+ return {+ onConflictDoUpdate: vi.fn(() => ({+ returning: vi.fn(() => Promise.resolve([{ nextSeq: ++seqCounter }])),+ })),+ };+ }if (Array.isArray(v)) {for (const row of v) writes.push({lastReadAt: row.lastReadAt,@@ -579,17 +745,20 @@ describe("read-state invariant property — every write path", () => {// createMessage generates its own `now` and `msg.id` — capture those// by scanning the inserts on dbD and dbE for the message row.]);- // Add createMessage-derived valid pairs. The first insert on each of- // dbD/dbE is the message row; its `createdAt` is `now` and `id` is- // the returned generated id (dbD's mock returns `m_generated`).+ // Add createMessage-derived valid pairs. `createMessage` now issues an+ // `insert` for the seq counter (`communityMessageSeq`) BEFORE the message+ // row, so scan every insert call on dbD/dbE for the one whose payload is+ // the message row (identified by carrying `content`) rather than+ // assuming it's the first call.const createDbs: any[] = [dbD, dbE];for (const cdb of createDbs) {- const firstInsertCall = cdb.insert.mock.calls[0];- if (!firstInsertCall) continue;- const valuesCall = cdb.insert.mock.results[0].value.values.mock.calls[0][0];- const id = valuesCall.id ?? "m_generated";- const createdAt = valuesCall.createdAt;- validPairs.add(`${createdAt}|${id}`);+ for (const result of cdb.insert.mock.results as Array<{ value: any }>) {+ const valuesCall = result.value?.values?.mock?.calls?.[0]?.[0];+ if (!valuesCall || !("content" in valuesCall)) continue;+ const id = valuesCall.id ?? "m_generated";+ const createdAt = valuesCall.createdAt;+ validPairs.add(`${createdAt}|${id}`);+ }}for (const w of writes) {diff --git a/src/shared/test/queries/community-read-state-bump-cursor.test.ts b/src/shared/test/queries/community-read-state-bump-cursor.test.tsnew file mode 100644index 000000000..31684d88e--- /dev/null+++ b/src/shared/test/queries/community-read-state-bump-cursor.test.ts@@ -0,0 +1,131 @@+import { describe, it, expect, vi } from "vitest";+import { bumpReadCursor } from "../../src/db/queries/community/read-state";+import { communityReadState } from "../../src/db/community-schema";++/**+ * `bumpReadCursor` does exactly two selects in order (`getMessageByChannelAndSeq`,+ * then `getReadState`) before its conditional insert/upsert — the thenable+ * chain trick from `community-agent-inbox.test.ts` covers both regardless of+ * which builder method ends up "last" in each call.+ */+function createMockDb(selectResponses: unknown[][]) {+ let call = 0;+ const methods = ["from", "where"];+ const select = vi.fn(() => {+ const idx = call++;+ const chain: any = {};+ for (const m of methods) chain[m] = vi.fn(() => chain);+ chain.then = (resolve: any, reject: any) =>+ Promise.resolve(selectResponses[idx] ?? []).then(resolve, reject);+ return chain;+ });+ const insertCalls: Array<{ values: any; onConflict: any }> = [];+ const insert = vi.fn(() => ({+ values: vi.fn((v: any) => {+ const rec = { values: v, onConflict: undefined as any };+ insertCalls.push(rec);+ return {+ onConflictDoUpdate: vi.fn((cfg: any) => {+ rec.onConflict = cfg;+ return Promise.resolve();+ }),+ };+ }),+ }));+ return { select, insert, __insertCalls: insertCalls } as any;+}++describe("bumpReadCursor", () => {+ it("returns null when seq doesn't resolve to a real message in that scope", async () => {+ const db = createMockDb([[], []]); // getMessageByChannelAndSeq → no rows+ const result = await bumpReadCursor(db, "u_1", { channelId: "ch_1" }, 99);+ expect(result).toBeNull();+ expect(db.insert).not.toHaveBeenCalled();+ });++ it("upserts lastReadMessageId/lastReadAt/lastReadSeq TOGETHER, aligned to the resolved message — never lastReadSeq alone", async () => {+ const db = createMockDb([+ [{ id: "m_5", createdAt: "2026-07-05T10:00:00.000Z", seq: 5 }], // getMessageByChannelAndSeq+ [], // getReadState — no existing row+ ]);+ const result = await bumpReadCursor(db, "u_1", { channelId: "ch_1" }, 5);+ expect(result).toEqual({ id: "m_5", createdAt: "2026-07-05T10:00:00.000Z", seq: 5 });+ expect(db.__insertCalls).toHaveLength(1);+ expect(db.__insertCalls[0].values).toMatchObject({+ userId: "u_1",+ channelId: "ch_1",+ dmConversationId: null,+ lastReadAt: "2026-07-05T10:00:00.000Z",+ lastReadMessageId: "m_5",+ lastReadSeq: 5,+ });+ expect(db.__insertCalls[0].onConflict.set).toMatchObject({+ lastReadAt: "2026-07-05T10:00:00.000Z",+ lastReadMessageId: "m_5",+ lastReadSeq: 5,+ });+ expect(db.__insertCalls[0].onConflict.setWhere).toBeDefined();+ expect(db.__insertCalls[0].onConflict.target).toEqual([+ communityReadState.userId,+ communityReadState.channelId,+ ]);+ });++ it("DM path: channelId is null, dmConversationId carries the scope", async () => {+ const db = createMockDb([+ [{ id: "m_dm_1", createdAt: "2026-07-05T11:00:00.000Z", seq: 3 }],+ [],+ ]);+ await bumpReadCursor(db, "u_1", { dmConversationId: "dm_1" }, 3);+ expect(db.__insertCalls[0].values).toMatchObject({+ channelId: null,+ dmConversationId: "dm_1",+ lastReadSeq: 3,+ });+ expect(db.__insertCalls[0].onConflict.target).toEqual([+ communityReadState.userId,+ communityReadState.dmConversationId,+ ]);+ expect(db.__insertCalls[0].onConflict.setWhere).toBeDefined();+ });++ it("idempotent — a lower/equal seq than what's already recorded is a no-op (never regresses)", async () => {+ const db = createMockDb([+ [{ id: "m_2", createdAt: "2026-07-05T09:00:00.000Z", seq: 2 }], // resolves to an OLDER message+ [{ lastReadAt: "2026-07-05T10:00:00.000Z", lastReadMessageId: "m_5", lastReadSeq: 5 }], // already ahead+ ]);+ const result = await bumpReadCursor(db, "u_1", { channelId: "ch_1" }, 2);+ // MAX semantics: existing pointer wins, no write happens.+ expect(result).toEqual({ id: "m_5", createdAt: "2026-07-05T10:00:00.000Z", seq: 5 });+ expect(db.insert).not.toHaveBeenCalled();+ });++ it("advances forward when the resolved message is strictly newer than the existing watermark", async () => {+ const db = createMockDb([+ [{ id: "m_9", createdAt: "2026-07-05T12:00:00.000Z", seq: 9 }],+ [{ lastReadAt: "2026-07-05T10:00:00.000Z", lastReadMessageId: "m_5", lastReadSeq: 5 }],+ ]);+ const result = await bumpReadCursor(db, "u_1", { channelId: "ch_1" }, 9);+ expect(result).toEqual({ id: "m_9", createdAt: "2026-07-05T12:00:00.000Z", seq: 9 });+ expect(db.__insertCalls).toHaveLength(1);+ expect(db.__insertCalls[0].values.lastReadSeq).toBe(9);+ });++ it("advances by seq even when the next message has the same createdAt timestamp", async () => {+ const timestamp = "2026-07-05T10:00:00.000Z";+ const db = createMockDb([+ [{ id: "m_6", createdAt: timestamp, seq: 6 }],+ [{ lastReadAt: timestamp, lastReadMessageId: "m_5", lastReadSeq: 5 }],+ ]);++ const result = await bumpReadCursor(db, "u_1", { channelId: "ch_1" }, 6);++ expect(result).toEqual({ id: "m_6", createdAt: timestamp, seq: 6 });+ expect(db.__insertCalls).toHaveLength(1);+ expect(db.__insertCalls[0].values).toMatchObject({+ lastReadAt: timestamp,+ lastReadMessageId: "m_6",+ lastReadSeq: 6,+ });+ });+});diff --git a/src/shared/test/queries/community-wake-candidates.test.ts b/src/shared/test/queries/community-wake-candidates.test.tsnew file mode 100644index 000000000..8371424c8--- /dev/null+++ b/src/shared/test/queries/community-wake-candidates.test.ts@@ -0,0 +1,64 @@+import { describe, it, expect, vi } from "vitest";+import { findWakeCandidates } from "../../src/db/queries/community/bot";++// Terminal-where mock — the module chains+// select().from().innerJoin().leftJoin().where(), and `.where()` is the+// terminal call that resolves to rows. We don't re-verify the WHERE+// predicate itself here (that's SQL, exercised in e2e/integration); this+// covers the post-fetch `lastReadSeq < newSeq` filter and row shape, which+// is the part `enqueueBotWakes` actually depends on.+function createSelectMock(rows: unknown[]) {+ const chain: Record<string, unknown> = {};+ chain.select = vi.fn(() => chain);+ chain.from = vi.fn(() => chain);+ chain.innerJoin = vi.fn(() => chain);+ chain.leftJoin = vi.fn(() => chain);+ chain.where = vi.fn(() => Promise.resolve(rows));+ return chain;+}++describe("findWakeCandidates", () => {+ it("returns [] and never queries when recipients is empty", async () => {+ const db = createSelectMock([{ botUserId: "never", name: "x", machineId: "m", runtime: "claude", lastReadSeq: 0 }]);+ const result = await findWakeCandidates(db as never, { recipients: [], channelId: "c1", newSeq: 5 });+ expect(result).toEqual([]);+ expect(db.select).not.toHaveBeenCalled();+ });++ it("excludes candidates already caught up (lastReadSeq >= newSeq)", async () => {+ const db = createSelectMock([+ { botUserId: "bot1", name: "zoe", machineId: "m1", runtime: "claude", lastReadSeq: 3 },+ { botUserId: "bot2", name: "kai", machineId: "m2", runtime: "codex", lastReadSeq: 10 },+ ]);+ const result = await findWakeCandidates(db as never, {+ recipients: ["bot1", "bot2"],+ channelId: "c1",+ newSeq: 7,+ });+ expect(result).toEqual([{ botUserId: "bot1", name: "zoe", machineId: "m1", runtime: "claude" }]);+ });++ it("treats a NULL lastReadSeq (never read) as behind — included", async () => {+ const db = createSelectMock([+ { botUserId: "bot1", name: "zoe", machineId: "m1", runtime: "claude", lastReadSeq: null },+ ]);+ const result = await findWakeCandidates(db as never, {+ recipients: ["bot1"],+ channelId: "c1",+ newSeq: 1,+ });+ expect(result).toEqual([{ botUserId: "bot1", name: "zoe", machineId: "m1", runtime: "claude" }]);+ });++ it("supports dmConversationId scope", async () => {+ const db = createSelectMock([+ { botUserId: "bot1", name: "zoe", machineId: "m1", runtime: "claude", lastReadSeq: 0 },+ ]);+ const result = await findWakeCandidates(db as never, {+ recipients: ["bot1"],+ dmConversationId: "dm1",+ newSeq: 1,+ });+ expect(result).toEqual([{ botUserId: "bot1", name: "zoe", machineId: "m1", runtime: "claude" }]);+ });+});diff --git a/src/wake-worker/knip.json b/src/wake-worker/knip.jsonnew file mode 100644index 000000000..d768344ce--- /dev/null+++ b/src/wake-worker/knip.json@@ -0,0 +1,12 @@+{+ "$schema": "https://unpkg.com/knip@6/schema.json",+ "project": [+ "src/**/*.ts"+ ],+ "includeEntryExports": true,+ "vitest": {+ "entry": [+ "src/**/*.test.ts"+ ]+ }+}\ No newline at end of filediff --git a/src/wake-worker/package.json b/src/wake-worker/package.jsonnew file mode 100644index 000000000..294125557--- /dev/null+++ b/src/wake-worker/package.json@@ -0,0 +1,23 @@+{+ "name": "@alook/wake-worker",+ "version": "0.0.149",+ "private": true,+ "scripts": {+ "dev": "wrangler dev --persist-to ../web/.wrangler/state",+ "deploy": "wrangler deploy",+ "knip": "knip",+ "test": "vitest run",+ "typecheck": "tsc --noEmit"+ },+ "dependencies": {+ "@alook/shared": "workspace:*"+ },+ "devDependencies": {+ "@cloudflare/workers-types": "^4.20260621.1",+ "@types/node": "^25.9.4",+ "knip": "^6.17.1",+ "typescript": "^6.0.3",+ "vitest": "^4.1.9",+ "wrangler": "^4.103.0"+ }+}\ No newline at end of filediff --git a/src/wake-worker/src/env.d.ts b/src/wake-worker/src/env.d.tsnew file mode 100644index 000000000..9f2e10879--- /dev/null+++ b/src/wake-worker/src/env.d.ts@@ -0,0 +1,3 @@+interface Env {+ WS_DO_WORKER: Fetcher+}diff --git a/src/wake-worker/src/index.test.ts b/src/wake-worker/src/index.test.tsnew file mode 100644index 000000000..047b91468--- /dev/null+++ b/src/wake-worker/src/index.test.ts@@ -0,0 +1,78 @@+import { describe, it, expect, vi, beforeEach } from "vitest"++const mockSendWakeToMachine = vi.fn()+vi.mock("@alook/shared", () => {+ const noopLogger = { debug: () => { }, info: () => { }, warn: () => { }, error: () => { }, child() { return this } }+ return {+ createLogger: () => noopLogger,+ sendWakeToMachine: (...a: unknown[]) => mockSendWakeToMachine(...a),+ }+})++import handler from "./index"++function makeMsg(body: { botUserId: string; machineId: string; command: unknown }) {+ return { body, ack: vi.fn(), retry: vi.fn() }+}++describe("wake-worker queue consumer", () => {+ const env = { WS_DO_WORKER: {} } as unknown as Env++ beforeEach(() => {+ vi.clearAllMocks()+ })++ it("acks on successful delivery ({ sent: true })", async () => {+ mockSendWakeToMachine.mockResolvedValue({ sent: true })+ const msg = makeMsg({ botUserId: "bot1", machineId: "m1", command: { type: "agent:start" } })+ const batch = { messages: [msg] } as unknown as MessageBatch<unknown>++ await handler.queue(batch as never, env)++ expect(mockSendWakeToMachine).toHaveBeenCalledWith(env, "m1", { type: "agent:start" })+ expect(msg.ack).toHaveBeenCalledTimes(1)+ expect(msg.retry).not.toHaveBeenCalled()+ })++ it("acks (does not retry) when daemon is offline ({ sent: false }) — known-permanent state", async () => {+ mockSendWakeToMachine.mockResolvedValue({ sent: false })+ const msg = makeMsg({ botUserId: "bot1", machineId: "m1", command: { type: "agent:start" } })+ const batch = { messages: [msg] } as unknown as MessageBatch<unknown>++ await handler.queue(batch as never, env)++ expect(msg.ack).toHaveBeenCalledTimes(1)+ expect(msg.retry).not.toHaveBeenCalled()+ })++ it("retries with backoff on a thrown (transient) error", async () => {+ mockSendWakeToMachine.mockRejectedValue(new Error("ws-do 500"))+ const msg = makeMsg({ botUserId: "bot1", machineId: "m1", command: { type: "agent:start" } })+ const batch = { messages: [msg] } as unknown as MessageBatch<unknown>++ await handler.queue(batch as never, env)++ expect(msg.retry).toHaveBeenCalledWith({ delaySeconds: 5 })+ expect(msg.ack).not.toHaveBeenCalled()+ })++ it("processes every message in the batch independently — one failure doesn't block others", async () => {+ mockSendWakeToMachine+ .mockResolvedValueOnce({ sent: true })+ .mockRejectedValueOnce(new Error("boom"))+ .mockResolvedValueOnce({ sent: false })++ const msgs = [+ makeMsg({ botUserId: "bot1", machineId: "m1", command: {} }),+ makeMsg({ botUserId: "bot2", machineId: "m2", command: {} }),+ makeMsg({ botUserId: "bot3", machineId: "m3", command: {} }),+ ]+ const batch = { messages: msgs } as unknown as MessageBatch<unknown>++ await handler.queue(batch as never, env)++ expect(msgs[0]!.ack).toHaveBeenCalledTimes(1)+ expect(msgs[1]!.retry).toHaveBeenCalledWith({ delaySeconds: 5 })+ expect(msgs[2]!.ack).toHaveBeenCalledTimes(1)+ })+})diff --git a/src/wake-worker/src/index.ts b/src/wake-worker/src/index.tsnew file mode 100644index 000000000..abff454c0--- /dev/null+++ b/src/wake-worker/src/index.ts@@ -0,0 +1,39 @@+import { createLogger, sendWakeToMachine } from "@alook/shared"+import type { WakePayload } from "@alook/shared"++const log = createLogger({ service: "wake-worker" })++/**+ * `alook-wake-worker` — Cloudflare Queue consumer for `alook-wake` (plan+ * §8/#13). Dumb, stateless forwarder: no D1 binding, does zero `HostCommand`+ * construction of its own (the `src/web` producer already built the full+ * command with D1 access). Fresh invocation per batch → own subrequest+ * budget; in practice exactly one subrequest (`sendWakeToMachine`) per+ * message.+ */+export default {+ async queue(batch: MessageBatch<WakePayload>, env: Env): Promise<void> {+ for (const msg of batch.messages) {+ try {+ const { sent } = await sendWakeToMachine(env, msg.body.machineId, msg.body.command)+ if (!sent) {+ log.info("wake_delivered_nowhere", { botUserId: msg.body.botUserId, machineId: msg.body.machineId })+ }+ // Both `{ sent: true }` and `{ sent: false }` ack — `false` means the+ // ws-do route resolved cleanly but the daemon is offline, a+ // known-permanent state for this attempt (plan §8's error contract).+ // Daemon reconnect warmup recovers; retrying here would just spin.+ msg.ack()+ } catch (err) {+ // Transient failure (5xx / network) — retry with backoff. After+ // `max_retries` (wrangler.toml: 3), the message lands in the DLQ.+ log.warn("wake_dispatch_failed_retrying", {+ botUserId: msg.body.botUserId,+ machineId: msg.body.machineId,+ err: String(err),+ })+ msg.retry({ delaySeconds: 5 })+ }+ }+ },+}diff --git a/src/wake-worker/tsconfig.json b/src/wake-worker/tsconfig.jsonnew file mode 100644index 000000000..d7bbb48cd--- /dev/null+++ b/src/wake-worker/tsconfig.json@@ -0,0 +1,19 @@+{+ "compilerOptions": {+ "target": "ES2022",+ "module": "ESNext",+ "moduleResolution": "bundler",+ "strict": true,+ "skipLibCheck": true,+ "types": [+ "@cloudflare/workers-types",+ "node"+ ],+ "lib": [+ "ES2022"+ ]+ },+ "include": [+ "src"+ ]+}\ No newline at end of filediff --git a/src/wake-worker/vitest.config.ts b/src/wake-worker/vitest.config.tsnew file mode 100644index 000000000..5a8caddbb--- /dev/null+++ b/src/wake-worker/vitest.config.ts@@ -0,0 +1,8 @@+import { defineConfig, mergeConfig } from "vitest/config"+import shared from "../../vitest.shared"++export default mergeConfig(shared, defineConfig({+ test: {+ include: ["src/**/*.test.ts"],+ },+}))diff --git a/src/wake-worker/wrangler.toml b/src/wake-worker/wrangler.tomlnew file mode 100644index 000000000..5f2d047f9--- /dev/null+++ b/src/wake-worker/wrangler.toml@@ -0,0 +1,35 @@+name = "alook-wake-worker"+main = "src/index.ts"+compatibility_date = "2025-04-01"+compatibility_flags = ["nodejs_compat"]+workers_dev = false++[observability]+enabled = true+head_sampling_rate = 0.1++[observability.logs]+invocation_logs = true+head_sampling_rate = 0.1+destinations = ["grafana-logs"]++[observability.traces]+enabled = true+head_sampling_rate = 0.05+destinations = ["grafana-traces"]++[dev]+port = 8790+inspector_port = 9232++# Sole binding this worker needs (plan §8) — doName resolution happens+# inside `alook-ws-do`'s own D1-backed route, not here. No D1 binding.+[[services]]+binding = "WS_DO_WORKER"+service = "alook-ws-do"++[[queues.consumers]]+queue = "alook-wake"+max_batch_size = 25+max_retries = 3+dead_letter_queue = "alook-wake-dlq"diff --git a/src/web/migrations/0052_community_message_seq.sql b/src/web/migrations/0052_community_message_seq.sqlnew file mode 100644index 000000000..fbd46b82c--- /dev/null+++ b/src/web/migrations/0052_community_message_seq.sql@@ -0,0 +1,34 @@+-- Per-channel/DM message sequencing via an atomic counter table.+-- See plans/community-agent-cli-bridge.md design §3.+--+-- `seq` is per-scope (channel or DM), monotonic, unique, but NOT guaranteed+-- gap-free (see design §3 for why a rare gap is an accepted trade-off, not a+-- bug). Existing rows are backfilled to seq = 0, a sentinel excluded from the+-- partial unique indexes below and treated as "not addressable by seq" by+-- the agent API's `resolve`/`read` routes.++-- 1. Counter table. One row per scope; `next_seq` holds the most recently+-- issued value (NOT "the next value to hand out", despite the name —+-- see design §7's `getLatestSeqForScope` note).+CREATE TABLE community_message_seq (+ scope_key TEXT PRIMARY KEY, -- 'channel:<id>' or 'dm:<id>'+ next_seq INTEGER NOT NULL+);++-- 2. seq column on community_message. Legacy rows default to 0 (sentinel).+ALTER TABLE community_message ADD COLUMN seq INTEGER NOT NULL DEFAULT 0;++-- 3. Uniqueness, excluding the legacy seq=0 sentinel.+CREATE UNIQUE INDEX uq_community_message_channel_seq+ ON community_message(channel_id, seq)+ WHERE channel_id IS NOT NULL AND seq > 0;++CREATE UNIQUE INDEX uq_community_message_dm_seq+ ON community_message(dm_conversation_id, seq)+ WHERE dm_conversation_id IS NOT NULL AND seq > 0;++-- 4. Prevents concurrent thread auto-create (resolve-ref.ts) from racing to+-- insert two thread channel rows for the same parent message.+CREATE UNIQUE INDEX uq_community_channel_parent_message+ ON community_channel(parent_channel_id, parent_message_id)+ WHERE parent_channel_id IS NOT NULL AND parent_message_id IS NOT NULL;diff --git a/src/web/migrations/0053_community_read_state_last_read_seq.sql b/src/web/migrations/0053_community_read_state_last_read_seq.sqlnew file mode 100644index 000000000..ee56eff33--- /dev/null+++ b/src/web/migrations/0053_community_read_state_last_read_seq.sql@@ -0,0 +1,6 @@+-- lastReadSeq on community_read_state — shared per-user cursor for humans+-- and bots (bots ARE users invariant). Only the agent `ack` route and the+-- author read-watermark upsert inside createMessage populate this; existing+-- human-only read routes (mark-all-read, thread read, DM read) intentionally+-- do not maintain it — see plans/community-agent-cli-bridge.md design §4.+ALTER TABLE community_read_state ADD COLUMN last_read_seq INTEGER NOT NULL DEFAULT 0;diff --git a/src/web/src/app/api/community/agent/ack/route.test.ts b/src/web/src/app/api/community/agent/ack/route.test.tsnew file mode 100644index 000000000..d898052fa--- /dev/null+++ b/src/web/src/app/api/community/agent/ack/route.test.ts@@ -0,0 +1,146 @@+import { describe, it, expect, vi, beforeEach } from "vitest"+import { NextRequest } from "next/server"++vi.mock("@opennextjs/cloudflare", () => ({+ getCloudflareContext: vi.fn(async () => ({ env: { DB: {} } })),+}))+vi.mock("@/lib/db", () => ({ getDb: vi.fn(() => ({})) }))++const mockFindActiveAgentRunnerKeyByBearer = vi.fn()+const mockGetUserInternal = vi.fn()+const mockGetBotBinding = vi.fn()+const mockResolveServerByNameForMember = vi.fn()+const mockResolveChannelByNameForMember = vi.fn()+const mockGetChannelForMember = vi.fn()+const mockGetDM = vi.fn()+const mockGetDMBetween = vi.fn()+const mockIsBlocked = vi.fn()+const mockBumpReadCursor = vi.fn()++vi.mock("@alook/shared", async () => {+ const actual = await vi.importActual<typeof import("@alook/shared")>("@alook/shared")+ return {+ ...actual,+ queries: {+ ...actual.queries,+ communityMachine: { findActiveAgentRunnerKeyByBearer: (...a: unknown[]) => mockFindActiveAgentRunnerKeyByBearer(...a) },+ user: { getUserInternal: (...a: unknown[]) => mockGetUserInternal(...a) },+ communityBot: { getBotBinding: (...a: unknown[]) => mockGetBotBinding(...a) },+ communityFriendship: { isBlocked: (...a: unknown[]) => mockIsBlocked(...a) },+ communityServer: { resolveServerByNameForMember: (...a: unknown[]) => mockResolveServerByNameForMember(...a) },+ communityChannel: {+ resolveChannelByNameForMember: (...a: unknown[]) => mockResolveChannelByNameForMember(...a),+ getChannelForMember: (...a: unknown[]) => mockGetChannelForMember(...a),+ },+ communityDm: {+ getDM: (...a: unknown[]) => mockGetDM(...a),+ getDMBetween: (...a: unknown[]) => mockGetDMBetween(...a),+ },+ communityReadState: { bumpReadCursor: (...a: unknown[]) => mockBumpReadCursor(...a) },+ },+ }+})++import { POST } from "./route"++function req(body: unknown, headers: Record<string, string> = {}): NextRequest {+ return new NextRequest("http://localhost/api/community/agent/ack", {+ method: "POST",+ headers: { "content-type": "application/json", ...headers },+ body: typeof body === "string" ? body : JSON.stringify(body),+ })+}++describe("POST /api/community/agent/ack", () => {+ beforeEach(() => {+ vi.clearAllMocks()+ mockFindActiveAgentRunnerKeyByBearer.mockResolvedValue({ userId: "owner_1", machineId: "m_1", agentId: "bot_1" })+ mockGetUserInternal.mockResolvedValue({ isBot: true, deletedAt: null })+ mockGetBotBinding.mockResolvedValue({ machineId: "m_1", runtime: "claude" })+ mockResolveServerByNameForMember.mockResolvedValue([{ id: "srv_1" }])+ mockResolveChannelByNameForMember.mockResolvedValue([{ id: "ch_1" }])+ mockGetChannelForMember.mockResolvedValue({ id: "ch_1", serverId: "srv_1", parentChannelId: null })+ })++ it("401 without Authorization", async () => {+ const res = await POST(req({ cursors: [{ channel: "/studio/general", seq: 3 }] }))+ expect(res.status).toBe(401)+ })++ it("400 when cursors is empty (schema requires min 1)", async () => {+ const res = await POST(req({ cursors: [] }, { Authorization: "Bearer crk_abc" }))+ expect(res.status).toBe(400)+ })++ it("400 when a cursor uses seq 0 sentinel", async () => {+ const res = await POST(+ req({ cursors: [{ channel: "/studio/general", seq: 0 }] }, { Authorization: "Bearer crk_abc" })+ )+ expect(res.status).toBe(400)+ expect(mockBumpReadCursor).not.toHaveBeenCalled()+ })++ it("never auto-creates a DM/thread as a side effect — resolves with createDmIfMissing/createThreadIfMissing false", async () => {+ mockResolveServerByNameForMember.mockResolvedValue([])+ const res = await POST(+ req({ cursors: [{ channel: "/studio/general", seq: 3 }] }, { Authorization: "Bearer crk_abc" })+ )+ expect(res.status).toBe(404)+ expect(mockBumpReadCursor).not.toHaveBeenCalled()+ })++ it("404 when bumpReadCursor can't find that seq in the channel", async () => {+ mockBumpReadCursor.mockResolvedValue(null)+ const res = await POST(+ req({ cursors: [{ channel: "/studio/general", seq: 99 }] }, { Authorization: "Bearer crk_abc" })+ )+ expect(res.status).toBe(404)+ expect((await res.json()).error).toMatch(/no message with seq #99/)+ })++ it("fails fast on the first bad cursor, never processing the rest", async () => {+ mockResolveChannelByNameForMember+ .mockResolvedValueOnce([{ id: "ch_1" }])+ .mockResolvedValueOnce([]) // second cursor's channel doesn't resolve+ mockBumpReadCursor.mockResolvedValue({ id: "m_1", createdAt: "t", seq: 3 })+ const res = await POST(+ req(+ {+ cursors: [+ { channel: "/studio/general", seq: 3 },+ { channel: "/studio/missing", seq: 1 },+ ],+ },+ { Authorization: "Bearer crk_abc" }+ )+ )+ expect(res.status).toBe(404)+ expect(mockBumpReadCursor).toHaveBeenCalledTimes(1)+ })++ it("200 { ok: true } advances the cursor for every scope in the request, channel and DM alike", async () => {+ mockGetUserInternal.mockImplementation((_db: unknown, id: string) =>+ Promise.resolve(id === "peer_1" ? { id: "peer_1", isBot: false, deletedAt: null } : { isBot: true, deletedAt: null })+ )+ mockGetDMBetween.mockResolvedValue({ id: "dm_1" })+ mockGetDM.mockResolvedValue({ id: "dm_1", user1Id: "bot_1", user2Id: "peer_1", lastMessageAt: null, createdAt: "t" })+ mockIsBlocked.mockResolvedValue(false)+ mockBumpReadCursor.mockResolvedValue({ id: "m_1", createdAt: "t", seq: 1 })+ const res = await POST(+ req(+ {+ cursors: [+ { channel: "/studio/general", seq: 3 },+ { channel: "/.dm/peer_1", seq: 1 },+ ],+ },+ { Authorization: "Bearer crk_abc" }+ )+ )+ expect(res.status).toBe(200)+ expect(await res.json()).toEqual({ ok: true })+ expect(mockBumpReadCursor).toHaveBeenCalledTimes(2)+ expect(mockBumpReadCursor).toHaveBeenNthCalledWith(1, expect.anything(), "bot_1", { channelId: "ch_1" }, 3)+ expect(mockBumpReadCursor).toHaveBeenNthCalledWith(2, expect.anything(), "bot_1", { dmConversationId: "dm_1" }, 1)+ })+})diff --git a/src/web/src/app/api/community/agent/ack/route.ts b/src/web/src/app/api/community/agent/ack/route.tsnew file mode 100644index 000000000..2e56b592b--- /dev/null+++ b/src/web/src/app/api/community/agent/ack/route.ts@@ -0,0 +1,60 @@+import { NextResponse, type NextRequest } from "next/server"+import { queries, CommunityAgentAckRequestSchema } from "@alook/shared"+import { getDb } from "@/lib/db"+import { withAgentRunnerAuth } from "@/lib/middleware/community-agent-runner-auth"+import { resolveTargetForMember, resolveErrorResponse } from "@/lib/community/resolve-ref"+import { requireChannelMember, requireDMParticipant } from "@/lib/community/permissions"++/**+ * POST /api/community/agent/ack — plan §7. The ONLY endpoint that advances+ * `lastReadSeq` (`inboxPull` never mutates read state — debt #2 correction).+ * Each cursor's `channel` ref is resolved read-only (no DM/thread+ * auto-create — a stale ref must never materialize a row as a side effect+ * of an ack) and membership-gated before `bumpReadCursor`. Fails fast on+ * the first bad cursor; earlier cursors in the same request have already+ * been durably applied (`bumpReadCursor` is independently atomic per call).+ */+export const POST = withAgentRunnerAuth(async (req: NextRequest, ctx) => {+ const db = getDb(ctx.env.DB)++ let raw: unknown+ try {+ raw = await req.json()+ } catch {+ return NextResponse.json({ error: "invalid JSON body" }, { status: 400 })+ }+ const parsed = CommunityAgentAckRequestSchema.safeParse(raw)+ if (!parsed.success) {+ return NextResponse.json({ error: "invalid payload", details: parsed.error.flatten() }, { status: 400 })+ }++ for (const cursor of parsed.data.cursors) {+ const resolved = await resolveTargetForMember(db, ctx.botUserId, cursor.channel, {+ createDmIfMissing: false,+ createThreadIfMissing: false,+ callerKind: "bot",+ })+ if ("error" in resolved) return resolveErrorResponse(resolved)++ const scopeTarget =+ resolved.kind === "dm" ? { dmConversationId: resolved.dmConversationId } : { channelId: resolved.channelId }++ if (resolved.kind === "dm") {+ const gate = await requireDMParticipant(db, resolved.dmConversationId, ctx.botUserId)+ if (!gate.ok) return NextResponse.json({ error: gate.error }, { status: gate.status })+ } else {+ const gate = await requireChannelMember(db, resolved.channelId, ctx.botUserId)+ if (!gate.ok) return NextResponse.json({ error: gate.error }, { status: gate.status })+ }++ const bumped = await queries.communityReadState.bumpReadCursor(db, ctx.botUserId, scopeTarget, cursor.seq)+ if (!bumped) {+ return NextResponse.json(+ { error: `no message with seq #${cursor.seq} in ${cursor.channel}` },+ { status: 404 }+ )+ }+ }++ return NextResponse.json({ ok: true })+})diff --git a/src/web/src/app/api/community/agent/inboxPull/route.test.ts b/src/web/src/app/api/community/agent/inboxPull/route.test.tsnew file mode 100644index 000000000..470a733e9--- /dev/null+++ b/src/web/src/app/api/community/agent/inboxPull/route.test.ts@@ -0,0 +1,98 @@+import { describe, it, expect, vi, beforeEach } from "vitest"+import { NextRequest } from "next/server"++vi.mock("@opennextjs/cloudflare", () => ({+ getCloudflareContext: vi.fn(async () => ({ env: { DB: {} } })),+}))+vi.mock("@/lib/db", () => ({ getDb: vi.fn(() => ({})) }))++const mockFindActiveAgentRunnerKeyByBearer = vi.fn()+const mockGetUserInternal = vi.fn()+const mockGetBotBinding = vi.fn()+const mockListUnreadMessagesForAgent = vi.fn()+const mockToAgentMessages = vi.fn()++vi.mock("@alook/shared", async () => {+ const actual = await vi.importActual<typeof import("@alook/shared")>("@alook/shared")+ return {+ ...actual,+ queries: {+ ...actual.queries,+ communityMachine: { findActiveAgentRunnerKeyByBearer: (...a: unknown[]) => mockFindActiveAgentRunnerKeyByBearer(...a) },+ user: { getUserInternal: (...a: unknown[]) => mockGetUserInternal(...a) },+ communityBot: { getBotBinding: (...a: unknown[]) => mockGetBotBinding(...a) },+ communityAgentInbox: {+ listUnreadMessagesForAgent: (...a: unknown[]) => mockListUnreadMessagesForAgent(...a),+ toAgentMessages: (...a: unknown[]) => mockToAgentMessages(...a),+ },+ },+ }+})++import { POST } from "./route"++function req(body?: string, headers: Record<string, string> = {}): NextRequest {+ return new NextRequest("http://localhost/api/community/agent/inboxPull", {+ method: "POST",+ headers: { "content-type": "application/json", ...headers },+ ...(body !== undefined ? { body } : {}),+ })+}++describe("POST /api/community/agent/inboxPull", () => {+ beforeEach(() => {+ vi.clearAllMocks()+ mockFindActiveAgentRunnerKeyByBearer.mockResolvedValue({ userId: "owner_1", machineId: "m_1", agentId: "bot_1" })+ mockGetUserInternal.mockResolvedValue({ isBot: true, deletedAt: null })+ mockGetBotBinding.mockResolvedValue({ machineId: "m_1", runtime: "claude" })+ mockToAgentMessages.mockImplementation((_db: unknown, rows: unknown[]) => Promise.resolve(rows))+ })++ it("401 without Authorization", async () => {+ const res = await POST(req(undefined))+ expect(res.status).toBe(401)+ })++ it("400 on invalid JSON body", async () => {+ const res = await POST(req("not-json", { Authorization: "Bearer crk_abc" }))+ expect(res.status).toBe(400)+ })++ it("400 when max is out of the schema's allowed range", async () => {+ const res = await POST(req(JSON.stringify({ max: 0 }), { Authorization: "Bearer crk_abc" }))+ expect(res.status).toBe(400)+ })++ it("a missing/empty body defaults to {} and uses the default max", async () => {+ mockListUnreadMessagesForAgent.mockResolvedValue([])+ const res = await POST(req(undefined, { Authorization: "Bearer crk_abc" }))+ expect(res.status).toBe(200)+ expect(mockListUnreadMessagesForAgent).toHaveBeenCalledWith(expect.anything(), "bot_1", { max: 201 })+ })++ it("hasMore is false and no probe row leaks through when unread count <= max", async () => {+ mockListUnreadMessagesForAgent.mockResolvedValue([{ id: "m_1" }, { id: "m_2" }])+ const res = await POST(req(JSON.stringify({ max: 5 }), { Authorization: "Bearer crk_abc" }))+ expect(res.status).toBe(200)+ const body = await res.json()+ expect(body.hasMore).toBe(false)+ expect(body.messages).toHaveLength(2)+ expect(mockListUnreadMessagesForAgent).toHaveBeenCalledWith(expect.anything(), "bot_1", { max: 6 })+ })++ it("hasMore is true and the probe row is trimmed off when unread count > max", async () => {+ mockListUnreadMessagesForAgent.mockResolvedValue([{ id: "m_1" }, { id: "m_2" }, { id: "m_3" }])+ const res = await POST(req(JSON.stringify({ max: 2 }), { Authorization: "Bearer crk_abc" }))+ const body = await res.json()+ expect(body.hasMore).toBe(true)+ expect(body.messages).toHaveLength(2)+ })++ it("caps an oversized max at MAX_PULL (200) before querying", async () => {+ mockListUnreadMessagesForAgent.mockResolvedValue([])+ // Schema itself caps at 200, so this exercises the route's own `Math.min` no-op path at the ceiling.+ const res = await POST(req(JSON.stringify({ max: 200 }), { Authorization: "Bearer crk_abc" }))+ expect(res.status).toBe(200)+ expect(mockListUnreadMessagesForAgent).toHaveBeenCalledWith(expect.anything(), "bot_1", { max: 201 })+ })+})diff --git a/src/web/src/app/api/community/agent/inboxPull/route.ts b/src/web/src/app/api/community/agent/inboxPull/route.tsnew file mode 100644index 000000000..c890341c2--- /dev/null+++ b/src/web/src/app/api/community/agent/inboxPull/route.ts@@ -0,0 +1,44 @@+import { NextResponse, type NextRequest } from "next/server"+import { queries, CommunityAgentInboxPullRequestSchema } from "@alook/shared"+import { getDb } from "@/lib/db"+import { withAgentRunnerAuth } from "@/lib/middleware/community-agent-runner-auth"++const MAX_PULL = 200++/**+ * POST /api/community/agent/inboxPull — plan §7.+ *+ * Grouped-by-channel fill (v4 decision): `ORDER BY channel_id, seq ASC`, one+ * channel's unread always drained fully before the next starts — `seq` is a+ * per-scope counter, so raw cross-channel seq comparison is meaningless (see+ * `listUnreadMessagesForAgent`'s doc comment). Excludes the bot's own+ * authored messages. Never mutates read state — `ack` is the only mutator+ * (debt #2 correction).+ */+export const POST = withAgentRunnerAuth(async (req: NextRequest, ctx) => {+ const db = getDb(ctx.env.DB)++ // Body is optional (`InboxPullRequest = { max? }`) — an empty/missing body+ // is equivalent to `{}`, not a 400. Only a body that parses to JSON but+ // fails schema validation (e.g. `max` out of range) is rejected.+ let raw: unknown = {}+ try {+ const text = await req.text()+ if (text) raw = JSON.parse(text)+ } catch {+ return NextResponse.json({ error: "invalid JSON body" }, { status: 400 })+ }+ const parsed = CommunityAgentInboxPullRequestSchema.safeParse(raw)+ if (!parsed.success) {+ return NextResponse.json({ error: "invalid payload", details: parsed.error.flatten() }, { status: 400 })+ }+ const max = Math.min(parsed.data.max ?? MAX_PULL, MAX_PULL)++ // Fetch one extra row to detect whether more unread remain beyond `max`.+ const rows = await queries.communityAgentInbox.listUnreadMessagesForAgent(db, ctx.botUserId, { max: max + 1 })+ const hasMore = rows.length > max+ const page = hasMore ? rows.slice(0, max) : rows++ const messages = await queries.communityAgentInbox.toAgentMessages(db, page, ctx.botUserId)+ return NextResponse.json({ messages, hasMore })+})diff --git a/src/web/src/app/api/community/agent/inboxSnapshot/route.test.ts b/src/web/src/app/api/community/agent/inboxSnapshot/route.test.tsnew file mode 100644index 000000000..07c84994e--- /dev/null+++ b/src/web/src/app/api/community/agent/inboxSnapshot/route.test.ts@@ -0,0 +1,78 @@+import { describe, it, expect, vi, beforeEach } from "vitest"+import { NextRequest } from "next/server"++vi.mock("@opennextjs/cloudflare", () => ({+ getCloudflareContext: vi.fn(async () => ({ env: { DB: {} } })),+}))+vi.mock("@/lib/db", () => ({ getDb: vi.fn(() => ({})) }))++const mockFindActiveAgentRunnerKeyByBearer = vi.fn()+const mockGetUserInternal = vi.fn()+const mockGetBotBinding = vi.fn()+const mockGetInboxSnapshotForAgent = vi.fn()+const mockToInboxRows = vi.fn()++vi.mock("@alook/shared", async () => {+ const actual = await vi.importActual<typeof import("@alook/shared")>("@alook/shared")+ return {+ ...actual,+ queries: {+ ...actual.queries,+ communityMachine: { findActiveAgentRunnerKeyByBearer: (...a: unknown[]) => mockFindActiveAgentRunnerKeyByBearer(...a) },+ user: { getUserInternal: (...a: unknown[]) => mockGetUserInternal(...a) },+ communityBot: { getBotBinding: (...a: unknown[]) => mockGetBotBinding(...a) },+ communityAgentInbox: {+ getInboxSnapshotForAgent: (...a: unknown[]) => mockGetInboxSnapshotForAgent(...a),+ toInboxRows: (...a: unknown[]) => mockToInboxRows(...a),+ },+ },+ }+})++import { POST } from "./route"++function req(headers: Record<string, string> = {}): NextRequest {+ return new NextRequest("http://localhost/api/community/agent/inboxSnapshot", {+ method: "POST",+ headers: { "content-type": "application/json", ...headers },+ body: "{}",+ })+}++describe("POST /api/community/agent/inboxSnapshot", () => {+ beforeEach(() => {+ vi.clearAllMocks()+ mockFindActiveAgentRunnerKeyByBearer.mockResolvedValue({ userId: "owner_1", machineId: "m_1", agentId: "bot_1" })+ mockGetUserInternal.mockResolvedValue({ isBot: true, deletedAt: null })+ mockGetBotBinding.mockResolvedValue({ machineId: "m_1", runtime: "claude" })+ })++ it("401 without Authorization", async () => {+ const res = await POST(new NextRequest("http://localhost/api/community/agent/inboxSnapshot", { method: "POST" }))+ expect(res.status).toBe(401)+ expect(mockGetInboxSnapshotForAgent).not.toHaveBeenCalled()+ })++ it("200 with rows plus derived pendingChannels/pendingMessages totals", async () => {+ mockGetInboxSnapshotForAgent.mockResolvedValue([{ channelId: "ch_1" }, { channelId: "ch_2" }])+ mockToInboxRows.mockResolvedValue([+ { channel: "/studio/general", pendingCount: 3, firstPendingSeq: 1, latestSeq: 3, latestSender: "@Alice", flags: [] },+ { channel: "/.dm/Bob", pendingCount: 2, firstPendingSeq: 5, latestSeq: 6, latestSender: "@Bob", flags: ["dm"] },+ ])+ const res = await POST(req({ Authorization: "Bearer crk_abc" }))+ expect(res.status).toBe(200)+ const body = await res.json()+ expect(body.pendingChannels).toBe(2)+ expect(body.pendingMessages).toBe(5)+ expect(body.rows).toHaveLength(2)+ expect(mockGetInboxSnapshotForAgent).toHaveBeenCalledWith(expect.anything(), "bot_1")+ })++ it("200 with empty rows → zeroed totals, no pending unread", async () => {+ mockGetInboxSnapshotForAgent.mockResolvedValue([])+ mockToInboxRows.mockResolvedValue([])+ const res = await POST(req({ Authorization: "Bearer crk_abc" }))+ expect(res.status).toBe(200)+ expect(await res.json()).toEqual({ rows: [], pendingChannels: 0, pendingMessages: 0 })+ })+})diff --git a/src/web/src/app/api/community/agent/inboxSnapshot/route.ts b/src/web/src/app/api/community/agent/inboxSnapshot/route.tsnew file mode 100644index 000000000..338fd4df5--- /dev/null+++ b/src/web/src/app/api/community/agent/inboxSnapshot/route.ts@@ -0,0 +1,21 @@+import { NextResponse, type NextRequest } from "next/server"+import { queries } from "@alook/shared"+import { getDb } from "@/lib/db"+import { withAgentRunnerAuth } from "@/lib/middleware/community-agent-runner-auth"++/**+ * POST /api/community/agent/inboxSnapshot — plan §7. Body `{}`.+ * Non-consuming bodiless summary of pending unread, bucketed per channel/DM.+ */+export const POST = withAgentRunnerAuth(async (_req: NextRequest, ctx) => {+ const db = getDb(ctx.env.DB)++ const snapshot = await queries.communityAgentInbox.getInboxSnapshotForAgent(db, ctx.botUserId)+ const rows = await queries.communityAgentInbox.toInboxRows(db, snapshot, ctx.botUserId)++ return NextResponse.json({+ rows,+ pendingChannels: rows.length,+ pendingMessages: rows.reduce((n, r) => n + r.pendingCount, 0),+ })+})diff --git a/src/web/src/app/api/community/agent/listChannels/route.test.ts b/src/web/src/app/api/community/agent/listChannels/route.test.tsnew file mode 100644index 000000000..abff660da--- /dev/null+++ b/src/web/src/app/api/community/agent/listChannels/route.test.ts@@ -0,0 +1,91 @@+import { describe, it, expect, vi, beforeEach } from "vitest"+import { NextRequest } from "next/server"++vi.mock("@opennextjs/cloudflare", () => ({+ getCloudflareContext: vi.fn(async () => ({ env: { DB: {} } })),+}))+vi.mock("@/lib/db", () => ({ getDb: vi.fn(() => ({})) }))++const mockFindActiveAgentRunnerKeyByBearer = vi.fn()+const mockGetUserInternal = vi.fn()+const mockGetBotBinding = vi.fn()+const mockListUserServers = vi.fn()+const mockListChannelsForMember = vi.fn()++vi.mock("@alook/shared", async () => {+ const actual = await vi.importActual<typeof import("@alook/shared")>("@alook/shared")+ return {+ ...actual,+ queries: {+ ...actual.queries,+ communityMachine: { findActiveAgentRunnerKeyByBearer: (...a: unknown[]) => mockFindActiveAgentRunnerKeyByBearer(...a) },+ user: { getUserInternal: (...a: unknown[]) => mockGetUserInternal(...a) },+ communityBot: { getBotBinding: (...a: unknown[]) => mockGetBotBinding(...a) },+ communityServer: { listUserServers: (...a: unknown[]) => mockListUserServers(...a) },+ communityChannel: { listChannelsForMember: (...a: unknown[]) => mockListChannelsForMember(...a) },+ },+ }+})++import { POST } from "./route"++function req(body: unknown, headers: Record<string, string> = {}): NextRequest {+ return new NextRequest("http://localhost/api/community/agent/listChannels", {+ method: "POST",+ headers: { "content-type": "application/json", ...headers },+ body: JSON.stringify(body),+ })+}++describe("POST /api/community/agent/listChannels", () => {+ beforeEach(() => {+ vi.clearAllMocks()+ mockFindActiveAgentRunnerKeyByBearer.mockResolvedValue({ userId: "owner_1", machineId: "m_1", agentId: "bot_1" })+ mockGetUserInternal.mockResolvedValue({ isBot: true, deletedAt: null })+ mockGetBotBinding.mockResolvedValue({ machineId: "m_1", runtime: "claude" })+ })++ it("401 without Authorization", async () => {+ const res = await POST(+ new NextRequest("http://localhost/api/community/agent/listChannels", { method: "POST", body: "{}" })+ )+ expect(res.status).toBe(401)+ })++ it("400 on a payload that fails schema validation", async () => {+ const res = await POST(req({ server: "" }, { Authorization: "Bearer crk_abc" }))+ expect(res.status).toBe(400)+ })++ it("empty body defaults to {} — lists channels across every server the bot is in", async () => {+ mockListUserServers.mockResolvedValue([{ id: "srv_1" }, { id: "srv_2" }])+ mockListChannelsForMember.mockImplementation((_db: unknown, serverId: string) =>+ Promise.resolve(serverId === "srv_1" ? [{ id: "ch_1", serverId: "srv_1", name: "general" }] : [{ id: "ch_2", serverId: "srv_2", name: "random" }])+ )+ const res = await POST(+ new NextRequest("http://localhost/api/community/agent/listChannels", {+ method: "POST",+ headers: { Authorization: "Bearer crk_abc" },+ })+ )+ expect(res.status).toBe(200)+ expect(await res.json()).toEqual({+ channels: [+ { id: "ch_1", serverId: "srv_1", name: "general", kind: "channel" },+ { id: "ch_2", serverId: "srv_2", name: "random", kind: "channel" },+ ],+ })+ expect(mockListUserServers).toHaveBeenCalledTimes(1)+ })++ it("with server provided: scopes to that one server, skips listUserServers", async () => {+ mockListChannelsForMember.mockResolvedValue([{ id: "ch_1", serverId: "srv_1", name: "general" }])+ const res = await POST(req({ server: "srv_1" }, { Authorization: "Bearer crk_abc" }))+ expect(res.status).toBe(200)+ expect(mockListUserServers).not.toHaveBeenCalled()+ expect(mockListChannelsForMember).toHaveBeenCalledWith(expect.anything(), "srv_1", "bot_1")+ expect(await res.json()).toEqual({+ channels: [{ id: "ch_1", serverId: "srv_1", name: "general", kind: "channel" }],+ })+ })+})diff --git a/src/web/src/app/api/community/agent/listChannels/route.ts b/src/web/src/app/api/community/agent/listChannels/route.tsnew file mode 100644index 000000000..6a79c55bf--- /dev/null+++ b/src/web/src/app/api/community/agent/listChannels/route.ts@@ -0,0 +1,45 @@+import { NextResponse, type NextRequest } from "next/server"+import { queries, CommunityAgentListChannelsRequestSchema } from "@alook/shared"+import { getDb } from "@/lib/db"+import { withAgentRunnerAuth } from "@/lib/middleware/community-agent-runner-auth"++/**+ * POST /api/community/agent/listChannels — plan §7. Body `{ server? }`+ * (`server` is a bare `ServerId`, not a name — omit to list across every+ * server the bot is in). Top-level channels only (`listChannelsForMember`+ * filters `parentChannelId IS NULL`, mirroring `listServerChannels`) — same+ * visibility rule a human server-channels route uses, no extra+ * private-category filter on read (decided plan §7 v3).+ */+export const POST = withAgentRunnerAuth(async (req: NextRequest, ctx) => {+ const db = getDb(ctx.env.DB)++ let raw: unknown = {}+ try {+ const text = await req.text()+ if (text) raw = JSON.parse(text)+ } catch {+ return NextResponse.json({ error: "invalid JSON body" }, { status: 400 })+ }+ const parsed = CommunityAgentListChannelsRequestSchema.safeParse(raw)+ if (!parsed.success) {+ return NextResponse.json({ error: "invalid payload", details: parsed.error.flatten() }, { status: 400 })+ }++ const serverIds = parsed.data.server+ ? [parsed.data.server]+ : (await queries.communityServer.listUserServers(db, ctx.botUserId)).map((s) => s.id)++ const channelsByServer = await Promise.all(+ serverIds.map((serverId) => queries.communityChannel.listChannelsForMember(db, serverId, ctx.botUserId))+ )++ const channels = channelsByServer.flat().map((c) => ({+ id: c.id,+ serverId: c.serverId,+ name: c.name,+ kind: "channel" as const,+ }))++ return NextResponse.json({ channels })+})diff --git a/src/web/src/app/api/community/agent/listServers/route.test.ts b/src/web/src/app/api/community/agent/listServers/route.test.tsnew file mode 100644index 000000000..ff71dcc14--- /dev/null+++ b/src/web/src/app/api/community/agent/listServers/route.test.ts@@ -0,0 +1,74 @@+import { describe, it, expect, vi, beforeEach } from "vitest"+import { NextRequest } from "next/server"++vi.mock("@opennextjs/cloudflare", () => ({+ getCloudflareContext: vi.fn(async () => ({ env: { DB: {} } })),+}))+vi.mock("@/lib/db", () => ({ getDb: vi.fn(() => ({})) }))++const mockFindActiveAgentRunnerKeyByBearer = vi.fn()+const mockGetUserInternal = vi.fn()+const mockGetBotBinding = vi.fn()+const mockListUserServers = vi.fn()++vi.mock("@alook/shared", async () => {+ const actual = await vi.importActual<typeof import("@alook/shared")>("@alook/shared")+ return {+ ...actual,+ queries: {+ ...actual.queries,+ communityMachine: { findActiveAgentRunnerKeyByBearer: (...a: unknown[]) => mockFindActiveAgentRunnerKeyByBearer(...a) },+ user: { getUserInternal: (...a: unknown[]) => mockGetUserInternal(...a) },+ communityBot: { getBotBinding: (...a: unknown[]) => mockGetBotBinding(...a) },+ communityServer: { listUserServers: (...a: unknown[]) => mockListUserServers(...a) },+ },+ }+})++import { POST } from "./route"++function req(headers: Record<string, string> = {}): NextRequest {+ return new NextRequest("http://localhost/api/community/agent/listServers", {+ method: "POST",+ headers: { "content-type": "application/json", ...headers },+ body: "{}",+ })+}++describe("POST /api/community/agent/listServers", () => {+ beforeEach(() => {+ vi.clearAllMocks()+ mockFindActiveAgentRunnerKeyByBearer.mockResolvedValue({ userId: "owner_1", machineId: "m_1", agentId: "bot_1" })+ mockGetUserInternal.mockResolvedValue({ isBot: true, deletedAt: null })+ mockGetBotBinding.mockResolvedValue({ machineId: "m_1", runtime: "claude" })+ })++ it("401 without Authorization", async () => {+ const res = await POST(new NextRequest("http://localhost/api/community/agent/listServers", { method: "POST" }))+ expect(res.status).toBe(401)+ expect(mockListUserServers).not.toHaveBeenCalled()+ })++ it("200 maps rows to { id, name } only, dropping other fields", async () => {+ mockListUserServers.mockResolvedValue([+ { id: "srv_1", name: "Studio", ownerId: "u_owner", secretStuff: "nope" },+ { id: "srv_2", name: "Lab" },+ ])+ const res = await POST(req({ Authorization: "Bearer crk_abc" }))+ expect(res.status).toBe(200)+ expect(await res.json()).toEqual({+ servers: [+ { id: "srv_1", name: "Studio" },+ { id: "srv_2", name: "Lab" },+ ],+ })+ expect(mockListUserServers).toHaveBeenCalledWith(expect.anything(), "bot_1")+ })++ it("200 with an empty list when the bot is in no servers", async () => {+ mockListUserServers.mockResolvedValue([])+ const res = await POST(req({ Authorization: "Bearer crk_abc" }))+ expect(res.status).toBe(200)+ expect(await res.json()).toEqual({ servers: [] })+ })+})diff --git a/src/web/src/app/api/community/agent/listServers/route.ts b/src/web/src/app/api/community/agent/listServers/route.tsnew file mode 100644index 000000000..61431cb47--- /dev/null+++ b/src/web/src/app/api/community/agent/listServers/route.ts@@ -0,0 +1,15 @@+import { NextResponse, type NextRequest } from "next/server"+import { queries } from "@alook/shared"+import { getDb } from "@/lib/db"+import { withAgentRunnerAuth } from "@/lib/middleware/community-agent-runner-auth"++/**+ * POST /api/community/agent/listServers — plan §7. Body `{}`. Which+ * servers/workspaces the bot participates in. Never includes `ownerUserId`.+ */+export const POST = withAgentRunnerAuth(async (_req: NextRequest, ctx) => {+ const db = getDb(ctx.env.DB)+ const rows = await queries.communityServer.listUserServers(db, ctx.botUserId)+ const servers = rows.map((s) => ({ id: s.id, name: s.name }))+ return NextResponse.json({ servers })+})diff --git a/src/web/src/app/api/community/agent/read/route.test.ts b/src/web/src/app/api/community/agent/read/route.test.tsnew file mode 100644index 000000000..6c9e6a5c9--- /dev/null+++ b/src/web/src/app/api/community/agent/read/route.test.ts@@ -0,0 +1,107 @@+import { describe, it, expect, vi, beforeEach } from "vitest"+import { NextRequest } from "next/server"++vi.mock("@opennextjs/cloudflare", () => ({+ getCloudflareContext: vi.fn(async () => ({ env: { DB: {} } })),+}))+vi.mock("@/lib/db", () => ({ getDb: vi.fn(() => ({})) }))++const mockFindActiveAgentRunnerKeyByBearer = vi.fn()+const mockGetUserInternal = vi.fn()+const mockGetBotBinding = vi.fn()+const mockResolveServerByNameForMember = vi.fn()+const mockResolveChannelByNameForMember = vi.fn()+const mockGetChannelForMember = vi.fn()+const mockListMessagesBySeq = vi.fn()+const mockToAgentMessages = vi.fn()++vi.mock("@alook/shared", async () => {+ const actual = await vi.importActual<typeof import("@alook/shared")>("@alook/shared")+ return {+ ...actual,+ queries: {+ ...actual.queries,+ communityMachine: { findActiveAgentRunnerKeyByBearer: (...a: unknown[]) => mockFindActiveAgentRunnerKeyByBearer(...a) },+ user: { getUserInternal: (...a: unknown[]) => mockGetUserInternal(...a) },+ communityBot: { getBotBinding: (...a: unknown[]) => mockGetBotBinding(...a) },+ communityServer: { resolveServerByNameForMember: (...a: unknown[]) => mockResolveServerByNameForMember(...a) },+ communityChannel: {+ resolveChannelByNameForMember: (...a: unknown[]) => mockResolveChannelByNameForMember(...a),+ getChannelForMember: (...a: unknown[]) => mockGetChannelForMember(...a),+ },+ communityAgentInbox: {+ listMessagesBySeq: (...a: unknown[]) => mockListMessagesBySeq(...a),+ toAgentMessages: (...a: unknown[]) => mockToAgentMessages(...a),+ },+ },+ }+})++import { POST } from "./route"++function req(body: unknown, headers: Record<string, string> = {}): NextRequest {+ return new NextRequest("http://localhost/api/community/agent/read", {+ method: "POST",+ headers: { "content-type": "application/json", ...headers },+ body: typeof body === "string" ? body : JSON.stringify(body),+ })+}++describe("POST /api/community/agent/read", () => {+ beforeEach(() => {+ vi.clearAllMocks()+ mockFindActiveAgentRunnerKeyByBearer.mockResolvedValue({ userId: "owner_1", machineId: "m_1", agentId: "bot_1" })+ mockGetUserInternal.mockResolvedValue({ isBot: true, deletedAt: null })+ mockGetBotBinding.mockResolvedValue({ machineId: "m_1", runtime: "claude" })+ mockResolveServerByNameForMember.mockResolvedValue([{ id: "srv_1" }])+ mockResolveChannelByNameForMember.mockResolvedValue([{ id: "ch_1" }])+ mockGetChannelForMember.mockResolvedValue({ id: "ch_1", serverId: "srv_1", parentChannelId: null })+ mockToAgentMessages.mockImplementation((_db: unknown, rows: unknown[]) => Promise.resolve(rows))+ })++ it("401 without Authorization", async () => {+ const res = await POST(req({ channel: "/studio/general" }))+ expect(res.status).toBe(401)+ })++ it("400 when more than one of before/after/around is supplied", async () => {+ const res = await POST(+ req({ channel: "/studio/general", before: 5, after: 1 }, { Authorization: "Bearer crk_abc" })+ )+ expect(res.status).toBe(400)+ })++ it("403 forbidden when the bot isn't a member of the resolved channel", async () => {+ mockGetChannelForMember.mockResolvedValue(null)+ const res = await POST(req({ channel: "/studio/general" }, { Authorization: "Bearer crk_abc" }))+ expect(res.status).toBe(403)+ })++ it("200 happy path: returns { items, hasMore, latestSeq } from listMessagesBySeq", async () => {+ mockListMessagesBySeq.mockResolvedValue({+ items: [{ id: "m_1", seq: 1 }, { id: "m_2", seq: 2 }],+ hasMore: true,+ latestSeq: 2,+ })+ const res = await POST(req({ channel: "/studio/general", after: 0, limit: 2 }, { Authorization: "Bearer crk_abc" }))+ expect(res.status).toBe(200)+ expect(await res.json()).toEqual({+ items: [{ id: "m_1", seq: 1 }, { id: "m_2", seq: 2 }],+ hasMore: true,+ latestSeq: 2,+ })+ expect(mockListMessagesBySeq).toHaveBeenCalledWith(+ expect.anything(),+ { channelId: "ch_1" },+ { before: undefined, after: 0, around: undefined, limit: 2 }+ )+ })++ it("omits latestSeq from the response when the page is empty (undefined, not null/0)", async () => {+ mockListMessagesBySeq.mockResolvedValue({ items: [], hasMore: false, latestSeq: undefined })+ const res = await POST(req({ channel: "/studio/general" }, { Authorization: "Bearer crk_abc" }))+ const body = await res.json()+ expect(body).toEqual({ items: [], hasMore: false })+ expect("latestSeq" in body).toBe(false)+ })+})diff --git a/src/web/src/app/api/community/agent/read/route.ts b/src/web/src/app/api/community/agent/read/route.tsnew file mode 100644index 000000000..10636a988--- /dev/null+++ b/src/web/src/app/api/community/agent/read/route.ts@@ -0,0 +1,56 @@+import { NextResponse, type NextRequest } from "next/server"+import { queries, CommunityAgentReadRequestSchema } from "@alook/shared"+import { getDb } from "@/lib/db"+import { withAgentRunnerAuth } from "@/lib/middleware/community-agent-runner-auth"+import { resolveTargetForMember, resolveErrorResponse } from "@/lib/community/resolve-ref"+import { requireChannelMember, requireDMParticipant } from "@/lib/community/permissions"++/**+ * POST /api/community/agent/read — plan §7. Seq-anchored pagination (NOT+ * `createdAt`-based) — pick at most one of `before`/`after`/`around`+ * (enforced at the Zod layer). Response is `{ items, hasMore, latestSeq? }`+ * — `items`, not `messages` (that name is reserved for `inboxPull`'s shape).+ */+export const POST = withAgentRunnerAuth(async (req: NextRequest, ctx) => {+ const db = getDb(ctx.env.DB)++ let raw: unknown+ try {+ raw = await req.json()+ } catch {+ return NextResponse.json({ error: "invalid JSON body" }, { status: 400 })+ }+ const parsed = CommunityAgentReadRequestSchema.safeParse(raw)+ if (!parsed.success) {+ return NextResponse.json({ error: "invalid payload", details: parsed.error.flatten() }, { status: 400 })+ }+ const body = parsed.data++ const resolved = await resolveTargetForMember(db, ctx.botUserId, body.channel, {+ createDmIfMissing: false,+ createThreadIfMissing: false,+ callerKind: "bot",+ })+ if ("error" in resolved) return resolveErrorResponse(resolved)++ const scopeTarget =+ resolved.kind === "dm" ? { dmConversationId: resolved.dmConversationId } : { channelId: resolved.channelId }++ if (resolved.kind === "dm") {+ const gate = await requireDMParticipant(db, resolved.dmConversationId, ctx.botUserId)+ if (!gate.ok) return NextResponse.json({ error: gate.error }, { status: gate.status })+ } else {+ const gate = await requireChannelMember(db, resolved.channelId, ctx.botUserId)+ if (!gate.ok) return NextResponse.json({ error: gate.error }, { status: gate.status })+ }++ const { items, hasMore, latestSeq } = await queries.communityAgentInbox.listMessagesBySeq(db, scopeTarget, {+ before: body.before,+ after: body.after,+ around: body.around,+ limit: body.limit,+ })+ const messages = await queries.communityAgentInbox.toAgentMessages(db, items, ctx.botUserId)++ return NextResponse.json({ items: messages, hasMore, ...(latestSeq !== undefined ? { latestSeq } : {}) })+})diff --git a/src/web/src/app/api/community/agent/resolve/route.test.ts b/src/web/src/app/api/community/agent/resolve/route.test.tsnew file mode 100644index 000000000..bc02bc627--- /dev/null+++ b/src/web/src/app/api/community/agent/resolve/route.test.ts@@ -0,0 +1,134 @@+import { describe, it, expect, vi, beforeEach } from "vitest"+import { NextRequest } from "next/server"++vi.mock("@opennextjs/cloudflare", () => ({+ getCloudflareContext: vi.fn(async () => ({ env: { DB: {} } })),+}))+vi.mock("@/lib/db", () => ({ getDb: vi.fn(() => ({})) }))++const mockFindActiveAgentRunnerKeyByBearer = vi.fn()+const mockGetUserInternal = vi.fn()+const mockGetBotBinding = vi.fn()+const mockResolveServerByNameForMember = vi.fn()+const mockResolveChannelByNameForMember = vi.fn()+const mockGetChannelForMember = vi.fn()+const mockGetDM = vi.fn()+const mockGetDMBetween = vi.fn()+const mockIsBlocked = vi.fn()+const mockGetMessageByChannelAndSeq = vi.fn()+const mockToAgentMessage = vi.fn()++vi.mock("@alook/shared", async () => {+ const actual = await vi.importActual<typeof import("@alook/shared")>("@alook/shared")+ return {+ ...actual,+ queries: {+ ...actual.queries,+ communityMachine: { findActiveAgentRunnerKeyByBearer: (...a: unknown[]) => mockFindActiveAgentRunnerKeyByBearer(...a) },+ user: { getUserInternal: (...a: unknown[]) => mockGetUserInternal(...a) },+ communityBot: { getBotBinding: (...a: unknown[]) => mockGetBotBinding(...a) },+ communityFriendship: { isBlocked: (...a: unknown[]) => mockIsBlocked(...a) },+ communityServer: { resolveServerByNameForMember: (...a: unknown[]) => mockResolveServerByNameForMember(...a) },+ communityChannel: {+ resolveChannelByNameForMember: (...a: unknown[]) => mockResolveChannelByNameForMember(...a),+ getChannelForMember: (...a: unknown[]) => mockGetChannelForMember(...a),+ },+ communityDm: {+ getDM: (...a: unknown[]) => mockGetDM(...a),+ getDMBetween: (...a: unknown[]) => mockGetDMBetween(...a),+ },+ communityMessage: {+ ...actual.queries.communityMessage,+ getMessageByChannelAndSeq: (...a: unknown[]) => mockGetMessageByChannelAndSeq(...a),+ },+ communityAgentInbox: { toAgentMessage: (...a: unknown[]) => mockToAgentMessage(...a) },+ },+ }+})++import { POST } from "./route"++function req(body: unknown, headers: Record<string, string> = {}): NextRequest {+ return new NextRequest("http://localhost/api/community/agent/resolve", {+ method: "POST",+ headers: { "content-type": "application/json", ...headers },+ body: typeof body === "string" ? body : JSON.stringify(body),+ })+}++describe("POST /api/community/agent/resolve", () => {+ beforeEach(() => {+ vi.clearAllMocks()+ mockFindActiveAgentRunnerKeyByBearer.mockResolvedValue({ userId: "owner_1", machineId: "m_1", agentId: "bot_1" })+ mockGetUserInternal.mockResolvedValue({ isBot: true, deletedAt: null })+ mockGetBotBinding.mockResolvedValue({ machineId: "m_1", runtime: "claude" })+ mockToAgentMessage.mockImplementation((_db: unknown, row: unknown) => Promise.resolve({ ...row as object, wireShaped: true }))+ })++ it("401 without Authorization", async () => {+ const res = await POST(req({ channel: "/studio/general", seq: 1 }))+ expect(res.status).toBe(401)+ })++ it("400 on a payload that fails schema validation", async () => {+ const res = await POST(req({ channel: "", seq: 1 }, { Authorization: "Bearer crk_abc" }))+ expect(res.status).toBe(400)+ })++ it("404 rejects seq 0 (legacy sentinel) before even resolving the channel", async () => {+ const res = await POST(req({ channel: "/studio/general", seq: 0 }, { Authorization: "Bearer crk_abc" }))+ expect(res.status).toBe(404)+ expect(mockResolveServerByNameForMember).not.toHaveBeenCalled()+ })++ it("404 propagates the ref-resolution error (channel not found)", async () => {+ mockResolveServerByNameForMember.mockResolvedValue([])+ const res = await POST(req({ channel: "/studio/general", seq: 3 }, { Authorization: "Bearer crk_abc" }))+ expect(res.status).toBe(404)+ expect(await res.json()).toEqual({ error: "server not found: studio" })+ })++ it("403 forbidden when the bot resolves the channel but isn't actually a member", async () => {+ mockResolveServerByNameForMember.mockResolvedValue([{ id: "srv_1" }])+ mockResolveChannelByNameForMember.mockResolvedValue([{ id: "ch_1" }])+ mockGetChannelForMember.mockResolvedValue(null)+ const res = await POST(req({ channel: "/studio/general", seq: 3 }, { Authorization: "Bearer crk_abc" }))+ expect(res.status).toBe(403)+ })++ it("404 when the channel exists but has no message at that seq", async () => {+ mockResolveServerByNameForMember.mockResolvedValue([{ id: "srv_1" }])+ mockResolveChannelByNameForMember.mockResolvedValue([{ id: "ch_1" }])+ mockGetChannelForMember.mockResolvedValue({ id: "ch_1", serverId: "srv_1", parentChannelId: null })+ mockGetMessageByChannelAndSeq.mockResolvedValue(null)+ const res = await POST(req({ channel: "/studio/general", seq: 99 }, { Authorization: "Bearer crk_abc" }))+ expect(res.status).toBe(404)+ expect((await res.json()).error).toMatch(/no message with seq #99/)+ })++ it("200 happy path: resolves the channel ref, fetches by seq, and wire-shapes via toAgentMessage", async () => {+ mockResolveServerByNameForMember.mockResolvedValue([{ id: "srv_1" }])+ mockResolveChannelByNameForMember.mockResolvedValue([{ id: "ch_1" }])+ mockGetChannelForMember.mockResolvedValue({ id: "ch_1", serverId: "srv_1", parentChannelId: null })+ mockGetMessageByChannelAndSeq.mockResolvedValue({ id: "m_1", seq: 3, content: "hi" })+ const res = await POST(req({ channel: "/studio/general", seq: 3 }, { Authorization: "Bearer crk_abc" }))+ expect(res.status).toBe(200)+ const body = await res.json()+ expect(body.message).toMatchObject({ id: "m_1", seq: 3, wireShaped: true })+ expect(mockGetMessageByChannelAndSeq).toHaveBeenCalledWith(expect.anything(), { channelId: "ch_1" }, 3)+ })++ it("200 happy path over a DM ref, gated by requireDMParticipant", async () => {+ mockGetUserInternal.mockImplementation((_db: unknown, id: string) =>+ Promise.resolve(id === "peer_1" ? { id: "peer_1", isBot: false, deletedAt: null } : { isBot: true, deletedAt: null })+ )+ // resolveTargetForMember (no createDmIfMissing) needs an existing DM row.+ mockGetDMBetween.mockResolvedValue({ id: "dm_1" })+ mockGetDM.mockResolvedValue({ id: "dm_1", user1Id: "bot_1", user2Id: "peer_1", lastMessageAt: null, createdAt: "t" })+ mockIsBlocked.mockResolvedValue(false)+ mockGetMessageByChannelAndSeq.mockResolvedValue({ id: "m_dm_1", seq: 2, content: "hey" })+ const res = await POST(req({ channel: "/.dm/peer_1", seq: 2 }, { Authorization: "Bearer crk_abc" }))+ expect(res.status).toBe(200)+ expect(mockGetMessageByChannelAndSeq).toHaveBeenCalledWith(expect.anything(), { dmConversationId: "dm_1" }, 2)+ })+})diff --git a/src/web/src/app/api/community/agent/resolve/route.ts b/src/web/src/app/api/community/agent/resolve/route.tsnew file mode 100644index 000000000..8f9f1fffc--- /dev/null+++ b/src/web/src/app/api/community/agent/resolve/route.ts@@ -0,0 +1,59 @@+import { NextResponse, type NextRequest } from "next/server"+import { queries, CommunityAgentResolveRequestSchema } from "@alook/shared"+import { getDb } from "@/lib/db"+import { withAgentRunnerAuth } from "@/lib/middleware/community-agent-runner-auth"+import { resolveTargetForMember, resolveErrorResponse } from "@/lib/community/resolve-ref"+import { requireChannelMember, requireDMParticipant } from "@/lib/community/permissions"++/**+ * POST /api/community/agent/resolve — plan §7. Body `{ channel, seq }` (two+ * separate fields, not a combined `"/server/channel#N"` ref string — the+ * CLI's own `parseRef` already splits a user-typed ref before calling this).+ * `seq === 0` is the legacy pre-migration sentinel, never a real message —+ * rejected with 404 (defense-in-depth).+ */+export const POST = withAgentRunnerAuth(async (req: NextRequest, ctx) => {+ const db = getDb(ctx.env.DB)++ let raw: unknown+ try {+ raw = await req.json()+ } catch {+ return NextResponse.json({ error: "invalid JSON body" }, { status: 400 })+ }+ const parsed = CommunityAgentResolveRequestSchema.safeParse(raw)+ if (!parsed.success) {+ return NextResponse.json({ error: "invalid payload", details: parsed.error.flatten() }, { status: 400 })+ }+ const body = parsed.data++ if (body.seq === 0) {+ return NextResponse.json({ error: "seq 0 is not a real message" }, { status: 404 })+ }++ const resolved = await resolveTargetForMember(db, ctx.botUserId, body.channel, {+ createDmIfMissing: false,+ createThreadIfMissing: false,+ callerKind: "bot",+ })+ if ("error" in resolved) return resolveErrorResponse(resolved)++ const scopeTarget =+ resolved.kind === "dm" ? { dmConversationId: resolved.dmConversationId } : { channelId: resolved.channelId }++ if (resolved.kind === "dm") {+ const gate = await requireDMParticipant(db, resolved.dmConversationId, ctx.botUserId)+ if (!gate.ok) return NextResponse.json({ error: gate.error }, { status: gate.status })+ } else {+ const gate = await requireChannelMember(db, resolved.channelId, ctx.botUserId)+ if (!gate.ok) return NextResponse.json({ error: gate.error }, { status: gate.status })+ }++ const row = await queries.communityMessage.getMessageByChannelAndSeq(db, scopeTarget, body.seq)+ if (!row) {+ return NextResponse.json({ error: `no message with seq #${body.seq} in ${body.channel}` }, { status: 404 })+ }++ const message = await queries.communityAgentInbox.toAgentMessage(db, row, ctx.botUserId)+ return NextResponse.json({ message })+})diff --git a/src/web/src/app/api/community/agent/send/route.test.ts b/src/web/src/app/api/community/agent/send/route.test.tsnew file mode 100644index 000000000..7fc68cc4d--- /dev/null+++ b/src/web/src/app/api/community/agent/send/route.test.ts@@ -0,0 +1,220 @@+import { describe, it, expect, vi, beforeEach } from "vitest"+import { NextRequest } from "next/server"++vi.mock("@opennextjs/cloudflare", () => ({+ getCloudflareContext: vi.fn(async () => ({ env: { DB: {} } })),+}))+vi.mock("@/lib/db", () => ({ getDb: vi.fn(() => ({})) }))++const mockFindActiveAgentRunnerKeyByBearer = vi.fn()+const mockGetUserInternal = vi.fn()+const mockGetBotBinding = vi.fn()+const mockResolveServerByNameForMember = vi.fn()+const mockResolveChannelByNameForMember = vi.fn()+const mockGetChannelForMember = vi.fn()+const mockGetDM = vi.fn()+const mockGetDMBetween = vi.fn()+const mockCreateOrGetDM = vi.fn()+const mockIsBlocked = vi.fn()+const mockAreFriends = vi.fn()+const mockGetLatestSeqForScope = vi.fn()+const mockGetReadState = vi.fn()+const mockToAgentMessage = vi.fn()++vi.mock("@alook/shared", async () => {+ const actual = await vi.importActual<typeof import("@alook/shared")>("@alook/shared")+ return {+ ...actual,+ queries: {+ ...actual.queries,+ communityMachine: { findActiveAgentRunnerKeyByBearer: (...a: unknown[]) => mockFindActiveAgentRunnerKeyByBearer(...a) },+ user: { getUserInternal: (...a: unknown[]) => mockGetUserInternal(...a) },+ communityBot: { getBotBinding: (...a: unknown[]) => mockGetBotBinding(...a) },+ communityFriendship: {+ isBlocked: (...a: unknown[]) => mockIsBlocked(...a),+ areFriends: (...a: unknown[]) => mockAreFriends(...a),+ },+ communityServer: { resolveServerByNameForMember: (...a: unknown[]) => mockResolveServerByNameForMember(...a) },+ communityChannel: {+ resolveChannelByNameForMember: (...a: unknown[]) => mockResolveChannelByNameForMember(...a),+ getChannelForMember: (...a: unknown[]) => mockGetChannelForMember(...a),+ },+ communityDm: {+ getDM: (...a: unknown[]) => mockGetDM(...a),+ getDMBetween: (...a: unknown[]) => mockGetDMBetween(...a),+ createOrGetDM: (...a: unknown[]) => mockCreateOrGetDM(...a),+ },+ communityMessage: {+ ...actual.queries.communityMessage, // keep the real scopeKeyForTarget+ },+ communityAgentInbox: {+ getLatestSeqForScope: (...a: unknown[]) => mockGetLatestSeqForScope(...a),+ toAgentMessage: (...a: unknown[]) => mockToAgentMessage(...a),+ },+ communityReadState: { getReadState: (...a: unknown[]) => mockGetReadState(...a) },+ },+ }+})++const mockCreateCommunityMessage = vi.fn()+vi.mock("@/lib/community/message-handler", () => ({+ createCommunityMessage: (...a: unknown[]) => mockCreateCommunityMessage(...a),+}))++import { POST } from "./route"++function req(body: unknown, headers: Record<string, string> = {}): NextRequest {+ return new NextRequest("http://localhost/api/community/agent/send", {+ method: "POST",+ headers: { "content-type": "application/json", ...headers },+ body: typeof body === "string" ? body : JSON.stringify(body),+ })+}++describe("POST /api/community/agent/send", () => {+ beforeEach(() => {+ vi.clearAllMocks()+ mockFindActiveAgentRunnerKeyByBearer.mockResolvedValue({ userId: "owner_1", machineId: "m_1", agentId: "bot_1" })+ mockGetUserInternal.mockResolvedValue({ isBot: true, deletedAt: null })+ mockGetBotBinding.mockResolvedValue({ machineId: "m_1", runtime: "claude" })+ mockResolveServerByNameForMember.mockResolvedValue([{ id: "srv_1" }])+ mockResolveChannelByNameForMember.mockResolvedValue([{ id: "ch_1" }])+ mockGetChannelForMember.mockResolvedValue({ id: "ch_1", serverId: "srv_1", parentChannelId: null })+ mockGetLatestSeqForScope.mockResolvedValue(0)+ mockGetReadState.mockResolvedValue(null)+ mockToAgentMessage.mockImplementation((_db: unknown, row: unknown) => Promise.resolve({ ...row as object, wireShaped: true }))+ })++ it("401 without Authorization", async () => {+ const res = await POST(req({ channel: "/studio/general", content: { text: "hi" } }))+ expect(res.status).toBe(401)+ })++ it("400 on a payload that fails schema validation (empty content text)", async () => {+ const res = await POST(+ req({ channel: "/studio/general", content: { text: "" } }, { Authorization: "Bearer crk_abc" })+ )+ expect(res.status).toBe(400)+ })++ it("404 propagates ref-resolution errors (e.g. channel not found)", async () => {+ mockResolveChannelByNameForMember.mockResolvedValue([])+ const res = await POST(+ req({ channel: "/studio/missing", content: { text: "hi" } }, { Authorization: "Bearer crk_abc" })+ )+ expect(res.status).toBe(404)+ expect(mockCreateCommunityMessage).not.toHaveBeenCalled()+ })++ it("returns { state: blocked, reason: unaligned } when the bot is behind the channel's latest seq and hasn't caught up", async () => {+ mockGetLatestSeqForScope.mockResolvedValue(10)+ mockGetReadState.mockResolvedValue({ lastReadSeq: 4 })+ const res = await POST(+ req({ channel: "/studio/general", content: { text: "hi" } }, { Authorization: "Bearer crk_abc" })+ )+ expect(res.status).toBe(200)+ expect(await res.json()).toEqual({ state: "blocked", reason: "unaligned", unreadCount: 6, latestSeq: 10 })+ expect(mockCreateCommunityMessage).not.toHaveBeenCalled()+ })++ it("an explicit seenUpToSeq overrides the bot's own tracked lastReadSeq for the alignment check", async () => {+ mockGetLatestSeqForScope.mockResolvedValue(10)+ mockGetReadState.mockResolvedValue({ lastReadSeq: 2 }) // would block if used+ mockGetChannelForMember.mockResolvedValue({ id: "ch_1", serverId: "srv_1", parentChannelId: null })+ mockCreateCommunityMessage.mockResolvedValue({ ok: true, row: { id: "m_1", seq: 10 } })+ const res = await POST(+ req(+ { channel: "/studio/general", content: { text: "hi" }, seenUpToSeq: 10 },+ { Authorization: "Bearer crk_abc" }+ )+ )+ expect(res.status).toBe(200)+ expect((await res.json()).state).toBe("sent")+ })++ it("403 forbidden when resolution succeeds but channel membership gate fails", async () => {+ mockGetChannelForMember.mockResolvedValue(null)+ const res = await POST(+ req({ channel: "/studio/general", content: { text: "hi" } }, { Authorization: "Bearer crk_abc" })+ )+ expect(res.status).toBe(403)+ expect(mockCreateCommunityMessage).not.toHaveBeenCalled()+ })++ it("200 { state: sent } happy path for a plain channel send", async () => {+ mockCreateCommunityMessage.mockResolvedValue({ ok: true, row: { id: "m_1", seq: 1, content: "hi" } })+ const res = await POST(+ req({ channel: "/studio/general", content: { text: "hi" } }, { Authorization: "Bearer crk_abc" })+ )+ expect(res.status).toBe(200)+ const body = await res.json()+ expect(body.state).toBe("sent")+ expect(body.message).toMatchObject({ id: "m_1", wireShaped: true })+ expect(mockCreateCommunityMessage).toHaveBeenCalledWith(+ expect.objectContaining({+ authorId: "bot_1",+ target: { kind: "channel", channelId: "ch_1", serverId: "srv_1" },+ body: { content: "hi" },+ source: "cli",+ })+ )+ })++ it("reconstructs a thread MessageTarget (kind: thread) when the resolved channel has a parentChannelId", async () => {+ // A plain channel ref that happens to resolve to a thread's own channel+ // row exercises the SAME reconstruction branch as an actual `/#N`+ // thread ref, without needing to also mock the root-message/thread-row+ // lookups `resolveTargetForMember`'s thread-form parsing would trigger.+ mockResolveChannelByNameForMember.mockResolvedValue([{ id: "thread_1" }])+ mockGetChannelForMember.mockResolvedValue({ id: "thread_1", serverId: "srv_1", parentChannelId: "ch_parent" })+ mockCreateCommunityMessage.mockResolvedValue({ ok: true, row: { id: "m_1", seq: 1, content: "hi" } })+ const res = await POST(+ req({ channel: "/studio/general", content: { text: "hi" } }, { Authorization: "Bearer crk_abc" })+ )+ expect(res.status).toBe(200)+ expect(mockCreateCommunityMessage).toHaveBeenCalledWith(+ expect.objectContaining({+ target: { kind: "thread", channelId: "thread_1", parentChannelId: "ch_parent", serverId: "srv_1" },+ })+ )+ })++ it("propagates createCommunityMessage's own validation error (e.g. content too long) with its status", async () => {+ mockCreateCommunityMessage.mockResolvedValue({ ok: false, status: 400, error: "content is required" })+ const res = await POST(+ req({ channel: "/studio/general", content: { text: "hi" } }, { Authorization: "Bearer crk_abc" })+ )+ expect(res.status).toBe(400)+ expect(await res.json()).toEqual({ error: "content is required" })+ })++ it("200 happy path for a DM send, auto-creating the DM row via createDmIfMissing", async () => {+ mockGetUserInternal.mockImplementation((_db: unknown, id: string) =>+ Promise.resolve(id === "peer_1" ? { id: "peer_1", isBot: false, deletedAt: null } : { isBot: true, deletedAt: null })+ )+ mockIsBlocked.mockResolvedValue(false)+ mockCreateOrGetDM.mockResolvedValue({ id: "dm_new" })+ mockGetDM.mockResolvedValue({ id: "dm_new", user1Id: "bot_1", user2Id: "peer_1", lastMessageAt: null, createdAt: "t" })+ mockCreateCommunityMessage.mockResolvedValue({ ok: true, row: { id: "m_dm", seq: 1, content: "hey" } })+ const res = await POST(+ req({ channel: "/.dm/peer_1", content: { text: "hey" } }, { Authorization: "Bearer crk_abc" })+ )+ expect(res.status).toBe(200)+ expect(mockCreateCommunityMessage).toHaveBeenCalledWith(+ expect.objectContaining({ target: { kind: "dm", dmId: "dm_new", otherUserId: "peer_1" } })+ )+ })++ it("403 blocked propagates from guardDmOpen when trying to auto-create a DM with a blocking peer", async () => {+ mockGetUserInternal.mockImplementation((_db: unknown, id: string) =>+ Promise.resolve(id === "peer_1" ? { id: "peer_1", isBot: false, deletedAt: null } : { isBot: true, deletedAt: null })+ )+ mockIsBlocked.mockResolvedValue(true)+ const res = await POST(+ req({ channel: "/.dm/peer_1", content: { text: "hey" } }, { Authorization: "Bearer crk_abc" })+ )+ expect(res.status).toBe(403)+ expect(mockCreateOrGetDM).not.toHaveBeenCalled()+ expect(mockCreateCommunityMessage).not.toHaveBeenCalled()+ })+})diff --git a/src/web/src/app/api/community/agent/send/route.ts b/src/web/src/app/api/community/agent/send/route.tsnew file mode 100644index 000000000..93252e2d4--- /dev/null+++ b/src/web/src/app/api/community/agent/send/route.ts@@ -0,0 +1,97 @@+import { NextResponse, type NextRequest } from "next/server"+import { queries, CommunityAgentSendRequestSchema } from "@alook/shared"+import { getDb } from "@/lib/db"+import { withAgentRunnerAuth } from "@/lib/middleware/community-agent-runner-auth"+import { resolveTargetForMember, resolveErrorResponse } from "@/lib/community/resolve-ref"+import { requireChannelMember, requireDMParticipant } from "@/lib/community/permissions"+import { createCommunityMessage, type MessageTarget } from "@/lib/community/message-handler"++/**+ * POST /api/community/agent/send — plan §7.+ *+ * Single resolve, WITH create flags (`createDmIfMissing`/`createThreadIfMissing:+ * true`), rather than the plan's literal read-only-then-mutating double+ * resolve. This is intentionally simplified but behaviorally identical: a+ * DM/thread row can only be auto-created when it has NEVER had a message+ * sent to it, which means that scope's `community_message_seq` counter is+ * necessarily absent (`latestSeq === 0`) — i.e. it is IMPOSSIBLE for the+ * alignment gate to block a send into a target that doesn't exist yet+ * (blocking requires `latestSeq > seen`, and `seen >= 0` always). So+ * auto-create can never fire on a request this gate would have blocked+ * anyway — a single resolve is safe and avoids a redundant DB round trip.+ */+export const POST = withAgentRunnerAuth(async (req: NextRequest, ctx) => {+ const db = getDb(ctx.env.DB)++ let raw: unknown+ try {+ raw = await req.json()+ } catch {+ return NextResponse.json({ error: "invalid JSON body" }, { status: 400 })+ }+ const parsed = CommunityAgentSendRequestSchema.safeParse(raw)+ if (!parsed.success) {+ return NextResponse.json({ error: "invalid payload", details: parsed.error.flatten() }, { status: 400 })+ }+ const body = parsed.data++ const resolved = await resolveTargetForMember(db, ctx.botUserId, body.channel, {+ createDmIfMissing: true,+ createThreadIfMissing: true,+ callerKind: "bot",+ })+ if ("error" in resolved) return resolveErrorResponse(resolved)++ const scopeTarget =+ resolved.kind === "dm" ? { dmConversationId: resolved.dmConversationId } : { channelId: resolved.channelId }++ // Channel-alignment gate (plan §7, debt #2 corrected) — no bypass. The+ // server is the source of truth for the "seen" waterline: a client that+ // omits `seenUpToSeq` is checked against its OWN tracked `lastReadSeq`,+ // never allowed to skip the gate by simply not sending the field.+ const scopeKey = queries.communityMessage.scopeKeyForTarget(scopeTarget)+ const [latestSeq, readState] = await Promise.all([+ queries.communityAgentInbox.getLatestSeqForScope(db, scopeKey),+ queries.communityReadState.getReadState(db, { userId: ctx.botUserId, ...scopeTarget }),+ ])+ const seen = body.seenUpToSeq ?? readState?.lastReadSeq ?? 0+ if (latestSeq > seen) {+ return NextResponse.json({+ state: "blocked",+ reason: "unaligned",+ unreadCount: latestSeq - seen,+ latestSeq,+ })+ }++ // Permission gate + MessageTarget reconstruction (plan §5 — threads are+ // channels for routing, but `createCommunityMessage` needs the full+ // 3-variant union to fire `CHILD_CHANNEL_UPDATE` for thread replies).+ let target: MessageTarget+ if (resolved.kind === "dm") {+ const gate = await requireDMParticipant(db, resolved.dmConversationId, ctx.botUserId)+ if (!gate.ok) return NextResponse.json({ error: gate.error }, { status: gate.status })+ target = { kind: "dm", dmId: resolved.dmConversationId, otherUserId: resolved.otherUserId }+ } else {+ const gate = await requireChannelMember(db, resolved.channelId, ctx.botUserId)+ if (!gate.ok) return NextResponse.json({ error: gate.error }, { status: gate.status })+ const channel = gate.value+ target = channel.parentChannelId+ ? { kind: "thread", channelId: channel.id, parentChannelId: channel.parentChannelId, serverId: channel.serverId }+ : { kind: "channel", channelId: channel.id, serverId: channel.serverId }+ }++ const result = await createCommunityMessage({+ db,+ authorId: ctx.botUserId,+ target,+ body: { content: body.content.text },+ source: "cli",+ })+ if (!result.ok) {+ return NextResponse.json({ error: result.error }, { status: result.status })+ }++ const message = await queries.communityAgentInbox.toAgentMessage(db, result.row, ctx.botUserId)+ return NextResponse.json({ state: "sent", message })+})diff --git a/src/web/src/app/api/community/channels/[id]/messages/route.test.ts b/src/web/src/app/api/community/channels/[id]/messages/route.test.tsindex 196bdbc8a..0ddb0a1de 100644--- a/src/web/src/app/api/community/channels/[id]/messages/route.test.ts+++ b/src/web/src/app/api/community/channels/[id]/messages/route.test.ts@@ -18,6 +18,7 @@ const mockListChildChannels = vi.fn()const mockListMessages = vi.fn()const mockListByMessageIds = vi.fn()const mockListReactionsByMessageIds = vi.fn()+const mockGetUserInternal = vi.fn()const mockFanOutToChannel = vi.fn()const mockBroadcastToUser = vi.fn()@@ -54,6 +55,9 @@ vi.mock("@alook/shared", async () => {communityReaction: {listReactionsByMessageIds: (...a: unknown[]) => mockListReactionsByMessageIds(...a),},+ user: {+ getUserInternal: (...a: unknown[]) => mockGetUserInternal(...a),+ },},}})@@ -103,6 +107,9 @@ describe("POST /api/community/channels/[id]/messages", () => {vi.clearAllMocks()mockGetChannelForMember.mockResolvedValue({ id: "c1", serverId: "s1" })mockCreateMessage.mockResolvedValue({ id: "m1" })+ // Human author by default — `createCommunityMessage`'s bot-authored audit+ // (plan §10) only fires when `isBot === true`, which none of these tests exercise.+ mockGetUserInternal.mockResolvedValue({ isBot: false, deletedAt: null })mockGetMessage.mockResolvedValue({id: "m1",authorId: "u1",diff --git a/src/web/src/app/api/community/daemon/bots/[botId]/messages/route.test.ts b/src/web/src/app/api/community/daemon/bots/[botId]/messages/route.test.tsnew file mode 100644index 000000000..040f4e9df--- /dev/null+++ b/src/web/src/app/api/community/daemon/bots/[botId]/messages/route.test.ts@@ -0,0 +1,121 @@+import { describe, it, expect, vi, beforeEach } from "vitest"+import { NextRequest } from "next/server"++vi.mock("@opennextjs/cloudflare", () => ({+ getCloudflareContext: vi.fn(async () => ({ env: { DB: {} } })),+}))+vi.mock("@/lib/db", () => ({ getDb: vi.fn(() => ({})) }))++const mockFindActiveCredential = vi.fn()+const mockGetUserInternal = vi.fn()+const mockGetBotBinding = vi.fn()+const mockGetChannel = vi.fn()+const mockGetMember = vi.fn()+const mockGetDM = vi.fn()+const mockIsBlocked = vi.fn()++vi.mock("@alook/shared", async () => {+ const actual = await vi.importActual<typeof import("@alook/shared")>("@alook/shared")+ return {+ ...actual,+ queries: {+ ...actual.queries,+ communityMachine: { findActiveCredentialByBearer: (...a: unknown[]) => mockFindActiveCredential(...a) },+ user: { getUserInternal: (...a: unknown[]) => mockGetUserInternal(...a) },+ communityBot: { getBotBinding: (...a: unknown[]) => mockGetBotBinding(...a) },+ communityChannel: { getChannel: (...a: unknown[]) => mockGetChannel(...a) },+ communityMember: { getMember: (...a: unknown[]) => mockGetMember(...a) },+ communityDm: { getDM: (...a: unknown[]) => mockGetDM(...a) },+ communityFriendship: { isBlocked: (...a: unknown[]) => mockIsBlocked(...a) },+ },+ }+})++// `createCommunityMessage`'s own audit-emission logic is unit-tested in+// `message-handler.test.ts` (plan §10) — this route test's only job is+// verifying THIS route calls it with `source: "daemon-http"` and does NOT+// also fire its own `logAudit` (the duplicate-audit regression this route+// used to have before the relocation, see route.ts's inline comments).+const mockCreateCommunityMessage = vi.fn()+vi.mock("@/lib/community/message-handler", () => ({+ createCommunityMessage: (...a: unknown[]) => mockCreateCommunityMessage(...a),+}))++const mockLogAudit = vi.fn()+vi.mock("@/lib/community/audit", async () => {+ const actual = await vi.importActual<typeof import("@/lib/community/audit")>("@/lib/community/audit")+ return { ...actual, logAudit: (...a: unknown[]) => mockLogAudit(...a) }+})++import { POST } from "./route"++function req(body: unknown, headers: Record<string, string> = {}): NextRequest {+ return new NextRequest("http://localhost/api/community/daemon/bots/bot_1/messages", {+ method: "POST",+ headers: { "content-type": "application/json", ...headers },+ body: typeof body === "string" ? body : JSON.stringify(body),+ })+}++function ctxParams() {+ return { params: Promise.resolve({ botId: "bot_1" }) }+}++describe("POST /api/community/daemon/bots/[botId]/messages", () => {+ beforeEach(() => {+ vi.clearAllMocks()+ mockFindActiveCredential.mockResolvedValue({ credentialId: "cmk_1", userId: "u_owner", machineId: "cm_1" })+ mockGetUserInternal.mockResolvedValue({ isBot: true, ownerUserId: "u_owner", deletedAt: null })+ mockGetBotBinding.mockResolvedValue({ machineId: "cm_1", runtime: "claude" })+ })++ it("channel send: calls createCommunityMessage with source 'daemon-http' and never calls logAudit itself", async () => {+ mockGetChannel.mockResolvedValue({ id: "ch_1", serverId: "srv_1" })+ mockGetMember.mockResolvedValue({ userId: "bot_1" })+ mockCreateCommunityMessage.mockResolvedValue({ ok: true, row: { id: "m_1" } })++ const res = await POST(+ req({ target: "channel", targetId: "ch_1", content: "hi" }, { Authorization: "Bearer cmk_1" }),+ ctxParams()+ )++ expect(res.status).toBe(200)+ expect(await res.json()).toEqual({ messageId: "m_1" })+ expect(mockCreateCommunityMessage).toHaveBeenCalledTimes(1)+ expect(mockCreateCommunityMessage).toHaveBeenCalledWith(+ expect.objectContaining({ authorId: "bot_1", source: "daemon-http" })+ )+ // The route itself must never call logAudit — that's exclusively+ // `createCommunityMessage`'s job now (which is mocked away here).+ expect(mockLogAudit).not.toHaveBeenCalled()+ })++ it("DM send: calls createCommunityMessage with source 'daemon-http' and never calls logAudit itself", async () => {+ mockGetDM.mockResolvedValue({ id: "dm_1", user1Id: "bot_1", user2Id: "peer_1" })+ mockIsBlocked.mockResolvedValue(false)+ mockCreateCommunityMessage.mockResolvedValue({ ok: true, row: { id: "m_dm_1" } })++ const res = await POST(+ req({ target: "dm", targetId: "dm_1", content: "hey" }, { Authorization: "Bearer cmk_1" }),+ ctxParams()+ )++ expect(res.status).toBe(200)+ expect(await res.json()).toEqual({ messageId: "m_dm_1" })+ expect(mockCreateCommunityMessage).toHaveBeenCalledWith(+ expect.objectContaining({ authorId: "bot_1", source: "daemon-http" })+ )+ expect(mockLogAudit).not.toHaveBeenCalled()+ })++ it("403 bot_not_a_member when the bot isn't in the target channel's server — no message created", async () => {+ mockGetChannel.mockResolvedValue({ id: "ch_1", serverId: "srv_1" })+ mockGetMember.mockResolvedValue(null)+ const res = await POST(+ req({ target: "channel", targetId: "ch_1", content: "hi" }, { Authorization: "Bearer cmk_1" }),+ ctxParams()+ )+ expect(res.status).toBe(403)+ expect(mockCreateCommunityMessage).not.toHaveBeenCalled()+ })+})diff --git a/src/web/src/app/api/community/daemon/bots/[botId]/messages/route.ts b/src/web/src/app/api/community/daemon/bots/[botId]/messages/route.tsindex 99ced7479..aa14647b2 100644--- a/src/web/src/app/api/community/daemon/bots/[botId]/messages/route.ts+++ b/src/web/src/app/api/community/daemon/bots/[botId]/messages/route.ts@@ -3,7 +3,6 @@ import { queries, CommunityDaemonSendAsBotRequestSchema } from "@alook/shared"import { getDb } from "@/lib/db"import { withCommunityDaemonAuth } from "@/lib/middleware/community-daemon-auth"import { createCommunityMessage } from "@/lib/community/message-handler"-import { logAudit, COMMUNITY_AUDIT_ACTIONS } from "@/lib/community/audit"import { requireNotBlocked } from "@/lib/community/permissions"/**@@ -67,23 +66,14 @@ export const POST = withCommunityDaemonAuth(async (req: NextRequest, ctx) => {mentionType: body.mentionType,attachments: body.attachments,},+ source: "daemon-http",})if (!result.ok) {return NextResponse.json({ error: result.error }, { status: result.status })}- logAudit(db, {- serverId: channel.serverId,- actorId: botId,- action: COMMUNITY_AUDIT_ACTIONS.MESSAGE_AUTHORED_AS_BOT,- targetType: "message",- targetId: result.row.id,- changes: JSON.stringify({- botId,- target: "channel",- targetId: body.targetId,- messageId: result.row.id,- }),- })+ // MESSAGE_AUTHORED_AS_BOT audit now fires from inside createCommunityMessage+ // itself (plan §10) — do not re-add a call here, or every bot message gets+ // audited twice.return NextResponse.json({ messageId: result.row.id })}@@ -111,22 +101,13 @@ export const POST = withCommunityDaemonAuth(async (req: NextRequest, ctx) => {replyToId: body.replyToId,attachments: body.attachments,},+ source: "daemon-http",})if (!result.ok) {return NextResponse.json({ error: result.error }, { status: result.status })}- logAudit(db, {- serverId: null,- actorId: botId,- action: COMMUNITY_AUDIT_ACTIONS.MESSAGE_AUTHORED_AS_BOT,- targetType: "message",- targetId: result.row.id,- changes: JSON.stringify({- botId,- target: "dm",- targetId: dm.id,- messageId: result.row.id,- }),- })+ // MESSAGE_AUTHORED_AS_BOT audit now fires from inside createCommunityMessage+ // itself (plan §10) — do not re-add a call here, or every bot message gets+ // audited twice.return NextResponse.json({ messageId: result.row.id })})diff --git a/src/web/src/app/api/community/dm/[id]/messages/route.test.ts b/src/web/src/app/api/community/dm/[id]/messages/route.test.tsindex 618fd7a84..582a57cce 100644--- a/src/web/src/app/api/community/dm/[id]/messages/route.test.ts+++ b/src/web/src/app/api/community/dm/[id]/messages/route.test.ts@@ -16,6 +16,7 @@ const mockListReactionsByMessageIds = vi.fn()const mockListMembers = vi.fn()const mockListMemberUserIds = vi.fn()const mockCreateAttachment = vi.fn()+const mockGetUserInternal = vi.fn()const mockFanOutToDM = vi.fn()const mockBroadcastToUser = vi.fn()@@ -54,6 +55,9 @@ vi.mock("@alook/shared", async () => {listReactionsByMessageIds: (...a: unknown[]) =>mockListReactionsByMessageIds(...a),},+ user: {+ getUserInternal: (...a: unknown[]) => mockGetUserInternal(...a),+ },},}})@@ -109,6 +113,9 @@ describe("POST /api/community/dm/[id]/messages", () => {lastMessageAt: null,createdAt: "2026-06-30T00:00:00.000Z",})+ // Human author by default — `createCommunityMessage`'s bot-authored audit+ // (plan §10) only fires when `isBot === true`, which none of these tests exercise.+ mockGetUserInternal.mockResolvedValue({ isBot: false, deletedAt: null })mockFanOutToDM.mockResolvedValue(undefined)mockBroadcastToUser.mockResolvedValue(undefined)})diff --git a/src/web/src/app/api/community/dm/route.ts b/src/web/src/app/api/community/dm/route.tsindex d970c8795..42f515f8c 100644--- a/src/web/src/app/api/community/dm/route.ts+++ b/src/web/src/app/api/community/dm/route.ts@@ -3,7 +3,7 @@ import { withAuth } from "@/lib/middleware/auth"import { writeJSON, writeError } from "@/lib/middleware/helpers"import { getDb } from "@/lib/db"import { queries } from "@alook/shared"-import { requireNotBlocked } from "@/lib/community/permissions"+import { guardDmOpen } from "@/lib/community/dm-guard"import { avatarInitial } from "@/lib/community/avatar"export const GET = withAuth(async (_req: NextRequest, ctx) => {@@ -32,37 +32,11 @@ export const POST = withAuth(async (req: NextRequest, ctx) => {}if (!body.userId) return writeError("userId is required", 400)- if (body.userId === ctx.userId) return writeError("cannot DM yourself", 400)- // Make sure the target user exists — otherwise we silently create an- // orphan DM row that the recipient never sees. Use `getUserInternal` so we- // can gate bot targets on owner ↔ bot relationship.- const target = await queries.user.getUserInternal(db, body.userId)- if (!target || target.deletedAt !== null) return writeError("user not found", 404)-- // Bot-target gating: caller must be either the bot's owner OR in an- // accepted friendship with the bot. Otherwise 404 — indistinguishable from- // "user not found" to preserve pass-as-human.- if (target.isBot === true) {- const isOwner = target.ownerUserId === ctx.userId- if (!isOwner) {- const areFriends = await queries.communityFriendship.areFriends(- db,- ctx.userId,- body.userId,- )- if (!areFriends) return writeError("user not found", 404)- }- // Owners: skip block-check with their own bot (self-block doesn't exist,- // but skip the round-trip regardless).- if (!isOwner) {- const blocked = await requireNotBlocked(db, ctx.userId, body.userId)- if (!blocked.ok) return writeError(blocked.error, blocked.status)- }- } else {- const blocked = await requireNotBlocked(db, ctx.userId, body.userId)- if (!blocked.ok) return writeError(blocked.error, blocked.status)- }+ // Default callerKind ("human") — 404-on-friend-failure / pass-as-human+ // preserved exactly as this route's pre-extraction behavior.+ const guard = await guardDmOpen(db, ctx.userId, body.userId)+ if (!guard.ok) return writeError(guard.error, guard.status)const dm = await queries.communityDm.createOrGetDM(db, {userId1: ctx.userId,diff --git a/src/web/src/env.d.ts b/src/web/src/env.d.tsindex 6f290e777..9ea2308d9 100644--- a/src/web/src/env.d.ts+++ b/src/web/src/env.d.ts@@ -5,6 +5,7 @@ declare namespace Cloudflare {COMMUNITY_MEDIA: R2BucketWS_DO_WORKER: FetcherEMAIL_WORKER: Fetcher+ WAKE_QUEUE: Queue<import("@alook/shared").WakePayload>WORKER_SELF_REFERENCE: FetcherNEXT_INC_CACHE_R2_BUCKET: R2BucketNEXT_TAG_CACHE_D1: D1Databasediff --git a/src/web/src/lib/community/dm-guard.test.ts b/src/web/src/lib/community/dm-guard.test.tsnew file mode 100644index 000000000..2628e7f60--- /dev/null+++ b/src/web/src/lib/community/dm-guard.test.ts@@ -0,0 +1,98 @@+import { describe, it, expect, vi, beforeEach } from "vitest"++const mockGetUserInternal = vi.fn()+const mockAreFriends = vi.fn()+const mockIsBlocked = vi.fn()++vi.mock("@alook/shared", () => ({+ queries: {+ user: { getUserInternal: (...a: unknown[]) => mockGetUserInternal(...a) },+ communityFriendship: {+ areFriends: (...a: unknown[]) => mockAreFriends(...a),+ isBlocked: (...a: unknown[]) => mockIsBlocked(...a),+ },+ },+}))++import { guardDmOpen } from "./dm-guard"++const db = {} as never++describe("guardDmOpen", () => {+ beforeEach(() => {+ vi.clearAllMocks()+ })++ it("400 cannot_dm_self when senderId === peerId", async () => {+ const res = await guardDmOpen(db, "u_1", "u_1")+ expect(res).toEqual({ ok: false, status: 400, error: "cannot DM yourself", code: "cannot_dm_self" })+ expect(mockGetUserInternal).not.toHaveBeenCalled()+ })++ it("404 user_not_found when peer is missing", async () => {+ mockGetUserInternal.mockResolvedValue(null)+ const res = await guardDmOpen(db, "u_1", "u_missing")+ expect(res).toEqual({ ok: false, status: 404, error: "user not found", code: "user_not_found" })+ })++ it("404 user_not_found when peer is soft-deleted", async () => {+ mockGetUserInternal.mockResolvedValue({ id: "u_2", isBot: false, deletedAt: "2026-01-01" })+ const res = await guardDmOpen(db, "u_1", "u_2")+ expect(res).toEqual({ ok: false, status: 404, error: "user not found", code: "user_not_found" })+ })++ it("human ↔ human: not-blocked check runs, blocked → 403", async () => {+ mockGetUserInternal.mockResolvedValue({ id: "u_2", isBot: false, deletedAt: null })+ mockIsBlocked.mockResolvedValue(true)+ const res = await guardDmOpen(db, "u_1", "u_2")+ expect(res).toEqual({ ok: false, status: 403, error: "blocked", code: "blocked" })+ })++ it("human ↔ human: not blocked → ok", async () => {+ mockGetUserInternal.mockResolvedValue({ id: "u_2", isBot: false, deletedAt: null })+ mockIsBlocked.mockResolvedValue(false)+ const res = await guardDmOpen(db, "u_1", "u_2")+ expect(res).toEqual({ ok: true })+ })++ describe("peer is a bot", () => {+ it("sender is the bot's owner → allowed, skips both friend and block checks", async () => {+ mockGetUserInternal.mockResolvedValue({ id: "bot_1", isBot: true, ownerUserId: "u_owner", deletedAt: null })+ const res = await guardDmOpen(db, "u_owner", "bot_1")+ expect(res).toEqual({ ok: true })+ expect(mockAreFriends).not.toHaveBeenCalled()+ expect(mockIsBlocked).not.toHaveBeenCalled()+ })++ it("not the owner, not friends, callerKind human (default) → 404 user_not_found (pass-as-human)", async () => {+ mockGetUserInternal.mockResolvedValue({ id: "bot_1", isBot: true, ownerUserId: "u_owner", deletedAt: null })+ mockAreFriends.mockResolvedValue(false)+ const res = await guardDmOpen(db, "u_stranger", "bot_1")+ expect(res).toEqual({ ok: false, status: 404, error: "user not found", code: "user_not_found" })+ })++ it("not the owner, not friends, callerKind bot → 403 not_friends", async () => {+ mockGetUserInternal.mockResolvedValue({ id: "bot_1", isBot: true, ownerUserId: "u_owner", deletedAt: null })+ mockAreFriends.mockResolvedValue(false)+ const res = await guardDmOpen(db, "bot_caller", "bot_1", { callerKind: "bot" })+ expect(res).toEqual({ ok: false, status: 403, error: "not friends with this bot", code: "not_friends" })+ })++ it("friends with the bot → block-gated, then ok", async () => {+ mockGetUserInternal.mockResolvedValue({ id: "bot_1", isBot: true, ownerUserId: "u_owner", deletedAt: null })+ mockAreFriends.mockResolvedValue(true)+ mockIsBlocked.mockResolvedValue(false)+ const res = await guardDmOpen(db, "u_friend", "bot_1", { callerKind: "bot" })+ expect(res).toEqual({ ok: true })+ expect(mockIsBlocked).toHaveBeenCalled()+ })++ it("friends with the bot but blocked → 403 blocked", async () => {+ mockGetUserInternal.mockResolvedValue({ id: "bot_1", isBot: true, ownerUserId: "u_owner", deletedAt: null })+ mockAreFriends.mockResolvedValue(true)+ mockIsBlocked.mockResolvedValue(true)+ const res = await guardDmOpen(db, "u_friend", "bot_1", { callerKind: "bot" })+ expect(res).toEqual({ ok: false, status: 403, error: "blocked", code: "blocked" })+ })+ })+})diff --git a/src/web/src/lib/community/dm-guard.ts b/src/web/src/lib/community/dm-guard.tsnew file mode 100644index 000000000..5fbce225d--- /dev/null+++ b/src/web/src/lib/community/dm-guard.ts@@ -0,0 +1,71 @@+import { queries } from "@alook/shared"+import type { Database } from "@alook/shared"+import { requireNotBlocked } from "./permissions"++export type GuardDmOpenResult =+ | { ok: true }+ | { ok: false; status: 400 | 403 | 404; error: string; code?: string }++/**+ * Shared DM-open gate (debt #9), extracted verbatim from the human DM route+ * (`/api/community/dm` POST) so bot DM-open goes through the SAME gating a+ * human does — not a looser path. Single signature, one opts flag:+ * `callerKind` defaults to `"human"` (preserves existing behavior for the+ * human route with zero call-site changes).+ *+ * - 400 `cannot_dm_self` if `senderId === peerId`.+ * - Peer missing/soft-deleted → 404 `user_not_found` (both caller kinds —+ * preserves pass-as-human for the human route; a `crk_`-authenticated bot+ * caller has no "pass as human" risk, so 404 here is just "not found",+ * not deliberate obfuscation).+ * - Peer is a bot: allowed if `senderId` is the bot's owner, else requires+ * `areFriends`. On friend-check failure:+ * - `callerKind: "human"` → 404 `user_not_found` (pass-as-human).+ * - `callerKind: "bot"` → 403 `not_friends` (crk_ authenticated; no+ * pass-as-human risk to preserve).+ * - `requireNotBlocked` → 403 `blocked` — EXCEPT when `senderId` is the+ * peer's owner, matching the existing human route's `isOwner` skip+ * exactly (a deliberate behavior-preservation decision, not an oversight:+ * a verbatim extraction without this skip would change existing+ * production behavior for owners DMing their own bot).+ */+export async function guardDmOpen(+ db: Database,+ senderId: string,+ peerId: string,+ opts?: { callerKind?: "human" | "bot" }+): Promise<GuardDmOpenResult> {+ const callerKind = opts?.callerKind ?? "human"++ if (senderId === peerId) {+ return { ok: false, status: 400, error: "cannot DM yourself", code: "cannot_dm_self" }+ }++ const peer = await queries.user.getUserInternal(db, peerId)+ if (!peer || peer.deletedAt !== null) {+ return { ok: false, status: 404, error: "user not found", code: "user_not_found" }+ }++ if (peer.isBot === true) {+ const isOwner = peer.ownerUserId === senderId+ if (!isOwner) {+ const areFriends = await queries.communityFriendship.areFriends(db, senderId, peerId)+ if (!areFriends) {+ return callerKind === "bot"+ ? { ok: false, status: 403, error: "not friends with this bot", code: "not_friends" }+ : { ok: false, status: 404, error: "user not found", code: "user_not_found" }+ }+ }+ if (!isOwner) {+ const blocked = await requireNotBlocked(db, senderId, peerId)+ // `requireNotBlocked` only ever fails with 403 — narrow the wider+ // `PermissionError` status union to satisfy this function's return type.+ if (!blocked.ok) return { ok: false, status: 403, error: blocked.error, code: "blocked" }+ }+ } else {+ const blocked = await requireNotBlocked(db, senderId, peerId)+ if (!blocked.ok) return { ok: false, status: 403, error: blocked.error, code: "blocked" }+ }++ return { ok: true }+}diff --git a/src/web/src/lib/community/fanout.test.ts b/src/web/src/lib/community/fanout.test.tsindex b30599a5d..f4e9ccd39 100644--- a/src/web/src/lib/community/fanout.test.ts+++ b/src/web/src/lib/community/fanout.test.ts@@ -38,6 +38,11 @@ vi.mock("../broadcast", () => ({broadcastToUser: (...a: unknown[]) => mockBroadcastToUser(...a),}))+const mockEnqueueBotWakes = vi.fn()+vi.mock("./wake-producer", () => ({+ enqueueBotWakes: (...a: unknown[]) => mockEnqueueBotWakes(...a),+}))+const mockListMembers = vi.fn()const mockListMemberUserIds = vi.fn()const mockGetChannel = vi.fn()@@ -110,6 +115,105 @@ describe("fanOutToServerMembers", () => {})})+describe("wake dispatch (plan §8) — only fires for MESSAGE_CREATE with a wakeMessageRow", () => {+ const wakeMessageRow = {+ id: "msg_1",+ seq: 7,+ authorId: "u1",+ content: "hello",+ createdAt: "2026-01-01T00:00:00.000Z",+ channelId: "c1",+ dmConversationId: null,+ }++ beforeEach(() => {+ vi.clearAllMocks()+ mockGetCloudflareContext.mockImplementation(() => ({ env: { DB: {} } }))+ mockBroadcastToUser.mockResolvedValue(undefined)+ mockEnqueueBotWakes.mockResolvedValue(undefined)+ })++ it("fanOutToChannel enqueues wakes using the same recipient list, minus excludeUserId", async () => {+ mockGetChannel.mockResolvedValue({ id: "c1", serverId: "srv_1" })+ mockListMemberUserIds.mockResolvedValue(["u1", "u2", "u3"])++ await fanOutToChannel(+ "c1",+ { type: WS_EVENTS.MESSAGE_CREATE, channelId: "c1", message: {} as never } as never,+ { excludeUserId: "u1", wakeMessageRow },+ )++ expect(mockEnqueueBotWakes).toHaveBeenCalledTimes(1)+ expect(mockEnqueueBotWakes).toHaveBeenCalledWith({+ recipients: ["u2", "u3"],+ channelId: "c1",+ messageRow: wakeMessageRow,+ })+ })++ it("fanOutToDM enqueues wakes with dmConversationId scope", async () => {+ mockGetDM.mockResolvedValue({ id: "dm1", user1Id: "u1", user2Id: "u2" })++ await fanOutToDM(+ "dm1",+ { type: WS_EVENTS.MESSAGE_CREATE, dmConversationId: "dm1", message: {} as never } as never,+ { excludeUserId: "u1", wakeMessageRow: { ...wakeMessageRow, channelId: null, dmConversationId: "dm1" } },+ )++ expect(mockEnqueueBotWakes).toHaveBeenCalledTimes(1)+ expect(mockEnqueueBotWakes).toHaveBeenCalledWith({+ recipients: ["u2"],+ dmConversationId: "dm1",+ messageRow: { ...wakeMessageRow, channelId: null, dmConversationId: "dm1" },+ })+ })++ it("does not enqueue wakes when wakeMessageRow is omitted", async () => {+ mockGetChannel.mockResolvedValue({ id: "c1", serverId: "srv_1" })+ mockListMemberUserIds.mockResolvedValue(["u1", "u2"])++ await fanOutToChannel("c1", {+ type: WS_EVENTS.MESSAGE_CREATE,+ channelId: "c1",+ message: {} as never,+ } as never)++ expect(mockEnqueueBotWakes).not.toHaveBeenCalled()+ })++ it("does not enqueue wakes for non-MESSAGE_CREATE events even with a wakeMessageRow", async () => {+ mockGetChannel.mockResolvedValue({ id: "c1", serverId: "srv_1" })+ mockListMemberUserIds.mockResolvedValue(["u1", "u2"])++ await fanOutToChannel(+ "c1",+ {+ type: WS_EVENTS.CHILD_CHANNEL_UPDATE,+ parentChannelId: "parent1",+ channelId: "c1",+ changes: { messageCount: 1, lastMessageAt: "2026-01-01T00:00:00.000Z" },+ } as never,+ { wakeMessageRow } as never,+ )++ expect(mockEnqueueBotWakes).not.toHaveBeenCalled()+ })++ it("a failing enqueueBotWakes does not reject fanOutToChannel", async () => {+ mockGetChannel.mockResolvedValue({ id: "c1", serverId: "srv_1" })+ mockListMemberUserIds.mockResolvedValue(["u1"])+ mockEnqueueBotWakes.mockRejectedValue(new Error("queue down"))++ await expect(+ fanOutToChannel(+ "c1",+ { type: WS_EVENTS.MESSAGE_CREATE, channelId: "c1", message: {} as never } as never,+ { wakeMessageRow },+ ),+ ).resolves.toBeUndefined()+ })+})+describe("fanout helpers absorb setup failures", () => {beforeEach(() => {vi.clearAllMocks()diff --git a/src/web/src/lib/community/fanout.ts b/src/web/src/lib/community/fanout.tsindex b4c765f0b..d76596867 100644--- a/src/web/src/lib/community/fanout.ts+++ b/src/web/src/lib/community/fanout.ts@@ -13,14 +13,25 @@*/import { getCloudflareContext } from "@opennextjs/cloudflare"-import { createDb, queries, createLogger } from "@alook/shared"+import { createDb, queries, createLogger, WS_EVENTS } from "@alook/shared"import type { CommunityWsEvent } from "@alook/shared"import { broadcastToUser } from "../broadcast"+import { enqueueBotWakes, type WakeMessageRow } from "./wake-producer"const log = createLogger({ service: "community-fanout" })type BroadcastableEvent = CommunityWsEvent & { type: string }+/**+ * Passed by `message-handler.ts` alongside a `MESSAGE_CREATE` event so+ * `fanOutToChannel`/`fanOutToDM` can trigger the push-wake pipeline (plan+ * §8) using the SAME recipient list already resolved for the human-WS+ * broadcast, instead of re-querying membership a second time. Omitted (or+ * event.type !== MESSAGE_CREATE) → no wake dispatch, e.g.+ * `CHILD_CHANNEL_UPDATE` never wakes anyone.+ */+type WakeOpts = { wakeMessageRow?: WakeMessageRow }+/*** Resolves all member user IDs for a server.*/@@ -46,13 +57,14 @@ async function getChannelRecipientUserIds(db: ReturnType<typeof createDb>, channexport async function fanOutToChannel(channelId: string,event: BroadcastableEvent,- opts?: { excludeUserId?: string }+ opts?: { excludeUserId?: string } & WakeOpts): Promise<void> {try {const { env } = getCloudflareContext()const db = createDb((env as Env).DB)const userIds = await getChannelRecipientUserIds(db, channelId)await broadcastToRecipients(userIds, event, opts?.excludeUserId)+ maybeEnqueueWakes(event, userIds, { channelId }, opts)} catch (err) {log.warn("fanout_to_channel_failed", {eventType: event.type,@@ -68,7 +80,7 @@ export async function fanOutToChannel(export async function fanOutToDM(dmConversationId: string,event: BroadcastableEvent,- opts?: { excludeUserId?: string }+ opts?: { excludeUserId?: string } & WakeOpts): Promise<void> {try {const { env } = getCloudflareContext()@@ -80,6 +92,7 @@ export async function fanOutToDM(}const userIds = [dm.user1Id, dm.user2Id].filter(Boolean) as string[]await broadcastToRecipients(userIds, event, opts?.excludeUserId)+ maybeEnqueueWakes(event, userIds, { dmConversationId }, opts)} catch (err) {log.warn("fanout_to_dm_failed", {eventType: event.type,@@ -89,6 +102,30 @@ export async function fanOutToDM(}}+/**+ * Wake dispatch only fires for real new-message events (plan §8) — reactions,+ * edits, pins, `CHILD_CHANNEL_UPDATE`, etc. never wake anyone. The sender is+ * excluded via the SAME `excludeUserId` the human-WS broadcast already used+ * (a bot never wakes itself off its own send). Never throws — `enqueueBotWakes`+ * owns its own error handling via `ctx.waitUntil`; this is best-effort on top.+ */+function maybeEnqueueWakes(+ event: BroadcastableEvent,+ recipients: string[],+ scope: { channelId: string } | { dmConversationId: string },+ opts?: { excludeUserId?: string } & WakeOpts+): void {+ if (event.type !== WS_EVENTS.MESSAGE_CREATE || !opts?.wakeMessageRow) return+ const filtered = opts.excludeUserId ? recipients.filter((id) => id !== opts.excludeUserId) : recipients+ enqueueBotWakes({+ recipients: filtered,+ ...scope,+ messageRow: opts.wakeMessageRow,+ }).catch((err) => {+ log.warn("enqueue_bot_wakes_from_fanout_failed", { err: String(err) })+ })+}+/*** Fan out an event to all members of a server.diff --git a/src/web/src/lib/community/message-handler.test.ts b/src/web/src/lib/community/message-handler.test.tsnew file mode 100644index 000000000..4f13a9f05--- /dev/null+++ b/src/web/src/lib/community/message-handler.test.ts@@ -0,0 +1,181 @@+import { describe, it, expect, vi, beforeEach } from "vitest"++const mockCreateMessage = vi.fn()+const mockGetMessage = vi.fn()+const mockGetUserInternal = vi.fn()+const mockCreateAttachment = vi.fn()+const mockListMembers = vi.fn()+const mockListMemberUserIds = vi.fn()+const mockCreateMentions = vi.fn()+const mockGetChannel = vi.fn()++vi.mock("@alook/shared", async () => {+ const actual = await vi.importActual<typeof import("@alook/shared")>("@alook/shared")+ return {+ ...actual,+ queries: {+ communityMessage: {+ createMessage: (...a: unknown[]) => mockCreateMessage(...a),+ getMessage: (...a: unknown[]) => mockGetMessage(...a),+ },+ communityAttachment: {+ createAttachment: (...a: unknown[]) => mockCreateAttachment(...a),+ },+ communityMember: {+ listMembers: (...a: unknown[]) => mockListMembers(...a),+ listMemberUserIds: (...a: unknown[]) => mockListMemberUserIds(...a),+ },+ communityMention: {+ createMentions: (...a: unknown[]) => mockCreateMentions(...a),+ },+ communityChannel: {+ getChannel: (...a: unknown[]) => mockGetChannel(...a),+ },+ user: {+ getUserInternal: (...a: unknown[]) => mockGetUserInternal(...a),+ },+ },+ }+})++const mockFanOutToChannel = vi.fn()+const mockFanOutToDM = vi.fn()+vi.mock("./fanout", () => ({+ fanOutToChannel: (...a: unknown[]) => mockFanOutToChannel(...a),+ fanOutToDM: (...a: unknown[]) => mockFanOutToDM(...a),+}))++const mockBroadcastToUser = vi.fn()+vi.mock("../broadcast", () => ({+ broadcastToUser: (...a: unknown[]) => mockBroadcastToUser(...a),+}))++const mockLogAudit = vi.fn()+vi.mock("./audit", async () => {+ const actual = await vi.importActual<typeof import("./audit")>("./audit")+ return {+ ...actual,+ logAudit: (...a: unknown[]) => mockLogAudit(...a),+ }+})++import { createCommunityMessage } from "./message-handler"++function messageRow(overrides: Partial<Record<string, unknown>> = {}) {+ return {+ id: "msg_1",+ authorId: "author_1",+ content: "hello",+ type: "default",+ mentionType: null,+ replyToId: null,+ embeds: null,+ flags: 0,+ createdAt: "2026-01-01T00:00:00.000Z",+ channelId: "c1",+ dmConversationId: null,+ seq: 7,+ authorName: "Author",+ authorEmail: "[email protected]",+ authorImage: null,+ ...overrides,+ }+}++describe("createCommunityMessage — audit relocation (plan §10)", () => {+ beforeEach(() => {+ vi.clearAllMocks()+ mockCreateMessage.mockResolvedValue({ id: "msg_1" })+ mockGetMessage.mockResolvedValue(messageRow())+ mockFanOutToChannel.mockResolvedValue(undefined)+ mockFanOutToDM.mockResolvedValue(undefined)+ mockBroadcastToUser.mockResolvedValue(undefined)+ })++ it("writes exactly ONE MESSAGE_AUTHORED_AS_BOT audit row for a bot author", async () => {+ mockGetUserInternal.mockResolvedValue({ id: "author_1", isBot: true, deletedAt: null })++ const result = await createCommunityMessage({+ db: {} as never,+ authorId: "author_1",+ target: { kind: "channel", channelId: "c1", serverId: "srv_1" },+ body: { content: "hello" },+ source: "cli",+ })++ expect(result.ok).toBe(true)+ expect(mockLogAudit).toHaveBeenCalledTimes(1)+ expect(mockLogAudit).toHaveBeenCalledWith(+ {},+ expect.objectContaining({+ serverId: "srv_1",+ actorId: "author_1",+ action: "community.message.authored_as_bot",+ targetType: "message",+ targetId: "msg_1",+ }),+ )+ const [, action] = mockLogAudit.mock.calls[0]!+ const changes = JSON.parse(action.changes)+ expect(changes).toEqual({+ botId: "author_1",+ target: "channel",+ targetId: "c1",+ messageId: "msg_1",+ source: "cli",+ })+ })++ it("does not write an audit row for a human author", async () => {+ mockGetUserInternal.mockResolvedValue({ id: "author_1", isBot: false, deletedAt: null })++ await createCommunityMessage({+ db: {} as never,+ authorId: "author_1",+ target: { kind: "channel", channelId: "c1", serverId: "srv_1" },+ body: { content: "hello" },+ })++ expect(mockLogAudit).not.toHaveBeenCalled()+ })++ it("defaults source to 'web' when omitted", async () => {+ mockGetUserInternal.mockResolvedValue({ id: "author_1", isBot: true, deletedAt: null })++ await createCommunityMessage({+ db: {} as never,+ authorId: "author_1",+ target: { kind: "channel", channelId: "c1", serverId: "srv_1" },+ body: { content: "hello" },+ })++ const [, action] = mockLogAudit.mock.calls[0]!+ expect(JSON.parse(action.changes).source).toBe("web")+ })++ it("DM target: serverId is null and targetId is the dmId", async () => {+ mockGetUserInternal.mockResolvedValue({ id: "author_1", isBot: true, deletedAt: null })+ mockGetMessage.mockResolvedValue(messageRow({ channelId: null, dmConversationId: "dm_1" }))++ await createCommunityMessage({+ db: {} as never,+ authorId: "author_1",+ target: { kind: "dm", dmId: "dm_1", otherUserId: "u2" },+ body: { content: "hello" },+ source: "daemon-http",+ })++ expect(mockLogAudit).toHaveBeenCalledWith(+ {},+ expect.objectContaining({ serverId: null }),+ )+ const [, action] = mockLogAudit.mock.calls[0]!+ expect(JSON.parse(action.changes)).toEqual({+ botId: "author_1",+ target: "dm",+ targetId: "dm_1",+ messageId: "msg_1",+ source: "daemon-http",+ })+ })+})diff --git a/src/web/src/lib/community/message-handler.ts b/src/web/src/lib/community/message-handler.tsindex af1a6d80a..537202c4b 100644--- a/src/web/src/lib/community/message-handler.ts+++ b/src/web/src/lib/community/message-handler.ts@@ -11,15 +11,16 @@ import type { Database } from "@alook/shared"import { fanOutToChannel, fanOutToDM } from "./fanout"import { broadcastToUser } from "../broadcast"import { mapMessageForWs } from "./message-payload"+import { logAudit, COMMUNITY_AUDIT_ACTIONS } from "./audit"export type MessageTarget =| { kind: "channel"; channelId: string; serverId: string }| {- kind: "thread"- channelId: string- parentChannelId: string- serverId: string- }+ kind: "thread"+ channelId: string+ parentChannelId: string+ serverId: string+ }| { kind: "dm"; dmId: string; otherUserId: string }type IncomingAttachment = {@@ -77,8 +78,10 @@ export async function createCommunityMessage(params: {authorId: stringtarget: MessageTargetbody: IncomingMessageBody+ /** Provenance tag threaded into the bot-authored audit row's `changes` (plan §10). */+ source?: "cli" | "daemon-http" | "web"}): Promise<CreateMessageResult> {- const { db, authorId, target, body } = params+ const { db, authorId, target, body, source } = paramsconst content = typeof body.content === "string" ? body.content : ""if (!content || content.trim().length === 0) {@@ -124,16 +127,16 @@ export async function createCommunityMessage(params: {const attachments: CreatedAttachment[] = incomingAttachments?.length? await Promise.all(- incomingAttachments.map((att) =>- queries.communityAttachment.createAttachment(db, {- messageId: created.id,- filename: att.filename,- url: att.url,- contentType: att.contentType,- size: att.size,- }),- ),- )+ incomingAttachments.map((att) =>+ queries.communityAttachment.createAttachment(db, {+ messageId: created.id,+ filename: att.filename,+ url: att.url,+ contentType: att.contentType,+ size: att.size,+ }),+ ),+ ): []const row = await queries.communityMessage.getMessage(db, created.id)@@ -143,6 +146,31 @@ export async function createCommunityMessage(params: {throw new Error("message not found after insert")}+ // Bot-authored audit (plan §10) — moved here from individual call sites+ // (the daemon bot-message route used to log this itself) so EVERY caller,+ // present and future (the CLI `send` route included), gets it for free+ // with no duplicate-call risk. There's no standalone `isBot()` helper in+ // the repo; this mirrors the check the daemon route did before its own+ // `logAudit` call was removed. Fire-and-forget — `logAudit` already+ // swallows its own errors.+ const author = await queries.user.getUserInternal(db, authorId)+ if (author?.isBot === true) {+ logAudit(db, {+ serverId: target.kind === "dm" ? null : target.serverId,+ actorId: authorId,+ action: COMMUNITY_AUDIT_ACTIONS.MESSAGE_AUTHORED_AS_BOT,+ targetType: "message",+ targetId: row.id,+ changes: JSON.stringify({+ botId: authorId,+ target: target.kind,+ targetId: target.kind === "dm" ? target.dmId : target.channelId,+ messageId: row.id,+ source: source ?? "web",+ }),+ })+ }+// Reply target for mention broadcasts. Scope-check against the current// target so a caller can't attach a preview of a message from a different// DM/channel by passing its id. The payload-side reply preview is built@@ -232,7 +260,7 @@ export async function createCommunityMessage(params: {messageId: row.id,...(channelIdForBroadcast ? { channelId: channelIdForBroadcast } : {}),authorName,- }).catch(() => {})+ }).catch(() => { })}}@@ -248,6 +276,21 @@ export async function createCommunityMessage(params: {})),})+ // Wake-dispatch row (plan §8) — the same `row` already fetched above via+ // `getMessage` (which now selects `seq`). Passed alongside the+ // MESSAGE_CREATE event so `fanOutToChannel`/`fanOutToDM` can enqueue bot+ // wakes using the SAME recipient list already resolved for the human-WS+ // broadcast, no second membership query.+ const wakeMessageRow = {+ id: row.id,+ seq: row.seq,+ authorId: row.authorId,+ content: row.content,+ createdAt: row.createdAt,+ channelId: row.channelId,+ dmConversationId: row.dmConversationId,+ }+if (target.kind === "dm") {fanOutToDM(target.dmId,@@ -256,14 +299,14 @@ export async function createCommunityMessage(params: {dmConversationId: target.dmId,message: messagePayload,},- { excludeUserId: authorId },- ).catch(() => {})+ { excludeUserId: authorId, wakeMessageRow },+ ).catch(() => { })broadcastToUser(target.otherUserId, {type: WS_EVENTS.DM_NEW_MESSAGE,dmConversationId: target.dmId,message: messagePayload,- }).catch(() => {})+ }).catch(() => { })} else {fanOutToChannel(target.channelId,@@ -272,8 +315,8 @@ export async function createCommunityMessage(params: {channelId: target.channelId,message: messagePayload,},- { excludeUserId: authorId },- ).catch(() => {})+ { excludeUserId: authorId, wakeMessageRow },+ ).catch(() => { })if (target.kind === "thread") {const updated = await queries.communityChannel.getChannel(@@ -293,7 +336,7 @@ export async function createCommunityMessage(params: {},},{ excludeUserId: authorId },- ).catch(() => {})+ ).catch(() => { })}}diff --git a/src/web/src/lib/community/resolve-ref.test.ts b/src/web/src/lib/community/resolve-ref.test.tsnew file mode 100644index 000000000..e713fc225--- /dev/null+++ b/src/web/src/lib/community/resolve-ref.test.ts@@ -0,0 +1,235 @@+import { describe, it, expect, vi, beforeEach } from "vitest"++const mockGetUserInternal = vi.fn()+const mockAreFriends = vi.fn()+const mockIsBlocked = vi.fn()+const mockCreateOrGetDM = vi.fn()+const mockGetDMBetween = vi.fn()+const mockResolveServerByNameForMember = vi.fn()+const mockResolveChannelByNameForMember = vi.fn()+const mockGetMessageByChannelAndSeq = vi.fn()+const mockGetThreadChannelByParentMessage = vi.fn()+const mockCreateThreadChannel = vi.fn()+const mockIsUniqueConstraintError = vi.fn(() => false)++vi.mock("@alook/shared", async () => {+ const actual = await vi.importActual<typeof import("@alook/shared")>("@alook/shared")+ return {+ ...actual,+ isUniqueConstraintError: (...a: unknown[]) => mockIsUniqueConstraintError(...a),+ queries: {+ user: { getUserInternal: (...a: unknown[]) => mockGetUserInternal(...a) },+ communityFriendship: {+ areFriends: (...a: unknown[]) => mockAreFriends(...a),+ isBlocked: (...a: unknown[]) => mockIsBlocked(...a),+ },+ communityDm: {+ createOrGetDM: (...a: unknown[]) => mockCreateOrGetDM(...a),+ getDMBetween: (...a: unknown[]) => mockGetDMBetween(...a),+ },+ communityServer: {+ resolveServerByNameForMember: (...a: unknown[]) => mockResolveServerByNameForMember(...a),+ },+ communityChannel: {+ resolveChannelByNameForMember: (...a: unknown[]) => mockResolveChannelByNameForMember(...a),+ getThreadChannelByParentMessage: (...a: unknown[]) => mockGetThreadChannelByParentMessage(...a),+ createThreadChannel: (...a: unknown[]) => mockCreateThreadChannel(...a),+ },+ communityMessage: {+ getMessageByChannelAndSeq: (...a: unknown[]) => mockGetMessageByChannelAndSeq(...a),+ },+ },+ }+})++import { resolveTargetForMember, resolveErrorResponse } from "./resolve-ref"++const db = {} as never++describe("resolveTargetForMember", () => {+ beforeEach(() => {+ vi.clearAllMocks()+ })++ it("400 malformed channel ref for a ref not starting with /", async () => {+ const res = await resolveTargetForMember(db, "u_1", "not-a-ref")+ expect(res).toEqual({ error: 400, message: "malformed channel ref" })+ })++ it("400 rejects a ref carrying a pinned #N message seq", async () => {+ const res = await resolveTargetForMember(db, "u_1", "/studio/general#5")+ expect(res).toMatchObject({ error: 400 })+ expect((res as { message: string }).message).toMatch(/must not pin/)+ })++ describe("DM refs (/.dm/<peer>)", () => {+ it("404 DM threads are not supported", async () => {+ const res = await resolveTargetForMember(db, "u_1", "/.dm/peer_1/#3")+ expect(res).toEqual({ error: 404, message: "DM threads are not supported" })+ })++ it("404 user not found when peer is missing or soft-deleted", async () => {+ mockGetUserInternal.mockResolvedValue(null)+ const res = await resolveTargetForMember(db, "u_1", "/.dm/peer_1")+ expect(res).toEqual({ error: 404, message: "user not found" })+ })++ it("without createDmIfMissing: 404 dm not found when no existing DM row", async () => {+ mockGetUserInternal.mockResolvedValue({ id: "peer_1", deletedAt: null })+ mockGetDMBetween.mockResolvedValue(null)+ const res = await resolveTargetForMember(db, "u_1", "/.dm/peer_1")+ expect(res).toEqual({ error: 404, message: "dm not found" })+ expect(mockCreateOrGetDM).not.toHaveBeenCalled()+ })++ it("without createDmIfMissing: resolves an existing DM without calling guardDmOpen", async () => {+ mockGetUserInternal.mockResolvedValue({ id: "peer_1", deletedAt: null })+ mockGetDMBetween.mockResolvedValue({ id: "dm_1" })+ const res = await resolveTargetForMember(db, "u_1", "/.dm/peer_1")+ expect(res).toEqual({ kind: "dm", dmConversationId: "dm_1", otherUserId: "peer_1" })+ expect(mockIsBlocked).not.toHaveBeenCalled()+ })++ it("with createDmIfMissing: blocked by guardDmOpen surfaces the guard's status/error", async () => {+ mockGetUserInternal.mockResolvedValue({ id: "peer_1", deletedAt: null })+ mockIsBlocked.mockResolvedValue(true)+ const res = await resolveTargetForMember(db, "u_1", "/.dm/peer_1", { createDmIfMissing: true })+ expect(res).toEqual({ error: 403, message: "blocked" })+ expect(mockCreateOrGetDM).not.toHaveBeenCalled()+ })++ it("with createDmIfMissing: creates/gets the DM when guard passes", async () => {+ mockGetUserInternal.mockResolvedValue({ id: "peer_1", deletedAt: null })+ mockIsBlocked.mockResolvedValue(false)+ mockCreateOrGetDM.mockResolvedValue({ id: "dm_new" })+ const res = await resolveTargetForMember(db, "u_1", "/.dm/peer_1", { createDmIfMissing: true })+ expect(res).toEqual({ kind: "dm", dmConversationId: "dm_new", otherUserId: "peer_1" })+ expect(mockCreateOrGetDM).toHaveBeenCalledWith(db, { userId1: "u_1", userId2: "peer_1" })+ })+ })++ describe("channel refs (/server/channel)", () => {+ it("404 server not found", async () => {+ mockResolveServerByNameForMember.mockResolvedValue([])+ const res = await resolveTargetForMember(db, "u_1", "/studio/general")+ expect(res).toEqual({ error: 404, message: "server not found: studio" })+ })++ it("400 ambiguous server name returns hint list", async () => {+ mockResolveServerByNameForMember.mockResolvedValue([{ id: "srv_1" }, { id: "srv_2" }])+ const res = await resolveTargetForMember(db, "u_1", "/studio/general")+ expect(res).toEqual({+ error: 400,+ message: "ambiguous server name",+ hint: [+ { id: "srv_1", path: "/srv_1/general" },+ { id: "srv_2", path: "/srv_2/general" },+ ],+ })+ })++ it("404 channel not found", async () => {+ mockResolveServerByNameForMember.mockResolvedValue([{ id: "srv_1" }])+ mockResolveChannelByNameForMember.mockResolvedValue([])+ const res = await resolveTargetForMember(db, "u_1", "/studio/general")+ expect(res).toEqual({ error: 404, message: "channel not found: general" })+ })++ it("400 ambiguous channel name returns hint list", async () => {+ mockResolveServerByNameForMember.mockResolvedValue([{ id: "srv_1" }])+ mockResolveChannelByNameForMember.mockResolvedValue([{ id: "ch_1" }, { id: "ch_2" }])+ const res = await resolveTargetForMember(db, "u_1", "/studio/general")+ expect(res).toEqual({+ error: 400,+ message: "ambiguous channel name",+ hint: [+ { id: "ch_1", path: "/srv_1/ch_1" },+ { id: "ch_2", path: "/srv_1/ch_2" },+ ],+ })+ })++ it("resolves a plain channel ref to { kind: channel, channelId }", async () => {+ mockResolveServerByNameForMember.mockResolvedValue([{ id: "srv_1" }])+ mockResolveChannelByNameForMember.mockResolvedValue([{ id: "ch_1" }])+ const res = await resolveTargetForMember(db, "u_1", "/studio/general")+ expect(res).toEqual({ kind: "channel", channelId: "ch_1" })+ })+ })++ describe("thread refs (/server/channel/#N)", () => {+ beforeEach(() => {+ mockResolveServerByNameForMember.mockResolvedValue([{ id: "srv_1" }])+ mockResolveChannelByNameForMember.mockResolvedValue([{ id: "ch_1" }])+ })++ it("404 when the root message (seq #N) doesn't exist", async () => {+ mockGetMessageByChannelAndSeq.mockResolvedValue(null)+ const res = await resolveTargetForMember(db, "u_1", "/studio/general/#7")+ expect(res).toEqual({ error: 404, message: "no message with seq #7 in this channel" })+ })++ it("resolves to the existing thread channel when one already exists", async () => {+ mockGetMessageByChannelAndSeq.mockResolvedValue({ id: "msg_1" })+ mockGetThreadChannelByParentMessage.mockResolvedValue({ id: "thread_1" })+ const res = await resolveTargetForMember(db, "u_1", "/studio/general/#7")+ expect(res).toEqual({ kind: "channel", channelId: "thread_1" })+ expect(mockCreateThreadChannel).not.toHaveBeenCalled()+ })++ it("404 thread not found when missing and createThreadIfMissing is false", async () => {+ mockGetMessageByChannelAndSeq.mockResolvedValue({ id: "msg_1" })+ mockGetThreadChannelByParentMessage.mockResolvedValue(null)+ const res = await resolveTargetForMember(db, "u_1", "/studio/general/#7")+ expect(res).toEqual({ error: 404, message: "thread not found" })+ })++ it("creates the thread channel when missing and createThreadIfMissing is true", async () => {+ mockGetMessageByChannelAndSeq.mockResolvedValue({ id: "msg_1" })+ mockGetThreadChannelByParentMessage.mockResolvedValue(null)+ mockCreateThreadChannel.mockResolvedValue({ id: "thread_new" })+ const res = await resolveTargetForMember(db, "u_1", "/studio/general/#7", { createThreadIfMissing: true })+ expect(res).toEqual({ kind: "channel", channelId: "thread_new" })+ expect(mockCreateThreadChannel).toHaveBeenCalledWith(db, "ch_1", "msg_1", "u_1")+ })++ it("on a lost create race (unique constraint), re-selects the winning thread", async () => {+ mockGetMessageByChannelAndSeq.mockResolvedValue({ id: "msg_1" })+ mockGetThreadChannelByParentMessage+ .mockResolvedValueOnce(null)+ .mockResolvedValueOnce({ id: "thread_winner" })+ mockCreateThreadChannel.mockRejectedValue(new Error("unique constraint failed"))+ mockIsUniqueConstraintError.mockReturnValue(true)+ const res = await resolveTargetForMember(db, "u_1", "/studio/general/#7", { createThreadIfMissing: true })+ expect(res).toEqual({ kind: "channel", channelId: "thread_winner" })+ })++ it("rethrows non-unique-constraint errors from createThreadChannel", async () => {+ mockGetMessageByChannelAndSeq.mockResolvedValue({ id: "msg_1" })+ mockGetThreadChannelByParentMessage.mockResolvedValue(null)+ mockCreateThreadChannel.mockRejectedValue(new Error("boom"))+ mockIsUniqueConstraintError.mockReturnValue(false)+ await expect(+ resolveTargetForMember(db, "u_1", "/studio/general/#7", { createThreadIfMissing: true })+ ).rejects.toThrow("boom")+ })+ })+})++describe("resolveErrorResponse", () => {+ it("maps error+message to a JSON response with matching status, no hint key when absent", async () => {+ const res = resolveErrorResponse({ error: 404, message: "not found" })+ expect(res.status).toBe(404)+ expect(await res.json()).toEqual({ error: "not found" })+ })++ it("includes hint when present", async () => {+ const res = resolveErrorResponse({+ error: 400,+ message: "ambiguous",+ hint: [{ id: "a", path: "/a/b" }],+ })+ expect(res.status).toBe(400)+ expect(await res.json()).toEqual({ error: "ambiguous", hint: [{ id: "a", path: "/a/b" }] })+ })+})diff --git a/src/web/src/lib/community/resolve-ref.ts b/src/web/src/lib/community/resolve-ref.tsnew file mode 100644index 000000000..29e4d6fca--- /dev/null+++ b/src/web/src/lib/community/resolve-ref.ts@@ -0,0 +1,159 @@+import { NextResponse } from "next/server"+import { queries, parseRef, DM_SERVER } from "@alook/shared"+import type { Database } from "@alook/shared"+import { isUniqueConstraintError } from "@alook/shared"+import { guardDmOpen } from "./dm-guard"++export type TargetResolution =+ | { kind: "channel"; channelId: string }+ | { kind: "dm"; dmConversationId: string; otherUserId: string }+ | { error: 400 | 403 | 404; message: string; hint?: Array<{ id: string; path: string }> }++export interface ResolveTargetOpts {+ /** `send` only — auto-creates the DM row (guarded by `guardDmOpen`) if missing. */+ createDmIfMissing?: boolean+ /** `send` only — auto-creates the thread channel row if missing. */+ createThreadIfMissing?: boolean+ /** Threaded into `guardDmOpen` when `createDmIfMissing` — default "human". */+ callerKind?: "human" | "bot"+}++/**+ * Resolve a CLI path ref (`ChannelRef`, e.g. `/studio/general`,+ * `/studio/general/#42`, `/.dm/user_123`) to a concrete channel/DM id,+ * scoped to `userId`'s memberships. Threads flatten to `{ kind: "channel",+ * channelId: <thread's own id> }` (debt #10 — threads ARE channels); the+ * caller (the `send` route) is responsible for reconstructing the full+ * `MessageTarget` (`kind: "thread"` with `parentChannelId`) before calling+ * `createCommunityMessage` — see plan §5's "MessageTarget reconstruction"+ * note, this function intentionally does NOT do that itself.+ *+ * Ambiguity (debt #5) is not a hard error: if a server/channel NAME matches+ * more than one candidate, this returns `{ error: 400, hint: [...] }` so the+ * agent can pick. `createDmIfMissing`/`createThreadIfMissing` are both+ * `true` for `send` only — every other route passes `false` so a stale ref+ * never materializes a DM/thread row as a side effect of a read.+ */+export async function resolveTargetForMember(+ db: Database,+ userId: string,+ ref: string,+ opts?: ResolveTargetOpts+): Promise<TargetResolution> {+ let parsed: ReturnType<typeof parseRef>+ try {+ parsed = parseRef(ref)+ } catch {+ return { error: 400, message: "malformed channel ref" }+ }++ // Message-pin form (`/server/channel#N`) has no use in this API surface —+ // every endpoint that needs to pin a message takes a separate `seq` field+ // (`resolve`, `read`). Reject rather than silently ignoring the `#N`.+ if (parsed.seq !== undefined) {+ return { error: 400, message: "channel ref must not pin a specific message (#N) — use a separate seq field" }+ }++ if (parsed.server === DM_SERVER) {+ if (parsed.threadRootSeq !== undefined) {+ // DM messages have no channelId, so they can't be a thread's+ // parentChannelId (community_channel.parentChannelId always+ // references another community_channel) — not modeled today.+ return { error: 404, message: "DM threads are not supported" }+ }++ const peerId = parsed.channel+ const peer = await queries.user.getUserInternal(db, peerId)+ if (!peer || peer.deletedAt !== null) {+ return { error: 404, message: "user not found" }+ }++ if (opts?.createDmIfMissing) {+ const guard = await guardDmOpen(db, userId, peerId, { callerKind: opts.callerKind })+ if (!guard.ok) return { error: guard.status, message: guard.error }+ const dm = await queries.communityDm.createOrGetDM(db, { userId1: userId, userId2: peerId })+ return { kind: "dm", dmConversationId: dm.id, otherUserId: peerId }+ }++ const dm = await queries.communityDm.getDMBetween(db, userId, peerId)+ if (!dm) return { error: 404, message: "dm not found" }+ return { kind: "dm", dmConversationId: dm.id, otherUserId: peerId }+ }++ // Channel form: resolve server, then channel, both scoped to membership.+ const servers = await queries.communityServer.resolveServerByNameForMember(db, userId, parsed.server)+ if (servers.length === 0) return { error: 404, message: `server not found: ${parsed.server}` }+ if (servers.length > 1) {+ return {+ error: 400,+ message: "ambiguous server name",+ hint: servers.map((s) => ({ id: s.id, path: `/${s.id}/${parsed.channel}` })),+ }+ }+ const serverId = servers[0]!.id++ const channels = await queries.communityChannel.resolveChannelByNameForMember(db, serverId, userId, parsed.channel)+ if (channels.length === 0) return { error: 404, message: `channel not found: ${parsed.channel}` }+ if (channels.length > 1) {+ return {+ error: 400,+ message: "ambiguous channel name",+ hint: channels.map((c) => ({ id: c.id, path: `/${serverId}/${c.id}` })),+ }+ }+ const channel = channels[0]!++ if (parsed.threadRootSeq === undefined) {+ return { kind: "channel", channelId: channel.id }+ }++ // Thread form (`/server/channel/#N`) — translate the root seq to the+ // parent message's id, then find (or create) the thread's own channel row.+ const rootMessage = await queries.communityMessage.getMessageByChannelAndSeq(+ db,+ { channelId: channel.id },+ parsed.threadRootSeq+ )+ if (!rootMessage || parsed.threadRootSeq === 0) {+ return { error: 404, message: `no message with seq #${parsed.threadRootSeq} in this channel` }+ }++ const existingThread = await queries.communityChannel.getThreadChannelByParentMessage(+ db,+ channel.id,+ rootMessage.id+ )+ if (existingThread) return { kind: "channel", channelId: existingThread.id }++ if (!opts?.createThreadIfMissing) {+ return { error: 404, message: "thread not found" }+ }++ try {+ const created = await queries.communityChannel.createThreadChannel(db, channel.id, rootMessage.id, userId)+ return { kind: "channel", channelId: created.id }+ } catch (err) {+ if (isUniqueConstraintError(err)) {+ // Lost the race to a concurrent thread-create — re-select the winner.+ const winner = await queries.communityChannel.getThreadChannelByParentMessage(db, channel.id, rootMessage.id)+ if (winner) return { kind: "channel", channelId: winner.id }+ }+ throw err+ }+}++/**+ * Convert a `resolveTargetForMember` error branch into the JSON error+ * response every agent route returns for it — shared so `send`/`ack`/`read`/+ * `resolve` don't each hand-roll the `{ error, hint? }` shape independently.+ * Callers narrow `resolved` to the error branch (`"error" in resolved`)+ * before calling this.+ */+export function resolveErrorResponse(+ resolved: Extract<TargetResolution, { error: 400 | 403 | 404 }>+): NextResponse {+ return NextResponse.json(+ { error: resolved.message, ...(resolved.hint ? { hint: resolved.hint } : {}) },+ { status: resolved.error }+ )+}diff --git a/src/web/src/lib/community/wake-producer.test.ts b/src/web/src/lib/community/wake-producer.test.tsnew file mode 100644index 000000000..97785781d--- /dev/null+++ b/src/web/src/lib/community/wake-producer.test.ts@@ -0,0 +1,184 @@+import { describe, it, expect, vi, beforeEach } from "vitest"++const mockCtxWaitUntil = vi.fn((p: Promise<unknown>) => p)+const mockGetCloudflareContext = vi.fn(() => ({+ env: { DB: {}, WAKE_QUEUE: { sendBatch: mockSendBatch } },+ ctx: { waitUntil: mockCtxWaitUntil },+}))+vi.mock("@opennextjs/cloudflare", () => ({+ getCloudflareContext: (...a: unknown[]) => mockGetCloudflareContext(...(a as [])),+}))++const mockSendBatch = vi.fn(async () => { })+const mockFindWakeCandidates = vi.fn()+const mockToAgentMessage = vi.fn()+const mockWarn = vi.fn()++vi.mock("@alook/shared", async () => {+ const actual = await vi.importActual<typeof import("@alook/shared")>("@alook/shared")+ return {+ ...actual,+ createDb: vi.fn(() => ({})),+ createLogger: () => ({ info: vi.fn(), warn: (...a: unknown[]) => mockWarn(...a), error: vi.fn(), debug: vi.fn() }),+ queries: {+ communityBot: {+ findWakeCandidates: (...a: unknown[]) => mockFindWakeCandidates(...a),+ },+ communityAgentInbox: {+ toAgentMessage: (...a: unknown[]) => mockToAgentMessage(...a),+ },+ },+ }+})++import { enqueueBotWakes } from "./wake-producer"++const messageRow = {+ id: "msg_1",+ seq: 7,+ authorId: "human_1",+ content: "hello",+ createdAt: "2026-01-01T00:00:00.000Z",+ channelId: "c1",+ dmConversationId: null,+}++describe("enqueueBotWakes", () => {+ beforeEach(() => {+ vi.clearAllMocks()+ mockSendBatch.mockResolvedValue(undefined)+ mockToAgentMessage.mockResolvedValue({+ seq: "#7",+ channel: "/studio/general",+ sender: "@human",+ content: { text: "hello" },+ time: messageRow.createdAt,+ })+ })++ it("no-ops when recipients is empty — never queries or enqueues", async () => {+ await enqueueBotWakes({ recipients: [], channelId: "c1", messageRow })++ expect(mockFindWakeCandidates).not.toHaveBeenCalled()+ expect(mockSendBatch).not.toHaveBeenCalled()+ })++ it("no-ops when no candidates are behind — zero sendBatch calls, not an empty one", async () => {+ mockFindWakeCandidates.mockResolvedValue([])++ await enqueueBotWakes({ recipients: ["bot1"], channelId: "c1", messageRow })++ expect(mockSendBatch).not.toHaveBeenCalled()+ })++ it("builds a HostCommand per candidate and sends a single batch", async () => {+ mockFindWakeCandidates.mockResolvedValue([+ { botUserId: "bot1", name: "zoe", machineId: "m1", runtime: "claude" },+ { botUserId: "bot2", name: "kai", machineId: "m2", runtime: "codex" },+ ])++ await enqueueBotWakes({ recipients: ["bot1", "bot2"], channelId: "c1", messageRow })++ expect(mockFindWakeCandidates).toHaveBeenCalledWith(+ {},+ { recipients: ["bot1", "bot2"], channelId: "c1", dmConversationId: undefined, newSeq: 7 },+ )+ expect(mockSendBatch).toHaveBeenCalledTimes(1)+ const [messages] = mockSendBatch.mock.calls[0]!+ expect(messages).toHaveLength(2)+ expect(messages[0].body.botUserId).toBe("bot1")+ expect(messages[0].body.machineId).toBe("m1")+ expect(messages[0].body.command.type).toBe("agent:start")+ expect(messages[0].body.command.agentId).toBe("bot1")+ expect(messages[0].body.command.config.runtime).toBe("claude")+ expect(messages[0].body.command.wakeMessage).toEqual({+ seq: "#7",+ channel: "/studio/general",+ sender: "@human",+ content: { text: "hello" },+ time: messageRow.createdAt,+ })+ expect(messages[1].body.botUserId).toBe("bot2")+ })++ it("hydrates wakeMessage once (viewer = first candidate), not once per candidate", async () => {+ mockFindWakeCandidates.mockResolvedValue([+ { botUserId: "bot1", name: "zoe", machineId: "m1", runtime: "claude" },+ { botUserId: "bot2", name: "kai", machineId: "m2", runtime: "codex" },+ { botUserId: "bot3", name: "ivy", machineId: "m3", runtime: "gemini" },+ ])++ await enqueueBotWakes({ recipients: ["bot1", "bot2", "bot3"], channelId: "c1", messageRow })++ expect(mockToAgentMessage).toHaveBeenCalledTimes(1)+ expect(mockToAgentMessage).toHaveBeenCalledWith({}, { ...messageRow, content: "hello" }, "bot1")+ })++ it("chunks into 100-message sendBatch slices for large fanouts", async () => {+ const candidates = Array.from({ length: 250 }, (_, i) => ({+ botUserId: `bot${i}`,+ name: `bot${i}`,+ machineId: `m${i}`,+ runtime: "claude",+ }))+ mockFindWakeCandidates.mockResolvedValue(candidates)++ await enqueueBotWakes({+ recipients: candidates.map((c) => c.botUserId),+ channelId: "c1",+ messageRow,+ })++ expect(mockSendBatch).toHaveBeenCalledTimes(3)+ expect(mockSendBatch.mock.calls[0]![0]).toHaveLength(100)+ expect(mockSendBatch.mock.calls[1]![0]).toHaveLength(100)+ expect(mockSendBatch.mock.calls[2]![0]).toHaveLength(50)+ })++ it("partial chunk failure: sibling chunks still enqueue, failure is logged, call does not throw", async () => {+ const candidates = Array.from({ length: 250 }, (_, i) => ({+ botUserId: `bot${i}`,+ name: `bot${i}`,+ machineId: `m${i}`,+ runtime: "claude",+ }))+ mockFindWakeCandidates.mockResolvedValue(candidates)+ mockSendBatch+ .mockResolvedValueOnce(undefined)+ .mockRejectedValueOnce(new Error("queue unavailable"))+ .mockResolvedValueOnce(undefined)++ await expect(+ enqueueBotWakes({ recipients: candidates.map((c) => c.botUserId), channelId: "c1", messageRow }),+ ).resolves.toBeUndefined()++ expect(mockSendBatch).toHaveBeenCalledTimes(3)+ expect(mockWarn).toHaveBeenCalledWith(+ "wake_batch_chunk_failed",+ expect.objectContaining({+ botIds: candidates.slice(100, 200).map((c) => c.botUserId),+ err: expect.stringContaining("queue unavailable"),+ }),+ )+ })++ it("registers ctx.waitUntil synchronously and does not require the caller to await", async () => {+ mockFindWakeCandidates.mockResolvedValue([+ { botUserId: "bot1", name: "zoe", machineId: "m1", runtime: "claude" },+ ])++ const promise = enqueueBotWakes({ recipients: ["bot1"], channelId: "c1", messageRow })+ expect(mockCtxWaitUntil).toHaveBeenCalledTimes(1)+ await promise+ })++ it("falls back to running standalone (no throw) when not in a CF request context", async () => {+ mockGetCloudflareContext.mockImplementationOnce(() => ({+ env: { DB: {}, WAKE_QUEUE: { sendBatch: mockSendBatch } },+ ctx: { waitUntil: () => { throw new Error("no request context") } },+ }))+ mockFindWakeCandidates.mockResolvedValue([])++ await expect(enqueueBotWakes({ recipients: ["bot1"], channelId: "c1", messageRow })).resolves.toBeUndefined()+ })+})diff --git a/src/web/src/lib/community/wake-producer.ts b/src/web/src/lib/community/wake-producer.tsnew file mode 100644index 000000000..459b70bb6--- /dev/null+++ b/src/web/src/lib/community/wake-producer.ts@@ -0,0 +1,126 @@+/**+ * Push-wake producer (plan §8) — after a message lands and the human-WS+ * fanout has broadcast it, this filters the fanout's recipient set down to+ * "bots that are actually behind on this scope" and enqueues one+ * `WAKE_QUEUE` payload per candidate, each carrying a fully-built+ * `HostCommand` (`agent:start`). The `alook-wake-worker` consumer (separate+ * deploy unit) is a dumb forwarder with no D1 access — all the D1-backed+ * construction (bot name/runtime/machine, `toAgentMessage` hydration)+ * happens HERE, where the D1 binding actually lives.+ */+import { getCloudflareContext } from "@opennextjs/cloudflare"+import { createDb, queries, createLogger, makeRuntimeConfig } from "@alook/shared"+import type { HostCommand, WakePayload } from "@alook/shared"+import { nanoid } from "nanoid"++const log = createLogger({ service: "community-wake-producer" })++// Cloudflare Queues caps a single `sendBatch` call at 100 messages.+const QUEUE_BATCH_SIZE = 100++/** The just-inserted message row — must include `seq` (see `getMessage`'s select). */+export interface WakeMessageRow {+ id: string+ seq: number+ authorId: string+ content: string | null+ createdAt: string+ channelId: string | null+ dmConversationId: string | null+}++export interface EnqueueBotWakesOpts {+ /** Every fanout recipient (human + bot) — this function does its own bot/unread filtering. */+ recipients: string[]+ channelId?: string+ dmConversationId?: string+ messageRow: WakeMessageRow+}++/**+ * Fire-and-forget from the caller's perspective, but NOT actually+ * fire-and-forget under the hood: this function acquires the Cloudflare+ * context and registers `ctx.waitUntil(...)` synchronously in its own first+ * tick (before any `await`), so the enclosing request's response can be+ * written and the isolate can still be kept alive long enough for the+ * `sendBatch` calls to land. Callers MUST invoke this before the response is+ * sent (same requirement as `broadcastToUser`/`fanOutToChannel`) — calling it+ * after the response has already been returned risks the `waitUntil`+ * registration being dropped.+ */+export function enqueueBotWakes(opts: EnqueueBotWakesOpts): Promise<void> {+ const { env, ctx } = getCloudflareContext()+ const promise = doEnqueueBotWakes(env as Env, opts)+ try {+ ctx.waitUntil(promise.catch((err) => {+ log.warn("enqueue_bot_wakes_failed", { err: String(err) })+ }))+ } catch {+ // Not in a CF request context (e.g. some test harnesses) — the promise+ // still runs to completion on its own.+ }+ return promise+}++async function doEnqueueBotWakes(env: Env, opts: EnqueueBotWakesOpts): Promise<void> {+ const { recipients, channelId, dmConversationId, messageRow } = opts+ if (recipients.length === 0) return++ const db = createDb(env.DB)+ const candidates = await queries.communityBot.findWakeCandidates(db, {+ recipients,+ channelId,+ dmConversationId,+ newSeq: messageRow.seq,+ })+ if (candidates.length === 0) return++ // Channel refs don't depend on `viewerId` at all; DM refs do, but a DM+ // scope only ever has (at most) one bot candidate since a DM has exactly+ // two participants — either way, hydrating once with the first+ // candidate's identity is correct and avoids N redundant DB round-trips.+ const wakeMessage = await queries.communityAgentInbox.toAgentMessage(+ db,+ { ...messageRow, content: messageRow.content ?? "" },+ candidates[0]!.botUserId+ )++ const payloads: WakePayload[] = candidates.map((c) => {+ // Known, accepted gap (plan §8): `community_bot_binding` stores only a+ // bare `runtime` string today — no model/mode/provider/instruction+ // columns exist yet. Bots wake with runtime-default model/mode and no+ // custom instruction until a future "bot profile config" feature adds+ // those columns; this is not an oversight.+ const config = makeRuntimeConfig({+ runtime: c.runtime,+ agentName: c.name ?? c.botUserId,+ agentHandle: `@${c.name ?? c.botUserId}`,+ })+ const command: HostCommand = {+ type: "agent:start",+ agentId: c.botUserId,+ config,+ launchId: nanoid(),+ wakeMessage,+ }+ return { botUserId: c.botUserId, machineId: c.machineId, command }+ })++ const chunks: WakePayload[][] = []+ for (let i = 0; i < payloads.length; i += QUEUE_BATCH_SIZE) {+ chunks.push(payloads.slice(i, i + QUEUE_BATCH_SIZE))+ }++ const results = await Promise.allSettled(+ chunks.map((chunk) => env.WAKE_QUEUE.sendBatch(chunk.map((body) => ({ body }))))+ )+ for (let i = 0; i < results.length; i++) {+ const r = results[i]!+ if (r.status === "rejected") {+ log.warn("wake_batch_chunk_failed", {+ botIds: chunks[i]!.map((p) => p.botUserId),+ err: String(r.reason),+ })+ }+ }+}diff --git a/src/web/src/lib/middleware/community-agent-runner-auth.test.ts b/src/web/src/lib/middleware/community-agent-runner-auth.test.tsnew file mode 100644index 000000000..c17e719ad--- /dev/null+++ b/src/web/src/lib/middleware/community-agent-runner-auth.test.ts@@ -0,0 +1,122 @@+import { describe, it, expect, vi, beforeEach } from "vitest"+import { NextRequest, NextResponse } from "next/server"++vi.mock("@opennextjs/cloudflare", () => ({+ getCloudflareContext: vi.fn(async () => ({ env: { DB: {} } })),+}))++vi.mock("@/lib/db", () => ({ getDb: vi.fn(() => ({})) }))++const mockFindActiveAgentRunnerKeyByBearer = vi.fn()+const mockGetUserInternal = vi.fn()+const mockGetBotBinding = vi.fn()+vi.mock("@alook/shared", () => ({+ queries: {+ communityMachine: {+ findActiveAgentRunnerKeyByBearer: (...a: unknown[]) => mockFindActiveAgentRunnerKeyByBearer(...a),+ },+ user: {+ getUserInternal: (...a: unknown[]) => mockGetUserInternal(...a),+ },+ communityBot: {+ getBotBinding: (...a: unknown[]) => mockGetBotBinding(...a),+ },+ },+}))++import { withAgentRunnerAuth } from "./community-agent-runner-auth"++const handler = vi.fn(async (_req: NextRequest, ctx: any) => NextResponse.json({ ok: true, ctx }))++describe("withAgentRunnerAuth", () => {+ beforeEach(() => {+ vi.clearAllMocks()+ })++ const wrapped = withAgentRunnerAuth(handler)++ it("rejects when Authorization is missing", async () => {+ const req = new NextRequest("http://localhost/x")+ const res = await wrapped(req)+ expect(res.status).toBe(401)+ expect(await res.json()).toEqual({ error: "missing or malformed Authorization header" })+ })++ it("rejects a non-crk_ bearer without querying the DB", async () => {+ const req = new NextRequest("http://localhost/x", { headers: { Authorization: "Bearer sk_something" } })+ const res = await wrapped(req)+ expect(res.status).toBe(401)+ expect(mockFindActiveAgentRunnerKeyByBearer).not.toHaveBeenCalled()+ })++ it("rejects a revoked/unknown crk_ key", async () => {+ mockFindActiveAgentRunnerKeyByBearer.mockResolvedValue(null)+ const req = new NextRequest("http://localhost/x", { headers: { Authorization: "Bearer crk_unknown" } })+ const res = await wrapped(req)+ expect(res.status).toBe(401)+ expect(await res.json()).toEqual({ error: "runner key revoked or unknown" })+ })++ it("rejects when the bot user is missing, not a bot, or soft-deleted", async () => {+ mockFindActiveAgentRunnerKeyByBearer.mockResolvedValue({+ userId: "owner_1",+ machineId: "m_1",+ agentId: "bot_1",+ })+ for (const badUser of [null, { isBot: false, deletedAt: null }, { isBot: true, deletedAt: "2026-01-01" }]) {+ mockGetUserInternal.mockResolvedValue(badUser)+ const req = new NextRequest("http://localhost/x", { headers: { Authorization: "Bearer crk_abc" } })+ const res = await wrapped(req)+ expect(res.status).toBe(401)+ expect(await res.json()).toEqual({ error: "bot not found or inactive" })+ }+ expect(mockGetBotBinding).not.toHaveBeenCalled()+ })++ it("rejects on binding machine mismatch", async () => {+ mockFindActiveAgentRunnerKeyByBearer.mockResolvedValue({+ userId: "owner_1",+ machineId: "m_1",+ agentId: "bot_1",+ })+ mockGetUserInternal.mockResolvedValue({ isBot: true, deletedAt: null })+ mockGetBotBinding.mockResolvedValue({ machineId: "m_OTHER", runtime: "claude" })+ const req = new NextRequest("http://localhost/x", { headers: { Authorization: "Bearer crk_abc" } })+ const res = await wrapped(req)+ expect(res.status).toBe(401)+ expect(await res.json()).toEqual({ error: "bot binding mismatch" })+ })++ it("rejects when no binding exists at all", async () => {+ mockFindActiveAgentRunnerKeyByBearer.mockResolvedValue({+ userId: "owner_1",+ machineId: "m_1",+ agentId: "bot_1",+ })+ mockGetUserInternal.mockResolvedValue({ isBot: true, deletedAt: null })+ mockGetBotBinding.mockResolvedValue(null)+ const req = new NextRequest("http://localhost/x", { headers: { Authorization: "Bearer crk_abc" } })+ const res = await wrapped(req)+ expect(res.status).toBe(401)+ })++ it("populates ctx { botUserId, ownerUserId, machineId } on a valid crk_ for a live bot on the right machine", async () => {+ mockFindActiveAgentRunnerKeyByBearer.mockResolvedValue({+ userId: "owner_1",+ machineId: "m_1",+ agentId: "bot_1",+ })+ mockGetUserInternal.mockResolvedValue({ isBot: true, deletedAt: null })+ mockGetBotBinding.mockResolvedValue({ machineId: "m_1", runtime: "claude" })+ const req = new NextRequest("http://localhost/x", { headers: { Authorization: "Bearer crk_abc" } })+ const res = await wrapped(req)+ expect(res.status).toBe(200)+ const body = (await res.json()) as { ctx: any }+ // Field mapping must not be inverted: row.agentId → botUserId, row.userId → ownerUserId.+ expect(body.ctx).toMatchObject({+ botUserId: "bot_1",+ ownerUserId: "owner_1",+ machineId: "m_1",+ })+ })+})diff --git a/src/web/src/lib/middleware/community-agent-runner-auth.ts b/src/web/src/lib/middleware/community-agent-runner-auth.tsnew file mode 100644index 000000000..61c005565--- /dev/null+++ b/src/web/src/lib/middleware/community-agent-runner-auth.ts@@ -0,0 +1,87 @@+import { NextRequest, NextResponse } from "next/server"+import { getCloudflareContext } from "@opennextjs/cloudflare"+import { queries } from "@alook/shared"+import { getDb } from "@/lib/db"++export interface AgentRunnerAuthContext {+ env: Env+ /** The BOT's own user id — `row.agentId` from `findActiveAgentRunnerKeyByBearer`. */+ botUserId: string+ /** The bot's OWNER (the human who ran `mintAgentRunnerKey`) — `row.userId`. */+ ownerUserId: string+ machineId: string+}++export type AgentRunnerAuthenticatedHandler = (+ req: NextRequest,+ ctx: AgentRunnerAuthContext & { params?: Record<string, string> }+) => Promise<NextResponse | Response>++/**+ * Agent-runner auth middleware for the CLI bridge (`/api/community/agent/*`).+ * Requires `Authorization: Bearer crk_…`. Cloned from `withCommunityDaemonAuth`+ * but needs BOTH a bot identity and an owner identity — both come off the+ * single `findActiveAgentRunnerKeyByBearer` row, no extra DB call required.+ *+ * Field mapping (do not invert): `row.userId` is the bot's OWNER;+ * `row.agentId` is the BOT's own user id. `row.doName` here is the runner+ * key's own DO-hash, unrelated to wake dispatch — never threaded through.+ *+ * Steps (plan §2):+ * 1. Extract `Bearer <token>`; reject non-`crk_` → 401.+ * 2. `findActiveAgentRunnerKeyByBearer` → 401 on null.+ * 3. `getUserInternal(row.agentId)` → 401 if null, `!isBot`, or soft-deleted.+ * 4. `getBotBinding(row.agentId)` → 401 if null or machine mismatch+ * (belt-and-braces; `getBotBinding` returns no owner of its own).+ *+ * Handlers must NEVER read `X-Agent-Id` or a body `agentId` — identity is+ * always `ctx.botUserId` from this middleware.+ */+export function withAgentRunnerAuth(handler: AgentRunnerAuthenticatedHandler) {+ return async (+ req: NextRequest,+ context?: { params?: Promise<Record<string, string>> | Record<string, string> }+ ) => {+ const resolvedParams = context?.params+ ? context.params instanceof Promise+ ? await context.params+ : context.params+ : undefined++ const authHeader = req.headers.get("Authorization")+ if (!authHeader || !authHeader.startsWith("Bearer ")) {+ return NextResponse.json({ error: "missing or malformed Authorization header" }, { status: 401 })+ }+ const raw = authHeader.slice(7).trim()+ if (!raw.startsWith("crk_")) {+ return NextResponse.json({ error: "invalid runner key" }, { status: 401 })+ }++ const { env } = await getCloudflareContext({ async: true })+ const cloudflareEnv = env as Env+ const db = getDb(cloudflareEnv.DB)++ const row = await queries.communityMachine.findActiveAgentRunnerKeyByBearer(db, raw)+ if (!row) {+ return NextResponse.json({ error: "runner key revoked or unknown" }, { status: 401 })+ }++ const botUser = await queries.user.getUserInternal(db, row.agentId)+ if (!botUser || !botUser.isBot || botUser.deletedAt !== null) {+ return NextResponse.json({ error: "bot not found or inactive" }, { status: 401 })+ }++ const binding = await queries.communityBot.getBotBinding(db, row.agentId)+ if (!binding || binding.machineId !== row.machineId) {+ return NextResponse.json({ error: "bot binding mismatch" }, { status: 401 })+ }++ return handler(req, {+ env: cloudflareEnv,+ botUserId: row.agentId,+ ownerUserId: row.userId,+ machineId: row.machineId,+ params: resolvedParams,+ })+ }+}diff --git a/src/web/wrangler.toml b/src/web/wrangler.tomlindex 734e4b405..c6a966ab4 100644--- a/src/web/wrangler.toml+++ b/src/web/wrangler.toml@@ -71,6 +71,12 @@ service = "alook-ws-do"binding = "EMAIL_WORKER"service = "alook-email-worker"+# Bot wake-on-unread producer — see plans/community-agent-cli-bridge.md §8.+# Consumer is the separate `alook-wake-worker` (src/wake-worker).+[[queues.producers]]+binding = "WAKE_QUEUE"+queue = "alook-wake"+[[kv_namespaces]]binding = "RATE_LIMIT_KV"id = "a3d035bea7bc49d99377b82ec21ce4c1"diff --git a/src/ws-do/src/index.test.ts b/src/ws-do/src/index.test.tsindex aebe28571..d3123fc49 100644--- a/src/ws-do/src/index.test.ts+++ b/src/ws-do/src/index.test.ts@@ -3,14 +3,15 @@ import { createMockDONamespace } from "./__mocks__/cf"// Mock ws-durable so the router import doesn't pull in cloudflare:workersvi.mock("./ws-durable", () => ({- WebSocketDurableObject: class {},+ WebSocketDurableObject: class { },}))const mockHashCredential = vi.fn(async (bearer: string) => `sha256:${bearer}`)const mockDoNameFromHash = vi.fn((hash: string) => hash.slice(0, 32))+const mockGetActiveDoNamesForMachine = vi.fn(async (_db: unknown, _machineId: string) => [] as string[])vi.mock("@alook/shared", () => {- const noopLogger = { debug: () => {}, info: () => {}, warn: () => {}, error: () => {}, child(){ return this } }+ const noopLogger = { debug: () => { }, info: () => { }, warn: () => { }, error: () => { }, child() { return this } }return {createDb: () => ({}),createLogger: () => noopLogger,@@ -18,6 +19,7 @@ vi.mock("@alook/shared", () => {communityMachine: {hashCredential: (bearer: string) => mockHashCredential(bearer),doNameFromHash: (hash: string) => mockDoNameFromHash(hash),+ getActiveDoNamesForMachine: (db: unknown, machineId: string) => mockGetActiveDoNamesForMachine(db, machineId),},},}@@ -260,6 +262,145 @@ describe("ws-do router", () => {})})+ describe("POST /community-machine/by-id/:machineId/forward-agent-start", () => {+ beforeEach(() => {+ mockGetActiveDoNamesForMachine.mockReset()+ mockGetActiveDoNamesForMachine.mockResolvedValue([])+ })++ it("zero active doNames → { sent: 0 } without touching any DO", async () => {+ const req = new Request("http://localhost/community-machine/by-id/machine-1/forward-agent-start", {+ method: "POST",+ body: JSON.stringify({ type: "agent:start" }),+ })+ const res = await handler.fetch(req, env as any)++ expect(mockGetActiveDoNamesForMachine).toHaveBeenCalledWith({}, "machine-1")+ expect(res.status).toBe(200)+ expect(await res.json()).toEqual({ sent: 0 })+ expect(doMock.stubFetch).not.toHaveBeenCalled()+ })++ it("single active doName, daemon connected → forwards and aggregates sent count", async () => {+ mockGetActiveDoNamesForMachine.mockResolvedValue(["do-abc"])+ doMock.stubFetch.mockResolvedValue(new Response(JSON.stringify({ sent: 1 }), { status: 200 }))++ const req = new Request("http://localhost/community-machine/by-id/machine-1/forward-agent-start", {+ method: "POST",+ headers: { "content-type": "application/json" },+ body: JSON.stringify({ type: "agent:start", agentId: "bot-1" }),+ })+ const res = await handler.fetch(req, env as any)++ expect(doMock.idFromName).toHaveBeenCalledWith("community-machine:do-abc")+ const stubReq = doMock.stubFetch.mock.calls[0][0] as Request+ expect(stubReq.url).toBe("http://internal/forward-agent-start")+ expect(res.status).toBe(200)+ expect(await res.json()).toEqual({ sent: 1 })+ })++ it("daemon offline (DO reports { sent: 0 }) → does not count as delivered", async () => {+ mockGetActiveDoNamesForMachine.mockResolvedValue(["do-abc"])+ doMock.stubFetch.mockResolvedValue(new Response(JSON.stringify({ sent: 0 }), { status: 200 }))++ const req = new Request("http://localhost/community-machine/by-id/machine-1/forward-agent-start", {+ method: "POST",+ body: JSON.stringify({ type: "agent:start" }),+ })+ const res = await handler.fetch(req, env as any)++ expect(res.status).toBe(200)+ expect(await res.json()).toEqual({ sent: 0 })+ })++ it("multi-doName fan-out: both DOs hit, aggregate sums delivered counts", async () => {+ mockGetActiveDoNamesForMachine.mockResolvedValue(["do-a", "do-b"])+ let call = 0+ doMock.stubFetch.mockImplementation(() => {+ call+++ const sent = call === 1 ? 0 : 1+ return Promise.resolve(new Response(JSON.stringify({ sent }), { status: 200 }))+ })++ const req = new Request("http://localhost/community-machine/by-id/machine-1/forward-agent-start", {+ method: "POST",+ body: JSON.stringify({ type: "agent:start" }),+ })+ const res = await handler.fetch(req, env as any)++ expect(doMock.idFromName).toHaveBeenCalledWith("community-machine:do-a")+ expect(doMock.idFromName).toHaveBeenCalledWith("community-machine:do-b")+ expect(res.status).toBe(200)+ expect(await res.json()).toEqual({ sent: 1 })+ })++ it("DO fetch throws — tolerated, other doNames still evaluated", async () => {+ mockGetActiveDoNamesForMachine.mockResolvedValue(["do-a", "do-b"])+ let call = 0+ doMock.stubFetch.mockImplementation(() => {+ call+++ if (call === 1) return Promise.reject(new Error("network error"))+ return Promise.resolve(new Response(JSON.stringify({ sent: 1 }), { status: 200 }))+ })++ const req = new Request("http://localhost/community-machine/by-id/machine-1/forward-agent-start", {+ method: "POST",+ body: JSON.stringify({ type: "agent:start" }),+ })+ const res = await handler.fetch(req, env as any)++ expect(res.status).toBe(200)+ expect(await res.json()).toEqual({ sent: 1 })+ })++ it("DO fetch throws with no delivery → retryable 503", async () => {+ mockGetActiveDoNamesForMachine.mockResolvedValue(["do-a"])+ doMock.stubFetch.mockRejectedValue(new Error("network error"))++ const req = new Request("http://localhost/community-machine/by-id/machine-1/forward-agent-start", {+ method: "POST",+ body: JSON.stringify({ type: "agent:start" }),+ })+ const res = await handler.fetch(req, env as any)++ expect(res.status).toBe(503)+ expect(await res.json()).toEqual({ error: "failed to forward agent start" })+ })++ it("non-2xx or malformed DO responses with no delivery → retryable 503", async () => {+ mockGetActiveDoNamesForMachine.mockResolvedValue(["do-a", "do-b"])+ let call = 0+ doMock.stubFetch.mockImplementation(() => {+ call+++ if (call === 1) return Promise.resolve(new Response("oops", { status: 502 }))+ return Promise.resolve(new Response(JSON.stringify({ sent: "bad" }), { status: 200 }))+ })++ const req = new Request("http://localhost/community-machine/by-id/machine-1/forward-agent-start", {+ method: "POST",+ body: JSON.stringify({ type: "agent:start" }),+ })+ const res = await handler.fetch(req, env as any)++ expect(res.status).toBe(503)+ expect(await res.json()).toEqual({ error: "failed to forward agent start" })+ })++ it("DB lookup failure → retryable 503, not offline { sent: 0 }", async () => {+ mockGetActiveDoNamesForMachine.mockRejectedValue(new Error("d1 unreachable"))++ const req = new Request("http://localhost/community-machine/by-id/machine-1/forward-agent-start", {+ method: "POST",+ body: JSON.stringify({ type: "agent:start" }),+ })+ const res = await handler.fetch(req, env as any)++ expect(res.status).toBe(503)+ expect(await res.json()).toEqual({ error: "failed to resolve machine" })+ expect(doMock.stubFetch).not.toHaveBeenCalled()+ })+ })+describe("force-close routing", () => {it("keys the DO by the do_name suffix", async () => {doMock.stubFetch.mockResolvedValue(new Response(JSON.stringify({ closed: 1 })))diff --git a/src/ws-do/src/index.ts b/src/ws-do/src/index.tsindex 8f22b300d..626115454 100644--- a/src/ws-do/src/index.ts+++ b/src/ws-do/src/index.ts@@ -134,6 +134,66 @@ export default {return Response.json({ sent: delivered })}+ // POST /community-machine/by-id/<machineId>/forward-agent-start — sibling+ // of the `/push` route above, for the community-agent-cli-bridge wake+ // path (plan §8/§13). Forwards an already-built `HostCommand`+ // (`agent:start`) verbatim to every live DO for this machine's active+ // credential(s), then aggregates by parsing each DO's own `{ sent: N }`+ // response — unlike `/push`, we must NOT just count `res.ok`: a 200 with+ // `{ sent: 0 }` means that DO has no authenticated daemon socket at all,+ // which must not be reported as delivered.+ const forwardAgentStart = url.pathname.match(/^\/community-machine\/by-id\/([^/]+)\/forward-agent-start$/)+ if (forwardAgentStart && request.method === "POST") {+ const machineId = decodeURIComponent(forwardAgentStart[1])+ const reqLog = log.child({ traceId, machineId })+ reqLog.debug("forwarding agent:start to machine")++ let doNames: string[] = []+ try {+ const shared = await import("@alook/shared")+ const db = shared.createDb((env as unknown as { DB: D1Database }).DB)+ doNames = await queries.communityMachine.getActiveDoNamesForMachine(db, machineId)+ } catch (err) {+ reqLog.error("failed to resolve machine doNames for agent wake", { err })+ return Response.json({ error: "failed to resolve machine" }, { status: 503 })+ }+ if (doNames.length === 0) {+ return Response.json({ sent: 0 })+ }+ const bodyText = await request.text()+ let delivered = 0+ let transientFailure = false+ for (const dn of doNames) {+ const doId = env.WS_DO.idFromName("community-machine:" + dn)+ const stub = env.WS_DO.get(doId)+ try {+ const res = await stub.fetch(+ new Request("http://internal/forward-agent-start", {+ method: "POST",+ headers: { "content-type": "application/json" },+ body: bodyText,+ }),+ )+ if (!res.ok) {+ transientFailure = true+ continue+ }+ const data = (await res.json()) as { sent?: unknown }+ if (typeof data.sent !== "number" || !Number.isFinite(data.sent) || data.sent < 0) {+ transientFailure = true+ continue+ }+ delivered += data.sent+ } catch {+ transientFailure = true+ }+ }+ if (delivered === 0 && transientFailure) {+ return Response.json({ error: "failed to forward agent start" }, { status: 503 })+ }+ return Response.json({ sent: delivered })+ }+// POST /community-machine/<doName>/force-close — disconnect a daemon by// its DO-name suffix (first 32 hex of the credential hash). Callers look// the suffix up from `community_machine_credential.do_name`.