@iowarp/clio-coder 0.3.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 (226) hide show
  1. package/CHANGELOG.md +407 -0
  2. package/CODE_OF_CONDUCT.md +21 -0
  3. package/CONTRIBUTING.md +224 -0
  4. package/LICENSE +202 -0
  5. package/NOTICE +9 -0
  6. package/README.md +798 -0
  7. package/SECURITY.md +72 -0
  8. package/assets/clio-coder-logo-128.webp +0 -0
  9. package/damage-control-rules.yaml +419 -0
  10. package/dist/acp-UMLFVA3F.js +92 -0
  11. package/dist/agents-Q4MYPMUW.js +91 -0
  12. package/dist/auth-O6HYIJ6J.js +521 -0
  13. package/dist/chunk-262G75JS.js +35 -0
  14. package/dist/chunk-26BZQOAD.js +1281 -0
  15. package/dist/chunk-2J63S4SF.js +508 -0
  16. package/dist/chunk-3DANZDGR.js +717 -0
  17. package/dist/chunk-4UQA7NCT.js +29 -0
  18. package/dist/chunk-527KG6XR.js +497 -0
  19. package/dist/chunk-5LDRNKX2.js +1063 -0
  20. package/dist/chunk-5N2FG33Q.js +25 -0
  21. package/dist/chunk-67MTHP2E.js +135 -0
  22. package/dist/chunk-6CWDTGUC.js +20 -0
  23. package/dist/chunk-7BHLZB3A.js +2115 -0
  24. package/dist/chunk-7RBKDI66.js +348 -0
  25. package/dist/chunk-AMFR5YA3.js +541 -0
  26. package/dist/chunk-BBUH4VAA.js +1224 -0
  27. package/dist/chunk-BYEU76JP.js +899 -0
  28. package/dist/chunk-CLJ5HLUD.js +458 -0
  29. package/dist/chunk-D5YD55AR.js +116 -0
  30. package/dist/chunk-DXQNI4PC.js +61 -0
  31. package/dist/chunk-E3NYWENM.js +1004 -0
  32. package/dist/chunk-GNGDQYDU.js +34688 -0
  33. package/dist/chunk-GOTUR54M.js +9 -0
  34. package/dist/chunk-HBU5MTAM.js +41 -0
  35. package/dist/chunk-HMYNFFY4.js +28 -0
  36. package/dist/chunk-JPOWPFCU.js +1010 -0
  37. package/dist/chunk-JWHCJDCI.js +1215 -0
  38. package/dist/chunk-KBR4MZZR.js +41 -0
  39. package/dist/chunk-KKKPTZLM.js +93 -0
  40. package/dist/chunk-ME6DNWIU.js +66 -0
  41. package/dist/chunk-NI4DEJMC.js +88 -0
  42. package/dist/chunk-O4EJEDHO.js +659 -0
  43. package/dist/chunk-PIDUD6M2.js +31 -0
  44. package/dist/chunk-PS4PFJQP.js +29459 -0
  45. package/dist/chunk-QV47YRF4.js +48 -0
  46. package/dist/chunk-RQDWMVRB.js +279 -0
  47. package/dist/chunk-TFSSEXL6.js +136 -0
  48. package/dist/chunk-TKHQ4DGZ.js +8290 -0
  49. package/dist/chunk-TPOCL34A.js +2876 -0
  50. package/dist/chunk-UGYAX5YI.js +565 -0
  51. package/dist/chunk-UHTSULZS.js +461 -0
  52. package/dist/chunk-UU3R62TT.js +128 -0
  53. package/dist/chunk-UWIJNAOB.js +3906 -0
  54. package/dist/chunk-VOO7NYPP.js +914 -0
  55. package/dist/chunk-VPAWTYLY.js +117 -0
  56. package/dist/chunk-WD6AJM35.js +1216 -0
  57. package/dist/chunk-X3BR7HWV.js +115 -0
  58. package/dist/chunk-X3NE4WVW.js +120 -0
  59. package/dist/chunk-XNISANGE.js +1395 -0
  60. package/dist/chunk-XV4ZJ6ZM.js +3177 -0
  61. package/dist/cli/index.js +236 -0
  62. package/dist/clio-KIQ5SNDS.js +53 -0
  63. package/dist/components-JVHMUBEB.js +653 -0
  64. package/dist/config-ZFCDBMDC.js +372 -0
  65. package/dist/configure-G4E3A2PG.js +27 -0
  66. package/dist/context-CDXTP2MP.js +293 -0
  67. package/dist/context-E3KIFVXI.js +185 -0
  68. package/dist/context-clear-3F4PLXOS.js +102 -0
  69. package/dist/context-index-Q7YSYTR3.js +106 -0
  70. package/dist/docs-YIETIWZI.js +280 -0
  71. package/dist/doctor-M5HJJZOL.js +61 -0
  72. package/dist/domains/agents/builtins/architect.md +33 -0
  73. package/dist/domains/agents/builtins/coder.md +31 -0
  74. package/dist/domains/agents/builtins/context-bootstrap.md +38 -0
  75. package/dist/domains/agents/builtins/debugger.md +30 -0
  76. package/dist/domains/agents/builtins/documenter.md +31 -0
  77. package/dist/domains/agents/builtins/git-master.md +30 -0
  78. package/dist/domains/agents/builtins/provenance.md +30 -0
  79. package/dist/domains/agents/builtins/researcher.md +71 -0
  80. package/dist/domains/agents/builtins/scout.md +42 -0
  81. package/dist/domains/agents/builtins/tester.md +31 -0
  82. package/dist/domains/agents/builtins/verifier.md +30 -0
  83. package/dist/domains/agents/builtins/wiki-writer.md +41 -0
  84. package/dist/eval-B3KZZESM.js +2674 -0
  85. package/dist/evidence-V67CHM35.js +233 -0
  86. package/dist/evolve-YDZSUQYA.js +518 -0
  87. package/dist/extensions-SRG7XCAH.js +207 -0
  88. package/dist/fleet-CA2CRTVG.js +760 -0
  89. package/dist/fleet-preflight-CLIAX7YR.js +21 -0
  90. package/dist/init-2OZDJE2D.js +227 -0
  91. package/dist/memory-3PIQQAKX.js +207 -0
  92. package/dist/models-DY35XI7Y.js +237 -0
  93. package/dist/paths-5OMXW7Z4.js +57 -0
  94. package/dist/preload-KZVHET2B.js +11 -0
  95. package/dist/reset-PIFYNOS3.js +216 -0
  96. package/dist/run-3VSPP24F.js +735 -0
  97. package/dist/share-D36RQCXM.js +241 -0
  98. package/dist/skills-F2MRLELY.js +445 -0
  99. package/dist/skills-eval-E2ZTW4PL.js +932 -0
  100. package/dist/targets-DZMEZAH4.js +977 -0
  101. package/dist/trace-7NYCUI2J.js +250 -0
  102. package/dist/uninstall-AD3JWHBB.js +322 -0
  103. package/dist/upgrade-WYYBKGDY.js +301 -0
  104. package/dist/usage-ULIDAGFF.js +755 -0
  105. package/dist/version-ROZ6CZKH.js +16 -0
  106. package/dist/wiki-generate-PKFIX6OB.js +377 -0
  107. package/dist/worker/entry.js +1739 -0
  108. package/docs/README.md +93 -0
  109. package/docs/acp.md +120 -0
  110. package/docs/alcf-provider.md +72 -0
  111. package/docs/architecture.md +172 -0
  112. package/docs/artifact-versions.md +54 -0
  113. package/docs/built-in-agents.md +265 -0
  114. package/docs/capacity-and-scheduling.md +97 -0
  115. package/docs/commands-and-modes.md +554 -0
  116. package/docs/config-knobs-audit.md +115 -0
  117. package/docs/configuration-and-targets.md +812 -0
  118. package/docs/context-engine.md +236 -0
  119. package/docs/dispatch-architecture-rationale.md +126 -0
  120. package/docs/documentation-coverage.md +46 -0
  121. package/docs/documentation-guide.md +166 -0
  122. package/docs/environment-variables.md +105 -0
  123. package/docs/eval-runner.md +205 -0
  124. package/docs/evals-internal.md +298 -0
  125. package/docs/evidence-and-memory.md +243 -0
  126. package/docs/evolution.md +143 -0
  127. package/docs/exit-codes-and-output.md +74 -0
  128. package/docs/extensions-and-sharing.md +306 -0
  129. package/docs/fleet-demo-runbook.md +179 -0
  130. package/docs/fleet-dispatch.md +591 -0
  131. package/docs/glossary.md +75 -0
  132. package/docs/html/agents_blueprint.html +936 -0
  133. package/docs/html/alcf_blueprint.html +324 -0
  134. package/docs/html/architecture_blueprint.html +850 -0
  135. package/docs/html/commands_blueprint.html +794 -0
  136. package/docs/html/config_knobs_audit_blueprint.html +178 -0
  137. package/docs/html/configuration_blueprint.html +1080 -0
  138. package/docs/html/context_blueprint.html +603 -0
  139. package/docs/html/documentation_blueprint.html +832 -0
  140. package/docs/html/environment_blueprint.html +404 -0
  141. package/docs/html/eval_blueprint.html +743 -0
  142. package/docs/html/evals_internal_blueprint.html +190 -0
  143. package/docs/html/evolution_blueprint.html +674 -0
  144. package/docs/html/extensions_blueprint.html +2065 -0
  145. package/docs/html/fleet_dispatch_blueprint.html +286 -0
  146. package/docs/html/index.html +919 -0
  147. package/docs/html/lifecycle_blueprint.html +723 -0
  148. package/docs/html/memory_blueprint.html +699 -0
  149. package/docs/html/middleware_blueprint.html +664 -0
  150. package/docs/html/models_blueprint.html +2366 -0
  151. package/docs/html/observability_blueprint.html +683 -0
  152. package/docs/html/provider_adapter_blueprint.html +245 -0
  153. package/docs/html/safety_blueprint.html +1386 -0
  154. package/docs/html/shared.css +571 -0
  155. package/docs/html/shared.js +143 -0
  156. package/docs/html/skills_blueprint.html +671 -0
  157. package/docs/html/soak_blueprint.html +182 -0
  158. package/docs/html/tool_usage_blueprint.html +350 -0
  159. package/docs/html/tools_blueprint.html +2249 -0
  160. package/docs/html/trace_blueprint.html +235 -0
  161. package/docs/html/tui_design_blueprint.html +314 -0
  162. package/docs/html/validation_blueprint.html +961 -0
  163. package/docs/html/worker_dispatch_blueprint.html +231 -0
  164. package/docs/installation-and-lifecycle.md +308 -0
  165. package/docs/middleware-and-components.md +148 -0
  166. package/docs/model-catalog.md +189 -0
  167. package/docs/observability.md +233 -0
  168. package/docs/proactive-memory.md +452 -0
  169. package/docs/prompt-envelope-and-tools.md +142 -0
  170. package/docs/provider-adapter-cookbook.md +148 -0
  171. package/docs/release-cut-checklist.md +138 -0
  172. package/docs/safety-model.md +357 -0
  173. package/docs/scientific-validation.md +105 -0
  174. package/docs/session-lifecycle.md +156 -0
  175. package/docs/skills-marketplace.md +46 -0
  176. package/docs/tool-usage.md +527 -0
  177. package/docs/trace-store.md +132 -0
  178. package/docs/troubleshooting.md +33 -0
  179. package/docs/tui-design.md +239 -0
  180. package/docs/worker-dispatch-mechanics.md +242 -0
  181. package/package.json +132 -0
  182. package/skills/README.md +408 -0
  183. package/skills/git/commit-crafting/SKILL.md +79 -0
  184. package/skills/git/commit-crafting/evals.md +92 -0
  185. package/skills/git/create-pr/SKILL.md +116 -0
  186. package/skills/git/create-pr/evals.md +114 -0
  187. package/skills/git/investigate-issue/SKILL.md +139 -0
  188. package/skills/git/investigate-issue/evals.md +94 -0
  189. package/skills/git/resolve-merge-conflicts/SKILL.md +96 -0
  190. package/skills/git/resolve-merge-conflicts/evals.md +58 -0
  191. package/skills/git/review-changes/SKILL.md +103 -0
  192. package/skills/git/review-changes/evals.md +85 -0
  193. package/skills/git/worktree-create/SKILL.md +92 -0
  194. package/skills/git/worktree-create/evals.md +97 -0
  195. package/skills/git/worktree-create/references/worktree-setup.md +66 -0
  196. package/skills/git/worktree-merge/SKILL.md +95 -0
  197. package/skills/git/worktree-merge/evals.md +114 -0
  198. package/skills/skill-marketplace.json +261 -0
  199. package/skills/workflow/cut-it/SKILL.md +86 -0
  200. package/skills/workflow/cut-it/evals.md +42 -0
  201. package/src/domains/agents/builtins/architect.md +33 -0
  202. package/src/domains/agents/builtins/coder.md +31 -0
  203. package/src/domains/agents/builtins/context-bootstrap.md +38 -0
  204. package/src/domains/agents/builtins/debugger.md +30 -0
  205. package/src/domains/agents/builtins/documenter.md +31 -0
  206. package/src/domains/agents/builtins/git-master.md +30 -0
  207. package/src/domains/agents/builtins/provenance.md +30 -0
  208. package/src/domains/agents/builtins/researcher.md +71 -0
  209. package/src/domains/agents/builtins/scout.md +42 -0
  210. package/src/domains/agents/builtins/tester.md +31 -0
  211. package/src/domains/agents/builtins/verifier.md +30 -0
  212. package/src/domains/agents/builtins/wiki-writer.md +41 -0
  213. package/src/domains/agents/fleets/build-review.md +34 -0
  214. package/src/domains/agents/fleets/build-test.md +35 -0
  215. package/src/domains/agents/fleets/sdlc.md +86 -0
  216. package/src/domains/prompts/fragments/identity/clio-worker.md +11 -0
  217. package/src/domains/prompts/fragments/identity/clio.md +26 -0
  218. package/src/domains/prompts/fragments/operating/contract.md +64 -0
  219. package/src/domains/prompts/fragments/safety/auto-edit.md +14 -0
  220. package/src/domains/prompts/fragments/safety/full-auto.md +14 -0
  221. package/src/domains/prompts/fragments/safety/read-only.md +13 -0
  222. package/src/domains/prompts/fragments/safety/suggest.md +13 -0
  223. package/src/domains/prompts/fragments/wiki/page.md +75 -0
  224. package/src/domains/prompts/fragments/wiki/plan.md +48 -0
  225. package/src/domains/providers/models/cloud-models/alcf.yaml +40 -0
  226. package/src/domains/providers/models/local-models/clio-local-coding-targets.yaml +993 -0
@@ -0,0 +1,235 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Clio Coder Trace Store Blueprint (v0.3.0)</title>
7
+ <link rel="stylesheet" href="shared.css">
8
+ <style>
9
+ .subcommand-card {
10
+ background: var(--bg-card);
11
+ border: 1px solid var(--border-card);
12
+ border-radius: 8px;
13
+ padding: 1.25rem;
14
+ margin-bottom: 1rem;
15
+ transition: border-color 0.2s ease;
16
+ }
17
+ .subcommand-card:hover {
18
+ border-color: var(--border-card-hover);
19
+ }
20
+ .subcommand-title {
21
+ font-family: var(--font-mono);
22
+ color: var(--color-cyan);
23
+ font-size: 1.1rem;
24
+ font-weight: 600;
25
+ margin-bottom: 0.5rem;
26
+ }
27
+ .badge-tag {
28
+ display: inline-block;
29
+ padding: 0.2rem 0.6rem;
30
+ border-radius: 4px;
31
+ font-size: 0.75rem;
32
+ font-family: var(--font-mono);
33
+ background: rgba(0, 212, 219, 0.1);
34
+ color: var(--color-cyan);
35
+ border: 1px solid rgba(0, 212, 219, 0.3);
36
+ margin-right: 0.5rem;
37
+ }
38
+ .table-schema-grid {
39
+ display: grid;
40
+ grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
41
+ gap: 1rem;
42
+ margin-top: 1rem;
43
+ }
44
+ .schema-card {
45
+ background: var(--bg-card);
46
+ border: 1px solid var(--border-card);
47
+ border-radius: 8px;
48
+ padding: 1rem;
49
+ }
50
+ .schema-card h4 {
51
+ font-family: var(--font-mono);
52
+ color: var(--color-orange);
53
+ margin-bottom: 0.5rem;
54
+ }
55
+ .sql-demo-box {
56
+ background: rgba(13, 20, 38, 0.8);
57
+ border: 1px solid var(--border-card);
58
+ border-radius: 8px;
59
+ padding: 1.25rem;
60
+ margin-top: 1.5rem;
61
+ }
62
+ .sql-input {
63
+ width: 100%;
64
+ background: #060911;
65
+ border: 1px solid var(--border-card);
66
+ color: var(--text-main);
67
+ font-family: var(--font-mono);
68
+ padding: 0.75rem;
69
+ border-radius: 6px;
70
+ font-size: 0.9rem;
71
+ margin-bottom: 0.75rem;
72
+ }
73
+ .sql-input:focus {
74
+ outline: none;
75
+ border-color: var(--color-cyan);
76
+ }
77
+ .sql-result {
78
+ font-family: var(--font-mono);
79
+ font-size: 0.85rem;
80
+ background: #04060c;
81
+ padding: 1rem;
82
+ border-radius: 6px;
83
+ white-space: pre-wrap;
84
+ max-height: 250px;
85
+ overflow-y: auto;
86
+ }
87
+ .sql-result.error {
88
+ color: var(--color-rose);
89
+ border-left: 3px solid var(--color-rose);
90
+ }
91
+ .sql-result.success {
92
+ color: var(--color-emerald);
93
+ border-left: 3px solid var(--color-emerald);
94
+ }
95
+ </style>
96
+ </head>
97
+ <body>
98
+ <div class="container">
99
+ <header>
100
+ <div>
101
+ <h1>Trace Store Blueprint</h1>
102
+ <p style="color: var(--text-muted);">Interactive reference and query validator simulator for the SQLite trace mirror (v0.3.0)</p>
103
+ </div>
104
+ <div>
105
+ <span class="badge-tag">v0.3.0</span>
106
+ <span class="badge-tag" style="color: var(--color-orange); border-color: rgba(255, 126, 41, 0.3); background: rgba(255, 126, 41, 0.1);">Trace Mirror</span>
107
+ </div>
108
+ </header>
109
+
110
+ <div style="margin-bottom: 2rem;">
111
+ <p>Clio's trace database is a rebuildable, queryable SQLite mirror located at <code>&lt;stateDir&gt;/trace.sqlite</code>. Authoritative state remains in receipts, ledgers, and gate artifacts. Removing <code>trace.sqlite</code> causes no data loss. Writers enforce WAL journal mode and busy_timeout=5000; readers open in read-only mode.</p>
112
+ </div>
113
+
114
+ <main>
115
+ <section style="margin-bottom: 3rem;">
116
+ <h2>clio-coder trace Subcommands</h2>
117
+ <p style="color: var(--text-muted); margin-bottom: 1.5rem;">The CLI exposes six dedicated subcommands for operational tracing and diagnostics:</p>
118
+
119
+ <div class="subcommand-card">
120
+ <div class="subcommand-title">clio-coder trace runs [--db PATH] [--limit N]</div>
121
+ <p>Queries and formats recent execution runs up to limit N (1 to 500, default 50). Displays run status, start timestamp, total tokens, USD cost, and run ID.</p>
122
+ </div>
123
+
124
+ <div class="subcommand-card">
125
+ <div class="subcommand-title">clio-coder trace phases &lt;runId&gt; [--db PATH]</div>
126
+ <p>Lists execution phases for a specified run. Displays phase status, attempt index, owner, token count, USD cost, and phase name.</p>
127
+ </div>
128
+
129
+ <div class="subcommand-card">
130
+ <div class="subcommand-title">clio-coder trace tail &lt;runId&gt; [--follow] [--db PATH]</div>
131
+ <p>Streams append-ordered trace events by SQLite <code>rowid</code>. When <code>--follow</code> is enabled, polls every 500 ms until two consecutive idle polls observe a completed run status.</p>
132
+ </div>
133
+
134
+ <div class="subcommand-card">
135
+ <div class="subcommand-title">clio-coder trace procs &lt;runId&gt; [--db PATH]</div>
136
+ <p>Displays process records (orchestrator and worker) registered for a run. Shows process state (<code>live</code> or <code>ended</code>), PID, kind, name, and command line.</p>
137
+ </div>
138
+
139
+ <div class="subcommand-card">
140
+ <div class="subcommand-title">clio-coder trace sql &lt;SELECT query&gt; [--db PATH]</div>
141
+ <p>Executes a single read-only <code>SELECT</code> or <code>WITH</code> query against the trace store. Rejects semicolons and data modification statements (<code>INSERT</code>, <code>UPDATE</code>, <code>DELETE</code>, etc.).</p>
142
+ </div>
143
+
144
+ <div class="subcommand-card">
145
+ <div class="subcommand-title">clio-coder trace ui [--db PATH] [--port N]</div>
146
+ <p>Launches the web-based trace viewer server on the specified port. Requires source checkout with <code>apps/trace-viewer/server.mjs</code>.</p>
147
+ </div>
148
+ </section>
149
+
150
+ <section style="margin-bottom: 3rem;">
151
+ <h2>Database Schema</h2>
152
+ <div class="table-schema-grid">
153
+ <div class="schema-card">
154
+ <h4>runs</h4>
155
+ <p style="font-size: 0.85rem; color: var(--text-muted);">Terminal run records, statuses, models, targets, node, timing, total tokens, total USD cost. Interactive session turns are recorded here too, under assignment_id "session".</p>
156
+ </div>
157
+ <div class="schema-card">
158
+ <h4>phases</h4>
159
+ <p style="font-size: 0.85rem; color: var(--text-muted);">Sequence phases, attempt index, retries, worker owner, itemized token and dollar spend, context occupancy.</p>
160
+ </div>
161
+ <div class="schema-card">
162
+ <h4>events</h4>
163
+ <p style="font-size: 0.85rem; color: var(--text-muted);">Append-ordered events by rowid. Tool calls are spans with ended_at; point events have null ended_at.</p>
164
+ </div>
165
+ <div class="schema-card">
166
+ <h4>envelopes</h4>
167
+ <p style="font-size: 0.85rem; color: var(--text-muted);">Agent output envelopes, valid flags, attempt indices, and output types.</p>
168
+ </div>
169
+ <div class="schema-card">
170
+ <h4>gate_results</h4>
171
+ <p style="font-size: 0.85rem; color: var(--text-muted);">Typed reviewer/judge verdicts, passed status, and itemized checks JSON array.</p>
172
+ </div>
173
+ <div class="schema-card">
174
+ <h4>agent_sessions</h4>
175
+ <p style="font-size: 0.85rem; color: var(--text-muted);">Mirrored worker/model/session context occupancy records.</p>
176
+ </div>
177
+ <div class="schema-card">
178
+ <h4>processes</h4>
179
+ <p style="font-size: 0.85rem; color: var(--text-muted);">Registered worker processes, PIDs, redacted command string, and SHA-256 command digest.</p>
180
+ </div>
181
+ <div class="schema-card">
182
+ <h4>meta</h4>
183
+ <p style="font-size: 0.85rem; color: var(--text-muted);">Schema version metadata table (enforces schema_version = 1).</p>
184
+ </div>
185
+ </div>
186
+ </section>
187
+
188
+ <section>
189
+ <h2>Interactive Read-Only SQL Query Simulator</h2>
190
+ <p style="color: var(--text-muted);">Test SQL queries against the strict <code>clio-coder trace sql</code> read-only validator rule set:</p>
191
+
192
+ <div class="sql-demo-box">
193
+ <input type="text" id="sqlQueryInput" class="sql-input" value="SELECT run_id, status, total_tokens, total_cost_usd FROM runs LIMIT 10">
194
+ <button type="button" id="sqlTestBtn" style="background: var(--gradient-main); color: #000; border: none; padding: 0.5rem 1.25rem; border-radius: 6px; font-weight: 600; cursor: pointer; margin-bottom: 1rem;">Validate Query</button>
195
+ <div id="sqlOutput" class="sql-result success">Validation passed: Read-only SELECT query is valid.</div>
196
+ </div>
197
+ </section>
198
+ </main>
199
+ </div>
200
+
201
+ <script src="shared.js"></script>
202
+ <script>
203
+ document.addEventListener("DOMContentLoaded", () => {
204
+ const input = document.getElementById("sqlQueryInput");
205
+ const btn = document.getElementById("sqlTestBtn");
206
+ const output = document.getElementById("sqlOutput");
207
+
208
+ function validateSql(sql) {
209
+ const trimmed = sql.trim();
210
+ if (!/^(SELECT|WITH)\b/i.test(trimmed)) {
211
+ return { ok: false, msg: "Error: trace sql accepts SELECT or read-only WITH queries only." };
212
+ }
213
+ if (trimmed.includes(";")) {
214
+ return { ok: false, msg: "Error: trace sql accepts exactly one statement (no semicolons allowed)." };
215
+ }
216
+ if (/\b(INSERT|UPDATE|DELETE|REPLACE|CREATE|ALTER|DROP|ATTACH|DETACH|VACUUM|PRAGMA)\b/i.test(trimmed)) {
217
+ return { ok: false, msg: "Error: trace sql query is not read-only (mutation keyword detected)." };
218
+ }
219
+ return { ok: true, msg: "Validation passed: Query is strictly read-only SELECT/WITH." };
220
+ }
221
+
222
+ btn.addEventListener("click", () => {
223
+ const result = validateSql(input.value);
224
+ if (result.ok) {
225
+ output.className = "sql-result success";
226
+ output.textContent = result.msg;
227
+ } else {
228
+ output.className = "sql-result error";
229
+ output.textContent = result.msg;
230
+ }
231
+ });
232
+ });
233
+ </script>
234
+ </body>
235
+ </html>
@@ -0,0 +1,314 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>TUI Design System Blueprint (v0.3.0)</title>
7
+ <link rel="stylesheet" href="shared.css">
8
+ <style>
9
+ /* Terminal custom styles */
10
+ .terminal-container {
11
+ background: #060913;
12
+ border: 1px solid #1f354f;
13
+ border-radius: 8px;
14
+ font-family: var(--font-mono);
15
+ font-size: 0.85rem;
16
+ padding: 1.25rem;
17
+ color: #b0c4de;
18
+ box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
19
+ position: relative;
20
+ }
21
+ .terminal-header {
22
+ border-bottom: 1px solid #1f354f;
23
+ padding-bottom: 0.5rem;
24
+ margin-bottom: 0.75rem;
25
+ display: flex;
26
+ justify-content: space-between;
27
+ align-items: center;
28
+ font-size: 0.75rem;
29
+ color: #6a7c85;
30
+ }
31
+
32
+ .tui-accent { color: #46e5d0; }
33
+ .tui-success { color: #57e389; }
34
+ .tui-warn { color: #ffb454; }
35
+ .tui-error { color: #ff5c66; }
36
+ .tui-reason { color: #9d8cff; }
37
+ .tui-dim { color: #6a7a85; }
38
+ .tui-muted { color: #8a99a4; }
39
+
40
+ .color-swatch {
41
+ width: 20px;
42
+ height: 20px;
43
+ border-radius: 4px;
44
+ border: 1px solid rgba(255,255,255,0.1);
45
+ display: inline-block;
46
+ vertical-align: middle;
47
+ }
48
+ </style>
49
+ </head>
50
+ <body>
51
+ <div class="container">
52
+ <header>
53
+ <div class="header-left">
54
+ <div class="header-logo">
55
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="color: var(--color-cyan);"><title>Icon</title>
56
+ <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
57
+ <line x1="9" y1="3" x2="9" y2="21"></line>
58
+ </svg>
59
+ </div>
60
+ <div class="header-title-wrapper">
61
+ <h1>Clio TUI Design System</h1>
62
+ <p>Glyph vocabularies, layout rules, and live CLI transcript terminal formatting</p>
63
+ <div class="meta-chips-row">
64
+ <span class="chip">Source: docs/tui-design.md</span>
65
+ <span class="chip chip-orange">clio-coder docs tui_design</span>
66
+ </div>
67
+ </div>
68
+ </div>
69
+ <div class="header-right">
70
+ <span class="version-badge">Clio Coder v0.3.0</span>
71
+ <a href="index.html" class="back-btn">
72
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><title>Icon</title><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>
73
+ Dashboard Hub
74
+ </a>
75
+ </div>
76
+ </header>
77
+
78
+ <div class="page-layout-grid">
79
+ <nav class="sidebar" aria-label="Table of Contents">
80
+ <div class="toc-container">
81
+ <div class="toc-title">On This Page</div>
82
+ <ul class="toc-list">
83
+ <!-- Dynamically populated -->
84
+ </ul>
85
+ </div>
86
+ </nav>
87
+
88
+ <main>
89
+ <div class="glass-card">
90
+ <h2>Overview Summary</h2>
91
+ <p>Clio's interactive TUI operates under the core design tenet: color indicates state, boxes outline structure, and brand icons represent identity.</p>
92
+ </div>
93
+
94
+ <div class="tabs-nav">
95
+ <button type="button" class="tab-btn active" onclick="switchTab('token-lab')">
96
+ Color &amp; Glyph Lab
97
+ </button>
98
+ <button type="button" class="tab-btn" onclick="switchTab('terminal-sim')">
99
+ Transcript Previewer
100
+ </button>
101
+ </div>
102
+
103
+ <!-- Tab 1: Token Lab -->
104
+ <div class="tab-pane active" id="pane-token-lab">
105
+ <div class="blueprint-layout">
106
+ <div class="specs-col">
107
+ <div class="glass-card">
108
+ <h3>TUI Color Semantic Tokens</h3>
109
+ <p>Click any token row to highlight in the simulator:</p>
110
+
111
+ <table class="env-table" style="cursor: pointer;">
112
+ <thead>
113
+ <tr>
114
+ <th>Token</th>
115
+ <th>Color Value</th>
116
+ <th>Typical Role</th>
117
+ </tr>
118
+ </thead>
119
+ <tbody>
120
+ <tr onclick="previewToken('accent')">
121
+ <td class="env-name" style="color:#46e5d0;">accent</td>
122
+ <td><span class="color-swatch" style="background:#46e5d0;"></span> #46E5D0</td>
123
+ <td>Brand headers, cursor, tool actions</td>
124
+ </tr>
125
+ <tr onclick="previewToken('success')">
126
+ <td class="env-name" style="color:#57e389;">success</td>
127
+ <td><span class="color-swatch" style="background:#57e389;"></span> #57E389</td>
128
+ <td>Success ticks, clean state status</td>
129
+ </tr>
130
+ <tr onclick="previewToken('warning')">
131
+ <td class="env-name" style="color:#ffb454;">warning</td>
132
+ <td><span class="color-swatch" style="background:#ffb454;"></span> #FFB454</td>
133
+ <td>Warnings, truncations, cache issues</td>
134
+ </tr>
135
+ <tr onclick="previewToken('error')">
136
+ <td class="env-name" style="color:#ff5c66;">error</td>
137
+ <td><span class="color-swatch" style="background:#ff5c66;"></span> #FF5C66</td>
138
+ <td>Failures, bad loops, errors</td>
139
+ </tr>
140
+ <tr onclick="previewToken('reason')">
141
+ <td class="env-name" style="color:#9d8cff;">reason</td>
142
+ <td><span class="color-swatch" style="background:#9d8cff;"></span> #9D8CFF</td>
143
+ <td>Purple reasoning fields and thinking states</td>
144
+ </tr>
145
+ <tr onclick="previewToken('dim')">
146
+ <td class="env-name" style="color:#6a7a85;">dim</td>
147
+ <td><span class="color-swatch" style="background:#6a7a85;"></span> #6A7A85</td>
148
+ <td>Keys, delimiters, separators</td>
149
+ </tr>
150
+ </tbody>
151
+ </table>
152
+ </div>
153
+ </div>
154
+
155
+ <div class="specs-col">
156
+ <div class="glass-card">
157
+ <h3>Glyph Vocabulary Constants</h3>
158
+ <p>Glyph representations loaded from <code>glyphs.ts</code>:</p>
159
+
160
+ <table class="env-table">
161
+ <thead>
162
+ <tr>
163
+ <th>Symbol</th>
164
+ <th>Token Key</th>
165
+ <th>Role</th>
166
+ </tr>
167
+ </thead>
168
+ <tbody>
169
+ <tr>
170
+ <td style="font-size:1.1rem; text-align:center;"><code>✦</code></td>
171
+ <td><code>agent</code></td>
172
+ <td>Voice character for Clio Agent response lines</td>
173
+ </tr>
174
+ <tr>
175
+ <td style="font-size:1.1rem; text-align:center;"><code>›</code></td>
176
+ <td><code>user</code></td>
177
+ <td>Voice character for user prompts</td>
178
+ </tr>
179
+ <tr>
180
+ <td style="font-size:1.1rem; text-align:center;"><code>✓</code></td>
181
+ <td><code>ok</code></td>
182
+ <td>Success indicator checks</td>
183
+ </tr>
184
+ <tr>
185
+ <td style="font-size:1.1rem; text-align:center;"><code>✗</code></td>
186
+ <td><code>error</code></td>
187
+ <td>Failure indicator cross</td>
188
+ </tr>
189
+ <tr>
190
+ <td style="font-size:1.1rem; text-align:center;"><code>▰</code></td>
191
+ <td><code>contextFull</code></td>
192
+ <td>Context window gauge meter cell</td>
193
+ </tr>
194
+ </tbody>
195
+ </table>
196
+ </div>
197
+ </div>
198
+ </div>
199
+ </div>
200
+
201
+ <!-- Tab 2: Transcript Sim -->
202
+ <div class="tab-pane" id="pane-terminal-sim">
203
+ <div class="blueprint-layout">
204
+ <div class="specs-col">
205
+ <div class="glass-card">
206
+ <h3>Choreography Options</h3>
207
+ <p>Configure the state of the active step in our simulated terminal:</p>
208
+
209
+ <div class="form-group">
210
+ <label for="stepState">Active Step State</label>
211
+ <select id="stepState" onchange="renderTerminalSim()">
212
+ <option value="thinking">Model Thinking (reasoning Purple)</option>
213
+ <option value="executing">Tool Executing (gear Cyan)</option>
214
+ <option value="success">Success Final (tick Green)</option>
215
+ <option value="error">Failure Blocked (cross Red)</option>
216
+ </select>
217
+ </div>
218
+
219
+ <div class="form-group">
220
+ <label for="inputText">Simulated Prompt</label>
221
+ <input type="text" id="inputText" value="npm run build" oninput="renderTerminalSim()">
222
+ </div>
223
+ </div>
224
+ </div>
225
+
226
+ <div class="specs-col">
227
+ <div class="glass-card">
228
+ <h3>Simulated CLI Frame Preview</h3>
229
+
230
+ <div class="terminal-container" id="terminalSim">
231
+ <!-- Generated dynamically -->
232
+ </div>
233
+ </div>
234
+ </div>
235
+ </div>
236
+ </div>
237
+
238
+ <!-- Related Navigation -->
239
+ <nav class="related-nav" aria-label="Related Pages">
240
+ <a href="provider_adapter_blueprint.html" class="nav-link-card">
241
+ <span class="nav-label">Previous Blueprint</span>
242
+ <span class="nav-title">Provider Adapter Cookbook</span>
243
+ </a>
244
+ <a href="worker_dispatch_blueprint.html" class="nav-link-card next">
245
+ <span class="nav-label">Next Blueprint</span>
246
+ <span class="nav-title">Worker Dispatch Mechanics</span>
247
+ </a>
248
+ </nav>
249
+ </main>
250
+ </div>
251
+
252
+ <footer>
253
+ <p>Clio Coder TUI Blueprint &bull; Version 0.3.0 &bull; Gnosis Research Center</p>
254
+ </footer>
255
+ </div>
256
+
257
+ <script src="shared.js"></script>
258
+ <script>
259
+ function previewToken(token) {
260
+ alert(`Token ${token} clicked. Semantics are loaded natively under themes/tokens.ts`);
261
+ }
262
+
263
+ function renderTerminalSim() {
264
+ const state = document.getElementById("stepState").value;
265
+ const cmd = document.getElementById("inputText").value;
266
+ const container = document.getElementById("terminalSim");
267
+
268
+ let html = `<div class="terminal-header"><span>clio-coder-tui</span><span>v0.3.0</span></div>`;
269
+ html += `<div><span class="tui-accent">›</span> <span style="color:#fff;">${cmd}</span></div>`;
270
+
271
+ if (state === 'thinking') {
272
+ html += `
273
+ <div style="margin-top:0.5rem;"><span class="tui-reason">⣾</span> <span class="tui-reason">Thinking...</span></div>
274
+ <div style="margin-top:0.25rem; border-left: 2px solid #9d8cff; padding-left: 0.5rem; color:#888;">
275
+ Analyzing repository boundaries...<br>
276
+ Checking compilation states...
277
+ </div>
278
+ `;
279
+ } else if (state === 'executing') {
280
+ html += `
281
+ <div style="margin-top:0.5rem;"><span class="tui-accent">⚙</span> <span class="tui-accent">Tool Executing...</span></div>
282
+ <div style="margin-top:0.25rem; color:#8a99a4;">
283
+ ▸ bash(command="npm run build")
284
+ </div>
285
+ `;
286
+ } else if (state === 'success') {
287
+ html += `
288
+ <div style="margin-top:0.5rem;"><span class="tui-success">✓</span> <span class="tui-success">Build completed successfully</span></div>
289
+ <div style="margin-top:0.25rem; color:#8a99a4;">
290
+ Checked 787 files. Output directory generated at dist/
291
+ </div>
292
+ `;
293
+ } else if (state === 'error') {
294
+ html += `
295
+ <div style="margin-top:0.5rem;"><span class="tui-error">✗</span> <span class="tui-error">Compilation failed</span></div>
296
+ <div style="margin-top:0.25rem; color:#ff5c66;">
297
+ Error: Cannot find module './missing-file.js'
298
+ </div>
299
+ `;
300
+ }
301
+
302
+ container.innerHTML = html;
303
+ if (window.initTableOfContents) window.initTableOfContents();
304
+ }
305
+
306
+ // Init
307
+ window.onload = () => {
308
+ renderTerminalSim();
309
+ window.previewToken = previewToken;
310
+ window.renderTerminalSim = renderTerminalSim;
311
+ };
312
+ </script>
313
+ </body>
314
+ </html>