Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: keep FableLoom run status scoped and live
[._.]/ Adam Eivy8ea5e26dc537
diff --git a/client/src/components/fableloom/LoomSeriesPlan.jsx b/client/src/components/fableloom/LoomSeriesPlan.jsxindex bb4e8eafa6..6ad56c7e75 100644--- a/client/src/components/fableloom/LoomSeriesPlan.jsx+++ b/client/src/components/fableloom/LoomSeriesPlan.jsx@@ -211,7 +211,9 @@ function SeriesAiEditor({ loom, dirty, onLoomUpdate }) {const [analysis, setAnalysis] = useState(null);const [route, setRoute] = useState({ providerId: '', model: '', effort: '' });const regenerateConfirm = useConfirmDelete();- const { run: aiRun, begin: beginAiRun, fail: failAiRun } = useFableLoomAiRun();+ const reviewRun = useFableLoomAiRun();+ const generateRun = useFableLoomAiRun();+ const feedbackRun = useFableLoomAiRun();const { providers, loading } = useProviderModels({ allowDefault: true, silent: true, withEffort: true });const selectedProvider = providers.find((provider) => provider.id === route.providerId);const routeBody = {@@ -221,26 +223,26 @@ function SeriesAiEditor({ loom, dirty, onLoomUpdate }) {};const [runReview, reviewing] = useAsyncAction(async () => {- const operationId = beginAiRun();+ const operationId = reviewRun.begin();const result = await reviewLoomSeriesPlan(loom.id, { ...routeBody, operationId }, { silent: true })- .catch((error) => { failAiRun(error.message); throw error; });+ .catch((error) => { reviewRun.fail(error.message); throw error; });setAnalysis(result.analysis);}, { errorMessage: 'Series analysis failed' });const [generatePlan, generating] = useAsyncAction(async () => {- const operationId = beginAiRun();+ const operationId = generateRun.begin();const result = await generateLoomSeriesPlan(loom.id, { ...routeBody, operationId }, { silent: true })- .catch((error) => { failAiRun(error.message); throw error; });+ .catch((error) => { generateRun.fail(error.message); throw error; });onLoomUpdate(result.loom);setAnalysis(null);toast.success('Full series plan drafted');}, { errorMessage: 'Series-plan drafting failed' });const [applyFeedback, applying] = useAsyncAction(async () => {- const operationId = beginAiRun();+ const operationId = feedbackRun.begin();const result = await feedbackLoomSeriesPlan(loom.id, {feedback: feedback.trim(), ...routeBody, operationId,- }, { silent: true }).catch((error) => { failAiRun(error.message); throw error; });+ }, { silent: true }).catch((error) => { feedbackRun.fail(error.message); throw error; });onLoomUpdate(result.loom);setFeedback('');setAnalysis(null);@@ -307,6 +309,7 @@ function SeriesAiEditor({ loom, dirty, onLoomUpdate }) {{generating ? 'Drafting full plan…' : hasPlan ? 'Regenerate full plan' : 'Draft full plan'}</button>)}+ <LoomAiRunStatus run={generateRun.run} />{hasPlan ? (<p className="text-xs text-port-text-muted">Regenerating replaces the saved arc, plot points, and side quests. Episode titles,@@ -324,6 +327,7 @@ function SeriesAiEditor({ loom, dirty, onLoomUpdate }) {{reviewing ? 'Analyzing…' : 'Analyze series'}</button></div>+ <LoomAiRunStatus run={reviewRun.run} /><FormFieldlabel="Edit outline & plot points"hint="Ask the AI to refine or restructure plot points, story beats, or side quests across the entire series."@@ -347,7 +351,7 @@ function SeriesAiEditor({ loom, dirty, onLoomUpdate }) {{applying ? <Loader2 size={14} className="animate-spin" /> : <Sparkles size={14} />}{applying ? 'Updating series plan…' : 'Apply guidance to plan'}</button>- <LoomAiRunStatus run={aiRun} />+ <LoomAiRunStatus run={feedbackRun.run} />{dirty ? <p className="text-xs text-port-warning">Save the plan before running AI so it reads the edits on screen.</p> : null}{analysis ? <SeriesAnalysis analysis={analysis} /> : null}</div>diff --git a/server/services/fableLoom/weave.js b/server/services/fableLoom/weave.jsindex a52829c237..1c3ad71559 100644--- a/server/services/fableLoom/weave.js+++ b/server/services/fableLoom/weave.js@@ -66,8 +66,7 @@ const llmOptions = ({ providerId, model, effort } = {}, source) => ({// mistaken for a different loom or a stale run in another tab. The normal// `ai:status` channel carries these frames; `localOnly` keeps the global toast// surface from duplicating the drawer's inline status and error message.-const runLoomAi = (stage, variables, route, { action, label, source }) => {- const status = route.operationId+const createLoomAiStatus = (route, { action, label }) => route.operationId? startAIOp({op: `fableloom-${action}`,label,@@ -75,13 +74,18 @@ const runLoomAi = (stage, variables, route, { action, label, source }) => {localOnly: true,silent: true,})- : null;+ : null;++const runLoomAi = (stage, variables, route, {+ action, label, source, status: existingStatus = null, complete = true,+}) => {+ const status = existingStatus || createLoomAiStatus(route, { action, label });const options = llmOptions(route, source);if (status) {options.onRunCreated = (runId, meta = {}) => status.update('running',`${label} is running…`,- { ...meta, runId },+ { ...meta, runId, shellReady: false },);options.onRunReady = (meta = {}) => status.update('ready',@@ -95,7 +99,7 @@ const runLoomAi = (stage, variables, route, { action, label, source }) => {);}return runStagedLLM(stage, variables, options).then((result) => {- status?.complete('AI response ready', { runId: result.runId, shellReady: false });+ if (complete) status?.complete('AI response ready', { runId: result.runId, shellReady: false });return result;}, (error) => {status?.error(@@ -860,6 +864,10 @@ export async function reformatEpisodeScenes(loomId, episodeId, { format, provideconst canonDigest = await buildCanonDigest(loom);const runIds = [];const nodes = episode.nodes.filter((n) => needsReformat(n, target));+ const status = createLoomAiStatus(+ { operationId, providerId, model, effort },+ { action: 'reformat-scenes', label: 'Reformatting scenes' },+ );let rewritten = 0;let chunks = 0;@@ -877,7 +885,7 @@ export async function reformatEpisodeScenes(loomId, episodeId, { format, providesceneFormatContract: sceneFormatContract(target),scenesJson: JSON.stringify(batch.map((n) => ({ id: n.id, title: n.title, prose: n.prose })), null, 2),}, { providerId, model, effort, operationId }, {- action: 'reformat-scenes', label: 'Reformatting scenes', source: 'fableloom-reformat',+ action: 'reformat-scenes', label: 'Reformatting scenes', source: 'fableloom-reformat', status, complete: false,});if (runId) runIds.push(runId);@@ -906,6 +914,8 @@ export async function reformatEpisodeScenes(loomId, episodeId, { format, providerewritten += byId.size;}+ status?.complete('AI response ready', { runId: runIds.at(-1), shellReady: false });+// An episode with nothing to rewrite is a no-op, not a failure — the client// walks every episode, and the pin below is still the point. Only an episode// that HAD scenes and got none back is a bad response.