quiver-cli 0.8.0 → 1.0.0
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.
- package/README.md +110 -45
- package/bin/quiver-cli.mjs +3 -1
- package/dist/cli.js +546 -458
- package/package.json +2 -2
- package/template/.agents/AGENTS.md +4 -3
- package/template/.agents/config.json +7 -0
- package/template/.agents/plugins/opencode/rtk.ts +34 -0
- package/template/.agents/skills/agent-browser/SKILL.md +1 -0
- package/template/.agents/skills/apps/skybridge/SKILL.md +4 -0
- package/template/.agents/skills/design/impeccable/SKILL.md +36 -118
- package/template/.agents/skills/design/impeccable/reference/adapt.md +1 -0
- package/template/.agents/skills/design/impeccable/reference/adapt.native.md +58 -0
- package/template/.agents/skills/design/impeccable/reference/android.md +40 -0
- package/template/.agents/skills/design/impeccable/reference/animate.md +73 -188
- package/template/.agents/skills/design/impeccable/reference/audit.md +12 -9
- package/template/.agents/skills/design/impeccable/reference/audit.native.md +139 -0
- package/template/.agents/skills/design/impeccable/reference/bolder.md +19 -101
- package/template/.agents/skills/design/impeccable/reference/clarify.md +59 -253
- package/template/.agents/skills/design/impeccable/reference/colorize.md +51 -222
- package/template/.agents/skills/design/impeccable/reference/craft-floor.md +42 -0
- package/template/.agents/skills/design/impeccable/reference/craft.md +3 -121
- package/template/.agents/skills/design/impeccable/reference/critique.md +44 -23
- package/template/.agents/skills/design/impeccable/reference/degraded/asset-producer.md +90 -0
- package/template/.agents/skills/design/impeccable/reference/degraded/documenter.md +24 -0
- package/template/.agents/skills/design/impeccable/reference/degraded/finish-reviewer.md +37 -0
- package/template/.agents/skills/design/impeccable/reference/degraded/manual-edit-applier.md +92 -0
- package/template/.agents/skills/design/impeccable/reference/delight.md +47 -279
- package/template/.agents/skills/design/impeccable/reference/distill.md +2 -2
- package/template/.agents/skills/design/impeccable/reference/doctor.md +53 -0
- package/template/.agents/skills/design/impeccable/reference/document.md +60 -73
- package/template/.agents/skills/design/impeccable/reference/harden.md +1 -12
- package/template/.agents/skills/design/impeccable/reference/hooks.md +20 -5
- package/template/.agents/skills/design/impeccable/reference/init.md +72 -119
- package/template/.agents/skills/design/impeccable/reference/ios.md +45 -0
- package/template/.agents/skills/design/impeccable/reference/layout.md +54 -131
- package/template/.agents/skills/design/impeccable/reference/live-setup.md +102 -0
- package/template/.agents/skills/design/impeccable/reference/live.md +116 -511
- package/template/.agents/skills/design/impeccable/reference/new-work.md +105 -0
- package/template/.agents/skills/design/impeccable/reference/{product.md → operate.md} +6 -5
- package/template/.agents/skills/design/impeccable/reference/optimize.md +4 -4
- package/template/.agents/skills/design/impeccable/reference/overdrive.md +1 -4
- package/template/.agents/skills/design/impeccable/reference/polish.md +68 -212
- package/template/.agents/skills/design/impeccable/reference/quieter.md +3 -3
- package/template/.agents/skills/design/impeccable/reference/routing.md +18 -0
- package/template/.agents/skills/design/impeccable/reference/shape.md +38 -144
- package/template/.agents/skills/design/impeccable/reference/typeset.md +51 -250
- package/template/.agents/skills/design/impeccable/reference/visualize.md +47 -0
- package/template/.agents/skills/design/impeccable/scripts/command-metadata.json +1 -1
- package/template/.agents/skills/design/impeccable/scripts/concept-seed.mjs +558 -0
- package/template/.agents/skills/design/impeccable/scripts/context-signals.mjs +119 -10
- package/template/.agents/skills/design/impeccable/scripts/context.mjs +534 -45
- package/template/.agents/skills/design/impeccable/scripts/critique-storage.mjs +18 -47
- package/template/.agents/skills/design/impeccable/scripts/detector/browser/injected/index.mjs +96 -10
- package/template/.agents/skills/design/impeccable/scripts/detector/cli/main.mjs +174 -26
- package/template/.agents/skills/design/impeccable/scripts/detector/design-system.mjs +233 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/detect-antipatterns-browser.js +3348 -203
- package/template/.agents/skills/design/impeccable/scripts/detector/engines/browser/detect-url.mjs +102 -7
- package/template/.agents/skills/design/impeccable/scripts/detector/engines/regex/detect-text.mjs +297 -97
- package/template/.agents/skills/design/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +187 -16
- package/template/.agents/skills/design/impeccable/scripts/detector/engines/static-html/detect-html.mjs +41 -11
- package/template/.agents/skills/design/impeccable/scripts/detector/findings.mjs +7 -1
- package/template/.agents/skills/design/impeccable/scripts/detector/node/file-system.mjs +16 -2
- package/template/.agents/skills/design/impeccable/scripts/detector/registry/antipatterns.mjs +207 -38
- package/template/.agents/skills/design/impeccable/scripts/detector/rules/checks.mjs +3082 -173
- package/template/.agents/skills/design/impeccable/scripts/detector/shared/constants.mjs +11 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/shared/fonts.mjs +30 -0
- package/template/.agents/skills/design/impeccable/scripts/doctor.mjs +336 -0
- package/template/.agents/skills/design/impeccable/scripts/embed-prompt.mjs +133 -0
- package/template/.agents/skills/design/impeccable/scripts/generate-image.mjs +240 -0
- package/template/.agents/skills/design/impeccable/scripts/hook-admin.mjs +98 -18
- package/template/.agents/skills/design/impeccable/scripts/hook-before-edit.mjs +46 -6
- package/template/.agents/skills/design/impeccable/scripts/hook-lib.mjs +518 -50
- package/template/.agents/skills/design/impeccable/scripts/hook.mjs +25 -8
- package/template/.agents/skills/design/impeccable/scripts/lib/artifact-schema.mjs +93 -0
- package/template/.agents/skills/design/impeccable/scripts/lib/composition-catalog.mjs +200 -0
- package/template/.agents/skills/design/impeccable/scripts/lib/concept-catalog.mjs +357 -0
- package/template/.agents/skills/design/impeccable/scripts/lib/impeccable-config.mjs +27 -7
- package/template/.agents/skills/design/impeccable/scripts/lib/impeccable-paths.mjs +17 -8
- package/template/.agents/skills/design/impeccable/scripts/lib/provider.mjs +5 -0
- package/template/.agents/skills/design/impeccable/scripts/lib/roll-selection.mjs +362 -0
- package/template/.agents/skills/design/impeccable/scripts/lib/staleness-deep.mjs +457 -0
- package/template/.agents/skills/design/impeccable/scripts/lib/staleness-notice.mjs +169 -0
- package/template/.agents/skills/design/impeccable/scripts/lib/staleness.mjs +457 -0
- package/template/.agents/skills/design/impeccable/scripts/lib/surface-briefs.mjs +151 -0
- package/template/.agents/skills/design/impeccable/scripts/lib/target-slug.mjs +33 -0
- package/template/.agents/skills/design/impeccable/scripts/lib/template-extensions.mjs +146 -0
- package/template/.agents/skills/design/impeccable/scripts/live/accept-css.mjs +617 -0
- package/template/.agents/skills/design/impeccable/scripts/live/accept-verify.mjs +60 -0
- package/template/.agents/skills/design/impeccable/scripts/live/browser-script-parts.mjs +7 -1
- package/template/.agents/skills/design/impeccable/scripts/live/completion.mjs +10 -1
- package/template/.agents/skills/design/impeccable/scripts/live/event-validation.mjs +67 -5
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/astro.mjs +47 -0
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/detect-utils.mjs +73 -0
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/index.mjs +143 -0
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/journal.mjs +197 -0
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/nextjs.mjs +49 -0
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/nuxt.mjs +161 -0
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/script-src.mjs +17 -0
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/static-html.mjs +26 -0
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/sveltekit.mjs +71 -0
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/tag-strategy.mjs +247 -0
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/tanstack-start.mjs +70 -0
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/vite-generic.mjs +42 -0
- package/template/.agents/skills/design/impeccable/scripts/live/generation-preflight.mjs +149 -0
- package/template/.agents/skills/design/impeccable/scripts/live/instructions.mjs +142 -0
- package/template/.agents/skills/design/impeccable/scripts/live/poll-lanes.mjs +14 -0
- package/template/.agents/skills/design/impeccable/scripts/live/roots.mjs +508 -0
- package/template/.agents/skills/design/impeccable/scripts/live/session-store.mjs +324 -50
- package/template/.agents/skills/design/impeccable/scripts/live/source-lock.mjs +105 -0
- package/template/.agents/skills/design/impeccable/scripts/live/source-search.mjs +105 -0
- package/template/.agents/skills/design/impeccable/scripts/live/svelte-ast.mjs +961 -0
- package/template/.agents/skills/design/impeccable/scripts/live/svelte-component.mjs +588 -72
- package/template/.agents/skills/design/impeccable/scripts/live/sveltekit-adapter.mjs +59 -17
- package/template/.agents/skills/design/impeccable/scripts/live/tanstack-adapter.mjs +280 -0
- package/template/.agents/skills/design/impeccable/scripts/live/vocabulary.mjs +135 -0
- package/template/.agents/skills/design/impeccable/scripts/live-accept.mjs +210 -68
- package/template/.agents/skills/design/impeccable/scripts/live-browser.js +1562 -223
- package/template/.agents/skills/design/impeccable/scripts/live-commit-manual-edits.mjs +3 -0
- package/template/.agents/skills/design/impeccable/scripts/live-complete.mjs +33 -1
- package/template/.agents/skills/design/impeccable/scripts/live-inject.mjs +175 -255
- package/template/.agents/skills/design/impeccable/scripts/live-insert.mjs +26 -6
- package/template/.agents/skills/design/impeccable/scripts/live-manual-edit-evidence.mjs +6 -1
- package/template/.agents/skills/design/impeccable/scripts/live-poll.mjs +61 -16
- package/template/.agents/skills/design/impeccable/scripts/live-resume.mjs +39 -10
- package/template/.agents/skills/design/impeccable/scripts/live-server.mjs +573 -47
- package/template/.agents/skills/design/impeccable/scripts/live-status.mjs +17 -7
- package/template/.agents/skills/design/impeccable/scripts/live-wrap.mjs +124 -91
- package/template/.agents/skills/design/impeccable/scripts/live.mjs +88 -26
- package/template/.agents/skills/design/impeccable/scripts/palette.mjs +76 -81
- package/template/.agents/skills/design/impeccable/scripts/pin.mjs +18 -11
- package/template/.agents/skills/design/impeccable/scripts/serve-question.mjs +932 -0
- package/template/.agents/skills/design/impeccable/scripts/surface-brief.mjs +74 -0
- package/template/.agents/skills/design/shadcn/SKILL.md +46 -11
- package/template/.agents/skills/design/shadcn/cli.md +49 -16
- package/template/.agents/skills/design/shadcn/customization.md +14 -7
- package/template/.agents/skills/design/shadcn/evals/evals.json +30 -0
- package/template/.agents/skills/design/shadcn/mcp.md +27 -16
- package/template/.agents/skills/design/shadcn/registry.md +277 -0
- package/template/.agents/skills/design/shadcn/rules/chat.md +224 -0
- package/template/.agents/skills/design/shadcn/rules/composition.md +20 -2
- package/template/.agents/skills/design/shadcn/rules/styling.md +23 -0
- package/template/.agents/skills/find-skills/SKILL.md +2 -3
- package/template/.agents/skills/hono/SKILL.md +579 -0
- package/template/.agents/skills/integrations/langfuse/SKILL.md +10 -6
- package/template/.agents/skills/integrations/langfuse/references/ci-cd.md +41 -0
- package/template/.agents/skills/integrations/langfuse/references/cli.md +8 -0
- package/template/.agents/skills/integrations/langfuse/references/error-analysis.md +15 -27
- package/template/.agents/skills/integrations/langfuse/references/instrumentation.md +39 -52
- package/template/.agents/skills/integrations/langfuse/references/judge-calibration.md +5 -2
- package/template/.agents/skills/integrations/langfuse/references/prompt-engineering.md +35 -0
- package/template/.agents/skills/integrations/langfuse/references/prompt-migration.md +41 -196
- package/template/.agents/skills/integrations/langfuse/references/skill-feedback.md +3 -0
- package/template/.agents/skills/integrations/langfuse/references/trace-evaluator-upgrade.md +76 -0
- package/template/.agents/skills/integrations/langfuse/references/user-feedback.md +4 -0
- package/template/.agents/skills/integrations/langfuse/references/v4-project-migration.md +73 -0
- package/template/.agents/skills/supabase/CHANGELOG.md +71 -0
- package/template/.agents/skills/supabase/SKILL.md +145 -0
- package/template/.agents/skills/supabase/assets/feedback-issue-template.md +17 -0
- package/template/.agents/skills/supabase/references/skill-feedback.md +17 -0
- package/template/.agents/skills/supabase-postgres-best-practices/CHANGELOG.md +73 -0
- package/template/.agents/skills/supabase-postgres-best-practices/SKILL.md +64 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/_contributing.md +170 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/_sections.md +39 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/_template.md +34 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/advanced-full-text-search.md +55 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/advanced-jsonb-indexing.md +49 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/conn-idle-timeout.md +46 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/conn-limits.md +44 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/conn-pooling.md +41 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/conn-prepared-statements.md +46 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/data-batch-inserts.md +54 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/data-n-plus-one.md +53 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/data-pagination.md +50 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/data-upsert.md +50 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/lock-advisory.md +56 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/lock-deadlock-prevention.md +68 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/lock-short-transactions.md +50 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/lock-skip-locked.md +54 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/monitor-explain-analyze.md +45 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/monitor-pg-stat-statements.md +55 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/monitor-vacuum-analyze.md +55 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/query-composite-indexes.md +44 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/query-covering-indexes.md +40 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/query-index-types.md +48 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/query-missing-indexes.md +43 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/query-partial-indexes.md +45 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/schema-constraints.md +80 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/schema-data-types.md +46 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/schema-foreign-key-indexes.md +59 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/schema-lowercase-identifiers.md +55 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/schema-partitioning.md +55 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/schema-primary-keys.md +61 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/security-privileges.md +54 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/security-rls-basics.md +50 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/security-rls-performance.md +63 -0
- package/template/.agents/upstreams.json +34 -12
- package/template/.agents/skills/design/impeccable/reference/brand.md +0 -108
- package/template/.agents/skills/design/impeccable/reference/codex.md +0 -105
- package/template/.agents/skills/design/impeccable/reference/interaction-design.md +0 -189
- package/template/.agents/skills/integrations/langfuse/references/sdk-upgrade.md +0 -175
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* actual live UI remains the shared plain-DOM browser chrome.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import crypto from 'node:crypto';
|
|
10
11
|
import fs from 'node:fs';
|
|
11
12
|
import path from 'node:path';
|
|
12
13
|
|
|
@@ -14,6 +15,28 @@ export const SVELTE_LIVE_ROOT_COMPONENT = 'src/lib/impeccable/ImpeccableLiveRoot
|
|
|
14
15
|
export const SVELTE_LAYOUT_MARKER_OPEN = '<!-- impeccable-live-svelte-start -->';
|
|
15
16
|
export const SVELTE_LAYOUT_MARKER_CLOSE = '<!-- impeccable-live-svelte-end -->';
|
|
16
17
|
export const SVELTE_ROOT_IMPORT = "import ImpeccableLiveRoot from '$lib/impeccable/ImpeccableLiveRoot.svelte';";
|
|
18
|
+
// Matches the import at ANY revision (or none). [ \t]* bounds only, never
|
|
19
|
+
// \s*: a greedy \s* after the statement swallowed the next line's
|
|
20
|
+
// indentation on removal, leaving a formatting scar in user layouts.
|
|
21
|
+
const SVELTE_ROOT_IMPORT_LINE_RE = /^[ \t]*import ImpeccableLiveRoot from '\$lib\/impeccable\/ImpeccableLiveRoot\.svelte(?:\?[^']*)?';[ \t]*\r?\n?/gm;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The import specifier carries a token-derived revision query. The adapter
|
|
25
|
+
* component embeds the helper token, and Vite (client AND SSR) can keep
|
|
26
|
+
* serving a stale compiled module after the file is rewritten on a helper
|
|
27
|
+
* restart; the browser then requests /live.js with a rotated-out token and
|
|
28
|
+
* gets a 401 with no picker. A changed specifier is a different module id,
|
|
29
|
+
* which no cache survives.
|
|
30
|
+
*/
|
|
31
|
+
export function svelteRootImportLine(rev) {
|
|
32
|
+
if (!rev) return SVELTE_ROOT_IMPORT;
|
|
33
|
+
return "import ImpeccableLiveRoot from '$lib/impeccable/ImpeccableLiveRoot.svelte?impeccable-live=" + rev + "';";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function svelteAdapterRev(token) {
|
|
37
|
+
if (!token) return null;
|
|
38
|
+
return crypto.createHash('sha256').update(String(token)).digest('hex').slice(0, 8);
|
|
39
|
+
}
|
|
17
40
|
|
|
18
41
|
export function detectSvelteKitProject(cwd = process.cwd(), config = null) {
|
|
19
42
|
const appHtml = findSvelteKitAppHtml(cwd, config);
|
|
@@ -36,21 +59,21 @@ export function detectSvelteKitProject(cwd = process.cwd(), config = null) {
|
|
|
36
59
|
};
|
|
37
60
|
}
|
|
38
61
|
|
|
39
|
-
export function applySvelteKitLiveAdapter({ cwd = process.cwd(), port, config = null } = {}) {
|
|
62
|
+
export function applySvelteKitLiveAdapter({ cwd = process.cwd(), port, token, config = null } = {}) {
|
|
40
63
|
if (!Number.isFinite(Number(port))) {
|
|
41
64
|
throw new Error('SvelteKit live adapter requires a numeric port');
|
|
42
65
|
}
|
|
43
66
|
const detected = detectSvelteKitProject(cwd, config);
|
|
44
67
|
if (!detected) return null;
|
|
45
68
|
|
|
46
|
-
ensureSvelteLiveRootComponent(cwd, Number(port));
|
|
69
|
+
ensureSvelteLiveRootComponent(cwd, Number(port), token);
|
|
47
70
|
|
|
48
71
|
const layoutRel = detected.layoutFile;
|
|
49
72
|
const layoutAbs = path.join(cwd, layoutRel);
|
|
50
73
|
fs.mkdirSync(path.dirname(layoutAbs), { recursive: true });
|
|
51
74
|
const layoutExisted = fs.existsSync(layoutAbs);
|
|
52
75
|
const before = layoutExisted ? fs.readFileSync(layoutAbs, 'utf-8') : defaultSvelteLayout();
|
|
53
|
-
const after = patchSvelteLayout(before);
|
|
76
|
+
const after = patchSvelteLayout(before, { rev: svelteAdapterRev(token) });
|
|
54
77
|
fs.writeFileSync(layoutAbs, after, 'utf-8');
|
|
55
78
|
|
|
56
79
|
return {
|
|
@@ -94,15 +117,27 @@ export function removeSvelteKitLiveAdapter({ cwd = process.cwd(), config = null
|
|
|
94
117
|
};
|
|
95
118
|
}
|
|
96
119
|
|
|
97
|
-
export function patchSvelteLayout(content) {
|
|
120
|
+
export function patchSvelteLayout(content, { rev = null } = {}) {
|
|
98
121
|
let out = String(content || '');
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
122
|
+
const importLine = svelteRootImportLine(rev);
|
|
123
|
+
if (!out.includes(importLine)) {
|
|
124
|
+
// An import at an older revision is replaced in place, keeping its
|
|
125
|
+
// indentation; only a layout with no impeccable import gets an insert.
|
|
126
|
+
let replaced = false;
|
|
127
|
+
out = out.replace(SVELTE_ROOT_IMPORT_LINE_RE, (line) => {
|
|
128
|
+
if (replaced) return '';
|
|
129
|
+
replaced = true;
|
|
130
|
+
const indent = (line.match(/^[ \t]*/) || [''])[0];
|
|
131
|
+
return indent + importLine + '\n';
|
|
132
|
+
});
|
|
133
|
+
if (!replaced) {
|
|
134
|
+
const scriptMatch = out.match(/<script(?:\s[^>]*)?>/i);
|
|
135
|
+
if (scriptMatch) {
|
|
136
|
+
const insertAt = scriptMatch.index + scriptMatch[0].length;
|
|
137
|
+
out = out.slice(0, insertAt) + '\n ' + importLine + out.slice(insertAt);
|
|
138
|
+
} else {
|
|
139
|
+
out = `<script>\n ${importLine}\n</script>\n\n` + out;
|
|
140
|
+
}
|
|
106
141
|
}
|
|
107
142
|
}
|
|
108
143
|
|
|
@@ -131,23 +166,25 @@ export function unpatchSvelteLayout(content) {
|
|
|
131
166
|
'g',
|
|
132
167
|
);
|
|
133
168
|
out = out.replace(blockRe, '$1');
|
|
134
|
-
out = out.replace(
|
|
135
|
-
out = out.replace(/<script>\s*<\/script
|
|
169
|
+
out = out.replace(SVELTE_ROOT_IMPORT_LINE_RE, '');
|
|
170
|
+
out = out.replace(/<script>\s*<\/script>[ \t]*\r?\n?/g, '');
|
|
136
171
|
return out.replace(/\n{3,}/g, '\n\n');
|
|
137
172
|
}
|
|
138
173
|
|
|
139
|
-
export function ensureSvelteLiveRootComponent(cwd, port) {
|
|
174
|
+
export function ensureSvelteLiveRootComponent(cwd, port, token) {
|
|
140
175
|
const file = path.join(cwd, SVELTE_LIVE_ROOT_COMPONENT);
|
|
141
176
|
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
142
|
-
fs.writeFileSync(file, buildSvelteLiveRootComponent(port), 'utf-8');
|
|
177
|
+
fs.writeFileSync(file, buildSvelteLiveRootComponent(port, token), 'utf-8');
|
|
143
178
|
return file;
|
|
144
179
|
}
|
|
145
180
|
|
|
146
|
-
export function buildSvelteLiveRootComponent(port) {
|
|
181
|
+
export function buildSvelteLiveRootComponent(port, token) {
|
|
182
|
+
const liveUrl = 'http://localhost:' + Number(port) + '/live.js'
|
|
183
|
+
+ (token ? '?token=' + encodeURIComponent(token) : '');
|
|
147
184
|
return `<script>
|
|
148
185
|
import { onMount } from 'svelte';
|
|
149
186
|
|
|
150
|
-
const LIVE_URL = '
|
|
187
|
+
const LIVE_URL = '${liveUrl}';
|
|
151
188
|
const HOST_ID = 'impeccable-live-root';
|
|
152
189
|
|
|
153
190
|
onMount(() => {
|
|
@@ -191,6 +228,11 @@ export function buildSvelteLiveRootComponent(port) {
|
|
|
191
228
|
script.src = LIVE_URL;
|
|
192
229
|
script.async = true;
|
|
193
230
|
script.dataset.impeccableLiveScript = 'true';
|
|
231
|
+
script.onerror = () => console.error(
|
|
232
|
+
'[impeccable] live.js failed to load from ' + LIVE_URL
|
|
233
|
+
+ ' (helper down, or the token rotated while a stale adapter module was cached).'
|
|
234
|
+
+ ' Re-run the live boot, then reload this page.'
|
|
235
|
+
);
|
|
194
236
|
document.head.appendChild(script);
|
|
195
237
|
|
|
196
238
|
return () => {
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TanStack Start live-mode adapter.
|
|
3
|
+
*
|
|
4
|
+
* TanStack Start is SSR: there is no static index.html to patch. The document
|
|
5
|
+
* shell is a React component (`shellComponent`/`component`) defined in the root
|
|
6
|
+
* route file, `src/routes/__root.tsx`, which renders `<html>…<body>{children}
|
|
7
|
+
* <Scripts /></body></html>`.
|
|
8
|
+
*
|
|
9
|
+
* A raw `<script src>` placed in that JSX is server-rendered into the streamed
|
|
10
|
+
* HTML, but React's script handling and hydration make it an unreliable place
|
|
11
|
+
* to load a cross-origin dev bundle. So, like the Nuxt and SvelteKit adapters,
|
|
12
|
+
* this keeps the injected code in a dev-only managed component that appends the
|
|
13
|
+
* live script on mount (client-only, after hydration). The adapter mounts that
|
|
14
|
+
* component from the root document and removes it cleanly on stop.
|
|
15
|
+
*
|
|
16
|
+
* The managed component lives OUTSIDE `src/routes/` (in `src/impeccable/`) so
|
|
17
|
+
* the TanStack Router file-based route generator never treats it as a route.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import fs from 'node:fs';
|
|
21
|
+
import path from 'node:path';
|
|
22
|
+
import { buildLiveScriptSrc } from './frameworks/script-src.mjs';
|
|
23
|
+
|
|
24
|
+
export const TANSTACK_MARKER_OPEN = '{/* impeccable-live-tanstack-start */}';
|
|
25
|
+
export const TANSTACK_MARKER_CLOSE = '{/* impeccable-live-tanstack-end */}';
|
|
26
|
+
export const TANSTACK_COMPONENT_DIR = 'src/impeccable';
|
|
27
|
+
export const TANSTACK_COMPONENT_BASENAME = 'ImpeccableLiveRoot';
|
|
28
|
+
|
|
29
|
+
const ROOT_ROUTE_CANDIDATES = [
|
|
30
|
+
'src/routes/__root.tsx',
|
|
31
|
+
'src/routes/__root.jsx',
|
|
32
|
+
'src/routes/__root.ts',
|
|
33
|
+
'src/routes/__root.js',
|
|
34
|
+
'app/routes/__root.tsx',
|
|
35
|
+
'app/routes/__root.jsx',
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
const START_PACKAGES = [
|
|
39
|
+
'@tanstack/react-start',
|
|
40
|
+
'@tanstack/solid-start',
|
|
41
|
+
'@tanstack/start',
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
export function detectTanStackStartProject(cwd = process.cwd()) {
|
|
45
|
+
if (!packageHasTanStackStart(cwd)) return null;
|
|
46
|
+
const rootRoute = findRootRouteFile(cwd);
|
|
47
|
+
if (!rootRoute) return null;
|
|
48
|
+
|
|
49
|
+
const ext = path.extname(rootRoute);
|
|
50
|
+
const componentExt = ext === '.jsx' || ext === '.js' ? '.jsx' : '.tsx';
|
|
51
|
+
const componentFile = `${TANSTACK_COMPONENT_DIR}/${TANSTACK_COMPONENT_BASENAME}${componentExt}`;
|
|
52
|
+
const componentImport = relativeImportSpecifier(rootRoute, componentFile);
|
|
53
|
+
|
|
54
|
+
return { rootRoute, componentFile, componentImport, ext };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function applyTanStackLiveAdapter({ cwd = process.cwd(), port, token, project = detectTanStackStartProject(cwd) } = {}) {
|
|
58
|
+
if (!project) return { error: 'tanstack_not_detected' };
|
|
59
|
+
if (!Number.isFinite(Number(port))) {
|
|
60
|
+
throw new Error('TanStack Start live adapter requires a numeric port');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Write the managed mount component.
|
|
64
|
+
const componentAbs = path.join(cwd, project.componentFile);
|
|
65
|
+
const componentBody = buildTanStackLiveRootComponent(Number(port), token);
|
|
66
|
+
const componentExisted = fs.existsSync(componentAbs);
|
|
67
|
+
if (componentExisted && !isManagedComponent(fs.readFileSync(componentAbs, 'utf-8'))) {
|
|
68
|
+
// A non-Impeccable file already sits at our managed path — refuse to clobber.
|
|
69
|
+
return {
|
|
70
|
+
file: project.componentFile,
|
|
71
|
+
error: 'tanstack_component_conflict',
|
|
72
|
+
hint: `${project.componentFile} already exists and is not managed by Impeccable Live`,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
fs.mkdirSync(path.dirname(componentAbs), { recursive: true });
|
|
76
|
+
fs.writeFileSync(componentAbs, componentBody, 'utf-8');
|
|
77
|
+
|
|
78
|
+
// Patch the root document to import + render the mount component.
|
|
79
|
+
const rootAbs = path.join(cwd, project.rootRoute);
|
|
80
|
+
const before = fs.readFileSync(rootAbs, 'utf-8');
|
|
81
|
+
const after = patchTanStackRoot(before, project.componentImport);
|
|
82
|
+
const changed = after !== before;
|
|
83
|
+
if (changed) fs.writeFileSync(rootAbs, after, 'utf-8');
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
file: project.rootRoute,
|
|
87
|
+
adapter: 'tanstack-start',
|
|
88
|
+
inserted: changed || !componentExisted,
|
|
89
|
+
componentFile: project.componentFile,
|
|
90
|
+
devOnly: true,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function removeTanStackLiveAdapter({ cwd = process.cwd(), project = detectTanStackStartProject(cwd) } = {}) {
|
|
95
|
+
if (!project) return { error: 'tanstack_not_detected' };
|
|
96
|
+
let removed = false;
|
|
97
|
+
|
|
98
|
+
const rootAbs = path.join(cwd, project.rootRoute);
|
|
99
|
+
if (fs.existsSync(rootAbs)) {
|
|
100
|
+
const before = fs.readFileSync(rootAbs, 'utf-8');
|
|
101
|
+
const after = unpatchTanStackRoot(before);
|
|
102
|
+
if (after !== before) {
|
|
103
|
+
fs.writeFileSync(rootAbs, after, 'utf-8');
|
|
104
|
+
removed = true;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const componentAbs = path.join(cwd, project.componentFile);
|
|
109
|
+
if (fs.existsSync(componentAbs)) {
|
|
110
|
+
fs.rmSync(componentAbs, { force: true });
|
|
111
|
+
removed = true;
|
|
112
|
+
}
|
|
113
|
+
pruneEmptyDir(path.dirname(componentAbs), path.join(cwd, 'src'));
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
file: project.rootRoute,
|
|
117
|
+
adapter: 'tanstack-start',
|
|
118
|
+
removed,
|
|
119
|
+
componentFile: project.componentFile,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function patchTanStackRoot(content, componentImport) {
|
|
124
|
+
let out = String(content || '');
|
|
125
|
+
const importStatement = `import ImpeccableLiveRoot from '${componentImport}';`;
|
|
126
|
+
|
|
127
|
+
if (!out.includes(importStatement)) {
|
|
128
|
+
out = insertAfterLastImport(out, importStatement);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (!out.includes(TANSTACK_MARKER_OPEN)) {
|
|
132
|
+
const block =
|
|
133
|
+
`${TANSTACK_MARKER_OPEN}\n`
|
|
134
|
+
+ ` <ImpeccableLiveRoot />\n`
|
|
135
|
+
+ ` ${TANSTACK_MARKER_CLOSE}\n `;
|
|
136
|
+
// Anchor before <Scripts …/> (the stable TanStack Start document marker);
|
|
137
|
+
// fall back to before </body>.
|
|
138
|
+
const scriptsMatch = out.match(/<Scripts\b/);
|
|
139
|
+
if (scriptsMatch) {
|
|
140
|
+
out = out.slice(0, scriptsMatch.index) + block + out.slice(scriptsMatch.index);
|
|
141
|
+
} else {
|
|
142
|
+
const bodyClose = out.lastIndexOf('</body>');
|
|
143
|
+
if (bodyClose !== -1) {
|
|
144
|
+
out = out.slice(0, bodyClose) + block + out.slice(bodyClose);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return out;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export function unpatchTanStackRoot(content) {
|
|
153
|
+
let out = String(content || '');
|
|
154
|
+
// Remove exactly the inserted block (open marker → component → close marker →
|
|
155
|
+
// trailing newline + the indent that leads back to the anchor). Leaving the
|
|
156
|
+
// leading indent before the open marker intact hands it back to the anchor
|
|
157
|
+
// (e.g. `<Scripts />`) so the file round-trips byte-for-byte.
|
|
158
|
+
const blockRe = new RegExp(
|
|
159
|
+
escapeRegExp(TANSTACK_MARKER_OPEN)
|
|
160
|
+
+ '\\s*<ImpeccableLiveRoot\\s*/>\\s*'
|
|
161
|
+
+ escapeRegExp(TANSTACK_MARKER_CLOSE)
|
|
162
|
+
+ '\\r?\\n?[ \\t]*',
|
|
163
|
+
'g',
|
|
164
|
+
);
|
|
165
|
+
out = out.replace(blockRe, '');
|
|
166
|
+
// Remove only the managed import line — not any following blank line.
|
|
167
|
+
out = out.replace(
|
|
168
|
+
new RegExp("^import ImpeccableLiveRoot from '[^']*';[ \\t]*\\r?\\n", 'gm'),
|
|
169
|
+
'',
|
|
170
|
+
);
|
|
171
|
+
return out;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export function buildTanStackLiveRootComponent(port, token) {
|
|
175
|
+
const liveSrc = buildLiveScriptSrc(Number(port), token);
|
|
176
|
+
return `/* impeccable-live-tanstack-start */
|
|
177
|
+
import { useEffect } from 'react';
|
|
178
|
+
|
|
179
|
+
const LIVE_SRC = '${liveSrc}';
|
|
180
|
+
const LIVE_SELECTOR = 'script[data-impeccable-live-tanstack]';
|
|
181
|
+
|
|
182
|
+
// Dev-only mount for Impeccable Live. TanStack Start server-renders the root
|
|
183
|
+
// document, so this appends the live-mode bundle from the client after
|
|
184
|
+
// hydration (mirrors the Nuxt/SvelteKit adapters). Renders nothing on the
|
|
185
|
+
// server, so there is no hydration mismatch.
|
|
186
|
+
export default function ImpeccableLiveRoot() {
|
|
187
|
+
useEffect(() => {
|
|
188
|
+
if (typeof document === 'undefined') return;
|
|
189
|
+
const expected = new URL(LIVE_SRC, window.location.href).href;
|
|
190
|
+
let script = document.querySelector(LIVE_SELECTOR);
|
|
191
|
+
if (script && script.src === expected) return;
|
|
192
|
+
if (script) script.remove();
|
|
193
|
+
|
|
194
|
+
script = document.createElement('script');
|
|
195
|
+
script.src = LIVE_SRC;
|
|
196
|
+
script.async = true;
|
|
197
|
+
script.setAttribute('data-impeccable-live-tanstack', '');
|
|
198
|
+
script.setAttribute('data-impeccable-live-script', 'true');
|
|
199
|
+
document.head.appendChild(script);
|
|
200
|
+
|
|
201
|
+
return () => {
|
|
202
|
+
if (script && script.isConnected) script.remove();
|
|
203
|
+
};
|
|
204
|
+
}, []);
|
|
205
|
+
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
`;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// ---------------------------------------------------------------------------
|
|
212
|
+
// helpers
|
|
213
|
+
// ---------------------------------------------------------------------------
|
|
214
|
+
|
|
215
|
+
// The managed mount component carries the `impeccable-live-tanstack` marker in
|
|
216
|
+
// its leading comment and its script data-attribute; user files never do.
|
|
217
|
+
function isManagedComponent(content) {
|
|
218
|
+
return String(content || '').includes('impeccable-live-tanstack');
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function findRootRouteFile(cwd) {
|
|
222
|
+
for (const rel of ROOT_ROUTE_CANDIDATES) {
|
|
223
|
+
if (fs.existsSync(path.join(cwd, rel))) return rel;
|
|
224
|
+
}
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function packageHasTanStackStart(cwd) {
|
|
229
|
+
const file = path.join(cwd, 'package.json');
|
|
230
|
+
if (!fs.existsSync(file)) return false;
|
|
231
|
+
try {
|
|
232
|
+
const pkg = JSON.parse(fs.readFileSync(file, 'utf-8'));
|
|
233
|
+
const deps = {
|
|
234
|
+
...(pkg.dependencies || {}),
|
|
235
|
+
...(pkg.devDependencies || {}),
|
|
236
|
+
...(pkg.peerDependencies || {}),
|
|
237
|
+
};
|
|
238
|
+
return START_PACKAGES.some((name) => Boolean(deps[name]));
|
|
239
|
+
} catch {
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function relativeImportSpecifier(fromFile, toFile) {
|
|
245
|
+
const rel = path.posix.relative(
|
|
246
|
+
path.posix.dirname(fromFile.split(path.sep).join('/')),
|
|
247
|
+
toFile.split(path.sep).join('/'),
|
|
248
|
+
).replace(/\.(tsx|ts|jsx|js)$/, '');
|
|
249
|
+
return rel.startsWith('.') ? rel : `./${rel}`;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function insertAfterLastImport(content, importStatement) {
|
|
253
|
+
const importRe = /^import\b[^\n]*\n/gm;
|
|
254
|
+
let lastEnd = -1;
|
|
255
|
+
let m;
|
|
256
|
+
while ((m = importRe.exec(content)) !== null) {
|
|
257
|
+
lastEnd = m.index + m[0].length;
|
|
258
|
+
}
|
|
259
|
+
if (lastEnd === -1) {
|
|
260
|
+
return `${importStatement}\n${content}`;
|
|
261
|
+
}
|
|
262
|
+
return content.slice(0, lastEnd) + importStatement + '\n' + content.slice(lastEnd);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function pruneEmptyDir(dir, stopDir) {
|
|
266
|
+
let current = dir;
|
|
267
|
+
while (current.startsWith(stopDir) && current !== stopDir) {
|
|
268
|
+
try {
|
|
269
|
+
if (fs.readdirSync(current).length > 0) return;
|
|
270
|
+
fs.rmdirSync(current);
|
|
271
|
+
current = path.dirname(current);
|
|
272
|
+
} catch {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function escapeRegExp(value) {
|
|
279
|
+
return String(value).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
280
|
+
}
|
|
@@ -34,3 +34,138 @@ export const LIVE_COMMANDS = [
|
|
|
34
34
|
|
|
35
35
|
// Action values accepted by the live event protocol, in palette order.
|
|
36
36
|
export const VISUAL_ACTIONS = LIVE_COMMANDS.map((c) => c.value);
|
|
37
|
+
|
|
38
|
+
/*
|
|
39
|
+
* ---------------------------------------------------------------------------
|
|
40
|
+
* Protocol vocabulary
|
|
41
|
+
* ---------------------------------------------------------------------------
|
|
42
|
+
* The enums below are the wire contract between the browser overlay, the live
|
|
43
|
+
* helper server, and the durable session journal. They live here rather than in
|
|
44
|
+
* the modules that use them so a value cannot be added to the validator without
|
|
45
|
+
* the store and the server seeing it too.
|
|
46
|
+
*
|
|
47
|
+
* live-browser.js still cannot import this file (it is served raw and injected
|
|
48
|
+
* as an IIFE), so its local phase table repeats the agent-phase names. Anything
|
|
49
|
+
* the server can broadcast must appear in AGENT_PHASES here first.
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Phases the live server broadcasts as `agent_phase`, in lifecycle order.
|
|
54
|
+
* Every one of these is emitted by `recordAgentPhase()` in live-server.mjs;
|
|
55
|
+
* the validator rejects anything else, so a typo in a phase name fails loudly
|
|
56
|
+
* instead of quietly ranking as an unknown phase in the browser's progress bar.
|
|
57
|
+
*/
|
|
58
|
+
export const AGENT_PHASES = Object.freeze([
|
|
59
|
+
'picked_up',
|
|
60
|
+
'scaffolding',
|
|
61
|
+
'source_ready',
|
|
62
|
+
'scaffold_fallback',
|
|
63
|
+
'generation_ready',
|
|
64
|
+
'first_reviewable',
|
|
65
|
+
'second_reviewable',
|
|
66
|
+
'all_variants_ready',
|
|
67
|
+
]);
|
|
68
|
+
|
|
69
|
+
/** Event types the helper server accepts from the browser over POST /events. */
|
|
70
|
+
export const CLIENT_EVENT_TYPES = Object.freeze([
|
|
71
|
+
'generate',
|
|
72
|
+
'accept',
|
|
73
|
+
'discard',
|
|
74
|
+
'checkpoint',
|
|
75
|
+
'agent_phase',
|
|
76
|
+
'variant_mounted',
|
|
77
|
+
'variant_mount_failed',
|
|
78
|
+
'exit',
|
|
79
|
+
'prefetch',
|
|
80
|
+
'manual_edits',
|
|
81
|
+
'steer',
|
|
82
|
+
'carbonize_cleanup',
|
|
83
|
+
]);
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Event types the durable journal applies. A superset of CLIENT_EVENT_TYPES:
|
|
87
|
+
* the agent-side helpers (live-poll, live-complete) and the server itself
|
|
88
|
+
* append the rest. An event type missing here lands as `unknown_event_type`
|
|
89
|
+
* in the snapshot diagnostics.
|
|
90
|
+
*/
|
|
91
|
+
export const JOURNAL_EVENT_TYPES = Object.freeze([
|
|
92
|
+
'generate',
|
|
93
|
+
'variant_plan',
|
|
94
|
+
'detector_waivers',
|
|
95
|
+
'agent_phase',
|
|
96
|
+
'variants_ready',
|
|
97
|
+
'agent_done',
|
|
98
|
+
'variant_mounted',
|
|
99
|
+
'variant_mount_failed',
|
|
100
|
+
'checkpoint',
|
|
101
|
+
'accept',
|
|
102
|
+
'accept_intent',
|
|
103
|
+
'manual_edit_apply',
|
|
104
|
+
'steer',
|
|
105
|
+
'steer_done',
|
|
106
|
+
'carbonize_cleanup',
|
|
107
|
+
'discard',
|
|
108
|
+
'discarded',
|
|
109
|
+
'complete',
|
|
110
|
+
'agent_error',
|
|
111
|
+
]);
|
|
112
|
+
|
|
113
|
+
/** Phases the session store assigns to a snapshot. */
|
|
114
|
+
export const SESSION_PHASES = Object.freeze([
|
|
115
|
+
'new',
|
|
116
|
+
'generate_requested',
|
|
117
|
+
'variants_ready',
|
|
118
|
+
'carbonize_required',
|
|
119
|
+
'carbonize_cleanup_requested',
|
|
120
|
+
'manual_edit_apply_requested',
|
|
121
|
+
'steer_requested',
|
|
122
|
+
'steer_done',
|
|
123
|
+
'accept_requested',
|
|
124
|
+
'discard_requested',
|
|
125
|
+
'discarded',
|
|
126
|
+
'completed',
|
|
127
|
+
'agent_error',
|
|
128
|
+
]);
|
|
129
|
+
|
|
130
|
+
/** Phases that retire a session from the active list. */
|
|
131
|
+
export const COMPLETED_SESSION_PHASES = Object.freeze(['completed', 'discarded']);
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Phases after which a late generation write is a ghost from a canceled cycle.
|
|
135
|
+
* The store journals such an event as a diagnostic instead of applying it.
|
|
136
|
+
*/
|
|
137
|
+
export const GENERATION_FENCED_SESSION_PHASES = Object.freeze([
|
|
138
|
+
'accept_requested',
|
|
139
|
+
'discard_requested',
|
|
140
|
+
'carbonize_required',
|
|
141
|
+
'completed',
|
|
142
|
+
'discarded',
|
|
143
|
+
]);
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* `reason` values carried on checkpoint events. Not validated (an unknown
|
|
147
|
+
* reason is journaled, never rejected) because the reason is diagnostic
|
|
148
|
+
* breadcrumb, not control flow. Two exceptions drive behavior and are split
|
|
149
|
+
* out below.
|
|
150
|
+
*/
|
|
151
|
+
export const CHECKPOINT_REASONS = Object.freeze([
|
|
152
|
+
'generate_started',
|
|
153
|
+
'variants_progress',
|
|
154
|
+
'variants_ready',
|
|
155
|
+
'browser_resumed',
|
|
156
|
+
'browser_resumed_svelte_component',
|
|
157
|
+
'param_changed',
|
|
158
|
+
'variant_anchor_missing',
|
|
159
|
+
'component_preview_anchor_missing',
|
|
160
|
+
'steer_input_focused',
|
|
161
|
+
'steer_submitted',
|
|
162
|
+
'steer_send_failed',
|
|
163
|
+
'steer_done',
|
|
164
|
+
'steer_error',
|
|
165
|
+
]);
|
|
166
|
+
|
|
167
|
+
/** Checkpoint reasons the server reads as variant-publication progress. */
|
|
168
|
+
export const VARIANT_PROGRESS_CHECKPOINT_REASONS = Object.freeze([
|
|
169
|
+
'variants_progress',
|
|
170
|
+
'variants_ready',
|
|
171
|
+
]);
|