{{/* Copyright (c) ClaceIO, LLC */}} {{/* SPDX-License-Identifier: Apache-2.0 */}} {{/* Builder session workspace (/builder/detail?id=...): chat pane + live preview + publish. HTMX partial: block session_content. The chat pane live-updates via (builderchat.js) consuming the /builder/events JSON-line stream; this page render is the durable transcript from the activity log */}} {{ template "head" . }}
{{ template "drawer_toggle" }}
{{ template "page_progress" }} {{ template "error_alert" .Data.Error }} {{ if .Data.Session }}
{{ block "session_content" . }} {{ template "flash_alerts" .Data }} {{ $s := .Data.Session }} {{ $canWrite := index .Data.Perms "builder:create" }} {{ $canPublish := index .Data.Perms "builder:publish" }}
{{ template "builder_status_badge" $s.status }} {{ if $s.edit_app }} editing {{ $s.edit_app }} {{ end }} {{ if $s.profile }}profile: {{ $s.profile }} · {{ end }}agent: {{ $s.agent }}{{ if $s.spec }} · spec: {{ $s.spec }}{{ end }}{{ if $s.services }} · services: {{ range $i, $svc := $s.services }}{{ if $i }}, {{ end }}{{ $svc }}{{ end }}{{ end }}
{{ if $s.preview_path }} {{ end }} {{/* Key off IsLive, not status: a published session keeps its "published" status after the sandbox is reaped, so status alone would hide Resume and offer a Stop with nothing to stop */}} {{ if not .Data.IsLive }} {{ else }} {{ end }}
{{ if .Data.PublishResult }}
Published {{ .Data.PublishResult.publish_path }} ({{ .Data.PublishResult.mode }} mode) {{ if .Data.PublishResult.commit_sha }} - commit {{ .Data.PublishResult.commit_sha | trunc 12 }} {{ end }}
{{ if eq .Data.PublishResult.mode "git" }}
Apps go live when the prod sync runs
{{ end }}
{{ end }} {{ if .Data.AskPromotePath }}
{{ template "promote_prompt" (dict "Message" "The changes were applied to the staging app. Promote to make them live on prod?" "Path" .Data.AskPromotePath "PostUrl" (print .AppPath "/builder/detail/promote?id=" .Data.Id) "Target" "#session-content" "KeepHref" (print .AppPath "/apps/detail?path=" .Data.AskPromotePath) "Perms" .Data.Perms) }}
{{ end }} {{ if $s.publish_path }}
Published at {{ $s.publish_path }}app detail {{ if not $s.edit_app }} {{ end }}
{{ end }}

Agent

{{ if .Data.SandboxContainerId }} agent {{ end }}
{{ range .Data.Messages }} {{ if eq .kind "prompt" }}
{{ .content | trim }}
{{ else if eq .kind "agent_message" }}
{{ .content | trim }}
{{ else if eq .kind "tool_call" }}
{{ range .parts }} {{- .text | trim -}} {{- if gt .count 1 }}×{{ .count }}{{ end -}} {{ end }}
{{ else if eq .kind "error" }}
{{ .content | trim }}
{{ else if eq .kind "lifecycle" }}
{{- range $i, $part := .parts }}{{ if $i }} · {{ end }}{{ $part.text }}{{ if gt $part.count 1 }} ×{{ $part.count }}{{ end }}{{ end -}}
{{ else }}
{{ .content | trim }}
{{ end }} {{ end }} {{ if .Data.Partial }}
{{ .Data.Partial | trim }}
{{ end }}
{{/* Failed sends land here via HX-Retarget: the composer posts with hx-swap=none (the chat renders from SSE events), so without this slot a rejected message (agent busy, session still starting) would be invisible */}}
{{ template "bc_send_error" . }}
{{ if .Data.Files }} {{ end }} {{ if $s.preview_path }} {{ $s.preview_path }} {{ template "globe_icon" }} {{ else }} waiting for a loadable app… {{ end }}
{{ if $s.preview_path }} {{ else }}
{{ if .Data.PreviewError }}

The app failed to load. Ask the agent to fix the error above - the preview is retried after every agent reply.

{{ else }} {{ if and .Data.Files (not .Data.HasAppStar) }}

The workspace has no app.star yet, which OpenRun needs to serve the app. Ask the agent to "add the app.star OpenRun app definition" - the preview is retried after every agent reply.

{{ else }}

Your app will appear here

The live preview loads automatically once the agent's first pass produces a loadable app

{{ end }} {{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ template "sidebar" . }}