bareloop 0.54.1 → 0.56.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 (149) hide show
  1. package/CHANGELOG.md +122 -0
  2. package/bareloop.context.md +67 -6
  3. package/package.json +3 -3
  4. package/src/authorflow.js +217 -238
  5. package/src/authoring.js +22 -6
  6. package/src/authorjob.js +138 -30
  7. package/src/authorreadout.js +15 -4
  8. package/src/authorrun.js +13 -4
  9. package/src/authorscout.js +9 -6
  10. package/src/behaviour.js +14 -0
  11. package/src/blockasks.js +43 -0
  12. package/src/cardschedule.js +42 -0
  13. package/src/checkblock.js +772 -0
  14. package/src/checklist.js +128 -0
  15. package/src/checkpick.js +294 -0
  16. package/src/checksuggest.js +28 -0
  17. package/src/checkwords.js +27 -0
  18. package/src/cli.js +1 -1
  19. package/src/config.js +24 -1
  20. package/src/declaredclose.js +30 -1
  21. package/src/destpoint.js +151 -0
  22. package/src/draftspend.js +85 -0
  23. package/src/facts.js +8 -1
  24. package/src/factwords.js +14 -1
  25. package/src/fitcheck.js +5 -3
  26. package/src/job.js +81 -1
  27. package/src/jobblock.js +9 -0
  28. package/src/labelscan.js +11 -0
  29. package/src/launcher.js +3 -2
  30. package/src/mcpchecks.js +52 -0
  31. package/src/mcppick.js +36 -0
  32. package/src/mcpsources.js +77 -0
  33. package/src/mcpuse.js +97 -0
  34. package/src/natural.js +23 -0
  35. package/src/pagemap.js +20 -5
  36. package/src/panel/authorroutes.js +105 -18
  37. package/src/panel/authorsession.js +293 -44
  38. package/src/panel/index.html +873 -41
  39. package/src/panel/jobgrid.js +117 -0
  40. package/src/panel/jobplan.js +103 -35
  41. package/src/panel/scheduler.js +80 -13
  42. package/src/panel/schedules.js +189 -28
  43. package/src/panel/schedulestart.js +44 -13
  44. package/src/panel/server.js +471 -39
  45. package/src/panel/settingsroutes.js +133 -3
  46. package/src/panel/status.js +19 -1
  47. package/src/panel/tickets.js +44 -0
  48. package/src/pickrecord.js +163 -0
  49. package/src/placerule.js +355 -0
  50. package/src/plan.js +31 -2
  51. package/src/planrun.js +71 -15
  52. package/src/prcheckout.js +259 -0
  53. package/src/promptregisters.js +11 -0
  54. package/src/questionbox.js +112 -0
  55. package/src/readshim.js +3 -2
  56. package/src/revises.js +56 -0
  57. package/src/rowedit.js +115 -0
  58. package/src/rubricstep.js +265 -132
  59. package/src/run.js +19 -2
  60. package/src/runexport.js +2 -0
  61. package/src/runlist.js +3 -2
  62. package/src/schedulewords.js +46 -4
  63. package/src/source.js +81 -7
  64. package/src/stepmcp.js +86 -0
  65. package/src/ticket.js +113 -0
  66. package/src/ticketfilter.js +76 -0
  67. package/src/ticketlabels.js +79 -0
  68. package/src/ticketmcp.js +111 -0
  69. package/src/ticketnext.js +35 -0
  70. package/src/ticketrepo.js +98 -0
  71. package/src/ticketschedule.js +32 -0
  72. package/src/ticketshape.js +45 -0
  73. package/src/tools.js +9 -0
  74. package/src/trigger.js +14 -2
  75. package/src/triggerclock.js +7 -3
  76. package/src/triggerfiles.js +19 -11
  77. package/src/triggertickets.js +244 -0
  78. package/src/userrun.js +191 -10
  79. package/src/validate.js +3 -1
  80. package/src/worktree.js +43 -1
  81. package/types/authorflow.d.ts +86 -93
  82. package/types/authorjob.d.ts +35 -4
  83. package/types/authorreadout.d.ts +4 -3
  84. package/types/authorscout.d.ts +4 -2
  85. package/types/behaviour.d.ts +12 -0
  86. package/types/blockasks.d.ts +37 -0
  87. package/types/cardschedule.d.ts +24 -0
  88. package/types/checkblock.d.ts +361 -0
  89. package/types/checklist.d.ts +134 -0
  90. package/types/checkpick.d.ts +160 -0
  91. package/types/checksuggest.d.ts +30 -0
  92. package/types/checkwords.d.ts +14 -0
  93. package/types/config.d.ts +7 -0
  94. package/types/declaredclose.d.ts +4 -0
  95. package/types/destpoint.d.ts +89 -0
  96. package/types/draftspend.d.ts +37 -0
  97. package/types/factwords.d.ts +7 -0
  98. package/types/fitcheck.d.ts +7 -1
  99. package/types/job.d.ts +13 -0
  100. package/types/jobblock.d.ts +9 -0
  101. package/types/labelscan.d.ts +7 -0
  102. package/types/launcher.d.ts +2 -2
  103. package/types/mcpchecks.d.ts +8 -0
  104. package/types/mcppick.d.ts +33 -0
  105. package/types/mcpsources.d.ts +51 -0
  106. package/types/mcpuse.d.ts +15 -0
  107. package/types/natural.d.ts +2 -0
  108. package/types/pagemap.d.ts +6 -1
  109. package/types/panel/authorroutes.d.ts +11 -2
  110. package/types/panel/authorsession.d.ts +69 -3
  111. package/types/panel/jobgrid.d.ts +405 -0
  112. package/types/panel/jobplan.d.ts +55 -11
  113. package/types/panel/scheduler.d.ts +7 -2
  114. package/types/panel/schedules.d.ts +124 -4
  115. package/types/panel/schedulestart.d.ts +21 -3
  116. package/types/panel/server.d.ts +432 -10
  117. package/types/panel/settingsroutes.d.ts +4 -2
  118. package/types/panel/status.d.ts +16 -2
  119. package/types/panel/tickets.d.ts +61 -0
  120. package/types/pickrecord.d.ts +100 -0
  121. package/types/placerule.d.ts +194 -0
  122. package/types/plan.d.ts +1 -0
  123. package/types/prcheckout.d.ts +151 -0
  124. package/types/questionbox.d.ts +87 -0
  125. package/types/readshim.d.ts +4 -3
  126. package/types/revises.d.ts +23 -0
  127. package/types/rowedit.d.ts +32 -0
  128. package/types/rubricstep.d.ts +100 -48
  129. package/types/run.d.ts +27 -1
  130. package/types/runlist.d.ts +6 -3
  131. package/types/schedulewords.d.ts +29 -2
  132. package/types/source.d.ts +40 -4
  133. package/types/stepmcp.d.ts +40 -0
  134. package/types/ticket.d.ts +114 -0
  135. package/types/ticketfilter.d.ts +34 -0
  136. package/types/ticketlabels.d.ts +44 -0
  137. package/types/ticketmcp.d.ts +84 -0
  138. package/types/ticketnext.d.ts +33 -0
  139. package/types/ticketrepo.d.ts +118 -0
  140. package/types/ticketschedule.d.ts +21 -0
  141. package/types/ticketshape.d.ts +37 -0
  142. package/types/tools.d.ts +1 -0
  143. package/types/trigger.d.ts +9 -1
  144. package/types/triggerclock.d.ts +6 -2
  145. package/types/triggerfiles.d.ts +13 -5
  146. package/types/triggertickets.d.ts +110 -0
  147. package/types/userrun.d.ts +50 -0
  148. package/types/validate.d.ts +1 -0
  149. package/types/worktree.d.ts +19 -0
@@ -117,12 +117,14 @@ export function schemaCoverage(catalogue?: Record<string, any>): {
117
117
  * `kinds` (Part 1a) narrows the branches to the kinds a language may use (`catalogueForLang`) WITHOUT narrowing the coverage check,
118
118
  * which stays over the whole catalogue; null (the default) = no narrowing.
119
119
  * @param {Record<string, any>} [catalogue]
120
- * @param {{verdictType?: string|null, questions?: boolean, kinds?: string[]|null}} [o]
120
+ * `ticket` (MCP + tickets piece 2) adds the optional top-level `ticketFilter` property for a job that reads tickets; absent, the schema is byte-identical.
121
+ * @param {{verdictType?: string|null, questions?: boolean, kinds?: string[]|null, ticket?: boolean}} [o]
121
122
  */
122
- export function declarationSchema(catalogue?: Record<string, any>, { verdictType, questions, kinds }?: {
123
+ export function declarationSchema(catalogue?: Record<string, any>, { verdictType, questions, kinds, ticket }?: {
123
124
  verdictType?: string | null;
124
125
  questions?: boolean;
125
126
  kinds?: string[] | null;
127
+ ticket?: boolean;
126
128
  }): {
127
129
  type: string;
128
130
  properties: {
@@ -144,6 +146,28 @@ export function declarationSchema(catalogue?: Record<string, any>, { verdictType
144
146
  };
145
147
  description: string;
146
148
  } | undefined;
149
+ ticketFilter?: {
150
+ type: string;
151
+ properties: {
152
+ priority: {
153
+ type: string;
154
+ items: {
155
+ type: string;
156
+ enum: string[];
157
+ };
158
+ description: string;
159
+ };
160
+ labels: {
161
+ type: string;
162
+ items: {
163
+ type: string;
164
+ };
165
+ description: string;
166
+ };
167
+ };
168
+ additionalProperties: boolean;
169
+ description: string;
170
+ } | undefined;
147
171
  stages: {
148
172
  type: string;
149
173
  minItems: number;
@@ -252,15 +276,16 @@ export function declarationSchema(catalogue?: Record<string, any>, { verdictType
252
276
  * The output channel. It records and acknowledges; it takes no action, which is
253
277
  * why handing it to a toolless authoring call does not reopen D3.
254
278
  * @param {{calls: any[]}} box
255
- * @param {{catalogue?: Record<string, any>, verdictType?: string|null, questions?: boolean, kinds?: string[]|null}} [o]
279
+ * @param {{catalogue?: Record<string, any>, verdictType?: string|null, questions?: boolean, kinds?: string[]|null, ticket?: boolean}} [o]
256
280
  */
257
281
  export function declarationTool(box: {
258
282
  calls: any[];
259
- }, { catalogue, verdictType, questions, kinds }?: {
283
+ }, { catalogue, verdictType, questions, kinds, ticket }?: {
260
284
  catalogue?: Record<string, any>;
261
285
  verdictType?: string | null;
262
286
  questions?: boolean;
263
287
  kinds?: string[] | null;
288
+ ticket?: boolean;
264
289
  }): {
265
290
  name: string;
266
291
  description: string;
@@ -285,6 +310,28 @@ export function declarationTool(box: {
285
310
  };
286
311
  description: string;
287
312
  } | undefined;
313
+ ticketFilter?: {
314
+ type: string;
315
+ properties: {
316
+ priority: {
317
+ type: string;
318
+ items: {
319
+ type: string;
320
+ enum: string[];
321
+ };
322
+ description: string;
323
+ };
324
+ labels: {
325
+ type: string;
326
+ items: {
327
+ type: string;
328
+ };
329
+ description: string;
330
+ };
331
+ };
332
+ additionalProperties: boolean;
333
+ description: string;
334
+ } | undefined;
288
335
  stages: {
289
336
  type: string;
290
337
  minItems: number;
@@ -472,8 +519,7 @@ export function writeScopeBlock(writeScope: string[]): string;
472
519
  * meaning from `openQuestions` (which means "could not resolve"): the two
473
520
  * never merge.
474
521
  * @param {{checks: string[], checkItems?: {text: string, fromLine: number[]|null}[], protections: string[], openQuestions?: string[], notChecked?: string[],
475
- * answeredQuestions?: string[]}} confirmed
476
- * @param {{numbered?: boolean}} [o] `numbered` (a rubric job on files): each confirmed check carries its `#n`, which a part cites in `covers`
522
+ * answeredQuestions?: string[], goalOnly?: boolean}} confirmed
477
523
  */
478
524
  export function confirmedBlock(confirmed: {
479
525
  checks: string[];
@@ -485,8 +531,7 @@ export function confirmedBlock(confirmed: {
485
531
  openQuestions?: string[];
486
532
  notChecked?: string[];
487
533
  answeredQuestions?: string[];
488
- }, { numbered }?: {
489
- numbered?: boolean;
534
+ goalOnly?: boolean;
490
535
  }): string;
491
536
  /**
492
537
  * P7: the job-line tagging order (model-facing, registered). Rule 1 of the job block: every stage the drafter writes
@@ -561,44 +606,6 @@ export function authorPrompt({ answers, questions, facts, listingBlock, lang, ve
561
606
  } | null;
562
607
  labelLists?: string[] | null;
563
608
  }): string;
564
- /**
565
- * The composer prompt for a rubric job on local files (Part 1a, docs/product/ITEM33-BUILD.md). There is no repository
566
- * and no survey: the facts are the numbered inputs and the listing is the frozen tree (input/ files, output/). It states
567
- * the step-file contract the worker is also told ({@link stepFileContract}), so the stage and the file cannot drift.
568
- * @param {{answers: Record<string|number, string>, questions?: Record<string|number, string>, facts: any, listingBlock: string,
569
- * verdictType: string, guards: {name: string, kind: string, params: Record<string, any>, fill: string[]}[],
570
- * mode?: 'tool'|'text', catalogue?: Record<string, any>, writeScope?: string[]|null,
571
- * jobLines?: {n: number}[]|null, inputs?: {n: number, label: string, value: string}[]|null, confirmed?: any,
572
- * labelLists?: string[]|null,
573
- * }} o
574
- * @returns {string}
575
- */
576
- export function rubricAuthorPrompt({ answers, questions, facts, listingBlock, verdictType, guards, mode, catalogue, writeScope, jobLines, inputs, confirmed, labelLists, }: {
577
- answers: Record<string | number, string>;
578
- questions?: Record<string | number, string>;
579
- facts: any;
580
- listingBlock: string;
581
- verdictType: string;
582
- guards: {
583
- name: string;
584
- kind: string;
585
- params: Record<string, any>;
586
- fill: string[];
587
- }[];
588
- mode?: "tool" | "text";
589
- catalogue?: Record<string, any>;
590
- writeScope?: string[] | null;
591
- jobLines?: {
592
- n: number;
593
- }[] | null;
594
- inputs?: {
595
- n: number;
596
- label: string;
597
- value: string;
598
- }[] | null;
599
- confirmed?: any;
600
- labelLists?: string[] | null;
601
- }): string;
602
609
  /**
603
610
  * The seed read, as the model sees it: mechanical labels, no editorial. Per-stage
604
611
  * gap capped with the trim ANNOUNCED (F28 — a bound that eats the failure names
@@ -631,10 +638,10 @@ export function renderSeedReadBlock(rows: any[], { gapCap }?: {
631
638
  * a credential crossed unmasked before this line existed. Applied to the whole
632
639
  * rendered block rather than one field, so a red added to the validator is
633
640
  * scrubbed by construction rather than by remembering.
634
- * @param {{kind: 'validation'|'artifact', reds: (Red|string)[], cap?: number}} o
641
+ * @param {{kind: 'validation'|'artifact'|'edits', reds: (Red|string)[], cap?: number}} o
635
642
  */
636
643
  export function renderRejectBlock({ kind, reds, cap }: {
637
- kind: "validation" | "artifact";
644
+ kind: "validation" | "artifact" | "edits";
638
645
  reds: (Red | string)[];
639
646
  cap?: number;
640
647
  }): string;
@@ -737,7 +744,7 @@ export function resolveSourcePrefixes({ workdir, sourcePaths, seedFiles }: {
737
744
  */
738
745
  /**
739
746
  * @param {{ceilingUsd?: number|null,
740
- * onCall?: (call: {label: string, costUsd: number|null, unpricedRounds: number, thinkingStatus?: string}) => void}} [o]
747
+ * onCall?: (call: {label: string, costUsd: number|null, unpricedRounds: number, thinkingStatus?: string, raw?: string}) => void}} [o]
741
748
  * `ceilingUsd` is the OPERATOR's ceiling; `null`/absent is UNBOUNDED.
742
749
  * `onCall` is a REPORTING seam fired as each metered call lands — the shell's
743
750
  * only chance to know what has been spent while the run is still alive. It is
@@ -754,6 +761,7 @@ export function makeCostBook({ ceilingUsd, onCall }?: {
754
761
  costUsd: number | null;
755
762
  unpricedRounds: number;
756
763
  thinkingStatus?: string;
764
+ raw?: string;
757
765
  }) => void;
758
766
  }): {
759
767
  /** @param {string} label @param {any} r a bare-agent run result @param {number} [attempt] */
@@ -912,9 +920,9 @@ export function confirmTool(box: {
912
920
  * @param {{answers: Record<string|number, string>, questions: Record<string|number, string>,
913
921
  * labels?: Record<string|number, string>, facts?: any, listing?: string|null,
914
922
  * writeScope?: string[]|null, isRepo: boolean, lang: string, worseThanBefore?: string,
915
- * fixText?: string|null, protections?: string[], inputs?: {n: number, label: string, value: string}[]|null}} o
923
+ * fixText?: string|null, protections?: string[], inputs?: {n: number, label: string, value: string}[]|null, ticket?: boolean}} o
916
924
  */
917
- export function confirmPrompt({ answers, questions, labels, facts, listing, writeScope, isRepo, lang, worseThanBefore, fixText, protections, inputs }: {
925
+ export function confirmPrompt({ answers, questions, labels, facts, listing, writeScope, isRepo, lang, worseThanBefore, fixText, protections, inputs, ticket }: {
918
926
  answers: Record<string | number, string>;
919
927
  questions: Record<string | number, string>;
920
928
  labels?: Record<string | number, string>;
@@ -931,6 +939,7 @@ export function confirmPrompt({ answers, questions, labels, facts, listing, writ
931
939
  label: string;
932
940
  value: string;
933
941
  }[] | null;
942
+ ticket?: boolean;
934
943
  }): string;
935
944
  /**
936
945
  * THE CONFIRM TURN: the $0 half (worse-than-before for a repo, a language
@@ -955,7 +964,7 @@ export function confirmPrompt({ answers, questions, labels, facts, listing, writ
955
964
  * ask: (step: {kind: string, [k: string]: any}) => Promise<string|null>,
956
965
  * onPhase?: (phase: string, data?: any) => void, mode?: 'tool'|'text',
957
966
  * worseThanBefore?: string, inputs?: {n: number, label: string, value: string}[]|null,
958
- * jobLines?: {n: number}[]|null}} o retired field (hamr's ruling 2026-09-28):
967
+ * jobLines?: {n: number}[]|null, ticket?: boolean, card?: {checkItems: {text: string, fromLine: number[], by: 'agent'|'you'|'default', key?: string}[], notChecked: string[], notCheckedBy?: Record<string, string>}|null, block?: CheckBlock|null, cardOf?: (() => any)|null}} o retired field (hamr's ruling 2026-09-28):
959
968
  * `worseThanBefore` is never asked any more and defaults to `''` — a
960
969
  * caller may still pass a string through (kept for a future, non-ask
961
970
  * source of the same constraint), it just never comes from an ask() step.
@@ -966,7 +975,7 @@ export function confirmPrompt({ answers, questions, labels, facts, listing, writ
966
975
  * worseThanBefore: string, openQuestions: string[], notChecked: string[], answeredQuestions?: string[]}|null,
967
976
  * reds: Red[], cost: any}>}
968
977
  */
969
- export function runConfirmTurn({ verdictType, answers, questions, labels, facts, listing, writeScope, isRepo, lang, generate, book, ask, onPhase, mode, worseThanBefore: presetWorseThanBefore, inputs, jobLines, }: {
978
+ export function runConfirmTurn({ verdictType, answers, questions, labels, facts, listing, writeScope, isRepo, lang, generate, book, ask, onPhase, mode, worseThanBefore: presetWorseThanBefore, inputs, jobLines, ticket, card, block, cardOf, }: {
970
979
  verdictType: string;
971
980
  answers: Record<string | number, string>;
972
981
  questions: Record<string | number, string>;
@@ -997,6 +1006,19 @@ export function runConfirmTurn({ verdictType, answers, questions, labels, facts,
997
1006
  jobLines?: {
998
1007
  n: number;
999
1008
  }[] | null;
1009
+ ticket?: boolean;
1010
+ card?: {
1011
+ checkItems: {
1012
+ text: string;
1013
+ fromLine: number[];
1014
+ by: "agent" | "you" | "default";
1015
+ key?: string;
1016
+ }[];
1017
+ notChecked: string[];
1018
+ notCheckedBy?: Record<string, string>;
1019
+ } | null;
1020
+ block?: CheckBlock | null;
1021
+ cardOf?: (() => any) | null;
1000
1022
  }): Promise<{
1001
1023
  ok: boolean;
1002
1024
  stop: null | "cap-halt" | "pricing-red" | "provider-red" | "artifact-red" | "confirm-abandoned" | "confirm-restart";
@@ -1064,10 +1086,10 @@ export function runConfirmTurn({ verdictType, answers, questions, labels, facts,
1064
1086
  * priorCalls?: {label: string, costUsd: number|null, unpricedRounds: number}[]|null,
1065
1087
  * priorRaws?: any[]|null,
1066
1088
  * jobLines?: {n: number, text: string}[]|null, inputs?: {n: number, label: string, value: string}[]|null,
1067
- * offerQuestions?: boolean,
1089
+ * offerQuestions?: boolean, ticket?: boolean, block?: CheckBlock|null, editGenerate?: Function|null,
1068
1090
  * confirmed?: {checks: string[], checkItems?: {text: string, fromLine: number[]|null}[], protections: string[], openQuestions?: string[], notChecked?: string[], answeredQuestions?: string[]}|null}} o
1069
1091
  */
1070
- export function authorClose({ workdir, seedRef, lang, verdictType, answers, questions, writeScope, scout, listing, priorCalls, priorRaws, confirmed, jobLines, inputs, generate, seedReadFn, closeCtx, ceilingUsd, onPhase, onCall, maxRevisions, structureRetries, structuredMode, catalogue: catalogueIn, offerQuestions, }: {
1092
+ export function authorClose({ workdir, seedRef, lang, verdictType, answers, questions, writeScope, scout, listing, priorCalls, priorRaws, confirmed, jobLines, inputs, generate, seedReadFn, closeCtx, ceilingUsd, onPhase, onCall, maxRevisions, structureRetries, structuredMode, catalogue: catalogueIn, offerQuestions, ticket, block, editGenerate, }: {
1071
1093
  workdir: string;
1072
1094
  seedRef: string;
1073
1095
  lang: string;
@@ -1121,6 +1143,9 @@ export function authorClose({ workdir, seedRef, lang, verdictType, answers, ques
1121
1143
  value: string;
1122
1144
  }[] | null;
1123
1145
  offerQuestions?: boolean;
1146
+ ticket?: boolean;
1147
+ block?: CheckBlock | null;
1148
+ editGenerate?: Function | null;
1124
1149
  confirmed?: {
1125
1150
  checks: string[];
1126
1151
  checkItems?: {
@@ -1672,19 +1697,6 @@ export const PARAM_SCHEMAS: Readonly<{
1672
1697
  minimum: number;
1673
1698
  description: string;
1674
1699
  };
1675
- names: {
1676
- type: string;
1677
- minItems: number;
1678
- items: {
1679
- type: string;
1680
- minLength: number;
1681
- };
1682
- description: string;
1683
- };
1684
- wordsPerSection: {
1685
- type: string;
1686
- minimum: number;
1687
- };
1688
1700
  source: {
1689
1701
  type: string;
1690
1702
  minLength: number;
@@ -1699,16 +1711,6 @@ export const PARAM_SCHEMAS: Readonly<{
1699
1711
  };
1700
1712
  description: string;
1701
1713
  };
1702
- covers: {
1703
- type: string;
1704
- minItems: number;
1705
- uniqueItems: boolean;
1706
- items: {
1707
- type: string;
1708
- minimum: number;
1709
- };
1710
- description: string;
1711
- };
1712
1714
  rules: {
1713
1715
  type: string;
1714
1716
  minItems: number;
@@ -1861,18 +1863,6 @@ export const PARAM_SCHEMAS: Readonly<{
1861
1863
  * about KINDS: every part of a job line is counted or checked against a quote, because nothing in this build judges.
1862
1864
  */
1863
1865
  export const RUBRIC_FILES_STATEMENT: string;
1864
- /**
1865
- * THE RUBRIC RULES, in one place (live fix B1): what the confirm step and the drafter are both told about turning the person's words
1866
- * into checks. The confirm note ({@link RUBRIC_CONFIRM_NOTE}) and the composer brief ({@link REQUIRED_FACTS_BRIEF}) interpolate THIS
1867
- * constant, so the two cannot drift (in smv6k6l8dxkzs the confirm step planned a limit the drafter then could not carry, and the
1868
- * drafter added an airport code the person never wrote). Field-neutral: neither turn needs the other's field names.
1869
- */
1870
- export const RUBRIC_RULES: string;
1871
- /**
1872
- * REQUIRED FACTS, as the composer is told them (PART 1b, PRD item 33 RF1–RF17). The shape of the fact part is in the catalogue and the
1873
- * schema; this is the judgement the schema cannot carry: what becomes a fact, where its words come from, and what is Not checked.
1874
- */
1875
- export const REQUIRED_FACTS_BRIEF: string;
1876
1866
  export const CONFIRM_TOOL_NAME: "confirm_plan";
1877
1867
  /** Acknowledgement text the confirm tool's `execute` returns — mirrors
1878
1868
  * {@link DECLARATION_ACK}'s role: an output channel that records and
@@ -1891,12 +1881,14 @@ export const CONFIRM_STRUCTURE_INSTRUCTION: string;
1891
1881
  * {@link CLASS_STATEMENTS} already use, rather than a code matcher over prose.
1892
1882
  */
1893
1883
  /**
1894
- * What the confirm turn tells the model about a rubric job on local text files (model-facing, registered). There is no
1895
- * repository and no judge: a check is a limit a machine counts (words, lines, sections), or a claim a quote from a named
1896
- * input must back. Everything else the person asked for is named in `notChecked`, in their words.
1884
+ * What the confirm turn tells the model about a rubric job on local text files (model-facing, registered). The turn plans the goal only: the checks of the job are the one list's
1885
+ * (`src/checklist.js`), made before the draft, never this turn's.
1897
1886
  */
1898
1887
  export const RUBRIC_CONFIRM_NOTE: string;
1899
1888
  export const CONFIRM_SYSTEM: string;
1889
+ /** the confirm turn's system prompt for a rubric job (model-facing, registered): a one-sentence goal, no check of its own */
1890
+ export const CONFIRM_GOAL_SYSTEM: string;
1891
+ export function confirmSystemFor(lang: string): string;
1900
1892
  export type Red = {
1901
1893
  code: string;
1902
1894
  path: string;
@@ -1904,3 +1896,4 @@ export type Red = {
1904
1896
  [k: string]: any;
1905
1897
  };
1906
1898
  import { scrubRaw } from './text.js';
1899
+ import { CheckBlock } from './checkblock.js';
@@ -92,15 +92,16 @@ export function refuseLockedKind(kind: string): Refusal;
92
92
  * authorFn?: Function, authorOpts?: object, writeScope?: string[]|null,
93
93
  * signerFix?: Function|any, proposeFn?: Function, compileOpts?: object,
94
94
  * ask?: ((step: {kind: string, [k: string]: any}) => Promise<string|null>)|null,
95
- * answerQuestions?: ((o: {questions: {line: number, question: string, rule?: number, source?: string, ask?: string, reading?: string}[], dropped: {reason: string, raw: any}[], confirmed: any}) =>
96
- * Promise<{jobLines: {n: number, text: string, rule?: string}[], answers: Record<string|number, any>, left?: {line: number, rule: number}[]}|null>)|null,
95
+ * answerQuestions?: ((o: {questions: {line: number, question: string, rule?: number, source?: string, ask?: string, reading?: string, key?: string}[], dropped: {reason: string, raw: any}[], confirmed: any}) =>
96
+ * Promise<{jobLines: {n: number, text: string, rule?: string}[], answers: Record<string|number, any>, left?: {line: number, rule: number}[], picks?: any[], choices?: {key: string, choice: string, text?: string}[]}|null>)|null,
97
+ * pickGenerate?: Function|null, ledgerGenerate?: Function|null, editGenerate?: Function|null, carriedPicks?: any[]|null, carriedChoices?: any[]|null, onChoices?: (rec: any[]) => void, onPicks?: (o: {entries: any[], kept: {line: number, rule: number, entry: any}[]}) => void,
97
98
  * confirmGenerate?: Function|null, isRepo?: boolean,
98
99
  * langResult?: {kind: string, candidates?: string[], [k: string]: any}|null}} o
99
100
  * @returns {Promise<{ok: boolean, refusal: Refusal|null, verdictType: string|null,
100
101
  * closeDecl: any, seedRef: string|null, authoring: any, judged: any, reds: Red[],
101
- * stop: string|null, cost: any, interview: any, confirmed: any}>}
102
+ * stop: string|null, cost: any, interview: any, confirmed: any, picked?: {line: number, text: string}[], hasBuiltCheck?: boolean, notBuilt?: {line: number, text: string}[]}>}
102
103
  */
103
- export function authorCloseForJob({ answers, repoPath, lang, verdictType, questions, jobLines, inputs, generate, provider, seedRef, scout, listing, ceilingUsd, rates, draftThinking, writeScope, judgeModel, onPhase, onCall, seedFn, scoutFn, listingFn, lookFn, fitFn, fitAsk, onFit, authorFn, authorOpts, signerFix, proposeFn, compileOpts, ask, confirmGenerate, isRepo, langResult, answerQuestions, }: {
104
+ export function authorCloseForJob({ answers, repoPath, lang, verdictType, questions, jobLines, inputs, generate, provider, seedRef, scout, listing, ceilingUsd, rates, draftThinking, writeScope, judgeModel, onPhase, onCall, seedFn, scoutFn, listingFn, lookFn, fitFn, fitAsk, onFit, authorFn, authorOpts, pickGenerate, ledgerGenerate, editGenerate, carriedPicks, onPicks, carriedChoices, onChoices, signerFix, proposeFn, compileOpts, ask, confirmGenerate, isRepo, langResult, answerQuestions, }: {
104
105
  answers: Record<string | number, any>;
105
106
  repoPath?: string | null;
106
107
  lang: string;
@@ -163,6 +164,7 @@ export function authorCloseForJob({ answers, repoPath, lang, verdictType, questi
163
164
  source?: string;
164
165
  ask?: string;
165
166
  reading?: string;
167
+ key?: string;
166
168
  }[];
167
169
  dropped: {
168
170
  reason: string;
@@ -180,7 +182,27 @@ export function authorCloseForJob({ answers, repoPath, lang, verdictType, questi
180
182
  line: number;
181
183
  rule: number;
182
184
  }[];
185
+ picks?: any[];
186
+ choices?: {
187
+ key: string;
188
+ choice: string;
189
+ text?: string;
190
+ }[];
183
191
  } | null>) | null;
192
+ pickGenerate?: Function | null;
193
+ ledgerGenerate?: Function | null;
194
+ editGenerate?: Function | null;
195
+ carriedPicks?: any[] | null;
196
+ carriedChoices?: any[] | null;
197
+ onChoices?: (rec: any[]) => void;
198
+ onPicks?: (o: {
199
+ entries: any[];
200
+ kept: {
201
+ line: number;
202
+ rule: number;
203
+ entry: any;
204
+ }[];
205
+ }) => void;
184
206
  confirmGenerate?: Function | null;
185
207
  isRepo?: boolean;
186
208
  langResult?: {
@@ -201,6 +223,15 @@ export function authorCloseForJob({ answers, repoPath, lang, verdictType, questi
201
223
  cost: any;
202
224
  interview: any;
203
225
  confirmed: any;
226
+ picked?: {
227
+ line: number;
228
+ text: string;
229
+ }[];
230
+ hasBuiltCheck?: boolean;
231
+ notBuilt?: {
232
+ line: number;
233
+ text: string;
234
+ }[];
204
235
  }>;
205
236
  /**
206
237
  * Fold an authored close into the OPERATOR's own half of the spec.
@@ -276,16 +276,17 @@ export function signingReasons(reds: PlainRed[], { cases }?: {
276
276
  export function signingKinds(): string[];
277
277
  /**
278
278
  * THE MESSAGE a person reads when the signing gates refuse. The panel's failed step and the CLI print exactly this.
279
- * @param {{reds: PlainRed[], refusal?: {detail?: string}|null, cases?: any,
280
- * spend?: {knownUsd?: number|null, spendComplete?: boolean|null}|null}} o
279
+ * @param {{reds: PlainRed[], refusal?: {detail?: string}|null, cases?: any, noCheck?: boolean,
280
+ * spend?: {knownUsd?: number|null, spendComplete?: boolean|null}|null}} o `noCheck` = the check block has no built check (block.hasBuiltCheck() is false): the stop is the end check's own words
281
281
  * @returns {string}
282
282
  */
283
- export function signingStopText({ reds, refusal, cases, spend }: {
283
+ export function signingStopText({ reds, refusal, cases, spend, noCheck }: {
284
284
  reds: PlainRed[];
285
285
  refusal?: {
286
286
  detail?: string;
287
287
  } | null;
288
288
  cases?: any;
289
+ noCheck?: boolean;
289
290
  spend?: {
290
291
  knownUsd?: number | null;
291
292
  spendComplete?: boolean | null;
@@ -92,7 +92,7 @@ export function defaultSurveyor({ workdir, granted, auditPath, ctx }: {
92
92
  * @param {{workdir: string, provider?: any,
93
93
  * rounds?: number, minBytes?: number, blobMax?: number, maxTokens?: number, ctx?: boolean,
94
94
  * attempts?: number, ceilingUsd?: number|null, callTimeoutMs?: number,
95
- * onCall?: (call: {label: string, costUsd: number|null, unpricedRounds: number, thinkingStatus?: string}) => void,
95
+ * onCall?: (call: {label: string, costUsd: number|null, unpricedRounds: number, thinkingStatus?: string, raw?: string}) => void,
96
96
  * createLoop?: (o: {system: string, policy: any, onLlmResult: any, provider: any, rates?: {in: number, out: number}}) => any,
97
97
  * rates?: {in: number, out: number}|null, callOptions?: Record<string, any>,
98
98
  * createSurveyor?: (o: {workdir: string, granted: readonly string[], ctx: boolean}) => Promise<any>}} o
@@ -116,6 +116,7 @@ export function runAuthorScout({ workdir, provider, rounds, minBytes, blobMax, m
116
116
  costUsd: number | null;
117
117
  unpricedRounds: number;
118
118
  thinkingStatus?: string;
119
+ raw?: string;
119
120
  }) => void;
120
121
  createLoop?: (o: {
121
122
  system: string;
@@ -151,7 +152,7 @@ export function runAuthorScout({ workdir, provider, rounds, minBytes, blobMax, m
151
152
  * Run the look. `createLoop` is the same seam the repo scout has; nothing else here needs a live process.
152
153
  * @param {{texts: Record<string, string>, inputs: {n: number, label: string}[], jobLines: {n: number, text: string, rule?: string, rules?: string[]}[],
153
154
  * provider?: any, rounds?: number, maxTokens?: number, ceilingUsd?: number|null, callTimeoutMs?: number,
154
- * onCall?: (call: {label: string, costUsd: number|null, unpricedRounds: number, thinkingStatus?: string}) => void,
155
+ * onCall?: (call: {label: string, costUsd: number|null, unpricedRounds: number, thinkingStatus?: string, raw?: string}) => void,
155
156
  * createLoop?: (o: {system: string, policy: any, onLlmResult: any, provider: any, rates?: {in: number, out: number}}) => any,
156
157
  * rates?: {in: number, out: number}|null, callOptions?: Record<string, any>,
157
158
  * prove?: (source: string, phrase: string) => number}} o
@@ -181,6 +182,7 @@ export function runInputLook({ texts, inputs, jobLines, provider, rounds, maxTok
181
182
  costUsd: number | null;
182
183
  unpricedRounds: number;
183
184
  thinkingStatus?: string;
185
+ raw?: string;
184
186
  }) => void;
185
187
  createLoop?: (o: {
186
188
  system: string;
@@ -35,6 +35,18 @@ export function runBehaviour(events: Array<{
35
35
  repeats: number;
36
36
  repeatPct: number | null;
37
37
  };
38
+ /**
39
+ * How many write/edit attempts the gate DENIED (they fell outside the write scope), from gate-audit records alone. One write-class test (action `type`
40
+ * write|edit, as `workerWrites`' reader in src/planrun.js uses), deny-decision only: an allowed write is never counted. Pure.
41
+ * @param {Array<{action?: {type?: string}, decision?: string|null}>} events
42
+ * @returns {number}
43
+ */
44
+ export function writesBlocked(events: Array<{
45
+ action?: {
46
+ type?: string;
47
+ };
48
+ decision?: string | null;
49
+ }>): number;
38
50
  /**
39
51
  * Render a {@link runBehaviour} summary as the agreed printable block
40
52
  * (2–4 short lines). A zero-call run formats plainly ("0 tool calls") rather
@@ -0,0 +1,37 @@
1
+ /** @typedef {{key: string, rowKey: string, line: number, rule: number, source: 'look', ask: 'reading'|'cant-check'|'no-check'|'check', ruleText: string, question: string, counted: boolean, reading?: string, check?: Record<string, any>, pairRule?: number}} BlockAsk */
2
+ /**
3
+ * The questions the block has open, in the order the person meets them: the look's readings, then the look's can't-checks, then the pick path's asks (a proposal or a can't-check about a rule the pick path owns) in rule order (a proposal is not counted toward the 3-ask cap).
4
+ * A can't-check about a rule the PICK path owns (`scoped`: src/checkpick.js scopedRules, every `~` rule of a file job) is the pick path's own ask, `no-check`, in fwd's words (a "Line N, guardrail ...: I can't check this" ask
5
+ * whose answer the panel records as a pick, so Revise carries it: am17/am18/am21); any other can't-check is the look's own ask about a page.
6
+ * @param {import('./checkblock.js').CheckBlock} block @param {{line: number, rule: number}[]} [scoped] @returns {BlockAsk[]}
7
+ */
8
+ export function questionsOfBlock(block: import("./checkblock.js").CheckBlock, scoped?: {
9
+ line: number;
10
+ rule: number;
11
+ }[]): BlockAsk[];
12
+ /**
13
+ * The person's choices back into the block, one by one (the choice decides, never the words). A choice the block refuses is returned with its plain reason; the question stays open.
14
+ * @param {import('./checkblock.js').CheckBlock} block @param {{key: string, choice: string, text?: string}[]} choices @returns {{key: string, why: string}[]}
15
+ */
16
+ export function applyChoices(block: import("./checkblock.js").CheckBlock, choices: {
17
+ key: string;
18
+ choice: string;
19
+ text?: string;
20
+ }[]): {
21
+ key: string;
22
+ why: string;
23
+ }[];
24
+ export type BlockAsk = {
25
+ key: string;
26
+ rowKey: string;
27
+ line: number;
28
+ rule: number;
29
+ source: "look";
30
+ ask: "reading" | "cant-check" | "no-check" | "check";
31
+ ruleText: string;
32
+ question: string;
33
+ counted: boolean;
34
+ reading?: string;
35
+ check?: Record<string, any>;
36
+ pairRule?: number;
37
+ };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @param {any} card the card as submitted (`card.schedule` = {kind, hour?, minute?, day?} or absent / null / {kind: 'hand'})
3
+ * @param {{ flowType: 'plain'|'mcp'|'tickets', pick: {server: string, tools: string[]}|null, inputs: Array<{label: string, value: string}>, hasSchedule?: (job: string) => boolean }} o
4
+ * `hasSchedule(job)` = the job (by the card's name) already has a schedule file: the card does not overwrite it
5
+ * @returns {{ok: true, trigger: import('./trigger.js').Trigger|null} | {ok: false, error: string}}
6
+ */
7
+ export function cardScheduleOf(card: any, o: {
8
+ flowType: "plain" | "mcp" | "tickets";
9
+ pick: {
10
+ server: string;
11
+ tools: string[];
12
+ } | null;
13
+ inputs: Array<{
14
+ label: string;
15
+ value: string;
16
+ }>;
17
+ hasSchedule?: (job: string) => boolean;
18
+ }): {
19
+ ok: true;
20
+ trigger: import("./trigger.js").Trigger | null;
21
+ } | {
22
+ ok: false;
23
+ error: string;
24
+ };