@narumitw/pi-ticker 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -47
- package/dist/chunks/{chunk-U5NETXSC.js → chunk-5QPNCY3F.ts} +1 -1
- package/dist/chunks/chunk-5QPNCY3F.ts.map +7 -0
- package/dist/chunks/{menu-WR7QV3P4.js → menu-L3RY6JMO.ts} +7 -10
- package/dist/chunks/menu-L3RY6JMO.ts.map +7 -0
- package/dist/chunks/{tui-menu-KQLX7NJ5.js → tui-menu-26V6EKZK.ts} +12 -33
- package/dist/chunks/tui-menu-26V6EKZK.ts.map +7 -0
- package/dist/index.ts +5 -17
- package/dist/index.ts.map +2 -2
- package/package.json +54 -55
- package/src/menu.ts +207 -226
- package/src/quotes.ts +67 -73
- package/src/render.ts +107 -114
- package/src/settings.ts +105 -111
- package/src/ticker.ts +263 -286
- package/src/tui-menu.ts +416 -457
- package/dist/chunks/chunk-U5NETXSC.js.map +0 -7
- package/dist/chunks/menu-WR7QV3P4.js.map +0 -7
- package/dist/chunks/tui-menu-KQLX7NJ5.js.map +0 -7
package/README.md
CHANGED
|
@@ -36,7 +36,6 @@ pi --no-extensions -e ./packages/pi-ticker
|
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
The package declares `dist/index.ts`, so an unbuilt local checkout must run the build before Pi loads the package directory.
|
|
39
|
-
|
|
40
39
|
Pi loads the generated TypeScript entrypoint through Jiti while menu code remains in lazy JavaScript chunks.
|
|
41
40
|
|
|
42
41
|
Extensions run with Pi's permissions, so install only trusted packages.
|
|
@@ -50,29 +49,20 @@ Open the ticker manager in TUI mode:
|
|
|
50
49
|
```
|
|
51
50
|
|
|
52
51
|
Choose **Add custom ticker…** and enter a Yahoo Finance symbol such as `MSFT`, `SPY`, or `BTC-USD`.
|
|
53
|
-
|
|
54
52
|
The widget appears after the settings save and the first quote request completes.
|
|
55
53
|
|
|
56
54
|
## 🧭 Ticker manager
|
|
57
55
|
|
|
58
56
|
`/ticker` opens **Manage tickers** in TUI and RPC modes.
|
|
59
|
-
|
|
60
57
|
In TUI mode, one screen provides search, symbol removal, direct add, widget visibility, and refresh actions.
|
|
61
|
-
|
|
62
58
|
The configured confirm binding or Space activates the focused row.
|
|
63
|
-
|
|
64
59
|
When a valid search has no match, the add row changes to **Add SYMBOL** for direct addition.
|
|
65
|
-
|
|
66
60
|
`Shift+Up` and `Shift+Down` reorder the focused ticker when the search field is empty and those keys do not conflict with configured standard bindings.
|
|
67
61
|
|
|
68
62
|
RPC mode exposes portable dialogs for choosing and moving a ticker.
|
|
69
|
-
|
|
70
63
|
Each accepted change saves immediately.
|
|
71
|
-
|
|
72
64
|
If a save fails, the manager restores the previous displayed and effective value.
|
|
73
|
-
|
|
74
65
|
Removing the final symbol hides the widget and stops polling.
|
|
75
|
-
|
|
76
66
|
Escape closes transient TUI flows, and `Ctrl+C` remains a hard-close path.
|
|
77
67
|
|
|
78
68
|
## 💬 Commands
|
|
@@ -84,9 +74,7 @@ Escape closes transient TUI flows, and `Ctrl+C` remains a hard-close path.
|
|
|
84
74
|
- `/ticker reset` reports that no default symbol list exists and leaves settings unchanged.
|
|
85
75
|
|
|
86
76
|
Known routes reject trailing arguments.
|
|
87
|
-
|
|
88
77
|
All command routes support TUI and RPC modes.
|
|
89
|
-
|
|
90
78
|
Print and JSON modes reject the command before changing settings.
|
|
91
79
|
|
|
92
80
|
## ⚙️ Settings
|
|
@@ -98,11 +86,8 @@ The canonical user settings file is:
|
|
|
98
86
|
```
|
|
99
87
|
|
|
100
88
|
The normal path is `~/.pi/agent/pi-ticker.json`.
|
|
101
|
-
|
|
102
89
|
Pi's configured agent directory replaces `~/.pi/agent` when applicable.
|
|
103
|
-
|
|
104
90
|
Ticker preferences are user-scoped and apply across projects.
|
|
105
|
-
|
|
106
91
|
The extension does not read project settings or extension-specific environment-variable overrides.
|
|
107
92
|
|
|
108
93
|
A missing file uses an empty symbol list, keeps the widget enabled, and does not create the file, its parent directory, or a polling task.
|
|
@@ -115,7 +100,6 @@ The settings file must contain a JSON object with these optional fields:
|
|
|
115
100
|
| `widgetEnabled` | boolean | `true` | Controls widget visibility and quote polling. |
|
|
116
101
|
|
|
117
102
|
Each symbol may contain up to 15 uppercase letters, digits, `.`, `^`, `=`, or `-`.
|
|
118
|
-
|
|
119
103
|
Lowercase command and menu input is normalized to uppercase.
|
|
120
104
|
|
|
121
105
|
Example:
|
|
@@ -128,61 +112,42 @@ Example:
|
|
|
128
112
|
```
|
|
129
113
|
|
|
130
114
|
Unknown JSON fields are preserved during saves.
|
|
131
|
-
|
|
132
115
|
Malformed or invalid settings use runtime defaults and leave the file unchanged.
|
|
133
|
-
|
|
134
116
|
Pi shows a warning when UI is available.
|
|
135
117
|
|
|
136
118
|
Writes are ordered within one Pi process and published through a temporary file plus atomic rename.
|
|
137
|
-
|
|
138
119
|
Reload and session replacement wait for accepted writes before loading the next settings snapshot.
|
|
139
|
-
|
|
140
120
|
Separate Pi processes do not share a cross-process lock.
|
|
141
|
-
|
|
142
121
|
Settings reload on startup and `/reload`.
|
|
143
122
|
|
|
144
123
|
## 🔒 Security and privacy
|
|
145
124
|
|
|
146
125
|
The extension requests public quote metadata from Yahoo Finance over HTTPS without an API key.
|
|
147
|
-
|
|
148
126
|
Requested ticker symbols and the host network address are visible to Yahoo Finance.
|
|
149
|
-
|
|
150
127
|
The user settings file contains only ticker symbols and widget visibility; it stores no credential or secret.
|
|
151
|
-
|
|
152
128
|
The extension displays ticker symbols and quote data locally without adding them to model context.
|
|
153
129
|
|
|
154
130
|
## 🚧 Limitations
|
|
155
131
|
|
|
156
|
-
Yahoo Finance is an unofficial dependency and may rate-limit, delay, change, or remove the endpoint.
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
Each request times out after 10 seconds, and one symbol failure does not discard successful symbols.
|
|
161
|
-
|
|
162
|
-
Each Pi session owns its polling queue, and separate Pi processes do not share one.
|
|
132
|
+
- Yahoo Finance is an unofficial dependency and may rate-limit, delay, change, or remove the endpoint.
|
|
133
|
+
- Quotes may be delayed and are not suitable for trading decisions.
|
|
134
|
+
- Each request times out after 10 seconds, and one symbol failure does not discard successful symbols.
|
|
135
|
+
- Each Pi session owns its polling queue, and separate Pi processes do not share one.
|
|
163
136
|
|
|
164
137
|
## 🗂️ Package layout
|
|
165
138
|
|
|
166
139
|
```text
|
|
167
140
|
packages/pi-ticker/
|
|
168
|
-
├── src/
|
|
169
|
-
│ ├── index.ts
|
|
170
|
-
│
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
│ ├── quotes.ts # Yahoo Finance requests and response parsing
|
|
175
|
-
│ └── render.ts # Width-bounded plain and themed widget rendering
|
|
176
|
-
├── scripts/
|
|
177
|
-
│ └── build-runtime.mjs # Deterministic runtime builder and boundary validator
|
|
178
|
-
├── dist/ # Generated Jiti entrypoint, lazy chunks, and source maps
|
|
179
|
-
├── test/ # Deterministic package behavior and generated-runtime tests
|
|
180
|
-
├── README.md
|
|
181
|
-
├── LICENSE
|
|
182
|
-
├── package.json
|
|
183
|
-
└── tsconfig.json
|
|
141
|
+
├── src/ # Authoritative implementation and helpers
|
|
142
|
+
│ ├── index.ts # Thin Pi entrypoint
|
|
143
|
+
│ └── ticker.ts # Quote polling and widget lifecycle
|
|
144
|
+
├── dist/ # Generated Jiti runtime
|
|
145
|
+
├── scripts/build-runtime.mjs # Runtime builder
|
|
146
|
+
└── test/ # Behavior and lifecycle coverage
|
|
184
147
|
```
|
|
185
148
|
|
|
149
|
+
The generated runtime is built from `src/index.ts` and does not import back into `src`.
|
|
150
|
+
|
|
186
151
|
## 🔎 Keywords
|
|
187
152
|
|
|
188
153
|
Pi extension, market quotes, stock ticker, Yahoo Finance, editor widget, terminal UI, TypeScript.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/settings.ts"],
|
|
4
|
+
"sourcesContent": ["import { mkdir, readFile, rename, unlink, writeFile } from \"node:fs/promises\";\nimport { basename, dirname, join } from \"node:path\";\n\nexport const MAX_SYMBOLS = 10;\nexport const DEFAULT_WIDGET_ENABLED = true;\n\nexport interface StockTickerSettings {\n symbols: string[];\n widgetEnabled: boolean;\n}\n\nexport interface LoadedSettings {\n settings: StockTickerSettings;\n warning?: string;\n}\n\nexport interface SettingsWriter {\n save(path: string, symbols: readonly string[]): Promise<void>;\n saveWidgetEnabled(path: string, widgetEnabled: boolean): Promise<void>;\n flush(): Promise<void>;\n}\n\nconst SYMBOL_PATTERN = /^[A-Z0-9.^=-]{1,15}$/;\n\nexport function parseSymbols(values: Iterable<string>): string[] {\n return normalizeSymbols(values, false);\n}\n\nexport function normalizeSymbols(values: Iterable<string>, allowEmpty: boolean): string[] {\n const symbols = [...values]\n .flatMap((value) => value.split(/[\\s,]+/))\n .map((value) => value.trim().toUpperCase())\n .filter(Boolean);\n const unique = [...new Set(symbols)];\n if (!allowEmpty && unique.length === 0) throw new Error(\"Provide at least one stock symbol.\");\n if (unique.length > MAX_SYMBOLS) {\n throw new Error(`At most ${MAX_SYMBOLS} stock symbols are supported.`);\n }\n const invalid = unique.find((symbol) => !SYMBOL_PATTERN.test(symbol));\n if (invalid) throw new Error(`Invalid stock symbol: ${invalid}`);\n return unique;\n}\n\nexport async function loadSettings(path: string): Promise<LoadedSettings> {\n let text: string;\n try {\n text = await readFile(path, \"utf8\");\n } catch (error) {\n if (isMissingFile(error)) return { settings: defaultSettings() };\n return {\n settings: defaultSettings(),\n warning: `Could not read ${path}; using default ticker settings.`,\n };\n }\n\n try {\n const document = parseDocument(text);\n const symbols = document.symbols === undefined ? [] : parseSymbolSetting(document.symbols);\n const widgetEnabled =\n document.widgetEnabled === undefined ? DEFAULT_WIDGET_ENABLED : parseWidgetEnabled(document.widgetEnabled);\n return { settings: { symbols, widgetEnabled } };\n } catch (error) {\n return {\n settings: defaultSettings(),\n warning: `${errorMessage(error)} Using default ticker settings without changing ${path}.`,\n };\n }\n}\n\nexport async function saveSymbols(path: string, symbols: readonly string[]): Promise<void> {\n await saveSettingsPatch(path, { symbols: normalizeSymbols(symbols, true) });\n}\n\nexport async function saveWidgetEnabled(path: string, widgetEnabled: boolean): Promise<void> {\n await saveSettingsPatch(path, { widgetEnabled: parseWidgetEnabled(widgetEnabled) });\n}\n\nexport function createSettingsWriter(): SettingsWriter {\n let queue = Promise.resolve();\n const enqueue = (operation: () => Promise<void>) => {\n const running = queue.catch(() => undefined).then(operation);\n queue = running.then(\n () => undefined,\n () => undefined,\n );\n return running;\n };\n return {\n save: (path, symbols) => enqueue(() => saveSymbols(path, symbols)),\n saveWidgetEnabled: (path, widgetEnabled) => enqueue(() => saveWidgetEnabled(path, widgetEnabled)),\n flush: () => queue,\n };\n}\n\nasync function saveSettingsPatch(path: string, patch: Partial<StockTickerSettings>): Promise<void> {\n let document: Record<string, unknown> = {};\n try {\n const text = await readFile(path, \"utf8\");\n document = parseDocument(text);\n validateKnownSettings(document);\n } catch (error) {\n if (!isMissingFile(error)) throw error;\n }\n\n const next = `${JSON.stringify({ ...document, ...patch }, null, 2)}\\n`;\n const directory = dirname(path);\n await mkdir(directory, { recursive: true });\n const temporaryPath = join(directory, `.${basename(path)}.${process.pid}.${Date.now()}.tmp`);\n try {\n await writeFile(temporaryPath, next, { encoding: \"utf8\", flag: \"wx\", mode: 0o600 });\n await rename(temporaryPath, path);\n } catch (error) {\n await unlink(temporaryPath).catch(() => undefined);\n throw error;\n }\n}\n\nfunction defaultSettings(): StockTickerSettings {\n return { symbols: [], widgetEnabled: DEFAULT_WIDGET_ENABLED };\n}\n\nfunction parseDocument(text: string): Record<string, unknown> {\n let value: unknown;\n try {\n value = JSON.parse(text);\n } catch {\n throw new Error(\"Stock ticker settings must contain valid JSON.\");\n }\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n throw new Error(\"Stock ticker settings must be a JSON object.\");\n }\n return value as Record<string, unknown>;\n}\n\nfunction validateKnownSettings(document: Record<string, unknown>): void {\n if (document.symbols !== undefined) parseSymbolSetting(document.symbols);\n if (document.widgetEnabled !== undefined) parseWidgetEnabled(document.widgetEnabled);\n}\n\nfunction parseSymbolSetting(value: unknown): string[] {\n if (!Array.isArray(value) || value.some((item) => typeof item !== \"string\")) {\n throw new Error(\"The stock ticker symbols setting must be an array of strings.\");\n }\n return normalizeSymbols(value as string[], true);\n}\n\nfunction parseWidgetEnabled(value: unknown): boolean {\n if (typeof value !== \"boolean\") {\n throw new Error(\"The stock ticker widgetEnabled setting must be a boolean.\");\n }\n return value;\n}\n\nfunction isMissingFile(error: unknown): boolean {\n return hasErrorCode(error, \"ENOENT\");\n}\n\nfunction hasErrorCode(error: unknown, code: string): boolean {\n return (\n typeof error === \"object\" && error !== null && \"code\" in error && (error as NodeJS.ErrnoException).code === code\n );\n}\n\nfunction errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n"],
|
|
5
|
+
"mappings": ";;;;AAAA,SAAS,OAAO,UAAU,QAAQ,QAAQ,iBAAiB;AAC3D,SAAS,UAAU,SAAS,YAAY;AAEjC,IAAM,cAAc;AACpB,IAAM,yBAAyB;AAkBtC,IAAM,iBAAiB;AAEhB,SAAS,aAAa,QAAoC;AAC/D,SAAO,iBAAiB,QAAQ,KAAK;AACvC;AAEO,SAAS,iBAAiB,QAA0B,YAA+B;AACxF,QAAM,UAAU,CAAC,GAAG,MAAM,EACvB,QAAQ,CAAC,UAAU,MAAM,MAAM,QAAQ,CAAC,EACxC,IAAI,CAAC,UAAU,MAAM,KAAK,EAAE,YAAY,CAAC,EACzC,OAAO,OAAO;AACjB,QAAM,SAAS,CAAC,GAAG,IAAI,IAAI,OAAO,CAAC;AACnC,MAAI,CAAC,cAAc,OAAO,WAAW,EAAG,OAAM,IAAI,MAAM,oCAAoC;AAC5F,MAAI,OAAO,SAAS,aAAa;AAC/B,UAAM,IAAI,MAAM,WAAW,WAAW,+BAA+B;AAAA,EACvE;AACA,QAAM,UAAU,OAAO,KA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AAM,8CAA8C;AAAA,EAChE;AACA,SAAO;AACT;AAEA,SAAS,sBAAsB,UAAyC;AACtE,MAAI,SAAS,YAAY,OAAW,oBAAmB,SAAS,OAAO;AACvE,MAAI,SAAS,kBAAkB,OAAW,oBAAmB,SAAS,aAAa;AACrF;AAEA,SAAS,mBAAmB,OAA0B;AACpD,MAAI,CAAC,MAAM,QAAQ,KAAK,KAAK,MAAM,KAAK,CAAC,SAAS,OAAO,SAAS,QAAQ,GAAG;AAC3E,UAAM,IAAI,MAAM,+DAA+D;AAAA,EACjF;AACA,SAAO,iBAAiB,OAAmB,IAAI;AACjD;AAEA,SAAS,mBAAmB,OAAyB;AACnD,MAAI,OAAO,UAAU,WAAW;AAC9B,UAAM,IAAI,MAAM,2DAA2D;AAAA,EAC7E;AACA,SAAO;AACT;AAEA,SAAS,cAAc,OAAyB;AAC9C,SAAO,aAAa,OAAO,QAAQ;AACrC;AAEA,SAAS,aAAa,OAAgB,MAAuB;AAC3D,SACE,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU,SAAU,MAAgC,SAAS;AAEhH;AAEA,SAAS,aAAa,OAAwB;AAC5C,SAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
// @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
|
|
3
3
|
import {
|
|
4
4
|
parseSymbols
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5QPNCY3F.ts";
|
|
6
6
|
|
|
7
7
|
// src/menu.ts
|
|
8
8
|
async function showTickerMenu(ctx, options) {
|
|
9
9
|
if (options.signal.aborted || !options.isCurrent()) return;
|
|
10
10
|
if (ctx.mode === "tui") {
|
|
11
|
-
const { showTickerTuiMenu } = await import("./tui-menu-
|
|
11
|
+
const { showTickerTuiMenu } = await import("./tui-menu-26V6EKZK.ts");
|
|
12
12
|
if (options.signal.aborted || !options.isCurrent()) return;
|
|
13
13
|
await showTickerTuiMenu(ctx, options);
|
|
14
14
|
return;
|
|
@@ -130,11 +130,9 @@ async function showTickerMenu(ctx, options) {
|
|
|
130
130
|
return { kind: "stay" };
|
|
131
131
|
},
|
|
132
132
|
addCustom: async ({ ctx: actionCtx, signal }) => {
|
|
133
|
-
const entered = await actionCtx.ui.input(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
{ signal }
|
|
137
|
-
);
|
|
133
|
+
const entered = await actionCtx.ui.input("Add custom ticker", "Yahoo symbol, for example MSFT or SOL-USD", {
|
|
134
|
+
signal
|
|
135
|
+
});
|
|
138
136
|
if (signal.aborted || !options.isCurrent()) return { kind: "stay" };
|
|
139
137
|
if (!entered?.trim()) return { kind: "stay" };
|
|
140
138
|
const parsed = parseSymbols([entered]);
|
|
@@ -194,8 +192,7 @@ async function showTickerMenu(ctx, options) {
|
|
|
194
192
|
menuCtx.ui.notify(sanitizeTerminalText(message), "error");
|
|
195
193
|
},
|
|
196
194
|
onUnsupportedMode: (menuCtx, mode) => {
|
|
197
|
-
if (menuCtx.hasUI)
|
|
198
|
-
menuCtx.ui.notify(`Ticker menu is unavailable in ${mode} mode.`, "warning");
|
|
195
|
+
if (menuCtx.hasUI) menuCtx.ui.notify(`Ticker menu is unavailable in ${mode} mode.`, "warning");
|
|
199
196
|
}
|
|
200
197
|
});
|
|
201
198
|
}
|
|
@@ -205,4 +202,4 @@ function orderedSymbols(selected, candidates) {
|
|
|
205
202
|
export {
|
|
206
203
|
showTickerMenu
|
|
207
204
|
};
|
|
208
|
-
//# sourceMappingURL=menu-
|
|
205
|
+
//# sourceMappingURL=menu-L3RY6JMO.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/menu.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ExtensionCommandContext } from \"@earendil-works/pi-coding-agent\";\nimport { parseSymbols } from \"./settings.js\";\n\ntype Screen = \"tickers\" | \"order\" | \"move\";\ntype Action = \"toggle\" | \"addCustom\" | \"toggleWidget\" | \"chooseTicker\" | \"moveUp\" | \"moveDown\" | \"refresh\";\n\nexport interface TickerMenuOptions {\n signal: AbortSignal;\n isCurrent(): boolean;\n getSymbols(): readonly string[];\n applySymbols(symbols: readonly string[], signal: AbortSignal): Promise<void>;\n getWidgetEnabled(): boolean;\n applyWidgetEnabled(widgetEnabled: boolean, signal: AbortSignal): Promise<void>;\n refresh(): void;\n}\n\nexport async function showTickerMenu(ctx: ExtensionCommandContext, options: TickerMenuOptions): Promise<void> {\n if (options.signal.aborted || !options.isCurrent()) return;\n if (ctx.mode === \"tui\") {\n const { showTickerTuiMenu } = await import(\"./tui-menu.js\");\n if (options.signal.aborted || !options.isCurrent()) return;\n await showTickerTuiMenu(ctx, options);\n return;\n }\n\n const { defineMenu, runMenu, sanitizeTerminalText } = await import(\"@narumitw/pi-tui-kit\");\n if (options.signal.aborted || !options.isCurrent()) return;\n let menuCandidates = [...options.getSymbols()];\n let movingSymbol: string | undefined;\n const candidates = () => {\n for (const symbol of options.getSymbols()) {\n if (!menuCandidates.includes(symbol)) menuCandidates.push(symbol);\n }\n return menuCandidates;\n };\n const menu = defineMenu<undefined, Screen, Action, ExtensionCommandContext>({\n start: \"tickers\",\n screens: {\n tickers: () => {\n const selected = new Set(options.getSymbols());\n return {\n kind: \"multiSelect\",\n title: \"Manage tickers\",\n lines: [`${selected.size} selected \u00B7 uncheck to remove \u00B7 changes save immediately`],\n items: candidates().map((symbol) => ({\n id: symbol,\n label: symbol,\n description: \"Display this Yahoo Finance symbol in the editor widget.\",\n selected: selected.has(symbol),\n searchText: symbol.replaceAll(\"-\", \" \"),\n })),\n action: \"toggle\",\n enableSearch: true,\n viewportSize: 10,\n actions: [\n {\n id: \"add-custom\",\n label: \"Add custom ticker\u2026\",\n description: \"Add and select one Yahoo Finance symbol.\",\n action: \"addCustom\",\n },\n ...(selected.size > 1\n ? [\n {\n id: \"reorder\",\n label: \"Reorder tickers\u2026\",\n description: \"Change the order shown in the editor widget.\",\n to: \"order\" as const,\n },\n ]\n : []),\n {\n id: \"widget-enabled\",\n label: `Widget: ${options.getWidgetEnabled() ? \"On\" : \"Off\"}`,\n description: \"Show or hide the editor widget and persist this setting.\",\n action: \"toggleWidget\",\n },\n {\n id: \"refresh\",\n label: \"Refresh now\",\n description: options.getWidgetEnabled()\n ? \"Fetch the selected symbols immediately.\"\n : \"Enable the widget before refreshing.\",\n action: \"refresh\",\n },\n ],\n hint: \"close\",\n doneLabel: \"Close\",\n };\n },\n order: () => ({\n kind: \"choice\",\n title: \"Ticker order\",\n lines: [\"Choose a ticker to move.\"],\n items: options.getSymbols().map((symbol, index) => ({\n id: symbol,\n label: `${index + 1}. ${symbol}`,\n description: \"Select this ticker, then move it up or down.\",\n })),\n action: \"chooseTicker\",\n viewportSize: 10,\n }),\n move: () => {\n const symbols = options.getSymbols();\n const index = movingSymbol ? symbols.indexOf(movingSymbol) : -1;\n const available = index >= 0;\n return {\n kind: \"actions\",\n title: movingSymbol ? `Move ${movingSymbol}` : \"Move ticker\",\n lines: [\n available ? `Position ${index + 1} of ${symbols.length}` : \"Ticker is no longer selected.\",\n `Order: ${symbols.join(\" \u00B7 \")}`,\n ],\n items: [\n {\n id: \"move-up\",\n label: \"Move up\",\n description: \"Move this ticker one position toward the start.\",\n disabled: !available || index === 0,\n disabledReason: !available ? \"Ticker is unavailable\" : index === 0 ? \"Already first\" : undefined,\n action: \"moveUp\",\n },\n {\n id: \"move-down\",\n label: \"Move down\",\n description: \"Move this ticker one position toward the end.\",\n disabled: !available || index === symbols.length - 1,\n disabledReason: !available\n ? \"Ticker is unavailable\"\n : index === symbols.length - 1\n ? \"Already last\"\n : undefined,\n action: \"moveDown\",\n },\n ],\n };\n },\n },\n actions: {\n toggle: async ({ itemId, selected, signal }) => {\n if (!candidates().includes(itemId)) return { kind: \"rejected\" };\n const next = new Set(options.getSymbols());\n if (selected) next.add(itemId);\n else next.delete(itemId);\n await options.applySymbols(orderedSymbols(next, candidates()), signal);\n if (signal.aborted || !options.isCurrent()) return { kind: \"stay\" };\n if (!selected) menuCandidates = menuCandidates.filter((symbol) => symbol !== itemId);\n return { kind: \"stay\" };\n },\n addCustom: async ({ ctx: actionCtx, signal }) => {\n const entered = await actionCtx.ui.input(\"Add custom ticker\", \"Yahoo symbol, for example MSFT or SOL-USD\", {\n signal,\n });\n if (signal.aborted || !options.isCurrent()) return { kind: \"stay\" };\n if (!entered?.trim()) return { kind: \"stay\" };\n const parsed = parseSymbols([entered]);\n if (parsed.length !== 1) throw new Error(\"Enter exactly one Yahoo Finance symbol.\");\n const symbol = parsed[0];\n if (!symbol) return { kind: \"stay\" };\n const selected = new Set(options.getSymbols());\n if (selected.has(symbol)) {\n actionCtx.ui.notify(`${symbol} is already selected.`, \"info\");\n return { kind: \"stay\" };\n }\n selected.add(symbol);\n await options.applySymbols([...selected], signal);\n if (signal.aborted || !options.isCurrent()) return { kind: \"stay\" };\n if (!menuCandidates.includes(symbol)) menuCandidates.push(symbol);\n return { kind: \"stay\" };\n },\n toggleWidget: async ({ signal }) => {\n await options.applyWidgetEnabled(!options.getWidgetEnabled(), signal);\n if (signal.aborted || !options.isCurrent()) return { kind: \"stay\" };\n return { kind: \"stay\" };\n },\n chooseTicker: ({ itemId }) => {\n if (!options.getSymbols().includes(itemId)) return { kind: \"rejected\" };\n movingSymbol = itemId;\n return { kind: \"to\", screen: \"move\" };\n },\n moveUp: ({ signal }) => moveSelectedTicker(-1, signal),\n moveDown: ({ signal }) => moveSelectedTicker(1, signal),\n refresh: () => {\n options.refresh();\n return { kind: \"stay\" };\n },\n },\n });\n\n async function moveSelectedTicker(direction: -1 | 1, signal: AbortSignal) {\n const current = options.getSymbols();\n const from = movingSymbol ? current.indexOf(movingSymbol) : -1;\n const to = from + direction;\n if (from < 0 || to < 0 || to >= current.length) return { kind: \"rejected\" } as const;\n const next = [...current];\n const [symbol] = next.splice(from, 1);\n if (!symbol) return { kind: \"rejected\" } as const;\n next.splice(to, 0, symbol);\n await options.applySymbols(next, signal);\n if (signal.aborted || !options.isCurrent()) return { kind: \"stay\" } as const;\n menuCandidates = [...next];\n return { kind: \"stay\" } as const;\n }\n\n await runMenu(ctx, menu, {\n getState: () => undefined,\n signal: options.signal,\n isCurrent: options.isCurrent,\n onError: (menuCtx, error) => {\n if (!menuCtx.hasUI) return;\n const message = error instanceof Error ? error.message : String(error);\n menuCtx.ui.notify(sanitizeTerminalText(message), \"error\");\n },\n onUnsupportedMode: (menuCtx, mode) => {\n if (menuCtx.hasUI) menuCtx.ui.notify(`Ticker menu is unavailable in ${mode} mode.`, \"warning\");\n },\n });\n}\n\nfunction orderedSymbols(selected: ReadonlySet<string>, candidates: readonly string[]): string[] {\n return candidates.filter((symbol) => selected.has(symbol));\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAgBA,eAAsB,eAAe,KAA8B,SAA2C;AAC5G,MAAI,QAAQ,OAAO,WAAW,CAAC,QAAQ,UAAU,EAAG;AACpD,MAAI,IAAI,SAAS,OAAO;AACtB,UAAM,EAAE,kBAAkB,IAAI,MAAM,OAAO,wBAAe;AAC1D,QAAI,QAAQ,OAAO,WAAW,CAAC,QAAQ,UAAU,EAAG;AACpD,UAAM,kBAAkB,KAAK,OAAO;AACpC;AAAA,EACF;AAEA,QAAM,EAAE,YAAY,SAAS,qBAAqB,IAAI,MAAM,OAAO,sBAAsB;AACzF,MAAI,QAAQ,OAAO,WAAW,CAAC,QAAQ,UAAU,EAAG;AACpD,MAAI,iBAAiB,CAAC,GAAG,QAAQ,WAAW,CAAC;AAC7C,MAAI;AACJ,QAAM,aAAa,MAAM;AACvB,eAAW,UAAU,QAAQ,WAAW,GAAG;AACzC,UAAI,CAAC,eAAe,SAAS,MAAM,EAAG,gBAAe,KAAK,MAAM;AAAA,IAClE;AACA,WAAO;AAAA,EACT;AACA,QAAM,OAAO,WAA+D;AAAA,IAC1E,OAAO;AAAA,IACP,SA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AAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACrE,cAAQ,GAAG,OAAO,qBAAqB,OAAO,GAAG,OAAO;AAAA,IAC1D;AAAA,IACA,mBAAmB,CAAC,SAAS,SAAS;AACpC,UAAI,QAAQ,MAAO,SAAQ,GAAG,OAAO,iCAAiC,IAAI,UAAU,SAAS;AAAA,IAC/F;AAAA,EACF,CAAC;AACH;AAEA,SAAS,eAAe,UAA+B,YAAyC;AAC9F,SAAO,WAAW,OAAO,CAAC,WAAW,SAAS,IAAI,MAAM,CAAC;AAC3D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
|
|
3
3
|
import {
|
|
4
4
|
parseSymbols
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5QPNCY3F.ts";
|
|
6
6
|
|
|
7
7
|
// src/tui-menu.ts
|
|
8
8
|
import { fuzzyFilter, Input, Key, matchesKey, truncateToWidth } from "@earendil-works/pi-tui";
|
|
@@ -57,9 +57,7 @@ async function showTickerTuiMenu(ctx, options) {
|
|
|
57
57
|
let pending = Promise.resolve();
|
|
58
58
|
const shortcutUp = shortcutAvailable(keybindings, "shift+up");
|
|
59
59
|
const shortcutDown = shortcutAvailable(keybindings, "shift+down");
|
|
60
|
-
const activationHint = (label) => formatInteractionHints(keybindings, [
|
|
61
|
-
{ bindings: ["tui.select.confirm"], keys: ["space"], label }
|
|
62
|
-
]);
|
|
60
|
+
const activationHint = (label) => formatInteractionHints(keybindings, [{ bindings: ["tui.select.confirm"], keys: ["space"], label }]);
|
|
63
61
|
const reorderKeys = [shortcutUp, shortcutDown].filter(
|
|
64
62
|
(shortcut) => shortcut !== void 0
|
|
65
63
|
);
|
|
@@ -109,9 +107,7 @@ async function showTickerTuiMenu(ctx, options) {
|
|
|
109
107
|
}
|
|
110
108
|
];
|
|
111
109
|
const buildRows = () => {
|
|
112
|
-
const tickerRows = symbols.map(
|
|
113
|
-
(symbol) => ({ kind: "ticker", id: symbol, symbol })
|
|
114
|
-
);
|
|
110
|
+
const tickerRows = symbols.map((symbol) => ({ kind: "ticker", id: symbol, symbol }));
|
|
115
111
|
const query = searchInput.getValue().toLowerCase();
|
|
116
112
|
const filtered = fuzzyFilter(
|
|
117
113
|
tickerRows,
|
|
@@ -151,9 +147,7 @@ async function showTickerTuiMenu(ctx, options) {
|
|
|
151
147
|
} catch (error) {
|
|
152
148
|
if (options.signal.aborted || !options.isCurrent()) return;
|
|
153
149
|
symbols = [...previousSymbols];
|
|
154
|
-
errorMessage = sanitizeTerminalText(
|
|
155
|
-
error instanceof Error ? error.message : String(error)
|
|
156
|
-
);
|
|
150
|
+
errorMessage = sanitizeTerminalText(error instanceof Error ? error.message : String(error));
|
|
157
151
|
ctx.ui.notify(`Ticker settings were not saved: ${errorMessage}`, "error");
|
|
158
152
|
} finally {
|
|
159
153
|
busy = false;
|
|
@@ -177,9 +171,7 @@ async function showTickerTuiMenu(ctx, options) {
|
|
|
177
171
|
} catch (error) {
|
|
178
172
|
if (options.signal.aborted || !options.isCurrent()) return;
|
|
179
173
|
widgetEnabled = previousWidgetEnabled;
|
|
180
|
-
errorMessage = sanitizeTerminalText(
|
|
181
|
-
error instanceof Error ? error.message : String(error)
|
|
182
|
-
);
|
|
174
|
+
errorMessage = sanitizeTerminalText(error instanceof Error ? error.message : String(error));
|
|
183
175
|
ctx.ui.notify(`Ticker settings were not saved: ${errorMessage}`, "error");
|
|
184
176
|
} finally {
|
|
185
177
|
busy = false;
|
|
@@ -270,12 +262,7 @@ async function showTickerTuiMenu(ctx, options) {
|
|
|
270
262
|
return focused ? theme.fg("accent", bounded) : bounded;
|
|
271
263
|
});
|
|
272
264
|
if (viewportSize < rows.length) {
|
|
273
|
-
content.push(
|
|
274
|
-
theme.fg(
|
|
275
|
-
"dim",
|
|
276
|
-
truncateToWidth(` (${selectedIndex + 1}/${rows.length})`, safeWidth, "")
|
|
277
|
-
)
|
|
278
|
-
);
|
|
265
|
+
content.push(theme.fg("dim", truncateToWidth(` (${selectedIndex + 1}/${rows.length})`, safeWidth, "")));
|
|
279
266
|
}
|
|
280
267
|
const row = selectedRow();
|
|
281
268
|
const description = row?.kind === "ticker" ? rawSearchInput.getValue() ? "Clear search before reordering." : tickerDescription : row?.description;
|
|
@@ -284,11 +271,7 @@ async function showTickerTuiMenu(ctx, options) {
|
|
|
284
271
|
...topRule.render(safeWidth),
|
|
285
272
|
theme.fg(
|
|
286
273
|
"muted",
|
|
287
|
-
truncateToWidth(
|
|
288
|
-
`${symbols.length} selected \xB7 changes save immediately`,
|
|
289
|
-
safeWidth,
|
|
290
|
-
""
|
|
291
|
-
)
|
|
274
|
+
truncateToWidth(`${symbols.length} selected \xB7 changes save immediately`, safeWidth, "")
|
|
292
275
|
),
|
|
293
276
|
...searchInput.render(safeWidth).map((line) => truncateToWidth(line, safeWidth, "")),
|
|
294
277
|
...content,
|
|
@@ -361,11 +344,9 @@ async function showTickerTuiMenu(ctx, options) {
|
|
|
361
344
|
}
|
|
362
345
|
});
|
|
363
346
|
if (result.kind !== "completed" || result.value === "close") return;
|
|
364
|
-
const entered = await ctx.ui.input(
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
{ signal: options.signal }
|
|
368
|
-
);
|
|
347
|
+
const entered = await ctx.ui.input("Add custom ticker", "Yahoo symbol, for example MSFT or SOL-USD", {
|
|
348
|
+
signal: options.signal
|
|
349
|
+
});
|
|
369
350
|
if (options.signal.aborted || !options.isCurrent()) return;
|
|
370
351
|
if (!entered?.trim()) continue;
|
|
371
352
|
try {
|
|
@@ -422,12 +403,10 @@ function canonicalKey(value) {
|
|
|
422
403
|
const parts = value.toLowerCase().split("+");
|
|
423
404
|
const base = parts.at(-1) ?? "";
|
|
424
405
|
const canonicalBase = base === "escape" ? "esc" : base === "return" ? "enter" : base;
|
|
425
|
-
const modifiers = ["ctrl", "shift", "alt", "super"].filter(
|
|
426
|
-
(modifier) => parts.includes(modifier)
|
|
427
|
-
);
|
|
406
|
+
const modifiers = ["ctrl", "shift", "alt", "super"].filter((modifier) => parts.includes(modifier));
|
|
428
407
|
return [...modifiers, canonicalBase].join("+");
|
|
429
408
|
}
|
|
430
409
|
export {
|
|
431
410
|
showTickerTuiMenu
|
|
432
411
|
};
|
|
433
|
-
//# sourceMappingURL=tui-menu-
|
|
412
|
+
//# sourceMappingURL=tui-menu-26V6EKZK.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/tui-menu.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ExtensionCommandContext } from \"@earendil-works/pi-coding-agent\";\nimport { fuzzyFilter, Input, Key, matchesKey, truncateToWidth } from \"@earendil-works/pi-tui\";\nimport type { TickerMenuOptions } from \"./menu.js\";\nimport { parseSymbols } from \"./settings.js\";\n\ntype TuiMenuResult = \"add\" | \"close\";\ntype TickerRow = { kind: \"ticker\"; id: string; symbol: string };\ntype ActionRow = {\n kind: \"action\";\n id: \"add\" | \"widget\" | \"refresh\";\n label: string;\n description: string;\n};\ntype Row = TickerRow | ActionRow;\n\nconst PASTE_START = \"\\u001b[200~\";\nconst PASTE_END = \"\\u001b[201~\";\n// Keep these aligned with Input.handleInput so configured editing actions beat additive reorder.\nconst RESERVED_INPUT_BINDINGS = [\n \"tui.select.up\",\n \"tui.select.down\",\n \"tui.select.pageUp\",\n \"tui.select.pageDown\",\n \"tui.select.confirm\",\n \"tui.select.cancel\",\n \"tui.editor.undo\",\n \"tui.input.submit\",\n \"tui.editor.deleteCharBackward\",\n \"tui.editor.deleteCharForward\",\n \"tui.editor.deleteWordBackward\",\n \"tui.editor.deleteWordForward\",\n \"tui.editor.deleteToLineStart\",\n \"tui.editor.deleteToLineEnd\",\n \"tui.editor.yank\",\n \"tui.editor.yankPop\",\n \"tui.editor.cursorLeft\",\n \"tui.editor.cursorRight\",\n \"tui.editor.cursorLineStart\",\n \"tui.editor.cursorLineEnd\",\n \"tui.editor.cursorWordLeft\",\n \"tui.editor.cursorWordRight\",\n] as const;\n\n// Pi TUI Kit multi-select screens do not expose in-place row-reorder shortcuts.\n// This specialized TUI keeps the same search, toggle, action, binding, and cancellation behavior\n// while RPC mode continues to use the Kit's declarative adapter in menu.ts.\nexport async function showTickerTuiMenu(ctx: ExtensionCommandContext, options: TickerMenuOptions): Promise<void> {\n const { formatInteractionHints, HorizontalRule, runCustomInteraction, sanitizeTerminalText } = await import(\n \"@narumitw/pi-tui-kit\"\n );\n\n while (!options.signal.aborted && options.isCurrent()) {\n const result = await runCustomInteraction<TuiMenuResult>(ctx, {\n signal: options.signal,\n isCurrent: options.isCurrent,\n onError: (errorCtx, error) => {\n if (!errorCtx.hasUI) return;\n const message = error instanceof Error ? error.message : String(error);\n errorCtx.ui.notify(sanitizeTerminalText(message), \"error\");\n },\n create: ({ tui, theme, keybindings, complete }) => {\n let symbols = [...options.getSymbols()];\n let widgetEnabled = options.getWidgetEnabled();\n const rawSearchInput = new Input();\n const searchInput = new Input();\n let selectedIndex = 0;\n let rows: Row[] = [];\n let busy = false;\n let disposed = false;\n let pasteActive = false;\n let errorMessage: string | undefined;\n let pending = Promise.resolve();\n const shortcutUp = shortcutAvailable(keybindings, \"shift+up\");\n const shortcutDown = shortcutAvailable(keybindings, \"shift+down\");\n const activationHint = (label: string) =>\n formatInteractionHints(keybindings, [{ bindings: [\"tui.select.confirm\"], keys: [\"space\"], label }]);\n const reorderKeys = [shortcutUp, shortcutDown].filter(\n (shortcut): shortcut is \"shift+up\" | \"shift+down\" => shortcut !== undefined,\n );\n const tickerDescription = `${[\n activationHint(\"removes this ticker\"),\n ...(reorderKeys.length > 0 ? [`${reorderKeys.join(\"/\")} changes its order`] : []),\n ].join(\"; \")}.`;\n const topRule = new HorizontalRule({\n label: \"Manage tickers\",\n labelAlignment: \"left\",\n ruleStyle: (text) => theme.fg(\"borderMuted\", text),\n labelStyle: (text) => theme.fg(\"accent\", text),\n });\n const bottomRule = new HorizontalRule({\n ruleStyle: (text) => theme.fg(\"borderMuted\", text),\n });\n const hint = formatInteractionHints(keybindings, [\n { bindings: [\"tui.select.up\", \"tui.select.down\"], label: \"select\" },\n ...(shortcutUp ? [{ keys: [shortcutUp], label: \"move up\" }] : []),\n ...(shortcutDown ? [{ keys: [shortcutDown], label: \"move down\" }] : []),\n { bindings: [\"tui.select.confirm\"], keys: [\"space\"], label: \"toggle/select\" },\n {\n bindings: [\"tui.select.cancel\"],\n excludeKeys: [\"ctrl+c\"],\n label: \"close\",\n },\n { keys: [\"ctrl+c\"], label: \"close\" },\n ]);\n\n const actionRows = (directSymbol?: string): ActionRow[] => [\n {\n kind: \"action\",\n id: \"add\",\n label: directSymbol ? `Add ${sanitizeTerminalText(directSymbol)}` : \"Add custom ticker\u2026\",\n description: directSymbol\n ? `${activationHint(`adds ${sanitizeTerminalText(directSymbol)} directly`)}.`\n : \"Add and select one Yahoo Finance symbol.\",\n },\n {\n kind: \"action\",\n id: \"widget\",\n label: `Widget: ${widgetEnabled ? \"On\" : \"Off\"}`,\n description: \"Show or hide the editor widget and persist this setting.\",\n },\n {\n kind: \"action\",\n id: \"refresh\",\n label: \"Refresh now\",\n description: widgetEnabled\n ? \"Fetch the selected symbols immediately.\"\n : \"Enable the widget before refreshing.\",\n },\n ];\n const buildRows = (): Row[] => {\n const tickerRows = symbols.map((symbol): TickerRow => ({ kind: \"ticker\", id: symbol, symbol }));\n const query = searchInput.getValue().toLowerCase();\n const filtered = fuzzyFilter(tickerRows, query, (row) =>\n sanitizeTerminalText(row.symbol.replaceAll(\"-\", \" \")).toLowerCase(),\n );\n const directSymbol = filtered.length === 0 ? tryDirectSymbol(rawSearchInput.getValue()) : undefined;\n return [...filtered, ...actionRows(directSymbol)];\n };\n const selectedRow = () => rows[selectedIndex];\n const rebuild = (preferredId?: string, fallbackIndex = selectedIndex) => {\n rows = buildRows();\n const preferredIndex = preferredId ? rows.findIndex((row) => row.id === preferredId) : -1;\n selectedIndex = preferredIndex >= 0 ? preferredIndex : Math.max(0, Math.min(fallbackIndex, rows.length - 1));\n tui.requestRender();\n };\n rebuild();\n\n const select = (index: number, wrap: boolean) => {\n if (rows.length === 0) return;\n selectedIndex = wrap ? (index + rows.length) % rows.length : Math.max(0, Math.min(index, rows.length - 1));\n tui.requestRender();\n };\n const persist = (\n nextSymbols: readonly string[],\n previousSymbols: readonly string[],\n preferredId: string | undefined,\n previousIndex: number,\n clearSearchOnSuccess = false,\n ) => {\n busy = true;\n errorMessage = undefined;\n symbols = [...nextSymbols];\n rebuild(preferredId, previousIndex);\n pending = (async () => {\n try {\n await options.applySymbols(symbols, options.signal);\n if (options.signal.aborted || !options.isCurrent()) return;\n symbols = [...options.getSymbols()];\n if (clearSearchOnSuccess) {\n rawSearchInput.setValue(\"\");\n searchInput.setValue(\"\");\n }\n } catch (error) {\n if (options.signal.aborted || !options.isCurrent()) return;\n symbols = [...previousSymbols];\n errorMessage = sanitizeTerminalText(error instanceof Error ? error.message : String(error));\n ctx.ui.notify(`Ticker settings were not saved: ${errorMessage}`, \"error\");\n } finally {\n busy = false;\n if (!disposed && !options.signal.aborted && options.isCurrent()) {\n rebuild(preferredId, previousIndex);\n }\n }\n })();\n };\n const persistWidgetEnabled = (nextWidgetEnabled: boolean) => {\n const previousWidgetEnabled = widgetEnabled;\n widgetEnabled = nextWidgetEnabled;\n busy = true;\n errorMessage = undefined;\n rebuild(\"widget\");\n pending = (async () => {\n try {\n await options.applyWidgetEnabled(nextWidgetEnabled, options.signal);\n if (options.signal.aborted || !options.isCurrent()) return;\n widgetEnabled = options.getWidgetEnabled();\n } catch (error) {\n if (options.signal.aborted || !options.isCurrent()) return;\n widgetEnabled = previousWidgetEnabled;\n errorMessage = sanitizeTerminalText(error instanceof Error ? error.message : String(error));\n ctx.ui.notify(`Ticker settings were not saved: ${errorMessage}`, \"error\");\n } finally {\n busy = false;\n if (!disposed && !options.signal.aborted && options.isCurrent()) rebuild(\"widget\");\n }\n })();\n };\n const toggle = () => {\n if (busy || disposed) return;\n const row = selectedRow();\n if (row?.kind !== \"ticker\") return;\n const previous = [...symbols];\n const next = symbols.filter((symbol) => symbol !== row.symbol);\n persist(next, previous, undefined, selectedIndex);\n };\n const moveTicker = (direction: -1 | 1) => {\n if (busy || disposed || rawSearchInput.getValue() || options.signal.aborted || !options.isCurrent()) {\n return;\n }\n const row = selectedRow();\n if (row?.kind !== \"ticker\") return;\n const from = symbols.indexOf(row.symbol);\n const to = from + direction;\n if (from < 0 || to < 0 || to >= symbols.length) return;\n const previous = [...symbols];\n const next = [...symbols];\n const [symbol] = next.splice(from, 1);\n if (!symbol) return;\n next.splice(to, 0, symbol);\n persist(next, previous, symbol, selectedIndex);\n };\n const activate = () => {\n if (busy || disposed) return;\n const row = selectedRow();\n if (!row) return;\n if (row.kind === \"ticker\") {\n toggle();\n return;\n }\n if (row.id === \"add\") {\n const query = rawSearchInput.getValue();\n const hasTickerMatch = rows.some((candidate) => candidate.kind === \"ticker\");\n if (query.trim() && !hasTickerMatch) {\n let symbol: string;\n try {\n symbol = parseDirectSymbol(query);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n errorMessage = sanitizeTerminalText(message);\n ctx.ui.notify(errorMessage, \"error\");\n tui.requestRender();\n return;\n }\n if (symbols.includes(symbol)) {\n ctx.ui.notify(`${symbol} is already selected.`, \"info\");\n return;\n }\n persist([...symbols, symbol], [...symbols], symbol, selectedIndex, true);\n return;\n }\n complete(\"add\");\n } else if (row.id === \"widget\") persistWidgetEnabled(!widgetEnabled);\n else options.refresh();\n };\n const handleSearch = (data: string) => {\n const previousId = selectedRow()?.id;\n errorMessage = undefined;\n rawSearchInput.handleInput(data);\n searchInput.handleInput(data);\n searchInput.setValue(sanitizeTerminalText(rawSearchInput.getValue()));\n rebuild(previousId, 0);\n };\n\n return {\n render(width: number) {\n const safeWidth = Number.isFinite(width) ? Math.max(0, Math.floor(width)) : 0;\n if (safeWidth === 0) return [\"\"];\n const viewportSize = availableRows(tui.terminal.rows, rows.length);\n const viewportStart = Math.max(\n 0,\n Math.min(selectedIndex - Math.floor(viewportSize / 2), rows.length - viewportSize),\n );\n const visibleRows = rows.slice(viewportStart, viewportStart + viewportSize);\n const content = visibleRows.map((row, offset) => {\n const index = viewportStart + offset;\n const focused = index === selectedIndex;\n const label =\n row.kind === \"ticker\"\n ? `${focused ? \"\u203A\" : \" \"} [x] ${sanitizeTerminalText(row.symbol)}`\n : `${focused ? \"\u203A\" : \" \"} ${row.label}`;\n const bounded = truncateToWidth(label, safeWidth, safeWidth > 1 ? \"\u2026\" : \"\");\n return focused ? theme.fg(\"accent\", bounded) : bounded;\n });\n if (viewportSize < rows.length) {\n content.push(theme.fg(\"dim\", truncateToWidth(` (${selectedIndex + 1}/${rows.length})`, safeWidth, \"\")));\n }\n const row = selectedRow();\n const description =\n row?.kind === \"ticker\"\n ? rawSearchInput.getValue()\n ? \"Clear search before reordering.\"\n : tickerDescription\n : row?.description;\n const status = errorMessage\n ? theme.fg(\"error\", errorMessage)\n : busy\n ? theme.fg(\"muted\", \"Saving changes\u2026\")\n : undefined;\n return [\n ...topRule.render(safeWidth),\n theme.fg(\n \"muted\",\n truncateToWidth(`${symbols.length} selected \u00B7 changes save immediately`, safeWidth, \"\"),\n ),\n ...searchInput.render(safeWidth).map((line) => truncateToWidth(line, safeWidth, \"\")),\n ...content,\n ...(description ? [theme.fg(\"dim\", truncateToWidth(` ${description}`, safeWidth, \"\"))] : []),\n ...(status ? [truncateToWidth(status, safeWidth, \"\")] : []),\n ...bottomRule.render(safeWidth),\n theme.fg(\"dim\", truncateToWidth(hint, safeWidth, \"\")),\n ];\n },\n invalidate() {\n searchInput.invalidate();\n },\n handleInput(data: string) {\n if (pasteActive || data.includes(PASTE_START)) {\n pasteActive = !data.includes(PASTE_END);\n handleSearch(data);\n return;\n }\n if (matchesKey(data, Key.ctrl(\"c\"))) {\n complete(\"close\");\n return;\n }\n if (keybindings.matches(data, \"tui.select.cancel\")) {\n complete(\"close\");\n return;\n }\n if (keybindings.matches(data, \"tui.select.up\")) {\n select(selectedIndex - 1, true);\n return;\n }\n if (keybindings.matches(data, \"tui.select.down\")) {\n select(selectedIndex + 1, true);\n return;\n }\n if (keybindings.matches(data, \"tui.select.pageUp\")) {\n select(selectedIndex - availableRows(tui.terminal.rows, rows.length), false);\n return;\n }\n if (keybindings.matches(data, \"tui.select.pageDown\")) {\n select(selectedIndex + availableRows(tui.terminal.rows, rows.length), false);\n return;\n }\n if (keybindings.matches(data, \"tui.select.confirm\") || data === \" \") {\n activate();\n return;\n }\n if (shortcutUp && matchesKey(data, shortcutUp)) {\n moveTicker(-1);\n return;\n }\n if (shortcutDown && matchesKey(data, shortcutDown)) {\n moveTicker(1);\n return;\n }\n handleSearch(data);\n },\n async waitForPending() {\n await pending;\n },\n dispose() {\n disposed = true;\n },\n get focused() {\n return searchInput.focused;\n },\n set focused(value: boolean) {\n searchInput.focused = value;\n },\n };\n },\n });\n\n if (result.kind !== \"completed\" || result.value === \"close\") return;\n const entered = await ctx.ui.input(\"Add custom ticker\", \"Yahoo symbol, for example MSFT or SOL-USD\", {\n signal: options.signal,\n });\n if (options.signal.aborted || !options.isCurrent()) return;\n if (!entered?.trim()) continue;\n try {\n const parsed = parseSymbols([entered]);\n if (parsed.length !== 1) throw new Error(\"Enter exactly one Yahoo Finance symbol.\");\n const symbol = parsed[0];\n if (!symbol) continue;\n const current = options.getSymbols();\n if (current.includes(symbol)) {\n ctx.ui.notify(`${symbol} is already selected.`, \"info\");\n continue;\n }\n await options.applySymbols([...current, symbol], options.signal);\n if (options.signal.aborted || !options.isCurrent()) return;\n } catch (error) {\n if (options.signal.aborted || !options.isCurrent()) return;\n const message = error instanceof Error ? error.message : String(error);\n ctx.ui.notify(sanitizeTerminalText(message), \"error\");\n }\n }\n}\n\nfunction parseDirectSymbol(value: string): string {\n const parsed = parseSymbols([value]);\n if (parsed.length !== 1) throw new Error(\"Enter exactly one Yahoo Finance symbol.\");\n const symbol = parsed[0];\n if (!symbol) throw new Error(\"Enter one Yahoo Finance symbol.\");\n return symbol;\n}\n\nfunction tryDirectSymbol(value: string): string | undefined {\n if (!value.trim()) return undefined;\n try {\n return parseDirectSymbol(value);\n } catch {\n return undefined;\n }\n}\n\nfunction availableRows(terminalRows: number, rowCount: number): number {\n const boundedRows = Number.isFinite(terminalRows) ? Math.max(1, Math.floor(terminalRows) - 9) : 10;\n return Math.max(1, Math.min(rowCount, boundedRows, 12));\n}\n\nfunction shortcutAvailable(\n keybindings: {\n getKeys(binding: string): readonly string[];\n },\n shortcut: \"shift+up\" | \"shift+down\",\n): typeof shortcut | undefined {\n const unavailable = new Set(\n [\n \"ctrl+c\",\n \"home\",\n \"end\",\n \"space\",\n ...RESERVED_INPUT_BINDINGS.flatMap((binding) => keybindings.getKeys(binding)),\n ].map(canonicalKey),\n );\n return unavailable.has(canonicalKey(shortcut)) ? undefined : shortcut;\n}\n\nfunction canonicalKey(value: string): string {\n const parts = value.toLowerCase().split(\"+\");\n const base = parts.at(-1) ?? \"\";\n const canonicalBase = base === \"escape\" ? \"esc\" : base === \"return\" ? \"enter\" : base;\n const modifiers = [\"ctrl\", \"shift\", \"alt\", \"super\"].filter((modifier) => parts.includes(modifier));\n return [...modifiers, canonicalBase].join(\"+\");\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;AACA,SAAS,aAAa,OAAO,KAAK,YAAY,uBAAuB;AAcrE,IAAM,cAAc;AACpB,IAAM,YAAY;AAElB,IAAM,0BAA0B;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKA,eAAsB,kBAAkB,KAA8B,SAA2C;AAC/G,QAAM,E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AI,CAAC,MAAM,KAAK,EAAG,QAAO;AAC1B,MAAI;AACF,WAAO,kBAAkB,KAAK;AAAA,EAChC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,SAAS,cAAc,cAAsB,UAA0B;AACrE,QAAM,cAAc,OAAO,SAAS,YAAY,IAAI,KAAK,IAAI,GAAG,KAAK,MAAM,YAAY,IAAI,CAAC,IAAI;AAChG,SAAO,KAAK,IAAI,GAAG,KAAK,IAAI,UAAU,aAAa,EAAE,CAAC;AACxD;AAEA,SAAS,kBACP,aAGA,UAC6B;AAC7B,QAAM,cAAc,IAAI;AAAA,IACtB;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG,wBAAwB,QAAQ,CAAC,YAAY,YAAY,QAAQ,OAAO,CAAC;AAAA,IAC9E,EAAE,IAAI,YAAY;AAAA,EACpB;AACA,SAAO,YAAY,IAAI,aAAa,QAAQ,CAAC,IAAI,SAAY;AAC/D;AAEA,SAAS,aAAa,OAAuB;AAC3C,QAAM,QAAQ,MAAM,YAAY,EAAE,MAAM,GAAG;AAC3C,QAAM,OAAO,MAAM,GAAG,EAAE,KAAK;AAC7B,QAAM,gBAAgB,SAAS,WAAW,QAAQ,SAAS,WAAW,UAAU;AAChF,QAAM,YAAY,CAAC,QAAQ,SAAS,OAAO,OAAO,EAAE,OAAO,CAAC,aAAa,MAAM,SAAS,QAAQ,CAAC;AACjG,SAAO,CAAC,GAAG,WAAW,aAAa,EAAE,KAAK,GAAG;AAC/C;",
|
|
6
|
+
"names": ["row"]
|
|
7
|
+
}
|
package/dist/index.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
loadSettings,
|
|
6
6
|
normalizeSymbols,
|
|
7
7
|
parseSymbols
|
|
8
|
-
} from "./chunks/chunk-
|
|
8
|
+
} from "./chunks/chunk-5QPNCY3F.ts";
|
|
9
9
|
|
|
10
10
|
// src/ticker.ts
|
|
11
11
|
import { join } from "node:path";
|
|
@@ -98,11 +98,7 @@ function renderTickerWidget(view, theme, width) {
|
|
|
98
98
|
separator,
|
|
99
99
|
renderWidth
|
|
100
100
|
);
|
|
101
|
-
return [
|
|
102
|
-
theme.fg("borderMuted", "\u2500".repeat(renderWidth)),
|
|
103
|
-
...fitLines(heading, renderWidth),
|
|
104
|
-
...quotes
|
|
105
|
-
];
|
|
101
|
+
return [theme.fg("borderMuted", "\u2500".repeat(renderWidth)), ...fitLines(heading, renderWidth), ...quotes];
|
|
106
102
|
}
|
|
107
103
|
function formatTickerPlain(view) {
|
|
108
104
|
const status = view.loading ? "Stocks \xB7 updating" : view.updatedAt ? `Stocks \xB7 updated ${new Date(view.updatedAt).toLocaleTimeString()}` : "Stocks";
|
|
@@ -323,7 +319,7 @@ function stockTicker(pi, dependencies = {}) {
|
|
|
323
319
|
const expectedGeneration = generation;
|
|
324
320
|
if (!controller || controller.signal.aborted || !ownsSession(ctx, expectedGeneration)) return;
|
|
325
321
|
const running = (async () => {
|
|
326
|
-
const { showTickerMenu } = await import("./chunks/menu-
|
|
322
|
+
const { showTickerMenu } = await import("./chunks/menu-L3RY6JMO.ts");
|
|
327
323
|
if (controller.signal.aborted || !ownsSession(ctx, expectedGeneration)) return;
|
|
328
324
|
await showTickerMenu(ctx, {
|
|
329
325
|
signal: controller.signal,
|
|
@@ -422,11 +418,7 @@ function stockTicker(pi, dependencies = {}) {
|
|
|
422
418
|
}
|
|
423
419
|
if (route === "refresh") {
|
|
424
420
|
if (!widgetEnabled) {
|
|
425
|
-
notify(
|
|
426
|
-
ctx,
|
|
427
|
-
"Ticker widget is disabled. Enable it with /ticker before refreshing.",
|
|
428
|
-
"warning"
|
|
429
|
-
);
|
|
421
|
+
notify(ctx, "Ticker widget is disabled. Enable it with /ticker before refreshing.", "warning");
|
|
430
422
|
return;
|
|
431
423
|
}
|
|
432
424
|
if (ownsSession(ctx)) startCycle(ctx);
|
|
@@ -434,11 +426,7 @@ function stockTicker(pi, dependencies = {}) {
|
|
|
434
426
|
return;
|
|
435
427
|
}
|
|
436
428
|
if (route === "reset") {
|
|
437
|
-
notify(
|
|
438
|
-
ctx,
|
|
439
|
-
"No default ticker list is configured. Use /ticker SYMBOL ... instead.",
|
|
440
|
-
"error"
|
|
441
|
-
);
|
|
429
|
+
notify(ctx, "No default ticker list is configured. Use /ticker SYMBOL ... instead.", "error");
|
|
442
430
|
return;
|
|
443
431
|
}
|
|
444
432
|
let nextSymbols;
|