bareloop 0.39.0 → 0.41.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 (76) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/bareloop.context.md +137 -112
  3. package/package.json +2 -2
  4. package/src/authorflow.js +333 -58
  5. package/src/authoring.js +65 -2
  6. package/src/authorjob.js +57 -9
  7. package/src/authorreadout.js +50 -2
  8. package/src/authorrun.js +30 -27
  9. package/src/authorscout.js +9 -6
  10. package/src/bridges.js +1 -1
  11. package/src/bundle.js +7 -4
  12. package/src/bundlerun.js +4 -1
  13. package/src/calibrate.js +1 -1
  14. package/src/cardauthor.js +4 -1
  15. package/src/cli.js +1 -1
  16. package/src/config.js +129 -29
  17. package/src/declaredclose.js +4 -3
  18. package/src/draftspend.js +6 -1
  19. package/src/index.js +2 -4
  20. package/src/interviewrun.js +73 -52
  21. package/src/job.js +50 -11
  22. package/src/jobblock.js +140 -0
  23. package/src/judged.js +12 -44
  24. package/src/keysfile.js +15 -7
  25. package/src/kinds.js +2 -2
  26. package/src/ledger.js +1 -1
  27. package/src/modellist.js +84 -0
  28. package/src/monthly.js +23 -43
  29. package/src/panel/authorroutes.js +34 -19
  30. package/src/panel/authorsession.js +187 -72
  31. package/src/panel/index.html +699 -215
  32. package/src/panel/jobplan.js +107 -0
  33. package/src/panel/runroutes.js +3 -0
  34. package/src/panel/server.js +102 -28
  35. package/src/panel/settingsroutes.js +232 -173
  36. package/src/planrun.js +6 -6
  37. package/src/promptregisters.js +1 -1
  38. package/src/providerrows.js +226 -141
  39. package/src/providers.js +58 -250
  40. package/src/providershapes.js +18 -0
  41. package/src/replay.js +1 -1
  42. package/src/reuse.js +1 -1
  43. package/src/root.js +1 -1
  44. package/src/run.js +3 -3
  45. package/src/selection.js +1 -1
  46. package/src/source.js +64 -1
  47. package/src/text.js +13 -0
  48. package/src/thinking.js +130 -0
  49. package/src/transport.js +1 -1
  50. package/src/userrun.js +53 -76
  51. package/types/authorflow.d.ts +258 -39
  52. package/types/authoring.d.ts +7 -1
  53. package/types/authorjob.d.ts +35 -3
  54. package/types/authorreadout.d.ts +17 -1
  55. package/types/authorscout.d.ts +5 -3
  56. package/types/config.d.ts +23 -6
  57. package/types/declaredclose.d.ts +4 -1
  58. package/types/draftspend.d.ts +8 -2
  59. package/types/index.d.ts +1 -1
  60. package/types/job.d.ts +6 -6
  61. package/types/jobblock.d.ts +102 -0
  62. package/types/judged.d.ts +5 -36
  63. package/types/keysfile.d.ts +15 -4
  64. package/types/modellist.d.ts +50 -0
  65. package/types/monthly.d.ts +4 -3
  66. package/types/panel/authorsession.d.ts +44 -15
  67. package/types/panel/jobplan.d.ts +58 -0
  68. package/types/panel/server.d.ts +34 -4
  69. package/types/planrun.d.ts +1 -1
  70. package/types/providerrows.d.ts +192 -99
  71. package/types/providers.d.ts +35 -116
  72. package/types/providershapes.d.ts +10 -0
  73. package/types/run.d.ts +1 -1
  74. package/types/source.d.ts +26 -0
  75. package/types/thinking.d.ts +90 -0
  76. package/types/userrun.d.ts +6 -1
package/types/source.d.ts CHANGED
@@ -304,6 +304,32 @@ export function frontDoorFromManifest(read: {
304
304
  * @returns {string}
305
305
  */
306
306
  export function nonRepoSourceMessage(kind: string): string;
307
+ /**
308
+ * P7 (docs/product/PANEL-BUILD.md, "Inputs"): prove the NUMBERED INPUTS at $0, before any token. Line 1 is the repo
309
+ * (an absolute path to an existing folder); lines 2+ are files or folders INSIDE that repo, repo-relative. A line
310
+ * that is not one of those is a named red naming its line number — never a throw, never a silent skip:
311
+ * - a `search:` line or a URL, and a path that leaves the repo: "only files inside the repo for now" (search and
312
+ * outside-the-repo inputs arrive with the plain-folder piece);
313
+ * - a path that does not exist, or that git does not track (a repo job would not see it);
314
+ * - the front door's own refusals for a file: an environment file by NAME, a symlink, a non-text file, an oversize
315
+ * file. A known secret shape in its content is NOT a refusal (masked where recorded, as the P6 worktree door does).
316
+ * A folder value is checked for existence and tracking only (its files are the repo's own, which the worktree door
317
+ * already masks). Reads the tree; writes nothing.
318
+ * @param {{n: number, label: string, value: string}[]} inputs the parsed Inputs (`parseInputs`)
319
+ * @returns {Promise<{ok: true, repo: string, root: string|null}|{ok: false, error: string}>} `repo` = line 1's absolute path; `root` = the git root it sits in (null when line 1 alone was given and it is not in a git repo)
320
+ */
321
+ export function proveInputFiles(inputs: {
322
+ n: number;
323
+ label: string;
324
+ value: string;
325
+ }[]): Promise<{
326
+ ok: true;
327
+ repo: string;
328
+ root: string | null;
329
+ } | {
330
+ ok: false;
331
+ error: string;
332
+ }>;
307
333
  /**
308
334
  * a named, non-throwing stop
309
335
  */
@@ -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[];
@@ -136,9 +136,13 @@ export type RunOpts = {
136
136
  */
137
137
  into?: string | undefined;
138
138
  /**
139
- * the raw `--model` tier name (`sonnet`/`haiku`), or null for the default
139
+ * the raw `--model <id>` (a model id of a ticked Settings line), or null
140
140
  */
141
141
  model?: string | null | undefined;
142
+ /**
143
+ * the raw `--provider <KEY>` (a key's env name), or null
144
+ */
145
+ providerKey?: string | null | undefined;
142
146
  /**
143
147
  * the raw `--read-shim` arm name, or null for the default
144
148
  */
@@ -205,6 +209,7 @@ export type RunCtx = {
205
209
  */
206
210
  into?: string | undefined;
207
211
  model: string | null;
212
+ providerKey: string | null;
208
213
  readShim: string | null;
209
214
  scout: string | null;
210
215
  draftSpentUsd: string | null;