@yaks/browse 0.0.0-stage → 0.2.36

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 (271) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +324 -2
  3. package/_dist/app.d.ts +8 -0
  4. package/_dist/app.d.ts.map +1 -0
  5. package/_dist/cli.d.ts +16 -0
  6. package/_dist/cli.d.ts.map +1 -0
  7. package/_dist/hosting.d.ts +24 -0
  8. package/_dist/hosting.d.ts.map +1 -0
  9. package/_dist/mod.d.ts +7 -0
  10. package/_dist/mod.d.ts.map +1 -0
  11. package/_dist/types.d.ts +5 -0
  12. package/_dist/types.d.ts.map +1 -0
  13. package/_dist/url.d.ts +2 -0
  14. package/_dist/url.d.ts.map +1 -0
  15. package/app.js +10 -0
  16. package/app.js.map +1 -0
  17. package/app.ts +10 -0
  18. package/browser-links.js +22 -0
  19. package/browser-links.js.map +1 -0
  20. package/browser-links.ts +28 -0
  21. package/cli.js +172 -0
  22. package/cli.js.map +1 -0
  23. package/cli.ts +168 -0
  24. package/client.js +748 -0
  25. package/client.js.map +1 -0
  26. package/client.ts +734 -0
  27. package/clipboard.js +18 -0
  28. package/clipboard.js.map +1 -0
  29. package/clipboard.ts +17 -0
  30. package/commands.js +1157 -0
  31. package/commands.js.map +1 -0
  32. package/commands.ts +1108 -0
  33. package/components/Ansi.tsx +160 -0
  34. package/components/App.tsx +446 -0
  35. package/components/Canvas.tsx +625 -0
  36. package/components/Card.tsx +276 -0
  37. package/components/Chat.tsx +205 -0
  38. package/components/Configuration.tsx +218 -0
  39. package/components/Decision.tsx +49 -0
  40. package/components/Dot.tsx +52 -0
  41. package/components/Entity.tsx +609 -0
  42. package/components/Fault.tsx +43 -0
  43. package/components/Filter.tsx +103 -0
  44. package/components/Keybindings.tsx +100 -0
  45. package/components/Keys.tsx +67 -0
  46. package/components/Markdown.tsx +90 -0
  47. package/components/Navigation.tsx +161 -0
  48. package/components/New.tsx +490 -0
  49. package/components/Peek.tsx +168 -0
  50. package/components/Prio.tsx +20 -0
  51. package/components/Run.tsx +263 -0
  52. package/components/Search.tsx +280 -0
  53. package/components/Stamp.tsx +44 -0
  54. package/components/Status.tsx +514 -0
  55. package/components/Sync.tsx +173 -0
  56. package/components/Tile.tsx +50 -0
  57. package/components/answered.js +23 -0
  58. package/components/answered.js.map +1 -0
  59. package/components/answered.ts +25 -0
  60. package/components/comp.js +11 -0
  61. package/components/comp.js.map +1 -0
  62. package/components/comp.ts +10 -0
  63. package/components/drag.js +173 -0
  64. package/components/drag.js.map +1 -0
  65. package/components/drag.ts +198 -0
  66. package/components/fields.tsx +90 -0
  67. package/components/fixtures/README.md +10 -0
  68. package/components/fixtures/archetypes.json +3646 -0
  69. package/components/hits.js +63 -0
  70. package/components/hits.js.map +1 -0
  71. package/components/hits.ts +84 -0
  72. package/components/icons.tsx +177 -0
  73. package/components/inspect.tsx +331 -0
  74. package/components/mount.ts +79 -0
  75. package/components/nav.tsx +479 -0
  76. package/components/offers.js +26 -0
  77. package/components/offers.js.map +1 -0
  78. package/components/offers.ts +54 -0
  79. package/components/page.js +21 -0
  80. package/components/page.js.map +1 -0
  81. package/components/page.ts +18 -0
  82. package/components/read.js +5 -0
  83. package/components/read.js.map +1 -0
  84. package/components/read.ts +7 -0
  85. package/components/registry.js +285 -0
  86. package/components/registry.js.map +1 -0
  87. package/components/registry.ts +317 -0
  88. package/components/session_status.tsx +115 -0
  89. package/components/subscriptions.js +149 -0
  90. package/components/subscriptions.js.map +1 -0
  91. package/components/subscriptions.ts +161 -0
  92. package/components/title.tsx +21 -0
  93. package/components/useQuery.js +166 -0
  94. package/components/useQuery.js.map +1 -0
  95. package/components/useQuery.ts +211 -0
  96. package/components/views/Board.tsx +450 -0
  97. package/components/views/BoardTile.tsx +65 -0
  98. package/components/views/Dashboard.tsx +148 -0
  99. package/components/views/Debug.tsx +445 -0
  100. package/components/views/Dependency.tsx +51 -0
  101. package/components/views/Entry.tsx +500 -0
  102. package/components/views/Gist.tsx +28 -0
  103. package/components/views/Inline.tsx +54 -0
  104. package/components/views/Json.tsx +19 -0
  105. package/components/views/Layout.tsx +211 -0
  106. package/components/views/List.tsx +238 -0
  107. package/components/views/Md.tsx +43 -0
  108. package/components/views/Media.tsx +48 -0
  109. package/components/views/Memory.tsx +32 -0
  110. package/components/views/Relate.tsx +205 -0
  111. package/components/views/Search.tsx +42 -0
  112. package/components/views/Session.tsx +850 -0
  113. package/components/views/SessionManage.tsx +127 -0
  114. package/components/views/Show.tsx +758 -0
  115. package/components/views/Shown.tsx +72 -0
  116. package/components/views/Split.tsx +58 -0
  117. package/components/views/TaskTile.tsx +37 -0
  118. package/components/views/Title.tsx +105 -0
  119. package/components/views/Wake.tsx +77 -0
  120. package/components/views/Web.tsx +49 -0
  121. package/components/wells.js +30 -0
  122. package/components/wells.js.map +1 -0
  123. package/components/wells.ts +33 -0
  124. package/configuration.js +38 -0
  125. package/configuration.js.map +1 -0
  126. package/configuration.ts +41 -0
  127. package/decision_sync.js +88 -0
  128. package/decision_sync.js.map +1 -0
  129. package/decision_sync.ts +93 -0
  130. package/deno.json +1 -0
  131. package/domain-host.tsx +108 -0
  132. package/edge.js +193 -0
  133. package/edge.js.map +1 -0
  134. package/edge.ts +196 -0
  135. package/entry_log.js +241 -0
  136. package/entry_log.js.map +1 -0
  137. package/entry_log.ts +214 -0
  138. package/failure.js +22 -0
  139. package/failure.js.map +1 -0
  140. package/failure.ts +34 -0
  141. package/front.json +61 -0
  142. package/highlight.js +143 -0
  143. package/highlight.js.map +1 -0
  144. package/highlight.ts +149 -0
  145. package/history.js +68 -0
  146. package/history.js.map +1 -0
  147. package/history.ts +72 -0
  148. package/host_commands.js +107 -0
  149. package/host_commands.js.map +1 -0
  150. package/host_commands.ts +38 -0
  151. package/hosting.js +53 -0
  152. package/hosting.js.map +1 -0
  153. package/hosting.ts +72 -0
  154. package/idb.js +14 -0
  155. package/idb.js.map +1 -0
  156. package/idb.ts +15 -0
  157. package/index.js +232 -0
  158. package/index.js.map +1 -0
  159. package/index.ts +252 -0
  160. package/keybindings.js +136 -0
  161. package/keybindings.js.map +1 -0
  162. package/keybindings.ts +37 -0
  163. package/kit.js +103 -0
  164. package/kit.js.map +1 -0
  165. package/kit.ts +119 -0
  166. package/layout.js +254 -0
  167. package/layout.js.map +1 -0
  168. package/layout.ts +210 -0
  169. package/legacy_outbox.js +53 -0
  170. package/legacy_outbox.js.map +1 -0
  171. package/legacy_outbox.ts +63 -0
  172. package/live.js +2883 -0
  173. package/live.js.map +1 -0
  174. package/live.ts +3334 -0
  175. package/live_archetypes.js +92 -0
  176. package/live_archetypes.js.map +1 -0
  177. package/live_archetypes.ts +113 -0
  178. package/live_client.js +145 -0
  179. package/live_client.js.map +1 -0
  180. package/live_client.ts +120 -0
  181. package/main.tsx +5 -0
  182. package/mod.js +7 -0
  183. package/mod.js.map +1 -0
  184. package/mod.ts +7 -0
  185. package/mount.tsx +50 -0
  186. package/navigation.js +120 -0
  187. package/navigation.js.map +1 -0
  188. package/navigation.ts +152 -0
  189. package/near.js +83 -0
  190. package/near.js.map +1 -0
  191. package/near.ts +83 -0
  192. package/new.js +295 -0
  193. package/new.js.map +1 -0
  194. package/new.ts +361 -0
  195. package/outbox.js +112 -0
  196. package/outbox.js.map +1 -0
  197. package/outbox.ts +129 -0
  198. package/owner.js +39 -0
  199. package/owner.js.map +1 -0
  200. package/owner.ts +37 -0
  201. package/package.json +81 -4
  202. package/paste.js +157 -0
  203. package/paste.js.map +1 -0
  204. package/paste.ts +122 -0
  205. package/props.js +303 -0
  206. package/props.js.map +1 -0
  207. package/props.ts +358 -0
  208. package/providers.js +136 -0
  209. package/providers.js.map +1 -0
  210. package/providers.ts +194 -0
  211. package/query.js +987 -0
  212. package/query.js.map +1 -0
  213. package/query.ts +1113 -0
  214. package/remote.js +37 -0
  215. package/remote.js.map +1 -0
  216. package/remote.ts +46 -0
  217. package/resolver.js +149 -0
  218. package/resolver.js.map +1 -0
  219. package/resolver.ts +213 -0
  220. package/rfc2047.js +37 -0
  221. package/rfc2047.js.map +1 -0
  222. package/rfc2047.ts +40 -0
  223. package/row_holds.js +107 -0
  224. package/row_holds.js.map +1 -0
  225. package/row_holds.ts +93 -0
  226. package/served.ts +42 -0
  227. package/session_worktree.js +7 -0
  228. package/session_worktree.js.map +1 -0
  229. package/session_worktree.ts +16 -0
  230. package/sessions.js +57 -0
  231. package/sessions.js.map +1 -0
  232. package/sessions.ts +53 -0
  233. package/sha.js +161 -0
  234. package/sha.js.map +1 -0
  235. package/sha.ts +164 -0
  236. package/styles.css +2823 -0
  237. package/subs.js +36 -0
  238. package/subs.js.map +1 -0
  239. package/subs.ts +40 -0
  240. package/terminal-route.js +13 -0
  241. package/terminal-route.js.map +1 -0
  242. package/terminal-route.ts +17 -0
  243. package/terminal.js +251 -0
  244. package/terminal.js.map +1 -0
  245. package/terminal.ts +186 -0
  246. package/time.js +142 -0
  247. package/time.js.map +1 -0
  248. package/time.ts +133 -0
  249. package/title.js +25 -0
  250. package/title.js.map +1 -0
  251. package/title.ts +50 -0
  252. package/tui/doc.ts +6 -0
  253. package/tui/testing.ts +19 -0
  254. package/twin.js +11 -0
  255. package/twin.js.map +1 -0
  256. package/twin.ts +13 -0
  257. package/types.js +456 -0
  258. package/types.js.map +1 -0
  259. package/types.ts +1370 -0
  260. package/url.js +77 -0
  261. package/url.js.map +1 -0
  262. package/url.ts +85 -0
  263. package/verb.js +82 -0
  264. package/verb.js.map +1 -0
  265. package/verb.ts +137 -0
  266. package/warmth.js +41 -0
  267. package/warmth.js.map +1 -0
  268. package/warmth.ts +54 -0
  269. package/wire.js +86 -0
  270. package/wire.js.map +1 -0
  271. package/wire.ts +63 -0
package/time.js ADDED
@@ -0,0 +1,142 @@
1
+ // The fleet's time DISPLAY and RECURRENCE: a stamp shown local, and the next
2
+ // firing of a schedule (a relative one is @yaks/ui `relative`). The phrase grammar (today, 1 hour ago, 9am)
3
+ // lives in @yaks/query as timeSpan/timeInstant; nothing here parses one.
4
+ import { unitMs } from "@yaks/query";
5
+ // A stamp in full, the way this machine's locale writes one: what a tooltip
6
+ // over a relative age says.
7
+ export { pretty } from "@yaks/ui/relative";
8
+ // A stored UTC stamp SHOWN in the running machine's local zone: ISO-8601
9
+ // with the local offset where the `Z` was, so `wake.at` reads as the wall
10
+ // clock an operator keeps while storage and wire stay Zulu. THE display face
11
+ // of a `time` prop — formatProp routes every stamp through here, and the CLI
12
+ // surfaces that print a stamp outside a prop (created/modified, comments, the
13
+ // journal) call it directly; the web feeds relative() from its minute tick.
14
+ // A non-stamp passes through untouched, so a malformed value never vanishes.
15
+ let pad = (n)=>String(n).padStart(2, '0');
16
+ export let local = (iso)=>{
17
+ let d = new Date(iso);
18
+ if (Number.isNaN(+d)) return iso;
19
+ let off = -d.getTimezoneOffset() // minutes east of UTC
20
+ ;
21
+ let zone = `${off < 0 ? '-' : '+'}${pad(Math.abs(off) / 60 | 0)}:${pad(Math.abs(off) % 60)}`;
22
+ return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T` + `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}${zone}`;
23
+ };
24
+ // ——— Recurrence (T-18724, D-18722 part B prereq) ———
25
+ // instant() resolves ONE phrase; a schedule needs the NEXT occurrence.
26
+ // next() names the first instant at-or-after `now` that a schedule fires:
27
+ // 'every 15m' / 'every 1h' / 'every hour' — the epoch-aligned grid, so a
28
+ // cadence is drift-free and whole units land clock-aligned; units run
29
+ // second..week (fixed sizes only — calendar cadence is cron's job).
30
+ // '0 9 * * *' — 5-field cron in LOCAL time: * , - / steps, dow 0-7
31
+ // (7 = Sunday), and the standard OR rule when BOTH dom and dow are
32
+ // restricted.
33
+ // Anything else is null, so a caller stamps the schedule unreadable
34
+ // (M-16612) instead of silently never firing.
35
+ // One cron field as the set of admitted values. null = unparseable.
36
+ let cronField = (s, lo, hi)=>{
37
+ let set = new Set();
38
+ let all = s == '*';
39
+ for (let part of s.split(',')){
40
+ let m = part.match(/^(\*|\d+(?:-\d+)?)(?:\/(\d+))?$/);
41
+ if (!m) return null;
42
+ let [, range, step] = m;
43
+ let by = step == null ? 1 : +step;
44
+ if (by < 1) return null;
45
+ let [a, b] = range == '*' ? [
46
+ lo,
47
+ hi
48
+ ] : range.includes('-') ? range.split('-').map(Number) : [
49
+ +range,
50
+ step == null ? +range : hi
51
+ ];
52
+ if (a < lo || b > hi || a > b) return null;
53
+ for(let v = a; v <= b; v += by)set.add(v);
54
+ }
55
+ // dow 7 is Sunday's second name.
56
+ if (hi == 7 && set.delete(7)) set.add(0);
57
+ return {
58
+ set,
59
+ all
60
+ };
61
+ };
62
+ // Four years covers every leap-year date, so a pattern that can fire does
63
+ // within the bound.
64
+ let CRON_DAYS = 1462;
65
+ // The most days each month runs to, February's in a leap year.
66
+ let LONGEST = [
67
+ 31,
68
+ 29,
69
+ 31,
70
+ 30,
71
+ 31,
72
+ 30,
73
+ 31,
74
+ 31,
75
+ 30,
76
+ 31,
77
+ 30,
78
+ 31
79
+ ];
80
+ let cronNext = (fields, now)=>{
81
+ let [mi, h, dom, mo, dow] = [
82
+ cronField(fields[0], 0, 59),
83
+ cronField(fields[1], 0, 23),
84
+ cronField(fields[2], 1, 31),
85
+ cronField(fields[3], 1, 12),
86
+ cronField(fields[4], 0, 7)
87
+ ];
88
+ if (!mi || !h || !dom || !mo || !dow) return null;
89
+ // A date no admitted month reaches never comes ('0 9 30 2 *'), unless a
90
+ // restricted weekday may fire in its place.
91
+ let earliest = Math.min(...dom.set);
92
+ if (dow.all && [
93
+ ...mo.set
94
+ ].every((m)=>LONGEST[m - 1] < earliest)) {
95
+ return null;
96
+ }
97
+ // Cron speaks minutes: at-or-after rounds up to the next whole minute,
98
+ // keeping an exact boundary (:00.000) a match for its own tick.
99
+ let t0 = new Date(Math.ceil(now / 60_000) * 60_000);
100
+ let minutes = [
101
+ ...mi.set
102
+ ].sort((a, b)=>a - b);
103
+ let hours = [
104
+ ...h.set
105
+ ].sort((a, b)=>a - b);
106
+ for(let day = 0; day < CRON_DAYS; day++){
107
+ let d = new Date(t0.getFullYear(), t0.getMonth(), t0.getDate() + day);
108
+ // A month the pattern never names is passed over whole: on to its last
109
+ // day, and the loop steps into the next month.
110
+ if (!mo.set.has(d.getMonth() + 1)) {
111
+ let last = new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate();
112
+ day += last - d.getDate();
113
+ continue;
114
+ }
115
+ // Standard cron: both restricted = either matches; else the one rules.
116
+ let dayOk = !dom.all && !dow.all ? dom.set.has(d.getDate()) || dow.set.has(d.getDay()) : dom.set.has(d.getDate()) && dow.set.has(d.getDay());
117
+ if (!dayOk) continue;
118
+ for (let hh of hours){
119
+ if (day == 0 && hh < t0.getHours()) continue;
120
+ for (let mm of minutes){
121
+ if (day == 0 && hh == t0.getHours() && mm < t0.getMinutes()) continue;
122
+ let at = +new Date(d.getFullYear(), d.getMonth(), d.getDate(), hh, mm);
123
+ if (at >= now) return at;
124
+ }
125
+ }
126
+ }
127
+ return null;
128
+ };
129
+ export let next = (s, now = Date.now())=>{
130
+ let t = s.trim().toLowerCase().replace(/\s+/g, ' ');
131
+ let m = t.match(/^every (?:(\d+) ?)?([a-z]+)$/);
132
+ if (m) {
133
+ let ms = unitMs(m[2]);
134
+ let n = +(m[1] ?? 1);
135
+ if (!ms || n < 1) return null;
136
+ let step = n * ms;
137
+ return Math.ceil(now / step) * step;
138
+ }
139
+ let fields = t.split(' ');
140
+ return fields.length == 5 ? cronNext(fields, now) : null;
141
+ };
142
+ //# sourceMappingURL=time.js.map
package/time.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.js","sources":["./time.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,4GAA4G;AAC5G,yEAAyE;AACzE,SAAS,MAAM,2BAAgC;AAE/C,4EAA4E;AAC5E,4BAA4B;AAC5B,SAAS,MAAM,iCAAsC;AAErD,yEAAyE;AACzE,0EAA0E;AAC1E,6EAA6E;AAC7E,6E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E,IAAI,GAAG,WAAW,GAAG,OAAO,CAAC,QAAQ;EAC/C,IAAI,IAAI,EAAE,KAAK,CAAC;EAChB,IAAI,GAAG;IACL,IAAI,KAAK,OAAO,CAAC,CAAC,EAAE;IACpB,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;IACnB,IAAI,CAAC,MAAM,IAAI,GAAG,OAAO;IACzB,IAAI,OAAO,IAAI;IACf,OAAO,KAAK,IAAI,CAAC,MAAM,QAAQ;EACjC;EACA,IAAI,SAAS,EAAE,KAAK,CAAC;EACrB,OAAO,OAAO,MAAM,IAAI,IAAI,SAAS,QAAQ,OAAO;AACtD,EAAC"}
package/time.ts ADDED
@@ -0,0 +1,133 @@
1
+ // The fleet's time DISPLAY and RECURRENCE: a stamp shown local, and the next
2
+ // firing of a schedule (a relative one is @yaks/ui `relative`). The phrase grammar (today, 1 hour ago, 9am)
3
+ // lives in @yaks/query as timeSpan/timeInstant; nothing here parses one.
4
+ import { unitMs } from '@yaks/query'
5
+
6
+ // A stamp in full, the way this machine's locale writes one: what a tooltip
7
+ // over a relative age says.
8
+ export { pretty } from '@yaks/ui/relative'
9
+
10
+ // A stored UTC stamp SHOWN in the running machine's local zone: ISO-8601
11
+ // with the local offset where the `Z` was, so `wake.at` reads as the wall
12
+ // clock an operator keeps while storage and wire stay Zulu. THE display face
13
+ // of a `time` prop — formatProp routes every stamp through here, and the CLI
14
+ // surfaces that print a stamp outside a prop (created/modified, comments, the
15
+ // journal) call it directly; the web feeds relative() from its minute tick.
16
+ // A non-stamp passes through untouched, so a malformed value never vanishes.
17
+ let pad = (n: number) => String(n).padStart(2, '0')
18
+ export let local = (iso: string): string => {
19
+ let d = new Date(iso)
20
+ if (Number.isNaN(+d)) return iso
21
+ let off = -d.getTimezoneOffset() // minutes east of UTC
22
+ let zone = `${off < 0 ? '-' : '+'}${pad(Math.abs(off) / 60 | 0)}:${
23
+ pad(Math.abs(off) % 60)
24
+ }`
25
+ return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T` +
26
+ `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}${zone}`
27
+ }
28
+
29
+ // ——— Recurrence (T-18724, D-18722 part B prereq) ———
30
+ // instant() resolves ONE phrase; a schedule needs the NEXT occurrence.
31
+ // next() names the first instant at-or-after `now` that a schedule fires:
32
+ // 'every 15m' / 'every 1h' / 'every hour' — the epoch-aligned grid, so a
33
+ // cadence is drift-free and whole units land clock-aligned; units run
34
+ // second..week (fixed sizes only — calendar cadence is cron's job).
35
+ // '0 9 * * *' — 5-field cron in LOCAL time: * , - / steps, dow 0-7
36
+ // (7 = Sunday), and the standard OR rule when BOTH dom and dow are
37
+ // restricted.
38
+ // Anything else is null, so a caller stamps the schedule unreadable
39
+ // (M-16612) instead of silently never firing.
40
+
41
+ // One cron field as the set of admitted values. null = unparseable.
42
+ let cronField = (
43
+ s: string,
44
+ lo: number,
45
+ hi: number,
46
+ ): { set: Set<number>; all: boolean } | null => {
47
+ let set = new Set<number>()
48
+ let all = s == '*'
49
+ for (let part of s.split(',')) {
50
+ let m = part.match(/^(\*|\d+(?:-\d+)?)(?:\/(\d+))?$/)
51
+ if (!m) return null
52
+ let [, range, step] = m
53
+ let by = step == null ? 1 : +step
54
+ if (by < 1) return null
55
+ let [a, b] = range == '*'
56
+ ? [lo, hi]
57
+ : range.includes('-')
58
+ ? range.split('-').map(Number)
59
+ : [+range, step == null ? +range : hi]
60
+ if (a < lo || b > hi || a > b) return null
61
+ for (let v = a; v <= b; v += by) set.add(v)
62
+ }
63
+ // dow 7 is Sunday's second name.
64
+ if (hi == 7 && set.delete(7)) set.add(0)
65
+ return { set, all }
66
+ }
67
+
68
+ // Four years covers every leap-year date, so a pattern that can fire does
69
+ // within the bound.
70
+ let CRON_DAYS = 1462
71
+
72
+ // The most days each month runs to, February's in a leap year.
73
+ let LONGEST = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
74
+
75
+ let cronNext = (fields: string[], now: number): number | null => {
76
+ let [mi, h, dom, mo, dow] = [
77
+ cronField(fields[0], 0, 59),
78
+ cronField(fields[1], 0, 23),
79
+ cronField(fields[2], 1, 31),
80
+ cronField(fields[3], 1, 12),
81
+ cronField(fields[4], 0, 7),
82
+ ]
83
+ if (!mi || !h || !dom || !mo || !dow) return null
84
+ // A date no admitted month reaches never comes ('0 9 30 2 *'), unless a
85
+ // restricted weekday may fire in its place.
86
+ let earliest = Math.min(...dom.set)
87
+ if (dow.all && [...mo.set].every((m) => LONGEST[m - 1] < earliest)) {
88
+ return null
89
+ }
90
+ // Cron speaks minutes: at-or-after rounds up to the next whole minute,
91
+ // keeping an exact boundary (:00.000) a match for its own tick.
92
+ let t0 = new Date(Math.ceil(now / 60_000) * 60_000)
93
+ let minutes = [...mi.set].sort((a, b) => a - b)
94
+ let hours = [...h.set].sort((a, b) => a - b)
95
+ for (let day = 0; day < CRON_DAYS; day++) {
96
+ let d = new Date(t0.getFullYear(), t0.getMonth(), t0.getDate() + day)
97
+ // A month the pattern never names is passed over whole: on to its last
98
+ // day, and the loop steps into the next month.
99
+ if (!mo.set.has(d.getMonth() + 1)) {
100
+ let last = new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate()
101
+ day += last - d.getDate()
102
+ continue
103
+ }
104
+ // Standard cron: both restricted = either matches; else the one rules.
105
+ let dayOk = !dom.all && !dow.all
106
+ ? dom.set.has(d.getDate()) || dow.set.has(d.getDay())
107
+ : dom.set.has(d.getDate()) && dow.set.has(d.getDay())
108
+ if (!dayOk) continue
109
+ for (let hh of hours) {
110
+ if (day == 0 && hh < t0.getHours()) continue
111
+ for (let mm of minutes) {
112
+ if (day == 0 && hh == t0.getHours() && mm < t0.getMinutes()) continue
113
+ let at = +new Date(d.getFullYear(), d.getMonth(), d.getDate(), hh, mm)
114
+ if (at >= now) return at
115
+ }
116
+ }
117
+ }
118
+ return null
119
+ }
120
+
121
+ export let next = (s: string, now = Date.now()): number | null => {
122
+ let t = s.trim().toLowerCase().replace(/\s+/g, ' ')
123
+ let m = t.match(/^every (?:(\d+) ?)?([a-z]+)$/)
124
+ if (m) {
125
+ let ms = unitMs(m[2])
126
+ let n = +(m[1] ?? 1)
127
+ if (!ms || n < 1) return null
128
+ let step = n * ms
129
+ return Math.ceil(now / step) * step
130
+ }
131
+ let fields = t.split(' ')
132
+ return fields.length == 5 ? cronNext(fields, now) : null
133
+ }
package/title.js ADDED
@@ -0,0 +1,25 @@
1
+ // Titles derived from component facets, shared by every display door.
2
+ import { idOf } from "./types.js";
3
+ import { relative } from "@yaks/ui";
4
+ import { local } from "./time.js";
5
+ export let wakeTitle = (e, ref, now = Date.now())=>{
6
+ let to = String(e.deliver?.to ?? '');
7
+ let who = to ? idOf(ref(to) ?? {
8
+ eid: to,
9
+ kind: 'entity'
10
+ }) : 'someone';
11
+ return `wake ${who} · ${relative(String(e.wake?.at ?? ''), now)}`;
12
+ };
13
+ export let wakeList = (wakes, to, ref)=>{
14
+ let lines = wakes.toSorted((a, b)=>String((a.comps?.wake ?? a.wake)?.at ?? '').localeCompare(String((b.comps?.wake ?? b.wake)?.at ?? ''))).map((e)=>{
15
+ let wake = e.comps?.wake ?? e.wake;
16
+ let target = String(wake?.target ?? '');
17
+ let note = String(wake?.note ?? '');
18
+ return `- ${idOf(e)} ${local(String(wake?.at ?? ''))}` + (target ? ` → ${idOf(ref(target) ?? {
19
+ eid: target,
20
+ kind: 'entity'
21
+ })}` : '') + (note ? ` — ${note}` : '');
22
+ });
23
+ return `pending wakes for ${idOf(to)} (${lines.length}):` + (lines.length ? `\n${lines.join('\n')}` : ' none');
24
+ };
25
+ //# sourceMappingURL=title.js.map
package/title.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"title.js","sources":["./title.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,SAAS,IAAI,qBAAoB;AACjC,SAAS,QAAQ,wBAA6B;AAC9C,SAAS,KAAK,oBAAmB;AAejC,OAAO,IAAI,YAAY,CACrB,GACA,KACA,MAAM,KAAK,GAAG,EAAE;EAEhB,IAAI,KAAK,OAAO,EAAE,OAAO,EAAE,MAAM;EACjC,IAAI,MAAM,KAAK,KAAK,IAAI,OAAO;IAAE,KAAK;IAAI,MAAM;EAAS,KAAK;EAC9D,OAAO,CAAC,KAAK,EAAE,IAAI,GAAG,EAAE,SAAS,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM;AACnE,EAAC;AAED,OAAO,IAAI,WAAW,CACpB,OACA,IACA;EAEA,IAAI,QAAQ,MAAM,QAAQ,CAAC,CAAC,GAAG,IAC7B,OAAO,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,GAAG,MAAM,IAAI,aAAa,CACvD,OAAO,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,GAAG,MAAM,MAE1C,GAAG,CAAC,CAAC;IACL,IAAI,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI;IAClC,IAAI,SAAS,OAAO,MAAM,UAAU;IACpC,IAAI,OAAO,OAAO,MAAM,QAAQ;IAChC,OAAO,CAAC,EAAE,EAAE,KAAK,GAAG,CAAC,EAAE,MAAM,OAAO,MAAM,MAAM,MAAM,GACpD,CAAC,SACG,CAAC,GAAG,EAAE,KAAK,IAAI,WAAW;MAAE,KAAK;MAAQ,MAAM;IAAS,IAAI,GAC5D,EAAE,IACN,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,EAAE;EAC7B;EACA,OAAO,CAAC,kBAAkB,EAAE,KAAK,IAAI,EAAE,EAAE,MAAM,MAAM,CAAC,EAAE,CAAC,GACvD,CAAC,MAAM,MAAM,GAAG,CAAC,EAAE,EAAE,MAAM,IAAI,CAAC,OAAO,GAAG,OAAO;AACrD,EAAC"}
package/title.ts ADDED
@@ -0,0 +1,50 @@
1
+ // Titles derived from component facets, shared by every display door.
2
+ import { idOf } from './types.js'
3
+ import { relative } from '@yaks/ui'
4
+ import { local } from './time.js'
5
+
6
+ type Face = {
7
+ wake?: { at?: unknown }
8
+ deliver?: { to?: unknown }
9
+ }
10
+ type Ref = { eid: string; kind: string; num?: number | null }
11
+
12
+ type WakeFace = Ref & Face & {
13
+ wake?: { at?: unknown; target?: unknown; note?: unknown }
14
+ comps?: {
15
+ wake?: { at?: unknown; target?: unknown; note?: unknown }
16
+ }
17
+ }
18
+
19
+ export let wakeTitle = (
20
+ e: Face,
21
+ ref: (eid: string) => Ref | undefined,
22
+ now = Date.now(),
23
+ ) => {
24
+ let to = String(e.deliver?.to ?? '')
25
+ let who = to ? idOf(ref(to) ?? { eid: to, kind: 'entity' }) : 'someone'
26
+ return `wake ${who} · ${relative(String(e.wake?.at ?? ''), now)}`
27
+ }
28
+
29
+ export let wakeList = (
30
+ wakes: WakeFace[],
31
+ to: Ref,
32
+ ref: (eid: string) => Ref | undefined,
33
+ ) => {
34
+ let lines = wakes.toSorted((a, b) =>
35
+ String((a.comps?.wake ?? a.wake)?.at ?? '').localeCompare(
36
+ String((b.comps?.wake ?? b.wake)?.at ?? ''),
37
+ )
38
+ ).map((e) => {
39
+ let wake = e.comps?.wake ?? e.wake
40
+ let target = String(wake?.target ?? '')
41
+ let note = String(wake?.note ?? '')
42
+ return `- ${idOf(e)} ${local(String(wake?.at ?? ''))}` +
43
+ (target
44
+ ? ` → ${idOf(ref(target) ?? { eid: target, kind: 'entity' })}`
45
+ : '') +
46
+ (note ? ` — ${note}` : '')
47
+ })
48
+ return `pending wakes for ${idOf(to)} (${lines.length}):` +
49
+ (lines.length ? `\n${lines.join('\n')}` : ' none')
50
+ }
package/tui/doc.ts ADDED
@@ -0,0 +1,6 @@
1
+ // The terminal's document: @yaks/tui's fake DOM, installed as `document` the
2
+ // moment this module loads, so import it before anything renders. `root` is
3
+ // what the app renders into and the painter reads.
4
+ import { install } from 'jsr:@yaks/tui@0.2.36'
5
+
6
+ export let { root } = install()
package/tui/testing.ts ADDED
@@ -0,0 +1,19 @@
1
+ // Tests read the kit's terminal paint without a tty.
2
+ import { lay, place, screenful, type TElement } from 'jsr:@yaks/tui@0.2.36'
3
+ import { composition, sheet as dress } from 'jsr:@yaks/ui@0.2.36'
4
+ let sheet = {
5
+ ...dress(composition),
6
+ Entry_Speaker: { block: true },
7
+ }
8
+ export let pane = (root: TElement) => ({
9
+ lines: lay(root, {}, 120, null, { sheet, metrics: {}, spaced: true }),
10
+ status: [],
11
+ })
12
+
13
+ /** The screen a 120 by 30 terminal paints, as the run loop paints it: its
14
+ * elements then measure themselves by what it painted. */
15
+ export let paint = (root: TElement) => {
16
+ let { lines, hidden } = screenful(root, 120, 30, sheet)
17
+ place(lines, hidden)
18
+ return lines
19
+ }
package/twin.js ADDED
@@ -0,0 +1,11 @@
1
+ // The near-duplicate ("twin") facts the doc view's Similar section reads,
2
+ // kept platform-free and apart from the server's embedder (@yaks/embedding).
3
+ // A doc's text as one string: title and body. A doc with none has no
4
+ // neighbours to ask for.
5
+ export let textOf = (title, body)=>`${String(title ?? '')}\n${String(body ?? '')}`.trim().slice(0, 2000);
6
+ // How close counts as a twin. A floor belongs to the embedder's space, so it
7
+ // moves when the configured model does. In granite-embedding-30m-english, over
8
+ // the tasks known to be duplicates, 0.86 lets the twin through for about three
9
+ // tasks in four, and the nearest task that is not a twin for about two in five.
10
+ export let FLOOR = 0.86;
11
+ //# sourceMappingURL=twin.js.map
package/twin.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"twin.js","sources":["./twin.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,6EAA6E;AAE7E,qEAAqE;AACrE,yBAAyB;AACzB,OAAO,IAAI,SAAS,CAAC,OAAgB,OACnC,GAAG,OAAO,SAAS,IAAI,EAAE,EAAE,OAAO,QAAQ,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,MAAK;AAEvE,6EAA6E;AAC7E,+EAA+E;AAC/E,+EAA+E;AAC/E,gFAAgF;AAChF,OAAO,IAAI,QAAQ,KAAI"}
package/twin.ts ADDED
@@ -0,0 +1,13 @@
1
+ // The near-duplicate ("twin") facts the doc view's Similar section reads,
2
+ // kept platform-free and apart from the server's embedder (@yaks/embedding).
3
+
4
+ // A doc's text as one string: title and body. A doc with none has no
5
+ // neighbours to ask for.
6
+ export let textOf = (title: unknown, body: unknown) =>
7
+ `${String(title ?? '')}\n${String(body ?? '')}`.trim().slice(0, 2000)
8
+
9
+ // How close counts as a twin. A floor belongs to the embedder's space, so it
10
+ // moves when the configured model does. In granite-embedding-30m-english, over
11
+ // the tasks known to be duplicates, 0.86 lets the twin through for about three
12
+ // tasks in four, and the nearest task that is not a twin for about two in five.
13
+ export let FLOOR = 0.86