opencode-peak-badge 0.5.0 → 0.6.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/README.md +93 -88
- package/dist/core.d.ts +3 -9
- package/dist/gui-experimental.cjs +2 -2
- package/dist/rpc.d.ts +298 -0
- package/dist/server.js +143 -2
- package/dist/server.js.map +7 -4
- package/dist/settings-client.d.ts +29 -0
- package/dist/settings.d.ts +65 -0
- package/dist/tui-settings.d.ts +15 -0
- package/dist/tui.d.ts +1 -0
- package/dist/tui.js +743 -25
- package/dist/tui.js.map +9 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,16 +7,19 @@
|
|
|
7
7
|
|
|
8
8
|
`[PEAK]` / `[OFF-PEAK]` badge for OpenCode TUI and OpenCode Desktop. It follows
|
|
9
9
|
the active model's configured peak-hour rules; running subagents are included and
|
|
10
|
-
peak wins.
|
|
10
|
+
peak wins. Settings are stored by the plugin's server and shared by both
|
|
11
|
+
surfaces; changes apply live.
|
|
11
12
|
|
|
12
|
-

|
|
13
14
|
|
|
14
15
|
## Features
|
|
15
16
|
|
|
16
17
|
- TUI: footer badge for the session (`prompt.footer.status`) and Home
|
|
17
|
-
(`home.footer.status`).
|
|
18
|
-
- Desktop: header chip for the session (`session.header`)
|
|
19
|
-
|
|
18
|
+
(`home.footer.status`), plus a `/peak-badge` settings editor.
|
|
19
|
+
- Desktop: header chip for the session (`session.header`), status strip on Home
|
|
20
|
+
(`window.bottom`) and a **Settings → Peak Badge** page.
|
|
21
|
+
- Shared settings: the TUI and Desktop read and write the same server-stored
|
|
22
|
+
object; an edit in either client updates the other.
|
|
20
23
|
- Provider-agnostic; built-in rules cover DeepSeek models.
|
|
21
24
|
- Tracks running subagent sessions; if any is peak, the parent shows `[PEAK]`.
|
|
22
25
|
- Configurable models, UTC windows, labels, polling and fallback (`alwaysShow`).
|
|
@@ -45,27 +48,13 @@ Manual alternative:
|
|
|
45
48
|
}
|
|
46
49
|
```
|
|
47
50
|
|
|
48
|
-
|
|
51
|
+
Settings are edited in the app, not in `opencode.json(c)`. Keep the package entry
|
|
52
|
+
as a string; the object form with `options` is no longer read (see
|
|
53
|
+
[Breaking change](#breaking-change-in-060)).
|
|
49
54
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"plugins": [
|
|
54
|
-
{ "package": "opencode-peak-badge", "options": { "pollSeconds": 30 } }
|
|
55
|
-
]
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
**TUI-only:** add the package to `~/.config/opencode/cli.json`:
|
|
60
|
-
|
|
61
|
-
```jsonc
|
|
62
|
-
{
|
|
63
|
-
"plugins": ["opencode-peak-badge"]
|
|
64
|
-
}
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
Desktop reads only `opencode.json(c)`, not `cli.json`. Use one
|
|
68
|
-
`opencode.json(c)` entry for both, and remove duplicates from `cli.json`.
|
|
55
|
+
Keep the package in `opencode.json(c)`, not only in `cli.json`: the TUI loads its
|
|
56
|
+
part from the connected server, and the shared settings need the plugin's server
|
|
57
|
+
part. `cli.json` is only for TUI-only plugins.
|
|
69
58
|
|
|
70
59
|
OpenCode reloads plugins when config changes; `/reload` forces a full reload. A
|
|
71
60
|
package update may need a client restart (Desktop loads the GUI bundle from the
|
|
@@ -85,10 +74,15 @@ footer badge, or the Desktop header chip. To force a state, see
|
|
|
85
74
|
- **Home / draft:** `window.bottom` strip shown while no session is routed. It
|
|
86
75
|
uses `client.model.default()`; it may lag behind the Home picker until a session
|
|
87
76
|
starts.
|
|
77
|
+
- The peak state is orange on both surfaces. The shade follows the active
|
|
78
|
+
light/dark theme so the label keeps AA contrast on the default surfaces.
|
|
88
79
|
- The parent session chip aggregates running subagents. A subagent's own header
|
|
89
80
|
follows that subagent's model.
|
|
81
|
+
- **Settings → Peak Badge** edits the shared settings.
|
|
90
82
|
- Settings → Extensions → Plugins can disable the GUI.
|
|
91
83
|
|
|
84
|
+

|
|
85
|
+
|
|
92
86
|
### OpenCode V1 (legacy)
|
|
93
87
|
|
|
94
88
|
`0.3.0` is the last V1-compatible release; npm `latest` is V2. Pin it:
|
|
@@ -103,71 +97,83 @@ Or in `~/.config/opencode/tui.json`:
|
|
|
103
97
|
{ "plugin": ["opencode-peak-badge@opencode-v1"] }
|
|
104
98
|
```
|
|
105
99
|
|
|
106
|
-
##
|
|
100
|
+
## Settings
|
|
107
101
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
"weekdaysOnly": true,
|
|
122
|
-
"pollSeconds": 10
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
]
|
|
126
|
-
}
|
|
127
|
-
```
|
|
102
|
+
Settings live on the server in the plugin's storage (KV) and are shared by every
|
|
103
|
+
TUI and Desktop window connected to that server. Changes apply live: a save in
|
|
104
|
+
the Desktop updates the TUI badge, and a save in the TUI updates the Desktop.
|
|
105
|
+
|
|
106
|
+
- **Desktop:** Settings → Peak Badge.
|
|
107
|
+
- **TUI:** command palette → **Peak Badge settings**, or `/peak-badge`
|
|
108
|
+
(`/peakbadge` also works).
|
|
109
|
+
|
|
110
|
+
The TUI has no plugin settings page in its native Settings screen; the command
|
|
111
|
+
opens the host's select/prompt/confirm dialogs. Both editors change the same
|
|
112
|
+
object.
|
|
113
|
+
|
|
114
|
+

|
|
128
115
|
|
|
129
|
-
###
|
|
116
|
+
### Defaults
|
|
130
117
|
|
|
131
|
-
|
|
|
118
|
+
| Setting | Default | Description |
|
|
132
119
|
|---|---|---|
|
|
133
|
-
| `models` | DeepSeek patterns | Rules to track.
|
|
134
|
-
| `windows` | `[["01:00","04:00"],["06:00","10:00"]]` | Peak windows in UTC. Each is `["HH:MM","HH:MM"]`, half-open; end ≤ start wraps midnight. An empty
|
|
120
|
+
| `models` | DeepSeek patterns | Rules to track. One entry per row: exact `provider/model`, `re:<regex>`, or a JSON object. Replaces the defaults; an empty list tracks nothing. |
|
|
121
|
+
| `windows` | `[["01:00","04:00"],["06:00","10:00"]]` | Peak windows in UTC. Each is `["HH:MM","HH:MM"]`, half-open; end ≤ start wraps midnight. An empty list means no peak windows. |
|
|
135
122
|
| `weekdaysOnly` | `true` | Weekends are always off-peak. |
|
|
136
123
|
| `pollSeconds` | `10` | Recompute interval (minimum 1). Live events also trigger updates. |
|
|
137
|
-
| `fakeTime` | unset | Fixed ISO timestamp for testing. Overrides `OPENCODE_PEAK_HOURS_FAKE_TIME` in the TUI and works in Desktop. |
|
|
138
|
-
| `subagents` | `true` | Include running subagent sessions; peak wins. |
|
|
139
|
-
| `alwaysShow` | `false` | Show the main model even without a matching rule, using the top-level windows. |
|
|
140
124
|
| `labelPeak` | `"[PEAK]"` | Peak label. |
|
|
141
125
|
| `labelOffPeak` | `"[OFF-PEAK]"` | Off-peak label. |
|
|
126
|
+
| `subagents` | `true` | Include running subagent sessions; peak wins. |
|
|
127
|
+
| `alwaysShow` | `false` | Show the main model even without a matching rule, using the top-level windows. |
|
|
142
128
|
| `debug` | `false` | Append the detected `provider/model` to the badge. |
|
|
129
|
+
| `fakeTime` | unset | Fixed ISO timestamp for testing. Empty uses the real clock. |
|
|
143
130
|
|
|
144
|
-
|
|
145
|
-
empty array tracks nothing.
|
|
131
|
+
**Reset to defaults** restores this table for both surfaces.
|
|
146
132
|
|
|
147
133
|
### Model matching
|
|
148
134
|
|
|
149
135
|
- Exact `provider/model`, case-insensitive.
|
|
150
136
|
- `re:<pattern>` regex, case-insensitive.
|
|
151
|
-
-
|
|
137
|
+
- JSON object for per-model overrides: `{ "id": "provider/model", "windows": [...], "weekdaysOnly": false }`, or the same with `pattern` instead of `id`.
|
|
152
138
|
- Exact entries beat regex patterns; otherwise the first match wins. Invalid
|
|
153
139
|
patterns are ignored.
|
|
154
|
-
- JSON escapes backslashes: use `"re:^opencode-go/deepseek\\.v4"
|
|
140
|
+
- JSON escapes backslashes: use `"re:^opencode-go/deepseek\\.v4"` inside the object
|
|
141
|
+
text. Plain regex rows do not need JSON escaping.
|
|
155
142
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
143
|
+
The shared models setting stores one raw line per entry. Both the Desktop and
|
|
144
|
+
TUI editors show and edit that list:
|
|
145
|
+
|
|
146
|
+
```text
|
|
147
|
+
opencode-go/deepseek-v4-flash
|
|
148
|
+
re:^opencode/deepseek
|
|
149
|
+
{"pattern":"^my-provider/.*$","windows":[["09:00","17:00"]],"weekdaysOnly":false}
|
|
162
150
|
```
|
|
163
151
|
|
|
152
|
+
### Scope
|
|
153
|
+
|
|
154
|
+
- Settings are **per server**. A TUI connected to a different server sees that
|
|
155
|
+
server's settings.
|
|
156
|
+
- Removing the plugin leaves the stored settings in the server's KV; reset them
|
|
157
|
+
before uninstalling if you want a clean slate.
|
|
158
|
+
- If the server is unreachable, clients keep the last known settings (or the
|
|
159
|
+
defaults). The Desktop page shows a connection warning with a Retry action.
|
|
160
|
+
|
|
161
|
+
### Breaking change in 0.6.0
|
|
162
|
+
|
|
163
|
+
Plugin `options` in `opencode.json(c)` are no longer read, and there is no
|
|
164
|
+
migration. Re-enter any customization in Settings → Peak Badge or `/peak-badge`.
|
|
165
|
+
The `fakeTime` option is replaced by the `fakeTime` setting; the
|
|
166
|
+
`OPENCODE_PEAK_HOURS_FAKE_TIME` environment variable remains a TUI-only test
|
|
167
|
+
override.
|
|
168
|
+
|
|
164
169
|
## Behavior
|
|
165
170
|
|
|
166
171
|
- **TUI model source:** committed session model, plus the uncommitted picker
|
|
167
172
|
selection from `$XDG_STATE_HOME/opencode/model.json`. A committed model wins;
|
|
168
173
|
Home uses the pick, then `client.model.default()`.
|
|
169
174
|
- **Subagents:** running descendants from `data.session.family()`; peak wins.
|
|
170
|
-
`subagents
|
|
175
|
+
Setting `subagents` to false ignores them; `alwaysShow` only affects the main
|
|
176
|
+
model.
|
|
171
177
|
- **Peak hours:** UTC defaults are Mon–Fri 01:00–04:00 and 06:00–10:00, weekends
|
|
172
178
|
off-peak. Defaults cover DeepSeek on OpenCode Go, OpenCode Zen and the DeepSeek
|
|
173
179
|
direct API; add rules for any other provider/model.
|
|
@@ -176,28 +182,22 @@ empty array tracks nothing.
|
|
|
176
182
|
|
|
177
183
|
## Evaluation
|
|
178
184
|
|
|
179
|
-
|
|
185
|
+
Set **Fake time** in Settings → Peak Badge (Desktop) or `/peak-badge` (TUI):
|
|
180
186
|
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
|
|
187
|
+
```text
|
|
188
|
+
2026-09-07T08:30:00Z # peak
|
|
189
|
+
2026-09-07T12:00:00Z # off-peak
|
|
184
190
|
```
|
|
185
191
|
|
|
186
|
-
|
|
187
|
-
the environment variable:
|
|
192
|
+
Clear it to return to the real clock.
|
|
188
193
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
"plugins": [
|
|
192
|
-
{
|
|
193
|
-
"package": "opencode-peak-badge",
|
|
194
|
-
"options": { "fakeTime": "2026-09-07T08:30:00Z" }
|
|
195
|
-
}
|
|
196
|
-
]
|
|
197
|
-
}
|
|
198
|
-
```
|
|
194
|
+
For a one-off TUI launch, the environment variable still overrides the shared
|
|
195
|
+
`fakeTime` setting in the TUI:
|
|
199
196
|
|
|
200
|
-
|
|
197
|
+
```sh
|
|
198
|
+
OPENCODE_PEAK_HOURS_FAKE_TIME=2026-09-07T08:30:00Z opencode # peak
|
|
199
|
+
OPENCODE_PEAK_HOURS_FAKE_TIME=2026-09-07T12:00:00Z opencode # off-peak
|
|
200
|
+
```
|
|
201
201
|
|
|
202
202
|
## Uninstall
|
|
203
203
|
|
|
@@ -206,27 +206,32 @@ opencode plugin remove opencode-peak-badge
|
|
|
206
206
|
```
|
|
207
207
|
|
|
208
208
|
Or remove the entry from `opencode.jsonc` / `cli.json`. Desktop only reads
|
|
209
|
-
`opencode.json(c)`.
|
|
209
|
+
`opencode.json(c)`. Server-stored settings remain in the plugin's KV; reset them
|
|
210
|
+
before removing the plugin if desired.
|
|
210
211
|
|
|
211
212
|
## Development
|
|
212
213
|
|
|
213
214
|
```sh
|
|
214
215
|
bun install
|
|
215
216
|
bun run typecheck # TUI + GUI TypeScript configs
|
|
216
|
-
bun test # core
|
|
217
|
+
bun test # core, settings, server RPC and mocked TUI tests
|
|
217
218
|
bun run build # dist/tui.js, dist/server.js, dist/gui-experimental.cjs
|
|
218
219
|
```
|
|
219
220
|
|
|
220
221
|
Local development: build, add the absolute repository directory to
|
|
221
222
|
`opencode.json(c)`, then reload. A local directory with `name` and `exports`
|
|
222
223
|
resolves `./tui`, `.` (server) and `./gui-experimental`; Desktop needs
|
|
223
|
-
`dist/gui-experimental.cjs`.
|
|
224
|
-
|
|
224
|
+
`dist/gui-experimental.cjs`. A TUI-only local entry has no server part, so it
|
|
225
|
+
uses the defaults and the `/peak-badge` editor cannot persist changes.
|
|
225
226
|
|
|
226
227
|
- `src/core.ts` — pure rules, badge/subagent resolution and the fake-time clock.
|
|
227
|
-
- `src/
|
|
228
|
-
- `src/
|
|
229
|
-
- `src/server.ts` —
|
|
228
|
+
- `src/settings.ts` — shared settings model, defaults, validation and normalization.
|
|
229
|
+
- `src/rpc.ts` — RPC contract between the server and both clients.
|
|
230
|
+
- `src/server.ts` — server part: stores settings and exposes `get`/`set`/`reset`.
|
|
231
|
+
- `src/index.tsx` — TUI part (`id: peak-badge`) and `/peak-badge` command.
|
|
232
|
+
- `src/tui-settings.ts` — TUI dialog editor.
|
|
233
|
+
- `src/gui.tsx` — Desktop part (`session.header` chip + `window.bottom` + settings page).
|
|
234
|
+
- `src/settings-page.tsx` — Desktop settings page.
|
|
230
235
|
- `scripts/build.ts` — TUI and server bundles; `vite.config.ts` — GUI CJS bundle.
|
|
231
236
|
|
|
232
237
|
Release check: `npm pack --dry-run`. The package must include `dist/tui.js`,
|
package/dist/core.d.ts
CHANGED
|
@@ -13,17 +13,10 @@ export type ModelEntryObject = {
|
|
|
13
13
|
weekdaysOnly?: boolean;
|
|
14
14
|
};
|
|
15
15
|
export type ModelEntrySpec = string | ModelEntryObject;
|
|
16
|
-
export type
|
|
16
|
+
export type RuleOptions = {
|
|
17
17
|
models?: ModelEntrySpec[];
|
|
18
18
|
windows?: WindowSpec[];
|
|
19
19
|
weekdaysOnly?: boolean;
|
|
20
|
-
pollSeconds?: number;
|
|
21
|
-
fakeTime?: string;
|
|
22
|
-
labelPeak?: string;
|
|
23
|
-
labelOffPeak?: string;
|
|
24
|
-
subagents?: boolean;
|
|
25
|
-
alwaysShow?: boolean;
|
|
26
|
-
debug?: boolean;
|
|
27
20
|
};
|
|
28
21
|
export type ResolvedModelRule = {
|
|
29
22
|
id: string;
|
|
@@ -53,7 +46,8 @@ export declare function parseWindows(specs: readonly WindowSpec[]): MinuteWindow
|
|
|
53
46
|
export declare function inWindow(minutes: number, window: MinuteWindow): boolean;
|
|
54
47
|
export declare function isPeakUtc(now: Date, windows: readonly MinuteWindow[], weekdaysOnly?: boolean): boolean;
|
|
55
48
|
export declare function modelKey(providerID: string, modelID: string): string;
|
|
56
|
-
export declare function resolveRules(options?:
|
|
49
|
+
export declare function resolveRules(options?: RuleOptions): RuleSet;
|
|
50
|
+
export declare function isValidModelEntry(entry: ModelEntrySpec): boolean;
|
|
57
51
|
export declare function matchRule(rules: RuleSet, key: string): ResolvedModelRule | undefined;
|
|
58
52
|
export declare function badgeFor(now: Date, rule: ResolvedModelRule | undefined, labels: {
|
|
59
53
|
peak: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("solid-js/web"),v=require("@opencode/plugin/gui"),g=require("solid-js"),j=[["01:00","04:00"],["06:00","10:00"]],V=["re:^opencode-go/deepseek","re:^opencode/deepseek","re:^deepseek/deepseek"];function I(e,t=new Date){if(e){const n=new Date(e);if(!Number.isNaN(n.getTime()))return n}return t}function O(e){const t=/^(\d{1,2}):(\d{2})$/.exec(e.trim());if(!t)return;const n=Number(t[1]),o=Number(t[2]);if(!(n>23||o>59))return n*60+o}function J(e){const t=O(e[0]),n=O(e[1]);if(!(t===void 0||n===void 0))return{start:t,end:n}}function k(e){const t=[];for(const n of e){const o=J(n);o&&t.push(o)}return t}function G(e,t){return t.end<=t.start?e>=t.start||e<t.end:e>=t.start&&e<t.end}function Q(e,t,n=!0){if(n){const i=e.getUTCDay();if(i===0||i===6)return!1}const o=e.getUTCHours()*60+e.getUTCMinutes();return t.some(i=>G(o,i))}function T(e,t){return`${e}/${t}`.trim().toLowerCase()}function P(e,t,n,o){return{id:e,windows:t.windows?.length?k(t.windows):n,weekdaysOnly:t.weekdaysOnly??o}}function X(e={}){const t=k(e.windows??j),n=e.weekdaysOnly??!0,o=e.models??V,i=new Map,w=[];for(const f of o)if(typeof f=="string"){const c=f.trim();if(!c)continue;if(c.toLowerCase().startsWith("re:")){const m=c.slice(3);if(!m.trim())continue;const h=$(m);if(!h)continue;w.push({id:m,regex:h,windows:t,weekdaysOnly:n})}else{const m=c.toLowerCase();i.set(m,P(m,{},t,n))}}else if("pattern"in f){const c=f.pattern;if(!c.trim())continue;const m=$(c);if(!m)continue;w.push({id:c,regex:m,windows:f.windows?.length?k(f.windows):t,weekdaysOnly:f.weekdaysOnly??n})}else{const c=f.id.trim().toLowerCase();if(!c)continue;i.set(c,P(c,f,t,n))}return{exact:i,patterns:w,fallback:{id:"",windows:t,weekdaysOnly:n}}}function Y(e){let t=0,n=!1;for(let o=0;o<e.length;o++){const i=e[o];if(i==="\\"){o++;continue}if(i==="["){n=!0;continue}if(i==="]"){n=!1;continue}if(!n){if(i==="(")t++;else if(i===")")t=Math.max(0,t-1);else if(t>0&&"+*}".includes(i))return!1}}return!0}function $(e){try{return Y(e)?new RegExp(e,"i"):void 0}catch{return}}function N(e,t){const n=e.exact.get(t);if(n)return n;for(const o of e.patterns)if(o.regex.test(t))return o}function R(e,t,n){if(!t)return;const o=Q(e,t.windows,t.weekdaysOnly);return{label:o?n.peak:n.offPeak,peak:o}}function Z(e){let t;for(const n of e)if(n){if(!t){t=n;continue}n.peak&&!t.peak&&(t=n)}return t}function W(e){const t=[];if(e.main){const n=N(e.rules,T(e.main.providerID,e.main.id))??(e.alwaysShow?e.rules.fallback:void 0),o=R(e.now,n,e.labels);o&&t.push(o)}for(const n of e.subagents){const o=R(e.now,N(e.rules,T(n.providerID,n.id)),e.labels);o&&t.push(o)}return Z(t)}function ee(e){const t=[],n=new Set,o=[...e.family(e.sessionID)];for(;o.length>0;){const i=o.pop();if(!(!i||n.has(i))){if(n.add(i),e.status(i)==="running"){const w=e.model(i);w&&t.push(w)}for(const w of e.family(i))n.has(w)||o.push(w)}}return t}var L=a.template("<span>");const te={display:"inline-flex","align-items":"center",gap:"4px","font-size":"11px","font-weight":"600","letter-spacing":"0.02em","white-space":"nowrap"};function b(e){return e?.providerID&&e.id?{providerID:e.providerID,id:e.id}:void 0}function ne(e){return e?{providerID:e.providerID,id:e.modelID}:void 0}const se=v.Plugin.define({setup(e){const t=e.options??{},n=X(t),o={peak:t.labelPeak??"[PEAK]",offPeak:t.labelOffPeak??"[OFF-PEAK]"},i=Math.max(1,Number(t.pollSeconds)||10),w=t.subagents??!0,f=t.alwaysShow??!1,c=t.debug??!1,m=typeof t.fakeTime=="string"?t.fakeTime:void 0,[h,x]=g.createSignal(I(m).getTime()),[A,E]=g.createSignal(void 0),p=new Set;function S(s,r,d){p.has(r)||(p.add(r),s.sync(d).catch(()=>p.delete(r)))}function D(s){const r=c&&s.model?`${s.model.providerID}/${s.model.id}`:"";return[s.state?.label??"",r].filter(Boolean).join(" ")}function F(s){const r=s.active===!1?void 0:ne(s.screen.composer.model());if(r)return r;const d=s.session.server.data.session,l=b(d.get(s.session.id)?.model);return l||S(d,s.session.key,s.session.id),l}function U(s,r){const d=s.session.server.data.session,l=b(d.get(r)?.model);return l||S(d,`${s.session.server.id}
|
|
2
|
-
${
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("solid-js/web"),w=require("@opencode/plugin/gui"),p=require("solid-js"),me=require("@opencode/plugin/rpc"),ee=[["01:00","04:00"],["06:00","10:00"]],te=["re:^opencode-go/deepseek","re:^opencode/deepseek","re:^deepseek/deepseek"];function $(e,t=new Date){if(e){const n=new Date(e);if(!Number.isNaN(n.getTime()))return n}return t}function D(e){const t=/^(\d{1,2}):(\d{2})$/.exec(e.trim());if(!t)return;const n=Number(t[1]),r=Number(t[2]);if(!(n>23||r>59))return n*60+r}function we(e){const t=D(e[0]),n=D(e[1]);if(!(t===void 0||n===void 0))return{start:t,end:n}}function x(e){const t=[];for(const n of e){const r=we(n);r&&t.push(r)}return t}function he(e,t){return t.end<=t.start?e>=t.start||e<t.end:e>=t.start&&e<t.end}function ye(e,t,n=!0){if(n){const s=e.getUTCDay();if(s===0||s===6)return!1}const r=e.getUTCHours()*60+e.getUTCMinutes();return t.some(s=>he(r,s))}function j(e,t){return`${e}/${t}`.trim().toLowerCase()}function V(e,t,n,r){return{id:e,windows:t.windows?.length?x(t.windows):n,weekdaysOnly:t.weekdaysOnly??r}}function ne(e={}){const t=x(e.windows??ee),n=e.weekdaysOnly??!0,r=e.models??te,s=new Map,l=[];for(const f of r)if(typeof f=="string"){const g=f.trim();if(!g)continue;if(g.toLowerCase().startsWith("re:")){const d=g.slice(3);if(!d.trim())continue;const a=J(d);if(!a)continue;l.push({id:d,regex:a,windows:t,weekdaysOnly:n})}else{const d=g.toLowerCase();s.set(d,V(d,{},t,n))}}else if("pattern"in f){const g=f.pattern;if(!g.trim())continue;const d=J(g);if(!d)continue;l.push({id:g,regex:d,windows:f.windows?.length?x(f.windows):t,weekdaysOnly:f.weekdaysOnly??n})}else{const g=f.id.trim().toLowerCase();if(!g)continue;s.set(g,V(g,f,t,n))}return{exact:s,patterns:l,fallback:{id:"",windows:t,weekdaysOnly:n}}}function be(e){const t=ne({models:[e]});return t.exact.size>0||t.patterns.length>0}function ke(e){let t=0,n=!1;for(let r=0;r<e.length;r++){const s=e[r];if(s==="\\"){r++;continue}if(s==="["){n=!0;continue}if(s==="]"){n=!1;continue}if(!n){if(s==="(")t++;else if(s===")")t=Math.max(0,t-1);else if(t>0&&"+*}".includes(s))return!1}}return!0}function J(e){try{return ke(e)?new RegExp(e,"i"):void 0}catch{return}}function q(e,t){const n=e.exact.get(t);if(n)return n;for(const r of e.patterns)if(r.regex.test(t))return r}function G(e,t,n){if(!t)return;const r=ye(e,t.windows,t.weekdaysOnly);return{label:r?n.peak:n.offPeak,peak:r}}function ve(e){let t;for(const n of e)if(n){if(!t){t=n;continue}n.peak&&!t.peak&&(t=n)}return t}function Z(e){const t=[];if(e.main){const n=q(e.rules,j(e.main.providerID,e.main.id))??(e.alwaysShow?e.rules.fallback:void 0),r=G(e.now,n,e.labels);r&&t.push(r)}for(const n of e.subagents){const r=G(e.now,q(e.rules,j(n.providerID,n.id)),e.labels);r&&t.push(r)}return ve(t)}function Se(e){const t=[],n=new Set,r=[...e.family(e.sessionID)];for(;r.length>0;){const s=r.pop();if(!(!s||n.has(s))){if(n.add(s),e.status(s)==="running"){const l=e.model(s);l&&t.push(l)}for(const l of e.family(s))n.has(l)||r.push(l)}}return t}const Ce={type:"object",properties:{models:{type:"array",items:{type:"string"}},windows:{type:"array",items:{type:"array",items:{type:"string"},minItems:2,maxItems:2}},weekdaysOnly:{type:"boolean"},pollSeconds:{type:"string"},labelPeak:{type:"string"},labelOffPeak:{type:"string"},subagents:{type:"boolean"},alwaysShow:{type:"boolean"},debug:{type:"boolean"},fakeTime:{type:"string"}},additionalProperties:!1},P={type:"object",properties:{settings:Ce},required:["settings"],additionalProperties:!1},Q={type:"object",additionalProperties:!1},Pe=me.Rpc.define({id:"peak-badge.settings",methods:{get:{input:Q,output:P},set:{input:P,output:P},reset:{input:Q,output:P}},events:{updated:{schema:P}}}),ie=10,E={models:Re(te),windows:ee.map(([e,t])=>[e,t]),weekdaysOnly:!0,pollSeconds:String(ie),labelPeak:"[PEAK]",labelOffPeak:"[OFF-PEAK]",subagents:!0,alwaysShow:!1,debug:!1,fakeTime:""};function Oe(){return{...E,models:[...E.models],windows:E.windows.map(([e,t])=>[e,t])}}function L(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Te(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="string"&&typeof e[1]=="string"}function re(e){return Array.isArray(e)&&e.every(Te)}function C(e){const t=Oe();return L(e)&&(Array.isArray(e.models)&&e.models.every(n=>typeof n=="string")&&(t.models=[...e.models]),re(e.windows)&&(t.windows=e.windows.map(([n,r])=>[n,r])),typeof e.weekdaysOnly=="boolean"&&(t.weekdaysOnly=e.weekdaysOnly),typeof e.pollSeconds=="string"&&(t.pollSeconds=e.pollSeconds),typeof e.labelPeak=="string"&&(t.labelPeak=e.labelPeak),typeof e.labelOffPeak=="string"&&(t.labelOffPeak=e.labelOffPeak),typeof e.subagents=="boolean"&&(t.subagents=e.subagents),typeof e.alwaysShow=="boolean"&&(t.alwaysShow=e.alwaysShow),typeof e.debug=="boolean"&&(t.debug=e.debug),typeof e.fakeTime=="string"&&(t.fakeTime=e.fakeTime)),t}function O(e){return C(L(e)?e.settings:void 0)}function Ie(e){const t=Number(e.pollSeconds);return{rules:ne({models:Me(e.models),windows:e.windows,weekdaysOnly:e.weekdaysOnly}),labels:{peak:e.labelPeak,offPeak:e.labelOffPeak},pollSeconds:Number.isFinite(t)&&t>=1?t:ie,subagents:e.subagents,alwaysShow:e.alwaysShow,debug:e.debug,fakeTime:e.fakeTime.trim()||void 0}}function Re(e){return e.map(t=>typeof t=="string"?t:JSON.stringify(t))}function oe(e){const t=e.trim();if(!t)return;if(!t.startsWith("{")&&!t.startsWith("["))return t;let n;try{n=JSON.parse(t)}catch{return}if(!L(n))return;const r=typeof n.pattern=="string"&&n.pattern.trim()?n.pattern.trim():void 0,s=typeof n.id=="string"&&n.id.trim()?n.id.trim():void 0;if(!r&&!s)return;let l;if(n.windows!==void 0){if(!re(n.windows))return;l=n.windows.map(([d,a])=>[d,a])}if(n.weekdaysOnly!==void 0&&typeof n.weekdaysOnly!="boolean")return;const f=typeof n.weekdaysOnly=="boolean"?n.weekdaysOnly:void 0;return r?{pattern:r,...l!==void 0?{windows:l}:{},...f!==void 0?{weekdaysOnly:f}:{}}:{id:s,...l!==void 0?{windows:l}:{},...f!==void 0?{weekdaysOnly:f}:{}}}function Me(e){const t=[];for(const n of e){const r=oe(n);r!==void 0&&t.push(r)}return t}function I(e){return D(e)!==void 0}function _e(e){return I(e[0])&&I(e[1])}function $e(e){const t=oe(e);return!(t===void 0||!be(t)||typeof t=="object"&&t.windows&&!t.windows.every(_e))}function Ee(e){const t=Number(e);return e.trim()!==""&&Number.isFinite(t)&&t>=1}function Ae(e){return e.trim()?!Number.isNaN(new Date(e).getTime()):!0}function T(e){return e instanceof Error?e.message:String(e)}function De(e){let t,n=!1;function r(){const d=e.client();if(typeof d.rpc=="function")return d.rpc(Pe)}async function s(d=!1){const a=r();if(a)try{const u=O(await a.get({}));if(n||!d&&e.canApply&&!e.canApply(u))return;e.set(u)}catch(u){n||e.onLoadError?.(T(u))}}function l(){n=!1,t?.(),t=void 0;const d=r();if(d)try{t=d.events.on("updated",a=>{if(n)return;const u=O(a.data);if(e.acceptEvent){if(!e.acceptEvent(u))return}else if(e.canApply&&!e.canApply(u))return;n||e.set(u)})}catch(a){e.onLoadError?.(T(a))}s()}async function f(d){const a=C(d);e.set(a);const u=r();if(u)try{const h=O(await u.set({settings:a}));n||e.set(h)}catch(h){if(n)return;e.onSaveError?.(T(h)),await s(!0)}}async function g(){const d=r();if(!d){e.set(C(void 0));return}try{const a=O(await d.reset({}));n||e.set(a)}catch(a){if(n)return;e.onSaveError?.(T(a)),await s(!0)}}return{connect:l,refresh:s,save:f,reset:g,stop:()=>{n=!0,t?.(),t=void 0}}}var xe=i.template("<div style=display:grid;gap:8px;width:360px;max-width:100%><div>"),Le=i.template("<div style=display:flex;gap:6px;align-items:center><div style=width:88px></div><span>to</span><div style=width:88px>"),We=i.template("<div style=display:grid;gap:8px;width:400px;max-width:100%><div>"),Be=i.template('<div style=display:flex;gap:6px;align-items:center><div style="flex:1 1 auto;min-width:160px;max-width:360px">'),X=i.template("<div style=width:200px>"),Ne=i.template("<div style=width:100px>"),Fe=i.template("<div style=width:280px;max-width:100%>");function Ue(e){const t=w.usePlugin().ui;function n(a){const u={...e.settings()};a(u),e.save(u)}function r(a,u,h){n(y=>{y.windows=y.windows.map((b,R)=>R!==a?b:u===0?[h,b[1]]:[b[0],h])})}function s(){n(a=>{const u=["",""];a.windows=[...a.windows,u]})}function l(a){n(u=>{u.windows=u.windows.filter((h,y)=>y!==a)})}function f(a,u){n(h=>{h.models=h.models.map((y,b)=>b===a?u:y)})}function g(){n(a=>{a.models=[...a.models,""]})}function d(a){n(u=>{u.models=u.models.filter((h,y)=>y!==a)})}return i.createComponent(t.SettingsLayout,{title:"Peak Badge",description:"Shared with the TUI. Settings are stored on this server and apply live.",get children(){return[i.createComponent(He,{get error(){return e.error},get refresh(){return e.refresh}}),i.createComponent(ze,{get settings(){return e.settings},update:n,patchWindow:r,addWindow:s,removeWindow:l}),i.createComponent(Ke,{get settings(){return e.settings},update:n,patchModel:f,addModel:g,removeModel:d}),i.createComponent(je,{get settings(){return e.settings},update:n}),i.createComponent(Ve,{get settings(){return e.settings},update:n}),i.createComponent(Je,{get settings(){return e.settings},update:n}),i.createComponent(qe,{get reset(){return e.reset}})]}})}function He(e){const t=w.usePlugin().ui;return i.createComponent(p.Show,{get when(){return e.error()},children:n=>i.createComponent(t.SettingsSection,{title:"Connection",get children(){return i.createComponent(t.SettingsRow,{title:"Shared settings unavailable",get description(){return n()},get children(){return i.createComponent(t.Button,{size:"small",get onClick(){return e.refresh},children:"Retry"})}})}})})}function ze(e){const t=w.usePlugin().ui;return i.createComponent(t.SettingsSection,{title:"Peak hours",get children(){return[i.createComponent(t.SettingsRow,{id:"peak-badge-windows",title:"Peak windows (UTC)",description:"Half-open; an end at or before the start wraps midnight. An empty list means no peak hours.",get children(){var n=xe(),r=n.firstChild;return i.insert(n,i.createComponent(p.Index,{get each(){return e.settings().windows},children:(s,l)=>(()=>{var f=Le(),g=f.firstChild,d=g.nextSibling,a=d.nextSibling;return i.insert(g,i.createComponent(t.TextInput,{label:`Window ${l+1} start`,get value(){return s()[0]},get invalid(){return!I(s()[0])},onInput:u=>e.patchWindow(l,0,u)})),i.insert(a,i.createComponent(t.TextInput,{label:`Window ${l+1} end`,get value(){return s()[1]},get invalid(){return!I(s()[1])},onInput:u=>e.patchWindow(l,1,u)})),i.insert(f,i.createComponent(t.IconButton,{icon:"trash",label:`Remove window ${l+1}`,onClick:()=>e.removeWindow(l)}),null),f})()}),r),i.insert(r,i.createComponent(t.Button,{size:"small",icon:"plus",get onClick(){return e.addWindow},children:"Add window"})),n}}),i.createComponent(t.SettingsRow,{id:"peak-badge-weekdays",title:"Weekdays only",description:"Weekends are always off-peak.",get children(){return i.createComponent(t.Switch,{label:"Weekdays only",hideLabel:!0,get checked(){return e.settings().weekdaysOnly},onChange:n=>e.update(r=>{r.weekdaysOnly=n})})}})]}})}function Ke(e){const t=w.usePlugin().ui;return i.createComponent(t.SettingsSection,{title:"Models",get children(){return[i.createComponent(t.SettingsRow,{id:"peak-badge-models",title:"Models",description:"One per row: provider/model, re:pattern, or a JSON object with id/pattern and optional windows/weekdaysOnly. Replaces the default list.",get children(){var n=We(),r=n.firstChild;return i.insert(n,i.createComponent(p.Index,{get each(){return e.settings().models},children:(s,l)=>(()=>{var f=Be(),g=f.firstChild;return i.insert(g,i.createComponent(t.TextInput,{label:`Model ${l+1}`,get value(){return s()},get invalid(){return!$e(s())},placeholder:"provider/model or re:pattern",onInput:d=>e.patchModel(l,d)})),i.insert(f,i.createComponent(t.IconButton,{icon:"trash",label:`Remove model ${l+1}`,onClick:()=>e.removeModel(l)}),null),f})()}),r),i.insert(r,i.createComponent(t.Button,{size:"small",icon:"plus",get onClick(){return e.addModel},children:"Add model"})),n}}),i.createComponent(t.SettingsRow,{id:"peak-badge-subagents",title:"Include subagents",description:"Running subagent sessions can make the parent badge peak.",get children(){return i.createComponent(t.Switch,{label:"Include subagents",hideLabel:!0,get checked(){return e.settings().subagents},onChange:n=>e.update(r=>{r.subagents=n})})}}),i.createComponent(t.SettingsRow,{id:"peak-badge-always-show",title:"Show unmatched models",description:"Show the main model even when it does not match a tracked model, using the top-level windows.",get children(){return i.createComponent(t.Switch,{label:"Show unmatched models",hideLabel:!0,get checked(){return e.settings().alwaysShow},onChange:n=>e.update(r=>{r.alwaysShow=n})})}})]}})}function je(e){const t=w.usePlugin().ui;return i.createComponent(t.SettingsSection,{title:"Badge",get children(){return[i.createComponent(t.SettingsRow,{id:"peak-badge-label-peak",title:"Peak label",description:"Text shown when the model is in peak hours.",get children(){var n=X();return i.insert(n,i.createComponent(t.TextInput,{label:"Peak label",get value(){return e.settings().labelPeak},onInput:r=>e.update(s=>{s.labelPeak=r})})),n}}),i.createComponent(t.SettingsRow,{id:"peak-badge-label-off",title:"Off-peak label",description:"Text shown when the model is outside peak hours.",get children(){var n=X();return i.insert(n,i.createComponent(t.TextInput,{label:"Off-peak label",get value(){return e.settings().labelOffPeak},onInput:r=>e.update(s=>{s.labelOffPeak=r})})),n}}),i.createComponent(t.SettingsRow,{id:"peak-badge-debug",title:"Debug",description:"Append provider/model to the badge.",get children(){return i.createComponent(t.Switch,{label:"Debug",hideLabel:!0,get checked(){return e.settings().debug},onChange:n=>e.update(r=>{r.debug=n})})}})]}})}function Ve(e){const t=w.usePlugin().ui;return i.createComponent(t.SettingsSection,{title:"Refresh",get children(){return i.createComponent(t.SettingsRow,{id:"peak-badge-poll",title:"Poll seconds",description:"Seconds between recomputations; at least 1. Invalid values fall back to 10.",get children(){var n=Ne();return i.insert(n,i.createComponent(t.TextInput,{label:"Poll seconds",get value(){return e.settings().pollSeconds},get invalid(){return!Ee(e.settings().pollSeconds)},onInput:r=>e.update(s=>{s.pollSeconds=r})})),n}})}})}function Je(e){const t=w.usePlugin().ui;return i.createComponent(t.SettingsSection,{title:"Advanced",get children(){return i.createComponent(t.SettingsRow,{id:"peak-badge-fake-time",title:"Fake time",description:"Fixed ISO timestamp for testing. Empty uses the real clock.",get children(){var n=Fe();return i.insert(n,i.createComponent(t.TextInput,{label:"Fake time",get value(){return e.settings().fakeTime},get invalid(){return!Ae(e.settings().fakeTime)},placeholder:"2026-09-07T08:30:00Z",onInput:r=>e.update(s=>{s.fakeTime=r})})),n}})}})}function qe(e){const t=w.usePlugin().ui;return i.createComponent(t.SettingsSection,{title:"Reset",get children(){return i.createComponent(t.SettingsRow,{id:"peak-badge-reset",title:"Reset to defaults",description:"Restore the built-in peak windows, models, labels and flags for both the TUI and Desktop.",get children(){return i.createComponent(t.Button,{size:"small",get onClick(){return e.reset},children:"Reset"})}})}})}var Y=i.template("<span>");const Ge={display:"inline-flex","align-items":"center",gap:"4px","font-size":"11px","font-weight":"600","letter-spacing":"0.02em","white-space":"nowrap"},Ze="var(--v2-orange-1000, #954c27)",Qe="var(--v2-orange-600, #ff8648)";function Xe(e){return e==="dark"?Qe:Ze}function A(e){return e?.providerID&&e.id?{providerID:e.providerID,id:e.id}:void 0}function Ye(e){return e?{providerID:e.providerID,id:e.modelID}:void 0}const et=200,tt=w.Plugin.define({setup(e){const[t,n]=p.createSignal(C(void 0)),[r,s]=p.createSignal(),l=p.createMemo(()=>Ie(t())),f=p.createMemo(()=>l().pollSeconds),g=p.createMemo(()=>l().fakeTime);let d,a=0,u=Promise.resolve(),h=!1,y=!1;const b=De({client:()=>e.client,set:o=>{n(o),s(void 0)},canApply:()=>d===void 0&&a===0,acceptEvent:o=>JSON.stringify(o)===JSON.stringify(t())?!1:d!==void 0||a>0?(y=!0,!1):!0,onLoadError:o=>s(o),onSaveError:o=>{s(o),e.toast.show({title:"Peak Badge settings",description:"Could not save the shared settings. Showing the server's values.",variant:"error"})}});b.connect();function R(o){const c=C(o);n(c),clearTimeout(d),d=setTimeout(()=>{d=void 0,a+=1,u=u.then(()=>b.save(c)).finally(()=>{a-=1,a===0&&d===void 0&&y&&(y=!1,b.refresh())})},et)}function se(){h||(clearTimeout(d),d=void 0,h=!0,n(C(void 0)),u=u.then(()=>b.reset()).finally(()=>{h=!1,a===0&&d===void 0&&y&&(y=!1,b.refresh())}))}const[W,B]=p.createSignal($(g()).getTime()),[ae,de]=p.createSignal(void 0),M=new Set;function N(o,c,m){M.has(c)||(M.add(c),o.sync(m).catch(()=>M.delete(c)))}function F(o){const c=l().debug&&o.model?`${o.model.providerID}/${o.model.id}`:"";return[o.state?.label??"",c].filter(Boolean).join(" ")}function U(o){return o?.peak?Xe(e.appearance.mode()):void 0}function le(o){const c=o.active===!1?void 0:Ye(o.screen.composer.model());if(c)return c;const m=o.session.server.data.session,k=A(m.get(o.session.id)?.model);return k||N(m,o.session.key,o.session.id),k}function ce(o,c){const m=o.session.server.data.session,k=A(m.get(c)?.model);return k||N(m,`${o.session.server.id}
|
|
2
|
+
${c}`,c),k}function ue(o){const c=l(),m=le(o),k=c.subagents?Se({sessionID:o.session.id,family:S=>o.session.server.data.session.family(S),status:S=>o.session.server.data.session.status(S),model:S=>ce(o,S)}):[];return{state:Z({now:new Date(W()),rules:c.rules,labels:c.labels,main:m,subagents:k,alwaysShow:c.alwaysShow}),model:m}}function fe(o){const c=p.createMemo(()=>ue(o.input));return i.createComponent(p.Show,{get when(){return F(c())},children:m=>(()=>{var k=Y();return i.insert(k,i.createComponent(p.Show,{get when(){return c().state},children:v=>i.createComponent(p.Show,{get when(){return v().peak},get fallback(){return i.createComponent(e.ui.Icon,{name:"circle-check",size:"small"})},get children(){return i.createComponent(e.ui.Icon,{name:"warning",size:"small"})}})}),null),i.insert(k,i.createComponent(p.Show,{get when(){return!o.input.compact},get children(){return m()}}),null),i.effect(v=>{var S={...Ge,color:U(c().state)},z=m(),K=o.input.compact?m():void 0;return v.e=i.style(k,S,v.e),z!==v.t&&i.setAttribute(k,"title",v.t=z),K!==v.a&&i.setAttribute(k,"aria-label",v.a=K),v},{e:void 0,t:void 0,a:void 0}),k})()})}const H=p.createMemo(()=>{const o=l(),c=ae();return{state:Z({now:new Date(W()),rules:o.rules,labels:o.labels,main:c,subagents:[],alwaysShow:o.alwaysShow}),model:c}});function ge(){return i.createComponent(p.Show,{get when(){return F(H())},children:o=>(()=>{var c=Y();return i.insert(c,o),i.effect(m=>i.setStyleProperty(c,"color",U(H().state))),c})()})}async function _(){try{const o=await e.client.model.default();de(A(o.data))}catch{}}_();function pe(){try{for(const o of e.servers.list()){const c=e.servers.get(o);if(c?.builtin)return c.data}}catch{}}return w.createKeyed(()=>pe(),o=>{p.onCleanup(o.on("model.updated",()=>{_()})),p.onCleanup(o.on("server.connected",()=>b.connect()))}),w.createKeyed(()=>f(),o=>{const c=setInterval(()=>{B($(g()).getTime()),e.sessions.current()||_()},o*1e3);p.onCleanup(()=>clearInterval(c))}),w.createKeyed(()=>g(),o=>B($(o).getTime())),e.add(w.SettingsPage,{id:"peak-badge",icon:"sliders",get title(){return"Peak Badge"},get entries(){return[{id:"peak-badge",title:"Peak Badge",description:"Peak hours, models and badge settings",keywords:"peak off-peak deepseek"},{id:"peak-badge-windows",title:"Peak windows",description:"UTC windows when the badge is peak"},{id:"peak-badge-weekdays",title:"Weekdays only",description:"Weekends are off-peak"},{id:"peak-badge-models",title:"Models",description:"Tracked model ids and patterns"},{id:"peak-badge-subagents",title:"Include subagents",description:"Running subagents can make the parent peak"},{id:"peak-badge-always-show",title:"Show unmatched models",description:"Badge the main model without a matching rule"},{id:"peak-badge-label-peak",title:"Peak label",description:"Text shown when peak"},{id:"peak-badge-label-off",title:"Off-peak label",description:"Text shown when off-peak"},{id:"peak-badge-debug",title:"Debug",description:"Append provider/model to the badge"},{id:"peak-badge-poll",title:"Poll seconds",description:"Badge recompute interval"},{id:"peak-badge-fake-time",title:"Fake time",description:"Fixed time for testing"},{id:"peak-badge-reset",title:"Reset to defaults",description:"Restore the built-in settings"}]},render:()=>i.createComponent(Ue,{settings:t,save:R,reset:se,refresh:()=>{b.refresh(!0)},error:r})}),e.add(w.Command,()=>({id:"settings",title:"Peak Badge settings",description:"Peak windows, models, labels and refresh",group:"Peak Badge",run:()=>e.layout.settings("peak-badge")})),e.add(w.Slot,{at:"session.header",order:100,render:o=>i.createComponent(fe,{input:o})}),e.add(w.Slot,{at:"window.bottom",order:10,render:()=>i.createComponent(p.Show,{get when(){return!e.sessions.current()},get children(){return i.createComponent(ge,{})}})}),()=>{b.stop(),clearTimeout(d)}}});exports.default=tt;
|