@dudousxd/nestjs-agent-core 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -559,6 +559,12 @@ interface RecordToolCallInput {
559
559
  toolType: 'read' | 'action';
560
560
  input: unknown;
561
561
  status: ToolCallStatus;
562
+ /**
563
+ * The run (turn) this tool call belongs to — enables a governance surface to deep-link a tool
564
+ * call out to its trace waterfall. Optional so a caller predating this (or a store's own
565
+ * synthetic tool calls) can omit it; the store persists it as `null` when absent.
566
+ */
567
+ runId?: string;
562
568
  }
563
569
  interface UpdateToolCallInput {
564
570
  toolCallId: string;
@@ -879,6 +885,8 @@ interface ToolCallActivityRow {
879
885
  status: string;
880
886
  threadId: string;
881
887
  createdAt: string;
888
+ /** The run this call belongs to, for a trace deep-link; `null` for a call recorded before this shipped. */
889
+ runId: string | null;
882
890
  }
883
891
  /** A recent thread with rolled-up activity. */
884
892
  interface ThreadActivityRow {
@@ -949,6 +957,8 @@ interface PendingApprovalRow {
949
957
  agentName: string | null;
950
958
  /** ISO timestamp. */
951
959
  requestedAt: string;
960
+ /** The run this call belongs to, for a trace deep-link; `null` for a call recorded before this shipped. */
961
+ runId: string | null;
952
962
  }
953
963
  /** Governance rollup for one tool over a range. */
954
964
  interface ToolStatRow {
@@ -960,6 +970,54 @@ interface ToolStatRow {
960
970
  /** p95 of executionMs across executed calls; null when none carry it. */
961
971
  p95ExecutionMs: number | null;
962
972
  }
973
+ /**
974
+ * Neutral paged query for the governance list reads (`toolCallsPage`/`threadsPage`/`runsPage`). The
975
+ * WIRE format a host exposes over HTTP mirrors `@dudousxd/nestjs-filter`'s conventions (`page`,
976
+ * `limit`, `where[field][op]`) so consumers see one grammar across the ecosystem, but this SPI stays
977
+ * neutral/typed — no filter-builder or ORM coupling here.
978
+ */
979
+ interface GovernancePageQuery<TWhere> {
980
+ /** 1-based. */
981
+ page: number;
982
+ /** Rows per page, already clamped by the caller (the dashboard clamps to 200). */
983
+ pageSize: number;
984
+ /** Equality/range filters; absent field = no constraint. */
985
+ where?: TWhere;
986
+ }
987
+ /** One page of a governance list read, with the total row count for prev/next + "page X of Y" UI. */
988
+ interface GovernancePage<TRow> {
989
+ rows: TRow[];
990
+ total: number;
991
+ page: number;
992
+ pageSize: number;
993
+ }
994
+ /** Filters for {@link AgentGovernanceQueries.toolCallsPage}. */
995
+ interface ToolCallWhere {
996
+ toolName?: string;
997
+ toolType?: string;
998
+ status?: string;
999
+ threadId?: string;
1000
+ /** Inclusive UTC day bounds, `YYYY-MM-DD`. */
1001
+ fromDay?: string;
1002
+ toDay?: string;
1003
+ }
1004
+ /** Filters for {@link AgentGovernanceQueries.threadsPage}. */
1005
+ interface ThreadWhere {
1006
+ actorRef?: string;
1007
+ /** Substring match on the title (case-insensitive). */
1008
+ title?: string;
1009
+ fromDay?: string;
1010
+ toDay?: string;
1011
+ }
1012
+ /** Filters for {@link AgentGovernanceQueries.runsPage}. */
1013
+ interface RunWhere {
1014
+ agentName?: string;
1015
+ status?: string;
1016
+ errorCode?: string;
1017
+ threadId?: string;
1018
+ fromDay?: string;
1019
+ toDay?: string;
1020
+ }
963
1021
  /**
964
1022
  * The governance read-model. Cost is `inputTokens/1e6 * inputPricePer1m + outputTokens/1e6 *
965
1023
  * outputPricePer1m` against the current pricing row per model; an unpriced model contributes 0 cost
@@ -982,6 +1040,21 @@ interface AgentGovernanceQueries {
982
1040
  pendingApprovals(limit: number): Promise<PendingApprovalRow[]>;
983
1041
  /** Per-tool call/failure/rejection/latency rollup over the range, highest call count first. */
984
1042
  toolStats(range: GovernanceRange): Promise<ToolStatRow[]>;
1043
+ /**
1044
+ * Paged, filterable tool-call activity, newest-first (same ordering as `recentToolCalls`). An
1045
+ * adapter without the backing data returns an empty page (`total: 0`) rather than throwing.
1046
+ */
1047
+ toolCallsPage(query: GovernancePageQuery<ToolCallWhere>): Promise<GovernancePage<ToolCallActivityRow>>;
1048
+ /**
1049
+ * Paged, filterable thread activity, newest-first (same ordering as `recentThreads`). An adapter
1050
+ * without the backing data returns an empty page (`total: 0`) rather than throwing.
1051
+ */
1052
+ threadsPage(query: GovernancePageQuery<ThreadWhere>): Promise<GovernancePage<ThreadActivityRow>>;
1053
+ /**
1054
+ * Paged, filterable run activity, newest-first (same ordering as `recentRuns`). An adapter backed
1055
+ * by a store without run recording (no `recordRunStart`) returns an empty page (`total: 0`).
1056
+ */
1057
+ runsPage(query: GovernancePageQuery<RunWhere>): Promise<GovernancePage<RecentRunRow>>;
985
1058
  }
986
1059
 
987
1060
  /**
@@ -1423,4 +1496,4 @@ type AgentDiagnosticKey = `agent:${AgentDiagnosticEvent}`;
1423
1496
  */
1424
1497
  declare function agentDiagnosticKey(event: AgentDiagnosticEvent): AgentDiagnosticKey;
1425
1498
 
1426
- export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_ATTACHMENT_STAGING, AGENT_DEPS_FACTORY, AGENT_DIAGNOSTIC_EVENTS, AGENT_DURABLE_RUNNER, AGENT_EMBEDDING_PROVIDER, AGENT_GOVERNANCE_QUERIES, AGENT_MODEL, AGENT_OPTIONS, AGENT_PRICING_STORE, AGENT_PROMPT_CONTRIBUTORS, AGENT_QUOTA_STORE, AGENT_REGISTRY, AGENT_RETRIEVER, AGENT_ROLES_POLICY, AGENT_RUNNER, AGENT_SINK, AGENT_SPAN_EVENTS, AGENT_STORE, AGENT_TOOL_REGISTRY, type Actor, type ActorDirectory, type ActorResolver, type ActorSpendRow, type AgentApprovalPort, type AgentCatalogEntry, type AgentDefinition, type AgentDelegated, type AgentDiagnosticEvent, type AgentDiagnosticKey, type AgentFollowUpsSpan, type AgentGovernanceQueries, type AgentLlmTurnSpan, type AgentLoopDeps, type AgentLoopHooks, type AgentMessageEvent, type AgentPricingStore, type AgentQuotaExceeded, AgentRegistry, type AgentRetrievalSpan, type AgentRetrieved, type AgentRunFailed, type AgentRunFinished, type AgentRunInput, type AgentRunStarted, type AgentRunner, type AgentSpanEvent, type AgentStore, AgentStreamError, type AgentStreamEvent, type AgentToolCallEvent, type AgentToolExecutionSpan, type AiToolCtx, type AppendMessageInput, type AttachmentStagingStore, type CostUsage, type CreateThreadInput, type CurrentModelPrice, type Decision, DefaultRolesPolicy, type EmbeddingProvider, type GovernanceRange, type GovernanceUsageInput, type LlmStepEnvelope, type MessageAttachment, type MessageRole, type MessageUsage, type ModelMessage, type ModelPrice, type ModelPriceInput, type ModelProvider, type ModelSpendRow, type ModelTurnArgs, type ModelTurnResult, type PageContext, type Passage, type PendingApprovalRow, type PromptBuilder, type PromptContext, type PromptContributor, QuotaExceededError, type QuotaState, type QuotaStore, type QuotaView, type RecentRunRow, type RecordRunEndInput, type RecordRunStartInput, type RecordToolCallInput, type RecordUsageInput, type RerankOptions, type Reranker, type RetrieveOptions, type Retriever, type RolesPolicy, type RunAgentBreakdownRow, type RunErrorBreakdownRow, type RunMetrics, type RunTrendPoint, type SinkWriter, type StageAttachmentInput, type StoredMessage, type StreamError, type ThreadActivityRow, type ThreadDetail, type ThreadMeta, type ThreadSpendRow, type ThreadSummary, type TokenStreamSink, type ToolCallActivityRow, type ToolCallRequest, type ToolCallStatus, type ToolDefinition, ToolForbiddenError, type ToolHandler, ToolInputInvalidError, type ToolKind, ToolNotFoundError, ToolRegistry, type ToolResult, type ToolSpec, type ToolStatRow, type ToolStepCtx, type ToolStepEnvelope, type UpdateThreadInput, type UpdateToolCallInput, type UsagePurpose, type UsageTrendPoint, agentDiagnosticKey, bucketByActor, bucketByModel, bucketByThread, bucketUsageTrend, dayBoundsUtc, encodeStreamEvent, estimateCost, filterToolsByAllowList, filterToolsByRole, publishAgentDelegated, publishAgentMessage, publishAgentQuotaExceeded, publishAgentRetrieved, publishAgentRunFailed, publishAgentRunFinished, publishAgentRunStarted, publishAgentToolCall, runAgentLoop, seedModelPrices, traceLlmTurn, traceToolExecution, withToolTimeout };
1499
+ export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_ATTACHMENT_STAGING, AGENT_DEPS_FACTORY, AGENT_DIAGNOSTIC_EVENTS, AGENT_DURABLE_RUNNER, AGENT_EMBEDDING_PROVIDER, AGENT_GOVERNANCE_QUERIES, AGENT_MODEL, AGENT_OPTIONS, AGENT_PRICING_STORE, AGENT_PROMPT_CONTRIBUTORS, AGENT_QUOTA_STORE, AGENT_REGISTRY, AGENT_RETRIEVER, AGENT_ROLES_POLICY, AGENT_RUNNER, AGENT_SINK, AGENT_SPAN_EVENTS, AGENT_STORE, AGENT_TOOL_REGISTRY, type Actor, type ActorDirectory, type ActorResolver, type ActorSpendRow, type AgentApprovalPort, type AgentCatalogEntry, type AgentDefinition, type AgentDelegated, type AgentDiagnosticEvent, type AgentDiagnosticKey, type AgentFollowUpsSpan, type AgentGovernanceQueries, type AgentLlmTurnSpan, type AgentLoopDeps, type AgentLoopHooks, type AgentMessageEvent, type AgentPricingStore, type AgentQuotaExceeded, AgentRegistry, type AgentRetrievalSpan, type AgentRetrieved, type AgentRunFailed, type AgentRunFinished, type AgentRunInput, type AgentRunStarted, type AgentRunner, type AgentSpanEvent, type AgentStore, AgentStreamError, type AgentStreamEvent, type AgentToolCallEvent, type AgentToolExecutionSpan, type AiToolCtx, type AppendMessageInput, type AttachmentStagingStore, type CostUsage, type CreateThreadInput, type CurrentModelPrice, type Decision, DefaultRolesPolicy, type EmbeddingProvider, type GovernancePage, type GovernancePageQuery, type GovernanceRange, type GovernanceUsageInput, type LlmStepEnvelope, type MessageAttachment, type MessageRole, type MessageUsage, type ModelMessage, type ModelPrice, type ModelPriceInput, type ModelProvider, type ModelSpendRow, type ModelTurnArgs, type ModelTurnResult, type PageContext, type Passage, type PendingApprovalRow, type PromptBuilder, type PromptContext, type PromptContributor, QuotaExceededError, type QuotaState, type QuotaStore, type QuotaView, type RecentRunRow, type RecordRunEndInput, type RecordRunStartInput, type RecordToolCallInput, type RecordUsageInput, type RerankOptions, type Reranker, type RetrieveOptions, type Retriever, type RolesPolicy, type RunAgentBreakdownRow, type RunErrorBreakdownRow, type RunMetrics, type RunTrendPoint, type RunWhere, type SinkWriter, type StageAttachmentInput, type StoredMessage, type StreamError, type ThreadActivityRow, type ThreadDetail, type ThreadMeta, type ThreadSpendRow, type ThreadSummary, type ThreadWhere, type TokenStreamSink, type ToolCallActivityRow, type ToolCallRequest, type ToolCallStatus, type ToolCallWhere, type ToolDefinition, ToolForbiddenError, type ToolHandler, ToolInputInvalidError, type ToolKind, ToolNotFoundError, ToolRegistry, type ToolResult, type ToolSpec, type ToolStatRow, type ToolStepCtx, type ToolStepEnvelope, type UpdateThreadInput, type UpdateToolCallInput, type UsagePurpose, type UsageTrendPoint, agentDiagnosticKey, bucketByActor, bucketByModel, bucketByThread, bucketUsageTrend, dayBoundsUtc, encodeStreamEvent, estimateCost, filterToolsByAllowList, filterToolsByRole, publishAgentDelegated, publishAgentMessage, publishAgentQuotaExceeded, publishAgentRetrieved, publishAgentRunFailed, publishAgentRunFinished, publishAgentRunStarted, publishAgentToolCall, runAgentLoop, seedModelPrices, traceLlmTurn, traceToolExecution, withToolTimeout };
package/dist/index.d.ts CHANGED
@@ -559,6 +559,12 @@ interface RecordToolCallInput {
559
559
  toolType: 'read' | 'action';
560
560
  input: unknown;
561
561
  status: ToolCallStatus;
562
+ /**
563
+ * The run (turn) this tool call belongs to — enables a governance surface to deep-link a tool
564
+ * call out to its trace waterfall. Optional so a caller predating this (or a store's own
565
+ * synthetic tool calls) can omit it; the store persists it as `null` when absent.
566
+ */
567
+ runId?: string;
562
568
  }
563
569
  interface UpdateToolCallInput {
564
570
  toolCallId: string;
@@ -879,6 +885,8 @@ interface ToolCallActivityRow {
879
885
  status: string;
880
886
  threadId: string;
881
887
  createdAt: string;
888
+ /** The run this call belongs to, for a trace deep-link; `null` for a call recorded before this shipped. */
889
+ runId: string | null;
882
890
  }
883
891
  /** A recent thread with rolled-up activity. */
884
892
  interface ThreadActivityRow {
@@ -949,6 +957,8 @@ interface PendingApprovalRow {
949
957
  agentName: string | null;
950
958
  /** ISO timestamp. */
951
959
  requestedAt: string;
960
+ /** The run this call belongs to, for a trace deep-link; `null` for a call recorded before this shipped. */
961
+ runId: string | null;
952
962
  }
953
963
  /** Governance rollup for one tool over a range. */
954
964
  interface ToolStatRow {
@@ -960,6 +970,54 @@ interface ToolStatRow {
960
970
  /** p95 of executionMs across executed calls; null when none carry it. */
961
971
  p95ExecutionMs: number | null;
962
972
  }
973
+ /**
974
+ * Neutral paged query for the governance list reads (`toolCallsPage`/`threadsPage`/`runsPage`). The
975
+ * WIRE format a host exposes over HTTP mirrors `@dudousxd/nestjs-filter`'s conventions (`page`,
976
+ * `limit`, `where[field][op]`) so consumers see one grammar across the ecosystem, but this SPI stays
977
+ * neutral/typed — no filter-builder or ORM coupling here.
978
+ */
979
+ interface GovernancePageQuery<TWhere> {
980
+ /** 1-based. */
981
+ page: number;
982
+ /** Rows per page, already clamped by the caller (the dashboard clamps to 200). */
983
+ pageSize: number;
984
+ /** Equality/range filters; absent field = no constraint. */
985
+ where?: TWhere;
986
+ }
987
+ /** One page of a governance list read, with the total row count for prev/next + "page X of Y" UI. */
988
+ interface GovernancePage<TRow> {
989
+ rows: TRow[];
990
+ total: number;
991
+ page: number;
992
+ pageSize: number;
993
+ }
994
+ /** Filters for {@link AgentGovernanceQueries.toolCallsPage}. */
995
+ interface ToolCallWhere {
996
+ toolName?: string;
997
+ toolType?: string;
998
+ status?: string;
999
+ threadId?: string;
1000
+ /** Inclusive UTC day bounds, `YYYY-MM-DD`. */
1001
+ fromDay?: string;
1002
+ toDay?: string;
1003
+ }
1004
+ /** Filters for {@link AgentGovernanceQueries.threadsPage}. */
1005
+ interface ThreadWhere {
1006
+ actorRef?: string;
1007
+ /** Substring match on the title (case-insensitive). */
1008
+ title?: string;
1009
+ fromDay?: string;
1010
+ toDay?: string;
1011
+ }
1012
+ /** Filters for {@link AgentGovernanceQueries.runsPage}. */
1013
+ interface RunWhere {
1014
+ agentName?: string;
1015
+ status?: string;
1016
+ errorCode?: string;
1017
+ threadId?: string;
1018
+ fromDay?: string;
1019
+ toDay?: string;
1020
+ }
963
1021
  /**
964
1022
  * The governance read-model. Cost is `inputTokens/1e6 * inputPricePer1m + outputTokens/1e6 *
965
1023
  * outputPricePer1m` against the current pricing row per model; an unpriced model contributes 0 cost
@@ -982,6 +1040,21 @@ interface AgentGovernanceQueries {
982
1040
  pendingApprovals(limit: number): Promise<PendingApprovalRow[]>;
983
1041
  /** Per-tool call/failure/rejection/latency rollup over the range, highest call count first. */
984
1042
  toolStats(range: GovernanceRange): Promise<ToolStatRow[]>;
1043
+ /**
1044
+ * Paged, filterable tool-call activity, newest-first (same ordering as `recentToolCalls`). An
1045
+ * adapter without the backing data returns an empty page (`total: 0`) rather than throwing.
1046
+ */
1047
+ toolCallsPage(query: GovernancePageQuery<ToolCallWhere>): Promise<GovernancePage<ToolCallActivityRow>>;
1048
+ /**
1049
+ * Paged, filterable thread activity, newest-first (same ordering as `recentThreads`). An adapter
1050
+ * without the backing data returns an empty page (`total: 0`) rather than throwing.
1051
+ */
1052
+ threadsPage(query: GovernancePageQuery<ThreadWhere>): Promise<GovernancePage<ThreadActivityRow>>;
1053
+ /**
1054
+ * Paged, filterable run activity, newest-first (same ordering as `recentRuns`). An adapter backed
1055
+ * by a store without run recording (no `recordRunStart`) returns an empty page (`total: 0`).
1056
+ */
1057
+ runsPage(query: GovernancePageQuery<RunWhere>): Promise<GovernancePage<RecentRunRow>>;
985
1058
  }
986
1059
 
987
1060
  /**
@@ -1423,4 +1496,4 @@ type AgentDiagnosticKey = `agent:${AgentDiagnosticEvent}`;
1423
1496
  */
1424
1497
  declare function agentDiagnosticKey(event: AgentDiagnosticEvent): AgentDiagnosticKey;
1425
1498
 
1426
- export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_ATTACHMENT_STAGING, AGENT_DEPS_FACTORY, AGENT_DIAGNOSTIC_EVENTS, AGENT_DURABLE_RUNNER, AGENT_EMBEDDING_PROVIDER, AGENT_GOVERNANCE_QUERIES, AGENT_MODEL, AGENT_OPTIONS, AGENT_PRICING_STORE, AGENT_PROMPT_CONTRIBUTORS, AGENT_QUOTA_STORE, AGENT_REGISTRY, AGENT_RETRIEVER, AGENT_ROLES_POLICY, AGENT_RUNNER, AGENT_SINK, AGENT_SPAN_EVENTS, AGENT_STORE, AGENT_TOOL_REGISTRY, type Actor, type ActorDirectory, type ActorResolver, type ActorSpendRow, type AgentApprovalPort, type AgentCatalogEntry, type AgentDefinition, type AgentDelegated, type AgentDiagnosticEvent, type AgentDiagnosticKey, type AgentFollowUpsSpan, type AgentGovernanceQueries, type AgentLlmTurnSpan, type AgentLoopDeps, type AgentLoopHooks, type AgentMessageEvent, type AgentPricingStore, type AgentQuotaExceeded, AgentRegistry, type AgentRetrievalSpan, type AgentRetrieved, type AgentRunFailed, type AgentRunFinished, type AgentRunInput, type AgentRunStarted, type AgentRunner, type AgentSpanEvent, type AgentStore, AgentStreamError, type AgentStreamEvent, type AgentToolCallEvent, type AgentToolExecutionSpan, type AiToolCtx, type AppendMessageInput, type AttachmentStagingStore, type CostUsage, type CreateThreadInput, type CurrentModelPrice, type Decision, DefaultRolesPolicy, type EmbeddingProvider, type GovernanceRange, type GovernanceUsageInput, type LlmStepEnvelope, type MessageAttachment, type MessageRole, type MessageUsage, type ModelMessage, type ModelPrice, type ModelPriceInput, type ModelProvider, type ModelSpendRow, type ModelTurnArgs, type ModelTurnResult, type PageContext, type Passage, type PendingApprovalRow, type PromptBuilder, type PromptContext, type PromptContributor, QuotaExceededError, type QuotaState, type QuotaStore, type QuotaView, type RecentRunRow, type RecordRunEndInput, type RecordRunStartInput, type RecordToolCallInput, type RecordUsageInput, type RerankOptions, type Reranker, type RetrieveOptions, type Retriever, type RolesPolicy, type RunAgentBreakdownRow, type RunErrorBreakdownRow, type RunMetrics, type RunTrendPoint, type SinkWriter, type StageAttachmentInput, type StoredMessage, type StreamError, type ThreadActivityRow, type ThreadDetail, type ThreadMeta, type ThreadSpendRow, type ThreadSummary, type TokenStreamSink, type ToolCallActivityRow, type ToolCallRequest, type ToolCallStatus, type ToolDefinition, ToolForbiddenError, type ToolHandler, ToolInputInvalidError, type ToolKind, ToolNotFoundError, ToolRegistry, type ToolResult, type ToolSpec, type ToolStatRow, type ToolStepCtx, type ToolStepEnvelope, type UpdateThreadInput, type UpdateToolCallInput, type UsagePurpose, type UsageTrendPoint, agentDiagnosticKey, bucketByActor, bucketByModel, bucketByThread, bucketUsageTrend, dayBoundsUtc, encodeStreamEvent, estimateCost, filterToolsByAllowList, filterToolsByRole, publishAgentDelegated, publishAgentMessage, publishAgentQuotaExceeded, publishAgentRetrieved, publishAgentRunFailed, publishAgentRunFinished, publishAgentRunStarted, publishAgentToolCall, runAgentLoop, seedModelPrices, traceLlmTurn, traceToolExecution, withToolTimeout };
1499
+ export { AGENT_ACTOR_DIRECTORY, AGENT_ACTOR_RESOLVER, AGENT_APPROVAL_PORT, AGENT_ATTACHMENT_STAGING, AGENT_DEPS_FACTORY, AGENT_DIAGNOSTIC_EVENTS, AGENT_DURABLE_RUNNER, AGENT_EMBEDDING_PROVIDER, AGENT_GOVERNANCE_QUERIES, AGENT_MODEL, AGENT_OPTIONS, AGENT_PRICING_STORE, AGENT_PROMPT_CONTRIBUTORS, AGENT_QUOTA_STORE, AGENT_REGISTRY, AGENT_RETRIEVER, AGENT_ROLES_POLICY, AGENT_RUNNER, AGENT_SINK, AGENT_SPAN_EVENTS, AGENT_STORE, AGENT_TOOL_REGISTRY, type Actor, type ActorDirectory, type ActorResolver, type ActorSpendRow, type AgentApprovalPort, type AgentCatalogEntry, type AgentDefinition, type AgentDelegated, type AgentDiagnosticEvent, type AgentDiagnosticKey, type AgentFollowUpsSpan, type AgentGovernanceQueries, type AgentLlmTurnSpan, type AgentLoopDeps, type AgentLoopHooks, type AgentMessageEvent, type AgentPricingStore, type AgentQuotaExceeded, AgentRegistry, type AgentRetrievalSpan, type AgentRetrieved, type AgentRunFailed, type AgentRunFinished, type AgentRunInput, type AgentRunStarted, type AgentRunner, type AgentSpanEvent, type AgentStore, AgentStreamError, type AgentStreamEvent, type AgentToolCallEvent, type AgentToolExecutionSpan, type AiToolCtx, type AppendMessageInput, type AttachmentStagingStore, type CostUsage, type CreateThreadInput, type CurrentModelPrice, type Decision, DefaultRolesPolicy, type EmbeddingProvider, type GovernancePage, type GovernancePageQuery, type GovernanceRange, type GovernanceUsageInput, type LlmStepEnvelope, type MessageAttachment, type MessageRole, type MessageUsage, type ModelMessage, type ModelPrice, type ModelPriceInput, type ModelProvider, type ModelSpendRow, type ModelTurnArgs, type ModelTurnResult, type PageContext, type Passage, type PendingApprovalRow, type PromptBuilder, type PromptContext, type PromptContributor, QuotaExceededError, type QuotaState, type QuotaStore, type QuotaView, type RecentRunRow, type RecordRunEndInput, type RecordRunStartInput, type RecordToolCallInput, type RecordUsageInput, type RerankOptions, type Reranker, type RetrieveOptions, type Retriever, type RolesPolicy, type RunAgentBreakdownRow, type RunErrorBreakdownRow, type RunMetrics, type RunTrendPoint, type RunWhere, type SinkWriter, type StageAttachmentInput, type StoredMessage, type StreamError, type ThreadActivityRow, type ThreadDetail, type ThreadMeta, type ThreadSpendRow, type ThreadSummary, type ThreadWhere, type TokenStreamSink, type ToolCallActivityRow, type ToolCallRequest, type ToolCallStatus, type ToolCallWhere, type ToolDefinition, ToolForbiddenError, type ToolHandler, ToolInputInvalidError, type ToolKind, ToolNotFoundError, ToolRegistry, type ToolResult, type ToolSpec, type ToolStatRow, type ToolStepCtx, type ToolStepEnvelope, type UpdateThreadInput, type UpdateToolCallInput, type UsagePurpose, type UsageTrendPoint, agentDiagnosticKey, bucketByActor, bucketByModel, bucketByThread, bucketUsageTrend, dayBoundsUtc, encodeStreamEvent, estimateCost, filterToolsByAllowList, filterToolsByRole, publishAgentDelegated, publishAgentMessage, publishAgentQuotaExceeded, publishAgentRetrieved, publishAgentRunFailed, publishAgentRunFinished, publishAgentRunStarted, publishAgentToolCall, runAgentLoop, seedModelPrices, traceLlmTurn, traceToolExecution, withToolTimeout };
package/dist/index.js CHANGED
@@ -785,7 +785,8 @@ ${buildContextBlock(passages)}`;
785
785
  input: {
786
786
  query: input.userText
787
787
  },
788
- status: "auto_executed"
788
+ status: "auto_executed",
789
+ runId: hooks.runId
789
790
  });
790
791
  await deps.store.updateToolCall({
791
792
  toolCallId,
@@ -834,7 +835,8 @@ ${buildContextBlock(passages)}`;
834
835
  toolName: call.name,
835
836
  toolType: "read",
836
837
  input: call.input,
837
- status: "auto_executed"
838
+ status: "auto_executed",
839
+ runId: hooks.runId
838
840
  }));
839
841
  const overDepth = (input.delegationDepth ?? 0) >= MAX_DELEGATION_DEPTH;
840
842
  publishAgentDelegated({
@@ -876,7 +878,8 @@ ${buildContextBlock(passages)}`;
876
878
  toolName: call.name,
877
879
  toolType: "action",
878
880
  input: call.input,
879
- status: "pending_approval"
881
+ status: "pending_approval",
882
+ runId: hooks.runId
880
883
  }));
881
884
  const decision = await hooks.awaitApproval(call, ctx);
882
885
  deciderRef = decision.executedByRef ?? input.actor.id;
@@ -913,7 +916,8 @@ ${buildContextBlock(passages)}`;
913
916
  toolName: call.name,
914
917
  toolType: "read",
915
918
  input: call.input,
916
- status: "auto_executed"
919
+ status: "auto_executed",
920
+ runId: hooks.runId
917
921
  }));
918
922
  }
919
923
  const startedAt2 = Date.now();