@cubicecho/agent-core 3.0.0 → 4.0.0
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/README.md +2 -1
- package/dist/compaction.d.ts +3 -3
- package/dist/compaction.js +3 -3
- package/dist/continuation.d.ts +2 -2
- package/dist/continuation.js +2 -2
- package/dist/guards.d.ts +2 -3
- package/dist/guards.js +1 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/retry.d.ts +1 -1
- package/dist/retry.js +1 -1
- package/dist/scope.d.ts +3 -3
- package/dist/tokens.d.ts +2 -2
- package/dist/tokens.js +2 -2
- package/llms.txt +0 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1245,7 +1245,8 @@ cannot drift. `endpointKey` holds the key in the clear; `endpointId`, its SHA-25
|
|
|
1245
1245
|
that is safe to write down.
|
|
1246
1246
|
|
|
1247
1247
|
`resetAll` drops all five, and `reset.ts` names each seam separately for a test that wants one —
|
|
1248
|
-
`resetCalibration` for the measured ratios
|
|
1248
|
+
`resetCalibration` for the measured ratios, `resetHints` for the models that refused the
|
|
1249
|
+
no-thinking hints.
|
|
1249
1250
|
|
|
1250
1251
|
The latches can outlive the process as well, because otherwise every restart spends one refused
|
|
1251
1252
|
request per endpoint and model learning the same facts again. `exportCapabilities` returns every
|
package/dist/compaction.d.ts
CHANGED
|
@@ -186,7 +186,7 @@ export declare function summaryInput(plan: CompactionPlan): string;
|
|
|
186
186
|
* @param model - The model to write it, which may be a smaller one than the run's.
|
|
187
187
|
* @param [options] - Cancellation and notices, and the instruction and ceiling the summary is
|
|
188
188
|
* written under.
|
|
189
|
-
* @returns A function from
|
|
189
|
+
* @returns A function from the text of what is being folded to the summary. It rejects as `ask` does, and
|
|
190
190
|
* resolves with an empty string where the model wrote nothing.
|
|
191
191
|
*/
|
|
192
192
|
export declare const summariser: (config: Endpoint, model: string, { system, maxTokens, ...options }?: SideTaskOptions & {
|
|
@@ -233,7 +233,7 @@ export interface CompactionRunOptions {
|
|
|
233
233
|
*
|
|
234
234
|
* @param messages - The transcript the plan was made for. Read only, and only for the hooks.
|
|
235
235
|
* @param plan - What `planCompaction` returned for it.
|
|
236
|
-
* @param summarise - Writes the summary from
|
|
236
|
+
* @param summarise - Writes the summary from the text it is handed. See `summariser`. Not called
|
|
237
237
|
* when a hook vetoes.
|
|
238
238
|
* @param [options] - Hooks to tell and whether the window is already past. See `CompactionRunOptions`.
|
|
239
239
|
* @returns `undefined` when nothing was folded — a hook vetoed, or the summary came back empty —
|
|
@@ -292,7 +292,7 @@ export declare const requestIndex: (index: number, record?: Pick<CompactionRecor
|
|
|
292
292
|
*
|
|
293
293
|
* @param messages - The transcript the plan was made for. Not written to.
|
|
294
294
|
* @param plan - What `planCompaction` returned for it.
|
|
295
|
-
* @param summarise - Writes the summary from
|
|
295
|
+
* @param summarise - Writes the summary from the text it is handed. See `summariser`. Not called
|
|
296
296
|
* when a hook vetoes.
|
|
297
297
|
* @param [options] - Hooks to tell and whether the window is already past. See
|
|
298
298
|
* `CompactionRunOptions`.
|
package/dist/compaction.js
CHANGED
|
@@ -252,7 +252,7 @@ export function summaryInput(plan) {
|
|
|
252
252
|
* @param model - The model to write it, which may be a smaller one than the run's.
|
|
253
253
|
* @param [options] - Cancellation and notices, and the instruction and ceiling the summary is
|
|
254
254
|
* written under.
|
|
255
|
-
* @returns A function from
|
|
255
|
+
* @returns A function from the text of what is being folded to the summary. It rejects as `ask` does, and
|
|
256
256
|
* resolves with an empty string where the model wrote nothing.
|
|
257
257
|
*/
|
|
258
258
|
export const summariser = (config, model, { system = SUMMARY_PROMPT, maxTokens = SUMMARY_TOKENS, ...options } = {}) => (text) => ask(config, model, system, text, { maxTokens, ...options });
|
|
@@ -261,7 +261,7 @@ export const summariser = (config, model, { system = SUMMARY_PROMPT, maxTokens =
|
|
|
261
261
|
*
|
|
262
262
|
* @param messages - The transcript the plan was made for. Read only, and only for the hooks.
|
|
263
263
|
* @param plan - What `planCompaction` returned for it.
|
|
264
|
-
* @param summarise - Writes the summary from
|
|
264
|
+
* @param summarise - Writes the summary from the text it is handed. See `summariser`. Not called
|
|
265
265
|
* when a hook vetoes.
|
|
266
266
|
* @param [options] - Hooks to tell and whether the window is already past. See `CompactionRunOptions`.
|
|
267
267
|
* @returns `undefined` when nothing was folded — a hook vetoed, or the summary came back empty —
|
|
@@ -357,7 +357,7 @@ export const requestIndex = (index, record, head = 0) => {
|
|
|
357
357
|
*
|
|
358
358
|
* @param messages - The transcript the plan was made for. Not written to.
|
|
359
359
|
* @param plan - What `planCompaction` returned for it.
|
|
360
|
-
* @param summarise - Writes the summary from
|
|
360
|
+
* @param summarise - Writes the summary from the text it is handed. See `summariser`. Not called
|
|
361
361
|
* when a hook vetoes.
|
|
362
362
|
* @param [options] - Hooks to tell and whether the window is already past. See
|
|
363
363
|
* `CompactionRunOptions`.
|
package/dist/continuation.d.ts
CHANGED
|
@@ -50,8 +50,8 @@ export declare const isContinuable: (turn: Turn) => boolean;
|
|
|
50
50
|
* continuation's `finishReason` and tool calls.
|
|
51
51
|
*
|
|
52
52
|
* @remarks
|
|
53
|
-
* Only a turn
|
|
54
|
-
* reasoning are joined in order, the tool calls a continuation makes are kept, and usage is summed
|
|
53
|
+
* Only a turn cut off at the ceiling, with an answer begun and no tool call in it, is continued;
|
|
54
|
+
* any other comes back as it was. Content and reasoning are joined in order, the tool calls a continuation makes are kept, and usage is summed
|
|
55
55
|
* across the requests with `continuations` counting them. The continuation is read as starting in
|
|
56
56
|
* the answer, whatever `startInReasoning` says: a template that opens a fence for a fresh reply
|
|
57
57
|
* does not open one for a prefill. Its tokens reach `onOutput` as they arrive, so a watcher sees
|
package/dist/continuation.js
CHANGED
|
@@ -112,8 +112,8 @@ function joinUsage(first, next) {
|
|
|
112
112
|
* continuation's `finishReason` and tool calls.
|
|
113
113
|
*
|
|
114
114
|
* @remarks
|
|
115
|
-
* Only a turn
|
|
116
|
-
* reasoning are joined in order, the tool calls a continuation makes are kept, and usage is summed
|
|
115
|
+
* Only a turn cut off at the ceiling, with an answer begun and no tool call in it, is continued;
|
|
116
|
+
* any other comes back as it was. Content and reasoning are joined in order, the tool calls a continuation makes are kept, and usage is summed
|
|
117
117
|
* across the requests with `continuations` counting them. The continuation is read as starting in
|
|
118
118
|
* the answer, whatever `startInReasoning` says: a template that opens a fence for a fresh reply
|
|
119
119
|
* does not open one for a prefill. Its tokens reach `onOutput` as they arrive, so a watcher sees
|
package/dist/guards.d.ts
CHANGED
|
@@ -37,12 +37,11 @@ interface Lookup<K, V> {
|
|
|
37
37
|
*
|
|
38
38
|
* @param map - Where to look. Gains an entry on a miss, which is the point of calling this.
|
|
39
39
|
* @param key - What to look under.
|
|
40
|
-
* @param create - Builds the value on a miss, and is not called on a hit.
|
|
41
|
-
* reads as a miss, so one that returns it is called every time.
|
|
40
|
+
* @param create - Builds the value on a miss, and is not called on a hit.
|
|
42
41
|
* @returns What the map holds under the key afterwards: the held value itself on a hit, what
|
|
43
42
|
* `create` returned on a miss.
|
|
44
43
|
*/
|
|
45
|
-
export declare function getOrCreate<K, V>(map: Lookup<K, V>, key: K, create: () => V): V;
|
|
44
|
+
export declare function getOrCreate<K, V extends {}>(map: Lookup<K, V>, key: K, create: () => V): V;
|
|
46
45
|
/**
|
|
47
46
|
* A count and its noun, plural unless the count is one: `1 tool`, `3 tools`.
|
|
48
47
|
*
|
package/dist/guards.js
CHANGED
|
@@ -32,8 +32,7 @@ export const isPositive = (value) => typeof value === 'number' && value > 0;
|
|
|
32
32
|
*
|
|
33
33
|
* @param map - Where to look. Gains an entry on a miss, which is the point of calling this.
|
|
34
34
|
* @param key - What to look under.
|
|
35
|
-
* @param create - Builds the value on a miss, and is not called on a hit.
|
|
36
|
-
* reads as a miss, so one that returns it is called every time.
|
|
35
|
+
* @param create - Builds the value on a miss, and is not called on a hit.
|
|
37
36
|
* @returns What the map holds under the key afterwards: the held value itself on a hit, what
|
|
38
37
|
* `create` returned on a miss.
|
|
39
38
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -14,9 +14,9 @@ export { calibrate, charsPerTokenFor, resetCalibration } from './calibration.ts'
|
|
|
14
14
|
export { type Capabilities, capabilitiesFor, EFFORT_LADDER, EFFORT_NONE, EFFORT_OFF, effortFor, expireCapabilities, type ModelCapabilities, modelCapabilitiesFor, type NegotiateOptions, negotiate, resetCapabilities, } from './capabilities.ts';
|
|
15
15
|
export type { CatalogServer } from './catalog.ts';
|
|
16
16
|
export { type ClientPoolOptions, configureClients, contextLimitFor, endpointId, endpointKey, firstTokenMs, getClient, listModels, type ModelInfo, NO_KEY, resetClients, resolveApiKey, servedWindow, timeoutMs, } from './client.ts';
|
|
17
|
-
export { applyCompaction, COMPACT_AT, type CompactionOptions, type CompactionPlan, type CompactionRecord, type CompactionRunOptions, compactTranscript, KEEP_RATIO, type PruneOptions, planCompaction, pruneToolResults, requestIndex, runCompaction, SUMMARY_LEAD, SUMMARY_PROMPT, summariser,
|
|
17
|
+
export { applyCompaction, COMPACT_AT, type CompactionOptions, type CompactionPlan, type CompactionRecord, type CompactionRunOptions, compactTranscript, KEEP_RATIO, type PruneOptions, planCompaction, pruneToolResults, requestIndex, runCompaction, SUMMARY_LEAD, SUMMARY_PROMPT, summariser, } from './compaction.ts';
|
|
18
18
|
export { type AgentConfig, type Endpoint, type ModelParams, type RetryPolicy, ToolDiscovery, type ToolPolicy, } from './config.ts';
|
|
19
|
-
export { type ContinueTurnOptions, continueTurn,
|
|
19
|
+
export { type ContinueTurnOptions, continueTurn, } from './continuation.ts';
|
|
20
20
|
export { AgentLoopError, type AgentLoopFailure, AgentLoopOverflow, errorMessage, failedRun, ToolIterationLimit, } from './errors.ts';
|
|
21
21
|
export { configureEvents, type EventBusOptions, emit, endRun, fold, history, type RunEvent, type RunEventInput, RunEventKind, type RunMetrics, type RunMetricsOptions, RunOutcome, type RunUsage, resetEvents, runMetrics, type TurnReport, watch, } from './events.ts';
|
|
22
22
|
export { HOOK_EVENTS, HookEvent, INJECT_EVENTS } from './hook-events.ts';
|
|
@@ -25,7 +25,7 @@ export { estimateFrom, type LedgerEntry, type LedgerEstimateOptions, type Ledger
|
|
|
25
25
|
export { type KeywordPreselection, type KeywordPreselectOptions, PRESELECT_SCHEMA, PRESELECT_SYSTEM, preselect, preselectByKeywords, preselectInput, preselection, preselectSystem, type ToolMatch, } from './preselect.ts';
|
|
26
26
|
export { buildBody } from './request-body.ts';
|
|
27
27
|
export { resetAll } from './reset.ts';
|
|
28
|
-
export { backoffMs, ContextOverflow, EndpointSilent, isModelLoading, isOverflow, isTransient, SMALLEST_LIKELY_WINDOW,
|
|
28
|
+
export { backoffMs, ContextOverflow, EndpointSilent, isModelLoading, isOverflow, isTransient, SMALLEST_LIKELY_WINDOW, } from './retry.ts';
|
|
29
29
|
export { preview } from './run-calls.ts';
|
|
30
30
|
export { type RunTurnOptions, runTurn } from './run-turn.ts';
|
|
31
31
|
export { createRuntime, defaultRuntime, type Runtime, type RuntimeOptions } from './runtime.ts';
|
|
@@ -35,7 +35,7 @@ export { CAPABILITY_SNAPSHOT_VERSION, type CapabilitySnapshot, type EndpointSnap
|
|
|
35
35
|
export { AGENT_SPEC, AGENT_SPEC_VERSION, AGENT_TASKS, type AgentHook, type AgentSpec, type EndpointSpec, type ExportSpecOptions, exportSpec, type ModelSpec, type ParsedSpec, type ParseSpecOptions, type PromptPart, parseSpec, REF_FILE, REF_URL, RESOLVED_DEFAULTS, type ResolvedAgent, type ResolvedTask, type RetrySpec, resolveAgentSpec, SPEC_EVENTS, type SpecBundle, type SpecServer, type TaskSpec, type ToolsSpec, } from './spec.ts';
|
|
36
36
|
export { CacheBreakReason, type Produced, type StreamTurnOptions, streamTurn, type Turn, type TurnUsage, } from './stream.ts';
|
|
37
37
|
export { ALL_FENCES, DEFAULT_FENCES, type Fence, FenceSplitter, type FenceSplitterOptions, SPLIT_OUTPUT, SPLIT_REASONING, type Split, stripThinking, THINK_FENCE, } from './thinking.ts';
|
|
38
|
-
export { type ContextBreakdown, type ContextBreakdownOptions, compact, contextChars, contextTokens, estimateTokens, messageTokens, requestChars, requestTokens, type TokenEstimateOptions,
|
|
38
|
+
export { type ContextBreakdown, type ContextBreakdownOptions, compact, contextChars, contextTokens, estimateTokens, messageTokens, requestChars, requestTokens, type TokenEstimateOptions, } from './tokens.ts';
|
|
39
39
|
export { ARGUMENTS_MALFORMED, ARGUMENTS_TRUNCATED, parseToolArguments, recoverToolCalls, ToolArgumentsError, type ToolCall, type ToolCallOutcome, type ToolCallRequest, type ToolCallResult, } from './tool-calls.ts';
|
|
40
40
|
export { CALL_TOOL, carryOver, catalogList, catalogPrompt, expandNames, holdsDefinitions, inCatalog, LOAD_TOOLS, LOAD_TOOLS_DEFINITION, loadedTools, loadResult, orderTools, PROXY_TOOLS, proxiedCall, proxyCatalogPrompt, proxyLoadResult, requestedNames, shownCall, type ToolOrder, } from './tool-loading.ts';
|
|
41
41
|
export { FinishReason, FUNCTION_TOOL, JSON_SCHEMA_FORMAT, PartType, Role, SchemaType } from './wire.ts';
|
package/dist/index.js
CHANGED
|
@@ -13,9 +13,9 @@ export { PRESELECT_APPEND, PRESELECT_EXCLUSIVE, runAgentLoop, } from './agent-lo
|
|
|
13
13
|
export { calibrate, charsPerTokenFor, resetCalibration } from './calibration.js';
|
|
14
14
|
export { capabilitiesFor, EFFORT_LADDER, EFFORT_NONE, EFFORT_OFF, effortFor, expireCapabilities, modelCapabilitiesFor, negotiate, resetCapabilities, } from './capabilities.js';
|
|
15
15
|
export { configureClients, contextLimitFor, endpointId, endpointKey, firstTokenMs, getClient, listModels, NO_KEY, resetClients, resolveApiKey, servedWindow, timeoutMs, } from './client.js';
|
|
16
|
-
export { applyCompaction, COMPACT_AT, compactTranscript, KEEP_RATIO, planCompaction, pruneToolResults, requestIndex, runCompaction, SUMMARY_LEAD, SUMMARY_PROMPT, summariser,
|
|
16
|
+
export { applyCompaction, COMPACT_AT, compactTranscript, KEEP_RATIO, planCompaction, pruneToolResults, requestIndex, runCompaction, SUMMARY_LEAD, SUMMARY_PROMPT, summariser, } from './compaction.js';
|
|
17
17
|
export { ToolDiscovery, } from './config.js';
|
|
18
|
-
export { continueTurn,
|
|
18
|
+
export { continueTurn, } from './continuation.js';
|
|
19
19
|
export { AgentLoopError, AgentLoopOverflow, errorMessage, failedRun, ToolIterationLimit, } from './errors.js';
|
|
20
20
|
export { configureEvents, emit, endRun, fold, history, RunEventKind, RunOutcome, resetEvents, runMetrics, watch, } from './events.js';
|
|
21
21
|
export { HOOK_EVENTS, HookEvent, INJECT_EVENTS } from './hook-events.js';
|
|
@@ -24,7 +24,7 @@ export { estimateFrom, rebaseLedger, recordRequest, tokensBetween, } from './led
|
|
|
24
24
|
export { PRESELECT_SCHEMA, PRESELECT_SYSTEM, preselect, preselectByKeywords, preselectInput, preselection, preselectSystem, } from './preselect.js';
|
|
25
25
|
export { buildBody } from './request-body.js';
|
|
26
26
|
export { resetAll } from './reset.js';
|
|
27
|
-
export { backoffMs, ContextOverflow, EndpointSilent, isModelLoading, isOverflow, isTransient, SMALLEST_LIKELY_WINDOW,
|
|
27
|
+
export { backoffMs, ContextOverflow, EndpointSilent, isModelLoading, isOverflow, isTransient, SMALLEST_LIKELY_WINDOW, } from './retry.js';
|
|
28
28
|
export { preview } from './run-calls.js';
|
|
29
29
|
export { runTurn } from './run-turn.js';
|
|
30
30
|
export { createRuntime, defaultRuntime } from './runtime.js';
|
|
@@ -34,7 +34,7 @@ export { CAPABILITY_SNAPSHOT_VERSION, exportCapabilities, importCapabilities, }
|
|
|
34
34
|
export { AGENT_SPEC, AGENT_SPEC_VERSION, AGENT_TASKS, exportSpec, parseSpec, REF_FILE, REF_URL, RESOLVED_DEFAULTS, resolveAgentSpec, SPEC_EVENTS, } from './spec.js';
|
|
35
35
|
export { CacheBreakReason, streamTurn, } from './stream.js';
|
|
36
36
|
export { ALL_FENCES, DEFAULT_FENCES, FenceSplitter, SPLIT_OUTPUT, SPLIT_REASONING, stripThinking, THINK_FENCE, } from './thinking.js';
|
|
37
|
-
export { compact, contextChars, contextTokens, estimateTokens, messageTokens, requestChars, requestTokens,
|
|
37
|
+
export { compact, contextChars, contextTokens, estimateTokens, messageTokens, requestChars, requestTokens, } from './tokens.js';
|
|
38
38
|
export { ARGUMENTS_MALFORMED, ARGUMENTS_TRUNCATED, parseToolArguments, recoverToolCalls, ToolArgumentsError, } from './tool-calls.js';
|
|
39
39
|
export { CALL_TOOL, carryOver, catalogList, catalogPrompt, expandNames, holdsDefinitions, inCatalog, LOAD_TOOLS, LOAD_TOOLS_DEFINITION, loadedTools, loadResult, orderTools, PROXY_TOOLS, proxiedCall, proxyCatalogPrompt, proxyLoadResult, requestedNames, shownCall, } from './tool-loading.js';
|
|
40
40
|
export { FinishReason, FUNCTION_TOOL, JSON_SCHEMA_FORMAT, PartType, Role, SchemaType } from './wire.js';
|
package/dist/retry.d.ts
CHANGED
|
@@ -91,7 +91,7 @@ export declare const refusesRequest: (error: unknown) => boolean;
|
|
|
91
91
|
*
|
|
92
92
|
* @remarks
|
|
93
93
|
* An abort reaches a catch in two shapes. The SDK raises its own class when a request in flight is
|
|
94
|
-
* cancelled, and
|
|
94
|
+
* cancelled, and the wait between attempts rejects with the signal's reason when the cancel lands there.
|
|
95
95
|
* A catch that knew only the first reported the second as a failure. A signal aborted with a
|
|
96
96
|
* reason of the caller's own making is not recognised, since only the error is looked at: a
|
|
97
97
|
* catch that holds the signal asks it as well, as `tryAsk` does.
|
package/dist/retry.js
CHANGED
|
@@ -135,7 +135,7 @@ export const refusesRequest = (error) => error instanceof OpenAI.APIError &&
|
|
|
135
135
|
*
|
|
136
136
|
* @remarks
|
|
137
137
|
* An abort reaches a catch in two shapes. The SDK raises its own class when a request in flight is
|
|
138
|
-
* cancelled, and
|
|
138
|
+
* cancelled, and the wait between attempts rejects with the signal's reason when the cancel lands there.
|
|
139
139
|
* A catch that knew only the first reported the second as a failure. A signal aborted with a
|
|
140
140
|
* reason of the caller's own making is not recognised, since only the error is looked at: a
|
|
141
141
|
* catch that holds the signal asks it as well, as `tryAsk` does.
|
package/dist/scope.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* A map rather than a record of named caches, so a module that grows a cache declares it where
|
|
6
6
|
* it is used and `runtime.ts` does not have to hear about it.
|
|
7
7
|
*/
|
|
8
|
-
export type Scope = Map<symbol, unknown
|
|
8
|
+
export type Scope = Map<symbol, NonNullable<unknown>>;
|
|
9
9
|
/** The default runtime's scope: what the top-level functions use when no runtime is running. */
|
|
10
10
|
export declare const rootScope: Scope;
|
|
11
11
|
/**
|
|
@@ -23,7 +23,7 @@ export declare const currentScope: () => Scope;
|
|
|
23
23
|
*/
|
|
24
24
|
export declare const inScope: <T>(scope: Scope, fn: () => T) => T;
|
|
25
25
|
/** One module's state, read from whichever scope is current. See `scoped`. */
|
|
26
|
-
export interface Scoped<T> {
|
|
26
|
+
export interface Scoped<T extends {}> {
|
|
27
27
|
/** The current scope's copy, made on first use. */
|
|
28
28
|
(): T;
|
|
29
29
|
/** Drops the current scope's copy, so the next read makes a fresh one. */
|
|
@@ -41,7 +41,7 @@ export interface Scoped<T> {
|
|
|
41
41
|
* and each use reads `cache()`. The copy is made lazily, so a runtime pays only for the modules
|
|
42
42
|
* it touches.
|
|
43
43
|
*/
|
|
44
|
-
export declare function scoped<T>(create: () => T): Scoped<T>;
|
|
44
|
+
export declare function scoped<T extends {}>(create: () => T): Scoped<T>;
|
|
45
45
|
/**
|
|
46
46
|
* Writes what a caller gave onto the settings in force, field by field, skipping what is unusable.
|
|
47
47
|
*
|
package/dist/tokens.d.ts
CHANGED
|
@@ -72,7 +72,7 @@ export declare function toolsChars(tools: OpenAI.ChatCompletionTool[]): number;
|
|
|
72
72
|
*
|
|
73
73
|
* @param body - The request as it was sent, tools included.
|
|
74
74
|
* @returns The sum of `messageChars` over the messages. The tools are not in it, whether or not
|
|
75
|
-
* the body carries them; `
|
|
75
|
+
* the body carries them; `contextChars` counts those, under `tools`.
|
|
76
76
|
*
|
|
77
77
|
* @remarks
|
|
78
78
|
* What calibration reads a reported prompt count against, since a ratio is only as good as the
|
|
@@ -132,7 +132,7 @@ export interface ContextBreakdown {
|
|
|
132
132
|
* that is neither that nor a `tool` message as `history`.
|
|
133
133
|
*
|
|
134
134
|
* @remarks
|
|
135
|
-
* Exact and additive: the parts sum to `total`, which is `requestChars` plus
|
|
135
|
+
* Exact and additive: the parts sum to `total`, which is `requestChars` plus the characters of the tools. The
|
|
136
136
|
* conversion to tokens is `contextTokens`' business, because that is where an estimate and a
|
|
137
137
|
* reported count have to be told apart.
|
|
138
138
|
*/
|
package/dist/tokens.js
CHANGED
|
@@ -180,7 +180,7 @@ export function toolsChars(tools) {
|
|
|
180
180
|
*
|
|
181
181
|
* @param body - The request as it was sent, tools included.
|
|
182
182
|
* @returns The sum of `messageChars` over the messages. The tools are not in it, whether or not
|
|
183
|
-
* the body carries them; `
|
|
183
|
+
* the body carries them; `contextChars` counts those, under `tools`.
|
|
184
184
|
*
|
|
185
185
|
* @remarks
|
|
186
186
|
* What calibration reads a reported prompt count against, since a ratio is only as good as the
|
|
@@ -232,7 +232,7 @@ const PARTS = ['system', 'tools', 'history', 'toolResults'];
|
|
|
232
232
|
* that is neither that nor a `tool` message as `history`.
|
|
233
233
|
*
|
|
234
234
|
* @remarks
|
|
235
|
-
* Exact and additive: the parts sum to `total`, which is `requestChars` plus
|
|
235
|
+
* Exact and additive: the parts sum to `total`, which is `requestChars` plus the characters of the tools. The
|
|
236
236
|
* conversion to tokens is `contextTokens`' business, because that is where an estimate and a
|
|
237
237
|
* reported count have to be told apart.
|
|
238
238
|
*/
|
package/llms.txt
CHANGED
|
@@ -90,7 +90,6 @@ Keeping a long run inside its window: stale tool results cleared, and the oldest
|
|
|
90
90
|
- `SUMMARY_LEAD` — How a summary message opens, which is also how `planCompaction` knows one from a system prompt.
|
|
91
91
|
- `SUMMARY_PROMPT` — The summariser's instruction when the caller gives none.
|
|
92
92
|
- `summariser` — A summariser that asks `model` with `SUMMARY_PROMPT`, for `compactTranscript`.
|
|
93
|
-
- `summaryInput` — What the summariser is handed for a plan: the earlier summary if there was one, then each message as its role and at most 4000 characters of its text.
|
|
94
93
|
|
|
95
94
|
### config
|
|
96
95
|
|
|
@@ -109,7 +108,6 @@ Picking up an answer the token ceiling cut off, instead of keeping half of it.
|
|
|
109
108
|
|
|
110
109
|
- `ContinueTurnOptions` (type) — What `continueTurn` takes besides what `runTurn` does.
|
|
111
110
|
- `continueTurn` — Carries on an answer the token ceiling cut off, by sending the transcript again with the answer so far as a trailing assistant message, and joins the pieces into one turn.
|
|
112
|
-
- `isContinuable` — Whether a turn is one a continuation can finish: cut off at the ceiling, with an answer begun and no tool call in it.
|
|
113
111
|
|
|
114
112
|
### errors
|
|
115
113
|
|
|
@@ -222,7 +220,6 @@ Everything about a request failing that is not about what the request said.
|
|
|
222
220
|
- `isOverflow` — Whether a refusal means the request was too big, rather than merely refused.
|
|
223
221
|
- `isTransient` — Whether a failed request is worth trying again.
|
|
224
222
|
- `SMALLEST_LIKELY_WINDOW` — The smallest window worth believing in, and the floor under `runTurn`'s guard.
|
|
225
|
-
- `sleep` — A delay an abort cuts short, rejecting rather than resolving early.
|
|
226
223
|
|
|
227
224
|
### run-calls
|
|
228
225
|
|
|
@@ -350,7 +347,6 @@ Telling a model's scratchpad from its answer when both arrive in `content`.
|
|
|
350
347
|
- `requestChars` — How many characters a request is worth: the walk `requestTokens` divides, without the division.
|
|
351
348
|
- `requestTokens` — What this request will cost the window, in tokens, near enough.
|
|
352
349
|
- `TokenEstimateOptions` (type) — What the two token estimates below take besides what they measure.
|
|
353
|
-
- `toolsChars` — How many characters a tool array is worth, measured once per array.
|
|
354
350
|
|
|
355
351
|
### tool-calls
|
|
356
352
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cubicecho/agent-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
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",
|