opencode-cache-hit 0.2.0 → 0.2.2

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.
@@ -5,15 +5,10 @@ import type { CacheHitMetrics } from "./use-cache-hit-metrics.ts"
5
5
  import { aggregateSubAgents } from "./stats.ts"
6
6
  import { computeSubsSaved } from "./pricing.ts"
7
7
  import { formatTokenCount } from "./format-tokens.ts"
8
- import { TuiMetricRow, truncateVisual, type PanelLayout } from "./tui-panel/index.ts"
8
+ import { formatSubAgentLabel, modelRowColor } from "./format-model.ts"
9
+ import { TuiMetricRow, type PanelLayout } from "./tui-panel/index.ts"
9
10
  import type { ProviderInfo, SubAgentSummary } from "./types.ts"
10
11
 
11
- function agentRowLabel(id: string, gauge: number): string {
12
- const tail = id.length > 10 ? id.slice(-8) : id
13
- const raw = id.length > 10 ? "\u2026" + tail : tail
14
- return truncateVisual(raw, Math.max(6, gauge - 14))
15
- }
16
-
17
12
  function subHasActivity(sub: SubAgentSummary): boolean {
18
13
  return sub.cost > 0 || sub.cacheRead > 0 || sub.cacheWrite > 0 || sub.input > 0
19
14
  }
@@ -57,9 +52,14 @@ export function AgentsView(props: {
57
52
  <TuiMetricRow
58
53
  pal={m.pal()}
59
54
  layout={layout}
60
- label={" " + agentRowLabel(sub.id, layout.gauge())}
55
+ label={
56
+ " " +
57
+ formatSubAgentLabel(sub, layout.gauge(), props.formatCost, m.t().tok)
58
+ }
61
59
  value={sub.cost > 0 ? props.formatCost(sub.cost) : formatTokenCount(sub.input)}
62
60
  unit={sub.cost > 0 ? "" : m.t().tok}
61
+ labelFg={modelRowColor(sub.model, sub.providerID, m.pal())}
62
+ valueFg={m.pal().muted}
63
63
  />
64
64
  </Show>
65
65
  )}
@@ -9,7 +9,6 @@ import type { AssistantMessage } from "./types.ts"
9
9
  import type { CacheTTLConfig } from "./plugin-config.ts"
10
10
  import { parseDuration } from "./plugin-config.ts"
11
11
  import type { PanelPalette, PanelLayout } from "./tui-panel/index.ts"
12
- import { TuiMetricRow } from "./tui-panel/index.ts"
13
12
 
14
13
  const SECOND = 1000
15
14
  const MINUTE = 60 * SECOND
@@ -121,13 +120,9 @@ export function CacheTTLView(props: {
121
120
 
122
121
  return (
123
122
  <Show when={elapsed() !== null}>
124
- <TuiMetricRow
125
- pal={props.pal}
126
- layout={props.layout}
127
- label={props.label}
128
- value={`${statusIcon()} ${formatElapsed(elapsed()!)}`}
129
- fg={statusColor()}
130
- />
123
+ <text fg={statusColor()}>
124
+ {props.layout.row(props.label, `${statusIcon()} ${formatElapsed(elapsed()!)}`, "")}
125
+ </text>
131
126
  </Show>
132
127
  )
133
128
  }
@@ -73,6 +73,76 @@ export function normalizeCostDisplay(raw: unknown): CostDisplayConfig {
73
73
  return cfg
74
74
  }
75
75
 
76
+ /** Resolved params for static HTML dashboards (timeline-dashboard.ts). */
77
+ export type CostDisplayEmbed = {
78
+ currency: CurrencyCode
79
+ costUnit: CurrencyCode
80
+ rate: number
81
+ symbol: string
82
+ decimals: number
83
+ minDisplay: number
84
+ /** Chart axis / table header, e.g. "Cost (¥)". */
85
+ chartLabel: string
86
+ /** Empty when display currency matches JSONL cost unit. */
87
+ costNote: string
88
+ }
89
+
90
+ function currencyOrDefault(code: unknown): CurrencyCode {
91
+ return typeof code === "string" && code in CURRENCY_PRESETS ? (code as CurrencyCode) : DEFAULT_COST_DISPLAY.currency
92
+ }
93
+
94
+ /** Guarantee finite rate/symbol/decimals for HTML embed + Chart.js. */
95
+ export function sanitizeCostDisplayEmbed(embed: CostDisplayEmbed): CostDisplayEmbed {
96
+ const currency = currencyOrDefault(embed.currency)
97
+ const costUnit = currencyOrDefault(embed.costUnit)
98
+ const preset = CURRENCY_PRESETS[currency]
99
+ let rate = embed.rate
100
+ if (!Number.isFinite(rate) || rate <= 0) {
101
+ rate = costUnit === currency ? 1 : (DEFAULT_COST_DISPLAY.rate ?? 1)
102
+ }
103
+ const symbol =
104
+ typeof embed.symbol === "string" && embed.symbol.length > 0 ? embed.symbol : preset.symbol
105
+ const decimals =
106
+ typeof embed.decimals === "number" && embed.decimals >= 0 && Number.isFinite(embed.decimals)
107
+ ? embed.decimals
108
+ : preset.decimals
109
+ const minDisplay =
110
+ typeof embed.minDisplay === "number" && embed.minDisplay > 0 && Number.isFinite(embed.minDisplay)
111
+ ? embed.minDisplay
112
+ : preset.minDisplay
113
+ const chartLabel = `Cost (${symbol})`
114
+ const costNote =
115
+ costUnit === currency ? "" : `JSONL cost is ${costUnit}; displayed as ${currency} @ ${rate}`
116
+ return { currency, costUnit, rate, symbol, decimals, minDisplay, chartLabel, costNote }
117
+ }
118
+
119
+ export function buildCostDisplayEmbed(config: CostDisplayConfig | unknown): CostDisplayEmbed {
120
+ const cfg = normalizeCostDisplay(config)
121
+ const currency = currencyOrDefault(cfg.currency)
122
+ const preset = CURRENCY_PRESETS[currency]
123
+ const symbol = cfg.symbol ?? preset.symbol
124
+ const decimals = cfg.decimals ?? preset.decimals
125
+ const minDisplay = cfg.minDisplay ?? preset.minDisplay
126
+ const costUnit = currencyOrDefault(cfg.costUnit ?? cfg.convert?.from ?? DEFAULT_COST_DISPLAY.costUnit)
127
+ const rate = costUnit === currency ? 1 : resolveExchangeRate({ ...cfg, currency, costUnit })
128
+ return sanitizeCostDisplayEmbed({
129
+ currency,
130
+ costUnit,
131
+ rate,
132
+ symbol,
133
+ decimals,
134
+ minDisplay,
135
+ chartLabel: `Cost (${symbol})`,
136
+ costNote:
137
+ costUnit === currency ? "" : `JSONL cost is ${costUnit}; displayed as ${currency} @ ${rate}`,
138
+ })
139
+ }
140
+
141
+ /** No config file / partial config / invalid fields → safe embed for dashboards. */
142
+ export function normalizeCostDisplayEmbed(raw: unknown): CostDisplayEmbed {
143
+ return buildCostDisplayEmbed(raw)
144
+ }
145
+
76
146
  export function createCostFormatter(config: CostDisplayConfig): (amountUsd: number) => string {
77
147
  const preset = CURRENCY_PRESETS[config.currency]
78
148
  const symbol = config.symbol ?? preset.symbol
@@ -0,0 +1,227 @@
1
+ import { formatTokenCount } from "./format-tokens.ts"
2
+ import { shortModelName } from "./stats.ts"
3
+ import type { PanelPalette } from "./tui-panel/palette.ts"
4
+ import { toneBrandHex } from "./tui-panel/palette.ts"
5
+ import { UNIT_GAP, truncateVisual, visualWidth } from "./tui-panel/layout.ts"
6
+ import type { SubAgentSummary } from "./types.ts"
7
+
8
+ const INDENT_COLS = 2
9
+ const MIN_ROW_GAP = 1
10
+ const MIN_LABEL_BUDGET = 6
11
+ const ID_TAIL_DEFAULT = 6
12
+ const ID_TAIL_MIN = 4
13
+
14
+ export type ModelFamilyId =
15
+ | "claude"
16
+ | "deepseek"
17
+ | "openai"
18
+ | "gemini"
19
+ | "qwen"
20
+ | "glm"
21
+ | "kimi"
22
+ | "minimax"
23
+ | "grok"
24
+ | "mimo"
25
+ | "meta"
26
+ | "mistral"
27
+
28
+ /**
29
+ * Approximate vendor brand colors (pre-toning). Tuned for recognition on dark terminals.
30
+ * Applied via `toneBrandHex` — not the panel semantic keys (`warning`, `primary`, …).
31
+ */
32
+ export const MODEL_BRAND_HEX: Record<ModelFamilyId, string> = {
33
+ claude: "#D4A574",
34
+ deepseek: "#4D6BFE",
35
+ openai: "#10A37F",
36
+ gemini: "#5B8DEF",
37
+ qwen: "#6157E5",
38
+ glm: "#2F67F6",
39
+ kimi: "#5B8FF9",
40
+ minimax: "#FF6B35",
41
+ grok: "#A8ADB8",
42
+ mimo: "#7C6FE8",
43
+ meta: "#0668E1",
44
+ mistral: "#FF8200",
45
+ }
46
+
47
+ /** Fallback hues for unknown providers (also toned; never panel `success` green). */
48
+ const UNKNOWN_BRAND_HEX = ["#8B9DAF", "#9CAF8B", "#A89BBF", "#B0A080"] as const
49
+
50
+ type ModelFamilyRule = {
51
+ id: ModelFamilyId
52
+ match: (name: string, providerID: string) => boolean
53
+ }
54
+
55
+ /**
56
+ * Built-in model/provider families (label stays full `displayModelName`).
57
+ * First match wins — order from more specific vendor slugs to broad prefixes.
58
+ */
59
+ export const MODEL_FAMILY_RULES: readonly ModelFamilyRule[] = [
60
+ {
61
+ id: "claude",
62
+ match: (n, p) =>
63
+ p === "anthropic" ||
64
+ n.startsWith("claude-") ||
65
+ /(^|-)(sonnet|opus|haiku)(-|$)/i.test(n),
66
+ },
67
+ {
68
+ id: "deepseek",
69
+ match: (n, p) => p === "deepseek" || n.startsWith("deepseek-"),
70
+ },
71
+ {
72
+ id: "openai",
73
+ match: (n, p) =>
74
+ p === "openai" ||
75
+ n.startsWith("gpt-") ||
76
+ /^o[13](-|$)/.test(n) ||
77
+ n.startsWith("chatgpt-"),
78
+ },
79
+ {
80
+ id: "gemini",
81
+ match: (n, p) => p === "google" || n.startsWith("gemini-"),
82
+ },
83
+ {
84
+ id: "qwen",
85
+ match: (n, p) => p === "qwen" || p === "alibaba" || n.startsWith("qwen"),
86
+ },
87
+ {
88
+ id: "glm",
89
+ match: (n, p) =>
90
+ p === "zhipu" ||
91
+ p === "zhipuai" ||
92
+ n.startsWith("glm-") ||
93
+ n.includes("chatglm"),
94
+ },
95
+ {
96
+ id: "kimi",
97
+ match: (n, p) => p === "moonshot" || n.startsWith("kimi-"),
98
+ },
99
+ {
100
+ id: "minimax",
101
+ match: (n, p) => p === "minimax" || n.startsWith("minimax"),
102
+ },
103
+ {
104
+ id: "grok",
105
+ match: (n, p) => p === "x-ai" || p === "xai" || n.startsWith("grok-"),
106
+ },
107
+ {
108
+ id: "mimo",
109
+ match: (n, p) => p === "mimo" || n.startsWith("mimo-"),
110
+ },
111
+ {
112
+ id: "meta",
113
+ match: (n, p) => p === "meta" || n.startsWith("llama-") || n.includes("meta-llama"),
114
+ },
115
+ {
116
+ id: "mistral",
117
+ match: (n, p) => p === "mistral" || n.startsWith("mistral-") || n.startsWith("codestral-"),
118
+ },
119
+ ]
120
+
121
+ /** Strip release-date tails only — same spirit as main-session `modelShort`. */
122
+ export function stripModelDateSuffix(name: string): string {
123
+ return name.replace(/-20\d{6,}$/, "").replace(/-\d{8}$/, "")
124
+ }
125
+
126
+ /** Sub-agent label text: `shortModelName` + date trim; row layout truncates visually. */
127
+ export function displayModelName(modelId: string): string {
128
+ const name = shortModelName(modelId)
129
+ if (!name) return ""
130
+ return stripModelDateSuffix(name)
131
+ }
132
+
133
+ /** @deprecated alias */
134
+ export function compactModelLabel(modelId: string, _providerID = ""): string {
135
+ return displayModelName(modelId)
136
+ }
137
+
138
+ function normalizeForFamilyMatch(s: string): string {
139
+ return s.toLowerCase()
140
+ }
141
+
142
+ function findFamilyRule(name: string, providerID: string): ModelFamilyRule | undefined {
143
+ const n = normalizeForFamilyMatch(name)
144
+ const p = normalizeForFamilyMatch(providerID)
145
+ return MODEL_FAMILY_RULES.find((r) => r.match(n, p))
146
+ }
147
+
148
+ export function modelFamilyId(modelId: string, providerID: string): ModelFamilyId | null {
149
+ const name = shortModelName(modelId)
150
+ if (!name) return null
151
+ return findFamilyRule(name, providerID)?.id ?? null
152
+ }
153
+
154
+ function stableHash(s: string): number {
155
+ let h = 5381
156
+ for (let i = 0; i < s.length; i++) h = (h * 33) ^ s.charCodeAt(i)
157
+ return h >>> 0
158
+ }
159
+
160
+ /** Sub-agent label color from vendor brand hex (toned for TUI). */
161
+ export function modelRowColor(modelId: string, providerID: string, pal: PanelPalette): string {
162
+ const fallback = pal.muted
163
+ const family = modelFamilyId(modelId, providerID)
164
+ if (family) return toneBrandHex(MODEL_BRAND_HEX[family], fallback)
165
+ const name = shortModelName(modelId)
166
+ const key = providerID || name.split("-")[0] || name
167
+ const idx = stableHash(key) % UNKNOWN_BRAND_HEX.length
168
+ return toneBrandHex(UNKNOWN_BRAND_HEX[idx]!, fallback)
169
+ }
170
+
171
+ export function sessionIdTail(id: string, tailLen: number): string {
172
+ if (!id) return ""
173
+ if (id.length <= tailLen) return id
174
+ return "\u2026" + id.slice(-tailLen)
175
+ }
176
+
177
+ export function subAgentLabelBudget(gauge: number, value: string, unit: string): number {
178
+ const rightW = visualWidth(value) + (unit ? visualWidth(unit) + UNIT_GAP : 0)
179
+ return Math.max(MIN_LABEL_BUDGET, gauge - rightW - INDENT_COLS - MIN_ROW_GAP)
180
+ }
181
+
182
+ /** Sub-agent label: `{model} …{idTail}` — model first; truncation keeps model prefix. */
183
+ export function formatSubAgentLabel(
184
+ sub: SubAgentSummary,
185
+ gauge: number,
186
+ formatCost: (n: number) => string,
187
+ tokUnit: string,
188
+ ): string {
189
+ const value = sub.cost > 0 ? formatCost(sub.cost) : formatTokenCount(sub.input)
190
+ const unit = sub.cost > 0 ? "" : tokUnit
191
+ const budget = subAgentLabelBudget(gauge, value, unit)
192
+
193
+ if (!shortModelName(sub.model)) {
194
+ return truncateVisual(sessionIdTail(sub.id, ID_TAIL_DEFAULT), budget)
195
+ }
196
+
197
+ const model = displayModelName(sub.model)
198
+ return joinModelAndSessionId(model, sub.id, budget)
199
+ }
200
+
201
+ function joinModelAndSessionId(model: string, id: string, budget: number): string {
202
+ if (!model) {
203
+ return truncateVisual(sessionIdTail(id, ID_TAIL_DEFAULT), budget)
204
+ }
205
+
206
+ const tryPair = (tailLen: number, trimModel: boolean): string | null => {
207
+ const idPart = sessionIdTail(id, tailLen)
208
+ const idBlockW = visualWidth(idPart) + 1
209
+ if (budget <= idBlockW) return null
210
+ const modelPart = trimModel ? truncateVisual(model, budget - idBlockW) : model
211
+ if (!modelPart) return null
212
+ const combined = modelPart + " " + idPart
213
+ return visualWidth(combined) <= budget ? combined : null
214
+ }
215
+
216
+ for (const tailLen of [ID_TAIL_DEFAULT, ID_TAIL_MIN]) {
217
+ const full = tryPair(tailLen, false)
218
+ if (full) return full
219
+ }
220
+
221
+ for (const tailLen of [ID_TAIL_MIN, ID_TAIL_DEFAULT]) {
222
+ const trimmed = tryPair(tailLen, true)
223
+ if (trimmed) return trimmed
224
+ }
225
+
226
+ return truncateVisual(model, budget)
227
+ }
@@ -6,16 +6,21 @@ import { createTimelineCollector } from "./timeline/collector.ts"
6
6
  import type { AssistantMessage, OpenCodeTuiApi, SubAgentSummary } from "./types.ts"
7
7
  import {
8
8
  emptySessionSnapshot,
9
+ aggregateFromSessionObject,
9
10
  aggregateSessionFromMessages,
11
+ mainSessionHasStats,
10
12
  subAgentHasStats,
11
13
  toSubAgentSummary,
14
+ withModelFallback,
12
15
  } from "./stats.ts"
13
16
  import { createChildSessionSync } from "./child-session-sync.ts"
14
17
  import { loadPluginConfig } from "./load-config.ts"
15
18
 
16
19
  /**
17
- * Session-scoped sidebar host. Bumps `refreshTick` on message.updated (same as visual-cache)
18
- * so memos re-read api.state.session.messages.
20
+ * Session-scoped sidebar host. Bumps `refreshTick` on message.updated
21
+ * so memos re-compute. Prefers session.get() for aggregate cost/tokens
22
+ * (DB-level, not capped at 100 messages), falls back to session.messages().
23
+ * Timeline writes are event-driven: message.updated → handleMessage → appendFile.
19
24
  */
20
25
  export function CacheHitSidebarHost(props: {
21
26
  sessionId: string
@@ -44,8 +49,6 @@ export function CacheHitSidebarHost(props: {
44
49
  config: props.timeline,
45
50
  getRootSessionId: () => props.sessionId,
46
51
  getChildIds: childIds,
47
- getMessages: (id) =>
48
- (props.api.state.session.messages(id) ?? []) as AssistantMessage[],
49
52
  })
50
53
  onCleanup(() => timeline.dispose())
51
54
 
@@ -56,7 +59,6 @@ export function CacheHitSidebarHost(props: {
56
59
  setChildIds,
57
60
  onSynced: () => {
58
61
  bumpRefresh()
59
- timeline.schedule()
60
62
  },
61
63
  })
62
64
  onCleanup(() => childSync.dispose())
@@ -65,6 +67,14 @@ export function CacheHitSidebarHost(props: {
65
67
  void refreshTick()
66
68
  const sid = props.sessionId
67
69
  if (!sid) return emptySessionSnapshot()
70
+ const session = props.api.state.session.get(sid)
71
+ if (session) {
72
+ const snap = aggregateFromSessionObject(session)
73
+ if (mainSessionHasStats(snap)) {
74
+ const msgs = props.api.state.session.messages(sid) as AssistantMessage[] | undefined
75
+ return msgs ? withModelFallback(snap, msgs) : snap
76
+ }
77
+ }
68
78
  const msgs = props.api.state.session.messages(sid)
69
79
  return msgs?.length
70
80
  ? aggregateSessionFromMessages(msgs as AssistantMessage[])
@@ -78,17 +88,27 @@ export function CacheHitSidebarHost(props: {
78
88
  return (props.api.state.session.messages(sid) ?? []) as AssistantMessage[]
79
89
  })
80
90
 
81
- const subAgentList = createMemo(() =>
82
- childIds()
91
+ const subAgentList = createMemo(() => {
92
+ void refreshTick()
93
+ return childIds()
83
94
  .map((cid) => {
95
+ const session = props.api.state.session.get(cid)
96
+ if (session) {
97
+ const snap = aggregateFromSessionObject(session)
98
+ if (subAgentHasStats(snap)) {
99
+ const msgs = props.api.state.session.messages(cid) as AssistantMessage[] | undefined
100
+ const merged = msgs ? withModelFallback(snap, msgs) : snap
101
+ return toSubAgentSummary(cid, merged)
102
+ }
103
+ }
84
104
  const msgs = props.api.state.session.messages(cid)
85
105
  if (!msgs?.length) return null
86
106
  const snap = aggregateSessionFromMessages(msgs as AssistantMessage[])
87
107
  if (!subAgentHasStats(snap)) return null
88
108
  return toSubAgentSummary(cid, snap)
89
109
  })
90
- .filter(Boolean) as SubAgentSummary[],
91
- )
110
+ .filter(Boolean) as SubAgentSummary[]
111
+ })
92
112
 
93
113
  createEffect(() => {
94
114
  const sid = props.sessionId
@@ -97,15 +117,17 @@ export function CacheHitSidebarHost(props: {
97
117
  timeline.resetForRootChange()
98
118
  if (sid) {
99
119
  childSync.loadChildren()
100
- timeline.schedule()
101
120
  }
102
121
  })
103
122
 
104
123
  createEffect(() => {
105
124
  const unsub = props.api.event.on("message.updated", (event) => {
106
125
  bumpRefresh()
107
- childSync.onForeignSessionActivity(event.properties?.info?.sessionID)
108
- timeline.schedule()
126
+ const sid = event.properties?.info?.sessionID
127
+ childSync.onForeignSessionActivity(sid)
128
+ if (sid && event.properties?.info) {
129
+ timeline.handleMessage(sid, event.properties.info as AssistantMessage)
130
+ }
109
131
  })
110
132
  onCleanup(() => unsub?.())
111
133
  })
package/src/stats.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AssistantMessage, SessionSnapshot, SubAgentSummary } from "./types.ts"
1
+ import type { AssistantMessage, SessionObject, SessionSnapshot, SubAgentSummary } from "./types.ts"
2
2
 
3
3
  export function mainSessionHasStats(main: SessionSnapshot): boolean {
4
4
  return (
@@ -14,6 +14,21 @@ export function emptySessionSnapshot(): SessionSnapshot {
14
14
  return { model: "", providerID: "", input: 0, output: 0, reasoning: 0, cacheRead: 0, cacheWrite: 0, cost: 0 }
15
15
  }
16
16
 
17
+ export function aggregateFromSessionObject(session: SessionObject): SessionSnapshot {
18
+ const t = session.tokens
19
+ const c = t?.cache
20
+ return {
21
+ model: session.model?.id ?? "",
22
+ providerID: session.model?.providerID ?? "",
23
+ input: t?.input ?? 0,
24
+ output: t?.output ?? 0,
25
+ reasoning: t?.reasoning ?? 0,
26
+ cacheRead: c?.read ?? 0,
27
+ cacheWrite: c?.write ?? 0,
28
+ cost: session.cost ?? 0,
29
+ }
30
+ }
31
+
17
32
  export function aggregateSessionFromMessages(messages: readonly AssistantMessage[]): SessionSnapshot {
18
33
  let model = "",
19
34
  providerID = "",
@@ -81,6 +96,31 @@ export function subAgentHasStats(snap: SessionSnapshot): boolean {
81
96
  )
82
97
  }
83
98
 
99
+ /**
100
+ * Fill missing model / providerID from the last assistant message.
101
+ * Session aggregates may have cost/tokens but lack model metadata;
102
+ * this avoids losing pricing/display when session.get() is used.
103
+ */
104
+ export function withModelFallback(
105
+ snap: SessionSnapshot,
106
+ messages: readonly AssistantMessage[],
107
+ ): SessionSnapshot {
108
+ if (snap.model && snap.providerID) return snap
109
+
110
+ let model = snap.model
111
+ let providerID = snap.providerID
112
+ for (let i = messages.length - 1; i >= 0; i--) {
113
+ const m = messages[i]
114
+ if (m.role !== "assistant") continue
115
+ if (!model && m.modelID) model = m.modelID
116
+ if (!providerID && m.providerID) providerID = m.providerID
117
+ if (model && providerID) break
118
+ }
119
+ return model === snap.model && providerID === snap.providerID
120
+ ? snap
121
+ : { ...snap, model, providerID }
122
+ }
123
+
84
124
  export function sidebarShouldShow(
85
125
  main: SessionSnapshot,
86
126
  subs: readonly SubAgentSummary[],