72 lines
3.6 KiB
Markdown
72 lines
3.6 KiB
Markdown
> **⚠️ 历史·过程留档(已归档,2026-10-16)**:本文为**当时**记录,**不代表现状**;现状以 `docs/standards/architecture-current-state.md` 为准,规则见 `docs/standards/`。
|
|
|
|
# v3.7.0 Runtime Baseline
|
|
|
|
## Snapshot
|
|
|
|
- Baseline release: `v3.6.0`
|
|
- Baseline commit: `8b8812a`
|
|
- Runtime entry: `app.js` single browser IIFE with modular IIFE globals loaded before it
|
|
- Browser runtime: React UMD + `React.createElement`, no JSX/ESM/CommonJS in runtime modules
|
|
- Persistence: LocalStorage compatibility keys plus IndexedDB database `iwb_web`, physical version `3`
|
|
- Build entry: `scripts/build.js`
|
|
- Verification: `npm run verify`
|
|
|
|
## Build order
|
|
|
|
`scripts/build.js` copies and loads modules in this order:
|
|
|
|
1. storage contract/runtime/migrations/result/local/indexeddb/workspace/groups/outputs/backup
|
|
2. runtime constants and canvas store
|
|
3. generation scheduler/retry
|
|
4. gallery query/hydration and UI components
|
|
5. `app.js` compatibility runtime
|
|
|
|
Every extracted module must remain an IIFE global and must have an `app.js` fallback.
|
|
|
|
## Current runtime boundaries
|
|
|
|
### Storage
|
|
|
|
Storage has modular adapters for result semantics, LocalStorage, IndexedDB, workspace, groups, outputs and backup. `app.js` still contains compatibility implementations and business orchestration. Existing keys, prefixes, backup formats and workspace `rev` behavior are compatibility constraints.
|
|
|
|
### Generation
|
|
|
|
Generation uses modular scheduler/retry helpers, while `app.js` still builds jobs, owns node/UI state, invokes provider APIs, persists run records, handles cancellation and archives outputs.
|
|
|
|
### UI and canvas
|
|
|
|
`app.js` owns React composition, canvas interaction, node/edge/group state, panels, settings, history, backup UI and cross-tab synchronization. `src/canvas-store.js` and `src/ui-components.js` provide low-risk extracted boundaries.
|
|
|
|
## Side-effect inventory
|
|
|
|
The runtime uses global event listeners for keyboard, pointer, paste, blur, storage, beforeunload/pagehide, resize and document pointer handling. It uses timers for UI feedback, autosave, polling, delayed downloads, progress and generation lifecycle. It creates AbortControllers for network/generation operations and Blob URLs for downloads and image exports.
|
|
|
|
The first v3.7.0 migration therefore adds tracking infrastructure without immediately replacing every existing call site.
|
|
|
|
## Error inventory
|
|
|
|
Errors currently cross storage, network, generation, recovery and UI boundaries. Some are converted through existing storage error helpers, while other paths catch locally, display generic messages, or intentionally ignore best-effort failures. v3.7.0 adds a non-breaking runtime error normalizer and diagnostics-safe serialization.
|
|
|
|
## Compatibility locks
|
|
|
|
- Do not change LocalStorage keys.
|
|
- Do not change IndexedDB name, physical version or stores.
|
|
- Do not change `ref_` / `out_` prefixes.
|
|
- Preserve workspace optimistic-lock `rev` behavior.
|
|
- Preserve legacy JSON/ZIP backup recovery.
|
|
- Preserve single-file/jsdom compatibility.
|
|
- Preserve existing selectors, keyboard shortcuts and generation behavior.
|
|
- Do not serialize API keys, prompts, images or raw request payloads into diagnostics.
|
|
|
|
## First implementation slice
|
|
|
|
The first slice is intentionally low risk:
|
|
|
|
1. Add `runtime-error.js` with normalization, classification, retryability and redacted serialization.
|
|
2. Add `runtime-lifecycle.js` with reversible disposer/event/timer/AbortController/Object URL tracking.
|
|
3. Add focused VM tests and build-order assertions.
|
|
4. Expose modules to the runtime without replacing existing behavior.
|
|
|
|
Later slices can migrate storage health, reconciliation, generation state and diagnostics one boundary at a time.
|