diff --git a/README.md b/README.md index 4dec6885..213fc021 100644 --- a/README.md +++ b/README.md @@ -1772,17 +1772,19 @@ still cannot fit is shortened with an ellipsis. Width updates on resize. when the option filter is empty). **Escape** closes the list, retaining the draft and typing focus. Back from a rename or directory review restores the edited argument in the composer. Speed menus -initially show all options: Up/Down highlights a choice, **Enter REVIEW** stages it, -and **C CONFIRM** applies it. The separate **CURRENT** marker identifies the +initially show all options: Up/Down highlights a choice, and **Enter APPLY** or +clicking an option applies it. Highlighting alone never changes a setting. +The separate **CURRENT** marker identifies the existing speed; the highlighted choice uses bright text without a reversed background. -The action line shows only the current next step, Enter Review or C Confirm, -without a second confirmation hint. Settings blocked during an active turn show +The action line shows the current next step. Permission changes, directory changes +and unknown actions retain **Enter REVIEW**, then **C CONFIRM**, by default. +Settings blocked during an active turn show **WAITING FOR IDLE**, with **Ctrl+R REFRESH** in the terminal composer (**F REFRESH** in the read-only picker) to read their availability again; -speed changes are available during a turn and are sent immediately after confirmation, +speed changes are available during a turn and are sent on explicit selection, without a local queue. They configure subsequent turns, not a request already in flight. -**HELP** identifies genuine browse-only entries. Model, reasoning and speed changes are provisional until C; -reviewing or changing the highlight sends no settings update. Buttons +**HELP** identifies genuine browse-only entries. Merely navigating or changing +the highlight sends no settings update. Buttons are clickable. Writable web mode exposes the same catalogue through **/ COMMANDS**, with the same composer suggestion shortcuts. @@ -1800,16 +1802,18 @@ read-only browser mode, except for the terminal-only `/commands` shortcut. **Connected-session commands — shared app-server required.** Availability depends on the installed server and session state; unsupported or empty catalogues are -omitted. Changes require explicit confirmation and, in the browser, opt-in -writable mode. Browse-only entries do not execute tools or change configuration. +omitted. Changes require explicit selection and, in the browser, opt-in writable +mode. Reversible session-local changes do not need a second confirmation; +permission/directory changes and unknown actions remain guarded by default. +Browse-only entries do not execute tools or change configuration. | Command family | Live options and behaviour | | --- | --- | | `/cd` | Change the selected session’s directory after review and confirmation while idle and with no queued messages. Absolute, session-relative and `~/` paths are supported; success is verified from running configuration. Retains thread ID/history; does not reproduce native project-config reload/fork. | | `/cwd`, `/pwd` | Read-only aliases showing the running session’s current directory, including during active turns. | -| `/rename` | Edit the selected session’s saved name, review it and confirm. Uses Codex’s name API; works during an active turn and does not send a prompt or change model settings. | +| `/rename` | Edit the selected session’s saved name and apply it without a second confirmation. Uses Codex’s name API; works during an active turn and does not send a prompt or change model settings. | | `/model` | Advertised models, their descriptions and supported reasoning levels. Choosing a model resets its explicit speed override to the server default. | -| Advertised speed commands, such as `/fast` | Show the default speed and every advertised tier in one list, initially highlighting the current speed. Up/Down selects; **Enter REVIEW** provisionally selects the highlighted choice while keeping the list visible, then **C CONFIRM** applies it. Changing the highlight cancels the pending confirmation. IDs and descriptions come from the current model's catalogue; no tier IDs are guessed. The changed speed is verified before success is reported. | +| Advertised speed commands, such as `/fast` | Show the default speed and every advertised tier in one list, initially highlighting the current speed. Up/Down highlights; **Enter APPLY** or clicking a choice applies it without a second confirmation. IDs and descriptions come from the current model's catalogue; no tier IDs are guessed. The changed speed is verified before success is reported. | | `/plan` | Advertised collaboration modes, using Codex's built-in mode instructions. | | `/permissions` | Named profiles allowed for the session's directory, with supplied descriptions. Review carefully: this changes future permission behaviour. | | `/skills`, `/apps`, `/mcp`, `/hooks`, `/experimental` | **Browse-only** live inventories and supplied help, including MCP tool descriptions. Invoke/configure these through Codex. | @@ -1850,9 +1854,9 @@ The terminal `/statusline` checkbox list uses the same composer expansion, but deliberately does not filter: **Up/Down** selects, **Space** toggles, **Left/Right** reorders and **Enter** applies the local display preferences. Escape discards unapplied changes. Other menu levels keep help subdued on one line, shortened -with an ellipsis when needed. Model, reasoning, speed, name and directory changes -still require separate review and **C CONFIRM**; shrinking the terminal cannot -confirm a hidden control. The composer and conversation remain in place through +with an ellipsis when needed. Reversible settings use **Enter APPLY**; guarded +changes keep separate review and **C CONFIRM** by default. Shrinking the terminal +cannot activate a hidden control. The composer and conversation remain in place through all levels, including in a wide session row. `/commands` also opens the root list, including local commands without a shared daemon. @@ -1867,10 +1871,11 @@ scope is process-wide rather than session-local. See the official [app-server API overview](https://learn.chatgpt.com/docs/app-server#api-overview) for the upstream catalogues. -Renames require a loaded session and explicit confirmation within 30 seconds; a concurrent rename or reconnect invalidates the confirmation. The updated name appears on the next telemetry refresh. +Renames require a loaded session and revalidated options; a concurrent rename or +reconnect invalidates the old choice. The updated name appears on the next telemetry refresh. -Codex session-setting changes require a loaded session and explicit confirmation within -30 seconds. Speed-only changes can be sent while working or waiting for an approval; +Codex session-setting changes require a loaded session. Guarded changes retain +their separate confirmation with a 30-second expiry. Speed-only changes can be sent while working or waiting for an approval; other settings still require idle and no pending approval. The command and options are revalidated before sending; stale connections and changed options fail closed. A normal turn start/completion does not invalidate a speed confirmation, but changed @@ -1882,6 +1887,41 @@ confirmations retain the draft and error context. These changes do not modify gl quota thresholds may later supersede model settings. Uncertain requests are not retried automatically. Read-only web mode offers no command-control endpoint. +### Fewer confirmation steps + +By default, `/rename`, model/reasoning selection, advertised speed changes such as +`/fast`, and `/plan` apply on explicit selection. They do not launch a prompt; +settings affect subsequent turns and can be changed again. Model and speed choices +can still affect quota consumption or API cost. `/cd`, `/permissions`, unknown +commands and other guarded actions retain their existing confirmation steps. +Local display commands and read-only inventories remain immediate or browse-only. + +To opt out of Codexometer's extra confirmation clicks for this launch: + +```sh +codexometer --no-confirm +codexometer --web --web-control --no-confirm +``` + +**Quota resets are the one exception: redeeming a reset always requires confirmation.** +Elsewhere, this flag makes explicit actions single-step, including approvals and +persistent grants, quota-profile decisions, sending browser prompts or schedules, +scheduled Send now, native queue deletion, Close All dismissal and guarded benchmark +launches. An accidental click can therefore authorise work, spend quota or change +permissions: use it only when you want that trade-off. It never chooses an action +for you or automatically approves an incoming request. + +The flag is not saved in preferences, does not enable web writes without +`--web-control`, and is not forwarded to Codex. Codex's sandbox/approval rules, +fresh-state checks, capability/revision validation and one-use/replay guards remain. +The browser still uses server-side prepare/commit validation, but completes both +phases after the one explicit action. Failed or uncertain writes are never retried +automatically. Unless stated otherwise, confirmation instructions elsewhere in this +README describe the default guarded behaviour. +Recognised key-repeat events are ignored for command submission and approval +shortcuts. Older terminals may not distinguish held-key repeats, so avoid holding +action keys when using `--no-confirm`. + **Slash-command audit:** the [complete version-matched inventory](docs/slash-command-support.md) compares Codexometer with Codex CLI **0.162.1**, including aliases, partial support and the reason for each missing adapter. Several missing commands already have @@ -2721,6 +2761,7 @@ open directly. --check-auth verify the current Codex login and exit --error-log PATH opt into bounded JSON operational diagnostics (off by default) --verbose add diagnostic context to --error-log; never raw payloads +--no-confirm skip extra confirmation clicks, except quota-reset redemption --demo preview simulated quota, Sessions, Usage, and benchmark data --inline render inline instead of using the alternate screen --web experimental read-only browser interface (loopback only) diff --git a/SECURITY.md b/SECURITY.md index e24c51a5..36a364ee 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -58,6 +58,20 @@ tests must cover confirmation, navigation/draft isolation, stale controls and te escaping. Prompt sending/approvals are the only web mutations; benchmarks and reset redemption still have no routes. +Reversible session-local slash changes (name, model/reasoning, advertised speed, +and collaboration mode) apply on explicit selection without a second UI click. +Permissions, directories and unknown actions remain guarded by default. +`--no-confirm` is a launch-only opt-out from other Codexometer confirmation clicks; +quota-reset redemption remains guarded even with this option. It does not select +approvals automatically, change Codex sandbox policies, enable read-only web +control routes or bypass server-side preparation/commit, source freshness, +revision, one-use capability or replay validation. Browser preparation and commit +remain distinct protected requests even when one user action runs both phases. +Never infer an action's risk from its display label: the shared adapter marks +only an explicit allowlist of reversible RPC methods/fields. Unknown metadata +requires confirmation by default. Test both policies, including unavailable +actions, failed preparation, stale/replaced requests and the reset exception. + Prepared bodies are limited to 64 KiB and each answer to 4,096 characters. At most one prepared action is retained for 30 seconds per server; replacement invalidates the previous confirmation. Drafts/answers are not logged or persisted. Secret diff --git a/internal/codex/session_commands.go b/internal/codex/session_commands.go index 7cf56501..8e888ee3 100644 --- a/internal/codex/session_commands.go +++ b/internal/codex/session_commands.go @@ -58,6 +58,9 @@ type SessionCommandChoice struct { Next string `json:"next,omitempty"` Action bool `json:"action,omitempty"` Selected bool `json:"selected,omitempty"` + // Reversible is set only for an explicit allowlist of session-local settings. + // Unknown actions and permission changes retain confirmation by default. + Reversible bool `json:"reversible,omitempty"` // Unavailable explains a blocked action; an empty reason with no Action is genuine browse-only help. Unavailable string `json:"unavailable,omitempty"` method string @@ -65,11 +68,12 @@ type SessionCommandChoice struct { } type SessionCommandMenu struct { - Title string `json:"title"` - Help string `json:"help"` - Path string `json:"path"` - Revision string `json:"revision"` - Multiple bool `json:"multiple,omitempty"` + ReversibleInput bool `json:"reversibleInput,omitempty"` + Title string `json:"title"` + Help string `json:"help"` + Path string `json:"path"` + Revision string `json:"revision"` + Multiple bool `json:"multiple,omitempty"` // Picker keeps choices visible; the highlighted option is applied explicitly. Picker bool `json:"picker,omitempty"` Input bool `json:"input,omitempty"` diff --git a/internal/codex/session_commands_unix.go b/internal/codex/session_commands_unix.go index 9055dd77..9726e2b6 100644 --- a/internal/codex/session_commands_unix.go +++ b/internal/codex/session_commands_unix.go @@ -197,6 +197,7 @@ func normalizeCommandMenu(menu SessionCommandMenu) SessionCommandMenu { o.Unavailable = commandText(o.Unavailable) o.ID = commandDigest([]any{o.Label, o.Help, o.Next, o.Unavailable, o.method, o.params}) o.Action = o.method != "" + o.Reversible = reversibleSessionCommand(*o) if !seen[o.ID] { unique = append(unique, *o) seen[o.ID] = true @@ -206,6 +207,29 @@ func normalizeCommandMenu(menu SessionCommandMenu) SessionCommandMenu { return menu } +func reversibleSessionCommand(o SessionCommandChoice) bool { + if !o.Action { + return false + } + switch o.method { + case "thread/name/set": + return len(o.params) == 2 && o.params["name"] != nil && o.params["threadId"] != nil + case "thread/settings/update": + changed := false + for key := range o.params { + switch key { + case "threadId": + case "model", "effort", "serviceTier", "collaborationMode": + changed = true + default: + return false + } + } + return changed && o.params["threadId"] != nil + } + return false +} + func (p *daemonStatusProvider) commandMenu(ctx context.Context, t commandThread, path string, collect func(string, commandMenuBranch)) (SessionCommandMenu, error) { m := SessionCommandMenu{Title: "/" + path, Help: "Live options from the shared Codex app-server.", Choices: []SessionCommandChoice{}} parts := strings.Split(path, "/") @@ -258,7 +282,7 @@ func (p *daemonStatusProvider) commandMenu(ctx context.Context, t commandThread, } } m.Title = "/ COMMANDS" - m.Help = "Choose a command. Options/help are discovered live. Changes target this session only and require confirmation. Speed changes can be sent during a turn and apply to subsequent turns; other settings require idle. Catalogues marked browse-only do not execute tools or change global configuration." + m.Help = "Choose a command. Options/help are discovered live. Reversible session settings apply on explicit selection; permission and directory changes require confirmation by default. Speed changes can be sent during a turn and apply to subsequent turns; other settings require idle. Browse-only catalogues do not execute tools or change global configuration." return m, nil } if parts[0] == "cd" || parts[0] == "cwd" || parts[0] == "pwd" { @@ -266,9 +290,10 @@ func (p *daemonStatusProvider) commandMenu(ctx context.Context, t commandThread, } if parts[0] == "rename" { m.Title = "/rename" - m.Help = "Rename this session in Codex. Enter a single-line name, then review and confirm the change. It does not send a prompt or change model settings." + m.Help = "Rename this session in Codex. Enter a single-line name and apply it. It does not send a prompt or change model settings." if path == "rename" { m.Input = true + m.ReversibleInput = true m.InputLabel, m.InputLimit = "Session name", SessionRenameInputLimit m.Value = commandLabel(t.Name) return m, nil diff --git a/internal/codex/session_confirmation_unix_test.go b/internal/codex/session_confirmation_unix_test.go new file mode 100644 index 00000000..d6aa0da0 --- /dev/null +++ b/internal/codex/session_confirmation_unix_test.go @@ -0,0 +1,34 @@ +//go:build unix + +package codex + +import "testing" + +func TestOnlyAllowlistedSessionChangesAreReversible(t *testing.T) { + for _, tc := range []struct { + method string + params map[string]any + want bool + }{ + {"thread/name/set", map[string]any{"threadId": "one", "name": "New name"}, true}, + {"thread/settings/update", map[string]any{"threadId": "one", "model": "m", "effort": "high", "serviceTier": nil}, true}, + {"thread/settings/update", map[string]any{"threadId": "one", "collaborationMode": map[string]any{}}, true}, + {"thread/settings/update", map[string]any{"threadId": "one", "serviceTier": "priority"}, true}, + {"thread/settings/update", map[string]any{"threadId": "one", "permissions": "full"}, false}, + {"thread/settings/update", map[string]any{"threadId": "one", "model": "m", "permissions": "full"}, false}, + {"thread/settings/update", map[string]any{"threadId": "one", "cwd": "/new"}, false}, + {"thread/settings/update", map[string]any{"threadId": "one", "futureField": "value"}, false}, + {"thread/settings/update", map[string]any{"threadId": "one"}, false}, + {"thread/settings/update", map[string]any{"model": "m"}, false}, + {"future/write", map[string]any{"threadId": "one"}, false}, + } { + menu := normalizeCommandMenu(SessionCommandMenu{Choices: []SessionCommandChoice{{Label: "Option", method: tc.method, params: tc.params}}}) + if len(menu.Choices) != 1 || menu.Choices[0].Reversible != tc.want { + t.Fatal("wrong reversible action classification", tc.method, tc.params, menu) + } + } + menu := normalizeCommandMenu(SessionCommandMenu{Choices: []SessionCommandChoice{{Label: "Read only", Reversible: true}}}) + if menu.Choices[0].Reversible || menu.Choices[0].Action { + t.Fatal("browse-only metadata became an action") + } +} diff --git a/internal/confirmation/policy.go b/internal/confirmation/policy.go new file mode 100644 index 00000000..a2be86b8 --- /dev/null +++ b/internal/confirmation/policy.go @@ -0,0 +1,26 @@ +// Package confirmation owns launch-scoped UI confirmation policy. Skipping a +// second click never authorises an action or bypasses backend validation. +package confirmation + +type Action uint8 + +const ( + Guarded Action = iota // Unknown actions fail closed by default. + Reversible + QuotaReset +) + +type Policy struct { + NoConfirm bool +} + +func (p Policy) Required(action Action) bool { + return action == QuotaReset || !p.NoConfirm && action != Reversible +} + +func Command(reversible bool) Action { + if reversible { + return Reversible + } + return Guarded +} diff --git a/internal/confirmation/policy_test.go b/internal/confirmation/policy_test.go new file mode 100644 index 00000000..87c754e3 --- /dev/null +++ b/internal/confirmation/policy_test.go @@ -0,0 +1,23 @@ +package confirmation + +import "testing" + +func TestPolicy(t *testing.T) { + for _, tc := range []struct { + noConfirm bool + action Action + want bool + }{ + {false, Guarded, true}, {false, Reversible, false}, + {false, QuotaReset, true}, {false, Action(99), true}, + {true, Guarded, false}, {true, Reversible, false}, + {true, QuotaReset, true}, {true, Action(99), false}, + } { + if (Policy{NoConfirm: tc.noConfirm}).Required(tc.action) != tc.want { + t.Fatal("wrong confirmation policy", tc) + } + } + if Command(false) != Guarded || Command(true) != Reversible { + t.Fatal("unknown command must remain guarded") + } +} diff --git a/internal/ui/confirmations.go b/internal/ui/confirmations.go new file mode 100644 index 00000000..b2e5d4a6 --- /dev/null +++ b/internal/ui/confirmations.go @@ -0,0 +1,9 @@ +package ui + +import "github.com/merefield/codexometer/internal/confirmation" + +// SetNoConfirm applies only to this launch, never to saved display preferences. +// Quota-reset redemption remains guarded regardless of this setting. +func (m *Model) SetNoConfirm(value bool) { + m.confirmations = confirmation.Policy{NoConfirm: value} +} diff --git a/internal/ui/confirmations_test.go b/internal/ui/confirmations_test.go new file mode 100644 index 00000000..c5e6a26a --- /dev/null +++ b/internal/ui/confirmations_test.go @@ -0,0 +1,77 @@ +package ui + +import ( + "testing" + "time" + + tea "charm.land/bubbletea/v2" + "github.com/merefield/codexometer/internal/codex" +) + +func TestNoConfirmQueueDeletionStillTargetsTheSelectedItem(t *testing.T) { + m, client := queueTestModel(false) + m.SetNoConfirm(true) + cmd := m.openQueueItem(0, true) + if cmd == nil || client.changed != "" { + t.Fatal("deletion was not an explicit one-shot command") + } + m, _, _ = m.updateMonitorQueue(cmd()) + if !client.removed || client.changed != "one" || client.thread != "root-one" || m.monitorQueue.open { + t.Fatal("wrong queue deletion target") + } +} + +func TestNoConfirmProfileSelectionDoesNotApplyOtherSessions(t *testing.T) { + m, client := profileTestModel(t) + m.SetNoConfirm(true) + m, cmd, _ := m.updateProfileKey("1") + if cmd == nil || client.updates != 0 { + t.Fatal("explicit profile action was not queued exactly once") + } + n, _ := m.Update(cmd()) + m = n.(Model) + if client.updates != 1 || len(client.targets) != 1 || client.targets[0].ID != "one" { + t.Fatal("no-confirm applied an unselected profile") + } +} + +func TestNoConfirmSendNowRetainsDispatchGuards(t *testing.T) { + m, client := scheduledTestModel(t) + m.SetNoConfirm(true) + cmd := m.triggerAction("ctrl+n") + if cmd == nil { + t.Fatal("Send now still required a second confirmation") + } + cmd() + if len(client.answers) != 1 || client.answers[0] != "The saved trigger prompt" { + t.Fatal("wrong scheduled prompt", client.answers) + } +} + +func TestNoConfirmRunAllRequiresAnExplicitLaunch(t *testing.T) { + tasks := make(chan []codex.BenchmarkTaskID, 1) + m := New(benchmarkCaptureFetcher{stubFetcher: stubFetcher{snapshot: codex.DemoSnapshot()}, tasks: tasks}, time.Minute) + m.SetNoConfirm(true) + m.snapshot, m.loading, m.meterView, m.benchmarkCombinations = codex.DemoSnapshot(), false, viewBenchmark, 1 + m, cmd := m.activateFooterButton(footerButtonBenchmarkAll) + if cmd == nil || m.benchmarkState != benchmarkRunning || m.benchmarkAllArmed { + t.Fatal("Run All still required confirmation") + } + select { + case <-tasks: + t.Fatal("benchmark ran without explicit command dispatch") + default: + } +} + +func TestNoConfirmDoesNotTurnComposerTypingIntoAnApproval(t *testing.T) { + m := approvalTestModel() + m.SetNoConfirm(true) + m.monitorPrompt = monitorPromptState{session: "root-one", offer: codex.SessionPromptOffer{Token: "previous", TurnID: "turn"}, input: newMonitorEditor()} + m.monitorPrompt.input.SetValue("Keep my draft") + m.monitorPrompt.input.Focus() + n, cmd := m.Update(tea.KeyPressMsg{Code: '1', Text: "1"}) + if cmd != nil || n.(Model).monitorApprovalBusy || m.fetcher.(*approvalTestClient).decision != "" { + t.Fatal("typing during a composer/approval transition granted permission") + } +} diff --git a/internal/ui/model.go b/internal/ui/model.go index 2d51b6da..5ff5efd9 100644 --- a/internal/ui/model.go +++ b/internal/ui/model.go @@ -12,6 +12,7 @@ import ( "charm.land/lipgloss/v2" "github.com/merefield/codexometer/internal/codex" + "github.com/merefield/codexometer/internal/confirmation" "github.com/merefield/codexometer/internal/i18n" "github.com/merefield/codexometer/internal/quotagraph" "github.com/merefield/codexometer/internal/version" @@ -173,6 +174,7 @@ type Model struct { benchmarkDetailCache benchmarkDetailTranscriptCache benchmarkQuotaAccounting benchmarkQuotaAccounting + confirmations confirmation.Policy monitorState monitorState monitorAutoStart bool monitorStartedAt time.Time @@ -1478,7 +1480,7 @@ func (m Model) activateFooterButton(button footerButtonID) (Model, tea.Cmd) { case footerButtonBenchmarkSelected: if m.meterView == viewBenchmark && m.benchmarkCanRunSelected() { tasks := m.benchmarkScopedTasks() - if m.benchmarkSelectedSuiteExternal() && !m.benchmarkSelectedArmed { + if m.benchmarkSelectedSuiteExternal() && !m.benchmarkSelectedArmed && !m.confirmations.NoConfirm { m.benchmarkSelectedArmed = true m.benchmarkConfirmSequence++ sequence := m.benchmarkConfirmSequence @@ -1496,7 +1498,7 @@ func (m Model) activateFooterButton(button footerButtonID) (Model, tea.Cmd) { allCombinations = m.benchmarkCombinations } if m.meterView == viewBenchmark && benchmarkRunAllAvailable(m.benchmarkRunActive(), allCombinations, len(tasks)) { - if !m.benchmarkAllArmed { + if !m.benchmarkAllArmed && !m.confirmations.NoConfirm { m.benchmarkAllArmed = true m.benchmarkConfirmSequence++ sequence := m.benchmarkConfirmSequence diff --git a/internal/ui/monitor_approval.go b/internal/ui/monitor_approval.go index a4a2fc7a..4ed77d57 100644 --- a/internal/ui/monitor_approval.go +++ b/internal/ui/monitor_approval.go @@ -273,7 +273,7 @@ func (m Model) monitorApprovalAction(action string) (Model, tea.Cmd, bool) { if option.Kind == "" { return m, nil, true } - if option.GrantsPermission() && !m.approvalConfirmationActive(token, action) { + if option.GrantsPermission() && !m.confirmations.NoConfirm && !m.approvalConfirmationActive(token, action) { m.monitorApprovalConfirm = token + "/" + action m.monitorApprovalConfirmUntil = time.Now().Add(monitorApprovalConfirmDuration) m.monitorApprovalNumberReleased = false diff --git a/internal/ui/monitor_approval_test.go b/internal/ui/monitor_approval_test.go index d0d4f5a4..dd5f5fca 100644 --- a/internal/ui/monitor_approval_test.go +++ b/internal/ui/monitor_approval_test.go @@ -75,6 +75,30 @@ func approvalTestModel() Model { return m } +func TestNoConfirmStillRequiresAnExplicitApprovalAndLiveCapability(t *testing.T) { + for _, stale := range []bool{false, true} { + m := approvalTestModel() + m.SetNoConfirm(true) + client := m.fetcher.(*approvalTestClient) + if stale { + client.token = "replacement" + } + n, cmd, _ := m.monitorApprovalAction("decision:0") + if (cmd != nil) == stale || n.monitorApprovalConfirm != "" { + t.Fatal("wrong live approval/confirmation handling", stale) + } + if cmd != nil { + if client.decision != "" { + t.Fatal("decision executed before explicit action dispatch") + } + cmd() + if client.decision != "accept" { + t.Fatal("chosen approval was not sent") + } + } + } +} + func TestMonitorApprovalRenderedTargets(t *testing.T) { for _, width := range []int{40, 60, 80, 120, 180} { for _, height := range []int{12, 24, 40} { diff --git a/internal/ui/monitor_close_all.go b/internal/ui/monitor_close_all.go index df58e0d7..668b7cbe 100644 --- a/internal/ui/monitor_close_all.go +++ b/internal/ui/monitor_close_all.go @@ -26,7 +26,7 @@ func (m *Model) clearMonitorCloseAllConfirmation() { } func (m *Model) requestMonitorCloseAll() { - if m.monitorCloseAllArmed() { + if m.confirmations.NoConfirm || m.monitorCloseAllArmed() { m.dismissAllMonitorSessions() return } diff --git a/internal/ui/monitor_commands.go b/internal/ui/monitor_commands.go index 59ebb0ca..01e4f279 100644 --- a/internal/ui/monitor_commands.go +++ b/internal/ui/monitor_commands.go @@ -11,6 +11,7 @@ import ( tea "charm.land/bubbletea/v2" "github.com/charmbracelet/x/ansi" "github.com/merefield/codexometer/internal/codex" + "github.com/merefield/codexometer/internal/confirmation" "github.com/merefield/codexometer/internal/i18n" "github.com/merefield/codexometer/internal/statusline" ) @@ -256,6 +257,9 @@ func (m Model) chooseMonitorCommand() (Model, tea.Cmd, bool) { cmd := m.navigateMonitorCommands(o.Next) return m, cmd, true } + if o.Action && !m.confirmations.Required(confirmation.Command(o.Reversible)) { + return m.executeMonitorCommand(o) + } if m.monitorCommands.menu.Picker { p := &m.monitorCommands if o.Action && p.notice == "" && (p.reviewedChoice != o.ID || time.Now().After(p.until)) { @@ -311,6 +315,14 @@ func (m Model) confirmMonitorCommand() (Model, tea.Cmd, bool) { // Keep Enter Review available so expiration uses the same recovery path. return m, nil, true } + return m.executeMonitorCommand(o) +} + +func (m Model) executeMonitorCommand(o codex.SessionCommandChoice) (Model, tea.Cmd, bool) { + p := &m.monitorCommands + if !p.open || p.busy || p.notice != "" || !o.Action || o.Unavailable != "" || m.monitorCommandPopup().height < 4 { + return m, nil, true + } c, ok := m.fetcher.(codex.SessionCommandsClient) if !ok { return m, nil, true @@ -490,7 +502,11 @@ func (m Model) commandFooter(width int) []commandDisplayRow { p := m.monitorCommands var buttons []commandDisplayRow if p.menu.Input && !p.busy && p.notice == "" && strings.TrimSpace(p.input.Value()) != "" { - buttons = append(buttons, commandDisplayRow{text: i18n.Text("[ ENTER REVIEW ]"), action: "review"}) + label := "[ ENTER REVIEW ]" + if p.menu.ReversibleInput || m.confirmations.NoConfirm { + label = "[ ENTER APPLY ]" + } + buttons = append(buttons, commandDisplayRow{text: i18n.Text(label), action: "review"}) } else if p.menu.Multiple { label := "[ C APPLY ]" if p.inline { @@ -498,7 +514,9 @@ func (m Model) commandFooter(width int) []commandDisplayRow { } buttons = append(buttons, commandDisplayRow{text: i18n.Text(label), action: "confirm"}) } else if o, ok := m.commandChoice(); ok && o.Action && !p.busy && p.notice == "" { - if (p.detail || (p.menu.Picker && p.reviewedChoice == o.ID)) && time.Now().Before(p.until) { + if !m.confirmations.Required(confirmation.Command(o.Reversible)) { + buttons = append(buttons, commandDisplayRow{text: i18n.Text("[ ENTER APPLY ]"), action: "stage"}) + } else if (p.detail || (p.menu.Picker && p.reviewedChoice == o.ID)) && time.Now().Before(p.until) { buttons = append(buttons, commandDisplayRow{text: i18n.Text("[ C CONFIRM ]"), action: "confirm"}) } else { buttons = append(buttons, commandDisplayRow{text: i18n.Text("[ ENTER REVIEW ]"), action: "stage"}) @@ -717,6 +735,9 @@ func (m Model) updateMonitorCommands(msg tea.Msg) (Model, tea.Cmd, bool) { return m, cmd, true } if (strings.HasPrefix(p.menu.Path, "rename/") || strings.HasPrefix(p.menu.Path, "cd/")) && len(p.menu.Choices) == 1 { + if o := p.menu.Choices[0]; o.Action && !m.confirmations.Required(confirmation.Command(o.Reversible)) { + return m.executeMonitorCommand(o) + } p.detail = true p.until = time.Now().Add(30 * time.Second) } @@ -740,6 +761,12 @@ func (m Model) updateMonitorCommands(msg tea.Msg) (Model, tea.Cmd, bool) { } return m, nil, false } + // Only suppress repeats that can submit/open a choice. Right still belongs + // to text editors (including inline filters) and local checkbox reordering. + if key, ok := msg.(tea.KeyPressMsg); ok && key.IsRepeat && (key.String() == "enter" || + key.String() == "right" && !p.inline && !p.menu.Input && !p.menu.Multiple) { + return m, nil, true + } if m.meterView != viewMonitor || m.monitorContextTarget() != p.session { m.closeMonitorCommands() return m, nil, false @@ -900,6 +927,9 @@ func (m Model) updateMonitorCommands(msg tea.Msg) (Model, tea.Cmd, bool) { p.reviewedChoice = "" } p.selected = p.hover + if o, ok := m.commandChoice(); ok && o.Action && !m.confirmations.Required(confirmation.Command(o.Reversible)) { + return m.chooseMonitorCommand() + } return m, nil, true } p.selected = p.hover diff --git a/internal/ui/monitor_commands_interaction_test.go b/internal/ui/monitor_commands_interaction_test.go new file mode 100644 index 00000000..bd1fe178 --- /dev/null +++ b/internal/ui/monitor_commands_interaction_test.go @@ -0,0 +1,136 @@ +package ui + +import ( + "fmt" + "testing" + + "charm.land/bubbles/v2/textinput" + tea "charm.land/bubbletea/v2" + "github.com/merefield/codexometer/internal/codex" +) + +func TestMonitorPickerClicksRespectConfirmationPolicy(t *testing.T) { + for _, inline := range []bool{false, true} { + for _, width := range []int{60, 120, 180} { + for _, reversible := range []bool{false, true} { + for _, noConfirm := range []bool{false, true} { + t.Run(fmt.Sprintf("inline=%t/width=%d/reversible=%t/noConfirm=%t", inline, width, reversible, noConfirm), func(t *testing.T) { + m, f := speedCommandTestModel(t) + m.width = width + m.SetNoConfirm(noConfirm) + m.monitorCommands.menu.Choices[0].Reversible = reversible + if inline { + m.monitorCommands.inline = true + m.monitorCommands.prefix = "/fast " + m.monitorPrompt.input.SetValue("/fast ") + m.monitorPrompt.input.Focus() + } + x, y := renderedTextStart(t, m, "Standard (default)") + next, _ := m.Update(tea.MouseMotionMsg{X: x, Y: y}) + m = next.(Model) + if m.monitorCommands.busy || f.calls != 0 || m.monitorCommands.selected != 2 { + t.Fatal("hover selected or applied an option") + } + next, cmd := m.Update(tea.MouseClickMsg{X: x, Y: y, Button: tea.MouseLeft}) + m = next.(Model) + if m.monitorCommands.selected != 0 || f.calls != 0 { + t.Fatal("click did not select the rendered option or sent before command execution") + } + if direct := reversible || noConfirm; (cmd != nil) != direct || m.monitorCommands.busy != direct { + t.Fatal("picker click ignored the confirmation policy") + } + if cmd == nil { + if m.monitorCommands.reviewedChoice != "" || m.monitorCommands.detail { + t.Fatal("guarded picker click did more than highlight") + } + return + } + _, duplicate := m.Update(tea.MouseClickMsg{X: x, Y: y, Button: tea.MouseLeft}) + if duplicate != nil { + t.Fatal("busy picker permitted a duplicate submission") + } + cmd() + if f.calls != 1 || f.choice != "default" { + t.Fatal("picker did not apply exactly the clicked choice") + } + }) + } + } + } + } +} + +func TestMonitorCommandRightRepeatKeepsTextCursorMovement(t *testing.T) { + for _, inline := range []bool{false, true} { + for _, path := range []string{"rename", "cd", "session/name", "model"} { + if !inline && path == "model" { + continue // Modal choices use Right to choose, not edit a filter. + } + t.Run(fmt.Sprintf("inline=%t/path=%s", inline, path), func(t *testing.T) { + m, f := commandTestModel(t) + p := &m.monitorCommands + p.menu.Path = path + p.menu.Input = path != "model" + p.input = textinput.New() + p.input.SetValue("abc") + p.input.Focus() + p.input.CursorEnd() + if inline { + p.inline = true + p.prefix = "/" + path + " " + m.monitorPrompt.input.SetValue(p.prefix + "abc") + m.monitorPrompt.input.Focus() + m.monitorPrompt.input.CursorEnd() + } + for _, k := range []tea.KeyPressMsg{ + {Code: tea.KeyLeft}, {Code: tea.KeyLeft}, + {Code: tea.KeyRight, IsRepeat: true}, key('X'), + } { + next, _ := m.Update(k) + m = next.(Model) + } + got := m.monitorCommands.input.Value() + want := "abXc" + if inline { + got = m.monitorPrompt.input.Value() + want = m.monitorCommands.prefix + want + } + if got != want || f.calls != 0 { + t.Fatalf("held Right lost cursor movement: got %q, want %q (calls=%d)", got, want, f.calls) + } + next, cmd := m.Update(tea.KeyPressMsg{Code: tea.KeyEnter, IsRepeat: true}) + if cmd != nil || next.(Model).monitorCommands.busy || f.calls != 0 { + t.Fatal("held Enter submitted text or opened a review") + } + }) + } + } +} + +func TestMonitorCommandRepeatGuardsOnlySubmissionKeys(t *testing.T) { + m, f := commandTestModel(t) + m.SetNoConfirm(true) + for _, code := range []rune{tea.KeyEnter, tea.KeyRight} { + next, cmd := m.Update(tea.KeyPressMsg{Code: code, IsRepeat: true}) + m = next.(Model) + if cmd != nil || m.monitorCommands.busy || f.calls != 0 { + t.Fatal("held choice activation sent a command") + } + } + _, cmd := m.Update(tea.KeyPressMsg{Code: tea.KeyRight}) + if cmd == nil { + t.Fatal("ordinary Right no longer activates a choice") + } + + for _, inline := range []bool{false, true} { + m, f := commandTestModel(t) + m.monitorCommands.inline = inline + m.monitorCommands.menu.Multiple = true + m.monitorCommands.menu.Choices = append(m.monitorCommands.menu.Choices, codex.SessionCommandChoice{ID: "second", Label: "Second"}) + next, cmd := m.Update(tea.KeyPressMsg{Code: tea.KeyRight, IsRepeat: true}) + m = next.(Model) + if cmd != nil || f.calls != 0 || m.monitorCommands.selected != 1 || m.monitorCommands.menu.Choices[1].ID != "choice" { + t.Fatal("held Right blocked local checkbox reordering", inline) + } + } +} diff --git a/internal/ui/monitor_commands_test.go b/internal/ui/monitor_commands_test.go index 1f0ca52e..9fadb747 100644 --- a/internal/ui/monitor_commands_test.go +++ b/internal/ui/monitor_commands_test.go @@ -46,6 +46,72 @@ func commandTestModel(t *testing.T) (Model, *commandTestClient) { n, _ := m.Update(cmd()) return n.(Model), f } + +func TestMonitorCommandsApplyReversibleChoicesWithoutExtraConfirmation(t *testing.T) { + for _, noConfirm := range []bool{false, true} { + for _, reversible := range []bool{false, true} { + m, f := commandTestModel(t) + m.SetNoConfirm(noConfirm) + m.monitorCommands.menu.Choices[0].Reversible = reversible + m.monitorPrompt.input.SetValue("keep draft") + next, cmd, _ := m.chooseMonitorCommand() + if direct := noConfirm || reversible; (cmd != nil) != direct { + t.Fatal("wrong confirmation policy", noConfirm, reversible) + } + if cmd != nil { + if _, duplicate, _ := next.chooseMonitorCommand(); duplicate != nil { + t.Fatal("busy action could be sent twice") + } + n, _ := next.Update(cmd()) + next = n.(Model) + if f.calls != 1 || next.monitorCommands.open || next.monitorPrompt.input.Value() != "keep draft" { + t.Fatal("direct action did not close its stale menu and preserve draft") + } + } + } + } +} + +func TestNoConfirmDoesNotApplyUnavailableOrHiddenCommands(t *testing.T) { + for _, blocked := range []string{"unavailable", "tiny", "busy", "notice", "closed"} { + m, f := commandTestModel(t) + m.SetNoConfirm(true) + switch blocked { + case "unavailable": + m.monitorCommands.menu.Choices[0].Unavailable = "Waiting for idle." + case "tiny": + m.height = 2 + case "busy": + m.monitorCommands.busy = true + case "notice": + m.monitorCommands.notice = "Outcome uncertain; do not retry." + case "closed": + m.monitorCommands.open = false + } + if _, cmd, _ := m.chooseMonitorCommand(); cmd != nil || f.calls != 0 { + t.Fatal("confirmation flag bypassed availability", blocked) + } + } +} + +func TestReversibleCommandClickSurfacesUseTheRenderedLayout(t *testing.T) { + for _, width := range []int{60, 120, 180} { + for _, label := range []string{"Medium", "[ ENTER APPLY ]"} { + m, f := commandTestModel(t) + m.width = width + m.monitorCommands.menu.Choices[0].Reversible = true + x, y := renderedTextStart(t, m, label) + n, cmd := m.Update(tea.MouseClickMsg{X: x, Y: y, Button: tea.MouseLeft}) + if cmd == nil || !n.(Model).monitorCommands.busy || f.calls != 0 { + t.Fatal("reversible action missed its click target", width, label) + } + cmd() + if f.calls != 1 { + t.Fatal("click did not send exactly one command", width, label) + } + } + } +} func TestMonitorCommandsConfirmationAndDraft(t *testing.T) { m, f := commandTestModel(t) m.monitorPrompt.input.SetValue("keep draft") diff --git a/internal/ui/monitor_prompt.go b/internal/ui/monitor_prompt.go index 5fa2f4a1..af8e50bd 100644 --- a/internal/ui/monitor_prompt.go +++ b/internal/ui/monitor_prompt.go @@ -362,6 +362,11 @@ func (m Model) updateMonitorPrompt(msg tea.Msg) (Model, tea.Cmd, bool) { *p = monitorPromptState{session: p.session} m.monitorApprovalConfirm = "" m.monitorApprovalNumberReleased = false + if m.confirmations.NoConfirm { + // Losing composer focus must never reinterpret typing + // as an immediate grant, even with fewer UI prompts. + return m, nil, true + } return m.updateMonitorApprovalKey(name) } } diff --git a/internal/ui/monitor_queue.go b/internal/ui/monitor_queue.go index 18946540..637f9285 100644 --- a/internal/ui/monitor_queue.go +++ b/internal/ui/monitor_queue.go @@ -380,6 +380,11 @@ func (m *Model) openQueueItem(index int, remove bool) tea.Cmd { q.input, _ = m.queueEditorLayout(g.contentWidth, g.meterHeight) m.monitorPrompt.input.Blur() if remove { + if m.confirmations.NoConfirm { + next, cmd, _ := m.changeQueueItem() + *m = next + return cmd + } return nil } return q.input.Focus() diff --git a/internal/ui/monitor_schedule_panel.go b/internal/ui/monitor_schedule_panel.go index e3ddba5e..7e547d55 100644 --- a/internal/ui/monitor_schedule_panel.go +++ b/internal/ui/monitor_schedule_panel.go @@ -171,6 +171,9 @@ func (m *Model) triggerAction(key string) tea.Cmd { p.confirmToken = m.monitorPromptOffer().Token p.confirmUntil = time.Now().Add(20 * time.Second) p.notice = "" + if m.confirmations.NoConfirm { + return m.triggerAction("ctrl+y") + } } case "ctrl+y": if p.confirmID != j.ID || !time.Now().Before(p.confirmUntil) || !m.triggerReady(j) || p.confirmToken != m.monitorPromptOffer().Token { diff --git a/internal/ui/quota_reset_test.go b/internal/ui/quota_reset_test.go index 582fc1f8..08e73c94 100644 --- a/internal/ui/quota_reset_test.go +++ b/internal/ui/quota_reset_test.go @@ -32,6 +32,20 @@ func resetModel() (Model, *resetFake) { return m, f } +func TestNoConfirmNeverBypassesQuotaResetConfirmation(t *testing.T) { + m, f := resetModel() + m.SetNoConfirm(true) + n, cmd := m.pressQuotaReset() + m = n.(Model) + if cmd != nil || len(f.keys) != 0 || m.resetConfirmUntil.IsZero() { + t.Fatal("--no-confirm bypassed the irreversible quota-reset confirmation") + } + _, cmd = m.pressQuotaReset() + if cmd == nil { + t.Fatal("explicit quota-reset confirmation stopped working") + } +} + func TestQuotaResetConfirmationAndRetry(t *testing.T) { m, f := resetModel() u, cmd := m.pressQuotaReset() diff --git a/internal/ui/quota_step_down.go b/internal/ui/quota_step_down.go index 57f31259..aef9df79 100644 --- a/internal/ui/quota_step_down.go +++ b/internal/ui/quota_step_down.go @@ -183,6 +183,9 @@ func (m Model) pressQuotaSession(id string, confirm bool) (Model, tea.Cmd) { return m, nil } m.resetConfirmUntil = time.Time{} + if m.confirmations.NoConfirm { + return m.startQuotaUpdate(targets) + } if !confirm { m.quota.confirm = targets m.quota.confirmStep = *m.quotaStepPending diff --git a/internal/web/control_commands_test.go b/internal/web/control_commands_test.go index ebe9386d..6a198d9c 100644 --- a/internal/web/control_commands_test.go +++ b/internal/web/control_commands_test.go @@ -100,6 +100,30 @@ func TestCommandConfirmationIsBoundAndSingleUse(t *testing.T) { } } +func TestNoConfirmDoesNotBypassServerCommandTickets(t *testing.T) { + s, _, token := controlServer(t) + s.store.state.NoConfirm = true + f := &commandsFake{revision: "current"} + s.control.commands = f + b := actionRequest{Session: "parent", Command: &commandRequest{Mode: "commit", Path: "model", Revision: "current", Choice: "choice"}} + if w := actionCall(s, token, "commands", b); w.Code != 409 || f.calls != 0 { + t.Fatal("single-click presentation bypassed the server preparation ticket") + } + b.Command.Mode = "prepare" + r := actionCall(s, token, "commands", b) + var prepared struct{ Confirmation string } + if r.Code != 200 || json.Unmarshal(r.Body.Bytes(), &prepared) != nil || prepared.Confirmation == "" || f.calls != 0 { + t.Fatal("preparation wrote a command or failed", r.Code) + } + b.Command.Mode, b.Confirmation = "commit", prepared.Confirmation + if w := actionCall(s, token, "commands", b); w.Code != 200 || f.calls != 1 { + t.Fatal("prepared command could not commit") + } + if w := actionCall(s, token, "commands", b); w.Code != 409 || f.calls != 1 { + t.Fatal("no-confirm allowed a replay") + } +} + func TestCommandsRejectStaleAndMixedRequests(t *testing.T) { s, _, token := controlServer(t) f := &commandsFake{revision: "new"} diff --git a/internal/web/dist/assets/index-DdTUC-03.js b/internal/web/dist/assets/index-D12p0CYy.js similarity index 78% rename from internal/web/dist/assets/index-DdTUC-03.js rename to internal/web/dist/assets/index-D12p0CYy.js index 7de76c01..bf40774a 100644 --- a/internal/web/dist/assets/index-DdTUC-03.js +++ b/internal/web/dist/assets/index-D12p0CYy.js @@ -9,39 +9,39 @@ redemption order.
`),Va=J(` `,1),Ha=jr(`Cycle duration or reset date unavailable — position cannot be plotted.
`),Ka=J(`
`),Xa=J(`
No quota windows reported yet.
`),Qa=J(` `,1),$a=J(`
All reported windows are shown. API-equivalent learning and quota status scoring remain in the terminal for this first preview.
`,1),eo=J(` `,1);function to(e,t){Ue(t,!0);let n=Wi(t,`params`,19,()=>({})),r=F(()=>ea.filter(e=>e!==`thresholds`||!!$.data?.thresholds?.length)),i=L(Yt(Date.now())),a=F(()=>K(r).includes(ta(n().view))?ta(n().view):`bars`);Gi(()=>{let e=setInterval(()=>R(i,Date.now(),!0),1e3);return()=>clearInterval(e)});function o(e){return!e.duration||e.duration<=0||!e.reset?null:Math.max(0,Math.min(100,100*(1-(e.reset*1e3-K(i))/(e.duration*6e4))))}vn(()=>{aa.view=K(a),(n().view===`zone`||n().view===`consumption-pace`)&&Zi(`/quota/pace`)});function s(e){let t=e/100*Math.PI*2;return`M60 60 L60 14 A46 46 0 ${+(e>50)} 1 ${60+46*Math.sin(t)} ${60-46*Math.cos(t)} Z`}var c=eo(),l=B(c);Xr(l,21,()=>K(r),Kr,(e,t)=>{var n=Fa();let r;var i=V(n,!0);U(e=>{Q(n,`href`,`#/quota/`+K(t)),Q(n,`aria-current`,K(a)===K(t)?`page`:void 0),r=ci(n,1,``,null,r,{active:K(a)===K(t)}),X(i,e)},[()=>K(t)===`fuel`?`FUEL TANK`:K(t).toUpperCase()]),Y(e,n)}),P(l);var u=H(l,2),d=e=>{var t=$a(),n=B(t),r=e=>{Y(e,Ia())};Z(n,e=>{$.data.quotaError&&e(r)});var i=H(n,2),c=e=>{var t=La(),n=V(t);U(()=>X(n,`Last usage accounting issue: - ${$.data.usageDiagnostic??``}`)),Y(e,t)};Z(i,e=>{$.data.usageDiagnostic&&e(c)});var l=H(i,2),u=V(l),d=H(l,2),f=e=>{wa(e,{})},p=e=>{var t=Ba(),n=z(t),r=V(n),i=H(n,4),a=e=>{Y(e,Ra())};Z(i,e=>{$.data.credits.length||e(a)}),Xr(H(i,2),17,()=>$.data.credits,Kr,(e,t)=>{var n=za(),r=z(n),i=V(r),a=V(H(r,2),!0);P(n),U(e=>{X(i,`${(K(t).title||`Quota reset`)??``} // ${K(t).status??``}`),X(a,e)},[()=>K(t).expiryKnown?K(t).expires?`EXPIRES `+ma(K(t).expires):`Does not expire`:`Expiry information unavailable`]),Y(e,n)}),xe(2),P(t),U(()=>X(r,`RESET INVENTORY // ${$.data.creditCount??``} AVAILABLE`)),Y(e,t)},m=e=>{var t=Qa(),n=B(t);let r;Xr(n,21,()=>$.data.meters,Kr,(e,t)=>{let n=F(()=>o(K(t)));var r=Xa(),i=z(r),c=V(i,!0),l=H(i,2),u=z(l),d=e=>{var n=Va(),r=B(n),i=V(r),a=V(H(r));U(()=>{X(i,`FREE ${100-K(t).used}%`),X(a,`USED ${K(t).used??``}%`)}),Y(e,n)},f=e=>{var n=Va(),r=B(n),i=V(r),a=V(H(r));U(()=>{X(i,`USED ${K(t).used??``}%`),X(a,`FREE ${100-K(t).used}%`)}),Y(e,n)};Z(u,e=>{K(a)===`fuel`?e(d):e(f,-1)}),P(l);var p=H(l,2);let m;var h=z(p),g=e=>{var n=Wa(),r=z(n),i=H(z(r)),a=e=>{Y(e,Ha())},o=e=>{var n=Ua();U(e=>Q(n,`d`,e),[()=>s(K(t).used)]),Y(e,n)};Z(i,e=>{K(t).used>=100?e(a):K(t).used>0&&e(o,1)}),P(r),P(n),U(()=>Q(r,`aria-label`,`${K(t).used}% quota used`)),Y(e,n)},_=e=>{var r=Nr(),i=B(r),a=e=>{{let r=F(()=>K(t).trail||[]);Pa(e,{get used(){return K(t).used},get elapsed(){return K(n)},get trail(){return K(r)},get duration(){return K(t).duration}})}},o=e=>{Y(e,Ga())};Z(i,e=>{K(n)===null?e(o,-1):e(a)}),Y(e,r)},v=e=>{var r=Ja(),i=B(r),o=z(i);let s;P(i);var c=H(i,2),l=e=>{Y(e,Ka())};Z(c,e=>{K(a)===`fuel`&&e(l)});var u=H(c,2),d=e=>{var t=qa(),r=B(t),i=V(r),o=H(r,2),s=z(o);let c;P(o),U(e=>{X(i,`RESET CYCLE // ${e??``}% ELAPSED`),c=ui(s,``,c,{width:`${K(a)===`fuel`?100-K(n):K(n)}%`})},[()=>Math.floor(K(n))]),Y(e,t)};Z(u,e=>{K(n)!==null&&e(d)}),U(()=>{Q(i,`aria-label`,K(a)===`fuel`?`Fuel remaining`:`Quota used`),Q(i,`aria-valuenow`,K(a)===`fuel`?100-K(t).used:K(t).used),s=ui(o,``,s,{width:`${K(a)===`fuel`?100-K(t).used:K(t).used}%`})}),Y(e,r)};Z(h,e=>{K(a)===`pie`?e(g):K(a)===`pace`?e(_,1):e(v,-1)}),P(p);var y=H(p,2),b=V(y),x=H(y,2),S=e=>{var n=Ya(),r=V(n,!0);U(()=>X(r,K(t).details)),Y(e,n)};Z(x,e=>{K(t).details&&e(S)}),P(r),U(e=>{X(c,K(t).name),m=ci(p,1,`meter-graphic`,null,m,{"bar-graphic":K(a)===`bars`||K(a)===`fuel`}),X(b,`RESETS // ${e??``}`)},[()=>ma(K(t).reset)]),Y(e,r)}),P(n);var i=H(n,2),c=e=>{Y(e,Za())};Z(i,e=>{$.data.meters.length||e(c)}),U(()=>r=ci(n,1,`quota-grid`,null,r,{radial:K(a)===`pie`,zone:K(a)===`pace`})),Y(e,t)};Z(d,e=>{K(a)===`thresholds`?e(f):K(a)===`resets`?e(p,1):e(m,-1)}),xe(2),U(e=>X(u,`QUOTA // OBSERVED ${e??``}`),[()=>ma($.data.quotaAt)]),Y(e,t)};Z(u,e=>{$.data&&e(d)}),Y(e,c),We()}var no=J(``),ro=J(``,1);function io(e,t){Ue(t,!0);let n=Wi(t,`values`,19,()=>[]),r=Wi(t,`label`,3,`Token activity`),i=Wi(t,`capacity`,3,0),a=F(()=>Math.max(0,...n())),o=F(()=>i()>n().length?[...Array(i()-n().length).fill(0),...n()]:n());var s=ro(),c=B(s),l=V(c),u=H(c,2);Xr(u,21,()=>K(o),Kr,(e,t)=>{var n=no();let r;U((e,t)=>{Q(n,`title`,e),r=ui(n,``,r,{height:t})},[()=>K(t).toLocaleString(`en-GB`)+` tokens`,()=>`${100*K(t)/Math.max(1,K(a))}%`]),Y(e,n)}),P(u),U((e,t)=>{X(l,`SCALE // 0 — ${e??``} TOKENS`),Q(u,`aria-label`,t)},[()=>K(a).toLocaleString(`en-GB`),()=>`${r()}. Peak ${K(a).toLocaleString(`en-GB`)} tokens.`]),Y(e,s),We()}function ao(e){if(!e||![`LAST REPLY`,`LAST ACTIVITY`].includes(e.contextKind))return``;let t=e.text||e.contextKind===`LAST ACTIVITY`&&e.workingCommand||``;return t.trim()?t:``}var oo=J(` `),so=J(``),co=J(`
`),lo=J(`
`,1),uo=J(`
`),fo=J(`
Loading / sending…
`),po=J(``),mo=J(``),ho=J(`
Review expired. Press Enter to review again.
`),yo=J(``,1),bo=J(`
`,1),xo=J(`
No available matching commands.
`),So=J(` `,1),Co=J(``),wo=J(`
Review expired. Review the option again.
`),To=J(``),Eo=J(``),Do=J(``),Oo=J(``),ko=J(``),Ao=J(``),jo=J(``),Mo=J(``,1);function io(e,t){Ue(t,!0);let n=Wi(t,`values`,19,()=>[]),r=Wi(t,`label`,3,`Token activity`),i=Wi(t,`capacity`,3,0),a=F(()=>Math.max(0,...n())),o=F(()=>i()>n().length?[...Array(i()-n().length).fill(0),...n()]:n());var s=ro(),c=B(s),l=V(c),u=H(c,2);Xr(u,21,()=>K(o),Kr,(e,t)=>{var n=no();let r;U((e,t)=>{Q(n,`title`,e),r=ui(n,``,r,{height:t})},[()=>K(t).toLocaleString(`en-GB`)+` tokens`,()=>`${100*K(t)/Math.max(1,K(a))}%`]),Y(e,n)}),P(u),U((e,t)=>{X(l,`SCALE // 0 — ${e??``} TOKENS`),Q(u,`aria-label`,t)},[()=>K(a).toLocaleString(`en-GB`),()=>`${r()}. Peak ${K(a).toLocaleString(`en-GB`)} tokens.`]),Y(e,s),We()}function ao(e){if(!e||![`LAST REPLY`,`LAST ACTIVITY`].includes(e.contextKind))return``;let t=e.text||e.contextKind===`LAST ACTIVITY`&&e.workingCommand||``;return t.trim()?t:``}var oo=J(` `),so=J(``),co=J(`
`),lo=J(`
`,1),uo=J(`
`),fo=J(`
Loading / sending…
`),po=J(``),mo=J(``),ho=J(`
Review expired. Press Enter to review again.
`),yo=J(``,1),bo=J(`
`,1),xo=J(`
No available matching commands.
`),So=J(` `,1),Co=J(``),wo=J(`
Review expired. Review the option again.
`),To=J(``),Eo=J(``),Do=J(``),Oo=J(``),ko=J(``),Ao=J(``),jo=J(` `),Bo=J(`
Send this saved prompt now? This starts Codex work and consumes quota.
`,1),Vo=J(``),Ho=J(`
In memory only. Follows session model, reasoning and speed. Closing - Codexometer cancels pending work.
MODEL / REASONING LEVEL / SPEED
MODEL / REASONING LEVEL / SPEED
Applied settings remain after Codexometer closes.
`,1),Wo=J(``),Go=J(`
`,1),Ko=J(`
Command unavailable from this observation. Open Codex to inspect the - request.
`),qo=J(`Session controls temporarily unavailable. Check Codex for current state.
`),Jo=J(`Checking session controls…
`),Yo=J(``),Xo=J(`
Controls require a supported live request from a connected shared - app-server session. Local observations alone cannot provide them.
`),$o=J(`Grants permission beyond this one action. Check the scope
- carefully.`),es=J(``),ts=J(``),ns=J(``),rs=J(``),is=J(`Not before this time; when quota and idle allow.
`),as=J(``,1),os=J(`
The existing trigger remains active until saved or deleted. If - it changes or sends while you edit, saving is blocked.
`),ss=J(` `,1),cs=J(``),ls=J(``),us=J(``),ds=J(` `,1),fs=J(`Type one of these choices exactly. Your answer stays masked.
`),gs=J(`
`,1),_s=J(` `,1),vs=J(``),ys=J(`
`,1),bs=J(`
`),zo=J(`
Send this saved prompt now? This starts Codex work and consumes quota.
`,1),Bo=J(``),Vo=J(`
In memory only. Follows session model, reasoning and speed. Closing + Codexometer cancels pending work.
MODEL / REASONING LEVEL / SPEED
MODEL / REASONING LEVEL / SPEED
Applied settings remain after Codexometer closes.
`,1),Uo=J(``),Wo=J(`
`,1),Go=J(`
Command unavailable from this observation. Open Codex to inspect the + request.
`),Ko=J(`Session controls temporarily unavailable. Check Codex for current state.
`),qo=J(`Checking session controls…
`),Jo=J(``),Yo=J(`
Controls require a supported live request from a connected shared + app-server session. Local observations alone cannot provide them.
`),Qo=J(`Grants permission beyond this one action. Check the scope
+ carefully.`),$o=J(``),es=J(``),ts=J(``),ns=J(``),rs=J(`Not before this time; when quota and idle allow.
`),is=J(``,1),as=J(`
The existing trigger remains active until saved or deleted. If + it changes or sends while you edit, saving is blocked.
`),os=J(` `,1),ss=J(``),cs=J(``),ls=J(``),us=J(` `,1),ds=J(`Type one of these choices exactly. Your answer stays masked.
`),hs=J(`
`,1),gs=J(` `,1),_s=J(``),vs=J(`
`,1),ys=J(`
Choose multiple fields and their order. These display preferences do not - change Codex CLI configuration. Missing values are omitted.
`,1),As=J(`
`,1),js=J(`
`),Ns=J(`
`),Fs=J(`
`,1),Is=J(`
`),Ls=J(`
Command unavailable from this observation. Open Codex to inspect the - request.
`),Rs=J(``),Bs=J(` `,1),Vs=J(`
Session connection or refresh unavailable. Context and telemetry may be - stale.
`),Us=J(`Some quota profile checks are unavailable. Only sessions with freshly + reasoning and speed.`,U(e=>X(r,`Will send: ${e??``}`),[()=>K(T)===`quota`?`when quota is available and this session is idle`:Number.isFinite(K(me))?ge(K(me)):`choose a date and time`]),Y(e,t)};Z(p,e=>{K(T)!==`now`&&e(m)});var h=H(p,2),g=e=>{Y(e,as())};Z(h,e=>{K(x)&&e(g)}),hi(r,()=>K(T),e=>R(T,e)),Y(e,t)};Z(r,e=>{K(u).questions?.length||e(i)}),Xr(H(r,2),17,()=>K(fe),Kr,(e,n,r)=>{var i=ps(),o=B(i),s=e=>{{let n=F(()=>K(d)[0]||``);Ii(No(e,{get session(){return t.session},get oncopy(){return l()},get query(){return K(n)},oncomplete:e=>{R(d,[e],!0),lr().then(()=>K(k)?.focus())},onchange:()=>{R(d,[``],!0),lr().then(()=>K(k)?.focus())}}),e=>R(re,e,!0),()=>K(re))}};Z(o,e=>{r===0&&a()!==`profile`&&K(u).kind===`prompt`&&!K(u).questions?.length&&e(s)});var c=H(o,2),f=z(c),p=H(f),m=e=>{var t=ss();xi(t),Ei(t,()=>K(d)[r],e=>K(d)[r]=e),Y(e,t)},h=e=>{var t=ls(),i=z(t);i.value=i.__value=``,Xr(H(i),17,()=>K(n).options||[],Kr,(e,t)=>{var n=cs(),r=V(n,!0),i={};U(()=>{X(r,K(t)),i!==(i=K(t))&&(n.value=(n.__value=i)??``)}),Y(e,n)}),P(t),mi(t),hi(t,()=>K(d)[r],e=>K(d)[r]=e),Y(e,t)},g=e=>{var t=us(),i=B(t);tt(i),Ii(i,e=>R(k,e),()=>K(k));var a=H(i,2),o=e=>{var t=Jo(),r=V(t);U(e=>X(r,`Suggested answers: ${e??``}`),[()=>K(n).options.join(` · `)]),Y(e,t)};Z(a,e=>{K(n).options?.length&&e(o)}),q(`keydown`,i,e=>{K(u)?.kind===`prompt`&&!K(u).questions?.length&&K(re)?.handleKey(e)}),Ei(i,()=>K(d)[r],e=>K(d)[r]=e),Y(e,t)};Z(p,e=>{K(n).secret?e(m):K(n).freeText?e(g,-1):e(h,1)}),P(c);var _=H(c,2),v=e=>{var t=fs(),r=H(z(t),4);Xr(r,21,()=>K(n).options||[],Kr,(e,t)=>{var n=ds(),r=V(n,!0);U(()=>X(r,K(t))),Y(e,n)}),P(r),P(t),Y(e,t)};Z(_,e=>{K(n).secret&&!K(n).freeText&&e(v)}),U(()=>X(f,`${K(n).text??``} `)),Y(e,i)}),Y(e,n)};Z(v,e=>{K(u).kind===`approval`||K(u).kind===`profile`?e(y):e(b,-1)}),P(s);var S=H(s,2),C=e=>{var t=hs(),n=B(t),r=e=>{var t=ms(),n=V(t);U(()=>X(n,`TRIGGER // ${K(te)??``}`)),Y(e,t)};Z(n,e=>{K(ee)&&e(r)});var i=H(n,2),a=V(i),o=H(i,2),s=V(o),c=H(o,2);U(e=>{X(a,`Check the target and ${K(u).kind===`profile`?`profile above`:K(u).kind===`approval`?K(u).fileChanges?.length?`proposed file changes above`:`exact command and permission scope`:`message above`}. ${K(ee)?`This schedules a follow-up that will send automatically when eligible`:`This will send to Codex`}; it may start work using your quota. + Confirmation expires in ${e??``}s.`),o.disabled=K(g)||K(A),X(s,`CONFIRM ${(K(u).kind===`approval`||K(u).kind===`profile`?K(u).choices?.[K(f)]?.label:K(ee)?K(x)?`SAVE CHANGES`:`SCHEDULE`:`SEND`)??``}`)},[()=>Math.max(0,Math.ceil((K(m)-K(h))/1e3))]),q(`click`,o,N),q(`click`,c,()=>{R(p,``)}),Y(e,t)},w=e=>{var t=gs(),n=B(t),r=e=>{var t=Ro(),n=V(t,!0);U(()=>X(n,K(he))),Y(e,t)};Z(n,e=>{K(he)&&e(r)});var i=H(n,2),a=V(i,!0);U(()=>{i.disabled=K(g)||K(A)||!K(j)||!!K(he),X(a,K(g)?`SENDING…`:$.data?.noConfirm?K(x)?`SAVE CHANGES`:K(u).kind===`approval`||K(u).kind===`profile`?`SEND DECISION`:K(u).kind===`prompt`&&!K(u).questions?.length&&K(T)!==`now`?`SET TRIGGER`:`SEND`:K(x)?`REVIEW CHANGES`:`REVIEW BEFORE SENDING`)}),q(`click`,i,()=>ve()),Y(e,t)};Z(S,e=>{K(de)&&!$.data?.noConfirm?e(C):e(w,-1)});var O=H(S,2),ne=e=>{var t=_s();q(`click`,t,()=>{R(x,!1),R(p,``),R(d,[],!0)}),Y(e,t)};Z(O,e=>{K(x)&&e(ne)}),U(()=>{X(o,`TARGET // ${K(u).thread??``} // ${(K(u).directory||`Directory unavailable`)??``}`),s.disabled=K(g)||K(de)||K(A),X(_,K(u).kind===`approval`||K(u).kind===`profile`?`Choose a decision`:K(x)?`EDIT SCHEDULED FOLLOW-UP`:`Reply to this session`)}),Y(e,r)};Z(ce,e=>{K(A)||K(y)?e(pe):K(u)?K(u).id?K(b)!==K(u).id&&e(ye,3):e(M,2):e(_e,1)}),P(r),U(()=>X(s,a()===`profile`?`QUOTA THRESHOLD`:`SESSION CONTROL // EXPERIMENTAL`)),Y(e,r)};Z(we,e=>{!K(ce)&&(!K(ne)||K(x)||a()||K(u)?.kind!==`prompt`||K(u).questions?.length)&&e(Te)}),Y(e,ye),We()}Sr([`click`,`keydown`]);var xs=J(` `,1),Ss=J(`
Choose multiple fields and their order. These display preferences do not + change Codex CLI configuration. Missing values are omitted.
`,1),ks=J(`
`,1),As=J(`
`),Ms=J(`
`),Ps=J(`
`,1),Fs=J(`
`),Is=J(`
Command unavailable from this observation. Open Codex to inspect the + request.
`),Ls=J(``),zs=J(` `,1),Bs=J(`
Session connection or refresh unavailable. Context and telemetry may be + stale.
`),Hs=J(`Some quota profile checks are unavailable. Only sessions with freshly verified quota and settings can be updated; previous outcome notices remain - visible.
`),Ws=J(` `),Gs=J(` `),Ks=J(` `),qs=J(``),Js=J(`Read only — reply or approve in Codex.
`),Xs=J(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),Zs=J(`
This session is no longer in the current observation. Return to sessions.
`),ec=J(``),tc=J(``),nc=J(``),rc=J(` `),ic=J(`
`),ac=J(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),oc=J(` `,1),sc=J(`
No locally observed sessions yet. Keep Codex running alongside - Codexometer.
`),dc=J(`↑ ↓ SELECT SESSION // ← LESS DETAIL // → MORE DETAIL // ESC BACK
`,1);function pc(e,t){Ue(t,!0);let n=(e,t=f,n,r)=>{let i=pt(()=>g(n?.(),!0)),a=pt(()=>g(r?.(),!1));var o=Bs(),s=B(o),c=e=>{var n=ks(),r=B(n),i=V(r,!0),a=V(H(r,2),!0);U(()=>{X(i,t().contextKind===`LAST REPLY`&&!t().streaming?`TASK`:`CURRENT TASK`),X(a,t().currentTask)}),Y(e,n)};Z(s,e=>{t().currentTask&&e(c)});var l=H(s,2),u=e=>{var n=As(),r=V(H(B(n),2),!0);U(()=>X(r,t().latestGuidance)),Y(e,n)};Z(l,e=>{t().latestGuidance&&e(u)});var d=H(l,2),p=e=>{var n=js(),r=V(H(B(n),2),!0);xe(2),U(()=>X(r,t().approvalContext)),Y(e,n)};Z(d,e=>{K(a)&&t().contextKind===`APPROVAL REQUEST`&&t().approvalContext&&e(p)});var m=H(d,2),h=e=>{var n=Ms();let r;var i=V(n,!0);U(e=>{r=ci(n,1,`attention-note`,null,r,{inferred:t().status===`CHECK SESSION`}),X(i,e)},[()=>D(t())]),Y(e,n)},_=F(()=>D(t())&&(!K(a)||K(v)||t().status===`CHECK SESSION`||y(t())));Z(m,e=>{K(_)&&e(h)});var b=H(m,2),x=e=>{var n=Ns(),r=V(n,!0);U(e=>X(r,e),[()=>ee(t())]),Y(e,n)};Z(b,e=>{K(i)&&e(x)});var S=H(b,2),C=e=>{var n=Ps(),r=V(n,!0);U(()=>X(r,t().text||`No session context available.`)),Y(e,n)};Z(S,e=>{(t().text||!t().workingCommand)&&e(C)});var w=H(S,2),T=e=>{var n=Fs(),r=H(B(n),2),i=z(r),a=H(i),o=e=>{var n=Mr();U(()=>X(n,`// ${t().commandTiming??``}`)),Y(e,n)};Z(a,e=>{t().commandTiming&&e(o)});var s=H(a,2),c=e=>{var n=Mr();U(()=>X(n,`// +${(t().runningCommands||0)-+(t().commandStatus===`running`)} RUNNING`)),Y(e,n)};Z(s,e=>{!K(v)&&(t().runningCommands||0)>+(t().commandStatus===`running`)&&e(c)});var l=H(s,2),u=e=>{Y(e,Mr(`+`))};Z(l,e=>{t().runningLimited&&e(u)}),P(r);var d=V(H(r,2),!0);U(e=>{X(i,`COMMAND // ${e??``} `),X(d,t().workingCommand)},[()=>K(v)?`UNKNOWN`:(t().commandStatus||`unknown`).toUpperCase()]),Y(e,n)};Z(w,e=>{t().workingCommand&&e(T)});var E=H(w,2),te=e=>{Ro(e,{get lines(){return t().fileChanges}})},O=e=>{var n=Rs(),r=H(B(n),2),i=V(r,!0),a=H(r,2),o=e=>{var n=Is(),r=V(n,!0);U(()=>X(r,t().command)),Y(e,n)},s=e=>{Y(e,Ls())};Z(a,e=>{t().command?e(o):e(s,-1)}),U(()=>X(i,K(v)||t().status!==`APPROVAL NEEDED`?`LAST OBSERVED COMMAND`:$.data?.control?`COMMAND REQUEST`:`COMMAND TO APPROVE IN CODEX`)),Y(e,n)};Z(E,e=>{(!K(a)||!$.data?.control)&&t().fileChanges?.length?e(te):K(a)&&$.data?.control||!t().command&&t().status!==`APPROVAL NEEDED`||e(O,1)});var ne=H(E,2),k=e=>{var n=zs(),r=V(n);U(()=>X(r,`CONTEXT SOURCE // ${(t().source||`LOCAL`)??``} // OBSERVATION`)),Y(e,n)};Z(ne,e=>{K(a)||e(k)}),Y(e,o)},r=L(void 0),i=Wi(t,`params`,19,()=>({})),a=F(()=>$.data?.sessions||[]),o=F(()=>$.data?.control&&$.data.profiles||[]),s=F(()=>($.data?.triggers||[]).filter(e=>K(a).some(t=>t.id===e.session)));function c(e,t){i().id&&i().id!==t&&K(u)?e.preventDefault():w(t)}function l(e){return[`TURN COMPLETE`,`IDLE`,`ACTIVE`].includes(e.status)&&K(s).some(t=>t.session===e.id)?`TRIGGER SET`:e.status}let u=L(!1);function d(e,t){i().id&&i().id!==t&&K(u)?e.preventDefault():w(t)}vn(()=>{let e=i().id;e&&fr(()=>{aa.selected=e,fa(e,2)})});let p=F(()=>K(a).find(e=>e.id===i().id)),m=F(()=>new URLSearchParams(Yi.querystring).get(`review`)===`profile`&&K(o).some(e=>e.session===i().id&&e.pending)),h=F(()=>K(a).some(e=>e.id===aa.selected)?aa.selected:K(a)[0]?.id),v=F(()=>!$.connected||!!$.data?.sessionsError);function y(e){return e.status!==`STALE`&&e.failed===!0}let b=F(()=>[[`OBSERVED TOKENS`,pa(K(a).reduce((e,t)=>e+t.tokens,0))],[`LISTED SESSIONS`,pa(K(a).length)],...[[`WORKING`,`WORKING`],[`AWAITING APPROVAL`,`APPROVAL NEEDED`],[`AWAITING INPUT`,`INPUT NEEDED`],[`ERRORS`,`ERRORS`],[`CHECK · INFERRED`,`CHECK SESSION`]].map(([e,t])=>[e,K(v)?`—`:pa(K(a).filter(e=>t===`ERRORS`?y(e):e.status===t).length)])]),x=F(()=>K(a).filter(e=>[`INPUT NEEDED`,`APPROVAL NEEDED`].includes(e.status)||y(e)).sort((e,t)=>S(e)-S(t)));function S(e){return e.status===`APPROVAL NEEDED`?0:e.status===`INPUT NEEDED`?1:2}let C=F(()=>K(a).filter(e=>e.status===`TURN COMPLETE`&&!K(s).some(t=>t.session===e.id)&&!K(o).some(t=>t.session===e.id&&t.pending)));function w(e){aa.selected=e,lr().then(()=>document.querySelector(`.session-row.selected`)?.scrollIntoView({block:`nearest`}))}function T(e,t){if(w(e),i().id){t<0&&(fa(e,2),location.hash=`/sessions`);return}let n=ua(e)+t;n>2?location.hash=`/sessions/`+encodeURIComponent(e):fa(e,n)}function E(e){let t=e.target;if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||t.closest(`input, textarea, select, [contenteditable="true"]`))){if(e.key===`Escape`&&i().id)e.preventDefault(),T(i().id,-1);else if([`ArrowLeft`,`ArrowRight`].includes(e.key)&&(i().id||K(h)))e.preventDefault(),T(i().id||K(h),e.key===`ArrowLeft`?-1:1);else if(!i().id&&[`ArrowUp`,`ArrowDown`].includes(e.key)&&K(a).length){e.preventDefault();let t=K(a).findIndex(e=>e.id===K(h));w(K(a)[Math.max(0,Math.min(K(a).length-1,t+(e.key===`ArrowUp`?-1:1)))].id)}}}function D(e){return K(v)?`Last observation only — refresh unavailable. Check Codex for current state.`:e.status===`CHECK SESSION`?`INFERRED INACTIVITY — a quiet session, not a confirmed input or approval request. Local tools may still be running.`:y(e)?e.status===`MODEL BUSY`?`CONFIRMED TURN FAILURE — the selected model was at capacity. Choose another model with /model or retry later in Codex. This is not a quota-exhaustion signal.`:e.status===`MODEL UNAVAILABLE`?`CONFIRMED TURN FAILURE — the provider could not find the selected model. Choose an available model in Codex. No automatic retry or model change.`:e.status===`CAPACITY RESTRICTED`?`CONFIRMED TURN FAILURE — capacity is unavailable on a policy-restricted route. This is not a quota-exhaustion signal. Check Codex for details; no automatic retry or policy change.`:`CONFIRMED TURN FAILURE — inspect the error below before sending another prompt. No automatic retry or model change.`:$.data?.control&&[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(e.status)?`Open full detail for supported live controls; otherwise reply in Codex.`:e.status===`APPROVAL NEEDED`?`OBSERVED APPROVAL SIGNAL — approve or decline in Codex.`:e.status===`INPUT NEEDED`?`OBSERVED INPUT SIGNAL — reply in Codex.`:e.status===`TURN COMPLETE`?`OBSERVED TURN COMPLETION — informational, not an approval request.`:``}function ee(e){return e.streaming&&e.contextKind===`LAST REPLY`?`REPLY // STREAMING`:e.contextKind||`LAST ACTIVITY`}var te=fc();xr(`keydown`,Qt,E);var O=B(te),ne=V(H(z(O),2));P(O);var k=H(O,2);let re;Xr(k,21,()=>K(b),Kr,(e,t)=>{var n=F(()=>_(K(t),2));let r=()=>K(n)[0],i=()=>K(n)[1];var a=Vs();let o;var s=z(a),c=V(s,!0),l=V(H(s,2),!0);P(a),U(()=>{o=ci(a,1,`svelte-mm4wfe`,null,o,{failed:r()===`ERRORS`&&i()!==`0`&&i()!==`—`}),X(c,r()),X(l,i())}),Y(e,a)}),P(k);var ie=H(k,2),ae=V(ie),oe=H(ie,2),se=e=>{Y(e,Hs())};Z(oe,e=>{K(v)&&e(se)});var A=H(oe,2),ce=e=>{Y(e,Us())};Z(A,e=>{$.data?.profileError&&e(ce)});var le=H(A,2),ue=e=>{var t=qs(),n=z(t);Xr(n,17,()=>K(x),Kr,(e,t)=>{var n=Ws();let r;var i=V(n);U((e,a,o)=>{r=ci(n,1,`button`,null,r,{approval:e}),Q(n,`href`,a),X(i,`${K(t).status??``} - ${o??``} // ${(K(t).name||K(t).directory||K(t).id)??``}`)},[()=>K(t).status===`APPROVAL NEEDED`||K(t).status===`INPUT NEEDED`||y(K(t)),()=>`#/sessions/`+encodeURIComponent(K(t).id),()=>Array.from(K(t).id).slice(-5).join(``).toUpperCase()]),q(`click`,n,()=>w(K(t).id)),Y(e,n)});var r=H(n,2);Xr(r,17,()=>K(o).filter(e=>e.pending&&K(a).some(t=>t.id===e.session)),Kr,(e,t)=>{var n=Gs(),r=V(n);U((e,a,o)=>{Q(n,`title`,i().id&&i().id!==K(t).session&&K(u)?`Finish sending or clear your current draft before switching sessions.`:`Review this session’s quota threshold`),Q(n,`href`,e),X(r,`QUOTA THRESHOLD ${a??``} // ${o??``}`)},[()=>`#/sessions/`+encodeURIComponent(K(t).session)+`?review=profile`,()=>Array.from(K(t).session).slice(-5).join(``).toUpperCase(),()=>K(a).find(e=>e.id===K(t).session)?.name||K(a).find(e=>e.id===K(t).session)?.directory||K(t).session]),q(`click`,n,e=>d(e,K(t).session)),Y(e,n)});var l=H(r,2);Xr(l,17,()=>K(C),Kr,(e,t)=>{var n=Ks(),r=V(n);U((e,i)=>{Q(n,`href`,e),X(r,`TURN COMPLETE ${i??``} // - ${(K(t).name||K(t).directory||K(t).id)??``}`)},[()=>`#/sessions/`+encodeURIComponent(K(t).id),()=>Array.from(K(t).id).slice(-5).join(``).toUpperCase()]),q(`click`,n,()=>w(K(t).id)),Y(e,n)}),Xr(H(l,2),17,()=>K(s),Kr,(e,t)=>{var n=Ks(),r=V(n);U((e,t,i)=>{Q(n,`href`,e),X(r,`TRIGGER SET ${t??``} // ${i??``}`)},[()=>`#/sessions/`+encodeURIComponent(K(t).session),()=>Array.from(K(t).session).slice(-5).join(``).toUpperCase(),()=>K(a).find(e=>e.id===K(t).session)?.name||K(a).find(e=>e.id===K(t).session)?.directory]),q(`click`,n,e=>c(e,K(t).session)),Y(e,n)}),P(t),Y(e,t)},de=F(()=>(K(x).length||K(C).length||K(o).some(e=>e.pending)||K(s).length)&&!K(v));Z(le,e=>{K(de)&&e(ue)});var fe=H(le,2),j=e=>{var t=Nr(),a=B(t),s=e=>{var t=Qs(),a=z(t),s=z(a);let c;var d=z(s);let f;var h=H(d);P(s);var g=H(s,2);P(a);var _=H(a,2),b=e=>{var t=zs(),n=V(t,!0);U(()=>X(n,K(p).directory)),Y(e,t)};Z(_,e=>{K(p).name&&K(p).directory&&e(b)});var x=H(_,2),S=V(x),C=H(x,2);let T;var E=z(C),D=z(E);n(D,()=>K(p),()=>!0,()=>!0),P(E);var ee=H(E,2),te=e=>{var t=Nr();Gr(B(t),()=>K(p).id,e=>{{let t=F(()=>new URLSearchParams(Yi.querystring).get(`schedule`)===`edit`),n=F(()=>K(p).fileChanges||[]);xs(e,{get session(){return K(p).id},oncopy:()=>K(r)?.copy(),get openScheduler(){return K(t)},get observedCommand(){return K(p).command},get observedFileChanges(){return K(n)},get suspended(){return K(m)},onProtectedChange:e=>{R(u,e,!0)}})}}),Y(e,t)},O=e=>{var t=Js();Gr(H(z(t),2),()=>K(p).id,e=>{Po(e,{get session(){return K(p).id},localOnly:!0,oncopy:()=>K(r)?.copy()})}),P(t),Y(e,t)};Z(ee,e=>{$.data?.control?e(te):e(O,-1)}),P(C);var ne=H(C,2);Xr(ne,17,()=>K(o).filter(e=>e.session===K(p).id),e=>e.session,(e,t)=>{var n=Zs(),r=z(n),i=e=>{var n=Ys(),r=V(n,!0);U(()=>X(r,K(t).notice)),Y(e,n)};Z(r,e=>{K(t).notice&&e(i)});var a=H(r,2),o=e=>{xs(e,{get session(){return K(p).id},review:`profile`})},s=e=>{var t=Xs();U(e=>Q(t,`href`,e),[()=>`#/sessions/`+encodeURIComponent(K(p).id)+`?review=profile`]),Y(e,t)};Z(a,e=>{K(t).pending&&K(m)?e(o):K(t).pending&&e(s,1)}),P(n),U(()=>Q(n,`id`,`quota-profile-`+K(p).id)),Y(e,n)});var k=H(ne,2),re=e=>{var t=Nr();Gr(B(t),()=>K(p).id,e=>{Ii(Os(e,{get session(){return K(p)},active:!0}),e=>R(r,e,!0),()=>K(r))}),Y(e,t)};Z(k,e=>{K(m)||e(re)}),Gr(H(k,2),()=>K(p).id,e=>{Es(e,{get session(){return K(p)},get stale(){return K(v)}})}),P(t),U((e,t,n,r)=>{c=ci(s,1,`svelte-mm4wfe`,null,c,{failed:e}),f=ci(d,1,`lamp lit svelte-mm4wfe`,null,f,{failed:t,working:K(p).status===`WORKING`&&!K(v)}),X(h,`${n??``} // ${(K(p).name||K(p).directory)??``}`),X(S,`${r??``} TOKENS // ${K(p).id??``} // CONTEXT SOURCE // ${(K(p).source||`LOCAL`)??``}`),T=ui(C,``,T,{display:K(m)?`none`:void 0})},[()=>y(K(p))&&!K(v)&&!K(m),()=>y(K(p))&&!K(v),()=>K(v)?`STALE`:K(m)?`QUOTA THRESHOLD`:l(K(p)),()=>pa(K(p).tokens)]),q(`click`,g,()=>{w(i().id),fa(i().id,2)}),Y(e,t)},c=e=>{Y(e,$s())};Z(a,e=>{K(p)?e(s):e(c,-1)}),Y(e,t)},pe=e=>{var t=dc(),r=B(t),i=H(z(r),2),s=z(i),c=H(s,2);P(i),P(r);var u=H(r,2);Xr(u,17,()=>K(a),e=>e.id,(e,t)=>{let r=F(()=>ua(K(t).id));var i=lc();let a;var s=z(i),c=z(s),u=e=>{var n=ec(),r=z(n),i=V(r);P(n),U(e=>{Q(r,`aria-pressed`,K(h)===K(t).id),X(i,`${e??``} // ${K(t).name??``}`)},[()=>Array.from(K(t).id).slice(-5).join(``).toUpperCase()]),q(`click`,r,()=>w(K(t).id)),Y(e,n)};Z(c,e=>{K(t).name&&e(u)});var f=H(c,2),p=z(f);let m;var g=z(p);let _;var b=H(g,1,!0);P(p),P(f);var x=H(f,2),S=e=>{var n=tc(),r=V(n,!0);U(()=>{Q(n,`aria-pressed`,K(h)===K(t).id),X(r,K(t).directory||K(t).id)}),q(`click`,n,()=>w(K(t).id)),Y(e,n)};Z(x,e=>{K(t).name||e(S)});var C=H(x,2),E=z(C);xe(),P(C);var D=H(C,2),te=e=>{var n=zs(),r=V(n,!0);U(()=>X(r,K(t).directory)),Y(e,n)};Z(D,e=>{K(t).name&&K(t).directory&&e(te)});var O=H(D,2),ne=V(O),k=H(O,2),re=V(k),ie=H(k,2),ae=z(ie),oe=H(ae,2),se=V(oe,!0),A=H(oe,2);P(ie);var ce=H(ie,2),le=H(ce,2),ue=e=>{var n=nc(),r=V(n,!0);U(e=>X(r,e),[()=>K(t).status===`CHECK SESSION`?`INFERRED INACTIVITY`:y(K(t))?`OPEN DETAIL FOR THE TURN ERROR`:$.data?.control?`OPEN FULL DETAIL OR REPLY IN CODEX`:K(t).status===`APPROVAL NEEDED`?`APPROVE OR DECLINE IN CODEX`:`REPLY IN CODEX`]),Y(e,n)},de=F(()=>!K(v)&&([`APPROVAL NEEDED`,`INPUT NEEDED`,`CHECK SESSION`].includes(K(t).status)||y(K(t))));Z(le,e=>{K(de)&&e(ue)}),P(s);var fe=H(s,2),j=e=>{var r=sc(),i=z(r),a=z(i),s=V(a,!0),c=H(a,2),l=e=>{var n=rc(),r=V(n,!0);U(e=>{Q(n,`href`,e),X(r,$.data?.control?`REVIEW IN FULL DETAIL ↗`:`APPROVAL IN CODEX ↗`)},[()=>`#/sessions/`+encodeURIComponent(K(t).id)]),Y(e,n)};Z(c,e=>{!K(v)&&K(t).status===`APPROVAL NEEDED`&&e(l)}),P(i);var u=H(i,2);n(u,()=>K(t),()=>!1);var f=H(u,2);Xr(f,17,()=>K(o).filter(e=>e.session===K(t).id),Kr,(e,n)=>{var r=oc(),i=B(r),a=e=>{var t=ic(),r=V(t,!0);U(()=>X(r,K(n).notice)),Y(e,t)};Z(i,e=>{K(n).notice&&e(a)});var o=H(i,2),s=e=>{var n=ac();U(e=>Q(n,`href`,e),[()=>`#/sessions/`+encodeURIComponent(K(t).id)+`?review=profile`]),q(`click`,n,e=>d(e,K(t).id)),Y(e,n)};Z(o,e=>{K(n).pending&&e(s)}),Y(e,r)});var p=H(f,2);{let e=F(()=>K(h)===K(t).id);Os(p,{get session(){return K(t)},get active(){return K(e)}})}P(r),U(e=>X(s,e),[()=>ee(K(t))]),Y(e,r)};Z(fe,e=>{K(r)>0&&e(j)});var pe=H(fe,2),me=e=>{var n=cc(),r=H(z(n),2);{let e=F(()=>(K(t).samples||[]).map(e=>e.tokens));io(r,{get values(){return K(e)},capacity:120})}var i=V(H(r,2));P(n),U(()=>X(i,`LAST ${(K(t).samples?.length||0)??``} SAMPLES // AUTO SCALE`)),Y(e,n)};Z(pe,e=>{K(r)<2&&e(me)}),P(i),U((e,n,o,s,c,l,u)=>{a=ci(i,1,`session-row`,null,a,{selected:K(h)===K(t).id,wide:K(r)===2,split:K(r)===1}),Q(i,`aria-label`,`Session `+(K(t).name||K(t).directory||K(t).id)),m=ci(p,1,`status-detail svelte-mm4wfe`,null,m,{failed:e}),Q(p,`href`,n),_=ci(g,1,`lamp lit svelte-mm4wfe`,null,_,{failed:o,working:K(t).status===`WORKING`&&!K(v)}),X(b,s),X(E,`${c??``} `),X(ne,`${K(t).agents??``} LINKED AGENTS`),X(re,`ACTIVE // ${l??``}`),ae.disabled=K(r)===0,Q(oe,`aria-expanded`,K(r)>0),X(se,K(r)?`HIDE DETAIL`:`SHOW DETAIL`),Q(ce,`href`,u)},[()=>y(K(t))&&!K(v),()=>`#/sessions/`+encodeURIComponent(K(t).id),()=>y(K(t))&&!K(v),()=>K(v)?`STALE`:l(K(t)),()=>pa(K(t).tokens),()=>ma(K(t).activity),()=>`#/sessions/`+encodeURIComponent(K(t).id)]),q(`click`,p,()=>w(K(t).id)),q(`click`,ae,()=>T(K(t).id,-1)),q(`click`,oe,()=>{w(K(t).id),fa(K(t).id,+!K(r))}),q(`click`,A,()=>T(K(t).id,1)),q(`click`,ce,()=>w(K(t).id)),Y(e,i)});var f=H(u,2),p=e=>{Y(e,uc())};Z(f,e=>{K(a).length||e(p)}),q(`click`,s,()=>da(1)),q(`click`,c,()=>da(0)),Y(e,t)};Z(fe,e=>{i().id?e(j):e(pe,-1)}),U(e=>{X(ne,`OBSERVED ${e??``}`),re=ci(k,1,`session-totals`,null,re,{stale:K(v)}),X(ae,`${K(v)?`LAST KNOWN TOTALS — live state counts unavailable. `:``}Tokens + visible.`),Us=J(` `),Ws=J(` `),Gs=J(` `),Ks=J(``),qs=J(`
Read only — reply or approve in Codex.
`),Ys=J(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),Xs=J(`
This session is no longer in the current observation. Return to sessions.
`),$s=J(``),ec=J(``),tc=J(``),nc=J(` `),rc=J(`
`),ic=J(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),ac=J(` `,1),oc=J(`
No locally observed sessions yet. Keep Codex running alongside + Codexometer.
`),uc=J(`↑ ↓ SELECT SESSION // ← LESS DETAIL // → MORE DETAIL // ESC BACK
`,1);function fc(e,t){Ue(t,!0);let n=(e,t=f,n,r)=>{let i=pt(()=>g(n?.(),!0)),a=pt(()=>g(r?.(),!1));var o=zs(),s=B(o),c=e=>{var n=Os(),r=B(n),i=V(r,!0),a=V(H(r,2),!0);U(()=>{X(i,t().contextKind===`LAST REPLY`&&!t().streaming?`TASK`:`CURRENT TASK`),X(a,t().currentTask)}),Y(e,n)};Z(s,e=>{t().currentTask&&e(c)});var l=H(s,2),u=e=>{var n=ks(),r=V(H(B(n),2),!0);U(()=>X(r,t().latestGuidance)),Y(e,n)};Z(l,e=>{t().latestGuidance&&e(u)});var d=H(l,2),p=e=>{var n=As(),r=V(H(B(n),2),!0);xe(2),U(()=>X(r,t().approvalContext)),Y(e,n)};Z(d,e=>{K(a)&&t().contextKind===`APPROVAL REQUEST`&&t().approvalContext&&e(p)});var m=H(d,2),h=e=>{var n=js();let r;var i=V(n,!0);U(e=>{r=ci(n,1,`attention-note`,null,r,{inferred:t().status===`CHECK SESSION`}),X(i,e)},[()=>D(t())]),Y(e,n)},_=F(()=>D(t())&&(!K(a)||K(v)||t().status===`CHECK SESSION`||y(t())));Z(m,e=>{K(_)&&e(h)});var b=H(m,2),x=e=>{var n=Ms(),r=V(n,!0);U(e=>X(r,e),[()=>ee(t())]),Y(e,n)};Z(b,e=>{K(i)&&e(x)});var S=H(b,2),C=e=>{var n=Ns(),r=V(n,!0);U(()=>X(r,t().text||`No session context available.`)),Y(e,n)};Z(S,e=>{(t().text||!t().workingCommand)&&e(C)});var w=H(S,2),T=e=>{var n=Ps(),r=H(B(n),2),i=z(r),a=H(i),o=e=>{var n=Mr();U(()=>X(n,`// ${t().commandTiming??``}`)),Y(e,n)};Z(a,e=>{t().commandTiming&&e(o)});var s=H(a,2),c=e=>{var n=Mr();U(()=>X(n,`// +${(t().runningCommands||0)-+(t().commandStatus===`running`)} RUNNING`)),Y(e,n)};Z(s,e=>{!K(v)&&(t().runningCommands||0)>+(t().commandStatus===`running`)&&e(c)});var l=H(s,2),u=e=>{Y(e,Mr(`+`))};Z(l,e=>{t().runningLimited&&e(u)}),P(r);var d=V(H(r,2),!0);U(e=>{X(i,`COMMAND // ${e??``} `),X(d,t().workingCommand)},[()=>K(v)?`UNKNOWN`:(t().commandStatus||`unknown`).toUpperCase()]),Y(e,n)};Z(w,e=>{t().workingCommand&&e(T)});var E=H(w,2),te=e=>{Lo(e,{get lines(){return t().fileChanges}})},O=e=>{var n=Ls(),r=H(B(n),2),i=V(r,!0),a=H(r,2),o=e=>{var n=Fs(),r=V(n,!0);U(()=>X(r,t().command)),Y(e,n)},s=e=>{Y(e,Is())};Z(a,e=>{t().command?e(o):e(s,-1)}),U(()=>X(i,K(v)||t().status!==`APPROVAL NEEDED`?`LAST OBSERVED COMMAND`:$.data?.control?`COMMAND REQUEST`:`COMMAND TO APPROVE IN CODEX`)),Y(e,n)};Z(E,e=>{(!K(a)||!$.data?.control)&&t().fileChanges?.length?e(te):K(a)&&$.data?.control||!t().command&&t().status!==`APPROVAL NEEDED`||e(O,1)});var ne=H(E,2),k=e=>{var n=Rs(),r=V(n);U(()=>X(r,`CONTEXT SOURCE // ${(t().source||`LOCAL`)??``} // OBSERVATION`)),Y(e,n)};Z(ne,e=>{K(a)||e(k)}),Y(e,o)},r=L(void 0),i=Wi(t,`params`,19,()=>({})),a=F(()=>$.data?.sessions||[]),o=F(()=>$.data?.control&&$.data.profiles||[]),s=F(()=>($.data?.triggers||[]).filter(e=>K(a).some(t=>t.id===e.session)));function c(e,t){i().id&&i().id!==t&&K(u)?e.preventDefault():w(t)}function l(e){return[`TURN COMPLETE`,`IDLE`,`ACTIVE`].includes(e.status)&&K(s).some(t=>t.session===e.id)?`TRIGGER SET`:e.status}let u=L(!1);function d(e,t){i().id&&i().id!==t&&K(u)?e.preventDefault():w(t)}vn(()=>{let e=i().id;e&&fr(()=>{aa.selected=e,fa(e,2)})});let p=F(()=>K(a).find(e=>e.id===i().id)),m=F(()=>new URLSearchParams(Yi.querystring).get(`review`)===`profile`&&K(o).some(e=>e.session===i().id&&e.pending)),h=F(()=>K(a).some(e=>e.id===aa.selected)?aa.selected:K(a)[0]?.id),v=F(()=>!$.connected||!!$.data?.sessionsError);function y(e){return e.status!==`STALE`&&e.failed===!0}let b=F(()=>[[`OBSERVED TOKENS`,pa(K(a).reduce((e,t)=>e+t.tokens,0))],[`LISTED SESSIONS`,pa(K(a).length)],...[[`WORKING`,`WORKING`],[`AWAITING APPROVAL`,`APPROVAL NEEDED`],[`AWAITING INPUT`,`INPUT NEEDED`],[`ERRORS`,`ERRORS`],[`CHECK · INFERRED`,`CHECK SESSION`]].map(([e,t])=>[e,K(v)?`—`:pa(K(a).filter(e=>t===`ERRORS`?y(e):e.status===t).length)])]),x=F(()=>K(a).filter(e=>[`INPUT NEEDED`,`APPROVAL NEEDED`].includes(e.status)||y(e)).sort((e,t)=>S(e)-S(t)));function S(e){return e.status===`APPROVAL NEEDED`?0:e.status===`INPUT NEEDED`?1:2}let C=F(()=>K(a).filter(e=>e.status===`TURN COMPLETE`&&!K(s).some(t=>t.session===e.id)&&!K(o).some(t=>t.session===e.id&&t.pending)));function w(e){aa.selected=e,lr().then(()=>document.querySelector(`.session-row.selected`)?.scrollIntoView({block:`nearest`}))}function T(e,t){if(w(e),i().id){t<0&&(fa(e,2),location.hash=`/sessions`);return}let n=ua(e)+t;n>2?location.hash=`/sessions/`+encodeURIComponent(e):fa(e,n)}function E(e){let t=e.target;if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||t.closest(`input, textarea, select, [contenteditable="true"]`))){if(e.key===`Escape`&&i().id)e.preventDefault(),T(i().id,-1);else if([`ArrowLeft`,`ArrowRight`].includes(e.key)&&(i().id||K(h)))e.preventDefault(),T(i().id||K(h),e.key===`ArrowLeft`?-1:1);else if(!i().id&&[`ArrowUp`,`ArrowDown`].includes(e.key)&&K(a).length){e.preventDefault();let t=K(a).findIndex(e=>e.id===K(h));w(K(a)[Math.max(0,Math.min(K(a).length-1,t+(e.key===`ArrowUp`?-1:1)))].id)}}}function D(e){return K(v)?`Last observation only — refresh unavailable. Check Codex for current state.`:e.status===`CHECK SESSION`?`INFERRED INACTIVITY — a quiet session, not a confirmed input or approval request. Local tools may still be running.`:y(e)?e.status===`MODEL BUSY`?`CONFIRMED TURN FAILURE — the selected model was at capacity. Choose another model with /model or retry later in Codex. This is not a quota-exhaustion signal.`:e.status===`MODEL UNAVAILABLE`?`CONFIRMED TURN FAILURE — the provider could not find the selected model. Choose an available model in Codex. No automatic retry or model change.`:e.status===`CAPACITY RESTRICTED`?`CONFIRMED TURN FAILURE — capacity is unavailable on a policy-restricted route. This is not a quota-exhaustion signal. Check Codex for details; no automatic retry or policy change.`:`CONFIRMED TURN FAILURE — inspect the error below before sending another prompt. No automatic retry or model change.`:$.data?.control&&[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(e.status)?`Open full detail for supported live controls; otherwise reply in Codex.`:e.status===`APPROVAL NEEDED`?`OBSERVED APPROVAL SIGNAL — approve or decline in Codex.`:e.status===`INPUT NEEDED`?`OBSERVED INPUT SIGNAL — reply in Codex.`:e.status===`TURN COMPLETE`?`OBSERVED TURN COMPLETION — informational, not an approval request.`:``}function ee(e){return e.streaming&&e.contextKind===`LAST REPLY`?`REPLY // STREAMING`:e.contextKind||`LAST ACTIVITY`}var te=dc();xr(`keydown`,Qt,E);var O=B(te),ne=V(H(z(O),2));P(O);var k=H(O,2);let re;Xr(k,21,()=>K(b),Kr,(e,t)=>{var n=F(()=>_(K(t),2));let r=()=>K(n)[0],i=()=>K(n)[1];var a=Bs();let o;var s=z(a),c=V(s,!0),l=V(H(s,2),!0);P(a),U(()=>{o=ci(a,1,`svelte-mm4wfe`,null,o,{failed:r()===`ERRORS`&&i()!==`0`&&i()!==`—`}),X(c,r()),X(l,i())}),Y(e,a)}),P(k);var ie=H(k,2),ae=V(ie),oe=H(ie,2),se=e=>{Y(e,Vs())};Z(oe,e=>{K(v)&&e(se)});var A=H(oe,2),ce=e=>{Y(e,Hs())};Z(A,e=>{$.data?.profileError&&e(ce)});var le=H(A,2),ue=e=>{var t=Ks(),n=z(t);Xr(n,17,()=>K(x),Kr,(e,t)=>{var n=Us();let r;var i=V(n);U((e,a,o)=>{r=ci(n,1,`button`,null,r,{approval:e}),Q(n,`href`,a),X(i,`${K(t).status??``} + ${o??``} // ${(K(t).name||K(t).directory||K(t).id)??``}`)},[()=>K(t).status===`APPROVAL NEEDED`||K(t).status===`INPUT NEEDED`||y(K(t)),()=>`#/sessions/`+encodeURIComponent(K(t).id),()=>Array.from(K(t).id).slice(-5).join(``).toUpperCase()]),q(`click`,n,()=>w(K(t).id)),Y(e,n)});var r=H(n,2);Xr(r,17,()=>K(o).filter(e=>e.pending&&K(a).some(t=>t.id===e.session)),Kr,(e,t)=>{var n=Ws(),r=V(n);U((e,a,o)=>{Q(n,`title`,i().id&&i().id!==K(t).session&&K(u)?`Finish sending or clear your current draft before switching sessions.`:`Review this session’s quota threshold`),Q(n,`href`,e),X(r,`QUOTA THRESHOLD ${a??``} // ${o??``}`)},[()=>`#/sessions/`+encodeURIComponent(K(t).session)+`?review=profile`,()=>Array.from(K(t).session).slice(-5).join(``).toUpperCase(),()=>K(a).find(e=>e.id===K(t).session)?.name||K(a).find(e=>e.id===K(t).session)?.directory||K(t).session]),q(`click`,n,e=>d(e,K(t).session)),Y(e,n)});var l=H(r,2);Xr(l,17,()=>K(C),Kr,(e,t)=>{var n=Gs(),r=V(n);U((e,i)=>{Q(n,`href`,e),X(r,`TURN COMPLETE ${i??``} // + ${(K(t).name||K(t).directory||K(t).id)??``}`)},[()=>`#/sessions/`+encodeURIComponent(K(t).id),()=>Array.from(K(t).id).slice(-5).join(``).toUpperCase()]),q(`click`,n,()=>w(K(t).id)),Y(e,n)}),Xr(H(l,2),17,()=>K(s),Kr,(e,t)=>{var n=Gs(),r=V(n);U((e,t,i)=>{Q(n,`href`,e),X(r,`TRIGGER SET ${t??``} // ${i??``}`)},[()=>`#/sessions/`+encodeURIComponent(K(t).session),()=>Array.from(K(t).session).slice(-5).join(``).toUpperCase(),()=>K(a).find(e=>e.id===K(t).session)?.name||K(a).find(e=>e.id===K(t).session)?.directory]),q(`click`,n,e=>c(e,K(t).session)),Y(e,n)}),P(t),Y(e,t)},de=F(()=>(K(x).length||K(C).length||K(o).some(e=>e.pending)||K(s).length)&&!K(v));Z(le,e=>{K(de)&&e(ue)});var fe=H(le,2),j=e=>{var t=Nr(),a=B(t),s=e=>{var t=Zs(),a=z(t),s=z(a);let c;var d=z(s);let f;var h=H(d);P(s);var g=H(s,2);P(a);var _=H(a,2),b=e=>{var t=Rs(),n=V(t,!0);U(()=>X(n,K(p).directory)),Y(e,t)};Z(_,e=>{K(p).name&&K(p).directory&&e(b)});var x=H(_,2),S=V(x),C=H(x,2);let T;var E=z(C),D=z(E);n(D,()=>K(p),()=>!0,()=>!0),P(E);var ee=H(E,2),te=e=>{var t=Nr();Gr(B(t),()=>K(p).id,e=>{{let t=F(()=>new URLSearchParams(Yi.querystring).get(`schedule`)===`edit`),n=F(()=>K(p).fileChanges||[]);bs(e,{get session(){return K(p).id},oncopy:()=>K(r)?.copy(),get openScheduler(){return K(t)},get observedCommand(){return K(p).command},get observedFileChanges(){return K(n)},get suspended(){return K(m)},onProtectedChange:e=>{R(u,e,!0)}})}}),Y(e,t)},O=e=>{var t=qs();Gr(H(z(t),2),()=>K(p).id,e=>{No(e,{get session(){return K(p).id},localOnly:!0,oncopy:()=>K(r)?.copy()})}),P(t),Y(e,t)};Z(ee,e=>{$.data?.control?e(te):e(O,-1)}),P(C);var ne=H(C,2);Xr(ne,17,()=>K(o).filter(e=>e.session===K(p).id),e=>e.session,(e,t)=>{var n=Xs(),r=z(n),i=e=>{var n=Js(),r=V(n,!0);U(()=>X(r,K(t).notice)),Y(e,n)};Z(r,e=>{K(t).notice&&e(i)});var a=H(r,2),o=e=>{bs(e,{get session(){return K(p).id},review:`profile`})},s=e=>{var t=Ys();U(e=>Q(t,`href`,e),[()=>`#/sessions/`+encodeURIComponent(K(p).id)+`?review=profile`]),Y(e,t)};Z(a,e=>{K(t).pending&&K(m)?e(o):K(t).pending&&e(s,1)}),P(n),U(()=>Q(n,`id`,`quota-profile-`+K(p).id)),Y(e,n)});var k=H(ne,2),re=e=>{var t=Nr();Gr(B(t),()=>K(p).id,e=>{Ii(Ds(e,{get session(){return K(p)},active:!0}),e=>R(r,e,!0),()=>K(r))}),Y(e,t)};Z(k,e=>{K(m)||e(re)}),Gr(H(k,2),()=>K(p).id,e=>{Ts(e,{get session(){return K(p)},get stale(){return K(v)}})}),P(t),U((e,t,n,r)=>{c=ci(s,1,`svelte-mm4wfe`,null,c,{failed:e}),f=ci(d,1,`lamp lit svelte-mm4wfe`,null,f,{failed:t,working:K(p).status===`WORKING`&&!K(v)}),X(h,`${n??``} // ${(K(p).name||K(p).directory)??``}`),X(S,`${r??``} TOKENS // ${K(p).id??``} // CONTEXT SOURCE // ${(K(p).source||`LOCAL`)??``}`),T=ui(C,``,T,{display:K(m)?`none`:void 0})},[()=>y(K(p))&&!K(v)&&!K(m),()=>y(K(p))&&!K(v),()=>K(v)?`STALE`:K(m)?`QUOTA THRESHOLD`:l(K(p)),()=>pa(K(p).tokens)]),q(`click`,g,()=>{w(i().id),fa(i().id,2)}),Y(e,t)},c=e=>{Y(e,Qs())};Z(a,e=>{K(p)?e(s):e(c,-1)}),Y(e,t)},pe=e=>{var t=uc(),r=B(t),i=H(z(r),2),s=z(i),c=H(s,2);P(i),P(r);var u=H(r,2);Xr(u,17,()=>K(a),e=>e.id,(e,t)=>{let r=F(()=>ua(K(t).id));var i=cc();let a;var s=z(i),c=z(s),u=e=>{var n=$s(),r=z(n),i=V(r);P(n),U(e=>{Q(r,`aria-pressed`,K(h)===K(t).id),X(i,`${e??``} // ${K(t).name??``}`)},[()=>Array.from(K(t).id).slice(-5).join(``).toUpperCase()]),q(`click`,r,()=>w(K(t).id)),Y(e,n)};Z(c,e=>{K(t).name&&e(u)});var f=H(c,2),p=z(f);let m;var g=z(p);let _;var b=H(g,1,!0);P(p),P(f);var x=H(f,2),S=e=>{var n=ec(),r=V(n,!0);U(()=>{Q(n,`aria-pressed`,K(h)===K(t).id),X(r,K(t).directory||K(t).id)}),q(`click`,n,()=>w(K(t).id)),Y(e,n)};Z(x,e=>{K(t).name||e(S)});var C=H(x,2),E=z(C);xe(),P(C);var D=H(C,2),te=e=>{var n=Rs(),r=V(n,!0);U(()=>X(r,K(t).directory)),Y(e,n)};Z(D,e=>{K(t).name&&K(t).directory&&e(te)});var O=H(D,2),ne=V(O),k=H(O,2),re=V(k),ie=H(k,2),ae=z(ie),oe=H(ae,2),se=V(oe,!0),A=H(oe,2);P(ie);var ce=H(ie,2),le=H(ce,2),ue=e=>{var n=tc(),r=V(n,!0);U(e=>X(r,e),[()=>K(t).status===`CHECK SESSION`?`INFERRED INACTIVITY`:y(K(t))?`OPEN DETAIL FOR THE TURN ERROR`:$.data?.control?`OPEN FULL DETAIL OR REPLY IN CODEX`:K(t).status===`APPROVAL NEEDED`?`APPROVE OR DECLINE IN CODEX`:`REPLY IN CODEX`]),Y(e,n)},de=F(()=>!K(v)&&([`APPROVAL NEEDED`,`INPUT NEEDED`,`CHECK SESSION`].includes(K(t).status)||y(K(t))));Z(le,e=>{K(de)&&e(ue)}),P(s);var fe=H(s,2),j=e=>{var r=oc(),i=z(r),a=z(i),s=V(a,!0),c=H(a,2),l=e=>{var n=nc(),r=V(n,!0);U(e=>{Q(n,`href`,e),X(r,$.data?.control?`REVIEW IN FULL DETAIL ↗`:`APPROVAL IN CODEX ↗`)},[()=>`#/sessions/`+encodeURIComponent(K(t).id)]),Y(e,n)};Z(c,e=>{!K(v)&&K(t).status===`APPROVAL NEEDED`&&e(l)}),P(i);var u=H(i,2);n(u,()=>K(t),()=>!1);var f=H(u,2);Xr(f,17,()=>K(o).filter(e=>e.session===K(t).id),Kr,(e,n)=>{var r=ac(),i=B(r),a=e=>{var t=rc(),r=V(t,!0);U(()=>X(r,K(n).notice)),Y(e,t)};Z(i,e=>{K(n).notice&&e(a)});var o=H(i,2),s=e=>{var n=ic();U(e=>Q(n,`href`,e),[()=>`#/sessions/`+encodeURIComponent(K(t).id)+`?review=profile`]),q(`click`,n,e=>d(e,K(t).id)),Y(e,n)};Z(o,e=>{K(n).pending&&e(s)}),Y(e,r)});var p=H(f,2);{let e=F(()=>K(h)===K(t).id);Ds(p,{get session(){return K(t)},get active(){return K(e)}})}P(r),U(e=>X(s,e),[()=>ee(K(t))]),Y(e,r)};Z(fe,e=>{K(r)>0&&e(j)});var pe=H(fe,2),me=e=>{var n=sc(),r=H(z(n),2);{let e=F(()=>(K(t).samples||[]).map(e=>e.tokens));io(r,{get values(){return K(e)},capacity:120})}var i=V(H(r,2));P(n),U(()=>X(i,`LAST ${(K(t).samples?.length||0)??``} SAMPLES // AUTO SCALE`)),Y(e,n)};Z(pe,e=>{K(r)<2&&e(me)}),P(i),U((e,n,o,s,c,l,u)=>{a=ci(i,1,`session-row`,null,a,{selected:K(h)===K(t).id,wide:K(r)===2,split:K(r)===1}),Q(i,`aria-label`,`Session `+(K(t).name||K(t).directory||K(t).id)),m=ci(p,1,`status-detail svelte-mm4wfe`,null,m,{failed:e}),Q(p,`href`,n),_=ci(g,1,`lamp lit svelte-mm4wfe`,null,_,{failed:o,working:K(t).status===`WORKING`&&!K(v)}),X(b,s),X(E,`${c??``} `),X(ne,`${K(t).agents??``} LINKED AGENTS`),X(re,`ACTIVE // ${l??``}`),ae.disabled=K(r)===0,Q(oe,`aria-expanded`,K(r)>0),X(se,K(r)?`HIDE DETAIL`:`SHOW DETAIL`),Q(ce,`href`,u)},[()=>y(K(t))&&!K(v),()=>`#/sessions/`+encodeURIComponent(K(t).id),()=>y(K(t))&&!K(v),()=>K(v)?`STALE`:l(K(t)),()=>pa(K(t).tokens),()=>ma(K(t).activity),()=>`#/sessions/`+encodeURIComponent(K(t).id)]),q(`click`,p,()=>w(K(t).id)),q(`click`,ae,()=>T(K(t).id,-1)),q(`click`,oe,()=>{w(K(t).id),fa(K(t).id,+!K(r))}),q(`click`,A,()=>T(K(t).id,1)),q(`click`,ce,()=>w(K(t).id)),Y(e,i)});var f=H(u,2),p=e=>{Y(e,lc())};Z(f,e=>{K(a).length||e(p)}),q(`click`,s,()=>da(1)),q(`click`,c,()=>da(0)),Y(e,t)};Z(fe,e=>{i().id?e(j):e(pe,-1)}),U(e=>{X(ne,`OBSERVED ${e??``}`),re=ci(k,1,`session-totals`,null,re,{stale:K(v)}),X(ae,`${K(v)?`LAST KNOWN TOTALS — live state counts unavailable. `:``}Tokens observed since this server started for currently listed sessions; linked agents are already included. Totals can decrease when a session leaves the - list. History samples every 30 seconds. Not account-wide totals.`)},[()=>ma($.data?.sessionsAt)]),Y(e,te),We()}Sr([`click`]);var mc=J(`
`),hc=J(`
Relative usage/credits are not tokens or quota percentages. Groupings - describe the same usage, not additional consumption.
`,1),gc=J(`// APPROXIMATE`),_c=J(`Partial accounting: totals may still change.
`),vc=J(`
Percentage of this period's historical allowance, not today's limit. May - exceed 100%. This is not a manual/automatic reset log.
`,1),yc=J(`
`,1),bc=J(`
This optional account report is unavailable. Token history remains - available; missing data does not mean zero usage.
`),xc=J(`No usage reported for this day.
`),wc=J(`Selected breakdown unavailable; missing does not mean zero.
`),Tc=J(`
`),mc=J(`
Relative usage/credits are not tokens or quota percentages. Groupings + describe the same usage, not additional consumption.
`,1),hc=J(`// APPROXIMATE`),gc=J(`Partial accounting: totals may still change.
`),_c=J(`
Percentage of this period's historical allowance, not today's limit. May + exceed 100%. This is not a manual/automatic reset log.
`,1),vc=J(`
`,1),yc=J(`
This optional account report is unavailable. Token history remains + available; missing data does not mean zero usage.
`),bc=J(`No usage reported for this day.
`),Cc=J(`Selected breakdown unavailable; missing does not mean zero.
`),wc=J(`
History refresh failed. Any displayed history is the last successful - observation.
`),Nc=J(`Token history unavailable; other reports may still be available.
`),Pc=J(``),Fc=J(``),Ic=J(`LESS ░ ▒ ▓ █ MORE // HOVER FOR DATE AND TOKENS
`,1),Lc=J(`
DAYS
SECONDS
DAYS
OPENAI // UTC
| Date (UTC) | Tokens |
|---|
`,1),Bc=J(`
History unavailable or awaiting a matching account observation. Missing - history is not treated as zero usage.
`),Vc=J(`Account-wide history reported by Codex, not the local Sessions counter. Dates + ${K(u)??``}`)},[()=>ma(K(i).fetchedAt),()=>m(K(f))]),Y(e,t)},ie=e=>{var t=vc(),n=B(t),r=z(n);let i;var o=V(r,!0),s=H(r),c=e=>{Y(e,hc())};Z(s,e=>{K(a).approximate&&e(c)});var u=H(s);P(n);var d=H(n,2),p=z(d),h=H(p),g=e=>{var t=Mr();U(()=>X(t,`// Boundary tolerance ${K(a).boundary_tolerance_seconds??``}s`)),Y(e,t)};Z(h,e=>{K(a).boundary_tolerance_seconds!=null&&e(g)}),P(d);var _=H(d,2),v=e=>{var t=_c(),n=B(t),r=z(n),i=H(r);let a;var o=V(i);P(n);var s=H(n,2),c=V(s),u=H(s,2),d=e=>{Y(e,gc())};Z(u,e=>{K(l).accounting_complete||e(d)}),xe(2),U(e=>{X(r,`${K(l).window_minutes??``} MIN // ${K(l).plan_type??``} // `),a=ci(i,1,`svelte-1fbui7h`,null,a,{muted:K(f)==null,"quota-near":K(f)!=null&&K(f)>=80&&K(f)<100,"quota-full":K(f)!=null&&K(f)>=100}),X(o,`USED ${e??``}${K(f)==null?``:`%`}`),X(c,`${K(l).starts_at??``} → ${K(l).ends_at??``}`)},[()=>m(K(f))]),Y(e,t)};Z(_,e=>{K(l)&&e(v)}),U(e=>{i=ci(r,1,`svelte-1fbui7h`,null,i,{"quality-warning":!K(a).coverage_complete}),X(o,K(a).coverage_complete?`Reported range complete`:`Partial coverage`),X(u,` // Latest fetch ${e??``}`),X(p,`Coverage starts ${(K(a).coverage_start||`unknown`)??``} // Data as of ${(K(a).data_as_of||`unknown`)??``}`)},[()=>ma(K(a).fetchedAt)]),Y(e,t)},ae=e=>{Y(e,yc())};Z(k,e=>{t.mode===`breakdown`&&K(i)?e(re):t.mode===`periods`&&K(a)?e(ie,1):e(ae,-1)});var oe=H(k,2),se=e=>{var n=xc(),r=z(n),i=V(H(z(r),2),!0);P(r),Xr(H(r,2),17,()=>K(d),Kr,(e,n,r)=>{var i=F(()=>_(K(n),2));let a=()=>K(i)[0],o=()=>K(i)[1];var s=bc();let c;var l=z(s),u=V(l,!0),d=H(l,2),f=z(d);let h;P(d);var g=V(H(d,2));P(s),U((e,n,i)=>{c=ci(s,1,`report-row svelte-1fbui7h`,null,c,{unknown:e,alternate:r%2==1}),Q(l,`title`,a()),X(u,a()),h=ui(f,``,h,{width:n}),X(g,`${i??``}${t.mode===`periods`?`%`:``}`)},[()=>a().trim().toLowerCase()===`unknown`,()=>`${Math.max(0,100*o()/K(p))}%`,()=>m(o())]),Y(e,s)}),P(n),U(()=>X(i,t.mode===`breakdown`?K(u):`QUOTA USED`)),Y(e,n)},A=e=>{Y(e,Sc())},ce=e=>{Y(e,Cc())};Z(oe,e=>{K(d).length?e(se):t.mode===`breakdown`&&K(c)?.total===0&&K(c)?.groups[K(n)]!=null?e(A,1):(K(i)&&t.mode===`breakdown`||K(a)&&t.mode===`periods`)&&e(ce,2)}),P(D),U(()=>{w.disabled=K(s)>=K(o)-1,T.disabled=K(s)===0,X(E,K(o)?`${K(s)+1} / ${K(o)}`:`NO DATA`),X(te,t.mode===`breakdown`?`DAILY BREAKDOWN`:`QUOTA WINDOWS`),X(ne,`${(t.mode===`breakdown`?t.reports?.dailyStatus||`UNAVAILABLE`:t.reports?.planStatus||`UNAVAILABLE`)??``} // UTC`)}),hi(y,()=>K(n),e=>R(n,e)),q(`click`,w,()=>R(r,K(s)+1)),q(`click`,T,()=>R(r,K(s)-1)),Y(e,h),We()}Sr([`click`]);var Ec=864e5;function Dc(e,t){let n=new Date(e);n.setUTCDate(1),n.setUTCMonth(n.getUTCMonth()+t);let r=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,0)).getUTCDate();return n.setUTCDate(Math.min(e.getUTCDate(),r)),n}function Oc(e,t,n){let r=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));for(let e=0;;e++){let i=Dc(r,-t),a=new Date(i.getTime()+Ec);if(e===n)return{start:a,end:r};r=i}}var kc=J(``),Ac=J(``,1),jc=J(`
History refresh failed. Any displayed history is the last successful + observation.
`),Mc=J(`Token history unavailable; other reports may still be available.
`),Nc=J(``),Pc=J(``),Fc=J(`LESS ░ ▒ ▓ █ MORE // HOVER FOR DATE AND TOKENS
`,1),Ic=J(`
DAYS
SECONDS
DAYS
OPENAI // UTC
| Date (UTC) | Tokens |
|---|
`,1),zc=J(`
History unavailable or awaiting a matching account observation. Missing + history is not treated as zero usage.
`),Bc=J(`Account-wide history reported by Codex, not the local Sessions counter. Dates use UTC. Allowance history is approximate where indicated; reset causes are - not provided.
`,1);function Hc(e,t){Ue(t,!0);let n=L(`daily`),r=L(12),i=L(0),a=F(()=>{let e=$.data?.usage?.dailyUsageBuckets;if(!e)return[];let{start:t,end:n}=kc(new Date,K(r),K(i)),a=new Map;for(let t of e)!Number.isFinite(t.tokens)||t.tokens<0||a.set(t.startDate,(a.get(t.startDate)||0)+t.tokens);let o=[];for(let e=t;e<=n;e=new Date(e.getTime()+864e5)){let t=e.toISOString().slice(0,10);o.push({date:t,tokens:a.get(t)||0})}return o}),o=F(()=>Math.max(1,...K(a).map(e=>e.tokens))),s=F(()=>K(a).length?new Date(K(a)[0].date+`T00:00:00Z`).getUTCDay():0),c=F(()=>{if(K(n)===`monthly`){let e=new Map;for(let t of K(a))e.set(t.date.slice(0,7),(e.get(t.date.slice(0,7))||0)+t.tokens);return[...e].map(([e,t])=>({date:e,tokens:t}))}let e=0;return K(a).map(t=>({date:t.date,tokens:e+=t.tokens}))});var l=Vc(),u=H(B(l),4);Xr(u,20,()=>[[`daily`,`Daily`],[`monthly`,`Monthly`],[`cumulative`,`Cumulative`],[`breakdown`,`Breakdown`],[`periods`,`Windows`]],Kr,(e,t)=>{var r=F(()=>_(t,2));let a=()=>K(r)[0],o=()=>K(r)[1];var s=Ac();let c;var l=V(s,!0);U(()=>{Q(s,`aria-pressed`,K(n)===a()),c=ci(s,1,``,null,c,{active:K(n)===a()}),X(l,o())}),q(`click`,s,()=>{R(n,a(),!0),R(i,0)}),Y(e,s)}),P(u);var d=H(u,2),f=z(d),p=e=>{var t=jc(),n=B(t),a=H(z(n)),o=z(a);o.value=o.__value=6;var s=H(o);s.value=s.__value=12,P(a),mi(a),P(n);var c=H(n),l=H(c);U(()=>l.disabled=K(i)===0),q(`change`,a,()=>R(i,0)),hi(a,()=>K(r),e=>R(r,e)),q(`click`,c,()=>Kt(i)),q(`click`,l,()=>Kt(i,-1)),Y(e,t)};Z(f,e=>{K(n)!==`breakdown`&&K(n)!==`periods`&&e(p)}),P(d);var m=H(d,2),h=e=>{Y(e,Mc())};Z(m,e=>{$.data?.usageError&&e(h)});var g=H(m,2),v=e=>{Y(e,Nc())};Z(g,e=>{$.data?.usage?.tokenStatus===`UNAVAILABLE`&&K(n)!==`breakdown`&&K(n)!==`periods`&&e(v)});var y=H(g,2),b=e=>{var t=Nr();Gr(B(t),()=>K(n),e=>{{let t=F(()=>$.data?.usage?.reports);Ec(e,{get reports(){return K(t)},get mode(){return K(n)}})}}),Y(e,t)},x=e=>{var t=zc(),r=B(t),i=z(r),l=V(H(z(i),2),!0);P(i);var u=H(i,2),d=V(H(z(u),2),!0);P(u);var f=H(u,2),p=H(z(f),2),m=z(p);xe(),P(p),P(f);var h=H(f,2),g=H(z(h),2),_=z(g);xe(),P(g),P(h);var v=H(h,2),y=H(z(v),2),b=z(y);xe(),P(y),P(v),P(r);var x=H(r,4),S=z(x),C=V(S),w=H(S,2),T=e=>{var t=Ic(),n=B(t),r=z(n),i=z(r);Xr(i,17,()=>Array(K(s)),Kr,(e,t)=>{Y(e,Pc())}),Xr(H(i,2),17,()=>K(a),Kr,(e,t)=>{var n=Fc();let r,i;U(e=>{r=ci(n,1,`heat-cell`,null,r,{zero:K(t).tokens===0}),Q(n,`title`,e),i=ui(n,``,i,{opacity:K(t).tokens?.25+.75*K(t).tokens/K(o):1})},[()=>`${K(t).date}: ${pa(K(t).tokens)} tokens`]),Y(e,n)}),P(r),P(n),xe(2),Y(e,t)},E=e=>{var t=Lc(),r=B(t);{let e=F(()=>K(c).map(e=>e.tokens)),t=F(()=>K(n)+` usage`);io(r,{get values(){return K(e)},get label(){return K(t)}})}var i=H(r,2),a=z(i),o=V(a,!0),s=V(H(a),!0);P(i),U(e=>{X(o,K(c)[0]?.date),X(s,e)},[()=>K(c).at(-1)?.date]),Y(e,t)};Z(w,e=>{K(n)===`daily`?e(T):e(E,-1)});var D=H(w,2),ee=H(z(D),2),te=z(ee),O=H(z(te));Xr(O,21,()=>K(n)===`daily`?K(a):K(c),Kr,(e,t)=>{var n=Rc(),r=z(n),i=V(r,!0),a=V(H(r),!0);P(n),U(e=>{X(i,K(t).date),X(a,e)},[()=>pa(K(t).tokens)]),Y(e,n)}),P(O),P(te),P(ee),P(D),P(x);var ne=V(H(x,2));U((e,t,n,r,i,o,s)=>{X(l,e),X(d,t),X(m,`${n??``} `),X(_,`${r??``} `),X(b,`${i??``} `),X(C,`${K(a)[0]?.date??``} — ${o??``}`),X(ne,`OBSERVED ${s??``} // CUMULATIVE IS FOR THE SELECTED PERIOD`)},[()=>pa($.data.usage.summary.lifetimeTokens),()=>pa($.data.usage.summary.peakDailyTokens),()=>pa($.data.usage.summary.currentStreakDays),()=>pa($.data.usage.summary.longestRunningTurnSec),()=>pa($.data.usage.summary.longestStreakDays),()=>K(a).at(-1)?.date,()=>ma($.data.usageAt)]),Y(e,t)},S=e=>{Y(e,Bc())};Z(y,e=>{K(n)===`breakdown`||K(n)===`periods`?e(b):$.data?.usage&&$.data.usage.dailyUsageBuckets!==null?e(x,1):e(S,-1)}),Y(e,l),We()}Sr([`click`,`change`]);var Uc=J(``),fl=J(`
Connecting to your local Codexometer…
`),pl=J(``),ml=J(``);function hl(e,t){Ue(t,!0);let n={"/":to,"/quota/:view?":to,"/sessions/:id?":pc,"/usage":Hc,"*":Wc},r={quota:/^(?:\/|\/quota(?:\/[^/]+)?\/?)$/,sessions:/^\/sessions(?:\/[^/]+)?\/?$/,usage:/^\/usage\/?$/},i=L(`hacker`),a=L(!0),o=L(void 0);vn(()=>{sa.requests&&lr().then(()=>{K(o)?.focus(),K(o)?.scrollIntoView({block:`nearest`})})});let s=L(void 0),c=[`hacker`,`rust`,`blue-steel`,`ultraviolet`,`nightshade`];vn(()=>{ca()}),vn(()=>{if($.data)for(let[e,t]of Object.entries(r))t.test(Yi.location)&&(aa.tab=e)}),Gi(()=>{try{let e=localStorage.getItem(`codexometer.web.theme`);e&&c.includes(e)&&R(i,e,!0)}catch{}return ya()});function l(){try{localStorage.setItem(`codexometer.web.theme`,K(i))}catch{}}var u=ml(),d=z(u),f=z(d),p=z(f);ol(z(p),{}),P(p),Ii(p,e=>R(s,e),()=>K(s)),xe(2),P(f);var m=H(f,2),h=z(m);let g;var v=H(h,1,!0),y=V(H(v));P(m),P(d);var b=H(d,2);Xr(b,21,()=>Object.entries(r),Kr,(e,t)=>{var n=F(()=>_(K(t),2));let r=()=>K(n)[0],i=()=>K(n)[1],a=F(()=>i().test(Yi.location));var o=ul();let s;var c=V(o,!0);U(e=>{Q(o,`href`,r()===`quota`?`#/quota/`+aa.view:`#/`+r()),Q(o,`aria-current`,K(a)?`page`:void 0),s=ci(o,1,``,null,s,{active:K(a)}),X(c,e)},[()=>r().toUpperCase()]),Y(e,o)}),P(b);var x=H(b,2),S=z(x),C=e=>{var t=dl(),n=V(t,!0);U(()=>X(n,$.error)),Y(e,t)};Z(S,e=>{$.error&&e(C)});var w=H(S,2),T=e=>{$i(e,{get routes(){return n}})},E=e=>{Y(e,fl())};Z(w,e=>{$.data?e(T):$.error||e(E,1)}),P(x);var D=H(x,2),ee=z(D),te=V(ee),O=H(ee,2),ne=V(O,!0),k=H(O,2),re=H(z(k));Xr(re,21,()=>c,Kr,(e,t)=>{var n=pl(),r=V(n,!0),i={};U(e=>{X(r,e),i!==(i=K(t))&&(n.value=(n.__value=i)??``)},[()=>K(t).replace(`-`,` `).toUpperCase()]),Y(e,n)}),P(re),Ii(re,e=>R(o,e),()=>K(o)),mi(re),P(k),P(D);var ie=H(D,2),ae=e=>{ll(e,{get target(){return K(s)},onfinish:()=>R(a,!1)})};Z(ie,e=>{K(a)&&e(ae)}),P(u),U(()=>{Q(u,`data-theme`,K(i)),Q(u,`data-starting`,K(a)),d.inert=K(a),g=ci(h,1,`lamp`,null,g,{lit:$.connected}),X(v,$.connected?`CONNECTED`:`OFFLINE`),X(y,`EXPERIMENTAL // ${$.data?.control?`SESSION CONTROL`:`READ ONLY`}`),b.inert=K(a),x.inert=K(a),D.inert=K(a),X(te,`v${($.data?.version||`…`)??``} // LOCAL ONLY`),X(ne,$.data?.control?`Session control enabled. Stop the server to revoke access.`:`No actions can be sent from this preview.`)}),q(`change`,re,l),hi(re,()=>K(i),e=>R(i,e)),Y(e,u),We()}Sr([`change`]),zr(hl,{target:document.getElementById(`app`)}); \ No newline at end of file + not provided. `,1);function Vc(e,t){Ue(t,!0);let n=L(`daily`),r=L(12),i=L(0),a=F(()=>{let e=$.data?.usage?.dailyUsageBuckets;if(!e)return[];let{start:t,end:n}=Oc(new Date,K(r),K(i)),a=new Map;for(let t of e)!Number.isFinite(t.tokens)||t.tokens<0||a.set(t.startDate,(a.get(t.startDate)||0)+t.tokens);let o=[];for(let e=t;e<=n;e=new Date(e.getTime()+864e5)){let t=e.toISOString().slice(0,10);o.push({date:t,tokens:a.get(t)||0})}return o}),o=F(()=>Math.max(1,...K(a).map(e=>e.tokens))),s=F(()=>K(a).length?new Date(K(a)[0].date+`T00:00:00Z`).getUTCDay():0),c=F(()=>{if(K(n)===`monthly`){let e=new Map;for(let t of K(a))e.set(t.date.slice(0,7),(e.get(t.date.slice(0,7))||0)+t.tokens);return[...e].map(([e,t])=>({date:e,tokens:t}))}let e=0;return K(a).map(t=>({date:t.date,tokens:e+=t.tokens}))});var l=Bc(),u=H(B(l),4);Xr(u,20,()=>[[`daily`,`Daily`],[`monthly`,`Monthly`],[`cumulative`,`Cumulative`],[`breakdown`,`Breakdown`],[`periods`,`Windows`]],Kr,(e,t)=>{var r=F(()=>_(t,2));let a=()=>K(r)[0],o=()=>K(r)[1];var s=kc();let c;var l=V(s,!0);U(()=>{Q(s,`aria-pressed`,K(n)===a()),c=ci(s,1,``,null,c,{active:K(n)===a()}),X(l,o())}),q(`click`,s,()=>{R(n,a(),!0),R(i,0)}),Y(e,s)}),P(u);var d=H(u,2),f=z(d),p=e=>{var t=Ac(),n=B(t),a=H(z(n)),o=z(a);o.value=o.__value=6;var s=H(o);s.value=s.__value=12,P(a),mi(a),P(n);var c=H(n),l=H(c);U(()=>l.disabled=K(i)===0),q(`change`,a,()=>R(i,0)),hi(a,()=>K(r),e=>R(r,e)),q(`click`,c,()=>Kt(i)),q(`click`,l,()=>Kt(i,-1)),Y(e,t)};Z(f,e=>{K(n)!==`breakdown`&&K(n)!==`periods`&&e(p)}),P(d);var m=H(d,2),h=e=>{Y(e,jc())};Z(m,e=>{$.data?.usageError&&e(h)});var g=H(m,2),v=e=>{Y(e,Mc())};Z(g,e=>{$.data?.usage?.tokenStatus===`UNAVAILABLE`&&K(n)!==`breakdown`&&K(n)!==`periods`&&e(v)});var y=H(g,2),b=e=>{var t=Nr();Gr(B(t),()=>K(n),e=>{{let t=F(()=>$.data?.usage?.reports);Tc(e,{get reports(){return K(t)},get mode(){return K(n)}})}}),Y(e,t)},x=e=>{var t=Rc(),r=B(t),i=z(r),l=V(H(z(i),2),!0);P(i);var u=H(i,2),d=V(H(z(u),2),!0);P(u);var f=H(u,2),p=H(z(f),2),m=z(p);xe(),P(p),P(f);var h=H(f,2),g=H(z(h),2),_=z(g);xe(),P(g),P(h);var v=H(h,2),y=H(z(v),2),b=z(y);xe(),P(y),P(v),P(r);var x=H(r,4),S=z(x),C=V(S),w=H(S,2),T=e=>{var t=Fc(),n=B(t),r=z(n),i=z(r);Xr(i,17,()=>Array(K(s)),Kr,(e,t)=>{Y(e,Nc())}),Xr(H(i,2),17,()=>K(a),Kr,(e,t)=>{var n=Pc();let r,i;U(e=>{r=ci(n,1,`heat-cell`,null,r,{zero:K(t).tokens===0}),Q(n,`title`,e),i=ui(n,``,i,{opacity:K(t).tokens?.25+.75*K(t).tokens/K(o):1})},[()=>`${K(t).date}: ${pa(K(t).tokens)} tokens`]),Y(e,n)}),P(r),P(n),xe(2),Y(e,t)},E=e=>{var t=Ic(),r=B(t);{let e=F(()=>K(c).map(e=>e.tokens)),t=F(()=>K(n)+` usage`);io(r,{get values(){return K(e)},get label(){return K(t)}})}var i=H(r,2),a=z(i),o=V(a,!0),s=V(H(a),!0);P(i),U(e=>{X(o,K(c)[0]?.date),X(s,e)},[()=>K(c).at(-1)?.date]),Y(e,t)};Z(w,e=>{K(n)===`daily`?e(T):e(E,-1)});var D=H(w,2),ee=H(z(D),2),te=z(ee),O=H(z(te));Xr(O,21,()=>K(n)===`daily`?K(a):K(c),Kr,(e,t)=>{var n=Lc(),r=z(n),i=V(r,!0),a=V(H(r),!0);P(n),U(e=>{X(i,K(t).date),X(a,e)},[()=>pa(K(t).tokens)]),Y(e,n)}),P(O),P(te),P(ee),P(D),P(x);var ne=V(H(x,2));U((e,t,n,r,i,o,s)=>{X(l,e),X(d,t),X(m,`${n??``} `),X(_,`${r??``} `),X(b,`${i??``} `),X(C,`${K(a)[0]?.date??``} — ${o??``}`),X(ne,`OBSERVED ${s??``} // CUMULATIVE IS FOR THE SELECTED PERIOD`)},[()=>pa($.data.usage.summary.lifetimeTokens),()=>pa($.data.usage.summary.peakDailyTokens),()=>pa($.data.usage.summary.currentStreakDays),()=>pa($.data.usage.summary.longestRunningTurnSec),()=>pa($.data.usage.summary.longestStreakDays),()=>K(a).at(-1)?.date,()=>ma($.data.usageAt)]),Y(e,t)},S=e=>{Y(e,zc())};Z(y,e=>{K(n)===`breakdown`||K(n)===`periods`?e(b):$.data?.usage&&$.data.usage.dailyUsageBuckets!==null?e(x,1):e(S,-1)}),Y(e,l),We()}Sr([`click`,`change`]);var Hc=J(``),dl=J(`
Connecting to your local Codexometer…
`),fl=J(``),pl=J(``);function ml(e,t){Ue(t,!0);let n={"/":to,"/quota/:view?":to,"/sessions/:id?":fc,"/usage":Vc,"*":Uc},r={quota:/^(?:\/|\/quota(?:\/[^/]+)?\/?)$/,sessions:/^\/sessions(?:\/[^/]+)?\/?$/,usage:/^\/usage\/?$/},i=L(`hacker`),a=L(!0),o=L(void 0);vn(()=>{sa.requests&&lr().then(()=>{K(o)?.focus(),K(o)?.scrollIntoView({block:`nearest`})})});let s=L(void 0),c=[`hacker`,`rust`,`blue-steel`,`ultraviolet`,`nightshade`];vn(()=>{ca()}),vn(()=>{if($.data)for(let[e,t]of Object.entries(r))t.test(Yi.location)&&(aa.tab=e)}),Gi(()=>{try{let e=localStorage.getItem(`codexometer.web.theme`);e&&c.includes(e)&&R(i,e,!0)}catch{}return ya()});function l(){try{localStorage.setItem(`codexometer.web.theme`,K(i))}catch{}}var u=pl(),d=z(u),f=z(d),p=z(f);al(z(p),{}),P(p),Ii(p,e=>R(s,e),()=>K(s)),xe(2),P(f);var m=H(f,2),h=z(m);let g;var v=H(h,1,!0),y=V(H(v));P(m),P(d);var b=H(d,2);Xr(b,21,()=>Object.entries(r),Kr,(e,t)=>{var n=F(()=>_(K(t),2));let r=()=>K(n)[0],i=()=>K(n)[1],a=F(()=>i().test(Yi.location));var o=ll();let s;var c=V(o,!0);U(e=>{Q(o,`href`,r()===`quota`?`#/quota/`+aa.view:`#/`+r()),Q(o,`aria-current`,K(a)?`page`:void 0),s=ci(o,1,``,null,s,{active:K(a)}),X(c,e)},[()=>r().toUpperCase()]),Y(e,o)}),P(b);var x=H(b,2),S=z(x),C=e=>{var t=ul(),n=V(t,!0);U(()=>X(n,$.error)),Y(e,t)};Z(S,e=>{$.error&&e(C)});var w=H(S,2),T=e=>{$i(e,{get routes(){return n}})},E=e=>{Y(e,dl())};Z(w,e=>{$.data?e(T):$.error||e(E,1)}),P(x);var D=H(x,2),ee=z(D),te=V(ee),O=H(ee,2),ne=V(O,!0),k=H(O,2),re=H(z(k));Xr(re,21,()=>c,Kr,(e,t)=>{var n=fl(),r=V(n,!0),i={};U(e=>{X(r,e),i!==(i=K(t))&&(n.value=(n.__value=i)??``)},[()=>K(t).replace(`-`,` `).toUpperCase()]),Y(e,n)}),P(re),Ii(re,e=>R(o,e),()=>K(o)),mi(re),P(k),P(D);var ie=H(D,2),ae=e=>{cl(e,{get target(){return K(s)},onfinish:()=>R(a,!1)})};Z(ie,e=>{K(a)&&e(ae)}),P(u),U(()=>{Q(u,`data-theme`,K(i)),Q(u,`data-starting`,K(a)),d.inert=K(a),g=ci(h,1,`lamp`,null,g,{lit:$.connected}),X(v,$.connected?`CONNECTED`:`OFFLINE`),X(y,`EXPERIMENTAL // ${$.data?.control?`SESSION CONTROL`:`READ ONLY`}`),b.inert=K(a),x.inert=K(a),D.inert=K(a),X(te,`v${($.data?.version||`…`)??``} // LOCAL ONLY`),X(ne,$.data?.control?`Session control enabled. Stop the server to revoke access.`:`No actions can be sent from this preview.`)}),q(`change`,re,l),hi(re,()=>K(i),e=>R(i,e)),Y(e,u),We()}Sr([`change`]),zr(ml,{target:document.getElementById(`app`)}); \ No newline at end of file diff --git a/internal/web/dist/index.html b/internal/web/dist/index.html index 7d6bfc93..f44ad662 100644 --- a/internal/web/dist/index.html +++ b/internal/web/dist/index.html @@ -5,7 +5,7 @@TRIGGER // {triggerDescription}
{/if}Check the target and {offer.kind === 'profile' @@ -731,9 +733,19 @@ disabled={busy || stale || !valid || !!scheduleError} >{busy ? 'SENDING…' - : editing - ? 'REVIEW CHANGES' - : 'REVIEW BEFORE SENDING'} {/if} {#if editing}{menu.reversibleInput || live.data?.noConfirm + ? 'ENTER APPLY' + : 'ENTER REVIEW'} {:else if currentChoice?.action && !currentChoice.unavailable} - {#if reviewed}{currentChoice.reversible || live.data?.noConfirm + ? 'ENTER APPLY' + : 'ENTER REVIEW'}{/if} {:else if !selected && currentChoice && !currentChoice.unavailable}