Skip to content

Self-hosted workflows for coding-agent delivery. Orchestrate CodeBuddy, Codex and Claude Code with scripts and human approval gates. Includes Local workflows for coding assistants.

fix(web): restore the AI orchestrator build animations (#135)

Robert06220721241e091f
diff --git a/web/app/flow-canvas.css b/web/app/flow-canvas.css
index b4be47db..32ba62c7 100644
--- a/web/app/flow-canvas.css
+++ b/web/app/flow-canvas.css
@@ -455,6 +455,22 @@ html[data-theme="dark"] #aiOrchestrator :is([data-cli="codex"],[data-cli="claude
#aiOrchestrator .ai-orchestrator-form>small{display:block;margin:8px 3px 0;color:var(--hui-tertiary);font-size:11px;line-height:1.6}
#aiOrchestrator :is(button,input):focus-visible{outline:2px solid var(--hui-accent);outline-offset:2px}
#aiOrchestrator input[data-model-search]:focus-visible{outline-offset:-2px}
+#aiOrchestrator .ai-live-thought.live b i{animation:aiPulse 1s ease-in-out infinite}
+/* Streaming build effects on the canvas, matching .ai-just-built / .ai-just-wired */
+#flowView .canvas.ai-building::after{content:"";position:absolute;inset:0;pointer-events:none;box-shadow:inset 0 0 0 2px color-mix(in srgb,var(--hui-accent) 35%,transparent);border-radius:inherit;animation:aiPulse 1.4s ease-in-out infinite}
+#flowView .canvas.ai-done::before{content:"";position:absolute;inset:0;z-index:30;pointer-events:none;background:linear-gradient(100deg,transparent 30%,color-mix(in srgb,var(--hui-accent) 14%,transparent) 50%,transparent 70%);background-size:250% 100%;animation:aiSweep 1.4s ease-out forwards}
+#flowView .canvas.ai-building .fd-empty{display:none}
+#flowView .ai-ghost-node{position:absolute;width:228px;height:92px;box-sizing:border-box;padding:14px 16px;border:1.5px dashed color-mix(in srgb,var(--hui-accent) 55%,transparent);border-radius:14px;background:linear-gradient(110deg,color-mix(in srgb,var(--hui-accent) 6%,transparent) 8%,color-mix(in srgb,var(--hui-info) 16%,transparent) 18%,color-mix(in srgb,var(--hui-accent) 6%,transparent) 33%);background-size:200% 100%;animation:aiShimmer 1.3s linear infinite;z-index:19;pointer-events:none}
+#flowView .ai-ghost-node i{display:block;height:10px;margin-bottom:8px;border-radius:6px;background:color-mix(in srgb,var(--hui-accent) 18%,transparent)}
+#flowView .ai-ghost-node i:first-child{width:60%}
+#flowView .ai-ghost-node i:nth-child(2){width:40%}
+#flowView .ai-ghost-node span{position:absolute;left:16px;bottom:10px;font-size:11.5px;color:var(--hui-accent)}
+@keyframes aiNodeIn{from{opacity:0;transform:translateY(10px) scale(.94)}to{opacity:1;transform:none}}
+@keyframes aiWire{from{stroke-dashoffset:48}to{stroke-dashoffset:0}}
+@keyframes aiPulse{0%,100%{opacity:.35}50%{opacity:1}}
+@keyframes aiShimmer{to{background-position:-200% 0}}
+@keyframes aiSweep{from{background-position:120% 0}to{background-position:-120% 0}}
+@media (prefers-reduced-motion:reduce){#flowView .canvas.ai-building::after,#flowView .canvas.ai-done::before,#flowView .ai-ghost-node,#aiOrchestrator .ai-live-thought.live b i,#flowView .fd-edges path.edge.ai-just-wired,#flowView .flow-node.fd-node.ai-just-built{animation:none}}
/* readonly */
#flowView.fd-readonly .fd-btn.save{display:none}
diff --git a/webtest/tests/flow-ai-panel-styles.test.mjs b/webtest/tests/flow-ai-panel-styles.test.mjs
new file mode 100644
index 00000000..bc902e0a
--- /dev/null
+++ b/webtest/tests/flow-ai-panel-styles.test.mjs
@@ -0,0 +1,69 @@
+import test from 'node:test';
+import assert from 'node:assert/strict';
+import { readFile, readdir } from 'node:fs/promises';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const WEB = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../web');
+const KEYWORDS = new Set(['none', 'infinite', 'linear', 'ease', 'ease-in', 'ease-out', 'ease-in-out', 'forwards', 'backwards', 'both', 'alternate', 'alternate-reverse', 'reverse', 'normal', 'paused', 'running', 'step-start', 'step-end', 'inherit', 'initial', 'unset']);
+
+async function studioStyles() {
+ const files = [];
+ for (const dir of ['', 'app']) {
+ for (const name of await readdir(path.join(WEB, dir))) {
+ if (name.endsWith('.css')) files.push(path.join(dir, name));
+ }
+ }
+ return Promise.all(files.map(async (file) => ({ file, css: await readFile(path.join(WEB, file), 'utf8') })));
+}
+
+// A stylesheet removal once took @keyframes with it while rules kept using
+// them, so canvas animations silently stopped.
+test('every studio animation name has a @keyframes definition', async () => {
+ const sheets = await studioStyles();
+ const defined = new Set(sheets.flatMap(({ css }) => [...css.matchAll(/@keyframes\s+([\w-]+)/g)].map((m) => m[1])));
+ const missing = [];
+ for (const { file, css } of sheets) {
+ for (const [, value] of css.matchAll(/animation(?:-name)?\s*:\s*([^;}]+)/g)) {
+ for (const token of value.split(/[\s,]+/)) {
+ if (/^[a-zA-Z][\w-]*$/.test(token) && !KEYWORDS.has(token) && !defined.has(token)) missing.push(`${file}: ${token}`);
+ }
+ }
+ }
+ assert.deepEqual(missing, []);
+});
+
+// #134: without these rules the composer overlapped the scenario chips and
+// the header buttons wrapped under the title.
+test('AI orchestrator panel stacks header, log and composer', async () => {
+ const css = await readFile(path.join(WEB, 'app/flow-canvas.css'), 'utf8');
+ const html = await readFile(path.join(WEB, 'index.html'), 'utf8');
+ for (const id of ['aiOrchestratorLog', 'aiOrchestratorSuggest', 'aiOrchestratorForm', 'aiOrchestratorInput']) {
+ assert.match(html, new RegExp(`id="${id}"`), `${id} missing from the panel`);
+ }
+ const rule = (selector) => {
+ const escaped = selector.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
+ const found = [...css.matchAll(new RegExp(`${escaped}\\{([^}]*)\\}`, 'g'))].map((m) => m[1]).join(';');
+ assert.ok(found, `no rule for ${selector}`);
+ return found;
+ };
+ assert.match(rule('#flowView .ai-orchestrator.fd-ai-panel'), /display:flex;flex-direction:column/);
+ assert.match(rule('#aiOrchestrator .ai-orchestrator-head'), /display:flex;align-items:center;justify-content:space-between/);
+ assert.match(rule('#aiOrchestrator .ai-orchestrator-log'), /flex:1;min-height:0;overflow:auto/);
+ assert.match(rule('#aiOrchestrator .ai-orchestrator-form'), /flex:none/);
+ assert.match(rule('#aiOrchestrator textarea'), /width:100%/);
+ // The send button sits in the composer toolbar instead of floating over the chips.
+ assert.match(rule('#flowView #aiOrchestrator .ai-orchestrator-send'), /position:static/);
+});
+
+test('canvas build effects are styled', async () => {
+ const css = await readFile(path.join(WEB, 'app/flow-canvas.css'), 'utf8');
+ for (const selector of ['#flowView .canvas.ai-building::after', '#flowView .canvas.ai-done::before', '#flowView .ai-ghost-node']) {
+ assert.ok(css.includes(`${selector}{`), `no rule for ${selector}`);
+ }
+ // The ghost node replaces the "还没有步骤" card while the assistant builds.
+ assert.ok(css.includes('#flowView .canvas.ai-building .fd-empty{display:none}'), 'empty-canvas card stays visible during an AI build');
+ const effects = css.split('\n').filter((line) => /^#flowView (\.canvas\.ai-|\.ai-ghost-node)/.test(line)).join('\n');
+ assert.doesNotMatch(effects, /rgba\(/, 'build effects must follow --hui-* tokens in both themes');
+ assert.match(css, /@media \(prefers-reduced-motion:reduce\)\{[^}]*#flowView \.ai-ghost-node[^}]*\{animation:none\}/);
+});