diff --git a/extensions/jaskiringg/confluence-ai/.env.example b/extensions/jaskiringg/confluence-ai/.env.example
new file mode 100644
index 0000000..b45d5b5
--- /dev/null
+++ b/extensions/jaskiringg/confluence-ai/.env.example
@@ -0,0 +1,11 @@
+SUPERDOCS_API_KEY=your-key-here
+SUPERDOCS_API_BASE=https://api.superdocs.app
+
+# Optional — real Confluence Cloud (sidecar fallback). Leave unset to use the demo page.
+CONFLUENCE_BASE_URL=https://your-site.atlassian.net
+CONFLUENCE_EMAIL=you@example.com
+CONFLUENCE_API_TOKEN=your-confluence-api-token
+CONFLUENCE_PAGE_ID=
+CONFLUENCE_SPACE_ID=
+
+SIDECAR_PORT=8787
diff --git a/extensions/jaskiringg/confluence-ai/.gitignore b/extensions/jaskiringg/confluence-ai/.gitignore
new file mode 100644
index 0000000..2281a64
--- /dev/null
+++ b/extensions/jaskiringg/confluence-ai/.gitignore
@@ -0,0 +1,10 @@
+node_modules/
+static/ui/node_modules/
+static/ui/build/
+.env
+.env.*
+!.env.example
+.DS_Store
+*.log
+.forge/
+dist/
diff --git a/extensions/jaskiringg/confluence-ai/README.md b/extensions/jaskiringg/confluence-ai/README.md
new file mode 100644
index 0000000..e149f95
--- /dev/null
+++ b/extensions/jaskiringg/confluence-ai/README.md
@@ -0,0 +1,57 @@
+# Confluence in-page AI edit and review
+
+Built by **Jaskirat Singh** for the SuperDocs task.
+
+Edits the Confluence page you are on instead of exporting it away. Select a section, give an instruction, review SuperDocs diffs inline, send a named approver if you want a second gate, then write **only accepted ranges** back as ADF. Tables, code blocks, and macros are placeholders SuperDocs is not allowed to rewrite. Space normalisation is a page-by-page queue. Publish for people who never open Confluence is a branded PDF via SuperDocs export.
+
+## What SuperDocs is used for
+
+- upload / `document_html`
+- `POST /v1/chat/async` with `approval_mode=ask_every_time`
+- approve / reject each proposed change
+- `POST /v1/documents/export` (PDF)
+
+Proposed-change payloads are parsed twice (JSON string → object). Large edits that pause with `awaiting_kind=continue_prompt` are resumed, not retried as a new job.
+
+## Run (sidecar demo, no Forge required)
+
+```bash
+cd extensions/jaskiringg/confluence-ai
+cp .env.example .env # put SUPERDOCS_API_KEY here
+npm install
+npm --prefix static/ui install
+npm run ui:build
+npm run sidecar
+```
+
+Open http://127.0.0.1:8787 — demo IT policy page with a table + code block.
+
+To hit a real Confluence Cloud site from the sidecar, set `CONFLUENCE_BASE_URL`, `CONFLUENCE_EMAIL`, `CONFLUENCE_API_TOKEN`, and a page id.
+
+## Run (Forge, sideload)
+
+1. Create a free Confluence Cloud site.
+2. `npm i -g @forge/cli` then `forge login`.
+3. In this folder: `forge register` (writes a real `app.id` into `manifest.yml` — re-register if you fork).
+4. `forge variables set SUPERDOCS_API_KEY "$SUPERDOCS_API_KEY" --encrypt`
+5. `FORGE=1 npm --prefix static/ui run build && forge deploy && forge install --product Confluence --site YOUR-SITE.atlassian.net`
+
+Page byline: **AI review**. Space page: **SuperDocs space queue**. Page menu → Apps → **SuperDocs AI edit**.
+
+This copy is sideloaded on `jaskiring.atlassian.net` (personal site, not public). Reviewers should run the sidecar or sideload their own site.
+
+Marketplace listing is out of scope; sideload is enough.
+
+## Honest limits
+
+- Native Confluence **Publish** cannot be fully intercepted from a content-action modal. We block **our** write-back until the named approver accepts, and store that state on a content property. That is the gate we can actually keep.
+- Sidecar without Confluence credentials uses a synthetic page so the SuperDocs loop can be demoed.
+- ADF mapping covers headings, paragraphs, lists, quotes. Unknown/opaque nodes stay byte-stable on the original ADF.
+
+## Tests
+
+```bash
+npm test
+```
+
+No live SuperDocs key required for unit tests.
diff --git a/extensions/jaskiringg/confluence-ai/fixtures/demo-page.adf.json b/extensions/jaskiringg/confluence-ai/fixtures/demo-page.adf.json
new file mode 100644
index 0000000..d7d22d9
--- /dev/null
+++ b/extensions/jaskiringg/confluence-ai/fixtures/demo-page.adf.json
@@ -0,0 +1,89 @@
+{
+ "type": "doc",
+ "version": 1,
+ "content": [
+ {
+ "type": "heading",
+ "attrs": { "level": 1 },
+ "content": [{ "type": "text", "text": "IT Change Policy — North Region" }]
+ },
+ {
+ "type": "paragraph",
+ "content": [
+ {
+ "type": "text",
+ "text": "All production changes require a CAB ticket before cutover. Emergency changes still need a follow-up ticket within 24 hours."
+ }
+ ]
+ },
+ {
+ "type": "heading",
+ "attrs": { "level": 2 },
+ "content": [{ "type": "text", "text": "Freeze windows" }]
+ },
+ {
+ "type": "paragraph",
+ "content": [
+ {
+ "type": "text",
+ "text": "North region freeze is 02:00-06:00 IST on release nights. No master-data edits during freeze."
+ }
+ ]
+ },
+ {
+ "type": "table",
+ "attrs": { "isNumberColumnEnabled": false, "layout": "default" },
+ "content": [
+ {
+ "type": "tableRow",
+ "content": [
+ {
+ "type": "tableHeader",
+ "attrs": {},
+ "content": [{ "type": "paragraph", "content": [{ "type": "text", "text": "System" }] }]
+ },
+ {
+ "type": "tableHeader",
+ "attrs": {},
+ "content": [{ "type": "paragraph", "content": [{ "type": "text", "text": "Owner" }] }]
+ }
+ ]
+ },
+ {
+ "type": "tableRow",
+ "content": [
+ {
+ "type": "tableCell",
+ "attrs": {},
+ "content": [{ "type": "paragraph", "content": [{ "type": "text", "text": "Order API" }] }]
+ },
+ {
+ "type": "tableCell",
+ "attrs": {},
+ "content": [{ "type": "paragraph", "content": [{ "type": "text", "text": "Platform" }] }]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "type": "heading",
+ "attrs": { "level": 2 },
+ "content": [{ "type": "text", "text": "Rollback" }]
+ },
+ {
+ "type": "paragraph",
+ "content": [
+ {
+ "type": "text",
+ "text": "If error rate exceeds 2% after cutover, roll back within 15 minutes and page the on-call."
+ }
+ ]
+ },
+ {
+ "type": "codeBlock",
+ "attrs": { "language": "bash" },
+ "content": [{ "type": "text", "text": "kubectl rollout undo deploy/order-api" }]
+ }
+ ]
+}
diff --git a/extensions/jaskiringg/confluence-ai/manifest.yml b/extensions/jaskiringg/confluence-ai/manifest.yml
new file mode 100644
index 0000000..b5e39f2
--- /dev/null
+++ b/extensions/jaskiringg/confluence-ai/manifest.yml
@@ -0,0 +1,57 @@
+modules:
+ confluence:contentAction:
+ - key: ai-edit-review
+ resource: main
+ resolver:
+ function: resolver
+ title: SuperDocs AI edit
+ viewportSize: large
+ confluence:contentBylineItem:
+ - key: ai-review-status
+ resource: main
+ resolver:
+ function: resolver
+ title: SuperDocs AI edit
+ confluence:globalPage:
+ - key: superdocs-home
+ resource: main
+ resolver:
+ function: resolver
+ title: SuperDocs AI
+ route: superdocs-ai
+ confluence:spacePage:
+ - key: space-normalise
+ resource: main
+ resolver:
+ function: resolver
+ title: SuperDocs space queue
+ route: superdocs-queue
+ function:
+ - key: resolver
+ handler: index.handler
+
+resources:
+ - key: main
+ path: static/ui/build
+
+app:
+ runtime:
+ name: nodejs22.x
+ memoryMB: 256
+ id: ari:cloud:ecosystem::app/7f17f3ef-6f7f-4c69-a213-590e8cacdfcc
+
+permissions:
+ scopes:
+ - read:page:confluence
+ - write:page:confluence
+ - read:space:confluence
+ - read:user:confluence
+ - search:confluence
+ - read:content.property:confluence
+ - write:content.property:confluence
+ external:
+ fetch:
+ backend:
+ - address: api.superdocs.app
+ client:
+ - address: api.superdocs.app
diff --git a/extensions/jaskiringg/confluence-ai/package-lock.json b/extensions/jaskiringg/confluence-ai/package-lock.json
new file mode 100644
index 0000000..bee32e9
--- /dev/null
+++ b/extensions/jaskiringg/confluence-ai/package-lock.json
@@ -0,0 +1,1554 @@
+{
+ "name": "confluence-ai-review",
+ "version": "0.1.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "confluence-ai-review",
+ "version": "0.1.0",
+ "dependencies": {
+ "@forge/api": "^8.0.3",
+ "@forge/resolver": "^2.0.0",
+ "cors": "^2.8.5",
+ "dotenv": "^16.4.7",
+ "express": "^4.21.2",
+ "node-html-parser": "^7.0.1"
+ }
+ },
+ "node_modules/@forge/api": {
+ "version": "8.0.3",
+ "resolved": "https://registry.npmjs.org/@forge/api/-/api-8.0.3.tgz",
+ "integrity": "sha512-qQ8W3pNXhXc1DHWZxH+pGmbXykKldGmtxfJUbnQjukDh8CAAHpXmLxwxRm6MEftW0wENgrPl8kQfGfXE2md1Bg==",
+ "license": "SEE LICENSE IN LICENSE.txt",
+ "dependencies": {
+ "@forge/auth": "1.0.0",
+ "@forge/egress": "3.0.0",
+ "@forge/i18n": "1.0.0",
+ "@forge/manifest": "^13.3.0",
+ "headers-utils": "^3.0.2"
+ },
+ "peerDependencies": {
+ "typescript": ">=5.0.0"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@forge/auth": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/@forge/auth/-/auth-1.0.0.tgz",
+ "integrity": "sha512-lEwaTIS9lZAMeuf9TfuP/OyhoJz1SCoIt5ZbgbgPtG3SV/KYdI2qSW6xafnONy0iAaKJo5D3VDBEbm7K1d+qog==",
+ "license": "SEE LICENSE IN LICENSE.txt",
+ "dependencies": {
+ "tslib": "^2.6.2"
+ },
+ "peerDependencies": {
+ "typescript": ">=5.0.0"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@forge/egress": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/@forge/egress/-/egress-3.0.0.tgz",
+ "integrity": "sha512-uQfoTAb3tk69sfxCwTQTDc08Et+zBQ3AHoY+uXZ8IiZkTsEZrRKk1IoWlOzwiEJHpvFgewTv1quvqI1P/PIb2w==",
+ "license": "SEE LICENSE IN LICENSE.txt",
+ "peerDependencies": {
+ "typescript": ">=5.0.0"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@forge/i18n": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/@forge/i18n/-/i18n-1.0.0.tgz",
+ "integrity": "sha512-zXQX2/vt3MM6EVv0EMiKM5GemHnFXMiNoclua0TzK9vCcQ+iA70Eg06n90ySKsyf3eslaLQtZvi/hfpntjH2Gg==",
+ "license": "SEE LICENSE IN LICENSE.txt",
+ "dependencies": {
+ "lodash": "^4.17.21"
+ },
+ "peerDependencies": {
+ "typescript": ">=5.0.0"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@forge/manifest": {
+ "version": "13.3.0",
+ "resolved": "https://registry.npmjs.org/@forge/manifest/-/manifest-13.3.0.tgz",
+ "integrity": "sha512-EdXhHz1PMjITk30zxapgHWuoZVrvNxYTjcK37V4HaLV3bo58z/VoVzE9ttkzGf9H7j1bXzPWPXnEioXobr61mA==",
+ "license": "SEE LICENSE IN LICENSE.txt",
+ "dependencies": {
+ "@forge/i18n": "1.0.0",
+ "@sentry/node": "7.106.0",
+ "ajv": "^8.18.0",
+ "ajv-formats": "2.1.1",
+ "cheerio": "^1.2.0",
+ "glob": "^13.0.0",
+ "lodash": "^4.17.21",
+ "mime-types": "^2.1.35",
+ "yaml": "^2.3.4"
+ },
+ "peerDependencies": {
+ "typescript": ">=5.0.0"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@forge/resolver": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@forge/resolver/-/resolver-2.0.0.tgz",
+ "integrity": "sha512-6TsntUodtRxefZjDTLVT5yvFo4OFEQwLRcN5cniWre0hD2tJ5B2OWw+8r4u1dTjflA0/+rciScWkuoKTRQK+WQ==",
+ "license": "SEE LICENSE IN LICENSE.txt",
+ "peerDependencies": {
+ "typescript": ">=5.0.0"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@sentry-internal/tracing": {
+ "version": "7.106.0",
+ "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.106.0.tgz",
+ "integrity": "sha512-O8Es6Sa/tP80nfl+8soNfWzeRNFcT484SvjLR8BS3pHM9KDAlwNXyoQhFr2BKNYL1irbq6UF6eku4xCnUKVmqA==",
+ "license": "MIT",
+ "dependencies": {
+ "@sentry/core": "7.106.0",
+ "@sentry/types": "7.106.0",
+ "@sentry/utils": "7.106.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@sentry/core": {
+ "version": "7.106.0",
+ "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.106.0.tgz",
+ "integrity": "sha512-Dc13XtnyFaXup2E4vCbzuG0QKAVjrJBk4qfGwvSJaTuopEaEWBs2MpK6hRzFhsz9S3T0La7c1F/62NptvTUWsQ==",
+ "license": "MIT",
+ "dependencies": {
+ "@sentry/types": "7.106.0",
+ "@sentry/utils": "7.106.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@sentry/node": {
+ "version": "7.106.0",
+ "resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.106.0.tgz",
+ "integrity": "sha512-4DIqbu5K7//lK/k2nV8lqKeGQzhu2T1OpJFmiUrjN6fUKWivGFjZrcmQDS7tvhAAyJezkL3LlrNU4tjPHUElPA==",
+ "license": "MIT",
+ "dependencies": {
+ "@sentry-internal/tracing": "7.106.0",
+ "@sentry/core": "7.106.0",
+ "@sentry/types": "7.106.0",
+ "@sentry/utils": "7.106.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@sentry/types": {
+ "version": "7.106.0",
+ "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.106.0.tgz",
+ "integrity": "sha512-oKTkDaL6P9xJC5/zHLRemHTWboUqRYjkJNaZCN63j4kJqGy56wee4vDtDese/NWWn4U4C1QV1h+Mifm2HmDcQg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@sentry/utils": {
+ "version": "7.106.0",
+ "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.106.0.tgz",
+ "integrity": "sha512-bVsePsXLpFu/1sH4rpJrPcnVxW2fXXfGfGxKs6Bm+dkOMbuVTlk/KAzIbdjCDIpVlrMDJmMNEv5xgTFjgWDkjw==",
+ "license": "MIT",
+ "dependencies": {
+ "@sentry/types": "7.106.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/accepts": {
+ "version": "1.3.8",
+ "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
+ "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
+ "license": "MIT",
+ "dependencies": {
+ "mime-types": "~2.1.34",
+ "negotiator": "0.6.3"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/ajv": {
+ "version": "8.20.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz",
+ "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==",
+ "license": "MIT",
+ "dependencies": {
+ "fast-deep-equal": "^3.1.3",
+ "fast-uri": "^3.0.1",
+ "json-schema-traverse": "^1.0.0",
+ "require-from-string": "^2.0.2"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/epoberezkin"
+ }
+ },
+ "node_modules/ajv-formats": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz",
+ "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==",
+ "license": "MIT",
+ "dependencies": {
+ "ajv": "^8.0.0"
+ },
+ "peerDependencies": {
+ "ajv": "^8.0.0"
+ },
+ "peerDependenciesMeta": {
+ "ajv": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/array-flatten": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
+ "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
+ "license": "MIT"
+ },
+ "node_modules/balanced-match": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz",
+ "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==",
+ "license": "MIT",
+ "engines": {
+ "node": "18 || 20 || >=22"
+ }
+ },
+ "node_modules/body-parser": {
+ "version": "1.20.6",
+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.6.tgz",
+ "integrity": "sha512-p5tAzS57i5MV9fZFDj9LeIiTZEufbSe2eDozP+ElheSUq1m74CRq1jI4mYNDdVs9vQztXFLuk/Gd6BWTdwRJ5g==",
+ "license": "MIT",
+ "dependencies": {
+ "bytes": "~3.1.2",
+ "content-type": "~1.0.5",
+ "debug": "2.6.9",
+ "depd": "2.0.0",
+ "destroy": "~1.2.0",
+ "http-errors": "~2.0.1",
+ "iconv-lite": "~0.4.24",
+ "on-finished": "~2.4.1",
+ "qs": "~6.15.1",
+ "raw-body": "~2.5.3",
+ "type-is": "~1.6.18",
+ "unpipe": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8",
+ "npm": "1.2.8000 || >= 1.4.16"
+ }
+ },
+ "node_modules/body-parser/node_modules/iconv-lite": {
+ "version": "0.4.24",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
+ "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
+ "license": "MIT",
+ "dependencies": {
+ "safer-buffer": ">= 2.1.2 < 3"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/boolbase": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
+ "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==",
+ "license": "ISC"
+ },
+ "node_modules/brace-expansion": {
+ "version": "5.0.9",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz",
+ "integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==",
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^4.0.2"
+ },
+ "engines": {
+ "node": "20 || >=22"
+ }
+ },
+ "node_modules/bytes": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
+ "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/call-bind-apply-helpers": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
+ "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/call-bound": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
+ "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.2",
+ "get-intrinsic": "^1.3.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/cheerio": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.2.0.tgz",
+ "integrity": "sha512-WDrybc/gKFpTYQutKIK6UvfcuxijIZfMfXaYm8NMsPQxSYvf+13fXUJ4rztGGbJcBQ/GF55gvrZ0Bc0bj/mqvg==",
+ "license": "MIT",
+ "dependencies": {
+ "cheerio-select": "^2.1.0",
+ "dom-serializer": "^2.0.0",
+ "domhandler": "^5.0.3",
+ "domutils": "^3.2.2",
+ "encoding-sniffer": "^0.2.1",
+ "htmlparser2": "^10.1.0",
+ "parse5": "^7.3.0",
+ "parse5-htmlparser2-tree-adapter": "^7.1.0",
+ "parse5-parser-stream": "^7.1.2",
+ "undici": "^7.19.0",
+ "whatwg-mimetype": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=20.18.1"
+ },
+ "funding": {
+ "url": "https://github.com/cheeriojs/cheerio?sponsor=1"
+ }
+ },
+ "node_modules/cheerio-select": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-2.1.0.tgz",
+ "integrity": "sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==",
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "boolbase": "^1.0.0",
+ "css-select": "^5.1.0",
+ "css-what": "^6.1.0",
+ "domelementtype": "^2.3.0",
+ "domhandler": "^5.0.3",
+ "domutils": "^3.0.1"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/fb55"
+ }
+ },
+ "node_modules/content-disposition": {
+ "version": "0.5.4",
+ "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
+ "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
+ "license": "MIT",
+ "dependencies": {
+ "safe-buffer": "5.2.1"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/content-type": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
+ "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/cookie": {
+ "version": "0.7.2",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
+ "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/cookie-signature": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz",
+ "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==",
+ "license": "MIT"
+ },
+ "node_modules/cors": {
+ "version": "2.8.6",
+ "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz",
+ "integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==",
+ "license": "MIT",
+ "dependencies": {
+ "object-assign": "^4",
+ "vary": "^1"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/css-select": {
+ "version": "5.2.2",
+ "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.2.2.tgz",
+ "integrity": "sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw==",
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "boolbase": "^1.0.0",
+ "css-what": "^6.1.0",
+ "domhandler": "^5.0.2",
+ "domutils": "^3.0.1",
+ "nth-check": "^2.0.1"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/fb55"
+ }
+ },
+ "node_modules/css-what": {
+ "version": "6.2.2",
+ "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.2.2.tgz",
+ "integrity": "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA==",
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">= 6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/fb55"
+ }
+ },
+ "node_modules/debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "2.0.0"
+ }
+ },
+ "node_modules/depd": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
+ "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/destroy": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
+ "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8",
+ "npm": "1.2.8000 || >= 1.4.16"
+ }
+ },
+ "node_modules/dom-serializer": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz",
+ "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==",
+ "license": "MIT",
+ "dependencies": {
+ "domelementtype": "^2.3.0",
+ "domhandler": "^5.0.2",
+ "entities": "^4.2.0"
+ },
+ "funding": {
+ "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1"
+ }
+ },
+ "node_modules/domelementtype": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz",
+ "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/fb55"
+ }
+ ],
+ "license": "BSD-2-Clause"
+ },
+ "node_modules/domhandler": {
+ "version": "5.0.3",
+ "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz",
+ "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==",
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "domelementtype": "^2.3.0"
+ },
+ "engines": {
+ "node": ">= 4"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/domhandler?sponsor=1"
+ }
+ },
+ "node_modules/domutils": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.2.2.tgz",
+ "integrity": "sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==",
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "dom-serializer": "^2.0.0",
+ "domelementtype": "^2.3.0",
+ "domhandler": "^5.0.3"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/domutils?sponsor=1"
+ }
+ },
+ "node_modules/dotenv": {
+ "version": "16.6.1",
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz",
+ "integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==",
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://dotenvx.com"
+ }
+ },
+ "node_modules/dunder-proto": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
+ "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "gopd": "^1.2.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/ee-first": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
+ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
+ "license": "MIT"
+ },
+ "node_modules/encodeurl": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
+ "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/encoding-sniffer": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/encoding-sniffer/-/encoding-sniffer-0.2.1.tgz",
+ "integrity": "sha512-5gvq20T6vfpekVtqrYQsSCFZ1wEg5+wW0/QaZMWkFr6BqD3NfKs0rLCx4rrVlSWJeZb5NBJgVLswK/w2MWU+Gw==",
+ "license": "MIT",
+ "dependencies": {
+ "iconv-lite": "^0.6.3",
+ "whatwg-encoding": "^3.1.1"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/encoding-sniffer?sponsor=1"
+ }
+ },
+ "node_modules/entities": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
+ "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=0.12"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/entities?sponsor=1"
+ }
+ },
+ "node_modules/es-define-property": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
+ "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-errors": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
+ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-object-atoms": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz",
+ "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/escape-html": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
+ "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
+ "license": "MIT"
+ },
+ "node_modules/etag": {
+ "version": "1.8.1",
+ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
+ "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/express": {
+ "version": "4.22.2",
+ "resolved": "https://registry.npmjs.org/express/-/express-4.22.2.tgz",
+ "integrity": "sha512-IuL+Elrou2ZvCFHs18/CIzy2Nzvo25nZ1/D2eIZlz7c+QUayAcYoiM2BthCjs+EBHVpjYjcuLDAiCWgeIX3X1Q==",
+ "license": "MIT",
+ "dependencies": {
+ "accepts": "~1.3.8",
+ "array-flatten": "1.1.1",
+ "body-parser": "~1.20.5",
+ "content-disposition": "~0.5.4",
+ "content-type": "~1.0.4",
+ "cookie": "~0.7.1",
+ "cookie-signature": "~1.0.6",
+ "debug": "2.6.9",
+ "depd": "2.0.0",
+ "encodeurl": "~2.0.0",
+ "escape-html": "~1.0.3",
+ "etag": "~1.8.1",
+ "finalhandler": "~1.3.1",
+ "fresh": "~0.5.2",
+ "http-errors": "~2.0.0",
+ "merge-descriptors": "1.0.3",
+ "methods": "~1.1.2",
+ "on-finished": "~2.4.1",
+ "parseurl": "~1.3.3",
+ "path-to-regexp": "~0.1.12",
+ "proxy-addr": "~2.0.7",
+ "qs": "~6.15.1",
+ "range-parser": "~1.2.1",
+ "safe-buffer": "5.2.1",
+ "send": "~0.19.0",
+ "serve-static": "~1.16.2",
+ "setprototypeof": "1.2.0",
+ "statuses": "~2.0.1",
+ "type-is": "~1.6.18",
+ "utils-merge": "1.0.1",
+ "vary": "~1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.10.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/fast-deep-equal": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
+ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
+ "license": "MIT"
+ },
+ "node_modules/fast-uri": {
+ "version": "3.1.5",
+ "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.5.tgz",
+ "integrity": "sha512-gHwA1O9LDIcKunMKhObS/HimwtehO1nPUECKAu5TpKgaO19fcWEl4bliWe1jWxVFvIXztJjjQ4L8XQ1EU9f7Jw==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/fastify"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/fastify"
+ }
+ ],
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/finalhandler": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz",
+ "integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "2.6.9",
+ "encodeurl": "~2.0.0",
+ "escape-html": "~1.0.3",
+ "on-finished": "~2.4.1",
+ "parseurl": "~1.3.3",
+ "statuses": "~2.0.2",
+ "unpipe": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/forwarded": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
+ "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/fresh": {
+ "version": "0.5.2",
+ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
+ "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/function-bind": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/get-intrinsic": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
+ "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.2",
+ "es-define-property": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "es-object-atoms": "^1.1.1",
+ "function-bind": "^1.1.2",
+ "get-proto": "^1.0.1",
+ "gopd": "^1.2.0",
+ "has-symbols": "^1.1.0",
+ "hasown": "^2.0.2",
+ "math-intrinsics": "^1.1.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/get-proto": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
+ "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
+ "license": "MIT",
+ "dependencies": {
+ "dunder-proto": "^1.0.1",
+ "es-object-atoms": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/glob": {
+ "version": "13.0.6",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.6.tgz",
+ "integrity": "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==",
+ "license": "BlueOak-1.0.0",
+ "dependencies": {
+ "minimatch": "^10.2.2",
+ "minipass": "^7.1.3",
+ "path-scurry": "^2.0.2"
+ },
+ "engines": {
+ "node": "18 || 20 || >=22"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/gopd": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
+ "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/has-symbols": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
+ "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/hasown": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
+ "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
+ "license": "MIT",
+ "dependencies": {
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/he": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
+ "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
+ "license": "MIT",
+ "bin": {
+ "he": "bin/he"
+ }
+ },
+ "node_modules/headers-utils": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/headers-utils/-/headers-utils-3.0.2.tgz",
+ "integrity": "sha512-xAxZkM1dRyGV2Ou5bzMxBPNLoRCjcX+ya7KSWybQD2KwLphxsapUVK6x/02o7f4VU6GPSXch9vNY2+gkU8tYWQ==",
+ "license": "MIT"
+ },
+ "node_modules/htmlparser2": {
+ "version": "10.1.0",
+ "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-10.1.0.tgz",
+ "integrity": "sha512-VTZkM9GWRAtEpveh7MSF6SjjrpNVNNVJfFup7xTY3UpFtm67foy9HDVXneLtFVt4pMz5kZtgNcvCniNFb1hlEQ==",
+ "funding": [
+ "https://github.com/fb55/htmlparser2?sponsor=1",
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/fb55"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "domelementtype": "^2.3.0",
+ "domhandler": "^5.0.3",
+ "domutils": "^3.2.2",
+ "entities": "^7.0.1"
+ }
+ },
+ "node_modules/htmlparser2/node_modules/entities": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/entities/-/entities-7.0.1.tgz",
+ "integrity": "sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==",
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=0.12"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/entities?sponsor=1"
+ }
+ },
+ "node_modules/http-errors": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
+ "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
+ "license": "MIT",
+ "dependencies": {
+ "depd": "~2.0.0",
+ "inherits": "~2.0.4",
+ "setprototypeof": "~1.2.0",
+ "statuses": "~2.0.2",
+ "toidentifier": "~1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/iconv-lite": {
+ "version": "0.6.3",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
+ "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
+ "license": "MIT",
+ "dependencies": {
+ "safer-buffer": ">= 2.1.2 < 3.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+ "license": "ISC"
+ },
+ "node_modules/ipaddr.js": {
+ "version": "1.9.1",
+ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
+ "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/json-schema-traverse": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
+ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
+ "license": "MIT"
+ },
+ "node_modules/lodash": {
+ "version": "4.18.1",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz",
+ "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==",
+ "license": "MIT"
+ },
+ "node_modules/lru-cache": {
+ "version": "11.5.2",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.2.tgz",
+ "integrity": "sha512-4pfM1Ff0x50o0tQwb5ucw/RzNyD0/YJME6IVcStalZuMWxdt3sR3huStTtxz4PUmvZfRguvDejasvQ2kifR11g==",
+ "license": "BlueOak-1.0.0",
+ "engines": {
+ "node": "20 || >=22"
+ }
+ },
+ "node_modules/math-intrinsics": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
+ "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/media-typer": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
+ "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/merge-descriptors": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",
+ "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/methods": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
+ "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
+ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
+ "license": "MIT",
+ "bin": {
+ "mime": "cli.js"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/mime-db": {
+ "version": "1.52.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime-types": {
+ "version": "2.1.35",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
+ "license": "MIT",
+ "dependencies": {
+ "mime-db": "1.52.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/minimatch": {
+ "version": "10.2.6",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz",
+ "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==",
+ "license": "BlueOak-1.0.0",
+ "dependencies": {
+ "brace-expansion": "^5.0.8"
+ },
+ "engines": {
+ "node": "18 || 20 || >=22"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/minipass": {
+ "version": "7.1.3",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz",
+ "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==",
+ "license": "BlueOak-1.0.0",
+ "engines": {
+ "node": ">=16 || 14 >=14.17"
+ }
+ },
+ "node_modules/ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
+ "license": "MIT"
+ },
+ "node_modules/negotiator": {
+ "version": "0.6.3",
+ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
+ "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/node-html-parser": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/node-html-parser/-/node-html-parser-7.1.0.tgz",
+ "integrity": "sha512-iJo8b2uYGT40Y8BTyy5ufL6IVbN8rbm/1QK2xffXU/1a/v3AAa0d1YAoqBNYqaS4R/HajkWIpIfdE6KcyFh1AQ==",
+ "license": "MIT",
+ "dependencies": {
+ "css-select": "^5.1.0",
+ "he": "1.2.0"
+ }
+ },
+ "node_modules/nth-check": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz",
+ "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==",
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "boolbase": "^1.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/nth-check?sponsor=1"
+ }
+ },
+ "node_modules/object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/object-inspect": {
+ "version": "1.13.4",
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
+ "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/on-finished": {
+ "version": "2.4.1",
+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
+ "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
+ "license": "MIT",
+ "dependencies": {
+ "ee-first": "1.1.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/parse5": {
+ "version": "7.3.0",
+ "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz",
+ "integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==",
+ "license": "MIT",
+ "dependencies": {
+ "entities": "^6.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/inikulin/parse5?sponsor=1"
+ }
+ },
+ "node_modules/parse5-htmlparser2-tree-adapter": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-7.1.0.tgz",
+ "integrity": "sha512-ruw5xyKs6lrpo9x9rCZqZZnIUntICjQAd0Wsmp396Ul9lN/h+ifgVV1x1gZHi8euej6wTfpqX8j+BFQxF0NS/g==",
+ "license": "MIT",
+ "dependencies": {
+ "domhandler": "^5.0.3",
+ "parse5": "^7.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/inikulin/parse5?sponsor=1"
+ }
+ },
+ "node_modules/parse5-parser-stream": {
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/parse5-parser-stream/-/parse5-parser-stream-7.1.2.tgz",
+ "integrity": "sha512-JyeQc9iwFLn5TbvvqACIF/VXG6abODeB3Fwmv/TGdLk2LfbWkaySGY72at4+Ty7EkPZj854u4CrICqNk2qIbow==",
+ "license": "MIT",
+ "dependencies": {
+ "parse5": "^7.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/inikulin/parse5?sponsor=1"
+ }
+ },
+ "node_modules/parse5/node_modules/entities": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz",
+ "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==",
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=0.12"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/entities?sponsor=1"
+ }
+ },
+ "node_modules/parseurl": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
+ "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/path-scurry": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz",
+ "integrity": "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg==",
+ "license": "BlueOak-1.0.0",
+ "dependencies": {
+ "lru-cache": "^11.0.0",
+ "minipass": "^7.1.2"
+ },
+ "engines": {
+ "node": "18 || 20 || >=22"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/path-to-regexp": {
+ "version": "0.1.13",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz",
+ "integrity": "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==",
+ "license": "MIT"
+ },
+ "node_modules/proxy-addr": {
+ "version": "2.0.7",
+ "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
+ "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
+ "license": "MIT",
+ "dependencies": {
+ "forwarded": "0.2.0",
+ "ipaddr.js": "1.9.1"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/qs": {
+ "version": "6.15.3",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.3.tgz",
+ "integrity": "sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "es-define-property": "^1.0.1",
+ "side-channel": "^1.1.1"
+ },
+ "engines": {
+ "node": ">=0.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/range-parser": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
+ "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/raw-body": {
+ "version": "2.5.3",
+ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz",
+ "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==",
+ "license": "MIT",
+ "dependencies": {
+ "bytes": "~3.1.2",
+ "http-errors": "~2.0.1",
+ "iconv-lite": "~0.4.24",
+ "unpipe": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/raw-body/node_modules/iconv-lite": {
+ "version": "0.4.24",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
+ "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
+ "license": "MIT",
+ "dependencies": {
+ "safer-buffer": ">= 2.1.2 < 3"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/require-from-string": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
+ "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/safe-buffer": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT"
+ },
+ "node_modules/safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+ "license": "MIT"
+ },
+ "node_modules/send": {
+ "version": "0.19.2",
+ "resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz",
+ "integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "2.6.9",
+ "depd": "2.0.0",
+ "destroy": "1.2.0",
+ "encodeurl": "~2.0.0",
+ "escape-html": "~1.0.3",
+ "etag": "~1.8.1",
+ "fresh": "~0.5.2",
+ "http-errors": "~2.0.1",
+ "mime": "1.6.0",
+ "ms": "2.1.3",
+ "on-finished": "~2.4.1",
+ "range-parser": "~1.2.1",
+ "statuses": "~2.0.2"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/send/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "license": "MIT"
+ },
+ "node_modules/serve-static": {
+ "version": "1.16.3",
+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz",
+ "integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==",
+ "license": "MIT",
+ "dependencies": {
+ "encodeurl": "~2.0.0",
+ "escape-html": "~1.0.3",
+ "parseurl": "~1.3.3",
+ "send": "~0.19.1"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/setprototypeof": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
+ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
+ "license": "ISC"
+ },
+ "node_modules/side-channel": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz",
+ "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "object-inspect": "^1.13.4",
+ "side-channel-list": "^1.0.1",
+ "side-channel-map": "^1.0.1",
+ "side-channel-weakmap": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-list": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz",
+ "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "object-inspect": "^1.13.4"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-map": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
+ "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.5",
+ "object-inspect": "^1.13.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-weakmap": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
+ "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.5",
+ "object-inspect": "^1.13.3",
+ "side-channel-map": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/statuses": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
+ "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/toidentifier": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
+ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.6"
+ }
+ },
+ "node_modules/tslib": {
+ "version": "2.8.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
+ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
+ "license": "0BSD"
+ },
+ "node_modules/type-is": {
+ "version": "1.6.18",
+ "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
+ "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
+ "license": "MIT",
+ "dependencies": {
+ "media-typer": "0.3.0",
+ "mime-types": "~2.1.24"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/undici": {
+ "version": "7.29.0",
+ "resolved": "https://registry.npmjs.org/undici/-/undici-7.29.0.tgz",
+ "integrity": "sha512-IDxfleLmmbSskfWSUATiN1nfn2rDuvnMOqb5CWR92iIfojA0Ud+ulOAAEQ57LPr9rWmsreUyf5lwyao+7GNNVw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=20.18.1"
+ }
+ },
+ "node_modules/unpipe": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
+ "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/utils-merge": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
+ "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4.0"
+ }
+ },
+ "node_modules/vary": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
+ "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/whatwg-encoding": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz",
+ "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==",
+ "deprecated": "Use @exodus/bytes instead for a more spec-conformant and faster implementation",
+ "license": "MIT",
+ "dependencies": {
+ "iconv-lite": "0.6.3"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/whatwg-mimetype": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz",
+ "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/yaml": {
+ "version": "2.9.0",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.9.0.tgz",
+ "integrity": "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA==",
+ "license": "ISC",
+ "bin": {
+ "yaml": "bin.mjs"
+ },
+ "engines": {
+ "node": ">= 14.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/eemeli"
+ }
+ }
+ }
+}
diff --git a/extensions/jaskiringg/confluence-ai/package.json b/extensions/jaskiringg/confluence-ai/package.json
new file mode 100644
index 0000000..ecf07b7
--- /dev/null
+++ b/extensions/jaskiringg/confluence-ai/package.json
@@ -0,0 +1,21 @@
+{
+ "name": "confluence-ai-review",
+ "private": true,
+ "version": "0.1.0",
+ "description": "Confluence Cloud in-page AI edit and review, built on SuperDocs.",
+ "scripts": {
+ "sidecar": "node sidecar/server.js",
+ "ui:dev": "npm --prefix static/ui run dev",
+ "ui:build": "npm --prefix static/ui run build",
+ "test": "node --test src/lib/*.test.js",
+ "start": "npm run ui:build && npm run sidecar"
+ },
+ "dependencies": {
+ "@forge/api": "^8.0.3",
+ "@forge/resolver": "^2.0.0",
+ "cors": "^2.8.5",
+ "dotenv": "^16.4.7",
+ "express": "^4.21.2",
+ "node-html-parser": "^7.0.1"
+ }
+}
diff --git a/extensions/jaskiringg/confluence-ai/scripts/live-hitl-demo.js b/extensions/jaskiringg/confluence-ai/scripts/live-hitl-demo.js
new file mode 100644
index 0000000..644134c
--- /dev/null
+++ b/extensions/jaskiringg/confluence-ai/scripts/live-hitl-demo.js
@@ -0,0 +1,106 @@
+#!/usr/bin/env node
+/**
+ * Hit the live Confluence IT policy page: SuperDocs HITL → approve freeze-window edit → write back.
+ */
+const path = require("path");
+require("dotenv").config({ path: path.join(__dirname, "../.env") });
+const { handlers } = require("../src/handlers");
+
+function sleep(ms) {
+ return new Promise((r) => setTimeout(r, ms));
+}
+
+async function main() {
+ const pageId = process.env.CONFLUENCE_PAGE_ID;
+ const spaceId = process.env.CONFLUENCE_SPACE_ID;
+ if (!pageId || !process.env.SUPERDOCS_API_KEY || !process.env.CONFLUENCE_API_TOKEN) {
+ throw new Error("Need SUPERDOCS_API_KEY, CONFLUENCE_API_TOKEN, CONFLUENCE_PAGE_ID in .env");
+ }
+ const ctx = {
+ kind: "sidecar",
+ apiKey: process.env.SUPERDOCS_API_KEY,
+ pageId,
+ spaceId,
+ };
+
+ const g = await handlers.getContext({ pageId, spaceId }, ctx);
+ console.log("page", g.page.title, "id", g.page.id, "v", g.page.version, "demo", g.page.demo);
+ if (g.page.demo) throw new Error("Still on demo page — Confluence env not picked up");
+
+ const freeze = (g.sections || []).find((s) => /freeze/i.test(s.heading || ""));
+ console.log("section", freeze || g.sections?.[0]);
+
+ const started = await handlers.startEdit(
+ {
+ pageId: g.page.id,
+ message:
+ "Change the freeze window to 01:00-05:00 IST. Do not invent other policy. Leave the table and the kubectl command untouched.",
+ start: freeze?.start,
+ end: freeze?.end,
+ role: "author",
+ },
+ ctx
+ );
+ console.log("job", started);
+
+ let settled;
+ for (let i = 0; i < 45; i += 1) {
+ const p = await handlers.pollJob({ jobId: started.jobId, sessionId: started.sessionId }, ctx);
+ console.log("poll", i, p.status, p.awaitingKind, (p.pendingChanges || []).length);
+ if (p.status === "awaiting_approval" && p.awaitingKind === "continue_prompt") {
+ await handlers.resumeLargeEdit(
+ { jobId: started.jobId, sessionId: started.sessionId, continue: true },
+ ctx
+ );
+ await sleep(2000);
+ continue;
+ }
+ if (p.status === "awaiting_approval" || p.status === "completed" || p.status === "failed") {
+ settled = p;
+ break;
+ }
+ await sleep(2000);
+ }
+ if (!settled) throw new Error("Timed out waiting for SuperDocs");
+ if (settled.status === "failed") throw new Error(settled.error || "job failed");
+
+ const pending = settled.pendingChanges || [];
+ console.log("pending", JSON.stringify(pending, null, 2).slice(0, 4000));
+
+ const decisions = pending.map((c) => {
+ const blob = `${c.old_html || ""} ${c.new_html || ""} ${c.ai_explanation || ""}`;
+ const freezeEdit = /01:00|05:00|freeze|02:00|06:00/i.test(blob);
+ return {
+ change_id: c.change_id,
+ chunk_id: c.chunk_id,
+ operation: c.operation,
+ new_html: c.new_html,
+ old_html: c.old_html,
+ insert_after_chunk_id: c.insert_after_chunk_id,
+ approved: freezeEdit || pending.length === 1,
+ };
+ });
+
+ if (decisions.length) {
+ await handlers.decide(
+ { sessionId: started.sessionId, jobId: started.jobId, decisions },
+ ctx
+ );
+ }
+
+ const written = await handlers.writeBack(
+ {
+ sessionId: started.sessionId,
+ pageId: g.page.id,
+ decisions,
+ role: "author",
+ },
+ ctx
+ );
+ console.log("wrote", written);
+}
+
+main().catch((err) => {
+ console.error(err);
+ process.exit(1);
+});
diff --git a/extensions/jaskiringg/confluence-ai/sidecar/server.js b/extensions/jaskiringg/confluence-ai/sidecar/server.js
new file mode 100644
index 0000000..5162e22
--- /dev/null
+++ b/extensions/jaskiringg/confluence-ai/sidecar/server.js
@@ -0,0 +1,40 @@
+const path = require("path");
+const fs = require("fs");
+const express = require("express");
+const cors = require("cors");
+require("dotenv").config({ path: path.join(__dirname, "../.env") });
+
+const { handlers } = require("../src/handlers");
+
+const app = express();
+app.use(cors());
+app.use(express.json({ limit: "8mb" }));
+
+app.post("/api/:action", async (req, res) => {
+ const fn = handlers[req.params.action];
+ if (!fn) return res.status(404).json({ error: `Unknown action ${req.params.action}` });
+ try {
+ const data = await fn(req.body || {}, {
+ kind: "sidecar",
+ apiKey: process.env.SUPERDOCS_API_KEY,
+ pageId: req.body?.pageId,
+ spaceId: req.body?.spaceId,
+ });
+ res.json(data);
+ } catch (err) {
+ console.error(req.params.action, err);
+ res.status(err.status || 500).json({ error: err.message || String(err) });
+ }
+});
+
+const uiBuild = path.join(__dirname, "../static/ui/build");
+if (fs.existsSync(uiBuild)) {
+ app.use(express.static(uiBuild));
+ app.get("*", (_req, res) => res.sendFile(path.join(uiBuild, "index.html")));
+}
+
+const port = Number(process.env.SIDECAR_PORT || 8787);
+app.listen(port, () => {
+ console.log(`Confluence AI sidecar http://127.0.0.1:${port}`);
+ console.log(process.env.SUPERDOCS_API_KEY ? "SuperDocs key: set" : "SuperDocs key: MISSING (.env)");
+});
diff --git a/extensions/jaskiringg/confluence-ai/src/handlers.js b/extensions/jaskiringg/confluence-ai/src/handlers.js
new file mode 100644
index 0000000..52931d0
--- /dev/null
+++ b/extensions/jaskiringg/confluence-ai/src/handlers.js
@@ -0,0 +1,305 @@
+const {
+ adfToHtml,
+ listSections,
+ sliceSectionHtml,
+ applyAcceptedChanges,
+ ensureLocalIds,
+} = require("./lib/adf");
+const {
+ startHitlEdit,
+ getJob,
+ approveChanges,
+ continueJob,
+ exportPdf,
+ HOUSE_STRUCTURE_PROMPT,
+ LETTERHEAD,
+} = require("./lib/superdocs");
+const {
+ getPage,
+ updatePage,
+ listSpacePages,
+ searchUsers,
+ getReviewState,
+ setReviewState,
+ DEMO_PAGE_ID,
+ DEMO_SPACE_ID,
+} = require("./lib/confluence");
+
+const sessions = new Map();
+const reviewMemory = new Map();
+
+function envFrom(ctx) {
+ return {
+ SUPERDOCS_API_KEY: ctx.apiKey || process.env.SUPERDOCS_API_KEY,
+ SUPERDOCS_API_BASE: process.env.SUPERDOCS_API_BASE,
+ CONFLUENCE_BASE_URL: process.env.CONFLUENCE_BASE_URL,
+ CONFLUENCE_EMAIL: process.env.CONFLUENCE_EMAIL,
+ CONFLUENCE_API_TOKEN: process.env.CONFLUENCE_API_TOKEN,
+ useForgeApi: ctx.kind === "forge",
+ };
+}
+
+function isDemoId(id) {
+ return !id || String(id).startsWith("demo");
+}
+
+function resolvePageId(payload, ctx) {
+ if (!isDemoId(payload.pageId)) return String(payload.pageId);
+ if (!isDemoId(ctx.pageId)) return String(ctx.pageId);
+ if (process.env.CONFLUENCE_PAGE_ID) return String(process.env.CONFLUENCE_PAGE_ID);
+ return payload.pageId || ctx.pageId || DEMO_PAGE_ID;
+}
+
+function resolveSpaceId(payload, ctx) {
+ if (!isDemoId(payload.spaceId)) return String(payload.spaceId);
+ if (!isDemoId(ctx.spaceId)) return String(ctx.spaceId);
+ if (process.env.CONFLUENCE_SPACE_ID) return String(process.env.CONFLUENCE_SPACE_ID);
+ return payload.spaceId || ctx.spaceId || DEMO_SPACE_ID;
+}
+
+function sessionKey(pageId) {
+ return `conf-${pageId}`;
+}
+
+async function getContext(payload, ctx) {
+ const env = envFrom(ctx);
+ const pageId = resolvePageId(payload, ctx);
+ const spaceId = resolveSpaceId(payload, ctx);
+
+ if (env.useForgeApi && isDemoId(pageId) && !isDemoId(spaceId)) {
+ const pages = await listSpacePages(env, spaceId);
+ const first =
+ pages.find((p) => /IT Change Policy/i.test(p.title || "")) ||
+ pages.find((p) => !/^Overview$/i.test(p.title || "")) ||
+ pages[0];
+ if (first) return getContext({ ...payload, pageId: first.id, spaceId }, ctx);
+ return {
+ page: { id: null, title: "Space queue", version: 1, spaceId, demo: false },
+ sections: [],
+ review: { status: "draft" },
+ hasSuperDocsKey: !!env.SUPERDOCS_API_KEY,
+ };
+ }
+
+ const page = await getPage(env, pageId);
+ const { sections } = listSections(page.adf);
+ const review = await getReviewState(env, pageId, reviewMemory);
+ return {
+ page: {
+ id: page.id,
+ title: page.title,
+ version: page.version?.number || 1,
+ spaceId: page.spaceId || spaceId,
+ demo: !!page.demo,
+ },
+ sections,
+ review,
+ hasSuperDocsKey: !!env.SUPERDOCS_API_KEY,
+ };
+}
+
+async function loadPageHtml(payload, ctx) {
+ const env = envFrom(ctx);
+ const page = await getPage(env, resolvePageId(payload, ctx));
+ const { start, end } = payload;
+ if (start != null && end != null) {
+ const sliced = sliceSectionHtml(page.adf, start, end);
+ sessions.set(sessionKey(page.id), { adf: sliced.doc, page, range: { start, end } });
+ return { html: sliced.html, title: page.title, version: page.version?.number || 1 };
+ }
+ const full = adfToHtml(page.adf);
+ sessions.set(sessionKey(page.id), { adf: full.doc, page, range: null });
+ return { html: full.html, title: page.title, version: page.version?.number || 1 };
+}
+
+async function startEdit(payload, ctx) {
+ const env = envFrom(ctx);
+ const page = await getPage(env, resolvePageId(payload, ctx));
+ const review = await getReviewState(env, page.id, reviewMemory);
+ if (review.status === "awaiting_approver" && payload.role !== "approver") {
+ throw new Error("This page is waiting on the named approver. Publish is blocked.");
+ }
+
+ let html;
+ let storedAdf;
+ if (payload.start != null && payload.end != null) {
+ const sliced = sliceSectionHtml(page.adf, payload.start, payload.end);
+ html = sliced.html;
+ storedAdf = sliced.doc;
+ } else {
+ const full = adfToHtml(page.adf);
+ html = full.html;
+ storedAdf = full.doc;
+ }
+
+ const sid = `${sessionKey(page.id)}-${Date.now()}`;
+ const instruction = payload.house
+ ? HOUSE_STRUCTURE_PROMPT
+ : payload.message;
+ if (!instruction || !String(instruction).trim()) {
+ throw new Error("Write an instruction, or use house structure.");
+ }
+
+ const job = await startHitlEdit({
+ apiKey: env.SUPERDOCS_API_KEY,
+ sessionId: sid,
+ documentHtml: html,
+ message: String(instruction).trim(),
+ modelTier: payload.modelTier || "core",
+ });
+
+ sessions.set(sid, {
+ adf: ensureLocalIds(storedAdf),
+ page,
+ range: payload.start != null ? { start: payload.start, end: payload.end } : null,
+ jobId: job.job_id,
+ sessionId: sid,
+ html,
+ });
+
+ return { jobId: job.job_id, sessionId: sid, status: job.status };
+}
+
+async function pollJob(payload, ctx) {
+ const env = envFrom(ctx);
+ const job = await getJob({ apiKey: env.SUPERDOCS_API_KEY, jobId: payload.jobId });
+ if (job.status === "awaiting_approval" && job.metadata?.awaiting_kind === "continue_prompt") {
+ return {
+ status: job.status,
+ awaitingKind: "continue_prompt",
+ continuePrompt: job.metadata.continue_prompt,
+ pendingChanges: [],
+ };
+ }
+ return {
+ status: job.status,
+ awaitingKind: job.metadata?.awaiting_kind || (job.pending_changes?.length ? "hitl" : null),
+ pendingChanges: job.pending_changes || [],
+ error: job.error || null,
+ result: job.status === "completed" ? job.result : null,
+ };
+}
+
+async function decide(payload, ctx) {
+ const env = envFrom(ctx);
+ const sess = sessions.get(payload.sessionId);
+ if (!sess) throw new Error("Session expired. Start the edit again.");
+
+ const out = await approveChanges({
+ apiKey: env.SUPERDOCS_API_KEY,
+ sessionId: payload.sessionId,
+ jobId: payload.jobId,
+ decisions: payload.decisions,
+ });
+
+ sess.decisions = payload.decisions;
+ sessions.set(payload.sessionId, sess);
+ return out;
+}
+
+async function resumeLargeEdit(payload, ctx) {
+ const env = envFrom(ctx);
+ return continueJob({
+ apiKey: env.SUPERDOCS_API_KEY,
+ sessionId: payload.sessionId,
+ jobId: payload.jobId,
+ shouldContinue: payload.continue !== false,
+ });
+}
+
+async function writeBack(payload, ctx) {
+ const env = envFrom(ctx);
+ const sess = sessions.get(payload.sessionId);
+ if (!sess) throw new Error("Session expired. Start the edit again.");
+
+ const review = await getReviewState(env, sess.page.id, reviewMemory);
+ if (review.status === "awaiting_approver") {
+ const actor = payload.actorAccountId || payload.role;
+ if (review.approverAccountId && actor !== review.approverAccountId && payload.role !== "approver") {
+ throw new Error("Named approver has not accepted yet. Write-back is blocked.");
+ }
+ }
+
+ const accepted = (payload.decisions || sess.decisions || []).filter((d) => d.approved !== false);
+ const nextAdf = applyAcceptedChanges(sess.adf, accepted.map((d) => ({
+ ...d,
+ operation: d.operation || "edit",
+ chunk_id: d.chunk_id,
+ new_html: d.new_html,
+ insert_after_chunk_id: d.insert_after_chunk_id,
+ approved: true,
+ })));
+
+ const updated = await updatePage(env, {
+ pageId: sess.page.id,
+ title: sess.page.title,
+ adf: nextAdf,
+ versionNumber: sess.page.version?.number || 1,
+ message: "SuperDocs AI edit (single approved batch)",
+ });
+
+ await setReviewState(env, sess.page.id, { status: "approved", approvedAt: new Date().toISOString() }, reviewMemory);
+ sess.adf = nextAdf;
+ sess.page.version = updated.version;
+ return {
+ version: updated.version?.number || (sess.page.version?.number || 1) + 1,
+ demo: !!updated.demo,
+ title: sess.page.title,
+ };
+}
+
+async function sendToApprover(payload, ctx) {
+ const env = envFrom(ctx);
+ const pageId = payload.pageId;
+ const value = {
+ status: "awaiting_approver",
+ approverAccountId: payload.approverAccountId,
+ approverName: payload.approverName || payload.approverAccountId,
+ sessionId: payload.sessionId,
+ jobId: payload.jobId,
+ requestedAt: new Date().toISOString(),
+ };
+ await setReviewState(env, pageId, value, reviewMemory);
+ return value;
+}
+
+async function listPages(payload, ctx) {
+ const env = envFrom(ctx);
+ const spaceId = resolveSpaceId(payload, ctx);
+ const pages = await listSpacePages(env, spaceId);
+ return { spaceId, pages };
+}
+
+async function findUsers(payload, ctx) {
+ const env = envFrom(ctx);
+ return { users: await searchUsers(env, payload.query || "") };
+}
+
+async function exportBrandedPdf(payload, ctx) {
+ const env = envFrom(ctx);
+ const sess = payload.sessionId ? sessions.get(payload.sessionId) : null;
+ const page = await getPage(env, payload.pageId || sess?.page?.id || DEMO_PAGE_ID);
+ const { html } = adfToHtml(sess?.adf || page.adf);
+ const wrapped = `${LETTERHEAD}${html}`;
+ return exportPdf({
+ apiKey: env.SUPERDOCS_API_KEY,
+ html: wrapped,
+ filename: (page.title || "confluence-page").replace(/[^\w.-]+/g, "-").slice(0, 80),
+ });
+}
+
+const handlers = {
+ getContext,
+ loadPageHtml,
+ startEdit,
+ pollJob,
+ decide,
+ resumeLargeEdit,
+ writeBack,
+ sendToApprover,
+ listPages,
+ findUsers,
+ exportBrandedPdf,
+};
+
+module.exports = { handlers };
diff --git a/extensions/jaskiringg/confluence-ai/src/index.js b/extensions/jaskiringg/confluence-ai/src/index.js
new file mode 100644
index 0000000..cae9dd4
--- /dev/null
+++ b/extensions/jaskiringg/confluence-ai/src/index.js
@@ -0,0 +1,15 @@
+const Resolver = require("@forge/resolver").default;
+const { handlers } = require("./handlers");
+
+const resolver = new Resolver();
+
+for (const [name, fn] of Object.entries(handlers)) {
+ resolver.define(name, async (req) => {
+ const pageId = req.context?.extension?.content?.id;
+ const spaceId = req.context?.extension?.space?.id;
+ const apiKey = process.env.SUPERDOCS_API_KEY;
+ return fn(req.payload || {}, { pageId, spaceId, apiKey, kind: "forge", context: req.context });
+ });
+}
+
+exports.handler = resolver.getDefinitions();
diff --git a/extensions/jaskiringg/confluence-ai/src/lib/adf.js b/extensions/jaskiringg/confluence-ai/src/lib/adf.js
new file mode 100644
index 0000000..cc1a172
--- /dev/null
+++ b/extensions/jaskiringg/confluence-ai/src/lib/adf.js
@@ -0,0 +1,294 @@
+const { parse: parseHtml } = require("node-html-parser");
+
+const OPAQUE = new Set([
+ "table",
+ "codeBlock",
+ "extension",
+ "bodiedExtension",
+ "inlineExtension",
+ "mediaSingle",
+ "mediaGroup",
+ "embedCard",
+ "decisionList",
+ "taskList",
+ "layoutSection",
+ "expand",
+ "nestedExpand",
+]);
+
+function textOf(node) {
+ if (!node) return "";
+ if (node.type === "text") return node.text || "";
+ return (node.content || []).map(textOf).join("");
+}
+
+function escapeHtml(s) {
+ return String(s)
+ .replace(/&/g, "&")
+ .replace(//g, ">")
+ .replace(/"/g, """);
+}
+
+function marksWrap(text, marks) {
+ let html = escapeHtml(text);
+ for (const mark of marks || []) {
+ if (mark.type === "strong") html = `${html}`;
+ else if (mark.type === "em") html = `${html}`;
+ else if (mark.type === "underline") html = `${html}`;
+ else if (mark.type === "strike") html = `${html}`;
+ else if (mark.type === "code") html = `${html}`;
+ else if (mark.type === "link" && mark.attrs?.href) {
+ html = `${html}`;
+ }
+ }
+ return html;
+}
+
+function inlineHtml(node) {
+ if (!node) return "";
+ if (node.type === "text") return marksWrap(node.text || "", node.marks);
+ if (node.type === "hardBreak") return "
";
+ return (node.content || []).map(inlineHtml).join("");
+}
+
+function stableId(node, path) {
+ return (node.attrs && node.attrs.localId) || `adf-${path.replace(/\//g, "-")}`;
+}
+
+function ensureLocalIds(doc) {
+ const clone = JSON.parse(JSON.stringify(doc));
+ (clone.content || []).forEach((node, i) => {
+ node.attrs = node.attrs || {};
+ if (!node.attrs.localId) node.attrs.localId = `adf-${i}`;
+ });
+ return clone;
+}
+
+function blockToHtml(node, path) {
+ const id = stableId(node, path);
+ const attr = `data-chunk-id="${id}" data-adf-path="${path}" data-adf-type="${node.type}"`;
+
+ if (OPAQUE.has(node.type)) {
+ return `
${inlineHtml(node)}
`; + } + if (node.type === "blockquote") { + const inner = (node.content || []).map((c, i) => blockToHtml(c, `${path}/${i}`)).join(""); + return `${inner}`; + } + if (node.type === "bulletList" || node.type === "orderedList") { + const tag = node.type === "bulletList" ? "ul" : "ol"; + const items = (node.content || []) + .map((li) => `
North region freeze is 01:00-05:00 IST on release nights.
", + approved: true, + }, + { + operation: "delete", + chunk_id: table.attrs.localId, + approved: true, + }, + ]); + const texts = JSON.stringify(next); + assert.match(texts, /01:00-05:00/); + assert.equal(next.content.some((n) => n.type === "table"), true); + assert.equal(next.content.some((n) => n.type === "codeBlock"), true); + }); + + it("html fragment becomes heading + paragraph", () => { + const frag = htmlFragmentToAdf("Not stated in source.
"); + assert.equal(frag[0].type, "heading"); + assert.equal(frag[1].type, "paragraph"); + }); +}); + +describe("superdocs pending parse", () => { + it("parses twice when payload is a JSON string", () => { + const inner = [{ change_id: "ch_1", operation: "edit", chunk_id: "a", old_html: "x
", new_html: "y
" }]; + const wrapped = JSON.stringify(JSON.stringify(inner)); + const once = parseTwice(JSON.parse(wrapped)); + assert.equal(Array.isArray(once), true); + const pending = normalizePendingChanges(JSON.stringify(inner)); + assert.equal(pending[0].change_id, "ch_1"); + }); +}); diff --git a/extensions/jaskiringg/confluence-ai/src/lib/confluence.js b/extensions/jaskiringg/confluence-ai/src/lib/confluence.js new file mode 100644 index 0000000..1954e1d --- /dev/null +++ b/extensions/jaskiringg/confluence-ai/src/lib/confluence.js @@ -0,0 +1,345 @@ +const DEMO_PAGE_ID = "demo-page"; +const DEMO_SPACE_ID = "demo-space"; + +const DEMO_ADF = { + type: "doc", + version: 1, + content: [ + { + type: "heading", + attrs: { level: 1 }, + content: [{ type: "text", text: "IT Change Policy — North Region" }], + }, + { + type: "paragraph", + content: [ + { + type: "text", + text: "All production changes require a CAB ticket before cutover. Emergency changes still need a follow-up ticket within 24 hours.", + }, + ], + }, + { + type: "heading", + attrs: { level: 2 }, + content: [{ type: "text", text: "Freeze windows" }], + }, + { + type: "paragraph", + content: [ + { + type: "text", + text: "North region freeze is 02:00-06:00 IST on release nights. No master-data edits during freeze.", + }, + ], + }, + { + type: "table", + attrs: { isNumberColumnEnabled: false, layout: "default" }, + content: [ + { + type: "tableRow", + content: [ + { + type: "tableHeader", + attrs: {}, + content: [{ type: "paragraph", content: [{ type: "text", text: "System" }] }], + }, + { + type: "tableHeader", + attrs: {}, + content: [{ type: "paragraph", content: [{ type: "text", text: "Owner" }] }], + }, + ], + }, + { + type: "tableRow", + content: [ + { + type: "tableCell", + attrs: {}, + content: [{ type: "paragraph", content: [{ type: "text", text: "Order API" }] }], + }, + { + type: "tableCell", + attrs: {}, + content: [{ type: "paragraph", content: [{ type: "text", text: "Platform" }] }], + }, + ], + }, + ], + }, + { + type: "heading", + attrs: { level: 2 }, + content: [{ type: "text", text: "Rollback" }], + }, + { + type: "paragraph", + content: [ + { + type: "text", + text: "If error rate exceeds 2% after cutover, roll back within 15 minutes and page the on-call.", + }, + ], + }, + { + type: "codeBlock", + attrs: { language: "bash" }, + content: [{ type: "text", text: "kubectl rollout undo deploy/order-api" }], + }, + ], +}; + +function loadDemoAdf() { + return JSON.parse(JSON.stringify(DEMO_ADF)); +} + +function authHeader(email, token) { + return `Basic ${Buffer.from(`${email}:${token}`).toString("base64")}`; +} + +function confluenceConfigured(env) { + return !!(env.CONFLUENCE_BASE_URL && env.CONFLUENCE_EMAIL && env.CONFLUENCE_API_TOKEN); +} + +function liveConfluence(env, id) { + if (id && String(id).startsWith("demo")) return false; + return !!(env.useForgeApi || confluenceConfigured(env)); +} + +async function forgeFetch(pathname, { method = "GET", body } = {}) { + const { asApp, assumeTrustedRoute } = require("@forge/api"); + const res = await asApp().requestConfluence(assumeTrustedRoute(pathname), { + method, + headers: { + Accept: "application/json", + ...(body ? { "Content-Type": "application/json" } : {}), + }, + body: body ? JSON.stringify(body) : undefined, + }); + const text = await res.text(); + const data = text ? JSON.parse(text) : null; + if (!res.ok) { + throw new Error(`Confluence ${res.status}: ${text.slice(0, 500)}`); + } + return data; +} + +async function cfFetch(env, pathname, { method = "GET", body } = {}) { + const url = `${env.CONFLUENCE_BASE_URL.replace(/\/$/, "")}${pathname}`; + const res = await fetch(url, { + method, + headers: { + Authorization: authHeader(env.CONFLUENCE_EMAIL, env.CONFLUENCE_API_TOKEN), + Accept: "application/json", + ...(body ? { "Content-Type": "application/json" } : {}), + }, + body: body ? JSON.stringify(body) : undefined, + }); + const text = await res.text(); + const data = text ? JSON.parse(text) : null; + if (!res.ok) { + throw new Error(`Confluence ${res.status}: ${text.slice(0, 500)}`); + } + return data; +} + +async function productFetch(env, pathname, opts) { + if (env.useForgeApi) return forgeFetch(pathname, opts); + return cfFetch(env, pathname, opts); +} + +function parseAdfFromPage(page) { + const value = + page?.body?.atlas_doc_format?.value || + page?.body?.value || + null; + if (!value) throw new Error("Page has no atlas_doc_format body"); + return typeof value === "string" ? JSON.parse(value) : value; +} + +const DEMO_TITLES = { + [DEMO_PAGE_ID]: "IT Change Policy — North Region", + "demo-page-2": "Go-live checklist (draft)", + "demo-page-3": "SIT notes — week 12", +}; + +async function getPage(env, pageId) { + if (!liveConfluence(env, pageId)) { + const adf = loadDemoAdf(); + if (pageId === "demo-page-2") { + adf.content[0] = { + type: "heading", + attrs: { level: 1 }, + content: [{ type: "text", text: "Go-live checklist (draft)" }], + }; + } + if (pageId === "demo-page-3") { + adf.content[0] = { + type: "heading", + attrs: { level: 1 }, + content: [{ type: "text", text: "SIT notes — week 12" }], + }; + } + return { + id: String(pageId), + title: DEMO_TITLES[pageId] || "Demo page", + status: "current", + spaceId: DEMO_SPACE_ID, + version: { number: 1 }, + adf, + demo: true, + }; + } + const page = await productFetch( + env, + `/wiki/api/v2/pages/${encodeURIComponent(pageId)}?body-format=atlas_doc_format` + ); + return { + id: String(page.id), + title: page.title, + status: page.status, + spaceId: String(page.spaceId), + version: page.version, + adf: parseAdfFromPage(page), + demo: false, + }; +} + +async function updatePage(env, { pageId, title, adf, versionNumber, message }) { + if (!liveConfluence(env, pageId)) { + return { + id: DEMO_PAGE_ID, + title, + version: { number: (versionNumber || 1) + 1, message }, + demo: true, + adf, + }; + } + return productFetch(env, `/wiki/api/v2/pages/${encodeURIComponent(pageId)}`, { + method: "PUT", + body: { + id: String(pageId), + status: "current", + title, + body: { + representation: "atlas_doc_format", + value: JSON.stringify(adf), + }, + version: { + number: versionNumber + 1, + message: message || "SuperDocs AI edit (approved batch)", + }, + }, + }); +} + +async function listSpacePages(env, spaceId) { + if (!liveConfluence(env, spaceId) || spaceId === DEMO_SPACE_ID) { + return [ + { id: DEMO_PAGE_ID, title: "IT Change Policy — North Region", status: "current" }, + { id: "demo-page-2", title: "Go-live checklist (draft)", status: "current" }, + { id: "demo-page-3", title: "SIT notes — week 12", status: "current" }, + ]; + } + const data = await productFetch( + env, + `/wiki/api/v2/spaces/${encodeURIComponent(spaceId)}/pages?limit=50&status=current` + ); + return (data.results || []).map((p) => ({ + id: String(p.id), + title: p.title, + status: p.status, + })); +} + +function mapUser(u) { + if (!u) return null; + return { + accountId: u.accountId, + displayName: u.displayName || u.publicName || u.email, + email: u.email, + }; +} + +async function searchUsers(env, query) { + if (!liveConfluence(env)) { + return [ + { accountId: "demo-approver", displayName: "Priya Sharma (demo)", email: "priya@example.com" }, + { accountId: "demo-author", displayName: "Jaskirat Singh (demo)", email: "singhjass6404@gmail.com" }, + ].filter((u) => !query || u.displayName.toLowerCase().includes(query.toLowerCase())); + } + try { + const q = String(query || "").trim(); + if (!q) { + const me = await productFetch(env, "/wiki/rest/api/user/current"); + const mapped = mapUser(me); + return mapped ? [mapped] : []; + } + const data = await productFetch( + env, + `/wiki/rest/api/user/search?query=${encodeURIComponent(q)}&limit=10` + ); + const rows = Array.isArray(data) ? data : data.results || []; + return rows.map(mapUser).filter(Boolean); + } catch { + return [ + { + accountId: "current-user", + displayName: "Jaskirat Singh", + email: env.CONFLUENCE_EMAIL || "singhjass6404@gmail.com", + }, + ]; + } +} + +const PROPERTY_KEY = "superdocs-review"; + +async function getReviewState(env, pageId, memory) { + if (memory.has(pageId)) return memory.get(pageId); + if (!liveConfluence(env, pageId) || pageId === DEMO_PAGE_ID) { + return { status: "draft" }; + } + try { + const data = await productFetch( + env, + `/wiki/rest/api/content/${encodeURIComponent(pageId)}/property/${PROPERTY_KEY}` + ); + return data.value || { status: "draft" }; + } catch { + return { status: "draft" }; + } +} + +async function setReviewState(env, pageId, value, memory) { + memory.set(pageId, value); + if (!liveConfluence(env, pageId) || pageId === DEMO_PAGE_ID) return value; + try { + await productFetch( + env, + `/wiki/rest/api/content/${encodeURIComponent(pageId)}/property/${PROPERTY_KEY}`, + { method: "PUT", body: { key: PROPERTY_KEY, value } } + ); + } catch { + await productFetch( + env, + `/wiki/rest/api/content/${encodeURIComponent(pageId)}/property`, + { method: "POST", body: { key: PROPERTY_KEY, value } } + ); + } + return value; +} + +module.exports = { + DEMO_PAGE_ID, + DEMO_SPACE_ID, + confluenceConfigured, + getPage, + updatePage, + listSpacePages, + searchUsers, + getReviewState, + setReviewState, + loadDemoAdf, +}; diff --git a/extensions/jaskiringg/confluence-ai/src/lib/superdocs.js b/extensions/jaskiringg/confluence-ai/src/lib/superdocs.js new file mode 100644 index 0000000..597badd --- /dev/null +++ b/extensions/jaskiringg/confluence-ai/src/lib/superdocs.js @@ -0,0 +1,158 @@ +const DEFAULT_BASE = process.env.SUPERDOCS_API_BASE || "https://api.superdocs.app"; + +function parseJsonLenient(text) { + if (text == null) return null; + if (typeof text !== "string") return text; + const cleaned = text.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g, " "); + try { + return JSON.parse(cleaned); + } catch (err) { + const once = cleaned.replace(/,\s*([}\]])/g, "$1"); + return JSON.parse(once); + } +} + +function parseTwice(value) { + let v = value; + if (typeof v === "string") v = parseJsonLenient(v); + if (typeof v === "string") v = parseJsonLenient(v); + return v; +} + +function normalizePendingChanges(raw) { + let v = parseTwice(raw); + if (!v) return []; + if (!Array.isArray(v) && v.changes) v = parseTwice(v.changes); + if (!Array.isArray(v)) return []; + return v.map((item) => { + const c = typeof item === "string" ? parseTwice(item) : item; + return c && typeof c === "object" ? c : null; + }).filter(Boolean); +} + +async function sdFetch(path, { method = "GET", body, apiKey, base = DEFAULT_BASE } = {}) { + if (!apiKey) throw new Error("SUPERDOCS_API_KEY is missing"); + const res = await fetch(`${base}${path}`, { + method, + headers: { + Authorization: `Bearer ${apiKey}`, + ...(body ? { "Content-Type": "application/json" } : {}), + }, + body: body ? JSON.stringify(body) : undefined, + }); + const text = await res.text(); + const data = text ? parseJsonLenient(text) : null; + if (!res.ok) { + const msg = data?.detail || data?.error || data?.message || text.slice(0, 400); + const err = new Error(`SuperDocs ${res.status}: ${typeof msg === "string" ? msg : JSON.stringify(msg)}`); + err.status = res.status; + err.body = data; + throw err; + } + return data; +} + +async function startHitlEdit({ apiKey, sessionId, documentHtml, message, modelTier = "core" }) { + return sdFetch("/v1/chat/async", { + method: "POST", + apiKey, + body: { + message, + session_id: sessionId, + document_html: documentHtml, + approval_mode: "ask_every_time", + model_tier: modelTier, + }, + }); +} + +async function getJob({ apiKey, jobId }) { + const job = await sdFetch(`/v1/jobs/${jobId}`, { apiKey }); + const pending = normalizePendingChanges(job?.metadata?.pending_changes); + return { ...job, pending_changes: pending }; +} + +async function approveChanges({ apiKey, sessionId, jobId, decisions }) { + const changes = decisions.map((d) => ({ + change_id: d.change_id, + approved: !!d.approved, + ...(d.feedback ? { feedback: d.feedback } : {}), + })); + return sdFetch(`/v1/chat/${encodeURIComponent(sessionId)}/approve`, { + method: "POST", + apiKey, + body: { + job_id: jobId, + approved: true, + changes, + }, + }); +} + +async function continueJob({ apiKey, sessionId, jobId, shouldContinue }) { + return sdFetch(`/v1/chat/${encodeURIComponent(sessionId)}/continue`, { + method: "POST", + apiKey, + body: { job_id: jobId, continue: !!shouldContinue }, + }); +} + +async function exportPdf({ apiKey, sessionId, html, filename = "confluence-export" }) { + const res = await fetch(`${DEFAULT_BASE}/v1/documents/export`, { + method: "POST", + headers: { + Authorization: `Bearer ${apiKey}`, + "Content-Type": "application/json", + }, + body: JSON.stringify({ + session_id: html ? undefined : sessionId, + html: html || undefined, + format: "pdf", + options: { filename, paper_size: "A4", margins: "normal" }, + }), + }); + if (!res.ok) { + const text = await res.text(); + throw new Error(`Export failed ${res.status}: ${text.slice(0, 400)}`); + } + const buf = Buffer.from(await res.arrayBuffer()); + return { + filename: `${filename}.pdf`, + contentType: res.headers.get("content-type") || "application/pdf", + base64: buf.toString("base64"), + bytes: buf.length, + }; +} + +const HOUSE_STRUCTURE_PROMPT = `Normalise this Confluence page to the house structure below. +Keep every fact that is already in the page. Do not invent owners, dates, metrics, or systems. +Do not rewrite or remove blocks marked as preserved (tables, code, macros). +Use these headings, in this order, and move existing sentences under the right heading: + +#{err || "Loading page…"}
+ v{ctx.page.version} + {ctx.page.demo ? " · not writing to Confluence yet" : " · writes back to the wiki page"} + {" · "} + review: {ctx.review?.status || "draft"} + {!ctx.hasSuperDocsKey ? " · missing SUPERDOCS_API_KEY" : ""} +
++ House structure is applied one page at a time. Nothing is bulk-overwritten. + Open a page, review diffs, then move to the next. +
+No pending diffs. Select a section and send an instruction.
+ ) : ( + pending.map((c) => { + const d = diffPreview(c.old_html, c.new_html); + const accepted = decisions[c.change_id] !== false; + return ( +