@genesislcap/ai-assistant 15.24.2 → 15.25.1
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/dist/ai-assistant.api.json +1065 -33
- package/dist/ai-assistant.d.ts +288 -102
- package/dist/chat-driver.cjs +630 -378
- package/dist/chat-driver.cjs.map +4 -4
- package/dist/chat-driver.mjs +630 -378
- package/dist/chat-driver.mjs.map +4 -4
- package/dist/custom-elements.json +1198 -388
- package/dist/dts/components/agent-session/agent-session.d.ts +134 -0
- package/dist/dts/components/agent-session/agent-session.d.ts.map +1 -0
- package/dist/dts/components/agent-session/index.d.ts +2 -0
- package/dist/dts/components/agent-session/index.d.ts.map +1 -0
- package/dist/dts/components/ai-driver/ai-driver.d.ts +31 -4
- package/dist/dts/components/ai-driver/ai-driver.d.ts.map +1 -1
- package/dist/dts/components/chat-driver/chat-driver.constants.d.ts +52 -0
- package/dist/dts/components/chat-driver/chat-driver.constants.d.ts.map +1 -0
- package/dist/dts/components/chat-driver/chat-driver.d.ts +100 -82
- package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
- package/dist/dts/components/chat-driver/fold-controller.d.ts +82 -0
- package/dist/dts/components/chat-driver/fold-controller.d.ts.map +1 -0
- package/dist/dts/components/chat-driver/turn-failures.d.ts +20 -1
- package/dist/dts/components/chat-driver/turn-failures.d.ts.map +1 -1
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts +14 -24
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts.map +1 -1
- package/dist/dts/index.d.ts +1 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/main/main.d.ts +6 -16
- package/dist/dts/main/main.d.ts.map +1 -1
- package/dist/dts/suggestions/generate-suggestions.d.ts +35 -0
- package/dist/dts/suggestions/generate-suggestions.d.ts.map +1 -0
- package/dist/dts/utils/agents-key.d.ts +10 -0
- package/dist/dts/utils/agents-key.d.ts.map +1 -0
- package/dist/dts/utils/resolve-turn-input.d.ts +9 -0
- package/dist/dts/utils/resolve-turn-input.d.ts.map +1 -0
- package/dist/esm/components/agent-session/agent-session.js +208 -0
- package/dist/esm/components/agent-session/index.js +1 -0
- package/dist/esm/components/chat-driver/chat-driver.constants.js +72 -0
- package/dist/esm/components/chat-driver/chat-driver.js +190 -395
- package/dist/esm/components/chat-driver/fold-controller.js +184 -0
- package/dist/esm/components/chat-driver/turn-failures.js +14 -0
- package/dist/esm/components/orchestrating-driver/orchestrating-driver.js +48 -131
- package/dist/esm/index.js +1 -0
- package/dist/esm/main/main.js +11 -38
- package/dist/esm/suggestions/generate-suggestions.js +123 -0
- package/dist/esm/utils/agents-key.js +24 -0
- package/dist/esm/utils/resolve-turn-input.js +16 -0
- package/docs/migration-GENC-1580.md +44 -36
- package/package.json +16 -16
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/** Tuning constants for the tool loop — caps, retry ceilings, and the two retry nudges. */
|
|
2
|
+
export const DEFAULT_MAX_TOOL_ITERATIONS = 50;
|
|
3
|
+
export const DEFAULT_MAX_FOLD_OPERATIONS = 5;
|
|
4
|
+
// TODO: dedup system prompts in-memory to allow raising this cap much higher.
|
|
5
|
+
// Each TurnSnapshot stores the full resolved `systemPrompt`, so the buffer's
|
|
6
|
+
// memory cost scales with cap × prompt size — a stable agent repeats a multi-KB
|
|
7
|
+
// prompt every turn. `getDebugLog` already dedups identical consecutive prompts
|
|
8
|
+
// at export time (`<repeated — identical to turn N>`); applying the same dedup
|
|
9
|
+
// at capture time (store the prompt only when it changes, back-reference
|
|
10
|
+
// otherwise) would make snapshots nearly as cheap as meta events and let this
|
|
11
|
+
// cap reach thousands for full-session capture without the memory blowup.
|
|
12
|
+
export const DEFAULT_MAX_TURN_SNAPSHOTS = 400;
|
|
13
|
+
export const DEFAULT_MAX_UNKNOWN_TOOL_CALLS = 5;
|
|
14
|
+
// Stale tools (advertised in an earlier state, retired now) and fold-hidden tools are
|
|
15
|
+
// self-correcting — the model drops them once guided — so they get a higher loop-protection
|
|
16
|
+
// ceiling than hallucinated names: a few legitimate stale calls across state transitions must
|
|
17
|
+
// not prematurely end the turn. Still bounded so a genuinely stuck loop terminates.
|
|
18
|
+
export const MAX_STALE_TOOL_CALLS = DEFAULT_MAX_UNKNOWN_TOOL_CALLS * 2;
|
|
19
|
+
// Gemini in particular emits short bursts of MALFORMED_FUNCTION_CALL; allow more CONSECUTIVE
|
|
20
|
+
// retries. These counters reset on any productive response, so this is a consecutive-failure
|
|
21
|
+
// ceiling, not a per-turn total.
|
|
22
|
+
export const MAX_MALFORMED_RETRIES = 5;
|
|
23
|
+
export const MAX_EMPTY_RESPONSE_RETRIES = 3;
|
|
24
|
+
/**
|
|
25
|
+
* Framed-tail nudge added to a retry after a MALFORMED tool call.
|
|
26
|
+
*
|
|
27
|
+
* Exported so tests can assert placement (framed tail, never the system prompt) without pinning
|
|
28
|
+
* the wording — the copy is a prompt, and a prompt should be free to improve.
|
|
29
|
+
*
|
|
30
|
+
* @beta
|
|
31
|
+
*/
|
|
32
|
+
export const MALFORMED_CALL_NUDGE = 'IMPORTANT: Use only the structured function-call API to invoke tools. Do not write Python code or use Python-style syntax to call tools.';
|
|
33
|
+
/**
|
|
34
|
+
* Framed-tail nudge added to a retry after an EMPTY response.
|
|
35
|
+
*
|
|
36
|
+
* Rewritten in GENC-1573. The previous copy ("You must respond to the user's message. Call the
|
|
37
|
+
* appropriate tool or provide a text response") told a model that had just returned nothing to
|
|
38
|
+
* respond, without naming the one exit available to an agent that genuinely cannot act: saying so.
|
|
39
|
+
* Across nine failures in the measured session it changed nothing — all 29 attempts came back at
|
|
40
|
+
* 8–9 output tokens — and most of those were on a tool-less agent, for which "call the appropriate
|
|
41
|
+
* tool" is not an option at all. This version names the honest answer explicitly.
|
|
42
|
+
*
|
|
43
|
+
* @beta
|
|
44
|
+
*/
|
|
45
|
+
export const EMPTY_RESPONSE_NUDGE = "IMPORTANT: Your previous attempt returned nothing at all, which is never a valid response. Answer the user's last message now, in prose — even if all you can honestly say is that you cannot help with it and why. If a tool is the right way to answer, call it. Do not return an empty response.";
|
|
46
|
+
// Transient throws while building the per-turn tool surface or calling the provider retry the
|
|
47
|
+
// SAME iteration up to this many times before propagating, rather than tearing down the turn.
|
|
48
|
+
export const MAX_SETUP_TRANSPORT_RETRIES = 3;
|
|
49
|
+
/**
|
|
50
|
+
* Sub-agent meta events worth folding into the parent's debug timeline: the
|
|
51
|
+
* per-attempt and per-failure signals that do NOT otherwise surface in the
|
|
52
|
+
* sub-agent's (now hoisted) messages — a retried-away malformed/empty attempt
|
|
53
|
+
* produces no message, and the stale-vs-hallucinated/streak diagnostics live only
|
|
54
|
+
* on the event. High-volume, message-derivable events (turn.start/turn.end,
|
|
55
|
+
* provider.selected, context.updated) are intentionally excluded: read the
|
|
56
|
+
* sub-agent's hoisted messages for model/tokens/cost and turn-by-turn activity.
|
|
57
|
+
* See `ChatDriver.invokeSubAgent`.
|
|
58
|
+
*/
|
|
59
|
+
export const HARVESTED_SUBAGENT_EVENTS = new Set([
|
|
60
|
+
'turn.retry',
|
|
61
|
+
'turn.error',
|
|
62
|
+
'tool.failed',
|
|
63
|
+
'tool.unresolved',
|
|
64
|
+
]);
|
|
65
|
+
/**
|
|
66
|
+
* Name reserved for the cross-agent handoff tool — injected by OrchestratingDriver.
|
|
67
|
+
*
|
|
68
|
+
* @beta
|
|
69
|
+
*/
|
|
70
|
+
export const REQUEST_CONTINUATION_TOOL = 'request_continuation';
|
|
71
|
+
/** Paired in history for each `request_continuation` so tool_calls stay balanced for the provider. */
|
|
72
|
+
export const HANDOFF_TOOL_RESULT_PLACEHOLDER = 'Handoff to another specialist — routing continues on the next turn.';
|