create-freeholder 0.2.0-beta.4 → 0.2.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/dist/template/.changeset/blog-playground-content.md +4 -0
  2. package/dist/template/.changeset/blog-wordpress-structure.md +6 -0
  3. package/dist/template/.changeset/managed-preview-assistant.md +4 -0
  4. package/dist/template/.changeset/native-linux-install.md +6 -0
  5. package/dist/template/.changeset/public-beta-5.md +4 -0
  6. package/dist/template/.changeset/public-beta-6.md +4 -0
  7. package/dist/template/.github/ISSUE_TEMPLATE/bug_report.yml +1 -1
  8. package/dist/template/.github/workflows/release-tarballs.yml +117 -0
  9. package/dist/template/AGENTS.md +15 -2
  10. package/dist/template/Dockerfile +3 -0
  11. package/dist/template/MASTER.md +114 -11
  12. package/dist/template/README.md +1 -1
  13. package/dist/template/app/(admin)/admin/assistant/page.tsx +9 -1
  14. package/dist/template/app/(admin)/admin/blog/PostSettings.tsx +26 -0
  15. package/dist/template/app/(admin)/admin/blog/[kind]/page.tsx +53 -0
  16. package/dist/template/app/(admin)/admin/blog/actions.ts +186 -6
  17. package/dist/template/app/(admin)/admin/blog/comments/page.tsx +25 -0
  18. package/dist/template/app/(admin)/admin/blog/page.tsx +21 -5
  19. package/dist/template/app/(admin)/admin/imports/[id]/page.tsx +2 -0
  20. package/dist/template/app/(admin)/admin/pages/[id]/page.tsx +3 -0
  21. package/dist/template/app/(admin)/assistant-actions.ts +13 -6
  22. package/dist/template/app/(public)/[[...slug]]/ReaderComments.tsx +25 -0
  23. package/dist/template/app/(public)/[[...slug]]/blog-parts.tsx +153 -0
  24. package/dist/template/app/(public)/[[...slug]]/comment-actions.ts +16 -0
  25. package/dist/template/app/(public)/[[...slug]]/page.tsx +182 -18
  26. package/dist/template/app/api/chat/assistant/call/route.ts +35 -0
  27. package/dist/template/db/migrations/0061_blog_structure.sql +89 -0
  28. package/dist/template/db/migrations/0062_blog_reader_comments.sql +24 -0
  29. package/dist/template/db/migrations/meta/_journal.json +14 -0
  30. package/dist/template/deploy/README.md +26 -9
  31. package/dist/template/deploy/blog-wordpress-2026-11-07.md +146 -0
  32. package/dist/template/deploy/docker-selfhost/.env.example +11 -1
  33. package/dist/template/deploy/docker-selfhost/README.md +79 -50
  34. package/dist/template/deploy/docker-selfhost/infra/backup.sh +81 -0
  35. package/dist/template/deploy/docker-selfhost/infra/compose.https.yml +37 -1
  36. package/dist/template/deploy/docker-selfhost/infra/compose.yml +37 -1
  37. package/dist/template/deploy/docker-selfhost/migrate.md +8 -5
  38. package/dist/template/deploy/docker-selfhost/recipe.yaml +9 -10
  39. package/dist/template/deploy/docker-selfhost/selfhost.sh +206 -0
  40. package/dist/template/deploy/docker-selfhost/verify.md +11 -4
  41. package/dist/template/deploy/f-criteria-matrix.md +89 -0
  42. package/dist/template/deploy/linux/.env.example +28 -0
  43. package/dist/template/deploy/linux/README.md +181 -0
  44. package/dist/template/deploy/linux/freeholder +655 -0
  45. package/dist/template/deploy/linux/install.sh +173 -0
  46. package/dist/template/deploy/linux/migrate.md +17 -0
  47. package/dist/template/deploy/linux/recipe.yaml +50 -0
  48. package/dist/template/deploy/linux/share/Caddyfile.template +19 -0
  49. package/dist/template/deploy/linux/share/systemd/freeholder-backup.service +13 -0
  50. package/dist/template/deploy/linux/share/systemd/freeholder-backup.timer +12 -0
  51. package/dist/template/deploy/linux/share/systemd/freeholder.service +41 -0
  52. package/dist/template/deploy/linux/verify.md +22 -0
  53. package/dist/template/deploy/managed-preview-assistant.md +99 -0
  54. package/dist/template/eslint.config.mjs +3 -1
  55. package/dist/template/gitignore.template +1 -0
  56. package/dist/template/locales/ar.json +85 -6
  57. package/dist/template/locales/en.json +83 -4
  58. package/dist/template/locales/es.json +83 -4
  59. package/dist/template/locales/fr.json +85 -6
  60. package/dist/template/next.config.ts +2 -0
  61. package/dist/template/package.json +3 -2
  62. package/dist/template/packages/cli/package.json +1 -1
  63. package/dist/template/packages/create-freeholder/package.json +1 -1
  64. package/dist/template/packages/freeholder-app/package.json +1 -1
  65. package/dist/template/packages/mobile-app/package.json +1 -1
  66. package/dist/template/packages/plugin-kit/package.json +1 -1
  67. package/dist/template/packages/sdk/package.json +1 -1
  68. package/dist/template/packages/sdk/src/generated.ts +177 -9
  69. package/dist/template/packages/sdk/src/version.ts +1 -1
  70. package/dist/template/packages/templates/package.json +1 -1
  71. package/dist/template/proxy.ts +18 -1
  72. package/dist/template/public/managed-assistant/0.1.10/duplex-codec/NOTICE.txt +117 -0
  73. package/dist/template/public/managed-assistant/0.1.10/duplex-codec/audio-output-processor.js +267 -0
  74. package/dist/template/public/managed-assistant/0.1.10/duplex-codec/decoderWorker.min.js +847 -0
  75. package/dist/template/public/managed-assistant/0.1.10/duplex-codec/decoderWorker.min.wasm +0 -0
  76. package/dist/template/public/managed-assistant/0.1.10/duplex-codec/encoderWorker.min.js +1 -0
  77. package/dist/template/public/managed-assistant/0.1.10/manifest.json +12 -0
  78. package/dist/template/public/managed-assistant/0.1.10/pm-ai-duplex-client.js +1376 -0
  79. package/dist/template/scripts/build-release.d.mts +4 -0
  80. package/dist/template/scripts/build-release.mjs +171 -0
  81. package/dist/template/scripts/launch-prepare.mjs +6 -3
  82. package/dist/template/scripts/license-headers.mjs +3 -0
  83. package/dist/template/scripts/recipe-matrix.sh +22 -7
  84. package/dist/template/scripts/verify-wordpress-migration.d.mts +8 -0
  85. package/dist/template/scripts/verify-wordpress-migration.mjs +105 -0
  86. package/dist/template/security/adversarial-audit-2026-10-08.md +1 -1
  87. package/dist/template/src/adapters/ai/types.ts +5 -0
  88. package/dist/template/src/adapters/paradise/assistant.ts +37 -0
  89. package/dist/template/src/adapters/paradise/http.ts +4 -3
  90. package/dist/template/src/adapters/storage/local-mode.ts +54 -0
  91. package/dist/template/src/adapters/storage/local.ts +53 -26
  92. package/dist/template/src/core/contract/json-schema.ts +8 -0
  93. package/dist/template/src/core/demo/playground-inserts.ts +29 -0
  94. package/dist/template/src/core/demo/playground-policy.ts +9 -0
  95. package/dist/template/src/core/doctor/index.ts +19 -10
  96. package/dist/template/src/core/env.ts +8 -1
  97. package/dist/template/src/core/http/csp.ts +10 -2
  98. package/dist/template/src/core/http/csrf-client.ts +10 -0
  99. package/dist/template/src/core/import/service.ts +217 -12
  100. package/dist/template/src/core/import/wordpress.ts +80 -15
  101. package/dist/template/src/core/notifications/service.ts +1 -0
  102. package/dist/template/src/core/retention/registry.ts +2 -0
  103. package/dist/template/src/core/search/registry.ts +2 -0
  104. package/dist/template/src/core/seo/feeds.ts +2 -0
  105. package/dist/template/src/core/seo/jsonld.ts +46 -2
  106. package/dist/template/src/core/seo/legacy-proxy.ts +53 -0
  107. package/dist/template/src/core/seo/meta.ts +10 -7
  108. package/dist/template/src/core/seo/service.ts +14 -1
  109. package/dist/template/src/core/update/preflight.ts +3 -2
  110. package/dist/template/src/core/update/release-declaration.json +1 -1
  111. package/dist/template/src/core/update/service.ts +7 -17
  112. package/dist/template/src/modules/assistant/contract.ts +1 -1
  113. package/dist/template/src/modules/assistant/limits.ts +3 -0
  114. package/dist/template/src/modules/assistant/preview.ts +124 -0
  115. package/dist/template/src/modules/assistant/provider.ts +7 -0
  116. package/dist/template/src/modules/assistant/service.ts +21 -5
  117. package/dist/template/src/modules/cms/blocks/PreviewAssistantCall.tsx +176 -0
  118. package/dist/template/src/modules/cms/blocks/SiteChatClient.tsx +10 -4
  119. package/dist/template/src/modules/cms/blocks/surfaces.tsx +10 -0
  120. package/dist/template/src/modules/cms/blog-comments-schema.ts +27 -0
  121. package/dist/template/src/modules/cms/blog-comments.ts +111 -0
  122. package/dist/template/src/modules/cms/blog-schema.ts +146 -0
  123. package/dist/template/src/modules/cms/blog-service.ts +999 -0
  124. package/dist/template/src/modules/cms/blog.tsx +245 -25
  125. package/dist/template/src/modules/cms/manifest.ts +7 -1
  126. package/dist/template/src/modules/cms/read.ts +18 -0
  127. package/dist/template/src/modules/cms/service.ts +22 -4
  128. package/dist/template/src/modules/cms/tables.ts +2 -0
  129. package/dist/template/src/modules/seed/launch.ts +31 -3
  130. package/dist/template/tests/browser/blog-structure.spec.ts +69 -0
  131. package/dist/template/tests/core/agent-launch.test.ts +7 -2
  132. package/dist/template/tests/core/analytics-consent.test.ts +1 -1
  133. package/dist/template/tests/core/blog-playground.test.ts +106 -0
  134. package/dist/template/tests/core/blog-structure-comments.test.ts +166 -0
  135. package/dist/template/tests/core/client-readiness-security.test.ts +3 -1
  136. package/dist/template/tests/core/csp.test.ts +1 -1
  137. package/dist/template/tests/core/deploy-recipe.test.ts +54 -4
  138. package/dist/template/tests/core/internal-services.test.ts +4 -0
  139. package/dist/template/tests/core/legacy-redirect-proxy.test.ts +59 -0
  140. package/dist/template/tests/core/linux-install.test.ts +169 -0
  141. package/dist/template/tests/core/local-storage-mode.test.ts +29 -0
  142. package/dist/template/tests/core/locale-routing.test.ts +1 -1
  143. package/dist/template/tests/core/playground-cache.test.ts +1 -1
  144. package/dist/template/tests/core/playground.test.ts +3 -3
  145. package/dist/template/tests/core/preview-assistant-call.test.ts +88 -0
  146. package/dist/template/tests/core/private-preview-webhooks.test.ts +1 -1
  147. package/dist/template/tests/core/private-preview.test.ts +1 -1
  148. package/dist/template/tests/core/proxy-locale.test.ts +1 -1
  149. package/dist/template/tests/core/sdk-schema.test.ts +20 -0
  150. package/dist/template/tests/core/seo.test.ts +1 -1
  151. package/dist/template/tests/core/site-chat-client.test.ts +50 -0
  152. package/dist/template/tests/core/storage.test.ts +38 -2
  153. package/dist/template/tests/core/wordpress-import-flow.test.ts +81 -18
  154. package/dist/template/tests/core/wordpress-import.test.ts +25 -12
  155. package/dist/template/tests/core/wordpress-migration-verification.test.ts +37 -0
  156. package/dist/template/tests/modules/preview-assistant.test.ts +164 -0
  157. package/dist/template-manifest.json +490 -175
  158. package/package.json +1 -1
@@ -0,0 +1,173 @@
1
+ #!/bin/sh
2
+ # Copyright (C) 2026 Tony Aly
3
+ # SPDX-License-Identifier: Apache-2.0
4
+ #
5
+ # Install Freeholder on a plain Ubuntu or Debian server, without Docker (C3.44).
6
+ #
7
+ # curl -fsSLO https://github.com/CampDenman/freeholder/releases/download/vVERSION/install.sh
8
+ # sudo sh install.sh # asks for your domain, or uses a temporary address
9
+ # sudo sh install.sh --domain example.com # no questions
10
+ #
11
+ # Read it first; it is meant to be read. What it does, in order:
12
+ # 1. Installs PostgreSQL (distribution package, or the official PostgreSQL
13
+ # apt repository when the distribution's is older than 15), Caddy (the
14
+ # official Caddy apt repository), curl and openssl.
15
+ # 2. Creates a `freeholder` system user.
16
+ # 3. Downloads the release tarball for this machine (it bundles its own
17
+ # Node.js runtime), checks its SHA-256, and unpacks it to
18
+ # /opt/freeholder/releases/VERSION with /opt/freeholder/current pointing
19
+ # at it.
20
+ # 4. Hands over to `freeholder setup` from that release, which creates the
21
+ # database, generates secrets with openssl into /etc/freeholder (mode 640),
22
+ # writes the systemd units, the Caddyfile and the nightly backup timer,
23
+ # starts everything and prints your private claim link.
24
+ #
25
+ # Running it again is safe: it keeps existing secrets, data and settings.
26
+ # Everything it creates is listed in deploy/linux/README.md, including how to
27
+ # remove it.
28
+ set -eu
29
+
30
+ # Bumped with every release (tests/core/linux-install.test.ts checks it
31
+ # matches package.json), so a downloaded install.sh installs its own release.
32
+ FREEHOLDER_VERSION_DEFAULT="0.2.0-beta.6"
33
+ REPOSITORY="CampDenman/freeholder"
34
+
35
+ say() { printf 'freeholder: %s\n' "$*"; }
36
+ die() { printf 'freeholder: error: %s\n' "$*" >&2; exit 1; }
37
+
38
+ usage() {
39
+ cat <<'USAGE'
40
+ Usage: sudo sh install.sh [options]
41
+
42
+ --domain NAME The site's domain. Without it you are asked, and an empty
43
+ answer uses a temporary https://<ip>.sslip.io address
44
+ until you run `freeholder domain NAME`.
45
+ --email ADDRESS Optional address Let's Encrypt may contact about the
46
+ certificate.
47
+ --storage local|s3 Where uploaded media lives (default: local, on this
48
+ server under /var/lib/freeholder/media, included in the
49
+ nightly backup). s3 asks for a bucket and key.
50
+ --version VERSION Release to install (default: this script's release).
51
+ --tarball FILE Install from a downloaded tarball; FILE.sha256 must sit
52
+ beside it.
53
+ --yes Never ask; use defaults for anything not given.
54
+ --help Show this.
55
+ USAGE
56
+ }
57
+
58
+ version="$FREEHOLDER_VERSION_DEFAULT"
59
+ tarball=""
60
+ setup_args=""
61
+ while [ $# -gt 0 ]; do
62
+ case "$1" in
63
+ --domain|--email|--storage)
64
+ [ $# -ge 2 ] || die "$1 needs a value"
65
+ setup_args="$setup_args $1 $2"; shift 2 ;;
66
+ --version) [ $# -ge 2 ] || die "--version needs a value"; version="${2#v}"; shift 2 ;;
67
+ --tarball) [ $# -ge 2 ] || die "--tarball needs a file"; tarball="$2"; shift 2 ;;
68
+ --yes) setup_args="$setup_args --yes"; shift ;;
69
+ --help|-h) usage; exit 0 ;;
70
+ *) die "unknown option $1 (see --help)" ;;
71
+ esac
72
+ done
73
+ case "$version" in
74
+ *[!0-9A-Za-z.-]*|"") die "not a release version: $version" ;;
75
+ esac
76
+
77
+ [ "$(id -u)" = 0 ] || die "run it as root: sudo sh install.sh"
78
+ [ -r /etc/os-release ] || die "this installer supports Ubuntu and Debian"
79
+ . /etc/os-release
80
+ case "${ID:-} ${ID_LIKE:-}" in
81
+ *ubuntu*|*debian*) ;;
82
+ *) die "this installer supports Ubuntu and Debian (found ${PRETTY_NAME:-unknown}); see deploy/README.md for other hosts" ;;
83
+ esac
84
+ command -v systemctl >/dev/null 2>&1 || die "systemd is required"
85
+ case "$(uname -m)" in
86
+ x86_64|amd64) arch=x64 ;;
87
+ aarch64|arm64) arch=arm64 ;;
88
+ *) die "release tarballs exist for x86_64 and arm64, not $(uname -m)" ;;
89
+ esac
90
+ memory_kb=$(awk '/^MemTotal:/ {print $2}' /proc/meminfo)
91
+ if [ "${memory_kb:-0}" -lt 1800000 ]; then
92
+ say "warning: this server has less than 2 GB of memory; Freeholder and PostgreSQL need about 1 GB together and more as the site grows."
93
+ fi
94
+
95
+ export DEBIAN_FRONTEND=noninteractive
96
+ apt_updated=""
97
+ apt_update() { [ -n "$apt_updated" ] || { apt-get update -q; apt_updated=1; }; }
98
+ apt_install() { apt_update; apt-get install -y -q --no-install-recommends "$@"; }
99
+
100
+ say "installing curl, openssl and PostgreSQL"
101
+ apt_install ca-certificates curl openssl gnupg tar gzip postgresql-common
102
+
103
+ # PostgreSQL 15 or newer. Ubuntu 24.04 and Debian 12 ship it; older releases
104
+ # use the PostgreSQL project's own apt repository, set up by the script that
105
+ # Debian's postgresql-common package provides for exactly this.
106
+ pg_package=postgresql
107
+ candidate=$(apt-cache policy postgresql | awk '/Candidate:/ {print $2}')
108
+ candidate_major=${candidate%%+*}
109
+ case "$candidate_major" in
110
+ ''|*[!0-9]*) candidate_major=0 ;;
111
+ esac
112
+ if [ "$candidate_major" -lt 15 ]; then
113
+ say "this distribution's PostgreSQL is older than 15; adding the official PostgreSQL apt repository"
114
+ /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y
115
+ apt_updated=""
116
+ pg_package=postgresql-16
117
+ fi
118
+ apt_install "$pg_package"
119
+ systemctl enable --now postgresql >/dev/null
120
+
121
+ if ! command -v caddy >/dev/null 2>&1; then
122
+ say "installing Caddy from its official apt repository"
123
+ keyring=/usr/share/keyrings/caddy-stable-archive-keyring.gpg
124
+ curl -fsSL https://dl.cloudsmith.io/public/caddy/stable/gpg.key | gpg --batch --yes --dearmor -o "$keyring"
125
+ chmod 644 "$keyring"
126
+ curl -fsSL https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt > /etc/apt/sources.list.d/caddy-stable.list
127
+ apt_updated=""
128
+ apt_install caddy
129
+ fi
130
+
131
+ if ! id freeholder >/dev/null 2>&1; then
132
+ say "creating the freeholder system user"
133
+ useradd --system --user-group --home-dir /var/lib/freeholder --shell /usr/sbin/nologin freeholder
134
+ fi
135
+ install -d -m 755 -o root -g root /opt/freeholder /opt/freeholder/releases
136
+
137
+ name="freeholder-${version}-linux-${arch}"
138
+ release="/opt/freeholder/releases/${version}"
139
+ if [ ! -x "$release/bin/freeholder" ]; then
140
+ work=$(mktemp -d)
141
+ trap 'rm -rf "$work"' EXIT
142
+ if [ -n "$tarball" ]; then
143
+ [ -f "$tarball" ] && [ -f "$tarball.sha256" ] || die "--tarball needs FILE and FILE.sha256"
144
+ cp "$tarball" "$work/$name.tar.gz"
145
+ cp "$tarball.sha256" "$work/$name.tar.gz.sha256"
146
+ else
147
+ base="https://github.com/${REPOSITORY}/releases/download/v${version}"
148
+ say "downloading $name"
149
+ curl -fsSL --retry 3 -o "$work/$name.tar.gz" "$base/$name.tar.gz"
150
+ curl -fsSL --retry 3 -o "$work/$name.tar.gz.sha256" "$base/$name.tar.gz.sha256"
151
+ fi
152
+ expected=$(awk '{print $1; exit}' "$work/$name.tar.gz.sha256")
153
+ actual=$(sha256sum "$work/$name.tar.gz" | awk '{print $1}')
154
+ [ -n "$expected" ] && [ "$expected" = "$actual" ] || die "checksum mismatch for $name.tar.gz; nothing was installed"
155
+ say "checksum verified ($actual)"
156
+ tar -xzf "$work/$name.tar.gz" -C "$work"
157
+ top=$(tar -tzf "$work/$name.tar.gz" | head -1 | cut -d/ -f1)
158
+ [ -x "$work/$top/bin/freeholder" ] && [ -x "$work/$top/runtime/node/bin/node" ] || die "the tarball is not a Freeholder release"
159
+ rm -rf "$release.partial"
160
+ mv "$work/$top" "$release.partial"
161
+ chown -R root:root "$release.partial"
162
+ mv "$release.partial" "$release"
163
+ rm -rf "$work"
164
+ trap - EXIT
165
+ fi
166
+ if [ ! -e /opt/freeholder/current ]; then
167
+ ln -sfn "releases/${version}" /opt/freeholder/current.new
168
+ mv -T /opt/freeholder/current.new /opt/freeholder/current
169
+ fi
170
+ ln -sfn /opt/freeholder/current/bin/freeholder /usr/local/bin/freeholder
171
+
172
+ # shellcheck disable=SC2086 # setup_args is a list of words built above.
173
+ exec "$release/bin/freeholder" setup $setup_args
@@ -0,0 +1,17 @@
1
+ # Migrate to or from a Linux server
2
+
3
+ Target: `linux`
4
+
5
+ Follow the complete [Tier-1 migration runbook](../migration-runbook.md).
6
+
7
+ - **Out:** `sudo freeholder backup` writes `database.dump` (PostgreSQL custom
8
+ format) and `media.tar.gz`, whose paths are the storage keys. Restore the
9
+ dump on the target with `pg_restore --no-owner`, and copy the media to the
10
+ target's bucket with the same keys, for example
11
+ `rclone copy /var/lib/freeholder/media remote:bucket`.
12
+ - **In:** copy a backup directory from another Linux install (or build one: a
13
+ `pg_dump --format=custom` as `database.dump`, the bucket's objects as
14
+ `media/` inside `media.tar.gz`, and `sha256sum ./* > SHA256SUMS`) and run
15
+ `sudo freeholder restore /path/to/that-directory`.
16
+ - Keep `/etc/freeholder/freeholder.env` from the source: `CREDENTIAL_KEY`
17
+ decrypts stored provider credentials, and a new one cannot read them.
@@ -0,0 +1,50 @@
1
+ # Copyright (C) 2026 Tony Aly
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ # C3.44: Freeholder on a plain Ubuntu/Debian server, no Docker.
4
+ name: linux
5
+ schema: freeholder-deploy-recipe/v1
6
+ tier: 2
7
+ maintainers: ["@tonyaly"]
8
+ freeholder_min_version: "0.2.0-beta.5"
9
+ provides:
10
+ database: distro-postgres
11
+ storage: local-disk-or-s3
12
+ jobs: web-process
13
+ cron: systemd-timer
14
+ estimated_monthly_cost_usd: { min: 6, typical: 24 }
15
+ limits:
16
+ - "One server: local-disk media cannot be shared by a second app server; move media to S3 before scaling out"
17
+ - "Ubuntu 22.04+ or Debian 12+ with systemd, on x86_64 or arm64"
18
+ - "Media and the database are on the server's disk: keep the nightly backups somewhere else too (BACKUP_RCLONE_REMOTE)"
19
+ artifacts:
20
+ - deploy/linux/install.sh
21
+ - deploy/linux/freeholder
22
+ - deploy/linux/share/systemd/freeholder.service
23
+ - deploy/linux/share/systemd/freeholder-backup.service
24
+ - deploy/linux/share/systemd/freeholder-backup.timer
25
+ - deploy/linux/share/Caddyfile.template
26
+ - scripts/build-release.mjs
27
+ required_environment:
28
+ - APP_URL
29
+ - DATABASE_URL
30
+ - BOOTSTRAP_SECRET
31
+ - SESSION_SECRET
32
+ - CREDENTIAL_KEY
33
+ - FREEHOLDER_STORAGE
34
+ - LOCAL_STORAGE_ROOT
35
+ operations:
36
+ install: "sudo sh install.sh --domain $FREEHOLDER_DOMAIN"
37
+ verify: "sudo freeholder status"
38
+ backup: "sudo freeholder backup"
39
+ restore: "sudo freeholder restore latest"
40
+ migrate-in: "sudo freeholder restore /path/to/backup-directory"
41
+ migrate-out: "sudo freeholder backup && sudo ls /var/lib/freeholder/backups"
42
+ update: "sudo freeholder update $FREEHOLDER_VERSION"
43
+ rollback: "sudo freeholder rollback"
44
+ update:
45
+ # The release tarball plays the image: a new one is unpacked beside the
46
+ # old, `current` is switched, and a failed health check switches back.
47
+ strategy: image-swap
48
+ rollback: previous release directory plus the pre-update database backup
49
+ automatable: false
50
+ tested_on: "2026-11-06"
@@ -0,0 +1,19 @@
1
+ # Copyright (C) 2026 Tony Aly
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ # managed-by-freeholder: `freeholder setup` and `freeholder domain` rewrite
4
+ # this file. Caddy obtains and renews the HTTPS certificate itself; the
5
+ # domain must resolve to this server with ports 80 and 443 open.
6
+ __GLOBAL__
7
+ __DOMAIN__ {
8
+ encode zstd gzip
9
+ # C11.10: Next's image optimizer is off (images.unoptimized); refuse its
10
+ # endpoint at the edge too (GHSA-2464-fhr4-w9xw).
11
+ @nextImage path /_next/image /_next/image/*
12
+ respond @nextImage 404
13
+ # C11.10: the connecting address, overwritten on every request. The app
14
+ # trusts it because TRUSTED_CLIENT_IP_HEADER names it and the app listens
15
+ # only on 127.0.0.1.
16
+ reverse_proxy 127.0.0.1:3000 {
17
+ header_up X-Freeholder-Client-Ip {client_ip}
18
+ }
19
+ }
@@ -0,0 +1,13 @@
1
+ # Copyright (C) 2026 Tony Aly
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ # C3.44: nightly database and media backup (freeholder-backup.timer).
4
+ [Unit]
5
+ Description=Freeholder nightly backup
6
+ After=postgresql.service
7
+
8
+ [Service]
9
+ Type=oneshot
10
+ ExecStart=/usr/local/bin/freeholder backup --scheduled
11
+ UMask=0077
12
+ Nice=10
13
+ IOSchedulingClass=idle
@@ -0,0 +1,12 @@
1
+ # Copyright (C) 2026 Tony Aly
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ [Unit]
4
+ Description=Freeholder nightly backup schedule
5
+
6
+ [Timer]
7
+ OnCalendar=*-*-* 03:15:00
8
+ RandomizedDelaySec=30min
9
+ Persistent=true
10
+
11
+ [Install]
12
+ WantedBy=timers.target
@@ -0,0 +1,41 @@
1
+ # Copyright (C) 2026 Tony Aly
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ # C3.44: the Freeholder web process on a native Linux install. Migrations run
4
+ # inside this process before it reports ready (instrumentation.node.ts), the
5
+ # same as the container image, so there is no separate migration unit that
6
+ # could run a different release's migrations.
7
+ [Unit]
8
+ Description=Freeholder
9
+ Documentation=https://github.com/CampDenman/freeholder/blob/main/deploy/linux/README.md
10
+ After=network-online.target postgresql.service
11
+ Wants=network-online.target postgresql.service
12
+
13
+ [Service]
14
+ Type=simple
15
+ User=freeholder
16
+ Group=freeholder
17
+ EnvironmentFile=/etc/freeholder/freeholder.env
18
+ Environment=NODE_ENV=production NEXT_MANUAL_SIG_HANDLE=true PORT=3000 HOSTNAME=127.0.0.1
19
+ WorkingDirectory=/opt/freeholder/current/app
20
+ ExecStart=/opt/freeholder/current/runtime/node/bin/node server.js
21
+ Restart=always
22
+ RestartSec=5
23
+ TimeoutStopSec=45
24
+ UMask=0027
25
+ LimitNOFILE=65536
26
+ # The release is root-owned and read-only to the service; it may write only
27
+ # its data directory (media, Next's cache).
28
+ NoNewPrivileges=yes
29
+ ProtectSystem=strict
30
+ ProtectHome=yes
31
+ PrivateTmp=yes
32
+ PrivateDevices=yes
33
+ ReadWritePaths=/var/lib/freeholder
34
+ ProtectKernelTunables=yes
35
+ ProtectKernelModules=yes
36
+ ProtectControlGroups=yes
37
+ RestrictSUIDSGID=yes
38
+ LockPersonality=yes
39
+
40
+ [Install]
41
+ WantedBy=multi-user.target
@@ -0,0 +1,22 @@
1
+ # Verify: Linux server (no Docker)
2
+
3
+ Also complete the shared [Tier-1 verification](../recipe-verification.md);
4
+ where it says "bucket", read "`/var/lib/freeholder/media`" for local storage.
5
+
6
+ - [ ] `sudo freeholder status` passes every check: service, PostgreSQL, Caddy,
7
+ local readiness, HTTPS with a valid certificate, media directory, backup
8
+ timer and free disk. It is the Doctor for this recipe and needs no Node,
9
+ pnpm or checkout.
10
+ - [ ] `https://YOUR-DOMAIN` loads with no browser warning and a fresh
11
+ instance sends you to `/setup`.
12
+ - [ ] Only ports 22, 80 and 443 answer from outside. PostgreSQL listens on
13
+ localhost only (`ss -ltn | grep 5432` shows `127.0.0.1`), and so does the
14
+ app (`127.0.0.1:3000`).
15
+ - [ ] Upload an image, then `sudo ls -R /var/lib/freeholder/media`: it is
16
+ there, and `sudo systemctl restart freeholder` keeps it.
17
+ - [ ] `sudo freeholder backup` writes a directory under
18
+ `/var/lib/freeholder/backups` with `database.dump`, `media.tar.gz` and
19
+ `SHA256SUMS`.
20
+ - [ ] `sudo freeholder restore latest` brings the site back with the same
21
+ pages and media. **Do this once before you trust the backup.**
22
+ - [ ] `systemctl list-timers freeholder-backup.timer` shows the next run.
@@ -0,0 +1,99 @@
1
+ # Managed preview assistant (C3.45)
2
+
3
+ This consumer is prepared for review. It has no production acceptance and
4
+ does not authorize enabling PM's version 3 generator or clearing a character.
5
+ The matching PM backend is `feat/autopilot-preview-video-assistant-20261106`.
6
+ Release the compatible consumer before PM emits version 3 specs. Version 1
7
+ and 2 specs still install without an assistant.
8
+
9
+ Version 3 explicitly supplies:
10
+
11
+ ```json
12
+ "assistant": {
13
+ "provider": "paradise",
14
+ "enabled": true,
15
+ "dailyCapUsd": 1,
16
+ "contentMode": "sfw"
17
+ }
18
+ ```
19
+
20
+ Optional `hours` are owner-supplied facts. Missing hours stay unknown. The
21
+ installer uses ordinary settings/module services, adds the existing site-chat
22
+ block to Contact, and configures the existing assistant provider. Text replies
23
+ remain ordinary assistant messages on the contact's canonical conversation.
24
+ No chatbot age-confirmation form is added.
25
+
26
+ The preview's server needs its own scoped `PARADISEMODERN_API_KEY`, plus
27
+ `PARADISEMODERN_URL` and exact HTTPS voice/face worker origins in
28
+ `PARADISEMODERN_ASSISTANT_ORIGINS`. Install these in the preview's private
29
+ provider configuration. Never put the key in a launch spec, browser bundle,
30
+ page, screenshot or commit. A key is issued through PM's owner-authorized
31
+ preview-key operation, not by another site key. With no worker origins or
32
+ cleared talent, the UI offers text. An existing private link and owner claim
33
+ remain separate from assistant credentials.
34
+
35
+ PM owns exact-asset clearance, SFW knowledge/rules, plan allowance, owner
36
+ credit, daily list-price cap, GPU admission and authoritative settlement. The
37
+ site derives `visitor_ref` from its validated chat cookie; a browser cannot
38
+ supply one, an account, a prompt, an arbitrary talent, or a provider key.
39
+ `/api/chat/assistant/call` refuses cross-site requests and uses the ordinary
40
+ service permission/CSRF/audit path. Owner settings use the same scoped services
41
+ from the admin screen and API. Managed amounts are USD cents, independent of
42
+ the business's storefront currency, and the managed cap is daily.
43
+
44
+ For text, Freeholder serializes budget claims and reserves the whole remaining
45
+ local cap, passes it as a maximum to PM's quote/admission, and settles the
46
+ actual list-price receipt into the existing turn meter. An unknown timeout
47
+ keeps the reservation for ledger reconciliation; it never assumes no charge.
48
+ That conservative failure can exhaust the local cap until the next period.
49
+ No automatic retry, budget reset or unsupported reconciliation is performed.
50
+
51
+ Voice/video use the byte-pinned PM duplex 0.1.10 distribution in
52
+ `public/managed-assistant/0.1.10`, with same-origin codecs and preserved MIT/BSD
53
+ notices. Their manifest digests are tested. The site opens only configured
54
+ worker origins on Contact (including localized paths before locale rewrite),
55
+ suppresses call controls on site-chat blocks placed elsewhere, asks for microphone access after a click, polls
56
+ bounded queue tickets, renews leases within the server's hard deadline and
57
+ always attempts End and local media cleanup. Browser captions are explicitly
58
+ labeled browser observations and deduplicated onto the existing conversation;
59
+ they are never billing, identity or consent receipts.
60
+
61
+ Local validation: existing launch/assistant suites 72 cases on isolated native
62
+ PostgreSQL; 10 new managed consumer cases cover v3 compatibility/installation,
63
+ byte pins, CSP, actual receipt and unknown-charge holds, concurrent claims,
64
+ visitor binding, End after off, owner authorization and caption deduplication.
65
+ TypeScript, focused lint, transaction-boundary, locale, licensing and plan
66
+ checks are separate from protected CI and production acceptance.
67
+
68
+ Before closing C3.45, qualify both exact deployed releases, text fallback on
69
+ the actual PM-hosted preview, owner off/cap/talent changes, one approved real
70
+ call with media readiness, captions, ordinary End, worker stop and one durable
71
+ settlement, plus cross-visitor refusals. Sienna's replacement voice still needs
72
+ Tony's listening approval and exact-asset clearance. No live call is accepted
73
+ from a fake grant or local test.
74
+
75
+ Peer review qualified the multilingual CSP defect as source integration, not a
76
+ live English-preview incident. Contact, /fr/contact and localized variants now
77
+ share the exact media policy; unrelated pages retain their ordinary policy.
78
+ Focused CSP/browser suites18 pass (7 database cases skipped in that invocation);
79
+ native managed tests and full fast gates are recorded separately.
80
+
81
+ Existing signed-in site-chat HTTP integration also omitted the double-submit
82
+ CSRF header on message/assistant/End requests. All chat media/text actions now
83
+ reuse a browser-safe token helper; a mounted browser regression runs those
84
+ requests through the real requireCsrf guard with a simulated httpOnly login
85
+ cookie. Anonymous visitor behavior and server CSRF requirements are preserved.
86
+
87
+ Hosted full CI found two additional source integration defects (shards19/26).
88
+ The first top-level discriminated object-action union reached a MCP adapter
89
+ that required an explicit root object type and otherwise erased every oneOf
90
+ branch. The shared JSONSchema projection now retains all object alternatives
91
+ and required fields with a semantically equivalent explicit root object;
92
+ mixed primitive unions stay unchanged. Native old-source MCP reproduction
93
+ was red; the corrected HTTP/MCP/SDK projections are qualified together.
94
+
95
+ The playground completeness guard also found managed call control and its
96
+ private caption phase unclassified. Unknown services already failed closed;
97
+ explicit refusal reasons now keep both provider-backed actions unavailable
98
+ in demos. No provider admission or privacy leak was observed. Both findings
99
+ remain linked to C3.45 until normal green release and deployed acceptance.
@@ -164,7 +164,9 @@ export default tseslint.config(
164
164
  // pnpm workspace with its own tsconfig, dependencies and CI job, so
165
165
  // type-aware linting here would resolve its imports against the wrong
166
166
  // project and report every one of them as missing.
167
- ignores: [".next/**", ".work/**", "node_modules/**", "packages/**", "db/**", "apps/**"],
167
+ // Byte-pinned shared transport build and MIT/BSD codecs; source policy
168
+ // belongs to their owning project. Consumer manifest digests are tested.
169
+ ignores: [".next/**", ".work/**", "node_modules/**", "packages/**", "db/**", "apps/**", "public/managed-assistant/0.1.10/**"],
168
170
  },
169
171
  // Type-aware from here down. Several gates in §15 are statements about
170
172
  // values, not syntax, and cannot be written without the type checker.
@@ -49,3 +49,4 @@ __pycache__/
49
49
 
50
50
  # Copied from deploy/digitalocean-droplet/infra at build time (packages/cli/scripts/copy-recipe.mjs).
51
51
  packages/cli/recipes/
52
+ .tools/
@@ -751,6 +751,24 @@
751
751
  "assistant.provider.anthropic": "Anthropic",
752
752
  "assistant.provider.none": "بلا مساعد",
753
753
  "assistant.provider.openai": "OpenAI أو أي شيء يتحدث بنسقه",
754
+ "assistant.provider.paradise": "Paradise Modern",
755
+ "assistant.call.voiceFallback": "الفيديو غير متاح. تستمر المحادثة بالصوت.",
756
+ "assistant.call.label": "مساعد ذكاء اصطناعي صوتي ومرئي",
757
+ "assistant.call.captions": "تظهر نصوص المكالمة في هذه المحادثة وصندوق وارد النشاط التجاري.",
758
+ "assistant.call.video": "بدء الفيديو",
759
+ "assistant.call.voice": "بدء الصوت",
760
+ "assistant.call.leave": "مغادرة الانتظار",
761
+ "assistant.call.end": "إنهاء المكالمة",
762
+ "assistant.call.waiting": "كل المساعدين يساعدون أشخاصًا آخرين. يمكنك متابعة الكتابة أثناء الانتظار.",
763
+ "assistant.call.unavailable": "الصوت والفيديو غير متاحين الآن. لا يزال بإمكانك إرسال رسالة.",
764
+ "assistant.call.connecting": "جارٍ الاتصال بمساعدك الذكي…",
765
+ "assistant.call.captionFailed": "تستمر المكالمة، لكن تعذر حفظ بعض النصوص. يمكنك أيضًا كتابة رسالة.",
766
+ "assistant.call.ended": "انتهت المكالمة. لا يزال بإمكانك إرسال رسالة.",
767
+ "assistant.call.lost": "تعذر استمرار اتصال المكالمة. لا يزال بإمكانك إرسال رسالة.",
768
+ "assistant.call.microphone": "تعذر الاتصال. اسمح باستخدام الميكروفون أو أرسل رسالة.",
769
+ "assistant.managed.talent": "شخصية المساعد",
770
+ "assistant.managed.clearance": "تظهر فقط الشخصيات الحاصلة على موافقة حالية لهذا الاستخدام. يجيب المساعد الافتراضي نصيًا حتى اعتماد صوته وصورته. الميزانيات المُدارة يومية ومقاسة بالسنت الأمريكي.",
771
+ "assistant.managed.textFallback": "المساعد الافتراضي — نص حتى اكتمال الموافقة",
754
772
  "assistant.scope.hand_to_a_person": "التسليم إلى شخص",
755
773
  "assistant.scope.off": "غير مسموح",
756
774
  "assistant.scope.on": "مسموح",
@@ -1840,9 +1858,9 @@
1840
1858
  "cms.editor.noAssets": "لا توجد صور في المكتبة بعد. ارفع صورة من صفحة الوسائط.",
1841
1859
  "cms.editor.noImage": "لم يتم اختيار صورة",
1842
1860
  "cms.editor.noCollection": "لم تُختر أي مجموعة",
1843
- "cms.editor.noCollections": "لا مجموعات بعد. أنشئ واحدة من المنتجات ← المجموعات.",
1861
+ "cms.editor.noCollections": "لا توجد مجموعات بعد. أنشئ واحدة من المنتجات ← المجموعات.",
1844
1862
  "cms.editor.noProduct": "لم يُختر أي منتج",
1845
- "cms.editor.noProducts": "لا منتجات بعد. أنشئ واحدًا من المنتجات.",
1863
+ "cms.editor.noProducts": "لا توجد منتجات بعد. أنشئ واحدًا من المنتجات.",
1846
1864
  "cms.editor.numbered": "قائمة مرقمة",
1847
1865
  "cms.editor.paste": "لصق المقطع",
1848
1866
  "cms.editor.preview": "معاينة",
@@ -7221,7 +7239,6 @@
7221
7239
  "cms.block.collectionShowcase": "عرض المجموعة",
7222
7240
  "cms.block.productRow": "صف المنتجات",
7223
7241
  "cms.block.promoBand": "شريط ترويجي",
7224
- "cms.field.collectionSlug": "المجموعة",
7225
7242
  "cms.field.showPrices": "إظهار أزرار الشراء",
7226
7243
  "cms.field.products": "المنتجات",
7227
7244
  "cms.choice.limit.0": "لا شيء",
@@ -7278,8 +7295,6 @@
7278
7295
  "cms.editor.showOutlines": "إظهار حدود الكتل",
7279
7296
  "cms.editor.hideOutlines": "إخفاء حدود الكتل",
7280
7297
  "cms.editor.zoom": "التكبير",
7281
- "cms.editor.noCollections": "لا توجد مجموعات بعد. أنشئ واحدة من المنتجات ← المجموعات.",
7282
- "cms.editor.noProducts": "لا توجد منتجات بعد. أنشئ واحدًا من المنتجات.",
7283
7298
  "cms.editor.pickedProducts": "{count} محدد",
7284
7299
  "common.done": "تم",
7285
7300
  "cms.storeSection.visitCollection": "تسوّق {title}",
@@ -8415,5 +8430,69 @@
8415
8430
  "linkinbio.admin.startsAt": "يظهر من",
8416
8431
  "linkinbio.admin.endsAt": "يظهر حتى",
8417
8432
  "linkinbio.admin.zone": "الأوقات بتوقيت {zone}.",
8418
- "settings.modules.name.linkinbio": "رابط في النبذة"
8433
+ "settings.modules.name.linkinbio": "رابط في النبذة",
8434
+ "blog.by": "بقلم",
8435
+ "blog.updated": "آخر تحديث",
8436
+ "blog.tags": "الوسوم",
8437
+ "blog.categories": "التصنيفات",
8438
+ "blog.aboutAuthor": "نبذة عن الكاتب",
8439
+ "blog.authors": "الكتّاب",
8440
+ "blog.author": "الكاتب",
8441
+ "blog.saved": "تم الحفظ.",
8442
+ "blog.name": "الاسم",
8443
+ "blog.bio": "السيرة",
8444
+ "blog.description": "الوصف",
8445
+ "blog.privateEmail": "البريد الإلكتروني (خاص)",
8446
+ "blog.parent": "التصنيف الأصل",
8447
+ "blog.none": "لا شيء",
8448
+ "blog.seoTitle": "عنوان البحث",
8449
+ "blog.seoDescription": "وصف البحث",
8450
+ "blog.noindex": "استبعاد هذا الأرشيف من نتائج البحث",
8451
+ "blog.save": "حفظ",
8452
+ "blog.delete": "حذف",
8453
+ "blog.directoryEmpty": "لا توجد عناصر بعد. أضف العنصر الأول أعلاه.",
8454
+ "blog.postSettings": "إعدادات التدوينة",
8455
+ "blog.isPost": "إدراج هذه الصفحة في المدونة",
8456
+ "blog.commentsEnabled": "السماح بتعليقات القراء",
8457
+ "blog.archive.category": "التصنيف",
8458
+ "blog.archive.tag": "الوسم",
8459
+ "blog.archive.author": "الكاتب",
8460
+ "blog.archive.empty": "لا توجد تدوينات منشورة هنا بعد.",
8461
+ "blog.settings": "إعدادات المدونة",
8462
+ "blog.categoryBase": "بادئة عناوين التصنيفات",
8463
+ "blog.tagBase": "بادئة عناوين الوسوم",
8464
+ "blog.authorBase": "بادئة عناوين الكتّاب",
8465
+ "blog.postsPerPage": "التدوينات في الصفحة",
8466
+ "blog.comments": "التعليقات",
8467
+ "blog.commentStatus": "الحالة",
8468
+ "blog.commentAll": "كل التعليقات",
8469
+ "blog.commentEmpty": "لا توجد تعليقات في هذا العرض.",
8470
+ "blog.commentPost": "فتح المقال",
8471
+ "blog.commentReceived": "تعليقك بانتظار المراجعة.",
8472
+ "blog.commentFailed": "تعذر إرسال تعليقك. تحقق من الحقول وحاول مجددًا.",
8473
+ "blog.commentInReplyTo": "ردًا على تعليق سابق",
8474
+ "blog.commentLeave": "اترك تعليقًا",
8475
+ "blog.commentPrivacy": "تظهر التعليقات بعد الموافقة. اسمك وتعليقك متاحان للجميع؛ يبقى بريدك الإلكتروني خاصًا ولا يشترك في رسائل التسويق.",
8476
+ "blog.commentEmail": "البريد الإلكتروني (خاص)",
8477
+ "blog.commentReply": "الرد على",
8478
+ "blog.commentBody": "التعليق",
8479
+ "blog.commentSubmit": "إرسال للموافقة",
8480
+ "blog.commentClosed": "التعليقات مغلقة.",
8481
+ "blog.commentNotificationTitle": "تعليق جديد بانتظار الموافقة",
8482
+ "blog.commentNotificationBody": "علّق قارئ على {title}.",
8483
+ "blog.commentState.pending": "قيد الانتظار",
8484
+ "blog.commentState.approved": "موافق عليه",
8485
+ "blog.commentState.spam": "مزعج",
8486
+ "blog.commentState.trash": "المحذوفات",
8487
+ "blog.archive.date": "الأرشيف حسب التاريخ",
8488
+ "cms.field.category": "التصنيف",
8489
+ "cms.field.tag": "الوسم",
8490
+ "cms.field.author": "الكاتب",
8491
+ "cms.field.date": "التاريخ (YYYY أو YYYY-MM أو YYYY-MM-DD)",
8492
+ "cms.field.showCategories": "عرض التصنيفات",
8493
+ "blog.commentWebsite": "الموقع الإلكتروني",
8494
+ "blog.linkedAccount": "الحساب المرتبط",
8495
+ "blog.guestAuthor": "كاتب ضيف (دون تسجيل دخول)",
8496
+ "imports.count.commentsImported": "التعليقات المستوردة",
8497
+ "imports.count.commentsStaged": "تعليقات مؤجلة حتى النشر"
8419
8498
  }