@buoy-gg/agent-core 7.0.41 → 7.0.42

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 (201) hide show
  1. package/lib/commonjs/blocks/receipts.js +1 -761
  2. package/lib/commonjs/blocks/runId.js +1 -31
  3. package/lib/commonjs/blocks/types.js +1 -140
  4. package/lib/commonjs/blocks/uiTool.js +6 -1405
  5. package/lib/commonjs/catalog/catalog.g.js +5 -4556
  6. package/lib/commonjs/catalog/catalog.source.json +249 -0
  7. package/lib/commonjs/catalog/catalog.types.g.js +1 -46
  8. package/lib/commonjs/catalog/normalizeParams.js +2 -332
  9. package/lib/commonjs/catalog/signature.js +1 -68
  10. package/lib/commonjs/catalog/snapshotReads.js +1 -263
  11. package/lib/commonjs/catalog/toProviderTools.js +2 -145
  12. package/lib/commonjs/catalog/validateParams.js +1 -129
  13. package/lib/commonjs/context/buildContextPack.js +1 -489
  14. package/lib/commonjs/effects/digest.js +1 -34
  15. package/lib/commonjs/effects/ledger.js +1 -345
  16. package/lib/commonjs/engine/askGate.js +1 -287
  17. package/lib/commonjs/engine/effectFor.js +1 -223
  18. package/lib/commonjs/engine/evidence.js +3 -111
  19. package/lib/commonjs/engine/historyBudget.js +1 -363
  20. package/lib/commonjs/engine/retrieve.js +1 -214
  21. package/lib/commonjs/engine/runAgentTurn.js +8 -1836
  22. package/lib/commonjs/engine/systemPrompt.js +54 -163
  23. package/lib/commonjs/engine/textToolCalls.js +1 -276
  24. package/lib/commonjs/engine/tokenCalibration.js +1 -81
  25. package/lib/commonjs/engine/verify.js +4 -297
  26. package/lib/commonjs/index.js +1 -384
  27. package/lib/commonjs/policy/labels.js +1 -319
  28. package/lib/commonjs/policy/policy.js +1 -148
  29. package/lib/commonjs/policy/redact.js +1 -172
  30. package/lib/commonjs/providers/anthropic.js +3 -445
  31. package/lib/commonjs/providers/openai.js +4 -324
  32. package/lib/commonjs/providers/problem.js +1 -98
  33. package/lib/commonjs/providers/sse.js +1 -240
  34. package/lib/commonjs/providers/streamTimer.js +1 -123
  35. package/lib/commonjs/providers/transport.js +1 -123
  36. package/lib/commonjs/providers/types.js +1 -6
  37. package/lib/commonjs/providers/xhrStream.js +1 -212
  38. package/lib/commonjs/realNow.js +1 -0
  39. package/lib/commonjs/session.js +1 -393
  40. package/lib/commonjs/types.js +0 -1
  41. package/lib/module/blocks/receipts.js +1 -755
  42. package/lib/module/blocks/runId.js +1 -26
  43. package/lib/module/blocks/types.js +1 -134
  44. package/lib/module/blocks/uiTool.js +6 -1396
  45. package/lib/module/catalog/catalog.g.js +5 -4552
  46. package/lib/module/catalog/catalog.source.json +249 -0
  47. package/lib/module/catalog/catalog.types.g.js +1 -42
  48. package/lib/module/catalog/normalizeParams.js +2 -326
  49. package/lib/module/catalog/signature.js +1 -63
  50. package/lib/module/catalog/snapshotReads.js +1 -259
  51. package/lib/module/catalog/toProviderTools.js +2 -139
  52. package/lib/module/catalog/validateParams.js +1 -124
  53. package/lib/module/context/buildContextPack.js +1 -485
  54. package/lib/module/effects/digest.js +1 -29
  55. package/lib/module/effects/ledger.js +1 -339
  56. package/lib/module/engine/askGate.js +1 -280
  57. package/lib/module/engine/effectFor.js +1 -220
  58. package/lib/module/engine/evidence.js +3 -105
  59. package/lib/module/engine/historyBudget.js +1 -355
  60. package/lib/module/engine/retrieve.js +1 -210
  61. package/lib/module/engine/runAgentTurn.js +8 -1827
  62. package/lib/module/engine/systemPrompt.js +54 -157
  63. package/lib/module/engine/textToolCalls.js +1 -270
  64. package/lib/module/engine/tokenCalibration.js +1 -75
  65. package/lib/module/engine/verify.js +4 -289
  66. package/lib/module/index.js +1 -35
  67. package/lib/module/policy/labels.js +1 -312
  68. package/lib/module/policy/policy.js +1 -142
  69. package/lib/module/policy/redact.js +1 -165
  70. package/lib/module/providers/anthropic.js +3 -441
  71. package/lib/module/providers/openai.js +4 -320
  72. package/lib/module/providers/problem.js +1 -92
  73. package/lib/module/providers/sse.js +1 -231
  74. package/lib/module/providers/streamTimer.js +1 -118
  75. package/lib/module/providers/transport.js +1 -119
  76. package/lib/module/providers/types.js +1 -4
  77. package/lib/module/providers/xhrStream.js +1 -207
  78. package/lib/module/realNow.js +1 -0
  79. package/lib/module/session.js +1 -369
  80. package/lib/module/types.js +0 -1
  81. package/lib/typescript/catalog/catalog.g.d.ts +3 -3
  82. package/lib/typescript/catalog/catalog.types.g.d.ts +3 -2
  83. package/lib/typescript/providers/problem.d.ts +0 -20
  84. package/lib/typescript/providers/streamTimer.d.ts +0 -24
  85. package/lib/typescript/realNow.d.ts +18 -0
  86. package/lib/web/index.mjs +52 -53
  87. package/package.json +1 -1
  88. package/lib/commonjs/blocks/receipts.js.map +0 -1
  89. package/lib/commonjs/blocks/runId.js.map +0 -1
  90. package/lib/commonjs/blocks/types.js.map +0 -1
  91. package/lib/commonjs/blocks/uiTool.js.map +0 -1
  92. package/lib/commonjs/catalog/catalog.g.js.map +0 -1
  93. package/lib/commonjs/catalog/catalog.types.g.js.map +0 -1
  94. package/lib/commonjs/catalog/normalizeParams.js.map +0 -1
  95. package/lib/commonjs/catalog/signature.js.map +0 -1
  96. package/lib/commonjs/catalog/snapshotReads.js.map +0 -1
  97. package/lib/commonjs/catalog/toProviderTools.js.map +0 -1
  98. package/lib/commonjs/catalog/validateParams.js.map +0 -1
  99. package/lib/commonjs/context/buildContextPack.js.map +0 -1
  100. package/lib/commonjs/effects/digest.js.map +0 -1
  101. package/lib/commonjs/effects/ledger.js.map +0 -1
  102. package/lib/commonjs/engine/askGate.js.map +0 -1
  103. package/lib/commonjs/engine/effectFor.js.map +0 -1
  104. package/lib/commonjs/engine/evidence.js.map +0 -1
  105. package/lib/commonjs/engine/historyBudget.js.map +0 -1
  106. package/lib/commonjs/engine/retrieve.js.map +0 -1
  107. package/lib/commonjs/engine/runAgentTurn.js.map +0 -1
  108. package/lib/commonjs/engine/systemPrompt.js.map +0 -1
  109. package/lib/commonjs/engine/textToolCalls.js.map +0 -1
  110. package/lib/commonjs/engine/tokenCalibration.js.map +0 -1
  111. package/lib/commonjs/engine/verify.js.map +0 -1
  112. package/lib/commonjs/index.js.map +0 -1
  113. package/lib/commonjs/policy/labels.js.map +0 -1
  114. package/lib/commonjs/policy/policy.js.map +0 -1
  115. package/lib/commonjs/policy/redact.js.map +0 -1
  116. package/lib/commonjs/providers/anthropic.js.map +0 -1
  117. package/lib/commonjs/providers/openai.js.map +0 -1
  118. package/lib/commonjs/providers/problem.js.map +0 -1
  119. package/lib/commonjs/providers/sse.js.map +0 -1
  120. package/lib/commonjs/providers/streamTimer.js.map +0 -1
  121. package/lib/commonjs/providers/transport.js.map +0 -1
  122. package/lib/commonjs/providers/types.js.map +0 -1
  123. package/lib/commonjs/providers/xhrStream.js.map +0 -1
  124. package/lib/commonjs/session.js.map +0 -1
  125. package/lib/commonjs/types.js.map +0 -1
  126. package/lib/module/blocks/receipts.js.map +0 -1
  127. package/lib/module/blocks/runId.js.map +0 -1
  128. package/lib/module/blocks/types.js.map +0 -1
  129. package/lib/module/blocks/uiTool.js.map +0 -1
  130. package/lib/module/catalog/catalog.g.js.map +0 -1
  131. package/lib/module/catalog/catalog.types.g.js.map +0 -1
  132. package/lib/module/catalog/normalizeParams.js.map +0 -1
  133. package/lib/module/catalog/signature.js.map +0 -1
  134. package/lib/module/catalog/snapshotReads.js.map +0 -1
  135. package/lib/module/catalog/toProviderTools.js.map +0 -1
  136. package/lib/module/catalog/validateParams.js.map +0 -1
  137. package/lib/module/context/buildContextPack.js.map +0 -1
  138. package/lib/module/effects/digest.js.map +0 -1
  139. package/lib/module/effects/ledger.js.map +0 -1
  140. package/lib/module/engine/askGate.js.map +0 -1
  141. package/lib/module/engine/effectFor.js.map +0 -1
  142. package/lib/module/engine/evidence.js.map +0 -1
  143. package/lib/module/engine/historyBudget.js.map +0 -1
  144. package/lib/module/engine/retrieve.js.map +0 -1
  145. package/lib/module/engine/runAgentTurn.js.map +0 -1
  146. package/lib/module/engine/systemPrompt.js.map +0 -1
  147. package/lib/module/engine/textToolCalls.js.map +0 -1
  148. package/lib/module/engine/tokenCalibration.js.map +0 -1
  149. package/lib/module/engine/verify.js.map +0 -1
  150. package/lib/module/index.js.map +0 -1
  151. package/lib/module/policy/labels.js.map +0 -1
  152. package/lib/module/policy/policy.js.map +0 -1
  153. package/lib/module/policy/redact.js.map +0 -1
  154. package/lib/module/providers/anthropic.js.map +0 -1
  155. package/lib/module/providers/openai.js.map +0 -1
  156. package/lib/module/providers/problem.js.map +0 -1
  157. package/lib/module/providers/sse.js.map +0 -1
  158. package/lib/module/providers/streamTimer.js.map +0 -1
  159. package/lib/module/providers/transport.js.map +0 -1
  160. package/lib/module/providers/types.js.map +0 -1
  161. package/lib/module/providers/xhrStream.js.map +0 -1
  162. package/lib/module/session.js.map +0 -1
  163. package/lib/module/types.js.map +0 -1
  164. package/lib/typescript/blocks/receipts.d.ts.map +0 -1
  165. package/lib/typescript/blocks/runId.d.ts.map +0 -1
  166. package/lib/typescript/blocks/types.d.ts.map +0 -1
  167. package/lib/typescript/blocks/uiTool.d.ts.map +0 -1
  168. package/lib/typescript/catalog/catalog.g.d.ts.map +0 -1
  169. package/lib/typescript/catalog/catalog.types.g.d.ts.map +0 -1
  170. package/lib/typescript/catalog/normalizeParams.d.ts.map +0 -1
  171. package/lib/typescript/catalog/signature.d.ts.map +0 -1
  172. package/lib/typescript/catalog/snapshotReads.d.ts.map +0 -1
  173. package/lib/typescript/catalog/toProviderTools.d.ts.map +0 -1
  174. package/lib/typescript/catalog/validateParams.d.ts.map +0 -1
  175. package/lib/typescript/context/buildContextPack.d.ts.map +0 -1
  176. package/lib/typescript/effects/digest.d.ts.map +0 -1
  177. package/lib/typescript/effects/ledger.d.ts.map +0 -1
  178. package/lib/typescript/engine/askGate.d.ts.map +0 -1
  179. package/lib/typescript/engine/effectFor.d.ts.map +0 -1
  180. package/lib/typescript/engine/evidence.d.ts.map +0 -1
  181. package/lib/typescript/engine/historyBudget.d.ts.map +0 -1
  182. package/lib/typescript/engine/retrieve.d.ts.map +0 -1
  183. package/lib/typescript/engine/runAgentTurn.d.ts.map +0 -1
  184. package/lib/typescript/engine/systemPrompt.d.ts.map +0 -1
  185. package/lib/typescript/engine/textToolCalls.d.ts.map +0 -1
  186. package/lib/typescript/engine/tokenCalibration.d.ts.map +0 -1
  187. package/lib/typescript/engine/verify.d.ts.map +0 -1
  188. package/lib/typescript/index.d.ts.map +0 -1
  189. package/lib/typescript/policy/labels.d.ts.map +0 -1
  190. package/lib/typescript/policy/policy.d.ts.map +0 -1
  191. package/lib/typescript/policy/redact.d.ts.map +0 -1
  192. package/lib/typescript/providers/anthropic.d.ts.map +0 -1
  193. package/lib/typescript/providers/openai.d.ts.map +0 -1
  194. package/lib/typescript/providers/problem.d.ts.map +0 -1
  195. package/lib/typescript/providers/sse.d.ts.map +0 -1
  196. package/lib/typescript/providers/streamTimer.d.ts.map +0 -1
  197. package/lib/typescript/providers/transport.d.ts.map +0 -1
  198. package/lib/typescript/providers/types.d.ts.map +0 -1
  199. package/lib/typescript/providers/xhrStream.d.ts.map +0 -1
  200. package/lib/typescript/session.d.ts.map +0 -1
  201. package/lib/typescript/types.d.ts.map +0 -1
@@ -1,26 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * A token unique to this launch of the app, stamped into every generated id.
5
- *
6
- * Every id counter here restarts at 1 when the process does, which was
7
- * harmless for as long as nothing outlived a reload. Ask Buoy's transcript now
8
- * does: a restored conversation comes back carrying `rc1`, `ui1` and `m1`, the
9
- * next turn generates `rc1` again, and React sees two children with the same
10
- * key — it renders one of them twice and drops the other. That is both halves
11
- * of the report this fixes: the "two children with the same key `rc1`" warning,
12
- * and the bag card appearing twice after a reload.
13
- *
14
- * Seeding the counters from the restored data instead would not work. A saved
15
- * transcript is trimmed from the oldest end and its ids are not contiguous, so
16
- * the highest id present is not the highest id ever issued — and blocks that
17
- * were dropped by the cap would hand their ids straight back out.
18
- */
19
- export const RUN_ID = Math.random().toString(36).slice(2, 8);
20
-
21
- /** `<prefix><run>-<n>`: unique within a run by the counter, across runs by the token. */
22
- export function idFactory(prefix) {
23
- let n = 0;
24
- return () => `${prefix}${RUN_ID}-${++n}`;
25
- }
26
- //# sourceMappingURL=runId.js.map
1
+ "use strict";export const RUN_ID=Math.random().toString(36).slice(2,8);export function idFactory(t){let r=0;return()=>`${t}${RUN_ID}-${++r}`}
@@ -1,134 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * Blocks — the closed catalog of things a transcript can render besides prose.
5
- *
6
- * Two producers, one schema. RECEIPTS are built by the engine from tool results
7
- * (see ./receipts.ts) and can't hallucinate. MODEL BLOCKS are authored through
8
- * the single `buoy_ui` tool (see ./uiTool.ts), validated before they reach a
9
- * renderer. A renderer never knows or cares which it got.
10
- *
11
- * Declarative data only — never HTML, never code. This is the shape A2UI and
12
- * MCP Apps both landed on, and the only one that works inside a phone sheet.
13
- * See ASK_BUOY_RICH_UI_PLAN.md §3–§6.
14
- */
15
-
16
- /** Where a fact block's data came from. Quiet when `live`, loud otherwise. */
17
-
18
- /**
19
- * A button. Exactly one of `dispatch` / `send` / `openTool` / `minimize`.
20
- * `dispatch` runs a Buoy action through the same policy + ledger a model call
21
- * would; `send` becomes the next user message; `openTool` opens another Buoy
22
- * tool; `minimize` collapses the sheet so the user can look at the app.
23
- */
24
-
25
- /** A small named icon a renderer may draw: network · storage · route · screen · user · image · check · warn · info · store · query. */
26
-
27
- // --- Ask: the user has to decide. These END the turn. -----------------------
28
-
29
- // --- Show: data the user should see rather than read. -----------------------
30
-
31
- // --- Receipts: engine-only kinds (never offered to the model). --------------
32
-
33
- /** Not a card — a chip after the agent moved the app: "Opened /shop · Look". */
34
-
35
- // --- Second wave (survey gaps, 2026-09-02). See plan §11. -------------------
36
-
37
- /** Follow-up chips under an answer. Tap = send. */
38
-
39
- /** Pick several. Ends the turn. */
40
-
41
- /** Pick one from a LONG list (routes, stores) — searchable. Ends the turn. */
42
-
43
- /** Several coupled fields, one submit. Ends the turn. */
44
-
45
- /** Confirm, but with the proposed values editable first. Ends the turn. */
46
-
47
- /** A sentence with evidence chips, and a Verify button that re-reads. */
48
-
49
- /** Two columns, differences highlighted. */
50
-
51
- /** A picture of the app's screen, captured on device. */
52
-
53
- /** Steps with live progress and a Go/Stop. */
54
-
55
- /** A long-running thing the user can watch: perf automation, a scenario run. */
56
-
57
- /** Sticky "you are looking at fake data" strip. */
58
-
59
- /** Attach a screenshot or file from the tester. */
60
-
61
- /** Kinds that stop the turn and wait for the user. */
62
- export const ASK_KINDS = new Set(["choice", "confirm", "input", "multiSelect", "select", "slider", "dateTime", "form", "proposal", "upload"]);
63
-
64
- /**
65
- * Kinds the model may author through `buoy_ui`. Receipts are engine-only.
66
- *
67
- * NINETEEN, down from twenty-seven. The first cut took it to eleven on bench
68
- * evidence alone — sixteen kinds were never authored once across five runs and
69
- * three agents. Rendering them side by side against their replacements showed
70
- * that argument was too blunt: a kind nobody reached for is not the same as a
71
- * kind nobody needs, and for eight of them the replacement was plainly worse.
72
- * Restored on that review: code (a JSON explorer beats a fenced string),
73
- * compare, details, multiSelect, plan, proposal, select, steps.
74
- *
75
- * The eight that stayed retired each have an equal or better answer among
76
- * these: keyValue -> table, card / cardCarousel -> list, claim -> finding,
77
- * sparkline -> chart, slider / dateTime -> input or choice, form -> input.
78
- *
79
- * `diff` and `compare` both stay and are NOT duplicates: diff is what CHANGED
80
- * (the engine projects one after every state write, see blocks/receipts.ts),
81
- * compare is two different things side by side.
82
- *
83
- * Nothing was ever deleted — every renderer, schema and normaliser lives in
84
- * UI_PARAMS / SHAPE_FIXES, so this list alone decides what is offered.
85
- */
86
- export const MODEL_KINDS = ["choice", "confirm", "input", "select", "multiSelect", "table", "list", "diff", "compare", "imageGrid", "chart", "code", "details", "steps", "plan", "proposal", "actions", "finding", "suggestions"];
87
- export function isAskBlock(block) {
88
- return ASK_KINDS.has(block.kind);
89
- }
90
-
91
- /** What the user did with an Ask block. Becomes the next user message. */
92
-
93
- /** The text the model receives for an answer — plain words, never JSON. */
94
- export function answerToText(answer) {
95
- switch (answer.kind) {
96
- case "choice":
97
- return `${answer.label}`;
98
- case "confirm":
99
- return answer.approved ? "Yes, go ahead." : "No, don't.";
100
- case "input":
101
- return answer.value;
102
- case "multi":
103
- return answer.labels.length ? answer.labels.join(", ") : "None of them";
104
- case "select":
105
- return answer.label;
106
- case "slider":
107
- return `${answer.value}${answer.unit ? ` ${answer.unit}` : ""}`;
108
- case "dateTime":
109
- return answer.label ?? answer.value;
110
- case "form":
111
- return Object.entries(answer.values).map(([k, v]) => `${k}: ${typeof v === "string" ? v : JSON.stringify(v)}`).join(", ");
112
- case "proposal":
113
- return answer.approved ? `Yes, go ahead${answer.values ? ` with ${Object.entries(answer.values).map(([k, v]) => `${k} = ${String(v)}`).join(", ")}` : ""}.` : "No, don't.";
114
- case "upload":
115
- return `(attached ${answer.name})`;
116
- case "skipped":
117
- return "(skipped that question)";
118
- }
119
- }
120
-
121
- /** Hard caps — the engine truncates and records `total` so "+N more" is honest. */
122
- export const CAPS = {
123
- listItems: 5,
124
- listExpanded: 25,
125
- gridImages: 6,
126
- gridMax: 24,
127
- tableRows: 8,
128
- chips: 8,
129
- chartBars: 8,
130
- keyValuePairs: 12,
131
- choiceOptions: 5,
132
- actions: 2
133
- };
134
- //# sourceMappingURL=types.js.map
1
+ "use strict";export const ASK_KINDS=new Set(["choice","confirm","input","multiSelect","select","slider","dateTime","form","proposal","upload"]);export const MODEL_KINDS=["choice","confirm","input","select","multiSelect","table","list","diff","compare","imageGrid","chart","code","details","steps","plan","proposal","actions","finding","suggestions"];export function isAskBlock(e){return ASK_KINDS.has(e.kind)}export function answerToText(e){switch(e.kind){case"choice":return`${e.label}`;case"confirm":return e.approved?"Yes, go ahead.":"No, don't.";case"input":return e.value;case"multi":return e.labels.length?e.labels.join(", "):"None of them";case"select":return e.label;case"slider":return`${e.value}${e.unit?` ${e.unit}`:""}`;case"dateTime":return e.label??e.value;case"form":return Object.entries(e.values).map(([i,t])=>`${i}: ${typeof t==="string"?t:JSON.stringify(t)}`).join(", ");case"proposal":return e.approved?`Yes, go ahead${e.values?` with ${Object.entries(e.values).map(([i,t])=>`${i} = ${String(t)}`).join(", ")}`:""}.`:"No, don't.";case"upload":return`(attached ${e.name})`;case"skipped":return"(skipped that question)"}}export const CAPS={listItems:5,listExpanded:25,gridImages:6,gridMax:24,tableRows:8,chips:8,chartBars:8,keyValuePairs:12,choiceOptions:5,actions:2};