bareloop 0.40.0 → 0.42.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 (77) hide show
  1. package/CHANGELOG.md +96 -1
  2. package/README.md +13 -21
  3. package/bareloop.context.md +141 -128
  4. package/package.json +5 -4
  5. package/src/authorflow.js +346 -38
  6. package/src/authoring.js +92 -7
  7. package/src/authorjob.js +82 -20
  8. package/src/authorreadout.js +89 -5
  9. package/src/authorrun.js +39 -30
  10. package/src/authorscout.js +112 -4
  11. package/src/bundle.js +7 -4
  12. package/src/bundlerun.js +4 -1
  13. package/src/cli.js +1 -1
  14. package/src/config.js +129 -29
  15. package/src/declaredclose.js +23 -12
  16. package/src/draftspend.js +4 -4
  17. package/src/facts.js +317 -0
  18. package/src/factwords.js +129 -0
  19. package/src/index.js +2 -4
  20. package/src/inputlook.js +301 -0
  21. package/src/interviewrun.js +17 -25
  22. package/src/job.js +15 -8
  23. package/src/jobblock.js +7 -2
  24. package/src/judged.js +11 -43
  25. package/src/keysfile.js +15 -7
  26. package/src/kinds.js +86 -5
  27. package/src/labelscan.js +170 -0
  28. package/src/modellist.js +84 -0
  29. package/src/monthly.js +23 -43
  30. package/src/pagefetch.js +125 -0
  31. package/src/panel/authorroutes.js +34 -16
  32. package/src/panel/authorsession.js +161 -80
  33. package/src/panel/index.html +553 -152
  34. package/src/panel/jobplan.js +34 -11
  35. package/src/panel/runroutes.js +3 -0
  36. package/src/panel/server.js +54 -18
  37. package/src/panel/settingsroutes.js +232 -173
  38. package/src/planrun.js +5 -4
  39. package/src/providerrows.js +226 -141
  40. package/src/providers.js +58 -332
  41. package/src/providershapes.js +18 -0
  42. package/src/replay.js +1 -1
  43. package/src/rubricstep.js +804 -0
  44. package/src/source.js +166 -1
  45. package/src/thinking.js +130 -0
  46. package/src/u-readout.js +1 -1
  47. package/src/userrun.js +64 -75
  48. package/types/authorflow.d.ts +272 -18
  49. package/types/authoring.d.ts +29 -1
  50. package/types/authorjob.d.ts +9 -7
  51. package/types/authorreadout.d.ts +27 -2
  52. package/types/authorscout.d.ts +72 -2
  53. package/types/config.d.ts +23 -6
  54. package/types/declaredclose.d.ts +4 -2
  55. package/types/draftspend.d.ts +8 -8
  56. package/types/facts.d.ts +71 -0
  57. package/types/factwords.d.ts +42 -0
  58. package/types/index.d.ts +1 -1
  59. package/types/inputlook.d.ts +238 -0
  60. package/types/job.d.ts +5 -5
  61. package/types/jobblock.d.ts +8 -1
  62. package/types/judged.d.ts +5 -36
  63. package/types/keysfile.d.ts +15 -4
  64. package/types/labelscan.d.ts +38 -0
  65. package/types/modellist.d.ts +50 -0
  66. package/types/monthly.d.ts +4 -3
  67. package/types/pagefetch.d.ts +71 -0
  68. package/types/panel/authorsession.d.ts +20 -11
  69. package/types/panel/jobplan.d.ts +12 -4
  70. package/types/panel/server.d.ts +18 -6
  71. package/types/providerrows.d.ts +192 -99
  72. package/types/providers.d.ts +34 -159
  73. package/types/providershapes.d.ts +10 -0
  74. package/types/rubricstep.d.ts +286 -0
  75. package/types/source.d.ts +94 -0
  76. package/types/thinking.d.ts +90 -0
  77. package/types/userrun.d.ts +17 -1
@@ -0,0 +1,90 @@
1
+ /**
2
+ * What bare-agent knows about switching this model's thinking. A missing kind, a non-function `impl`, or a throw all read
3
+ * `'unverified'` — never a guess in either direction.
4
+ * @param {string} shape an API shape id (src/providershapes.js)
5
+ * @param {string} model
6
+ * @param {{ baseUrl?: string|null, impl?: Function }} [o] `impl` is a test seam; production uses bare-agent's own
7
+ * @returns {true|false|'unverified'}
8
+ */
9
+ export function thinkingSupport(shape: string, model: string, { baseUrl, impl }?: {
10
+ baseUrl?: string | null;
11
+ impl?: Function;
12
+ }): true | false | "unverified";
13
+ /**
14
+ * The per-call options for one support answer and one tick (`true` = "Thinking on"). The table (PANEL-BUILD.md P8, ruling Q1):
15
+ * tick on : true -> on | false -> {} (the box is greyed, cannot be on) | 'unverified' -> on
16
+ * tick off: true -> off | false -> {} (the model thinks as it would) | 'unverified' -> off (bare-agent decides; plain request on failure)
17
+ * @param {true|false|'unverified'} support
18
+ * @param {boolean} tick
19
+ * @returns {{ thinkingMode: 'on'|'off' } | {}}
20
+ */
21
+ export function thinkingOptions(support: true | false | "unverified", tick: boolean): {
22
+ thinkingMode: "on" | "off";
23
+ } | {};
24
+ /**
25
+ * Throw unless `mode` is one of {@link THINKING_MODES} — an operator-param guard, so a typo never silently means a mode.
26
+ * @param {unknown} mode
27
+ * @returns {'on'|'off'}
28
+ */
29
+ export function assertThinkingMode(mode: unknown): "on" | "off";
30
+ /**
31
+ * The API shape of a constructed bare-agent provider (the three client classes only); `null` for a test double or a clipipe.
32
+ * @param {any} provider
33
+ * @returns {string|null}
34
+ */
35
+ export function shapeOfProvider(provider: any): string | null;
36
+ /**
37
+ * The per-call options every DRAFTING and JUDGING model call on this provider instance carries for this mode. A provider that is
38
+ * not one of the three client classes (a test double, a clipipe) is never sent the switch.
39
+ * @param {any} provider a constructed bare-agent provider
40
+ * @param {unknown} [mode] 'on' | 'off' (default 'off')
41
+ * @returns {{ thinkingMode: 'on'|'off' } | {}}
42
+ */
43
+ export function thinkingCallOptions(provider: any, mode?: unknown): {
44
+ thinkingMode: "on" | "off";
45
+ } | {};
46
+ /**
47
+ * What the drafting calls will carry for a model the caller has only NAMED (shape, model id, Base URL) — no key, no network. The
48
+ * first drafting row is shown from this, before the key is read.
49
+ * @param {{providerName: string, model: string, baseUrl?: string|null}} o
50
+ * @param {unknown} [mode] 'on' | 'off'
51
+ * @returns {{ support: true|false|'unverified', mode: 'on'|'off', options: {thinkingMode?: 'on'|'off'} }}
52
+ */
53
+ export function thinkingPlanFor({ providerName, model, baseUrl }: {
54
+ providerName: string;
55
+ model: string;
56
+ baseUrl?: string | null;
57
+ }, mode?: unknown): {
58
+ support: true | false | "unverified";
59
+ mode: "on" | "off";
60
+ options: {
61
+ thinkingMode?: "on" | "off";
62
+ };
63
+ };
64
+ /**
65
+ * The server's answer for one Model-menu line: whether the "Thinking on" box can change and the words under it. `false` greys and
66
+ * unticks the box (the note reads {@link THINKING_FIXED_SAY}); `'unverified'` leaves it enabled with no note.
67
+ * @param {string} shape @param {string} model @param {string|null|undefined} baseUrl
68
+ * @returns {{ support: true|false|'unverified', canChange: boolean, say: string }}
69
+ */
70
+ export function thinkingForLine(shape: string, model: string, baseUrl: string | null | undefined): {
71
+ support: true | false | "unverified";
72
+ canChange: boolean;
73
+ say: string;
74
+ };
75
+ /**
76
+ * The first drafting row's words — code-owned, ALWAYS starting "thinking on" or "thinking off". `status` is bare-agent's own
77
+ * `thinkingStatus` for a call that has run ('applied' | 'unsupported' | 'ignored' | 'unknown'); undefined = before any call, read from
78
+ * the plan (`support`, `mode`).
79
+ * @param {{ mode: 'on'|'off', support?: true|false|'unverified', status?: string }} s
80
+ * @returns {string}
81
+ */
82
+ export function thinkingRowText({ mode, support, status }: {
83
+ mode: "on" | "off";
84
+ support?: true | false | "unverified";
85
+ status?: string;
86
+ }): string;
87
+ /** The words under a greyed "Thinking on" box (the server's `thinking.canChange` decides; the page decides nothing). */
88
+ export const THINKING_FIXED_SAY: "can't change this for this model";
89
+ /** The enumerated operator knob a drafting call is built with: 'on' | 'off' (the tick, spelled as a word). */
90
+ export const THINKING_MODES: readonly string[];
@@ -61,6 +61,17 @@ export type Deps = {
61
61
  */
62
62
  provider?: any;
63
63
  providerFor?: ((tier: string) => any) | undefined;
64
+ /**
65
+ * PART 1c - a test seam: how a web input is read at run start (production: barebrowse)
66
+ */
67
+ fetchUrl?: ((url: string) => Promise<{
68
+ ok: true;
69
+ text: string;
70
+ url: string;
71
+ } | {
72
+ ok: false;
73
+ error: string;
74
+ }>) | undefined;
64
75
  judgeProvider?: any;
65
76
  /**
66
77
  * F196 — a test seam for `appendRun`'s
@@ -136,9 +147,13 @@ export type RunOpts = {
136
147
  */
137
148
  into?: string | undefined;
138
149
  /**
139
- * the raw `--model` tier name (`sonnet`/`haiku`), or null for the default
150
+ * the raw `--model <id>` (a model id of a ticked Settings line), or null
140
151
  */
141
152
  model?: string | null | undefined;
153
+ /**
154
+ * the raw `--provider <KEY>` (a key's env name), or null
155
+ */
156
+ providerKey?: string | null | undefined;
142
157
  /**
143
158
  * the raw `--read-shim` arm name, or null for the default
144
159
  */
@@ -205,6 +220,7 @@ export type RunCtx = {
205
220
  */
206
221
  into?: string | undefined;
207
222
  model: string | null;
223
+ providerKey: string | null;
208
224
  readShim: string | null;
209
225
  scout: string | null;
210
226
  draftSpentUsd: string | null;