@buoy-gg/agent-core 7.0.62 → 7.0.64

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 (70) hide show
  1. package/lib/commonjs/blocks/receipts.js +1 -1
  2. package/lib/commonjs/catalog/catalog.g.js +2 -2
  3. package/lib/commonjs/catalog/catalog.source.json +85 -1
  4. package/lib/commonjs/catalog/catalog.types.g.js +1 -1
  5. package/lib/commonjs/catalog/snapshotReads.js +1 -1
  6. package/lib/commonjs/context/buildContextPack.js +1 -1
  7. package/lib/commonjs/engine/emptyTap.test.js +1 -0
  8. package/lib/commonjs/engine/historyBudget.js +1 -1
  9. package/lib/commonjs/engine/idGrounding.js +2 -0
  10. package/lib/commonjs/engine/planOnlyStop.js +1 -1
  11. package/lib/commonjs/engine/runAgentTurn.js +9 -8
  12. package/lib/commonjs/engine/stepBudget.test.js +1 -0
  13. package/lib/commonjs/engine/systemPrompt.js +5 -2
  14. package/lib/commonjs/engine/verify.js +2 -2
  15. package/lib/commonjs/feeds/claude.js +23 -0
  16. package/lib/commonjs/feeds/gpt.js +5 -0
  17. package/lib/commonjs/feeds/index.js +1 -0
  18. package/lib/commonjs/policy/policy.js +1 -1
  19. package/lib/commonjs/policy/redact.js +1 -1
  20. package/lib/commonjs/policy/turnScope.js +1 -0
  21. package/lib/commonjs/providers/anthropic.js +1 -5
  22. package/lib/commonjs/providers/openai.js +1 -5
  23. package/lib/commonjs/providers/types.js +1 -1
  24. package/lib/commonjs/session.js +1 -1
  25. package/lib/module/blocks/receipts.js +1 -1
  26. package/lib/module/catalog/catalog.g.js +2 -2
  27. package/lib/module/catalog/catalog.source.json +85 -1
  28. package/lib/module/catalog/catalog.types.g.js +1 -1
  29. package/lib/module/catalog/snapshotReads.js +1 -1
  30. package/lib/module/context/buildContextPack.js +1 -1
  31. package/lib/module/engine/emptyTap.test.js +1 -0
  32. package/lib/module/engine/historyBudget.js +1 -1
  33. package/lib/module/engine/idGrounding.js +2 -0
  34. package/lib/module/engine/planOnlyStop.js +1 -1
  35. package/lib/module/engine/runAgentTurn.js +9 -8
  36. package/lib/module/engine/stepBudget.test.js +1 -0
  37. package/lib/module/engine/systemPrompt.js +5 -2
  38. package/lib/module/engine/verify.js +2 -2
  39. package/lib/module/feeds/claude.js +23 -0
  40. package/lib/module/feeds/gpt.js +5 -0
  41. package/lib/module/feeds/index.js +1 -0
  42. package/lib/module/policy/policy.js +1 -1
  43. package/lib/module/policy/redact.js +1 -1
  44. package/lib/module/policy/turnScope.js +1 -0
  45. package/lib/module/providers/anthropic.js +1 -5
  46. package/lib/module/providers/openai.js +1 -5
  47. package/lib/module/providers/types.js +1 -1
  48. package/lib/module/session.js +1 -1
  49. package/lib/typescript/catalog/catalog.g.d.ts +3 -3
  50. package/lib/typescript/catalog/catalog.types.g.d.ts +4 -3
  51. package/lib/typescript/engine/emptyTap.test.d.ts +2 -0
  52. package/lib/typescript/engine/historyBudget.d.ts +1 -1
  53. package/lib/typescript/engine/idGrounding.d.ts +8 -0
  54. package/lib/typescript/engine/planOnlyStop.d.ts +2 -2
  55. package/lib/typescript/engine/runAgentTurn.d.ts +2 -0
  56. package/lib/typescript/engine/stepBudget.test.d.ts +2 -0
  57. package/lib/typescript/engine/systemPrompt.d.ts +1 -1
  58. package/lib/typescript/engine/verify.d.ts +2 -1
  59. package/lib/typescript/feeds/claude.d.ts +67 -0
  60. package/lib/typescript/feeds/gpt.d.ts +41 -0
  61. package/lib/typescript/feeds/index.d.ts +27 -0
  62. package/lib/typescript/index.d.ts +1 -1
  63. package/lib/typescript/policy/policy.d.ts +8 -3
  64. package/lib/typescript/policy/redact.d.ts +1 -0
  65. package/lib/typescript/policy/turnScope.d.ts +13 -0
  66. package/lib/typescript/providers/anthropic.d.ts +4 -0
  67. package/lib/typescript/providers/openai.d.ts +29 -0
  68. package/lib/typescript/providers/types.d.ts +32 -1
  69. package/lib/web/index.mjs +77 -38
  70. package/package.json +1 -1
@@ -14,6 +14,7 @@
14
14
  * returned — out of `network.getRequests`. That is a credential leak and a
15
15
  * prompt-injection channel in one call.
16
16
  */
17
+ export declare function isSecretKey(key: string, scope?: "tool" | "route"): boolean;
17
18
  /**
18
19
  * Deep-redact by key name AND by value shape. Depth-limited because tool
19
20
  * results can be deeply nested state trees and a runaway walk on a megabyte
@@ -0,0 +1,13 @@
1
+ export type TurnScope = "question" | "task";
2
+ export declare function classifyTurn(text: string): TurnScope;
3
+ export declare const QUESTION_DECLINED = "The user asked a question; this change was not made. Answer from what you can read.";
4
+ export interface TapTarget {
5
+ label?: string;
6
+ text?: string;
7
+ name?: string;
8
+ role?: string;
9
+ via?: string;
10
+ }
11
+ export declare function isQuestionLookup(toolId: string, action: string, params: Record<string, unknown>, targets?: TapTarget[]): boolean;
12
+ export declare function tapLabels(screen: unknown, params: Record<string, unknown>): TapTarget[];
13
+ //# sourceMappingURL=turnScope.d.ts.map
@@ -21,6 +21,10 @@
21
21
  * turn it came from whenever that turn's tool results are sent back. An
22
22
  * adapter that keeps only text and tool_use 400s on the second request of
23
23
  * every tool-using turn — which is every turn Ask Buoy actually makes.
24
+ * Only the CURRENT turn's thinking is replayed. A block is bound to the
25
+ * system prompt it was made with, and the "right now" block at the end of
26
+ * `system` changes every user turn, so an older turn's thinking 400s with
27
+ * "The `system` prompt differs" on the user's second message.
24
28
  */
25
29
  import type { Provider, ProviderConfig } from "./types";
26
30
  export declare function createAnthropicProvider(config: ProviderConfig): Provider;
@@ -1,3 +1,32 @@
1
+ /**
2
+ * OpenAI chat-completions protocol.
3
+ *
4
+ * The differences from Anthropic that actually matter to the code:
5
+ * - Tool results are their own `{role:"tool", tool_call_id, content}` MESSAGE,
6
+ * not blocks inside a user message.
7
+ * - Tool arguments arrive as a JSON STRING, streamed in fragments, and are
8
+ * keyed by an `index` that is stable across deltas while `id`/`name` only
9
+ * appear on the first fragment.
10
+ * - The stream DOES have a `data: [DONE]` sentinel, unlike Anthropic's.
11
+ *
12
+ * This adapter also serves Azure and any OpenAI-compatible org gateway, which
13
+ * is the common shape for an internal LLM proxy. Note Anthropic's own
14
+ * OpenAI-compatibility endpoint is explicitly not production-ready and silently
15
+ * ignores several fields — use the native Anthropic adapter for Anthropic.
16
+ *
17
+ * THE 1024-CHAR TRAP. Azure caps a function description at 1024 chars, so
18
+ * this adapter trims to fit. The catalog renders a tool's summary FIRST and
19
+ * its `Actions:` list LAST, and every tool's full description is longer than
20
+ * the cap — so trimming `t.description` silently removed every action line
21
+ * for 23 of the 24 tools — the 24th kept one line of sixteen — measured
22
+ * against the catalog as it is. A model on this protocol (api.openai.com, Azure,
23
+ * OpenRouter, fal — every row of the model-floor sweep) saw a summary cut
24
+ * mid-sentence and a bare `action` enum: no per-action summary, no
25
+ * [DESTRUCTIVE] / [changes state] tag, no "prefer X over Y" guidance, and a
26
+ * catalog wording change could not move its score. So the description is
27
+ * the SUMMARY only, and the `Actions:` block goes into
28
+ * `parameters.properties.action.description`, which nothing caps.
29
+ */
1
30
  import type { Provider, ProviderConfig } from "./types";
2
31
  export declare function createOpenAIProvider(config: ProviderConfig): Provider;
3
32
  //# sourceMappingURL=openai.d.ts.map
@@ -53,6 +53,15 @@ export type ThinkingBlock = {
53
53
  export type AgentMessage = {
54
54
  role: "user";
55
55
  text: string;
56
+ /** Claude user turns have an ID; engine notes keep the current turn. */
57
+ turnId?: string;
58
+ source?: "engine";
59
+ systemNotice?: boolean;
60
+ /** Captured once, then kept with this real user turn. */
61
+ liveBlock?: {
62
+ placement: "append" | "system-msg";
63
+ text: string;
64
+ };
56
65
  } | {
57
66
  role: "assistant";
58
67
  text: string;
@@ -79,7 +88,7 @@ export type StreamOutcome =
79
88
  * The text it managed is real; any tool calls in it are half a thought and
80
89
  * are NOT executed.
81
90
  */
82
- | "output-limited";
91
+ | "output-limited" | "refused" | "context-limited";
83
92
  /**
84
93
  * Why a stream failed. `provider` is the model or gateway saying so; the other
85
94
  * two are this side deciding the response cannot be trusted.
@@ -177,12 +186,33 @@ export interface ProviderRequest {
177
186
  */
178
187
  systemVolatile?: string;
179
188
  tools: ProviderTool[];
189
+ toolChoice?: "auto" | "none";
180
190
  model: string;
181
191
  maxTokens: number;
182
192
  signal?: AbortSignal;
183
193
  meta?: RequestMeta;
184
194
  }
195
+ export interface FeedOptions {
196
+ liveBlock?: "system-tail" | "append" | "system-msg";
197
+ freezeHistory?: boolean;
198
+ notices?: "today" | "system-msg";
199
+ cacheLayout?: "today" | "tools-bp";
200
+ maxTokens?: number;
201
+ effort?: "low" | "medium" | "high";
202
+ thinking?: "adaptive" | "disabled";
203
+ parallelHint?: boolean;
204
+ promptStyle?: "shared" | "calm";
205
+ earlyStopHint?: boolean;
206
+ stateOwnerHint?: boolean;
207
+ screenProofHint?: boolean;
208
+ freshProofHint?: boolean;
209
+ actionScopeHint?: boolean;
210
+ keepStateRule?: boolean;
211
+ thinkingDisplay?: "summarized";
212
+ }
213
+ export declare function isRealUserMessage(m: AgentMessage): boolean;
185
214
  export interface ProviderConfig {
215
+ feedOptions?: FeedOptions;
186
216
  /** The org's gateway, or the provider's own URL for the dev-only direct mode. */
187
217
  endpoint: string;
188
218
  /**
@@ -246,6 +276,7 @@ export interface ProviderConfig {
246
276
  * doesn't model. The escape hatch that keeps one config type honest across
247
277
  * every OpenAI-compatible gateway; core fields (model, messages, tools,
248
278
  * stream) win only if you don't override them, so use with care.
279
+ * Claude protects feed fields and drops OpenAI-only fields.
249
280
  */
250
281
  requestOverrides?: Record<string, unknown>;
251
282
  /**