Fix prompt buttons, add command output to prompt steps, add worker to repo

- Fix onclick buttons broken by JSON.stringify double-quotes inside HTML
  attributes — use data-opt attribute + this.dataset.opt instead
- Track last command stdout in execution state when command_result arrives
- executePromptStep: include last command output in log entry and broadcast
  so users can review results alongside the question in the same view
- GET /api/executions/🆔 propagate output field to pending prompt response
- Add .prompt-output CSS class for scrollable terminal-style output block
- Fix MariaDB CAST(? AS JSON) → JSON_EXTRACT(?, '$') (MariaDB 10.11 compat)
- Add worker/worker.js to repo (deployed on pulse-worker-01 / LXC 153)
  Fix: worker was not echoing command_id back in result — resolvers always
  got undefined, causing every workflow step to timeout and fail

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-17 19:06:02 -04:00
parent 3f6e04d1ab
commit 2290d52f8b
3 changed files with 297 additions and 8 deletions

View File

@@ -574,6 +574,19 @@
font-family: var(--font-mono);
margin-bottom: 14px;
}
.prompt-output {
background: rgba(0, 0, 0, 0.4);
border: 1px solid rgba(0, 255, 65, 0.25);
color: var(--terminal-green);
font-family: var(--font-mono);
font-size: 0.78em;
padding: 10px;
max-height: 280px;
overflow-y: auto;
white-space: pre-wrap;
word-break: break-all;
margin-bottom: 14px;
}
.prompt-opt-btn {
padding: 7px 16px;
margin: 4px 4px 4px 0;
@@ -2002,13 +2015,15 @@
`;
if (execution.waiting_for_input && execution.prompt) {
const promptOutput = execution.prompt.output || '';
html += `
<div class="prompt-box">
<h3>Waiting for Input</h3>
${promptOutput ? `<pre class="prompt-output">${escapeHtml(promptOutput)}</pre>` : ''}
<p>${escapeHtml(execution.prompt.message || '')}</p>
<div style="margin-top: 10px;">
${(execution.prompt.options || []).map(opt =>
`<button class="prompt-opt-btn" onclick="respondToPrompt('${executionId}', ${JSON.stringify(opt)})">${escapeHtml(opt)}</button>`
`<button class="prompt-opt-btn" data-opt="${opt.replace(/&/g,'&amp;').replace(/"/g,'&quot;')}" onclick="respondToPrompt('${executionId}', this.dataset.opt)">${escapeHtml(opt)}</button>`
).join('')}
</div>
</div>
@@ -2172,7 +2187,7 @@
if (log.action === 'prompt') {
const optionsHtml = (log.options || []).map(opt => {
if (executionId) {
return `<button class="prompt-opt-btn" onclick="respondToPrompt('${executionId}', ${JSON.stringify(opt)})">${escapeHtml(opt)}</button>`;
return `<button class="prompt-opt-btn" data-opt="${opt.replace(/&/g,'&amp;').replace(/"/g,'&quot;')}" onclick="respondToPrompt('${executionId}', this.dataset.opt)">${escapeHtml(opt)}</button>`;
}
return `<button class="prompt-opt-btn answered" disabled>${escapeHtml(opt)}</button>`;
}).join('');
@@ -2181,6 +2196,7 @@
<div class="log-timestamp">[${timestamp}]</div>
<div class="log-title" style="color: var(--terminal-cyan);">❓ Step ${log.step}: ${escapeHtml(log.step_name || 'Prompt')}</div>
<div class="log-details">
${log.output ? `<pre class="log-output" style="max-height:300px;overflow-y:auto;margin-bottom:10px;">${escapeHtml(log.output)}</pre>` : ''}
<div style="color: var(--terminal-green); margin-bottom: 10px;">${escapeHtml(log.message || '')}</div>
<div>${optionsHtml}</div>
</div>