omkit 0.1.6 → 0.1.7

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.
@@ -27,7 +27,18 @@ const header = (node) => [
27
27
  `# started: ${stamp(node.startedAt)}`,
28
28
  `# finished: ${stamp(node.endedAt)} (${node.duration}ms)`,
29
29
  `# status: ${node.status}`,
30
+ ...(node.parentId === null ? legend : []), // the run's root log (main.log) only
30
31
  ].filter((line) => line !== null);
32
+ /** A compact reading guide, printed once on the root log so an agent can follow the run. */
33
+ const legend = [
34
+ "#",
35
+ "# ── legend ──────────────────────────────────────────────────────────",
36
+ "# [n] global sequence — the merge/order key across every .log",
37
+ "# indented rows a child action's milestones, bubbled up here",
38
+ "# name [tags] the action and its tags · defined … where its code lives",
39
+ "# launch · → ….log a child started — open that file for its full output",
40
+ "# ⚡ event ✓ done ok ⊘ cancelled ✗ failed ⊨/⊭ assert pass/fail 📸 snapshot ▪ output",
41
+ ];
31
42
  const stamp = (ms) => (ms ? new Date(ms).toISOString() : "-");
32
43
  const renderArgs = (args) => {
33
44
  try {
@@ -6,7 +6,11 @@ import { label } from "../../foundation/ActionRef.js";
6
6
  * the child by its {@link label} (name + tags) via `refOf`; everything else keeps its
7
7
  * `source` (proc name, `console`, …).
8
8
  */
9
- export const entryLine = (e, refOf) => `[${e.sequence}] ${bodyOf(e, refOf)}`;
9
+ export const entryLine = (e, refOf) => {
10
+ // Bubbled child rows are nested a level in — the whole row, `[seq]` included.
11
+ const indent = e.level === "child" ? " " : "";
12
+ return `${indent}[${e.sequence}] ${bodyOf(e, refOf)}`;
13
+ };
10
14
  const bodyOf = (e, refOf) => {
11
15
  switch (e.level) {
12
16
  case "event":
@@ -24,9 +28,9 @@ const bodyOf = (e, refOf) => {
24
28
  // output. (Cancellation no longer logs at this level — it's a clean stop.)
25
29
  return e.source === "error" ? `✗ ${e.message}` : `▪ ${e.message}`;
26
30
  case "child": {
27
- // A bubbled child milestone carries the child's id as `source`: name it with its
28
- // tags (`name [tags]`) so the parent timeline always shows them. The launch
29
- // pointer (`source === "launch"`) keeps its `→ id · logfile` message as-is.
31
+ // A bubbled child line (indented at the row level by `entryLine`). The launch pointer
32
+ // (`source === "launch"`) keeps its `→ id · logfile` message; a milestone names the
33
+ // child by its label (name + tags) via `refOf`.
30
34
  if (e.source === "launch")
31
35
  return `${e.source} · ${e.message}`;
32
36
  const ref = refOf?.(e.source);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omkit",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "A tiny runtime for developer workflows: typed actions that pass runtime capabilities and emit typed events, under one run and one shared log. The operational/runtime layer to tskb's knowledge layer.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",