@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.
- package/dist/index.mjs +72 -71
- package/package.json +5 -6
- package/src/check.ts +0 -478
- package/src/cli-flags.ts +0 -8
- package/src/click/wire.ts +0 -158
- package/src/config/action.ts +0 -329
- package/src/config/cli.ts +0 -71
- package/src/config/default-dsl-config.ts +0 -1645
- package/src/config/disclosure.ts +0 -170
- package/src/config/dsl-loader.ts +0 -339
- package/src/config/dsl-types.ts +0 -581
- package/src/config/edit-chrome.ts +0 -559
- package/src/config/help.ts +0 -151
- package/src/config/ident.ts +0 -22
- package/src/config/layout-ops.ts +0 -177
- package/src/config/loader/actions.ts +0 -972
- package/src/config/loader/cache.ts +0 -206
- package/src/config/loader/cross-ref.ts +0 -714
- package/src/config/loader/cycles.ts +0 -148
- package/src/config/loader/diagnostics.ts +0 -99
- package/src/config/loader/discovery.ts +0 -182
- package/src/config/loader/edit-mode.ts +0 -137
- package/src/config/loader/emit-schema.ts +0 -68
- package/src/config/loader/globals.ts +0 -269
- package/src/config/loader/helpers.ts +0 -48
- package/src/config/loader/layout.ts +0 -693
- package/src/config/loader/looks.ts +0 -96
- package/src/config/loader/menu-synth.ts +0 -435
- package/src/config/loader/merge.ts +0 -115
- package/src/config/loader/persist-target.ts +0 -67
- package/src/config/loader/presets.ts +0 -119
- package/src/config/loader/refs.ts +0 -100
- package/src/config/loader/reserved-namespace.ts +0 -38
- package/src/config/loader/segments.ts +0 -120
- package/src/config/loader/validate-core.ts +0 -737
- package/src/config/loader/variables.ts +0 -260
- package/src/config/menu-keys.ts +0 -139
- package/src/config/option-domain.ts +0 -164
- package/src/config/presets.ts +0 -326
- package/src/config/settings-menu.ts +0 -775
- package/src/daemon/acquire.ts +0 -684
- package/src/daemon/cache/git.ts +0 -649
- package/src/daemon/cache/render.ts +0 -623
- package/src/daemon/cache/session-usage-store.ts +0 -720
- package/src/daemon/cache/watchers.ts +0 -249
- package/src/daemon/client-debug.ts +0 -120
- package/src/daemon/client-stats.ts +0 -130
- package/src/daemon/client-transport.ts +0 -273
- package/src/daemon/client.ts +0 -78
- package/src/daemon/config-overrides-store.ts +0 -663
- package/src/daemon/debug-types.ts +0 -91
- package/src/daemon/debug.ts +0 -264
- package/src/daemon/fork-bomb-breaker.ts +0 -351
- package/src/daemon/limits.ts +0 -211
- package/src/daemon/log.ts +0 -81
- package/src/daemon/parent-watchdog.ts +0 -87
- package/src/daemon/paths.ts +0 -211
- package/src/daemon/process-fingerprint.ts +0 -146
- package/src/daemon/protocol.ts +0 -292
- package/src/daemon/render-payload.ts +0 -1256
- package/src/daemon/server.ts +0 -1330
- package/src/daemon/session-state-file.ts +0 -108
- package/src/daemon/session-state.ts +0 -237
- package/src/daemon/socket-lease.ts +0 -209
- package/src/daemon/socket-ownership.ts +0 -209
- package/src/daemon/stats.ts +0 -235
- package/src/daemon/verbs/config-validators.ts +0 -250
- package/src/daemon/verbs/index.ts +0 -706
- package/src/daemon/verbs/state-validators.ts +0 -249
- package/src/daemon/verbs/validator-registry.ts +0 -457
- package/src/demo/dsl.ts +0 -143
- package/src/demo/mock-data.ts +0 -67
- package/src/demo/statusline.json5 +0 -94
- package/src/dsl/node-registry.ts +0 -374
- package/src/dsl/render.ts +0 -803
- package/src/help-text.ts +0 -90
- package/src/index.ts +0 -210
- package/src/install/currency.ts +0 -197
- package/src/install/index.ts +0 -557
- package/src/proc/launch.ts +0 -459
- package/src/proc/stats-handle.ts +0 -13
- package/src/render/action.ts +0 -883
- package/src/render/active-segment.ts +0 -78
- package/src/render/diagnostic-style.ts +0 -23
- package/src/render/diagnostic-text.ts +0 -77
- package/src/render/error-glyph.ts +0 -53
- package/src/render/menu.ts +0 -257
- package/src/render/outcome-plan.ts +0 -45
- package/src/render/picker.ts +0 -372
- package/src/render/segment-color.ts +0 -74
- package/src/render/split-lines.ts +0 -51
- package/src/render/strip.ts +0 -228
- package/src/segments/cache.ts +0 -131
- package/src/segments/context.ts +0 -190
- package/src/segments/git.ts +0 -1084
- package/src/segments/metrics.ts +0 -187
- package/src/segments/pricing.ts +0 -452
- package/src/segments/session.ts +0 -23
- package/src/segments/tmux.ts +0 -74
- package/src/template-engine/cells.ts +0 -90
- package/src/template-engine/colors.ts +0 -124
- package/src/template-engine/engine.ts +0 -108
- package/src/template-engine/funcs.ts +0 -232
- package/src/template-engine/index.ts +0 -11
- package/src/template-engine/layout.ts +0 -133
- package/src/template-engine/scope.ts +0 -62
- package/src/template-engine/sparkline.ts +0 -79
- package/src/themes/index.ts +0 -20
- package/src/themes/palette-resolvers.ts +0 -84
- package/src/themes/policy.ts +0 -393
- package/src/utils/cache.ts +0 -206
- package/src/utils/claude.ts +0 -683
- package/src/utils/color-support.ts +0 -118
- package/src/utils/formatters.ts +0 -99
- package/src/utils/logger.ts +0 -5
- package/src/utils/outcome.ts +0 -33
- package/src/utils/schema-validator.ts +0 -126
- package/src/utils/single-flight.ts +0 -57
- package/src/utils/terminal-width.ts +0 -51
- package/src/utils/terminal.ts +0 -11
- package/src/utils/transcript-fs.ts +0 -279
- package/src/var-system/index.ts +0 -24
- package/src/var-system/sources.ts +0 -1047
- package/src/var-system/store.ts +0 -223
- package/src/var-system/types.ts +0 -57
- package/src/version.ts +0 -17
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
// [LAW:types-are-the-program] The cache-policy schema: a CacheDecl is exactly one
|
|
2
|
-
// of ttl / watch_file / depends_on / key / never, declared as DATA (CACHE_SCHEMA)
|
|
3
|
-
// and interpreted by the tag-by-present-key engine (oneOfPresent).
|
|
4
|
-
// requireCache/optionalCache gate presence by source kind. This file changes when
|
|
5
|
-
// the cache vocabulary changes — add an arm to CACHE_SCHEMA and CacheDecl.
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
CACHE_KEYS,
|
|
9
|
-
SOURCES_REQUIRING_CACHE,
|
|
10
|
-
type CacheDecl,
|
|
11
|
-
type SourceKind,
|
|
12
|
-
type TtlCacheDecl,
|
|
13
|
-
} from "../dsl-types.js";
|
|
14
|
-
import { findKeyLine } from "./diagnostics.js";
|
|
15
|
-
import {
|
|
16
|
-
describeValue,
|
|
17
|
-
oneOfPresent,
|
|
18
|
-
oneOfPresentJson,
|
|
19
|
-
type FieldSpec,
|
|
20
|
-
type JsonNode,
|
|
21
|
-
type OneOfPresentSchema,
|
|
22
|
-
type ValidateCtx,
|
|
23
|
-
} from "./validate-core.js";
|
|
24
|
-
|
|
25
|
-
export function requireCache(
|
|
26
|
-
ctx: ValidateCtx,
|
|
27
|
-
path: string,
|
|
28
|
-
raw: Record<string, unknown>,
|
|
29
|
-
kind: SourceKind,
|
|
30
|
-
): CacheDecl | null {
|
|
31
|
-
if (raw.cache === undefined) {
|
|
32
|
-
if (SOURCES_REQUIRING_CACHE.includes(kind)) {
|
|
33
|
-
ctx.issues.push({
|
|
34
|
-
path: `${path}.cache`,
|
|
35
|
-
message: `${kind} variables must declare a cache policy (one of: ${CACHE_KEYS.join(", ")})`,
|
|
36
|
-
line: findKeyLine(ctx.source, path.split(".")),
|
|
37
|
-
});
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
// For kinds where cache is optional and absent, this path is unreachable
|
|
41
|
-
// because callers use optionalCache; keep narrow.
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
return validateCache(ctx, `${path}.cache`, raw.cache);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function optionalCache(
|
|
48
|
-
ctx: ValidateCtx,
|
|
49
|
-
path: string,
|
|
50
|
-
raw: Record<string, unknown>,
|
|
51
|
-
): CacheDecl | undefined {
|
|
52
|
-
if (raw.cache === undefined) return undefined;
|
|
53
|
-
const c = validateCache(ctx, `${path}.cache`, raw.cache);
|
|
54
|
-
return c ?? undefined;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// [LAW:dataflow-not-control-flow] The `cache` field as a record-field spec, so a
|
|
58
|
-
// per-kind variable schema declares its cache policy as DATA. `kind` selects the
|
|
59
|
-
// requiredness: file/shell/git require it (a missing cache reports the per-kind
|
|
60
|
-
// message and fails the arm); template leaves it optional; time is optional but
|
|
61
|
-
// ttl-only (ttlOnlyCacheSpec below). The field key is conventionally "cache",
|
|
62
|
-
// read directly by requireCache/optionalCache.
|
|
63
|
-
export function requireCacheSpec(kind: SourceKind): FieldSpec<CacheDecl> {
|
|
64
|
-
return {
|
|
65
|
-
required: true,
|
|
66
|
-
json: cacheJson(),
|
|
67
|
-
parse: (ctx, path, _field, raw) =>
|
|
68
|
-
requireCache(ctx, path, raw, kind) ?? undefined,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export function optionalCacheSpec(): FieldSpec<CacheDecl> {
|
|
73
|
-
return {
|
|
74
|
-
required: false,
|
|
75
|
-
json: cacheJson(),
|
|
76
|
-
parse: (ctx, path, _field, raw) => optionalCache(ctx, path, raw),
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// [LAW:single-enforcer] One arm helper to push a variant's bespoke message and
|
|
81
|
-
// drop — the message is the only thing that varies per arm, carried as DATA.
|
|
82
|
-
function reject<M>(ctx: ValidateCtx, path: string, message: string): M | null {
|
|
83
|
-
ctx.issues.push({
|
|
84
|
-
path,
|
|
85
|
-
message,
|
|
86
|
-
line: findKeyLine(ctx.source, path.split(".")),
|
|
87
|
-
});
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// [LAW:types-are-the-program] The cache schema declared as DATA: arm keys in
|
|
92
|
-
// CACHE_KEYS order (the structural messages join them), each arm carrying its
|
|
93
|
-
// value-validation predicate and bespoke message. The literal "cache.<key>"
|
|
94
|
-
// prefix is the contract text, independent of the runtime path used for line.
|
|
95
|
-
// [LAW:one-source-of-truth] Each arm's `json` is the schema for the VALUE at its
|
|
96
|
-
// present key — duration/path/key are strings, depends_on a string array, never
|
|
97
|
-
// the literal true; the duration FORMAT (and non-empty) is a semantic check the
|
|
98
|
-
// validator keeps (a JSON Schema `pattern` could mirror it, but the loader's
|
|
99
|
-
// duration grammar is the single authority, so the schema stays at `type:string`).
|
|
100
|
-
const CACHE_SCHEMA: OneOfPresentSchema<CacheDecl> = {
|
|
101
|
-
noun: "cache",
|
|
102
|
-
arms: {
|
|
103
|
-
ttl: {
|
|
104
|
-
json: { type: "string" },
|
|
105
|
-
parse: (ctx, path, value) =>
|
|
106
|
-
typeof value === "string" && isValidDuration(value)
|
|
107
|
-
? { ttl: value }
|
|
108
|
-
: reject(
|
|
109
|
-
ctx,
|
|
110
|
-
path,
|
|
111
|
-
`cache.ttl must be a duration string like "5s", "100ms", "2m", "1h"; got ${describeValue(value)}`,
|
|
112
|
-
),
|
|
113
|
-
},
|
|
114
|
-
watch_file: {
|
|
115
|
-
json: { type: "string" },
|
|
116
|
-
parse: (ctx, path, value) =>
|
|
117
|
-
typeof value === "string" && value !== ""
|
|
118
|
-
? { watch_file: value }
|
|
119
|
-
: reject(
|
|
120
|
-
ctx,
|
|
121
|
-
path,
|
|
122
|
-
`cache.watch_file must be a non-empty path string, got ${describeValue(value)}`,
|
|
123
|
-
),
|
|
124
|
-
},
|
|
125
|
-
depends_on: {
|
|
126
|
-
json: { type: "array", items: { type: "string" } },
|
|
127
|
-
parse: (ctx, path, value) =>
|
|
128
|
-
Array.isArray(value) && value.every((v) => typeof v === "string")
|
|
129
|
-
? { depends_on: value as string[] }
|
|
130
|
-
: reject(
|
|
131
|
-
ctx,
|
|
132
|
-
path,
|
|
133
|
-
`cache.depends_on must be an array of variable-name strings, got ${describeValue(value)}`,
|
|
134
|
-
),
|
|
135
|
-
},
|
|
136
|
-
key: {
|
|
137
|
-
json: { type: "string" },
|
|
138
|
-
parse: (ctx, path, value) =>
|
|
139
|
-
typeof value === "string" && value !== ""
|
|
140
|
-
? { key: value }
|
|
141
|
-
: reject(
|
|
142
|
-
ctx,
|
|
143
|
-
path,
|
|
144
|
-
`cache.key must be a non-empty template string, got ${describeValue(value)}`,
|
|
145
|
-
),
|
|
146
|
-
},
|
|
147
|
-
never: {
|
|
148
|
-
json: { const: true },
|
|
149
|
-
parse: (ctx, path, value) =>
|
|
150
|
-
value === true
|
|
151
|
-
? { never: true }
|
|
152
|
-
: reject(
|
|
153
|
-
ctx,
|
|
154
|
-
path,
|
|
155
|
-
`cache.never must be the literal boolean true, got ${describeValue(value)}`,
|
|
156
|
-
),
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
function validateCache(
|
|
162
|
-
ctx: ValidateCtx,
|
|
163
|
-
path: string,
|
|
164
|
-
raw: unknown,
|
|
165
|
-
): CacheDecl | null {
|
|
166
|
-
return oneOfPresent(ctx, CACHE_SCHEMA, path, raw);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// [LAW:types-are-the-program] The ttl-only subset for kinds whose runtime
|
|
170
|
-
// honors no other invalidation (time vars refresh on a clock; declareTime
|
|
171
|
-
// always registers a TTL timer). OneOfPresentSchema<TtlCacheDecl> forces
|
|
172
|
-
// exactly the ttl arm at compile time, and the arm is CACHE_SCHEMA's own —
|
|
173
|
-
// a subset of the vocabulary, never a parallel grammar. A non-ttl form is a
|
|
174
|
-
// load-time diagnostic naming ttl as the only supported key, replacing the
|
|
175
|
-
// runtime's former silent coercion to the default TTL [LAW:no-silent-failure].
|
|
176
|
-
const TTL_ONLY_CACHE_SCHEMA: OneOfPresentSchema<TtlCacheDecl> = {
|
|
177
|
-
noun: "time-variable cache",
|
|
178
|
-
arms: { ttl: CACHE_SCHEMA.arms.ttl },
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
export function ttlOnlyCacheSpec(): FieldSpec<TtlCacheDecl> {
|
|
182
|
-
return {
|
|
183
|
-
required: false,
|
|
184
|
-
json: oneOfPresentJson(TTL_ONLY_CACHE_SCHEMA),
|
|
185
|
-
parse: (ctx, path, _field, raw) =>
|
|
186
|
-
raw.cache === undefined
|
|
187
|
-
? undefined
|
|
188
|
-
: (oneOfPresent(
|
|
189
|
-
ctx,
|
|
190
|
-
TTL_ONLY_CACHE_SCHEMA,
|
|
191
|
-
`${path}.cache`,
|
|
192
|
-
raw.cache,
|
|
193
|
-
) ?? undefined),
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// [LAW:one-source-of-truth] The cache emitter derives from the SAME CACHE_SCHEMA
|
|
198
|
-
// the validator interprets — shared by the per-kind variable cache fields.
|
|
199
|
-
export function cacheJson(): JsonNode {
|
|
200
|
-
return oneOfPresentJson(CACHE_SCHEMA);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
const DURATION_RE = /^(\d+(?:\.\d+)?)(ms|s|m|h)$/;
|
|
204
|
-
function isValidDuration(s: string): boolean {
|
|
205
|
-
return DURATION_RE.test(s);
|
|
206
|
-
}
|