opencode-deepseek-peak 0.1.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.
package/README.md CHANGED
@@ -19,11 +19,18 @@ the source unless DeepSeek or a local proxy returns one of:
19
19
  When such a header exists, it becomes the source of truth and the indicator
20
20
  marks disagreements with `⚠`.
21
21
 
22
+ The sidebar evidence also names the next schedule change, for example
23
+ `Official schedule · ▼ 07:00` in your local time (`10:00 UTC` when the timezone
24
+ setting is UTC): `▲` means peak starts, `▼` means peak ends, and the weekday is
25
+ added when the change lands on another day. The line never wraps and refreshes
26
+ itself while the session is idle. The `/deepseek-peak` dialog lists the full
27
+ peak windows.
28
+
22
29
  ## Commands
23
30
 
24
31
  - `/deepseek-peak` — show the last observed status and evidence.
25
32
  - `/deepseek-peak-sections` — toggle toast, footer indicator, sidebar indicator,
26
- sidebar evidence, and toast frequency.
33
+ sidebar evidence, toast frequency, timezone (local or UTC), and language.
27
34
  - `/deepseek-peak-lang` — switch the display language.
28
35
 
29
36
  ## Language
@@ -43,8 +50,9 @@ npm install -g opencode-deepseek-peak
43
50
  opencode-deepseek-peak
44
51
  ```
45
52
 
46
- The installer adds the package to the OpenCode server and CLI configurations,
47
- preserving existing settings. Restart OpenCode after installation.
53
+ The installer adds the package to the OpenCode server and CLI configurations as
54
+ well as `tui.json(c)` for OpenCode V1, preserving existing settings. Restart
55
+ OpenCode after installation.
48
56
 
49
57
  For manual configuration, add the package to both plugin lists:
50
58
 
@@ -69,6 +77,22 @@ Optional server settings:
69
77
  }
70
78
  ```
71
79
 
80
+ ## OpenCode V1
81
+
82
+ OpenCode V1 loads TUI plugins from `tui.json` (`plugin` list) and has no
83
+ server-side plugin hooks, so the V1 build computes the official schedule
84
+ locally: sidebar and prompt-right indicators, commands, toast on period
85
+ change, settings, and i18n all work. Only the API response header source of
86
+ truth is unavailable there.
87
+
88
+ ```jsonc
89
+ // ~/.config/opencode/tui.jsonc
90
+ {
91
+ "$schema": "https://opencode.ai/tui.json",
92
+ "plugin": ["opencode-deepseek-peak"]
93
+ }
94
+ ```
95
+
72
96
  ## Development
73
97
 
74
98
  ```sh
package/dist/index.js CHANGED
@@ -47222,32 +47222,35 @@ var index_default = Plugin.define({
47222
47222
  const status = statuses.get(sessionID);
47223
47223
  return status ? { found: true, status } : { found: false };
47224
47224
  },
47225
- // Lets the TUI show the current period as soon as a session opens with a
47226
- // DeepSeek model selected, without waiting for the first request.
47225
+ // Re-synthesizes the current period on every call so an idle TUI can
47226
+ // refresh itself without waiting for a request. A recent API header
47227
+ // still wins over the official schedule.
47227
47228
  preview: async (input) => {
47228
47229
  const { sessionID } = input;
47229
- const observed = statuses.get(sessionID);
47230
- if (observed) return { found: true, status: observed };
47231
47230
  try {
47232
47231
  const session = await context.session.get({ sessionID });
47233
47232
  const model = session.model;
47234
47233
  if (!model || !isDeepSeek(model.providerID)) return { found: false };
47235
- const schedule = scheduleInfo(/* @__PURE__ */ new Date());
47236
- const evidence = schedule.holiday ? `Chinese public holiday: ${schedule.holiday} (no request observed yet)` : "Current schedule (no request observed yet)";
47234
+ const observed = statuses.get(sessionID);
47235
+ const now = Date.now();
47236
+ const schedule = scheduleInfo(new Date(now));
47237
+ const cached = apiSignals.get(modelKey(model.providerID, model.id));
47238
+ const api = cached && now - cached.observedAt <= apiSignalTtlMs ? cached : void 0;
47239
+ const evidence = api ? `${api.evidence} (cached)` : schedule.holiday ? `Chinese public holiday: ${schedule.holiday}${observed ? "" : " (no request observed yet)"}` : observed ? "DeepSeek official UTC pricing schedule" : "Current schedule (no request observed yet)";
47237
47240
  return {
47238
47241
  found: true,
47239
47242
  status: {
47240
47243
  sessionID,
47241
47244
  providerID: model.providerID,
47242
47245
  modelID: model.id,
47243
- period: schedule.period,
47246
+ period: api?.period ?? schedule.period,
47244
47247
  scheduledPeriod: schedule.period,
47245
- source: "official-schedule",
47246
- phase: "request",
47247
- mismatch: false,
47248
- observedAt: Date.now(),
47248
+ source: api ? "api-header" : "official-schedule",
47249
+ phase: observed?.phase ?? "request",
47250
+ mismatch: api ? api.period !== schedule.period : false,
47251
+ observedAt: now,
47249
47252
  evidence,
47250
- holiday: schedule.holiday
47253
+ ...schedule.holiday !== void 0 ? { holiday: schedule.holiday } : {}
47251
47254
  }
47252
47255
  };
47253
47256
  } catch {
@@ -47278,7 +47281,7 @@ var index_default = Plugin.define({
47278
47281
  mismatch: api ? api.period !== schedule.period : false,
47279
47282
  observedAt: now,
47280
47283
  evidence: api ? `${api.evidence} (cached)` : schedule.holiday ? `Chinese public holiday: ${schedule.holiday}` : "DeepSeek official UTC pricing schedule",
47281
- holiday: schedule.holiday
47284
+ ...schedule.holiday !== void 0 ? { holiday: schedule.holiday } : {}
47282
47285
  });
47283
47286
  });
47284
47287
  const stopResponse = await context.session.hook("http.response", async (event) => {
@@ -47302,7 +47305,7 @@ var index_default = Plugin.define({
47302
47305
  mismatch: api.period !== schedule.period,
47303
47306
  observedAt: now,
47304
47307
  evidence: api.evidence,
47305
- holiday: schedule.holiday
47308
+ ...schedule.holiday !== void 0 ? { holiday: schedule.holiday } : {}
47306
47309
  });
47307
47310
  });
47308
47311
  return async () => {