@jjanczur/tyran 0.1.29 → 0.1.31

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.
@@ -68,7 +68,7 @@ export function validateConfig(doc) {
68
68
  const errors = [];
69
69
  if (!isPlainObject(doc)) return ['config must be a mapping'];
70
70
 
71
- const known = ['profile', 'autonomy', 'tiers', 'validation', 'shared_zones', 'budget', 'main_writable_paths', 'limits', 'pricing'];
71
+ const known = ['profile', 'autonomy', 'tiers', 'validation', 'shared_zones', 'budget', 'main_writable_paths', 'limits', 'pricing', 'spend'];
72
72
  for (const key of Object.keys(doc)) {
73
73
  if (!known.includes(key)) errors.push(`${key}: unknown top-level key`);
74
74
  }
@@ -229,6 +229,32 @@ export function validateConfig(doc) {
229
229
  }
230
230
  }
231
231
 
232
+ // Where cost.mjs should look for THIS repo's transcripts, when the
233
+ // derived-slug / cwd-probe fallback lands on the wrong session — a
234
+ // conductor that ran from a working directory other than the repo it
235
+ // operates on. Operator-written, never scanner-inferred, exactly like
236
+ // `pricing:` and `limits:` above, and optional for the same reason: absence
237
+ // means the existing fallback resolution applies, unchanged.
238
+ if ('spend' in doc) {
239
+ if (!isPlainObject(doc.spend)) errors.push('spend: must be a mapping');
240
+ else {
241
+ const spend = doc.spend;
242
+ if ('transcript_dirs' in spend) {
243
+ if (!Array.isArray(spend.transcript_dirs)) {
244
+ errors.push('spend.transcript_dirs: must be a list of directory paths');
245
+ } else {
246
+ spend.transcript_dirs.forEach((d, i) => {
247
+ if (!isNonEmptyString(d)) errors.push(`spend.transcript_dirs[${i}]: must be a non-empty path`);
248
+ });
249
+ }
250
+ }
251
+ const knownSpend = ['transcript_dirs'];
252
+ for (const key of Object.keys(spend)) {
253
+ if (!knownSpend.includes(key)) errors.push(`spend.${key}: unknown key`);
254
+ }
255
+ }
256
+ }
257
+
232
258
  return errors;
233
259
  }
234
260