@dudousxd/nestjs-agent-core 0.34.0 → 0.36.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/ag-ui/index.cjs +1064 -0
- package/dist/ag-ui/index.cjs.map +1 -0
- package/dist/ag-ui/index.d.cts +479 -0
- package/dist/ag-ui/index.d.ts +479 -0
- package/dist/ag-ui/index.js +1025 -0
- package/dist/ag-ui/index.js.map +1 -0
- package/dist/genui/index.d.cts +2 -1
- package/dist/genui/index.d.ts +2 -1
- package/dist/guardrails/index.d.cts +3 -2
- package/dist/guardrails/index.d.ts +3 -2
- package/dist/index.cjs +42 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +43 -7
- package/dist/index.d.ts +43 -7
- package/dist/index.js +40 -3
- package/dist/index.js.map +1 -1
- package/dist/{processors-CtrfAA0B.d.ts → processors-C0snQzZJ.d.cts} +1 -1
- package/dist/{processors-Bm2DniQ8.d.cts → processors-D5110pit.d.ts} +1 -1
- package/dist/{tool-C128TFWw.d.cts → stream-events-CgWqAI-1.d.cts} +455 -556
- package/dist/{tool-C128TFWw.d.ts → stream-events-CgWqAI-1.d.ts} +455 -556
- package/dist/tool-DklsS3JX.d.ts +119 -0
- package/dist/tool-DuJ-_qXM.d.cts +119 -0
- package/package.json +14 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { M as ModelMessage, c as ToolDefinition, d as ToolCallRequest, e as MessageUsage, f as AgentUiComponent,
|
|
2
|
-
export {
|
|
1
|
+
import { M as ModelMessage, c as ToolDefinition, d as ToolCallRequest, e as MessageUsage, f as AgentUiComponent, a as Actor, A as AgentStreamEvent, T as ToolSpec, Q as QuotaState, g as AgentRunInput, H as HumanReply, h as MessageAttachment, i as ToolKind, j as ToolCallStatus, k as ToolCallApproval, l as HistoryPolicy, P as PageContext, m as AgentDefinition, n as AgentStore, o as AgentDelegation, D as DetachedDelivery, p as PromptBuilder, q as PromptContributor, r as ToolTransientRetrySetting, s as AgentIntake, t as Decision, E as ElicitationRequest, L as LlmStepEnvelope, u as ToolStepEnvelope, C as ChatQueueStore, v as CreateThreadInput, w as ThreadSummary, x as ThreadDetail, y as ToolCallApprovalState, U as UpdateThreadInput, R as RecordRunStartInput, z as EnqueueMessageInput, B as QueuedMessage, F as QueuedMessagePatch, G as QueuePause, I as AppendMessageInput, S as StoredMessage, J as ToolResult, K as MessageFeedback, N as RecordToolCallInput, O as ToolCallOutcome, V as UpdateToolCallInput, W as RecordUsageInput } from './stream-events-CgWqAI-1.cjs';
|
|
2
|
+
export { X as ALL_AGENTS, Y as ASK_TOOL_DESCRIPTION, Z as ASK_TOOL_NAME, _ as AgentApprovalRequest, $ as AgentApprovalSettlement, a0 as AgentAttachmentConfig, a1 as AgentCatalogEntry, a2 as AgentClientConfig, a3 as AgentHistoryWindow, a4 as AgentStreamErrorCode, a5 as AskToolInput, a6 as ChatQueueState, a7 as DEFAULT_INTAKE_PREAMBLE, a8 as DEFAULT_TOOL_TRANSIENT_RETRY_ATTEMPTS, a9 as DEFAULT_TOOL_TRANSIENT_RETRY_BACKOFF_MS, aa as ELICITATION_INPUT_TYPES, ab as ElicitationInput, ac as ElicitationInputType, ad as ElicitationOption, ae as ElicitationOutcome, af as ElicitationQuestion, ag as ElicitationReply, ah as ElicitationResult, ai as HistoryPolicyContext, aj as HistorySelection, ak as HistorySummary, al as InvokeWithTransientRetryOptions, am as MAX_ASK_QUESTIONS, an as MessageFeedbackValue, ao as MessageRole, ap as PromptContext, aq as QueuePauseReason, ar as QueuedMessageView, as as QuotaView, at as RUN_ENDED_BEFORE_TOOL_CALL, au as RecordRunEndInput, av as ThreadTurnPage, aw as ThreadTurnQuery, ax as ThreadTurnReader, ay as ToolCallApprovalStatus, az as ToolCatalogEntry, aA as ToolConfirmation, b as ToolPresentation, aB as ToolPresentationTone, aC as ToolResultField, aD as ToolResultView, aE as ToolStepCtx, aF as ToolTransientRetryNumbers, aG as ToolTransientRetryOptions, aH as UNFINISHED_TOOL_CALL, aI as UsagePurpose, aJ as askInputSchema, aK as askToolDefinition, aL as danglingToolCallIds, aM as decodeStreamEvent, aN as encodeStreamEvent, aO as invokeWithTransientRetry, aP as isChatQueueStore, aQ as isTransientToolError, aR as isTypedQuestion, aS as normalizeElicitationReply, aT as questionOptions, aU as queuedMessageView, aV as readElicitationInput, aW as readElicitationQuestions, aX as releaseThreadRun, aY as renderElicitationAnswers, aZ as resolveElicitation, a_ as resolveToolTransientRetryNumbers, a$ as settleDanglingToolCalls, b0 as settleElicitation, b1 as validateElicitationAnswer, b2 as validateElicitationValue } from './stream-events-CgWqAI-1.cjs';
|
|
3
|
+
import { A as AiToolCtx, T as ToolHandler, a as ToolDescribeScope } from './tool-DuJ-_qXM.cjs';
|
|
4
|
+
export { b as ToolDescription } from './tool-DuJ-_qXM.cjs';
|
|
3
5
|
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-
|
|
5
|
-
export { D as DEFAULT_INCREMENTAL_LOOKBACK_CHARS, b as IncrementalGating, c as OutputRejectedError, d as OutputVerdict, e as ProcessorFailedError } from './processors-
|
|
6
|
+
import { O as OutputProcessor, P as ProcessorContext, I as InputProcessor, a as ProcessedPrompt, M as ModelAnswer } from './processors-C0snQzZJ.cjs';
|
|
7
|
+
export { D as DEFAULT_INCREMENTAL_LOOKBACK_CHARS, b as IncrementalGating, c as OutputRejectedError, d as OutputVerdict, e as ProcessorFailedError } from './processors-C0snQzZJ.cjs';
|
|
6
8
|
import { ChannelRegistry } from '@dudousxd/nestjs-diagnostics';
|
|
7
9
|
|
|
8
10
|
/**
|
|
@@ -2570,10 +2572,44 @@ declare class ToolRegistry {
|
|
|
2570
2572
|
* tools still park on approval either way.
|
|
2571
2573
|
*/
|
|
2572
2574
|
declare class DefaultRolesPolicy implements RolesPolicy {
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
+
readonly defaultRoles: string[];
|
|
2576
|
+
/** What an empty roles list means here — see {@link EmptyRoles}. */
|
|
2577
|
+
readonly emptyRoles: EmptyRoles;
|
|
2578
|
+
constructor(defaultRoles?: string[], options?: RolesPolicyOptions);
|
|
2575
2579
|
can(actor: Actor, tool: ToolSpec): boolean;
|
|
2576
2580
|
}
|
|
2581
|
+
/**
|
|
2582
|
+
* What an empty roles list means to {@link DefaultRolesPolicy}: `'allow'` (the default) — no
|
|
2583
|
+
* restriction; `'deny'` — nobody.
|
|
2584
|
+
*
|
|
2585
|
+
* The open default is what makes a one-line `AgentModule.forRoot({ model })` a working chat. It is
|
|
2586
|
+
* also why an app that used `[]` to DENY — a `roles` computed from permissions that can come out
|
|
2587
|
+
* empty, `defaultRoles: []` on a multi-tenant MCP surface — reaches everyone instead, silently.
|
|
2588
|
+
* `'deny'` keeps such an app closed.
|
|
2589
|
+
*/
|
|
2590
|
+
type EmptyRoles = 'allow' | 'deny';
|
|
2591
|
+
interface RolesPolicyOptions {
|
|
2592
|
+
/** What an empty roles list means. Default `'allow'`. */
|
|
2593
|
+
emptyRoles?: EmptyRoles;
|
|
2594
|
+
}
|
|
2595
|
+
/**
|
|
2596
|
+
* The closed gate — {@link DefaultRolesPolicy} with `emptyRoles: 'deny'`: the actor needs a role the
|
|
2597
|
+
* tool declares (else one of the default roles). A tool with no `roles` and no default roles, or with
|
|
2598
|
+
* an explicitly empty list, reaches nobody. What `AgentModule.forRoot({ emptyRoles: 'deny' })` binds.
|
|
2599
|
+
*/
|
|
2600
|
+
declare class ClosedRolesPolicy extends DefaultRolesPolicy {
|
|
2601
|
+
constructor(defaultRoles?: string[]);
|
|
2602
|
+
}
|
|
2603
|
+
/**
|
|
2604
|
+
* Close a policy you did not build: a tool whose roles come out empty — declared `[]`, or undeclared
|
|
2605
|
+
* with no default roles to fall back on — reaches nobody; anything else is the inner policy's call.
|
|
2606
|
+
*
|
|
2607
|
+
* The default roles are read off a {@link DefaultRolesPolicy}; any other inner policy keeps its own
|
|
2608
|
+
* defaults to itself, so for it an undeclared list counts as empty. A tool gated by `ability` has
|
|
2609
|
+
* nothing to do with roles and is always left to the inner policy. What the MCP server's
|
|
2610
|
+
* `emptyRoles: 'deny'` wraps the agent's shared policy in.
|
|
2611
|
+
*/
|
|
2612
|
+
declare function closeEmptyRoles(inner: RolesPolicy): RolesPolicy;
|
|
2577
2613
|
|
|
2578
2614
|
interface AgentLoopDeps<TOutput = unknown> {
|
|
2579
2615
|
model: ModelProvider;
|
|
@@ -3526,4 +3562,4 @@ declare class InMemoryAgentStore implements AgentStore, ChatQueueStore {
|
|
|
3526
3562
|
private toSummary;
|
|
3527
3563
|
}
|
|
3528
3564
|
|
|
3529
|
-
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 AgentRunStartOptions, type AgentRunStarted, type AgentRunner, type AgentSkillsResolved, type AgentSpanEvent, AgentStore, AgentStreamError, AgentStreamEvent, type AgentStructuredOutputSpan, type AgentToolCallEvent, type AgentToolExecutionSpan, type AgentToolRetry, AgentUiComponent, AiToolCtx, AppendMessageInput, type ApprovalDecisionRef, type ApprovalPolicy, type ApprovalRequirement, type ApprovalThreadRef, type ApprovalToolRef, type ApprovalWhere, type AttachmentRef, type AttachmentStagingDescription, type AttachmentStagingStore, type BufferedModelTurnResult, type BuildMemoryBlockInput, ChatQueueStore, type CostUsage, 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, EnqueueMessageInput, type ForgetMemoryInput, type FrameBuffer, GLOBAL_SCOPE, type GovernanceMessageRow, type GovernancePage, type GovernancePageQuery, type GovernancePendingApprovalRow, type GovernanceRange, type GovernanceRunDetail, type GovernanceRunRow, type GovernanceThreadDetail, type GovernanceThreadDetailQuery, type GovernanceThreadRow, type GovernanceToolCallRow, type GovernanceUsageInput, type GovernanceUsageRow, HistoryPolicy, HumanReply, InMemoryAgentStore, 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 ModelCatalogLock, 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, QueuePause, QueuedMessage, QueuedMessagePatch, type QuotaBlock, QuotaExceededError, type QuotaPeriod, type QuotaProvider, type QuotaQuery, type QuotaReport, QuotaState, type QuotaStore, type QuotaWarning, type QuotaWindow, REMEMBER_TOOL_DESCRIPTION, REMEMBER_TOOL_NAME, REQUESTER_APPROVER, RUN_FAILED_MESSAGE, RUN_NOT_ACTIVE_CODE, RUN_NOT_ACTIVE_MESSAGE, RUN_NO_LONGER_RUNNING, type RecentRunRow, RecordRunStartInput, RecordToolCallInput, 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 SettleDeadRunInput, 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 ThreadUsageRollup, type ThreadWhere, type TokenStreamSink, type ToolCallActivityRow, ToolCallApproval, type ToolCallApprovalColumns, ToolCallApprovalState, ToolCallOutcome, 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, UpdateThreadInput, UpdateToolCallInput, 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, exposeStreamErrorDetails, 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, quotaUsedRatio, quotaWarning, releaseGatedFrames, rememberInputSchema, rememberToolDefinition, repairInstruction, resolveGateLookback, resolveMemoryDigest, resolveOutputGateMode, resolveSkillCatalog, rollupThreadUsage, runAgentLoop, runInputProcessors, runOutputProcessors, seedModelPrices, settleAll, settleDeadRun, settleUnsettledDelegation, skillInputSchema, skillToolDefinition, skillWriteVerdict, stampToolKinds, staticModelCatalog, staticSkillProvider, streamFailure, summarizeWithModel, tenantScope, toolCallApprovalFromRow, toolCallContext, traceLlmTurn, traceToolExecution, truncateDetailContent, unwrapToolStepOutput, validateStructured, windowHistory, withAskTool, withMemoryTool, withSelectedModel, withSkillTool, withToolTimeout, withTurnFrames, wrapToolStepOutput, writeMemory };
|
|
3565
|
+
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 AgentRunStartOptions, type AgentRunStarted, type AgentRunner, type AgentSkillsResolved, type AgentSpanEvent, AgentStore, AgentStreamError, AgentStreamEvent, type AgentStructuredOutputSpan, type AgentToolCallEvent, type AgentToolExecutionSpan, type AgentToolRetry, AgentUiComponent, AiToolCtx, AppendMessageInput, type ApprovalDecisionRef, type ApprovalPolicy, type ApprovalRequirement, type ApprovalThreadRef, type ApprovalToolRef, type ApprovalWhere, type AttachmentRef, type AttachmentStagingDescription, type AttachmentStagingStore, type BufferedModelTurnResult, type BuildMemoryBlockInput, ChatQueueStore, ClosedRolesPolicy, type CostUsage, 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 EmptyRoles, EnqueueMessageInput, type ForgetMemoryInput, type FrameBuffer, GLOBAL_SCOPE, type GovernanceMessageRow, type GovernancePage, type GovernancePageQuery, type GovernancePendingApprovalRow, type GovernanceRange, type GovernanceRunDetail, type GovernanceRunRow, type GovernanceThreadDetail, type GovernanceThreadDetailQuery, type GovernanceThreadRow, type GovernanceToolCallRow, type GovernanceUsageInput, type GovernanceUsageRow, HistoryPolicy, HumanReply, InMemoryAgentStore, 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 ModelCatalogLock, 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, QueuePause, QueuedMessage, QueuedMessagePatch, type QuotaBlock, QuotaExceededError, type QuotaPeriod, type QuotaProvider, type QuotaQuery, type QuotaReport, QuotaState, type QuotaStore, type QuotaWarning, type QuotaWindow, REMEMBER_TOOL_DESCRIPTION, REMEMBER_TOOL_NAME, REQUESTER_APPROVER, RUN_FAILED_MESSAGE, RUN_NOT_ACTIVE_CODE, RUN_NOT_ACTIVE_MESSAGE, RUN_NO_LONGER_RUNNING, type RecentRunRow, RecordRunStartInput, RecordToolCallInput, RecordUsageInput, type RememberToolInput, type RerankOptions, type Reranker, type ResolveAttachmentInput, type ResolveMemoryDigestInput, type ResolvedDelegation, type RetrieveOptions, type Retriever, type RolesPolicy, type RolesPolicyOptions, 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 SettleDeadRunInput, 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 ThreadUsageRollup, type ThreadWhere, type TokenStreamSink, type ToolCallActivityRow, ToolCallApproval, type ToolCallApprovalColumns, ToolCallApprovalState, ToolCallOutcome, 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, UpdateThreadInput, UpdateToolCallInput, type UsageTrendPoint, type WindowHistoryOptions, type WithMemoryToolInput, type WriteMemoryInput, actorScope, agentDiagnosticKey, agentFailureCode, bucketByActor, bucketByModel, bucketByThread, bucketUsageTrend, buildMemoryBlock, buildSkillsBlock, canActorUseTool, closeEmptyRoles, compositeSkillProvider, createFrameBuffer, createIncrementalGate, createNoopEmitUi, createUiCollector, dayBoundsUtc, defaultCanDecide, defaultScopeResolver, detachedDelivered, detachedStarted, detachedUnsettled, estimateCost, estimateMessageTokens, exhaustedWindow, exposeStreamErrorDetails, 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, quotaUsedRatio, quotaWarning, releaseGatedFrames, rememberInputSchema, rememberToolDefinition, repairInstruction, resolveGateLookback, resolveMemoryDigest, resolveOutputGateMode, resolveSkillCatalog, rollupThreadUsage, runAgentLoop, runInputProcessors, runOutputProcessors, seedModelPrices, settleAll, settleDeadRun, settleUnsettledDelegation, skillInputSchema, skillToolDefinition, skillWriteVerdict, stampToolKinds, staticModelCatalog, staticSkillProvider, streamFailure, summarizeWithModel, tenantScope, toolCallApprovalFromRow, toolCallContext, traceLlmTurn, traceToolExecution, truncateDetailContent, unwrapToolStepOutput, validateStructured, windowHistory, withAskTool, withMemoryTool, withSelectedModel, withSkillTool, withToolTimeout, withTurnFrames, wrapToolStepOutput, writeMemory };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { M as ModelMessage, c as ToolDefinition, d as ToolCallRequest, e as MessageUsage, f as AgentUiComponent,
|
|
2
|
-
export {
|
|
1
|
+
import { M as ModelMessage, c as ToolDefinition, d as ToolCallRequest, e as MessageUsage, f as AgentUiComponent, a as Actor, A as AgentStreamEvent, T as ToolSpec, Q as QuotaState, g as AgentRunInput, H as HumanReply, h as MessageAttachment, i as ToolKind, j as ToolCallStatus, k as ToolCallApproval, l as HistoryPolicy, P as PageContext, m as AgentDefinition, n as AgentStore, o as AgentDelegation, D as DetachedDelivery, p as PromptBuilder, q as PromptContributor, r as ToolTransientRetrySetting, s as AgentIntake, t as Decision, E as ElicitationRequest, L as LlmStepEnvelope, u as ToolStepEnvelope, C as ChatQueueStore, v as CreateThreadInput, w as ThreadSummary, x as ThreadDetail, y as ToolCallApprovalState, U as UpdateThreadInput, R as RecordRunStartInput, z as EnqueueMessageInput, B as QueuedMessage, F as QueuedMessagePatch, G as QueuePause, I as AppendMessageInput, S as StoredMessage, J as ToolResult, K as MessageFeedback, N as RecordToolCallInput, O as ToolCallOutcome, V as UpdateToolCallInput, W as RecordUsageInput } from './stream-events-CgWqAI-1.js';
|
|
2
|
+
export { X as ALL_AGENTS, Y as ASK_TOOL_DESCRIPTION, Z as ASK_TOOL_NAME, _ as AgentApprovalRequest, $ as AgentApprovalSettlement, a0 as AgentAttachmentConfig, a1 as AgentCatalogEntry, a2 as AgentClientConfig, a3 as AgentHistoryWindow, a4 as AgentStreamErrorCode, a5 as AskToolInput, a6 as ChatQueueState, a7 as DEFAULT_INTAKE_PREAMBLE, a8 as DEFAULT_TOOL_TRANSIENT_RETRY_ATTEMPTS, a9 as DEFAULT_TOOL_TRANSIENT_RETRY_BACKOFF_MS, aa as ELICITATION_INPUT_TYPES, ab as ElicitationInput, ac as ElicitationInputType, ad as ElicitationOption, ae as ElicitationOutcome, af as ElicitationQuestion, ag as ElicitationReply, ah as ElicitationResult, ai as HistoryPolicyContext, aj as HistorySelection, ak as HistorySummary, al as InvokeWithTransientRetryOptions, am as MAX_ASK_QUESTIONS, an as MessageFeedbackValue, ao as MessageRole, ap as PromptContext, aq as QueuePauseReason, ar as QueuedMessageView, as as QuotaView, at as RUN_ENDED_BEFORE_TOOL_CALL, au as RecordRunEndInput, av as ThreadTurnPage, aw as ThreadTurnQuery, ax as ThreadTurnReader, ay as ToolCallApprovalStatus, az as ToolCatalogEntry, aA as ToolConfirmation, b as ToolPresentation, aB as ToolPresentationTone, aC as ToolResultField, aD as ToolResultView, aE as ToolStepCtx, aF as ToolTransientRetryNumbers, aG as ToolTransientRetryOptions, aH as UNFINISHED_TOOL_CALL, aI as UsagePurpose, aJ as askInputSchema, aK as askToolDefinition, aL as danglingToolCallIds, aM as decodeStreamEvent, aN as encodeStreamEvent, aO as invokeWithTransientRetry, aP as isChatQueueStore, aQ as isTransientToolError, aR as isTypedQuestion, aS as normalizeElicitationReply, aT as questionOptions, aU as queuedMessageView, aV as readElicitationInput, aW as readElicitationQuestions, aX as releaseThreadRun, aY as renderElicitationAnswers, aZ as resolveElicitation, a_ as resolveToolTransientRetryNumbers, a$ as settleDanglingToolCalls, b0 as settleElicitation, b1 as validateElicitationAnswer, b2 as validateElicitationValue } from './stream-events-CgWqAI-1.js';
|
|
3
|
+
import { A as AiToolCtx, T as ToolHandler, a as ToolDescribeScope } from './tool-DklsS3JX.js';
|
|
4
|
+
export { b as ToolDescription } from './tool-DklsS3JX.js';
|
|
3
5
|
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-
|
|
5
|
-
export { D as DEFAULT_INCREMENTAL_LOOKBACK_CHARS, b as IncrementalGating, c as OutputRejectedError, d as OutputVerdict, e as ProcessorFailedError } from './processors-
|
|
6
|
+
import { O as OutputProcessor, P as ProcessorContext, I as InputProcessor, a as ProcessedPrompt, M as ModelAnswer } from './processors-D5110pit.js';
|
|
7
|
+
export { D as DEFAULT_INCREMENTAL_LOOKBACK_CHARS, b as IncrementalGating, c as OutputRejectedError, d as OutputVerdict, e as ProcessorFailedError } from './processors-D5110pit.js';
|
|
6
8
|
import { ChannelRegistry } from '@dudousxd/nestjs-diagnostics';
|
|
7
9
|
|
|
8
10
|
/**
|
|
@@ -2570,10 +2572,44 @@ declare class ToolRegistry {
|
|
|
2570
2572
|
* tools still park on approval either way.
|
|
2571
2573
|
*/
|
|
2572
2574
|
declare class DefaultRolesPolicy implements RolesPolicy {
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
+
readonly defaultRoles: string[];
|
|
2576
|
+
/** What an empty roles list means here — see {@link EmptyRoles}. */
|
|
2577
|
+
readonly emptyRoles: EmptyRoles;
|
|
2578
|
+
constructor(defaultRoles?: string[], options?: RolesPolicyOptions);
|
|
2575
2579
|
can(actor: Actor, tool: ToolSpec): boolean;
|
|
2576
2580
|
}
|
|
2581
|
+
/**
|
|
2582
|
+
* What an empty roles list means to {@link DefaultRolesPolicy}: `'allow'` (the default) — no
|
|
2583
|
+
* restriction; `'deny'` — nobody.
|
|
2584
|
+
*
|
|
2585
|
+
* The open default is what makes a one-line `AgentModule.forRoot({ model })` a working chat. It is
|
|
2586
|
+
* also why an app that used `[]` to DENY — a `roles` computed from permissions that can come out
|
|
2587
|
+
* empty, `defaultRoles: []` on a multi-tenant MCP surface — reaches everyone instead, silently.
|
|
2588
|
+
* `'deny'` keeps such an app closed.
|
|
2589
|
+
*/
|
|
2590
|
+
type EmptyRoles = 'allow' | 'deny';
|
|
2591
|
+
interface RolesPolicyOptions {
|
|
2592
|
+
/** What an empty roles list means. Default `'allow'`. */
|
|
2593
|
+
emptyRoles?: EmptyRoles;
|
|
2594
|
+
}
|
|
2595
|
+
/**
|
|
2596
|
+
* The closed gate — {@link DefaultRolesPolicy} with `emptyRoles: 'deny'`: the actor needs a role the
|
|
2597
|
+
* tool declares (else one of the default roles). A tool with no `roles` and no default roles, or with
|
|
2598
|
+
* an explicitly empty list, reaches nobody. What `AgentModule.forRoot({ emptyRoles: 'deny' })` binds.
|
|
2599
|
+
*/
|
|
2600
|
+
declare class ClosedRolesPolicy extends DefaultRolesPolicy {
|
|
2601
|
+
constructor(defaultRoles?: string[]);
|
|
2602
|
+
}
|
|
2603
|
+
/**
|
|
2604
|
+
* Close a policy you did not build: a tool whose roles come out empty — declared `[]`, or undeclared
|
|
2605
|
+
* with no default roles to fall back on — reaches nobody; anything else is the inner policy's call.
|
|
2606
|
+
*
|
|
2607
|
+
* The default roles are read off a {@link DefaultRolesPolicy}; any other inner policy keeps its own
|
|
2608
|
+
* defaults to itself, so for it an undeclared list counts as empty. A tool gated by `ability` has
|
|
2609
|
+
* nothing to do with roles and is always left to the inner policy. What the MCP server's
|
|
2610
|
+
* `emptyRoles: 'deny'` wraps the agent's shared policy in.
|
|
2611
|
+
*/
|
|
2612
|
+
declare function closeEmptyRoles(inner: RolesPolicy): RolesPolicy;
|
|
2577
2613
|
|
|
2578
2614
|
interface AgentLoopDeps<TOutput = unknown> {
|
|
2579
2615
|
model: ModelProvider;
|
|
@@ -3526,4 +3562,4 @@ declare class InMemoryAgentStore implements AgentStore, ChatQueueStore {
|
|
|
3526
3562
|
private toSummary;
|
|
3527
3563
|
}
|
|
3528
3564
|
|
|
3529
|
-
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 AgentRunStartOptions, type AgentRunStarted, type AgentRunner, type AgentSkillsResolved, type AgentSpanEvent, AgentStore, AgentStreamError, AgentStreamEvent, type AgentStructuredOutputSpan, type AgentToolCallEvent, type AgentToolExecutionSpan, type AgentToolRetry, AgentUiComponent, AiToolCtx, AppendMessageInput, type ApprovalDecisionRef, type ApprovalPolicy, type ApprovalRequirement, type ApprovalThreadRef, type ApprovalToolRef, type ApprovalWhere, type AttachmentRef, type AttachmentStagingDescription, type AttachmentStagingStore, type BufferedModelTurnResult, type BuildMemoryBlockInput, ChatQueueStore, type CostUsage, 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, EnqueueMessageInput, type ForgetMemoryInput, type FrameBuffer, GLOBAL_SCOPE, type GovernanceMessageRow, type GovernancePage, type GovernancePageQuery, type GovernancePendingApprovalRow, type GovernanceRange, type GovernanceRunDetail, type GovernanceRunRow, type GovernanceThreadDetail, type GovernanceThreadDetailQuery, type GovernanceThreadRow, type GovernanceToolCallRow, type GovernanceUsageInput, type GovernanceUsageRow, HistoryPolicy, HumanReply, InMemoryAgentStore, 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 ModelCatalogLock, 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, QueuePause, QueuedMessage, QueuedMessagePatch, type QuotaBlock, QuotaExceededError, type QuotaPeriod, type QuotaProvider, type QuotaQuery, type QuotaReport, QuotaState, type QuotaStore, type QuotaWarning, type QuotaWindow, REMEMBER_TOOL_DESCRIPTION, REMEMBER_TOOL_NAME, REQUESTER_APPROVER, RUN_FAILED_MESSAGE, RUN_NOT_ACTIVE_CODE, RUN_NOT_ACTIVE_MESSAGE, RUN_NO_LONGER_RUNNING, type RecentRunRow, RecordRunStartInput, RecordToolCallInput, 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 SettleDeadRunInput, 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 ThreadUsageRollup, type ThreadWhere, type TokenStreamSink, type ToolCallActivityRow, ToolCallApproval, type ToolCallApprovalColumns, ToolCallApprovalState, ToolCallOutcome, 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, UpdateThreadInput, UpdateToolCallInput, 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, exposeStreamErrorDetails, 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, quotaUsedRatio, quotaWarning, releaseGatedFrames, rememberInputSchema, rememberToolDefinition, repairInstruction, resolveGateLookback, resolveMemoryDigest, resolveOutputGateMode, resolveSkillCatalog, rollupThreadUsage, runAgentLoop, runInputProcessors, runOutputProcessors, seedModelPrices, settleAll, settleDeadRun, settleUnsettledDelegation, skillInputSchema, skillToolDefinition, skillWriteVerdict, stampToolKinds, staticModelCatalog, staticSkillProvider, streamFailure, summarizeWithModel, tenantScope, toolCallApprovalFromRow, toolCallContext, traceLlmTurn, traceToolExecution, truncateDetailContent, unwrapToolStepOutput, validateStructured, windowHistory, withAskTool, withMemoryTool, withSelectedModel, withSkillTool, withToolTimeout, withTurnFrames, wrapToolStepOutput, writeMemory };
|
|
3565
|
+
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 AgentRunStartOptions, type AgentRunStarted, type AgentRunner, type AgentSkillsResolved, type AgentSpanEvent, AgentStore, AgentStreamError, AgentStreamEvent, type AgentStructuredOutputSpan, type AgentToolCallEvent, type AgentToolExecutionSpan, type AgentToolRetry, AgentUiComponent, AiToolCtx, AppendMessageInput, type ApprovalDecisionRef, type ApprovalPolicy, type ApprovalRequirement, type ApprovalThreadRef, type ApprovalToolRef, type ApprovalWhere, type AttachmentRef, type AttachmentStagingDescription, type AttachmentStagingStore, type BufferedModelTurnResult, type BuildMemoryBlockInput, ChatQueueStore, ClosedRolesPolicy, type CostUsage, 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 EmptyRoles, EnqueueMessageInput, type ForgetMemoryInput, type FrameBuffer, GLOBAL_SCOPE, type GovernanceMessageRow, type GovernancePage, type GovernancePageQuery, type GovernancePendingApprovalRow, type GovernanceRange, type GovernanceRunDetail, type GovernanceRunRow, type GovernanceThreadDetail, type GovernanceThreadDetailQuery, type GovernanceThreadRow, type GovernanceToolCallRow, type GovernanceUsageInput, type GovernanceUsageRow, HistoryPolicy, HumanReply, InMemoryAgentStore, 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 ModelCatalogLock, 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, QueuePause, QueuedMessage, QueuedMessagePatch, type QuotaBlock, QuotaExceededError, type QuotaPeriod, type QuotaProvider, type QuotaQuery, type QuotaReport, QuotaState, type QuotaStore, type QuotaWarning, type QuotaWindow, REMEMBER_TOOL_DESCRIPTION, REMEMBER_TOOL_NAME, REQUESTER_APPROVER, RUN_FAILED_MESSAGE, RUN_NOT_ACTIVE_CODE, RUN_NOT_ACTIVE_MESSAGE, RUN_NO_LONGER_RUNNING, type RecentRunRow, RecordRunStartInput, RecordToolCallInput, RecordUsageInput, type RememberToolInput, type RerankOptions, type Reranker, type ResolveAttachmentInput, type ResolveMemoryDigestInput, type ResolvedDelegation, type RetrieveOptions, type Retriever, type RolesPolicy, type RolesPolicyOptions, 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 SettleDeadRunInput, 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 ThreadUsageRollup, type ThreadWhere, type TokenStreamSink, type ToolCallActivityRow, ToolCallApproval, type ToolCallApprovalColumns, ToolCallApprovalState, ToolCallOutcome, 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, UpdateThreadInput, UpdateToolCallInput, type UsageTrendPoint, type WindowHistoryOptions, type WithMemoryToolInput, type WriteMemoryInput, actorScope, agentDiagnosticKey, agentFailureCode, bucketByActor, bucketByModel, bucketByThread, bucketUsageTrend, buildMemoryBlock, buildSkillsBlock, canActorUseTool, closeEmptyRoles, compositeSkillProvider, createFrameBuffer, createIncrementalGate, createNoopEmitUi, createUiCollector, dayBoundsUtc, defaultCanDecide, defaultScopeResolver, detachedDelivered, detachedStarted, detachedUnsettled, estimateCost, estimateMessageTokens, exhaustedWindow, exposeStreamErrorDetails, 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, quotaUsedRatio, quotaWarning, releaseGatedFrames, rememberInputSchema, rememberToolDefinition, repairInstruction, resolveGateLookback, resolveMemoryDigest, resolveOutputGateMode, resolveSkillCatalog, rollupThreadUsage, runAgentLoop, runInputProcessors, runOutputProcessors, seedModelPrices, settleAll, settleDeadRun, settleUnsettledDelegation, skillInputSchema, skillToolDefinition, skillWriteVerdict, stampToolKinds, staticModelCatalog, staticSkillProvider, streamFailure, summarizeWithModel, tenantScope, toolCallApprovalFromRow, toolCallContext, traceLlmTurn, traceToolExecution, truncateDetailContent, unwrapToolStepOutput, validateStructured, windowHistory, withAskTool, withMemoryTool, withSelectedModel, withSkillTool, withToolTimeout, withTurnFrames, wrapToolStepOutput, writeMemory };
|
package/dist/index.js
CHANGED
|
@@ -2690,15 +2690,40 @@ var DefaultRolesPolicy = class {
|
|
|
2690
2690
|
__name(this, "DefaultRolesPolicy");
|
|
2691
2691
|
}
|
|
2692
2692
|
defaultRoles;
|
|
2693
|
-
|
|
2693
|
+
/** What an empty roles list means here — see {@link EmptyRoles}. */
|
|
2694
|
+
emptyRoles;
|
|
2695
|
+
constructor(defaultRoles = [], options = {}) {
|
|
2694
2696
|
this.defaultRoles = defaultRoles;
|
|
2697
|
+
this.emptyRoles = options.emptyRoles ?? "allow";
|
|
2695
2698
|
}
|
|
2696
2699
|
can(actor, tool) {
|
|
2697
2700
|
const allowed = tool.roles ?? this.defaultRoles;
|
|
2698
|
-
if (allowed.length === 0) return
|
|
2701
|
+
if (allowed.length === 0) return this.emptyRoles === "allow";
|
|
2699
2702
|
return (actor.roles ?? []).some((role) => allowed.includes(role));
|
|
2700
2703
|
}
|
|
2701
2704
|
};
|
|
2705
|
+
var ClosedRolesPolicy = class extends DefaultRolesPolicy {
|
|
2706
|
+
static {
|
|
2707
|
+
__name(this, "ClosedRolesPolicy");
|
|
2708
|
+
}
|
|
2709
|
+
constructor(defaultRoles = []) {
|
|
2710
|
+
super(defaultRoles, {
|
|
2711
|
+
emptyRoles: "deny"
|
|
2712
|
+
});
|
|
2713
|
+
}
|
|
2714
|
+
};
|
|
2715
|
+
function closeEmptyRoles(inner) {
|
|
2716
|
+
const defaults = inner instanceof DefaultRolesPolicy ? inner.defaultRoles : [];
|
|
2717
|
+
return {
|
|
2718
|
+
can(actor, tool) {
|
|
2719
|
+
if (tool.ability === void 0 && (tool.roles ?? defaults).length === 0) {
|
|
2720
|
+
return false;
|
|
2721
|
+
}
|
|
2722
|
+
return inner.can(actor, tool);
|
|
2723
|
+
}
|
|
2724
|
+
};
|
|
2725
|
+
}
|
|
2726
|
+
__name(closeEmptyRoles, "closeEmptyRoles");
|
|
2702
2727
|
|
|
2703
2728
|
// src/agent-loop.ts
|
|
2704
2729
|
import { createHash } from "crypto";
|
|
@@ -4577,6 +4602,7 @@ ${block}`;
|
|
|
4577
4602
|
};
|
|
4578
4603
|
}
|
|
4579
4604
|
const resolvedModelId = turn.modelId ?? deps.modelId ?? "unknown";
|
|
4605
|
+
const stepModel = turn.modelId ?? deps.modelId;
|
|
4580
4606
|
const costUsd = resolveCostUsd(turn.usage, turn.costUsd, priceByModel.get(resolvedModelId));
|
|
4581
4607
|
const toolCallsWithKind = turn.toolCalls.map((call) => ({
|
|
4582
4608
|
...call,
|
|
@@ -4778,6 +4804,9 @@ ${block}`;
|
|
|
4778
4804
|
costUsd,
|
|
4779
4805
|
...turn.reasoningMs !== void 0 ? {
|
|
4780
4806
|
reasoningMs: turn.reasoningMs
|
|
4807
|
+
} : {},
|
|
4808
|
+
...stepModel !== void 0 ? {
|
|
4809
|
+
model: stepModel
|
|
4781
4810
|
} : {}
|
|
4782
4811
|
}));
|
|
4783
4812
|
});
|
|
@@ -4842,6 +4871,9 @@ ${block}`;
|
|
|
4842
4871
|
costUsd,
|
|
4843
4872
|
...turn.reasoningMs !== void 0 ? {
|
|
4844
4873
|
reasoningMs: turn.reasoningMs
|
|
4874
|
+
} : {},
|
|
4875
|
+
...stepModel !== void 0 ? {
|
|
4876
|
+
model: stepModel
|
|
4845
4877
|
} : {}
|
|
4846
4878
|
}));
|
|
4847
4879
|
});
|
|
@@ -4917,7 +4949,10 @@ var InMemoryAgentStore = class {
|
|
|
4917
4949
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
4918
4950
|
}
|
|
4919
4951
|
async createThread(input) {
|
|
4920
|
-
const id = crypto.randomUUID();
|
|
4952
|
+
const id = input.id ?? crypto.randomUUID();
|
|
4953
|
+
if (this.threads.has(id)) {
|
|
4954
|
+
throw new Error(`thread ${id} already exists`);
|
|
4955
|
+
}
|
|
4921
4956
|
const ts = this.now();
|
|
4922
4957
|
const row = {
|
|
4923
4958
|
id,
|
|
@@ -5786,6 +5821,7 @@ export {
|
|
|
5786
5821
|
ASK_TOOL_NAME,
|
|
5787
5822
|
AgentRegistry,
|
|
5788
5823
|
AgentStreamError,
|
|
5824
|
+
ClosedRolesPolicy,
|
|
5789
5825
|
DEFAULT_HISTORY_SUMMARY_INSTRUCTION,
|
|
5790
5826
|
DEFAULT_INCREMENTAL_LOOKBACK_CHARS,
|
|
5791
5827
|
DEFAULT_INTAKE_PREAMBLE,
|
|
@@ -5836,6 +5872,7 @@ export {
|
|
|
5836
5872
|
buildMemoryBlock,
|
|
5837
5873
|
buildSkillsBlock,
|
|
5838
5874
|
canActorUseTool,
|
|
5875
|
+
closeEmptyRoles,
|
|
5839
5876
|
compositeSkillProvider,
|
|
5840
5877
|
createFrameBuffer,
|
|
5841
5878
|
createIncrementalGate,
|