@cubicecho/agent-core 3.0.0 → 4.1.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 +34 -3
- package/dist/{compaction.d.ts → context/compaction.d.ts} +6 -6
- package/dist/{compaction.js → context/compaction.js} +9 -9
- package/dist/{ledger.d.ts → context/ledger.d.ts} +2 -2
- package/dist/{ledger.js → context/ledger.js} +3 -3
- package/dist/{guards.d.ts → core/guards.d.ts} +2 -3
- package/dist/{guards.js → core/guards.js} +1 -2
- package/dist/{scope.d.ts → core/scope.d.ts} +3 -3
- package/dist/{calibration.js → endpoint/calibration.js} +4 -4
- package/dist/{capabilities.d.ts → endpoint/capabilities.d.ts} +2 -2
- package/dist/{capabilities.js → endpoint/capabilities.js} +3 -3
- package/dist/{client.d.ts → endpoint/client.d.ts} +27 -11
- package/dist/{client.js → endpoint/client.js} +85 -26
- package/dist/{schema-compat.js → endpoint/schema-compat.js} +2 -2
- package/dist/{hooks.js → hooks/hooks.js} +6 -6
- package/dist/index.d.ts +30 -30
- package/dist/index.js +29 -29
- package/dist/{agent-loop.d.ts → run/agent-loop.d.ts} +25 -16
- package/dist/{agent-loop.js → run/agent-loop.js} +34 -25
- package/dist/{events.d.ts → run/events.d.ts} +3 -3
- package/dist/{events.js → run/events.js} +6 -6
- package/dist/{request-body.d.ts → run/request-body.d.ts} +3 -3
- package/dist/{request-body.js → run/request-body.js} +4 -4
- package/dist/{run-calls.d.ts → run/run-calls.d.ts} +3 -3
- package/dist/{run-calls.js → run/run-calls.js} +4 -4
- package/dist/{reset.js → runtime/reset.js} +6 -6
- package/dist/{runtime.d.ts → runtime/runtime.d.ts} +11 -11
- package/dist/{runtime.js → runtime/runtime.js} +12 -12
- package/dist/{snapshot.js → runtime/snapshot.js} +4 -4
- package/dist/{spec.d.ts → spec/spec.d.ts} +2 -2
- package/dist/{spec.js → spec/spec.js} +3 -3
- package/dist/{preselect.d.ts → tools/preselect.d.ts} +5 -4
- package/dist/{preselect.js → tools/preselect.js} +6 -5
- package/dist/{tool-loading.js → tools/tool-loading.js} +3 -3
- package/dist/{continuation.d.ts → turn/continuation.d.ts} +4 -4
- package/dist/{continuation.js → turn/continuation.js} +7 -7
- package/dist/{run-turn.d.ts → turn/run-turn.d.ts} +2 -2
- package/dist/{run-turn.js → turn/run-turn.js} +7 -7
- package/dist/{side-task.d.ts → turn/side-task.d.ts} +2 -2
- package/dist/{side-task.js → turn/side-task.js} +9 -9
- package/dist/{errors.d.ts → wire/errors.d.ts} +4 -0
- package/dist/{errors.js → wire/errors.js} +4 -0
- package/dist/{retry.d.ts → wire/retry.d.ts} +1 -1
- package/dist/{retry.js → wire/retry.js} +2 -2
- package/dist/{stream.js → wire/stream.js} +1 -1
- package/dist/{tokens.d.ts → wire/tokens.d.ts} +2 -2
- package/dist/{tokens.js → wire/tokens.js} +2 -2
- package/dist/{tool-calls.js → wire/tool-calls.js} +1 -1
- package/llms.txt +177 -179
- package/package.json +3 -3
- /package/dist/{config.d.ts → core/config.d.ts} +0 -0
- /package/dist/{config.js → core/config.js} +0 -0
- /package/dist/{digest.d.ts → core/digest.d.ts} +0 -0
- /package/dist/{digest.js → core/digest.js} +0 -0
- /package/dist/{platform.d.ts → core/platform.d.ts} +0 -0
- /package/dist/{platform.js → core/platform.js} +0 -0
- /package/dist/{scope.js → core/scope.js} +0 -0
- /package/dist/{calibration.d.ts → endpoint/calibration.d.ts} +0 -0
- /package/dist/{schema-compat.d.ts → endpoint/schema-compat.d.ts} +0 -0
- /package/dist/{hook-events.d.ts → hooks/hook-events.d.ts} +0 -0
- /package/dist/{hook-events.js → hooks/hook-events.js} +0 -0
- /package/dist/{hooks.d.ts → hooks/hooks.d.ts} +0 -0
- /package/dist/{reset.d.ts → runtime/reset.d.ts} +0 -0
- /package/dist/{snapshot.d.ts → runtime/snapshot.d.ts} +0 -0
- /package/dist/{catalog.d.ts → tools/catalog.d.ts} +0 -0
- /package/dist/{catalog.js → tools/catalog.js} +0 -0
- /package/dist/{tool-loading.d.ts → tools/tool-loading.d.ts} +0 -0
- /package/dist/{stream.d.ts → wire/stream.d.ts} +0 -0
- /package/dist/{thinking.d.ts → wire/thinking.d.ts} +0 -0
- /package/dist/{thinking.js → wire/thinking.js} +0 -0
- /package/dist/{tool-calls.d.ts → wire/tool-calls.d.ts} +0 -0
- /package/dist/{wire.d.ts → wire/wire.d.ts} +0 -0
- /package/dist/{wire.js → wire/wire.js} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -9,33 +9,33 @@
|
|
|
9
9
|
* prompts, and whatever the run is about — because that is the caller's, and it is the part
|
|
10
10
|
* that differs between one server and the next.
|
|
11
11
|
*/
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export { type
|
|
15
|
-
export
|
|
16
|
-
export { type
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
28
|
-
export {
|
|
29
|
-
export {
|
|
30
|
-
export { type
|
|
31
|
-
export {
|
|
32
|
-
export {
|
|
33
|
-
export { type
|
|
34
|
-
export {
|
|
35
|
-
export {
|
|
36
|
-
export {
|
|
37
|
-
export {
|
|
38
|
-
export {
|
|
39
|
-
export {
|
|
40
|
-
export {
|
|
41
|
-
export { FinishReason, FUNCTION_TOOL, JSON_SCHEMA_FORMAT, PartType, Role, SchemaType } from './wire.ts';
|
|
12
|
+
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 './context/compaction.ts';
|
|
13
|
+
export { estimateFrom, type LedgerEntry, type LedgerEstimateOptions, type LedgerRequest, rebaseLedger, recordRequest, type TokenLedger, tokensBetween, } from './context/ledger.ts';
|
|
14
|
+
export { type AgentConfig, type Endpoint, type ModelParams, type RetryPolicy, ToolDiscovery, type ToolPolicy, } from './core/config.ts';
|
|
15
|
+
export { calibrate, charsPerTokenFor, resetCalibration } from './endpoint/calibration.ts';
|
|
16
|
+
export { type Capabilities, capabilitiesFor, EFFORT_LADDER, EFFORT_NONE, EFFORT_OFF, effortFor, expireCapabilities, type ModelCapabilities, modelCapabilitiesFor, type NegotiateOptions, negotiate, resetCapabilities, } from './endpoint/capabilities.ts';
|
|
17
|
+
export { type ClientPoolOptions, configureClients, contextLimitFor, endpointId, endpointKey, firstTokenMs, getClient, type LookupOptions, listModels, type ModelInfo, NO_KEY, resetClients, resolveApiKey, servedWindow, timeoutMs, } from './endpoint/client.ts';
|
|
18
|
+
export { isGrammarError, relaxSchema, relaxTools, sanitizeSchema, sanitizeTools, } from './endpoint/schema-compat.ts';
|
|
19
|
+
export { HOOK_EVENTS, HookEvent, INJECT_EVENTS } from './hooks/hook-events.ts';
|
|
20
|
+
export { assembleContext, configureHooks, consult, type Gathered, gather, HOOK_CONTEXT_TOKENS, HOOK_PREFACE, type HookContext, type HookMessage, type HookNote, type HookOptions, type HookOutcome, type HookRunner, notify, resetHooks, turnIndex, turnMessages, UNTRUSTED_PREFACE, untrusted, withContext, } from './hooks/hooks.ts';
|
|
21
|
+
export { type AgentLoopHooks, type AgentLoopOptions, type AgentLoopRequest, type AgentLoopResult, PRESELECT_APPEND, PRESELECT_EXCLUSIVE, PRESELECTED_NOTICE, runAgentLoop, type StepWindow, } from './run/agent-loop.ts';
|
|
22
|
+
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 './run/events.ts';
|
|
23
|
+
export { buildBody } from './run/request-body.ts';
|
|
24
|
+
export { preview } from './run/run-calls.ts';
|
|
25
|
+
export { resetAll } from './runtime/reset.ts';
|
|
26
|
+
export { createRuntime, defaultRuntime, type Runtime, type RuntimeOptions } from './runtime/runtime.ts';
|
|
27
|
+
export { CAPABILITY_SNAPSHOT_VERSION, type CapabilitySnapshot, type EndpointSnapshot, exportCapabilities, importCapabilities, type ModelSnapshot, } from './runtime/snapshot.ts';
|
|
28
|
+
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/spec.ts';
|
|
29
|
+
export type { CatalogServer } from './tools/catalog.ts';
|
|
30
|
+
export { type KeywordPreselection, type KeywordPreselectOptions, PRESELECT_SCHEMA, PRESELECT_SYSTEM, preselect, preselectByKeywords, preselectInput, preselection, preselectSystem, type ToolMatch, } from './tools/preselect.ts';
|
|
31
|
+
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 './tools/tool-loading.ts';
|
|
32
|
+
export { type ContinueTurnOptions, continueTurn, } from './turn/continuation.ts';
|
|
33
|
+
export { type RunTurnOptions, runTurn } from './turn/run-turn.ts';
|
|
34
|
+
export { type AskJsonOptions, ask, askJson, clean, listLines, parseJson, resetHints, type SideTask, type SideTaskInput, type SideTaskOptions, taskCall, tryAsk, } from './turn/side-task.ts';
|
|
35
|
+
export { AgentLoopError, type AgentLoopFailure, AgentLoopOverflow, errorMessage, failedRun, ToolIterationLimit, } from './wire/errors.ts';
|
|
36
|
+
export { backoffMs, ContextOverflow, EndpointSilent, isModelLoading, isOverflow, isTransient, SMALLEST_LIKELY_WINDOW, } from './wire/retry.ts';
|
|
37
|
+
export { CacheBreakReason, type Produced, type StreamTurnOptions, streamTurn, type Turn, type TurnUsage, } from './wire/stream.ts';
|
|
38
|
+
export { ALL_FENCES, DEFAULT_FENCES, type Fence, FenceSplitter, type FenceSplitterOptions, SPLIT_OUTPUT, SPLIT_REASONING, type Split, stripThinking, THINK_FENCE, } from './wire/thinking.ts';
|
|
39
|
+
export { type ContextBreakdown, type ContextBreakdownOptions, compact, contextChars, contextTokens, estimateTokens, messageTokens, requestChars, requestTokens, type TokenEstimateOptions, } from './wire/tokens.ts';
|
|
40
|
+
export { ARGUMENTS_MALFORMED, ARGUMENTS_TRUNCATED, parseToolArguments, recoverToolCalls, ToolArgumentsError, type ToolCall, type ToolCallOutcome, type ToolCallRequest, type ToolCallResult, } from './wire/tool-calls.ts';
|
|
41
|
+
export { FinishReason, FUNCTION_TOOL, JSON_SCHEMA_FORMAT, PartType, Role, SchemaType } from './wire/wire.ts';
|
package/dist/index.js
CHANGED
|
@@ -9,32 +9,32 @@
|
|
|
9
9
|
* prompts, and whatever the run is about — because that is the caller's, and it is the part
|
|
10
10
|
* that differs between one server and the next.
|
|
11
11
|
*/
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
28
|
-
export {
|
|
29
|
-
export {
|
|
30
|
-
export {
|
|
31
|
-
export {
|
|
32
|
-
export {
|
|
33
|
-
export {
|
|
34
|
-
export {
|
|
35
|
-
export {
|
|
36
|
-
export {
|
|
37
|
-
export {
|
|
38
|
-
export {
|
|
39
|
-
export {
|
|
40
|
-
export { FinishReason, FUNCTION_TOOL, JSON_SCHEMA_FORMAT, PartType, Role, SchemaType } from './wire.js';
|
|
12
|
+
export { applyCompaction, COMPACT_AT, compactTranscript, KEEP_RATIO, planCompaction, pruneToolResults, requestIndex, runCompaction, SUMMARY_LEAD, SUMMARY_PROMPT, summariser, } from './context/compaction.js';
|
|
13
|
+
export { estimateFrom, rebaseLedger, recordRequest, tokensBetween, } from './context/ledger.js';
|
|
14
|
+
export { ToolDiscovery, } from './core/config.js';
|
|
15
|
+
export { calibrate, charsPerTokenFor, resetCalibration } from './endpoint/calibration.js';
|
|
16
|
+
export { capabilitiesFor, EFFORT_LADDER, EFFORT_NONE, EFFORT_OFF, effortFor, expireCapabilities, modelCapabilitiesFor, negotiate, resetCapabilities, } from './endpoint/capabilities.js';
|
|
17
|
+
export { configureClients, contextLimitFor, endpointId, endpointKey, firstTokenMs, getClient, listModels, NO_KEY, resetClients, resolveApiKey, servedWindow, timeoutMs, } from './endpoint/client.js';
|
|
18
|
+
export { isGrammarError, relaxSchema, relaxTools, sanitizeSchema, sanitizeTools, } from './endpoint/schema-compat.js';
|
|
19
|
+
export { HOOK_EVENTS, HookEvent, INJECT_EVENTS } from './hooks/hook-events.js';
|
|
20
|
+
export { assembleContext, configureHooks, consult, gather, HOOK_CONTEXT_TOKENS, HOOK_PREFACE, notify, resetHooks, turnIndex, turnMessages, UNTRUSTED_PREFACE, untrusted, withContext, } from './hooks/hooks.js';
|
|
21
|
+
export { PRESELECT_APPEND, PRESELECT_EXCLUSIVE, PRESELECTED_NOTICE, runAgentLoop, } from './run/agent-loop.js';
|
|
22
|
+
export { configureEvents, emit, endRun, fold, history, RunEventKind, RunOutcome, resetEvents, runMetrics, watch, } from './run/events.js';
|
|
23
|
+
export { buildBody } from './run/request-body.js';
|
|
24
|
+
export { preview } from './run/run-calls.js';
|
|
25
|
+
export { resetAll } from './runtime/reset.js';
|
|
26
|
+
export { createRuntime, defaultRuntime } from './runtime/runtime.js';
|
|
27
|
+
export { CAPABILITY_SNAPSHOT_VERSION, exportCapabilities, importCapabilities, } from './runtime/snapshot.js';
|
|
28
|
+
export { AGENT_SPEC, AGENT_SPEC_VERSION, AGENT_TASKS, exportSpec, parseSpec, REF_FILE, REF_URL, RESOLVED_DEFAULTS, resolveAgentSpec, SPEC_EVENTS, } from './spec/spec.js';
|
|
29
|
+
export { PRESELECT_SCHEMA, PRESELECT_SYSTEM, preselect, preselectByKeywords, preselectInput, preselection, preselectSystem, } from './tools/preselect.js';
|
|
30
|
+
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 './tools/tool-loading.js';
|
|
31
|
+
export { continueTurn, } from './turn/continuation.js';
|
|
32
|
+
export { runTurn } from './turn/run-turn.js';
|
|
33
|
+
export { ask, askJson, clean, listLines, parseJson, resetHints, taskCall, tryAsk, } from './turn/side-task.js';
|
|
34
|
+
export { AgentLoopError, AgentLoopOverflow, errorMessage, failedRun, ToolIterationLimit, } from './wire/errors.js';
|
|
35
|
+
export { backoffMs, ContextOverflow, EndpointSilent, isModelLoading, isOverflow, isTransient, SMALLEST_LIKELY_WINDOW, } from './wire/retry.js';
|
|
36
|
+
export { CacheBreakReason, streamTurn, } from './wire/stream.js';
|
|
37
|
+
export { ALL_FENCES, DEFAULT_FENCES, FenceSplitter, SPLIT_OUTPUT, SPLIT_REASONING, stripThinking, THINK_FENCE, } from './wire/thinking.js';
|
|
38
|
+
export { compact, contextChars, contextTokens, estimateTokens, messageTokens, requestChars, requestTokens, } from './wire/tokens.js';
|
|
39
|
+
export { ARGUMENTS_MALFORMED, ARGUMENTS_TRUNCATED, parseToolArguments, recoverToolCalls, ToolArgumentsError, } from './wire/tool-calls.js';
|
|
40
|
+
export { FinishReason, FUNCTION_TOOL, JSON_SCHEMA_FORMAT, PartType, Role, SchemaType } from './wire/wire.js';
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type OpenAI from 'openai';
|
|
2
|
-
import type
|
|
3
|
-
import { type
|
|
4
|
-
import type { Endpoint, ModelParams, RetryPolicy, ToolPolicy } from '
|
|
2
|
+
import { type CompactionOptions } from '../context/compaction.ts';
|
|
3
|
+
import { type TokenLedger } from '../context/ledger.ts';
|
|
4
|
+
import type { Endpoint, ModelParams, RetryPolicy, ToolPolicy } from '../core/config.ts';
|
|
5
|
+
import { HookEvent } from '../hooks/hook-events.ts';
|
|
6
|
+
import { type HookContext, type HookNote, type HookRunner, type OnNote } from '../hooks/hooks.ts';
|
|
7
|
+
import type { CatalogServer } from '../tools/catalog.ts';
|
|
8
|
+
import { type KeywordPreselectOptions } from '../tools/preselect.ts';
|
|
9
|
+
import { type ToolOrder } from '../tools/tool-loading.ts';
|
|
10
|
+
import { type SideTask } from '../turn/side-task.ts';
|
|
11
|
+
import { type Turn, type TurnUsage } from '../wire/stream.ts';
|
|
12
|
+
import { type ToolCallOutcome, type ToolCallRequest, type ToolCallResult } from '../wire/tool-calls.ts';
|
|
5
13
|
import { type RunEventInput, type RunMetrics } from './events.ts';
|
|
6
|
-
import { HookEvent } from './hook-events.ts';
|
|
7
|
-
import { type HookContext, type HookNote, type HookRunner, type OnNote } from './hooks.ts';
|
|
8
|
-
import { type TokenLedger } from './ledger.ts';
|
|
9
|
-
import { type KeywordPreselectOptions } from './preselect.ts';
|
|
10
14
|
import { type ToolDispatch } from './run-calls.ts';
|
|
11
|
-
import { type SideTask } from './side-task.ts';
|
|
12
|
-
import { type Turn, type TurnUsage } from './stream.ts';
|
|
13
|
-
import { type ToolCallOutcome, type ToolCallRequest, type ToolCallResult } from './tool-calls.ts';
|
|
14
|
-
import { type ToolOrder } from './tool-loading.ts';
|
|
15
15
|
/**
|
|
16
16
|
* The loop above a turn: send, run the tools the model asked for, send again, until it stops
|
|
17
17
|
* asking.
|
|
@@ -181,7 +181,9 @@ export interface AgentLoopOptions {
|
|
|
181
181
|
*
|
|
182
182
|
* `true` takes `preselect`'s defaults; an object passes `keywords` and `maxPerLoad` through.
|
|
183
183
|
* Its notices arrive as `notice` events, and a preselection that fails picks nothing rather
|
|
184
|
-
* than ending the run.
|
|
184
|
+
* than ending the run. What it picked is a notice too, `PRESELECTED_NOTICE` and the names,
|
|
185
|
+
* before the first `turn` event, and is the result's `preselected`. It runs before the hooks
|
|
186
|
+
* gather, not beside them.
|
|
185
187
|
*/
|
|
186
188
|
preselect?: boolean | {
|
|
187
189
|
keywords?: boolean | KeywordPreselectOptions;
|
|
@@ -352,6 +354,11 @@ export interface AgentLoopResult {
|
|
|
352
354
|
loaded: string[];
|
|
353
355
|
/** The tools the model actually called, `load_tools` excluded and `call_tool` looked through. */
|
|
354
356
|
used: string[];
|
|
357
|
+
/**
|
|
358
|
+
* The shortlist the run opened with, as the host's `preselected` gave it or the loop's own
|
|
359
|
+
* preselection picked it. Empty in eager mode, and where nothing was picked.
|
|
360
|
+
*/
|
|
361
|
+
preselected: string[];
|
|
355
362
|
/** The hooks' notes from before the first request. */
|
|
356
363
|
notes: HookNote[];
|
|
357
364
|
/**
|
|
@@ -400,10 +407,10 @@ export interface AgentLoopResult {
|
|
|
400
407
|
* and the ledger. See `AgentLoopResult`.
|
|
401
408
|
*
|
|
402
409
|
* @remarks
|
|
403
|
-
* What it throws carries the run as it stood — `messages`, `usage`, `toolCalls`, `loaded`
|
|
404
|
-
* `
|
|
405
|
-
* has nothing else to store them from. A spent budget is a `ToolIterationLimit`, an
|
|
406
|
-
* an `AgentLoopOverflow`, which is still a `ContextOverflow`, and anything else is an
|
|
410
|
+
* What it throws carries the run as it stood — `messages`, `usage`, `toolCalls`, `loaded`, `used`
|
|
411
|
+
* and `preselected` — because the steps before a failure were real and a host that stores its
|
|
412
|
+
* transcript has nothing else to store them from. A spent budget is a `ToolIterationLimit`, an
|
|
413
|
+
* overflow is an `AgentLoopOverflow`, which is still a `ContextOverflow`, and anything else is an
|
|
407
414
|
* `AgentLoopError` with what was caught as its `cause` and its message as its own; `failedRun`
|
|
408
415
|
* reads the run off any of the three. A failure while a step's tools run leaves the transcript
|
|
409
416
|
* well-formed: the results that came back are kept, and each call without one is answered with a
|
|
@@ -439,3 +446,5 @@ export interface AgentLoopResult {
|
|
|
439
446
|
* run's `temperature` or `maxTokens`.
|
|
440
447
|
*/
|
|
441
448
|
export declare function runAgentLoop(options: AgentLoopOptions): Promise<AgentLoopResult>;
|
|
449
|
+
/** What opens the notice naming the loop's own picks, ahead of the names. */
|
|
450
|
+
export declare const PRESELECTED_NOTICE = "tools picked before the run: ";
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { compactTranscript, planCompaction, summariser } from '../context/compaction.js';
|
|
2
|
+
import { breakReason, rebaseLedger, recordRequest, } from '../context/ledger.js';
|
|
3
|
+
import { ToolDiscovery } from '../core/config.js';
|
|
4
|
+
import { counted } from '../core/guards.js';
|
|
5
|
+
import { charsPerTokenFor } from '../endpoint/calibration.js';
|
|
6
|
+
import { capabilitiesFor, modelCapabilitiesFor, } from '../endpoint/capabilities.js';
|
|
7
|
+
import { firstTokenMs, getClient, loadingMs, timeoutMs } from '../endpoint/client.js';
|
|
8
|
+
import { HookEvent } from '../hooks/hook-events.js';
|
|
9
|
+
import { configureHooks, gather, notify, turnIndex, turnMessages, withContext, } from '../hooks/hooks.js';
|
|
10
|
+
import { preselect } from '../tools/preselect.js';
|
|
11
|
+
import { CALL_TOOL, catalogPrompt, inCatalog, LOAD_TOOLS, LOAD_TOOLS_DEFINITION, loadedTools, orderTools, PROXY_TOOLS, proxyCatalogPrompt, toolName, } from '../tools/tool-loading.js';
|
|
12
|
+
import { continueTurn } from '../turn/continuation.js';
|
|
13
|
+
import { runTurn } from '../turn/run-turn.js';
|
|
14
|
+
import { taskCall, tryAsk } from '../turn/side-task.js';
|
|
15
|
+
import { AgentLoopError, AgentLoopOverflow, errorMessage, ToolIterationLimit, } from '../wire/errors.js';
|
|
16
|
+
import { ContextOverflow } from '../wire/retry.js';
|
|
17
|
+
import { addCounts, noUsage } from '../wire/stream.js';
|
|
18
|
+
import { contextTokens, toolsChars } from '../wire/tokens.js';
|
|
19
|
+
import { recoverToolCalls, } from '../wire/tool-calls.js';
|
|
20
|
+
import { FinishReason, PartType, Role } from '../wire/wire.js';
|
|
8
21
|
import { RunEventKind, RunOutcome, runMetrics, stamp, } from './events.js';
|
|
9
|
-
import { counted } from './guards.js';
|
|
10
|
-
import { HookEvent } from './hook-events.js';
|
|
11
|
-
import { configureHooks, gather, notify, turnIndex, turnMessages, withContext, } from './hooks.js';
|
|
12
|
-
import { breakReason, rebaseLedger, recordRequest, } from './ledger.js';
|
|
13
|
-
import { preselect } from './preselect.js';
|
|
14
22
|
import { buildBody } from './request-body.js';
|
|
15
|
-
import { ContextOverflow } from './retry.js';
|
|
16
23
|
import { assistantMessage, definedAs, loadShortlist, readCalls, runCalls, } from './run-calls.js';
|
|
17
|
-
import { runTurn } from './run-turn.js';
|
|
18
|
-
import { taskCall, tryAsk } from './side-task.js';
|
|
19
|
-
import { addCounts, noUsage } from './stream.js';
|
|
20
|
-
import { contextTokens, toolsChars } from './tokens.js';
|
|
21
|
-
import { recoverToolCalls, } from './tool-calls.js';
|
|
22
|
-
import { CALL_TOOL, catalogPrompt, inCatalog, LOAD_TOOLS, LOAD_TOOLS_DEFINITION, loadedTools, orderTools, PROXY_TOOLS, proxyCatalogPrompt, toolName, } from './tool-loading.js';
|
|
23
|
-
import { FinishReason, PartType, Role } from './wire.js';
|
|
24
24
|
/** The `preselectRouting` that sends the first step the shortlist alone. */
|
|
25
25
|
export const PRESELECT_EXCLUSIVE = 'exclusive';
|
|
26
26
|
/** The `preselectRouting` that loads the shortlist after what was carried, and sends the first step like any other. */
|
|
@@ -71,10 +71,10 @@ function cacheDiagnosis(previous, next, usage) {
|
|
|
71
71
|
* and the ledger. See `AgentLoopResult`.
|
|
72
72
|
*
|
|
73
73
|
* @remarks
|
|
74
|
-
* What it throws carries the run as it stood — `messages`, `usage`, `toolCalls`, `loaded`
|
|
75
|
-
* `
|
|
76
|
-
* has nothing else to store them from. A spent budget is a `ToolIterationLimit`, an
|
|
77
|
-
* an `AgentLoopOverflow`, which is still a `ContextOverflow`, and anything else is an
|
|
74
|
+
* What it throws carries the run as it stood — `messages`, `usage`, `toolCalls`, `loaded`, `used`
|
|
75
|
+
* and `preselected` — because the steps before a failure were real and a host that stores its
|
|
76
|
+
* transcript has nothing else to store them from. A spent budget is a `ToolIterationLimit`, an
|
|
77
|
+
* overflow is an `AgentLoopOverflow`, which is still a `ContextOverflow`, and anything else is an
|
|
78
78
|
* `AgentLoopError` with what was caught as its `cause` and its message as its own; `failedRun`
|
|
79
79
|
* reads the run off any of the three. A failure while a step's tools run leaves the transcript
|
|
80
80
|
* well-formed: the results that came back are kept, and each call without one is answered with a
|
|
@@ -118,6 +118,7 @@ export async function runAgentLoop(options) {
|
|
|
118
118
|
toolCalls: [],
|
|
119
119
|
loaded: [],
|
|
120
120
|
used: [],
|
|
121
|
+
preselected: [],
|
|
121
122
|
}),
|
|
122
123
|
};
|
|
123
124
|
let result;
|
|
@@ -285,6 +286,8 @@ function recorder(heard) {
|
|
|
285
286
|
};
|
|
286
287
|
return { recorded, onEvent };
|
|
287
288
|
}
|
|
289
|
+
/** What opens the notice naming the loop's own picks, ahead of the names. */
|
|
290
|
+
export const PRESELECTED_NOTICE = 'tools picked before the run: ';
|
|
288
291
|
/**
|
|
289
292
|
* How this run finds its tools, and what it starts with in hand: the loop's own preselection
|
|
290
293
|
* where it was asked for and the host has not already decided, and what an earlier question
|
|
@@ -292,7 +295,8 @@ function recorder(heard) {
|
|
|
292
295
|
*
|
|
293
296
|
* @param options - The run's options. Read for the discovery mode, the catalogue, `loaded`,
|
|
294
297
|
* `preselected` and `preselect`.
|
|
295
|
-
* @param notice - Hears what the loop's own preselection has to say
|
|
298
|
+
* @param notice - Hears what the loop's own preselection has to say, and then what it picked,
|
|
299
|
+
* by name. A shortlist the host gave is not told back to it.
|
|
296
300
|
* @returns `proxied` and `onDemand`, the second true of both modes and both false where `catalog`
|
|
297
301
|
* is empty; `preselected`, the shortlist, empty in eager mode; and `loaded`, a new set of what was
|
|
298
302
|
* carried and then the shortlist — empty when eager or proxied.
|
|
@@ -309,6 +313,9 @@ async function discovery(options, notice) {
|
|
|
309
313
|
let preselected = [];
|
|
310
314
|
if (onDemand && chooses) {
|
|
311
315
|
preselected = await chooseTools(options, notice);
|
|
316
|
+
if (preselected.length > 0) {
|
|
317
|
+
notice(`${PRESELECTED_NOTICE}${preselected.join(', ')}`);
|
|
318
|
+
}
|
|
312
319
|
}
|
|
313
320
|
else if (onDemand) {
|
|
314
321
|
preselected = [...(options.preselected ?? [])];
|
|
@@ -450,6 +457,7 @@ async function runSteps(options, standing) {
|
|
|
450
457
|
// As the result would have said it: proxied, nothing is loaded that the history does not hold.
|
|
451
458
|
loaded: proxied ? [] : [...loaded],
|
|
452
459
|
used: [...used],
|
|
460
|
+
preselected: [...preselected],
|
|
453
461
|
});
|
|
454
462
|
const announce = announcer(onMessage);
|
|
455
463
|
// Held by reference rather than by index, so a `beforeStep` that folds the head into a summary
|
|
@@ -639,6 +647,7 @@ async function runSteps(options, standing) {
|
|
|
639
647
|
toolCalls,
|
|
640
648
|
loaded: proxied ? [] : [...loaded],
|
|
641
649
|
used: [...used],
|
|
650
|
+
preselected: [...preselected],
|
|
642
651
|
notes: gathered.notes,
|
|
643
652
|
context: gathered.context,
|
|
644
653
|
preface,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { TokenLedger } from '
|
|
2
|
-
import type { TurnUsage } from '
|
|
3
|
-
import { CacheBreakReason } from '
|
|
1
|
+
import type { TokenLedger } from '../context/ledger.ts';
|
|
2
|
+
import type { TurnUsage } from '../wire/stream.ts';
|
|
3
|
+
import { CacheBreakReason } from '../wire/stream.ts';
|
|
4
4
|
/**
|
|
5
5
|
* What a run is doing, while it is doing it.
|
|
6
6
|
*
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { getOrCreate } from '
|
|
2
|
-
import { ABORT_EVENT, MS_PER_MINUTE } from '
|
|
3
|
-
import { assignSettings, scoped } from '
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { FinishReason } from '
|
|
1
|
+
import { getOrCreate } from '../core/guards.js';
|
|
2
|
+
import { ABORT_EVENT, MS_PER_MINUTE } from '../core/platform.js';
|
|
3
|
+
import { assignSettings, scoped } from '../core/scope.js';
|
|
4
|
+
import { LOAD_TOOLS } from '../tools/tool-loading.js';
|
|
5
|
+
import { CacheBreakReason } from '../wire/stream.js';
|
|
6
|
+
import { FinishReason } from '../wire/wire.js';
|
|
7
7
|
/** How many minutes an unended run's events are kept, absent a `retainUnendedMs`. */
|
|
8
8
|
const RETAIN_UNENDED_MINUTES = 30;
|
|
9
9
|
/** The numbers a run of the shape this bus was written for wants. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type OpenAI from 'openai';
|
|
2
|
-
import { type
|
|
3
|
-
import { type
|
|
4
|
-
import { type ToolOrder } from '
|
|
2
|
+
import { type ModelParams } from '../core/config.ts';
|
|
3
|
+
import { type Capabilities, type ModelCapabilities } from '../endpoint/capabilities.ts';
|
|
4
|
+
import { type ToolOrder } from '../tools/tool-loading.ts';
|
|
5
5
|
/**
|
|
6
6
|
* The one place a streamed request's body is decided from a config and what the endpoint and
|
|
7
7
|
* the model have refused.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { relaxTools, sanitizeTools } from '
|
|
4
|
-
import { orderTools } from '
|
|
1
|
+
import { RESERVED_BODY_FIELDS } from '../core/config.js';
|
|
2
|
+
import { ceilingAndTemperature, effortFor, } from '../endpoint/capabilities.js';
|
|
3
|
+
import { relaxTools, sanitizeTools } from '../endpoint/schema-compat.js';
|
|
4
|
+
import { orderTools } from '../tools/tool-loading.js';
|
|
5
5
|
/**
|
|
6
6
|
* The one place a streamed request's body is decided from a config and what the endpoint and
|
|
7
7
|
* the model have refused.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type OpenAI from 'openai';
|
|
2
|
-
import type { CatalogServer } from '
|
|
2
|
+
import type { CatalogServer } from '../tools/catalog.ts';
|
|
3
|
+
import type { Turn } from '../wire/stream.ts';
|
|
4
|
+
import { type ToolCall, type ToolCallOutcome, type ToolCallRequest, type ToolCallResult } from '../wire/tool-calls.ts';
|
|
3
5
|
import type { RunEventInput } from './events.ts';
|
|
4
|
-
import type { Turn } from './stream.ts';
|
|
5
|
-
import { type ToolCall, type ToolCallOutcome, type ToolCallRequest, type ToolCallResult } from './tool-calls.ts';
|
|
6
6
|
/**
|
|
7
7
|
* The tools between two turns: a step's calls read, run and written into the transcript.
|
|
8
8
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CALL_TOOL, expandNames, inCatalog, LOAD_TOOLS, loadResult, proxiedCall, proxyLoadResult, requestedNames, shownCall, toolName, } from '../tools/tool-loading.js';
|
|
2
|
+
import { errorMessage } from '../wire/errors.js';
|
|
3
|
+
import { parseToolArguments, } from '../wire/tool-calls.js';
|
|
4
|
+
import { FUNCTION_TOOL, Role } from '../wire/wire.js';
|
|
2
5
|
import { RunEventKind } from './events.js';
|
|
3
|
-
import { parseToolArguments, } from './tool-calls.js';
|
|
4
|
-
import { CALL_TOOL, expandNames, inCatalog, LOAD_TOOLS, loadResult, proxiedCall, proxyLoadResult, requestedNames, shownCall, toolName, } from './tool-loading.js';
|
|
5
|
-
import { FUNCTION_TOOL, Role } from './wire.js';
|
|
6
6
|
/**
|
|
7
7
|
* The tools between two turns: a step's calls read, run and written into the transcript.
|
|
8
8
|
*
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { resetCalibration } from '
|
|
2
|
-
import { resetCapabilities } from '
|
|
3
|
-
import { resetClients } from '
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { resetHints } from '
|
|
1
|
+
import { resetCalibration } from '../endpoint/calibration.js';
|
|
2
|
+
import { resetCapabilities } from '../endpoint/capabilities.js';
|
|
3
|
+
import { resetClients } from '../endpoint/client.js';
|
|
4
|
+
import { resetHooks } from '../hooks/hooks.js';
|
|
5
|
+
import { resetEvents } from '../run/events.js';
|
|
6
|
+
import { resetHints } from '../turn/side-task.js';
|
|
7
7
|
/**
|
|
8
8
|
* Forgets everything this package remembers between calls.
|
|
9
9
|
*
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { calibrate, charsPerTokenFor, resetCalibration } from '
|
|
3
|
-
import { capabilitiesFor, expireCapabilities, resetCapabilities } from '
|
|
4
|
-
import { type ClientPoolOptions, configureClients, contextLimitFor, getClient, listModels, resetClients, servedWindow } from '
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { configureEvents, type EventBusOptions, emit, endRun, history, resetEvents, watch } from '
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { compactTranscript, runCompaction, summariser } from '../context/compaction.ts';
|
|
2
|
+
import { calibrate, charsPerTokenFor, resetCalibration } from '../endpoint/calibration.ts';
|
|
3
|
+
import { capabilitiesFor, expireCapabilities, resetCapabilities } from '../endpoint/capabilities.ts';
|
|
4
|
+
import { type ClientPoolOptions, configureClients, contextLimitFor, getClient, listModels, resetClients, servedWindow } from '../endpoint/client.ts';
|
|
5
|
+
import { assembleContext, configureHooks, consult, gather, type HookOptions, notify, resetHooks, withContext } from '../hooks/hooks.ts';
|
|
6
|
+
import { runAgentLoop } from '../run/agent-loop.ts';
|
|
7
|
+
import { configureEvents, type EventBusOptions, emit, endRun, history, resetEvents, watch } from '../run/events.ts';
|
|
8
|
+
import { preselect } from '../tools/preselect.ts';
|
|
9
|
+
import { continueTurn } from '../turn/continuation.ts';
|
|
10
|
+
import { runTurn } from '../turn/run-turn.ts';
|
|
11
|
+
import { ask, askJson, resetHints, tryAsk } from '../turn/side-task.ts';
|
|
10
12
|
import { resetAll } from './reset.ts';
|
|
11
|
-
import { runTurn } from './run-turn.ts';
|
|
12
|
-
import { ask, askJson, resetHints, tryAsk } from './side-task.ts';
|
|
13
13
|
import { exportCapabilities, importCapabilities } from './snapshot.ts';
|
|
14
14
|
/**
|
|
15
15
|
* Every exported function that reads or writes what a runtime remembers, itself or through what
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { preselect } from '
|
|
1
|
+
import { compactTranscript, runCompaction, summariser } from '../context/compaction.js';
|
|
2
|
+
import { inScope, rootScope } from '../core/scope.js';
|
|
3
|
+
import { calibrate, charsPerTokenFor, resetCalibration } from '../endpoint/calibration.js';
|
|
4
|
+
import { capabilitiesFor, expireCapabilities, resetCapabilities } from '../endpoint/capabilities.js';
|
|
5
|
+
import { configureClients, contextLimitFor, getClient, listModels, resetClients, servedWindow, } from '../endpoint/client.js';
|
|
6
|
+
import { assembleContext, configureHooks, consult, gather, notify, resetHooks, withContext, } from '../hooks/hooks.js';
|
|
7
|
+
import { runAgentLoop } from '../run/agent-loop.js';
|
|
8
|
+
import { configureEvents, emit, endRun, history, resetEvents, watch } from '../run/events.js';
|
|
9
|
+
import { preselect } from '../tools/preselect.js';
|
|
10
|
+
import { continueTurn } from '../turn/continuation.js';
|
|
11
|
+
import { runTurn } from '../turn/run-turn.js';
|
|
12
|
+
import { ask, askJson, resetHints, tryAsk } from '../turn/side-task.js';
|
|
10
13
|
import { resetAll } from './reset.js';
|
|
11
|
-
import { runTurn } from './run-turn.js';
|
|
12
|
-
import { inScope, rootScope } from './scope.js';
|
|
13
|
-
import { ask, askJson, resetHints, tryAsk } from './side-task.js';
|
|
14
14
|
import { exportCapabilities, importCapabilities } from './snapshot.js';
|
|
15
15
|
/**
|
|
16
16
|
* Every exported function that reads or writes what a runtime remembers, itself or through what
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { refusedHints } from '
|
|
1
|
+
import { isRecord } from '../core/guards.js';
|
|
2
|
+
import { capabilitiesById, knownCapabilities, MODEL_FLAGS, modelCapabilitiesFor, OPTIMISTIC_MODEL, } from '../endpoint/capabilities.js';
|
|
3
|
+
import { modelKey } from '../endpoint/client.js';
|
|
4
|
+
import { refusedHints } from '../turn/side-task.js';
|
|
5
5
|
/**
|
|
6
6
|
* What endpoints and models refused, carried across a restart.
|
|
7
7
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type AgentConfig, type Endpoint } from '
|
|
2
|
-
import { HookEvent } from '
|
|
1
|
+
import { type AgentConfig, type Endpoint } from '../core/config.ts';
|
|
2
|
+
import { HookEvent } from '../hooks/hook-events.ts';
|
|
3
3
|
/**
|
|
4
4
|
* A JSON document that defines an agent, and the rules for reading one.
|
|
5
5
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { RESERVED_BODY_FIELDS, ToolDiscovery } from '
|
|
2
|
-
import { isRecord } from '
|
|
3
|
-
import { HOOK_EVENTS, HookEvent, INJECT_EVENTS } from '
|
|
1
|
+
import { RESERVED_BODY_FIELDS, ToolDiscovery } from '../core/config.js';
|
|
2
|
+
import { isRecord } from '../core/guards.js';
|
|
3
|
+
import { HOOK_EVENTS, HookEvent, INJECT_EVENTS } from '../hooks/hook-events.js';
|
|
4
4
|
/**
|
|
5
5
|
* A JSON document that defines an agent, and the rules for reading one.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Endpoint } from '../core/config.ts';
|
|
2
|
+
import type { OnNotice } from '../endpoint/capabilities.ts';
|
|
2
3
|
import type { CatalogServer } from './catalog.ts';
|
|
3
|
-
import type { Endpoint } from './config.ts';
|
|
4
4
|
/**
|
|
5
5
|
* The system prompt a preselector is given, holding it to the cap its answer will be held to.
|
|
6
6
|
*
|
|
@@ -176,8 +176,9 @@ export interface PreselectOptions {
|
|
|
176
176
|
* The tools a request is likely to need, picked by a small model before the run starts, or none.
|
|
177
177
|
*
|
|
178
178
|
* @param config - The endpoint the preselector is reached through.
|
|
179
|
-
* @param model - The preselector. An empty name picks nothing, which is what
|
|
180
|
-
* means by empty
|
|
179
|
+
* @param model - The preselector. An empty name picks nothing, silently, which is what
|
|
180
|
+
* `toolSelectModel` means by empty: a host whose settings read `""` as "the run's model" passes
|
|
181
|
+
* `toolSelectModel: settings.toolSelectModel || settings.model`.
|
|
181
182
|
* @param catalog - The servers to choose from.
|
|
182
183
|
* @param prompt - The request being planned for. Only its head is read; see `preselectInput`.
|
|
183
184
|
* @param [options] - Cancellation, notices, the reply ceiling, the temperature and reasoning effort
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { byCodeUnit, counted, isRecord } from '
|
|
2
|
-
import { askJson, tryAsk } from '
|
|
1
|
+
import { byCodeUnit, counted, isRecord } from '../core/guards.js';
|
|
2
|
+
import { askJson, tryAsk } from '../turn/side-task.js';
|
|
3
|
+
import { SchemaType } from '../wire/wire.js';
|
|
3
4
|
import { catalogList, expandNames, MAX_PER_LOAD } from './tool-loading.js';
|
|
4
|
-
import { SchemaType } from './wire.js';
|
|
5
5
|
/**
|
|
6
6
|
* Choosing a run's tools before it starts, from the request and the catalogue's names.
|
|
7
7
|
*
|
|
@@ -243,8 +243,9 @@ export function preselectByKeywords(catalog, prompt, { maxPerLoad = MAX_PER_LOAD
|
|
|
243
243
|
* The tools a request is likely to need, picked by a small model before the run starts, or none.
|
|
244
244
|
*
|
|
245
245
|
* @param config - The endpoint the preselector is reached through.
|
|
246
|
-
* @param model - The preselector. An empty name picks nothing, which is what
|
|
247
|
-
* means by empty
|
|
246
|
+
* @param model - The preselector. An empty name picks nothing, silently, which is what
|
|
247
|
+
* `toolSelectModel` means by empty: a host whose settings read `""` as "the run's model" passes
|
|
248
|
+
* `toolSelectModel: settings.toolSelectModel || settings.model`.
|
|
248
249
|
* @param catalog - The servers to choose from.
|
|
249
250
|
* @param prompt - The request being planned for. Only its head is read; see `preselectInput`.
|
|
250
251
|
* @param [options] - Cancellation, notices, the reply ceiling, the temperature and reasoning effort
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { byCodeUnit, isRecord } from '
|
|
2
|
-
import { ARGUMENT_PREVIEW_CHARS } from '
|
|
3
|
-
import { FUNCTION_TOOL, SchemaType } from '
|
|
1
|
+
import { byCodeUnit, isRecord } from '../core/guards.js';
|
|
2
|
+
import { ARGUMENT_PREVIEW_CHARS } from '../wire/tool-calls.js';
|
|
3
|
+
import { FUNCTION_TOOL, SchemaType } from '../wire/wire.js';
|
|
4
4
|
/**
|
|
5
5
|
* On-demand tool loading.
|
|
6
6
|
*
|