@dudousxd/nestjs-agent-core 0.23.0 → 0.25.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/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as ModelMessage, a as ToolDefinition, b as ToolCallRequest, c as MessageUsage, d as AgentUiComponent, e as AiToolCtx, f as AgentStreamEvent, A as Actor, g as ThreadSummary, h as ThreadDetail, S as StoredMessage, i as ToolResult, j as MessageAttachment, k as MessageFeedback, l as ToolCallStatus, U as UsagePurpose, m as ToolSpec, Q as QuotaState, n as AgentRunInput, H as HumanReply, o as ToolKind, p as ToolCallApproval, T as ToolHandler, q as HistoryPolicy, O as OutputProcessor, P as ProcessorContext, I as InputProcessor, r as ProcessedPrompt, s as ModelAnswer, t as PageContext, u as AgentDefinition, v as AgentDelegation, D as DetachedDelivery, w as PromptBuilder, x as PromptContributor, y as ToolTransientRetrySetting, z as AgentIntake, B as Decision, E as ElicitationRequest, L as LlmStepEnvelope, C as ToolStepEnvelope } from './tool-BdW-LV1J.cjs';
2
- export { F as ASK_TOOL_DESCRIPTION, G as ASK_TOOL_NAME, J as AgentApprovalRequest, K as AgentApprovalSettlement, N as AgentCatalogEntry, R as AgentHistoryWindow, V as AskToolInput, W as DEFAULT_INCREMENTAL_LOOKBACK_CHARS, X as DEFAULT_INTAKE_PREAMBLE, Y as DEFAULT_TOOL_TRANSIENT_RETRY_ATTEMPTS, Z as DEFAULT_TOOL_TRANSIENT_RETRY_BACKOFF_MS, _ as ELICITATION_INPUT_TYPES, $ as ElicitationInput, a0 as ElicitationInputType, a1 as ElicitationOption, a2 as ElicitationOutcome, a3 as ElicitationQuestion, a4 as ElicitationReply, a5 as ElicitationResult, a6 as HistoryPolicyContext, a7 as HistorySelection, a8 as HistorySummary, a9 as IncrementalGating, aa as InvokeWithTransientRetryOptions, ab as MAX_ASK_QUESTIONS, ac as MessageFeedbackValue, ad as MessageRole, ae as OutputRejectedError, af as OutputVerdict, ag as ProcessorFailedError, ah as PromptContext, ai as QuotaView, aj as ToolCallApprovalStatus, ak as ToolCatalogEntry, al as ToolConfirmation, am as ToolPresentation, an as ToolPresentationTone, ao as ToolResultField, ap as ToolResultView, aq as ToolStepCtx, ar as ToolTransientRetryNumbers, as as ToolTransientRetryOptions, at as askInputSchema, au as askToolDefinition, av as decodeStreamEvent, aw as encodeStreamEvent, ax as invokeWithTransientRetry, ay as isTransientToolError, az as isTypedQuestion, aA as normalizeElicitationReply, aB as questionOptions, aC as readElicitationInput, aD as readElicitationQuestions, aE as renderElicitationAnswers, aF as resolveElicitation, aG as resolveToolTransientRetryNumbers, aH as settleElicitation, aI as validateElicitationAnswer, aJ as validateElicitationValue } from './tool-BdW-LV1J.cjs';
1
+ import { M as ModelMessage, a as ToolDefinition, b as ToolCallRequest, c as MessageUsage, d as AgentUiComponent, A as Actor, e as AiToolCtx, f as AgentStreamEvent, g as ThreadSummary, h as ThreadDetail, S as StoredMessage, i as ToolResult, j as MessageAttachment, k as MessageFeedback, l as ToolCallStatus, U as UsagePurpose, m as ToolSpec, Q as QuotaState, n as AgentRunInput, H as HumanReply, o as ToolKind, p as ToolCallApproval, T as ToolHandler, q as HistoryPolicy, O as OutputProcessor, P as ProcessorContext, I as InputProcessor, r as ProcessedPrompt, s as ModelAnswer, t as PageContext, u as AgentDefinition, v as AgentDelegation, D as DetachedDelivery, w as PromptBuilder, x as PromptContributor, y as ToolTransientRetrySetting, z as AgentIntake, B as Decision, E as ElicitationRequest, L as LlmStepEnvelope, C as ToolStepEnvelope } from './tool-fLRLs_f3.cjs';
2
+ export { F as ASK_TOOL_DESCRIPTION, G as ASK_TOOL_NAME, J as AgentApprovalRequest, K as AgentApprovalSettlement, N as AgentCatalogEntry, R as AgentHistoryWindow, V as AskToolInput, W as DEFAULT_INCREMENTAL_LOOKBACK_CHARS, X as DEFAULT_INTAKE_PREAMBLE, Y as DEFAULT_TOOL_TRANSIENT_RETRY_ATTEMPTS, Z as DEFAULT_TOOL_TRANSIENT_RETRY_BACKOFF_MS, _ as ELICITATION_INPUT_TYPES, $ as ElicitationInput, a0 as ElicitationInputType, a1 as ElicitationOption, a2 as ElicitationOutcome, a3 as ElicitationQuestion, a4 as ElicitationReply, a5 as ElicitationResult, a6 as HistoryPolicyContext, a7 as HistorySelection, a8 as HistorySummary, a9 as IncrementalGating, aa as InvokeWithTransientRetryOptions, ab as MAX_ASK_QUESTIONS, ac as MessageFeedbackValue, ad as MessageRole, ae as OutputRejectedError, af as OutputVerdict, ag as ProcessorFailedError, ah as PromptContext, ai as QuotaView, aj as ToolCallApprovalStatus, ak as ToolCatalogEntry, al as ToolConfirmation, am as ToolPresentation, an as ToolPresentationTone, ao as ToolResultField, ap as ToolResultView, aq as ToolStepCtx, ar as ToolTransientRetryNumbers, as as ToolTransientRetryOptions, at as askInputSchema, au as askToolDefinition, av as decodeStreamEvent, aw as encodeStreamEvent, ax as invokeWithTransientRetry, ay as isTransientToolError, az as isTypedQuestion, aA as normalizeElicitationReply, aB as questionOptions, aC as readElicitationInput, aD as readElicitationQuestions, aE as renderElicitationAnswers, aF as resolveElicitation, aG as resolveToolTransientRetryNumbers, aH as settleElicitation, aI as validateElicitationAnswer, aJ as validateElicitationValue } from './tool-fLRLs_f3.cjs';
3
3
  import { StandardSchemaV1 } from '@standard-schema/spec';
4
4
  import { ChannelRegistry } from '@dudousxd/nestjs-diagnostics';
5
5
 
@@ -32,6 +32,10 @@ declare const AGENT_REGISTRY: unique symbol;
32
32
  declare const AGENT_ACTOR_RESOLVER: unique symbol;
33
33
  /** The governance read-model (usage/spend/threads), consumed by the dashboard + telescope surfaces. */
34
34
  declare const AGENT_GOVERNANCE_QUERIES: unique symbol;
35
+ /** The `QuotaProvider` behind `GET <base>/quota` (and, when the host binds one, the send gate). */
36
+ declare const AGENT_QUOTA_PROVIDER: unique symbol;
37
+ /** The `ModelCatalog` behind `GET <base>/models` and the model a send may name. Optional. */
38
+ declare const AGENT_MODEL_CATALOG: unique symbol;
35
39
  /** The pricing WRITE side (`AgentPricingStore`) — seeds/updates the per-model rates cost is priced against. */
36
40
  declare const AGENT_PRICING_STORE: unique symbol;
37
41
  /** The RAG retrieval seam (`Retriever`) — vector/keyword search behind the agentic tool or inject mode. */
@@ -134,6 +138,12 @@ interface ModelTurnArgs {
134
138
  * the reply against the same schema either way, so ignoring it costs reliability, not safety.
135
139
  */
136
140
  outputSchema?: StandardSchemaV1;
141
+ /**
142
+ * The model the caller picked for this turn — a {@link import('./model-catalog.js').ModelCatalogEntry}
143
+ * id the server already checked against the catalog (a per-send `model`, else the thread's pinned
144
+ * one). Absent → the provider's own default. A provider serving a single model may ignore it.
145
+ */
146
+ model?: string;
137
147
  }
138
148
  /** The outcome of ONE assistant turn. The loop — not the model — drives tool execution. */
139
149
  interface ModelTurnResult {
@@ -211,6 +221,61 @@ interface ModelProvider {
211
221
  runTurn(args: ModelTurnArgs): Promise<ModelTurnResult>;
212
222
  }
213
223
 
224
+ /** One model a caller may pick. */
225
+ interface ModelCatalogEntry {
226
+ /** What a client sends as `model` — and what the {@link ModelProvider} receives as `args.model`. */
227
+ id: string;
228
+ label: string;
229
+ description?: string;
230
+ /** Short tags a picker can render as chips — `'fast'`, `'reasoning'`, `'vision'`, `'new'`, … */
231
+ badges?: string[];
232
+ /** `false` → listed but not selectable right now (plan, quota, outage); a send naming it is refused. */
233
+ available: boolean;
234
+ /** Why it is unavailable, in words a picker can show. */
235
+ unavailableReason?: string;
236
+ /** Context window, in tokens, when the host knows it. */
237
+ contextWindow?: number;
238
+ }
239
+ /** Models grouped under the provider that serves them. */
240
+ interface ModelCatalogProviderGroup {
241
+ id: string;
242
+ label: string;
243
+ models: ModelCatalogEntry[];
244
+ }
245
+ /** What `GET <base>/models` answers. */
246
+ interface ModelCatalogView {
247
+ providers: ModelCatalogProviderGroup[];
248
+ /** The model a turn runs on when nobody picked one; `null` when the provider decides. */
249
+ default: string | null;
250
+ }
251
+ interface ModelCatalogQuery {
252
+ actor: Actor;
253
+ /** The agent the picker is for; omitted → the default agent. */
254
+ agent?: string;
255
+ }
256
+ /**
257
+ * Which models a caller may run a turn on — the picker's data and the send's gate. The server
258
+ * refuses a `model` (on a send, or pinned on a thread) that this does not list as `available` for
259
+ * the actor and agent, so a client cannot pick a model the host did not offer it.
260
+ *
261
+ * Bind with `AgentModule.forRoot({ models })`. Without one, `GET <base>/models` answers an empty
262
+ * catalog and a request naming a model is refused.
263
+ */
264
+ interface ModelCatalog {
265
+ list(query: ModelCatalogQuery): ModelCatalogView | Promise<ModelCatalogView>;
266
+ }
267
+ /** A catalog that answers the same view to everyone — for a fixed list of models. */
268
+ declare function staticModelCatalog(view: ModelCatalogView): ModelCatalog;
269
+ /** The entry `id` names in `view`, or `undefined`. */
270
+ declare function findCatalogModel(view: ModelCatalogView, id: string): ModelCatalogEntry | undefined;
271
+ /**
272
+ * A provider that runs every turn on `model` — what the loop wraps the bound provider in when a
273
+ * turn has a selected model, so every call it makes (the answer, a structured-output pass, the
274
+ * follow-up suggestions) goes to the same one. A provider that does not read `args.model` runs its
275
+ * own default, unchanged.
276
+ */
277
+ declare function withSelectedModel(provider: ModelProvider, model: string): ModelProvider;
278
+
214
279
  /** What a model turn streamed that the persisted message keeps, beyond its text and tool calls. */
215
280
  interface TurnFrameSummary {
216
281
  reasoning?: string;
@@ -344,6 +409,8 @@ interface UpdateThreadInput {
344
409
  title?: string;
345
410
  /** `null` clears the thread's default agent (falls back to the module default). */
346
411
  defaultAgent?: string | null;
412
+ /** `null` unpins the thread's model (turns run on the provider default). */
413
+ model?: string | null;
347
414
  }
348
415
  interface RecordUsageInput {
349
416
  threadId: string;
@@ -579,6 +646,15 @@ interface AgentStore {
579
646
  usedTokens: number;
580
647
  costUsd: number;
581
648
  }>;
649
+ /**
650
+ * OPTIONAL: the actor's spend over the UTC days `fromDay`..`toDay` (`YYYY-MM-DD`, inclusive) —
651
+ * {@link quotaToday} over a range. Feeds the monthly window of `GET <base>/quota`; absent → that
652
+ * window is left out.
653
+ */
654
+ usageBetween?(actorRef: string, fromDay: string, toDay: string): Promise<{
655
+ usedTokens: number;
656
+ costUsd: number;
657
+ }>;
582
658
  }
583
659
 
584
660
  /**
@@ -603,6 +679,57 @@ interface QuotaStore {
603
679
  bump(actorRef: string, day: string, tokens: number): Promise<void>;
604
680
  }
605
681
 
682
+ /** The span a quota window counts over, in UTC. */
683
+ type QuotaPeriod = 'day' | 'month';
684
+ /** One budget window: what was spent in it, and the ceiling when there is one. */
685
+ interface QuotaWindow {
686
+ period: QuotaPeriod;
687
+ usedTokens: number;
688
+ /** Absent → no token ceiling on this window. */
689
+ limitTokens?: number;
690
+ usedUsd: number;
691
+ /** Absent → no spend ceiling on this window. */
692
+ limitUsd?: number;
693
+ /** ISO-8601 instant the window starts over (next UTC midnight, first of next month). */
694
+ resetsAt?: string;
695
+ }
696
+ /** Which window stopped the actor, when one did. */
697
+ interface QuotaBlock {
698
+ period: QuotaPeriod;
699
+ /** Words a client can show ("Monthly AI budget reached"). */
700
+ reason?: string;
701
+ }
702
+ /** What `GET <base>/quota` answers. */
703
+ interface QuotaReport {
704
+ windows: QuotaWindow[];
705
+ /** Present when a window is exhausted — a send will be refused until it resets. */
706
+ blocked?: QuotaBlock;
707
+ }
708
+ interface QuotaQuery {
709
+ actor: Actor;
710
+ /** The instant to report for; defaults to now. */
711
+ now?: Date;
712
+ }
713
+ /**
714
+ * The actor's budget across windows — the read behind `GET <base>/quota` and, when the host binds
715
+ * one (`AgentModule.forRoot({ quotaProvider })`), the gate a send passes: a report with `blocked`
716
+ * refuses the turn with `429` before it starts.
717
+ *
718
+ * The default reads the usage ledger (`LedgerQuotaProvider` in `@dudousxd/nestjs-agent`); a host
719
+ * with its own budget (an AI-gateway spend cap, a plan's monthly allowance) implements this.
720
+ */
721
+ interface QuotaProvider {
722
+ report(query: QuotaQuery): Promise<QuotaReport>;
723
+ }
724
+ /** The first window whose token or spend ceiling is reached, as a {@link QuotaBlock}. */
725
+ declare function exhaustedWindow(windows: readonly QuotaWindow[]): QuotaBlock | undefined;
726
+ /** The UTC day range (`YYYY-MM-DD`, inclusive) and reset instant of `period` around `now`. */
727
+ declare function quotaPeriodRange(period: QuotaPeriod, now: Date): {
728
+ fromDay: string;
729
+ toDay: string;
730
+ resetsAt: string;
731
+ };
732
+
606
733
  /**
607
734
  * The WRITE side of the pricing table the {@link import('./governance-queries.js').AgentGovernanceQueries}
608
735
  * read-model prices usage against. Cost is $0 for an unpriced model, so an app seeds its models'
@@ -3109,7 +3236,7 @@ interface AgentLoopResult<TOutput = unknown> {
3109
3236
  * It drives the model→tools→model iteration; the runner supplies the `step`/`awaitApproval`
3110
3237
  * hooks that make the same loop body either in-process or a replay-safe durable workflow.
3111
3238
  */
3112
- declare function runAgentLoop<TOutput = unknown>(deps: AgentLoopDeps<TOutput>, input: AgentRunInput, hooks: AgentLoopHooks): Promise<AgentLoopResult<TOutput>>;
3239
+ declare function runAgentLoop<TOutput = unknown>(boundDeps: AgentLoopDeps<TOutput>, input: AgentRunInput, hooks: AgentLoopHooks): Promise<AgentLoopResult<TOutput>>;
3113
3240
 
3114
3241
  /** Payloads carried on each `aviary:agent:*` channel. */
3115
3242
  interface AgentRunStarted {
@@ -3343,4 +3470,4 @@ type AgentDiagnosticKey = `agent:${AgentDiagnosticEvent}`;
3343
3470
  */
3344
3471
  declare function agentDiagnosticKey(event: AgentDiagnosticEvent): AgentDiagnosticKey;
3345
3472
 
3346
- export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_ATTACHMENT_STAGING, AGENT_DEPS_FACTORY, AGENT_DIAGNOSTIC_EVENTS, AGENT_DURABLE_RUNNER, AGENT_EMBEDDING_PROVIDER, AGENT_GOVERNANCE_QUERIES, AGENT_MEMORY, AGENT_MODEL, AGENT_OPTIONS, AGENT_PRICING_STORE, AGENT_PROMPT_CONTRIBUTORS, AGENT_QUOTA_STORE, AGENT_REGISTRY, AGENT_RETRIEVER, AGENT_ROLES_POLICY, AGENT_RUNNER, AGENT_SINK, AGENT_SKILLS, AGENT_SKILL_SOURCES, AGENT_SPAN_EVENTS, AGENT_STORE, AGENT_TOOL_REGISTRY, APPROVAL_EXPIRED_REASON, Actor, type ActorDirectory, type ActorResolver, type ActorSpendRow, type AgentApprovalPort, AgentDefinition, type AgentDelegated, AgentDelegation, type AgentDiagnosticEvent, type AgentDiagnosticKey, type AgentFollowUpsSpan, type AgentGovernanceQueries, AgentIntake, type AgentLlmTurnSpan, type AgentLoopDeps, type AgentLoopHooks, type AgentLoopResult, type AgentMemoryResolved, type AgentMemoryWritten, type AgentMessageEvent, type AgentPricingStore, type AgentQuotaExceeded, AgentRegistry, type AgentRetrievalSpan, type AgentRetrieved, type AgentRunFailed, type AgentRunFinished, AgentRunInput, type AgentRunStarted, type AgentRunner, type AgentSkillsResolved, type AgentSpanEvent, type AgentStore, AgentStreamError, AgentStreamEvent, type AgentStructuredOutputSpan, type AgentToolCallEvent, type AgentToolExecutionSpan, type AgentToolRetry, AgentUiComponent, AiToolCtx, type AppendMessageInput, type ApprovalDecisionRef, type ApprovalPolicy, type ApprovalRequirement, type ApprovalThreadRef, type ApprovalToolRef, type ApprovalWhere, type AttachmentRef, type AttachmentStagingStore, type BufferedModelTurnResult, type BuildMemoryBlockInput, type CostUsage, type CreateThreadInput, type CurrentModelPrice, DEFAULT_HISTORY_SUMMARY_INSTRUCTION, DEFAULT_MAX_FACT_CHARS, DEFAULT_MAX_MEMORIES, DEFAULT_MAX_SKILLS, DEFAULT_REFUSAL_REASON, DEFAULT_STRUCTURED_OUTPUT_INSTRUCTION, Decision, DefaultApprovalPolicy, DefaultRolesPolicy, type DetachedDelegationOutcome, type DetachedDelegationReceipt, DetachedDelivery, type DetailThreadRef, ElicitationRequest, type EmbeddingProvider, type EmitUi, type ForgetMemoryInput, type FrameBuffer, GLOBAL_SCOPE, type GovernancePage, type GovernancePageQuery, type GovernanceRange, type GovernanceRunDetail, type GovernanceThreadDetail, type GovernanceThreadDetailQuery, type GovernanceUsageInput, HistoryPolicy, HumanReply, type IncrementalGate, InputProcessor, type ListMemoriesInput, type ListSkillsInput, type ListStagedAttachmentsInput, LlmStepEnvelope, type LoadSkillInput, type MemoryAuthor, type MemoryConfig, type MemoryDigest, type MemoryDigestEntry, type MemoryFact, type MemoryForgetRequest, type MemoryOrigin, type MemoryProvider, type MemoryRecord, type MemoryVerdict, type MemoryWriteOutcome, type MemoryWriteRequest, MessageAttachment, MessageFeedback, MessageUsage, ModelAnswer, ModelMessage, type ModelPrice, type ModelPriceInput, type ModelProvider, type ModelSpendRow, type ModelTurnArgs, type ModelTurnResult, type ObservedTurnFrames, type OfferMemoriesInput, type OutputGateMode, type OutputGateResult, OutputProcessor, type OverriddenMemory, PageContext, type Passage, type PendingApprovalRow, ProcessedPrompt, ProcessorContext, PromptBuilder, PromptContributor, QuotaExceededError, QuotaState, type QuotaStore, REMEMBER_TOOL_DESCRIPTION, REMEMBER_TOOL_NAME, REQUESTER_APPROVER, type RecentRunRow, type RecordRunEndInput, type RecordRunStartInput, type RecordToolCallInput, type RecordUsageInput, type RememberToolInput, type RerankOptions, type Reranker, type ResolveAttachmentInput, type ResolveMemoryDigestInput, type ResolvedDelegation, type RetrieveOptions, type Retriever, type RolesPolicy, type RunAgentBreakdownRow, RunCancelledError, type RunErrorBreakdownRow, type RunMetrics, type RunToolCallRow, type RunTrendPoint, type RunWhere, SKILL_TOOL_DESCRIPTION, SKILL_TOOL_NAME, type ScopeContext, type ScopeResolver, type SearchMemoriesInput, type SettledTask, type SinkWriter, type Skill, type SkillAuthor, type SkillCatalogEntry, type SkillContext, type SkillLoadOutcome, type SkillOffer, type SkillProvider, type SkillSummary, type SkillToolInput, type SkillWriteRequest, type SkillWriteVerdict, type SkillsConfig, type StageAttachmentInput, type StagedAttachment, type StoreMemoryInput, StoredMessage, type StreamError, type StructuredOutcome, StructuredOutputError, THREAD_DETAIL_CONTENT_CHARS, type ThreadActivityRow, ThreadDetail, type ThreadMessageRow, type ThreadMeta, type ThreadSpendRow, ThreadSummary, type ThreadTurnPage, type ThreadTurnQuery, type ThreadTurnReader, type ThreadUsageRollup, type ThreadWhere, type TokenStreamSink, type ToolCallActivityRow, ToolCallApproval, type ToolCallApprovalColumns, type ToolCallApprovalState, ToolCallRequest, ToolCallStatus, type ToolCallWhere, ToolDefinition, ToolDisabledError, ToolForbiddenError, ToolHandler, ToolInputInvalidError, ToolKind, type ToolKindDeps, ToolNotFoundError, ToolRegistry, ToolResult, ToolSpec, type ToolStatRow, ToolStepEnvelope, ToolTransientRetrySetting, type TurnFrameSummary, type UiCollector, type UpdateThreadInput, type UpdateToolCallInput, UsagePurpose, type UsageTrendPoint, type WindowHistoryOptions, type WithMemoryToolInput, type WriteMemoryInput, actorScope, agentDiagnosticKey, agentFailureCode, bucketByActor, bucketByModel, bucketByThread, bucketUsageTrend, buildMemoryBlock, buildSkillsBlock, canActorUseTool, compositeSkillProvider, createFrameBuffer, createIncrementalGate, createUiCollector, dayBoundsUtc, defaultCanDecide, defaultScopeResolver, detachedDelivered, detachedStarted, detachedUnsettled, estimateCost, estimateMessageTokens, extractJson, filterToolsByAllowList, filterToolsByCanUse, filterToolsByEnabled, filterToolsByRole, gateFollowUps, gateTail, isControlFlowSignal, isReplayIntegrityError, isToolEnabled, loadSkill, mayDecideApproval, memoryForgetVerdict, memoryWriteVerdict, mergeUi, normalizeDelegation, observeTurnFrames, offerMemories, offerSkills, publishAgentDelegated, publishAgentMemoryResolved, publishAgentMemoryWritten, publishAgentMessage, publishAgentQuotaExceeded, publishAgentRetrieved, publishAgentRunFailed, publishAgentRunFinished, publishAgentRunStarted, publishAgentSkillsResolved, publishAgentToolCall, publishAgentToolRetry, releaseGatedFrames, rememberInputSchema, rememberToolDefinition, repairInstruction, resolveGateLookback, resolveMemoryDigest, resolveOutputGateMode, resolveSkillCatalog, rollupThreadUsage, runAgentLoop, runInputProcessors, runOutputProcessors, seedModelPrices, settleAll, settleUnsettledDelegation, skillInputSchema, skillToolDefinition, skillWriteVerdict, stampToolKinds, staticSkillProvider, summarizeWithModel, tenantScope, toolCallApprovalFromRow, traceLlmTurn, traceToolExecution, truncateDetailContent, unwrapToolStepOutput, validateStructured, windowHistory, withAskTool, withMemoryTool, withSkillTool, withToolTimeout, withTurnFrames, wrapToolStepOutput, writeMemory };
3473
+ export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_ATTACHMENT_STAGING, AGENT_DEPS_FACTORY, AGENT_DIAGNOSTIC_EVENTS, AGENT_DURABLE_RUNNER, AGENT_EMBEDDING_PROVIDER, AGENT_GOVERNANCE_QUERIES, AGENT_MEMORY, AGENT_MODEL, AGENT_MODEL_CATALOG, AGENT_OPTIONS, AGENT_PRICING_STORE, AGENT_PROMPT_CONTRIBUTORS, AGENT_QUOTA_PROVIDER, AGENT_QUOTA_STORE, AGENT_REGISTRY, AGENT_RETRIEVER, AGENT_ROLES_POLICY, AGENT_RUNNER, AGENT_SINK, AGENT_SKILLS, AGENT_SKILL_SOURCES, AGENT_SPAN_EVENTS, AGENT_STORE, AGENT_TOOL_REGISTRY, APPROVAL_EXPIRED_REASON, Actor, type ActorDirectory, type ActorResolver, type ActorSpendRow, type AgentApprovalPort, AgentDefinition, type AgentDelegated, AgentDelegation, type AgentDiagnosticEvent, type AgentDiagnosticKey, type AgentFollowUpsSpan, type AgentGovernanceQueries, AgentIntake, type AgentLlmTurnSpan, type AgentLoopDeps, type AgentLoopHooks, type AgentLoopResult, type AgentMemoryResolved, type AgentMemoryWritten, type AgentMessageEvent, type AgentPricingStore, type AgentQuotaExceeded, AgentRegistry, type AgentRetrievalSpan, type AgentRetrieved, type AgentRunFailed, type AgentRunFinished, AgentRunInput, type AgentRunStarted, type AgentRunner, type AgentSkillsResolved, type AgentSpanEvent, type AgentStore, AgentStreamError, AgentStreamEvent, type AgentStructuredOutputSpan, type AgentToolCallEvent, type AgentToolExecutionSpan, type AgentToolRetry, AgentUiComponent, AiToolCtx, type AppendMessageInput, type ApprovalDecisionRef, type ApprovalPolicy, type ApprovalRequirement, type ApprovalThreadRef, type ApprovalToolRef, type ApprovalWhere, type AttachmentRef, type AttachmentStagingStore, type BufferedModelTurnResult, type BuildMemoryBlockInput, type CostUsage, type CreateThreadInput, type CurrentModelPrice, DEFAULT_HISTORY_SUMMARY_INSTRUCTION, DEFAULT_MAX_FACT_CHARS, DEFAULT_MAX_MEMORIES, DEFAULT_MAX_SKILLS, DEFAULT_REFUSAL_REASON, DEFAULT_STRUCTURED_OUTPUT_INSTRUCTION, Decision, DefaultApprovalPolicy, DefaultRolesPolicy, type DetachedDelegationOutcome, type DetachedDelegationReceipt, DetachedDelivery, type DetailThreadRef, ElicitationRequest, type EmbeddingProvider, type EmitUi, type ForgetMemoryInput, type FrameBuffer, GLOBAL_SCOPE, type GovernancePage, type GovernancePageQuery, type GovernanceRange, type GovernanceRunDetail, type GovernanceThreadDetail, type GovernanceThreadDetailQuery, type GovernanceUsageInput, HistoryPolicy, HumanReply, type IncrementalGate, InputProcessor, type ListMemoriesInput, type ListSkillsInput, type ListStagedAttachmentsInput, LlmStepEnvelope, type LoadSkillInput, type MemoryAuthor, type MemoryConfig, type MemoryDigest, type MemoryDigestEntry, type MemoryFact, type MemoryForgetRequest, type MemoryOrigin, type MemoryProvider, type MemoryRecord, type MemoryVerdict, type MemoryWriteOutcome, type MemoryWriteRequest, MessageAttachment, MessageFeedback, MessageUsage, ModelAnswer, type ModelCatalog, type ModelCatalogEntry, type ModelCatalogProviderGroup, type ModelCatalogQuery, type ModelCatalogView, ModelMessage, type ModelPrice, type ModelPriceInput, type ModelProvider, type ModelSpendRow, type ModelTurnArgs, type ModelTurnResult, type ObservedTurnFrames, type OfferMemoriesInput, type OutputGateMode, type OutputGateResult, OutputProcessor, type OverriddenMemory, PageContext, type Passage, type PendingApprovalRow, ProcessedPrompt, ProcessorContext, PromptBuilder, PromptContributor, type QuotaBlock, QuotaExceededError, type QuotaPeriod, type QuotaProvider, type QuotaQuery, type QuotaReport, QuotaState, type QuotaStore, type QuotaWindow, REMEMBER_TOOL_DESCRIPTION, REMEMBER_TOOL_NAME, REQUESTER_APPROVER, type RecentRunRow, type RecordRunEndInput, type RecordRunStartInput, type RecordToolCallInput, type RecordUsageInput, type RememberToolInput, type RerankOptions, type Reranker, type ResolveAttachmentInput, type ResolveMemoryDigestInput, type ResolvedDelegation, type RetrieveOptions, type Retriever, type RolesPolicy, type RunAgentBreakdownRow, RunCancelledError, type RunErrorBreakdownRow, type RunMetrics, type RunToolCallRow, type RunTrendPoint, type RunWhere, SKILL_TOOL_DESCRIPTION, SKILL_TOOL_NAME, type ScopeContext, type ScopeResolver, type SearchMemoriesInput, type SettledTask, type SinkWriter, type Skill, type SkillAuthor, type SkillCatalogEntry, type SkillContext, type SkillLoadOutcome, type SkillOffer, type SkillProvider, type SkillSummary, type SkillToolInput, type SkillWriteRequest, type SkillWriteVerdict, type SkillsConfig, type StageAttachmentInput, type StagedAttachment, type StoreMemoryInput, StoredMessage, type StreamError, type StructuredOutcome, StructuredOutputError, THREAD_DETAIL_CONTENT_CHARS, type ThreadActivityRow, ThreadDetail, type ThreadMessageRow, type ThreadMeta, type ThreadSpendRow, ThreadSummary, type ThreadTurnPage, type ThreadTurnQuery, type ThreadTurnReader, type ThreadUsageRollup, type ThreadWhere, type TokenStreamSink, type ToolCallActivityRow, ToolCallApproval, type ToolCallApprovalColumns, type ToolCallApprovalState, ToolCallRequest, ToolCallStatus, type ToolCallWhere, ToolDefinition, ToolDisabledError, ToolForbiddenError, ToolHandler, ToolInputInvalidError, ToolKind, type ToolKindDeps, ToolNotFoundError, ToolRegistry, ToolResult, ToolSpec, type ToolStatRow, ToolStepEnvelope, ToolTransientRetrySetting, type TurnFrameSummary, type UiCollector, type UpdateThreadInput, type UpdateToolCallInput, UsagePurpose, type UsageTrendPoint, type WindowHistoryOptions, type WithMemoryToolInput, type WriteMemoryInput, actorScope, agentDiagnosticKey, agentFailureCode, bucketByActor, bucketByModel, bucketByThread, bucketUsageTrend, buildMemoryBlock, buildSkillsBlock, canActorUseTool, compositeSkillProvider, createFrameBuffer, createIncrementalGate, createUiCollector, dayBoundsUtc, defaultCanDecide, defaultScopeResolver, detachedDelivered, detachedStarted, detachedUnsettled, estimateCost, estimateMessageTokens, exhaustedWindow, extractJson, filterToolsByAllowList, filterToolsByCanUse, filterToolsByEnabled, filterToolsByRole, findCatalogModel, gateFollowUps, gateTail, isControlFlowSignal, isReplayIntegrityError, isToolEnabled, loadSkill, mayDecideApproval, memoryForgetVerdict, memoryWriteVerdict, mergeUi, normalizeDelegation, observeTurnFrames, offerMemories, offerSkills, publishAgentDelegated, publishAgentMemoryResolved, publishAgentMemoryWritten, publishAgentMessage, publishAgentQuotaExceeded, publishAgentRetrieved, publishAgentRunFailed, publishAgentRunFinished, publishAgentRunStarted, publishAgentSkillsResolved, publishAgentToolCall, publishAgentToolRetry, quotaPeriodRange, releaseGatedFrames, rememberInputSchema, rememberToolDefinition, repairInstruction, resolveGateLookback, resolveMemoryDigest, resolveOutputGateMode, resolveSkillCatalog, rollupThreadUsage, runAgentLoop, runInputProcessors, runOutputProcessors, seedModelPrices, settleAll, settleUnsettledDelegation, skillInputSchema, skillToolDefinition, skillWriteVerdict, stampToolKinds, staticModelCatalog, staticSkillProvider, summarizeWithModel, tenantScope, toolCallApprovalFromRow, traceLlmTurn, traceToolExecution, truncateDetailContent, unwrapToolStepOutput, validateStructured, windowHistory, withAskTool, withMemoryTool, withSelectedModel, withSkillTool, withToolTimeout, withTurnFrames, wrapToolStepOutput, writeMemory };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as ModelMessage, a as ToolDefinition, b as ToolCallRequest, c as MessageUsage, d as AgentUiComponent, e as AiToolCtx, f as AgentStreamEvent, A as Actor, g as ThreadSummary, h as ThreadDetail, S as StoredMessage, i as ToolResult, j as MessageAttachment, k as MessageFeedback, l as ToolCallStatus, U as UsagePurpose, m as ToolSpec, Q as QuotaState, n as AgentRunInput, H as HumanReply, o as ToolKind, p as ToolCallApproval, T as ToolHandler, q as HistoryPolicy, O as OutputProcessor, P as ProcessorContext, I as InputProcessor, r as ProcessedPrompt, s as ModelAnswer, t as PageContext, u as AgentDefinition, v as AgentDelegation, D as DetachedDelivery, w as PromptBuilder, x as PromptContributor, y as ToolTransientRetrySetting, z as AgentIntake, B as Decision, E as ElicitationRequest, L as LlmStepEnvelope, C as ToolStepEnvelope } from './tool-BdW-LV1J.js';
2
- export { F as ASK_TOOL_DESCRIPTION, G as ASK_TOOL_NAME, J as AgentApprovalRequest, K as AgentApprovalSettlement, N as AgentCatalogEntry, R as AgentHistoryWindow, V as AskToolInput, W as DEFAULT_INCREMENTAL_LOOKBACK_CHARS, X as DEFAULT_INTAKE_PREAMBLE, Y as DEFAULT_TOOL_TRANSIENT_RETRY_ATTEMPTS, Z as DEFAULT_TOOL_TRANSIENT_RETRY_BACKOFF_MS, _ as ELICITATION_INPUT_TYPES, $ as ElicitationInput, a0 as ElicitationInputType, a1 as ElicitationOption, a2 as ElicitationOutcome, a3 as ElicitationQuestion, a4 as ElicitationReply, a5 as ElicitationResult, a6 as HistoryPolicyContext, a7 as HistorySelection, a8 as HistorySummary, a9 as IncrementalGating, aa as InvokeWithTransientRetryOptions, ab as MAX_ASK_QUESTIONS, ac as MessageFeedbackValue, ad as MessageRole, ae as OutputRejectedError, af as OutputVerdict, ag as ProcessorFailedError, ah as PromptContext, ai as QuotaView, aj as ToolCallApprovalStatus, ak as ToolCatalogEntry, al as ToolConfirmation, am as ToolPresentation, an as ToolPresentationTone, ao as ToolResultField, ap as ToolResultView, aq as ToolStepCtx, ar as ToolTransientRetryNumbers, as as ToolTransientRetryOptions, at as askInputSchema, au as askToolDefinition, av as decodeStreamEvent, aw as encodeStreamEvent, ax as invokeWithTransientRetry, ay as isTransientToolError, az as isTypedQuestion, aA as normalizeElicitationReply, aB as questionOptions, aC as readElicitationInput, aD as readElicitationQuestions, aE as renderElicitationAnswers, aF as resolveElicitation, aG as resolveToolTransientRetryNumbers, aH as settleElicitation, aI as validateElicitationAnswer, aJ as validateElicitationValue } from './tool-BdW-LV1J.js';
1
+ import { M as ModelMessage, a as ToolDefinition, b as ToolCallRequest, c as MessageUsage, d as AgentUiComponent, A as Actor, e as AiToolCtx, f as AgentStreamEvent, g as ThreadSummary, h as ThreadDetail, S as StoredMessage, i as ToolResult, j as MessageAttachment, k as MessageFeedback, l as ToolCallStatus, U as UsagePurpose, m as ToolSpec, Q as QuotaState, n as AgentRunInput, H as HumanReply, o as ToolKind, p as ToolCallApproval, T as ToolHandler, q as HistoryPolicy, O as OutputProcessor, P as ProcessorContext, I as InputProcessor, r as ProcessedPrompt, s as ModelAnswer, t as PageContext, u as AgentDefinition, v as AgentDelegation, D as DetachedDelivery, w as PromptBuilder, x as PromptContributor, y as ToolTransientRetrySetting, z as AgentIntake, B as Decision, E as ElicitationRequest, L as LlmStepEnvelope, C as ToolStepEnvelope } from './tool-fLRLs_f3.js';
2
+ export { F as ASK_TOOL_DESCRIPTION, G as ASK_TOOL_NAME, J as AgentApprovalRequest, K as AgentApprovalSettlement, N as AgentCatalogEntry, R as AgentHistoryWindow, V as AskToolInput, W as DEFAULT_INCREMENTAL_LOOKBACK_CHARS, X as DEFAULT_INTAKE_PREAMBLE, Y as DEFAULT_TOOL_TRANSIENT_RETRY_ATTEMPTS, Z as DEFAULT_TOOL_TRANSIENT_RETRY_BACKOFF_MS, _ as ELICITATION_INPUT_TYPES, $ as ElicitationInput, a0 as ElicitationInputType, a1 as ElicitationOption, a2 as ElicitationOutcome, a3 as ElicitationQuestion, a4 as ElicitationReply, a5 as ElicitationResult, a6 as HistoryPolicyContext, a7 as HistorySelection, a8 as HistorySummary, a9 as IncrementalGating, aa as InvokeWithTransientRetryOptions, ab as MAX_ASK_QUESTIONS, ac as MessageFeedbackValue, ad as MessageRole, ae as OutputRejectedError, af as OutputVerdict, ag as ProcessorFailedError, ah as PromptContext, ai as QuotaView, aj as ToolCallApprovalStatus, ak as ToolCatalogEntry, al as ToolConfirmation, am as ToolPresentation, an as ToolPresentationTone, ao as ToolResultField, ap as ToolResultView, aq as ToolStepCtx, ar as ToolTransientRetryNumbers, as as ToolTransientRetryOptions, at as askInputSchema, au as askToolDefinition, av as decodeStreamEvent, aw as encodeStreamEvent, ax as invokeWithTransientRetry, ay as isTransientToolError, az as isTypedQuestion, aA as normalizeElicitationReply, aB as questionOptions, aC as readElicitationInput, aD as readElicitationQuestions, aE as renderElicitationAnswers, aF as resolveElicitation, aG as resolveToolTransientRetryNumbers, aH as settleElicitation, aI as validateElicitationAnswer, aJ as validateElicitationValue } from './tool-fLRLs_f3.js';
3
3
  import { StandardSchemaV1 } from '@standard-schema/spec';
4
4
  import { ChannelRegistry } from '@dudousxd/nestjs-diagnostics';
5
5
 
@@ -32,6 +32,10 @@ declare const AGENT_REGISTRY: unique symbol;
32
32
  declare const AGENT_ACTOR_RESOLVER: unique symbol;
33
33
  /** The governance read-model (usage/spend/threads), consumed by the dashboard + telescope surfaces. */
34
34
  declare const AGENT_GOVERNANCE_QUERIES: unique symbol;
35
+ /** The `QuotaProvider` behind `GET <base>/quota` (and, when the host binds one, the send gate). */
36
+ declare const AGENT_QUOTA_PROVIDER: unique symbol;
37
+ /** The `ModelCatalog` behind `GET <base>/models` and the model a send may name. Optional. */
38
+ declare const AGENT_MODEL_CATALOG: unique symbol;
35
39
  /** The pricing WRITE side (`AgentPricingStore`) — seeds/updates the per-model rates cost is priced against. */
36
40
  declare const AGENT_PRICING_STORE: unique symbol;
37
41
  /** The RAG retrieval seam (`Retriever`) — vector/keyword search behind the agentic tool or inject mode. */
@@ -134,6 +138,12 @@ interface ModelTurnArgs {
134
138
  * the reply against the same schema either way, so ignoring it costs reliability, not safety.
135
139
  */
136
140
  outputSchema?: StandardSchemaV1;
141
+ /**
142
+ * The model the caller picked for this turn — a {@link import('./model-catalog.js').ModelCatalogEntry}
143
+ * id the server already checked against the catalog (a per-send `model`, else the thread's pinned
144
+ * one). Absent → the provider's own default. A provider serving a single model may ignore it.
145
+ */
146
+ model?: string;
137
147
  }
138
148
  /** The outcome of ONE assistant turn. The loop — not the model — drives tool execution. */
139
149
  interface ModelTurnResult {
@@ -211,6 +221,61 @@ interface ModelProvider {
211
221
  runTurn(args: ModelTurnArgs): Promise<ModelTurnResult>;
212
222
  }
213
223
 
224
+ /** One model a caller may pick. */
225
+ interface ModelCatalogEntry {
226
+ /** What a client sends as `model` — and what the {@link ModelProvider} receives as `args.model`. */
227
+ id: string;
228
+ label: string;
229
+ description?: string;
230
+ /** Short tags a picker can render as chips — `'fast'`, `'reasoning'`, `'vision'`, `'new'`, … */
231
+ badges?: string[];
232
+ /** `false` → listed but not selectable right now (plan, quota, outage); a send naming it is refused. */
233
+ available: boolean;
234
+ /** Why it is unavailable, in words a picker can show. */
235
+ unavailableReason?: string;
236
+ /** Context window, in tokens, when the host knows it. */
237
+ contextWindow?: number;
238
+ }
239
+ /** Models grouped under the provider that serves them. */
240
+ interface ModelCatalogProviderGroup {
241
+ id: string;
242
+ label: string;
243
+ models: ModelCatalogEntry[];
244
+ }
245
+ /** What `GET <base>/models` answers. */
246
+ interface ModelCatalogView {
247
+ providers: ModelCatalogProviderGroup[];
248
+ /** The model a turn runs on when nobody picked one; `null` when the provider decides. */
249
+ default: string | null;
250
+ }
251
+ interface ModelCatalogQuery {
252
+ actor: Actor;
253
+ /** The agent the picker is for; omitted → the default agent. */
254
+ agent?: string;
255
+ }
256
+ /**
257
+ * Which models a caller may run a turn on — the picker's data and the send's gate. The server
258
+ * refuses a `model` (on a send, or pinned on a thread) that this does not list as `available` for
259
+ * the actor and agent, so a client cannot pick a model the host did not offer it.
260
+ *
261
+ * Bind with `AgentModule.forRoot({ models })`. Without one, `GET <base>/models` answers an empty
262
+ * catalog and a request naming a model is refused.
263
+ */
264
+ interface ModelCatalog {
265
+ list(query: ModelCatalogQuery): ModelCatalogView | Promise<ModelCatalogView>;
266
+ }
267
+ /** A catalog that answers the same view to everyone — for a fixed list of models. */
268
+ declare function staticModelCatalog(view: ModelCatalogView): ModelCatalog;
269
+ /** The entry `id` names in `view`, or `undefined`. */
270
+ declare function findCatalogModel(view: ModelCatalogView, id: string): ModelCatalogEntry | undefined;
271
+ /**
272
+ * A provider that runs every turn on `model` — what the loop wraps the bound provider in when a
273
+ * turn has a selected model, so every call it makes (the answer, a structured-output pass, the
274
+ * follow-up suggestions) goes to the same one. A provider that does not read `args.model` runs its
275
+ * own default, unchanged.
276
+ */
277
+ declare function withSelectedModel(provider: ModelProvider, model: string): ModelProvider;
278
+
214
279
  /** What a model turn streamed that the persisted message keeps, beyond its text and tool calls. */
215
280
  interface TurnFrameSummary {
216
281
  reasoning?: string;
@@ -344,6 +409,8 @@ interface UpdateThreadInput {
344
409
  title?: string;
345
410
  /** `null` clears the thread's default agent (falls back to the module default). */
346
411
  defaultAgent?: string | null;
412
+ /** `null` unpins the thread's model (turns run on the provider default). */
413
+ model?: string | null;
347
414
  }
348
415
  interface RecordUsageInput {
349
416
  threadId: string;
@@ -579,6 +646,15 @@ interface AgentStore {
579
646
  usedTokens: number;
580
647
  costUsd: number;
581
648
  }>;
649
+ /**
650
+ * OPTIONAL: the actor's spend over the UTC days `fromDay`..`toDay` (`YYYY-MM-DD`, inclusive) —
651
+ * {@link quotaToday} over a range. Feeds the monthly window of `GET <base>/quota`; absent → that
652
+ * window is left out.
653
+ */
654
+ usageBetween?(actorRef: string, fromDay: string, toDay: string): Promise<{
655
+ usedTokens: number;
656
+ costUsd: number;
657
+ }>;
582
658
  }
583
659
 
584
660
  /**
@@ -603,6 +679,57 @@ interface QuotaStore {
603
679
  bump(actorRef: string, day: string, tokens: number): Promise<void>;
604
680
  }
605
681
 
682
+ /** The span a quota window counts over, in UTC. */
683
+ type QuotaPeriod = 'day' | 'month';
684
+ /** One budget window: what was spent in it, and the ceiling when there is one. */
685
+ interface QuotaWindow {
686
+ period: QuotaPeriod;
687
+ usedTokens: number;
688
+ /** Absent → no token ceiling on this window. */
689
+ limitTokens?: number;
690
+ usedUsd: number;
691
+ /** Absent → no spend ceiling on this window. */
692
+ limitUsd?: number;
693
+ /** ISO-8601 instant the window starts over (next UTC midnight, first of next month). */
694
+ resetsAt?: string;
695
+ }
696
+ /** Which window stopped the actor, when one did. */
697
+ interface QuotaBlock {
698
+ period: QuotaPeriod;
699
+ /** Words a client can show ("Monthly AI budget reached"). */
700
+ reason?: string;
701
+ }
702
+ /** What `GET <base>/quota` answers. */
703
+ interface QuotaReport {
704
+ windows: QuotaWindow[];
705
+ /** Present when a window is exhausted — a send will be refused until it resets. */
706
+ blocked?: QuotaBlock;
707
+ }
708
+ interface QuotaQuery {
709
+ actor: Actor;
710
+ /** The instant to report for; defaults to now. */
711
+ now?: Date;
712
+ }
713
+ /**
714
+ * The actor's budget across windows — the read behind `GET <base>/quota` and, when the host binds
715
+ * one (`AgentModule.forRoot({ quotaProvider })`), the gate a send passes: a report with `blocked`
716
+ * refuses the turn with `429` before it starts.
717
+ *
718
+ * The default reads the usage ledger (`LedgerQuotaProvider` in `@dudousxd/nestjs-agent`); a host
719
+ * with its own budget (an AI-gateway spend cap, a plan's monthly allowance) implements this.
720
+ */
721
+ interface QuotaProvider {
722
+ report(query: QuotaQuery): Promise<QuotaReport>;
723
+ }
724
+ /** The first window whose token or spend ceiling is reached, as a {@link QuotaBlock}. */
725
+ declare function exhaustedWindow(windows: readonly QuotaWindow[]): QuotaBlock | undefined;
726
+ /** The UTC day range (`YYYY-MM-DD`, inclusive) and reset instant of `period` around `now`. */
727
+ declare function quotaPeriodRange(period: QuotaPeriod, now: Date): {
728
+ fromDay: string;
729
+ toDay: string;
730
+ resetsAt: string;
731
+ };
732
+
606
733
  /**
607
734
  * The WRITE side of the pricing table the {@link import('./governance-queries.js').AgentGovernanceQueries}
608
735
  * read-model prices usage against. Cost is $0 for an unpriced model, so an app seeds its models'
@@ -3109,7 +3236,7 @@ interface AgentLoopResult<TOutput = unknown> {
3109
3236
  * It drives the model→tools→model iteration; the runner supplies the `step`/`awaitApproval`
3110
3237
  * hooks that make the same loop body either in-process or a replay-safe durable workflow.
3111
3238
  */
3112
- declare function runAgentLoop<TOutput = unknown>(deps: AgentLoopDeps<TOutput>, input: AgentRunInput, hooks: AgentLoopHooks): Promise<AgentLoopResult<TOutput>>;
3239
+ declare function runAgentLoop<TOutput = unknown>(boundDeps: AgentLoopDeps<TOutput>, input: AgentRunInput, hooks: AgentLoopHooks): Promise<AgentLoopResult<TOutput>>;
3113
3240
 
3114
3241
  /** Payloads carried on each `aviary:agent:*` channel. */
3115
3242
  interface AgentRunStarted {
@@ -3343,4 +3470,4 @@ type AgentDiagnosticKey = `agent:${AgentDiagnosticEvent}`;
3343
3470
  */
3344
3471
  declare function agentDiagnosticKey(event: AgentDiagnosticEvent): AgentDiagnosticKey;
3345
3472
 
3346
- export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_ATTACHMENT_STAGING, AGENT_DEPS_FACTORY, AGENT_DIAGNOSTIC_EVENTS, AGENT_DURABLE_RUNNER, AGENT_EMBEDDING_PROVIDER, AGENT_GOVERNANCE_QUERIES, AGENT_MEMORY, AGENT_MODEL, AGENT_OPTIONS, AGENT_PRICING_STORE, AGENT_PROMPT_CONTRIBUTORS, AGENT_QUOTA_STORE, AGENT_REGISTRY, AGENT_RETRIEVER, AGENT_ROLES_POLICY, AGENT_RUNNER, AGENT_SINK, AGENT_SKILLS, AGENT_SKILL_SOURCES, AGENT_SPAN_EVENTS, AGENT_STORE, AGENT_TOOL_REGISTRY, APPROVAL_EXPIRED_REASON, Actor, type ActorDirectory, type ActorResolver, type ActorSpendRow, type AgentApprovalPort, AgentDefinition, type AgentDelegated, AgentDelegation, type AgentDiagnosticEvent, type AgentDiagnosticKey, type AgentFollowUpsSpan, type AgentGovernanceQueries, AgentIntake, type AgentLlmTurnSpan, type AgentLoopDeps, type AgentLoopHooks, type AgentLoopResult, type AgentMemoryResolved, type AgentMemoryWritten, type AgentMessageEvent, type AgentPricingStore, type AgentQuotaExceeded, AgentRegistry, type AgentRetrievalSpan, type AgentRetrieved, type AgentRunFailed, type AgentRunFinished, AgentRunInput, type AgentRunStarted, type AgentRunner, type AgentSkillsResolved, type AgentSpanEvent, type AgentStore, AgentStreamError, AgentStreamEvent, type AgentStructuredOutputSpan, type AgentToolCallEvent, type AgentToolExecutionSpan, type AgentToolRetry, AgentUiComponent, AiToolCtx, type AppendMessageInput, type ApprovalDecisionRef, type ApprovalPolicy, type ApprovalRequirement, type ApprovalThreadRef, type ApprovalToolRef, type ApprovalWhere, type AttachmentRef, type AttachmentStagingStore, type BufferedModelTurnResult, type BuildMemoryBlockInput, type CostUsage, type CreateThreadInput, type CurrentModelPrice, DEFAULT_HISTORY_SUMMARY_INSTRUCTION, DEFAULT_MAX_FACT_CHARS, DEFAULT_MAX_MEMORIES, DEFAULT_MAX_SKILLS, DEFAULT_REFUSAL_REASON, DEFAULT_STRUCTURED_OUTPUT_INSTRUCTION, Decision, DefaultApprovalPolicy, DefaultRolesPolicy, type DetachedDelegationOutcome, type DetachedDelegationReceipt, DetachedDelivery, type DetailThreadRef, ElicitationRequest, type EmbeddingProvider, type EmitUi, type ForgetMemoryInput, type FrameBuffer, GLOBAL_SCOPE, type GovernancePage, type GovernancePageQuery, type GovernanceRange, type GovernanceRunDetail, type GovernanceThreadDetail, type GovernanceThreadDetailQuery, type GovernanceUsageInput, HistoryPolicy, HumanReply, type IncrementalGate, InputProcessor, type ListMemoriesInput, type ListSkillsInput, type ListStagedAttachmentsInput, LlmStepEnvelope, type LoadSkillInput, type MemoryAuthor, type MemoryConfig, type MemoryDigest, type MemoryDigestEntry, type MemoryFact, type MemoryForgetRequest, type MemoryOrigin, type MemoryProvider, type MemoryRecord, type MemoryVerdict, type MemoryWriteOutcome, type MemoryWriteRequest, MessageAttachment, MessageFeedback, MessageUsage, ModelAnswer, ModelMessage, type ModelPrice, type ModelPriceInput, type ModelProvider, type ModelSpendRow, type ModelTurnArgs, type ModelTurnResult, type ObservedTurnFrames, type OfferMemoriesInput, type OutputGateMode, type OutputGateResult, OutputProcessor, type OverriddenMemory, PageContext, type Passage, type PendingApprovalRow, ProcessedPrompt, ProcessorContext, PromptBuilder, PromptContributor, QuotaExceededError, QuotaState, type QuotaStore, REMEMBER_TOOL_DESCRIPTION, REMEMBER_TOOL_NAME, REQUESTER_APPROVER, type RecentRunRow, type RecordRunEndInput, type RecordRunStartInput, type RecordToolCallInput, type RecordUsageInput, type RememberToolInput, type RerankOptions, type Reranker, type ResolveAttachmentInput, type ResolveMemoryDigestInput, type ResolvedDelegation, type RetrieveOptions, type Retriever, type RolesPolicy, type RunAgentBreakdownRow, RunCancelledError, type RunErrorBreakdownRow, type RunMetrics, type RunToolCallRow, type RunTrendPoint, type RunWhere, SKILL_TOOL_DESCRIPTION, SKILL_TOOL_NAME, type ScopeContext, type ScopeResolver, type SearchMemoriesInput, type SettledTask, type SinkWriter, type Skill, type SkillAuthor, type SkillCatalogEntry, type SkillContext, type SkillLoadOutcome, type SkillOffer, type SkillProvider, type SkillSummary, type SkillToolInput, type SkillWriteRequest, type SkillWriteVerdict, type SkillsConfig, type StageAttachmentInput, type StagedAttachment, type StoreMemoryInput, StoredMessage, type StreamError, type StructuredOutcome, StructuredOutputError, THREAD_DETAIL_CONTENT_CHARS, type ThreadActivityRow, ThreadDetail, type ThreadMessageRow, type ThreadMeta, type ThreadSpendRow, ThreadSummary, type ThreadTurnPage, type ThreadTurnQuery, type ThreadTurnReader, type ThreadUsageRollup, type ThreadWhere, type TokenStreamSink, type ToolCallActivityRow, ToolCallApproval, type ToolCallApprovalColumns, type ToolCallApprovalState, ToolCallRequest, ToolCallStatus, type ToolCallWhere, ToolDefinition, ToolDisabledError, ToolForbiddenError, ToolHandler, ToolInputInvalidError, ToolKind, type ToolKindDeps, ToolNotFoundError, ToolRegistry, ToolResult, ToolSpec, type ToolStatRow, ToolStepEnvelope, ToolTransientRetrySetting, type TurnFrameSummary, type UiCollector, type UpdateThreadInput, type UpdateToolCallInput, UsagePurpose, type UsageTrendPoint, type WindowHistoryOptions, type WithMemoryToolInput, type WriteMemoryInput, actorScope, agentDiagnosticKey, agentFailureCode, bucketByActor, bucketByModel, bucketByThread, bucketUsageTrend, buildMemoryBlock, buildSkillsBlock, canActorUseTool, compositeSkillProvider, createFrameBuffer, createIncrementalGate, createUiCollector, dayBoundsUtc, defaultCanDecide, defaultScopeResolver, detachedDelivered, detachedStarted, detachedUnsettled, estimateCost, estimateMessageTokens, extractJson, filterToolsByAllowList, filterToolsByCanUse, filterToolsByEnabled, filterToolsByRole, gateFollowUps, gateTail, isControlFlowSignal, isReplayIntegrityError, isToolEnabled, loadSkill, mayDecideApproval, memoryForgetVerdict, memoryWriteVerdict, mergeUi, normalizeDelegation, observeTurnFrames, offerMemories, offerSkills, publishAgentDelegated, publishAgentMemoryResolved, publishAgentMemoryWritten, publishAgentMessage, publishAgentQuotaExceeded, publishAgentRetrieved, publishAgentRunFailed, publishAgentRunFinished, publishAgentRunStarted, publishAgentSkillsResolved, publishAgentToolCall, publishAgentToolRetry, releaseGatedFrames, rememberInputSchema, rememberToolDefinition, repairInstruction, resolveGateLookback, resolveMemoryDigest, resolveOutputGateMode, resolveSkillCatalog, rollupThreadUsage, runAgentLoop, runInputProcessors, runOutputProcessors, seedModelPrices, settleAll, settleUnsettledDelegation, skillInputSchema, skillToolDefinition, skillWriteVerdict, stampToolKinds, staticSkillProvider, summarizeWithModel, tenantScope, toolCallApprovalFromRow, traceLlmTurn, traceToolExecution, truncateDetailContent, unwrapToolStepOutput, validateStructured, windowHistory, withAskTool, withMemoryTool, withSkillTool, withToolTimeout, withTurnFrames, wrapToolStepOutput, writeMemory };
3473
+ export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_ATTACHMENT_STAGING, AGENT_DEPS_FACTORY, AGENT_DIAGNOSTIC_EVENTS, AGENT_DURABLE_RUNNER, AGENT_EMBEDDING_PROVIDER, AGENT_GOVERNANCE_QUERIES, AGENT_MEMORY, AGENT_MODEL, AGENT_MODEL_CATALOG, AGENT_OPTIONS, AGENT_PRICING_STORE, AGENT_PROMPT_CONTRIBUTORS, AGENT_QUOTA_PROVIDER, AGENT_QUOTA_STORE, AGENT_REGISTRY, AGENT_RETRIEVER, AGENT_ROLES_POLICY, AGENT_RUNNER, AGENT_SINK, AGENT_SKILLS, AGENT_SKILL_SOURCES, AGENT_SPAN_EVENTS, AGENT_STORE, AGENT_TOOL_REGISTRY, APPROVAL_EXPIRED_REASON, Actor, type ActorDirectory, type ActorResolver, type ActorSpendRow, type AgentApprovalPort, AgentDefinition, type AgentDelegated, AgentDelegation, type AgentDiagnosticEvent, type AgentDiagnosticKey, type AgentFollowUpsSpan, type AgentGovernanceQueries, AgentIntake, type AgentLlmTurnSpan, type AgentLoopDeps, type AgentLoopHooks, type AgentLoopResult, type AgentMemoryResolved, type AgentMemoryWritten, type AgentMessageEvent, type AgentPricingStore, type AgentQuotaExceeded, AgentRegistry, type AgentRetrievalSpan, type AgentRetrieved, type AgentRunFailed, type AgentRunFinished, AgentRunInput, type AgentRunStarted, type AgentRunner, type AgentSkillsResolved, type AgentSpanEvent, type AgentStore, AgentStreamError, AgentStreamEvent, type AgentStructuredOutputSpan, type AgentToolCallEvent, type AgentToolExecutionSpan, type AgentToolRetry, AgentUiComponent, AiToolCtx, type AppendMessageInput, type ApprovalDecisionRef, type ApprovalPolicy, type ApprovalRequirement, type ApprovalThreadRef, type ApprovalToolRef, type ApprovalWhere, type AttachmentRef, type AttachmentStagingStore, type BufferedModelTurnResult, type BuildMemoryBlockInput, type CostUsage, type CreateThreadInput, type CurrentModelPrice, DEFAULT_HISTORY_SUMMARY_INSTRUCTION, DEFAULT_MAX_FACT_CHARS, DEFAULT_MAX_MEMORIES, DEFAULT_MAX_SKILLS, DEFAULT_REFUSAL_REASON, DEFAULT_STRUCTURED_OUTPUT_INSTRUCTION, Decision, DefaultApprovalPolicy, DefaultRolesPolicy, type DetachedDelegationOutcome, type DetachedDelegationReceipt, DetachedDelivery, type DetailThreadRef, ElicitationRequest, type EmbeddingProvider, type EmitUi, type ForgetMemoryInput, type FrameBuffer, GLOBAL_SCOPE, type GovernancePage, type GovernancePageQuery, type GovernanceRange, type GovernanceRunDetail, type GovernanceThreadDetail, type GovernanceThreadDetailQuery, type GovernanceUsageInput, HistoryPolicy, HumanReply, type IncrementalGate, InputProcessor, type ListMemoriesInput, type ListSkillsInput, type ListStagedAttachmentsInput, LlmStepEnvelope, type LoadSkillInput, type MemoryAuthor, type MemoryConfig, type MemoryDigest, type MemoryDigestEntry, type MemoryFact, type MemoryForgetRequest, type MemoryOrigin, type MemoryProvider, type MemoryRecord, type MemoryVerdict, type MemoryWriteOutcome, type MemoryWriteRequest, MessageAttachment, MessageFeedback, MessageUsage, ModelAnswer, type ModelCatalog, type ModelCatalogEntry, type ModelCatalogProviderGroup, type ModelCatalogQuery, type ModelCatalogView, ModelMessage, type ModelPrice, type ModelPriceInput, type ModelProvider, type ModelSpendRow, type ModelTurnArgs, type ModelTurnResult, type ObservedTurnFrames, type OfferMemoriesInput, type OutputGateMode, type OutputGateResult, OutputProcessor, type OverriddenMemory, PageContext, type Passage, type PendingApprovalRow, ProcessedPrompt, ProcessorContext, PromptBuilder, PromptContributor, type QuotaBlock, QuotaExceededError, type QuotaPeriod, type QuotaProvider, type QuotaQuery, type QuotaReport, QuotaState, type QuotaStore, type QuotaWindow, REMEMBER_TOOL_DESCRIPTION, REMEMBER_TOOL_NAME, REQUESTER_APPROVER, type RecentRunRow, type RecordRunEndInput, type RecordRunStartInput, type RecordToolCallInput, type RecordUsageInput, type RememberToolInput, type RerankOptions, type Reranker, type ResolveAttachmentInput, type ResolveMemoryDigestInput, type ResolvedDelegation, type RetrieveOptions, type Retriever, type RolesPolicy, type RunAgentBreakdownRow, RunCancelledError, type RunErrorBreakdownRow, type RunMetrics, type RunToolCallRow, type RunTrendPoint, type RunWhere, SKILL_TOOL_DESCRIPTION, SKILL_TOOL_NAME, type ScopeContext, type ScopeResolver, type SearchMemoriesInput, type SettledTask, type SinkWriter, type Skill, type SkillAuthor, type SkillCatalogEntry, type SkillContext, type SkillLoadOutcome, type SkillOffer, type SkillProvider, type SkillSummary, type SkillToolInput, type SkillWriteRequest, type SkillWriteVerdict, type SkillsConfig, type StageAttachmentInput, type StagedAttachment, type StoreMemoryInput, StoredMessage, type StreamError, type StructuredOutcome, StructuredOutputError, THREAD_DETAIL_CONTENT_CHARS, type ThreadActivityRow, ThreadDetail, type ThreadMessageRow, type ThreadMeta, type ThreadSpendRow, ThreadSummary, type ThreadTurnPage, type ThreadTurnQuery, type ThreadTurnReader, type ThreadUsageRollup, type ThreadWhere, type TokenStreamSink, type ToolCallActivityRow, ToolCallApproval, type ToolCallApprovalColumns, type ToolCallApprovalState, ToolCallRequest, ToolCallStatus, type ToolCallWhere, ToolDefinition, ToolDisabledError, ToolForbiddenError, ToolHandler, ToolInputInvalidError, ToolKind, type ToolKindDeps, ToolNotFoundError, ToolRegistry, ToolResult, ToolSpec, type ToolStatRow, ToolStepEnvelope, ToolTransientRetrySetting, type TurnFrameSummary, type UiCollector, type UpdateThreadInput, type UpdateToolCallInput, UsagePurpose, type UsageTrendPoint, type WindowHistoryOptions, type WithMemoryToolInput, type WriteMemoryInput, actorScope, agentDiagnosticKey, agentFailureCode, bucketByActor, bucketByModel, bucketByThread, bucketUsageTrend, buildMemoryBlock, buildSkillsBlock, canActorUseTool, compositeSkillProvider, createFrameBuffer, createIncrementalGate, createUiCollector, dayBoundsUtc, defaultCanDecide, defaultScopeResolver, detachedDelivered, detachedStarted, detachedUnsettled, estimateCost, estimateMessageTokens, exhaustedWindow, extractJson, filterToolsByAllowList, filterToolsByCanUse, filterToolsByEnabled, filterToolsByRole, findCatalogModel, gateFollowUps, gateTail, isControlFlowSignal, isReplayIntegrityError, isToolEnabled, loadSkill, mayDecideApproval, memoryForgetVerdict, memoryWriteVerdict, mergeUi, normalizeDelegation, observeTurnFrames, offerMemories, offerSkills, publishAgentDelegated, publishAgentMemoryResolved, publishAgentMemoryWritten, publishAgentMessage, publishAgentQuotaExceeded, publishAgentRetrieved, publishAgentRunFailed, publishAgentRunFinished, publishAgentRunStarted, publishAgentSkillsResolved, publishAgentToolCall, publishAgentToolRetry, quotaPeriodRange, releaseGatedFrames, rememberInputSchema, rememberToolDefinition, repairInstruction, resolveGateLookback, resolveMemoryDigest, resolveOutputGateMode, resolveSkillCatalog, rollupThreadUsage, runAgentLoop, runInputProcessors, runOutputProcessors, seedModelPrices, settleAll, settleUnsettledDelegation, skillInputSchema, skillToolDefinition, skillWriteVerdict, stampToolKinds, staticModelCatalog, staticSkillProvider, summarizeWithModel, tenantScope, toolCallApprovalFromRow, traceLlmTurn, traceToolExecution, truncateDetailContent, unwrapToolStepOutput, validateStructured, windowHistory, withAskTool, withMemoryTool, withSelectedModel, withSkillTool, withToolTimeout, withTurnFrames, wrapToolStepOutput, writeMemory };
package/dist/index.js CHANGED
@@ -14,6 +14,8 @@ var AGENT_TOOL_REGISTRY = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:too
14
14
  var AGENT_REGISTRY = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:agent-registry");
15
15
  var AGENT_ACTOR_RESOLVER = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:actor-resolver");
16
16
  var AGENT_GOVERNANCE_QUERIES = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:governance-queries");
17
+ var AGENT_QUOTA_PROVIDER = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:quota-provider");
18
+ var AGENT_MODEL_CATALOG = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:model-catalog");
17
19
  var AGENT_PRICING_STORE = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:pricing-store");
18
20
  var AGENT_RETRIEVER = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:retriever");
19
21
  var AGENT_EMBEDDING_PROVIDER = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:embedding-provider");
@@ -26,6 +28,31 @@ var AGENT_SKILLS = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:skills");
26
28
  var AGENT_MEMORY = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:memory");
27
29
  var AGENT_SKILL_SOURCES = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:skill-sources");
28
30
 
31
+ // src/spi/model-catalog.ts
32
+ function staticModelCatalog(view) {
33
+ return {
34
+ list: /* @__PURE__ */ __name(() => view, "list")
35
+ };
36
+ }
37
+ __name(staticModelCatalog, "staticModelCatalog");
38
+ function findCatalogModel(view, id) {
39
+ for (const group of view.providers) {
40
+ const found = group.models.find((model) => model.id === id);
41
+ if (found !== void 0) return found;
42
+ }
43
+ return void 0;
44
+ }
45
+ __name(findCatalogModel, "findCatalogModel");
46
+ function withSelectedModel(provider, model) {
47
+ return {
48
+ runTurn: /* @__PURE__ */ __name((args) => provider.runTurn({
49
+ ...args,
50
+ model
51
+ }), "runTurn")
52
+ };
53
+ }
54
+ __name(withSelectedModel, "withSelectedModel");
55
+
29
56
  // src/spi/token-stream-sink.ts
30
57
  var AgentStreamError = class extends Error {
31
58
  static {
@@ -246,6 +273,43 @@ function mergeUi(...lists) {
246
273
  }
247
274
  __name(mergeUi, "mergeUi");
248
275
 
276
+ // src/spi/quota-provider.ts
277
+ function exhaustedWindow(windows) {
278
+ for (const window of windows) {
279
+ const tokensOut = window.limitTokens !== void 0 && window.usedTokens >= window.limitTokens;
280
+ const spendOut = window.limitUsd !== void 0 && window.usedUsd >= window.limitUsd;
281
+ if (tokensOut || spendOut) {
282
+ return {
283
+ period: window.period,
284
+ reason: `${window.period === "day" ? "Daily" : "Monthly"} ${spendOut ? "spend" : "token"} limit reached`
285
+ };
286
+ }
287
+ }
288
+ return void 0;
289
+ }
290
+ __name(exhaustedWindow, "exhaustedWindow");
291
+ function quotaPeriodRange(period, now) {
292
+ const year = now.getUTCFullYear();
293
+ const month = now.getUTCMonth();
294
+ const day = now.toISOString().slice(0, 10);
295
+ if (period === "day") {
296
+ const next = new Date(Date.UTC(year, month, now.getUTCDate() + 1));
297
+ return {
298
+ fromDay: day,
299
+ toDay: day,
300
+ resetsAt: next.toISOString()
301
+ };
302
+ }
303
+ const first = new Date(Date.UTC(year, month, 1));
304
+ const last = new Date(Date.UTC(year, month + 1, 0));
305
+ return {
306
+ fromDay: first.toISOString().slice(0, 10),
307
+ toDay: last.toISOString().slice(0, 10),
308
+ resetsAt: new Date(Date.UTC(year, month + 1, 1)).toISOString()
309
+ };
310
+ }
311
+ __name(quotaPeriodRange, "quotaPeriodRange");
312
+
249
313
  // src/spi/pricing-store.ts
250
314
  async function seedModelPrices(store, prices) {
251
315
  for (const price of prices) {
@@ -3922,7 +3986,12 @@ async function invokeClaimedToolsTogether(turn, parallel, claimed) {
3922
3986
  return results;
3923
3987
  }
3924
3988
  __name(invokeClaimedToolsTogether, "invokeClaimedToolsTogether");
3925
- async function runAgentLoop(deps, input, hooks) {
3989
+ async function runAgentLoop(boundDeps, input, hooks) {
3990
+ const deps = input.model === void 0 ? boundDeps : {
3991
+ ...boundDeps,
3992
+ model: withSelectedModel(boundDeps.model, input.model),
3993
+ modelId: input.model
3994
+ };
3926
3995
  const maxSteps = deps.maxSteps ?? 8;
3927
3996
  let system = await resolveSystemPrompt(deps, input);
3928
3997
  const inputProcessors = deps.inputProcessors ?? [];
@@ -4119,6 +4188,9 @@ ${block}`;
4119
4188
  actor: input.actor,
4120
4189
  ...gated ? {
4121
4190
  bufferOutput: true
4191
+ } : {},
4192
+ ...input.model !== void 0 ? {
4193
+ model: input.model
4122
4194
  } : {}
4123
4195
  });
4124
4196
  } else {
@@ -4537,9 +4609,11 @@ export {
4537
4609
  AGENT_GOVERNANCE_QUERIES,
4538
4610
  AGENT_MEMORY,
4539
4611
  AGENT_MODEL,
4612
+ AGENT_MODEL_CATALOG,
4540
4613
  AGENT_OPTIONS,
4541
4614
  AGENT_PRICING_STORE,
4542
4615
  AGENT_PROMPT_CONTRIBUTORS,
4616
+ AGENT_QUOTA_PROVIDER,
4543
4617
  AGENT_QUOTA_STORE,
4544
4618
  AGENT_REGISTRY,
4545
4619
  AGENT_RETRIEVER,
@@ -4613,11 +4687,13 @@ export {
4613
4687
  encodeStreamEvent,
4614
4688
  estimateCost,
4615
4689
  estimateMessageTokens,
4690
+ exhaustedWindow,
4616
4691
  extractJson,
4617
4692
  filterToolsByAllowList,
4618
4693
  filterToolsByCanUse,
4619
4694
  filterToolsByEnabled,
4620
4695
  filterToolsByRole,
4696
+ findCatalogModel,
4621
4697
  gateFollowUps,
4622
4698
  gateTail,
4623
4699
  invokeWithTransientRetry,
@@ -4649,6 +4725,7 @@ export {
4649
4725
  publishAgentToolCall,
4650
4726
  publishAgentToolRetry,
4651
4727
  questionOptions,
4728
+ quotaPeriodRange,
4652
4729
  readElicitationInput,
4653
4730
  readElicitationQuestions,
4654
4731
  releaseGatedFrames,
@@ -4674,6 +4751,7 @@ export {
4674
4751
  skillToolDefinition,
4675
4752
  skillWriteVerdict,
4676
4753
  stampToolKinds,
4754
+ staticModelCatalog,
4677
4755
  staticSkillProvider,
4678
4756
  summarizeWithModel,
4679
4757
  tenantScope,
@@ -4688,6 +4766,7 @@ export {
4688
4766
  windowHistory,
4689
4767
  withAskTool,
4690
4768
  withMemoryTool,
4769
+ withSelectedModel,
4691
4770
  withSkillTool,
4692
4771
  withToolTimeout,
4693
4772
  withTurnFrames,