@promptctl/cc-candybar 1.42.0 → 1.43.0

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 (126) hide show
  1. package/README.md +4 -0
  2. package/dist/index.mjs +81 -80
  3. package/package.json +5 -6
  4. package/src/check.ts +0 -478
  5. package/src/cli-flags.ts +0 -8
  6. package/src/click/wire.ts +0 -158
  7. package/src/config/action.ts +0 -329
  8. package/src/config/cli.ts +0 -71
  9. package/src/config/default-dsl-config.ts +0 -1645
  10. package/src/config/disclosure.ts +0 -170
  11. package/src/config/dsl-loader.ts +0 -339
  12. package/src/config/dsl-types.ts +0 -581
  13. package/src/config/edit-chrome.ts +0 -559
  14. package/src/config/help.ts +0 -151
  15. package/src/config/ident.ts +0 -22
  16. package/src/config/layout-ops.ts +0 -177
  17. package/src/config/loader/actions.ts +0 -972
  18. package/src/config/loader/cache.ts +0 -206
  19. package/src/config/loader/cross-ref.ts +0 -714
  20. package/src/config/loader/cycles.ts +0 -148
  21. package/src/config/loader/diagnostics.ts +0 -99
  22. package/src/config/loader/discovery.ts +0 -182
  23. package/src/config/loader/edit-mode.ts +0 -137
  24. package/src/config/loader/emit-schema.ts +0 -68
  25. package/src/config/loader/globals.ts +0 -269
  26. package/src/config/loader/helpers.ts +0 -48
  27. package/src/config/loader/layout.ts +0 -693
  28. package/src/config/loader/looks.ts +0 -96
  29. package/src/config/loader/menu-synth.ts +0 -435
  30. package/src/config/loader/merge.ts +0 -115
  31. package/src/config/loader/persist-target.ts +0 -67
  32. package/src/config/loader/presets.ts +0 -119
  33. package/src/config/loader/refs.ts +0 -100
  34. package/src/config/loader/reserved-namespace.ts +0 -38
  35. package/src/config/loader/segments.ts +0 -120
  36. package/src/config/loader/validate-core.ts +0 -737
  37. package/src/config/loader/variables.ts +0 -260
  38. package/src/config/menu-keys.ts +0 -139
  39. package/src/config/option-domain.ts +0 -164
  40. package/src/config/presets.ts +0 -326
  41. package/src/config/settings-menu.ts +0 -775
  42. package/src/daemon/acquire.ts +0 -684
  43. package/src/daemon/cache/git.ts +0 -649
  44. package/src/daemon/cache/render.ts +0 -623
  45. package/src/daemon/cache/session-usage-store.ts +0 -720
  46. package/src/daemon/cache/watchers.ts +0 -249
  47. package/src/daemon/client-debug.ts +0 -120
  48. package/src/daemon/client-stats.ts +0 -130
  49. package/src/daemon/client-transport.ts +0 -273
  50. package/src/daemon/client.ts +0 -78
  51. package/src/daemon/config-overrides-store.ts +0 -663
  52. package/src/daemon/debug-types.ts +0 -91
  53. package/src/daemon/debug.ts +0 -264
  54. package/src/daemon/fork-bomb-breaker.ts +0 -351
  55. package/src/daemon/limits.ts +0 -211
  56. package/src/daemon/log.ts +0 -81
  57. package/src/daemon/parent-watchdog.ts +0 -87
  58. package/src/daemon/paths.ts +0 -211
  59. package/src/daemon/process-fingerprint.ts +0 -146
  60. package/src/daemon/protocol.ts +0 -292
  61. package/src/daemon/render-payload.ts +0 -1256
  62. package/src/daemon/server.ts +0 -1330
  63. package/src/daemon/session-state-file.ts +0 -108
  64. package/src/daemon/session-state.ts +0 -237
  65. package/src/daemon/socket-lease.ts +0 -209
  66. package/src/daemon/socket-ownership.ts +0 -209
  67. package/src/daemon/stats.ts +0 -235
  68. package/src/daemon/verbs/config-validators.ts +0 -250
  69. package/src/daemon/verbs/index.ts +0 -706
  70. package/src/daemon/verbs/state-validators.ts +0 -249
  71. package/src/daemon/verbs/validator-registry.ts +0 -457
  72. package/src/demo/dsl.ts +0 -143
  73. package/src/demo/mock-data.ts +0 -67
  74. package/src/demo/statusline.json5 +0 -94
  75. package/src/dsl/node-registry.ts +0 -374
  76. package/src/dsl/render.ts +0 -803
  77. package/src/help-text.ts +0 -90
  78. package/src/index.ts +0 -210
  79. package/src/install/index.ts +0 -541
  80. package/src/proc/launch.ts +0 -459
  81. package/src/proc/stats-handle.ts +0 -13
  82. package/src/render/action.ts +0 -883
  83. package/src/render/active-segment.ts +0 -78
  84. package/src/render/diagnostic-style.ts +0 -23
  85. package/src/render/diagnostic-text.ts +0 -77
  86. package/src/render/error-glyph.ts +0 -53
  87. package/src/render/menu.ts +0 -257
  88. package/src/render/outcome-plan.ts +0 -45
  89. package/src/render/picker.ts +0 -372
  90. package/src/render/segment-color.ts +0 -74
  91. package/src/render/split-lines.ts +0 -51
  92. package/src/render/strip.ts +0 -228
  93. package/src/segments/cache.ts +0 -131
  94. package/src/segments/context.ts +0 -190
  95. package/src/segments/git.ts +0 -1084
  96. package/src/segments/metrics.ts +0 -187
  97. package/src/segments/pricing.ts +0 -452
  98. package/src/segments/session.ts +0 -23
  99. package/src/segments/tmux.ts +0 -74
  100. package/src/template-engine/cells.ts +0 -90
  101. package/src/template-engine/colors.ts +0 -124
  102. package/src/template-engine/engine.ts +0 -108
  103. package/src/template-engine/funcs.ts +0 -232
  104. package/src/template-engine/index.ts +0 -11
  105. package/src/template-engine/layout.ts +0 -133
  106. package/src/template-engine/scope.ts +0 -62
  107. package/src/template-engine/sparkline.ts +0 -79
  108. package/src/themes/index.ts +0 -20
  109. package/src/themes/palette-resolvers.ts +0 -84
  110. package/src/themes/policy.ts +0 -393
  111. package/src/utils/cache.ts +0 -206
  112. package/src/utils/claude.ts +0 -683
  113. package/src/utils/color-support.ts +0 -118
  114. package/src/utils/formatters.ts +0 -99
  115. package/src/utils/logger.ts +0 -5
  116. package/src/utils/outcome.ts +0 -33
  117. package/src/utils/schema-validator.ts +0 -126
  118. package/src/utils/single-flight.ts +0 -57
  119. package/src/utils/terminal-width.ts +0 -51
  120. package/src/utils/terminal.ts +0 -11
  121. package/src/utils/transcript-fs.ts +0 -279
  122. package/src/var-system/index.ts +0 -24
  123. package/src/var-system/sources.ts +0 -1047
  124. package/src/var-system/store.ts +0 -223
  125. package/src/var-system/types.ts +0 -57
  126. package/src/version.ts +0 -17
@@ -1,223 +0,0 @@
1
- // [LAW:one-source-of-truth] The daemon's MobX store is THE place where
2
- // every variable's value lives. Templates, segments, and click handlers
3
- // all read through this store; there is no parallel cache, no shadow
4
- // state, no per-renderer copy.
5
- //
6
- // Two node kinds — `box` for externally-driven values (input JSON,
7
- // shell output, fs watchers, TTL timers) and `computed` for derived
8
- // values (templates, git fields wrapping shell). MobX auto-tracks
9
- // dependencies when a computed's deriver reads other variables; the
10
- // invalidation graph is built without us declaring it.
11
-
12
- import {
13
- observable,
14
- computed,
15
- runInAction as mobxRunInAction,
16
- type IObservableValue,
17
- type IComputedValue,
18
- } from "mobx";
19
- import { typeOf, type VarType, type VarValue } from "./types";
20
-
21
- export interface VarNode {
22
- readonly name: string;
23
- readonly type: VarType;
24
- readonly kind: "box" | "computed";
25
- read(): VarValue;
26
- // [LAW:types-are-the-program] Age is a property of the node, not of an
27
- // external bookkeeping layer — duplicating it in a side map would let the
28
- // two diverge. `number` for box nodes (epoch ms of last set, including the
29
- // initial-value set at construction); `null` for computed nodes, whose
30
- // freshness is governed by MobX invalidation, not a single timestamp.
31
- lastUpdatedMs(): number | null;
32
- }
33
-
34
- class BoxNode implements VarNode {
35
- readonly kind = "box" as const;
36
- private readonly cell: IObservableValue<VarValue>;
37
- // [LAW:single-enforcer] One write path (`set`) updates both the value and
38
- // the timestamp; introspection reads from the same place renderers do.
39
- private lastSetAt: number;
40
-
41
- constructor(
42
- readonly name: string,
43
- readonly type: VarType,
44
- initial: VarValue,
45
- ) {
46
- assertType(name, type, initial, "initial value");
47
- this.cell = observable.box(initial, { deep: false });
48
- this.lastSetAt = Date.now();
49
- }
50
-
51
- read(): VarValue {
52
- return this.cell.get();
53
- }
54
-
55
- set(value: VarValue): void {
56
- assertType(this.name, this.type, value, "set value");
57
- this.cell.set(value);
58
- this.lastSetAt = Date.now();
59
- }
60
-
61
- lastUpdatedMs(): number {
62
- return this.lastSetAt;
63
- }
64
- }
65
-
66
- class ComputedNode implements VarNode {
67
- readonly kind = "computed" as const;
68
- private readonly cell: IComputedValue<VarValue>;
69
-
70
- constructor(
71
- readonly name: string,
72
- readonly type: VarType,
73
- deriver: () => VarValue,
74
- ) {
75
- // [LAW:one-source-of-truth] keepAlive caches the value across reads
76
- // so `.get()` re-runs the deriver only when a tracked dep
77
- // invalidates — without it, MobX treats an unobserved computed as
78
- // "not cached" and re-runs on every read. The render path is pull-
79
- // only (no autorun), so keepAlive is the only mode that gives the
80
- // reactive-cache contract the proposal promises.
81
- this.cell = computed(
82
- () => {
83
- const v = deriver();
84
- assertType(this.name, this.type, v, "computed result");
85
- return v;
86
- },
87
- { keepAlive: true },
88
- );
89
- }
90
-
91
- read(): VarValue {
92
- return this.cell.get();
93
- }
94
-
95
- lastUpdatedMs(): null {
96
- // [LAW:no-defensive-null-guards] Computed nodes have no single
97
- // "updated" moment — the cache is valid until a tracked dep changes.
98
- // Returning null is structurally distinct from "updated at 0," so a
99
- // consumer can render "—" for computed and a real age for boxes.
100
- return null;
101
- }
102
- }
103
-
104
- function assertType(
105
- name: string,
106
- declared: VarType,
107
- value: VarValue,
108
- context: string,
109
- ): void {
110
- const actual = typeOf(value);
111
- if (actual !== declared) {
112
- throw new TypeError(
113
- `Variable "${name}": ${context} type ${actual} does not match declared type ${declared}`,
114
- );
115
- }
116
- }
117
-
118
- // [LAW:single-enforcer] All declarations and reads go through one
119
- // VariableStore instance per daemon. Two stores cannot coexist for the
120
- // same daemon — the dep graph would split, click handlers would mutate
121
- // one while renders read the other.
122
-
123
- export class VariableStore {
124
- private readonly nodes = new Map<string, VarNode>();
125
-
126
- defineBox(name: string, type: VarType, initial: VarValue): void {
127
- this.assertNotDefined(name);
128
- this.nodes.set(name, new BoxNode(name, type, initial));
129
- }
130
-
131
- // Computed deriver receives a `read` function that returns the value
132
- // of any variable in the store. Calling `read(other)` from inside the
133
- // deriver is what registers the dependency with MobX — the deriver's
134
- // body is the dep graph.
135
- defineComputed(
136
- name: string,
137
- type: VarType,
138
- deriver: (read: (other: string) => VarValue) => VarValue,
139
- ): void {
140
- this.assertNotDefined(name);
141
- const reader = (other: string): VarValue => this.read(other);
142
- this.nodes.set(name, new ComputedNode(name, type, () => deriver(reader)));
143
- }
144
-
145
- read(name: string): VarValue {
146
- return this.requireNode(name).read();
147
- }
148
-
149
- setBox(name: string, value: VarValue): void {
150
- const node = this.requireNode(name);
151
- if (node.kind !== "box") {
152
- throw new TypeError(
153
- `Variable "${name}" is a ${node.kind}, not a box (use defineBox to create a settable variable)`,
154
- );
155
- }
156
- // [LAW:single-enforcer] All mutations go through one action. MobX
157
- // strict-mode (the default in v6) rejects modifications outside an
158
- // action once the observable has observers — and our keepAlive
159
- // computeds always do. Wrapping setBox here means callers do not
160
- // need to remember; runInAction stays useful for batching multiple
161
- // sets so dependents invalidate once.
162
- mobxRunInAction(() => (node as BoxNode).set(value));
163
- }
164
-
165
- // Wrap multi-variable updates so dependents only invalidate once per
166
- // batch. Used by the render path to push a whole input payload before
167
- // any computed re-evaluates.
168
- runInAction(fn: () => void): void {
169
- mobxRunInAction(fn);
170
- }
171
-
172
- has(name: string): boolean {
173
- return this.nodes.has(name);
174
- }
175
-
176
- getType(name: string): VarType {
177
- return this.requireNode(name).type;
178
- }
179
-
180
- getKind(name: string): "box" | "computed" {
181
- return this.requireNode(name).kind;
182
- }
183
-
184
- // [LAW:types-are-the-program] Introspection (src/daemon/debug.ts) needs
185
- // the whole node — type, kind, lastUpdatedMs — in one lookup, but
186
- // returning the BoxNode directly would leak `.set` structurally even
187
- // though VarNode does not advertise it. The returned wrapper is a fresh
188
- // object exposing only the VarNode surface — `.set` is unreachable at
189
- // any level (no structural escape, no plain-JS reach-through). The
190
- // mutation path remains gated behind `setBox`, which wraps in
191
- // runInAction to satisfy MobX strict-mode.
192
- //
193
- // [LAW:single-enforcer] One requireNode call per consumer-row — the
194
- // round-1 dedup fix in introspectVars relies on the caller getting both
195
- // type/kind and a read() in one go without paying for a second
196
- // requireNode. The wrapper preserves that.
197
- getNode(name: string): VarNode {
198
- const node = this.requireNode(name);
199
- return {
200
- name: node.name,
201
- type: node.type,
202
- kind: node.kind,
203
- read: () => node.read(),
204
- lastUpdatedMs: () => node.lastUpdatedMs(),
205
- };
206
- }
207
-
208
- names(): string[] {
209
- return [...this.nodes.keys()];
210
- }
211
-
212
- private requireNode(name: string): VarNode {
213
- const node = this.nodes.get(name);
214
- if (!node) throw new ReferenceError(`Unknown variable "${name}"`);
215
- return node;
216
- }
217
-
218
- private assertNotDefined(name: string): void {
219
- if (this.nodes.has(name)) {
220
- throw new Error(`Variable "${name}" is already declared`);
221
- }
222
- }
223
- }
@@ -1,57 +0,0 @@
1
- // [LAW:one-type-per-behavior] Every variable, every source kind, every
2
- // template result lands in this same union. Adding a new value type would
3
- // be a code change that ripples through the cast helpers and the filter
4
- // pipeline — there is no "extra" variant available at the type layer.
5
-
6
- export type VarType = "string" | "number" | "boolean";
7
- export type VarValue = string | number | boolean;
8
-
9
- export function typeOf(v: VarValue): VarType {
10
- const t = typeof v;
11
- if (t === "string" || t === "number" || t === "boolean") return t;
12
- // [LAW:no-defensive-null-guards] This is a trust-boundary check —
13
- // values arrive from user-authored templates and external sources, so
14
- // an unsupported runtime value must fail loudly here, not silently
15
- // downstream.
16
- throw new TypeError(
17
- `Variable values must be string|number|boolean (got ${t})`,
18
- );
19
- }
20
-
21
- // Cast helpers used by the filter pipeline (chunk 2 will consume these).
22
- // Each cast either returns a typed value or throws with a useful message.
23
- // Total casts (toString) never throw; partial casts (toNumber, toBool)
24
- // throw on ambiguous input rather than silently coercing.
25
-
26
- export function toString(v: VarValue): string {
27
- return typeof v === "string" ? v : String(v);
28
- }
29
-
30
- export function toNumber(v: VarValue): number {
31
- if (typeof v === "number") return v;
32
- if (typeof v === "boolean") return v ? 1 : 0;
33
- const trimmed = v.trim();
34
- if (trimmed === "") {
35
- throw new TypeError(`Cannot cast empty string to number`);
36
- }
37
- const n = Number(trimmed);
38
- if (!Number.isFinite(n)) {
39
- throw new TypeError(`Cannot cast ${JSON.stringify(v)} to number`);
40
- }
41
- return n;
42
- }
43
-
44
- export function toBool(v: VarValue): boolean {
45
- if (typeof v === "boolean") return v;
46
- if (typeof v === "number") {
47
- if (v === 0 || v === 1) return v === 1;
48
- throw new TypeError(
49
- `Cannot cast number ${v} to bool (only 0 and 1 are accepted)`,
50
- );
51
- }
52
- if (v === "true") return true;
53
- if (v === "false") return false;
54
- throw new TypeError(
55
- `Cannot cast ${JSON.stringify(v)} to bool (expected "true" or "false")`,
56
- );
57
- }
package/src/version.ts DELETED
@@ -1,17 +0,0 @@
1
- // [LAW:one-source-of-truth] THE version stamp of this runtime. package.json is
2
- // the sole authority: tsdown's `define` bakes it into the bundle, and
3
- // scripts/version-stamp.cjs preloads it for untranspiled source. Every consumer
4
- // — `--version`, the install banner, the daemon's stats snapshot — reads this
5
- // one export.
6
- declare const __PACKAGE_VERSION__: string;
7
-
8
- // [LAW:no-silent-failure] A runtime that cannot say what it is must say THAT.
9
- // The old `"dev"` fallback was an answer-shaped void in a flag whose whole job
10
- // is answering this question; an unsubstituted build now fails at module load.
11
- if (typeof __PACKAGE_VERSION__ === "undefined") {
12
- throw new Error(
13
- "__PACKAGE_VERSION__ was not substituted: build via tsdown (define), or preload scripts/version-stamp.cjs when running source",
14
- );
15
- }
16
-
17
- export const PACKAGE_VERSION: string = __PACKAGE_VERSION__;