@promptctl/cc-candybar 1.42.1 → 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/dist/index.mjs +72 -71
  2. package/package.json +5 -6
  3. package/src/check.ts +0 -478
  4. package/src/cli-flags.ts +0 -8
  5. package/src/click/wire.ts +0 -158
  6. package/src/config/action.ts +0 -329
  7. package/src/config/cli.ts +0 -71
  8. package/src/config/default-dsl-config.ts +0 -1645
  9. package/src/config/disclosure.ts +0 -170
  10. package/src/config/dsl-loader.ts +0 -339
  11. package/src/config/dsl-types.ts +0 -581
  12. package/src/config/edit-chrome.ts +0 -559
  13. package/src/config/help.ts +0 -151
  14. package/src/config/ident.ts +0 -22
  15. package/src/config/layout-ops.ts +0 -177
  16. package/src/config/loader/actions.ts +0 -972
  17. package/src/config/loader/cache.ts +0 -206
  18. package/src/config/loader/cross-ref.ts +0 -714
  19. package/src/config/loader/cycles.ts +0 -148
  20. package/src/config/loader/diagnostics.ts +0 -99
  21. package/src/config/loader/discovery.ts +0 -182
  22. package/src/config/loader/edit-mode.ts +0 -137
  23. package/src/config/loader/emit-schema.ts +0 -68
  24. package/src/config/loader/globals.ts +0 -269
  25. package/src/config/loader/helpers.ts +0 -48
  26. package/src/config/loader/layout.ts +0 -693
  27. package/src/config/loader/looks.ts +0 -96
  28. package/src/config/loader/menu-synth.ts +0 -435
  29. package/src/config/loader/merge.ts +0 -115
  30. package/src/config/loader/persist-target.ts +0 -67
  31. package/src/config/loader/presets.ts +0 -119
  32. package/src/config/loader/refs.ts +0 -100
  33. package/src/config/loader/reserved-namespace.ts +0 -38
  34. package/src/config/loader/segments.ts +0 -120
  35. package/src/config/loader/validate-core.ts +0 -737
  36. package/src/config/loader/variables.ts +0 -260
  37. package/src/config/menu-keys.ts +0 -139
  38. package/src/config/option-domain.ts +0 -164
  39. package/src/config/presets.ts +0 -326
  40. package/src/config/settings-menu.ts +0 -775
  41. package/src/daemon/acquire.ts +0 -684
  42. package/src/daemon/cache/git.ts +0 -649
  43. package/src/daemon/cache/render.ts +0 -623
  44. package/src/daemon/cache/session-usage-store.ts +0 -720
  45. package/src/daemon/cache/watchers.ts +0 -249
  46. package/src/daemon/client-debug.ts +0 -120
  47. package/src/daemon/client-stats.ts +0 -130
  48. package/src/daemon/client-transport.ts +0 -273
  49. package/src/daemon/client.ts +0 -78
  50. package/src/daemon/config-overrides-store.ts +0 -663
  51. package/src/daemon/debug-types.ts +0 -91
  52. package/src/daemon/debug.ts +0 -264
  53. package/src/daemon/fork-bomb-breaker.ts +0 -351
  54. package/src/daemon/limits.ts +0 -211
  55. package/src/daemon/log.ts +0 -81
  56. package/src/daemon/parent-watchdog.ts +0 -87
  57. package/src/daemon/paths.ts +0 -211
  58. package/src/daemon/process-fingerprint.ts +0 -146
  59. package/src/daemon/protocol.ts +0 -292
  60. package/src/daemon/render-payload.ts +0 -1256
  61. package/src/daemon/server.ts +0 -1330
  62. package/src/daemon/session-state-file.ts +0 -108
  63. package/src/daemon/session-state.ts +0 -237
  64. package/src/daemon/socket-lease.ts +0 -209
  65. package/src/daemon/socket-ownership.ts +0 -209
  66. package/src/daemon/stats.ts +0 -235
  67. package/src/daemon/verbs/config-validators.ts +0 -250
  68. package/src/daemon/verbs/index.ts +0 -706
  69. package/src/daemon/verbs/state-validators.ts +0 -249
  70. package/src/daemon/verbs/validator-registry.ts +0 -457
  71. package/src/demo/dsl.ts +0 -143
  72. package/src/demo/mock-data.ts +0 -67
  73. package/src/demo/statusline.json5 +0 -94
  74. package/src/dsl/node-registry.ts +0 -374
  75. package/src/dsl/render.ts +0 -803
  76. package/src/help-text.ts +0 -90
  77. package/src/index.ts +0 -210
  78. package/src/install/currency.ts +0 -197
  79. package/src/install/index.ts +0 -557
  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,249 +0,0 @@
1
- // [LAW:single-enforcer] The SessionState instance of the shared keyed-
2
- // validator registry (validator-registry.ts): the click protocol's `set-state`
3
- // verb writes only what's registered here, paired with the per-key validator
4
- // that decides whether a raw incoming string is a legal value for that key.
5
- // Adding a new state-writable key is one entry in this table — no new verb,
6
- // no scattered string-matching, no defensive guard in the dispatcher.
7
- //
8
- // [LAW:one-source-of-truth] The registered keys ARE the schema for what
9
- // SessionState mutations the click protocol can perform. Unknown-key
10
- // rejection lists these names — operators see exactly the surface they're
11
- // allowed to write.
12
- //
13
- // [LAW:one-type-per-behavior] The spec algebra (DerivedValidatorSpec,
14
- // mergeKeySpecs, the registry's register/validate/dispose lifecycle) lives in
15
- // validator-registry.ts, shared verbatim with config-validators.ts (the
16
- // `persist` action's keyspace) — two keyspaces, one mechanism.
17
-
18
- import { listResolvablePaletteNames, STRIP_STYLES } from "../../themes/policy";
19
- import { actionDestinations, type ActionDecl } from "../../config/action";
20
- import {
21
- perConfigDomainsFor,
22
- resolveOptionDomain,
23
- } from "../../config/option-domain";
24
- import type { DslConfig } from "../../config/dsl-types";
25
- import { numericGlobalsSeeds } from "../../config/loader/globals";
26
- import {
27
- clampSeed,
28
- createValidatorRegistry,
29
- mergeContributions,
30
- type DerivedValidatorSpec,
31
- type KeySpecContribution,
32
- type KeyValidator,
33
- type RangeParams,
34
- type ValidateResult,
35
- } from "./validator-registry";
36
-
37
- export type {
38
- DerivedValidatorSpec,
39
- KeySpecContribution,
40
- KeyValidator,
41
- RangeParams,
42
- ValidateResult,
43
- } from "./validator-registry";
44
- // [LAW:locality-or-seam] Re-exported for existing test/consumer imports — the
45
- // builder is generic (validator-registry.ts owns it), but state-validators.ts
46
- // stays a stable barrel so nothing outside this module needs to know the
47
- // factory moved.
48
- export {
49
- makeAllowListValidator,
50
- makeIntValidator,
51
- makeRangeValidator,
52
- } from "./validator-registry";
53
-
54
- // [LAW:one-source-of-truth] listResolvablePaletteNames is THE set whose
55
- // members resolve to a concrete Palette. It deliberately excludes the "custom"
56
- // sentinel (which needs inline colors and is not a renderable theme name):
57
- // accepting "custom" here would persist an unrenderable value into SessionState
58
- // and break the next render.
59
- const RESOLVABLE_THEMES_LIST: readonly string[] = listResolvablePaletteNames();
60
- const RESOLVABLE_THEMES: ReadonlySet<string> = new Set(RESOLVABLE_THEMES_LIST);
61
- const RESOLVABLE_STYLES: ReadonlySet<string> = new Set(STRIP_STYLES);
62
-
63
- const validateTheme: KeyValidator = (raw) => {
64
- if (!raw) return { ok: false, reason: "theme name is required" };
65
- if (!RESOLVABLE_THEMES.has(raw)) {
66
- return {
67
- ok: false,
68
- reason: `unknown theme "${raw}" (have: ${RESOLVABLE_THEMES_LIST.join(", ")})`,
69
- };
70
- }
71
- return { ok: true, value: raw };
72
- };
73
-
74
- const validateStyle: KeyValidator = (raw) => {
75
- if (!raw) return { ok: false, reason: "style name is required" };
76
- if (!RESOLVABLE_STYLES.has(raw)) {
77
- return {
78
- ok: false,
79
- reason: `unknown style "${raw}" (have: ${STRIP_STYLES.join(", ")})`,
80
- };
81
- }
82
- return { ok: true, value: raw };
83
- };
84
-
85
- // [LAW:dataflow-not-control-flow] Boolean-ish accepts exactly four canonical
86
- // inputs and normalizes to two canonical outputs: truthy ("1"/"true") → "1",
87
- // falsy ("0"/"false") → "" (empty). The empty falsy sentinel matches what
88
- // `toolbar-toggle` produces via `clear()` for the next render.
89
- const BOOLEAN_TRUTHY = new Set(["1", "true"]);
90
- const BOOLEAN_FALSY = new Set(["0", "false"]);
91
- const validateBoolean: KeyValidator = (raw) => {
92
- if (BOOLEAN_TRUTHY.has(raw)) return { ok: true, value: "1" };
93
- if (BOOLEAN_FALSY.has(raw)) return { ok: true, value: "" };
94
- return {
95
- ok: false,
96
- reason: `expected boolean-ish (1, 0, true, false), got "${raw}"`,
97
- };
98
- };
99
-
100
- // [LAW:one-source-of-truth] THE SessionState instance of the shared registry.
101
- // Baseline keys (style/theme/toolbar-expanded) are legacy widget-era targets
102
- // that predate the action-table-driven world and stay permanent; every other
103
- // SessionState key is fully derived from a config's action table.
104
- const registry = createValidatorRegistry({
105
- style: validateStyle,
106
- theme: validateTheme,
107
- "toolbar-expanded": validateBoolean,
108
- });
109
-
110
- export function listStateKeys(): readonly string[] {
111
- return registry.listKeys();
112
- }
113
-
114
- export function registerStateValidator(
115
- key: string,
116
- spec: DerivedValidatorSpec,
117
- ): () => void {
118
- return registry.register(key, spec);
119
- }
120
-
121
- export function validateStateWrite(
122
- key: string,
123
- rawValue: string,
124
- ): ValidateResult {
125
- return registry.validate(key, rawValue);
126
- }
127
-
128
- export function rangeParamsFor(key: string): RangeParams | null {
129
- return registry.rangeParamsFor(key);
130
- }
131
-
132
- // [LAW:one-source-of-truth] The ONE place mapping a decoupled ACTION to the
133
- // validator key SPEC it declares, for `set` (SessionState) actions. See
134
- // config-validators.ts's actionKeySpecs for the `persist` (config-overrides)
135
- // twin — same shape, different action key and target keyspace.
136
- function actionKeySpecs(
137
- a: ActionDecl,
138
- seeds: ReadonlyMap<string, number>,
139
- perConfigDomains: ReadonlyMap<string, readonly string[]>,
140
- ): KeySpecContribution[] {
141
- if (!("set" in a)) return [];
142
- if ("to" in a) {
143
- return [{ key: a.set, spec: { kind: "allow-list", allowed: [a.to] } }];
144
- }
145
- if ("from" in a) {
146
- return [
147
- {
148
- key: a.set,
149
- spec: {
150
- kind: "allow-list",
151
- allowed: resolveOptionDomain(a.from, perConfigDomains),
152
- },
153
- },
154
- ];
155
- }
156
- if ("int" in a) {
157
- return [{ key: a.set, spec: { kind: "int" } }];
158
- }
159
- if ("cycle" in a) {
160
- return [{ key: a.set, spec: { kind: "allow-list", allowed: a.cycle } }];
161
- }
162
- return [
163
- {
164
- key: a.set,
165
- spec: {
166
- kind: "range",
167
- min: a.min,
168
- max: a.max,
169
- seed: clampSeed(seeds.get(a.set), a.min, a.max),
170
- },
171
- },
172
- ];
173
- }
174
-
175
- // [LAW:single-enforcer] A STRUCTURAL spec (menu int / stepper range) is
176
- // always kept — even on a baseline key — so a collision throws loudly at
177
- // registration rather than silently shadowing the permanent gate. Only an
178
- // ALLOW-LIST contribution to a baseline key is dropped (the click reuses the
179
- // baseline gate as intended).
180
- //
181
- // [LAW:one-source-of-truth] The baseline set is read from the registry that
182
- // owns it (registry.listBaselineKeys()), not re-declared here — the baseline
183
- // keys were passed to createValidatorRegistry above; a second hardcoded list
184
- // could silently drift from them if a future baseline key were added there
185
- // and forgotten here.
186
- function dropBaselineAllowLists(
187
- contributions: readonly KeySpecContribution[],
188
- ): KeySpecContribution[] {
189
- const baseline = new Set(registry.listBaselineKeys());
190
- return contributions.filter(
191
- (c) => c.spec.kind !== "allow-list" || !baseline.has(c.key),
192
- );
193
- }
194
-
195
- // [LAW:one-source-of-truth] The value a bounded key renders with before any
196
- // click, from the two places that can define it: a `state` variable's integer
197
- // `default` (the only source for a key of the config's own invention, like a
198
- // hue stepper), and — winning for the fields it covers — what the config
199
- // resolves for a GLOBALS field, since a session stepper over `padding` starts
200
- // from the padding the bar is showing, not from a state var nobody declared.
201
- //
202
- // The globals half is the SAME function the config-overrides gate seeds from
203
- // (numericGlobalsSeeds), so a session stepper and its durable twin cannot
204
- // start from different numbers. Before it existed, the settings menu's session
205
- // padding stepper seeded from `min`: a bar reading `padding 1` answered its
206
- // first ◀ by wrapping to 16.
207
- function stateKeySeeds(config: DslConfig): ReadonlyMap<string, number> {
208
- const seeds = new Map<string, number>();
209
- const INT_RE = /^-?\d+$/;
210
- for (const decl of Object.values(config.variables)) {
211
- if (decl.kind !== "state") continue;
212
- const raw = decl.default;
213
- if (raw !== undefined && INT_RE.test(raw)) {
214
- seeds.set(decl.key, parseInt(raw, 10));
215
- }
216
- }
217
- for (const [key, seed] of numericGlobalsSeeds(config.globals)) {
218
- seeds.set(key, seed);
219
- }
220
- return seeds;
221
- }
222
-
223
- // [LAW:one-source-of-truth] The writable-key surface a config's `set` actions
224
- // need, DERIVED from the action table — the same declarations the
225
- // `{{ action }}` fn realizes a click from are the gate the wire enforces.
226
- function actionContributions(config: DslConfig): KeySpecContribution[] {
227
- const seeds = stateKeySeeds(config);
228
- const perConfigDomains = perConfigDomainsFor(config);
229
- // [LAW:single-enforcer] Every action is exploded into the
230
- // single-destination declarations it writes through BEFORE the fold, so a
231
- // dual-destination action (candybar-settings-ui-aok.3) contributes exactly
232
- // the `set` spec its session half would have contributed on its own — the
233
- // gate is derived by the code that has always derived it, from the same
234
- // declaration the click realizes, and a dual can widen nothing.
235
- return dropBaselineAllowLists(
236
- Object.values(config.actions)
237
- .flatMap(actionDestinations)
238
- .flatMap((a) => actionKeySpecs(a, seeds, perConfigDomains)),
239
- );
240
- }
241
-
242
- // [LAW:single-enforcer] The SOLE install-site derivation: a config's
243
- // SessionState-writable-key surface is the merge of every `set` ACTION it
244
- // declares, through ONE coherence pass.
245
- export function deriveActionValidators(
246
- config: DslConfig,
247
- ): readonly KeySpecContribution[] {
248
- return mergeContributions(actionContributions(config));
249
- }