@dudousxd/nestjs-agent-core 0.45.0 → 0.45.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +121 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -1
- package/dist/index.d.ts +25 -1
- package/dist/index.js +119 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -3563,6 +3563,12 @@ declare class InMemoryActionProposalStore implements ActionProposalStore, Action
|
|
|
3563
3563
|
getActionProposal(scope: ActionProposalScope, id: string): Promise<ActionProposal | null>;
|
|
3564
3564
|
listActionProposals(scope: ActionProposalScope, query?: ListActionProposals): Promise<ActionProposal[]>;
|
|
3565
3565
|
private mutate;
|
|
3566
|
+
/**
|
|
3567
|
+
* Called after every proposal transition, with the row before and after — synchronously, so no
|
|
3568
|
+
* reader sees one without the other. {@link InMemoryAgentStore} settles the proposal's tool-call
|
|
3569
|
+
* record here (see `toolCallUpdateForTransition`).
|
|
3570
|
+
*/
|
|
3571
|
+
protected proposalChanged(_previous: ActionProposal, _next: ActionProposal): void;
|
|
3566
3572
|
decideActionProposal(scope: ActionProposalScope, id: string, command: ActionProposalDecisionCommand): Promise<ActionProposalMutationResult>;
|
|
3567
3573
|
claimActionProposal(scope: ActionProposalScope, id: string, command: ClaimActionProposal): Promise<ActionProposalMutationResult>;
|
|
3568
3574
|
extendActionProposalLease(scope: ActionProposalScope, id: string, command: ExtendActionProposalLease): Promise<ActionProposalMutationResult>;
|
|
@@ -3756,6 +3762,9 @@ declare class InMemoryAgentStore extends InMemoryActionProposalStore implements
|
|
|
3756
3762
|
toolCallOutcomes(toolCallIds: readonly string[]): Promise<ToolCallOutcome[]>;
|
|
3757
3763
|
failUnsettledToolCalls(runId: string, error: string): Promise<number>;
|
|
3758
3764
|
updateToolCall(input: UpdateToolCallInput): Promise<void>;
|
|
3765
|
+
/** An independent proposal moved: its `proposed` tool-call record follows it. */
|
|
3766
|
+
protected proposalChanged(previous: ActionProposal, next: ActionProposal): void;
|
|
3767
|
+
private applyToolCallUpdate;
|
|
3759
3768
|
recordUsage(input: RecordUsageInput): Promise<void>;
|
|
3760
3769
|
quotaToday(actorRef: string, day: string): Promise<{
|
|
3761
3770
|
usedTokens: number;
|
|
@@ -4380,6 +4389,21 @@ declare function parseTextActionProposalCommand(text: string, vocabulary?: TextA
|
|
|
4380
4389
|
*/
|
|
4381
4390
|
declare const ptBrActionProposalText: Required<TextActionProposalConfig>;
|
|
4382
4391
|
|
|
4392
|
+
/**
|
|
4393
|
+
* The tool-call record an independent proposal's state settles, or `null` while it has nothing to
|
|
4394
|
+
* say yet (pending, or approved and not yet run).
|
|
4395
|
+
*
|
|
4396
|
+
* In `actionApprovalMode: 'independent'` the turn records the call as `proposed` and ends; the
|
|
4397
|
+
* proposal row then carries the decision and the execution. Every store applies this on each
|
|
4398
|
+
* proposal transition — in the same write where it can — so the call's own record (what the
|
|
4399
|
+
* dashboard, the run detail and a host's audit read) follows the proposal: `executed` with its
|
|
4400
|
+
* output, `failed` with its error, `rejected`, or `expired` (a lapsed proposal, or one a newer
|
|
4401
|
+
* proposal superseded; the tool never ran either way).
|
|
4402
|
+
*/
|
|
4403
|
+
declare function toolCallUpdateForProposal(proposal: ActionProposal): UpdateToolCallInput | null;
|
|
4404
|
+
/** The update a transition from `previous` to `next` calls for: `null` when the call's status stays. */
|
|
4405
|
+
declare function toolCallUpdateForTransition(previous: ActionProposal | undefined, next: ActionProposal): UpdateToolCallInput | null;
|
|
4406
|
+
|
|
4383
4407
|
interface ActionProposalExecutionDeps {
|
|
4384
4408
|
registry: ToolRegistry;
|
|
4385
4409
|
rolesPolicy: RolesPolicy;
|
|
@@ -4453,4 +4477,4 @@ declare function createFunctionalTool<I, O>(definition: FunctionalToolDefinition
|
|
|
4453
4477
|
/** Presentation failures must never cause a successful side effect to be retried. */
|
|
4454
4478
|
declare function emitToolPresentations<I, O>(handler: ToolHandler<I, O>, output: O, ctx: AiToolCtx, toolName: string): Promise<void>;
|
|
4455
4479
|
|
|
4456
|
-
export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_ATTACHMENT_STAGING, AGENT_CHANNEL_STORE, AGENT_CONFIRM_TOKEN_STORE, 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, type ActionApprovalMode, ActionProposal, ActionProposalDecision, ActionProposalDecisionCommand, type ActionProposalDiscoveryIndexStore, ActionProposalExecution, type ActionProposalExecutionDeps, type ActionProposalExecutionResult, ActionProposalExecutor, type ActionProposalExecutorOptions, ActionProposalMutationResult, type ActionProposalMutationView, ActionProposalOutcome, ActionProposalOutcomeDelivery, ActionProposalOutcomeLease, ActionProposalOutcomeStore, type ActionProposalReceipt, type ActionProposalRuntimeStore, ActionProposalScope, ActionProposalStore, ActionProposalStoreOptions, ActionProposalSupersessionStore, type ActionProposalTarget, type ActionProposalView, ActionProposalWorker, type ActionProposalWorkerOptions, type ActionProposalWorkerStore, 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, ApprovalPolicy, type ApprovalWhere, type AttachmentRef, type AttachmentStagingDescription, type AttachmentStagingStore, type BackgroundActorResolver, type BufferedModelTurnResult, type BuildMemoryBlockInput, CONFIRM_JSON_SCHEMA_PROPERTIES, type ChannelStore, ChatQueueStore, ClaimActionProposal, ClosedRolesPolicy, type ConfirmFields, type ConfirmTokenClaim, ConfirmTokenError, type ConfirmTokenStore, type ConfirmTokenSubject, type ConfirmedTool, type ConfirmedToolDone, type ConfirmedToolMessages, type ConfirmedToolOptions, type ConfirmedToolOutcome, type ConfirmedToolPreview, type ConfirmedToolResult, type ConfirmedToolSteps, type CostUsage, CreateActionProposal, CreateActionProposalResult, CreateThreadInput, type CurrentModelPrice, DEFAULT_CONFIRM_TTL_MS, DEFAULT_HISTORY_SUMMARY_INSTRUCTION, DEFAULT_MAX_FACT_CHARS, DEFAULT_MAX_MEMORIES, DEFAULT_MAX_SKILLS, DEFAULT_PREVIEW_THROTTLE_MS, DEFAULT_REFUSAL_REASON, DEFAULT_STRUCTURED_OUTPUT_INSTRUCTION, DEFAULT_TEXT_ACTION_PROPOSAL_REPLIES, DEFAULT_TEXT_ACTION_PROPOSAL_VOCABULARY, Decision, DefaultRolesPolicy, type DetachedDelegationOutcome, type DetachedDelegationReceipt, DetachedDelivery, type DetailThreadRef, ElicitationRequest, type EmbeddingProvider, type EmitUi, type EmptyRoles, EnqueueMessageInput, ExtendActionProposalLease, type ForgetMemoryInput, type FrameBuffer, type FunctionalTool, type FunctionalToolDefinition, 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, InMemoryActionProposalStore, InMemoryAgentStore, InMemoryChannelStore, InMemoryConfirmTokenStore, type IncrementalGate, InputProcessor, type InvokeOptions, ListActionProposals, 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 NegotiatedUiCollector, type ObservedTurnFrames, type OfferMemoriesInput, type OutputGateMode, type OutputGateResult, OutputProcessor, type OverriddenMemory, PageContext, type PartialJson, type Passage, type PendingApprovalRow, Persona, type PersonaAlias, PersonaCatalogEntry, type PrepareOptions, 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, 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 ResolveToolUiCatalog, type ResolvedDelegation, type RetrieveOptions, type Retriever, type RolesPolicy, type RolesPolicyOptions, type RunAgentBreakdownRow, RunCancelledError, type RunErrorBreakdownRow, type RunMetrics, type RunToolCallRow, type RunTrendPoint, type RunWhere, SCHEMA_EXTENSION, SKILL_TOOL_DESCRIPTION, SKILL_TOOL_NAME, type SchemaExtension, type ScopeContext, type ScopeResolver, type SearchMemoriesInput, SettleActionProposal, type SettleDeadRunInput, type SettledTask, type ShownToolInputPreview, 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, SqlTokenStreamSink, type SqlTokenStreamSinkOptions, type StageAttachmentInput, type StagedAttachment, type StoreMemoryInput, StoredMessage, type StreamError, type StreamFrameRow, type StreamFrameTable, type StructuredOutcome, StructuredOutputError, THREAD_DETAIL_CONTENT_CHARS, type TextActionProposalCandidate, type TextActionProposalCommand, type TextActionProposalConfig, type TextActionProposalReplies, type TextActionProposalResolution, type TextActionProposalVocabulary, type ThreadActivityRow, ThreadDetail, type ThreadMessageRow, type ThreadMeta, type ThreadSpendRow, ThreadSummary, type ThreadUsageRollup, type ThreadWhere, type TokenStreamSink, type ToolCallActivityRow, ToolCallApprovalState, ToolCallOutcome, ToolCallRequest, ToolCallStatus, type ToolCallWhere, ToolConfirmation, ToolDefinition, ToolDescribeScope, ToolDisabledError, ToolForbiddenError, ToolHandler, ToolInputDriftError, ToolInputInvalidError, ToolInputPreview, ToolInputPreviewScope, type ToolInputPreviews, type ToolKindDeps, ToolNotFoundError, ToolPreflightDeniedError, ToolPreflightResult, type ToolPreparationResult, ToolRegistry, ToolResult, ToolSpec, type ToolStatRow, ToolStepEnvelope, ToolTransientRetrySetting, type TurnFrameSummary, type UiCollector, UpdateThreadInput, UpdateToolCallInput, type UsageTrendPoint, type WindowHistoryOptions, type WithMemoryToolInput, type WriteMemoryInput, actionProposalCreationMatches, actionProposalOutcomeFenceValid, actionProposalOutcomeScope, actionProposalOutcomeText, actionProposalReceipt, actionProposalScopeMatches, actorScope, agentDiagnosticKey, agentFailureCode, assertIndependentActionCapabilities, attachActionProposalOutcome, bucketByActor, bucketByModel, bucketByThread, bucketUsageTrend, buildMemoryBlock, buildSkillsBlock, canActorUseTool, canonicalActionProposalJson, canonicalJson, claimActionProposalOutcome, closeEmptyRoles, compositeSkillProvider, confirmTokenExpiry, createFrameBuffer, createFunctionalTool, createIncrementalGate, createNegotiatedUiCollector, createNoopEmitUi, createUiCollector, dayBoundsUtc, defaultScopeResolver, defineConfirmedTool, detachedDelivered, detachedStarted, detachedUnsettled, emitToolPresentations, escapeUnsafeToolUiText, estimateCost, estimateMessageTokens, exhaustedWindow, exposeStreamErrorDetails, extractJson, filterToolsByAllowList, filterToolsByCanUse, filterToolsByEnabled, filterToolsByRole, findCatalogModel, findPersona, gateFollowUps, gateTail, hashConfirmToken, initialActionProposal, intersectAllowLists, isControlFlowSignal, isReplayIntegrityError, isToolEnabled, loadSkill, memoryForgetVerdict, memoryWriteVerdict, mergeUi, normalizeDelegation, observeTurnFrames, offerMemories, offerSkills, parsePartialJson, parseTextActionProposalCommand, personaCatalogEntry, prepareActionProposal, previewToolInputs, previewUiId, ptBrActionProposalText, publishAgentDelegated, publishAgentMemoryResolved, publishAgentMemoryWritten, publishAgentMessage, publishAgentQuotaExceeded, publishAgentRetrieved, publishAgentRunFailed, publishAgentRunFinished, publishAgentRunStarted, publishAgentSkillsResolved, publishAgentToolCall, publishAgentToolRetry, quotaPeriodRange, quotaUsedRatio, quotaWarning, registryInputPreviews, releaseGatedFrames, rememberInputSchema, rememberToolDefinition, repairInstruction, resolveGateLookback, resolveMemoryDigest, resolveOutputGateMode, resolvePersonaAlias, resolveSkillCatalog, resolveTextActionProposalDecision, rollupThreadUsage, runAgentLoop, runInputProcessors, runOutputProcessors, schemaExtensionOf, seedModelPrices, settleAll, settleDeadRun, settleUnsettledDelegation, signConfirmToken, skillInputSchema, skillToolDefinition, skillWriteVerdict, snapshotActionProposal, stampToolKinds, staticModelCatalog, staticSkillProvider, streamFailure, summarizeWithModel, tenantScope, textActionProposalReply, toActionProposalMutationView, toActionProposalView, toolCallContext, traceLlmTurn, traceToolExecution, transitionActionProposalClaim, transitionActionProposalDecision, transitionActionProposalLease, transitionActionProposalSettlement, transitionActionProposalSupersession, truncateDetailContent, unwrapToolStepOutput, validateActionProposalCreation, validateActionProposalDiscoveryIndexBatch, validateActionProposalExpiryBatch, validateActionProposalListQuery, validateActionProposalWorkerClaim, validateStructured, verifyConfirmToken, windowHistory, withAskTool, withConfirmFields, withMemoryTool, withSelectedModel, withSkillTool, withToolTimeout, withTurnFrames, withdrawPreviewEvent, wrapToolPreflightDenied, wrapToolStepOutput, writeMemory };
|
|
4480
|
+
export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_ATTACHMENT_STAGING, AGENT_CHANNEL_STORE, AGENT_CONFIRM_TOKEN_STORE, 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, type ActionApprovalMode, ActionProposal, ActionProposalDecision, ActionProposalDecisionCommand, type ActionProposalDiscoveryIndexStore, ActionProposalExecution, type ActionProposalExecutionDeps, type ActionProposalExecutionResult, ActionProposalExecutor, type ActionProposalExecutorOptions, ActionProposalMutationResult, type ActionProposalMutationView, ActionProposalOutcome, ActionProposalOutcomeDelivery, ActionProposalOutcomeLease, ActionProposalOutcomeStore, type ActionProposalReceipt, type ActionProposalRuntimeStore, ActionProposalScope, ActionProposalStore, ActionProposalStoreOptions, ActionProposalSupersessionStore, type ActionProposalTarget, type ActionProposalView, ActionProposalWorker, type ActionProposalWorkerOptions, type ActionProposalWorkerStore, 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, ApprovalPolicy, type ApprovalWhere, type AttachmentRef, type AttachmentStagingDescription, type AttachmentStagingStore, type BackgroundActorResolver, type BufferedModelTurnResult, type BuildMemoryBlockInput, CONFIRM_JSON_SCHEMA_PROPERTIES, type ChannelStore, ChatQueueStore, ClaimActionProposal, ClosedRolesPolicy, type ConfirmFields, type ConfirmTokenClaim, ConfirmTokenError, type ConfirmTokenStore, type ConfirmTokenSubject, type ConfirmedTool, type ConfirmedToolDone, type ConfirmedToolMessages, type ConfirmedToolOptions, type ConfirmedToolOutcome, type ConfirmedToolPreview, type ConfirmedToolResult, type ConfirmedToolSteps, type CostUsage, CreateActionProposal, CreateActionProposalResult, CreateThreadInput, type CurrentModelPrice, DEFAULT_CONFIRM_TTL_MS, DEFAULT_HISTORY_SUMMARY_INSTRUCTION, DEFAULT_MAX_FACT_CHARS, DEFAULT_MAX_MEMORIES, DEFAULT_MAX_SKILLS, DEFAULT_PREVIEW_THROTTLE_MS, DEFAULT_REFUSAL_REASON, DEFAULT_STRUCTURED_OUTPUT_INSTRUCTION, DEFAULT_TEXT_ACTION_PROPOSAL_REPLIES, DEFAULT_TEXT_ACTION_PROPOSAL_VOCABULARY, Decision, DefaultRolesPolicy, type DetachedDelegationOutcome, type DetachedDelegationReceipt, DetachedDelivery, type DetailThreadRef, ElicitationRequest, type EmbeddingProvider, type EmitUi, type EmptyRoles, EnqueueMessageInput, ExtendActionProposalLease, type ForgetMemoryInput, type FrameBuffer, type FunctionalTool, type FunctionalToolDefinition, 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, InMemoryActionProposalStore, InMemoryAgentStore, InMemoryChannelStore, InMemoryConfirmTokenStore, type IncrementalGate, InputProcessor, type InvokeOptions, ListActionProposals, 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 NegotiatedUiCollector, type ObservedTurnFrames, type OfferMemoriesInput, type OutputGateMode, type OutputGateResult, OutputProcessor, type OverriddenMemory, PageContext, type PartialJson, type Passage, type PendingApprovalRow, Persona, type PersonaAlias, PersonaCatalogEntry, type PrepareOptions, 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, 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 ResolveToolUiCatalog, type ResolvedDelegation, type RetrieveOptions, type Retriever, type RolesPolicy, type RolesPolicyOptions, type RunAgentBreakdownRow, RunCancelledError, type RunErrorBreakdownRow, type RunMetrics, type RunToolCallRow, type RunTrendPoint, type RunWhere, SCHEMA_EXTENSION, SKILL_TOOL_DESCRIPTION, SKILL_TOOL_NAME, type SchemaExtension, type ScopeContext, type ScopeResolver, type SearchMemoriesInput, SettleActionProposal, type SettleDeadRunInput, type SettledTask, type ShownToolInputPreview, 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, SqlTokenStreamSink, type SqlTokenStreamSinkOptions, type StageAttachmentInput, type StagedAttachment, type StoreMemoryInput, StoredMessage, type StreamError, type StreamFrameRow, type StreamFrameTable, type StructuredOutcome, StructuredOutputError, THREAD_DETAIL_CONTENT_CHARS, type TextActionProposalCandidate, type TextActionProposalCommand, type TextActionProposalConfig, type TextActionProposalReplies, type TextActionProposalResolution, type TextActionProposalVocabulary, type ThreadActivityRow, ThreadDetail, type ThreadMessageRow, type ThreadMeta, type ThreadSpendRow, ThreadSummary, type ThreadUsageRollup, type ThreadWhere, type TokenStreamSink, type ToolCallActivityRow, ToolCallApprovalState, ToolCallOutcome, ToolCallRequest, ToolCallStatus, type ToolCallWhere, ToolConfirmation, ToolDefinition, ToolDescribeScope, ToolDisabledError, ToolForbiddenError, ToolHandler, ToolInputDriftError, ToolInputInvalidError, ToolInputPreview, ToolInputPreviewScope, type ToolInputPreviews, type ToolKindDeps, ToolNotFoundError, ToolPreflightDeniedError, ToolPreflightResult, type ToolPreparationResult, ToolRegistry, ToolResult, ToolSpec, type ToolStatRow, ToolStepEnvelope, ToolTransientRetrySetting, type TurnFrameSummary, type UiCollector, UpdateThreadInput, UpdateToolCallInput, type UsageTrendPoint, type WindowHistoryOptions, type WithMemoryToolInput, type WriteMemoryInput, actionProposalCreationMatches, actionProposalOutcomeFenceValid, actionProposalOutcomeScope, actionProposalOutcomeText, actionProposalReceipt, actionProposalScopeMatches, actorScope, agentDiagnosticKey, agentFailureCode, assertIndependentActionCapabilities, attachActionProposalOutcome, bucketByActor, bucketByModel, bucketByThread, bucketUsageTrend, buildMemoryBlock, buildSkillsBlock, canActorUseTool, canonicalActionProposalJson, canonicalJson, claimActionProposalOutcome, closeEmptyRoles, compositeSkillProvider, confirmTokenExpiry, createFrameBuffer, createFunctionalTool, createIncrementalGate, createNegotiatedUiCollector, createNoopEmitUi, createUiCollector, dayBoundsUtc, defaultScopeResolver, defineConfirmedTool, detachedDelivered, detachedStarted, detachedUnsettled, emitToolPresentations, escapeUnsafeToolUiText, estimateCost, estimateMessageTokens, exhaustedWindow, exposeStreamErrorDetails, extractJson, filterToolsByAllowList, filterToolsByCanUse, filterToolsByEnabled, filterToolsByRole, findCatalogModel, findPersona, gateFollowUps, gateTail, hashConfirmToken, initialActionProposal, intersectAllowLists, isControlFlowSignal, isReplayIntegrityError, isToolEnabled, loadSkill, memoryForgetVerdict, memoryWriteVerdict, mergeUi, normalizeDelegation, observeTurnFrames, offerMemories, offerSkills, parsePartialJson, parseTextActionProposalCommand, personaCatalogEntry, prepareActionProposal, previewToolInputs, previewUiId, ptBrActionProposalText, publishAgentDelegated, publishAgentMemoryResolved, publishAgentMemoryWritten, publishAgentMessage, publishAgentQuotaExceeded, publishAgentRetrieved, publishAgentRunFailed, publishAgentRunFinished, publishAgentRunStarted, publishAgentSkillsResolved, publishAgentToolCall, publishAgentToolRetry, quotaPeriodRange, quotaUsedRatio, quotaWarning, registryInputPreviews, releaseGatedFrames, rememberInputSchema, rememberToolDefinition, repairInstruction, resolveGateLookback, resolveMemoryDigest, resolveOutputGateMode, resolvePersonaAlias, resolveSkillCatalog, resolveTextActionProposalDecision, rollupThreadUsage, runAgentLoop, runInputProcessors, runOutputProcessors, schemaExtensionOf, seedModelPrices, settleAll, settleDeadRun, settleUnsettledDelegation, signConfirmToken, skillInputSchema, skillToolDefinition, skillWriteVerdict, snapshotActionProposal, stampToolKinds, staticModelCatalog, staticSkillProvider, streamFailure, summarizeWithModel, tenantScope, textActionProposalReply, toActionProposalMutationView, toActionProposalView, toolCallContext, toolCallUpdateForProposal, toolCallUpdateForTransition, traceLlmTurn, traceToolExecution, transitionActionProposalClaim, transitionActionProposalDecision, transitionActionProposalLease, transitionActionProposalSettlement, transitionActionProposalSupersession, truncateDetailContent, unwrapToolStepOutput, validateActionProposalCreation, validateActionProposalDiscoveryIndexBatch, validateActionProposalExpiryBatch, validateActionProposalListQuery, validateActionProposalWorkerClaim, validateStructured, verifyConfirmToken, windowHistory, withAskTool, withConfirmFields, withMemoryTool, withSelectedModel, withSkillTool, withToolTimeout, withTurnFrames, withdrawPreviewEvent, wrapToolPreflightDenied, wrapToolStepOutput, writeMemory };
|
package/dist/index.d.ts
CHANGED
|
@@ -3563,6 +3563,12 @@ declare class InMemoryActionProposalStore implements ActionProposalStore, Action
|
|
|
3563
3563
|
getActionProposal(scope: ActionProposalScope, id: string): Promise<ActionProposal | null>;
|
|
3564
3564
|
listActionProposals(scope: ActionProposalScope, query?: ListActionProposals): Promise<ActionProposal[]>;
|
|
3565
3565
|
private mutate;
|
|
3566
|
+
/**
|
|
3567
|
+
* Called after every proposal transition, with the row before and after — synchronously, so no
|
|
3568
|
+
* reader sees one without the other. {@link InMemoryAgentStore} settles the proposal's tool-call
|
|
3569
|
+
* record here (see `toolCallUpdateForTransition`).
|
|
3570
|
+
*/
|
|
3571
|
+
protected proposalChanged(_previous: ActionProposal, _next: ActionProposal): void;
|
|
3566
3572
|
decideActionProposal(scope: ActionProposalScope, id: string, command: ActionProposalDecisionCommand): Promise<ActionProposalMutationResult>;
|
|
3567
3573
|
claimActionProposal(scope: ActionProposalScope, id: string, command: ClaimActionProposal): Promise<ActionProposalMutationResult>;
|
|
3568
3574
|
extendActionProposalLease(scope: ActionProposalScope, id: string, command: ExtendActionProposalLease): Promise<ActionProposalMutationResult>;
|
|
@@ -3756,6 +3762,9 @@ declare class InMemoryAgentStore extends InMemoryActionProposalStore implements
|
|
|
3756
3762
|
toolCallOutcomes(toolCallIds: readonly string[]): Promise<ToolCallOutcome[]>;
|
|
3757
3763
|
failUnsettledToolCalls(runId: string, error: string): Promise<number>;
|
|
3758
3764
|
updateToolCall(input: UpdateToolCallInput): Promise<void>;
|
|
3765
|
+
/** An independent proposal moved: its `proposed` tool-call record follows it. */
|
|
3766
|
+
protected proposalChanged(previous: ActionProposal, next: ActionProposal): void;
|
|
3767
|
+
private applyToolCallUpdate;
|
|
3759
3768
|
recordUsage(input: RecordUsageInput): Promise<void>;
|
|
3760
3769
|
quotaToday(actorRef: string, day: string): Promise<{
|
|
3761
3770
|
usedTokens: number;
|
|
@@ -4380,6 +4389,21 @@ declare function parseTextActionProposalCommand(text: string, vocabulary?: TextA
|
|
|
4380
4389
|
*/
|
|
4381
4390
|
declare const ptBrActionProposalText: Required<TextActionProposalConfig>;
|
|
4382
4391
|
|
|
4392
|
+
/**
|
|
4393
|
+
* The tool-call record an independent proposal's state settles, or `null` while it has nothing to
|
|
4394
|
+
* say yet (pending, or approved and not yet run).
|
|
4395
|
+
*
|
|
4396
|
+
* In `actionApprovalMode: 'independent'` the turn records the call as `proposed` and ends; the
|
|
4397
|
+
* proposal row then carries the decision and the execution. Every store applies this on each
|
|
4398
|
+
* proposal transition — in the same write where it can — so the call's own record (what the
|
|
4399
|
+
* dashboard, the run detail and a host's audit read) follows the proposal: `executed` with its
|
|
4400
|
+
* output, `failed` with its error, `rejected`, or `expired` (a lapsed proposal, or one a newer
|
|
4401
|
+
* proposal superseded; the tool never ran either way).
|
|
4402
|
+
*/
|
|
4403
|
+
declare function toolCallUpdateForProposal(proposal: ActionProposal): UpdateToolCallInput | null;
|
|
4404
|
+
/** The update a transition from `previous` to `next` calls for: `null` when the call's status stays. */
|
|
4405
|
+
declare function toolCallUpdateForTransition(previous: ActionProposal | undefined, next: ActionProposal): UpdateToolCallInput | null;
|
|
4406
|
+
|
|
4383
4407
|
interface ActionProposalExecutionDeps {
|
|
4384
4408
|
registry: ToolRegistry;
|
|
4385
4409
|
rolesPolicy: RolesPolicy;
|
|
@@ -4453,4 +4477,4 @@ declare function createFunctionalTool<I, O>(definition: FunctionalToolDefinition
|
|
|
4453
4477
|
/** Presentation failures must never cause a successful side effect to be retried. */
|
|
4454
4478
|
declare function emitToolPresentations<I, O>(handler: ToolHandler<I, O>, output: O, ctx: AiToolCtx, toolName: string): Promise<void>;
|
|
4455
4479
|
|
|
4456
|
-
export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_ATTACHMENT_STAGING, AGENT_CHANNEL_STORE, AGENT_CONFIRM_TOKEN_STORE, 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, type ActionApprovalMode, ActionProposal, ActionProposalDecision, ActionProposalDecisionCommand, type ActionProposalDiscoveryIndexStore, ActionProposalExecution, type ActionProposalExecutionDeps, type ActionProposalExecutionResult, ActionProposalExecutor, type ActionProposalExecutorOptions, ActionProposalMutationResult, type ActionProposalMutationView, ActionProposalOutcome, ActionProposalOutcomeDelivery, ActionProposalOutcomeLease, ActionProposalOutcomeStore, type ActionProposalReceipt, type ActionProposalRuntimeStore, ActionProposalScope, ActionProposalStore, ActionProposalStoreOptions, ActionProposalSupersessionStore, type ActionProposalTarget, type ActionProposalView, ActionProposalWorker, type ActionProposalWorkerOptions, type ActionProposalWorkerStore, 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, ApprovalPolicy, type ApprovalWhere, type AttachmentRef, type AttachmentStagingDescription, type AttachmentStagingStore, type BackgroundActorResolver, type BufferedModelTurnResult, type BuildMemoryBlockInput, CONFIRM_JSON_SCHEMA_PROPERTIES, type ChannelStore, ChatQueueStore, ClaimActionProposal, ClosedRolesPolicy, type ConfirmFields, type ConfirmTokenClaim, ConfirmTokenError, type ConfirmTokenStore, type ConfirmTokenSubject, type ConfirmedTool, type ConfirmedToolDone, type ConfirmedToolMessages, type ConfirmedToolOptions, type ConfirmedToolOutcome, type ConfirmedToolPreview, type ConfirmedToolResult, type ConfirmedToolSteps, type CostUsage, CreateActionProposal, CreateActionProposalResult, CreateThreadInput, type CurrentModelPrice, DEFAULT_CONFIRM_TTL_MS, DEFAULT_HISTORY_SUMMARY_INSTRUCTION, DEFAULT_MAX_FACT_CHARS, DEFAULT_MAX_MEMORIES, DEFAULT_MAX_SKILLS, DEFAULT_PREVIEW_THROTTLE_MS, DEFAULT_REFUSAL_REASON, DEFAULT_STRUCTURED_OUTPUT_INSTRUCTION, DEFAULT_TEXT_ACTION_PROPOSAL_REPLIES, DEFAULT_TEXT_ACTION_PROPOSAL_VOCABULARY, Decision, DefaultRolesPolicy, type DetachedDelegationOutcome, type DetachedDelegationReceipt, DetachedDelivery, type DetailThreadRef, ElicitationRequest, type EmbeddingProvider, type EmitUi, type EmptyRoles, EnqueueMessageInput, ExtendActionProposalLease, type ForgetMemoryInput, type FrameBuffer, type FunctionalTool, type FunctionalToolDefinition, 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, InMemoryActionProposalStore, InMemoryAgentStore, InMemoryChannelStore, InMemoryConfirmTokenStore, type IncrementalGate, InputProcessor, type InvokeOptions, ListActionProposals, 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 NegotiatedUiCollector, type ObservedTurnFrames, type OfferMemoriesInput, type OutputGateMode, type OutputGateResult, OutputProcessor, type OverriddenMemory, PageContext, type PartialJson, type Passage, type PendingApprovalRow, Persona, type PersonaAlias, PersonaCatalogEntry, type PrepareOptions, 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, 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 ResolveToolUiCatalog, type ResolvedDelegation, type RetrieveOptions, type Retriever, type RolesPolicy, type RolesPolicyOptions, type RunAgentBreakdownRow, RunCancelledError, type RunErrorBreakdownRow, type RunMetrics, type RunToolCallRow, type RunTrendPoint, type RunWhere, SCHEMA_EXTENSION, SKILL_TOOL_DESCRIPTION, SKILL_TOOL_NAME, type SchemaExtension, type ScopeContext, type ScopeResolver, type SearchMemoriesInput, SettleActionProposal, type SettleDeadRunInput, type SettledTask, type ShownToolInputPreview, 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, SqlTokenStreamSink, type SqlTokenStreamSinkOptions, type StageAttachmentInput, type StagedAttachment, type StoreMemoryInput, StoredMessage, type StreamError, type StreamFrameRow, type StreamFrameTable, type StructuredOutcome, StructuredOutputError, THREAD_DETAIL_CONTENT_CHARS, type TextActionProposalCandidate, type TextActionProposalCommand, type TextActionProposalConfig, type TextActionProposalReplies, type TextActionProposalResolution, type TextActionProposalVocabulary, type ThreadActivityRow, ThreadDetail, type ThreadMessageRow, type ThreadMeta, type ThreadSpendRow, ThreadSummary, type ThreadUsageRollup, type ThreadWhere, type TokenStreamSink, type ToolCallActivityRow, ToolCallApprovalState, ToolCallOutcome, ToolCallRequest, ToolCallStatus, type ToolCallWhere, ToolConfirmation, ToolDefinition, ToolDescribeScope, ToolDisabledError, ToolForbiddenError, ToolHandler, ToolInputDriftError, ToolInputInvalidError, ToolInputPreview, ToolInputPreviewScope, type ToolInputPreviews, type ToolKindDeps, ToolNotFoundError, ToolPreflightDeniedError, ToolPreflightResult, type ToolPreparationResult, ToolRegistry, ToolResult, ToolSpec, type ToolStatRow, ToolStepEnvelope, ToolTransientRetrySetting, type TurnFrameSummary, type UiCollector, UpdateThreadInput, UpdateToolCallInput, type UsageTrendPoint, type WindowHistoryOptions, type WithMemoryToolInput, type WriteMemoryInput, actionProposalCreationMatches, actionProposalOutcomeFenceValid, actionProposalOutcomeScope, actionProposalOutcomeText, actionProposalReceipt, actionProposalScopeMatches, actorScope, agentDiagnosticKey, agentFailureCode, assertIndependentActionCapabilities, attachActionProposalOutcome, bucketByActor, bucketByModel, bucketByThread, bucketUsageTrend, buildMemoryBlock, buildSkillsBlock, canActorUseTool, canonicalActionProposalJson, canonicalJson, claimActionProposalOutcome, closeEmptyRoles, compositeSkillProvider, confirmTokenExpiry, createFrameBuffer, createFunctionalTool, createIncrementalGate, createNegotiatedUiCollector, createNoopEmitUi, createUiCollector, dayBoundsUtc, defaultScopeResolver, defineConfirmedTool, detachedDelivered, detachedStarted, detachedUnsettled, emitToolPresentations, escapeUnsafeToolUiText, estimateCost, estimateMessageTokens, exhaustedWindow, exposeStreamErrorDetails, extractJson, filterToolsByAllowList, filterToolsByCanUse, filterToolsByEnabled, filterToolsByRole, findCatalogModel, findPersona, gateFollowUps, gateTail, hashConfirmToken, initialActionProposal, intersectAllowLists, isControlFlowSignal, isReplayIntegrityError, isToolEnabled, loadSkill, memoryForgetVerdict, memoryWriteVerdict, mergeUi, normalizeDelegation, observeTurnFrames, offerMemories, offerSkills, parsePartialJson, parseTextActionProposalCommand, personaCatalogEntry, prepareActionProposal, previewToolInputs, previewUiId, ptBrActionProposalText, publishAgentDelegated, publishAgentMemoryResolved, publishAgentMemoryWritten, publishAgentMessage, publishAgentQuotaExceeded, publishAgentRetrieved, publishAgentRunFailed, publishAgentRunFinished, publishAgentRunStarted, publishAgentSkillsResolved, publishAgentToolCall, publishAgentToolRetry, quotaPeriodRange, quotaUsedRatio, quotaWarning, registryInputPreviews, releaseGatedFrames, rememberInputSchema, rememberToolDefinition, repairInstruction, resolveGateLookback, resolveMemoryDigest, resolveOutputGateMode, resolvePersonaAlias, resolveSkillCatalog, resolveTextActionProposalDecision, rollupThreadUsage, runAgentLoop, runInputProcessors, runOutputProcessors, schemaExtensionOf, seedModelPrices, settleAll, settleDeadRun, settleUnsettledDelegation, signConfirmToken, skillInputSchema, skillToolDefinition, skillWriteVerdict, snapshotActionProposal, stampToolKinds, staticModelCatalog, staticSkillProvider, streamFailure, summarizeWithModel, tenantScope, textActionProposalReply, toActionProposalMutationView, toActionProposalView, toolCallContext, traceLlmTurn, traceToolExecution, transitionActionProposalClaim, transitionActionProposalDecision, transitionActionProposalLease, transitionActionProposalSettlement, transitionActionProposalSupersession, truncateDetailContent, unwrapToolStepOutput, validateActionProposalCreation, validateActionProposalDiscoveryIndexBatch, validateActionProposalExpiryBatch, validateActionProposalListQuery, validateActionProposalWorkerClaim, validateStructured, verifyConfirmToken, windowHistory, withAskTool, withConfirmFields, withMemoryTool, withSelectedModel, withSkillTool, withToolTimeout, withTurnFrames, withdrawPreviewEvent, wrapToolPreflightDenied, wrapToolStepOutput, writeMemory };
|
|
4480
|
+
export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_ATTACHMENT_STAGING, AGENT_CHANNEL_STORE, AGENT_CONFIRM_TOKEN_STORE, 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, type ActionApprovalMode, ActionProposal, ActionProposalDecision, ActionProposalDecisionCommand, type ActionProposalDiscoveryIndexStore, ActionProposalExecution, type ActionProposalExecutionDeps, type ActionProposalExecutionResult, ActionProposalExecutor, type ActionProposalExecutorOptions, ActionProposalMutationResult, type ActionProposalMutationView, ActionProposalOutcome, ActionProposalOutcomeDelivery, ActionProposalOutcomeLease, ActionProposalOutcomeStore, type ActionProposalReceipt, type ActionProposalRuntimeStore, ActionProposalScope, ActionProposalStore, ActionProposalStoreOptions, ActionProposalSupersessionStore, type ActionProposalTarget, type ActionProposalView, ActionProposalWorker, type ActionProposalWorkerOptions, type ActionProposalWorkerStore, 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, ApprovalPolicy, type ApprovalWhere, type AttachmentRef, type AttachmentStagingDescription, type AttachmentStagingStore, type BackgroundActorResolver, type BufferedModelTurnResult, type BuildMemoryBlockInput, CONFIRM_JSON_SCHEMA_PROPERTIES, type ChannelStore, ChatQueueStore, ClaimActionProposal, ClosedRolesPolicy, type ConfirmFields, type ConfirmTokenClaim, ConfirmTokenError, type ConfirmTokenStore, type ConfirmTokenSubject, type ConfirmedTool, type ConfirmedToolDone, type ConfirmedToolMessages, type ConfirmedToolOptions, type ConfirmedToolOutcome, type ConfirmedToolPreview, type ConfirmedToolResult, type ConfirmedToolSteps, type CostUsage, CreateActionProposal, CreateActionProposalResult, CreateThreadInput, type CurrentModelPrice, DEFAULT_CONFIRM_TTL_MS, DEFAULT_HISTORY_SUMMARY_INSTRUCTION, DEFAULT_MAX_FACT_CHARS, DEFAULT_MAX_MEMORIES, DEFAULT_MAX_SKILLS, DEFAULT_PREVIEW_THROTTLE_MS, DEFAULT_REFUSAL_REASON, DEFAULT_STRUCTURED_OUTPUT_INSTRUCTION, DEFAULT_TEXT_ACTION_PROPOSAL_REPLIES, DEFAULT_TEXT_ACTION_PROPOSAL_VOCABULARY, Decision, DefaultRolesPolicy, type DetachedDelegationOutcome, type DetachedDelegationReceipt, DetachedDelivery, type DetailThreadRef, ElicitationRequest, type EmbeddingProvider, type EmitUi, type EmptyRoles, EnqueueMessageInput, ExtendActionProposalLease, type ForgetMemoryInput, type FrameBuffer, type FunctionalTool, type FunctionalToolDefinition, 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, InMemoryActionProposalStore, InMemoryAgentStore, InMemoryChannelStore, InMemoryConfirmTokenStore, type IncrementalGate, InputProcessor, type InvokeOptions, ListActionProposals, 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 NegotiatedUiCollector, type ObservedTurnFrames, type OfferMemoriesInput, type OutputGateMode, type OutputGateResult, OutputProcessor, type OverriddenMemory, PageContext, type PartialJson, type Passage, type PendingApprovalRow, Persona, type PersonaAlias, PersonaCatalogEntry, type PrepareOptions, 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, 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 ResolveToolUiCatalog, type ResolvedDelegation, type RetrieveOptions, type Retriever, type RolesPolicy, type RolesPolicyOptions, type RunAgentBreakdownRow, RunCancelledError, type RunErrorBreakdownRow, type RunMetrics, type RunToolCallRow, type RunTrendPoint, type RunWhere, SCHEMA_EXTENSION, SKILL_TOOL_DESCRIPTION, SKILL_TOOL_NAME, type SchemaExtension, type ScopeContext, type ScopeResolver, type SearchMemoriesInput, SettleActionProposal, type SettleDeadRunInput, type SettledTask, type ShownToolInputPreview, 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, SqlTokenStreamSink, type SqlTokenStreamSinkOptions, type StageAttachmentInput, type StagedAttachment, type StoreMemoryInput, StoredMessage, type StreamError, type StreamFrameRow, type StreamFrameTable, type StructuredOutcome, StructuredOutputError, THREAD_DETAIL_CONTENT_CHARS, type TextActionProposalCandidate, type TextActionProposalCommand, type TextActionProposalConfig, type TextActionProposalReplies, type TextActionProposalResolution, type TextActionProposalVocabulary, type ThreadActivityRow, ThreadDetail, type ThreadMessageRow, type ThreadMeta, type ThreadSpendRow, ThreadSummary, type ThreadUsageRollup, type ThreadWhere, type TokenStreamSink, type ToolCallActivityRow, ToolCallApprovalState, ToolCallOutcome, ToolCallRequest, ToolCallStatus, type ToolCallWhere, ToolConfirmation, ToolDefinition, ToolDescribeScope, ToolDisabledError, ToolForbiddenError, ToolHandler, ToolInputDriftError, ToolInputInvalidError, ToolInputPreview, ToolInputPreviewScope, type ToolInputPreviews, type ToolKindDeps, ToolNotFoundError, ToolPreflightDeniedError, ToolPreflightResult, type ToolPreparationResult, ToolRegistry, ToolResult, ToolSpec, type ToolStatRow, ToolStepEnvelope, ToolTransientRetrySetting, type TurnFrameSummary, type UiCollector, UpdateThreadInput, UpdateToolCallInput, type UsageTrendPoint, type WindowHistoryOptions, type WithMemoryToolInput, type WriteMemoryInput, actionProposalCreationMatches, actionProposalOutcomeFenceValid, actionProposalOutcomeScope, actionProposalOutcomeText, actionProposalReceipt, actionProposalScopeMatches, actorScope, agentDiagnosticKey, agentFailureCode, assertIndependentActionCapabilities, attachActionProposalOutcome, bucketByActor, bucketByModel, bucketByThread, bucketUsageTrend, buildMemoryBlock, buildSkillsBlock, canActorUseTool, canonicalActionProposalJson, canonicalJson, claimActionProposalOutcome, closeEmptyRoles, compositeSkillProvider, confirmTokenExpiry, createFrameBuffer, createFunctionalTool, createIncrementalGate, createNegotiatedUiCollector, createNoopEmitUi, createUiCollector, dayBoundsUtc, defaultScopeResolver, defineConfirmedTool, detachedDelivered, detachedStarted, detachedUnsettled, emitToolPresentations, escapeUnsafeToolUiText, estimateCost, estimateMessageTokens, exhaustedWindow, exposeStreamErrorDetails, extractJson, filterToolsByAllowList, filterToolsByCanUse, filterToolsByEnabled, filterToolsByRole, findCatalogModel, findPersona, gateFollowUps, gateTail, hashConfirmToken, initialActionProposal, intersectAllowLists, isControlFlowSignal, isReplayIntegrityError, isToolEnabled, loadSkill, memoryForgetVerdict, memoryWriteVerdict, mergeUi, normalizeDelegation, observeTurnFrames, offerMemories, offerSkills, parsePartialJson, parseTextActionProposalCommand, personaCatalogEntry, prepareActionProposal, previewToolInputs, previewUiId, ptBrActionProposalText, publishAgentDelegated, publishAgentMemoryResolved, publishAgentMemoryWritten, publishAgentMessage, publishAgentQuotaExceeded, publishAgentRetrieved, publishAgentRunFailed, publishAgentRunFinished, publishAgentRunStarted, publishAgentSkillsResolved, publishAgentToolCall, publishAgentToolRetry, quotaPeriodRange, quotaUsedRatio, quotaWarning, registryInputPreviews, releaseGatedFrames, rememberInputSchema, rememberToolDefinition, repairInstruction, resolveGateLookback, resolveMemoryDigest, resolveOutputGateMode, resolvePersonaAlias, resolveSkillCatalog, resolveTextActionProposalDecision, rollupThreadUsage, runAgentLoop, runInputProcessors, runOutputProcessors, schemaExtensionOf, seedModelPrices, settleAll, settleDeadRun, settleUnsettledDelegation, signConfirmToken, skillInputSchema, skillToolDefinition, skillWriteVerdict, snapshotActionProposal, stampToolKinds, staticModelCatalog, staticSkillProvider, streamFailure, summarizeWithModel, tenantScope, textActionProposalReply, toActionProposalMutationView, toActionProposalView, toolCallContext, toolCallUpdateForProposal, toolCallUpdateForTransition, traceLlmTurn, traceToolExecution, transitionActionProposalClaim, transitionActionProposalDecision, transitionActionProposalLease, transitionActionProposalSettlement, transitionActionProposalSupersession, truncateDetailContent, unwrapToolStepOutput, validateActionProposalCreation, validateActionProposalDiscoveryIndexBatch, validateActionProposalExpiryBatch, validateActionProposalListQuery, validateActionProposalWorkerClaim, validateStructured, verifyConfirmToken, windowHistory, withAskTool, withConfirmFields, withMemoryTool, withSelectedModel, withSkillTool, withToolTimeout, withTurnFrames, withdrawPreviewEvent, wrapToolPreflightDenied, wrapToolStepOutput, writeMemory };
|
package/dist/index.js
CHANGED
|
@@ -7808,6 +7808,98 @@ ${toolText}`;
|
|
|
7808
7808
|
}
|
|
7809
7809
|
__name(runAgentLoop, "runAgentLoop");
|
|
7810
7810
|
|
|
7811
|
+
// src/action-proposal-tool-call.ts
|
|
7812
|
+
function toolCallUpdateForProposal(proposal) {
|
|
7813
|
+
const audit = proposal.decisionAudit;
|
|
7814
|
+
const toolCallId = proposal.originToolCallId;
|
|
7815
|
+
const decidedBy = {
|
|
7816
|
+
...audit?.actorRef !== void 0 ? {
|
|
7817
|
+
executedByRef: audit.actorRef
|
|
7818
|
+
} : {},
|
|
7819
|
+
...audit?.via !== void 0 ? {
|
|
7820
|
+
decidedVia: audit.via
|
|
7821
|
+
} : {}
|
|
7822
|
+
};
|
|
7823
|
+
switch (proposal.decision) {
|
|
7824
|
+
case "rejected":
|
|
7825
|
+
return {
|
|
7826
|
+
toolCallId,
|
|
7827
|
+
status: "rejected",
|
|
7828
|
+
...decidedBy,
|
|
7829
|
+
...audit?.reason !== void 0 ? {
|
|
7830
|
+
error: storableText2(audit.reason)
|
|
7831
|
+
} : {}
|
|
7832
|
+
};
|
|
7833
|
+
case "expired":
|
|
7834
|
+
return {
|
|
7835
|
+
toolCallId,
|
|
7836
|
+
status: "expired",
|
|
7837
|
+
...audit?.via !== void 0 ? {
|
|
7838
|
+
decidedVia: audit.via
|
|
7839
|
+
} : {}
|
|
7840
|
+
};
|
|
7841
|
+
case "superseded":
|
|
7842
|
+
return {
|
|
7843
|
+
toolCallId,
|
|
7844
|
+
status: "expired",
|
|
7845
|
+
decidedVia: audit?.via ?? "supersession",
|
|
7846
|
+
error: proposal.supersededBy !== void 0 ? `superseded by proposal ${proposal.supersededBy}` : "superseded by a newer proposal"
|
|
7847
|
+
};
|
|
7848
|
+
case "approved": {
|
|
7849
|
+
const execution = proposal.execution;
|
|
7850
|
+
const remember = audit?.remember !== void 0 ? {
|
|
7851
|
+
remember: audit.remember
|
|
7852
|
+
} : {};
|
|
7853
|
+
if (execution?.status === "succeeded") {
|
|
7854
|
+
return {
|
|
7855
|
+
toolCallId,
|
|
7856
|
+
status: "executed",
|
|
7857
|
+
...storableOutput(execution.result) ? {
|
|
7858
|
+
output: execution.result
|
|
7859
|
+
} : {},
|
|
7860
|
+
...decidedBy,
|
|
7861
|
+
...remember
|
|
7862
|
+
};
|
|
7863
|
+
}
|
|
7864
|
+
if (execution?.status === "failed") {
|
|
7865
|
+
return {
|
|
7866
|
+
toolCallId,
|
|
7867
|
+
status: "failed",
|
|
7868
|
+
error: storableText2(execution.error ?? "the approved action failed"),
|
|
7869
|
+
...decidedBy,
|
|
7870
|
+
...remember
|
|
7871
|
+
};
|
|
7872
|
+
}
|
|
7873
|
+
return null;
|
|
7874
|
+
}
|
|
7875
|
+
default:
|
|
7876
|
+
return null;
|
|
7877
|
+
}
|
|
7878
|
+
}
|
|
7879
|
+
__name(toolCallUpdateForProposal, "toolCallUpdateForProposal");
|
|
7880
|
+
function toolCallUpdateForTransition(previous, next) {
|
|
7881
|
+
const update = toolCallUpdateForProposal(next);
|
|
7882
|
+
if (update === null) return null;
|
|
7883
|
+
const before = previous === void 0 ? null : toolCallUpdateForProposal(previous);
|
|
7884
|
+
return before?.status === update.status ? null : update;
|
|
7885
|
+
}
|
|
7886
|
+
__name(toolCallUpdateForTransition, "toolCallUpdateForTransition");
|
|
7887
|
+
function storableOutput(result2) {
|
|
7888
|
+
if (result2 === void 0) return false;
|
|
7889
|
+
let json;
|
|
7890
|
+
try {
|
|
7891
|
+
json = JSON.stringify(result2);
|
|
7892
|
+
} catch {
|
|
7893
|
+
return false;
|
|
7894
|
+
}
|
|
7895
|
+
return json !== void 0 && !/\\u0000|\\ud[89ab][0-9a-f]{2}(?!\\ud[c-f])|(?<!\\ud[89ab][0-9a-f]{2})\\ud[c-f][0-9a-f]{2}/i.test(json);
|
|
7896
|
+
}
|
|
7897
|
+
__name(storableOutput, "storableOutput");
|
|
7898
|
+
function storableText2(text) {
|
|
7899
|
+
return text.replaceAll("\0", "");
|
|
7900
|
+
}
|
|
7901
|
+
__name(storableText2, "storableText");
|
|
7902
|
+
|
|
7811
7903
|
// src/in-memory-action-proposal-store.ts
|
|
7812
7904
|
import { randomUUID } from "crypto";
|
|
7813
7905
|
var InMemoryActionProposalStore = class {
|
|
@@ -7854,9 +7946,19 @@ var InMemoryActionProposalStore = class {
|
|
|
7854
7946
|
status: "not_found"
|
|
7855
7947
|
};
|
|
7856
7948
|
const result2 = transition(row2, this.clock());
|
|
7857
|
-
if (result2.proposal)
|
|
7949
|
+
if (result2.proposal) {
|
|
7950
|
+
this.rows.set(id, snapshotActionProposal(result2.proposal));
|
|
7951
|
+
this.proposalChanged(row2, result2.proposal);
|
|
7952
|
+
}
|
|
7858
7953
|
return result2;
|
|
7859
7954
|
}
|
|
7955
|
+
/**
|
|
7956
|
+
* Called after every proposal transition, with the row before and after — synchronously, so no
|
|
7957
|
+
* reader sees one without the other. {@link InMemoryAgentStore} settles the proposal's tool-call
|
|
7958
|
+
* record here (see `toolCallUpdateForTransition`).
|
|
7959
|
+
*/
|
|
7960
|
+
proposalChanged(_previous, _next) {
|
|
7961
|
+
}
|
|
7860
7962
|
async decideActionProposal(scope, id, command) {
|
|
7861
7963
|
return this.mutate(scope, id, (row2, now) => transitionActionProposalDecision(row2, command, now));
|
|
7862
7964
|
}
|
|
@@ -7937,7 +8039,11 @@ var InMemoryActionProposalStore = class {
|
|
|
7937
8039
|
if (result2.proposal) replacements.push(result2.proposal);
|
|
7938
8040
|
}
|
|
7939
8041
|
this.rows.set(proposal.id, proposal);
|
|
7940
|
-
for (const row2 of replacements)
|
|
8042
|
+
for (const row2 of replacements) {
|
|
8043
|
+
const previous = this.rows.get(row2.id);
|
|
8044
|
+
this.rows.set(row2.id, row2);
|
|
8045
|
+
if (previous) this.proposalChanged(previous, row2);
|
|
8046
|
+
}
|
|
7941
8047
|
return {
|
|
7942
8048
|
status: "created",
|
|
7943
8049
|
proposal: snapshotActionProposal(proposal)
|
|
@@ -8658,6 +8764,15 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
8658
8764
|
return settled;
|
|
8659
8765
|
}
|
|
8660
8766
|
async updateToolCall(input) {
|
|
8767
|
+
this.applyToolCallUpdate(input);
|
|
8768
|
+
}
|
|
8769
|
+
/** An independent proposal moved: its `proposed` tool-call record follows it. */
|
|
8770
|
+
proposalChanged(previous, next) {
|
|
8771
|
+
const update = toolCallUpdateForTransition(previous, next);
|
|
8772
|
+
if (update === null || this.toolCalls.get(update.toolCallId)?.proposalId !== next.id) return;
|
|
8773
|
+
this.applyToolCallUpdate(update);
|
|
8774
|
+
}
|
|
8775
|
+
applyToolCallUpdate(input) {
|
|
8661
8776
|
const row2 = this.toolCalls.get(input.toolCallId);
|
|
8662
8777
|
if (row2 === void 0) {
|
|
8663
8778
|
return;
|
|
@@ -10199,6 +10314,8 @@ export {
|
|
|
10199
10314
|
toActionProposalView,
|
|
10200
10315
|
toolCallApprovalFromRow,
|
|
10201
10316
|
toolCallContext,
|
|
10317
|
+
toolCallUpdateForProposal,
|
|
10318
|
+
toolCallUpdateForTransition,
|
|
10202
10319
|
traceLlmTurn,
|
|
10203
10320
|
traceToolExecution,
|
|
10204
10321
|
transitionActionProposalClaim,
|