@app-vitals/agent-admin 1.91.0 → 1.92.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/admin-ui-github-identity-pages.ts +4 -4
- package/src/admin-ui-installation-repos-pages.ts +4 -4
- package/src/admin-ui-layout.ts +3 -0
- package/src/admin-ui-layout.unit.test.ts +16 -0
- package/src/admin-ui-pages.ts +111 -110
- package/src/admin-ui-pages.unit.test.ts +5 -3
- package/src/admin-ui-push-test.ts +5 -6
- package/src/admin-ui-styles.ts +113 -113
- package/src/admin-ui-styles.unit.test.ts +5 -40
- package/src/admin-ui-templates-pages.ts +1 -1
- package/src/github-app-api.unit.test.ts +235 -0
- package/src/github-enterprise-warnings.ts +1 -1
- package/src/github-enterprise-warnings.unit.test.ts +7 -0
- package/src/github-installation-wiring.ts +4 -1
- package/src/github-installation.fixtures.ts +1 -1
- package/src/github-repo-cache.integration.test.ts +32 -0
- package/src/github-repo-cache.ts +13 -4
- package/src/github-repo-refresh-discovery.ts +14 -1
- package/src/github-repo-refresher.ts +43 -3
- package/src/github-repo-refresher.unit.test.ts +54 -2
- package/src/github-sync-cache.integration.test.ts +63 -0
- package/src/github-sync.ts +62 -13
- package/src/github-sync.unit.test.ts +65 -0
- package/src/push-toggle.ts +1 -1
package/src/admin-ui-pages.ts
CHANGED
|
@@ -428,7 +428,7 @@ export function renderAgentsPage(
|
|
|
428
428
|
const accountCell = (a: AgentListItem): string => {
|
|
429
429
|
if (!showAccount) return "";
|
|
430
430
|
const name = a.accountId ? opts?.accountNames?.get(a.accountId) : undefined;
|
|
431
|
-
return `<td>${a.accountId && name ? `<a href="/admin/accounts/${escapeHtml(a.accountId)}">${escapeHtml(name)}</a>` : '<span style="color
|
|
431
|
+
return `<td>${a.accountId && name ? `<a href="/admin/accounts/${escapeHtml(a.accountId)}">${escapeHtml(name)}</a>` : '<span style="color:var(--vos-text-faint)">—</span>'}</td>`;
|
|
432
432
|
};
|
|
433
433
|
const successHtml = opts?.successMsg
|
|
434
434
|
? `<div class="alert alert-success">${escapeHtml(opts.successMsg)}</div>`
|
|
@@ -453,7 +453,7 @@ export function renderAgentsPage(
|
|
|
453
453
|
.map(
|
|
454
454
|
(a) => `<tr>
|
|
455
455
|
<td><a href="/admin/agents/${escapeHtml(a.id)}" class="agent-link">${escapeHtml(a.name)}</a></td>
|
|
456
|
-
<td class="mono">${a.slackId ? escapeHtml(a.slackId) : '<span style="color
|
|
456
|
+
<td class="mono">${a.slackId ? escapeHtml(a.slackId) : '<span style="color:var(--vos-text-faint)">—</span>'}</td>
|
|
457
457
|
${accountCell(a)}
|
|
458
458
|
<td>${escapeHtml(new Date(a.createdAt).toLocaleDateString("en-US", { timeZone: timezone }))}</td>
|
|
459
459
|
<td>
|
|
@@ -569,7 +569,7 @@ export function renderNewLocalAgentPage(
|
|
|
569
569
|
class="form-input"
|
|
570
570
|
placeholder="sk-ant-oat01-..."
|
|
571
571
|
/>
|
|
572
|
-
<p style="font-size:12px;color
|
|
572
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin-top:4px">
|
|
573
573
|
Stored as the agent's <span class="mono">CLAUDE_CODE_OAUTH_TOKEN</span>. Required for the agent
|
|
574
574
|
to run — set it here or from the agent detail page.
|
|
575
575
|
</p>
|
|
@@ -583,7 +583,7 @@ export function renderNewLocalAgentPage(
|
|
|
583
583
|
class="form-input"
|
|
584
584
|
placeholder="sk-ant-..."
|
|
585
585
|
/>
|
|
586
|
-
<p style="font-size:12px;color
|
|
586
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin-top:4px">
|
|
587
587
|
Stored as the agent's <span class="mono">ANTHROPIC_API_KEY</span>.
|
|
588
588
|
</p>
|
|
589
589
|
</div>`;
|
|
@@ -613,14 +613,14 @@ export function renderNewLocalAgentPage(
|
|
|
613
613
|
</p>
|
|
614
614
|
${
|
|
615
615
|
selfServe.remaining <= 0
|
|
616
|
-
? `<p style="font-size:13px;color
|
|
616
|
+
? `<p style="font-size:13px;color:var(--vos-danger-text);margin-bottom:8px">
|
|
617
617
|
This account has reached its agent limit. Delete an agent to free a slot,
|
|
618
618
|
or contact <a href="mailto:${escapeHtml(selfServe.contactEmail)}">${escapeHtml(selfServe.contactEmail)}</a> for more.
|
|
619
619
|
</p>`
|
|
620
620
|
: ""
|
|
621
621
|
}
|
|
622
|
-
<p style="font-size:13px;color
|
|
623
|
-
<ul style="font-size:13px;color
|
|
622
|
+
<p style="font-size:13px;color:var(--vos-text-muted);margin-bottom:4px">Have these ready before you start:</p>
|
|
623
|
+
<ul style="font-size:13px;color:var(--vos-text-muted);margin-left:20px">
|
|
624
624
|
<li>A Slack App Configuration Token</li>
|
|
625
625
|
<li>A GitHub org with an App, or a personal access token (PAT)</li>
|
|
626
626
|
<li>A Claude API key or OAuth token</li>
|
|
@@ -629,12 +629,12 @@ export function renderNewLocalAgentPage(
|
|
|
629
629
|
: "";
|
|
630
630
|
const tplOpts = opts?.template;
|
|
631
631
|
const templateFieldsetHtml = tplOpts
|
|
632
|
-
? `<fieldset id="template-section" style="border:1px solid
|
|
632
|
+
? `<fieldset id="template-section" style="border:1px solid var(--vos-border);border-radius:8px;padding:16px">
|
|
633
633
|
<legend style="font-size:13px;font-weight:600;padding:0 8px">Agent template</legend>
|
|
634
634
|
${
|
|
635
635
|
tplOpts.items.length === 0
|
|
636
|
-
? `<p style="font-size:13px;color
|
|
637
|
-
: `<p style="font-size:13px;color
|
|
636
|
+
? `<p style="font-size:13px;color:var(--vos-text-muted);margin-bottom:12px">No template items apply to new agents.</p>`
|
|
637
|
+
: `<p style="font-size:13px;color:var(--vos-text-muted);margin-bottom:8px">New agents start with these template defaults${tplOpts.allowEnv ? "; anything you enter below overrides them" : ""}:</p>
|
|
638
638
|
<table class="data-table" style="margin-bottom:12px">
|
|
639
639
|
<thead><tr><th>Kind</th><th>Key</th><th>Default</th><th>Applies to</th></tr></thead>
|
|
640
640
|
<tbody>${tplOpts.items
|
|
@@ -650,7 +650,7 @@ export function renderNewLocalAgentPage(
|
|
|
650
650
|
? `<div class="form-group">
|
|
651
651
|
<label class="form-label" for="env">Env overrides (optional)</label>
|
|
652
652
|
<textarea id="env" name="env" class="form-input mono" rows="3" placeholder="KEY=value (one per line)"></textarea>
|
|
653
|
-
<p style="font-size:12px;color
|
|
653
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin-top:4px">
|
|
654
654
|
Values entered here win over the template defaults above and stay fixed when the template changes.
|
|
655
655
|
</p>
|
|
656
656
|
</div>`
|
|
@@ -661,7 +661,7 @@ export function renderNewLocalAgentPage(
|
|
|
661
661
|
<input type="checkbox" name="templateDetached" value="true" />
|
|
662
662
|
Start without the template (opt out)
|
|
663
663
|
</label>
|
|
664
|
-
<p style="font-size:12px;color
|
|
664
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin-top:4px">
|
|
665
665
|
The agent gets only its built-in defaults and ignores later template changes until you reattach it.
|
|
666
666
|
</p>
|
|
667
667
|
</div>
|
|
@@ -681,14 +681,14 @@ export function renderNewLocalAgentPage(
|
|
|
681
681
|
<div class="vos-page">
|
|
682
682
|
<div class="page-header">
|
|
683
683
|
<div>
|
|
684
|
-
<a href="/admin/agents" style="font-size:13px;color
|
|
684
|
+
<a href="/admin/agents" style="font-size:13px;color:var(--vos-text-muted);text-decoration:none">← Agents</a>
|
|
685
685
|
<h1 class="page-title" style="margin-top:4px">New Agent</h1>
|
|
686
686
|
</div>
|
|
687
687
|
</div>
|
|
688
688
|
${errorHtml}
|
|
689
689
|
${selfServeHtml}
|
|
690
690
|
<div class="card">
|
|
691
|
-
<p style="font-size:14px;color
|
|
691
|
+
<p style="font-size:14px;color:var(--vos-text-muted);margin-bottom:20px">
|
|
692
692
|
Create an agent and choose where it runs. Slack and GitHub connections
|
|
693
693
|
below are optional — you can always talk to the agent from the
|
|
694
694
|
<a href="/admin/chat">Chat</a> tab first and connect them later from
|
|
@@ -708,7 +708,7 @@ export function renderNewLocalAgentPage(
|
|
|
708
708
|
/>
|
|
709
709
|
</div>
|
|
710
710
|
${typeFieldHtml}
|
|
711
|
-
<fieldset style="border:1px solid
|
|
711
|
+
<fieldset style="border:1px solid var(--vos-border);border-radius:8px;padding:16px">
|
|
712
712
|
<legend style="font-size:13px;font-weight:600;padding:0 8px">Runtime</legend>
|
|
713
713
|
<div class="form-group" style="margin-bottom:0">
|
|
714
714
|
<label style="display:block;font-size:13px;font-weight:500;margin-bottom:8px">
|
|
@@ -716,7 +716,7 @@ export function renderNewLocalAgentPage(
|
|
|
716
716
|
onchange="${runtimeSectionsOnchange("")}"
|
|
717
717
|
/>
|
|
718
718
|
Provisioned in-cluster
|
|
719
|
-
<span style="font-weight:400;color
|
|
719
|
+
<span style="font-weight:400;color:var(--vos-text-muted)">
|
|
720
720
|
— the admin service creates the Deployment, Secret, and PVC for you.
|
|
721
721
|
</span>
|
|
722
722
|
</label>
|
|
@@ -725,14 +725,14 @@ export function renderNewLocalAgentPage(
|
|
|
725
725
|
onchange="${runtimeSectionsOnchange("none")}"
|
|
726
726
|
/>
|
|
727
727
|
Self-hosted
|
|
728
|
-
<span style="font-weight:400;color
|
|
728
|
+
<span style="font-weight:400;color:var(--vos-text-muted)">
|
|
729
729
|
— you run the container yourself (<span class="mono">task stack</span>, local Docker).
|
|
730
730
|
</span>
|
|
731
731
|
</label>
|
|
732
732
|
${
|
|
733
733
|
canProvision
|
|
734
734
|
? ""
|
|
735
|
-
: `<p style="font-size:12px;color
|
|
735
|
+
: `<p style="font-size:12px;color:var(--vos-text-muted);margin-top:8px">
|
|
736
736
|
In-cluster provisioning is unavailable — <span class="mono">SHIPWRIGHT_K8S_PROVISIONING</span> is not enabled on this admin service.
|
|
737
737
|
</p>`
|
|
738
738
|
}
|
|
@@ -748,7 +748,7 @@ export function renderNewLocalAgentPage(
|
|
|
748
748
|
rows="4"
|
|
749
749
|
placeholder="my-org/repo-one my-org/repo-two"
|
|
750
750
|
></textarea>
|
|
751
|
-
<p style="font-size:12px;color
|
|
751
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin-top:4px">Format: <span class="mono">org/repo</span></p>
|
|
752
752
|
</div>
|
|
753
753
|
<div class="form-group">
|
|
754
754
|
<label class="form-label" for="authorAllowlist">Author allowlist (review) (optional, one GitHub login per line)</label>
|
|
@@ -759,7 +759,7 @@ export function renderNewLocalAgentPage(
|
|
|
759
759
|
rows="4"
|
|
760
760
|
placeholder="octocat another-user"
|
|
761
761
|
></textarea>
|
|
762
|
-
<p style="font-size:12px;color
|
|
762
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin-top:4px">GitHub login, one per line</p>
|
|
763
763
|
</div>
|
|
764
764
|
<div class="form-group">
|
|
765
765
|
<label class="form-label" for="patchAuthorAllowlist">Patch author allowlist (optional, one GitHub login per line)</label>
|
|
@@ -770,7 +770,7 @@ export function renderNewLocalAgentPage(
|
|
|
770
770
|
rows="4"
|
|
771
771
|
placeholder="octocat another-user"
|
|
772
772
|
></textarea>
|
|
773
|
-
<p style="font-size:12px;color
|
|
773
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin-top:4px">GitHub login, one per line</p>
|
|
774
774
|
</div>
|
|
775
775
|
<div id="restrict-slack-group" style="display:${runtimeSectionsDisplay}">
|
|
776
776
|
<div class="form-group" style="display:flex;align-items:center;gap:6px">
|
|
@@ -783,7 +783,7 @@ export function renderNewLocalAgentPage(
|
|
|
783
783
|
/>
|
|
784
784
|
<label class="form-label" for="restrictSlackToMembers" style="margin-bottom:0">Restrict Slack to members</label>
|
|
785
785
|
</div>
|
|
786
|
-
<p style="font-size:12px;color
|
|
786
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin-top:-12px">
|
|
787
787
|
When enabled, only AgentMember emails may message this agent over Slack. If the agent has no
|
|
788
788
|
members yet, enabling this will block all Slack senders.
|
|
789
789
|
</p>
|
|
@@ -797,11 +797,11 @@ export function renderNewLocalAgentPage(
|
|
|
797
797
|
rows="4"
|
|
798
798
|
placeholder="alice@example.com bob@example.com"
|
|
799
799
|
></textarea>
|
|
800
|
-
<p style="font-size:12px;color
|
|
800
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin-top:4px">Email address, one per line</p>
|
|
801
801
|
</div>
|
|
802
802
|
</div>
|
|
803
803
|
</div>
|
|
804
|
-
<fieldset id="slack-section" style="display:${runtimeSectionsDisplay};border:1px solid
|
|
804
|
+
<fieldset id="slack-section" style="display:${runtimeSectionsDisplay};border:1px solid var(--vos-border);border-radius:8px;padding:16px">
|
|
805
805
|
<legend style="font-size:13px;font-weight:600;padding:0 8px">Slack (optional)</legend>
|
|
806
806
|
<div class="form-group" style="display:flex;align-items:center;gap:6px;margin-bottom:0">
|
|
807
807
|
<input
|
|
@@ -823,7 +823,7 @@ export function renderNewLocalAgentPage(
|
|
|
823
823
|
class="form-input"
|
|
824
824
|
placeholder="xoxe.xoxp-..."
|
|
825
825
|
/>
|
|
826
|
-
<p style="font-size:12px;color
|
|
826
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin-top:4px">
|
|
827
827
|
${
|
|
828
828
|
opts?.slackConfigTokenStored
|
|
829
829
|
? "Optional: a stored Slack config token is configured in Settings and is used when this is left blank. A token pasted here is used instead. "
|
|
@@ -834,7 +834,7 @@ export function renderNewLocalAgentPage(
|
|
|
834
834
|
</div>
|
|
835
835
|
</div>
|
|
836
836
|
</fieldset>
|
|
837
|
-
<fieldset id="github-section" style="display:${runtimeSectionsDisplay};border:1px solid
|
|
837
|
+
<fieldset id="github-section" style="display:${runtimeSectionsDisplay};border:1px solid var(--vos-border);border-radius:8px;padding:16px">
|
|
838
838
|
<legend style="font-size:13px;font-weight:600;padding:0 8px">GitHub Authentication (optional)</legend>
|
|
839
839
|
<!--
|
|
840
840
|
ghAppMode disambiguates the two ghAuthMode="app" radios below
|
|
@@ -850,7 +850,7 @@ export function renderNewLocalAgentPage(
|
|
|
850
850
|
<input type="radio" name="ghAuthMode" value="skip" checked
|
|
851
851
|
onchange="document.getElementById('gh-pat-fields').style.display='none';document.getElementById('gh-app-fields').style.display='none';document.getElementById('gh-app-manual-fields').style.display='none'"
|
|
852
852
|
/> Skip
|
|
853
|
-
<span style="font-weight:400;color
|
|
853
|
+
<span style="font-weight:400;color:var(--vos-text-muted)">
|
|
854
854
|
— connect GitHub later from the agent detail page.
|
|
855
855
|
</span>
|
|
856
856
|
</label>
|
|
@@ -868,7 +868,7 @@ export function renderNewLocalAgentPage(
|
|
|
868
868
|
<input type="radio" name="ghAuthMode" value="app"
|
|
869
869
|
onchange="document.getElementById('ghAppMode').value='manual';document.getElementById('gh-pat-fields').style.display='none';document.getElementById('gh-app-fields').style.display='none';document.getElementById('gh-app-manual-fields').style.display='block'"
|
|
870
870
|
/> Use existing GitHub App
|
|
871
|
-
<span style="font-weight:400;color
|
|
871
|
+
<span style="font-weight:400;color:var(--vos-text-muted)">
|
|
872
872
|
— connect a GitHub App you've already created.
|
|
873
873
|
</span>
|
|
874
874
|
</label>
|
|
@@ -883,7 +883,7 @@ export function renderNewLocalAgentPage(
|
|
|
883
883
|
<div class="form-group">
|
|
884
884
|
<label class="form-label" for="githubOrg">GitHub org</label>
|
|
885
885
|
<input id="githubOrg" name="githubOrg" type="text" class="form-input" placeholder="my-org" />
|
|
886
|
-
<p style="font-size:12px;color
|
|
886
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin-top:4px">
|
|
887
887
|
You'll be redirected to GitHub to create the App under this organization from a manifest.
|
|
888
888
|
</p>
|
|
889
889
|
</div>
|
|
@@ -900,7 +900,7 @@ export function renderNewLocalAgentPage(
|
|
|
900
900
|
<div class="form-group">
|
|
901
901
|
<label class="form-label" for="ghAppPrivateKeyFile">Private Key (.pem)</label>
|
|
902
902
|
<input id="ghAppPrivateKeyFile" name="ghAppPrivateKeyFile" type="file" accept=".pem" class="form-input" />
|
|
903
|
-
<p style="font-size:12px;color
|
|
903
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin-top:4px">
|
|
904
904
|
Upload the private key <span class="mono">.pem</span> file you downloaded when creating the GitHub App.
|
|
905
905
|
</p>
|
|
906
906
|
</div>
|
|
@@ -980,8 +980,8 @@ function renderConnectAction(
|
|
|
980
980
|
.join("\n ");
|
|
981
981
|
return `<details style="position:relative">
|
|
982
982
|
<summary class="btn btn-secondary" style="cursor:pointer;font-size:12px;list-style:none">${escapeHtml(cfg.label)}</summary>
|
|
983
|
-
<div style="position:absolute;left:0;margin-top:6px;background
|
|
984
|
-
<p style="font-size:12px;color
|
|
983
|
+
<div style="position:absolute;left:0;margin-top:6px;background:var(--vos-surface);border:1px solid var(--vos-border);border-radius:6px;padding:12px;box-shadow:0 4px 12px rgba(0,0,0,0.08);z-index:10;min-width:320px">
|
|
984
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin:0 0 10px">${cfg.description}</p>
|
|
985
985
|
<form method="POST" action="${cfg.action}"${hasFileInput ? ' enctype="multipart/form-data"' : ""} style="display:flex;flex-direction:column;gap:8px">
|
|
986
986
|
${hiddenInputs}
|
|
987
987
|
${visibleInputs}
|
|
@@ -1255,7 +1255,7 @@ export function renderAgentDetailPage(
|
|
|
1255
1255
|
.map(
|
|
1256
1256
|
([k]) => `<tr>
|
|
1257
1257
|
<td class="mono">${escapeHtml(k)}${secretKeySet.has(k) ? ' <span title="Secret">🔒</span>' : ""}${sourceBadge(envSources[k])}</td>
|
|
1258
|
-
<td class="mono" style="color
|
|
1258
|
+
<td class="mono" style="color:var(--vos-text-muted)">••••••••</td>
|
|
1259
1259
|
<td>
|
|
1260
1260
|
<form method="POST" action="/admin/agents/${escapeHtml(agent.id)}/envs/delete" style="display:inline">
|
|
1261
1261
|
<input type="hidden" name="key" value="${escapeHtml(k)}" />
|
|
@@ -1417,15 +1417,15 @@ export function renderAgentDetailPage(
|
|
|
1417
1417
|
<td style="font-size:11px">${
|
|
1418
1418
|
child.lastRun?.startedAt
|
|
1419
1419
|
? `<span class="badge" style="${cronOutcomeStyle(lastRunOutcomeLabel)}">${escapeHtml(lastRunOutcomeLabel ?? "unknown")}</span>`
|
|
1420
|
-
: `<span style="color
|
|
1420
|
+
: `<span style="color:var(--vos-border-strong)">never</span>`
|
|
1421
1421
|
}</td>
|
|
1422
1422
|
<td style="white-space:nowrap">${renderCronActions(child)}</td>
|
|
1423
1423
|
</tr>`;
|
|
1424
1424
|
})
|
|
1425
1425
|
.join("\n");
|
|
1426
1426
|
return `<tr>
|
|
1427
|
-
<td colspan="8" style="background
|
|
1428
|
-
<div style="font-size:11px;font-weight:600;color
|
|
1427
|
+
<td colspan="8" style="background:var(--vos-surface-muted);padding:12px 12px 12px 32px">
|
|
1428
|
+
<div style="font-size:11px;font-weight:600;color:var(--vos-text-muted);text-transform:uppercase;letter-spacing:0.05em;margin-bottom:8px">Phases of ${escapeHtml(parentLabel)}</div>
|
|
1429
1429
|
<table class="data-table">
|
|
1430
1430
|
<thead>
|
|
1431
1431
|
<tr>
|
|
@@ -1454,7 +1454,7 @@ export function renderAgentDetailPage(
|
|
|
1454
1454
|
? ""
|
|
1455
1455
|
: `
|
|
1456
1456
|
<details style="margin-top:6px">
|
|
1457
|
-
<summary style="cursor:pointer;font-size:11px;color
|
|
1457
|
+
<summary style="cursor:pointer;font-size:11px;color:var(--vos-text-muted)">Edit</summary>
|
|
1458
1458
|
<form method="POST" action="/admin/agents/${escapeHtml(agent.id)}/crons/${escapeHtml(c.id)}/update" style="display:flex;flex-direction:column;gap:4px;margin-top:6px;min-width:240px">
|
|
1459
1459
|
<input name="schedule" type="text" class="form-input mono" style="font-size:11px;padding:3px 6px" value="${escapeHtml(c.schedule)}" placeholder="0 * * * *" required title="Cron expression (5 fields)" />
|
|
1460
1460
|
<textarea name="prompt" class="form-input" style="font-size:11px;padding:3px 6px;min-height:48px" placeholder="Prompt" required>${escapeHtml(c.prompt)}</textarea>
|
|
@@ -1468,12 +1468,12 @@ export function renderAgentDetailPage(
|
|
|
1468
1468
|
: null;
|
|
1469
1469
|
const lastRunHtml = c.lastRun?.startedAt
|
|
1470
1470
|
? `
|
|
1471
|
-
<div style="font-size:11px;color
|
|
1471
|
+
<div style="font-size:11px;color:var(--vos-text-muted);margin-bottom:4px">${relativeTime(c.lastRun.startedAt, now)}</div>
|
|
1472
1472
|
<div>
|
|
1473
1473
|
<span class="badge" style="${cronOutcomeStyle(lastRunOutcomeLabel)}">${escapeHtml(lastRunOutcomeLabel ?? "unknown")}</span>
|
|
1474
1474
|
</div>
|
|
1475
|
-
<div style="font-size:11px;color
|
|
1476
|
-
: `<div style="color
|
|
1475
|
+
<div style="font-size:11px;color:var(--vos-text-muted);margin-top:4px">${c.runCountToday ?? 0} run${(c.runCountToday ?? 0) === 1 ? "" : "s"}</div>`
|
|
1476
|
+
: `<div style="color:var(--vos-border-strong)">never</div>`;
|
|
1477
1477
|
|
|
1478
1478
|
const children = crons.filter((child) => child.parentCronId === c.id);
|
|
1479
1479
|
const nestedPhasesRow = renderNestedPhasesRow(c, children);
|
|
@@ -1481,7 +1481,7 @@ export function renderAgentDetailPage(
|
|
|
1481
1481
|
return `<tr>
|
|
1482
1482
|
<td class="mono">${escapeHtml(c.schedule)}</td>
|
|
1483
1483
|
<td style="max-width:280px;overflow:hidden;text-overflow:ellipsis">${escapeHtml(c.name ? `${c.name}: ${c.prompt}` : c.prompt)}${sourceBadge(c.system ? undefined : c.source)}</td>
|
|
1484
|
-
<td class="mono" style="font-size:11px;color
|
|
1484
|
+
<td class="mono" style="font-size:11px;color:var(--vos-text-muted);max-width:170px;overflow:hidden;text-overflow:ellipsis">${c.preCheck ? escapeHtml(c.preCheck) : "—"}</td>
|
|
1485
1485
|
<td>${c.channel ? escapeHtml(c.channel) : c.user ? escapeHtml(c.user) : "—"}</td>
|
|
1486
1486
|
<td><span class="badge ${c.enabled ? "badge-green" : "badge-gray"}">${c.enabled ? "enabled" : "disabled"}</span></td>
|
|
1487
1487
|
<td style="font-size:11px">${lastRunHtml}</td>
|
|
@@ -1529,7 +1529,7 @@ export function renderAgentDetailPage(
|
|
|
1529
1529
|
: tokens
|
|
1530
1530
|
.map(
|
|
1531
1531
|
(t) => `<tr>
|
|
1532
|
-
<td>${t.label ? escapeHtml(t.label) : '<span style="color
|
|
1532
|
+
<td>${t.label ? escapeHtml(t.label) : '<span style="color:var(--vos-text-faint)">—</span>'}</td>
|
|
1533
1533
|
<td>${escapeHtml(new Date(t.createdAt).toLocaleDateString("en-US", { timeZone: timezone }))}</td>
|
|
1534
1534
|
<td>${t.revokedAt ? `<span class="badge badge-gray">Revoked ${escapeHtml(new Date(t.revokedAt).toLocaleDateString("en-US", { timeZone: timezone }))}</span>` : '<span class="badge badge-green">Active</span>'}</td>
|
|
1535
1535
|
<td>${
|
|
@@ -1593,8 +1593,8 @@ export function renderAgentDetailPage(
|
|
|
1593
1593
|
.map(
|
|
1594
1594
|
(name) => `<tr data-baked-marketplace="${escapeHtml(name)}">
|
|
1595
1595
|
<td class="mono">${escapeHtml(name)}</td>
|
|
1596
|
-
<td class="mono" style="color
|
|
1597
|
-
<td class="mono" style="color
|
|
1596
|
+
<td class="mono" style="color:var(--vos-text-muted)">—</td>
|
|
1597
|
+
<td class="mono" style="color:var(--vos-text-muted)">—</td>
|
|
1598
1598
|
<td><span class="badge badge-gray" title="Comes from the agent image; only an image update changes it">from image</span></td>
|
|
1599
1599
|
<td></td>
|
|
1600
1600
|
</tr>`,
|
|
@@ -1910,7 +1910,7 @@ export function renderAgentDetailPage(
|
|
|
1910
1910
|
<input type="hidden" name="restrictSlackToMembers" value="false" />
|
|
1911
1911
|
<label class="form-label" for="restrictSlackToMembers" style="margin-bottom:0">Restrict Slack to members</label>
|
|
1912
1912
|
</div>
|
|
1913
|
-
<p style="font-size:12px;color
|
|
1913
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin:4px 0 12px">
|
|
1914
1914
|
When enabled, only AgentMember emails may message this agent over Slack. If the agent has no
|
|
1915
1915
|
members yet, enabling this will block all Slack senders.
|
|
1916
1916
|
</p>
|
|
@@ -1924,12 +1924,12 @@ export function renderAgentDetailPage(
|
|
|
1924
1924
|
|
|
1925
1925
|
${
|
|
1926
1926
|
agent.selfHosted
|
|
1927
|
-
? `<p style="font-size:13px;color
|
|
1927
|
+
? `<p style="font-size:13px;color:var(--vos-text-muted);margin:0 0 16px">Crons fire only while the local agent service is running. Make sure your service is active before enabling crons.</p>`
|
|
1928
1928
|
: ""
|
|
1929
1929
|
}
|
|
1930
1930
|
|
|
1931
1931
|
<div style="margin-bottom:20px">
|
|
1932
|
-
<div style="font-size:12px;font-weight:600;color
|
|
1932
|
+
<div style="font-size:12px;font-weight:600;color:var(--vos-text-muted);text-transform:uppercase;letter-spacing:0.05em;margin-bottom:8px">System</div>
|
|
1933
1933
|
<div class="data-table-wrapper">
|
|
1934
1934
|
<table class="data-table">
|
|
1935
1935
|
<thead>
|
|
@@ -1952,7 +1952,7 @@ export function renderAgentDetailPage(
|
|
|
1952
1952
|
</div>
|
|
1953
1953
|
|
|
1954
1954
|
<div>
|
|
1955
|
-
<div style="font-size:12px;font-weight:600;color
|
|
1955
|
+
<div style="font-size:12px;font-weight:600;color:var(--vos-text-muted);text-transform:uppercase;letter-spacing:0.05em;margin-bottom:8px">Custom</div>
|
|
1956
1956
|
<form method="POST" action="/admin/agents/${escapeHtml(agent.id)}/crons" style="margin-bottom:12px">
|
|
1957
1957
|
<div class="form-row" style="flex-wrap:wrap;gap:8px">
|
|
1958
1958
|
<div class="form-group">
|
|
@@ -2102,18 +2102,19 @@ export function renderAgentDetailPage(
|
|
|
2102
2102
|
<input name="ref" type="text" class="form-input mono" placeholder="ref (optional)" />
|
|
2103
2103
|
<button type="submit" class="btn btn-primary">Add marketplace</button>
|
|
2104
2104
|
</form>
|
|
2105
|
-
<p style="color
|
|
2105
|
+
<p style="color:var(--vos-text-muted);font-size:12px;margin-top:8px">Rows marked "from image" are baked into the agent's image and can't be edited here.</p>
|
|
2106
2106
|
</div>`;
|
|
2107
2107
|
|
|
2108
2108
|
// PAI-2.5: read-only trace from this agent to its Anthropic identity. Values
|
|
2109
2109
|
// are user data (owner email) or provider IDs, so every one is escaped.
|
|
2110
|
-
const identityPlaceholder =
|
|
2110
|
+
const identityPlaceholder =
|
|
2111
|
+
'<span style="color:var(--vos-text-faint)">—</span>';
|
|
2111
2112
|
const identityRow = (
|
|
2112
2113
|
label: string,
|
|
2113
2114
|
value: string | null | undefined,
|
|
2114
2115
|
mono: boolean,
|
|
2115
2116
|
): string =>
|
|
2116
|
-
`<tr><td style="color
|
|
2117
|
+
`<tr><td style="color:var(--vos-text-muted);width:200px">${label}</td><td${mono ? ' class="mono"' : ""}>${value ? escapeHtml(value) : identityPlaceholder}</td></tr>`;
|
|
2117
2118
|
const identitySection = `<div class="card">
|
|
2118
2119
|
<div class="card-title">Owner & identities</div>
|
|
2119
2120
|
<table class="detail-table"><tbody>
|
|
@@ -2152,7 +2153,7 @@ export function renderAgentDetailPage(
|
|
|
2152
2153
|
<input type="hidden" name="signedCommits" value="false" />
|
|
2153
2154
|
<label class="form-label" for="signedCommits" style="margin-bottom:0">Signed commits</label>
|
|
2154
2155
|
</div>
|
|
2155
|
-
<p style="font-size:12px;color
|
|
2156
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin:4px 0 12px">
|
|
2156
2157
|
Commits are made through the GitHub API so they show Verified. Executable bits and symlinks need the per-call bypass.
|
|
2157
2158
|
</p>`
|
|
2158
2159
|
: "";
|
|
@@ -2173,7 +2174,7 @@ export function renderAgentDetailPage(
|
|
|
2173
2174
|
<input type="hidden" name="autoPostReviews" value="false" />
|
|
2174
2175
|
<label class="form-label" for="autoPostReviews" style="margin-bottom:0">Auto-post reviews</label>
|
|
2175
2176
|
</div>
|
|
2176
|
-
<p style="font-size:12px;color
|
|
2177
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin:4px 0 12px">
|
|
2177
2178
|
Off stages reviews to state/reviews/ + Slack notify instead of posting directly to GitHub.
|
|
2178
2179
|
</p>
|
|
2179
2180
|
<div class="form-group" style="display:flex;align-items:center;gap:6px">
|
|
@@ -2187,7 +2188,7 @@ export function renderAgentDetailPage(
|
|
|
2187
2188
|
<input type="hidden" name="allowSelfReview" value="false" />
|
|
2188
2189
|
<label class="form-label" for="allowSelfReview" style="margin-bottom:0">Allow self-review</label>
|
|
2189
2190
|
</div>
|
|
2190
|
-
<p style="font-size:12px;color
|
|
2191
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin:4px 0 12px">
|
|
2191
2192
|
Whether the agent may review its own open PRs.
|
|
2192
2193
|
</p>
|
|
2193
2194
|
<div class="form-group" style="display:flex;align-items:center;gap:6px">
|
|
@@ -2201,23 +2202,23 @@ export function renderAgentDetailPage(
|
|
|
2201
2202
|
<input type="hidden" name="cleanupMergedWorktrees" value="false" />
|
|
2202
2203
|
<label class="form-label" for="cleanupMergedWorktrees" style="margin-bottom:0">Cleanup merged worktrees</label>
|
|
2203
2204
|
</div>
|
|
2204
|
-
<p style="font-size:12px;color
|
|
2205
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin:4px 0 12px">
|
|
2205
2206
|
Remove worktrees for merged PRs each cron cycle.
|
|
2206
2207
|
</p>
|
|
2207
2208
|
<div class="form-group">
|
|
2208
2209
|
<label class="form-label" for="minConfidence">Min confidence (0-100)</label>
|
|
2209
2210
|
<input id="minConfidence" name="minConfidence" type="number" value="${agent.minConfidence}" class="form-input" />
|
|
2210
|
-
<p style="font-size:12px;color
|
|
2211
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin-top:4px">Minimum finding confidence to surface in a review.</p>
|
|
2211
2212
|
</div>
|
|
2212
2213
|
<div class="form-group">
|
|
2213
2214
|
<label class="form-label" for="maxFindings">Max findings</label>
|
|
2214
2215
|
<input id="maxFindings" name="maxFindings" type="number" value="${agent.maxFindings}" class="form-input" />
|
|
2215
|
-
<p style="font-size:12px;color
|
|
2216
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin-top:4px">Max findings surfaced per review.</p>
|
|
2216
2217
|
</div>
|
|
2217
2218
|
<div class="form-group">
|
|
2218
2219
|
<label class="form-label" for="cleanupAfterDays">Cleanup after days</label>
|
|
2219
2220
|
<input id="cleanupAfterDays" name="cleanupAfterDays" type="number" value="${agent.cleanupAfterDays}" class="form-input" />
|
|
2220
|
-
<p style="font-size:12px;color
|
|
2221
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin-top:4px">Remove worktrees older than N days even if the PR is still open.</p>
|
|
2221
2222
|
</div>
|
|
2222
2223
|
${signedCommitsHtml}
|
|
2223
2224
|
<button type="submit" class="btn btn-primary">Save</button>
|
|
@@ -2228,7 +2229,7 @@ export function renderAgentDetailPage(
|
|
|
2228
2229
|
? `<!-- Danger Zone -->
|
|
2229
2230
|
<div class="settings-danger-zone">
|
|
2230
2231
|
<div class="settings-section-title">Danger Zone</div>
|
|
2231
|
-
<p style="font-size:13px;color
|
|
2232
|
+
<p style="font-size:13px;color:var(--vos-text-muted);margin-bottom:16px">
|
|
2232
2233
|
Deleting this agent permanently removes all its data (env vars, crons, tools, tokens, plugins, members)
|
|
2233
2234
|
and terminates its pod. This action cannot be undone.
|
|
2234
2235
|
</p>
|
|
@@ -2278,10 +2279,10 @@ export function renderAgentDetailPage(
|
|
|
2278
2279
|
|
|
2279
2280
|
const headerInfoHtml = `<div class="page-header">
|
|
2280
2281
|
<div>
|
|
2281
|
-
<a href="/admin/agents" style="font-size:13px;color
|
|
2282
|
+
<a href="/admin/agents" style="font-size:13px;color:var(--vos-text-muted);text-decoration:none">← Agents</a>
|
|
2282
2283
|
<div style="margin-top:4px">
|
|
2283
|
-
<span style="font-size:13px;color
|
|
2284
|
-
${agent.slackId ? `<span style="font-size:13px;color
|
|
2284
|
+
<span style="font-size:13px;color:var(--vos-text-muted)">Type: <span class="mono">${escapeHtml(agent.specialty)}</span></span>
|
|
2285
|
+
${agent.slackId ? `<span style="font-size:13px;color:var(--vos-text-muted)">Slack ID: <span class="mono">${escapeHtml(agent.slackId)}</span></span>` : ""}
|
|
2285
2286
|
</div>
|
|
2286
2287
|
</div>
|
|
2287
2288
|
${
|
|
@@ -2289,8 +2290,8 @@ export function renderAgentDetailPage(
|
|
|
2289
2290
|
? `<div>
|
|
2290
2291
|
<details>
|
|
2291
2292
|
<summary class="btn btn-secondary" style="cursor:pointer;font-size:12px;list-style:none">Sync Manifest</summary>
|
|
2292
|
-
<div style="position:absolute;right:24px;margin-top:6px;background
|
|
2293
|
-
<p style="font-size:12px;color
|
|
2293
|
+
<div style="position:absolute;right:24px;margin-top:6px;background:var(--vos-surface);border:1px solid var(--vos-border);border-radius:6px;padding:12px;box-shadow:0 4px 12px rgba(0,0,0,0.08);z-index:10;min-width:320px">
|
|
2294
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin:0 0 10px">Syncs the current manifest to the provisioned Slack app. ${
|
|
2294
2295
|
slackStored
|
|
2295
2296
|
? 'Optional: a stored Slack config token is used unless you paste a Slack app configuration token (<span class="mono">xoxe.xoxp-</span>).'
|
|
2296
2297
|
: 'Requires a Slack app configuration token (<span class="mono">xoxe.xoxp-</span>).'
|
|
@@ -2383,7 +2384,7 @@ export function renderGithubAppManifestRedirectPage(
|
|
|
2383
2384
|
<span class="provision-step">3. Complete</span>
|
|
2384
2385
|
</div>
|
|
2385
2386
|
<div class="card">
|
|
2386
|
-
<p style="font-size:14px;margin-bottom:16px;color
|
|
2387
|
+
<p style="font-size:14px;margin-bottom:16px;color:var(--vos-text-muted)">
|
|
2387
2388
|
Redirecting to GitHub to create the GitHub App under <strong>${escapeHtml(opts.githubOrg)}</strong>…
|
|
2388
2389
|
</p>
|
|
2389
2390
|
<form id="github-app-manifest-form" method="POST" action="${escapeHtml(actionUrl)}">
|
|
@@ -2443,7 +2444,7 @@ export function renderAddAnotherOrgAction(
|
|
|
2443
2444
|
if (envVars.GH_APP_SLUG) {
|
|
2444
2445
|
return `<a href="/admin/agents/${escapeHtml(agentId)}/connect-github/add-org" class="btn btn-secondary" style="font-size:12px" rel="noopener noreferrer">Add another org</a>`;
|
|
2445
2446
|
}
|
|
2446
|
-
return `<span style="font-size:12px;color
|
|
2447
|
+
return `<span style="font-size:12px;color:var(--vos-text-muted)">To install this App on another org, see <a href="https://github.com/app-vitals/shipwright/blob/main/docs/configuration-agent.md" rel="noopener noreferrer">the docs</a> (GH_APP_SLUG).</span>`;
|
|
2447
2448
|
}
|
|
2448
2449
|
|
|
2449
2450
|
/**
|
|
@@ -2519,7 +2520,7 @@ export function renderProvisionXappTokenPage(
|
|
|
2519
2520
|
<span class="provision-step active">4. Add Socket Token</span>
|
|
2520
2521
|
</div>
|
|
2521
2522
|
<div class="card">
|
|
2522
|
-
<p style="font-size:14px;margin-bottom:16px;color
|
|
2523
|
+
<p style="font-size:14px;margin-bottom:16px;color:var(--vos-text-muted)">
|
|
2523
2524
|
Open your Slack App's <strong>Socket Mode</strong> settings, enable Socket Mode,
|
|
2524
2525
|
and generate an <strong>App-Level Token</strong> with <code class="mono">connections:write</code> scope.
|
|
2525
2526
|
Paste the <code class="mono">xapp-</code> token below.
|
|
@@ -2604,9 +2605,9 @@ export function renderProvisionCompletePage(
|
|
|
2604
2605
|
|
|
2605
2606
|
const threadPaneStyles = `
|
|
2606
2607
|
.thread-pane-list { display:flex;flex-direction:column;gap:4px;margin-top:8px }
|
|
2607
|
-
.thread-pane-link { display:block;padding:8px 12px;border-radius:6px;font-size:13px;color
|
|
2608
|
-
.thread-pane-link:hover { background
|
|
2609
|
-
.thread-pane-link.active { background
|
|
2608
|
+
.thread-pane-link { display:block;padding:8px 12px;border-radius:6px;font-size:13px;color:var(--vos-text-body);text-decoration:none;background:var(--vos-surface-muted);border:1px solid var(--vos-border) }
|
|
2609
|
+
.thread-pane-link:hover { background:var(--vos-brand-bg);color:var(--vos-brand) }
|
|
2610
|
+
.thread-pane-link.active { background:var(--vos-brand-bg);color:var(--vos-brand);font-weight:600 }`;
|
|
2610
2611
|
|
|
2611
2612
|
const chatPageStyles = `
|
|
2612
2613
|
.chat-sidebar-new-thread-input { font-size:12px }
|
|
@@ -2781,12 +2782,12 @@ export function renderChatMessageBubble(
|
|
|
2781
2782
|
isUser ? "user" : isAssistant ? "assistant" : isSystem ? "system" : "other",
|
|
2782
2783
|
);
|
|
2783
2784
|
const bubbleColor = isUser
|
|
2784
|
-
? "
|
|
2785
|
+
? "var(--vos-brand)"
|
|
2785
2786
|
: isAssistant
|
|
2786
|
-
? "
|
|
2787
|
+
? "var(--vos-success-text)"
|
|
2787
2788
|
: isSystem
|
|
2788
|
-
? "
|
|
2789
|
-
: "
|
|
2789
|
+
? "var(--vos-warning-text)"
|
|
2790
|
+
: "var(--vos-text-body)";
|
|
2790
2791
|
const bubbleInnerClass = isSystem
|
|
2791
2792
|
? `${CHAT_BUBBLE_INNER_CLASS} ${CHAT_BUBBLE_INNER_WIDE_CLASS}`
|
|
2792
2793
|
: CHAT_BUBBLE_INNER_CLASS;
|
|
@@ -2799,9 +2800,9 @@ export function renderChatMessageBubble(
|
|
|
2799
2800
|
const retryable =
|
|
2800
2801
|
RETRYABLE_ERROR_KINDS.has(m.errorKind) && retryBody !== null;
|
|
2801
2802
|
const retryAction = retryable
|
|
2802
|
-
? `<button type="button" class="chat-retry-btn" data-retry-body="${escapeHtml(retryBody as string)}" style="margin-left:8px;padding:2px 8px;background
|
|
2803
|
+
? `<button type="button" class="chat-retry-btn" data-retry-body="${escapeHtml(retryBody as string)}" style="margin-left:8px;padding:2px 8px;background:var(--vos-surface);color:var(--vos-danger-text);border:1px solid var(--vos-danger-text);border-radius:4px;font-size:12px;font-weight:600;cursor:pointer">Retry</button>`
|
|
2803
2804
|
: "";
|
|
2804
|
-
errorBadge = `<div style="margin-top:6px;padding:4px 8px;background
|
|
2805
|
+
errorBadge = `<div style="margin-top:6px;padding:4px 8px;background:var(--vos-danger-bg);color:var(--vos-danger-text);border-radius:4px;font-size:12px;font-weight:600;display:inline-flex;align-items:center">${errorKindLabel(m.errorKind)}${retryAction}</div>`;
|
|
2805
2806
|
}
|
|
2806
2807
|
|
|
2807
2808
|
// Parse markers from assistant messages to extract URLs/paths and clean text
|
|
@@ -2815,7 +2816,7 @@ export function renderChatMessageBubble(
|
|
|
2815
2816
|
const uploadBadges = uploads
|
|
2816
2817
|
.map((path) => {
|
|
2817
2818
|
const filename = path.split("/").pop() || path;
|
|
2818
|
-
return `<div style="display:inline-block;margin-right:6px;margin-top:8px;padding:3px 8px;background
|
|
2819
|
+
return `<div style="display:inline-block;margin-right:6px;margin-top:8px;padding:3px 8px;background:var(--vos-border);color:var(--vos-text-body);border-radius:6px;font-size:12px">📎 ${escapeHtml(filename)}</div>`;
|
|
2819
2820
|
})
|
|
2820
2821
|
.join("");
|
|
2821
2822
|
|
|
@@ -2823,7 +2824,7 @@ export function renderChatMessageBubble(
|
|
|
2823
2824
|
const planLinks = planUrls
|
|
2824
2825
|
.map(
|
|
2825
2826
|
(url) =>
|
|
2826
|
-
`<a href="${escapeHtml(url)}" target="_blank" style="display:inline-block;margin-right:6px;margin-top:8px;padding:3px 8px;background
|
|
2827
|
+
`<a href="${escapeHtml(url)}" target="_blank" style="display:inline-block;margin-right:6px;margin-top:8px;padding:3px 8px;background:var(--vos-info-bg);color:var(--vos-info-text);border-radius:6px;font-size:12px;text-decoration:none">View plan →</a>`,
|
|
2827
2828
|
)
|
|
2828
2829
|
.join("");
|
|
2829
2830
|
|
|
@@ -2860,7 +2861,7 @@ export function renderChatMessageBubble(
|
|
|
2860
2861
|
? isAssistant
|
|
2861
2862
|
? voiceControl
|
|
2862
2863
|
: `<audio controls style="display:block;margin-top:8px;max-width:100%" src="${escapeHtml(attachmentUrl)}"></audio>`
|
|
2863
|
-
: `<div style="display:inline-block;margin-top:8px;padding:3px 8px;background
|
|
2864
|
+
: `<div style="display:inline-block;margin-top:8px;padding:3px 8px;background:var(--vos-border);color:var(--vos-text-body);border-radius:6px;font-size:12px">📎 ${escapeHtml(m.attachmentFilename)}</div>`
|
|
2864
2865
|
: "";
|
|
2865
2866
|
|
|
2866
2867
|
let tokenBadge = "";
|
|
@@ -2869,7 +2870,7 @@ export function renderChatMessageBubble(
|
|
|
2869
2870
|
const inTok = t.input_tokens ?? 0;
|
|
2870
2871
|
const outTok = t.output_tokens ?? 0;
|
|
2871
2872
|
const costPart = m.costUsd !== null ? ` · $${m.costUsd.toFixed(4)}` : "";
|
|
2872
|
-
tokenBadge = `<div style="font-size:11px;color
|
|
2873
|
+
tokenBadge = `<div style="font-size:11px;color:var(--vos-text-muted);margin-top:4px">${escapeHtml(`${inTok} in / ${outTok} out${costPart}`)}</div>`;
|
|
2873
2874
|
}
|
|
2874
2875
|
|
|
2875
2876
|
return `<div class="${CHAT_BUBBLE_CLASS} ${bubbleRoleClass}" data-message-id="${escapeHtml(m.id)}">
|
|
@@ -2880,7 +2881,7 @@ export function renderChatMessageBubble(
|
|
|
2880
2881
|
${attachmentMedia}
|
|
2881
2882
|
${errorBadge}
|
|
2882
2883
|
${tokenBadge}
|
|
2883
|
-
<div style="font-size:11px;color
|
|
2884
|
+
<div style="font-size:11px;color:var(--vos-text-faint);margin-top:6px">${escapeHtml(new Date(m.createdAt).toLocaleString())}</div>
|
|
2884
2885
|
</div>
|
|
2885
2886
|
</div>`;
|
|
2886
2887
|
}
|
|
@@ -2905,7 +2906,7 @@ function renderLiveStatusBubble(m: ChatMessage): string {
|
|
|
2905
2906
|
const seq = m.progressSeq ?? 0;
|
|
2906
2907
|
return `<div id="${LIVE_STATUS_BUBBLE_ID}" class="${CHAT_BUBBLE_CLASS} ${chatBubbleRoleClass("assistant")}" data-created-at="${createdAtMs}" data-progress-seq="${seq}">
|
|
2907
2908
|
<div class="${CHAT_BUBBLE_INNER_CLASS}">
|
|
2908
|
-
<div style="font-size:14px;color
|
|
2909
|
+
<div style="font-size:14px;color:var(--vos-success-text);font-style:italic">
|
|
2909
2910
|
${milestoneHtml}
|
|
2910
2911
|
<span id="${LIVE_STATUS_ELAPSED_ID}">working… (0s)</span>
|
|
2911
2912
|
</div>
|
|
@@ -2926,8 +2927,8 @@ const chatThreadStyles = `
|
|
|
2926
2927
|
/* Collapsed-by-default rename/delete disclosure (CFB-3.1 #5) — keeps the
|
|
2927
2928
|
header compact above the fold regardless of viewport width. */
|
|
2928
2929
|
.chat-thread-actions { margin-top:12px }
|
|
2929
|
-
.chat-thread-actions-summary { cursor:pointer;font-size:13px;color
|
|
2930
|
-
.chat-thread-actions-summary:hover { color
|
|
2930
|
+
.chat-thread-actions-summary { cursor:pointer;font-size:13px;color:var(--vos-text-muted);user-select:none }
|
|
2931
|
+
.chat-thread-actions-summary:hover { color:var(--vos-text-body) }
|
|
2931
2932
|
.chat-messages-container { flex:1;overflow-y:auto;overscroll-behavior:contain;padding:8px 0;min-height:0 }
|
|
2932
2933
|
.${CHAT_BUBBLE_CLASS} { display:flex;margin-bottom:12px }
|
|
2933
2934
|
.${chatBubbleRoleClass("user")} { justify-content:flex-end }
|
|
@@ -2940,39 +2941,39 @@ const chatThreadStyles = `
|
|
|
2940
2941
|
to overflow. Scoped to the bubble so it doesn't affect other <pre>. */
|
|
2941
2942
|
.${CHAT_BUBBLE_INNER_CLASS} pre { overflow-x:auto }
|
|
2942
2943
|
.${CHAT_BUBBLE_INNER_CLASS}.${CHAT_BUBBLE_INNER_WIDE_CLASS} { max-width:80% }
|
|
2943
|
-
.${chatBubbleRoleClass("user")} .${CHAT_BUBBLE_INNER_CLASS} { background
|
|
2944
|
-
.${chatBubbleRoleClass("assistant")} .${CHAT_BUBBLE_INNER_CLASS} { background
|
|
2945
|
-
.${chatBubbleRoleClass("system")} .${CHAT_BUBBLE_INNER_CLASS} { background
|
|
2946
|
-
.${chatBubbleRoleClass("other")} .${CHAT_BUBBLE_INNER_CLASS} { background
|
|
2944
|
+
.${chatBubbleRoleClass("user")} .${CHAT_BUBBLE_INNER_CLASS} { background:var(--vos-brand-bg) }
|
|
2945
|
+
.${chatBubbleRoleClass("assistant")} .${CHAT_BUBBLE_INNER_CLASS} { background:var(--vos-success-bg) }
|
|
2946
|
+
.${chatBubbleRoleClass("system")} .${CHAT_BUBBLE_INNER_CLASS} { background:var(--vos-warning-bg) }
|
|
2947
|
+
.${chatBubbleRoleClass("other")} .${CHAT_BUBBLE_INNER_CLASS} { background:var(--vos-surface-subtle) }
|
|
2947
2948
|
/* Sticky composer: pins to the bottom of the scroll container so it stays
|
|
2948
2949
|
reachable as messages grow. padding-bottom folds in the iOS safe-area
|
|
2949
2950
|
inset plus --kb-inset (set by the visualViewport listener when the
|
|
2950
2951
|
on-screen keyboard shrinks the visual viewport) so the composer isn't
|
|
2951
2952
|
slid under the keyboard on iOS, where dvh does NOT shrink the layout. */
|
|
2952
|
-
.chat-composer-form { flex-shrink:0;position:sticky;bottom:0;background
|
|
2953
|
+
.chat-composer-form { flex-shrink:0;position:sticky;bottom:0;background:var(--vos-bg);padding:16px 0;padding-bottom:calc(12px + env(safe-area-inset-bottom) + var(--kb-inset, 0px));border-top:1px solid var(--vos-border);margin-top:8px }
|
|
2953
2954
|
.chat-composer-row { display:flex;gap:8px;align-items:flex-end }
|
|
2954
|
-
.chat-message-input { flex:1;resize:vertical;padding:10px 12px;border:1px solid
|
|
2955
|
+
.chat-message-input { flex:1;resize:vertical;padding:10px 12px;border:1px solid var(--vos-border-strong);border-radius:8px;font-size:14px;font-family:inherit;line-height:1.5;outline:none }
|
|
2955
2956
|
.chat-composer-btn { flex-shrink:0;height:44px }
|
|
2956
2957
|
.chat-composer-btn--attach { padding:0 16px }
|
|
2957
2958
|
.chat-composer-btn--mic { padding:0 16px }
|
|
2958
|
-
.chat-composer-btn--mic.chat-mic-recording { background
|
|
2959
|
+
.chat-composer-btn--mic.chat-mic-recording { background:var(--vos-danger-bg);color:var(--vos-danger-text);border-color:var(--vos-danger-text) }
|
|
2959
2960
|
/* Voice reply control (COS-63.1): 56px round tap target + progress. */
|
|
2960
2961
|
.chat-voice { display:flex;align-items:center;gap:12px;margin-top:8px;flex-wrap:wrap }
|
|
2961
2962
|
.chat-voice-play { width:56px;height:56px;min-width:56px;border-radius:50%;border:0;background:#2563eb;color:#fff;font-size:22px;line-height:1;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;padding:0 }
|
|
2962
|
-
.chat-voice-play:focus-visible { outline:3px solid
|
|
2963
|
+
.chat-voice-play:focus-visible { outline:3px solid var(--vos-info-border);outline-offset:2px }
|
|
2963
2964
|
.chat-voice-meta { flex:1;min-width:120px }
|
|
2964
|
-
.chat-voice-progress { height:4px;border-radius:2px;background
|
|
2965
|
+
.chat-voice-progress { height:4px;border-radius:2px;background:var(--vos-border-strong);overflow:hidden }
|
|
2965
2966
|
.chat-voice-bar { height:100%;width:0;background:#2563eb }
|
|
2966
|
-
.chat-voice-time { display:block;margin-top:4px;font-size:12px;color
|
|
2967
|
-
.chat-voice-error { flex-basis:100%;font-size:13px;color
|
|
2967
|
+
.chat-voice-time { display:block;margin-top:4px;font-size:12px;color:var(--vos-text-muted);font-variant-numeric:tabular-nums }
|
|
2968
|
+
.chat-voice-error { flex-basis:100%;font-size:13px;color:var(--vos-danger-text) }
|
|
2968
2969
|
.chat-voice-error[hidden] { display:none }
|
|
2969
2970
|
.chat-composer-btn--send { padding:0 20px }
|
|
2970
2971
|
/* Live-progress stall state (CFB-2.3): when progressSeq hasn't advanced for
|
|
2971
2972
|
STALL_WARN_AFTER_MS the status bubble gains .${STALL_INDICATOR_CLASS},
|
|
2972
2973
|
which pulses to draw the eye. Motion is suppressed for users who ask for
|
|
2973
2974
|
reduced motion — the amber colour still conveys the state statically. */
|
|
2974
|
-
.${STALL_INDICATOR_CLASS} { color
|
|
2975
|
-
.${STALL_INDICATOR_CLASS} .${CHAT_BUBBLE_INNER_CLASS} { background
|
|
2975
|
+
.${STALL_INDICATOR_CLASS} { color:var(--vos-warning-text) }
|
|
2976
|
+
.${STALL_INDICATOR_CLASS} .${CHAT_BUBBLE_INNER_CLASS} { background:var(--vos-warning-bg);animation:chat-stall-pulse 1.4s ease-in-out infinite }
|
|
2976
2977
|
@keyframes chat-stall-pulse { 0%,100% { opacity:1 } 50% { opacity:0.55 } }
|
|
2977
2978
|
@media (prefers-reduced-motion: reduce) {
|
|
2978
2979
|
.${STALL_INDICATOR_CLASS} .${CHAT_BUBBLE_INNER_CLASS} { animation:none }
|
|
@@ -2985,8 +2986,8 @@ const chatThreadStyles = `
|
|
|
2985
2986
|
order is load-bearing: the checkbox precedes the sidebar so the ~ sibling
|
|
2986
2987
|
combinator can reach it. */
|
|
2987
2988
|
.chat-drawer-toggle { position:absolute;opacity:0;width:1px;height:1px;pointer-events:none }
|
|
2988
|
-
.chat-drawer-hamburger { display:none;background:none;border:1px solid
|
|
2989
|
-
.chat-drawer-hamburger:hover { color
|
|
2989
|
+
.chat-drawer-hamburger { display:none;background:none;border:1px solid var(--vos-border);border-radius:6px;font-size:18px;line-height:1;padding:6px 10px;cursor:pointer;color:var(--vos-text-body) }
|
|
2990
|
+
.chat-drawer-hamburger:hover { color:var(--vos-brand) }
|
|
2990
2991
|
.chat-drawer-scrim { display:none }`;
|
|
2991
2992
|
|
|
2992
2993
|
export function renderChatPage(
|
|
@@ -3189,7 +3190,7 @@ export function renderChatThreadPage(
|
|
|
3189
3190
|
|
|
3190
3191
|
const emptyState =
|
|
3191
3192
|
messages.length === 0
|
|
3192
|
-
? `<div class="empty-state" style="text-align:center;padding:48px 24px;color
|
|
3193
|
+
? `<div class="empty-state" style="text-align:center;padding:48px 24px;color:var(--vos-text-faint)">No messages in this thread yet. Send a message to get started.</div>`
|
|
3193
3194
|
: "";
|
|
3194
3195
|
|
|
3195
3196
|
const safeAgentId = escapeHtml(agentId);
|
|
@@ -3201,12 +3202,12 @@ export function renderChatThreadPage(
|
|
|
3201
3202
|
const signedOutReturnTo = encodeURIComponent(
|
|
3202
3203
|
`/admin/chat/${encodeURIComponent(agentId)}/threads/${encodeURIComponent(threadId)}`,
|
|
3203
3204
|
);
|
|
3204
|
-
const signedOutBanner = `<a id="signed-out-banner" class="chat-signed-out-banner" href="/admin/login?returnTo=${signedOutReturnTo}" role="alert" style="display:none;padding:10px 14px;margin-bottom:8px;background
|
|
3205
|
+
const signedOutBanner = `<a id="signed-out-banner" class="chat-signed-out-banner" href="/admin/login?returnTo=${signedOutReturnTo}" role="alert" style="display:none;padding:10px 14px;margin-bottom:8px;background:var(--vos-warning-bg);color:var(--vos-warning-text);border:1px solid #f59e0b;border-radius:8px;font-size:14px;font-weight:600;text-decoration:none;text-align:center">You're signed out. Tap to sign in.</a>`;
|
|
3205
3206
|
|
|
3206
3207
|
// Held-upload prompt (ASX-1.3): hidden until the thread loads with a
|
|
3207
3208
|
// voice note / file that failed on a 401 and is waiting in IndexedDB.
|
|
3208
3209
|
// Never auto-sent; the user chooses Resend or Discard.
|
|
3209
|
-
const heldUploadPrompt = `<div id="held-upload-prompt" class="chat-held-upload" role="status" style="display:none;padding:10px 14px;margin-bottom:8px;background
|
|
3210
|
+
const heldUploadPrompt = `<div id="held-upload-prompt" class="chat-held-upload" role="status" style="display:none;padding:10px 14px;margin-bottom:8px;background:var(--vos-info-bg);color:var(--vos-info-text);border:1px solid var(--vos-info-border);border-radius:8px;font-size:14px"><span>You have an unsent voice note.</span> <button type="button" id="held-upload-resend" style="margin-left:8px;padding:4px 10px;border-radius:6px;border:1px solid var(--vos-info-text);background:var(--vos-info-text);color:var(--vos-primary-text);cursor:pointer">Resend</button> <button type="button" id="held-upload-discard" style="margin-left:4px;padding:4px 10px;border-radius:6px;border:1px solid var(--vos-info-border);background:var(--vos-surface);color:var(--vos-info-text);cursor:pointer">Discard</button></div>`;
|
|
3210
3211
|
|
|
3211
3212
|
const renameForm = `
|
|
3212
3213
|
<form method="POST" action="/admin/chat/${escapeHtml(agentId)}/threads/${escapeHtml(threadId)}/rename" style="margin-top:12px">
|
|
@@ -3326,13 +3327,13 @@ export function renderChatThreadPage(
|
|
|
3326
3327
|
// local object URL (no round-trip needed to preview what was just
|
|
3327
3328
|
// recorded); everything else still gets the plain filename badge.
|
|
3328
3329
|
function addUserBubble(body, file) {
|
|
3329
|
-
var color = '
|
|
3330
|
+
var color = 'var(--vos-brand)';
|
|
3330
3331
|
var attachmentHtml = '';
|
|
3331
3332
|
if (file) {
|
|
3332
3333
|
if (file.type && file.type.indexOf('audio/') === 0) {
|
|
3333
3334
|
attachmentHtml = '<audio controls style="display:block;margin-top:8px;max-width:100%" src="' + URL.createObjectURL(file) + '"></audio>';
|
|
3334
3335
|
} else {
|
|
3335
|
-
attachmentHtml = '<div style="display:inline-block;margin-top:8px;padding:3px 8px;background
|
|
3336
|
+
attachmentHtml = '<div style="display:inline-block;margin-top:8px;padding:3px 8px;background:var(--vos-border);color:var(--vos-text-body);border-radius:6px;font-size:12px">📎 ' + escHtml(file.name) + '</div>';
|
|
3336
3337
|
}
|
|
3337
3338
|
}
|
|
3338
3339
|
var bubble = document.createElement('div');
|
|
@@ -3385,7 +3386,7 @@ export function renderChatThreadPage(
|
|
|
3385
3386
|
live.setAttribute('data-created-at', String(createdAtMs));
|
|
3386
3387
|
live.setAttribute('data-progress-seq', '0');
|
|
3387
3388
|
live.innerHTML = '<div class="${CHAT_BUBBLE_INNER_CLASS}">'
|
|
3388
|
-
+ '<div style="font-size:14px;color
|
|
3389
|
+
+ '<div style="font-size:14px;color:var(--vos-success-text);font-style:italic">'
|
|
3389
3390
|
+ '<span id="' + LIVE_STATUS_MILESTONE_ID + '"></span> '
|
|
3390
3391
|
+ '<span id="' + LIVE_STATUS_ELAPSED_ID + '">working… (0s)</span>'
|
|
3391
3392
|
+ '</div></div>';
|
|
@@ -3431,7 +3432,7 @@ export function renderChatThreadPage(
|
|
|
3431
3432
|
var errBubble = document.createElement('div');
|
|
3432
3433
|
errBubble.className = ASSISTANT_ROLE_CLASS;
|
|
3433
3434
|
errBubble.innerHTML = '<div class="${CHAT_BUBBLE_INNER_CLASS}">'
|
|
3434
|
-
+ '<div style="margin-top:0;padding:4px 8px;background
|
|
3435
|
+
+ '<div style="margin-top:0;padding:4px 8px;background:var(--vos-danger-bg);color:var(--vos-danger-text);border-radius:4px;font-size:12px;font-weight:600">Request timed out. Please try again.</div>'
|
|
3435
3436
|
+ '</div>';
|
|
3436
3437
|
container.appendChild(errBubble);
|
|
3437
3438
|
enableSend();
|
|
@@ -3800,7 +3801,7 @@ export function renderChatThreadPage(
|
|
|
3800
3801
|
var errBubble = document.createElement('div');
|
|
3801
3802
|
errBubble.className = ASSISTANT_ROLE_CLASS;
|
|
3802
3803
|
errBubble.innerHTML = '<div class="${CHAT_BUBBLE_INNER_CLASS}">'
|
|
3803
|
-
+ '<div style="margin-top:0;padding:4px 8px;background
|
|
3804
|
+
+ '<div style="margin-top:0;padding:4px 8px;background:var(--vos-danger-bg);color:var(--vos-danger-text);border-radius:4px;font-size:12px;font-weight:600">' + escHtml((data && data.error) || 'Upload failed.') + '</div>'
|
|
3804
3805
|
+ '</div>';
|
|
3805
3806
|
container.appendChild(errBubble);
|
|
3806
3807
|
enableSend();
|
|
@@ -4077,7 +4078,7 @@ export function renderChatThreadPage(
|
|
|
4077
4078
|
<a href="/admin/chat?agentId=${safeAgentId}" class="btn btn-secondary">← Back to threads</a>
|
|
4078
4079
|
</div>
|
|
4079
4080
|
<h1 class="page-title">${title}</h1>
|
|
4080
|
-
<div class="chat-thread-meta" style="font-size:12px;color
|
|
4081
|
+
<div class="chat-thread-meta" style="font-size:12px;color:var(--vos-text-faint);margin-top:4px">Thread <span class="mono">${safeThreadId}</span></div>
|
|
4081
4082
|
${
|
|
4082
4083
|
stats &&
|
|
4083
4084
|
(
|
|
@@ -4085,7 +4086,7 @@ export function renderChatThreadPage(
|
|
|
4085
4086
|
stats.totalOutputTokens > 0 ||
|
|
4086
4087
|
stats.totalCostUsd > 0
|
|
4087
4088
|
)
|
|
4088
|
-
? `<div class="chat-thread-stats" style="font-size:12px;color
|
|
4089
|
+
? `<div class="chat-thread-stats" style="font-size:12px;color:var(--vos-text-muted);margin-top:4px">${escapeHtml(`${formatTokenCount(stats.totalInputTokens)} in / ${formatTokenCount(stats.totalOutputTokens)} out | $${stats.totalCostUsd.toFixed(4)}`)}</div>`
|
|
4089
4090
|
: ""
|
|
4090
4091
|
}
|
|
4091
4092
|
${threadActionsDetails}
|
|
@@ -4140,7 +4141,7 @@ export function renderChatThreadPage(
|
|
|
4140
4141
|
class="btn btn-primary chat-composer-btn chat-composer-btn--send"
|
|
4141
4142
|
>Send</button>
|
|
4142
4143
|
</div>
|
|
4143
|
-
<div id="file-name" style="font-size:12px;color
|
|
4144
|
+
<div id="file-name" style="font-size:12px;color:var(--vos-text-muted);margin-top:6px;min-height:16px"></div>
|
|
4144
4145
|
</form>
|
|
4145
4146
|
</div>
|
|
4146
4147
|
</div>
|