@yaks/effects 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 (101) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +979 -2
  3. package/_dist/docs.d.ts +10 -0
  4. package/_dist/docs.d.ts.map +1 -0
  5. package/_dist/enqueue.d.ts +12 -0
  6. package/_dist/enqueue.d.ts.map +1 -0
  7. package/_dist/expire.d.ts +31 -0
  8. package/_dist/expire.d.ts.map +1 -0
  9. package/_dist/invocation.d.ts +36 -0
  10. package/_dist/invocation.d.ts.map +1 -0
  11. package/_dist/lease.d.ts +98 -0
  12. package/_dist/lease.d.ts.map +1 -0
  13. package/_dist/mod.d.ts +89 -0
  14. package/_dist/mod.d.ts.map +1 -0
  15. package/_dist/outage.d.ts +48 -0
  16. package/_dist/outage.d.ts.map +1 -0
  17. package/_dist/pool.d.ts +148 -0
  18. package/_dist/pool.d.ts.map +1 -0
  19. package/_dist/provisional.d.ts +8 -0
  20. package/_dist/provisional.d.ts.map +1 -0
  21. package/_dist/ready.d.ts +3 -0
  22. package/_dist/ready.d.ts.map +1 -0
  23. package/_dist/registration.d.ts +17 -0
  24. package/_dist/registration.d.ts.map +1 -0
  25. package/_dist/registry.d.ts +153 -0
  26. package/_dist/registry.d.ts.map +1 -0
  27. package/_dist/tools.d.ts +21 -0
  28. package/_dist/tools.d.ts.map +1 -0
  29. package/_dist/trace.d.ts +63 -0
  30. package/_dist/trace.d.ts.map +1 -0
  31. package/_dist/views.d.ts +15 -0
  32. package/_dist/views.d.ts.map +1 -0
  33. package/_dist/vocab.d.ts +11 -0
  34. package/_dist/vocab.d.ts.map +1 -0
  35. package/_dist/worker.d.ts +19 -0
  36. package/_dist/worker.d.ts.map +1 -0
  37. package/_dist/write.d.ts +25 -0
  38. package/_dist/write.d.ts.map +1 -0
  39. package/cleanup.js +75 -0
  40. package/cleanup.js.map +1 -0
  41. package/cleanup.ts +83 -0
  42. package/deno.json +1 -0
  43. package/docs.js +13 -0
  44. package/docs.js.map +1 -0
  45. package/docs.ts +13 -0
  46. package/enqueue.js +71 -0
  47. package/enqueue.js.map +1 -0
  48. package/enqueue.ts +86 -0
  49. package/expire.js +225 -0
  50. package/expire.js.map +1 -0
  51. package/expire.ts +244 -0
  52. package/invocation.js +245 -0
  53. package/invocation.js.map +1 -0
  54. package/invocation.ts +250 -0
  55. package/lease.js +343 -0
  56. package/lease.js.map +1 -0
  57. package/lease.ts +444 -0
  58. package/mod.js +89 -0
  59. package/mod.js.map +1 -0
  60. package/mod.ts +92 -0
  61. package/outage.js +77 -0
  62. package/outage.js.map +1 -0
  63. package/outage.ts +84 -0
  64. package/package.json +52 -4
  65. package/page.js +315 -0
  66. package/page.js.map +1 -0
  67. package/page.ts +524 -0
  68. package/pool.js +1474 -0
  69. package/pool.js.map +1 -0
  70. package/pool.ts +1635 -0
  71. package/provisional.js +20 -0
  72. package/provisional.js.map +1 -0
  73. package/provisional.ts +26 -0
  74. package/ready.js +48 -0
  75. package/ready.js.map +1 -0
  76. package/ready.ts +93 -0
  77. package/registration.js +21 -0
  78. package/registration.js.map +1 -0
  79. package/registration.ts +43 -0
  80. package/registry.js +872 -0
  81. package/registry.js.map +1 -0
  82. package/registry.ts +1196 -0
  83. package/tools.js +182 -0
  84. package/tools.js.map +1 -0
  85. package/tools.ts +229 -0
  86. package/trace.js +167 -0
  87. package/trace.js.map +1 -0
  88. package/trace.ts +217 -0
  89. package/views.js +18 -0
  90. package/views.js.map +1 -0
  91. package/views.ts +18 -0
  92. package/vocab.js +18 -0
  93. package/vocab.js.map +1 -0
  94. package/vocab.json +364 -0
  95. package/vocab.ts +20 -0
  96. package/worker.js +114 -0
  97. package/worker.js.map +1 -0
  98. package/worker.ts +146 -0
  99. package/write.js +38 -0
  100. package/write.js.map +1 -0
  101. package/write.ts +60 -0
package/outage.js ADDED
@@ -0,0 +1,77 @@
1
+ // The record of a failure that lasts, kept across the tries of whatever keeps
2
+ // failing, so it is told once and its end is logged.
3
+ //
4
+ // A remote that does not answer (an edge's tray, the platform tracker, a
5
+ // model) and a step that keeps failing by the same bug run the same course:
6
+ // the first failure starts an outage, the failures after it ride on in it, one
7
+ // that finds it has lasted the caller's limit reports it once, and the first
8
+ // answer ends it, saying how long it lasted. The record is a value, not a
9
+ // timer: a service keeps it in a variable between passes, a Durable Object in
10
+ // its storage between alarms. What is logged or reported, in what words, is
11
+ // the caller's.
12
+ /** A failure that lasts: since when, the cause it fails by where the caller
13
+ * names one, and whether its lasting has been reported. */ /**
14
+ * A failure at `now`. Met with no outage, it starts one; else it rides on in
15
+ * it, keeping its `since`. A `cause` other than the outage's is fresh, as a
16
+ * new bug is; without one, the outage keeps its own. An outage a failure
17
+ * finds lasted `limit` (default: never) has `stayed`, once.
18
+ *
19
+ * ```ts
20
+ * import { failing } from '@yaks/effects/outage'
21
+ * import { equal } from '@yaks/testing'
22
+ * let { outage } = failing(null, 0)
23
+ * equal(failing(null, 0), { outage: { since: 0 }, fresh: true })
24
+ * equal(failing(outage, 60_000, { limit: 300_000 }), { outage, fresh: false })
25
+ * equal(failing(outage, 300_000, { limit: 300_000 }), {
26
+ * outage: { since: 0, told: true },
27
+ * fresh: false,
28
+ * stayed: 300_000,
29
+ * })
30
+ * equal(failing({ since: 0, cause: 'Error: a' }, 9, { cause: 'Error: b' }), {
31
+ * outage: { since: 0, cause: 'Error: b' },
32
+ * fresh: true,
33
+ * })
34
+ * ```
35
+ */ export let failing = (outage, now, { cause, limit = Infinity } = {})=>{
36
+ if (!outage) {
37
+ return {
38
+ outage: {
39
+ since: now,
40
+ ...cause == null ? {} : {
41
+ cause
42
+ }
43
+ },
44
+ fresh: true
45
+ };
46
+ }
47
+ let fresh = cause != null && cause != outage.cause;
48
+ let rides = fresh ? {
49
+ ...outage,
50
+ cause
51
+ } : outage;
52
+ let lasted = now - outage.since;
53
+ if (rides.told || lasted < limit) return {
54
+ outage: rides,
55
+ fresh
56
+ };
57
+ return {
58
+ outage: {
59
+ ...rides,
60
+ told: true
61
+ },
62
+ fresh,
63
+ stayed: lasted
64
+ };
65
+ };
66
+ /**
67
+ * An answer at `now`: how long the outage it ends had lasted, where it met
68
+ * one.
69
+ *
70
+ * ```ts
71
+ * import { answered } from '@yaks/effects/outage'
72
+ * import { equal } from '@yaks/testing'
73
+ * equal(answered({ since: 1_000 }, 91_000), 90_000)
74
+ * equal(answered(null, 91_000), undefined)
75
+ * ```
76
+ */ export let answered = (outage, now)=>outage ? now - outage.since : undefined;
77
+ //# sourceMappingURL=outage.js.map
package/outage.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outage.js","sources":["./outage.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,qDAAqD;AACrD,EAAE;AACF,yEAAyE;AACzE,4EAA4E;AAC5E,+EAA+E;AAC/E,6EAA6E;AAC7E,0EAA0E;AAC1E,8EAA8E;AAC9E,4EAA4E;AAC5E,gBAAgB;AAEhB;yDACyD,GAezD;;;;;;;;;;;;;;;;;;;;;;CAsBC,GACD,OAAO,IAAI,UAAU,CACnB,QACA,KACA,EAAE,KAAK,EAAE,QAAQ,QAAQ,EAAsC,GAAG,CAAC,CAAC;EAEpE,IAAI,CAAC,QAAQ;IACX,OAAO;MACL,QAAQ;QAAE,OAAO;QAAK,GAAG,SAAS,OAAO,CAAC,IAAI;UAAE;QAAM,CAAC;MAAC;MACxD,OAAO;IACT;EACF;EACA,IAAI,QAAQ,SAAS,QAAQ,SAAS,OAAO,KAAK;EAClD,IAAI,QAAQ,QAAQ;IAAE,GAAG,MAAM;IAAE;EAAM,IAAI;EAC3C,IAAI,SAAS,MAAM,OAAO,KAAK;EAC/B,IAAI,MAAM,IAAI,IAAI,SAAS,OAAO,OAAO;IAAE,QAAQ;IAAO;EAAM;EAChE,OAAO;IAAE,QAAQ;MAAE,GAAG,KAAK;MAAE,MAAM;IAAK;IAAG;IAAO,QAAQ;EAAO;AACnE,EAAC;AAED;;;;;;;;;;CAUC,GACD,OAAO,IAAI,WAAW,CACpB,QACA,MACuB,SAAS,MAAM,OAAO,KAAK,GAAG,UAAS"}
package/outage.ts ADDED
@@ -0,0 +1,84 @@
1
+ // The record of a failure that lasts, kept across the tries of whatever keeps
2
+ // failing, so it is told once and its end is logged.
3
+ //
4
+ // A remote that does not answer (an edge's tray, the platform tracker, a
5
+ // model) and a step that keeps failing by the same bug run the same course:
6
+ // the first failure starts an outage, the failures after it ride on in it, one
7
+ // that finds it has lasted the caller's limit reports it once, and the first
8
+ // answer ends it, saying how long it lasted. The record is a value, not a
9
+ // timer: a service keeps it in a variable between passes, a Durable Object in
10
+ // its storage between alarms. What is logged or reported, in what words, is
11
+ // the caller's.
12
+
13
+ /** A failure that lasts: since when, the cause it fails by where the caller
14
+ * names one, and whether its lasting has been reported. */
15
+ export type Outage = { since: number; cause?: string; told?: true }
16
+
17
+ /** What one failure makes of the outage it met. */
18
+ export type Failing = {
19
+ /** the outage it started or rides on in; the one it met while nothing
20
+ * changed */
21
+ outage: Outage
22
+ /** it started the outage, or failed by a cause other than the one before */
23
+ fresh: boolean
24
+ /** how long the outage has lasted, the one time a failure finds it at
25
+ * `limit` or past it */
26
+ stayed?: number
27
+ }
28
+
29
+ /**
30
+ * A failure at `now`. Met with no outage, it starts one; else it rides on in
31
+ * it, keeping its `since`. A `cause` other than the outage's is fresh, as a
32
+ * new bug is; without one, the outage keeps its own. An outage a failure
33
+ * finds lasted `limit` (default: never) has `stayed`, once.
34
+ *
35
+ * ```ts
36
+ * import { failing } from '@yaks/effects/outage'
37
+ * import { equal } from '@yaks/testing'
38
+ * let { outage } = failing(null, 0)
39
+ * equal(failing(null, 0), { outage: { since: 0 }, fresh: true })
40
+ * equal(failing(outage, 60_000, { limit: 300_000 }), { outage, fresh: false })
41
+ * equal(failing(outage, 300_000, { limit: 300_000 }), {
42
+ * outage: { since: 0, told: true },
43
+ * fresh: false,
44
+ * stayed: 300_000,
45
+ * })
46
+ * equal(failing({ since: 0, cause: 'Error: a' }, 9, { cause: 'Error: b' }), {
47
+ * outage: { since: 0, cause: 'Error: b' },
48
+ * fresh: true,
49
+ * })
50
+ * ```
51
+ */
52
+ export let failing = (
53
+ outage: Outage | null | undefined,
54
+ now: number,
55
+ { cause, limit = Infinity }: { cause?: string; limit?: number } = {},
56
+ ): Failing => {
57
+ if (!outage) {
58
+ return {
59
+ outage: { since: now, ...cause == null ? {} : { cause } },
60
+ fresh: true,
61
+ }
62
+ }
63
+ let fresh = cause != null && cause != outage.cause
64
+ let rides = fresh ? { ...outage, cause } : outage
65
+ let lasted = now - outage.since
66
+ if (rides.told || lasted < limit) return { outage: rides, fresh }
67
+ return { outage: { ...rides, told: true }, fresh, stayed: lasted }
68
+ }
69
+
70
+ /**
71
+ * An answer at `now`: how long the outage it ends had lasted, where it met
72
+ * one.
73
+ *
74
+ * ```ts
75
+ * import { answered } from '@yaks/effects/outage'
76
+ * import { equal } from '@yaks/testing'
77
+ * equal(answered({ since: 1_000 }, 91_000), 90_000)
78
+ * equal(answered(null, 91_000), undefined)
79
+ * ```
80
+ */
81
+ export let answered = (
82
+ outage: Outage | null | undefined,
83
+ now: number,
84
+ ): number | undefined => outage ? now - outage.since : undefined
package/package.json CHANGED
@@ -1,6 +1,54 @@
1
1
  {
2
2
  "name": "@yaks/effects",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.36",
4
+ "homepage": "https://jsr.io/@yaks/effects",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./_dist/mod.d.ts",
9
+ "default": "./mod.js"
10
+ },
11
+ "./invocation": {
12
+ "types": "./_dist/invocation.d.ts",
13
+ "default": "./invocation.js"
14
+ },
15
+ "./vocab": {
16
+ "types": "./_dist/vocab.d.ts",
17
+ "default": "./vocab.js"
18
+ },
19
+ "./tools": {
20
+ "types": "./_dist/tools.d.ts",
21
+ "default": "./tools.js"
22
+ },
23
+ "./lease": {
24
+ "types": "./_dist/lease.d.ts",
25
+ "default": "./lease.js"
26
+ },
27
+ "./outage": {
28
+ "types": "./_dist/outage.d.ts",
29
+ "default": "./outage.js"
30
+ },
31
+ "./views": {
32
+ "types": "./_dist/views.d.ts",
33
+ "default": "./views.js"
34
+ }
35
+ },
36
+ "license": "Apache-2.0",
37
+ "dependencies": {
38
+ "@yaks/fp": "0.2.36",
39
+ "@yaks/graph": "0.2.36",
40
+ "@yaks/id": "0.2.36",
41
+ "@yaks/inspect": "0.2.36",
42
+ "@yaks/match": "0.2.36",
43
+ "@yaks/query": "0.2.36",
44
+ "@yaks/tools": "0.2.36",
45
+ "@yaks/trace": "0.2.36",
46
+ "@yaks/ui": "0.2.36",
47
+ "@yaks/vocab": "0.2.36",
48
+ "@types/react": "19.3.0",
49
+ "lucide": "1.31.0",
50
+ "react": "19.3.0"
51
+ },
52
+ "description": "Runs application code after graph changes commit, with isolated failures, an optional pool for persisted runs, and leases for work held by one process.",
53
+ "repository": "https://github.com/yak-sh/yak.git"
54
+ }
package/page.js ADDED
@@ -0,0 +1,315 @@
1
+ /**
2
+ * The page the browsing app's sidebar offers as Effects: the processes
3
+ * working the effect pool, how busy each is and what it is running, how fast
4
+ * runs end, and the runs owed behind them, by handler. It moves as the
5
+ * workers say themselves, every fifteen seconds (./worker.ts `SAY`).
6
+ *
7
+ * Where each number comes from:
8
+ * - workers, what each is running, runs a second and how busy each is: the
9
+ * `worker` row every process working the pool writes on itself
10
+ * (./worker.ts). A worker is up while that row is fresh;
11
+ * - running, waiting, retrying and failed by handler: the `effect` rows
12
+ * themselves, tallied by handler (./pool.ts), for every effect the
13
+ * vocabulary declares, each named by its `_effect` row (@yaks/vocab), so
14
+ * one owed nothing still shows.
15
+ *
16
+ * @module
17
+ */ /* @ts-types="npm:@types/react@19.3.0" */ import { createElement as h, useEffect, useState } from "react";
18
+ import { effectEid, mention, useNamed } from "@yaks/inspect";
19
+ import { Head, Loading, Meter, Metrics, Section, Spark, Table } from "@yaks/ui";
20
+ import { effectsIn } from "@yaks/vocab";
21
+ import { rate, said, SAY } from "./worker.js";
22
+ /** How long a worker may say nothing before it reads as silent (ms): two of
23
+ * its turns to say something. */ export let QUIET = 2 * SAY;
24
+ /** How long a silent worker is still shown (ms); past this it is long gone,
25
+ * whatever its process row says. */ export let FORGOTTEN = 10 * 60_000;
26
+ /** What a process is called: the name its unit gave it, or what it runs. */ /// called('deno work --process yak-work --config x') -> 'yak-work'
27
+ /// called('deno browse --config x') -> 'browse'
28
+ /// called() -> 'process'
29
+ export let called = (command = '')=>{
30
+ let words = command.split(/\s+/).filter(Boolean);
31
+ return command.match(/--process[ =](\S+)/)?.[1] ?? words[1] ?? words[0] ?? 'process';
32
+ };
33
+ /** How long something has lasted, in its two largest units. */ /// lasted(12_400) -> '12s'
34
+ /// lasted(192_000) -> '3m 12s'
35
+ /// lasted(3 * 3_600_000 + 60_000) -> '3h 1m'
36
+ /// lasted(50 * 3_600_000) -> '2d 2h'
37
+ export let lasted = (ms)=>{
38
+ let s = Math.max(0, Math.floor(ms / 1000));
39
+ let d = Math.floor(s / 86_400), h = Math.floor(s / 3600) % 24;
40
+ let m = Math.floor(s / 60) % 60;
41
+ return d ? `${d}d ${h}h` : h ? `${h}h ${m}m` : m ? `${m}m ${s % 60}s` : `${s}s`;
42
+ };
43
+ /** Runs a second, as a person reads them. */ /// perSecond(0) -> '0'
44
+ /// perSecond(0.4) -> '0.4'
45
+ /// perSecond(12.6) -> '13'
46
+ /// perSecond(1234) -> '1,234'
47
+ export let perSecond = (n)=>n == 0 ? '0' : n < 10 ? n.toFixed(1) : Math.round(n).toLocaleString('en-US');
48
+ /** Several workers' histories as one, second by second, their newest seconds
49
+ * lined up. */ /// together([[1, 2, 3], [0, 1]]) -> [1, 2, 4]
50
+ /// together([]) -> []
51
+ export let together = (histories)=>{
52
+ let n = Math.max(0, ...histories.map((h)=>h.length));
53
+ return Array.from({
54
+ length: n
55
+ }, (_, i)=>histories.reduce((sum, h)=>sum + (h[h.length - n + i] ?? 0), 0));
56
+ };
57
+ /** The workers worth showing, by name: every one that said something in the
58
+ * last {@link FORGOTTEN}, with how long ago. */ /// let w = (eid: string, at: string) => ({ entity: { eid }, worker: { at }, process: { pid: 7, command: 'deno work --process yak-work' } })
59
+ /// let now = Date.parse('2026-01-01T00:00:10Z')
60
+ /// workers([w('a', '2026-01-01T00:00:09Z'), w('b', '2026-01-01T00:00:00Z'), w('c', '2025-01-01T00:00:00Z')], now).map((s) => [s.eid, s.name, s.silent])
61
+ /// -> [['a', 'yak-work', 1000], ['b', 'yak-work', 10000]]
62
+ export let workers = (rows, now)=>rows.flatMap((b)=>{
63
+ let w = said(b);
64
+ if (!w) return [];
65
+ let silent = Math.max(0, now - Date.parse(w.at));
66
+ if (!(silent <= FORGOTTEN)) return [];
67
+ let p = b.process ?? {};
68
+ let born = b.created?.at;
69
+ return [
70
+ {
71
+ eid: b.entity.eid,
72
+ name: called(p.command),
73
+ pid: p.pid,
74
+ born,
75
+ w,
76
+ silent
77
+ }
78
+ ];
79
+ }).sort((a, b)=>a.name.localeCompare(b.name) || (a.pid ?? 0) - (b.pid ?? 0) || a.eid.localeCompare(b.eid));
80
+ /** The runs owed by handler, from the `effect` rows' tallies: every handler
81
+ * owed something, and each of `declared` though it is owed nothing. The
82
+ * busiest first, then the most failed, then by name. */ /// handlers({ owed: { a: 3, b: 1 }, claimed: { a: 1 }, retrying: { b: 1 }, failed: { c: 2, b: 1 } }).map((o) => Object.values(o))
83
+ /// -> [['a', 1, 2, 0, 0], ['b', 0, 1, 1, 1], ['c', 0, 0, 0, 2]]
84
+ /// handlers({}, ['z']) -> [{ handler: 'z', running: 0, waiting: 0, retrying: 0, failed: 0 }]
85
+ export let handlers = (t, declared = [])=>{
86
+ let n = (x, k)=>x?.[k] ?? 0;
87
+ let names = new Set([
88
+ ...declared,
89
+ ...[
90
+ t.owed,
91
+ t.claimed,
92
+ t.retrying,
93
+ t.failed
94
+ ].flatMap((x)=>Object.keys(x ?? {}))
95
+ ]);
96
+ return [
97
+ ...names
98
+ ].map((handler)=>({
99
+ handler,
100
+ running: n(t.claimed, handler),
101
+ waiting: Math.max(0, n(t.owed, handler) - n(t.claimed, handler)),
102
+ retrying: n(t.retrying, handler),
103
+ failed: n(t.failed, handler)
104
+ })).sort((a, b)=>b.running + b.waiting - a.running - a.waiting || b.failed - a.failed || a.handler.localeCompare(b.handler));
105
+ };
106
+ // What the page asks: every worker still running with its process, and the
107
+ // effect rows owed, tallied by handler four ways.
108
+ let asks = (_e, io)=>{
109
+ let has = (c)=>!!io.vocab.comp(c);
110
+ return {
111
+ workers: `.worker${has('exit') ? '&!exit' : ''}` + [
112
+ 'process',
113
+ 'created'
114
+ ].filter(has).map((c)=>`&?${c}`).join('') + '&.limit=100',
115
+ owed: '.effect.state=pending&.tally=effect.handler',
116
+ claimed: '.effect.state=pending&.effect.lease_owner&.tally=effect.handler',
117
+ retrying: '.effect.state=pending&.effect.error&.tally=effect.handler',
118
+ failed: '.effect.state=failed&.tally=effect.handler'
119
+ };
120
+ };
121
+ // The clock the page reads, moving every second while it is drawn.
122
+ let useNow = (every = 1000)=>{
123
+ let [now, set] = useState(()=>Date.now());
124
+ useEffect(()=>{
125
+ let timer = setInterval(()=>set(Date.now()), every);
126
+ return ()=>clearInterval(timer);
127
+ }, [
128
+ every
129
+ ]);
130
+ return now;
131
+ };
132
+ let { Body, Cell, Heading, Row } = Table;
133
+ let heads = (...names)=>/*#__PURE__*/ h(Table.Head, {}, /*#__PURE__*/ h(Row, {}, names.map((n)=>typeof n == 'string' ? /*#__PURE__*/ h(Heading, {
134
+ key: n
135
+ }, n) : /*#__PURE__*/ h(Heading, {
136
+ key: n[0],
137
+ mod: n[1]
138
+ }, n[0]))));
139
+ // A count that opens the runs it counts; nothing where there are none.
140
+ let count = (io, n, query)=>n ? /*#__PURE__*/ h('a', {
141
+ href: io.find(query)
142
+ }, n.toLocaleString('en-US')) : '';
143
+ let stat = (value, label, mod, note)=>/*#__PURE__*/ h(Metrics.Item, {}, /*#__PURE__*/ h(Metrics.Value, {
144
+ mod
145
+ }, value), /*#__PURE__*/ h(Metrics.Label, {}, label), note ? /*#__PURE__*/ h(Metrics.Note, {}, note) : null);
146
+ let percent = (n)=>`${Math.round(n * 100)}%`;
147
+ // The workers, one a row: how busy, how fast, how much, and how long up.
148
+ let Workers = ({ io, seen, now })=>/*#__PURE__*/ h(Section, {}, /*#__PURE__*/ h(Section.Title, {}, 'Workers'), /*#__PURE__*/ h(Section.Sub, {}, 'Each process working the pool. Busy is the share of a core it used; loop is how late its thread ran a timer, which climbs as its event loop fills.'), seen.length ? /*#__PURE__*/ h(Table, {
149
+ cols: [
150
+ null,
151
+ null,
152
+ 'num',
153
+ null,
154
+ 'num',
155
+ 'num',
156
+ 'num',
157
+ null
158
+ ]
159
+ }, heads('worker', 'busy', [
160
+ 'loop',
161
+ 'num'
162
+ ], 'runs a second', [
163
+ 'running',
164
+ 'num'
165
+ ], [
166
+ 'finished',
167
+ 'num'
168
+ ], [
169
+ 'errors',
170
+ 'num'
171
+ ], 'up'), /*#__PURE__*/ h(Body, {}, seen.map(({ eid, name, pid, born, w, silent })=>/*#__PURE__*/ h(Row, {
172
+ key: eid,
173
+ 'data-worker': eid
174
+ }, /*#__PURE__*/ h(Cell, {}, /*#__PURE__*/ h('a', {
175
+ href: io.link(eid)
176
+ }, name), pid ? ` ${pid}` : ''), /*#__PURE__*/ h(Cell, {}, w.cpu == null ? '' : [
177
+ /*#__PURE__*/ h(Meter, {
178
+ value: w.cpu,
179
+ width: 10
180
+ }),
181
+ ' ',
182
+ percent(w.cpu)
183
+ ]), /*#__PURE__*/ h(Cell, {
184
+ mod: 'num'
185
+ }, w.lag == null ? '' : `${w.lag} ms`), /*#__PURE__*/ h(Cell, {}, /*#__PURE__*/ h(Spark, {
186
+ values: w.history.slice(-20)
187
+ }), ` ${perSecond(rate(w.history))}`), /*#__PURE__*/ h(Cell, {
188
+ mod: 'num'
189
+ }, String(w.running)), /*#__PURE__*/ h(Cell, {
190
+ mod: 'num'
191
+ }, w.ran.toLocaleString('en-US')), /*#__PURE__*/ h(Cell, {
192
+ mod: 'num'
193
+ }, w.errors.toLocaleString('en-US')), /*#__PURE__*/ h(Cell, {
194
+ 'data-silent': silent >= QUIET ? '' : undefined
195
+ }, silent >= QUIET ? `silent ${lasted(silent)}` : born ? lasted(now - Date.parse(born)) : ''))))) : /*#__PURE__*/ h(Section.Sub, {
196
+ role: 'status'
197
+ }, 'No process is working the pool, so nothing owed runs until one starts.'));
198
+ // Every run going in a worker that is up, the longest first.
199
+ let Running = ({ io, up, now })=>{
200
+ let runs = up.flatMap((s)=>s.w.runs.map((r)=>({
201
+ ...r,
202
+ by: s
203
+ }))).sort((a, b)=>a.since.localeCompare(b.since));
204
+ let unlisted = up.reduce((n, s)=>n + s.w.running - s.w.runs.length, 0);
205
+ useNamed(io, runs.map((r)=>r.target));
206
+ return /*#__PURE__*/ h(Section, {}, /*#__PURE__*/ h(Section.Title, {}, 'Running now', ' ', /*#__PURE__*/ h(Section.Count, {}, String(runs.length + unlisted))), runs.length ? /*#__PURE__*/ h(Table, {
207
+ cols: [
208
+ null,
209
+ null,
210
+ null,
211
+ 'num'
212
+ ]
213
+ }, heads('handler', 'for', 'worker', [
214
+ 'running for',
215
+ 'num'
216
+ ]), /*#__PURE__*/ h(Body, {}, runs.map((r)=>/*#__PURE__*/ h(Row, {
217
+ key: r.run,
218
+ 'data-run': r.run
219
+ }, /*#__PURE__*/ h(Cell, {}, r.handler), /*#__PURE__*/ h(Cell, {}, mention(io, r.target)), /*#__PURE__*/ h(Cell, {}, r.by.name), /*#__PURE__*/ h(Cell, {
220
+ mod: 'num'
221
+ }, lasted(now - Date.parse(r.since))))), unlisted > 0 ? /*#__PURE__*/ h(Row, {
222
+ mod: 'quiet'
223
+ }, /*#__PURE__*/ h(Cell, {}, `and ${unlisted.toLocaleString('en-US')} more`)) : null)) : /*#__PURE__*/ h(Section.Sub, {}, 'Nothing is running.'));
224
+ };
225
+ // What each handler is owed: going, waiting, retrying and failed, each a
226
+ // link to those runs; its name, a link to its declaration. One owed nothing
227
+ // steps back.
228
+ let Handlers = ({ io, owed })=>{
229
+ let of = (handler, rest)=>`.effect.handler=${handler}&${rest}&?effect`;
230
+ return /*#__PURE__*/ h(Section, {}, /*#__PURE__*/ h(Section.Title, {}, 'By handler'), /*#__PURE__*/ h(Section.Sub, {}, 'The runs each declared effect is owed. Retrying ones failed before and wait out their backoff; failed ones spent their tries and wait for a person.'), owed.length ? /*#__PURE__*/ h(Table, {
231
+ cols: [
232
+ null,
233
+ 'num',
234
+ 'num',
235
+ 'num',
236
+ 'num'
237
+ ]
238
+ }, heads('handler', [
239
+ 'running',
240
+ 'num'
241
+ ], [
242
+ 'waiting',
243
+ 'num'
244
+ ], [
245
+ 'retrying',
246
+ 'num'
247
+ ], [
248
+ 'failed',
249
+ 'num'
250
+ ]), /*#__PURE__*/ h(Body, {}, owed.map((o)=>/*#__PURE__*/ h(Row, {
251
+ key: o.handler,
252
+ 'data-handler': o.handler,
253
+ mod: o.running + o.waiting + o.failed ? undefined : 'quiet'
254
+ }, /*#__PURE__*/ h(Cell, {}, /*#__PURE__*/ h('a', {
255
+ href: io.link(effectEid(io.vocab, o.handler))
256
+ }, o.handler)), /*#__PURE__*/ h(Cell, {
257
+ mod: 'num'
258
+ }, count(io, o.running, of(o.handler, '.effect.lease_owner'))), /*#__PURE__*/ h(Cell, {
259
+ mod: 'num'
260
+ }, count(io, o.waiting, of(o.handler, '.effect.state=pending&!effect.lease_owner'))), /*#__PURE__*/ h(Cell, {
261
+ mod: 'num'
262
+ }, count(io, o.retrying, of(o.handler, '.effect.state=pending&.effect.error'))), /*#__PURE__*/ h(Cell, {
263
+ mod: 'num'
264
+ }, count(io, o.failed, of(o.handler, '.effect.state=failed'))))))) : /*#__PURE__*/ h(Section.Sub, {}, 'Nothing is owed: every run has ended.'));
265
+ };
266
+ let waiting = (got, what)=>got?.error ? /*#__PURE__*/ h(Section.Sub, {
267
+ role: 'alert'
268
+ }, got.error) : !got?.ready ? /*#__PURE__*/ h(Loading, {}, `Loading ${what}…`) : null;
269
+ /** The page. */ export let EffectsPage = ({ got, io })=>{
270
+ let now = useNow();
271
+ let seen = workers(got.workers?.rows ?? [], now);
272
+ let up = seen.filter((s)=>s.silent < QUIET);
273
+ let owed = handlers({
274
+ owed: got.owed?.tally,
275
+ claimed: got.claimed?.tally,
276
+ retrying: got.retrying?.tally,
277
+ failed: got.failed?.tally
278
+ }, io.vocab.docs.flatMap((d)=>effectsIn(d).map((x)=>x.name)));
279
+ let total = (k)=>owed.reduce((n, o)=>n + o[k], 0);
280
+ let history = together(up.map((s)=>s.w.history));
281
+ let speed = rate(history);
282
+ let running = up.reduce((n, s)=>n + s.w.running, 0);
283
+ let silent = seen.length - up.length;
284
+ let left = total('waiting'), retrying = total('retrying');
285
+ let failed = total('failed');
286
+ return /*#__PURE__*/ h('article', {
287
+ 'data-effects': ''
288
+ }, /*#__PURE__*/ h(Head, {}, /*#__PURE__*/ h(Head.Title, {}, 'Effects'), /*#__PURE__*/ h(Head.Sub, {}, 'The work a write leaves behind, and the processes doing it: how many are up, how busy each is, what each is running and how fast runs end, then what waits behind them.')), waiting(got.workers, 'the workers') ?? [
289
+ /*#__PURE__*/ h(Metrics, {}, stat(String(up.length), up.length == 1 ? 'worker up' : 'workers up', !up.length && left ? 'negative' : undefined, silent ? `${silent} silent` : null), stat(String(running), 'running now'), stat(perSecond(speed), 'runs a second', undefined, /*#__PURE__*/ h(Spark, {
290
+ values: history
291
+ })), stat(left.toLocaleString('en-US'), 'waiting', undefined, retrying ? `${retrying.toLocaleString('en-US')} retrying` : null), stat(failed.toLocaleString('en-US'), 'failed', failed ? 'negative' : undefined)),
292
+ /*#__PURE__*/ h(Workers, {
293
+ io,
294
+ seen,
295
+ now
296
+ }),
297
+ /*#__PURE__*/ h(Running, {
298
+ io,
299
+ up,
300
+ now
301
+ })
302
+ ], waiting(got.owed, 'what is owed') ?? /*#__PURE__*/ h(Handlers, {
303
+ io,
304
+ owed
305
+ }));
306
+ };
307
+ /** The views this package draws. */ export let inspectViews = [
308
+ {
309
+ view: 'Effects.Page',
310
+ match: true,
311
+ asks,
312
+ Render: EffectsPage
313
+ }
314
+ ];
315
+ //# sourceMappingURL=page.js.map
package/page.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page.js","sources":["./page.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;CAgBC,GACD,uCAAuC,GAAG,SACxC,iBAAiB,CAAC,EAGlB,SAAS,EACT,QAAQ,gBACe;AACzB,SAGE,SAAS,EAET,OAAO,EAEP,QAAQ,6BAEuB;AACjC,SAAS,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,wBAA6B;AAC1F,SAAS,SAAS,2BAAgC;AAClD,SAAS,IAAI,EAAE,IAAI,EAAE,GAAG,sBAAkC;AAE1D;+BAC+B,GAC/B,OAAO,IAAI,QAAQ,IAAI,IAAG;AAE1B;kCACkC,GAClC,OAAO,IAAI,YAAY,KAAK,OAAM;AAElC,0EAA0E,GAC1E,mEAAmE;AACnE,gDAAgD;AAChD,yBAAyB;AACzB,OAAO,IAAI,SAAS,CAAC,UAAU,EAAE;EAC/B,IAAI,QAAQ,QAAQ,KAAK,CAAC,OAAO,MAAM,CAAC;EACxC,OAAO,QAAQ,KAAK,CAAC,uBAAuB,CAAC,EAAE,IAAI,KAAK,CAAC,EAAE,IAAI,KAAK,CAAC,EAAE,IACrE;AACJ,EAAC;AAED,6DAA6D,GAC7D,2BAA2B;AAC3B,+BAA+B;AAC/B,6CAA6C;AAC7C,qCAAqC;AACrC,OAAO,IAAI,SAAS,CAAC;EACnB,IAAI,IAAI,KAAK,GAAG,CAAC,GAAG,KAAK,KAAK,CAAC,KAAK;EACpC,IAAI,IAAI,KAAK,KAAK,CAAC,IAAI,SAAS,IAAI,KAAK,KAAK,CAAC,IAAI,QAAQ;EAC3D,IAAI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