discoveries.html 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <pstm-uri>/discoveries</pstm-uri>
  5. <pstm-template>main</pstm-template>
  6. <script>
  7. // The search box filters CLIENT-SIDE, like the task page's
  8. // selects: the Statum entrypoint fetch never carries the page's
  9. // own query string to the server, so the box filters the
  10. // rendered rows directly (case-insensitive substring over the
  11. // body, the same search the daemon's search_discoveries tool
  12. // performs server-side). A `?q=` on a direct entrypoint hit
  13. // pre-seeds the box (DiscoveriesEntrypoint reads it).
  14. if (window.statum) {
  15. (function () {
  16. 'use strict';
  17. window.discoveryRowVisible = function (row) {
  18. var needle = (window.discoveryQuery || '').toLowerCase();
  19. if (!needle) return true;
  20. return (row.body || '').toLowerCase().indexOf(needle) !== -1;
  21. };
  22. window.setDiscoveryQuery = function (value) {
  23. window.discoveryQuery = value || '';
  24. var box = document.getElementById('discovery-q');
  25. if (box && box.value !== window.discoveryQuery) {
  26. box.value = window.discoveryQuery;
  27. }
  28. document.body.setAttribute('data-discovery-bump',
  29. String(Date.now()));
  30. };
  31. })();
  32. }
  33. </script>
  34. </head>
  35. <body>
  36. <section>
  37. <h2>Discoveries</h2>
  38. <p class="text-muted">The fleet's editable knowledge base of non-project facts — compiler
  39. quirks, library behaviours, tool flags, protocol gotchas. Agents search this
  40. before working with a technology and refine notes in place; you can do the same.</p>
  41. <p stm-if="discoveries == null">Loading…</p>
  42. <div stm-if="discoveries != null">
  43. <form class="cluster" onsubmit="window.setDiscoveryQuery(document.getElementById('discovery-q').value); return false;">
  44. <div class="field"><label for="discovery-q">Search</label>
  45. <input type="search" id="discovery-q"
  46. stm-attribute.value="discoveries.query"
  47. placeholder="meson, valac, sqlite…">
  48. <button type="submit">Search</button></div>
  49. </form>
  50. <div stm-for-discovery-in="discoveries.discoveries" stm-key="discovery.id"
  51. stm-if="window.discoveryRowVisible(discovery)" class="card">
  52. <div class="md" stm-markdown="discovery.body">body</div>
  53. <p class="text-muted">Created <span stm-text="discovery.created_display">when</span><span
  54. stm-if="discovery.updated_display != ''"> · Updated <span
  55. stm-text="discovery.updated_display">when</span></span></p>
  56. <details>
  57. <summary>Edit</summary>
  58. <form stm-action="discovery.update">
  59. <input type="hidden" name="discovery_id" stm-attribute.value="discovery.id">
  60. <div class="field"><label>Body</label>
  61. <textarea name="body" rows="6" stm-attribute.value="discovery.body"></textarea></div>
  62. <button type="submit">Save</button>
  63. </form>
  64. </details>
  65. <form class="cluster">
  66. <button type="button" stm-action="discovery.delete"
  67. stm-confirm="Delete this discovery?">Delete</button>
  68. </form>
  69. </div>
  70. <p stm-if="discoveries.discoveries.length == 0" class="text-muted">
  71. No discoveries yet — the knowledge base starts empty and grows as agents
  72. record what they learn.</p>
  73. <p stm-if="discoveries.more > 0" class="text-muted">… and <span
  74. stm-text="discoveries.more">n</span> more (narrow the search).</p>
  75. </div>
  76. </section>
  77. </body>
  78. </html>