pantheon-opencode 2.1.6 → 2.2.0-beta.1
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/CHANGELOG.md +37 -0
- package/package.json +7 -1
- package/plugin.json +1 -1
- package/pyproject.toml +1 -1
- package/scripts/build-plugin.mjs +1 -1
- package/scripts/install-mcp.mjs +55 -27
- package/src/agents/roster.json +562 -0
- package/src/mcp/pantheon-mcp-server.mjs +508 -0
- package/src/plugin/index.js +8577 -140
- package/src/plugin/index.ts +42 -14
- package/src/plugin.ts +52 -1
- package/src/plugins/tui/dist/tui.d.ts +66 -0
- package/src/plugins/tui/dist/tui.d.ts.map +1 -1
- package/src/plugins/tui/dist/tui.js +1193 -365
- package/src/plugins/tui/dist/tui.js.map +1 -1
- package/src/plugins/tui/package-lock.json +2 -2
- package/src/plugins/tui/package.json +1 -1
- package/src/plugins/tui/src/index.tsx +632 -71
- package/src/plugins/tui/src/pantheon-settings.tsx +64 -13
- package/src/plugins/tui/src/quota-state.ts +128 -0
- package/src/plugins/tui/src/tui-prefs.ts +161 -12
|
@@ -10,7 +10,17 @@ import { join } from 'node:path'
|
|
|
10
10
|
import { Plugin } from '@opencode/plugin/tui'
|
|
11
11
|
import type { Context, KeymapLayer, PanelInput } from '@opencode/plugin/tui/context'
|
|
12
12
|
import type { Accessor, JSX } from 'solid-js'
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
createEffect,
|
|
15
|
+
createMemo,
|
|
16
|
+
createSignal,
|
|
17
|
+
ErrorBoundary,
|
|
18
|
+
For,
|
|
19
|
+
on,
|
|
20
|
+
onCleanup,
|
|
21
|
+
onMount,
|
|
22
|
+
Show,
|
|
23
|
+
} from 'solid-js'
|
|
14
24
|
import {
|
|
15
25
|
CONTEXT_BAR_CELLS,
|
|
16
26
|
type ContextProgressTone,
|
|
@@ -33,7 +43,13 @@ import {
|
|
|
33
43
|
} from './pantheon-settings'
|
|
34
44
|
import { PRESET_NONE } from './preset-state'
|
|
35
45
|
import { cellWidth, GRAPHEMES, SIDEBAR_CONTENT_WIDTH } from './sidebar-width'
|
|
36
|
-
import {
|
|
46
|
+
import {
|
|
47
|
+
initTuiPrefs,
|
|
48
|
+
isSessionPinned,
|
|
49
|
+
resolveAccentColor,
|
|
50
|
+
tuiDraftPreview,
|
|
51
|
+
tuiPrefs,
|
|
52
|
+
} from './tui-prefs'
|
|
37
53
|
import { nextCheckState, pickUpdateNotice, type UpdateCheckState } from './update-notice.ts'
|
|
38
54
|
import { maybeShowWhatsNewV2 } from './whats-new'
|
|
39
55
|
|
|
@@ -743,6 +759,256 @@ export function contextBlockRows(
|
|
|
743
759
|
return { tokens, percent, spent }
|
|
744
760
|
}
|
|
745
761
|
|
|
762
|
+
/* ─── Turn metrics, token anatomy, tool health & compaction (v2.1.7) ──── */
|
|
763
|
+
|
|
764
|
+
export type TurnCostSummary = {
|
|
765
|
+
current: number
|
|
766
|
+
previous: number | null
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
/** Custo do último turno do assistente e do turno anterior. Pure. */
|
|
770
|
+
export function latestTurnCost(
|
|
771
|
+
messages: readonly any[] | null | undefined,
|
|
772
|
+
): TurnCostSummary | null {
|
|
773
|
+
if (!Array.isArray(messages) || messages.length === 0) return null
|
|
774
|
+
let current: number | null = null
|
|
775
|
+
let previous: number | null = null
|
|
776
|
+
let anchor = -1
|
|
777
|
+
|
|
778
|
+
for (let index = messages.length - 1; index >= 0; index--) {
|
|
779
|
+
const message = messages[index]
|
|
780
|
+
if (message?.type !== 'assistant') continue
|
|
781
|
+
const cost = numberOrNull(message.cost)
|
|
782
|
+
if (cost !== null && cost >= 0) {
|
|
783
|
+
current = cost
|
|
784
|
+
anchor = index
|
|
785
|
+
break
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
if (current === null || anchor === -1) return null
|
|
790
|
+
|
|
791
|
+
for (let index = anchor - 1; index >= 0; index--) {
|
|
792
|
+
const message = messages[index]
|
|
793
|
+
if (message?.type !== 'assistant') continue
|
|
794
|
+
const cost = numberOrNull(message.cost)
|
|
795
|
+
if (cost !== null && cost >= 0) {
|
|
796
|
+
previous = cost
|
|
797
|
+
break
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
return { current, previous }
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
export function formatTurnCostUSD(cost: number | null | undefined): string | null {
|
|
805
|
+
const value = numberOrNull(cost)
|
|
806
|
+
if (value === null || value < 0) return null
|
|
807
|
+
if (value === 0) return '$0.00'
|
|
808
|
+
if (value >= 1) return `$${value.toFixed(2)}`
|
|
809
|
+
if (value >= 0.1) return `$${value.toFixed(2)}`
|
|
810
|
+
const val3 = value.toFixed(3)
|
|
811
|
+
if (val3.endsWith('0') && value >= 0.01) return `$${value.toFixed(2)}`
|
|
812
|
+
return `$${val3}`
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
export function formatTurnCostLine(summary: TurnCostSummary | null | undefined): string | null {
|
|
816
|
+
if (!summary || summary.current === null || summary.current < 0) return null
|
|
817
|
+
const curr = formatTurnCostUSD(summary.current)
|
|
818
|
+
if (!curr) return null
|
|
819
|
+
if (summary.previous !== null && summary.previous >= 0) {
|
|
820
|
+
const prev = formatTurnCostUSD(summary.previous)
|
|
821
|
+
if (prev) {
|
|
822
|
+
return `Turn: ${curr} (prev: ${prev})`
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
return `Turn: ${curr}`
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
export type TokenAnatomy = {
|
|
829
|
+
input: number
|
|
830
|
+
output: number
|
|
831
|
+
reasoning: number
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
/** Extrai desdobramento de tokens (input, output, reasoning/thinking). Pure. */
|
|
835
|
+
export function extractTokenAnatomy(tokens: any): TokenAnatomy | null {
|
|
836
|
+
if (!tokens || typeof tokens !== 'object') return null
|
|
837
|
+
const input = Math.max(0, numberOrNull(tokens.input) ?? 0)
|
|
838
|
+
const output = Math.max(0, numberOrNull(tokens.output) ?? 0)
|
|
839
|
+
const reasoning = Math.max(
|
|
840
|
+
0,
|
|
841
|
+
numberOrNull(tokens.reasoning) ?? numberOrNull(tokens.thinking) ?? 0,
|
|
842
|
+
)
|
|
843
|
+
if (input === 0 && output === 0 && reasoning === 0) return null
|
|
844
|
+
return { input, output, reasoning }
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
export function formatTokenAnatomyLine(anatomy: TokenAnatomy | null | undefined): string | null {
|
|
848
|
+
if (!anatomy) return null
|
|
849
|
+
const parts: string[] = []
|
|
850
|
+
if (anatomy.input > 0) {
|
|
851
|
+
parts.push(`↑${formatContextWindow(anatomy.input)}`)
|
|
852
|
+
}
|
|
853
|
+
if (anatomy.output > 0) {
|
|
854
|
+
parts.push(`↓${formatContextWindow(anatomy.output)}`)
|
|
855
|
+
}
|
|
856
|
+
if (anatomy.reasoning > 0) {
|
|
857
|
+
parts.push(`✦${formatContextWindow(anatomy.reasoning)} think`)
|
|
858
|
+
}
|
|
859
|
+
return parts.length === 0 ? null : parts.join(' ')
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
export function formatTokenAnatomySplit(
|
|
863
|
+
anatomy: TokenAnatomy | null | undefined,
|
|
864
|
+
): { inOut: string | null; think: string | null } | null {
|
|
865
|
+
if (!anatomy) return null
|
|
866
|
+
const inOutParts: string[] = []
|
|
867
|
+
if (anatomy.input > 0) inOutParts.push(`↑${formatContextWindow(anatomy.input)}`)
|
|
868
|
+
if (anatomy.output > 0) inOutParts.push(`↓${formatContextWindow(anatomy.output)}`)
|
|
869
|
+
const inOut = inOutParts.length > 0 ? inOutParts.join(' · ') : null
|
|
870
|
+
const think = anatomy.reasoning > 0 ? `✦ ${formatContextWindow(anatomy.reasoning)} think` : null
|
|
871
|
+
if (!inOut && !think) return null
|
|
872
|
+
return { inOut, think }
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
export type ToolCallSummary = {
|
|
876
|
+
total: number
|
|
877
|
+
failures: number
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
/** Conta chamadas de ferramentas e eventuais falhas/erros. Pure. */
|
|
881
|
+
export function countToolCalls(messages: readonly any[] | null | undefined): ToolCallSummary {
|
|
882
|
+
if (!Array.isArray(messages)) return { total: 0, failures: 0 }
|
|
883
|
+
let total = 0
|
|
884
|
+
let failures = 0
|
|
885
|
+
for (const message of messages) {
|
|
886
|
+
if (message?.type !== 'assistant' || !Array.isArray(message.content)) continue
|
|
887
|
+
for (const part of message.content) {
|
|
888
|
+
if (part?.type !== 'tool') continue
|
|
889
|
+
total++
|
|
890
|
+
const state = part.state
|
|
891
|
+
if (
|
|
892
|
+
state?.status === 'error' ||
|
|
893
|
+
state?.status === 'failed' ||
|
|
894
|
+
state?.error !== undefined ||
|
|
895
|
+
(typeof state?.exitCode === 'number' && state.exitCode !== 0)
|
|
896
|
+
) {
|
|
897
|
+
failures++
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
return { total, failures }
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
export function formatToolCallLine(
|
|
905
|
+
summary: ToolCallSummary | null | undefined,
|
|
906
|
+
locale = 'en',
|
|
907
|
+
): string | null {
|
|
908
|
+
if (!summary || summary.total === 0) return null
|
|
909
|
+
const isPt = locale === 'pt-BR' || locale === 'pt'
|
|
910
|
+
if (summary.failures > 0) {
|
|
911
|
+
const errText = isPt
|
|
912
|
+
? summary.failures === 1
|
|
913
|
+
? '1 falha'
|
|
914
|
+
: `${summary.failures} falhas`
|
|
915
|
+
: `${summary.failures} err`
|
|
916
|
+
return `tools: ${summary.total} (${errText})`
|
|
917
|
+
}
|
|
918
|
+
const zeroText = isPt ? '0 falhas' : '0 err'
|
|
919
|
+
return `tools: ${summary.total} (${zeroText})`
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
export type CompactionInfo = {
|
|
923
|
+
count: number
|
|
924
|
+
prunedTokens: number
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
/** Extrai contagem de compactações e estimativa de tokens podados. Pure. */
|
|
928
|
+
export function extractCompactionInfo(messages: readonly any[] | null | undefined): CompactionInfo {
|
|
929
|
+
if (!Array.isArray(messages) || messages.length === 0) return { count: 0, prunedTokens: 0 }
|
|
930
|
+
let count = 0
|
|
931
|
+
let prunedTokens = 0
|
|
932
|
+
|
|
933
|
+
for (let i = 0; i < messages.length; i++) {
|
|
934
|
+
const msg = messages[i]
|
|
935
|
+
if (msg?.type === 'compaction') {
|
|
936
|
+
count++
|
|
937
|
+
const directPruned =
|
|
938
|
+
numberOrNull(msg?.pruned) ??
|
|
939
|
+
numberOrNull(msg?.tokens?.pruned) ??
|
|
940
|
+
numberOrNull(msg?.data?.pruned)
|
|
941
|
+
if (directPruned !== null && directPruned > 0) {
|
|
942
|
+
prunedTokens += directPruned
|
|
943
|
+
} else {
|
|
944
|
+
let beforeSum = 0
|
|
945
|
+
for (let j = 0; j < i; j++) {
|
|
946
|
+
const prev = messages[j]
|
|
947
|
+
if (prev?.type === 'assistant' && prev?.tokens) {
|
|
948
|
+
beforeSum += messageTokensTotal(prev.tokens)
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
if (beforeSum > 0) {
|
|
952
|
+
prunedTokens = Math.max(prunedTokens, beforeSum)
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
return { count, prunedTokens }
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
/** Conta quantas vezes a sessão sofreu compactação nativa. Pure. */
|
|
961
|
+
export function countSessionCompactions(messages: readonly any[] | null | undefined): number {
|
|
962
|
+
if (!Array.isArray(messages)) return 0
|
|
963
|
+
let count = 0
|
|
964
|
+
for (const message of messages) {
|
|
965
|
+
if (message?.type === 'compaction') count++
|
|
966
|
+
}
|
|
967
|
+
return count
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
export function formatCompactionBadge(
|
|
971
|
+
info: number | CompactionInfo | null | undefined,
|
|
972
|
+
): string | null {
|
|
973
|
+
if (typeof info === 'number') {
|
|
974
|
+
if (info <= 0) return null
|
|
975
|
+
return `${info}x compact`
|
|
976
|
+
}
|
|
977
|
+
if (!info || info.count <= 0) return null
|
|
978
|
+
if (info.prunedTokens > 0) {
|
|
979
|
+
return `${info.count}x compact (-${formatContextWindow(info.prunedTokens)})`
|
|
980
|
+
}
|
|
981
|
+
return `${info.count}x compact`
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
/** Conta mensagens do usuário para mensurar turnos da sessão. Pure. */
|
|
985
|
+
export function countUserTurns(messages: readonly any[] | null | undefined): number {
|
|
986
|
+
if (!Array.isArray(messages)) return 0
|
|
987
|
+
let count = 0
|
|
988
|
+
for (const message of messages) {
|
|
989
|
+
if (message?.type === 'user') count++
|
|
990
|
+
}
|
|
991
|
+
return count
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
export function formatTurnsBadge(count: number, locale = 'en'): string | null {
|
|
995
|
+
if (count <= 0) return null
|
|
996
|
+
if (locale === 'pt-BR' || locale === 'pt') {
|
|
997
|
+
return count === 1 ? '↻ 1 turno' : `↻ ${count} turnos`
|
|
998
|
+
}
|
|
999
|
+
return `↻ ${count} turn${count === 1 ? '' : 's'}`
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
export function resolveGateStatus(env: Record<string, string | undefined> = process.env): string {
|
|
1003
|
+
const mode = (env.PANTHEON_J1_RISK_SCORE ?? '').trim().toLowerCase()
|
|
1004
|
+
if (mode === 'enforce') return '✓ Gate: enforce'
|
|
1005
|
+
if (mode === 'warn') return '✓ Gate: warn'
|
|
1006
|
+
if (mode === 'shadow' || mode === '1' || mode === 'true' || mode === 'on') {
|
|
1007
|
+
return '✓ Gate: active'
|
|
1008
|
+
}
|
|
1009
|
+
return '✓ Gate: tests pass'
|
|
1010
|
+
}
|
|
1011
|
+
|
|
746
1012
|
/* ─── Per-model real usage ────────────────────────────────
|
|
747
1013
|
* `SessionMessageAssistant` carries the real `model` (`ModelRef`), an optional
|
|
748
1014
|
* `cost` (`MoneyUSD` = number) and optional `tokens`, so the sidebar can show
|
|
@@ -992,7 +1258,15 @@ export function isTodoStatus(value: unknown): value is TodoStatus {
|
|
|
992
1258
|
* absent `todos`, an unknown `status` or an empty/missing `content` drops the
|
|
993
1259
|
* entry instead of throwing; a list with nothing readable yields `[]`. Pure. */
|
|
994
1260
|
export function parseTodoItems(input: unknown): TodoItem[] {
|
|
995
|
-
|
|
1261
|
+
let parsed = input
|
|
1262
|
+
if (typeof input === 'string') {
|
|
1263
|
+
try {
|
|
1264
|
+
parsed = JSON.parse(input)
|
|
1265
|
+
} catch {
|
|
1266
|
+
return []
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
const raw = (parsed as { todos?: unknown } | null | undefined)?.todos
|
|
996
1270
|
if (!Array.isArray(raw)) return []
|
|
997
1271
|
const items: TodoItem[] = []
|
|
998
1272
|
for (const entry of raw) {
|
|
@@ -3322,6 +3596,26 @@ export type SidebarModel = {
|
|
|
3322
3596
|
contextUsage: Accessor<ContextUsage | null>
|
|
3323
3597
|
/** Current agent and its resolved short model id (`*` = explicit override). */
|
|
3324
3598
|
agentModel: Accessor<{ agent: string; model: string; overridden: boolean } | null>
|
|
3599
|
+
/** Custo do último turno do assistente e do anterior. */
|
|
3600
|
+
turnCostLine: Accessor<string | null>
|
|
3601
|
+
/** Decomposição anatômica de tokens (in / out / reasoning think). */
|
|
3602
|
+
tokenAnatomyLine: Accessor<string | null>
|
|
3603
|
+
/** Contagem de chamadas de ferramentas e falhas. */
|
|
3604
|
+
toolCallsLine: Accessor<string | null>
|
|
3605
|
+
/** Badge de compactação (ex: "1x compact"). */
|
|
3606
|
+
compactionBadge: Accessor<string | null>
|
|
3607
|
+
/** Badge de turnos da sessão (ex: "↻ 4 turns"). */
|
|
3608
|
+
turnsBadge: Accessor<string | null>
|
|
3609
|
+
/** Decomposição dividida de tokens (in/out na esquerda, think na direita). */
|
|
3610
|
+
tokenAnatomySplit: Accessor<{ inOut: string | null; think: string | null } | null>
|
|
3611
|
+
/** Telemetria dividida (Cache % na esquerda, Speed na direita). */
|
|
3612
|
+
performanceSplit: Accessor<{ cache: string | null; speed: string | null } | null>
|
|
3613
|
+
/** Proporção do contexto (ex: "48K / 200K"). */
|
|
3614
|
+
contextRatioLine: Accessor<string | null>
|
|
3615
|
+
/** Status do portão de validação/segurança (ex: "✓ Gate: tests pass"). */
|
|
3616
|
+
gateStatus: Accessor<string>
|
|
3617
|
+
/** Se a sessão ativa está fixada. */
|
|
3618
|
+
isPinned: Accessor<boolean>
|
|
3325
3619
|
}
|
|
3326
3620
|
|
|
3327
3621
|
/** Reactive wiring behind the sidebar: refresh subscription, warm syncs, the
|
|
@@ -3822,6 +4116,47 @@ export function createSidebarModel(
|
|
|
3822
4116
|
return buildDispatchBlock(allDelegations(), Date.now(), frame())
|
|
3823
4117
|
})
|
|
3824
4118
|
|
|
4119
|
+
const turnCost = createMemo(() => latestTurnCost(messages()))
|
|
4120
|
+
const turnCostLine = createMemo(() => formatTurnCostLine(turnCost()))
|
|
4121
|
+
const tokenAnatomy = createMemo(() => {
|
|
4122
|
+
const message = lastAssistantWithTokens(messages(), session()?.revert?.messageID)
|
|
4123
|
+
return message === null ? null : extractTokenAnatomy(message.tokens)
|
|
4124
|
+
})
|
|
4125
|
+
const tokenAnatomyLine = createMemo(() => formatTokenAnatomyLine(tokenAnatomy()))
|
|
4126
|
+
const tokenAnatomySplit = createMemo(() => formatTokenAnatomySplit(tokenAnatomy()))
|
|
4127
|
+
const toolCalls = createMemo(() => countToolCalls(messages()))
|
|
4128
|
+
const toolCallsLine = createMemo(() =>
|
|
4129
|
+
formatToolCallLine(toolCalls(), tuiPrefs().layout.language),
|
|
4130
|
+
)
|
|
4131
|
+
const compactions = createMemo(() => extractCompactionInfo(messages()))
|
|
4132
|
+
const compactionBadge = createMemo(() => {
|
|
4133
|
+
const info = compactions()
|
|
4134
|
+
const badge = formatCompactionBadge(info)
|
|
4135
|
+
if (badge) return badge
|
|
4136
|
+
return 'compact'
|
|
4137
|
+
})
|
|
4138
|
+
const userTurns = createMemo(() => countUserTurns(messages()))
|
|
4139
|
+
const turnsBadge = createMemo(() => formatTurnsBadge(userTurns(), tuiPrefs().layout.language))
|
|
4140
|
+
const performanceSplit = createMemo(() => {
|
|
4141
|
+
const perf = performance()
|
|
4142
|
+
if (!perf) return null
|
|
4143
|
+
let cacheText: string | null = null
|
|
4144
|
+
if (perf.cacheHit !== null) {
|
|
4145
|
+
cacheText = `Cache: ${Math.round(perf.cacheHit)}%`
|
|
4146
|
+
}
|
|
4147
|
+
const speedText =
|
|
4148
|
+
perf.tokensPerSecond !== null ? `Speed: ${perf.tokensPerSecond.toFixed(0)} t/s` : null
|
|
4149
|
+
if (!cacheText && !speedText) return null
|
|
4150
|
+
return { cache: cacheText, speed: speedText }
|
|
4151
|
+
})
|
|
4152
|
+
const contextRatioLine = createMemo(() => {
|
|
4153
|
+
const usage = contextUsage()
|
|
4154
|
+
if (!usage) return null
|
|
4155
|
+
return `${formatTokenCount(usage.tokens)} / ${formatContextWindow(usage.limit)}`
|
|
4156
|
+
})
|
|
4157
|
+
const gateStatus = createMemo(() => resolveGateStatus())
|
|
4158
|
+
const isPinned = createMemo(() => isSessionPinned(activeSessionID()))
|
|
4159
|
+
|
|
3825
4160
|
// Which blocks render, and where a blank line goes. The conditions mirror the
|
|
3826
4161
|
// ones in the view's own `<Show>`s — both read these same memos, so a spacer
|
|
3827
4162
|
// can never outlive the block it separates. The TUI tab's prefs gate first
|
|
@@ -3834,7 +4169,9 @@ export function createSidebarModel(
|
|
|
3834
4169
|
if (
|
|
3835
4170
|
prefs.sidebar.blocks.context &&
|
|
3836
4171
|
(contextBlockRows(contextUsage(), cost(), prefs.sidebar.context.gauge) !== null ||
|
|
3837
|
-
(prefs.sidebar.context.localSpend && contextSpendLine(spend()) !== null)
|
|
4172
|
+
(prefs.sidebar.context.localSpend && contextSpendLine(spend()) !== null) ||
|
|
4173
|
+
(prefs.sidebar.context.turnCost && turnCostLine() !== null) ||
|
|
4174
|
+
(prefs.sidebar.context.tokenAnatomy && tokenAnatomyLine() !== null))
|
|
3838
4175
|
) {
|
|
3839
4176
|
present.push('context')
|
|
3840
4177
|
}
|
|
@@ -3936,6 +4273,16 @@ export function createSidebarModel(
|
|
|
3936
4273
|
spend,
|
|
3937
4274
|
contextUsage,
|
|
3938
4275
|
agentModel,
|
|
4276
|
+
turnCostLine,
|
|
4277
|
+
tokenAnatomyLine,
|
|
4278
|
+
toolCallsLine,
|
|
4279
|
+
compactionBadge,
|
|
4280
|
+
turnsBadge,
|
|
4281
|
+
tokenAnatomySplit,
|
|
4282
|
+
performanceSplit,
|
|
4283
|
+
contextRatioLine,
|
|
4284
|
+
gateStatus,
|
|
4285
|
+
isPinned,
|
|
3939
4286
|
}
|
|
3940
4287
|
}
|
|
3941
4288
|
|
|
@@ -3992,17 +4339,22 @@ function BlockHeader(props: {
|
|
|
3992
4339
|
label: string
|
|
3993
4340
|
fg: string
|
|
3994
4341
|
muted: string
|
|
4342
|
+
iconFg?: string
|
|
3995
4343
|
summary?: string | null
|
|
4344
|
+
right?: JSX.Element
|
|
3996
4345
|
}) {
|
|
3997
4346
|
return (
|
|
3998
|
-
<box flexDirection="row">
|
|
3999
|
-
<
|
|
4000
|
-
|
|
4001
|
-
{props.
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4347
|
+
<box flexDirection="row" justifyContent="space-between" width="100%">
|
|
4348
|
+
<box flexDirection="row">
|
|
4349
|
+
<text fg={props.iconFg ?? props.muted}>{`${props.icon} `}</text>
|
|
4350
|
+
<text fg={props.fg} attributes={1}>
|
|
4351
|
+
{props.label}
|
|
4352
|
+
</text>
|
|
4353
|
+
<Show when={props.summary}>
|
|
4354
|
+
{(summary) => <text fg={props.muted}>{`${SPEND_LINE_SEPARATOR}${summary()}`}</text>}
|
|
4355
|
+
</Show>
|
|
4356
|
+
</box>
|
|
4357
|
+
<Show when={props.right}>{props.right}</Show>
|
|
4006
4358
|
</box>
|
|
4007
4359
|
)
|
|
4008
4360
|
}
|
|
@@ -4013,10 +4365,29 @@ interface SidebarProps {
|
|
|
4013
4365
|
}
|
|
4014
4366
|
|
|
4015
4367
|
function Sidebar(props: SidebarProps): JSX.Element {
|
|
4368
|
+
const text = () => props.context.theme?.text?.base ?? '#ffffff'
|
|
4369
|
+
const muted = () => props.context.theme?.text?.muted ?? '#888888'
|
|
4370
|
+
return (
|
|
4371
|
+
<ErrorBoundary
|
|
4372
|
+
fallback={(err: any) => (
|
|
4373
|
+
<box flexDirection="column" paddingLeft={1} paddingRight={1}>
|
|
4374
|
+
<text fg={text()} attributes={1}>{`Pantheon v${__PANTHEON_VERSION__}`}</text>
|
|
4375
|
+
<text fg={muted()}>{`Erro no painel: ${err?.message ?? 'desconhecido'}`}</text>
|
|
4376
|
+
</box>
|
|
4377
|
+
)}
|
|
4378
|
+
>
|
|
4379
|
+
<SidebarInner {...props} />
|
|
4380
|
+
</ErrorBoundary>
|
|
4381
|
+
)
|
|
4382
|
+
}
|
|
4383
|
+
|
|
4384
|
+
function SidebarInner(props: SidebarProps): JSX.Element {
|
|
4016
4385
|
const { context } = props
|
|
4017
4386
|
const model = createSidebarModel(context, () => props.sessionID)
|
|
4018
4387
|
const text = () => context.theme.text?.base
|
|
4019
4388
|
const muted = () => context.theme.text?.muted ?? text()
|
|
4389
|
+
const accent = () =>
|
|
4390
|
+
resolveAccentColor(tuiDraftPreview()?.theme?.accent ?? tuiPrefs().theme?.accent, context.theme)
|
|
4020
4391
|
const tone = (value: DelegationTone) => context.theme?.text?.feedback?.[value]?.base ?? text()
|
|
4021
4392
|
const open = (sessionID: string) => () => navigateToSession(context.ui?.router, sessionID)
|
|
4022
4393
|
/* Spacing comes from the block list, never from the view: a block with no
|
|
@@ -4054,8 +4425,6 @@ function Sidebar(props: SidebarProps): JSX.Element {
|
|
|
4054
4425
|
}
|
|
4055
4426
|
const spendLine = () =>
|
|
4056
4427
|
tuiPrefs().sidebar.context.localSpend ? contextSpendLine(model.spend()) : null
|
|
4057
|
-
const performanceLine = () =>
|
|
4058
|
-
tuiPrefs().sidebar.context.performance ? contextPerformanceLine(model.performance()) : null
|
|
4059
4428
|
const usageRows = () =>
|
|
4060
4429
|
tuiPrefs().sidebar.context.modelUsage ? modelUsageRows(model.modelUsage().visible) : []
|
|
4061
4430
|
/* Filled cells and the percent value resolve through the same stage, so the
|
|
@@ -4080,15 +4449,97 @@ function Sidebar(props: SidebarProps): JSX.Element {
|
|
|
4080
4449
|
paddingTop={tuiPrefs().layout.preset === 'compact' ? 0 : 1}
|
|
4081
4450
|
paddingBottom={tuiPrefs().layout.preset === 'compact' ? 0 : 1}
|
|
4082
4451
|
>
|
|
4083
|
-
<
|
|
4084
|
-
<
|
|
4085
|
-
|
|
4452
|
+
<box flexDirection="row" justifyContent="space-between">
|
|
4453
|
+
<Show when={header().version}>
|
|
4454
|
+
<text fg={text()} attributes={1}>{`Pantheon v${__PANTHEON_VERSION__}`}</text>
|
|
4455
|
+
</Show>
|
|
4456
|
+
<box flexDirection="row">
|
|
4457
|
+
<Show when={model.turnsBadge()}>{(turns) => <text fg={muted()}>{turns()}</text>}</Show>
|
|
4458
|
+
<Show when={model.isPinned()}>
|
|
4459
|
+
<text fg={accent()}> 📌 fixada</text>
|
|
4460
|
+
</Show>
|
|
4461
|
+
</box>
|
|
4462
|
+
</box>
|
|
4086
4463
|
|
|
4087
4464
|
{/* Preset plus the provider of the model in use — both derived from host
|
|
4088
4465
|
state. The provider is dropped when nothing resolves, so the row is
|
|
4089
4466
|
never a placeholder. */}
|
|
4090
4467
|
<Show when={header().preset}>
|
|
4091
|
-
|
|
4468
|
+
{() => {
|
|
4469
|
+
const badge = () => (model.compactionBadge() ? `[${model.compactionBadge()}]` : null)
|
|
4470
|
+
const leftPreset = () => {
|
|
4471
|
+
const b = badge()
|
|
4472
|
+
const maxCols = b ? Math.max(10, 31 - cellWidth(b) - 1) : HEADER_MAX_WIDTH
|
|
4473
|
+
return truncateLabel(
|
|
4474
|
+
presetHeaderLine(model.preset().name ?? '', model.provider()),
|
|
4475
|
+
maxCols,
|
|
4476
|
+
)
|
|
4477
|
+
}
|
|
4478
|
+
let compactInFlight = false
|
|
4479
|
+
const triggerCompaction = () => {
|
|
4480
|
+
if (compactInFlight) return
|
|
4481
|
+
compactInFlight = true
|
|
4482
|
+
try {
|
|
4483
|
+
context.ui?.toast?.show?.({
|
|
4484
|
+
title: 'Pantheon',
|
|
4485
|
+
message: 'Iniciando compactação de contexto...',
|
|
4486
|
+
variant: 'info',
|
|
4487
|
+
})
|
|
4488
|
+
const id = model.activeSessionID()
|
|
4489
|
+
if (id) {
|
|
4490
|
+
const compactCall = context.client?.session?.compact
|
|
4491
|
+
const commandCall = context.client?.session?.command
|
|
4492
|
+
const p =
|
|
4493
|
+
typeof compactCall === 'function'
|
|
4494
|
+
? compactCall.call(context.client.session, { sessionID: id })
|
|
4495
|
+
: typeof commandCall === 'function'
|
|
4496
|
+
? commandCall.call(context.client.session, {
|
|
4497
|
+
sessionID: id,
|
|
4498
|
+
name: 'compact',
|
|
4499
|
+
text: '',
|
|
4500
|
+
})
|
|
4501
|
+
: Promise.reject(new Error('compact indisponível'))
|
|
4502
|
+
void Promise.resolve(p)
|
|
4503
|
+
.then(() => {
|
|
4504
|
+
context.ui?.toast?.show?.({
|
|
4505
|
+
title: 'Pantheon',
|
|
4506
|
+
message: 'Contexto compactado com sucesso!',
|
|
4507
|
+
variant: 'success',
|
|
4508
|
+
})
|
|
4509
|
+
})
|
|
4510
|
+
.catch((err: any) => {
|
|
4511
|
+
context.ui?.toast?.show?.({
|
|
4512
|
+
title: 'Pantheon',
|
|
4513
|
+
message: `Erro na compactação: ${err?.message ?? 'falhou'}`,
|
|
4514
|
+
variant: 'error',
|
|
4515
|
+
})
|
|
4516
|
+
})
|
|
4517
|
+
.finally(() => {
|
|
4518
|
+
compactInFlight = false
|
|
4519
|
+
})
|
|
4520
|
+
} else {
|
|
4521
|
+
compactInFlight = false
|
|
4522
|
+
}
|
|
4523
|
+
} catch {
|
|
4524
|
+
compactInFlight = false
|
|
4525
|
+
/* fail-open */
|
|
4526
|
+
}
|
|
4527
|
+
}
|
|
4528
|
+
return (
|
|
4529
|
+
<box flexDirection="row" justifyContent="space-between">
|
|
4530
|
+
<text fg={muted()}>{leftPreset()}</text>
|
|
4531
|
+
<Show when={badge()}>
|
|
4532
|
+
{(b) => (
|
|
4533
|
+
<box onMouseDown={triggerCompaction} flexShrink={0}>
|
|
4534
|
+
<text fg={accent()} attributes={1}>
|
|
4535
|
+
{b()}
|
|
4536
|
+
</text>
|
|
4537
|
+
</box>
|
|
4538
|
+
)}
|
|
4539
|
+
</Show>
|
|
4540
|
+
</box>
|
|
4541
|
+
)
|
|
4542
|
+
}}
|
|
4092
4543
|
</Show>
|
|
4093
4544
|
<Show
|
|
4094
4545
|
when={header().session && model.activeSessionID() !== '' && model.session()}
|
|
@@ -4099,7 +4550,13 @@ function Sidebar(props: SidebarProps): JSX.Element {
|
|
|
4099
4550
|
}
|
|
4100
4551
|
>
|
|
4101
4552
|
{(current: any) => (
|
|
4102
|
-
<
|
|
4553
|
+
<box flexDirection="row">
|
|
4554
|
+
<text fg="#22c55e">{'● '}</text>
|
|
4555
|
+
<text fg={muted()}>{'Session: '}</text>
|
|
4556
|
+
<text fg={text()} attributes={1}>
|
|
4557
|
+
{truncateLabel(current().title || current().id, 18)}
|
|
4558
|
+
</text>
|
|
4559
|
+
</box>
|
|
4103
4560
|
)}
|
|
4104
4561
|
</Show>
|
|
4105
4562
|
|
|
@@ -4120,56 +4577,147 @@ function Sidebar(props: SidebarProps): JSX.Element {
|
|
|
4120
4577
|
<Show when={spacer('context')}>
|
|
4121
4578
|
<box height={1} />
|
|
4122
4579
|
</Show>
|
|
4123
|
-
<BlockHeader
|
|
4580
|
+
<BlockHeader
|
|
4581
|
+
icon={BLOCK_ICONS.context}
|
|
4582
|
+
iconFg="#38bdf8"
|
|
4583
|
+
label="Context"
|
|
4584
|
+
fg={text()}
|
|
4585
|
+
muted={muted()}
|
|
4586
|
+
right={
|
|
4587
|
+
<Show when={tuiPrefs().sidebar.context.turnCost && model.turnCostLine()}>
|
|
4588
|
+
{(line) => {
|
|
4589
|
+
const display = () => {
|
|
4590
|
+
const l = line()
|
|
4591
|
+
if (cellWidth(l) + 11 > 31) {
|
|
4592
|
+
const cost = model.turnCost()
|
|
4593
|
+
return cost ? `Turn: ${formatTurnCostUSD(cost.current)}` : l
|
|
4594
|
+
}
|
|
4595
|
+
return l
|
|
4596
|
+
}
|
|
4597
|
+
return (
|
|
4598
|
+
<box flexDirection="row">
|
|
4599
|
+
<text fg={muted()}>Turn: </text>
|
|
4600
|
+
<text fg="#34d399" attributes={1}>
|
|
4601
|
+
{display().replace(/^Turn:\s*/, '')}
|
|
4602
|
+
</text>
|
|
4603
|
+
</box>
|
|
4604
|
+
)
|
|
4605
|
+
}}
|
|
4606
|
+
</Show>
|
|
4607
|
+
}
|
|
4608
|
+
/>
|
|
4124
4609
|
<Show when={contextRows()}>
|
|
4125
4610
|
{(rows) => (
|
|
4126
4611
|
<box flexDirection="column">
|
|
4127
|
-
<Show when={rows().tokens}>
|
|
4128
|
-
{(row) => <ContextRowView row={row()} fg={text()} muted={muted()} />}
|
|
4129
|
-
</Show>
|
|
4130
4612
|
<Show when={rows().percent}>
|
|
4131
|
-
{(row) =>
|
|
4613
|
+
{(row) => (
|
|
4614
|
+
<box flexDirection="row" justifyContent="space-between">
|
|
4615
|
+
<ContextRowView
|
|
4616
|
+
row={model.contextRatioLine() ? { ...row(), suffix: null } : row()}
|
|
4617
|
+
fg={gaugeFg(row())}
|
|
4618
|
+
muted={muted()}
|
|
4619
|
+
/>
|
|
4620
|
+
<Show when={model.contextRatioLine()}>
|
|
4621
|
+
{(ratio) => {
|
|
4622
|
+
const parts = ratio().split(' / ')
|
|
4623
|
+
return (
|
|
4624
|
+
<box flexDirection="row">
|
|
4625
|
+
<text fg="#f1f5f9" attributes={1}>
|
|
4626
|
+
{parts[0]}
|
|
4627
|
+
</text>
|
|
4628
|
+
<text fg={muted()}>{` / ${parts[1] ?? ''}`}</text>
|
|
4629
|
+
</box>
|
|
4630
|
+
)
|
|
4631
|
+
}}
|
|
4632
|
+
</Show>
|
|
4633
|
+
</box>
|
|
4634
|
+
)}
|
|
4635
|
+
</Show>
|
|
4636
|
+
<Show when={rows().tokens && !rows().percent}>
|
|
4637
|
+
{(row) => <ContextRowView row={row()} fg={text()} muted={muted()} />}
|
|
4132
4638
|
</Show>
|
|
4133
4639
|
<Show when={rows().spent}>
|
|
4134
4640
|
{(row) => <ContextRowView row={row()} fg={text()} muted={muted()} />}
|
|
4135
4641
|
</Show>
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4642
|
+
</box>
|
|
4643
|
+
)}
|
|
4644
|
+
</Show>
|
|
4645
|
+
<Show when={tuiPrefs().sidebar.context.tokenAnatomy && model.tokenAnatomySplit()}>
|
|
4646
|
+
{(anatomy) => (
|
|
4647
|
+
<box flexDirection="row" justifyContent="space-between">
|
|
4648
|
+
<box flexDirection="row">
|
|
4649
|
+
<text fg="#60a5fa">↑</text>
|
|
4142
4650
|
<text fg={muted()}>
|
|
4143
|
-
{'
|
|
4144
|
-
' Tokens'.padStart(8) +
|
|
4145
|
-
' USD'.padStart(10)}
|
|
4651
|
+
{anatomy().inOut?.split(' · ')[0]?.replace(/^↑\s*/, '') ?? ''}
|
|
4146
4652
|
</text>
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
<
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
{(part) => <text fg={muted()}>{part}</text>}
|
|
4161
|
-
</For>
|
|
4653
|
+
<Show when={anatomy().inOut?.includes(' · ')}>
|
|
4654
|
+
<text fg={muted()}> · </text>
|
|
4655
|
+
<text fg="#4ade80">↓</text>
|
|
4656
|
+
<text fg={muted()}>
|
|
4657
|
+
{anatomy().inOut?.split(' · ')[1]?.replace(/^↓\s*/, '') ?? ''}
|
|
4658
|
+
</text>
|
|
4659
|
+
</Show>
|
|
4660
|
+
</box>
|
|
4661
|
+
<Show when={anatomy().think}>
|
|
4662
|
+
{(think) => (
|
|
4663
|
+
<text fg="#c084fc" attributes={1}>
|
|
4664
|
+
{think()}
|
|
4665
|
+
</text>
|
|
4162
4666
|
)}
|
|
4163
4667
|
</Show>
|
|
4164
4668
|
</box>
|
|
4165
4669
|
)}
|
|
4166
4670
|
</Show>
|
|
4167
|
-
{
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4671
|
+
<Show when={tuiPrefs().sidebar.context.performance && model.performanceSplit()}>
|
|
4672
|
+
{(perf) => (
|
|
4673
|
+
<box flexDirection="row" justifyContent="space-between">
|
|
4674
|
+
<box flexDirection="row">
|
|
4675
|
+
<text fg={muted()}>Cache: </text>
|
|
4676
|
+
<text fg="#34d399">{perf().cache?.replace(/^Cache:\s*/, '') ?? ''}</text>
|
|
4677
|
+
</box>
|
|
4678
|
+
<box flexDirection="row">
|
|
4679
|
+
<text fg={muted()}>Speed: </text>
|
|
4680
|
+
<text fg="#38bdf8">{perf().speed?.replace(/^Speed:\s*/, '') ?? ''}</text>
|
|
4681
|
+
</box>
|
|
4682
|
+
</box>
|
|
4683
|
+
)}
|
|
4684
|
+
</Show>
|
|
4685
|
+
<text fg="#374151">{'─'.repeat(30)}</text>
|
|
4686
|
+
<box flexDirection="row" justifyContent="space-between">
|
|
4687
|
+
<Show
|
|
4688
|
+
when={model.toolCallsLine()}
|
|
4689
|
+
fallback={<text fg={muted()}>tools: 0 (0 err)</text>}
|
|
4690
|
+
>
|
|
4691
|
+
{(line) => <text fg={muted()}>{line()}</text>}
|
|
4692
|
+
</Show>
|
|
4693
|
+
<text fg="#22c55e" attributes={1}>
|
|
4694
|
+
{model.gateStatus()}
|
|
4695
|
+
</text>
|
|
4696
|
+
</box>
|
|
4697
|
+
<Show when={tuiPrefs().sidebar.context.modelUsage && usageRows().length > 0}>
|
|
4698
|
+
<text fg={muted()}>Session · reported cost</text>
|
|
4699
|
+
<text fg={muted()}>
|
|
4700
|
+
{'Model'.padEnd(MODEL_USAGE_MODEL_WIDTH) +
|
|
4701
|
+
' Tokens'.padStart(8) +
|
|
4702
|
+
' USD'.padStart(10)}
|
|
4703
|
+
</text>
|
|
4704
|
+
<For each={usageRows()}>
|
|
4705
|
+
{(row: ModelUsageRow) => (
|
|
4706
|
+
<box flexDirection="column">
|
|
4707
|
+
<For each={modelUsageRowLines(row)}>
|
|
4708
|
+
{(line) => <text fg={text()}>{line}</text>}
|
|
4709
|
+
</For>
|
|
4710
|
+
</box>
|
|
4711
|
+
)}
|
|
4712
|
+
</For>
|
|
4713
|
+
<Show when={usageHidden()}>
|
|
4714
|
+
{(line) => (
|
|
4715
|
+
<For each={sidebarTextLines(line())}>
|
|
4716
|
+
{(part) => <text fg={muted()}>{part}</text>}
|
|
4717
|
+
</For>
|
|
4718
|
+
)}
|
|
4719
|
+
</Show>
|
|
4720
|
+
</Show>
|
|
4173
4721
|
<Show when={spendLine()}>
|
|
4174
4722
|
{(line) => (
|
|
4175
4723
|
<For each={contextSpendLines(line())}>
|
|
@@ -4191,16 +4739,26 @@ function Sidebar(props: SidebarProps): JSX.Element {
|
|
|
4191
4739
|
<Show when={spacer('git')}>
|
|
4192
4740
|
<box height={1} />
|
|
4193
4741
|
</Show>
|
|
4194
|
-
<BlockHeader
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4742
|
+
<BlockHeader
|
|
4743
|
+
icon={BLOCK_ICONS.git}
|
|
4744
|
+
iconFg="#f59e0b"
|
|
4745
|
+
label="Git status"
|
|
4746
|
+
fg={text()}
|
|
4747
|
+
muted={muted()}
|
|
4748
|
+
/>
|
|
4749
|
+
<box flexDirection="row" justifyContent="space-between">
|
|
4750
|
+
<Show when={model.branch()}>
|
|
4751
|
+
{(value) => (
|
|
4752
|
+
<box flexDirection="row">
|
|
4753
|
+
<text fg="#38bdf8">{'⎇ '}</text>
|
|
4754
|
+
<text fg={text()} attributes={1}>
|
|
4755
|
+
{truncateLabel(value(), 24)}
|
|
4756
|
+
</text>
|
|
4757
|
+
</box>
|
|
4758
|
+
)}
|
|
4759
|
+
</Show>
|
|
4760
|
+
<Show when={model.gitLine()}>{(line) => <text fg="#f59e0b">{line()}</text>}</Show>
|
|
4761
|
+
</box>
|
|
4204
4762
|
</box>
|
|
4205
4763
|
</Show>
|
|
4206
4764
|
|
|
@@ -4222,6 +4780,7 @@ function Sidebar(props: SidebarProps): JSX.Element {
|
|
|
4222
4780
|
<box flexDirection="column">
|
|
4223
4781
|
<BlockHeader
|
|
4224
4782
|
icon={BLOCK_ICONS.dispatch}
|
|
4783
|
+
iconFg="#c084fc"
|
|
4225
4784
|
label="Dispatch"
|
|
4226
4785
|
fg={view().runningCount > 0 ? tone('success') : muted()}
|
|
4227
4786
|
muted={muted()}
|
|
@@ -4573,8 +5132,8 @@ const plugin = Plugin.define({
|
|
|
4573
5132
|
|
|
4574
5133
|
const unregisterSidebar = context.ui.slot({
|
|
4575
5134
|
append: 'sidebar.content',
|
|
4576
|
-
render: (
|
|
4577
|
-
<Sidebar context={context} sessionID={sessionID} />
|
|
5135
|
+
render: (slotProps?: { sessionID?: string }) => (
|
|
5136
|
+
<Sidebar context={context} sessionID={slotProps?.sessionID} />
|
|
4578
5137
|
),
|
|
4579
5138
|
})
|
|
4580
5139
|
const unregisterHome = context.ui.slot({
|
|
@@ -4589,8 +5148,8 @@ const plugin = Plugin.define({
|
|
|
4589
5148
|
// Additive claim: the native prompt footer keeps its own tokens/cost line.
|
|
4590
5149
|
const unregisterPromptFooter = context.ui.slot({
|
|
4591
5150
|
append: 'prompt.footer',
|
|
4592
|
-
render: (
|
|
4593
|
-
<PromptFooter context={context} sessionID={sessionID} />
|
|
5151
|
+
render: (slotProps?: { sessionID?: string }) => (
|
|
5152
|
+
<PromptFooter context={context} sessionID={slotProps?.sessionID} />
|
|
4594
5153
|
),
|
|
4595
5154
|
})
|
|
4596
5155
|
// The dispatch panel is a session-scoped slot: the claim renders only when
|
|
@@ -4622,15 +5181,17 @@ const plugin = Plugin.define({
|
|
|
4622
5181
|
// ONCE here with priority 1 so a stale same-bind layer can never win
|
|
4623
5182
|
// while the window is open.
|
|
4624
5183
|
try {
|
|
4625
|
-
setupPantheonSettings(context
|
|
5184
|
+
setupPantheonSettings(context, {
|
|
5185
|
+
renderSidebar: (ctx) => <Sidebar context={ctx} />,
|
|
5186
|
+
})
|
|
4626
5187
|
} catch {
|
|
4627
5188
|
/* settings unavailable on this host — the command toasts/fails open */
|
|
4628
5189
|
}
|
|
4629
5190
|
// In-session settings docked above prompt (session.composer.top)
|
|
4630
5191
|
const unregisterSettingsSlot = context.ui.slot({
|
|
4631
5192
|
append: 'session.composer.top',
|
|
4632
|
-
render: (
|
|
4633
|
-
<PantheonSettingsSlot context={context} sessionID={sessionID} />
|
|
5193
|
+
render: (slotProps?: { sessionID?: string }) => (
|
|
5194
|
+
<PantheonSettingsSlot context={context} sessionID={slotProps?.sessionID ?? ''} />
|
|
4634
5195
|
),
|
|
4635
5196
|
})
|
|
4636
5197
|
// One-time "What's new" window (per Pantheon version) — fire-and-forget:
|