@dudousxd/nestjs-agent-core 0.25.0 → 0.26.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 +3 -1
- package/dist/catalog-CrzetM3_.d.cts +147 -0
- package/dist/catalog-CrzetM3_.d.ts +147 -0
- package/dist/genui/builtins.cjs +555 -0
- package/dist/genui/builtins.cjs.map +1 -0
- package/dist/genui/builtins.d.cts +47 -0
- package/dist/genui/builtins.d.ts +47 -0
- package/dist/genui/builtins.js +511 -0
- package/dist/genui/builtins.js.map +1 -0
- package/dist/genui/index.cjs +1225 -0
- package/dist/genui/index.cjs.map +1 -0
- package/dist/genui/index.d.cts +175 -0
- package/dist/genui/index.d.ts +175 -0
- package/dist/genui/index.js +1175 -0
- package/dist/genui/index.js.map +1 -0
- package/dist/guardrails/index.d.cts +2 -1
- package/dist/guardrails/index.d.ts +2 -1
- package/dist/index.cjs +51 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -5
- package/dist/index.d.ts +14 -5
- package/dist/index.js +50 -11
- package/dist/index.js.map +1 -1
- package/dist/processors-Bf1fYLbY.d.cts +160 -0
- package/dist/processors-CK1RWv0D.d.ts +160 -0
- package/dist/{tool-fLRLs_f3.d.cts → tool-BXKG2xSm.d.cts} +36 -163
- package/dist/{tool-fLRLs_f3.d.ts → tool-BXKG2xSm.d.ts} +36 -163
- package/package.json +24 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { M as ModelMessage,
|
|
2
|
-
export {
|
|
1
|
+
import { M as ModelMessage, c as ToolDefinition, d as ToolCallRequest, e as MessageUsage, f as AgentUiComponent, A as Actor, g as AiToolCtx, h as AgentStreamEvent, i as ThreadSummary, j as ThreadDetail, S as StoredMessage, k as ToolResult, l as MessageAttachment, m as MessageFeedback, n as ToolCallStatus, U as UsagePurpose, T as ToolSpec, Q as QuotaState, o as AgentRunInput, H as HumanReply, p as ToolKind, q as ToolCallApproval, a as ToolHandler, r as HistoryPolicy, P as PageContext, s as AgentDefinition, t as AgentDelegation, D as DetachedDelivery, u as ToolDescribeScope, v as PromptBuilder, w as PromptContributor, x as ToolTransientRetrySetting, y as AgentIntake, z as Decision, E as ElicitationRequest, L as LlmStepEnvelope, B as ToolStepEnvelope } from './tool-BXKG2xSm.cjs';
|
|
2
|
+
export { C as ASK_TOOL_DESCRIPTION, F as ASK_TOOL_NAME, G as AgentApprovalRequest, I as AgentApprovalSettlement, J as AgentCatalogEntry, K as AgentHistoryWindow, N as AskToolInput, O as DEFAULT_INTAKE_PREAMBLE, R as DEFAULT_TOOL_TRANSIENT_RETRY_ATTEMPTS, V as DEFAULT_TOOL_TRANSIENT_RETRY_BACKOFF_MS, W as ELICITATION_INPUT_TYPES, X as ElicitationInput, Y as ElicitationInputType, Z as ElicitationOption, _ as ElicitationOutcome, $ as ElicitationQuestion, a0 as ElicitationReply, a1 as ElicitationResult, a2 as HistoryPolicyContext, a3 as HistorySelection, a4 as HistorySummary, a5 as InvokeWithTransientRetryOptions, a6 as MAX_ASK_QUESTIONS, a7 as MessageFeedbackValue, a8 as MessageRole, a9 as PromptContext, aa as QuotaView, ab as ToolCallApprovalStatus, ac as ToolCatalogEntry, ad as ToolConfirmation, ae as ToolDescription, b as ToolPresentation, af as ToolPresentationTone, ag as ToolResultField, ah as ToolResultView, ai as ToolStepCtx, aj as ToolTransientRetryNumbers, ak as ToolTransientRetryOptions, al as askInputSchema, am as askToolDefinition, an as decodeStreamEvent, ao as encodeStreamEvent, ap as invokeWithTransientRetry, aq as isTransientToolError, ar as isTypedQuestion, as as normalizeElicitationReply, at as questionOptions, au as readElicitationInput, av as readElicitationQuestions, aw as renderElicitationAnswers, ax as resolveElicitation, ay as resolveToolTransientRetryNumbers, az as settleElicitation, aA as validateElicitationAnswer, aB as validateElicitationValue } from './tool-BXKG2xSm.cjs';
|
|
3
3
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
4
|
+
import { O as OutputProcessor, P as ProcessorContext, I as InputProcessor, a as ProcessedPrompt, M as ModelAnswer } from './processors-Bf1fYLbY.cjs';
|
|
5
|
+
export { D as DEFAULT_INCREMENTAL_LOOKBACK_CHARS, b as IncrementalGating, c as OutputRejectedError, d as OutputVerdict, e as ProcessorFailedError } from './processors-Bf1fYLbY.cjs';
|
|
4
6
|
import { ChannelRegistry } from '@dudousxd/nestjs-diagnostics';
|
|
5
7
|
|
|
6
8
|
/**
|
|
@@ -311,7 +313,13 @@ declare function unwrapToolStepOutput(raw: unknown): {
|
|
|
311
313
|
output: unknown;
|
|
312
314
|
ui: AgentUiComponent[];
|
|
313
315
|
};
|
|
314
|
-
type EmitUi =
|
|
316
|
+
type EmitUi = AiToolCtx['emitUi'];
|
|
317
|
+
/**
|
|
318
|
+
* `ctx.emitUi` where there is no conversation to push into (the MCP server, a direct
|
|
319
|
+
* `registry.invoke`): nothing is streamed or persisted, but the call resolves to an id — the one it
|
|
320
|
+
* was given, else `<scope>:ui:<n>` — so a tool never has to test for the capability.
|
|
321
|
+
*/
|
|
322
|
+
declare function createNoopEmitUi(scope?: string): EmitUi;
|
|
315
323
|
/** Collects what one tool invocation pushes, streaming each push as it happens. */
|
|
316
324
|
interface UiCollector {
|
|
317
325
|
emit: EmitUi;
|
|
@@ -2750,13 +2758,14 @@ declare class ToolRegistry {
|
|
|
2750
2758
|
* feature-flag store, an MCP server — and this runs once per model step. Asking those about a
|
|
2751
2759
|
* tool the allow-list has already excluded is a call whose answer nothing reads.
|
|
2752
2760
|
*/
|
|
2753
|
-
definitionsFor(actor: Actor, policy: RolesPolicy, allowedTools?: string[]): Promise<ToolDefinition[]>;
|
|
2761
|
+
definitionsFor(actor: Actor, policy: RolesPolicy, allowedTools?: string[], scope?: Omit<ToolDescribeScope, 'actor'>): Promise<ToolDefinition[]>;
|
|
2754
2762
|
/**
|
|
2755
2763
|
* The specs {@link definitionsFor} offers the model, whole — the same four gates (allow-list,
|
|
2756
2764
|
* enabled, role, `canUse`) in the same order. For a surface that lists what an actor can reach
|
|
2757
2765
|
* (`GET <base>/tools`), which must never disagree with what the model is actually shown.
|
|
2758
2766
|
*/
|
|
2759
2767
|
visibleSpecs(actor: Actor, policy: RolesPolicy, allowedTools?: string[]): Promise<ToolSpec[]>;
|
|
2768
|
+
private visibleEntries;
|
|
2760
2769
|
/**
|
|
2761
2770
|
* Run a tool. Re-checks that the tool is enabled and that the role allows it (defense-in-depth —
|
|
2762
2771
|
* a call can reach here from a replayed durable step or an approval granted before the flag
|
|
@@ -3470,4 +3479,4 @@ type AgentDiagnosticKey = `agent:${AgentDiagnosticEvent}`;
|
|
|
3470
3479
|
*/
|
|
3471
3480
|
declare function agentDiagnosticKey(event: AgentDiagnosticEvent): AgentDiagnosticKey;
|
|
3472
3481
|
|
|
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 };
|
|
3482
|
+
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, ToolDescribeScope, 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, createNoopEmitUi, 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,6 +1,8 @@
|
|
|
1
|
-
import { M as ModelMessage,
|
|
2
|
-
export {
|
|
1
|
+
import { M as ModelMessage, c as ToolDefinition, d as ToolCallRequest, e as MessageUsage, f as AgentUiComponent, A as Actor, g as AiToolCtx, h as AgentStreamEvent, i as ThreadSummary, j as ThreadDetail, S as StoredMessage, k as ToolResult, l as MessageAttachment, m as MessageFeedback, n as ToolCallStatus, U as UsagePurpose, T as ToolSpec, Q as QuotaState, o as AgentRunInput, H as HumanReply, p as ToolKind, q as ToolCallApproval, a as ToolHandler, r as HistoryPolicy, P as PageContext, s as AgentDefinition, t as AgentDelegation, D as DetachedDelivery, u as ToolDescribeScope, v as PromptBuilder, w as PromptContributor, x as ToolTransientRetrySetting, y as AgentIntake, z as Decision, E as ElicitationRequest, L as LlmStepEnvelope, B as ToolStepEnvelope } from './tool-BXKG2xSm.js';
|
|
2
|
+
export { C as ASK_TOOL_DESCRIPTION, F as ASK_TOOL_NAME, G as AgentApprovalRequest, I as AgentApprovalSettlement, J as AgentCatalogEntry, K as AgentHistoryWindow, N as AskToolInput, O as DEFAULT_INTAKE_PREAMBLE, R as DEFAULT_TOOL_TRANSIENT_RETRY_ATTEMPTS, V as DEFAULT_TOOL_TRANSIENT_RETRY_BACKOFF_MS, W as ELICITATION_INPUT_TYPES, X as ElicitationInput, Y as ElicitationInputType, Z as ElicitationOption, _ as ElicitationOutcome, $ as ElicitationQuestion, a0 as ElicitationReply, a1 as ElicitationResult, a2 as HistoryPolicyContext, a3 as HistorySelection, a4 as HistorySummary, a5 as InvokeWithTransientRetryOptions, a6 as MAX_ASK_QUESTIONS, a7 as MessageFeedbackValue, a8 as MessageRole, a9 as PromptContext, aa as QuotaView, ab as ToolCallApprovalStatus, ac as ToolCatalogEntry, ad as ToolConfirmation, ae as ToolDescription, b as ToolPresentation, af as ToolPresentationTone, ag as ToolResultField, ah as ToolResultView, ai as ToolStepCtx, aj as ToolTransientRetryNumbers, ak as ToolTransientRetryOptions, al as askInputSchema, am as askToolDefinition, an as decodeStreamEvent, ao as encodeStreamEvent, ap as invokeWithTransientRetry, aq as isTransientToolError, ar as isTypedQuestion, as as normalizeElicitationReply, at as questionOptions, au as readElicitationInput, av as readElicitationQuestions, aw as renderElicitationAnswers, ax as resolveElicitation, ay as resolveToolTransientRetryNumbers, az as settleElicitation, aA as validateElicitationAnswer, aB as validateElicitationValue } from './tool-BXKG2xSm.js';
|
|
3
3
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
4
|
+
import { O as OutputProcessor, P as ProcessorContext, I as InputProcessor, a as ProcessedPrompt, M as ModelAnswer } from './processors-CK1RWv0D.js';
|
|
5
|
+
export { D as DEFAULT_INCREMENTAL_LOOKBACK_CHARS, b as IncrementalGating, c as OutputRejectedError, d as OutputVerdict, e as ProcessorFailedError } from './processors-CK1RWv0D.js';
|
|
4
6
|
import { ChannelRegistry } from '@dudousxd/nestjs-diagnostics';
|
|
5
7
|
|
|
6
8
|
/**
|
|
@@ -311,7 +313,13 @@ declare function unwrapToolStepOutput(raw: unknown): {
|
|
|
311
313
|
output: unknown;
|
|
312
314
|
ui: AgentUiComponent[];
|
|
313
315
|
};
|
|
314
|
-
type EmitUi =
|
|
316
|
+
type EmitUi = AiToolCtx['emitUi'];
|
|
317
|
+
/**
|
|
318
|
+
* `ctx.emitUi` where there is no conversation to push into (the MCP server, a direct
|
|
319
|
+
* `registry.invoke`): nothing is streamed or persisted, but the call resolves to an id — the one it
|
|
320
|
+
* was given, else `<scope>:ui:<n>` — so a tool never has to test for the capability.
|
|
321
|
+
*/
|
|
322
|
+
declare function createNoopEmitUi(scope?: string): EmitUi;
|
|
315
323
|
/** Collects what one tool invocation pushes, streaming each push as it happens. */
|
|
316
324
|
interface UiCollector {
|
|
317
325
|
emit: EmitUi;
|
|
@@ -2750,13 +2758,14 @@ declare class ToolRegistry {
|
|
|
2750
2758
|
* feature-flag store, an MCP server — and this runs once per model step. Asking those about a
|
|
2751
2759
|
* tool the allow-list has already excluded is a call whose answer nothing reads.
|
|
2752
2760
|
*/
|
|
2753
|
-
definitionsFor(actor: Actor, policy: RolesPolicy, allowedTools?: string[]): Promise<ToolDefinition[]>;
|
|
2761
|
+
definitionsFor(actor: Actor, policy: RolesPolicy, allowedTools?: string[], scope?: Omit<ToolDescribeScope, 'actor'>): Promise<ToolDefinition[]>;
|
|
2754
2762
|
/**
|
|
2755
2763
|
* The specs {@link definitionsFor} offers the model, whole — the same four gates (allow-list,
|
|
2756
2764
|
* enabled, role, `canUse`) in the same order. For a surface that lists what an actor can reach
|
|
2757
2765
|
* (`GET <base>/tools`), which must never disagree with what the model is actually shown.
|
|
2758
2766
|
*/
|
|
2759
2767
|
visibleSpecs(actor: Actor, policy: RolesPolicy, allowedTools?: string[]): Promise<ToolSpec[]>;
|
|
2768
|
+
private visibleEntries;
|
|
2760
2769
|
/**
|
|
2761
2770
|
* Run a tool. Re-checks that the tool is enabled and that the role allows it (defense-in-depth —
|
|
2762
2771
|
* a call can reach here from a replayed durable step or an approval granted before the flag
|
|
@@ -3470,4 +3479,4 @@ type AgentDiagnosticKey = `agent:${AgentDiagnosticEvent}`;
|
|
|
3470
3479
|
*/
|
|
3471
3480
|
declare function agentDiagnosticKey(event: AgentDiagnosticEvent): AgentDiagnosticKey;
|
|
3472
3481
|
|
|
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 };
|
|
3482
|
+
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, ToolDescribeScope, 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, createNoopEmitUi, 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
|
@@ -214,6 +214,22 @@ function unwrapToolStepOutput(raw) {
|
|
|
214
214
|
};
|
|
215
215
|
}
|
|
216
216
|
__name(unwrapToolStepOutput, "unwrapToolStepOutput");
|
|
217
|
+
function createNoopEmitUi(scope = "noop") {
|
|
218
|
+
let next = 0;
|
|
219
|
+
return async (_component, _props, options = {}) => {
|
|
220
|
+
if (options.id !== void 0) {
|
|
221
|
+
return {
|
|
222
|
+
id: options.id
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
const id = `${scope}:ui:${next}`;
|
|
226
|
+
next += 1;
|
|
227
|
+
return {
|
|
228
|
+
id
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
__name(createNoopEmitUi, "createNoopEmitUi");
|
|
217
233
|
function createUiCollector(toolCallId, write) {
|
|
218
234
|
const pushed = /* @__PURE__ */ new Map();
|
|
219
235
|
let next = 0;
|
|
@@ -2398,12 +2414,19 @@ var ToolRegistry = class {
|
|
|
2398
2414
|
* feature-flag store, an MCP server — and this runs once per model step. Asking those about a
|
|
2399
2415
|
* tool the allow-list has already excluded is a call whose answer nothing reads.
|
|
2400
2416
|
*/
|
|
2401
|
-
async definitionsFor(actor, policy, allowedTools) {
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2417
|
+
async definitionsFor(actor, policy, allowedTools, scope = {}) {
|
|
2418
|
+
const visible = await this.visibleEntries(actor, policy, allowedTools);
|
|
2419
|
+
return Promise.all(visible.map(async ({ spec, handler }) => {
|
|
2420
|
+
const override = handler.describe === void 0 ? void 0 : await handler.describe({
|
|
2421
|
+
actor,
|
|
2422
|
+
...scope
|
|
2423
|
+
});
|
|
2424
|
+
return {
|
|
2425
|
+
name: spec.name,
|
|
2426
|
+
kind: spec.kind,
|
|
2427
|
+
description: override?.description ?? spec.description,
|
|
2428
|
+
inputSchema: override?.inputSchema ?? spec.inputSchema
|
|
2429
|
+
};
|
|
2407
2430
|
}));
|
|
2408
2431
|
}
|
|
2409
2432
|
/**
|
|
@@ -2412,6 +2435,9 @@ var ToolRegistry = class {
|
|
|
2412
2435
|
* (`GET <base>/tools`), which must never disagree with what the model is actually shown.
|
|
2413
2436
|
*/
|
|
2414
2437
|
async visibleSpecs(actor, policy, allowedTools) {
|
|
2438
|
+
return (await this.visibleEntries(actor, policy, allowedTools)).map(({ spec }) => spec);
|
|
2439
|
+
}
|
|
2440
|
+
async visibleEntries(actor, policy, allowedTools) {
|
|
2415
2441
|
const pinnedNames = new Set(filterToolsByAllowList(this.allSpecs(), allowedTools).map((spec) => spec.name));
|
|
2416
2442
|
const pinned = [
|
|
2417
2443
|
...this.entries.values()
|
|
@@ -2419,8 +2445,7 @@ var ToolRegistry = class {
|
|
|
2419
2445
|
const live = await filterToolsByEnabled(pinned);
|
|
2420
2446
|
const allowedByRole = new Set((await filterToolsByRole(live.map((entry) => entry.spec), actor, policy)).map((spec) => spec.name));
|
|
2421
2447
|
const roleScoped = live.filter((entry) => allowedByRole.has(entry.spec.name));
|
|
2422
|
-
|
|
2423
|
-
return actorScoped.map(({ spec }) => spec);
|
|
2448
|
+
return filterToolsByCanUse(roleScoped, actor);
|
|
2424
2449
|
}
|
|
2425
2450
|
/**
|
|
2426
2451
|
* Run a tool. Re-checks that the tool is enabled and that the role allows it (defense-in-depth —
|
|
@@ -2445,7 +2470,11 @@ var ToolRegistry = class {
|
|
|
2445
2470
|
if (validation.issues !== void 0) {
|
|
2446
2471
|
throw new ToolInputInvalidError(name, validation.issues);
|
|
2447
2472
|
}
|
|
2448
|
-
|
|
2473
|
+
const withEmit = typeof ctx.emitUi === "function" ? ctx : {
|
|
2474
|
+
...ctx,
|
|
2475
|
+
emitUi: createNoopEmitUi(ctx.requestId)
|
|
2476
|
+
};
|
|
2477
|
+
return entry.handler.execute(validation.value, withEmit);
|
|
2449
2478
|
}
|
|
2450
2479
|
};
|
|
2451
2480
|
var DefaultRolesPolicy = class {
|
|
@@ -3135,7 +3164,10 @@ function toolContext(deps, input, hooks) {
|
|
|
3135
3164
|
} : {},
|
|
3136
3165
|
...deps.host !== void 0 ? {
|
|
3137
3166
|
host: deps.host
|
|
3138
|
-
} : {}
|
|
3167
|
+
} : {},
|
|
3168
|
+
// Replaced per tool call by the call's own collector (see the tool step); this one only serves
|
|
3169
|
+
// what runs outside a call — the elicitation wait.
|
|
3170
|
+
emitUi: createNoopEmitUi(hooks.runId)
|
|
3139
3171
|
};
|
|
3140
3172
|
}
|
|
3141
3173
|
__name(toolContext, "toolContext");
|
|
@@ -4186,6 +4218,7 @@ ${block}`;
|
|
|
4186
4218
|
system: prompt.system,
|
|
4187
4219
|
messages: prompt.messages,
|
|
4188
4220
|
actor: input.actor,
|
|
4221
|
+
threadId: input.threadId,
|
|
4189
4222
|
...gated ? {
|
|
4190
4223
|
bufferOutput: true
|
|
4191
4224
|
} : {},
|
|
@@ -4197,7 +4230,12 @@ ${block}`;
|
|
|
4197
4230
|
const tools = withMemoryTool({
|
|
4198
4231
|
tools: withSkillTool({
|
|
4199
4232
|
tools: withAskTool({
|
|
4200
|
-
tools: await deps.registry.definitionsFor(input.actor, deps.rolesPolicy, deps.toolAllowList
|
|
4233
|
+
tools: await deps.registry.definitionsFor(input.actor, deps.rolesPolicy, deps.toolAllowList, {
|
|
4234
|
+
threadId: input.threadId,
|
|
4235
|
+
...input.agentName !== void 0 ? {
|
|
4236
|
+
agentName: input.agentName
|
|
4237
|
+
} : {}
|
|
4238
|
+
}),
|
|
4201
4239
|
ask: deps.ask
|
|
4202
4240
|
}),
|
|
4203
4241
|
enabled: deps.skills !== void 0
|
|
@@ -4676,6 +4714,7 @@ export {
|
|
|
4676
4714
|
compositeSkillProvider,
|
|
4677
4715
|
createFrameBuffer,
|
|
4678
4716
|
createIncrementalGate,
|
|
4717
|
+
createNoopEmitUi,
|
|
4679
4718
|
createUiCollector,
|
|
4680
4719
|
dayBoundsUtc,
|
|
4681
4720
|
decodeStreamEvent,
|