pi-minimal 0.1.0 → 0.2.2

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.
@@ -0,0 +1,22 @@
1
+ import assert from "node:assert/strict"
2
+ import test from "node:test"
3
+ import { gutterThinking } from "../src/transcript.js"
4
+
5
+ test("gutterThinking prefixes paragraph starts only", () => {
6
+ const input = "First thought\ncontinues here.\n\nSecond thought."
7
+ assert.equal(gutterThinking(input), "┊ First thought\ncontinues here.\n\n┊ Second thought.")
8
+ })
9
+
10
+ test("gutterThinking leaves block syntax and fenced code alone", () => {
11
+ const input = "# Heading\n\n- item one\n- item two\n\n```js\nconst x = 1\n\nconst y = 2\n```\n\n> quoted\n\nplain"
12
+ assert.equal(
13
+ gutterThinking(input),
14
+ "# Heading\n\n- item one\n- item two\n\n```js\nconst x = 1\n\nconst y = 2\n```\n\n> quoted\n\n┊ plain",
15
+ )
16
+ })
17
+
18
+ test("gutterThinking is idempotent and handles empty input", () => {
19
+ assert.equal(gutterThinking(""), "")
20
+ const once = gutterThinking("a\n\nb")
21
+ assert.equal(gutterThinking(once), once)
22
+ })
@@ -0,0 +1,33 @@
1
+ import assert from "node:assert/strict"
2
+ import test from "node:test"
3
+ import { formatClock, isTurnSummary, ruleLine, runOutcome, turnLabel } from "../src/turn-rule.js"
4
+
5
+ test("turnLabel joins clock, elapsed, tools and non-normal outcomes", () => {
6
+ const endedAt = new Date(2026, 9, 22, 15, 51).getTime()
7
+ assert.equal(turnLabel({ endedAt, elapsedMs: 12_000, tools: 4, outcome: "completed" }), "15:51 · 12s · 4 tools")
8
+ assert.equal(turnLabel({ endedAt, elapsedMs: 3_000, tools: 1, outcome: "aborted" }), "15:51 · 3s · 1 tool · aborted")
9
+ assert.equal(turnLabel({ endedAt, elapsedMs: 3_000, tools: 0, outcome: "error" }), "15:51 · 3s · error")
10
+ assert.equal(formatClock(new Date(2026, 0, 1, 9, 5).getTime()), "09:05")
11
+ })
12
+
13
+ test("ruleLine fills the width and keeps the label when it fits", () => {
14
+ const line = ruleLine(40, "15:51 · 12s")
15
+ assert.equal(line.length, 40)
16
+ assert.ok(line.startsWith("── 15:51 · 12s ─"))
17
+ assert.equal(ruleLine(6, "15:51 · 12s"), "──────")
18
+ assert.equal(ruleLine(0, "x"), "")
19
+ })
20
+
21
+ test("runOutcome reads the last assistant stop reason", () => {
22
+ assert.equal(runOutcome(undefined), "completed")
23
+ assert.equal(runOutcome([{ role: "user" }]), "completed")
24
+ assert.equal(runOutcome([{ role: "assistant", stopReason: "aborted" }, { role: "user" }]), "aborted")
25
+ assert.equal(runOutcome([{ role: "assistant", stopReason: "error" }]), "error")
26
+ assert.equal(runOutcome([{ role: "assistant", stopReason: "stop" }]), "completed")
27
+ })
28
+
29
+ test("isTurnSummary rejects malformed entry data", () => {
30
+ assert.equal(isTurnSummary(null), false)
31
+ assert.equal(isTurnSummary({ endedAt: 1, elapsedMs: 2, tools: 3, outcome: "nope" }), false)
32
+ assert.equal(isTurnSummary({ endedAt: 1, elapsedMs: 2, tools: 3, outcome: "completed" }), true)
33
+ })
@@ -0,0 +1,84 @@
1
+ {
2
+ "$schema": "https://pi.dev/schemas/theme.schema.json",
3
+ "name": "minimal-dark",
4
+ "appearance": "dark",
5
+ "vars": {
6
+ "bg": "okhsl(230 6% 11%)",
7
+ "panel": "okhsl(230 5% 17%)",
8
+ "text": "okhsl(234 3% 90%)",
9
+ "muted": "okhsl(229 6% 64%)",
10
+ "dim": "okhsl(229 7% 48%)",
11
+ "faint": "okhsl(230 6% 34%)",
12
+ "violet": "okhsl(295 50% 67%)",
13
+ "violetSoft": "okhsl(295 45% 74%)",
14
+ "blue": "okhsl(232 54% 67%)",
15
+ "green": "okhsl(159 59% 67%)",
16
+ "red": "okhsl(20 72% 67%)",
17
+ "yellow": "okhsl(83 88% 67%)",
18
+ "userBg": "okhsl(233 45% 27%)",
19
+ "errorBg": "okhsl(19 40% 19%)"
20
+ },
21
+ "colors": {
22
+ "accent": "violet",
23
+ "border": "okhsl(231 30% 45%)",
24
+ "borderAccent": "violet",
25
+ "borderMuted": "faint",
26
+ "success": "green",
27
+ "error": "red",
28
+ "warning": "yellow",
29
+ "muted": "muted",
30
+ "dim": "dim",
31
+ "text": "text",
32
+ "thinkingText": "okhsl(229 6% 52%)",
33
+ "selectedBg": "userBg",
34
+ "scrollbarTrack": "faint",
35
+ "scrollbarThumb": "dim",
36
+ "searchMatchBg": "okhsl(53 51% 24%)",
37
+ "searchMatchText": "text",
38
+ "userMessageBg": "userBg",
39
+ "userMessageText": "text",
40
+ "customMessageBg": "okhsl(295 30% 20%)",
41
+ "customMessageText": "muted",
42
+ "customMessageLabel": "violet",
43
+ "toolPendingBg": "panel",
44
+ "toolSuccessBg": "panel",
45
+ "toolErrorBg": "errorBg",
46
+ "toolTitle": "text",
47
+ "toolOutput": "dim",
48
+ "mdHeading": "violetSoft",
49
+ "mdLink": "blue",
50
+ "mdLinkUrl": "dim",
51
+ "mdCode": "violet",
52
+ "mdCodeBlock": "text",
53
+ "mdCodeBlockBorder": "faint",
54
+ "mdQuote": "muted",
55
+ "mdQuoteBorder": "faint",
56
+ "mdHr": "faint",
57
+ "mdListBullet": "dim",
58
+ "toolDiffAdded": "green",
59
+ "toolDiffRemoved": "red",
60
+ "toolDiffContext": "dim",
61
+ "syntaxComment": "dim",
62
+ "syntaxKeyword": "blue",
63
+ "syntaxFunction": "yellow",
64
+ "syntaxVariable": "okhsl(202 58% 70%)",
65
+ "syntaxString": "okhsl(52 67% 70%)",
66
+ "syntaxNumber": "green",
67
+ "syntaxType": "violet",
68
+ "syntaxOperator": "muted",
69
+ "syntaxPunctuation": "muted",
70
+ "thinkingOff": "okhsl(229 8% 49%)",
71
+ "thinkingMinimal": "okhsl(232 20% 52%)",
72
+ "thinkingLow": "okhsl(232 45% 54%)",
73
+ "thinkingMedium": "okhsl(263 59% 56%)",
74
+ "thinkingHigh": "okhsl(295 73% 59%)",
75
+ "thinkingXhigh": "okhsl(337 81% 61%)",
76
+ "thinkingMax": "okhsl(20 99% 63%)",
77
+ "bashMode": "okhsl(159 64% 65%)"
78
+ },
79
+ "export": {
80
+ "pageBg": "okhsl(230 6% 11%)",
81
+ "cardBg": "okhsl(230 5% 15%)",
82
+ "infoBg": "okhsl(53 51% 24%)"
83
+ }
84
+ }