@buoy-gg/agent-core 7.0.40 → 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.
- package/lib/commonjs/blocks/receipts.js +1 -761
- package/lib/commonjs/blocks/runId.js +1 -31
- package/lib/commonjs/blocks/types.js +1 -140
- package/lib/commonjs/blocks/uiTool.js +6 -1405
- package/lib/commonjs/catalog/catalog.g.js +5 -4207
- package/lib/commonjs/catalog/catalog.source.json +656 -12
- package/lib/commonjs/catalog/catalog.types.g.js +1 -44
- package/lib/commonjs/catalog/normalizeParams.js +2 -332
- package/lib/commonjs/catalog/signature.js +1 -68
- package/lib/commonjs/catalog/snapshotReads.js +1 -263
- package/lib/commonjs/catalog/toProviderTools.js +2 -145
- package/lib/commonjs/catalog/validateParams.js +1 -129
- package/lib/commonjs/context/buildContextPack.js +1 -489
- package/lib/commonjs/effects/digest.js +1 -34
- package/lib/commonjs/effects/ledger.js +1 -325
- package/lib/commonjs/engine/askGate.js +1 -287
- package/lib/commonjs/engine/effectFor.js +1 -176
- package/lib/commonjs/engine/evidence.js +3 -111
- package/lib/commonjs/engine/historyBudget.js +1 -363
- package/lib/commonjs/engine/retrieve.js +1 -214
- package/lib/commonjs/engine/runAgentTurn.js +8 -1803
- package/lib/commonjs/engine/systemPrompt.js +54 -163
- package/lib/commonjs/engine/textToolCalls.js +1 -276
- package/lib/commonjs/engine/tokenCalibration.js +1 -81
- package/lib/commonjs/engine/verify.js +4 -297
- package/lib/commonjs/index.js +1 -384
- package/lib/commonjs/policy/labels.js +1 -319
- package/lib/commonjs/policy/policy.js +1 -148
- package/lib/commonjs/policy/redact.js +1 -172
- package/lib/commonjs/providers/anthropic.js +3 -445
- package/lib/commonjs/providers/openai.js +4 -324
- package/lib/commonjs/providers/problem.js +1 -98
- package/lib/commonjs/providers/sse.js +1 -240
- package/lib/commonjs/providers/streamTimer.js +1 -123
- package/lib/commonjs/providers/transport.js +1 -123
- package/lib/commonjs/providers/types.js +1 -6
- package/lib/commonjs/providers/xhrStream.js +1 -212
- package/lib/commonjs/realNow.js +1 -0
- package/lib/commonjs/session.js +1 -393
- package/lib/commonjs/types.js +0 -1
- package/lib/module/blocks/receipts.js +1 -755
- package/lib/module/blocks/runId.js +1 -26
- package/lib/module/blocks/types.js +1 -134
- package/lib/module/blocks/uiTool.js +6 -1396
- package/lib/module/catalog/catalog.g.js +5 -4203
- package/lib/module/catalog/catalog.source.json +656 -12
- package/lib/module/catalog/catalog.types.g.js +1 -40
- package/lib/module/catalog/normalizeParams.js +2 -326
- package/lib/module/catalog/signature.js +1 -63
- package/lib/module/catalog/snapshotReads.js +1 -259
- package/lib/module/catalog/toProviderTools.js +2 -139
- package/lib/module/catalog/validateParams.js +1 -124
- package/lib/module/context/buildContextPack.js +1 -485
- package/lib/module/effects/digest.js +1 -29
- package/lib/module/effects/ledger.js +1 -319
- package/lib/module/engine/askGate.js +1 -280
- package/lib/module/engine/effectFor.js +1 -173
- package/lib/module/engine/evidence.js +3 -105
- package/lib/module/engine/historyBudget.js +1 -355
- package/lib/module/engine/retrieve.js +1 -210
- package/lib/module/engine/runAgentTurn.js +8 -1794
- package/lib/module/engine/systemPrompt.js +54 -157
- package/lib/module/engine/textToolCalls.js +1 -270
- package/lib/module/engine/tokenCalibration.js +1 -75
- package/lib/module/engine/verify.js +4 -289
- package/lib/module/index.js +1 -35
- package/lib/module/policy/labels.js +1 -312
- package/lib/module/policy/policy.js +1 -142
- package/lib/module/policy/redact.js +1 -165
- package/lib/module/providers/anthropic.js +3 -441
- package/lib/module/providers/openai.js +4 -320
- package/lib/module/providers/problem.js +1 -92
- package/lib/module/providers/sse.js +1 -231
- package/lib/module/providers/streamTimer.js +1 -118
- package/lib/module/providers/transport.js +1 -119
- package/lib/module/providers/types.js +1 -4
- package/lib/module/providers/xhrStream.js +1 -207
- package/lib/module/realNow.js +1 -0
- package/lib/module/session.js +1 -369
- package/lib/module/types.js +0 -1
- package/lib/typescript/catalog/catalog.g.d.ts +3 -3
- package/lib/typescript/catalog/catalog.types.g.d.ts +7 -4
- package/lib/typescript/effects/ledger.d.ts +16 -1
- package/lib/typescript/providers/problem.d.ts +0 -20
- package/lib/typescript/providers/streamTimer.d.ts +0 -24
- package/lib/typescript/realNow.d.ts +18 -0
- package/lib/web/index.mjs +152 -0
- package/package.json +24 -3
- package/lib/commonjs/blocks/receipts.js.map +0 -1
- package/lib/commonjs/blocks/runId.js.map +0 -1
- package/lib/commonjs/blocks/types.js.map +0 -1
- package/lib/commonjs/blocks/uiTool.js.map +0 -1
- package/lib/commonjs/catalog/catalog.g.js.map +0 -1
- package/lib/commonjs/catalog/catalog.types.g.js.map +0 -1
- package/lib/commonjs/catalog/normalizeParams.js.map +0 -1
- package/lib/commonjs/catalog/signature.js.map +0 -1
- package/lib/commonjs/catalog/snapshotReads.js.map +0 -1
- package/lib/commonjs/catalog/toProviderTools.js.map +0 -1
- package/lib/commonjs/catalog/validateParams.js.map +0 -1
- package/lib/commonjs/context/buildContextPack.js.map +0 -1
- package/lib/commonjs/effects/digest.js.map +0 -1
- package/lib/commonjs/effects/ledger.js.map +0 -1
- package/lib/commonjs/engine/askGate.js.map +0 -1
- package/lib/commonjs/engine/effectFor.js.map +0 -1
- package/lib/commonjs/engine/evidence.js.map +0 -1
- package/lib/commonjs/engine/historyBudget.js.map +0 -1
- package/lib/commonjs/engine/retrieve.js.map +0 -1
- package/lib/commonjs/engine/runAgentTurn.js.map +0 -1
- package/lib/commonjs/engine/systemPrompt.js.map +0 -1
- package/lib/commonjs/engine/textToolCalls.js.map +0 -1
- package/lib/commonjs/engine/tokenCalibration.js.map +0 -1
- package/lib/commonjs/engine/verify.js.map +0 -1
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/policy/labels.js.map +0 -1
- package/lib/commonjs/policy/policy.js.map +0 -1
- package/lib/commonjs/policy/redact.js.map +0 -1
- package/lib/commonjs/providers/anthropic.js.map +0 -1
- package/lib/commonjs/providers/openai.js.map +0 -1
- package/lib/commonjs/providers/problem.js.map +0 -1
- package/lib/commonjs/providers/sse.js.map +0 -1
- package/lib/commonjs/providers/streamTimer.js.map +0 -1
- package/lib/commonjs/providers/transport.js.map +0 -1
- package/lib/commonjs/providers/types.js.map +0 -1
- package/lib/commonjs/providers/xhrStream.js.map +0 -1
- package/lib/commonjs/session.js.map +0 -1
- package/lib/commonjs/types.js.map +0 -1
- package/lib/module/blocks/receipts.js.map +0 -1
- package/lib/module/blocks/runId.js.map +0 -1
- package/lib/module/blocks/types.js.map +0 -1
- package/lib/module/blocks/uiTool.js.map +0 -1
- package/lib/module/catalog/catalog.g.js.map +0 -1
- package/lib/module/catalog/catalog.types.g.js.map +0 -1
- package/lib/module/catalog/normalizeParams.js.map +0 -1
- package/lib/module/catalog/signature.js.map +0 -1
- package/lib/module/catalog/snapshotReads.js.map +0 -1
- package/lib/module/catalog/toProviderTools.js.map +0 -1
- package/lib/module/catalog/validateParams.js.map +0 -1
- package/lib/module/context/buildContextPack.js.map +0 -1
- package/lib/module/effects/digest.js.map +0 -1
- package/lib/module/effects/ledger.js.map +0 -1
- package/lib/module/engine/askGate.js.map +0 -1
- package/lib/module/engine/effectFor.js.map +0 -1
- package/lib/module/engine/evidence.js.map +0 -1
- package/lib/module/engine/historyBudget.js.map +0 -1
- package/lib/module/engine/retrieve.js.map +0 -1
- package/lib/module/engine/runAgentTurn.js.map +0 -1
- package/lib/module/engine/systemPrompt.js.map +0 -1
- package/lib/module/engine/textToolCalls.js.map +0 -1
- package/lib/module/engine/tokenCalibration.js.map +0 -1
- package/lib/module/engine/verify.js.map +0 -1
- package/lib/module/index.js.map +0 -1
- package/lib/module/policy/labels.js.map +0 -1
- package/lib/module/policy/policy.js.map +0 -1
- package/lib/module/policy/redact.js.map +0 -1
- package/lib/module/providers/anthropic.js.map +0 -1
- package/lib/module/providers/openai.js.map +0 -1
- package/lib/module/providers/problem.js.map +0 -1
- package/lib/module/providers/sse.js.map +0 -1
- package/lib/module/providers/streamTimer.js.map +0 -1
- package/lib/module/providers/transport.js.map +0 -1
- package/lib/module/providers/types.js.map +0 -1
- package/lib/module/providers/xhrStream.js.map +0 -1
- package/lib/module/session.js.map +0 -1
- package/lib/module/types.js.map +0 -1
- package/lib/typescript/blocks/receipts.d.ts.map +0 -1
- package/lib/typescript/blocks/runId.d.ts.map +0 -1
- package/lib/typescript/blocks/types.d.ts.map +0 -1
- package/lib/typescript/blocks/uiTool.d.ts.map +0 -1
- package/lib/typescript/catalog/catalog.g.d.ts.map +0 -1
- package/lib/typescript/catalog/catalog.types.g.d.ts.map +0 -1
- package/lib/typescript/catalog/normalizeParams.d.ts.map +0 -1
- package/lib/typescript/catalog/signature.d.ts.map +0 -1
- package/lib/typescript/catalog/snapshotReads.d.ts.map +0 -1
- package/lib/typescript/catalog/toProviderTools.d.ts.map +0 -1
- package/lib/typescript/catalog/validateParams.d.ts.map +0 -1
- package/lib/typescript/context/buildContextPack.d.ts.map +0 -1
- package/lib/typescript/effects/digest.d.ts.map +0 -1
- package/lib/typescript/effects/ledger.d.ts.map +0 -1
- package/lib/typescript/engine/askGate.d.ts.map +0 -1
- package/lib/typescript/engine/effectFor.d.ts.map +0 -1
- package/lib/typescript/engine/evidence.d.ts.map +0 -1
- package/lib/typescript/engine/historyBudget.d.ts.map +0 -1
- package/lib/typescript/engine/retrieve.d.ts.map +0 -1
- package/lib/typescript/engine/runAgentTurn.d.ts.map +0 -1
- package/lib/typescript/engine/systemPrompt.d.ts.map +0 -1
- package/lib/typescript/engine/textToolCalls.d.ts.map +0 -1
- package/lib/typescript/engine/tokenCalibration.d.ts.map +0 -1
- package/lib/typescript/engine/verify.d.ts.map +0 -1
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/policy/labels.d.ts.map +0 -1
- package/lib/typescript/policy/policy.d.ts.map +0 -1
- package/lib/typescript/policy/redact.d.ts.map +0 -1
- package/lib/typescript/providers/anthropic.d.ts.map +0 -1
- package/lib/typescript/providers/openai.d.ts.map +0 -1
- package/lib/typescript/providers/problem.d.ts.map +0 -1
- package/lib/typescript/providers/sse.d.ts.map +0 -1
- package/lib/typescript/providers/streamTimer.d.ts.map +0 -1
- package/lib/typescript/providers/transport.d.ts.map +0 -1
- package/lib/typescript/providers/types.d.ts.map +0 -1
- package/lib/typescript/providers/xhrStream.d.ts.map +0 -1
- package/lib/typescript/session.d.ts.map +0 -1
- 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};
|