opencode-agora 0.2.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/README.md +217 -52
  2. package/dist/cli/app.d.ts +3 -0
  3. package/dist/cli/app.d.ts.map +1 -1
  4. package/dist/cli/app.js +1202 -227
  5. package/dist/cli/app.js.map +1 -1
  6. package/dist/cli/chat-renderer.d.ts +31 -0
  7. package/dist/cli/chat-renderer.d.ts.map +1 -0
  8. package/dist/cli/chat-renderer.js +275 -0
  9. package/dist/cli/chat-renderer.js.map +1 -0
  10. package/dist/cli/commands-meta.d.ts +21 -0
  11. package/dist/cli/commands-meta.d.ts.map +1 -0
  12. package/dist/cli/commands-meta.js +600 -0
  13. package/dist/cli/commands-meta.js.map +1 -0
  14. package/dist/cli/completions.d.ts +18 -0
  15. package/dist/cli/completions.d.ts.map +1 -0
  16. package/dist/cli/completions.js +190 -0
  17. package/dist/cli/completions.js.map +1 -0
  18. package/dist/cli/mcp-server.d.ts +4 -0
  19. package/dist/cli/mcp-server.d.ts.map +1 -0
  20. package/dist/cli/mcp-server.js +277 -0
  21. package/dist/cli/mcp-server.js.map +1 -0
  22. package/dist/cli/menu.d.ts +7 -0
  23. package/dist/cli/menu.d.ts.map +1 -0
  24. package/dist/cli/menu.js +164 -0
  25. package/dist/cli/menu.js.map +1 -0
  26. package/dist/cli/pages/community.d.ts +3 -0
  27. package/dist/cli/pages/community.d.ts.map +1 -0
  28. package/dist/cli/pages/community.js +276 -0
  29. package/dist/cli/pages/community.js.map +1 -0
  30. package/dist/cli/pages/helpers.d.ts +32 -0
  31. package/dist/cli/pages/helpers.d.ts.map +1 -0
  32. package/dist/cli/pages/helpers.js +67 -0
  33. package/dist/cli/pages/helpers.js.map +1 -0
  34. package/dist/cli/pages/home.d.ts +3 -0
  35. package/dist/cli/pages/home.d.ts.map +1 -0
  36. package/dist/cli/pages/home.js +148 -0
  37. package/dist/cli/pages/home.js.map +1 -0
  38. package/dist/cli/pages/marketplace.d.ts +3 -0
  39. package/dist/cli/pages/marketplace.d.ts.map +1 -0
  40. package/dist/cli/pages/marketplace.js +179 -0
  41. package/dist/cli/pages/marketplace.js.map +1 -0
  42. package/dist/cli/pages/news.d.ts +3 -0
  43. package/dist/cli/pages/news.d.ts.map +1 -0
  44. package/dist/cli/pages/news.js +561 -0
  45. package/dist/cli/pages/news.js.map +1 -0
  46. package/dist/cli/pages/settings.d.ts +3 -0
  47. package/dist/cli/pages/settings.d.ts.map +1 -0
  48. package/dist/cli/pages/settings.js +166 -0
  49. package/dist/cli/pages/settings.js.map +1 -0
  50. package/dist/cli/pages/types.d.ts +67 -0
  51. package/dist/cli/pages/types.d.ts.map +1 -0
  52. package/dist/cli/pages/types.js +2 -0
  53. package/dist/cli/pages/types.js.map +1 -0
  54. package/dist/cli/prompter.d.ts +135 -0
  55. package/dist/cli/prompter.d.ts.map +1 -0
  56. package/dist/cli/prompter.js +675 -0
  57. package/dist/cli/prompter.js.map +1 -0
  58. package/dist/cli/shell.d.ts +23 -0
  59. package/dist/cli/shell.d.ts.map +1 -0
  60. package/dist/cli/shell.js +819 -0
  61. package/dist/cli/shell.js.map +1 -0
  62. package/dist/cli/tui.d.ts +7 -0
  63. package/dist/cli/tui.d.ts.map +1 -0
  64. package/dist/cli/tui.js +373 -0
  65. package/dist/cli/tui.js.map +1 -0
  66. package/dist/cli.js +1 -1
  67. package/dist/cli.js.map +1 -1
  68. package/dist/commands.d.ts +14 -0
  69. package/dist/commands.d.ts.map +1 -0
  70. package/dist/commands.js +28 -0
  71. package/dist/commands.js.map +1 -0
  72. package/dist/community/client.d.ts +47 -0
  73. package/dist/community/client.d.ts.map +1 -0
  74. package/dist/community/client.js +245 -0
  75. package/dist/community/client.js.map +1 -0
  76. package/dist/community/types.d.ts +50 -0
  77. package/dist/community/types.d.ts.map +1 -0
  78. package/dist/community/types.js +11 -0
  79. package/dist/community/types.js.map +1 -0
  80. package/dist/config-files.d.ts.map +1 -1
  81. package/dist/config-files.js +11 -8
  82. package/dist/config-files.js.map +1 -1
  83. package/dist/config.d.ts +8 -8
  84. package/dist/config.d.ts.map +1 -1
  85. package/dist/config.js +16 -27
  86. package/dist/config.js.map +1 -1
  87. package/dist/data.d.ts +1 -1
  88. package/dist/data.d.ts.map +1 -1
  89. package/dist/data.js +1013 -545
  90. package/dist/data.js.map +1 -1
  91. package/dist/format.d.ts +5 -39
  92. package/dist/format.d.ts.map +1 -1
  93. package/dist/format.js +5 -118
  94. package/dist/format.js.map +1 -1
  95. package/dist/history.d.ts +13 -0
  96. package/dist/history.d.ts.map +1 -0
  97. package/dist/history.js +37 -0
  98. package/dist/history.js.map +1 -0
  99. package/dist/index.d.ts.map +1 -1
  100. package/dist/index.js +151 -236
  101. package/dist/index.js.map +1 -1
  102. package/dist/init.d.ts +4 -1
  103. package/dist/init.d.ts.map +1 -1
  104. package/dist/init.js +103 -51
  105. package/dist/init.js.map +1 -1
  106. package/dist/live.d.ts +4 -0
  107. package/dist/live.d.ts.map +1 -1
  108. package/dist/live.js +87 -19
  109. package/dist/live.js.map +1 -1
  110. package/dist/marketplace.d.ts +9 -0
  111. package/dist/marketplace.d.ts.map +1 -1
  112. package/dist/marketplace.js +128 -33
  113. package/dist/marketplace.js.map +1 -1
  114. package/dist/news/cache.d.ts +13 -0
  115. package/dist/news/cache.d.ts.map +1 -0
  116. package/dist/news/cache.js +65 -0
  117. package/dist/news/cache.js.map +1 -0
  118. package/dist/news/score.d.ts +4 -0
  119. package/dist/news/score.d.ts.map +1 -0
  120. package/dist/news/score.js +43 -0
  121. package/dist/news/score.js.map +1 -0
  122. package/dist/news/sources/arxiv.d.ts +9 -0
  123. package/dist/news/sources/arxiv.d.ts.map +1 -0
  124. package/dist/news/sources/arxiv.js +103 -0
  125. package/dist/news/sources/arxiv.js.map +1 -0
  126. package/dist/news/sources/github-trending.d.ts +9 -0
  127. package/dist/news/sources/github-trending.d.ts.map +1 -0
  128. package/dist/news/sources/github-trending.js +93 -0
  129. package/dist/news/sources/github-trending.js.map +1 -0
  130. package/dist/news/sources/hn.d.ts +9 -0
  131. package/dist/news/sources/hn.d.ts.map +1 -0
  132. package/dist/news/sources/hn.js +53 -0
  133. package/dist/news/sources/hn.js.map +1 -0
  134. package/dist/news/sources/reddit.d.ts +9 -0
  135. package/dist/news/sources/reddit.d.ts.map +1 -0
  136. package/dist/news/sources/reddit.js +68 -0
  137. package/dist/news/sources/reddit.js.map +1 -0
  138. package/dist/news/sources/rss.d.ts +14 -0
  139. package/dist/news/sources/rss.d.ts.map +1 -0
  140. package/dist/news/sources/rss.js +102 -0
  141. package/dist/news/sources/rss.js.map +1 -0
  142. package/dist/news/types.d.ts +39 -0
  143. package/dist/news/types.d.ts.map +1 -0
  144. package/dist/news/types.js +47 -0
  145. package/dist/news/types.js.map +1 -0
  146. package/dist/preferences.d.ts +14 -0
  147. package/dist/preferences.d.ts.map +1 -0
  148. package/dist/preferences.js +31 -0
  149. package/dist/preferences.js.map +1 -0
  150. package/dist/settings.d.ts +26 -0
  151. package/dist/settings.d.ts.map +1 -0
  152. package/dist/settings.js +257 -0
  153. package/dist/settings.js.map +1 -0
  154. package/dist/state.d.ts.map +1 -1
  155. package/dist/state.js +7 -6
  156. package/dist/state.js.map +1 -1
  157. package/dist/transcript.d.ts +28 -0
  158. package/dist/transcript.d.ts.map +1 -0
  159. package/dist/transcript.js +79 -0
  160. package/dist/transcript.js.map +1 -0
  161. package/dist/types.d.ts +6 -1
  162. package/dist/types.d.ts.map +1 -1
  163. package/dist/ui.d.ts +157 -0
  164. package/dist/ui.d.ts.map +1 -0
  165. package/dist/ui.js +296 -0
  166. package/dist/ui.js.map +1 -0
  167. package/package.json +21 -10
  168. package/dist/api.d.ts +0 -69
  169. package/dist/api.d.ts.map +0 -1
  170. package/dist/api.js +0 -109
  171. package/dist/api.js.map +0 -1
  172. package/dist/logger.d.ts +0 -20
  173. package/dist/logger.d.ts.map +0 -1
  174. package/dist/logger.js +0 -59
  175. package/dist/logger.js.map +0 -1
package/dist/ui.d.ts ADDED
@@ -0,0 +1,157 @@
1
+ /**
2
+ * Terminal styling for the agora CLI — a flat, minimal look: one accent colour
3
+ * for identifiers, dim for everything secondary, plain foreground for body text,
4
+ * plus a gradient wordmark banner and a rounded header frame for the standalone
5
+ * hub experience.
6
+ *
7
+ * Colour is opt-in. It is emitted only to an interactive TTY, and never under
8
+ * `NO_COLOR`, `TERM=dumb`, or `--json`. Non-TTY callers (pipes, the test
9
+ * harness) get plain strings, so output stays assertable.
10
+ *
11
+ * The wordmark art, gradient, and accent colour below come from the Claude
12
+ * Design handoff (docs/claude-design-brief.md → `agora-wordmark.ts`). Palette:
13
+ * "agora at golden hour" — Aegean blue → marble warm → terracotta.
14
+ */
15
+ export type RGB = [number, number, number];
16
+ export interface Styler {
17
+ accent(value: string): string;
18
+ dim(value: string): string;
19
+ bold(value: string): string;
20
+ orange(value: string): string;
21
+ }
22
+ /**
23
+ * ACCENT — used for package identifiers in list output. A desaturated amber:
24
+ * high contrast on both light and dark terminals, and distinct from the
25
+ * gradient stops so ids never blend into the banner.
26
+ */
27
+ export declare const ACCENT: {
28
+ readonly hex: "#D4A85A";
29
+ readonly rgb: RGB;
30
+ readonly ansi256: 179;
31
+ readonly ansiBasic: 33;
32
+ };
33
+ export declare const ORANGE: {
34
+ readonly hex: "#FF8C00";
35
+ readonly rgb: RGB;
36
+ readonly ansi256: 208;
37
+ readonly ansiBasic: 33;
38
+ };
39
+ /**
40
+ * Builds a styler. The accent colour is emitted as 24-bit when the terminal
41
+ * advertises truecolor, otherwise as the nearest xterm-256 cube colour.
42
+ */
43
+ export declare function createStyler(useColor: boolean, trueColor?: boolean): Styler;
44
+ export declare function shouldUseColor(stream: {
45
+ isTTY?: boolean;
46
+ }, env: Record<string, string | undefined>, json: boolean): boolean;
47
+ /** 24-bit colour is only safe to emit when the terminal advertises it. */
48
+ export declare function supportsTrueColor(env: Record<string, string | undefined>): boolean;
49
+ /**
50
+ * Carved-relief letterforms (7 rows × 52 cols). Built from a SOLID skeleton +
51
+ * an algorithmic shading pass: cells whose neighbour above is empty get `▓`
52
+ * (top highlight), cells whose neighbour below is empty get `▒` (bottom
53
+ * shadow), plus a few weather specks on stroke interiors. The pass only ever
54
+ * rewrites existing `█` cells, so it cannot bleed into the O / R counters.
55
+ * Reads as top-lit carved stone; survives `NO_COLOR` because the texture is
56
+ * in the *characters*, not the colours.
57
+ */
58
+ export declare const AGORA_WORDMARK_RELIEF: string[];
59
+ /**
60
+ * BANNER_GRADIENT — 3 stops sampled across the wordmark's columns.
61
+ * "Marble & terracotta": warm cream → terracotta → deep brick. A purely
62
+ * warm Mediterranean sweep; neither endpoint touches pure black or white,
63
+ * so it holds contrast on either terminal background.
64
+ */
65
+ export declare const BANNER_GRADIENT: RGB[];
66
+ export declare function colorize(char: string, rgb: RGB, trueColor: boolean): string;
67
+ export declare function sampleGradient(stops: RGB[], t: number): RGB;
68
+ /** Colorizes each character of `text` across BANNER_GRADIENT stops. */
69
+ export declare function gradientText(text: string, opts: {
70
+ trueColor: boolean;
71
+ }): string;
72
+ export interface BannerOptions {
73
+ color: boolean;
74
+ trueColor: boolean;
75
+ /** Dim line printed under the wordmark. */
76
+ subtitle?: string;
77
+ }
78
+ /**
79
+ * Renders the AGORA wordmark with a left-to-right gradient applied per column
80
+ * (so the gradient stays aligned across all rows), followed by an optional
81
+ * dim subtitle. Degrades to plain block letters when colour is off.
82
+ */
83
+ export declare function renderBanner(opts: BannerOptions): string;
84
+ export interface BoxOptions {
85
+ color: boolean;
86
+ trueColor: boolean;
87
+ }
88
+ /**
89
+ * A calm rounded-corner frame for the welcome header — rounded corners, single
90
+ * sides, a half-block "pillar" prefix on each content line (the pillar reads as
91
+ * a small column — fitting for the agora). The first line is the bold accent
92
+ * title; the rest are dim body text. Border and pillar are accent-tinted; body
93
+ * text is left uncoloured per the design spec.
94
+ */
95
+ export declare function renderBox(title: string, body: string[], opts: BoxOptions): string;
96
+ /**
97
+ * One tint per chat-movement kind so a transcript reads at a glance:
98
+ * thinking = cool grey-tan (low energy), tool = terracotta (mid), response =
99
+ * accent amber (full). All three sit inside the BANNER_GRADIENT palette.
100
+ */
101
+ export declare const MOVEMENT_COLOR: {
102
+ readonly thinking: {
103
+ readonly hex: "#8A7866";
104
+ readonly rgb: RGB;
105
+ };
106
+ readonly tool: {
107
+ readonly hex: "#C66A4A";
108
+ readonly rgb: RGB;
109
+ };
110
+ readonly response: {
111
+ readonly hex: "#D4A85A";
112
+ readonly rgb: RGB;
113
+ };
114
+ };
115
+ export type MovementKind = keyof typeof MOVEMENT_COLOR;
116
+ /** Colorize `▍` with the tint for a given movement kind. */
117
+ export declare function movementBar(kind: MovementKind, opts: {
118
+ trueColor: boolean;
119
+ }): string;
120
+ /**
121
+ * 52-cell middle row of zigzag teeth — alternating upper-half / lower-half
122
+ * blocks. In a 3-row frieze the teeth attach to the top bar (`▀▀`) and the
123
+ * bottom bar (`▄▄`) alternately, creating voids that zigzag between top and
124
+ * bottom — the classic Greek-key reading.
125
+ */
126
+ export declare const MEANDER: string;
127
+ export interface MeanderOptions {
128
+ trueColor: boolean;
129
+ /** Render mode: `idle` (default), `wave`, or `progress`. */
130
+ mode?: 'idle' | 'wave' | 'progress';
131
+ /** For `wave`: elapsed time in ms. The head moves at ~18 cells/sec. */
132
+ tMs?: number;
133
+ /** For `progress`: 0–100. */
134
+ pct?: number;
135
+ }
136
+ /**
137
+ * Render the meander. `idle` and `wave` return a 3-row Greek-key ribbon
138
+ * (solid bar + square teeth + solid bar). `progress` returns a single inline
139
+ * row of square teeth so it can be redrawn in place with `\r`.
140
+ */
141
+ export declare function renderMeander(opts: MeanderOptions): string;
142
+ /**
143
+ * 5-char dancing figure built from the top of an Ionic column: the corner
144
+ * brackets `╭ ╮ ╰ ╯` form the *abacus* (flat slab), the two `⊙` characters
145
+ * are the *volutes* (spiral scrolls), and the `─` between them is the
146
+ * *echinus*. Only the abacus corners swap between frames — the volutes and
147
+ * echinus are fixed — so the eye reads it as one figure swaying, not four
148
+ * different glyphs flickering.
149
+ *
150
+ * Lifecycle: paint while a `thinking` movement is in flight; clear the line
151
+ * on the first response token so the user's eye lands on the answer, not the
152
+ * dance. Survives `NO_COLOR` because the silhouette is in the characters.
153
+ */
154
+ export declare const MASCOT_FRAMES: readonly string[];
155
+ /** Pick the current mascot frame given elapsed thinking time in ms. */
156
+ export declare function mascotFrame(tMs: number): string;
157
+ //# sourceMappingURL=ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE3C,MAAM,WAAW,MAAM;IACrB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CAC/B;AAID;;;;GAIG;AACH,eAAO,MAAM,MAAM;;kBAEM,GAAG;;;CAGlB,CAAC;AAEX,eAAO,MAAM,MAAM;;kBAEK,GAAG;;;CAGjB,CAAC;AASX;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,UAAQ,GAAG,MAAM,CAezE;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,EAC3B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EACvC,IAAI,EAAE,OAAO,GACZ,OAAO,CAKT;AAED,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SA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AAID;;;;;GAKG;AACH,eAAO,MAAM,OAAO,QAAoB,CAAC;AAQzC,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,OAAO,CAAC;IACnB,4DAA4D;IAC5D,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;IACpC,uEAAuE;IACvE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAwCD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAU1D;AAID;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAKjC,CAAC;AAEX,uEAAuE;AACvE,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C"}
package/dist/ui.js ADDED
@@ -0,0 +1,296 @@
1
+ /**
2
+ * Terminal styling for the agora CLI — a flat, minimal look: one accent colour
3
+ * for identifiers, dim for everything secondary, plain foreground for body text,
4
+ * plus a gradient wordmark banner and a rounded header frame for the standalone
5
+ * hub experience.
6
+ *
7
+ * Colour is opt-in. It is emitted only to an interactive TTY, and never under
8
+ * `NO_COLOR`, `TERM=dumb`, or `--json`. Non-TTY callers (pipes, the test
9
+ * harness) get plain strings, so output stays assertable.
10
+ *
11
+ * The wordmark art, gradient, and accent colour below come from the Claude
12
+ * Design handoff (docs/claude-design-brief.md → `agora-wordmark.ts`). Palette:
13
+ * "agora at golden hour" — Aegean blue → marble warm → terracotta.
14
+ */
15
+ const RESET = '\x1b[0m';
16
+ /**
17
+ * ACCENT — used for package identifiers in list output. A desaturated amber:
18
+ * high contrast on both light and dark terminals, and distinct from the
19
+ * gradient stops so ids never blend into the banner.
20
+ */
21
+ export const ACCENT = {
22
+ hex: '#D4A85A',
23
+ rgb: [212, 168, 90],
24
+ ansi256: 179, // xterm-256 warm gold
25
+ ansiBasic: 33 // ANSI yellow (fg) — 16-colour fallback
26
+ };
27
+ export const ORANGE = {
28
+ hex: '#FF8C00',
29
+ rgb: [255, 140, 0],
30
+ ansi256: 208,
31
+ ansiBasic: 33
32
+ };
33
+ const plain = {
34
+ accent: (value) => value,
35
+ dim: (value) => value,
36
+ bold: (value) => value,
37
+ orange: (value) => value
38
+ };
39
+ /**
40
+ * Builds a styler. The accent colour is emitted as 24-bit when the terminal
41
+ * advertises truecolor, otherwise as the nearest xterm-256 cube colour.
42
+ */
43
+ export function createStyler(useColor, trueColor = false) {
44
+ if (!useColor)
45
+ return plain;
46
+ const accentCode = trueColor
47
+ ? `38;2;${ACCENT.rgb[0]};${ACCENT.rgb[1]};${ACCENT.rgb[2]}`
48
+ : `38;5;${ACCENT.ansi256}`;
49
+ const wrap = (code) => (value) => `\x1b[${code}m${value}${RESET}`;
50
+ const orangeCode = trueColor
51
+ ? `38;2;${ORANGE.rgb[0]};${ORANGE.rgb[1]};${ORANGE.rgb[2]}`
52
+ : `38;5;${ORANGE.ansi256}`;
53
+ return {
54
+ accent: wrap(accentCode),
55
+ dim: wrap('2'),
56
+ bold: wrap('1'),
57
+ orange: wrap(orangeCode)
58
+ };
59
+ }
60
+ export function shouldUseColor(stream, env, json) {
61
+ if (json)
62
+ return false;
63
+ if (env.NO_COLOR != null)
64
+ return false;
65
+ if (env.TERM === 'dumb')
66
+ return false;
67
+ return Boolean(stream.isTTY);
68
+ }
69
+ /** 24-bit colour is only safe to emit when the terminal advertises it. */
70
+ export function supportsTrueColor(env) {
71
+ const colorterm = env.COLORTERM ?? '';
72
+ return colorterm === 'truecolor' || colorterm === '24bit';
73
+ }
74
+ // ── Wordmark + banner ───────────────────────────────────────────────────────
75
+ /**
76
+ * Carved-relief letterforms (7 rows × 52 cols). Built from a SOLID skeleton +
77
+ * an algorithmic shading pass: cells whose neighbour above is empty get `▓`
78
+ * (top highlight), cells whose neighbour below is empty get `▒` (bottom
79
+ * shadow), plus a few weather specks on stroke interiors. The pass only ever
80
+ * rewrites existing `█` cells, so it cannot bleed into the O / R counters.
81
+ * Reads as top-lit carved stone; survives `NO_COLOR` because the texture is
82
+ * in the *characters*, not the colours.
83
+ */
84
+ export const AGORA_WORDMARK_RELIEF = [
85
+ ' ▓▓▓ ▓▓▓▓▓ ▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓ ',
86
+ ' ▓▒▒▒▓ ▓█ ▒▓ ▓█ █▓ ██ █▓ ▓▒▒▒▓ ',
87
+ ' ▓▒ █▓ █▒ █▒ ██ █▒ █▒ ▓▒ █▓ ',
88
+ ' ██ ▒█ ██ ▓▓▓▓ ██ ██ ██▓▓▓▒ ██ ▒█ ',
89
+ ' ██▓▓▓██ ██ ▒█ ██ █▒ ██ ▒▒ ██▓▓▓██ ',
90
+ ' ██ █▒ ▒█ █▒ ▒█ █▒ ██ ▒▓ ██ █▒ ',
91
+ ' ▒▒ ▒▒ ▒▓▓▓▒ ▒▓▓▓▒ ▒▒ ▒▓ ▒▒ ▒▒ '
92
+ ];
93
+ /**
94
+ * BANNER_GRADIENT — 3 stops sampled across the wordmark's columns.
95
+ * "Marble & terracotta": warm cream → terracotta → deep brick. A purely
96
+ * warm Mediterranean sweep; neither endpoint touches pure black or white,
97
+ * so it holds contrast on either terminal background.
98
+ */
99
+ export const BANNER_GRADIENT = [
100
+ [220, 196, 158], // #DCC49E warm cream
101
+ [198, 106, 74], // #C66A4A terracotta
102
+ [148, 64, 56] // #944038 deep brick
103
+ ];
104
+ function lerp(a, b, t) {
105
+ return Math.round(a + (b - a) * t);
106
+ }
107
+ /** Nearest colour in the xterm-256 6×6×6 cube — the fallback when truecolor is off. */
108
+ function rgbTo256(rgb) {
109
+ const axis = (v) => Math.round((v / 255) * 5);
110
+ return 16 + 36 * axis(rgb[0]) + 6 * axis(rgb[1]) + axis(rgb[2]);
111
+ }
112
+ export function colorize(char, rgb, trueColor) {
113
+ const code = trueColor ? `38;2;${rgb[0]};${rgb[1]};${rgb[2]}` : `38;5;${rgbTo256(rgb)}`;
114
+ return `\x1b[${code}m${char}${RESET}`;
115
+ }
116
+ export function sampleGradient(stops, t) {
117
+ if (stops.length === 1)
118
+ return stops[0];
119
+ const clamped = Math.min(1, Math.max(0, t));
120
+ const span = clamped * (stops.length - 1);
121
+ const index = Math.min(stops.length - 2, Math.floor(span));
122
+ const local = span - index;
123
+ const from = stops[index];
124
+ const to = stops[index + 1];
125
+ return [lerp(from[0], to[0], local), lerp(from[1], to[1], local), lerp(from[2], to[2], local)];
126
+ }
127
+ /** Colorizes each character of `text` across BANNER_GRADIENT stops. */
128
+ export function gradientText(text, opts) {
129
+ if (text.length === 0)
130
+ return text;
131
+ let out = '';
132
+ for (let i = 0; i < text.length; i++) {
133
+ const t = text.length === 1 ? 0 : i / (text.length - 1);
134
+ const rgb = sampleGradient(BANNER_GRADIENT, t);
135
+ out += colorize(text[i], rgb, opts.trueColor);
136
+ }
137
+ return out;
138
+ }
139
+ /**
140
+ * Renders the AGORA wordmark with a left-to-right gradient applied per column
141
+ * (so the gradient stays aligned across all rows), followed by an optional
142
+ * dim subtitle. Degrades to plain block letters when colour is off.
143
+ */
144
+ export function renderBanner(opts) {
145
+ const rows = AGORA_WORDMARK_RELIEF;
146
+ const width = Math.max(...rows.map((line) => line.length));
147
+ const lines = rows.map((line) => {
148
+ if (!opts.color)
149
+ return line;
150
+ let out = '';
151
+ for (let col = 0; col < line.length; col += 1) {
152
+ const char = line[col];
153
+ if (char === ' ') {
154
+ out += char;
155
+ continue;
156
+ }
157
+ const rgb = sampleGradient(BANNER_GRADIENT, col / (width - 1));
158
+ out += colorize(char, rgb, opts.trueColor);
159
+ }
160
+ return out;
161
+ });
162
+ if (opts.subtitle) {
163
+ const subtitle = opts.color ? `\x1b[2m${opts.subtitle}${RESET}` : opts.subtitle;
164
+ lines.push('', subtitle);
165
+ }
166
+ return lines.join('\n');
167
+ }
168
+ /**
169
+ * A calm rounded-corner frame for the welcome header — rounded corners, single
170
+ * sides, a half-block "pillar" prefix on each content line (the pillar reads as
171
+ * a small column — fitting for the agora). The first line is the bold accent
172
+ * title; the rest are dim body text. Border and pillar are accent-tinted; body
173
+ * text is left uncoloured per the design spec.
174
+ */
175
+ export function renderBox(title, body, opts) {
176
+ const styler = createStyler(opts.color, opts.trueColor);
177
+ const contentLines = [title, ...body];
178
+ const textWidth = Math.max(...contentLines.map((line) => line.length));
179
+ // layout per row: │ + 2 pad + "▍ " + text(textWidth) + 2 pad + │
180
+ const inner = 2 + 2 + textWidth + 2;
181
+ const top = styler.accent(`╭${'─'.repeat(inner)}╮`);
182
+ const bottom = styler.accent(`╰${'─'.repeat(inner)}╯`);
183
+ const blank = `${styler.accent('│')}${' '.repeat(inner)}${styler.accent('│')}`;
184
+ const row = (text, isTitle) => {
185
+ const trailing = ' '.repeat(textWidth - text.length);
186
+ const styledText = isTitle ? styler.bold(text) : text;
187
+ return `${styler.accent('│')} ${styler.accent('▍')} ${styledText}${trailing} ${styler.accent('│')}`;
188
+ };
189
+ return [top, blank, ...contentLines.map((line, i) => row(line, i === 0)), blank, bottom].join('\n');
190
+ }
191
+ // ── Movement tints — distinct per-kind accent for the ▍ marker ──────────────
192
+ /**
193
+ * One tint per chat-movement kind so a transcript reads at a glance:
194
+ * thinking = cool grey-tan (low energy), tool = terracotta (mid), response =
195
+ * accent amber (full). All three sit inside the BANNER_GRADIENT palette.
196
+ */
197
+ export const MOVEMENT_COLOR = {
198
+ thinking: { hex: '#8A7866', rgb: [138, 120, 102] },
199
+ tool: { hex: '#C66A4A', rgb: [198, 106, 74] },
200
+ response: { hex: '#D4A85A', rgb: [212, 168, 90] }
201
+ };
202
+ /** Colorize `▍` with the tint for a given movement kind. */
203
+ export function movementBar(kind, opts) {
204
+ return colorize('▍', MOVEMENT_COLOR[kind].rgb, opts.trueColor);
205
+ }
206
+ // ── Meander — Greek-key frieze + loading bar ────────────────────────────────
207
+ /**
208
+ * 52-cell middle row of zigzag teeth — alternating upper-half / lower-half
209
+ * blocks. In a 3-row frieze the teeth attach to the top bar (`▀▀`) and the
210
+ * bottom bar (`▄▄`) alternately, creating voids that zigzag between top and
211
+ * bottom — the classic Greek-key reading.
212
+ */
213
+ export const MEANDER = '▀▀▄▄'.repeat(13);
214
+ /** Solid 52-cell bar — the top and bottom of the Greek-key frieze. */
215
+ const MEANDER_BAR = '█'.repeat(52);
216
+ const MEANDER_DIM = [107, 98, 83]; // #6B6253 — brightened for dark terminal visibility
217
+ const MEANDER_TAIL = [122, 90, 72]; // #7A5A48 — warm-dim trailing tail
218
+ /** Per-cell colour for the indeterminate wave at time `tMs`. */
219
+ function meanderWaveColor(i, tMs) {
220
+ const speed = 0.018; // cells per ms
221
+ const period = MEANDER.length + 8; // 8-cell pause between sweeps
222
+ const head = Math.floor(tMs * speed) % period;
223
+ const dist = (head - i + period) % period;
224
+ if (dist === 0)
225
+ return ACCENT.rgb;
226
+ if (dist <= 2)
227
+ return MOVEMENT_COLOR.tool.rgb;
228
+ if (dist <= 4)
229
+ return MEANDER_TAIL;
230
+ return MEANDER_DIM;
231
+ }
232
+ /** Per-cell colour for the determinate progress bar at `pct`. */
233
+ function meanderProgressColor(i, pct) {
234
+ const n = MEANDER.length;
235
+ const filled = Math.round((n * Math.max(0, Math.min(100, pct))) / 100);
236
+ if (i < filled - 1)
237
+ return ACCENT.rgb;
238
+ if (i === filled - 1)
239
+ return MOVEMENT_COLOR.tool.rgb;
240
+ return MEANDER_DIM;
241
+ }
242
+ function renderMeanderRow(row, mode, opts) {
243
+ let out = '';
244
+ for (let i = 0; i < row.length; i++) {
245
+ const ch = row[i];
246
+ let rgb;
247
+ if (mode === 'wave')
248
+ rgb = meanderWaveColor(i, opts.tMs ?? 0);
249
+ else if (mode === 'progress')
250
+ rgb = meanderProgressColor(i, opts.pct ?? 0);
251
+ else
252
+ rgb = MEANDER_DIM;
253
+ out += colorize(ch, rgb, opts.trueColor);
254
+ }
255
+ return out;
256
+ }
257
+ /**
258
+ * Render the meander. `idle` and `wave` return a 3-row Greek-key ribbon
259
+ * (solid bar + square teeth + solid bar). `progress` returns a single inline
260
+ * row of square teeth so it can be redrawn in place with `\r`.
261
+ */
262
+ export function renderMeander(opts) {
263
+ const mode = opts.mode ?? 'idle';
264
+ if (mode === 'progress') {
265
+ return renderMeanderRow(MEANDER, mode, opts);
266
+ }
267
+ return [
268
+ renderMeanderRow(MEANDER_BAR, mode, opts),
269
+ renderMeanderRow(MEANDER, mode, opts),
270
+ renderMeanderRow(MEANDER_BAR, mode, opts)
271
+ ].join('\n');
272
+ }
273
+ // ── Mascot — Ionic column capital that dances while the model thinks ────────
274
+ /**
275
+ * 5-char dancing figure built from the top of an Ionic column: the corner
276
+ * brackets `╭ ╮ ╰ ╯` form the *abacus* (flat slab), the two `⊙` characters
277
+ * are the *volutes* (spiral scrolls), and the `─` between them is the
278
+ * *echinus*. Only the abacus corners swap between frames — the volutes and
279
+ * echinus are fixed — so the eye reads it as one figure swaying, not four
280
+ * different glyphs flickering.
281
+ *
282
+ * Lifecycle: paint while a `thinking` movement is in flight; clear the line
283
+ * on the first response token so the user's eye lands on the answer, not the
284
+ * dance. Survives `NO_COLOR` because the silhouette is in the characters.
285
+ */
286
+ export const MASCOT_FRAMES = [
287
+ '╭⊙─⊙╮', // both corners up — abacus level
288
+ '╭⊙─⊙╯', // right corner dips — column leans right
289
+ '╰⊙─⊙╯', // both corners down
290
+ '╰⊙─⊙╮' // left corner dips — column leans left
291
+ ];
292
+ /** Pick the current mascot frame given elapsed thinking time in ms. */
293
+ export function mascotFrame(tMs) {
294
+ return MASCOT_FRAMES[Math.floor(tMs / 200) % MASCOT_FRAMES.length];
295
+ }
296
+ //# sourceMappingURL=ui.js.map
package/dist/ui.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.js","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAWH,MAAM,KAAK,GAAG,SAAS,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,GAAG,EAAE,SAAS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E,oBAAoB;IAC7B,OAAO,CAAC,wCAAwC;CACxC,CAAC;AAEX,uEAAuE;AACvE,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,OAAO,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;AACrE,CAAC"}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "opencode-agora",
3
- "version": "0.2.2",
3
+ "version": "0.4.0",
4
4
  "description": "Agora - The Developer's Terminal Marketplace & Community Hub for OpenCode",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "type": "module",
8
8
  "bin": {
9
- "agora": "./dist/cli.js",
10
- "opencode-agora": "./dist/cli.js"
9
+ "agora": "dist/cli.js",
10
+ "opencode-agora": "dist/cli.js"
11
11
  },
12
12
  "repository": {
13
13
  "type": "git",
@@ -26,13 +26,17 @@
26
26
  "dist"
27
27
  ],
28
28
  "scripts": {
29
- "build": "tsc",
29
+ "build": "rm -rf dist && tsc && chmod +x dist/cli.js",
30
30
  "dev": "bun run build && cp -r dist/* ~/.config/opencode/plugins/agora/",
31
31
  "hub:dev": "bun hub/server.ts",
32
- "typecheck": "tsc --noEmit",
32
+ "typecheck": "tsc -p tsconfig.check.json",
33
33
  "test": "bun test",
34
34
  "prepublishOnly": "bun run build",
35
- "refresh:data": "bun scripts/refresh-data.ts"
35
+ "refresh:data": "bun scripts/refresh-data.ts",
36
+ "lint": "eslint .",
37
+ "lint:fix": "eslint . --fix",
38
+ "format": "prettier --write .",
39
+ "format:check": "prettier --check ."
36
40
  },
37
41
  "keywords": [
38
42
  "opencode",
@@ -45,13 +49,20 @@
45
49
  "author": "IrgenSlj",
46
50
  "license": "MIT",
47
51
  "dependencies": {
48
- "zod": "^3.24.0"
52
+ "@clack/prompts": "^1.4.0",
53
+ "@modelcontextprotocol/sdk": "^1.29.0",
54
+ "zod": "^4.4.3"
49
55
  },
50
56
  "devDependencies": {
57
+ "@eslint/js": "^10.0.1",
51
58
  "@opencode-ai/plugin": "^1.0.0",
52
59
  "@types/bun": "^1.2.0",
53
- "@types/node": "^22.0.0",
54
- "typescript": "^5.7.0",
55
- "bun-types": "^1.2.0"
60
+ "@types/node": "^25.8.0",
61
+ "bun-types": "^1.2.0",
62
+ "eslint": "^10.3.0",
63
+ "eslint-config-prettier": "^10.0.0",
64
+ "prettier": "^3.0.0",
65
+ "typescript": "^6.0.3",
66
+ "typescript-eslint": "^8.0.0"
56
67
  }
57
68
  }
package/dist/api.d.ts DELETED
@@ -1,69 +0,0 @@
1
- export interface Package {
2
- id: string;
3
- name: string;
4
- description: string;
5
- author: string;
6
- version: string;
7
- category: string;
8
- tags: string[];
9
- stars: number;
10
- installs: number;
11
- repository?: string;
12
- npm_package?: string;
13
- created_at: string;
14
- }
15
- export interface Workflow {
16
- id: string;
17
- name: string;
18
- description: string;
19
- author: string;
20
- prompt: string;
21
- model?: string;
22
- tags: string[];
23
- stars: number;
24
- forks: number;
25
- created_at: string;
26
- }
27
- export interface Discussion {
28
- id: string;
29
- title: string;
30
- content: string;
31
- author: string;
32
- category: string;
33
- stars: number;
34
- reply_count: number;
35
- created_at: string;
36
- }
37
- export interface User {
38
- id: string;
39
- username: string;
40
- display_name?: string;
41
- bio?: string;
42
- avatar_url?: string;
43
- package_count?: number;
44
- workflow_count?: number;
45
- discussion_count?: number;
46
- created_at?: string;
47
- }
48
- export declare function searchPackages(query: string, category?: string): Promise<Package[]>;
49
- export declare function getPackage(id: string): Promise<Package | null>;
50
- export declare function searchWorkflows(query: string): Promise<Workflow[]>;
51
- export declare function getWorkflow(id: string): Promise<Workflow | null>;
52
- export declare function getTrending(_type?: 'packages' | 'workflows' | 'all'): Promise<unknown>;
53
- export declare function getDiscussions(category?: string): Promise<Discussion[]>;
54
- export declare function createDiscussion(data: {
55
- title: string;
56
- content: string;
57
- category: string;
58
- author?: string;
59
- }, token?: string): Promise<{
60
- id: string;
61
- } | null>;
62
- export declare function getUser(username: string): Promise<User | null>;
63
- export declare function searchNpmPackages(query: string): Promise<{
64
- npm: any[];
65
- mcp: any[];
66
- }>;
67
- export declare function getMcpPackage(name: string): Promise<any | null>;
68
- export declare function getGitHubRepo(owner: string, repo: string): Promise<any | null>;
69
- //# sourceMappingURL=api.d.ts.map
package/dist/api.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK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