@valbuild/core 0.120.0 → 0.121.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 (37) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/dist/declarations/src/index.d.ts +3 -0
  3. package/dist/declarations/src/initSchema.d.ts +27 -0
  4. package/dist/declarations/src/initVal.d.ts +11 -8
  5. package/dist/declarations/src/schema/array.d.ts +2 -2
  6. package/dist/declarations/src/schema/boolean.d.ts +2 -2
  7. package/dist/declarations/src/schema/code.d.ts +2 -2
  8. package/dist/declarations/src/schema/color.d.ts +2 -2
  9. package/dist/declarations/src/schema/date.d.ts +2 -2
  10. package/dist/declarations/src/schema/datetime.d.ts +2 -2
  11. package/dist/declarations/src/schema/file.d.ts +2 -2
  12. package/dist/declarations/src/schema/image.d.ts +2 -2
  13. package/dist/declarations/src/schema/index.d.ts +12 -3
  14. package/dist/declarations/src/schema/keyOf.d.ts +2 -2
  15. package/dist/declarations/src/schema/literal.d.ts +2 -2
  16. package/dist/declarations/src/schema/number.d.ts +2 -2
  17. package/dist/declarations/src/schema/object.d.ts +2 -2
  18. package/dist/declarations/src/schema/record.d.ts +2 -2
  19. package/dist/declarations/src/schema/richtext.d.ts +2 -2
  20. package/dist/declarations/src/schema/route.d.ts +2 -2
  21. package/dist/declarations/src/schema/settings.d.ts +102 -0
  22. package/dist/declarations/src/schema/string.d.ts +2 -2
  23. package/dist/declarations/src/schema/union.d.ts +2 -2
  24. package/dist/declarations/src/selector/index.d.ts +3 -2
  25. package/dist/declarations/src/settingsModule.d.ts +60 -0
  26. package/dist/declarations/src/source/index.d.ts +2 -1
  27. package/dist/declarations/src/source/settings.d.ts +94 -0
  28. package/dist/{index-2f65e194.esm.js → index-5fe6fb98.esm.js} +707 -201
  29. package/dist/{index-861944d8.cjs.prod.js → index-61237991.cjs.prod.js} +712 -200
  30. package/dist/{index-01f673d2.cjs.dev.js → index-9860179f.cjs.dev.js} +712 -200
  31. package/dist/valbuild-core.cjs.dev.js +7 -1
  32. package/dist/valbuild-core.cjs.prod.js +7 -1
  33. package/dist/valbuild-core.esm.js +1 -1
  34. package/package.json +1 -1
  35. package/patch/dist/valbuild-core-patch.cjs.dev.js +1 -1
  36. package/patch/dist/valbuild-core-patch.cjs.prod.js +1 -1
  37. package/patch/dist/valbuild-core-patch.esm.js +2 -2
@@ -0,0 +1,94 @@
1
+ /**
2
+ * The source of the project's settings module — `s.settings()`.
3
+ *
4
+ * **Every key is optional, at every level, and that is the whole point.** A
5
+ * settings module is written as
6
+ *
7
+ * ```typescript
8
+ * export default c.define("/settings.val.ts", s.settings(), {});
9
+ * ```
10
+ *
11
+ * and `{}` has to keep validating as sections are added to it. A project that
12
+ * never touched the assistant's settings should not have to edit its settings
13
+ * file the day `locales` or `permissions` land.
14
+ *
15
+ * That is why settings is not sugar over `s.object()`: an object schema errors
16
+ * with `Expected key 'assistant' not found in object` for any absent key (see
17
+ * `ObjectSchema.executeAssert`), and `.nullable()` permits `null`, not absence.
18
+ * `SettingsSchema` gives absent keys the meaning "unset" instead.
19
+ *
20
+ * `null` means unset too, so the editor can clear a field it has already
21
+ * written without removing the key.
22
+ */
23
+ export type SettingsSource = {
24
+ assistant?: AssistantSettingsSource;
25
+ };
26
+ /**
27
+ * The assistant: whether editors have one, and what it is told about the
28
+ * project on every message.
29
+ *
30
+ * `context` and `tone` are prose the model reads, not instructions Val
31
+ * interprets, and both are capped (see {@link ASSISTANT_SETTINGS_MAX_LENGTH}):
32
+ * they are prepended to every request the chat makes, so an unbounded field
33
+ * here is an unbounded cost on every turn.
34
+ */
35
+ export type AssistantSettingsSource = {
36
+ /**
37
+ * Whether editors have an assistant in this project.
38
+ *
39
+ * Three states, not two — see {@link assistantAvailability}, which is the one
40
+ * place that reads them. Unset is NOT "on": it is "nobody has decided", and
41
+ * the Studio treats that as an offer rather than as an answer.
42
+ */
43
+ enabled?: boolean | null;
44
+ /**
45
+ * Background the model would otherwise have to guess: what this site is, who
46
+ * runs it, what the product does, names and spellings that matter.
47
+ */
48
+ context?: string | null;
49
+ /**
50
+ * How the model should write when it writes content — formal or playful,
51
+ * British or American, sentence case in headings, no exclamation marks.
52
+ *
53
+ * Named `tone` rather than `toneOfVoice` so it reads as one hint among
54
+ * several inside `assistant`, leaving room for siblings (`audience`,
55
+ * `glossary`) rather than a field that looks like it should absorb them.
56
+ */
57
+ tone?: string | null;
58
+ };
59
+ /**
60
+ * The cap on each of the assistant's prose fields, in characters.
61
+ *
62
+ * Roughly a thousand tokens each. Generous enough for a paragraph of
63
+ * background and a house style, small enough that the two of them together do
64
+ * not dominate the system prompt they are appended to.
65
+ */
66
+ export declare const ASSISTANT_SETTINGS_MAX_LENGTH = 4000;
67
+ /**
68
+ * Whether a project has an assistant — and the answer is not a boolean.
69
+ *
70
+ * - `"on"`: use it.
71
+ * - `"off"`: every trace of it goes. No button in the top bar, no row in the
72
+ * quick actions, no panel, nothing sent. A project that says `false` has
73
+ * decided, and the Studio does not keep offering.
74
+ * - `"unconfigured"`: nobody has said. The affordances are SHOWN, and asking to
75
+ * use the assistant asks to turn it on first. That is the difference between
76
+ * this and `"off"`, and the reason `enabled` is a tri-state: hiding an
77
+ * unconfigured assistant means nobody discovers it, and quietly enabling one
78
+ * means a project starts sending its content to a model because it did not
79
+ * know to say no.
80
+ *
81
+ * A project with NO settings module is `"on"`. There is nowhere to record a
82
+ * decision, so there is nothing to prompt for and nothing to prompt INTO — the
83
+ * prompt writes to a settings module, and that project has none.
84
+ *
85
+ * This is the only answer to "does this project have an assistant":
86
+ * `config.ai.chat` is gone, and with it the chat's title, description and
87
+ * suggestions, which nothing replaces. The AI commit-message summariser is
88
+ * deliberately not part of this — `config.ai.commitMessages` stays where it is,
89
+ * and gets settings of its own later.
90
+ */
91
+ export type AssistantAvailability = "on" | "off" | "unconfigured";
92
+ export declare function assistantAvailability(
93
+ /** The settings module's source, or `undefined` where the project has none. */
94
+ settings: SettingsSource | undefined): AssistantAvailability;