akanjs 3.2.0-rc.0 → 3.2.0-rc.1

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.
package/CHANGELOG.md CHANGED
@@ -410,6 +410,11 @@
410
410
  - **A write leaves untouched `search()` values as they were.** An array `search()` value used to be parsed again on every write, as a new array, so a component reading it rendered again on writes it did not read.
411
411
  - **`set` with a `search()` or `computed()` key** now throws before it writes anything. Before, the state was already replaced when it threw.
412
412
 
413
+ - 6291fec: Akan Studio opens without a dev builder, and names every job in full.
414
+
415
+ - **`/_akan/studio` with no dev builder** lands on the Runtime view, which reads the running server, instead of answering 503 with nothing to click. A view that needs the builder (ERD, Signals, Changes, Framework) still answers 503, now inside Studio's header and nav, saying to open it under `akan start` and that Runtime needs no builder. A failed build shows its error the same way.
416
+ - **Each job row** carries its full name and schedule as a tooltip (`cron syncAccountBalances · 0 * * * *`), with the skip reason below it for a job this server does not run, so two long names clipped alike can be told apart.
417
+
413
418
  - 0c480c6: The signal-test harness clears the env cache once it has set the test port, so a fetch client built after setup reaches the test server even when a module read `getEnv()` before the harness ran.
414
419
  - d9eaacc: A socket that is down keeps at most 100 messages emitted meanwhile, dropping the oldest, and says how many it dropped when it reconnects. Before, the outbox grew without end, so a stream of emits (a cursor, a typing signal) on a tab offline for minutes held every one of them and sent them all at once on reconnect. `configureWs({ outboxLimit })` sets the cap, and `0` keeps none. Room subscriptions never queue there and are sent again on every open, as before.
415
420
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akanjs",
3
- "version": "3.2.0-rc.0",
3
+ "version": "3.2.0-rc.1",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -676,7 +676,9 @@ for it to be added.
676
676
  `/_akan/studio?view=runtime` draws `/_akan/deps` and `/_akan/signal` as one picture, next to Studio's
677
677
  source-built views (ERD, Signals, Changes, Framework). It calls the same serializers in process, so it reads the
678
678
  container of the process that answered and needs that server running; the header says which (`pid`,
679
- `serverMode`, `replicaIdx`).
679
+ `serverMode`, `replicaIdx`). It needs no dev builder, so `/_akan/studio` with no `view` lands on it when no
680
+ builder answers; a source-built view asked for then answers 503 inside Studio's nav, saying to open it under
681
+ `akan start`.
680
682
 
681
683
  - **Columns.** Jobs, then services by boot stage, then adaptors by boot stage. An injection always targets
682
684
  an earlier stage, so the latest stage stands leftmost and every arrow points from what injects to what it
@@ -684,8 +686,9 @@ container of the process that answered and needs that server running; the header
684
686
  - **Edges.** `database`, `service`, `plug` and `memory` injections, one arrow per `from|to|kind` with every
685
687
  prop in its title. `env`, `use` and `signal` injections are left out (see §7).
686
688
  - **Jobs.** One box per internal class that declares a job, one row per job with its schedule; `resolveField`
687
- internals are not jobs and are left out. A row the process does not run (`scheduledHere: false`) is greyed,
688
- and its `skipReason` is the row's tooltip. Behind the gateway only a `federation` or `all` child answers, so
689
+ internals are not jobs and are left out. Each row's tooltip names the job in full with its schedule
690
+ (`cron syncAccountBalances · 0 * * * *`). A row the process does not run (`scheduledHere: false`) is greyed,
691
+ and its `skipReason` is the tooltip's second line. Behind the gateway only a `federation` or `all` child answers, so
689
692
  with separate `federation` and `batch` replicas every `serverMode: "batch"` job is greyed: it runs on a
690
693
  batch child, which Studio never reads.
691
694
  - **`disabledModules`** are listed under the diagram.
@@ -96,18 +96,7 @@ export class StudioDocument {
96
96
  <header>
97
97
  <strong>Akan Studio</strong>
98
98
  <span className="muted">{appName}</span>
99
- <nav>
100
- {views.map((view) => (
101
- <a
102
- key={view}
103
- href={hrefOf({ view })}
104
- title={viewTitles[view]}
105
- aria-current={view === query.view ? "page" : undefined}
106
- >
107
- {viewLabels[view]}
108
- </a>
109
- ))}
110
- </nav>
99
+ {StudioDocument.#views(basePath, query)}
111
100
  <form method="get" action={basePath} hidden={query.view === "framework"}>
112
101
  <input type="hidden" name="view" value={query.view} />
113
102
  <input type="hidden" name="editor" value={query.editor} />
@@ -230,22 +219,47 @@ export class StudioDocument {
230
219
  );
231
220
  }
232
221
 
233
- static unavailable(appName: string, reason: string) {
222
+ static unavailable({ basePath, appName, query, reason }: Omit<StudioDocumentProps, "payload"> & { reason: string }) {
234
223
  return (
235
224
  <html lang="en">
236
225
  <head>
237
226
  <meta charSet="utf-8" />
227
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
238
228
  <title>{`Akan Studio · ${appName}`}</title>
239
229
  <style>{studioStyle}</style>
240
230
  </head>
241
231
  <body>
242
- <p className="empty">{reason}</p>
232
+ <header>
233
+ <strong>Akan Studio</strong>
234
+ <span className="muted">{appName}</span>
235
+ {StudioDocument.#views(basePath, query)}
236
+ </header>
237
+ <main>
238
+ <p className="empty">{reason}</p>
239
+ </main>
243
240
  {StudioDocument.#runtime()}
244
241
  </body>
245
242
  </html>
246
243
  );
247
244
  }
248
245
 
246
+ static #views(basePath: string, query: StudioQuery) {
247
+ return (
248
+ <nav>
249
+ {views.map((view) => (
250
+ <a
251
+ key={view}
252
+ href={StudioDocument.href(basePath, { ...query, view })}
253
+ title={viewTitles[view]}
254
+ aria-current={view === query.view ? "page" : undefined}
255
+ >
256
+ {viewLabels[view]}
257
+ </a>
258
+ ))}
259
+ </nav>
260
+ );
261
+ }
262
+
249
263
  static #runtime() {
250
264
  return (
251
265
 
@@ -348,7 +362,7 @@ export class StudioDocument {
348
362
  </text>
349
363
  {rows.map((row, idx) => (
350
364
  <a key={idx} href={openOf(row.at)}>
351
- {row.skipped ? <title>{row.skipped}</title> : null}
365
+ {row.title || row.skipped ? <title>{[row.title, row.skipped].filter(Boolean).join("\n")}</title> : null}
352
366
  <text className={row.skipped ? "skipped" : row.change} x={x + 12} y={row.y + 4}>
353
367
  {clip(
354
368
  row.change ? `${changeSigns[row.change]} ${row.text}` : row.text,
@@ -31,6 +31,7 @@ export interface StudioRow {
31
31
  at: AkanGraphLocation | null;
32
32
  change?: AkanGraphChange;
33
33
  skipped?: string;
34
+ title?: string;
34
35
  }
35
36
 
36
37
  export interface StudioBox {
@@ -39,10 +39,18 @@ export class StudioRoute {
39
39
 
40
40
  async page(req: Request): Promise<Response> {
41
41
  const { basePath, appName } = this.#context;
42
- const query = StudioRoute.queryOf(new URL(req.url));
43
- const loaded = await this.#load(query);
44
- if ("error" in loaded) return await StudioRoute.#html(StudioDocument.unavailable(appName, loaded.error), 503);
45
- return await StudioRoute.#html(StudioDocument.render({ basePath, appName, payload: loaded.payload, query }), 200);
42
+ const url = new URL(req.url);
43
+ const asked = StudioRoute.queryOf(url);
44
+ const loaded = await this.#load(asked);
45
+ const landed = "error" in loaded && loaded.builderless && !url.searchParams.has("view");
46
+ const query: StudioQuery = landed ? { ...asked, view: "runtime" } : asked;
47
+ const shown = landed ? await this.#load(query) : loaded;
48
+ if ("error" in shown)
49
+ return await StudioRoute.#html(
50
+ StudioDocument.unavailable({ basePath, appName, query, reason: shown.error }),
51
+ 503,
52
+ );
53
+ return await StudioRoute.#html(StudioDocument.render({ basePath, appName, payload: shown.payload, query }), 200);
46
54
  }
47
55
 
48
56
  async graph(req: Request): Promise<Response> {
@@ -59,17 +67,21 @@ export class StudioRoute {
59
67
  return buildGraph ? await buildGraph() : null;
60
68
  }
61
69
 
62
- async #load(query: StudioQuery): Promise<{ payload: StudioPayload } | { error: string }> {
70
+ async #load(query: StudioQuery): Promise<{ payload: StudioPayload } | { error: string; builderless: boolean }> {
63
71
  if (query.view === "runtime") return { payload: this.#context.runtime() };
64
72
  try {
65
73
  const payload = await this.#payloadOf(query);
66
74
  return payload
67
75
  ? { payload }
68
- : { error: "Akan Studio reads the graph from the dev builder; open it under `akan start`." };
76
+ : {
77
+ error:
78
+ "Akan Studio reads this view from the dev builder; open it under `akan start`. Runtime (live) reads this running server and needs no builder.",
79
+ builderless: true,
80
+ };
69
81
  } catch (error) {
70
82
  const message = error instanceof Error ? error.message : String(error);
71
83
  StudioRoute.logger.warn(`Failed to build the Akan Graph: ${message}`);
72
- return { error: message };
84
+ return { error: message, builderless: false };
73
85
  }
74
86
  }
75
87
 
@@ -38,10 +38,7 @@ export class StudioRuntimeGraph {
38
38
  this.columns = [
39
39
  { label: "Jobs", nodes: internals },
40
40
  ...StudioRuntimeGraph.#byStage(services, deps.stages.service.length, "Services", (node) =>
41
- StudioRuntimeGraph.#node(node, node.refName, [
42
- ...(node.serviceType === "database" ? ["database"] : []),
43
- ...(node.enabled === false ? ["disabled"] : []),
44
- ]),
41
+ StudioRuntimeGraph.#node(node, node.refName, node.serviceType === "database" ? ["database"] : []),
45
42
  ),
46
43
  ...StudioRuntimeGraph.#byStage(adaptors, deps.stages.adaptor.length, "Adaptors", (node) =>
47
44
  StudioRuntimeGraph.#node(node, moduleOf.get(node.id) ?? null, node.role ? [node.role] : []),
@@ -71,12 +68,17 @@ export class StudioRuntimeGraph {
71
68
  rowsOf(node: StudioNode): Omit<StudioRow, "y">[] {
72
69
  const jobs = this.#jobs.get(node.id);
73
70
  if (!jobs) return node.detail.length ? [{ text: node.detail.join(" · "), hint: "", at: null }] : [];
74
- return jobs.map((job) => ({
75
- text: `${job.type} ${job.key}`,
76
- hint: StudioRuntimeGraph.#scheduleOf(job),
77
- at: null,
78
- ...(job.scheduledHere ? {} : { skipped: job.skipReason ?? "not scheduled on this server" }),
79
- }));
71
+ return jobs.map((job) => {
72
+ const text = `${job.type} ${job.key}`;
73
+ const hint = StudioRuntimeGraph.#scheduleOf(job);
74
+ return {
75
+ text,
76
+ hint,
77
+ title: hint ? `${text} · ${hint}` : text,
78
+ at: null,
79
+ ...(job.scheduledHere ? {} : { skipped: job.skipReason ?? "not scheduled on this server" }),
80
+ };
81
+ });
80
82
  }
81
83
 
82
84
  static #jobsOf(signal: SignalData | null) {
@@ -19,7 +19,9 @@ export interface StudioDocumentProps {
19
19
  export declare class StudioDocument {
20
20
  #private;
21
21
  static render({ basePath, appName, payload, query }: StudioDocumentProps): import("react").JSX.Element;
22
- static unavailable(appName: string, reason: string): import("react").JSX.Element;
22
+ static unavailable({ basePath, appName, query, reason }: Omit<StudioDocumentProps, "payload"> & {
23
+ reason: string;
24
+ }): import("react").JSX.Element;
23
25
  static href(basePath: string, { view, module, editor, since }: StudioQuery): string;
24
26
  static editorHref(editor: StudioEditor, workspaceRoot: string, at: AkanGraphLocation): string;
25
27
  }
@@ -16,6 +16,7 @@ export interface StudioRow {
16
16
  at: AkanGraphLocation | null;
17
17
  change?: AkanGraphChange;
18
18
  skipped?: string;
19
+ title?: string;
19
20
  }
20
21
  export interface StudioBox {
21
22
  node: StudioNode;