@qthinker/opencode-deepseek-search 0.1.1 → 0.2.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/src/usage.ts CHANGED
@@ -114,3 +114,22 @@ export function formatUsage(ledger: UsageLedger, pricePerThousand: number, mode:
114
114
  "说明:空结果与失败请求不计费;DeepSeek 以账号侧账单为准,本统计不含其他机器或其他工具的调用。",
115
115
  ].join("\n")
116
116
  }
117
+
118
+ /**
119
+ * Compact one-line summaries for a status display, keyed by period. Callers add
120
+ * the 今日/本月/累计 labels themselves. Costs are read from the ledger, which
121
+ * already accumulated them at tally time.
122
+ */
123
+ export function usageSummaryLines(
124
+ ledger: UsageLedger,
125
+ today = dayKey(),
126
+ ): { today: string; month: string; total: string } {
127
+ const month = today.slice(0, 7)
128
+ const line = (d: UsageDay) =>
129
+ `搜索 ${d.search} · 抓取 ${d.fetch} · 空/失 ${d.empty + d.failed} · ${formatYuan(d.costMicro)}`
130
+ return {
131
+ today: line(sumDays(ledger, (k) => k === today)),
132
+ month: line(sumDays(ledger, (k) => k.startsWith(month))),
133
+ total: line(sumDays(ledger, () => true)),
134
+ }
135
+ }
package/tui.ts ADDED
@@ -0,0 +1,6 @@
1
+ // TUI entrypoint. OpenCode resolves a configured plugin *directory* by its root
2
+ // conventional file names (`tui` for the TUI half), so this re-export keeps the
3
+ // TUI half loadable without a package `exports` map (a `name`+`exports`
4
+ // manifest switches resolution to the package name, which OpenCode drops when
5
+ // the result falls outside the directory).
6
+ export { default } from "./src/tui/main.ts"