@cubicecho/agent-core 2.18.0 → 2.18.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/tool-loading.d.ts +17 -8
- package/dist/tool-loading.js +25 -8
- package/llms.txt +1 -1
- package/package.json +1 -1
package/dist/tool-loading.d.ts
CHANGED
|
@@ -107,21 +107,30 @@ export declare function orderTools(tools: OpenAI.ChatCompletionTool[], order?: T
|
|
|
107
107
|
export declare const MAX_PER_LOAD = 12;
|
|
108
108
|
/**
|
|
109
109
|
* The most a conversation carries between turns. Bounds the tool array no matter how long the
|
|
110
|
-
* conversation runs;
|
|
110
|
+
* conversation runs; past it, the earliest-declared names this turn did not use fall off first.
|
|
111
111
|
*
|
|
112
112
|
* Only a multi-turn caller needs this — a run that starts from nothing each time has nothing to
|
|
113
113
|
* carry. See `carryOver`, which takes another number if this one is not yours.
|
|
114
114
|
*/
|
|
115
115
|
export declare const MAX_CARRIED = 16;
|
|
116
116
|
/**
|
|
117
|
-
* The tools to start the next turn with:
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
117
|
+
* The tools to start the next turn with: last turn's where they were, then what this turn used.
|
|
118
|
+
*
|
|
119
|
+
* Nothing carried moves. A template renders the tool array near the head of the prompt, and
|
|
120
|
+
* moving each used tool to the end — which this did until it was found in a local server's cache
|
|
121
|
+
* log — reordered the array between turns and re-prefilled the whole transcript from the first
|
|
122
|
+
* moved definition. Kept in place, the next turn's array is this one's with only the unused
|
|
123
|
+
* loads gone, a prefix of it when every load was used. Past `max`, dropping a name from the
|
|
124
|
+
* middle costs the cache from there, so it happens only when the cap forces it.
|
|
125
|
+
*
|
|
126
|
+
* @param previous Last turn's names, in the order they were declared.
|
|
127
|
+
* @param used What this turn called. Names not already carried are appended in the order given,
|
|
128
|
+
* so pass them in load order to keep them where the tool array had them.
|
|
129
|
+
* @param max How many to carry, defaulting to `MAX_CARRIED`. Past it, the earliest names not in
|
|
130
|
+
* `used` go first, then the earliest of all. At least one: a cap of zero is read as one, not as
|
|
131
|
+
* no cap and not as none.
|
|
123
132
|
*/
|
|
124
|
-
export declare
|
|
133
|
+
export declare function carryOver(previous: readonly string[], used: ReadonlySet<string>, max?: number): string[];
|
|
125
134
|
/**
|
|
126
135
|
* Resolves requested names against the catalogue, expanding trailing `*` wildcards.
|
|
127
136
|
*
|
package/dist/tool-loading.js
CHANGED
|
@@ -174,21 +174,38 @@ export function orderTools(tools, order = true) {
|
|
|
174
174
|
export const MAX_PER_LOAD = 12;
|
|
175
175
|
/**
|
|
176
176
|
* The most a conversation carries between turns. Bounds the tool array no matter how long the
|
|
177
|
-
* conversation runs;
|
|
177
|
+
* conversation runs; past it, the earliest-declared names this turn did not use fall off first.
|
|
178
178
|
*
|
|
179
179
|
* Only a multi-turn caller needs this — a run that starts from nothing each time has nothing to
|
|
180
180
|
* carry. See `carryOver`, which takes another number if this one is not yours.
|
|
181
181
|
*/
|
|
182
182
|
export const MAX_CARRIED = 16;
|
|
183
183
|
/**
|
|
184
|
-
* The tools to start the next turn with:
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
184
|
+
* The tools to start the next turn with: last turn's where they were, then what this turn used.
|
|
185
|
+
*
|
|
186
|
+
* Nothing carried moves. A template renders the tool array near the head of the prompt, and
|
|
187
|
+
* moving each used tool to the end — which this did until it was found in a local server's cache
|
|
188
|
+
* log — reordered the array between turns and re-prefilled the whole transcript from the first
|
|
189
|
+
* moved definition. Kept in place, the next turn's array is this one's with only the unused
|
|
190
|
+
* loads gone, a prefix of it when every load was used. Past `max`, dropping a name from the
|
|
191
|
+
* middle costs the cache from there, so it happens only when the cap forces it.
|
|
192
|
+
*
|
|
193
|
+
* @param previous Last turn's names, in the order they were declared.
|
|
194
|
+
* @param used What this turn called. Names not already carried are appended in the order given,
|
|
195
|
+
* so pass them in load order to keep them where the tool array had them.
|
|
196
|
+
* @param max How many to carry, defaulting to `MAX_CARRIED`. Past it, the earliest names not in
|
|
197
|
+
* `used` go first, then the earliest of all. At least one: a cap of zero is read as one, not as
|
|
198
|
+
* no cap and not as none.
|
|
190
199
|
*/
|
|
191
|
-
export
|
|
200
|
+
export function carryOver(previous, used, max = MAX_CARRIED) {
|
|
201
|
+
const next = [...previous, ...[...used].filter((name) => !previous.includes(name))];
|
|
202
|
+
const cap = Math.max(1, max);
|
|
203
|
+
while (next.length > cap) {
|
|
204
|
+
const stale = next.findIndex((name) => !used.has(name));
|
|
205
|
+
next.splice(stale === -1 ? 0 : stale, 1);
|
|
206
|
+
}
|
|
207
|
+
return next;
|
|
208
|
+
}
|
|
192
209
|
/**
|
|
193
210
|
* Resolves requested names against the catalogue, expanding trailing `*` wildcards.
|
|
194
211
|
*
|
package/llms.txt
CHANGED
|
@@ -300,7 +300,7 @@ Reading what a model meant by a tool call when it did not write one cleanly.
|
|
|
300
300
|
|
|
301
301
|
### tool-loading
|
|
302
302
|
|
|
303
|
-
- `carryOver` — The tools to start the next turn with:
|
|
303
|
+
- `carryOver` — The tools to start the next turn with: last turn's where they were, then what this turn used.
|
|
304
304
|
- `catalogList` — The catalogue as a plain grouped listing of names, loaded ones marked if asked.
|
|
305
305
|
- `catalogPrompt` — The catalogue block appended to the system prompt.
|
|
306
306
|
- `expandNames` — Resolves requested names against the catalogue, expanding trailing `*` wildcards.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cubicecho/agent-core",
|
|
3
|
-
"version": "2.18.
|
|
3
|
+
"version": "2.18.1",
|
|
4
4
|
"description": "The endpoint-agnostic half of an OpenAI-compatible agent loop: tool-schema compatibility, on-demand tool loading, one-shot side tasks, run events, and a pooled client.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openai",
|