Changeset 0.30.2 cs2 (#202)

Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit is contained in:
2026-03-18 18:05:58 +00:00
committed by xcaliber
parent 7b0b6eb061
commit 5883cb50e2
17 changed files with 1231 additions and 31 deletions

View File

@@ -164,9 +164,11 @@
{{end}}
<!-- Stage surface mount point (v0.30.2) -->
<!-- Modes: form_only, form_chat, chat_only, review -->
<!-- Modes: form_only, form_chat, chat_only, review, or custom surface via SurfacePkgID -->
{{if eq .Data.StageMode "form_only"}}
{{if .Data.SurfacePkgID}}
<div id="customSurfaceMount" style="flex:1;overflow-y:auto"></div>
{{else if eq .Data.StageMode "form_only"}}
<div class="wf-form" id="formArea"></div>
{{else if eq .Data.StageMode "form_chat"}}
<div class="wf-body-split">
@@ -192,7 +194,7 @@
{{end}}
<div class="wf-session-info">
{{if eq .Data.StageMode "form_only"}}Submitting as{{else if eq .Data.StageMode "review"}}Reviewing as{{else}}Chatting as{{end}} <strong>{{.Data.SessionName}}</strong>
{{if .Data.SurfacePkgID}}Session:{{else if eq .Data.StageMode "form_only"}}Submitting as{{else if eq .Data.StageMode "review"}}Reviewing as{{else}}Chatting as{{end}} <strong>{{.Data.SessionName}}</strong>
</div>
</div>
@@ -204,6 +206,7 @@
const STAGE_MODE = '{{.Data.StageMode}}';
const TOTAL_STAGES = {{.Data.TotalStages}};
const CURRENT_STAGE = {{.Data.CurrentStage}};
const SURFACE_PKG_ID = '{{.Data.SurfacePkgID}}';
var FORM_TPL = null;
try { FORM_TPL = JSON.parse('{{.Data.FormTemplateJSON}}' || 'null'); } catch(e) {}
@@ -439,6 +442,44 @@
});
}
// ── Custom surface (v0.30.2) ──────────
if (SURFACE_PKG_ID) {
(async function() {
var mount = document.getElementById('customSurfaceMount');
if (!mount) return;
mount.innerHTML = '<div style="padding:24px;text-align:center;color:var(--text-3)">Loading surface\u2026</div>';
try {
// Load workflow-surfaces registry + dependencies
await loadScript(BASE + '/js/ui-primitives.js');
await loadScript(BASE + '/js/workflow-surfaces.js');
// Load the package's surface JS (registers via WorkflowSurfaces.register())
await loadScript(BASE + '/surfaces/' + SURFACE_PKG_ID + '/js/main.js');
// Mount the custom surface
var ctx = { channelId: CHAN_ID, sessionId: SESSION_ID, basePath: BASE,
stageMode: STAGE_MODE, formTemplate: FORM_TPL,
totalStages: TOTAL_STAGES, currentStage: CURRENT_STAGE };
mount.innerHTML = '';
if (typeof WorkflowSurfaces !== 'undefined') {
WorkflowSurfaces.mount(mount, SURFACE_PKG_ID, ctx);
} else {
mount.innerHTML = '<div style="padding:24px;color:var(--danger)">Failed to load surface registry.</div>';
}
} catch(e) {
mount.innerHTML = '<div style="padding:24px;color:var(--danger)">Failed to load surface: ' + escHtml(e.message) + '</div>';
}
})();
}
function loadScript(src) {
return new Promise(function(resolve, reject) {
var s = document.createElement('script');
s.src = src;
s.onload = resolve;
s.onerror = function() { reject(new Error('Failed to load ' + src)); };
document.head.appendChild(s);
});
}
// ── Review surface (v0.30.2) ──────────
if (STAGE_MODE === 'review') {
var reviewArea = document.getElementById('reviewArea');