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(``),Ua=jr(``),Wa=J(`
`),Ga=J(`

Cycle duration or reset date unavailable — position cannot be plotted.

`),Ka=J(`
EMPTYFULL
`),qa=J(`

`,1),Ja=J(`
`,1),Ya=J(`

`),Xa=J(`

`),Za=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(`

 
`),go=J(`
`),_o=J(`
`),vo=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(`
`),No=J(`
`);function Po(e,t){let n=Pr();Ue(t,!0);let r=e=>{var t=Nr();Xr(B(t),19,()=>K(fe),e=>e.id,(e,t,r)=>{var i=so();let o;var s=z(i),c=V(s,!0),l=H(s),u=V(l),d=H(l),f=e=>{var n=oo(),r=V(n,!0);U(()=>X(r,K(t).help)),Y(e,n)};Z(d,e=>{(K(v)?.path===``||K(A))&&e(f)}),P(i),U((e,s)=>{Q(i,`id`,`${n}-${K(r)}`),Q(i,`role`,K(A)?`option`:void 0),Q(i,`aria-selected`,K(A)?K(T)===K(r):void 0),Q(i,`tabindex`,K(A)?-1:void 0),i.disabled=K(g)||K(he)&&!a(),Q(i,`title`,K(t).help),Q(i,`aria-label`,e),o=ci(i,1,`svelte-7bfwr9`,null,o,{suggested:K(T)===K(r)}),X(c,K(t).label),X(u,`${K(A)&&K(t).selected?` // CURRENT`:``}${s??``}`)},[()=>K(t).label+(K(A)&&K(t).selected?` // CURRENT`:``)+ie(K(t)),()=>ie(K(t))]),xr(`focus`,i,()=>{K(A)||_e(K(r))}),q(`click`,i,()=>{_e(K(r)),ye(K(t))}),Y(e,i)}),Y(e,t)},i=Wi(t,`query`,3,``),a=Wi(t,`localOnly`,3,!1),o=Wi(t,`oncopy`,3,()=>{}),s=Wi(t,`onchange`,3,()=>{}),c=Wi(t,`oncomplete`,3,e=>{}),l=[`statusline`,`usage`,`copy`,`theme`,`exit`,`quit`];function u(){return[{id:`local-statusline`,label:`/statusline`,help:`Choose fields for Codexometer’s detail footer.`,next:`statusline`},{id:`local-usage`,label:`/usage`,help:`Open Codexometer’s usage history. Quota and reset views remain available.`,next:`usage`},{id:`local-copy`,label:`/copy`,help:`Copy the selected session’s observed reply or activity with its Copy control.`,next:`copy`},{id:`local-theme`,label:`/theme`,help:`Open the existing Codexometer theme selector. Saved browser display preferences only.`,next:`theme`},{id:`local-exit`,label:`/exit`,help:`Leave session detail and return to Sessions. The local server remains running.`,next:`exit`},{id:`local-quit`,label:`/quit`,help:`Alias for /exit: return to Sessions. The local server remains running.`,next:`quit`}]}function d(){return{title:`/ COMMANDS`,help:`Local Codexometer commands remain available without session control.`,path:``,revision:``,choices:u()}}function f(){R(b,``),R(O,``),R(x,0),R(ne,[],!0)}function p(){w++,R(g,!1),R(h,!1),R(E,i()),f(),R(_,``),K(ue)?s()():c()(i())}async function m(e){if(!l.includes(e))return!1;if(e===`copy`&&!ao($.data?.sessions.find(e=>e.id===t.session)))return R(_,`No reply or activity text is available to copy for this session.`),!0;if(e===`copy`){let e=o()();p(),await e}else p(),e===`usage`?location.hash=`/usage`:e===`theme`?sa.requests++:e===`statusline`?oa.open=!0:location.hash=`/sessions`;return!0}let h=L(!1),g=L(!1),_=L(``),v=L(null),y=L(null),b=L(``),x=L(0),S=L(Yt(Date.now())),C=L(``),w=0,T=L(0),E=L(null),D=L(void 0),ee=L(void 0),te=L(void 0),O=L(``),ne=L(Yt([])),k=F(()=>K(v)?.path.startsWith(`rename/`)||K(v)?.path.startsWith(`cd/`)),re=F(()=>!!K(y)&&!K(k)||!!K(O)||K(ne).length>0);function ie(e){return e.unavailable?e.unavailable.startsWith(`Waiting for idle.`)?` // WAITING FOR IDLE`:` // UNAVAILABLE`:e.next?` →`:e.action?``:` // HELP`}async function ae(e){K(v)&&!(K(ge)&&K(de))&&R(ne,[...K(ne),{path:K(v).path,index:K(T),input:K(C)}],!0),await N(e)}async function oe(){if(!K(re))return;if(w++,R(g,!1),R(b,``),R(x,0),R(_,``),K(O)){R(O,``),K(D)?.focus();return}if(K(y)&&!K(k)){R(y,null),await lr(),K(D)?.focus();return}let e=K(ne).at(-1);e&&(R(ne,K(ne).slice(0,-1),!0),await N(e.path,e))}function se(){K(v)&&K(C).trim()&&!K(g)&&!K(he)&&ae(K(v).path+`/`+encodeURIComponent(K(C).trim()))}let A=F(()=>K(h)&&!!K(v)?.picker&&!K(y)),ce=F(()=>K(h)&&!K(v)?.input&&!K(y)),le=setInterval(()=>{R(S,Date.now(),!0)},1e3);Ki(()=>{clearInterval(le),w++});let ue=F(()=>i().trim().startsWith(`/`)&&!i().trim().startsWith(`//`)),de=F(()=>K(v)?.path===``&&K(ue)?i().trim().slice(1).toLowerCase():``),fe=F(()=>(K(v)?.choices||[]).filter(e=>!K(de)||e.label.toLowerCase().startsWith(`/`+K(de)))),j=F(()=>K(y)||K(fe)[K(T)]),pe=F(()=>!!K(b)&&K(S)K(fe).find(e=>e.id===K(O))),he=F(()=>!$.connected||!!$.data?.sessionsError),ge=F(()=>K(h)&&K(ue)&&(!K(v)||K(v).path===``)&&!K(y));vn(()=>{i(),R(T,0)}),vn(()=>{let e=K(T);K(fe),K(ce)&&lr().then(()=>{let t=K(D)?.children[e];if(!t||!K(D))return;let n=K(D).getBoundingClientRect(),r=t.getBoundingClientRect();r.topn.bottom&&(K(D).scrollTop+=r.bottom-n.bottom)})});function _e(e){K(T)!==e&&K(v)?.picker&&(R(O,``),R(b,``),R(x,0),R(_,``),w++),R(T,e,!0)}function M(){w++,R(g,!1),R(h,!1),R(E,i()),f(),c()(i())}function ve(e){let t=!!K(ee)?.contains(e.target);if(!K(h)||!K(ce)&&!K(y)&&!K(v)?.input||!K(ue)&&!t||K(he)&&!a()||e.isComposing||e.ctrlKey||e.metaKey||e.altKey)return;if(K(v)?.input){e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),M());return}let n=e.key===`ArrowLeft`,r=e.key.toLowerCase()===`f`,i=e.key.toLowerCase()===`c`;if((i||r||n)&&!t||![`ArrowUp`,`ArrowDown`,`Tab`,`Enter`,`Escape`].includes(e.key)&&!i&&!r&&!n||e.key===`Tab`&&(K(y)||K(v)?.path!==``||e.shiftKey)||e.key===`Enter`&&e.target instanceof Element&&e.target.closest(`button`)&&!K(D)?.contains(e.target)&&!e.target.closest(`[data-command-confirm]`)||K(y)&&!t||K(y)&&[`ArrowUp`,`ArrowDown`].includes(e.key))return;if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){M();return}if(K(g)||e.repeat&&i)return;if(n){K(re)&&oe();return}if(r){N(K(v)?.path||``,void 0,!0);return}if(i){(K(y)?.action||K(A)&&K(O))&&xe();return}if(K(y)){e.key===`Enter`&&K(y).action&&!K(pe)&&!K(_)&&be(K(y));return}if(e.key===`ArrowUp`||e.key===`ArrowDown`){_e(Math.min(Math.max(K(T)+(e.key===`ArrowUp`?-1:1),0),Math.max(K(fe).length-1,0))),!K(A)&&K(D)?.contains(e.target)&&lr().then(()=>(K(D)?.children[K(T)])?.focus());return}let o=K(fe)[K(T)];o&&(e.key===`Tab`?c()(o.label):K(A)?be(o):ye(o))}vn(()=>{K(he)&&!a()&&(w++,R(g,!1),f(),K(h)&&(R(h,!1),R(E,i())),R(v,null),R(y,null))}),vn(()=>{K(ue)&&!K(h)&&i()!==K(E)&&(!K(he)||a())&&(f(),R(h,!0),N(``))});async function N(e,n,r=!1){let i=++w;if(K(v)&&R(v,{...K(v),path:e},!0),n&&R(C,n.input,!0),R(g,!0),R(y,null),R(O,``),R(b,``),R(x,0),R(_,``),a())R(v,d(),!0),R(T,n?.index??0,!0),R(g,!1);else try{let a=await va(`commands`,{session:t.session,command:{mode:`list`,path:e,...r?{refresh:!0}:{}}});i===w&&((e===``||e===`help`)&&(a.choices=[...a.choices.filter(e=>!l.includes(e.label.replace(/^\//,``))),...u()]),R(v,a,!0),R(T,n?Math.min(n.index,Math.max(a.choices.length-1,0)):a.picker?Math.max(a.choices.findIndex(e=>e.selected),0):0,!0),a.picker&&lr().then(()=>K(D)?.focus()),R(C,n?.input??a.value??``,!0),n&&lr().then(()=>{a.input?K(ee)?.querySelector(`input`)?.focus():K(D)?.focus()}),(a.path.startsWith(`rename/`)||a.path.startsWith(`cd/`))&&a.choices.length===1&&(R(g,!1),ye(a.choices[0])))}catch{i===w&&(R(_,`Command catalogue unavailable. Use Codex.`),e===``||e===`help`?(R(v,d(),!0),R(_,``)):R(v,{title:`/`+e,help:``,path:e,revision:``,choices:[]},!0))}finally{i===w&&R(g,!1)}}async function ye(e){e.unavailable||K(g)||e.next&&await m(e.next)||K(_)||(K(v)?.picker?(_e(K(fe).findIndex(t=>t.id===e.id)),K(D)?.focus()):e.next?await ae(e.next):await be(e))}async function be(e){if(K(g)||K(he)||!K(v)||e.unavailable||K(_))return;if(K(v).picker){if(K(pe)&&K(O)===e.id)return;R(O,e.id,!0)}else R(y,e,!0),lr().then(()=>K(te)?.focus());if(R(b,``),R(x,0),R(_,``),!e.action)return;let n=++w;R(g,!0);try{let r=await va(`commands`,{session:t.session,command:{mode:`prepare`,path:K(v).path,revision:K(v).revision,choice:e.id}});if(n===w){let e=Date.parse(r.expires);if(!r.confirmation||!Number.isFinite(e)||Date.now()>=e)throw Error(`Review confirmation unavailable`);R(b,r.confirmation,!0),R(x,e,!0)}}catch{n===w&&R(_,`Option changed or unavailable. Refresh before retrying.`)}finally{n===w&&R(g,!1)}}async function xe(){if(!K(b)||K(he)||K(g)||Date.now()>=K(x)||!K(v)||K(v).picker&&K(O)!==K(fe)[K(T)]?.id)return;let e=K(b);R(b,``),R(g,!0);let n=++w;try{let r=await va(`commands`,{session:t.session,confirmation:e,command:{mode:`commit`,path:K(v).path}});n===w&&(R(_,r.message,!0),R(h,!1),R(v,null),R(y,null),f(),R(E,null),s()())}catch{n===w&&R(_,`Change unconfirmed. Check Codex before retrying.`)}finally{n===w&&R(g,!1)}}var Se={handleKey:ve},Ce=No(),we=z(Ce),Te=H(we,2),Ee=e=>{var t=co(),n=V(t,!0);U(()=>X(n,K(_))),Y(e,t)};Z(Te,e=>{K(_)&&!K(h)&&e(Ee)});var De=H(Te,2),Oe=e=>{var i=Mo();let o;var s=z(i),c=e=>{var t=lo(),n=B(t),r=V(n,!0),i=V(H(n,2),!0);U(()=>{X(r,K(v)?.title||`/ COMMANDS`),X(i,K(v)?.help||`Loading live options…`)}),Y(e,t)};Z(s,e=>{K(ge)||e(c)});var l=H(s,2),u=e=>{var t=uo(),n=V(t,!0);U(()=>X(n,K(_))),Y(e,t)};Z(l,e=>{K(_)&&e(u)});var d=H(l,2),f=e=>{Y(e,fo())};Z(d,e=>{K(g)&&e(f)});var p=H(d,2),m=e=>{var t=po(),r=z(t),i=z(r),o=H(i);xi(o),P(r),P(t),U(e=>{Q(t,`id`,`${n}-input`),X(i,`${e??``} `),Q(o,`aria-label`,K(v).inputLabel||`Session name`),Q(o,`maxlength`,K(v).inputLimit||512),o.disabled=K(g)||K(he)&&!a()},[()=>(K(v).inputLabel||`Session name`).toUpperCase()]),xr(`submit`,t,e=>{e.preventDefault(),se()}),Ei(o,()=>K(C),e=>R(C,e)),Y(e,t)},h=e=>{var n=ho(),r=z(n),i=V(r,!0),a=H(r,2),o=V(a,!0),s=H(a,2),c=e=>{var n=mo(),r=z(n),i=H(r),a=e=>{Y(e,Mr(`Only this session's saved + ${$.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(`

 
`),go=J(`
`),_o=J(`
`),vo=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(`
`);function No(e,t){let n=Pr();Ue(t,!0);let r=e=>{var t=Nr();Xr(B(t),19,()=>K(fe),e=>e.id,(e,t,r)=>{var i=so();let o;var s=z(i),c=V(s,!0),l=H(s),u=V(l),d=H(l),f=e=>{var n=oo(),r=V(n,!0);U(()=>X(r,K(t).help)),Y(e,n)};Z(d,e=>{(K(v)?.path===``||K(A))&&e(f)}),P(i),U((e,s)=>{Q(i,`id`,`${n}-${K(r)}`),Q(i,`role`,K(A)?`option`:void 0),Q(i,`aria-selected`,K(A)?K(T)===K(r):void 0),Q(i,`tabindex`,K(A)?-1:void 0),i.disabled=K(g)||K(he)&&!a(),Q(i,`title`,K(t).help),Q(i,`aria-label`,e),o=ci(i,1,`svelte-7bfwr9`,null,o,{suggested:K(T)===K(r)}),X(c,K(t).label),X(u,`${K(A)&&K(t).selected?` // CURRENT`:``}${s??``}`)},[()=>K(t).label+(K(A)&&K(t).selected?` // CURRENT`:``)+ie(K(t)),()=>ie(K(t))]),xr(`focus`,i,()=>{K(A)||_e(K(r))}),q(`click`,i,()=>{_e(K(r)),ye(K(t))}),Y(e,i)}),Y(e,t)},i=Wi(t,`query`,3,``),a=Wi(t,`localOnly`,3,!1),o=Wi(t,`oncopy`,3,()=>{}),s=Wi(t,`onchange`,3,()=>{}),c=Wi(t,`oncomplete`,3,e=>{}),l=[`statusline`,`usage`,`copy`,`theme`,`exit`,`quit`];function u(){return[{id:`local-statusline`,label:`/statusline`,help:`Choose fields for Codexometer’s detail footer.`,next:`statusline`},{id:`local-usage`,label:`/usage`,help:`Open Codexometer’s usage history. Quota and reset views remain available.`,next:`usage`},{id:`local-copy`,label:`/copy`,help:`Copy the selected session’s observed reply or activity with its Copy control.`,next:`copy`},{id:`local-theme`,label:`/theme`,help:`Open the existing Codexometer theme selector. Saved browser display preferences only.`,next:`theme`},{id:`local-exit`,label:`/exit`,help:`Leave session detail and return to Sessions. The local server remains running.`,next:`exit`},{id:`local-quit`,label:`/quit`,help:`Alias for /exit: return to Sessions. The local server remains running.`,next:`quit`}]}function d(){return{title:`/ COMMANDS`,help:`Local Codexometer commands remain available without session control.`,path:``,revision:``,choices:u()}}function f(){R(b,``),R(O,``),R(x,0),R(ne,[],!0)}function p(){w++,R(g,!1),R(h,!1),R(E,i()),f(),R(_,``),K(ue)?s()():c()(i())}async function m(e){if(!l.includes(e))return!1;if(e===`copy`&&!ao($.data?.sessions.find(e=>e.id===t.session)))return R(_,`No reply or activity text is available to copy for this session.`),!0;if(e===`copy`){let e=o()();p(),await e}else p(),e===`usage`?location.hash=`/usage`:e===`theme`?sa.requests++:e===`statusline`?oa.open=!0:location.hash=`/sessions`;return!0}let h=L(!1),g=L(!1),_=L(``),v=L(null),y=L(null),b=L(``),x=L(0),S=L(Yt(Date.now())),C=L(``),w=0,T=L(0),E=L(null),D=L(void 0),ee=L(void 0),te=L(void 0),O=L(``),ne=L(Yt([])),k=F(()=>K(v)?.path.startsWith(`rename/`)||K(v)?.path.startsWith(`cd/`)),re=F(()=>!!K(y)&&!K(k)||!!K(O)||K(ne).length>0);function ie(e){return e.unavailable?e.unavailable.startsWith(`Waiting for idle.`)?` // WAITING FOR IDLE`:` // UNAVAILABLE`:e.next?` →`:e.action?``:` // HELP`}async function ae(e){K(v)&&!(K(ge)&&K(de))&&R(ne,[...K(ne),{path:K(v).path,index:K(T),input:K(C)}],!0),await N(e)}async function oe(){if(!K(re))return;if(w++,R(g,!1),R(b,``),R(x,0),R(_,``),K(O)){R(O,``),K(D)?.focus();return}if(K(y)&&!K(k)){R(y,null),await lr(),K(D)?.focus();return}let e=K(ne).at(-1);e&&(R(ne,K(ne).slice(0,-1),!0),await N(e.path,e))}function se(){K(v)&&K(C).trim()&&!K(g)&&!K(he)&&ae(K(v).path+`/`+encodeURIComponent(K(C).trim()))}let A=F(()=>K(h)&&!!K(v)?.picker&&!K(y)),ce=F(()=>K(h)&&!K(v)?.input&&!K(y)),le=setInterval(()=>{R(S,Date.now(),!0)},1e3);Ki(()=>{clearInterval(le),w++});let ue=F(()=>i().trim().startsWith(`/`)&&!i().trim().startsWith(`//`)),de=F(()=>K(v)?.path===``&&K(ue)?i().trim().slice(1).toLowerCase():``),fe=F(()=>(K(v)?.choices||[]).filter(e=>!K(de)||e.label.toLowerCase().startsWith(`/`+K(de)))),j=F(()=>K(y)||K(fe)[K(T)]),pe=F(()=>!!K(b)&&K(S)K(fe).find(e=>e.id===K(O))),he=F(()=>!$.connected||!!$.data?.sessionsError),ge=F(()=>K(h)&&K(ue)&&(!K(v)||K(v).path===``)&&!K(y));vn(()=>{i(),R(T,0)}),vn(()=>{let e=K(T);K(fe),K(ce)&&lr().then(()=>{let t=K(D)?.children[e];if(!t||!K(D))return;let n=K(D).getBoundingClientRect(),r=t.getBoundingClientRect();r.topn.bottom&&(K(D).scrollTop+=r.bottom-n.bottom)})});function _e(e){K(T)!==e&&K(v)?.picker&&(R(O,``),R(b,``),R(x,0),R(_,``),w++),R(T,e,!0)}function M(){w++,R(g,!1),R(h,!1),R(E,i()),f(),c()(i())}function ve(e){let t=!!K(ee)?.contains(e.target);if(!K(h)||!K(ce)&&!K(y)&&!K(v)?.input||!K(ue)&&!t||K(he)&&!a()||e.isComposing||e.ctrlKey||e.metaKey||e.altKey)return;if(K(v)?.input){e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),M());return}let n=e.key===`ArrowLeft`,r=e.key.toLowerCase()===`f`,i=e.key.toLowerCase()===`c`;if((i||r||n)&&!t||![`ArrowUp`,`ArrowDown`,`Tab`,`Enter`,`Escape`].includes(e.key)&&!i&&!r&&!n||e.key===`Tab`&&(K(y)||K(v)?.path!==``||e.shiftKey)||e.key===`Enter`&&e.target instanceof Element&&e.target.closest(`button`)&&!K(D)?.contains(e.target)&&!e.target.closest(`[data-command-confirm]`)||K(y)&&!t||K(y)&&[`ArrowUp`,`ArrowDown`].includes(e.key))return;if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){M();return}if(K(g)||e.repeat&&(i||e.key===`Enter`))return;if(n){K(re)&&oe();return}if(r){N(K(v)?.path||``,void 0,!0);return}if(i){(K(y)?.action||K(A)&&K(O))&&xe();return}if(K(y)){e.key===`Enter`&&K(y).action&&!K(pe)&&!K(_)&&be(K(y));return}if(e.key===`ArrowUp`||e.key===`ArrowDown`){_e(Math.min(Math.max(K(T)+(e.key===`ArrowUp`?-1:1),0),Math.max(K(fe).length-1,0))),!K(A)&&K(D)?.contains(e.target)&&lr().then(()=>(K(D)?.children[K(T)])?.focus());return}let o=K(fe)[K(T)];o&&(e.key===`Tab`?c()(o.label):K(A)?be(o):ye(o))}vn(()=>{K(he)&&!a()&&(w++,R(g,!1),f(),K(h)&&(R(h,!1),R(E,i())),R(v,null),R(y,null))}),vn(()=>{K(ue)&&!K(h)&&i()!==K(E)&&(!K(he)||a())&&(f(),R(h,!0),N(``))});async function N(e,n,r=!1){let i=++w;if(K(v)&&R(v,{...K(v),path:e},!0),n&&R(C,n.input,!0),R(g,!0),R(y,null),R(O,``),R(b,``),R(x,0),R(_,``),a())R(v,d(),!0),R(T,n?.index??0,!0),R(g,!1);else try{let a=await va(`commands`,{session:t.session,command:{mode:`list`,path:e,...r?{refresh:!0}:{}}});i===w&&((e===``||e===`help`)&&(a.choices=[...a.choices.filter(e=>!l.includes(e.label.replace(/^\//,``))),...u()]),R(v,a,!0),R(T,n?Math.min(n.index,Math.max(a.choices.length-1,0)):a.picker?Math.max(a.choices.findIndex(e=>e.selected),0):0,!0),a.picker&&lr().then(()=>K(D)?.focus()),R(C,n?.input??a.value??``,!0),n&&lr().then(()=>{a.input?K(ee)?.querySelector(`input`)?.focus():K(D)?.focus()}),(a.path.startsWith(`rename/`)||a.path.startsWith(`cd/`))&&a.choices.length===1&&(R(g,!1),ye(a.choices[0])))}catch{i===w&&(R(_,`Command catalogue unavailable. Use Codex.`),e===``||e===`help`?(R(v,d(),!0),R(_,``)):R(v,{title:`/`+e,help:``,path:e,revision:``,choices:[]},!0))}finally{i===w&&R(g,!1)}}async function ye(e){e.unavailable||K(g)||e.next&&await m(e.next)||K(_)||(K(v)?.picker?(_e(K(fe).findIndex(t=>t.id===e.id)),e.action&&(e.reversible||$.data?.noConfirm)?await be(e):K(D)?.focus()):e.next?await ae(e.next):await be(e))}async function be(e){if(K(g)||K(he)||!K(v)||e.unavailable||K(_))return;let n=e.action&&(e.reversible||$.data?.noConfirm);if(K(v).picker){if(K(pe)&&K(O)===e.id)return;R(O,e.id,!0)}else n||(R(y,e,!0),lr().then(()=>K(te)?.focus()));if(R(b,``),R(x,0),R(_,``),!e.action)return;let r=++w;R(g,!0);try{let n=await va(`commands`,{session:t.session,command:{mode:`prepare`,path:K(v).path,revision:K(v).revision,choice:e.id}});if(r===w){let e=Date.parse(n.expires);if(!n.confirmation||!Number.isFinite(e)||Date.now()>=e)throw Error(`Review confirmation unavailable`);R(b,n.confirmation,!0),R(x,e,!0)}}catch{r===w&&R(_,`Option changed or unavailable. Refresh before retrying.`)}finally{r===w&&R(g,!1)}n&&r===w&&K(b)&&await xe()}async function xe(){if(!K(b)||K(he)||K(g)||Date.now()>=K(x)||!K(v)||K(v).picker&&K(O)!==K(fe)[K(T)]?.id)return;let e=K(b);R(b,``),R(g,!0);let n=++w;try{let r=await va(`commands`,{session:t.session,confirmation:e,command:{mode:`commit`,path:K(v).path}});n===w&&(R(_,r.message,!0),R(h,!1),R(v,null),R(y,null),f(),R(E,null),s()())}catch{n===w&&R(_,`Change unconfirmed. Check Codex before retrying.`)}finally{n===w&&R(g,!1)}}var Se={handleKey:ve},Ce=Mo(),we=z(Ce),Te=H(we,2),Ee=e=>{var t=co(),n=V(t,!0);U(()=>X(n,K(_))),Y(e,t)};Z(Te,e=>{K(_)&&!K(h)&&e(Ee)});var De=H(Te,2),Oe=e=>{var i=jo();let o;var s=z(i),c=e=>{var t=lo(),n=B(t),r=V(n,!0),i=V(H(n,2),!0);U(()=>{X(r,K(v)?.title||`/ COMMANDS`),X(i,K(v)?.help||`Loading live options…`)}),Y(e,t)};Z(s,e=>{K(ge)||e(c)});var l=H(s,2),u=e=>{var t=uo(),n=V(t,!0);U(()=>X(n,K(_))),Y(e,t)};Z(l,e=>{K(_)&&e(u)});var d=H(l,2),f=e=>{Y(e,fo())};Z(d,e=>{K(g)&&e(f)});var p=H(d,2),m=e=>{var t=po(),r=z(t),i=z(r),o=H(i);xi(o),P(r),P(t),U(e=>{Q(t,`id`,`${n}-input`),X(i,`${e??``} `),Q(o,`aria-label`,K(v).inputLabel||`Session name`),Q(o,`maxlength`,K(v).inputLimit||512),o.disabled=K(g)||K(he)&&!a()},[()=>(K(v).inputLabel||`Session name`).toUpperCase()]),xr(`submit`,t,e=>{e.preventDefault(),se()}),Ei(o,()=>K(C),e=>R(C,e)),Y(e,t)},h=e=>{var n=ho(),r=z(n),i=V(r,!0),a=H(r,2),o=V(a,!0),s=H(a,2),c=e=>{var n=mo(),r=z(n),i=H(r),a=e=>{Y(e,Mr(`Only this session's saved name changes.`))},o=F(()=>K(v)?.path.startsWith(`rename/`)),s=e=>{Y(e,Mr(`Only this session’s directory changes; project configuration is not reloaded.`))},c=F(()=>K(v)?.path.startsWith(`cd/`)),l=e=>{Y(e,Mr(`No change sent yet. Model, reasoning and speed settings can change token usage and cost. Changes affect subsequent turns of this session, not global defaults. Automatic quota thresholds - may later supersede model settings.`))};Z(i,e=>{K(o)?e(a):K(c)?e(s,1):e(l,-1)}),P(n),U(()=>X(r,`TARGET // ${t.session??``}. `)),Y(e,n)};Z(s,e=>{K(y).action&&e(c)}),P(n),Ii(n,e=>R(te,e),()=>K(te)),U(()=>{X(i,K(y).label),X(o,K(y).help||`No additional help supplied by Codex.`)}),Y(e,n)},w=e=>{var t=So(),i=B(t),a=e=>{var t=go(),i=z(t);r(i),P(t),Ii(t,e=>R(D,e),()=>K(D)),U(()=>Q(t,`aria-activedescendant`,`${n}-${K(T)}`)),Y(e,t)},o=e=>{var t=_o();let n;var i=z(t);r(i),P(t),Ii(t,e=>R(D,e),()=>K(D)),U(()=>n=ci(t,1,`command-options svelte-7bfwr9`,null,n,{vertical:K(ge)})),Y(e,t)};Z(i,e=>{K(A)?e(a):e(o,-1)});var s=H(i,2),c=e=>{var t=bo(),n=B(t),r=V(n,!0),i=H(n,2),a=e=>{var t=yo(),n=B(t),r=V(n),i=H(n,2),a=e=>{Y(e,vo())};Z(i,e=>{K(b)&&K(S)>=K(x)&&e(a)}),U(()=>X(r,`REVIEW // ${K(me).label??``}. No change sent yet.`)),Y(e,t)};Z(i,e=>{K(me)&&e(a)}),U(()=>X(r,K(fe)[K(T)]?.help)),Y(e,t)};Z(s,e=>{K(A)&&e(c)});var l=H(s,2),u=e=>{Y(e,xo())};Z(l,e=>{!K(g)&&!K(fe).length&&e(u)}),Y(e,t)};Z(p,e=>{K(v)?.input?e(m):K(y)?e(h,1):e(w,-1)});var E=H(p,2),O=e=>{var t=Co(),n=V(t,!0);U(()=>X(n,K(j).unavailable)),Y(e,t)};Z(E,e=>{K(j)?.unavailable&&e(O)});var ne=H(E,2),k=e=>{Y(e,wo())};Z(ne,e=>{K(b)&&K(S)>=K(x)&&!K(A)&&e(k)});var ie=H(ne,2),ae=z(ie),ce=e=>{var t=Nr(),r=B(t),i=e=>{var t=To();U(e=>{Q(t,`form`,`${n}-input`),t.disabled=e},[()=>K(g)||K(he)||!K(C).trim()]),Y(e,t)},o=e=>{var t=Nr(),n=B(t),r=e=>{var t=Eo();U(()=>t.disabled=K(g)||K(he)&&!a()),q(`click`,t,xe),Y(e,t)},i=e=>{var t=Do();U(()=>t.disabled=K(g)||K(he)&&!a()),q(`click`,t,()=>{K(j)&&be(K(j))}),Y(e,t)};Z(n,e=>{K(pe)?e(r):e(i,-1)}),Y(e,t)},s=e=>{var t=Oo(),n=V(t);U(()=>{t.disabled=K(g)||K(he)&&!a(),X(n,`ENTER ${K(j).next?`OPEN`:`HELP`}`)}),q(`click`,t,()=>{K(j)&&ye(K(j))}),Y(e,t)};Z(r,e=>{K(v)?.input?e(i):K(j)?.action&&!K(j).unavailable?e(o,1):!K(y)&&K(j)&&!K(j).unavailable&&e(s,2)}),Y(e,t)};Z(ae,e=>{K(_)||e(ce)});var le=H(ae,2),ue=e=>{var t=ko();U(()=>t.disabled=K(g)),q(`click`,t,oe),Y(e,t)};Z(le,e=>{K(re)&&e(ue)});var de=H(le,2),_e=e=>{var t=Ao();U(()=>t.disabled=K(g)),q(`click`,t,()=>N(K(v)?.path||``,void 0,!0)),Y(e,t)};Z(de,e=>{K(ge)||e(_e)});var Se=H(de,2);P(ie);var Ce=H(ie,2),we=e=>{var t=jo(),n=V(t);U(()=>X(n,`↑/↓ select${K(ge)?` · Tab complete`:``}`)),Y(e,t)};Z(Ce,e=>{!K(v)?.input&&!K(y)&&e(we)}),P(i),Ii(i,e=>R(ee,e),()=>K(ee)),U(()=>{Q(i,`aria-label`,K(ge)?`Slash command suggestions`:`Session command options`),o=ci(i,1,`svelte-7bfwr9`,null,o,{"command-popup":K(ge)})}),q(`keydown`,i,ve),q(`click`,Se,M),Y(e,i)};return Z(De,e=>{K(h)&&e(Oe)}),P(Ce),U(()=>we.disabled=K(he)&&!a()||K(g)),q(`click`,we,()=>{R(h,!K(h)),R(E,K(h)?null:i(),!0),R(b,``),K(h)?(R(ne,[],!0),N(``)):M()}),Y(e,Ce),We(Se)}Sr([`click`,`keydown`]);var Fo=J(` `,1),Io=J(`
`),Lo=J(`
/
`);function Ro(e,t){Ue(t,!0);let n=F(()=>t.lines.filter(e=>e.kind===`addition`).length),r=F(()=>t.lines.filter(e=>e.kind===`removal`).length);var i=Lo(),a=z(i),o=z(a),s=V(o),c=V(H(o,2));P(a),Xr(H(a,2),17,()=>t.lines,Kr,(e,t)=>{var n=Io();let r;var i=z(n),a=e=>{var n=Fo(),r=B(n),i=V(r,!0),a=V(H(r),!0);U(()=>{X(i,K(t).old||``),X(a,K(t).new||``)}),Y(e,n)};Z(i,e=>{K(t).kind!==`heading`&&K(t).kind!==`metadata`&&e(a)});var o=V(H(i),!0);P(n),U(()=>{r=ci(n,1,`diff-line svelte-x4gtb6`,null,r,{added:K(t).kind===`addition`,removed:K(t).kind===`removal`,heading:K(t).kind===`heading`}),X(o,K(t).text)}),Y(e,n)}),P(i),U(()=>{Q(a,`aria-label`,`${K(n)} lines added, ${K(r)} lines removed`),X(s,`+${K(n)??``}`),X(c,`−${K(r)??``}`)}),Y(e,i),We()}var zo=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.

`),Uo=J(`

CURRENT PROFILE

MODEL / REASONING LEVEL / SPEED

 

PROPOSED PROFILE

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(`
About browser controls

Controls require a supported live request from a connected shared - app-server session. Local observations alone cannot provide them.

`),Zo=J(` `,1),Qo=J(` `),$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(`
  • `),ps=J(`
    View fixed choices

    Type one of these choices exactly. Your answer stays masked.

      `),ms=J(` `,1),hs=J(`

      `),gs=J(`

      `,1),_s=J(` `,1),vs=J(``),ys=J(`

      `,1),bs=J(`

      `);function xs(e,t){Ue(t,!0);let n=[],r=Wi(t,`observedCommand`,3,``),i=Wi(t,`observedFileChanges`,19,()=>[]),a=Wi(t,`review`,3,``),o=Wi(t,`suspended`,3,!1),s=Wi(t,`openScheduler`,3,!1),c=Wi(t,`onProtectedChange`,3,e=>{}),l=Wi(t,`oncopy`,3,()=>{}),u=L(null),d=L(Yt([])),f=L(null),p=L(``),m=L(0),h=L(Yt(Date.now())),g=L(!1),_=L(``),v=L(!1),y=L(!1),b=L(``),x=L(!1),S=L(``),C=L(!1),w=L(``),T=L(`now`),E=L(60),D=L(``),ee=L(!1),te=L(``),O=L(Yt([])),ne=F(()=>K(O).find(e=>e.status!==`sent`)),k=L(void 0),re=L(void 0);function ie(e){if(K(x)){lr().then(()=>K(k)?.focus());return}if(e.status!==`pending`||K(g)||!K(u)?.id||K(u).kind!==`prompt`||K(u).questions?.length)return;R(x,!0),R(S,e.id,!0),lr().then(()=>K(k)?.focus()),R(d,[e.text],!0),R(T,e.trigger===`quota`?`quota`:`at`,!0),R(p,``),R(w,``);let t=new Date(e.at);e.trigger!==`quota`&&R(D,new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,16),!0)}vn(()=>{s()&&K(ne)&&!K(C)&&K(u)?.id&&K(u).kind===`prompt`&&!K(u).questions?.length&&(R(C,!0),ie(K(ne)))});async function ae(){if(!a())try{R(O,await va(`schedules`,{session:t.session},M.signal),!0),K(x)&&!K(O).some(e=>e.id===K(S)&&e.status===`pending`)&&R(p,``),K(w)&&!K(O).some(e=>e.id===K(w)&&e.status===`pending`)&&(R(p,``),R(w,``))}catch{}}async function oe(e){try{R(O,await va(`schedules`,{session:t.session,cancelId:e},M.signal),!0),R(x,!1),R(p,``),R(w,``),R(d,[],!0)}catch(e){R(_,e instanceof Error?e.message:`Unable to cancel trigger.`,!0)}}vn(()=>(c()(K(g)||K(d).some(e=>e.length>0)),()=>c()(!1)));let se=F(()=>$.data?.sessions.find(e=>e.id===t.session)?.status),A=F(()=>!$.connected||!!$.data?.sessionsError),ce=F(()=>a()!==`profile`&&K(u)?.kind===`prompt`&&!K(u).questions?.length&&!!$.data?.profiles?.some(e=>e.session===t.session&&e.pending)),le=F(()=>!K(A)&&!K(y)&&!!K(u)?.id&&K(u).kind===`approval`&&K(b)!==K(u).id),ue=F(()=>K(le)?K(u).command:r()),de=F(()=>!!K(p)&&K(h)K(u)?.questions?.length?K(u).questions:[{text:`Follow-up message`,secret:!1,freeText:!0,options:[]}]),j=F(()=>K(u)?.kind===`approval`||K(u)?.kind===`profile`?K(f)!==null:K(d).length===K(fe).length&&K(d).every((e,t)=>e.trim().length>0&&(K(fe)[t].freeText||K(fe)[t].options?.includes(e)))),pe=F(()=>K(u)?.kind===`prompt`&&!K(u).questions?.length&&K(T)!==`now`),me=F(()=>K(T)===`delay`?K(h)+K(E)*6e4:Date.parse(K(D))),he=F(()=>{if(!K(pe))return``;if(K(x)&&!K(O).some(e=>e.id===K(S)&&e.status===`pending`))return`Trigger changed, removed or already sent. Go back and reopen it; your draft has not been saved.`;if(!K(d)[0]?.trim())return`Enter a message to schedule.`;if(K(T)===`quota`)return``;if(!Number.isFinite(K(me))||K(me)<=K(h))return`Choose a future date/time or a delay greater than zero.`;let e=new Date(K(h));return e.setFullYear(e.getFullYear()+1),K(me)>=e.getTime()?`Choose a time within one year.`:``});function ge(e){return new Date(e).toLocaleString([],{timeZoneName:`short`})}function _e(e){if(e.status!==`pending`)return e.status;if(e.trigger===`at`&&Date.parse(e.at)>K(h))return`Due in `+Math.ceil((Date.parse(e.at)-K(h))/6e4)+` min`;let t=K(A)?`waiting for a fresh connection`:e.waitingReason||(e.canSend?`ready; awaiting dispatch`:`waiting for quota and an eligible idle session`);return(e.trigger===`at`?`Time reached — `:``)+t}vn(()=>{(K(A)||o()||K(ce)||K(h)>=K(m))&&R(p,``)});let M=new AbortController;Gi(()=>{let e=e=>{e.ctrlKey&&e.key.toLowerCase()===`s`&&!a()&&K(ne)&&(e.preventDefault(),ie(K(ne)))};window.addEventListener(`keydown`,e);let n,r=setInterval(()=>{R(h,Date.now(),!0)},1e3);async function i(){await ae();try{let e=await va(`offer`,{session:t.session,...a()?{review:a()}:{}},M.signal);if(M.signal.aborted)return;R(y,!1),K(u)?.id!==e.id&&(R(p,``),R(f,null),R(d,Array(Math.max(1,e.questions?.length||0)).fill(``),!0)),R(u,e,!0),K(v)&&e.id&&e.id!==K(b)&&(R(_,``),R(v,!1))}catch{M.signal.aborted||(R(u,null),R(y,!0),R(p,``))}finally{M.signal.aborted||(n=setTimeout(i,2e3))}}return i(),()=>{window.removeEventListener(`keydown`,e),M.abort(),clearTimeout(n),clearInterval(r)}});async function ve(e){if(!e&&K(u)?.kind===`prompt`&&!K(u).questions?.length&&K(d)[0]?.trim().startsWith(`/`)&&!K(d)[0]?.trim().startsWith(`//`)){R(_,`Choose a slash command from COMMANDS; use // for literal slash text.`);return}if(!K(u)?.id||K(g)||K(A)||o()||K(ce)||(e?!e.canSend:!K(j)||K(he)))return;let n=K(u).id;R(g,!0),R(_,``),R(v,!1),R(p,``),R(w,e?.id||``,!0);try{let r=!e&&K(u).kind===`prompt`&&!K(u).questions?.length&&K(T)!==`now`?{trigger:K(T)===`quota`?`quota`:`at`,zone:Intl.DateTimeFormat().resolvedOptions().timeZone,...K(T)===`quota`?{}:{at:(K(T)===`delay`?new Date(Date.now()+K(E)*6e4):new Date(K(D))).toISOString()}}:void 0;R(ee,!!r),R(te,r?r.trigger===`quota`?`After fresh quota becomes available, when the session is idle`:ge(r.at)+` — not before this time; when quota and idle allow`:``,!0);let i=await va(`prepare`,{session:t.session,...a()?{review:a()}:{},offer:n,...e?{sendId:e.id}:{},...r?{schedule:r}:{},...r&&K(x)?{editId:K(S)}:{},...K(u).kind===`approval`||K(u).kind===`profile`?{choice:K(f)}:{answers:e?[e.text]:[...K(d)]}},M.signal);K(u)?.id!==n||M.signal.aborted||K(A)||o()||K(ce)||(R(p,i.confirmation,!0),R(m,Date.parse(i.expires),!0))}catch(e){M.signal.aborted||R(_,e instanceof Error?e.message:`Unable to prepare action.`,!0)}finally{R(g,!1)}}async function N(){if(!K(u)?.id||K(g)||o()||K(ce)||!K(de))return;let e=K(u).id,n=K(u).kind,r=K(p);R(p,``),R(g,!0),R(b,e,!0);try{await va(`commit`,{session:t.session,...a()?{review:a()}:{},offer:e,confirmation:r},M.signal),R(v,!0),R(x,!1),K(ee)&&(R(b,``),await ae()),R(_,K(ee)?`Trigger set. Closing Codexometer cancels it.`:n===`profile`?`Profile decision completed.`:n===`approval`?`Decision sent.`:`Text sent.`,!0)}catch(e){R(_,e instanceof ga?e.message:`Outcome uncertain. Check Codex before taking another action; nothing was retried.`,!0)}finally{R(g,!1),R(w,``),await ae(),R(d,[],!0),R(f,null)}}var ye=Zo(),be=B(ye),Se=e=>{var t=Nr();Xr(B(t),17,()=>K(O).filter(e=>e.status!==`sent`),e=>e.id,(e,t)=>{var n=Ho(),r=z(n),i=V(r,!0),a=H(r,2),s=V(a),c=H(a,2),l=V(c,!0),d=H(c,2),f=V(d,!0),m=H(d,2),h=V(m,!0),v=H(m,2),y=e=>{var t=zo(),n=V(t,!0);U(()=>X(n,K(_))),Y(e,t)};Z(v,e=>{K(_)&&e(y)});var b=H(v,4),x=H(b,2),S=H(x,2),C=e=>{var n=Bo(),r=H(B(n),2),i=H(r,2);U(()=>r.disabled=K(g)||K(A)||!K(t).canSend),q(`click`,r,N),q(`click`,i,()=>{R(p,``),R(w,``)}),Y(e,n)},T=e=>{var n=Vo();U(()=>n.disabled=K(g)||K(A)||!K(t).canSend||o()),q(`click`,n,()=>ve(K(t))),Y(e,n)};Z(S,e=>{K(de)&&K(w)===K(t).id?e(C):e(T,-1)}),P(n),U((e,n)=>{X(i,K(t).status===`uncertain`?`CHECK TRIGGER — outcome uncertain; not retried`:`SCHEDULED FOLLOW-UP`),X(s,`TARGET // ${K(t).session??``}`),X(l,e),X(f,n),X(h,K(t).text),b.disabled=K(g)||!K(u)?.id||K(u).kind!==`prompt`||!!K(u).questions?.length||K(t).status!==`pending`,x.disabled=K(g)||K(t).status===`sending`},[()=>K(t).trigger===`quota`?`After confirmed quota recovery, when idle`:`Not before ${ge(K(t).at)}`,()=>_e(K(t))]),q(`click`,b,()=>ie(K(t))),q(`click`,x,()=>oe(K(t).id)),Y(e,n)}),Y(e,t)},Ce=F(()=>!a()&&K(u)?.kind!==`approval`&&!K(u)?.questions?.length&&![`APPROVAL NEEDED`,`INPUT NEEDED`].includes(K(se)||``));Z(be,e=>{K(Ce)&&e(Se)});var we=H(be,2),Te=e=>{var r=bs(),o=z(r),s=V(o,!0),c=H(o,2),S=e=>{var t=Uo(),n=B(t),r=V(n),i=H(n,6),a=V(i,!0),o=V(H(i,6),!0);xe(2),U(()=>{X(r,`Your ${K(u).profile.threshold??``}% quota threshold has been reached. Review - the profile for subsequent turns.`),X(a,K(u).profile.current),X(o,K(u).profile.proposed)}),Y(e,t)};Z(c,e=>{K(u)?.profile&&!K(A)&&!K(y)&&e(S)});var C=H(c,2),w=e=>{var t=Wo();let n;var r=V(t,!0);U(()=>{n=ci(t,1,`svelte-1oupzfc`,null,n,{notice:!K(v),sent:K(v)}),X(r,K(_))}),Y(e,t)};Z(C,e=>{K(_)&&e(w)});var O=H(C,2),ne=e=>{Ro(e,{get lines(){return K(u).fileChanges}})},ie=e=>{Ro(e,{get lines(){return i()}})},ae=e=>{var t=Go(),n=B(t),r=V(n,!0),i=V(H(n,2),!0);U(()=>{X(r,K(le)?`EXACT COMMAND`:`LAST OBSERVED COMMAND`),X(i,K(ue))}),Y(e,t)},oe=e=>{Y(e,Ko())};Z(O,e=>{K(u)?.fileChanges?.length&&!K(A)&&!K(y)?e(ne):i().length?e(ie,1):K(ue)?e(ae,2):a()!==`profile`&&K(se)===`APPROVAL NEEDED`&&!K(v)&&e(oe,3)});var ce=H(O,2),pe=e=>{Y(e,qo())},_e=e=>{Y(e,Jo())},M=e=>{var t=Zo(),n=B(t),r=e=>{var t=Yo(),n=V(t,!0);U(e=>X(n,e),[()=>K(se)===`WORKING`?`Codex is working — nothing to respond to.`:[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(K(se)||``)?`Respond in Codex for this request.`:`Nothing needs a response right now.`]),Y(e,t)};Z(n,e=>{(K(se)===`WORKING`||!K(v)&&!K(g))&&e(r)});var i=H(n,2),a=e=>{Y(e,Xo())},o=F(()=>[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(K(se)||``)&&!K(v));Z(i,e=>{K(o)&&e(a)}),Y(e,t)},ye=e=>{var r=ys(),i=B(r),o=V(i),s=H(i,2),c=z(s),_=V(c,!0),v=H(c,2),y=e=>{var r=Nr();Xr(B(r),17,()=>K(u).choices||[],Kr,(e,r,i)=>{var o=es(),s=z(o);xi(s),s.value=s.__value=i;var c=H(s),l=H(c),u=e=>{var t=Qo(),n=V(t,!0);U(()=>X(n,K(r).detail)),Y(e,t)};Z(l,e=>{K(r).detail&&e(u)});var d=H(l,2),p=e=>{Y(e,$o())};Z(d,e=>{K(r).persistent&&e(p)}),P(o),U(()=>{Q(s,`name`,`decision-`+t.session+`-`+a()),X(c,` ${K(r).label??``} `)}),Oi(n,[],s,()=>K(f),e=>R(f,e)),Y(e,o)}),Y(e,r)},b=e=>{var n=Zo(),r=B(n),i=e=>{var t=ss(),n=B(t),r=H(z(n)),i=z(r),a=e=>{var t=ts();t.value=t.__value=`now`,Y(e,t)};Z(i,e=>{K(x)||e(a)});var o=H(i);o.value=o.__value=`quota`;var s=H(o);s.value=s.__value=`delay`;var c=H(s);c.value=c.__value=`at`,P(r),mi(r),P(n);var l=H(n,2),u=e=>{var t=ns(),n=H(z(t));xi(n),P(t),Ei(n,()=>K(E),e=>R(E,e)),Y(e,t)};Z(l,e=>{K(T)===`delay`&&e(u)});var d=H(l,2),f=e=>{var t=rs(),n=H(z(t));xi(n),P(t),Ei(n,()=>K(D),e=>R(D,e)),Y(e,t)};Z(d,e=>{K(T)===`at`&&e(f)});var p=H(d,2),m=e=>{var t=as(),n=B(t),r=V(n),i=H(n,2),a=e=>{Y(e,is())};Z(i,e=>{K(T)!==`quota`&&e(a)});var o=H(i,2);o.textContent=`Timezone: ${Intl.DateTimeFormat().resolvedOptions().timeZone??``}. + may later supersede model settings.`))};Z(i,e=>{K(o)?e(a):K(c)?e(s,1):e(l,-1)}),P(n),U(()=>X(r,`TARGET // ${t.session??``}. `)),Y(e,n)};Z(s,e=>{K(y).action&&e(c)}),P(n),Ii(n,e=>R(te,e),()=>K(te)),U(()=>{X(i,K(y).label),X(o,K(y).help||`No additional help supplied by Codex.`)}),Y(e,n)},w=e=>{var t=So(),i=B(t),a=e=>{var t=go(),i=z(t);r(i),P(t),Ii(t,e=>R(D,e),()=>K(D)),U(()=>Q(t,`aria-activedescendant`,`${n}-${K(T)}`)),Y(e,t)},o=e=>{var t=_o();let n;var i=z(t);r(i),P(t),Ii(t,e=>R(D,e),()=>K(D)),U(()=>n=ci(t,1,`command-options svelte-7bfwr9`,null,n,{vertical:K(ge)})),Y(e,t)};Z(i,e=>{K(A)?e(a):e(o,-1)});var s=H(i,2),c=e=>{var t=bo(),n=B(t),r=V(n,!0),i=H(n,2),a=e=>{var t=yo(),n=B(t),r=V(n),i=H(n,2),a=e=>{Y(e,vo())};Z(i,e=>{K(b)&&K(S)>=K(x)&&e(a)}),U(()=>X(r,`REVIEW // ${K(me).label??``}. No change sent yet.`)),Y(e,t)};Z(i,e=>{K(me)&&e(a)}),U(()=>X(r,K(fe)[K(T)]?.help)),Y(e,t)};Z(s,e=>{K(A)&&e(c)});var l=H(s,2),u=e=>{Y(e,xo())};Z(l,e=>{!K(g)&&!K(fe).length&&e(u)}),Y(e,t)};Z(p,e=>{K(v)?.input?e(m):K(y)?e(h,1):e(w,-1)});var E=H(p,2),O=e=>{var t=Co(),n=V(t,!0);U(()=>X(n,K(j).unavailable)),Y(e,t)};Z(E,e=>{K(j)?.unavailable&&e(O)});var ne=H(E,2),k=e=>{Y(e,wo())};Z(ne,e=>{K(b)&&K(S)>=K(x)&&!K(A)&&e(k)});var ie=H(ne,2),ae=z(ie),ce=e=>{var t=Nr(),r=B(t),i=e=>{var t=To(),r=V(t,!0);U(e=>{Q(t,`form`,`${n}-input`),t.disabled=e,X(r,K(v).reversibleInput||$.data?.noConfirm?`ENTER APPLY`:`ENTER REVIEW`)},[()=>K(g)||K(he)||!K(C).trim()]),Y(e,t)},o=e=>{var t=Nr(),n=B(t),r=e=>{var t=Eo();U(()=>t.disabled=K(g)||K(he)&&!a()),q(`click`,t,xe),Y(e,t)},i=e=>{var t=Do(),n=V(t,!0);U(()=>{t.disabled=K(g)||K(he)&&!a(),X(n,K(j).reversible||$.data?.noConfirm?`ENTER APPLY`:`ENTER REVIEW`)}),q(`click`,t,()=>{K(j)&&be(K(j))}),Y(e,t)};Z(n,e=>{K(pe)&&!K(j).reversible&&!$.data?.noConfirm?e(r):e(i,-1)}),Y(e,t)},s=e=>{var t=Do(),n=V(t);U(()=>{t.disabled=K(g)||K(he)&&!a(),X(n,`ENTER ${K(j).next?`OPEN`:`HELP`}`)}),q(`click`,t,()=>{K(j)&&ye(K(j))}),Y(e,t)};Z(r,e=>{K(v)?.input?e(i):K(j)?.action&&!K(j).unavailable?e(o,1):!K(y)&&K(j)&&!K(j).unavailable&&e(s,2)}),Y(e,t)};Z(ae,e=>{K(_)||e(ce)});var le=H(ae,2),ue=e=>{var t=Oo();U(()=>t.disabled=K(g)),q(`click`,t,oe),Y(e,t)};Z(le,e=>{K(re)&&e(ue)});var de=H(le,2),_e=e=>{var t=ko();U(()=>t.disabled=K(g)),q(`click`,t,()=>N(K(v)?.path||``,void 0,!0)),Y(e,t)};Z(de,e=>{K(ge)||e(_e)});var Se=H(de,2);P(ie);var Ce=H(ie,2),we=e=>{var t=Ao(),n=V(t);U(()=>X(n,`↑/↓ select${K(ge)?` · Tab complete`:``}`)),Y(e,t)};Z(Ce,e=>{!K(v)?.input&&!K(y)&&e(we)}),P(i),Ii(i,e=>R(ee,e),()=>K(ee)),U(()=>{Q(i,`aria-label`,K(ge)?`Slash command suggestions`:`Session command options`),o=ci(i,1,`svelte-7bfwr9`,null,o,{"command-popup":K(ge)})}),q(`keydown`,i,ve),q(`click`,Se,M),Y(e,i)};return Z(De,e=>{K(h)&&e(Oe)}),P(Ce),U(()=>we.disabled=K(he)&&!a()||K(g)),q(`click`,we,()=>{R(h,!K(h)),R(E,K(h)?null:i(),!0),R(b,``),K(h)?(R(ne,[],!0),N(``)):M()}),Y(e,Ce),We(Se)}Sr([`click`,`keydown`]);var Po=J(` `,1),Fo=J(`
      `),Io=J(`
      /
      `);function Lo(e,t){Ue(t,!0);let n=F(()=>t.lines.filter(e=>e.kind===`addition`).length),r=F(()=>t.lines.filter(e=>e.kind===`removal`).length);var i=Io(),a=z(i),o=z(a),s=V(o),c=V(H(o,2));P(a),Xr(H(a,2),17,()=>t.lines,Kr,(e,t)=>{var n=Fo();let r;var i=z(n),a=e=>{var n=Po(),r=B(n),i=V(r,!0),a=V(H(r),!0);U(()=>{X(i,K(t).old||``),X(a,K(t).new||``)}),Y(e,n)};Z(i,e=>{K(t).kind!==`heading`&&K(t).kind!==`metadata`&&e(a)});var o=V(H(i),!0);P(n),U(()=>{r=ci(n,1,`diff-line svelte-x4gtb6`,null,r,{added:K(t).kind===`addition`,removed:K(t).kind===`removal`,heading:K(t).kind===`heading`}),X(o,K(t).text)}),Y(e,n)}),P(i),U(()=>{Q(a,`aria-label`,`${K(n)} lines added, ${K(r)} lines removed`),X(s,`+${K(n)??``}`),X(c,`−${K(r)??``}`)}),Y(e,i),We()}var Ro=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.

      `),Ho=J(`

      CURRENT PROFILE

      MODEL / REASONING LEVEL / SPEED

       

      PROPOSED PROFILE

      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(`
      About browser controls

      Controls require a supported live request from a connected shared + app-server session. Local observations alone cannot provide them.

      `),Xo=J(` `,1),Zo=J(` `),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(`
    • `),fs=J(`
      View fixed choices

      Type one of these choices exactly. Your answer stays masked.

        `),ps=J(` `,1),ms=J(`

        `),hs=J(`

        `,1),gs=J(` `,1),_s=J(``),vs=J(`

        `,1),ys=J(`

        `);function bs(e,t){Ue(t,!0);let n=[],r=Wi(t,`observedCommand`,3,``),i=Wi(t,`observedFileChanges`,19,()=>[]),a=Wi(t,`review`,3,``),o=Wi(t,`suspended`,3,!1),s=Wi(t,`openScheduler`,3,!1),c=Wi(t,`onProtectedChange`,3,e=>{}),l=Wi(t,`oncopy`,3,()=>{}),u=L(null),d=L(Yt([])),f=L(null),p=L(``),m=L(0),h=L(Yt(Date.now())),g=L(!1),_=L(``),v=L(!1),y=L(!1),b=L(``),x=L(!1),S=L(``),C=L(!1),w=L(``),T=L(`now`),E=L(60),D=L(``),ee=L(!1),te=L(``),O=L(Yt([])),ne=F(()=>K(O).find(e=>e.status!==`sent`)),k=L(void 0),re=L(void 0);function ie(e){if(K(x)){lr().then(()=>K(k)?.focus());return}if(e.status!==`pending`||K(g)||!K(u)?.id||K(u).kind!==`prompt`||K(u).questions?.length)return;R(x,!0),R(S,e.id,!0),lr().then(()=>K(k)?.focus()),R(d,[e.text],!0),R(T,e.trigger===`quota`?`quota`:`at`,!0),R(p,``),R(w,``);let t=new Date(e.at);e.trigger!==`quota`&&R(D,new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,16),!0)}vn(()=>{s()&&K(ne)&&!K(C)&&K(u)?.id&&K(u).kind===`prompt`&&!K(u).questions?.length&&(R(C,!0),ie(K(ne)))});async function ae(){if(!a())try{R(O,await va(`schedules`,{session:t.session},M.signal),!0),K(x)&&!K(O).some(e=>e.id===K(S)&&e.status===`pending`)&&R(p,``),K(w)&&!K(O).some(e=>e.id===K(w)&&e.status===`pending`)&&(R(p,``),R(w,``))}catch{}}async function oe(e){try{R(O,await va(`schedules`,{session:t.session,cancelId:e},M.signal),!0),R(x,!1),R(p,``),R(w,``),R(d,[],!0)}catch(e){R(_,e instanceof Error?e.message:`Unable to cancel trigger.`,!0)}}vn(()=>(c()(K(g)||K(d).some(e=>e.length>0)),()=>c()(!1)));let se=F(()=>$.data?.sessions.find(e=>e.id===t.session)?.status),A=F(()=>!$.connected||!!$.data?.sessionsError),ce=F(()=>a()!==`profile`&&K(u)?.kind===`prompt`&&!K(u).questions?.length&&!!$.data?.profiles?.some(e=>e.session===t.session&&e.pending)),le=F(()=>!K(A)&&!K(y)&&!!K(u)?.id&&K(u).kind===`approval`&&K(b)!==K(u).id),ue=F(()=>K(le)?K(u).command:r()),de=F(()=>!!K(p)&&K(h)K(u)?.questions?.length?K(u).questions:[{text:`Follow-up message`,secret:!1,freeText:!0,options:[]}]),j=F(()=>K(u)?.kind===`approval`||K(u)?.kind===`profile`?K(f)!==null:K(d).length===K(fe).length&&K(d).every((e,t)=>e.trim().length>0&&(K(fe)[t].freeText||K(fe)[t].options?.includes(e)))),pe=F(()=>K(u)?.kind===`prompt`&&!K(u).questions?.length&&K(T)!==`now`),me=F(()=>K(T)===`delay`?K(h)+K(E)*6e4:Date.parse(K(D))),he=F(()=>{if(!K(pe))return``;if(K(x)&&!K(O).some(e=>e.id===K(S)&&e.status===`pending`))return`Trigger changed, removed or already sent. Go back and reopen it; your draft has not been saved.`;if(!K(d)[0]?.trim())return`Enter a message to schedule.`;if(K(T)===`quota`)return``;if(!Number.isFinite(K(me))||K(me)<=K(h))return`Choose a future date/time or a delay greater than zero.`;let e=new Date(K(h));return e.setFullYear(e.getFullYear()+1),K(me)>=e.getTime()?`Choose a time within one year.`:``});function ge(e){return new Date(e).toLocaleString([],{timeZoneName:`short`})}function _e(e){if(e.status!==`pending`)return e.status;if(e.trigger===`at`&&Date.parse(e.at)>K(h))return`Due in `+Math.ceil((Date.parse(e.at)-K(h))/6e4)+` min`;let t=K(A)?`waiting for a fresh connection`:e.waitingReason||(e.canSend?`ready; awaiting dispatch`:`waiting for quota and an eligible idle session`);return(e.trigger===`at`?`Time reached — `:``)+t}vn(()=>{(K(A)||o()||K(ce)||K(h)>=K(m))&&R(p,``)});let M=new AbortController;Gi(()=>{let e=e=>{e.ctrlKey&&e.key.toLowerCase()===`s`&&!a()&&K(ne)&&(e.preventDefault(),ie(K(ne)))};window.addEventListener(`keydown`,e);let n,r=setInterval(()=>{R(h,Date.now(),!0)},1e3);async function i(){await ae();try{let e=await va(`offer`,{session:t.session,...a()?{review:a()}:{}},M.signal);if(M.signal.aborted)return;R(y,!1),K(u)?.id!==e.id&&(R(p,``),R(f,null),R(d,Array(Math.max(1,e.questions?.length||0)).fill(``),!0)),R(u,e,!0),K(v)&&e.id&&e.id!==K(b)&&(R(_,``),R(v,!1))}catch{M.signal.aborted||(R(u,null),R(y,!0),R(p,``))}finally{M.signal.aborted||(n=setTimeout(i,2e3))}}return i(),()=>{window.removeEventListener(`keydown`,e),M.abort(),clearTimeout(n),clearInterval(r)}});async function ve(e){if(!e&&K(u)?.kind===`prompt`&&!K(u).questions?.length&&K(d)[0]?.trim().startsWith(`/`)&&!K(d)[0]?.trim().startsWith(`//`)){R(_,`Choose a slash command from COMMANDS; use // for literal slash text.`);return}if(!K(u)?.id||K(g)||K(A)||o()||K(ce)||(e?!e.canSend:!K(j)||K(he)))return;let n=K(u).id;R(g,!0),R(_,``),R(v,!1),R(p,``),R(w,e?.id||``,!0);try{let r=!e&&K(u).kind===`prompt`&&!K(u).questions?.length&&K(T)!==`now`?{trigger:K(T)===`quota`?`quota`:`at`,zone:Intl.DateTimeFormat().resolvedOptions().timeZone,...K(T)===`quota`?{}:{at:(K(T)===`delay`?new Date(Date.now()+K(E)*6e4):new Date(K(D))).toISOString()}}:void 0;R(ee,!!r),R(te,r?r.trigger===`quota`?`After fresh quota becomes available, when the session is idle`:ge(r.at)+` — not before this time; when quota and idle allow`:``,!0);let i=await va(`prepare`,{session:t.session,...a()?{review:a()}:{},offer:n,...e?{sendId:e.id}:{},...r?{schedule:r}:{},...r&&K(x)?{editId:K(S)}:{},...K(u).kind===`approval`||K(u).kind===`profile`?{choice:K(f)}:{answers:e?[e.text]:[...K(d)]}},M.signal);K(u)?.id!==n||M.signal.aborted||K(A)||o()||K(ce)||(R(p,i.confirmation,!0),R(m,Date.parse(i.expires),!0))}catch(e){M.signal.aborted||R(_,e instanceof Error?e.message:`Unable to prepare action.`,!0)}finally{R(g,!1)}$.data?.noConfirm&&K(p)&&!M.signal.aborted&&await N()}async function N(){if(!K(u)?.id||K(g)||o()||K(ce)||!K(de))return;let e=K(u).id,n=K(u).kind,r=K(p);R(p,``),R(g,!0),R(b,e,!0);try{await va(`commit`,{session:t.session,...a()?{review:a()}:{},offer:e,confirmation:r},M.signal),R(v,!0),R(x,!1),K(ee)&&(R(b,``),await ae()),R(_,K(ee)?`Trigger set. Closing Codexometer cancels it.`:n===`profile`?`Profile decision completed.`:n===`approval`?`Decision sent.`:`Text sent.`,!0)}catch(e){R(_,e instanceof ga?e.message:`Outcome uncertain. Check Codex before taking another action; nothing was retried.`,!0)}finally{R(g,!1),R(w,``),await ae(),R(d,[],!0),R(f,null)}}var ye=Xo(),be=B(ye),Se=e=>{var t=Nr();Xr(B(t),17,()=>K(O).filter(e=>e.status!==`sent`),e=>e.id,(e,t)=>{var n=Vo(),r=z(n),i=V(r,!0),a=H(r,2),s=V(a),c=H(a,2),l=V(c,!0),d=H(c,2),f=V(d,!0),m=H(d,2),h=V(m,!0),v=H(m,2),y=e=>{var t=Ro(),n=V(t,!0);U(()=>X(n,K(_))),Y(e,t)};Z(v,e=>{K(_)&&e(y)});var b=H(v,4),x=H(b,2),S=H(x,2),C=e=>{var n=zo(),r=H(B(n),2),i=H(r,2);U(()=>r.disabled=K(g)||K(A)||!K(t).canSend),q(`click`,r,N),q(`click`,i,()=>{R(p,``),R(w,``)}),Y(e,n)},T=e=>{var n=Bo();U(()=>n.disabled=K(g)||K(A)||!K(t).canSend||o()),q(`click`,n,()=>ve(K(t))),Y(e,n)};Z(S,e=>{K(de)&&K(w)===K(t).id?e(C):e(T,-1)}),P(n),U((e,n)=>{X(i,K(t).status===`uncertain`?`CHECK TRIGGER — outcome uncertain; not retried`:`SCHEDULED FOLLOW-UP`),X(s,`TARGET // ${K(t).session??``}`),X(l,e),X(f,n),X(h,K(t).text),b.disabled=K(g)||!K(u)?.id||K(u).kind!==`prompt`||!!K(u).questions?.length||K(t).status!==`pending`,x.disabled=K(g)||K(t).status===`sending`},[()=>K(t).trigger===`quota`?`After confirmed quota recovery, when idle`:`Not before ${ge(K(t).at)}`,()=>_e(K(t))]),q(`click`,b,()=>ie(K(t))),q(`click`,x,()=>oe(K(t).id)),Y(e,n)}),Y(e,t)},Ce=F(()=>!a()&&K(u)?.kind!==`approval`&&!K(u)?.questions?.length&&![`APPROVAL NEEDED`,`INPUT NEEDED`].includes(K(se)||``));Z(be,e=>{K(Ce)&&e(Se)});var we=H(be,2),Te=e=>{var r=ys(),o=z(r),s=V(o,!0),c=H(o,2),S=e=>{var t=Ho(),n=B(t),r=V(n),i=H(n,6),a=V(i,!0),o=V(H(i,6),!0);xe(2),U(()=>{X(r,`Your ${K(u).profile.threshold??``}% quota threshold has been reached. Review + the profile for subsequent turns.`),X(a,K(u).profile.current),X(o,K(u).profile.proposed)}),Y(e,t)};Z(c,e=>{K(u)?.profile&&!K(A)&&!K(y)&&e(S)});var C=H(c,2),w=e=>{var t=Uo();let n;var r=V(t,!0);U(()=>{n=ci(t,1,`svelte-1oupzfc`,null,n,{notice:!K(v),sent:K(v)}),X(r,K(_))}),Y(e,t)};Z(C,e=>{K(_)&&e(w)});var O=H(C,2),ne=e=>{Lo(e,{get lines(){return K(u).fileChanges}})},ie=e=>{Lo(e,{get lines(){return i()}})},ae=e=>{var t=Wo(),n=B(t),r=V(n,!0),i=V(H(n,2),!0);U(()=>{X(r,K(le)?`EXACT COMMAND`:`LAST OBSERVED COMMAND`),X(i,K(ue))}),Y(e,t)},oe=e=>{Y(e,Go())};Z(O,e=>{K(u)?.fileChanges?.length&&!K(A)&&!K(y)?e(ne):i().length?e(ie,1):K(ue)?e(ae,2):a()!==`profile`&&K(se)===`APPROVAL NEEDED`&&!K(v)&&e(oe,3)});var ce=H(O,2),pe=e=>{Y(e,Ko())},_e=e=>{Y(e,qo())},M=e=>{var t=Xo(),n=B(t),r=e=>{var t=Jo(),n=V(t,!0);U(e=>X(n,e),[()=>K(se)===`WORKING`?`Codex is working — nothing to respond to.`:[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(K(se)||``)?`Respond in Codex for this request.`:`Nothing needs a response right now.`]),Y(e,t)};Z(n,e=>{(K(se)===`WORKING`||!K(v)&&!K(g))&&e(r)});var i=H(n,2),a=e=>{Y(e,Yo())},o=F(()=>[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(K(se)||``)&&!K(v));Z(i,e=>{K(o)&&e(a)}),Y(e,t)},ye=e=>{var r=vs(),i=B(r),o=V(i),s=H(i,2),c=z(s),_=V(c,!0),v=H(c,2),y=e=>{var r=Nr();Xr(B(r),17,()=>K(u).choices||[],Kr,(e,r,i)=>{var o=$o(),s=z(o);xi(s),s.value=s.__value=i;var c=H(s),l=H(c),u=e=>{var t=Zo(),n=V(t,!0);U(()=>X(n,K(r).detail)),Y(e,t)};Z(l,e=>{K(r).detail&&e(u)});var d=H(l,2),p=e=>{Y(e,Qo())};Z(d,e=>{K(r).persistent&&e(p)}),P(o),U(()=>{Q(s,`name`,`decision-`+t.session+`-`+a()),X(c,` ${K(r).label??``} `)}),Oi(n,[],s,()=>K(f),e=>R(f,e)),Y(e,o)}),Y(e,r)},b=e=>{var n=Xo(),r=B(n),i=e=>{var t=os(),n=B(t),r=H(z(n)),i=z(r),a=e=>{var t=es();t.value=t.__value=`now`,Y(e,t)};Z(i,e=>{K(x)||e(a)});var o=H(i);o.value=o.__value=`quota`;var s=H(o);s.value=s.__value=`delay`;var c=H(s);c.value=c.__value=`at`,P(r),mi(r),P(n);var l=H(n,2),u=e=>{var t=ts(),n=H(z(t));xi(n),P(t),Ei(n,()=>K(E),e=>R(E,e)),Y(e,t)};Z(l,e=>{K(T)===`delay`&&e(u)});var d=H(l,2),f=e=>{var t=ns(),n=H(z(t));xi(n),P(t),Ei(n,()=>K(D),e=>R(D,e)),Y(e,t)};Z(d,e=>{K(T)===`at`&&e(f)});var p=H(d,2),m=e=>{var t=is(),n=B(t),r=V(n),i=H(n,2),a=e=>{Y(e,rs())};Z(i,e=>{K(T)!==`quota`&&e(a)});var o=H(i,2);o.textContent=`Timezone: ${Intl.DateTimeFormat().resolvedOptions().timeZone??``}. One pending request per session; saving replaces it. Memory only; Codexometer must stay running. Uses session model, - 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,os())};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=ms(),o=B(i),s=e=>{{let n=F(()=>K(d)[0]||``);Ii(Po(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=cs();xi(t),Ei(t,()=>K(d)[r],e=>K(d)[r]=e),Y(e,t)},h=e=>{var t=us(),i=z(t);i.value=i.__value=``,Xr(H(i),17,()=>K(n).options||[],Kr,(e,t)=>{var n=ls(),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=ds(),i=B(t);tt(i),Ii(i,e=>R(k,e),()=>K(k));var a=H(i,2),o=e=>{var t=Yo(),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=ps(),r=H(z(t),4);Xr(r,21,()=>K(n).options||[],Kr,(e,t)=>{var n=fs(),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=gs(),n=B(t),r=e=>{var t=hs(),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=_s(),n=B(t),r=e=>{var t=zo(),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…`:K(x)?`REVIEW CHANGES`:`REVIEW BEFORE SENDING`)}),q(`click`,i,()=>ve()),Y(e,t)};Z(S,e=>{K(de)?e(C):e(w,-1)});var O=H(S,2),ne=e=>{var t=vs();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 Ss=J(` `,1),Cs=J(`
        `),ws=J(`

        STATUS LINE // CODEXOMETER

        Choose multiple fields and their order. These display preferences do not - change Codex CLI configuration. Missing values are omitted.

        `),Ts=J(`

        `,1);function Es(e,t){Ue(t,!0);let n=Wi(t,`stale`,3,!1),r=L(Yt([])),i=L(!1),a=F(()=>$.data?.statusLineFields||[]),o=e=>[...new Set(e??K(a).filter(e=>e.default).map(e=>e.id))].filter(e=>K(a).some(t=>t.id===e)),s=e=>o(e).map(e=>e===`run-state`&&(n()||!$.connected||$.data?.sessionsError)?`STALE`:t.session.statusLine?.[e]).filter(Boolean).join(` · `),c=F(()=>[...K(r).map(e=>K(a).find(t=>t.id===e)).filter(Boolean),...K(a).filter(e=>!K(r).includes(e.id))]);vn(()=>{oa.open&&!K(i)?(R(r,o(aa.statusLine),!0),R(i,!0)):oa.open||R(i,!1)});function l(e,t){R(r,t?[...K(r),e]:K(r).filter(t=>t!==e),!0)}function u(e,t){let n=K(r).indexOf(e),i=n+t;if(n<0||i<0||i>=K(r).length)return;let a=[...K(r)];[a[n],a[i]]=[a[i],a[n]],R(r,a,!0)}var d=Ts(),f=B(d),p=e=>{var t=ws(),n=H(z(t),4);Xr(n,21,()=>K(c),e=>e.id,(e,t)=>{var n=Cs(),i=z(n),a=z(i);xi(a);var o=H(a,1,!0),s=V(H(o),!0);P(i);var c=H(i,2),d=e=>{var n=Ss(),i=B(n),a=H(i,2);U((e,n)=>{Q(i,`aria-label`,`Move `+K(t).label+` earlier`),i.disabled=e,Q(a,`aria-label`,`Move `+K(t).label+` later`),a.disabled=n},[()=>K(r).indexOf(K(t).id)===0,()=>K(r).indexOf(K(t).id)===K(r).length-1]),q(`click`,i,()=>u(K(t).id,-1)),q(`click`,a,()=>u(K(t).id,1)),Y(e,n)},f=F(()=>K(r).includes(K(t).id));Z(c,e=>{K(f)&&e(d)}),P(n),U(e=>{Q(i,`title`,K(t).help),Si(a,e),X(o,K(t).label),X(s,K(t).help)},[()=>K(r).includes(K(t).id)]),q(`change`,a,e=>l(K(t).id,e.currentTarget.checked)),Y(e,n)}),P(n);var i=H(n,2),a=V(i),o=H(i,2),d=H(o,2);P(t),U(e=>X(a,`Preview // ${e??``}`),[()=>s(K(r))||`—`]),q(`click`,o,()=>{aa.statusLine=[...K(r)],ca(),oa.open=!1}),q(`click`,d,()=>{oa.open=!1}),Y(e,t)};Z(f,e=>{oa.open&&e(p)});var m=H(f,2),h=z(m),g=V(h,!0),_=H(h,2);P(m),U((e,t)=>{Q(h,`title`,e),X(g,t)},[()=>s(aa.statusLine),()=>s(aa.statusLine)]),q(`click`,_,()=>{oa.open=!oa.open}),Y(e,d),We()}Sr([`change`,`click`]);var Ds=J(`
        `);function Os(e,t){Ue(t,!0);let n=Wi(t,`active`,3,!1),r=F(()=>ao(t.session)),i=F(()=>!!K(r)),a=L(!1),o=L(``),s=L(!1);vn(()=>{if(!K(s))return;let e=setTimeout(()=>{R(s,!1)},150);return()=>clearTimeout(e)}),vn(()=>{K(r),t.session.status,R(o,``)});async function c(){if(!K(i)||K(a))return;let e=K(r);R(a,!0),R(s,!0),R(o,``);try{await navigator.clipboard.writeText(e),K(r)===e&&R(o,`Copied.`)}catch{K(r)===e&&R(o,`Clipboard unavailable. Select the visible text and copy it manually.`)}finally{R(a,!1)}}function l(e){!n()||!K(i)||e.defaultPrevented||e.repeat||e.ctrlKey||e.metaKey||e.altKey||e.key.toLowerCase()!==`c`||e.target instanceof Element&&e.target.closest(`input, textarea, select, [contenteditable]`)||(e.preventDefault(),c())}var u={copy:c},d=Nr();xr(`keydown`,Qt,l);var f=B(d),p=e=>{var t=Ds(),n=z(t),r=V(n,!0),i=H(n,2);let l;P(t),U(()=>{X(r,K(o)),i.disabled=K(a),l=ci(i,1,`svelte-543j00`,null,l,{flashed:K(s)})}),q(`click`,i,c),Y(e,t)};return Z(f,e=>{K(i)&&e(p)}),Y(e,d),We(u)}Sr([`click`]);var ks=J(`

         
        `,1),As=J(`

        LATEST GUIDANCE

         
        `,1),js=J(`

        CONTEXT

         

        `,1),Ms=J(`

        `),Ns=J(`

        `),Ps=J(`
         
        `),Fs=J(`

         
        `,1),Is=J(`
         
        `),Ls=J(`

        Command unavailable from this observation. Open Codex to inspect the - request.

        `),Rs=J(`

        `,1),zs=J(`

        `),Bs=J(` `,1),Vs=J(`
        `),Hs=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(`

        `),Cs=J(`

        STATUS LINE // CODEXOMETER

        Choose multiple fields and their order. These display preferences do not + change Codex CLI configuration. Missing values are omitted.

        `),ws=J(`

        `,1);function Ts(e,t){Ue(t,!0);let n=Wi(t,`stale`,3,!1),r=L(Yt([])),i=L(!1),a=F(()=>$.data?.statusLineFields||[]),o=e=>[...new Set(e??K(a).filter(e=>e.default).map(e=>e.id))].filter(e=>K(a).some(t=>t.id===e)),s=e=>o(e).map(e=>e===`run-state`&&(n()||!$.connected||$.data?.sessionsError)?`STALE`:t.session.statusLine?.[e]).filter(Boolean).join(` · `),c=F(()=>[...K(r).map(e=>K(a).find(t=>t.id===e)).filter(Boolean),...K(a).filter(e=>!K(r).includes(e.id))]);vn(()=>{oa.open&&!K(i)?(R(r,o(aa.statusLine),!0),R(i,!0)):oa.open||R(i,!1)});function l(e,t){R(r,t?[...K(r),e]:K(r).filter(t=>t!==e),!0)}function u(e,t){let n=K(r).indexOf(e),i=n+t;if(n<0||i<0||i>=K(r).length)return;let a=[...K(r)];[a[n],a[i]]=[a[i],a[n]],R(r,a,!0)}var d=ws(),f=B(d),p=e=>{var t=Cs(),n=H(z(t),4);Xr(n,21,()=>K(c),e=>e.id,(e,t)=>{var n=Ss(),i=z(n),a=z(i);xi(a);var o=H(a,1,!0),s=V(H(o),!0);P(i);var c=H(i,2),d=e=>{var n=xs(),i=B(n),a=H(i,2);U((e,n)=>{Q(i,`aria-label`,`Move `+K(t).label+` earlier`),i.disabled=e,Q(a,`aria-label`,`Move `+K(t).label+` later`),a.disabled=n},[()=>K(r).indexOf(K(t).id)===0,()=>K(r).indexOf(K(t).id)===K(r).length-1]),q(`click`,i,()=>u(K(t).id,-1)),q(`click`,a,()=>u(K(t).id,1)),Y(e,n)},f=F(()=>K(r).includes(K(t).id));Z(c,e=>{K(f)&&e(d)}),P(n),U(e=>{Q(i,`title`,K(t).help),Si(a,e),X(o,K(t).label),X(s,K(t).help)},[()=>K(r).includes(K(t).id)]),q(`change`,a,e=>l(K(t).id,e.currentTarget.checked)),Y(e,n)}),P(n);var i=H(n,2),a=V(i),o=H(i,2),d=H(o,2);P(t),U(e=>X(a,`Preview // ${e??``}`),[()=>s(K(r))||`—`]),q(`click`,o,()=>{aa.statusLine=[...K(r)],ca(),oa.open=!1}),q(`click`,d,()=>{oa.open=!1}),Y(e,t)};Z(f,e=>{oa.open&&e(p)});var m=H(f,2),h=z(m),g=V(h,!0),_=H(h,2);P(m),U((e,t)=>{Q(h,`title`,e),X(g,t)},[()=>s(aa.statusLine),()=>s(aa.statusLine)]),q(`click`,_,()=>{oa.open=!oa.open}),Y(e,d),We()}Sr([`change`,`click`]);var Es=J(`
        `);function Ds(e,t){Ue(t,!0);let n=Wi(t,`active`,3,!1),r=F(()=>ao(t.session)),i=F(()=>!!K(r)),a=L(!1),o=L(``),s=L(!1);vn(()=>{if(!K(s))return;let e=setTimeout(()=>{R(s,!1)},150);return()=>clearTimeout(e)}),vn(()=>{K(r),t.session.status,R(o,``)});async function c(){if(!K(i)||K(a))return;let e=K(r);R(a,!0),R(s,!0),R(o,``);try{await navigator.clipboard.writeText(e),K(r)===e&&R(o,`Copied.`)}catch{K(r)===e&&R(o,`Clipboard unavailable. Select the visible text and copy it manually.`)}finally{R(a,!1)}}function l(e){!n()||!K(i)||e.defaultPrevented||e.repeat||e.ctrlKey||e.metaKey||e.altKey||e.key.toLowerCase()!==`c`||e.target instanceof Element&&e.target.closest(`input, textarea, select, [contenteditable]`)||(e.preventDefault(),c())}var u={copy:c},d=Nr();xr(`keydown`,Qt,l);var f=B(d),p=e=>{var t=Es(),n=z(t),r=V(n,!0),i=H(n,2);let l;P(t),U(()=>{X(r,K(o)),i.disabled=K(a),l=ci(i,1,`svelte-543j00`,null,l,{flashed:K(s)})}),q(`click`,i,c),Y(e,t)};return Z(f,e=>{K(i)&&e(p)}),Y(e,d),We(u)}Sr([`click`]);var Os=J(`

         
        `,1),ks=J(`

        LATEST GUIDANCE

         
        `,1),As=J(`

        CONTEXT

         

        `,1),js=J(`

        `),Ms=J(`

        `),Ns=J(`
         
        `),Ps=J(`

         
        `,1),Fs=J(`
         
        `),Is=J(`

        Command unavailable from this observation. Open Codex to inspect the + request.

        `),Ls=J(`

        `,1),Rs=J(`

        `),zs=J(` `,1),Bs=J(`
        `),Vs=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.

        `),Ys=J(`

        `),Xs=J(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),Zs=J(`
        `),Qs=J(`
        `),$s=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(`

        `),cc=J(`

        TOKEN ACTIVITY // 30 SECOND SAMPLES

        `),lc=J(`

        TOKENS

        FULL DETAIL →
        `),uc=J(`

        No locally observed sessions yet. Keep Codex running alongside - Codexometer.

        `),dc=J(`

        ↑ ↓ SELECT SESSION // ← LESS DETAIL // → MORE DETAIL // ESC BACK

        `,1),fc=J(`

        SESSION TOTALS

        `,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.

        `),Js=J(`

        `),Ys=J(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),Xs=J(`
        `),Zs=J(`
        `),Qs=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(`

        `),sc=J(`

        TOKEN ACTIVITY // 30 SECOND SAMPLES

        `),cc=J(`

        TOKENS

        FULL DETAIL →
        `),lc=J(`

        No locally observed sessions yet. Keep Codex running alongside + Codexometer.

        `),uc=J(`

        ↑ ↓ SELECT SESSION // ← LESS DETAIL // → MORE DETAIL // ESC BACK

        `,1),dc=J(`

        SESSION TOTALS

        `,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(`
        `),Sc=J(`
        `),Cc=J(`

        No usage reported for this day.

        `),wc=J(`

        Selected breakdown unavailable; missing does not mean zero.

        `),Tc=J(`

        `,1);function Ec(e,t){Ue(t,!0);let n=L(`surface`),r=L(0),i=F(()=>t.reports?.daily),a=F(()=>t.reports?.plan),o=F(()=>t.mode===`breakdown`?K(i)?.days.length||0:K(a)?.periods.length||0),s=F(()=>Math.min(K(r),Math.max(0,K(o)-1))),c=F(()=>K(i)?.days[(K(i)?.days.length||0)-1-K(s)]),l=F(()=>K(a)?.periods[K(s)]),u=F(()=>t.mode===`breakdown`?K(i)?.units||``:`%`),d=F(()=>{let e=Object.create(null);if(t.mode===`breakdown`)e=K(c)?.groups[K(n)]||{};else{let t=K(n)===`feature`?`thread_source`:K(n)===`task start`?`turn_trigger`:K(n);for(let n of K(l)?.breakdowns||[])if(n.dimension===t)for(let t of n.rows)e[t.key]=(e[t.key]||0)+t.basis_points/100}return Object.entries(e).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0]))}),f=F(()=>t.mode===`breakdown`?K(c)?.total:K(l)?.used_basis_points==null?null:K(l).used_basis_points/100),p=F(()=>Math.max(1,K(f)||0,...K(d).map(([,e])=>e))),m=e=>e==null?`UNKNOWN`:e.toLocaleString(`en-GB`,{maximumFractionDigits:2});var h=Tc(),g=B(h),v=z(g),y=H(z(v)),b=z(y);b.value=b.__value=`surface`;var x=H(b);x.value=x.__value=`model`;var S=H(x);S.value=S.__value=`feature`;var C=H(S);C.value=C.__value=`task start`,P(y),mi(y),P(v);var w=H(v,2),T=H(w,2),E=V(H(T,2),!0);P(g);var D=H(g,2),ee=z(D),te=V(ee,!0),O=H(ee,2),ne=V(O),k=H(O,2),re=e=>{var t=hc(),n=B(t),r=V(n),a=H(n,2),o=e=>{var t=mc(),n=V(t);U(()=>X(n,`Data as of ${K(i).dataAsOf??``}`)),Y(e,t)};Z(a,e=>{K(i).dataAsOf&&e(o)});var s=V(H(a,2));xe(2),U((e,t)=>{X(r,`Latest fetch ${e??``} // queried ${K(i).from??``} → ${K(i).through??``}. + list. History samples every 30 seconds. Not account-wide totals.`)},[()=>ma($.data?.sessionsAt)]),Y(e,te),We()}Sr([`click`]);var pc=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(`
        `),xc=J(`
        `),Sc=J(`

        No usage reported for this day.

        `),Cc=J(`

        Selected breakdown unavailable; missing does not mean zero.

        `),wc=J(`

        `,1);function Tc(e,t){Ue(t,!0);let n=L(`surface`),r=L(0),i=F(()=>t.reports?.daily),a=F(()=>t.reports?.plan),o=F(()=>t.mode===`breakdown`?K(i)?.days.length||0:K(a)?.periods.length||0),s=F(()=>Math.min(K(r),Math.max(0,K(o)-1))),c=F(()=>K(i)?.days[(K(i)?.days.length||0)-1-K(s)]),l=F(()=>K(a)?.periods[K(s)]),u=F(()=>t.mode===`breakdown`?K(i)?.units||``:`%`),d=F(()=>{let e=Object.create(null);if(t.mode===`breakdown`)e=K(c)?.groups[K(n)]||{};else{let t=K(n)===`feature`?`thread_source`:K(n)===`task start`?`turn_trigger`:K(n);for(let n of K(l)?.breakdowns||[])if(n.dimension===t)for(let t of n.rows)e[t.key]=(e[t.key]||0)+t.basis_points/100}return Object.entries(e).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0]))}),f=F(()=>t.mode===`breakdown`?K(c)?.total:K(l)?.used_basis_points==null?null:K(l).used_basis_points/100),p=F(()=>Math.max(1,K(f)||0,...K(d).map(([,e])=>e))),m=e=>e==null?`UNKNOWN`:e.toLocaleString(`en-GB`,{maximumFractionDigits:2});var h=wc(),g=B(h),v=z(g),y=H(z(v)),b=z(y);b.value=b.__value=`surface`;var x=H(b);x.value=x.__value=`model`;var S=H(x);S.value=S.__value=`feature`;var C=H(S);C.value=C.__value=`task start`,P(y),mi(y),P(v);var w=H(v,2),T=H(w,2),E=V(H(T,2),!0);P(g);var D=H(g,2),ee=z(D),te=V(ee,!0),O=H(ee,2),ne=V(O),k=H(O,2),re=e=>{var t=mc(),n=B(t),r=V(n),a=H(n,2),o=e=>{var t=pc(),n=V(t);U(()=>X(n,`Data as of ${K(i).dataAsOf??``}`)),Y(e,t)};Z(a,e=>{K(i).dataAsOf&&e(o)});var s=V(H(a,2));xe(2),U((e,t)=>{X(r,`Latest fetch ${e??``} // queried ${K(i).from??``} → ${K(i).through??``}. Reports are fetched from OpenAI and are not saved between runs.`),X(s,`${(K(c)?.date||`No daily buckets reported`)??``} // ${t??``} - ${K(u)??``}`)},[()=>ma(K(i).fetchedAt),()=>m(K(f))]),Y(e,t)},ie=e=>{var t=yc(),n=B(t),r=z(n);let i;var o=V(r,!0),s=H(r),c=e=>{Y(e,gc())};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=vc(),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,_c())};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,bc())};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=Sc(),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=xc();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,Cc())},ce=e=>{Y(e,wc())};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 Dc=864e5;function Oc(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 kc(e,t,n){let r=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));for(let e=0;;e++){let i=Oc(r,-t),a=new Date(i.getTime()+Dc);if(e===n)return{start:a,end:r};r=i}}var Ac=J(``),jc=J(``,1),Mc=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(`
        `,1),Rc=J(` `),zc=J(`

        LIFETIME TOKENS

        PEAK DAY

        CURRENT STREAK

        DAYS

        LONGEST TURN

        SECONDS

        LONGEST STREAK

        DAYS

        OPENAI // UTC

        Accessible data table
        Date (UTC)Tokens

        `,1),Bc=J(`

        History unavailable or awaiting a matching account observation. Missing - history is not treated as zero usage.

        `),Vc=J(`

        USAGE // ACCOUNT HISTORY

        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(`
        `,1),Lc=J(` `),Rc=J(`

        LIFETIME TOKENS

        PEAK DAY

        CURRENT STREAK

        DAYS

        LONGEST TURN

        SECONDS

        LONGEST STREAK

        DAYS

        OPENAI // UTC

        Accessible data table
        Date (UTC)Tokens

        `,1),zc=J(`

        History unavailable or awaiting a matching account observation. Missing + history is not treated as zero usage.

        `),Bc=J(`

        USAGE // ACCOUNT HISTORY

        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(`

        Page not found

        Return to Quota

        `,1);function Wc(e){var t=Uc();xe(2),Y(e,t)}var Gc=`CODEXOMETER`,Kc=[`█▀▀ █▀█ █▀▄ █▀▀ ▀▄▀ █▀█ █▀▄▀█ █▀▀ ▀█▀ █▀▀ █▀█`,`█▄▄ █▄█ █▄▀ ██▄ █ █ █▄█ █ ▀ █ ██▄ █ ██▄ █▀▄`].flatMap(e=>[[...e].map(e=>e===`█`||e===`▀`),[...e].map(e=>e===`█`||e===`▄`)]),qc=Kc[0].length,Jc=Kc.length,Yc=0,Xc=[...Gc].map(e=>{let t=e===`M`?5:3,n={start:Yc,width:t};return Yc+=t+1,n}),Zc=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`,Qc=`010 101 111 101.110 111 101 110.111 100 100 111.110 101 101 110.111 100 110 111.111 100 110 100.111 100 101 111.101 101 111 101.111 010 010 111.001 001 101 111.101 110 110 101.100 100 100 111.101 111 101 101.101 111 111 101.111 101 101 111.111 101 111 100.111 101 111 001.111 101 110 101.111 100 001 111.111 010 010 010.101 101 101 111.101 101 101 010.101 101 111 101.101 010 010 101.101 101 010 010.111 001 100 111.111 101 101 111.110 010 010 111.111 001 110 111.111 011 001 111.101 101 111 001.111 110 001 111.100 111 101 111.111 001 010 010.111 111 101 111.111 101 111 001`.split(`.`).map(e=>e.split(` `));function $c(e=Gc,t=-1,n=!1){let r=``;for(let i=0;i{e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296}}function rl(){let e=el[Math.floor(Math.random()*el.length)],t=Math.floor(Math.random()*4294967296),n=nl(t),r=[...Gc].map((e,t)=>t);for(let e=r.length-1;e>0;e--){let t=Math.floor(n()*(e+1));[r[e],r[t]]=[r[t],r[e]]}return{variant:e,seed:t,order:r}}function il(e,t){if(e.variant===`typing`){let e=t<1080,n=e?0:Math.min(Math.floor((t-1080)/90)+1,11);return{text:Gc.slice(0,n).padEnd(11),cursor:n,dot:e?Math.floor(t/180)%2==0:n<11}}if(e.variant===`shuffle`){let n=nl(e.seed^Math.floor(t/70)),r=[...Gc].map(e=>{let t;do t=Zc[Math.floor(n()*36)];while(t===e);return t}),i=Math.min(Math.floor(t/110),11);for(let t of e.order.slice(0,i))r[t]=Gc[t];return{text:r.join(``),cursor:-1,dot:!1}}return{text:Gc,cursor:-1,dot:!1}}var al=jr(``);function ol(e,t){Ue(t,!0);let n=Wi(t,`text`,3,Gc),r=Wi(t,`cursor`,19,()=>-1),i=Wi(t,`dot`,3,!1),a=F(()=>$c(n(),r(),i()));var o=al(),s=V(o);U(()=>{Q(o,`viewBox`,`0 0 ${qc} ${Jc}`),Q(o,`width`,qc),Q(o,`height`,Jc),Q(s,`d`,K(a))}),Y(e,o),We()}var sl=J(`
        `),cl=J(`
        `);function ll(e,t){Ue(t,!0);let n=L(void 0),r=L(0),i=L(Yt({width:0,height:0,pixelRatio:1})),a=L(Yt({x:0,y:0,width:0})),o=F(()=>K(n)?il(K(n),K(r)):void 0),s=F(()=>{if(!K(n))return{x:0,y:0,width:0};let e=tl[K(n).variant],t=Math.min(Math.max((K(r)-e-180)/800,0),1),o=t*t*(3-2*t),s=K(i).width+(K(a).width-K(i).width)*o,c=Math.max((K(i).height-K(i).width*Jc/qc)/2,0),l=(K(n).variant===`slide`&&K(r)Math.round(e*K(i).pixelRatio)/K(i).pixelRatio;return{x:d(l),y:d(u),width:d(s)}});Gi(()=>{let e=matchMedia(`(prefers-reduced-motion: reduce)`);if(e.matches){t.onfinish();return}R(n,rl(),!0);let o=tl[K(n).variant]+180+800,s=0,c=!1,l=performance.now(),u=()=>{let e=t.target?.getBoundingClientRect();R(i,{width:window.innerWidth,height:window.innerHeight,pixelRatio:window.devicePixelRatio||1},!0),e&&R(a,{x:e.x,y:e.y,width:e.width},!0)},d=()=>{c||(c=!0,cancelAnimationFrame(s),t.onfinish())},f=e=>{e instanceof PointerEvent&&e.button!==0||e instanceof KeyboardEvent&&(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)||e instanceof KeyboardEvent&&[`Shift`,`Control`,`Alt`,`Meta`].includes(e.key)||(e.preventDefault(),e.stopImmediatePropagation(),d())},p=()=>{e.matches&&d()},m=e=>{R(r,Math.max(e-l,0),!0),K(r)>=o?d():s=requestAnimationFrame(m)},h=new ResizeObserver(u);if(t.target){h.observe(t.target),t.target.parentElement&&h.observe(t.target.parentElement);let e=t.target.closest(`header`);e&&h.observe(e)}return u(),window.addEventListener(`resize`,u),document.addEventListener(`keydown`,f,!0),document.addEventListener(`pointerdown`,f,!0),e.addEventListener(`change`,p),s=requestAnimationFrame(m),()=>{c=!0,cancelAnimationFrame(s),h.disconnect(),window.removeEventListener(`resize`,u),document.removeEventListener(`keydown`,f,!0),document.removeEventListener(`pointerdown`,f,!0),e.removeEventListener(`change`,p)}});var c=cl(),l=z(c),u=e=>{var t=sl();let n;ol(z(t),{get text(){return K(o).text},get cursor(){return K(o).cursor},get dot(){return K(o).dot}}),P(t),U(()=>{Q(t,`data-text`,K(o).text),Q(t,`data-cursor`,K(o).dot?K(o).cursor:void 0),n=ui(t,``,n,{left:`${K(s).x}px`,top:`${K(s).y}px`,width:`${K(s).width}px`})}),Y(e,t)};Z(l,e=>{K(o)&&e(u)});var d=H(l,2);P(c),U(()=>Q(c,`data-entrance`,K(n)?.variant)),q(`click`,d,function(...e){t.onfinish?.apply(this,e)}),Y(e,c),We()}Sr([`click`]);var ul=J(` `),dl=J(`

        `),fl=J(`

        Connecting to your local Codexometer…

        `),pl=J(``),ml=J(`

        Your quota. Your sessions. Your command centre.

        `);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(`

        Page not found

        Return to Quota

        `,1);function Uc(e){var t=Hc();xe(2),Y(e,t)}var Wc=`CODEXOMETER`,Gc=[`█▀▀ █▀█ █▀▄ █▀▀ ▀▄▀ █▀█ █▀▄▀█ █▀▀ ▀█▀ █▀▀ █▀█`,`█▄▄ █▄█ █▄▀ ██▄ █ █ █▄█ █ ▀ █ ██▄ █ ██▄ █▀▄`].flatMap(e=>[[...e].map(e=>e===`█`||e===`▀`),[...e].map(e=>e===`█`||e===`▄`)]),Kc=Gc[0].length,qc=Gc.length,Jc=0,Yc=[...Wc].map(e=>{let t=e===`M`?5:3,n={start:Jc,width:t};return Jc+=t+1,n}),Xc=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`,Zc=`010 101 111 101.110 111 101 110.111 100 100 111.110 101 101 110.111 100 110 111.111 100 110 100.111 100 101 111.101 101 111 101.111 010 010 111.001 001 101 111.101 110 110 101.100 100 100 111.101 111 101 101.101 111 111 101.111 101 101 111.111 101 111 100.111 101 111 001.111 101 110 101.111 100 001 111.111 010 010 010.101 101 101 111.101 101 101 010.101 101 111 101.101 010 010 101.101 101 010 010.111 001 100 111.111 101 101 111.110 010 010 111.111 001 110 111.111 011 001 111.101 101 111 001.111 110 001 111.100 111 101 111.111 001 010 010.111 111 101 111.111 101 111 001`.split(`.`).map(e=>e.split(` `));function Qc(e=Wc,t=-1,n=!1){let r=``;for(let i=0;i{e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296}}function nl(){let e=$c[Math.floor(Math.random()*$c.length)],t=Math.floor(Math.random()*4294967296),n=tl(t),r=[...Wc].map((e,t)=>t);for(let e=r.length-1;e>0;e--){let t=Math.floor(n()*(e+1));[r[e],r[t]]=[r[t],r[e]]}return{variant:e,seed:t,order:r}}function rl(e,t){if(e.variant===`typing`){let e=t<1080,n=e?0:Math.min(Math.floor((t-1080)/90)+1,11);return{text:Wc.slice(0,n).padEnd(11),cursor:n,dot:e?Math.floor(t/180)%2==0:n<11}}if(e.variant===`shuffle`){let n=tl(e.seed^Math.floor(t/70)),r=[...Wc].map(e=>{let t;do t=Xc[Math.floor(n()*36)];while(t===e);return t}),i=Math.min(Math.floor(t/110),11);for(let t of e.order.slice(0,i))r[t]=Wc[t];return{text:r.join(``),cursor:-1,dot:!1}}return{text:Wc,cursor:-1,dot:!1}}var il=jr(``);function al(e,t){Ue(t,!0);let n=Wi(t,`text`,3,Wc),r=Wi(t,`cursor`,19,()=>-1),i=Wi(t,`dot`,3,!1),a=F(()=>Qc(n(),r(),i()));var o=il(),s=V(o);U(()=>{Q(o,`viewBox`,`0 0 ${Kc} ${qc}`),Q(o,`width`,Kc),Q(o,`height`,qc),Q(s,`d`,K(a))}),Y(e,o),We()}var ol=J(`
        `),sl=J(`
        `);function cl(e,t){Ue(t,!0);let n=L(void 0),r=L(0),i=L(Yt({width:0,height:0,pixelRatio:1})),a=L(Yt({x:0,y:0,width:0})),o=F(()=>K(n)?rl(K(n),K(r)):void 0),s=F(()=>{if(!K(n))return{x:0,y:0,width:0};let e=el[K(n).variant],t=Math.min(Math.max((K(r)-e-180)/800,0),1),o=t*t*(3-2*t),s=K(i).width+(K(a).width-K(i).width)*o,c=Math.max((K(i).height-K(i).width*qc/Kc)/2,0),l=(K(n).variant===`slide`&&K(r)Math.round(e*K(i).pixelRatio)/K(i).pixelRatio;return{x:d(l),y:d(u),width:d(s)}});Gi(()=>{let e=matchMedia(`(prefers-reduced-motion: reduce)`);if(e.matches){t.onfinish();return}R(n,nl(),!0);let o=el[K(n).variant]+180+800,s=0,c=!1,l=performance.now(),u=()=>{let e=t.target?.getBoundingClientRect();R(i,{width:window.innerWidth,height:window.innerHeight,pixelRatio:window.devicePixelRatio||1},!0),e&&R(a,{x:e.x,y:e.y,width:e.width},!0)},d=()=>{c||(c=!0,cancelAnimationFrame(s),t.onfinish())},f=e=>{e instanceof PointerEvent&&e.button!==0||e instanceof KeyboardEvent&&(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)||e instanceof KeyboardEvent&&[`Shift`,`Control`,`Alt`,`Meta`].includes(e.key)||(e.preventDefault(),e.stopImmediatePropagation(),d())},p=()=>{e.matches&&d()},m=e=>{R(r,Math.max(e-l,0),!0),K(r)>=o?d():s=requestAnimationFrame(m)},h=new ResizeObserver(u);if(t.target){h.observe(t.target),t.target.parentElement&&h.observe(t.target.parentElement);let e=t.target.closest(`header`);e&&h.observe(e)}return u(),window.addEventListener(`resize`,u),document.addEventListener(`keydown`,f,!0),document.addEventListener(`pointerdown`,f,!0),e.addEventListener(`change`,p),s=requestAnimationFrame(m),()=>{c=!0,cancelAnimationFrame(s),h.disconnect(),window.removeEventListener(`resize`,u),document.removeEventListener(`keydown`,f,!0),document.removeEventListener(`pointerdown`,f,!0),e.removeEventListener(`change`,p)}});var c=sl(),l=z(c),u=e=>{var t=ol();let n;al(z(t),{get text(){return K(o).text},get cursor(){return K(o).cursor},get dot(){return K(o).dot}}),P(t),U(()=>{Q(t,`data-text`,K(o).text),Q(t,`data-cursor`,K(o).dot?K(o).cursor:void 0),n=ui(t,``,n,{left:`${K(s).x}px`,top:`${K(s).y}px`,width:`${K(s).width}px`})}),Y(e,t)};Z(l,e=>{K(o)&&e(u)});var d=H(l,2);P(c),U(()=>Q(c,`data-entrance`,K(n)?.variant)),q(`click`,d,function(...e){t.onfinish?.apply(this,e)}),Y(e,c),We()}Sr([`click`]);var ll=J(` `),ul=J(`

        `),dl=J(`

        Connecting to your local Codexometer…

        `),fl=J(``),pl=J(`

        Your quota. Your sessions. Your command centre.

        `);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 @@ Codexometer // Experimental web - + diff --git a/internal/web/server.go b/internal/web/server.go index d8da5866..105276c8 100644 --- a/internal/web/server.go +++ b/internal/web/server.go @@ -42,8 +42,12 @@ type server struct { control *control } +type Options struct { + NoConfirm bool +} + // Run binds IPv4 loopback only. Control must be explicitly enabled at launch. -func Run(ctx context.Context, source Source, refresh time.Duration, port int, output io.Writer, writable bool) error { +func Run(ctx context.Context, source Source, refresh time.Duration, port int, output io.Writer, writable bool, options ...Options) error { if port < 0 || port > 65535 { return fmt.Errorf("web port must be between 0 and 65535") } @@ -60,8 +64,14 @@ func Run(ctx context.Context, source Source, refresh time.Duration, port int, ou if writable { s.control = newControl(source, s.store) s.store.state.Control = true + if len(options) > 0 { + s.store.state.NoConfirm = options[0].NoConfirm + } s.store.publish() mode = "SESSION CONTROL ENABLED — prompts, decisions and configured quota profiles enabled" + if s.store.state.NoConfirm { + mode += " // EXTRA CONFIRMATIONS OFF" + } } ctx, cancel := context.WithCancel(ctx) defer cancel() diff --git a/internal/web/state.go b/internal/web/state.go index 1bf5af42..f4ae79f1 100644 --- a/internal/web/state.go +++ b/internal/web/state.go @@ -115,6 +115,7 @@ type state struct { Thresholds []quotaThreshold `json:"thresholds,omitempty"` ProfileError bool `json:"profileError,omitempty"` Control bool `json:"control"` + NoConfirm bool `json:"noConfirm,omitempty"` Version string `json:"version"` Meters []meter `json:"meters"` Credits []credit `json:"credits"` diff --git a/intro-post.md b/intro-post.md index 7c6ad099..21568db1 100644 --- a/intro-post.md +++ b/intro-post.md @@ -95,7 +95,9 @@ Subtle animated dots in inline and full-screen detail indicate observed work, di On a shared-server session ready for input, the selected full-width detail row also offers a follow-up composer when there is room for the complete context. Click or press Enter to write, Enter to send, and Escape to leave the editor. Smaller panels and structured questions keep full-screen detail as the fallback. -**Live command menus:** type `/` in the composer for a vertical popup with help that shrinks as you type: Up/Down selects, Tab completes, Enter opens options and Escape dismisses. Terminal and writable web mode discover model/reasoning options, advertised speed tiers, collaboration modes and allowed permission profiles. Changes require confirmation and a loaded shared-server session. Speed changes can be sent immediately during a turn for subsequent turns; other settings require idle. Skills, apps, MCP tools, hooks and experimental flags have browse-only catalogues; this is not every Codex CLI slash command. Unsupported catalogues stay hidden, and slash text is never silently sent as a prompt (`//` escapes a literal leading slash). +**Live command menus:** type `/` in the composer for a vertical popup with help that shrinks as you type: Up/Down highlights, Tab completes, Enter opens options or applies a choice, and Escape dismisses. Terminal and writable web mode discover model/reasoning options, advertised speed tiers, collaboration modes and allowed permission profiles. Reversible session changes—name, model/reasoning, speed and Plan mode—apply on explicit selection without an extra confirmation. Permission and directory changes remain guarded by default. A loaded shared-server session is required. Speed changes can be sent immediately during a turn for subsequent turns; other settings require idle. Skills, apps, MCP tools, hooks and experimental flags have browse-only catalogues; this is not every Codex CLI slash command. Unsupported catalogues stay hidden, and slash text is never silently sent as a prompt (`//` escapes a literal leading slash). + +Prefer fewer extra clicks? Launch with `--no-confirm` (plus `--web --web-control` for browser actions) to make Codexometer's other guarded actions single-step too. **Quota-reset redemption always keeps its confirmation.** This launch-only option never auto-selects an approval or bypasses Codex's sandbox, permissions, live capabilities or replay checks. It can make accidental clicks consequential—including permission grants and paid benchmark launches—so leave it off unless you want that trade-off. Confirmation instructions elsewhere in this post describe the default guarded mode. **Your own status line:** full session detail has a configurable footer for model/reasoning, speed, tokens and directory. `/statusline` offers checkboxes, ordering and a live preview; choose multiple fields or hide it entirely. The settings belong to Codexometer and persist as display preferences. Web's footer configuration also works in read-only mode. diff --git a/main.go b/main.go index 60484bdc..b818b8f2 100644 --- a/main.go +++ b/main.go @@ -356,8 +356,8 @@ type dependencies struct { checkAuth func(context.Context, string) (codex.Snapshot, error) listDigBenchGames func(context.Context, string) ([]string, error) runDigBench func(context.Context, string, string, string, codex.DigBenchOptions) (codex.DigBenchResult, error) - startUI func(ui.Fetcher, time.Duration, bool, int, int) error - startWeb func(web.Source, time.Duration, int, io.Writer, bool) error + startUI func(ui.Fetcher, time.Duration, bool, int, int, bool) error + startWeb func(web.Source, time.Duration, int, io.Writer, bool, bool) error } func defaultDependencies() dependencies { @@ -373,10 +373,10 @@ func defaultDependencies() dependencies { return (codex.Client{Binary: binary, BenchmarkAPIKey: apiKey}).RunDigBench(ctx, digbench.Client{Token: token}, options) }, startUI: startUI, - startWeb: func(source web.Source, refresh time.Duration, port int, output io.Writer, control bool) error { + startWeb: func(source web.Source, refresh time.Duration, port int, output io.Writer, control, noConfirm bool) error { ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt) defer cancel() - return web.Run(ctx, source, refresh, port, output, control) + return web.Run(ctx, source, refresh, port, output, control, web.Options{NoConfirm: noConfirm}) }, } } @@ -389,6 +389,7 @@ func run(args []string, stdout, stderr io.Writer, deps dependencies) int { codexPath = flags.String("codex", "codex", "path to the Codex CLI") errorLog = flags.String("error-log", "", "write bounded operational diagnostics to this file (off by default)") verbose = flags.Bool("verbose", false, "include diagnostic context in --error-log (never raw payloads)") + noConfirm = flags.Bool("no-confirm", false, "skip Codexometer confirmation steps except quota resets (does not bypass Codex permissions)") refresh = flags.Duration("refresh", time.Minute, "quota refresh interval") demo = flags.Bool("demo", false, "show the UI with simulated quota data") inline = flags.Bool("inline", false, "render inline instead of using the alternate screen") @@ -528,7 +529,7 @@ func run(args []string, stdout, stderr io.Writer, deps dependencies) int { if *demo { source = &demoFetcher{quotaSteps: quotaSteps} } - if err := deps.startWeb(source, *refresh, *webPort, stdout, *webControl); err != nil { + if err := deps.startWeb(source, *refresh, *webPort, stdout, *webControl, *noConfirm); err != nil { diagnostics.Error("application", "web interface", err, diagnostics.Fields{}) fmt.Fprintln(stderr, "codexometer:", err) return 1 @@ -558,7 +559,7 @@ func run(args []string, stdout, stderr io.Writer, deps dependencies) int { fetcher = &demoFetcher{quotaSteps: quotaSteps} } - if err := deps.startUI(fetcher, *refresh, *inline, *resetThreshold, *resetWarningHours); err != nil { + if err := deps.startUI(fetcher, *refresh, *inline, *resetThreshold, *resetWarningHours, *noConfirm); err != nil { diagnostics.Error("application", "terminal interface", err, diagnostics.Fields{}) fmt.Fprintln(stderr, "codexometer:", err) return 1 @@ -675,7 +676,7 @@ func formatDigBenchResult(result codex.DigBenchResult) string { return line } -func startUI(fetcher ui.Fetcher, refresh time.Duration, inline bool, resetThreshold, resetWarningHours int) error { +func startUI(fetcher ui.Fetcher, refresh time.Duration, inline bool, resetThreshold, resetWarningHours int, noConfirm bool) error { model := ui.New(fetcher, refresh) if store, storeErr := ui.NewDefaultPreferenceStore(); storeErr == nil { model = ui.NewWithPreferences(fetcher, refresh, store) @@ -683,6 +684,7 @@ func startUI(fetcher ui.Fetcher, refresh time.Duration, inline bool, resetThresh model.SetInline(inline) model.SetResetThreshold(resetThreshold) model.SetResetWarningHours(resetWarningHours) + model.SetNoConfirm(noConfirm) finalModel, runErr := tea.NewProgram(model, terminalProgramOptions(os.Environ(), appleTerminalSupportsTrueColor())...).Run() if final, ok := finalModel.(ui.Model); ok { final.CancelQuotaWork() diff --git a/main_logging_test.go b/main_logging_test.go index 8015e492..e64cfc73 100644 --- a/main_logging_test.go +++ b/main_logging_test.go @@ -18,8 +18,10 @@ func TestLoggingFlagsAndLaunchFailures(t *testing.T) { for _, browser := range []bool{false, true} { path := filepath.Join(t.TempDir(), "error.log") deps := dependencies{ - startUI: func(ui.Fetcher, time.Duration, bool, int, int) error { return errors.New("PRIVATE_UPSTREAM_BODY") }, - startWeb: func(web.Source, time.Duration, int, io.Writer, bool) error { + startUI: func(ui.Fetcher, time.Duration, bool, int, int, bool) error { + return errors.New("PRIVATE_UPSTREAM_BODY") + }, + startWeb: func(web.Source, time.Duration, int, io.Writer, bool, bool) error { return errors.New("PRIVATE_UPSTREAM_BODY") }, } diff --git a/main_test.go b/main_test.go index 2f70c5a4..24916ed6 100644 --- a/main_test.go +++ b/main_test.go @@ -189,7 +189,7 @@ func TestResetThresholdOption(t *testing.T) { t.Run(test.value, func(t *testing.T) { var stdout, stderr bytes.Buffer called := false - deps := dependencies{startUI: func(_ ui.Fetcher, _ time.Duration, _ bool, threshold, _ int) error { + deps := dependencies{startUI: func(_ ui.Fetcher, _ time.Duration, _ bool, threshold, _ int, _ bool) error { called = true if threshold != test.want { t.Fatalf("threshold %d, want %d", threshold, test.want) @@ -214,7 +214,7 @@ func TestRunStartsDemoWithSelectedOptions(t *testing.T) { var stdout, stderr bytes.Buffer called := false deps := dependencies{ - startUI: func(fetcher ui.Fetcher, refresh time.Duration, inline bool, resetThreshold, warningHours int) error { + startUI: func(fetcher ui.Fetcher, refresh time.Duration, inline bool, resetThreshold, warningHours int, _ bool) error { called = true if refresh != 30*time.Second || !inline || resetThreshold != 35 || warningHours != 72 { t.Fatalf("refresh=%s inline=%v", refresh, inline) @@ -267,7 +267,7 @@ func TestRunResetWarningHours(t *testing.T) { t.Run(test.value, func(t *testing.T) { var stdout, stderr bytes.Buffer called := false - deps := dependencies{startUI: func(_ ui.Fetcher, _ time.Duration, _ bool, _ int, hours int) error { + deps := dependencies{startUI: func(_ ui.Fetcher, _ time.Duration, _ bool, _ int, hours int, _ bool) error { called = true if hours != test.want { t.Fatalf("got %d hours, want %d", hours, test.want) @@ -300,7 +300,7 @@ func sameDemoAccounting(left, right codex.LiveUsageSnapshot) bool { func TestRunReportsUIError(t *testing.T) { var stdout, stderr bytes.Buffer deps := dependencies{ - startUI: func(ui.Fetcher, time.Duration, bool, int, int) error { return errors.New("terminal unavailable") }, + startUI: func(ui.Fetcher, time.Duration, bool, int, int, bool) error { return errors.New("terminal unavailable") }, } code := run(nil, &stdout, &stderr, deps) if code != 1 || !strings.Contains(stderr.String(), "terminal unavailable") { @@ -391,7 +391,7 @@ func TestRunPassesOpenAIAPIKeyToUIBenchmarks(t *testing.T) { t.Setenv("OPENAI_API_KEY", "openai-secret") var stdout, stderr bytes.Buffer deps := dependencies{ - startUI: func(fetcher ui.Fetcher, _ time.Duration, _ bool, _, _ int) error { + startUI: func(fetcher ui.Fetcher, _ time.Duration, _ bool, _, _ int, _ bool) error { client, ok := fetcher.(codex.Client) if !ok || client.BenchmarkAPIKey != "openai-secret" { t.Fatalf("benchmark API key was not attached to Codex client") @@ -417,7 +417,7 @@ func TestRunPassesDigBenchTokenToUIWithoutLeavingItInEnvironment(t *testing.T) { } return []string{"P-2", "P-1", "P-2"}, nil }, - startUI: func(fetcher ui.Fetcher, _ time.Duration, _ bool, _, _ int) error { + startUI: func(fetcher ui.Fetcher, _ time.Duration, _ bool, _, _ int, _ bool) error { client, ok := fetcher.(codex.Client) if !ok || client.DigBenchToken != "digbench-secret" { t.Fatalf("DigBench token was not attached to Codex client") diff --git a/main_web_test.go b/main_web_test.go index 336f3e39..bc83c5ee 100644 --- a/main_web_test.go +++ b/main_web_test.go @@ -22,14 +22,14 @@ func TestLaunchModesAreIsolated(t *testing.T) { t.Setenv("OPENAI_API_KEY", "private-key") terminal, browser, discovery := 0, 0, 0 deps := dependencies{ - startUI: func(_ ui.Fetcher, refresh time.Duration, inline bool, threshold, hours int) error { + startUI: func(_ ui.Fetcher, refresh time.Duration, inline bool, threshold, hours int, _ bool) error { terminal++ if refresh != time.Minute || inline || threshold != 80 || hours != 72 { t.Fatal("terminal defaults changed") } return nil }, - startWeb: func(source web.Source, refresh time.Duration, port int, output io.Writer, control bool) error { + startWeb: func(source web.Source, refresh time.Duration, port int, output io.Writer, control bool, _ bool) error { browser++ if refresh != time.Minute || port != 54321 || control { t.Fatal("web options missing") @@ -76,7 +76,7 @@ func TestWebFlagsAndErrors(t *testing.T) { } } var out, err bytes.Buffer - deps := dependencies{startWeb: func(source web.Source, _ time.Duration, _ int, _ io.Writer, _ bool) error { + deps := dependencies{startWeb: func(source web.Source, _ time.Duration, _ int, _ io.Writer, _ bool, _ bool) error { if _, ok := source.(*demoFetcher); !ok { t.Fatal("web demo not isolated") } @@ -94,7 +94,7 @@ func TestWebFlagsAndErrors(t *testing.T) { func TestWebControlExplicitOptIn(t *testing.T) { var out, err bytes.Buffer - deps := dependencies{startWeb: func(_ web.Source, _ time.Duration, _ int, _ io.Writer, control bool) error { + deps := dependencies{startWeb: func(_ web.Source, _ time.Duration, _ int, _ io.Writer, control bool, _ bool) error { if !control { t.Fatal("explicit control flag lost") } @@ -104,3 +104,38 @@ func TestWebControlExplicitOptIn(t *testing.T) { t.Fatalf("%d %s", code, &err) } } + +func TestNoConfirmFlagIsLaunchScopedAndDoesNotEnableWebWrites(t *testing.T) { + for _, browser := range []bool{false, true} { + for _, enabled := range []bool{false, true} { + seen := false + deps := dependencies{ + startUI: func(_ ui.Fetcher, _ time.Duration, _ bool, _, _ int, noConfirm bool) error { + seen = true + if browser || noConfirm != enabled { + t.Fatal("wrong terminal policy") + } + return nil + }, + startWeb: func(_ web.Source, _ time.Duration, _ int, _ io.Writer, writable, noConfirm bool) error { + seen = true + if !browser || writable || noConfirm != enabled { + t.Fatal("no-confirm enabled web writes or lost policy") + } + return nil + }, + } + args := []string{"--demo"} + if browser { + args = append(args, "--web") + } + if enabled { + args = append(args, "--no-confirm") + } + var out, stderr bytes.Buffer + if code := run(args, &out, &stderr, deps); code != 0 || !seen { + t.Fatal("confirmation flag did not reach launch", code, stderr.String()) + } + } + } +} diff --git a/web/src/SessionActions.svelte b/web/src/SessionActions.svelte index a66a8099..5717ef03 100644 --- a/web/src/SessionActions.svelte +++ b/web/src/SessionActions.svelte @@ -387,6 +387,8 @@ } finally { busy = false; } + if (live.data?.noConfirm && confirmation && !controller.signal.aborted) + await commit(); } async function commit() { if (!offer?.id || busy || suspended || followUpBlocked || !confirming) @@ -693,7 +695,7 @@ {/each} {/if} - {#if confirming} + {#if confirming && !live.data?.noConfirm} {#if scheduled}

        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}