@seanhogg/builderforce-memory 2026.9.30 → 2026.9.32
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/bridges/FetchBridge.d.ts +12 -5
- package/dist/bridges/FetchBridge.d.ts.map +1 -1
- package/dist/bridges/FetchBridge.js +6 -4
- package/dist/bridges/FetchBridge.js.map +1 -1
- package/dist/bridges/OpenAIBridge.d.ts +17 -4
- package/dist/bridges/OpenAIBridge.d.ts.map +1 -1
- package/dist/bridges/OpenAIBridge.js +68 -57
- package/dist/bridges/OpenAIBridge.js.map +1 -1
- package/dist/bridges/TransformerBridge.d.ts +6 -0
- package/dist/bridges/TransformerBridge.d.ts.map +1 -1
- package/dist/evermind/index.d.ts +6 -0
- package/dist/evermind/index.d.ts.map +1 -1
- package/dist/evermind/index.js +5 -0
- package/dist/evermind/index.js.map +1 -1
- package/dist/evermind/runtime.d.ts +158 -0
- package/dist/evermind/runtime.d.ts.map +1 -0
- package/dist/evermind/runtime.js +236 -0
- package/dist/evermind/runtime.js.map +1 -0
- package/dist/evermind/textCoherence.d.ts +55 -0
- package/dist/evermind/textCoherence.d.ts.map +1 -0
- package/dist/evermind/textCoherence.js +218 -0
- package/dist/evermind/textCoherence.js.map +1 -0
- package/dist/evermind/toolCall.d.ts +175 -0
- package/dist/evermind/toolCall.d.ts.map +1 -0
- package/dist/evermind/toolCall.js +398 -0
- package/dist/evermind/toolCall.js.map +1 -0
- package/dist/evermind/wordLexicon.d.ts +103 -0
- package/dist/evermind/wordLexicon.d.ts.map +1 -0
- package/dist/evermind/wordLexicon.js +361 -0
- package/dist/evermind/wordLexicon.js.map +1 -0
- package/dist/wire/chatClient.d.ts +100 -0
- package/dist/wire/chatClient.d.ts.map +1 -0
- package/dist/wire/chatClient.js +123 -0
- package/dist/wire/chatClient.js.map +1 -0
- package/dist/wire/index.d.ts +3 -1
- package/dist/wire/index.d.ts.map +1 -1
- package/dist/wire/index.js +2 -1
- package/dist/wire/index.js.map +1 -1
- package/dist/wire/sse.d.ts +17 -9
- package/dist/wire/sse.d.ts.map +1 -1
- package/dist/wire/sse.js +45 -22
- package/dist/wire/sse.js.map +1 -1
- package/package.json +3 -3
- package/src/bridges/FetchBridge.ts +15 -6
- package/src/bridges/OpenAIBridge.ts +82 -72
- package/src/bridges/TransformerBridge.ts +6 -0
- package/src/evermind/index.ts +48 -0
- package/src/evermind/runtime.ts +364 -0
- package/src/evermind/textCoherence.ts +248 -0
- package/src/evermind/toolCall.ts +523 -0
- package/src/evermind/wordLexicon.ts +395 -0
- package/src/wire/chatClient.ts +196 -0
- package/src/wire/index.ts +3 -1
- package/src/wire/sse.ts +43 -21
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* toolCall — function calling for Evermind, a project's OWN SSM.
|
|
3
|
+
*
|
|
4
|
+
* Evermind used to REFUSE every tool-bearing request, on the reasoning that a head
|
|
5
|
+
* which generates raw text cannot emit `tool_calls` and that narrating a call is
|
|
6
|
+
* worse than an error. The refusal was right about the failure mode and wrong about
|
|
7
|
+
* the remedy: "can the architecture emit a JSON tool call?" is not a property of the
|
|
8
|
+
* weights at all, it is a property of the DECODING STRATEGY. A tiny under-trained
|
|
9
|
+
* head asked to free-generate `{"name":…,"arguments":{…}}` will indeed produce
|
|
10
|
+
* malformed junk — so this module never asks it to.
|
|
11
|
+
*
|
|
12
|
+
* The approach is schema-driven CONSTRAINED DECODING (the jsonformer/outlines shape):
|
|
13
|
+
* the JSON is ASSEMBLED HERE as a real JS object from the tool's JSON Schema, and the
|
|
14
|
+
* model is only ever consulted for the leaves it is qualified to fill:
|
|
15
|
+
*
|
|
16
|
+
* • a finite choice (which tool, an `enum`, a boolean) → every candidate is SCORED
|
|
17
|
+
* by likelihood and the argmax wins, so the answer is always a legal value;
|
|
18
|
+
* • a free value (a string, a number) → generated, then parsed/escaped by us.
|
|
19
|
+
*
|
|
20
|
+
* Structural validity is therefore guaranteed BY CONSTRUCTION — the braces, quotes,
|
|
21
|
+
* commas and key names are never sampled, so there is no such thing as a malformed
|
|
22
|
+
* Evermind tool call. `JSON.stringify` of a real object cannot be invalid JSON.
|
|
23
|
+
*
|
|
24
|
+
* What that does NOT buy is a good CHOICE, and this is where the original file's
|
|
25
|
+
* instinct is kept rather than discarded. A head that cannot tell `read_file` from
|
|
26
|
+
* `open_pull_request` will still pick one — structurally perfect, semantically a coin
|
|
27
|
+
* flip — and an agent loop acting on coin flips writes files for no reason. So the
|
|
28
|
+
* planner reports the MARGIN between its best and runner-up candidate, and the vendor
|
|
29
|
+
* refuses (400 → cascade) when the head is measurably guessing. Fitness to tool-call
|
|
30
|
+
* is now measured, the same way {@link ./textCoherence} measures fitness to answer in
|
|
31
|
+
* prose, instead of being assumed absent.
|
|
32
|
+
*
|
|
33
|
+
* Pure + port-based (no engine, no R2, no db imports) so the whole planner is unit
|
|
34
|
+
* testable against a fake decoder; the model-backed adapter lives in
|
|
35
|
+
* {@link ./runtime}.
|
|
36
|
+
*/
|
|
37
|
+
/** A tool the model may call, normalized out of the OpenAI wire shape. */
|
|
38
|
+
export interface NormalizedTool {
|
|
39
|
+
name: string;
|
|
40
|
+
description: string;
|
|
41
|
+
/** JSON Schema for the arguments object (`{ type:'object', properties, required }`). */
|
|
42
|
+
parameters: JsonSchema;
|
|
43
|
+
}
|
|
44
|
+
/** The slice of JSON Schema this decoder understands. Anything unrecognised is
|
|
45
|
+
* filled as a string, which is always representable. */
|
|
46
|
+
export interface JsonSchema {
|
|
47
|
+
type?: string | string[];
|
|
48
|
+
description?: string;
|
|
49
|
+
enum?: unknown[];
|
|
50
|
+
properties?: Record<string, JsonSchema>;
|
|
51
|
+
required?: string[];
|
|
52
|
+
items?: JsonSchema;
|
|
53
|
+
default?: unknown;
|
|
54
|
+
minimum?: number;
|
|
55
|
+
maximum?: number;
|
|
56
|
+
maxLength?: number;
|
|
57
|
+
minItems?: number;
|
|
58
|
+
maxItems?: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* What the caller's `tool_choice` resolved to. Mirrors the OpenAI contract:
|
|
62
|
+
* `none` never calls, `auto` lets the model decide, `required` must call something,
|
|
63
|
+
* and a pinned function forces exactly one.
|
|
64
|
+
*/
|
|
65
|
+
export type ToolChoicePlan = {
|
|
66
|
+
mode: 'none';
|
|
67
|
+
} | {
|
|
68
|
+
mode: 'auto';
|
|
69
|
+
} | {
|
|
70
|
+
mode: 'required';
|
|
71
|
+
} | {
|
|
72
|
+
mode: 'forced';
|
|
73
|
+
name: string;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* The two capabilities the planner needs from a language model. Kept this narrow so
|
|
77
|
+
* the planner has no engine dependency — {@link ./runtime} supplies the
|
|
78
|
+
* EvermindLM-backed implementation and tests supply a deterministic fake.
|
|
79
|
+
*/
|
|
80
|
+
export interface EvermindToolDecoder {
|
|
81
|
+
/**
|
|
82
|
+
* Length-normalized mean log-probability of `continuation` following `prompt`
|
|
83
|
+
* (higher = more likely). Length normalization is what makes candidates of
|
|
84
|
+
* different token counts comparable — without it the shortest tool name wins
|
|
85
|
+
* every vote purely for being short.
|
|
86
|
+
*/
|
|
87
|
+
score(prompt: string, continuation: string): number;
|
|
88
|
+
/** Free-text continuation of `prompt`, at most `maxTokens` new tokens. */
|
|
89
|
+
generate(prompt: string, maxTokens: number): string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Minimum separation (in mean log-prob) between the winning candidate and the
|
|
93
|
+
* runner-up for a choice to count as a DECISION rather than a coin flip.
|
|
94
|
+
*
|
|
95
|
+
* This is the tool-calling analogue of the coherence bar: it is what stops a
|
|
96
|
+
* structurally-perfect-but-meaningless call from driving an agent loop. Tuned low
|
|
97
|
+
* on purpose — the job is to catch a head with no preference at all (margins at
|
|
98
|
+
* ~1e-3), not to demand confidence a small model never shows.
|
|
99
|
+
*/
|
|
100
|
+
export declare const TOOL_CHOICE_MIN_MARGIN = 0.02;
|
|
101
|
+
/**
|
|
102
|
+
* The margin bar in force for a raw override (the host reads it from its own config —
|
|
103
|
+
* the gateway's `EVERMIND_TOOL_CHOICE_MIN_MARGIN`). ONE resolver, shared by the
|
|
104
|
+
* serve-time gate and the bench, so the bench can never report a bar the gateway is
|
|
105
|
+
* not applying.
|
|
106
|
+
*
|
|
107
|
+
* The default is an analytic placeholder and documented as one; the override is what
|
|
108
|
+
* lets it be CALIBRATED from logged margins without a deploy per candidate value.
|
|
109
|
+
*/
|
|
110
|
+
export declare function resolveToolChoiceMinMargin(override?: string | null): number;
|
|
111
|
+
/**
|
|
112
|
+
* Normalize the OpenAI `tools` array into {@link NormalizedTool}s, accepting both the
|
|
113
|
+
* nested chat-completions shape (`{ type:'function', function:{…} }`) and the already
|
|
114
|
+
* flattened Responses shape (`{ type:'function', name, … }`) — the gateway carries
|
|
115
|
+
* both, and a vendor that understood only one would silently see zero tools.
|
|
116
|
+
* Entries without a usable name are dropped rather than half-registered.
|
|
117
|
+
*/
|
|
118
|
+
export declare function normalizeEvermindTools(tools: unknown[] | undefined): NormalizedTool[];
|
|
119
|
+
/**
|
|
120
|
+
* Resolve the caller's `tool_choice` against the tools actually on offer. A pinned
|
|
121
|
+
* function that isn't in the list degrades to `required` rather than forcing a name
|
|
122
|
+
* the caller never declared (which would produce a call no agent loop can dispatch).
|
|
123
|
+
*/
|
|
124
|
+
export declare function resolveEvermindToolChoice(toolChoice: unknown, tools: NormalizedTool[]): ToolChoicePlan;
|
|
125
|
+
/**
|
|
126
|
+
* The tool catalogue, rendered into the prompt so the head's choice is INFORMED by
|
|
127
|
+
* the descriptions rather than made from the tool names alone. Shared by the decision
|
|
128
|
+
* vote and every argument fill so the model sees one consistent context.
|
|
129
|
+
*/
|
|
130
|
+
export declare function renderToolsPreamble(tools: NormalizedTool[]): string;
|
|
131
|
+
/** One planned call. */
|
|
132
|
+
export interface EvermindPlannedCall {
|
|
133
|
+
name: string;
|
|
134
|
+
arguments: Record<string, unknown>;
|
|
135
|
+
}
|
|
136
|
+
/** A planned call plus the evidence for how confidently it was chosen. */
|
|
137
|
+
export interface EvermindToolPlan {
|
|
138
|
+
/** The FIRST chosen call, or null when the head elected to answer in prose
|
|
139
|
+
* (`auto` only). Kept as the single-call view every existing reader uses;
|
|
140
|
+
* {@link EvermindToolPlan.calls} is the full list. */
|
|
141
|
+
call: EvermindPlannedCall | null;
|
|
142
|
+
/**
|
|
143
|
+
* Every call this turn emits, in order.
|
|
144
|
+
*
|
|
145
|
+
* The OpenAI shape has always been an ARRAY and frontier models emit parallel
|
|
146
|
+
* calls; Evermind used to plan exactly one, so a caller that relies on parallel
|
|
147
|
+
* calls silently got serialized behaviour. After the first call the head is asked
|
|
148
|
+
* "another call?" — the same continue-vote the array filler already uses for list
|
|
149
|
+
* length — so a model with nothing more to do still emits exactly one.
|
|
150
|
+
* Empty when `call` is null.
|
|
151
|
+
*/
|
|
152
|
+
calls: EvermindPlannedCall[];
|
|
153
|
+
/**
|
|
154
|
+
* Separation between the winning tool and the runner-up. The vendor gates on this:
|
|
155
|
+
* a head with no preference is guessing, and a guessed tool call is exactly the
|
|
156
|
+
* "silently doing the wrong thing" this backend refuses to do.
|
|
157
|
+
* `Infinity` when the choice was forced or unopposed (nothing was guessed).
|
|
158
|
+
*/
|
|
159
|
+
margin: number;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Choose a tool and fill its arguments under the caller's `tool_choice` contract.
|
|
163
|
+
*
|
|
164
|
+
* The decision and every argument come from the model; the JSON structure comes from
|
|
165
|
+
* the schema. Returns `{ call: null }` only in `auto` mode, and only when answering
|
|
166
|
+
* directly out-scored every tool — `required`/`forced` always produce a call.
|
|
167
|
+
*/
|
|
168
|
+
export declare function planEvermindToolCall(decoder: EvermindToolDecoder, basePrompt: string, tools: NormalizedTool[], choice: ToolChoicePlan): EvermindToolPlan;
|
|
169
|
+
/** Wrap a planned call in the OpenAI `tool_calls` wire shape. `id` is supplied by the
|
|
170
|
+
* caller so the completion builder controls id generation (and tests stay stable). */
|
|
171
|
+
export declare function toOpenAIToolCall(call: {
|
|
172
|
+
name: string;
|
|
173
|
+
arguments: Record<string, unknown>;
|
|
174
|
+
}, id: string): Record<string, unknown>;
|
|
175
|
+
//# sourceMappingURL=toolCall.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolCall.d.ts","sourceRoot":"","sources":["../../src/evermind/toolCall.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,0EAA0E;AAC1E,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,wFAAwF;IACxF,UAAU,EAAE,UAAU,CAAC;CACxB;AAED;yDACyD;AACzD,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,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iFlB;AAED;uFACuF;AACvF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEhI"}
|
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* toolCall — function calling for Evermind, a project's OWN SSM.
|
|
3
|
+
*
|
|
4
|
+
* Evermind used to REFUSE every tool-bearing request, on the reasoning that a head
|
|
5
|
+
* which generates raw text cannot emit `tool_calls` and that narrating a call is
|
|
6
|
+
* worse than an error. The refusal was right about the failure mode and wrong about
|
|
7
|
+
* the remedy: "can the architecture emit a JSON tool call?" is not a property of the
|
|
8
|
+
* weights at all, it is a property of the DECODING STRATEGY. A tiny under-trained
|
|
9
|
+
* head asked to free-generate `{"name":…,"arguments":{…}}` will indeed produce
|
|
10
|
+
* malformed junk — so this module never asks it to.
|
|
11
|
+
*
|
|
12
|
+
* The approach is schema-driven CONSTRAINED DECODING (the jsonformer/outlines shape):
|
|
13
|
+
* the JSON is ASSEMBLED HERE as a real JS object from the tool's JSON Schema, and the
|
|
14
|
+
* model is only ever consulted for the leaves it is qualified to fill:
|
|
15
|
+
*
|
|
16
|
+
* • a finite choice (which tool, an `enum`, a boolean) → every candidate is SCORED
|
|
17
|
+
* by likelihood and the argmax wins, so the answer is always a legal value;
|
|
18
|
+
* • a free value (a string, a number) → generated, then parsed/escaped by us.
|
|
19
|
+
*
|
|
20
|
+
* Structural validity is therefore guaranteed BY CONSTRUCTION — the braces, quotes,
|
|
21
|
+
* commas and key names are never sampled, so there is no such thing as a malformed
|
|
22
|
+
* Evermind tool call. `JSON.stringify` of a real object cannot be invalid JSON.
|
|
23
|
+
*
|
|
24
|
+
* What that does NOT buy is a good CHOICE, and this is where the original file's
|
|
25
|
+
* instinct is kept rather than discarded. A head that cannot tell `read_file` from
|
|
26
|
+
* `open_pull_request` will still pick one — structurally perfect, semantically a coin
|
|
27
|
+
* flip — and an agent loop acting on coin flips writes files for no reason. So the
|
|
28
|
+
* planner reports the MARGIN between its best and runner-up candidate, and the vendor
|
|
29
|
+
* refuses (400 → cascade) when the head is measurably guessing. Fitness to tool-call
|
|
30
|
+
* is now measured, the same way {@link ./textCoherence} measures fitness to answer in
|
|
31
|
+
* prose, instead of being assumed absent.
|
|
32
|
+
*
|
|
33
|
+
* Pure + port-based (no engine, no R2, no db imports) so the whole planner is unit
|
|
34
|
+
* testable against a fake decoder; the model-backed adapter lives in
|
|
35
|
+
* {@link ./runtime}.
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* Minimum separation (in mean log-prob) between the winning candidate and the
|
|
39
|
+
* runner-up for a choice to count as a DECISION rather than a coin flip.
|
|
40
|
+
*
|
|
41
|
+
* This is the tool-calling analogue of the coherence bar: it is what stops a
|
|
42
|
+
* structurally-perfect-but-meaningless call from driving an agent loop. Tuned low
|
|
43
|
+
* on purpose — the job is to catch a head with no preference at all (margins at
|
|
44
|
+
* ~1e-3), not to demand confidence a small model never shows.
|
|
45
|
+
*/
|
|
46
|
+
export const TOOL_CHOICE_MIN_MARGIN = 0.02;
|
|
47
|
+
/**
|
|
48
|
+
* The margin bar in force for a raw override (the host reads it from its own config —
|
|
49
|
+
* the gateway's `EVERMIND_TOOL_CHOICE_MIN_MARGIN`). ONE resolver, shared by the
|
|
50
|
+
* serve-time gate and the bench, so the bench can never report a bar the gateway is
|
|
51
|
+
* not applying.
|
|
52
|
+
*
|
|
53
|
+
* The default is an analytic placeholder and documented as one; the override is what
|
|
54
|
+
* lets it be CALIBRATED from logged margins without a deploy per candidate value.
|
|
55
|
+
*/
|
|
56
|
+
export function resolveToolChoiceMinMargin(override) {
|
|
57
|
+
const text = override?.trim();
|
|
58
|
+
// Empty is ABSENT, checked before the numeric parse: `Number('')` is 0, not NaN, so
|
|
59
|
+
// a declared-but-unset variable — the normal shape of a secret nobody filled in —
|
|
60
|
+
// would otherwise set the bar to zero and silently turn the confidence gate off.
|
|
61
|
+
if (!text)
|
|
62
|
+
return TOOL_CHOICE_MIN_MARGIN;
|
|
63
|
+
const raw = Number(text);
|
|
64
|
+
// A non-numeric or negative override is ignored rather than obeyed: a bar of NaN
|
|
65
|
+
// compares false against everything, which is the same silent disabling.
|
|
66
|
+
return Number.isFinite(raw) && raw >= 0 ? raw : TOOL_CHOICE_MIN_MARGIN;
|
|
67
|
+
}
|
|
68
|
+
/** Ceiling on calls emitted in ONE turn. Each additional call costs a full tool vote
|
|
69
|
+
* plus an argument fill, so this bounds the CPU an agent loop can spend on a single
|
|
70
|
+
* planning turn — and a head that wants more than this is not planning, it is
|
|
71
|
+
* looping. */
|
|
72
|
+
const MAX_PARALLEL_TOOL_CALLS = 4;
|
|
73
|
+
/** Hard caps so a hostile or recursive schema cannot spin the decoder. */
|
|
74
|
+
const MAX_SCHEMA_DEPTH = 4;
|
|
75
|
+
const MAX_ARRAY_ITEMS = 4;
|
|
76
|
+
const MAX_STRING_CHARS = 400;
|
|
77
|
+
const STRING_VALUE_TOKENS = 48;
|
|
78
|
+
const NUMBER_VALUE_TOKENS = 8;
|
|
79
|
+
/** The sentinel candidate representing "don't call a tool, just answer". Scored
|
|
80
|
+
* alongside the real tools in `auto` mode so one primitive makes the decision. */
|
|
81
|
+
const ANSWER_DIRECTLY = 'answer the user directly without calling a tool';
|
|
82
|
+
// ── Wire-shape normalization ─────────────────────────────────────────────────
|
|
83
|
+
/**
|
|
84
|
+
* Normalize the OpenAI `tools` array into {@link NormalizedTool}s, accepting both the
|
|
85
|
+
* nested chat-completions shape (`{ type:'function', function:{…} }`) and the already
|
|
86
|
+
* flattened Responses shape (`{ type:'function', name, … }`) — the gateway carries
|
|
87
|
+
* both, and a vendor that understood only one would silently see zero tools.
|
|
88
|
+
* Entries without a usable name are dropped rather than half-registered.
|
|
89
|
+
*/
|
|
90
|
+
export function normalizeEvermindTools(tools) {
|
|
91
|
+
if (!Array.isArray(tools))
|
|
92
|
+
return [];
|
|
93
|
+
const out = [];
|
|
94
|
+
for (const raw of tools) {
|
|
95
|
+
// A caller's `tools` array is untrusted wire data — a null/scalar entry must be
|
|
96
|
+
// skipped, not dereferenced.
|
|
97
|
+
if (!raw || typeof raw !== 'object')
|
|
98
|
+
continue;
|
|
99
|
+
const tool = raw;
|
|
100
|
+
const fn = (tool.function ?? tool);
|
|
101
|
+
const name = typeof fn.name === 'string' ? fn.name.trim() : '';
|
|
102
|
+
if (!name)
|
|
103
|
+
continue;
|
|
104
|
+
out.push({
|
|
105
|
+
name,
|
|
106
|
+
description: typeof fn.description === 'string' ? fn.description : '',
|
|
107
|
+
parameters: (fn.parameters && typeof fn.parameters === 'object' ? fn.parameters : { type: 'object' }),
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return out;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Resolve the caller's `tool_choice` against the tools actually on offer. A pinned
|
|
114
|
+
* function that isn't in the list degrades to `required` rather than forcing a name
|
|
115
|
+
* the caller never declared (which would produce a call no agent loop can dispatch).
|
|
116
|
+
*/
|
|
117
|
+
export function resolveEvermindToolChoice(toolChoice, tools) {
|
|
118
|
+
if (tools.length === 0)
|
|
119
|
+
return { mode: 'none' };
|
|
120
|
+
if (toolChoice === 'none')
|
|
121
|
+
return { mode: 'none' };
|
|
122
|
+
if (toolChoice === 'required')
|
|
123
|
+
return { mode: 'required' };
|
|
124
|
+
if (toolChoice === 'auto' || toolChoice == null)
|
|
125
|
+
return { mode: 'auto' };
|
|
126
|
+
const pinned = toolChoice;
|
|
127
|
+
if (pinned && typeof pinned === 'object' && pinned.type === 'function') {
|
|
128
|
+
// Accept both the nested and flattened spellings, exactly as `normalizeEvermindTools` does.
|
|
129
|
+
const name = typeof pinned.function?.name === 'string' ? pinned.function.name
|
|
130
|
+
: typeof pinned.name === 'string' ? pinned.name
|
|
131
|
+
: '';
|
|
132
|
+
if (name && tools.some((t) => t.name === name))
|
|
133
|
+
return { mode: 'forced', name };
|
|
134
|
+
return { mode: 'required' };
|
|
135
|
+
}
|
|
136
|
+
return { mode: 'auto' };
|
|
137
|
+
}
|
|
138
|
+
// ── Prompt rendering ─────────────────────────────────────────────────────────
|
|
139
|
+
/** One line per tool: the signature the model is choosing between. */
|
|
140
|
+
function renderToolSignature(tool) {
|
|
141
|
+
const props = tool.parameters?.properties ?? {};
|
|
142
|
+
const required = new Set(tool.parameters?.required ?? []);
|
|
143
|
+
const args = Object.entries(props)
|
|
144
|
+
.map(([key, schema]) => `${key}${required.has(key) ? '' : '?'}: ${schemaTypeName(schema)}`)
|
|
145
|
+
.join(', ');
|
|
146
|
+
return `- ${tool.name}(${args})${tool.description ? ` — ${tool.description}` : ''}`;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* The tool catalogue, rendered into the prompt so the head's choice is INFORMED by
|
|
150
|
+
* the descriptions rather than made from the tool names alone. Shared by the decision
|
|
151
|
+
* vote and every argument fill so the model sees one consistent context.
|
|
152
|
+
*/
|
|
153
|
+
export function renderToolsPreamble(tools) {
|
|
154
|
+
return `Available tools:\n${tools.map(renderToolSignature).join('\n')}`;
|
|
155
|
+
}
|
|
156
|
+
/** Human-readable type for a schema node, used in the rendered signatures. */
|
|
157
|
+
function schemaTypeName(schema) {
|
|
158
|
+
if (!schema)
|
|
159
|
+
return 'string';
|
|
160
|
+
if (Array.isArray(schema.enum) && schema.enum.length > 0)
|
|
161
|
+
return schema.enum.map((v) => JSON.stringify(v)).join('|');
|
|
162
|
+
const type = Array.isArray(schema.type) ? schema.type[0] : schema.type;
|
|
163
|
+
if (type === 'array')
|
|
164
|
+
return `${schemaTypeName(schema.items)}[]`;
|
|
165
|
+
return type ?? 'string';
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Pick the most likely candidate and report the separation. This is the ONE place a
|
|
169
|
+
* finite choice is made — the tool vote, `enum` values and booleans all route through
|
|
170
|
+
* it, so "how does Evermind choose?" has a single answer and a single margin
|
|
171
|
+
* definition. A single candidate is unopposed (`Infinity`): there is nothing to
|
|
172
|
+
* second-guess, so it must not be judged as a low-confidence guess.
|
|
173
|
+
*/
|
|
174
|
+
function decide(decoder, prompt, candidates) {
|
|
175
|
+
if (candidates.length === 0)
|
|
176
|
+
throw new Error('decide() requires at least one candidate');
|
|
177
|
+
const first = candidates[0];
|
|
178
|
+
if (candidates.length === 1)
|
|
179
|
+
return { value: first.value, margin: Infinity };
|
|
180
|
+
let best = first;
|
|
181
|
+
let bestScore = -Infinity;
|
|
182
|
+
let runnerUp = -Infinity;
|
|
183
|
+
for (const candidate of candidates) {
|
|
184
|
+
const score = decoder.score(prompt, candidate.text);
|
|
185
|
+
if (score > bestScore) {
|
|
186
|
+
runnerUp = bestScore;
|
|
187
|
+
bestScore = score;
|
|
188
|
+
best = candidate;
|
|
189
|
+
}
|
|
190
|
+
else if (score > runnerUp) {
|
|
191
|
+
runnerUp = score;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return { value: best.value, margin: bestScore - runnerUp };
|
|
195
|
+
}
|
|
196
|
+
// ── Argument filling ─────────────────────────────────────────────────────────
|
|
197
|
+
/** The prompt a leaf value is generated/scored against: conversation + catalogue +
|
|
198
|
+
* exactly which argument of which tool is being filled. */
|
|
199
|
+
function valuePrompt(base, tool, path, schema) {
|
|
200
|
+
const described = schema?.description ? ` (${schema.description})` : '';
|
|
201
|
+
return `${base}\nCalling tool: ${tool.name}\nValue for argument "${path}"${described}, as ${schemaTypeName(schema)}:`;
|
|
202
|
+
}
|
|
203
|
+
/** First line of a generated value, unquoted and bounded. Free text is never parsed
|
|
204
|
+
* as JSON — it is escaped by `JSON.stringify` at assembly time, so any bytes the
|
|
205
|
+
* head emits are representable. */
|
|
206
|
+
function cleanStringValue(raw, schema) {
|
|
207
|
+
const firstLine = (raw ?? '').split('\n').find((line) => line.trim().length > 0) ?? '';
|
|
208
|
+
const unquoted = firstLine.trim().replace(/^["'`]+/, '').replace(/["'`,]+$/, '').trim();
|
|
209
|
+
const cap = Math.min(schema?.maxLength ?? MAX_STRING_CHARS, MAX_STRING_CHARS);
|
|
210
|
+
return unquoted.slice(0, cap);
|
|
211
|
+
}
|
|
212
|
+
/** First numeric literal in a generated value, clamped to the schema's bounds.
|
|
213
|
+
* Falls back to `default` → `minimum` → 0 when the head emitted no number at all. */
|
|
214
|
+
function cleanNumberValue(raw, schema, integer) {
|
|
215
|
+
const match = (raw ?? '').match(/-?\d+(\.\d+)?/);
|
|
216
|
+
const fallback = typeof schema?.default === 'number' ? schema.default : schema?.minimum ?? 0;
|
|
217
|
+
let value = match ? Number(match[0]) : fallback;
|
|
218
|
+
if (!Number.isFinite(value))
|
|
219
|
+
value = fallback;
|
|
220
|
+
if (typeof schema?.minimum === 'number')
|
|
221
|
+
value = Math.max(value, schema.minimum);
|
|
222
|
+
if (typeof schema?.maximum === 'number')
|
|
223
|
+
value = Math.min(value, schema.maximum);
|
|
224
|
+
return integer ? Math.round(value) : value;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Fill ONE schema node by dispatching on its type — the recursive core of the
|
|
228
|
+
* constrained decoder. Every branch returns a value that is legal for the node, so
|
|
229
|
+
* the assembled object always validates against the shape the tool declared.
|
|
230
|
+
*/
|
|
231
|
+
function fillValue(decoder, base, tool, path, schema, depth, margins) {
|
|
232
|
+
// Depth guard: a self-referential schema would otherwise recurse forever. A string
|
|
233
|
+
// is the universally representable leaf, so that is where we bottom out.
|
|
234
|
+
if (depth > MAX_SCHEMA_DEPTH) {
|
|
235
|
+
return cleanStringValue(decoder.generate(valuePrompt(base, tool, path, schema), STRING_VALUE_TOKENS), schema);
|
|
236
|
+
}
|
|
237
|
+
// An `enum` is a finite choice regardless of the declared type — vote, never generate.
|
|
238
|
+
if (Array.isArray(schema?.enum) && schema.enum.length > 0) {
|
|
239
|
+
const decision = decide(decoder, valuePrompt(base, tool, path, schema), schema.enum.map((value) => ({ value, text: String(value) })));
|
|
240
|
+
margins.push(decision.margin);
|
|
241
|
+
return decision.value;
|
|
242
|
+
}
|
|
243
|
+
const type = Array.isArray(schema?.type) ? schema.type[0] : schema?.type;
|
|
244
|
+
switch (type) {
|
|
245
|
+
case 'boolean': {
|
|
246
|
+
const decision = decide(decoder, valuePrompt(base, tool, path, schema), [
|
|
247
|
+
{ value: true, text: 'true' },
|
|
248
|
+
{ value: false, text: 'false' },
|
|
249
|
+
]);
|
|
250
|
+
margins.push(decision.margin);
|
|
251
|
+
return decision.value;
|
|
252
|
+
}
|
|
253
|
+
case 'integer':
|
|
254
|
+
return cleanNumberValue(decoder.generate(valuePrompt(base, tool, path, schema), NUMBER_VALUE_TOKENS), schema, true);
|
|
255
|
+
case 'number':
|
|
256
|
+
return cleanNumberValue(decoder.generate(valuePrompt(base, tool, path, schema), NUMBER_VALUE_TOKENS), schema, false);
|
|
257
|
+
case 'object':
|
|
258
|
+
return fillObject(decoder, base, tool, path, schema, depth, margins);
|
|
259
|
+
case 'array': {
|
|
260
|
+
const items = [];
|
|
261
|
+
const min = Math.max(0, schema?.minItems ?? 0);
|
|
262
|
+
const max = Math.min(schema?.maxItems ?? MAX_ARRAY_ITEMS, MAX_ARRAY_ITEMS);
|
|
263
|
+
for (let i = 0; i < max; i++) {
|
|
264
|
+
if (i >= min) {
|
|
265
|
+
// Length is itself a decision: keep going only while the head prefers it.
|
|
266
|
+
const more = decide(decoder, `${valuePrompt(base, tool, `${path}[${i}]`, schema?.items)}\nIs there another item?`, [
|
|
267
|
+
{ value: true, text: 'yes' },
|
|
268
|
+
{ value: false, text: 'no' },
|
|
269
|
+
]);
|
|
270
|
+
if (!more.value)
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
items.push(fillValue(decoder, base, tool, `${path}[${i}]`, schema?.items, depth + 1, margins));
|
|
274
|
+
}
|
|
275
|
+
return items;
|
|
276
|
+
}
|
|
277
|
+
case 'null':
|
|
278
|
+
return null;
|
|
279
|
+
default:
|
|
280
|
+
// `string` and anything unrecognised. Generating text is always safe: it is
|
|
281
|
+
// escaped at assembly, so an unknown schema keyword degrades to a filled
|
|
282
|
+
// string rather than to invalid JSON.
|
|
283
|
+
return cleanStringValue(decoder.generate(valuePrompt(base, tool, path, schema), STRING_VALUE_TOKENS), schema);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Fill an object node. Required properties are always present (that is what
|
|
288
|
+
* `required` means); each optional property is a yes/no decision, so the head can
|
|
289
|
+
* produce a minimal call instead of being forced to invent every argument.
|
|
290
|
+
*/
|
|
291
|
+
function fillObject(decoder, base, tool, path, schema, depth, margins) {
|
|
292
|
+
const properties = schema?.properties ?? {};
|
|
293
|
+
const required = new Set(schema?.required ?? []);
|
|
294
|
+
const out = {};
|
|
295
|
+
for (const [key, propSchema] of Object.entries(properties)) {
|
|
296
|
+
const childPath = path ? `${path}.${key}` : key;
|
|
297
|
+
if (!required.has(key)) {
|
|
298
|
+
const include = decide(decoder, `${valuePrompt(base, tool, childPath, propSchema)}\nShould this optional argument be provided?`, [
|
|
299
|
+
{ value: true, text: 'yes' },
|
|
300
|
+
{ value: false, text: 'no' },
|
|
301
|
+
]);
|
|
302
|
+
if (!include.value)
|
|
303
|
+
continue;
|
|
304
|
+
}
|
|
305
|
+
out[key] = fillValue(decoder, base, tool, childPath, propSchema, depth + 1, margins);
|
|
306
|
+
}
|
|
307
|
+
return out;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Choose a tool and fill its arguments under the caller's `tool_choice` contract.
|
|
311
|
+
*
|
|
312
|
+
* The decision and every argument come from the model; the JSON structure comes from
|
|
313
|
+
* the schema. Returns `{ call: null }` only in `auto` mode, and only when answering
|
|
314
|
+
* directly out-scored every tool — `required`/`forced` always produce a call.
|
|
315
|
+
*/
|
|
316
|
+
export function planEvermindToolCall(decoder, basePrompt, tools, choice) {
|
|
317
|
+
if (choice.mode === 'none' || tools.length === 0)
|
|
318
|
+
return { call: null, calls: [], margin: Infinity };
|
|
319
|
+
const base = `${basePrompt}\n\n${renderToolsPreamble(tools)}`;
|
|
320
|
+
const margins = [];
|
|
321
|
+
// 1) Which tool (or none)? `forced` skips the vote entirely — the caller already decided.
|
|
322
|
+
let tool;
|
|
323
|
+
let choiceMargin = Infinity;
|
|
324
|
+
if (choice.mode === 'forced') {
|
|
325
|
+
tool = tools.find((t) => t.name === choice.name);
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
// In `auto`, "answer directly" competes as a peer candidate, so one vote settles
|
|
329
|
+
// both questions (call vs. answer, and which call) with one comparable margin.
|
|
330
|
+
const candidates = tools.map((t) => ({
|
|
331
|
+
value: t,
|
|
332
|
+
text: `${t.name} — ${t.description || t.name}`,
|
|
333
|
+
}));
|
|
334
|
+
if (choice.mode === 'auto')
|
|
335
|
+
candidates.push({ value: null, text: ANSWER_DIRECTLY });
|
|
336
|
+
const decision = decide(decoder, `${base}\nThe best next action is: `, candidates);
|
|
337
|
+
choiceMargin = decision.margin;
|
|
338
|
+
if (!decision.value)
|
|
339
|
+
return { call: null, calls: [], margin: choiceMargin };
|
|
340
|
+
tool = decision.value;
|
|
341
|
+
}
|
|
342
|
+
// A `forced` name is validated by `resolveEvermindToolChoice`, so this is a
|
|
343
|
+
// belt-and-braces fallback rather than a reachable branch.
|
|
344
|
+
if (!tool)
|
|
345
|
+
return { call: null, calls: [], margin: choiceMargin };
|
|
346
|
+
// 2) Fill the arguments object against the tool's own schema.
|
|
347
|
+
const calls = [
|
|
348
|
+
{ name: tool.name, arguments: fillObject(decoder, base, tool, '', tool.parameters, 0, margins) },
|
|
349
|
+
];
|
|
350
|
+
// 3) Additional PARALLEL calls. `forced` names exactly one tool, so it stops here —
|
|
351
|
+
// asking for more would emit calls the caller never requested. Otherwise the head is
|
|
352
|
+
// asked whether it wants another, exactly as the array filler asks whether a list has
|
|
353
|
+
// another item, so a model with nothing more to do still emits exactly one call.
|
|
354
|
+
if (choice.mode !== 'forced') {
|
|
355
|
+
while (calls.length < MAX_PARALLEL_TOOL_CALLS) {
|
|
356
|
+
const rendered = calls.map((c) => `${c.name}(${JSON.stringify(c.arguments)})`).join('\n');
|
|
357
|
+
const more = decide(decoder, `${base}\nAlready calling:\n${rendered}\nIs there another tool call to make?`, [
|
|
358
|
+
{ value: true, text: 'yes' },
|
|
359
|
+
{ value: false, text: 'no' },
|
|
360
|
+
]);
|
|
361
|
+
// A TIE means no. `decide` breaks ties by candidate order, so requiring a
|
|
362
|
+
// positive margin is what keeps "one call" the default: an indifferent head
|
|
363
|
+
// must not have a second call read into its silence.
|
|
364
|
+
if (!more.value || !(more.margin > 0))
|
|
365
|
+
break;
|
|
366
|
+
// Counted ONLY when the vote said yes. A head that is indifferent about making
|
|
367
|
+
// a SECOND call has guessed nothing — folding that indifference into the plan
|
|
368
|
+
// margin would let an optional extra drag a confidently-chosen first call below
|
|
369
|
+
// the confidence gate and get the whole turn refused. A coin-flip "yes",
|
|
370
|
+
// though, does put a guessed call in the plan, and counts.
|
|
371
|
+
margins.push(more.margin);
|
|
372
|
+
const next = decide(decoder, `${base}\nAlready calling:\n${rendered}\nThe next tool to call is: `, tools.map((t) => ({ value: t, text: `${t.name} — ${t.description || t.name}` })));
|
|
373
|
+
margins.push(next.margin);
|
|
374
|
+
if (!next.value)
|
|
375
|
+
break;
|
|
376
|
+
const nextCall = {
|
|
377
|
+
name: next.value.name,
|
|
378
|
+
arguments: fillObject(decoder, base, next.value, '', next.value.parameters, 0, margins),
|
|
379
|
+
};
|
|
380
|
+
// An identical repeat is the head LOOPING, not planning parallel work. Stop
|
|
381
|
+
// rather than emit a duplicate an agent loop would faithfully execute twice.
|
|
382
|
+
const duplicate = calls.some((c) => c.name === nextCall.name && JSON.stringify(c.arguments) === JSON.stringify(nextCall.arguments));
|
|
383
|
+
if (duplicate)
|
|
384
|
+
break;
|
|
385
|
+
calls.push(nextCall);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
// The reported margin is the WEAKEST link in the whole plan: a confident tool
|
|
389
|
+
// choice whose enum argument was a coin flip is still a coin flip overall.
|
|
390
|
+
const weakest = Math.min(choiceMargin, ...margins);
|
|
391
|
+
return { call: calls[0], calls, margin: Number.isFinite(weakest) ? weakest : Infinity };
|
|
392
|
+
}
|
|
393
|
+
/** Wrap a planned call in the OpenAI `tool_calls` wire shape. `id` is supplied by the
|
|
394
|
+
* caller so the completion builder controls id generation (and tests stay stable). */
|
|
395
|
+
export function toOpenAIToolCall(call, id) {
|
|
396
|
+
return { id, type: 'function', function: { name: call.name, arguments: JSON.stringify(call.arguments) } };
|
|
397
|
+
}
|
|
398
|
+
//# sourceMappingURL=toolCall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolCall.js","sourceRoot":"","sources":["../../src/evermind/toolCall.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAuDH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAE3C;;;;;;;;GAQG;AACH,MAAM,UAAU,0BAA0B,CAAC,QAAwB;IACjE,MAAM,IAAI,GAAG,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC9B,oFAAoF;IACpF,kFAAkF;IAClF,iFAAiF;IACjF,IAAI,CAAC,IAAI;QAAE,OAAO,sBAAsB,CAAC;IACzC,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IACzB,iFAAiF;IACjF,yEAAyE;IACzE,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,sBAAsB,CAAC;AACzE,CAAC;AAED;;;eAGe;AACf,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAElC,0EAA0E;AAC1E,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,MAAM,eAAe,GAAG,CAAC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