# GLMChat V2.2 Installation and Acceptance Guide

Updated: 22 July 2026

## 1. Hosting requirements

- HTTPS-enabled LiteSpeed or Apache-compatible shared hosting.
- PHP 8.2 or later.
- PHP extensions: `sqlite3`, `curl`, `json`, `openssl`, `mbstring`, `fileinfo` and `zip`.
- Writable private `storage/` directory.
- `.htaccess` support for rewrite and header rules.
- No Node.js, Python, Composer, container or background daemon is required on the production host.

## 2. New installation

1. Create an empty HTTPS directory at the domain root or intended nested path.
2. Upload the contents of the supplied `app/` directory, or extract the standalone direct-deployment ZIP in that directory.
3. Confirm `.htaccess`, `server/.htaccess` and `storage/.htaccess` remain present.
4. Make `storage/` writable by PHP without making it publicly browsable.
5. Open `/api/status` and confirm it returns a controlled success response. A controlled `ENVIRONMENT_INVALID` response identifies missing extensions without exposing stack traces or private paths.
6. Open the application in Chrome for Android or Samsung Internet.
7. Complete first-use setup: create the six-digit PIN, enter and test the Together API key, then review optional recovery guidance.
8. Install the PWA from the browser when prompted.

## 3. Upgrade procedure

1. Export any required user data through the application.
2. Back up the complete existing `storage/` directory outside the public web root.
3. Record the current release ZIP and SHA-256 for rollback.
4. Put the application into a maintenance window if users are active.
5. Upload new immutable `assets/` files first.
6. Upload server files and mutable coordination files next.
7. Upload `index.html` last.
8. Preserve the existing `storage/` directory; do not replace it with an empty packaged directory.
9. Open `/api/status`, log in, and allow forward-only migrations to complete.
10. Confirm existing projects, conversations, queues and settings remain available.
11. Trigger the service-worker update and verify the application reloads without clearing IndexedDB or pending mutations.

## 4. Rollback

1. Preserve the current `storage/` directory and take another backup before rollback.
2. Restore the previous application files without restoring an older database over a migrated database unless a separately tested database rollback plan exists.
3. Restore the previous immutable assets and coordination files as one coherent release.
4. Clear only obsolete GLMChat shell caches through the recovery interface; do not clear IndexedDB or queued mutations.
5. Verify login, projects, conversations and offline queues.

Database migrations are forward-only. A code rollback after a schema upgrade must be assessed against the migration compatibility notes rather than assumed safe.

## 5. Post-installation acceptance

### Server and security

- [ ] `/api/status` reports a healthy environment.
- [ ] HTTP requests are rejected rather than redirected using an untrusted Host header.
- [ ] Root and nested-subdirectory routes work.
- [ ] `storage/`, `server/`, `source/`, `tests/`, `scripts/`, `handover/`, `evidence/` and `implementation-prompts/` are not publicly accessible.
- [ ] PHP, database, log, key and evidence files cannot be downloaded.
- [ ] CSP contains no `unsafe-eval` and no uncontrolled remote script source.
- [ ] API, setup and authentication responses use `Cache-Control: no-store`.
- [ ] Session cookies are Secure, HttpOnly and SameSite where HTTPS is active.

### Application and PWA

- [ ] Welcome, setup and PIN login work.
- [ ] Together API-key validation succeeds.
- [ ] Chat streams a response and Stop works.
- [ ] A project can be created and its selected files are visibly included in chat context.
- [ ] An agent, workflow and team can be saved and launched.
- [ ] A run shows real stages, workers, approvals and events.
- [ ] Pause, resume, cancel and retry operate only in valid states.
- [ ] A read-only tool executes; a destructive tool requires approval and recent PIN.
- [ ] Offline launch works after an initial online load.
- [ ] Offline chat remains a draft and is not silently submitted.
- [ ] Pending mutations resume in order after reconnection.
- [ ] Conflicts can be reviewed and resolved.
- [ ] A service-worker update preserves IndexedDB and queued work.

### Android and accessibility

- [ ] Chrome for Android installation and update work.
- [ ] Samsung Internet installation and update work.
- [ ] Android Back closes overlays before navigating away.
- [ ] The keyboard does not obscure the composer.
- [ ] Portrait, short landscape and display cut-outs are usable.
- [ ] 200% text and Android large text do not clip controls.
- [ ] TalkBack announces controls, stages and approval states correctly.
- [ ] Reduced-motion mode removes nonessential animation.

### Live provider acceptance

- [ ] GLM-5.1 text and coding requests succeed.
- [ ] Streaming and cancellation succeed.
- [ ] Structured JSON output validates.
- [ ] Function calling executes through the PHP allowlist.
- [ ] Images route to the configured vision-capable model.
- [ ] TTS voice listing and playback succeed.
- [ ] Provider errors, timeouts, rate limits and cost limits are handled safely.

The physical-device, live-host and live-provider checks above remain external until performed on the target environment.

## 6. Full-handover development and verification workspace

The full handover, not the public server ZIP, contains the reconstructed source and portable verification workspace. From its root run:

```sh
npm run build
npm run type-check
npm run lint
npm test
python3 scripts/refresh_release_metadata.py
npm run verify
```

The TypeScript compatibility check requires `tsc` 5.8 or later in `PATH`. It analyses all reconstructed frontend/runtime JavaScript with legacy global declarations isolated from the deployable output.

The build is deterministic and must reproduce `app/assets/index-5aa4ab81f41a.js` byte-for-byte. The test suite performs PHP static contracts, frontend/PWA contracts, SQLite fresh/clone/rollback/upgrade checks and a real PHP front-controller environment preflight in an isolated temporary deployment.

The non-destructive local/target-host runner accepts named arguments:

```sh
python3 tools/target_host_acceptance_22072026163824.py --app-dir ./app
python3 tools/target_host_acceptance_22072026163824.py --base-url https://example.test/glmchat/
python3 tools/target_host_acceptance_22072026163824.py --app-dir ./app --base-url https://example.test/glmchat/ --json-output ./acceptance.json
```

Do not pass the handover directory as a positional argument. `--app-dir` must point to the actual deploy root containing `.htaccess`, `index.php`, `assets/`, `server/` and `storage/`.
