10const INTEGRATION_PROMPT = 'Resume internal-link writer integration for the listed audit records: establish exclusive ownership of each content field, keep source-origin URL rewriting limited to non-content configuration, and connect the dedicated blog-post link writer to verified destinations and a checkpointed post-frontend update, publish and read-back phase. Run the scoped compatibility and end-to-end checks, resume only compatible writers, and return the refreshed link audit, report and handoff. If a required writer or lifecycle is unavailable, keep the affected repairs pending and report the missing contract.';
11const ROUTE_PROMPT = "Resume app page routing for the listed page families and original paths: inspect the destination's current route configuration, apply the supported source-matching configuration, record any unsupported family with its actual Wix destination and redirect requirement, and return the refreshed capability matrix, configuration read-back and report.";
12const UNRESOLVED_PROMPT = 'Resume app routing and internal-link reconciliation for the listed audit occurrence IDs; obtain missing capture/adapter access, resolve intended targets, apply approved repairs, and return the refreshed link audit and report.';
13const PENDING_PROMPT = 'Run the post-frontend routing and link verification step for this migration: confirm the frontend deployment origin and mount path, read back generated entity URLs, run the read-only calibration and budget estimate, and only within the approved budget check the per-family samples and verify and repair the stored destinations, and return the refreshed link audit and report.';
14const UNAVAILABLE_PROMPT = 'Rerun internal-link verification for the listed audit occurrence and destination IDs against the current Wix deployment: confirm deployment origin, mount path, permissions and safe session fixtures, re-check route identity, rendered links, fragments and actions, and return the refreshed link audit and report.';
15const BUDGET_PROMPT = 'Present the recorded link counts, estimate and budget to the migration owner and request a decision to continue, reduce scope or stop. Then resume verification and repair for the listed audit within the approved limit and return the refreshed link audit and report.';
16
17function auditPath(projectDir) {
18 return path.join(projectDir, RELATIVE_PATH);
19}
20
21function nonempty(value, label) {
22 if (typeof value !== 'string' || !value) throw new Error(`${label} must be a non-empty string`);
23 return value;
24}
25
26function unique(values, label) {
27 if (!Array.isArray(values) || values.some((value) => typeof value !== 'string' || !value)) {
28 throw new Error(`${label} must be an array of non-empty strings`);
29 }
30 if (new Set(values).size !== values.length) throw new Error(`${label} contains duplicates`);
31}
32
33// The queues partition navigation occurrences. A missing or duplicated occurrence must never
34// disappear from cutover just because a backend import succeeded.
35function validateLinkAudit(audit) {
36 if (!audit || audit.schemaVersion !== 1) throw new Error('link audit schemaVersion must be 1');
161 deadlineReason: 'The approved 30-minute live-work or 100,000 exception-review-token ceiling would be exceeded; resume only after an explicit decision.',
166 action: `Cutover Operator: after DNS and HTTPS readiness, check the public host against the routes listed in ${RELATIVE_PATH}; return any local repair to the Import Operator.`,
167 deadlineReason: 'After DNS; preview-host checks do not prove the final public route.',