@dudousxd/nestjs-agent-core 0.40.0 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/ag-ui/index.cjs +46 -10
- package/dist/ag-ui/index.cjs.map +1 -1
- package/dist/ag-ui/index.d.cts +9 -3
- package/dist/ag-ui/index.d.ts +9 -3
- package/dist/ag-ui/index.js +46 -10
- package/dist/ag-ui/index.js.map +1 -1
- package/dist/{catalog-CrzetM3_.d.cts → catalog-BKS3Yxo6.d.cts} +2 -0
- package/dist/{catalog-CrzetM3_.d.ts → catalog-BKS3Yxo6.d.ts} +2 -0
- package/dist/genui/builtins.cjs.map +1 -1
- package/dist/genui/builtins.d.cts +1 -1
- package/dist/genui/builtins.d.ts +1 -1
- package/dist/genui/builtins.js.map +1 -1
- package/dist/genui/index.cjs +660 -68
- package/dist/genui/index.cjs.map +1 -1
- package/dist/genui/index.d.cts +5 -5
- package/dist/genui/index.d.ts +5 -5
- package/dist/genui/index.js +654 -68
- package/dist/genui/index.js.map +1 -1
- package/dist/guardrails/index.cjs +3 -1
- package/dist/guardrails/index.cjs.map +1 -1
- package/dist/guardrails/index.d.cts +5 -4
- package/dist/guardrails/index.d.ts +5 -4
- package/dist/guardrails/index.js +3 -1
- package/dist/guardrails/index.js.map +1 -1
- package/dist/index.cjs +1161 -421
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +118 -13
- package/dist/index.d.ts +118 -13
- package/dist/index.js +1153 -421
- package/dist/index.js.map +1 -1
- package/dist/{processors-B7nfbU6E.d.cts → processors-BXM-MNga.d.cts} +1 -1
- package/dist/{processors-BR3nICcp.d.ts → processors-ByDr5POu.d.ts} +1 -1
- package/dist/{stream-events-DAmes2Of.d.ts → stream-events-BGKLD6RX.d.ts} +73 -4
- package/dist/{stream-events-M0jc7lSW.d.cts → stream-events-CF-6-Y6L.d.cts} +73 -4
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { M as ModelMessage,
|
|
2
|
-
export {
|
|
1
|
+
import { M as ModelMessage, q as ToolDefinition, r as ToolCallRequest, u as MessageUsage, w as AgentUiComponent, a as Actor, x as AiToolCtx, A as AgentStreamEvent, T as ToolSpec, Q as QuotaState, y as AgentRunInput, H as HumanReply, z as MessageAttachment, B as ActionProposalMutationResult, D as ActionProposal, E as ActionProposalExecution, F as ActionProposalOutcomeDelivery, b as ToolHandler, G as AgentDefinition, I as Persona, J as PersonaCatalogEntry, K as HistoryPolicy, L as PageContext, N as AgentStore, O as AgentDelegation, R as DetachedDelivery, S as ToolDescribeScope, V as ToolPreflightResult, W as ApprovalPolicy, X as PromptBuilder, Y as PromptContributor, Z as ToolTransientRetrySetting, _ as AgentIntake, $ as Decision, a0 as ElicitationRequest, a1 as LlmStepEnvelope, a2 as ToolStepEnvelope, a3 as ClaimActionProposal, a4 as ActionProposalStore, a5 as ActionProposalStoreOptions, a6 as CreateActionProposal, a7 as CreateActionProposalResult, a8 as ActionProposalScope, a9 as ListActionProposals, aa as ActionProposalDecisionCommand, ab as ExtendActionProposalLease, ac as SettleActionProposal, ad as ActionProposalOutcome, ae as ActionProposalOutcomeLease, af as ToolCallStatus, ag as ChatQueueStore, ah as ActionProposalOutcomeStore, ai as CreateThreadInput, aj as ThreadSummary, ak as ThreadDetail, al as ToolCallApprovalState, am as UpdateThreadInput, an as RecordRunStartInput, ao as EnqueueMessageInput, ap as QueuedMessage, aq as QueuedMessagePatch, ar as QueuePause, as as AppendMessageInput, at as StoredMessage, au as ToolResult, av as MessageFeedback, aw as RecordToolCallInput, ax as ToolCallOutcome, ay as UpdateToolCallInput, az as RecordUsageInput, aA as ToolConfirmation, aB as ActionProposalDecision, aC as ActionProposalSupersessionStore } from './stream-events-CF-6-Y6L.cjs';
|
|
2
|
+
export { aD as ALL_AGENTS, aE as ASK_TOOL_DESCRIPTION, aF as ASK_TOOL_NAME, aG as ActionProposalDecisionAudit, aH as ActionProposalExecutionContext, aI as ActionProposalLease, aJ as AgentApprovalRequest, aK as AgentApprovalSettlement, aL as AgentAttachmentConfig, aM as AgentCatalogEntry, aN as AgentClientConfig, aO as AgentHistoryWindow, aP as AgentStreamErrorCode, aQ as ApprovalDecisionRef, aR as ApprovalRequirement, aS as ApprovalThreadRef, aT as ApprovalToolRef, aU as AskToolInput, aV as ChatQueueState, aW as ClaimedActionApproval, aX as DEFAULT_INTAKE_PREAMBLE, aY as DEFAULT_TOOL_TRANSIENT_RETRY_ATTEMPTS, aZ as DEFAULT_TOOL_TRANSIENT_RETRY_BACKOFF_MS, a_ as DefaultApprovalPolicy, a$ as ELICITATION_INPUT_TYPES, b0 as ElicitationInput, b1 as ElicitationInputType, b2 as ElicitationOption, b3 as ElicitationOutcome, b4 as ElicitationQuestion, b5 as ElicitationReply, b6 as ElicitationResult, b7 as EmitUiOptions, b8 as HistoryPolicyContext, b9 as HistorySelection, ba as HistorySummary, bb as InvokeWithTransientRetryOptions, bc as MAX_ASK_QUESTIONS, bd as MessageFeedbackValue, be as MessageRole, bf as PersonaRef, bg as PromptContext, bh as QueuePauseReason, bi as QueuedMessageView, bj as QuotaView, bk as REQUESTER_APPROVER, bl as RUN_ENDED_BEFORE_TOOL_CALL, bm as RecordRunEndInput, bn as ResolveActionProposalApprovalInput, bo as ThreadTurnPage, bp as ThreadTurnQuery, bq as ThreadTurnReader, br as ToolCallApproval, bs as ToolCallApprovalColumns, bt as ToolCallApprovalStatus, bu as ToolCatalogEntry, bv as ToolDescription, bw as ToolKind, bx as ToolPreflightOptions, c as ToolPresentation, by as ToolPresentationTone, bz as ToolResultField, bA as ToolResultView, bB as ToolStepCtx, bC as ToolTransientRetryNumbers, bD as ToolTransientRetryOptions, bE as TurnPersona, bF as UNFINISHED_TOOL_CALL, bG as UsagePurpose, bH as askInputSchema, bI as askToolDefinition, bJ as danglingToolCallIds, bK as decodeStreamEvent, bL as defaultCanDecide, bM as encodeStreamEvent, bN as invokeWithTransientRetry, bO as isChatQueueStore, bP as isTransientToolError, bQ as isTypedQuestion, bR as mayDecideApproval, bS as normalizeElicitationReply, bT as questionOptions, bU as queuedMessageView, bV as readElicitationInput, bW as readElicitationQuestions, bX as releaseThreadRun, bY as renderElicitationAnswers, bZ as resolveActionProposalApproval, b_ as resolveElicitation, b$ as resolveToolTransientRetryNumbers, c0 as settleDanglingToolCalls, c1 as settleElicitation, c2 as toolCallApprovalFromRow, c3 as validateElicitationAnswer, c4 as validateElicitationValue } from './stream-events-CF-6-Y6L.cjs';
|
|
3
3
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
4
|
-
import { O as OutputProcessor, P as ProcessorContext, I as InputProcessor, a as ProcessedPrompt, M as ModelAnswer } from './processors-
|
|
5
|
-
export { D as DEFAULT_INCREMENTAL_LOOKBACK_CHARS, b as IncrementalGating, c as OutputRejectedError, d as OutputVerdict, e as ProcessorFailedError } from './processors-
|
|
6
|
-
import { a as Catalog } from './catalog-
|
|
4
|
+
import { O as OutputProcessor, P as ProcessorContext, I as InputProcessor, a as ProcessedPrompt, M as ModelAnswer } from './processors-BXM-MNga.cjs';
|
|
5
|
+
export { D as DEFAULT_INCREMENTAL_LOOKBACK_CHARS, b as IncrementalGating, c as OutputRejectedError, d as OutputVerdict, e as ProcessorFailedError } from './processors-BXM-MNga.cjs';
|
|
6
|
+
import { a as Catalog } from './catalog-BKS3Yxo6.cjs';
|
|
7
7
|
import { ChannelRegistry } from '@dudousxd/nestjs-diagnostics';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -29,6 +29,11 @@ declare const AGENT_DURABLE_RUNNER: unique symbol;
|
|
|
29
29
|
declare const AGENT_SINK: unique symbol;
|
|
30
30
|
declare const AGENT_MODEL: unique symbol;
|
|
31
31
|
declare const AGENT_ROLES_POLICY: unique symbol;
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Nothing binds or injects this token since the quota rework (#230): `AgentModule`
|
|
34
|
+
* enforces and reports the budget through {@link AGENT_QUOTA_PROVIDER}, configured with
|
|
35
|
+
* `AgentModule.forRoot({ quota })`. Inject `AGENT_QUOTA_PROVIDER` instead. Removed in the next major.
|
|
36
|
+
*/
|
|
32
37
|
declare const AGENT_QUOTA_STORE: unique symbol;
|
|
33
38
|
declare const AGENT_TOOL_REGISTRY: unique symbol;
|
|
34
39
|
declare const AGENT_REGISTRY: unique symbol;
|
|
@@ -449,7 +454,7 @@ interface QuotaQuery {
|
|
|
449
454
|
}
|
|
450
455
|
/**
|
|
451
456
|
* The actor's budget across windows — the read behind `GET <base>/quota` and, when the host binds
|
|
452
|
-
* one (`AgentModule.forRoot({
|
|
457
|
+
* one (`AgentModule.forRoot({ quota })`), the gate a send passes: a report with `blocked`
|
|
453
458
|
* refuses the turn with `429` before it starts.
|
|
454
459
|
*
|
|
455
460
|
* The default reads the usage ledger (`LedgerQuotaProvider` in `@dudousxd/nestjs-agent`); a host
|
|
@@ -1136,6 +1141,26 @@ interface AttachmentStagingDescription {
|
|
|
1136
1141
|
upload?: 'multipart' | 'resumable';
|
|
1137
1142
|
}
|
|
1138
1143
|
|
|
1144
|
+
/**
|
|
1145
|
+
* What leaves the server about a proposal — the routes, a text decision's answer, AG-UI, the approval
|
|
1146
|
+
* port. The stored row minus what only the worker and the store may hold: the execution and
|
|
1147
|
+
* delivery leases (whose token lets a holder settle the work), the idempotency key the tool's side
|
|
1148
|
+
* effect is keyed on, and the execution address (the original preparation input and the request's
|
|
1149
|
+
* context).
|
|
1150
|
+
*/
|
|
1151
|
+
interface ActionProposalView extends Omit<ActionProposal, 'execution' | 'outcomeDelivery' | 'idempotencyKey' | 'preparationInput' | 'executionContext'> {
|
|
1152
|
+
execution: Omit<ActionProposalExecution, 'lease'> | null;
|
|
1153
|
+
outcomeDelivery?: Omit<ActionProposalOutcomeDelivery, 'lease'>;
|
|
1154
|
+
}
|
|
1155
|
+
/** {@link ActionProposalMutationResult} with its proposal as an {@link ActionProposalView}. */
|
|
1156
|
+
interface ActionProposalMutationView extends Omit<ActionProposalMutationResult, 'proposal'> {
|
|
1157
|
+
proposal?: ActionProposalView;
|
|
1158
|
+
}
|
|
1159
|
+
/** The public view of a stored proposal. See {@link ActionProposalView}. */
|
|
1160
|
+
declare function toActionProposalView(proposal: ActionProposal): ActionProposalView;
|
|
1161
|
+
/** The public view of a mutation's answer. See {@link ActionProposalView}. */
|
|
1162
|
+
declare function toActionProposalMutationView(result: ActionProposalMutationResult): ActionProposalMutationView;
|
|
1163
|
+
|
|
1139
1164
|
/**
|
|
1140
1165
|
* Console-side HITL decisions. Implemented by the agent runtime (the nestjs package binds it to
|
|
1141
1166
|
* the same signal path chat approvals use); the dashboard injects it OPTIONALLY — absent = the
|
|
@@ -1149,7 +1174,7 @@ interface AgentApprovalPort {
|
|
|
1149
1174
|
}, opts?: {
|
|
1150
1175
|
remember?: boolean;
|
|
1151
1176
|
decidedVia?: string;
|
|
1152
|
-
}): Promise<
|
|
1177
|
+
}): Promise<ActionProposalMutationView>;
|
|
1153
1178
|
rejectActionProposal?(actor: Actor, target: {
|
|
1154
1179
|
kind: 'proposal';
|
|
1155
1180
|
threadId: string;
|
|
@@ -1157,7 +1182,7 @@ interface AgentApprovalPort {
|
|
|
1157
1182
|
}, opts?: {
|
|
1158
1183
|
reason?: string;
|
|
1159
1184
|
decidedVia?: string;
|
|
1160
|
-
}): Promise<
|
|
1185
|
+
}): Promise<ActionProposalMutationView>;
|
|
1161
1186
|
/**
|
|
1162
1187
|
* `remember` approves later calls of the same tool in the same thread; `decidedVia` names the
|
|
1163
1188
|
* surface the decision came through (`'console'`, `'slack'`, …) and is persisted with the call.
|
|
@@ -2512,6 +2537,10 @@ declare class ToolInputDriftError extends Error {
|
|
|
2512
2537
|
declare class ToolRegistry {
|
|
2513
2538
|
private readonly entries;
|
|
2514
2539
|
register(spec: ToolSpec, handler: ToolHandler): void;
|
|
2540
|
+
/** Whether a successful preflight shortcut has UI to journal. */
|
|
2541
|
+
hasPresentation(name: string): boolean;
|
|
2542
|
+
/** Present an already authorized successful domain result without executing its action again. */
|
|
2543
|
+
presentOutput(name: string, output: unknown, ctx: AiToolCtx): Promise<void>;
|
|
2515
2544
|
has(name: string): boolean;
|
|
2516
2545
|
/**
|
|
2517
2546
|
* Give a name back, and report whether it was held. For an importer that registered tools on
|
|
@@ -2581,6 +2610,10 @@ interface ToolPreparationResult {
|
|
|
2581
2610
|
* visitor included, when no resolver is configured); restrict with `@AiTool({ roles })` per tool,
|
|
2582
2611
|
* `AgentModule.forRoot({ defaultRoles })` module-wide, or a `rolesPolicy` of your own. `action`
|
|
2583
2612
|
* tools still park on approval either way.
|
|
2613
|
+
*
|
|
2614
|
+
* A tool gated by an `ability` and naming no `roles` is refused: this policy cannot evaluate an
|
|
2615
|
+
* ability, and falling through to the open default would hand the tool to everyone. Bind an
|
|
2616
|
+
* ability-aware policy (`AgentAuthzModule`) to reach it — or give the tool `roles` as well.
|
|
2584
2617
|
*/
|
|
2585
2618
|
declare class DefaultRolesPolicy implements RolesPolicy {
|
|
2586
2619
|
readonly defaultRoles: string[];
|
|
@@ -3172,10 +3205,22 @@ interface AgentToolCallEvent {
|
|
|
3172
3205
|
status: string;
|
|
3173
3206
|
durationMs?: number;
|
|
3174
3207
|
}
|
|
3208
|
+
/**
|
|
3209
|
+
* A turn refused for budget. Published by the send gate (`429`) and the message queue when a
|
|
3210
|
+
* `QuotaProvider` reports `blocked`, and by the loop's own per-day `QuotaStore` gate. The figures
|
|
3211
|
+
* are the exhausted window's: a window that does not count tokens (a USD-only spend cap) carries no
|
|
3212
|
+
* token figures, never a made-up `0`.
|
|
3213
|
+
*/
|
|
3175
3214
|
interface AgentQuotaExceeded {
|
|
3176
3215
|
actorId: string;
|
|
3177
|
-
|
|
3178
|
-
|
|
3216
|
+
/** The window that ran out. Absent from the loop's per-day `QuotaStore` gate. */
|
|
3217
|
+
period?: QuotaPeriod;
|
|
3218
|
+
/** The provider's words for the block, when it gave some. */
|
|
3219
|
+
reason?: string;
|
|
3220
|
+
usedTokens?: number;
|
|
3221
|
+
limitTokens?: number;
|
|
3222
|
+
usedUsd?: number;
|
|
3223
|
+
limitUsd?: number;
|
|
3179
3224
|
}
|
|
3180
3225
|
interface AgentRunFinished {
|
|
3181
3226
|
runId: string;
|
|
@@ -4117,7 +4162,7 @@ type TextActionProposalResolution = {
|
|
|
4117
4162
|
* resolve the authenticated actor and use the normal scoped decision service with via=text.
|
|
4118
4163
|
* Never feed model output here or consume an unmatched message as an approval.
|
|
4119
4164
|
*/
|
|
4120
|
-
declare function resolveTextActionProposalDecision(text: string, proposals: readonly TextActionProposalCandidate[]): TextActionProposalResolution;
|
|
4165
|
+
declare function resolveTextActionProposalDecision(text: string, proposals: readonly TextActionProposalCandidate[], vocabulary?: TextActionProposalVocabulary): TextActionProposalResolution;
|
|
4121
4166
|
type TextActionProposalCommand = {
|
|
4122
4167
|
status: 'unmatched';
|
|
4123
4168
|
} | {
|
|
@@ -4126,8 +4171,54 @@ type TextActionProposalCommand = {
|
|
|
4126
4171
|
remember: boolean;
|
|
4127
4172
|
proposalId?: string;
|
|
4128
4173
|
};
|
|
4174
|
+
/**
|
|
4175
|
+
* The words a whole chat message must consist of to decide a proposal by text. Matched
|
|
4176
|
+
* case-insensitively, as the complete message (an optional trailing `.`/`!`, an optional `#ID`).
|
|
4177
|
+
*/
|
|
4178
|
+
interface TextActionProposalVocabulary {
|
|
4179
|
+
/** Approve, e.g. `sim`, `yes`. */
|
|
4180
|
+
approve: readonly string[];
|
|
4181
|
+
/** Reject, e.g. `não`, `no`. */
|
|
4182
|
+
reject: readonly string[];
|
|
4183
|
+
/** The phrase after an approve word that also approves later calls of the tool in this thread. */
|
|
4184
|
+
remember: readonly string[];
|
|
4185
|
+
}
|
|
4186
|
+
/**
|
|
4187
|
+
* English. Portuguese ships as {@link ptBrActionProposalText}; any other language through
|
|
4188
|
+
* `AgentModule.forRoot({ actionProposalText })`.
|
|
4189
|
+
*/
|
|
4190
|
+
declare const DEFAULT_TEXT_ACTION_PROPOSAL_VOCABULARY: TextActionProposalVocabulary;
|
|
4191
|
+
/** What the agent answers to a text decision. Every field has an English default. */
|
|
4192
|
+
interface TextActionProposalReplies {
|
|
4193
|
+
approved: string;
|
|
4194
|
+
rejected: string;
|
|
4195
|
+
expired: string;
|
|
4196
|
+
/** The proposal could not change (already decided by someone else, superseded, …). */
|
|
4197
|
+
unchanged: string;
|
|
4198
|
+
/** More than one pending proposal could be meant: ask for the `#ID`. */
|
|
4199
|
+
ambiguous(proposalIds: readonly string[]): string;
|
|
4200
|
+
/** Too many pending proposals to pick one without an explicit `#ID`. */
|
|
4201
|
+
tooMany: string;
|
|
4202
|
+
}
|
|
4203
|
+
declare const DEFAULT_TEXT_ACTION_PROPOSAL_REPLIES: TextActionProposalReplies;
|
|
4204
|
+
/** `AgentModule.forRoot({ actionProposalText })`: either part replaces the default it names. */
|
|
4205
|
+
interface TextActionProposalConfig {
|
|
4206
|
+
vocabulary?: Partial<TextActionProposalVocabulary>;
|
|
4207
|
+
replies?: Partial<TextActionProposalReplies>;
|
|
4208
|
+
}
|
|
4209
|
+
/** The reply to a decision the store answered with `result`. */
|
|
4210
|
+
declare function textActionProposalReply(result: Pick<ActionProposalMutationResult, 'status'> & {
|
|
4211
|
+
proposal?: {
|
|
4212
|
+
decision: ActionProposalDecision;
|
|
4213
|
+
};
|
|
4214
|
+
}, decision: 'approved' | 'rejected', replies?: TextActionProposalReplies): string;
|
|
4129
4215
|
/** Parse exact consent syntax only. Authentication and target lookup remain the caller's responsibility. */
|
|
4130
|
-
declare function parseTextActionProposalCommand(text: string): TextActionProposalCommand;
|
|
4216
|
+
declare function parseTextActionProposalCommand(text: string, vocabulary?: TextActionProposalVocabulary): TextActionProposalCommand;
|
|
4217
|
+
/**
|
|
4218
|
+
* Brazilian Portuguese text decisions — `AgentModule.forRoot({ actionProposalText: ptBrActionProposalText })`.
|
|
4219
|
+
* Commands in Portuguese (English ones still work), replies in Portuguese.
|
|
4220
|
+
*/
|
|
4221
|
+
declare const ptBrActionProposalText: Required<TextActionProposalConfig>;
|
|
4131
4222
|
|
|
4132
4223
|
interface ActionProposalExecutionDeps {
|
|
4133
4224
|
registry: ToolRegistry;
|
|
@@ -4188,4 +4279,18 @@ declare class ActionProposalWorker {
|
|
|
4188
4279
|
type ActionProposalRuntimeStore = AgentStore & ActionProposalStore & ActionProposalWorkerStore & ActionProposalOutcomeStore & ActionProposalSupersessionStore;
|
|
4189
4280
|
declare function assertIndependentActionCapabilities(store: AgentStore, resolver: BackgroundActorResolver | undefined): asserts store is ActionProposalRuntimeStore;
|
|
4190
4281
|
|
|
4191
|
-
export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_ATTACHMENT_STAGING, 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, type ActionProposalExecutionDeps, type ActionProposalExecutionResult, ActionProposalExecutor, type ActionProposalExecutorOptions, ActionProposalMutationResult, ActionProposalOutcome, ActionProposalOutcomeLease, ActionProposalOutcomeStore, type ActionProposalReceipt, type ActionProposalRuntimeStore, ActionProposalScope, ActionProposalStore, ActionProposalStoreOptions, ActionProposalSupersessionStore, type ActionProposalTarget, 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, 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_REFUSAL_REASON, DEFAULT_STRUCTURED_OUTPUT_INSTRUCTION, Decision, DefaultRolesPolicy, type DetachedDelegationOutcome, type DetachedDelegationReceipt, DetachedDelivery, type DetailThreadRef, ElicitationRequest, type EmbeddingProvider, type EmitUi, type EmptyRoles, EnqueueMessageInput, ExtendActionProposalLease, 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, InMemoryActionProposalStore, InMemoryAgentStore, 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 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 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 TextActionProposalResolution, 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, 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, createIncrementalGate, createNegotiatedUiCollector, createNoopEmitUi, createUiCollector, dayBoundsUtc, defaultScopeResolver, defineConfirmedTool, detachedDelivered, detachedStarted, detachedUnsettled, 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, parseTextActionProposalCommand, personaCatalogEntry, prepareActionProposal, publishAgentDelegated, publishAgentMemoryResolved, publishAgentMemoryWritten, publishAgentMessage, publishAgentQuotaExceeded, publishAgentRetrieved, publishAgentRunFailed, publishAgentRunFinished, publishAgentRunStarted, publishAgentSkillsResolved, publishAgentToolCall, publishAgentToolRetry, quotaPeriodRange, quotaUsedRatio, quotaWarning, 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, 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, wrapToolPreflightDenied, wrapToolStepOutput, writeMemory };
|
|
4282
|
+
interface FunctionalTool<I = unknown, O = unknown> {
|
|
4283
|
+
spec: ToolSpec;
|
|
4284
|
+
handler: ToolHandler<I, O>;
|
|
4285
|
+
}
|
|
4286
|
+
type FunctionalToolDefinition<I, O> = Omit<ToolSpec, 'inputSchema' | 'kind'> & {
|
|
4287
|
+
input: StandardSchemaV1<unknown, I>;
|
|
4288
|
+
kind?: ToolSpec['kind'];
|
|
4289
|
+
} & ToolHandler<I, O>;
|
|
4290
|
+
/** Framework-independent authoring; every method keeps the author's object as its receiver. */
|
|
4291
|
+
declare function createFunctionalTool<I, O>(definition: FunctionalToolDefinition<I, O>): FunctionalTool<I, O>;
|
|
4292
|
+
|
|
4293
|
+
/** Presentation failures must never cause a successful side effect to be retried. */
|
|
4294
|
+
declare function emitToolPresentations<I, O>(handler: ToolHandler<I, O>, output: O, ctx: AiToolCtx, toolName: string): Promise<void>;
|
|
4295
|
+
|
|
4296
|
+
export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_ATTACHMENT_STAGING, 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, 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_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, 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 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 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, 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, parseTextActionProposalCommand, personaCatalogEntry, prepareActionProposal, ptBrActionProposalText, publishAgentDelegated, publishAgentMemoryResolved, publishAgentMemoryWritten, publishAgentMessage, publishAgentQuotaExceeded, publishAgentRetrieved, publishAgentRunFailed, publishAgentRunFinished, publishAgentRunStarted, publishAgentSkillsResolved, publishAgentToolCall, publishAgentToolRetry, quotaPeriodRange, quotaUsedRatio, quotaWarning, 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, wrapToolPreflightDenied, wrapToolStepOutput, writeMemory };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { M as ModelMessage,
|
|
2
|
-
export {
|
|
1
|
+
import { M as ModelMessage, q as ToolDefinition, r as ToolCallRequest, u as MessageUsage, w as AgentUiComponent, a as Actor, x as AiToolCtx, A as AgentStreamEvent, T as ToolSpec, Q as QuotaState, y as AgentRunInput, H as HumanReply, z as MessageAttachment, B as ActionProposalMutationResult, D as ActionProposal, E as ActionProposalExecution, F as ActionProposalOutcomeDelivery, b as ToolHandler, G as AgentDefinition, I as Persona, J as PersonaCatalogEntry, K as HistoryPolicy, L as PageContext, N as AgentStore, O as AgentDelegation, R as DetachedDelivery, S as ToolDescribeScope, V as ToolPreflightResult, W as ApprovalPolicy, X as PromptBuilder, Y as PromptContributor, Z as ToolTransientRetrySetting, _ as AgentIntake, $ as Decision, a0 as ElicitationRequest, a1 as LlmStepEnvelope, a2 as ToolStepEnvelope, a3 as ClaimActionProposal, a4 as ActionProposalStore, a5 as ActionProposalStoreOptions, a6 as CreateActionProposal, a7 as CreateActionProposalResult, a8 as ActionProposalScope, a9 as ListActionProposals, aa as ActionProposalDecisionCommand, ab as ExtendActionProposalLease, ac as SettleActionProposal, ad as ActionProposalOutcome, ae as ActionProposalOutcomeLease, af as ToolCallStatus, ag as ChatQueueStore, ah as ActionProposalOutcomeStore, ai as CreateThreadInput, aj as ThreadSummary, ak as ThreadDetail, al as ToolCallApprovalState, am as UpdateThreadInput, an as RecordRunStartInput, ao as EnqueueMessageInput, ap as QueuedMessage, aq as QueuedMessagePatch, ar as QueuePause, as as AppendMessageInput, at as StoredMessage, au as ToolResult, av as MessageFeedback, aw as RecordToolCallInput, ax as ToolCallOutcome, ay as UpdateToolCallInput, az as RecordUsageInput, aA as ToolConfirmation, aB as ActionProposalDecision, aC as ActionProposalSupersessionStore } from './stream-events-BGKLD6RX.js';
|
|
2
|
+
export { aD as ALL_AGENTS, aE as ASK_TOOL_DESCRIPTION, aF as ASK_TOOL_NAME, aG as ActionProposalDecisionAudit, aH as ActionProposalExecutionContext, aI as ActionProposalLease, aJ as AgentApprovalRequest, aK as AgentApprovalSettlement, aL as AgentAttachmentConfig, aM as AgentCatalogEntry, aN as AgentClientConfig, aO as AgentHistoryWindow, aP as AgentStreamErrorCode, aQ as ApprovalDecisionRef, aR as ApprovalRequirement, aS as ApprovalThreadRef, aT as ApprovalToolRef, aU as AskToolInput, aV as ChatQueueState, aW as ClaimedActionApproval, aX as DEFAULT_INTAKE_PREAMBLE, aY as DEFAULT_TOOL_TRANSIENT_RETRY_ATTEMPTS, aZ as DEFAULT_TOOL_TRANSIENT_RETRY_BACKOFF_MS, a_ as DefaultApprovalPolicy, a$ as ELICITATION_INPUT_TYPES, b0 as ElicitationInput, b1 as ElicitationInputType, b2 as ElicitationOption, b3 as ElicitationOutcome, b4 as ElicitationQuestion, b5 as ElicitationReply, b6 as ElicitationResult, b7 as EmitUiOptions, b8 as HistoryPolicyContext, b9 as HistorySelection, ba as HistorySummary, bb as InvokeWithTransientRetryOptions, bc as MAX_ASK_QUESTIONS, bd as MessageFeedbackValue, be as MessageRole, bf as PersonaRef, bg as PromptContext, bh as QueuePauseReason, bi as QueuedMessageView, bj as QuotaView, bk as REQUESTER_APPROVER, bl as RUN_ENDED_BEFORE_TOOL_CALL, bm as RecordRunEndInput, bn as ResolveActionProposalApprovalInput, bo as ThreadTurnPage, bp as ThreadTurnQuery, bq as ThreadTurnReader, br as ToolCallApproval, bs as ToolCallApprovalColumns, bt as ToolCallApprovalStatus, bu as ToolCatalogEntry, bv as ToolDescription, bw as ToolKind, bx as ToolPreflightOptions, c as ToolPresentation, by as ToolPresentationTone, bz as ToolResultField, bA as ToolResultView, bB as ToolStepCtx, bC as ToolTransientRetryNumbers, bD as ToolTransientRetryOptions, bE as TurnPersona, bF as UNFINISHED_TOOL_CALL, bG as UsagePurpose, bH as askInputSchema, bI as askToolDefinition, bJ as danglingToolCallIds, bK as decodeStreamEvent, bL as defaultCanDecide, bM as encodeStreamEvent, bN as invokeWithTransientRetry, bO as isChatQueueStore, bP as isTransientToolError, bQ as isTypedQuestion, bR as mayDecideApproval, bS as normalizeElicitationReply, bT as questionOptions, bU as queuedMessageView, bV as readElicitationInput, bW as readElicitationQuestions, bX as releaseThreadRun, bY as renderElicitationAnswers, bZ as resolveActionProposalApproval, b_ as resolveElicitation, b$ as resolveToolTransientRetryNumbers, c0 as settleDanglingToolCalls, c1 as settleElicitation, c2 as toolCallApprovalFromRow, c3 as validateElicitationAnswer, c4 as validateElicitationValue } from './stream-events-BGKLD6RX.js';
|
|
3
3
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
4
|
-
import { O as OutputProcessor, P as ProcessorContext, I as InputProcessor, a as ProcessedPrompt, M as ModelAnswer } from './processors-
|
|
5
|
-
export { D as DEFAULT_INCREMENTAL_LOOKBACK_CHARS, b as IncrementalGating, c as OutputRejectedError, d as OutputVerdict, e as ProcessorFailedError } from './processors-
|
|
6
|
-
import { a as Catalog } from './catalog-
|
|
4
|
+
import { O as OutputProcessor, P as ProcessorContext, I as InputProcessor, a as ProcessedPrompt, M as ModelAnswer } from './processors-ByDr5POu.js';
|
|
5
|
+
export { D as DEFAULT_INCREMENTAL_LOOKBACK_CHARS, b as IncrementalGating, c as OutputRejectedError, d as OutputVerdict, e as ProcessorFailedError } from './processors-ByDr5POu.js';
|
|
6
|
+
import { a as Catalog } from './catalog-BKS3Yxo6.js';
|
|
7
7
|
import { ChannelRegistry } from '@dudousxd/nestjs-diagnostics';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -29,6 +29,11 @@ declare const AGENT_DURABLE_RUNNER: unique symbol;
|
|
|
29
29
|
declare const AGENT_SINK: unique symbol;
|
|
30
30
|
declare const AGENT_MODEL: unique symbol;
|
|
31
31
|
declare const AGENT_ROLES_POLICY: unique symbol;
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Nothing binds or injects this token since the quota rework (#230): `AgentModule`
|
|
34
|
+
* enforces and reports the budget through {@link AGENT_QUOTA_PROVIDER}, configured with
|
|
35
|
+
* `AgentModule.forRoot({ quota })`. Inject `AGENT_QUOTA_PROVIDER` instead. Removed in the next major.
|
|
36
|
+
*/
|
|
32
37
|
declare const AGENT_QUOTA_STORE: unique symbol;
|
|
33
38
|
declare const AGENT_TOOL_REGISTRY: unique symbol;
|
|
34
39
|
declare const AGENT_REGISTRY: unique symbol;
|
|
@@ -449,7 +454,7 @@ interface QuotaQuery {
|
|
|
449
454
|
}
|
|
450
455
|
/**
|
|
451
456
|
* The actor's budget across windows — the read behind `GET <base>/quota` and, when the host binds
|
|
452
|
-
* one (`AgentModule.forRoot({
|
|
457
|
+
* one (`AgentModule.forRoot({ quota })`), the gate a send passes: a report with `blocked`
|
|
453
458
|
* refuses the turn with `429` before it starts.
|
|
454
459
|
*
|
|
455
460
|
* The default reads the usage ledger (`LedgerQuotaProvider` in `@dudousxd/nestjs-agent`); a host
|
|
@@ -1136,6 +1141,26 @@ interface AttachmentStagingDescription {
|
|
|
1136
1141
|
upload?: 'multipart' | 'resumable';
|
|
1137
1142
|
}
|
|
1138
1143
|
|
|
1144
|
+
/**
|
|
1145
|
+
* What leaves the server about a proposal — the routes, a text decision's answer, AG-UI, the approval
|
|
1146
|
+
* port. The stored row minus what only the worker and the store may hold: the execution and
|
|
1147
|
+
* delivery leases (whose token lets a holder settle the work), the idempotency key the tool's side
|
|
1148
|
+
* effect is keyed on, and the execution address (the original preparation input and the request's
|
|
1149
|
+
* context).
|
|
1150
|
+
*/
|
|
1151
|
+
interface ActionProposalView extends Omit<ActionProposal, 'execution' | 'outcomeDelivery' | 'idempotencyKey' | 'preparationInput' | 'executionContext'> {
|
|
1152
|
+
execution: Omit<ActionProposalExecution, 'lease'> | null;
|
|
1153
|
+
outcomeDelivery?: Omit<ActionProposalOutcomeDelivery, 'lease'>;
|
|
1154
|
+
}
|
|
1155
|
+
/** {@link ActionProposalMutationResult} with its proposal as an {@link ActionProposalView}. */
|
|
1156
|
+
interface ActionProposalMutationView extends Omit<ActionProposalMutationResult, 'proposal'> {
|
|
1157
|
+
proposal?: ActionProposalView;
|
|
1158
|
+
}
|
|
1159
|
+
/** The public view of a stored proposal. See {@link ActionProposalView}. */
|
|
1160
|
+
declare function toActionProposalView(proposal: ActionProposal): ActionProposalView;
|
|
1161
|
+
/** The public view of a mutation's answer. See {@link ActionProposalView}. */
|
|
1162
|
+
declare function toActionProposalMutationView(result: ActionProposalMutationResult): ActionProposalMutationView;
|
|
1163
|
+
|
|
1139
1164
|
/**
|
|
1140
1165
|
* Console-side HITL decisions. Implemented by the agent runtime (the nestjs package binds it to
|
|
1141
1166
|
* the same signal path chat approvals use); the dashboard injects it OPTIONALLY — absent = the
|
|
@@ -1149,7 +1174,7 @@ interface AgentApprovalPort {
|
|
|
1149
1174
|
}, opts?: {
|
|
1150
1175
|
remember?: boolean;
|
|
1151
1176
|
decidedVia?: string;
|
|
1152
|
-
}): Promise<
|
|
1177
|
+
}): Promise<ActionProposalMutationView>;
|
|
1153
1178
|
rejectActionProposal?(actor: Actor, target: {
|
|
1154
1179
|
kind: 'proposal';
|
|
1155
1180
|
threadId: string;
|
|
@@ -1157,7 +1182,7 @@ interface AgentApprovalPort {
|
|
|
1157
1182
|
}, opts?: {
|
|
1158
1183
|
reason?: string;
|
|
1159
1184
|
decidedVia?: string;
|
|
1160
|
-
}): Promise<
|
|
1185
|
+
}): Promise<ActionProposalMutationView>;
|
|
1161
1186
|
/**
|
|
1162
1187
|
* `remember` approves later calls of the same tool in the same thread; `decidedVia` names the
|
|
1163
1188
|
* surface the decision came through (`'console'`, `'slack'`, …) and is persisted with the call.
|
|
@@ -2512,6 +2537,10 @@ declare class ToolInputDriftError extends Error {
|
|
|
2512
2537
|
declare class ToolRegistry {
|
|
2513
2538
|
private readonly entries;
|
|
2514
2539
|
register(spec: ToolSpec, handler: ToolHandler): void;
|
|
2540
|
+
/** Whether a successful preflight shortcut has UI to journal. */
|
|
2541
|
+
hasPresentation(name: string): boolean;
|
|
2542
|
+
/** Present an already authorized successful domain result without executing its action again. */
|
|
2543
|
+
presentOutput(name: string, output: unknown, ctx: AiToolCtx): Promise<void>;
|
|
2515
2544
|
has(name: string): boolean;
|
|
2516
2545
|
/**
|
|
2517
2546
|
* Give a name back, and report whether it was held. For an importer that registered tools on
|
|
@@ -2581,6 +2610,10 @@ interface ToolPreparationResult {
|
|
|
2581
2610
|
* visitor included, when no resolver is configured); restrict with `@AiTool({ roles })` per tool,
|
|
2582
2611
|
* `AgentModule.forRoot({ defaultRoles })` module-wide, or a `rolesPolicy` of your own. `action`
|
|
2583
2612
|
* tools still park on approval either way.
|
|
2613
|
+
*
|
|
2614
|
+
* A tool gated by an `ability` and naming no `roles` is refused: this policy cannot evaluate an
|
|
2615
|
+
* ability, and falling through to the open default would hand the tool to everyone. Bind an
|
|
2616
|
+
* ability-aware policy (`AgentAuthzModule`) to reach it — or give the tool `roles` as well.
|
|
2584
2617
|
*/
|
|
2585
2618
|
declare class DefaultRolesPolicy implements RolesPolicy {
|
|
2586
2619
|
readonly defaultRoles: string[];
|
|
@@ -3172,10 +3205,22 @@ interface AgentToolCallEvent {
|
|
|
3172
3205
|
status: string;
|
|
3173
3206
|
durationMs?: number;
|
|
3174
3207
|
}
|
|
3208
|
+
/**
|
|
3209
|
+
* A turn refused for budget. Published by the send gate (`429`) and the message queue when a
|
|
3210
|
+
* `QuotaProvider` reports `blocked`, and by the loop's own per-day `QuotaStore` gate. The figures
|
|
3211
|
+
* are the exhausted window's: a window that does not count tokens (a USD-only spend cap) carries no
|
|
3212
|
+
* token figures, never a made-up `0`.
|
|
3213
|
+
*/
|
|
3175
3214
|
interface AgentQuotaExceeded {
|
|
3176
3215
|
actorId: string;
|
|
3177
|
-
|
|
3178
|
-
|
|
3216
|
+
/** The window that ran out. Absent from the loop's per-day `QuotaStore` gate. */
|
|
3217
|
+
period?: QuotaPeriod;
|
|
3218
|
+
/** The provider's words for the block, when it gave some. */
|
|
3219
|
+
reason?: string;
|
|
3220
|
+
usedTokens?: number;
|
|
3221
|
+
limitTokens?: number;
|
|
3222
|
+
usedUsd?: number;
|
|
3223
|
+
limitUsd?: number;
|
|
3179
3224
|
}
|
|
3180
3225
|
interface AgentRunFinished {
|
|
3181
3226
|
runId: string;
|
|
@@ -4117,7 +4162,7 @@ type TextActionProposalResolution = {
|
|
|
4117
4162
|
* resolve the authenticated actor and use the normal scoped decision service with via=text.
|
|
4118
4163
|
* Never feed model output here or consume an unmatched message as an approval.
|
|
4119
4164
|
*/
|
|
4120
|
-
declare function resolveTextActionProposalDecision(text: string, proposals: readonly TextActionProposalCandidate[]): TextActionProposalResolution;
|
|
4165
|
+
declare function resolveTextActionProposalDecision(text: string, proposals: readonly TextActionProposalCandidate[], vocabulary?: TextActionProposalVocabulary): TextActionProposalResolution;
|
|
4121
4166
|
type TextActionProposalCommand = {
|
|
4122
4167
|
status: 'unmatched';
|
|
4123
4168
|
} | {
|
|
@@ -4126,8 +4171,54 @@ type TextActionProposalCommand = {
|
|
|
4126
4171
|
remember: boolean;
|
|
4127
4172
|
proposalId?: string;
|
|
4128
4173
|
};
|
|
4174
|
+
/**
|
|
4175
|
+
* The words a whole chat message must consist of to decide a proposal by text. Matched
|
|
4176
|
+
* case-insensitively, as the complete message (an optional trailing `.`/`!`, an optional `#ID`).
|
|
4177
|
+
*/
|
|
4178
|
+
interface TextActionProposalVocabulary {
|
|
4179
|
+
/** Approve, e.g. `sim`, `yes`. */
|
|
4180
|
+
approve: readonly string[];
|
|
4181
|
+
/** Reject, e.g. `não`, `no`. */
|
|
4182
|
+
reject: readonly string[];
|
|
4183
|
+
/** The phrase after an approve word that also approves later calls of the tool in this thread. */
|
|
4184
|
+
remember: readonly string[];
|
|
4185
|
+
}
|
|
4186
|
+
/**
|
|
4187
|
+
* English. Portuguese ships as {@link ptBrActionProposalText}; any other language through
|
|
4188
|
+
* `AgentModule.forRoot({ actionProposalText })`.
|
|
4189
|
+
*/
|
|
4190
|
+
declare const DEFAULT_TEXT_ACTION_PROPOSAL_VOCABULARY: TextActionProposalVocabulary;
|
|
4191
|
+
/** What the agent answers to a text decision. Every field has an English default. */
|
|
4192
|
+
interface TextActionProposalReplies {
|
|
4193
|
+
approved: string;
|
|
4194
|
+
rejected: string;
|
|
4195
|
+
expired: string;
|
|
4196
|
+
/** The proposal could not change (already decided by someone else, superseded, …). */
|
|
4197
|
+
unchanged: string;
|
|
4198
|
+
/** More than one pending proposal could be meant: ask for the `#ID`. */
|
|
4199
|
+
ambiguous(proposalIds: readonly string[]): string;
|
|
4200
|
+
/** Too many pending proposals to pick one without an explicit `#ID`. */
|
|
4201
|
+
tooMany: string;
|
|
4202
|
+
}
|
|
4203
|
+
declare const DEFAULT_TEXT_ACTION_PROPOSAL_REPLIES: TextActionProposalReplies;
|
|
4204
|
+
/** `AgentModule.forRoot({ actionProposalText })`: either part replaces the default it names. */
|
|
4205
|
+
interface TextActionProposalConfig {
|
|
4206
|
+
vocabulary?: Partial<TextActionProposalVocabulary>;
|
|
4207
|
+
replies?: Partial<TextActionProposalReplies>;
|
|
4208
|
+
}
|
|
4209
|
+
/** The reply to a decision the store answered with `result`. */
|
|
4210
|
+
declare function textActionProposalReply(result: Pick<ActionProposalMutationResult, 'status'> & {
|
|
4211
|
+
proposal?: {
|
|
4212
|
+
decision: ActionProposalDecision;
|
|
4213
|
+
};
|
|
4214
|
+
}, decision: 'approved' | 'rejected', replies?: TextActionProposalReplies): string;
|
|
4129
4215
|
/** Parse exact consent syntax only. Authentication and target lookup remain the caller's responsibility. */
|
|
4130
|
-
declare function parseTextActionProposalCommand(text: string): TextActionProposalCommand;
|
|
4216
|
+
declare function parseTextActionProposalCommand(text: string, vocabulary?: TextActionProposalVocabulary): TextActionProposalCommand;
|
|
4217
|
+
/**
|
|
4218
|
+
* Brazilian Portuguese text decisions — `AgentModule.forRoot({ actionProposalText: ptBrActionProposalText })`.
|
|
4219
|
+
* Commands in Portuguese (English ones still work), replies in Portuguese.
|
|
4220
|
+
*/
|
|
4221
|
+
declare const ptBrActionProposalText: Required<TextActionProposalConfig>;
|
|
4131
4222
|
|
|
4132
4223
|
interface ActionProposalExecutionDeps {
|
|
4133
4224
|
registry: ToolRegistry;
|
|
@@ -4188,4 +4279,18 @@ declare class ActionProposalWorker {
|
|
|
4188
4279
|
type ActionProposalRuntimeStore = AgentStore & ActionProposalStore & ActionProposalWorkerStore & ActionProposalOutcomeStore & ActionProposalSupersessionStore;
|
|
4189
4280
|
declare function assertIndependentActionCapabilities(store: AgentStore, resolver: BackgroundActorResolver | undefined): asserts store is ActionProposalRuntimeStore;
|
|
4190
4281
|
|
|
4191
|
-
export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_ATTACHMENT_STAGING, 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, type ActionProposalExecutionDeps, type ActionProposalExecutionResult, ActionProposalExecutor, type ActionProposalExecutorOptions, ActionProposalMutationResult, ActionProposalOutcome, ActionProposalOutcomeLease, ActionProposalOutcomeStore, type ActionProposalReceipt, type ActionProposalRuntimeStore, ActionProposalScope, ActionProposalStore, ActionProposalStoreOptions, ActionProposalSupersessionStore, type ActionProposalTarget, 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, 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_REFUSAL_REASON, DEFAULT_STRUCTURED_OUTPUT_INSTRUCTION, Decision, DefaultRolesPolicy, type DetachedDelegationOutcome, type DetachedDelegationReceipt, DetachedDelivery, type DetailThreadRef, ElicitationRequest, type EmbeddingProvider, type EmitUi, type EmptyRoles, EnqueueMessageInput, ExtendActionProposalLease, 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, InMemoryActionProposalStore, InMemoryAgentStore, 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 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 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 TextActionProposalResolution, 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, 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, createIncrementalGate, createNegotiatedUiCollector, createNoopEmitUi, createUiCollector, dayBoundsUtc, defaultScopeResolver, defineConfirmedTool, detachedDelivered, detachedStarted, detachedUnsettled, 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, parseTextActionProposalCommand, personaCatalogEntry, prepareActionProposal, publishAgentDelegated, publishAgentMemoryResolved, publishAgentMemoryWritten, publishAgentMessage, publishAgentQuotaExceeded, publishAgentRetrieved, publishAgentRunFailed, publishAgentRunFinished, publishAgentRunStarted, publishAgentSkillsResolved, publishAgentToolCall, publishAgentToolRetry, quotaPeriodRange, quotaUsedRatio, quotaWarning, 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, 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, wrapToolPreflightDenied, wrapToolStepOutput, writeMemory };
|
|
4282
|
+
interface FunctionalTool<I = unknown, O = unknown> {
|
|
4283
|
+
spec: ToolSpec;
|
|
4284
|
+
handler: ToolHandler<I, O>;
|
|
4285
|
+
}
|
|
4286
|
+
type FunctionalToolDefinition<I, O> = Omit<ToolSpec, 'inputSchema' | 'kind'> & {
|
|
4287
|
+
input: StandardSchemaV1<unknown, I>;
|
|
4288
|
+
kind?: ToolSpec['kind'];
|
|
4289
|
+
} & ToolHandler<I, O>;
|
|
4290
|
+
/** Framework-independent authoring; every method keeps the author's object as its receiver. */
|
|
4291
|
+
declare function createFunctionalTool<I, O>(definition: FunctionalToolDefinition<I, O>): FunctionalTool<I, O>;
|
|
4292
|
+
|
|
4293
|
+
/** Presentation failures must never cause a successful side effect to be retried. */
|
|
4294
|
+
declare function emitToolPresentations<I, O>(handler: ToolHandler<I, O>, output: O, ctx: AiToolCtx, toolName: string): Promise<void>;
|
|
4295
|
+
|
|
4296
|
+
export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_ATTACHMENT_STAGING, 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, 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_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, 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 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 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, 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, parseTextActionProposalCommand, personaCatalogEntry, prepareActionProposal, ptBrActionProposalText, publishAgentDelegated, publishAgentMemoryResolved, publishAgentMemoryWritten, publishAgentMessage, publishAgentQuotaExceeded, publishAgentRetrieved, publishAgentRunFailed, publishAgentRunFinished, publishAgentRunStarted, publishAgentSkillsResolved, publishAgentToolCall, publishAgentToolRetry, quotaPeriodRange, quotaUsedRatio, quotaWarning, 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, wrapToolPreflightDenied, wrapToolStepOutput, writeMemory };
|