@axiom-lattice/protocols 4.11.0 → 6.0.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.ts CHANGED
@@ -150,7 +150,6 @@ interface ModelLatticeProtocol extends BaseLatticeProtocol<LLMConfig, BaseChatMo
150
150
  declare enum AgentType {
151
151
  REACT = "react",
152
152
  DEEP_AGENT = "deep_agent",
153
- TEAM = "team",
154
153
  PROCESSING = "processing",
155
154
  /** Remote A2A agent — delegates to an external A2A-compatible server */
156
155
  A2A_REMOTE = "a2a_remote",
@@ -320,45 +319,6 @@ interface ProcessingAgentConfig extends BaseAgentConfig {
320
319
  subAgents?: string[];
321
320
  internalSubAgents?: AgentConfig[];
322
321
  }
323
- /**
324
- * Team teammate configuration -- describes an available teammate.
325
- */
326
- interface TeamTeammateConfig {
327
- /** Unique name for this teammate (used as agent ID) */
328
- name: string;
329
- /** Role category (e.g. "research", "writing", "review") */
330
- role: string;
331
- /** Human-readable description of what this teammate does */
332
- description: string;
333
- /** Tool keys this teammate has access to */
334
- tools?: string[];
335
- /** Custom system prompt for this teammate */
336
- prompt?: string;
337
- /** Model key override for this teammate */
338
- modelKey?: string;
339
- }
340
- /**
341
- * TEAM agent configuration -- a team lead that dynamically creates teammates.
342
- * Teammates are created on-the-fly from create_team tool input (name, role, description).
343
- */
344
- interface TeamAgentConfig extends BaseAgentConfig {
345
- type: AgentType.TEAM;
346
- /** Tool keys available to the team lead */
347
- tools?: string[];
348
- /** Maximum number of teammates running concurrently */
349
- maxConcurrency?: number;
350
- /**
351
- * Schedule lattice key for polling task list / mailbox.
352
- * When set, teammates use ScheduleLattice for periodic polling instead of event-driven wait.
353
- */
354
- scheduleLatticeKey?: string;
355
- /** Poll interval in ms when using schedule lattice (default: 5000) */
356
- pollIntervalMs?: number;
357
- }
358
- /**
359
- * Type guard to check if config is TeamAgentConfig
360
- */
361
- declare function isTeamAgentConfig(config: AgentConfig): config is TeamAgentConfig;
362
322
  interface LocalRuntimeConfig {
363
323
  label?: string;
364
324
  agentCardUrl: string;
@@ -444,11 +404,11 @@ declare function isWorkflowAgentConfig(config: AgentConfig): config is WorkflowA
444
404
  * Agent configuration union type
445
405
  * Different agent types have different configuration options
446
406
  */
447
- type AgentConfig = ReactAgentConfig | DeepAgentConfig | TeamAgentConfig | ProcessingAgentConfig | A2ARemoteAgentConfig | WorkflowAgentConfig;
407
+ type AgentConfig = ReactAgentConfig | DeepAgentConfig | ProcessingAgentConfig | A2ARemoteAgentConfig | WorkflowAgentConfig;
448
408
  /**
449
409
  * Agent configuration with tools property
450
410
  */
451
- type AgentConfigWithTools = ReactAgentConfig | DeepAgentConfig | TeamAgentConfig | ProcessingAgentConfig | A2ARemoteAgentConfig | WorkflowAgentConfig;
411
+ type AgentConfigWithTools = ReactAgentConfig | DeepAgentConfig | ProcessingAgentConfig | A2ARemoteAgentConfig | WorkflowAgentConfig;
452
412
  /**
453
413
  * Type guard to check if config has tools property
454
414
  */
@@ -917,6 +877,11 @@ interface ScheduleClient {
917
877
  * @returns Number of tasks restored
918
878
  */
919
879
  restore(): Promise<number>;
880
+ /**
881
+ * Reconcile this replica's timers with the shared store. Implementations
882
+ * that support multi-replica scheduling should expose this.
883
+ */
884
+ reconcile?(): Promise<number>;
920
885
  /**
921
886
  * Set the storage backend
922
887
  */
@@ -946,6 +911,7 @@ interface ScheduleLatticeProtocol extends BaseLatticeProtocol<ScheduleConfig, Sc
946
911
  getActiveTaskIds: () => Promise<string[]>;
947
912
  cancelAll: () => Promise<void>;
948
913
  restore: () => Promise<number>;
914
+ reconcile?: () => Promise<number>;
949
915
  }
950
916
 
951
917
  /**
@@ -1244,6 +1210,14 @@ declare const MessageChunkTypes: {
1244
1210
  type MessageChunkType = typeof MessageChunkTypes[keyof typeof MessageChunkTypes];
1245
1211
  interface MessageChunk {
1246
1212
  type: MessageChunkType;
1213
+ /**
1214
+ * Shared append-log cursor for this chunk.
1215
+ *
1216
+ * Set by streaming transports when the chunk is read from a cursor-addressable
1217
+ * log (for example Redis Streams) so reconnects can resume via SSE
1218
+ * `Last-Event-ID`. Omitted by in-memory buffers configured without a log.
1219
+ */
1220
+ cursor?: string;
1247
1221
  data: {
1248
1222
  id: string;
1249
1223
  content?: string;
@@ -1288,6 +1262,22 @@ interface MessageChunk {
1288
1262
  */
1289
1263
  type Message = UserMessage | AssistantMessage | SystemMessage | ToolMessage | DeveloperMessage;
1290
1264
 
1265
+ /**
1266
+ * Normalized human-in-the-loop interrupt exposed by the Agent Server surface.
1267
+ */
1268
+ interface AgentInterrupt {
1269
+ /** Stable id derived from the LangGraph interrupt id or task/index. */
1270
+ interruptId: string;
1271
+ /** Normalized interrupt kind. */
1272
+ type: "clarify" | "task_review" | "custom";
1273
+ /** Thread whose graph is interrupted. */
1274
+ threadId: string;
1275
+ /** Task id that owns the interrupt, when available. */
1276
+ taskId?: string;
1277
+ /** Raw or normalized interrupt payload. */
1278
+ payload: unknown;
1279
+ }
1280
+
1291
1281
  /**
1292
1282
  * ThreadStoreProtocol
1293
1283
  *
@@ -1322,6 +1312,12 @@ interface Thread {
1322
1312
  * Thread last update timestamp
1323
1313
  */
1324
1314
  updatedAt: Date;
1315
+ /**
1316
+ * Optional expiry timestamp used by the thread TTL sweeper.
1317
+ *
1318
+ * @remarks Absent means the thread never expires.
1319
+ */
1320
+ expiresAt?: Date;
1325
1321
  }
1326
1322
  /**
1327
1323
  * Create thread request type
@@ -1331,6 +1327,13 @@ interface CreateThreadRequest {
1331
1327
  * Thread metadata
1332
1328
  */
1333
1329
  metadata?: Record<string, any>;
1330
+ /**
1331
+ * Optional thread expiry timestamp.
1332
+ *
1333
+ * @remarks Routes compute this from `ttlSeconds`/`expiresAt`; the store only
1334
+ * persists it.
1335
+ */
1336
+ expiresAt?: Date;
1334
1337
  }
1335
1338
  /**
1336
1339
  * ThreadStore interface
@@ -1384,6 +1387,14 @@ interface ThreadStore {
1384
1387
  * @returns true if thread exists, false otherwise
1385
1388
  */
1386
1389
  hasThread(tenantId: string, threadId: string): Promise<boolean>;
1390
+ /**
1391
+ * List expired threads across all tenants.
1392
+ *
1393
+ * @param now Current time; threads with `expiresAt <= now` are returned.
1394
+ * @param limit Maximum number of threads to return.
1395
+ * @returns Expired threads ordered by `expiresAt` ascending.
1396
+ */
1397
+ listExpiredThreads(now: Date, limit: number): Promise<Thread[]>;
1387
1398
  }
1388
1399
 
1389
1400
  /**
@@ -4494,6 +4505,8 @@ type McpUiRef = {
4494
4505
  resource: string;
4495
4506
  displayMode: McpUiDisplayMode;
4496
4507
  title?: string;
4508
+ /** Opaque HMAC-signed run/connection scope (1..4096 chars); never contains secrets. */
4509
+ scope?: string;
4497
4510
  };
4498
4511
  /** Resolved UI resource body returned by the gateway. */
4499
4512
  interface McpUiResourcePayload {
@@ -4555,6 +4568,8 @@ type McpAppMenuConfig = {
4555
4568
  resource: string;
4556
4569
  displayMode?: McpUiDisplayMode;
4557
4570
  title?: string;
4571
+ /** Signed scope copied from the ref so a pinned App can keep calling. */
4572
+ scope?: string;
4558
4573
  toolInput?: Record<string, unknown>;
4559
4574
  toolResult?: unknown;
4560
4575
  ui?: ToolCallUi;
@@ -4724,6 +4739,8 @@ interface EvalRun {
4724
4739
  interruptedCases?: number;
4725
4740
  avgScore: number;
4726
4741
  error?: string;
4742
+ /** A client requested cancellation; the executing worker polls this flag. */
4743
+ cancelRequested?: boolean;
4727
4744
  /**
4728
4745
  * When true, this run executed ONLY the hold-out validation suite.
4729
4746
  * Per-case results of holdout runs are withheld from agents (aggregate
@@ -4817,6 +4834,8 @@ interface EvalStore {
4817
4834
  error?: string;
4818
4835
  completedAt?: Date;
4819
4836
  }): Promise<EvalRun | null>;
4837
+ /** Request cooperative cancellation for a running evaluation. */
4838
+ requestCancel?(tenantId: string, id: string): Promise<boolean>;
4820
4839
  deleteRun(tenantId: string, id: string): Promise<boolean>;
4821
4840
  getResultsByRun(tenantId: string, runId: string): Promise<EvalRunResult[]>;
4822
4841
  createRunResult(tenantId: string, runId: string, id: string, data: Omit<EvalRunResult, 'id' | 'runId' | 'createdAt'>): Promise<EvalRunResult>;
@@ -5134,6 +5153,13 @@ interface TaskListFilter {
5134
5153
  * Filter by priority level
5135
5154
  */
5136
5155
  priority?: string;
5156
+ /**
5157
+ * Filter by the isolated run thread linked from `context.thread_id`.
5158
+ *
5159
+ * @remarks Used to authorize read-only views of task execution threads that
5160
+ * do not have a durable Thread row or AgentRun row.
5161
+ */
5162
+ threadId?: string;
5137
5163
  /**
5138
5164
  * Filter by workspace ID
5139
5165
  */
@@ -5620,6 +5646,16 @@ type MessageMiddleware = (ctx: MessageContext, next: () => Promise<void>) => Pro
5620
5646
  interface ChannelAdapter<TConfig = unknown> {
5621
5647
  readonly channel: string;
5622
5648
  readonly configSchema: z.ZodSchema<TConfig>;
5649
+ /**
5650
+ * Whether `sendReply` is safe to call from any Gateway replica.
5651
+ *
5652
+ * @remarks
5653
+ * Only adapters whose reply transport is stateless/HTTP (for example Lark)
5654
+ * may set this. Connection-bound adapters (WeCom/WeChat/Room) leave it
5655
+ * undefined: their replies depend on process-local sockets or context tokens,
5656
+ * so the durable cross-replica reply path must not claim their jobs.
5657
+ */
5658
+ readonly durableReply?: boolean;
5623
5659
  receive(rawPayload: unknown, installation: ChannelInstallation): Promise<InboundMessage | null>;
5624
5660
  sendReply(replyTarget: ReplyTarget, message: OutboundMessage, installation: ChannelInstallation): Promise<void>;
5625
5661
  /**
@@ -6124,7 +6160,7 @@ interface AgentWebAppInterrupt {
6124
6160
  * `INVALID_REQUEST` covers redacted request-validation failures and
6125
6161
  * `INTERNAL_ERROR` covers redacted unexpected server failures.
6126
6162
  */
6127
- type AgentWebAppErrorCode = "WEB_APP_NOT_FOUND" | "WEB_APP_DISABLED" | "USER_ID_REQUIRED" | "INVALID_USER_ID" | "PROJECT_NOT_ALLOWED" | "PROJECT_SELECTOR_DISABLED" | "MODEL_NOT_ALLOWED" | "FEATURE_DISABLED" | "THREAD_NOT_FOUND" | "STREAM_CONFLICT" | "STREAM_FAILED" | "INVALID_REQUEST" | "INTERNAL_ERROR";
6163
+ type AgentWebAppErrorCode = "WEB_APP_NOT_FOUND" | "WEB_APP_DISABLED" | "USER_ID_REQUIRED" | "INVALID_USER_ID" | "PROJECT_NOT_ALLOWED" | "PROJECT_SELECTOR_DISABLED" | "MODEL_NOT_ALLOWED" | "FEATURE_DISABLED" | "THREAD_NOT_FOUND" | "STREAM_CONFLICT" | "STREAM_FAILED" | "RUN_CANCEL_UNAVAILABLE" | "RUN_CANCEL_STORE_UNAVAILABLE" | "INVALID_REQUEST" | "INTERNAL_ERROR";
6128
6164
  /** Public error payload returned by the Web App runtime. */
6129
6165
  interface AgentWebAppError {
6130
6166
  code: AgentWebAppErrorCode;
@@ -6779,6 +6815,337 @@ interface OutboxStore {
6779
6815
  pruneOlderThan(olderThanMs: number): Promise<number>;
6780
6816
  }
6781
6817
 
6818
+ /**
6819
+ * Checkpoint storage usage for a single thread.
6820
+ *
6821
+ * This is a read-only accounting view over the checkpointer's persisted rows.
6822
+ */
6823
+ interface ThreadCheckpointStorage {
6824
+ /** Thread whose checkpoint rows were measured. */
6825
+ threadId: string;
6826
+ /** Sum of checkpoint, channel-value, and pending-write bytes. */
6827
+ totalBytes: number;
6828
+ /** Persisted checkpoint rows (`checkpoints` table). */
6829
+ checkpoints: {
6830
+ count: number;
6831
+ bytes: number;
6832
+ };
6833
+ /** Persisted channel values (`checkpoint_blobs` table). */
6834
+ channelValues: {
6835
+ count: number;
6836
+ bytes: number;
6837
+ };
6838
+ /** Persisted pending writes (`checkpoint_writes` table). */
6839
+ pendingWrites: {
6840
+ count: number;
6841
+ bytes: number;
6842
+ };
6843
+ }
6844
+ /**
6845
+ * Read-only checkpoint storage accounting.
6846
+ *
6847
+ * Implementations must not create, copy, prune, or mutate checkpoint rows.
6848
+ */
6849
+ interface CheckpointStorage {
6850
+ /**
6851
+ * Measure the checkpoint storage used by one thread.
6852
+ *
6853
+ * @param threadId - Thread id whose checkpoint rows should be measured.
6854
+ * @returns Counts and byte sizes grouped by checkpoint storage category.
6855
+ */
6856
+ get(threadId: string): Promise<ThreadCheckpointStorage>;
6857
+ }
6858
+ /**
6859
+ * Checkpoint maintenance operations over persisted thread checkpoints.
6860
+ *
6861
+ * Implementations copy, delete, and prune raw checkpoint rows for a thread.
6862
+ * Callers must verify thread ownership and refuse to run while the thread is
6863
+ * active.
6864
+ */
6865
+ interface CheckpointMaintenance {
6866
+ /**
6867
+ * Copy every checkpoint row from a source thread to an empty target thread.
6868
+ *
6869
+ * @param sourceThreadId - Thread whose rows are copied.
6870
+ * @param targetThreadId - Empty thread that receives the rows.
6871
+ * @returns Resolves when the copy commits; an empty source is a no-op.
6872
+ * @throws When the target already has checkpoint rows.
6873
+ */
6874
+ copyThread(sourceThreadId: string, targetThreadId: string): Promise<void>;
6875
+ /**
6876
+ * Delete every checkpoint row for a thread.
6877
+ *
6878
+ * @param threadId - Thread whose checkpoint rows are deleted.
6879
+ * @returns Resolves when the deletion commits.
6880
+ */
6881
+ deleteThread(threadId: string): Promise<void>;
6882
+ /**
6883
+ * Delete the checkpoints that descend from a base checkpoint.
6884
+ *
6885
+ * Preserves the base checkpoint and every checkpoint that is not descended
6886
+ * from it. Descendants are discovered by following both same-namespace
6887
+ * `parent_checkpoint_id` edges and cross-namespace `metadata.parents` edges
6888
+ * (the `{ "<parent checkpoint_ns>": "<parent checkpoint id>" }` map that
6889
+ * LangGraph writes for subgraph checkpoints), recursively across all
6890
+ * namespaces. Checkpoint-id ordering is not used. LangGraph keys the first
6891
+ * superstep's writes of a resumed execution to the parent/base checkpoint, so
6892
+ * writes keyed to the base itself belong to the rolled-back run and are
6893
+ * deleted with descendant writes. Channel blobs are removed only when no
6894
+ * retained checkpoint references them.
6895
+ *
6896
+ * @param threadId - Thread whose later checkpoint history is deleted.
6897
+ * @param baseCheckpointId - Checkpoint to retain as the new tip, or `null` to
6898
+ * delete every checkpoint for the thread. An empty string is invalid and must
6899
+ * never be treated as the `null` wildcard.
6900
+ * @returns Resolves when the deletion commits; no descendants is a no-op.
6901
+ * @throws When the base checkpoint does not exist on the thread. Callers must
6902
+ * fail closed rather than deleting an unknown range.
6903
+ * @remarks The operation is transactional and idempotent so rollback recovery
6904
+ * can retry it.
6905
+ */
6906
+ deleteAfter(threadId: string, baseCheckpointId: string | null): Promise<void>;
6907
+ /**
6908
+ * Retain only the latest N checkpoints per checkpoint namespace.
6909
+ *
6910
+ * @param threadId - Thread whose checkpoint history is pruned.
6911
+ * @param options - Retention options.
6912
+ * @param options.keepLatest - Number of latest checkpoints to retain per namespace.
6913
+ * @returns Counts of deleted checkpoint, blob, and write rows.
6914
+ */
6915
+ pruneThread(threadId: string, options: {
6916
+ keepLatest: number;
6917
+ }): Promise<{
6918
+ checkpoints: number;
6919
+ blobs: number;
6920
+ writes: number;
6921
+ }>;
6922
+ }
6923
+
6924
+ /**
6925
+ * A tenant-scoped namespaced key-value item.
6926
+ */
6927
+ interface StoreItem {
6928
+ /** Hierarchical namespace path. */
6929
+ namespace: string[];
6930
+ /** Item key, unique within `(tenantId, namespace)`. */
6931
+ key: string;
6932
+ /** Arbitrary JSON object stored under the key. */
6933
+ value: Record<string, unknown>;
6934
+ /** Creation timestamp. */
6935
+ createdAt: Date;
6936
+ /** Last write timestamp. */
6937
+ updatedAt: Date;
6938
+ /** Optional expiry timestamp; expired items are invisible. */
6939
+ expiresAt?: Date;
6940
+ }
6941
+ /** Input for {@link StoreProtocol.put}. */
6942
+ interface StorePutInput {
6943
+ /** Non-empty namespace path. */
6944
+ namespace: string[];
6945
+ /** Non-empty item key. */
6946
+ key: string;
6947
+ /** JSON object value. */
6948
+ value: Record<string, unknown>;
6949
+ /**
6950
+ * Optional time-to-live in minutes.
6951
+ *
6952
+ * @remarks Positive finite numbers are accepted; stores compute `expiresAt`.
6953
+ */
6954
+ ttlMinutes?: number;
6955
+ /**
6956
+ * Optional index hint accepted for future indexing.
6957
+ *
6958
+ * @remarks No vector index is created in this slice.
6959
+ */
6960
+ index?: boolean | string[];
6961
+ }
6962
+ /** Input for {@link StoreProtocol.search}. */
6963
+ interface StoreSearchInput {
6964
+ /** Only return items whose namespace starts with this path. */
6965
+ namespacePrefix?: string[];
6966
+ /** Deep partial-equality filter over `value`. */
6967
+ filter?: Record<string, unknown>;
6968
+ /** Case-insensitive substring over the serialized value. */
6969
+ query?: string;
6970
+ /** Maximum items to return. */
6971
+ limit?: number;
6972
+ /** Pagination offset. */
6973
+ offset?: number;
6974
+ }
6975
+ /**
6976
+ * Tenant-scoped namespaced key-value store with TTL and simple search.
6977
+ *
6978
+ * @remarks
6979
+ * - Unique identity is `(tenantId, namespace, key)`.
6980
+ * - Expired items are invisible to {@link get} and {@link search}.
6981
+ * - `filter` is deep partial equality over `value`; `query` is a
6982
+ * case-insensitive substring over the serialized value. Semantic/embedding
6983
+ * search is deferred.
6984
+ */
6985
+ interface StoreProtocol {
6986
+ /** Create or replace an item. */
6987
+ put(tenantId: string, input: StorePutInput): Promise<StoreItem>;
6988
+ /** Read an unexpired item. */
6989
+ get(tenantId: string, namespace: string[], key: string): Promise<StoreItem | null>;
6990
+ /** Delete an item regardless of expiry. */
6991
+ delete(tenantId: string, namespace: string[], key: string): Promise<boolean>;
6992
+ /** Search unexpired items. */
6993
+ search(tenantId: string, input: StoreSearchInput): Promise<StoreItem[]>;
6994
+ /** List distinct namespace paths under a prefix. */
6995
+ listNamespaces(tenantId: string, prefix?: string[], limit?: number): Promise<string[][]>;
6996
+ /** Hard-delete expired items across all tenants. */
6997
+ deleteExpired(now: Date, limit: number): Promise<number>;
6998
+ }
6999
+ /** Separator reserved for encoded namespace paths. */
7000
+ declare const STORE_IDENTITY_SEPARATOR = "\u001F";
7001
+ /** Raised when a store namespace/key identity is malformed. */
7002
+ declare class StoreValidationError extends Error {
7003
+ readonly code: "STORE_IDENTITY_INVALID";
7004
+ constructor(message: string);
7005
+ }
7006
+ /**
7007
+ * Assert a non-empty namespace array of non-empty segments without the
7008
+ * reserved separator.
7009
+ *
7010
+ * @param namespace - Candidate namespace path.
7011
+ * @throws {StoreValidationError} When the namespace is malformed.
7012
+ */
7013
+ declare function assertStoreIdentity(namespace: unknown, key: unknown): asserts namespace is string[];
7014
+ /**
7015
+ * Assert a namespace prefix (which may be empty for "all namespaces").
7016
+ *
7017
+ * @param prefix - Candidate prefix path.
7018
+ * @throws {StoreValidationError} When any segment is malformed.
7019
+ */
7020
+ declare function assertStoreNamespacePrefix(prefix: unknown): asserts prefix is string[];
7021
+ /**
7022
+ * Validate and compute an expiry date from `ttlMinutes`.
7023
+ *
7024
+ * @param ttlMinutes - Optional positive finite TTL in minutes.
7025
+ * @param now - Base time (default current time).
7026
+ * @returns The expiry date, or `undefined` when no TTL was supplied.
7027
+ * @throws {StoreValidationError} When the TTL is invalid or out of range.
7028
+ */
7029
+ declare function storeExpiresAt(ttlMinutes: number | undefined, now?: Date): Date | undefined;
7030
+ /**
7031
+ * Validate a non-negative safe-integer pagination value.
7032
+ *
7033
+ * @param value - Candidate limit/offset.
7034
+ * @param fallback - Value used when omitted.
7035
+ * @returns The validated number.
7036
+ * @throws {StoreValidationError} When the value is not a non-negative safe integer.
7037
+ */
7038
+ declare function storePaginationValue(value: number | undefined, fallback: number): number;
7039
+
7040
+ /** Lifecycle of one durable channel reply delivery attempt. */
7041
+ type ChannelReplyJobStatus = "pending" | "delivered" | "failed";
7042
+ /**
7043
+ * A durable, cross-replica channel reply job.
7044
+ *
7045
+ * @remarks
7046
+ * The row is keyed by `runId` but always read/written inside a tenant scope.
7047
+ * Claiming is a lease-based CAS: only a pending, due row with no live lease can
7048
+ * be claimed, and terminal writes must present the current lease owner.
7049
+ */
7050
+ interface ChannelReplyJob {
7051
+ runId: string;
7052
+ tenantId: string;
7053
+ assistantId: string;
7054
+ threadId: string;
7055
+ adapterChannel: string;
7056
+ channelInstallationId: string;
7057
+ replyTarget: Record<string, unknown>;
7058
+ inputMessageId: string;
7059
+ /**
7060
+ * Legacy chunk-buffer cursor captured before the run was created.
7061
+ *
7062
+ * @remarks Retained for schema compatibility. The durable dispatcher now
7063
+ * reads final text from the thread checkpoint and does not use this field.
7064
+ */
7065
+ streamCursor?: string | null;
7066
+ status: ChannelReplyJobStatus;
7067
+ attempts: number;
7068
+ /** Epoch milliseconds. */
7069
+ availableAt: number;
7070
+ leaseOwner: string | null;
7071
+ /** Epoch milliseconds. */
7072
+ leaseExpiresAt: number | null;
7073
+ lastError: string | null;
7074
+ outputMessageId: string | null;
7075
+ /** Epoch milliseconds. */
7076
+ createdAt: number;
7077
+ /** Epoch milliseconds. */
7078
+ updatedAt: number;
7079
+ /** Epoch milliseconds. */
7080
+ deliveredAt: number | null;
7081
+ }
7082
+ /** Fields accepted when enqueuing a reply job. Status/lease/output fields are assigned by the store. */
7083
+ interface CreateChannelReplyJobInput {
7084
+ runId: string;
7085
+ tenantId: string;
7086
+ assistantId: string;
7087
+ threadId: string;
7088
+ adapterChannel: string;
7089
+ channelInstallationId: string;
7090
+ replyTarget: Record<string, unknown>;
7091
+ inputMessageId: string;
7092
+ /**
7093
+ * Legacy chunk-buffer cursor captured before the run was created.
7094
+ *
7095
+ * @remarks Retained for schema compatibility. The durable dispatcher now
7096
+ * reads final text from the thread checkpoint and does not use this field.
7097
+ */
7098
+ streamCursor?: string | null;
7099
+ /** Earliest epoch-ms time the job may be claimed. */
7100
+ availableAt: number;
7101
+ }
7102
+ /** Persistence boundary for durable channel reply jobs. */
7103
+ interface ChannelReplyJobStore {
7104
+ /** Creates a pending job. */
7105
+ create(input: CreateChannelReplyJobInput): Promise<ChannelReplyJob>;
7106
+ /** Reads one job within a tenant scope. */
7107
+ get(tenantId: string, runId: string): Promise<ChannelReplyJob | null>;
7108
+ /** Lists claimable pending jobs that are due at `now`, oldest first. */
7109
+ listPending(now: number, limit?: number): Promise<ChannelReplyJob[]>;
7110
+ /**
7111
+ * Atomically leases a pending, due job that is unleased or has an expired
7112
+ * lease. Returns the claimed job, or `null` when another owner won.
7113
+ */
7114
+ claim(tenantId: string, runId: string, owner: string, leaseMs: number, now?: number): Promise<ChannelReplyJob | null>;
7115
+ /** Marks a job delivered when `owner` still holds the lease. */
7116
+ markDelivered(tenantId: string, runId: string, owner: string, outputMessageId?: string | null, now?: number): Promise<ChannelReplyJob | null>;
7117
+ /** Returns a job to pending with an incremented attempt count. */
7118
+ reschedule(tenantId: string, runId: string, owner: string, error: string, availableAt: number, now?: number): Promise<ChannelReplyJob | null>;
7119
+ /** Marks a job terminally failed. */
7120
+ markFailed(tenantId: string, runId: string, owner: string, error: string, now?: number): Promise<ChannelReplyJob | null>;
7121
+ /** Deletes one job. Returns whether a row was removed. */
7122
+ delete(tenantId: string, runId: string): Promise<boolean>;
7123
+ /**
7124
+ * Deletes up to `limit` terminal (`delivered`/`failed`) jobs whose last update
7125
+ * is strictly older than `before`.
7126
+ *
7127
+ * @param before Epoch milliseconds retention cutoff.
7128
+ * @param limit Maximum rows to prune in this batch (normalized 1..200).
7129
+ * @returns Number of rows removed.
7130
+ */
7131
+ deleteTerminalBefore(before: number, limit?: number): Promise<number>;
7132
+ }
7133
+ /** Smallest accepted page size for {@link ChannelReplyJobStore.listPending}. */
7134
+ declare const CHANNEL_REPLY_JOB_LIST_LIMIT_MIN = 1;
7135
+ /** Largest accepted page size for {@link ChannelReplyJobStore.listPending}. */
7136
+ declare const CHANNEL_REPLY_JOB_LIST_LIMIT_MAX = 200;
7137
+ /** Default page size for {@link ChannelReplyJobStore.listPending}. */
7138
+ declare const CHANNEL_REPLY_JOB_LIST_LIMIT_DEFAULT = 100;
7139
+ /**
7140
+ * Normalizes a caller-supplied page size into the shared 1..200 range.
7141
+ *
7142
+ * @remarks Zero and negative values clamp to 1; non-finite values fall back to
7143
+ * the default. Stores must use this helper so InMemory and PostgreSQL agree.
7144
+ */
7145
+ declare function normalizeChannelReplyJobListLimit(limit?: number): number;
7146
+ /** Rejects missing/blank required fields and malformed create payloads at runtime. */
7147
+ declare function assertValidCreateChannelReplyJobInput(input: CreateChannelReplyJobInput): void;
7148
+
6782
7149
  /** A safely extracted value from an own enumerable data-property descriptor. */
6783
7150
  interface DescriptorDataValue {
6784
7151
  ok: true;
@@ -7777,6 +8144,47 @@ interface RunScope {
7777
8144
  */
7778
8145
  declare function resolveRunScope(runConfig: unknown): RunScope;
7779
8146
 
8147
+ /**
8148
+ * A cancellation signal routed to the current owner of a run.
8149
+ *
8150
+ * `runId` is mandatory: a signal without it cannot unambiguously identify the
8151
+ * execution to stop, so it is rejected rather than applied to the thread.
8152
+ */
8153
+ interface RunCancelSignal {
8154
+ commandId: string;
8155
+ tenantId: string;
8156
+ assistantId: string;
8157
+ threadId: string;
8158
+ runId: string;
8159
+ reason: "abort" | "a2a.cancel" | "shutdown";
8160
+ createdAt: string;
8161
+ }
8162
+ /**
8163
+ * Identity of a human-in-the-loop interrupt answer, used for distributed
8164
+ * dedupe so multiple replicas settle the same answer at most once.
8165
+ */
8166
+ interface InterruptAnswerKey {
8167
+ tenantId: string;
8168
+ assistantId: string;
8169
+ threadId: string;
8170
+ interruptId: string;
8171
+ }
8172
+ /**
8173
+ * Durable A2A event delivery cursor stored with the shared A2A task.
8174
+ * `lastEventId` is the last event already handed to the client.
8175
+ */
8176
+ interface A2AEventCursor {
8177
+ taskId: string;
8178
+ lastEventId: string;
8179
+ updatedAt: string;
8180
+ }
8181
+ /** Strict validator for {@link RunCancelSignal}. */
8182
+ declare const runCancelSignalSchema: z.ZodType<RunCancelSignal>;
8183
+ /** Strict validator for {@link InterruptAnswerKey}. */
8184
+ declare const interruptAnswerKeySchema: z.ZodType<InterruptAnswerKey>;
8185
+ /** Strict validator for {@link A2AEventCursor}. */
8186
+ declare const a2aEventCursorSchema: z.ZodType<A2AEventCursor>;
8187
+
7780
8188
  /**
7781
8189
  * Request header carrying the per-thread affinity key (the thread id).
7782
8190
  *
@@ -7804,4 +8212,157 @@ declare function threadAffinityHeaders(threadId: string | undefined): Record<str
7804
8212
  */
7805
8213
  declare function buildAffinityMissChunk(owner: string, threadId: string): MessageChunk;
7806
8214
 
7807
- export { type A2AApiKeyEntry, type A2AApiKeyRecord, type A2AApiKeyStore, type A2AAuthContext, type A2ARemoteAgentConfig, AFFINITY_ECHO_HEADER, AFFINITY_MISS_CODE, AGENT_AFFINITY_HEADER, type AgentClient, type AgentConfig, type AgentConfigWithTools, type AgentLatticeProtocol, type AgentMenuConfig, type AgentMiddlewareConfig, type AgentRunConfig, AgentType, type AgentWebApp, type AgentWebAppAppearance, type AgentWebAppBootstrap, type AgentWebAppCalloutWidget, type AgentWebAppError, type AgentWebAppErrorCode, type AgentWebAppFeatures, type AgentWebAppGenUIBlock, type AgentWebAppIdentityAssurance, type AgentWebAppIdentityConfig, type AgentWebAppIdentityPolicy, type AgentWebAppInterrupt, type AgentWebAppIssuerConfig, type AgentWebAppQuickPrompt, type AgentWebAppRuntimeMessage, type AgentWebAppRuntimeThread, type AgentWebAppScope, type AgentWebAppStatus, type AgentWebAppStore, type AgentWebAppStorePatch, type AgentWebAppStreamEvent, type AgentWebAppStreamProjectionContext, type AgentWebAppTableWidget, type AgentWebAppThreadMetadata, type AgentWebAppUpdateOptions, type Assistant, type AssistantMessage, type AssistantStore, type Attachment, type AvailableModule, type BaseLatticeProtocol, type BaseMessage, type Binding, type BindingListParams, type BindingMutablePatch, type BindingRegistry, type BootstrapFilesConfig, type BrowserMiddlewareConfig, type Callback, type CapabilityBundle, type CapabilityBundleDeleteResult, type CapabilityBundleStore, type CapabilityBundleUpdateConflict, type CapabilityFieldSource, type CapabilityOverride, type CapabilityPreview, type CapabilityPreviewIssue, type CapabilityRuntime, type ChannelAdapter, type ChannelBindingMigrationConflict, ChannelBindingMigrationConflictError, type ChannelInstallation, type ChannelInstallationStore, type ChannelInstallationType, type ClawMiddlewareConfig, type CodeEvalMiddlewareConfig, type Collection, type CollectionField, type CollectionFieldType, type CollectionMiddlewareConfig, type CollectionSchema, type CollectionStore, type ConnectionEntry, type ConnectionStore, type ConversationRecord, type CreateA2AApiKeyInput, type CreateAgentWebAppInput, type CreateAssistantRequest, type CreateBindingInput, type CreateCapabilityBundleInput, type CreateChannelInstallationInput, type CreateChannelInstallationRequest, type CreateCollectionRequest, type CreateConversationInput, type CreateDatabaseConfigRequest, type CreateEvalCaseRequest, type CreateEvalProjectRequest, type CreateEvalRunRequest, type CreateEvalSuiteRequest, type CreateMcpServerConfigRequest, type CreateMenuItemInput, type CreateMetricsServerConfigRequest, type CreateModelProviderRequest, type CreateProjectRequest, type CreateRunStepRequest, type CreateShareRequest, type CreateSkillRequest, type CreateTaskRequest, type CreateTenantRequest, type CreateThreadRequest, type CreateUserRequest, type CreateUserTenantLinkRequest, type CreateWorkItemIfAbsentRequest, type CreateWorkItemRequest, type CreateWorkflowRunRequest, type CreateWorkspaceRequest, type CustomMenuConfig, type DataSource, type DatabaseConfig, type DatabaseConfigEntry, type DatabaseConfigStore, type DatabaseType, type DeepAgentConfig, type DescriptorDataValue, type DeveloperMessage, type DiscoveredModel, type DispatchResult, DuplicateChannelBindingSubjectError, EXECUTION_RESULT_EVENT_KEY_PATTERN, EXECUTION_RESULT_EVENT_KEY_PATTERN_SOURCE, EXECUTION_RESULT_EVENT_KEY_PREFIX, type EmbeddingsConfig, type EmbeddingsLatticeProtocol, type EvalCase, type EvalProject, type EvalProjectReport, type EvalRun, type EvalRunResult, type EvalStore, type EvalSuite, type ExecuteSqlQueryRequest, type ExecuteSqlQueryResponse, type ExpectedCapabilityBundleRevisions, type FileMenuConfig, type FilterCondition, type GraphBuildOptions, type HtmlMenuConfig, type IConversationStore, type ID, type InboundMessage, type InternalAgentNode, type InternalBaseNode, type InternalCreateCapabilityBundleInput, type InternalDSL, type InternalEdge, type InternalInput, type InternalInputNode, type InternalMapNode, type InternalNode, type InternalNodeConfig, type InternalOutput, type InternalState, type InternalStateField, type InternalTerminalNode, type InternalUpdateCapabilityBundleInput, type InterruptMessage, type InterruptPolicy, InvalidProjectCapabilityBundleConfigError, type LLMConfig, type LarkChannelInstallationConfig, type LatticeError, type LatticeEventBus, type LatticeMessage, type LeaseRecord, type LeaseStore, type LocalA2AProviderId, type LocalA2AProviderState, type LocalA2AProviderStatus, type LocalA2ATemplateDefinition, type LocalRuntimeConfig, type LoggerClient, type LoggerConfig, type LoggerContext, type LoggerLatticeProtocol, LoggerType, MAX_PENDING_EXECUTION_RESULTS_LIMIT, type McpAppMenuConfig, type McpClient, type McpClientOptions, type McpConnectionStatus, type McpLatticeMessage, type McpLatticeProtocol, McpMessageType, type McpServerConfig, type McpServerConfigEntry, type McpServerConfigStore, type McpStats, type McpTool, type McpToolResult, type McpTransportType, type McpUiCsp, type McpUiDisplayMode, type McpUiPermissions, type McpUiRef, type McpUiResourcePayload, type MemoryClient, type MemoryConfig, type MemoryLatticeProtocol, MemoryType, type MenuContentConfig, type MenuContentType, type MenuItem, type MenuRegistry, type MenuTarget, type Message, type MessageChunk, type MessageChunkType, MessageChunkTypes, type MessageContext, type MessageMiddleware, type MetricColumn, type MetricDataPoint, type MetricMeta, type MetricQueryResult, type MetricsMiddlewareConfig, type MetricsServerConfig, type MetricsServerConfigEntry, type MetricsServerConfigStore, type MetricsServerType, type MiddlewareType, type ModelDiscoveryResult, type ModelKind, type ModelLatticeProtocol, type ModelProviderApiStyle, type ModelProviderEntry, type ModelProviderErrorCode, type ModelProviderLlmProvider, type ModelProviderModelEntry, type ModelProviderProbeRequest, type ModelProviderProbeResult, type ModelProviderPublicEntry, type ModelProviderStatus, type ModelProviderStore, type ModelProviderUpstreamErrorCode, type ModelProviderWireProtocol, type ModelSelection, type OpenAuditAppendInput, type OpenAuditQuery, type OpenAuditRecord, type OpenAuditStore, type OpenCapabilitySource, type OpenCatalog, type OpenCatalogDomain, type OpenCatalogItem, type OpenCredentialKind, type OpenExecutionContext, type OpenExecutionResult, type OpenGrant, type OutboundMessage, type OutboundStreamChunk, type OutboxEvent, type OutboxStore, PROJECT_ROOM_TASK_DELEGATED_LABEL, PROJECT_ROOM_TASK_DELEGATED_SEPARATOR, PROJECT_ROOM_USER_CHANNEL_PROJECT, PROJECT_TASK_LIFECYCLE_ACTIONS, type PaginatedResult, type PaginationParams, type PinoFileOptions, type Plugin, type PluginConnection, type PluginConnectionFieldSchema, type PluginConnectionTestResult, type PluginContext, type PluginDeployment, type PluginDeploymentMode, type PluginDeploymentStatus, type PluginDeploymentStore, type PluginDiscoveredResource, type PluginMeta, type PluginMetaOutput, type PluginMiddlewareFactory, type PluginSkillDefinition, type PluginSkillResource, type PluginStandardConnectionConfig, type PluginToolMeta, type PluginToolUi, type PluginUiResource, type ProcessingAgentConfig, type Project, type ProjectBotMembership, type ProjectBotMembershipStatus, type ProjectBotMembershipStore, type ProjectBotRole, type ProjectCapabilityConfig, type ProjectFilter, type ProjectHumanRole, type ProjectKind, type ProjectLifecycleEventCursor, type ProjectLifecycleEventQuery, type ProjectMembership, type ProjectMembershipMutationResult, type ProjectMembershipStatus, type ProjectMembershipStore, type ProjectRoom, ProjectRoomBrokerCapacityError, type ProjectRoomBusinessEvent, type ProjectRoomBusinessEventDraft, type ProjectRoomControlEvent, ProjectRoomCursorError, type ProjectRoomEventBrokerProtocol, type ProjectRoomEventId, type ProjectRoomEventOf, type ProjectRoomEventScope, type ProjectRoomEventSubscription, type ProjectRoomMembershipAffectedEvent, type ProjectRoomMembershipChangedEvent, type ProjectRoomMention, type ProjectRoomMessage, type ProjectRoomMessageAuthor, type ProjectRoomMessageCreatedEvent, type ProjectRoomMessageCursor, type ProjectRoomMessageSource, type ProjectRoomMessageStore, type ProjectRoomPublicBotMembership, type ProjectRoomPublicMembership, type ProjectRoomPublicMessage, type ProjectRoomReadChangedEvent, type ProjectRoomReadState, type ProjectRoomReadStateStore, type ProjectRoomRealtimeActor, type ProjectRoomRosterChangedEvent, type ProjectRoomScopedBusinessEvent, type ProjectRoomSseWritable, type ProjectRoomStore, type ProjectRoomTaskChangedEvent, type ProjectRoomThreadMetadata, type ProjectRoomTrustedRunContext, type ProjectStore, type ProjectTaskLifecycleAction, ProjectTaskStoreUnsupportedError, type ProjectTaskThreadMetadata, type ProjectTaskTrustedRunContext, type ProjectTaskWorkItemStore, type ProviderModelInput, type PublicChannelInstallationType, type QueryParams, type QueryResultFormat, type QueryWorkflowRunsOptions, type QueryWorkflowRunsResult, type QueueClient, type QueueConfig, type QueueLatticeProtocol, type QueueResult, QueueType, type QueuedExecutionMode, REPLICA_HEADER, type ReactAgentConfig, type ReplyTarget, type ResourceAddress, type ResourceResolver, type Result, type RunScope, type RunStep, type STTClient, type STTConfig, type STTModelLatticeProtocol, type SandboxMiddlewareConfig, type SandboxPluginConnectionDef, type SandboxPluginDiagnostic, type SandboxPluginManifest, type SandboxPluginToolDef, type ScheduleClient, type ScheduleConfig, type ScheduleCronOptions, ScheduleExecutionType, type ScheduleLatticeProtocol, type ScheduleOnceOptions, type ScheduleStorage, ScheduleType, type ScheduledTaskDefinition, ScheduledTaskStatus, type SchedulerMiddlewareConfig, type SemanticMetricsFilter, type SemanticMetricsQueryRequest, type SemanticMetricsQueryResponse, type SemanticMetricsServerConfig, type ShareRecord, type ShareResult, type ShareVisibility, type SharedResourceStore, type Skill, type SkillClient, type SkillClientType, type SkillConfig, type SkillLatticeProtocol, type SkillStore, type SkillStoreContext, type SqlMiddlewareConfig, type StepStatus, type StepType, type StorageType, type SystemMessage, type TableQueryRequest, type TableQueryResponse, type TaskBeliefDiagnosticCode, type TaskBeliefEntry, type TaskBeliefParseFailure, type TaskBeliefParseResult, type TaskBeliefParseSuccess, type TaskBeliefState, type TaskDependentListQuery, type TaskFileRef, type TaskHandler, type TaskItem, type TaskListFilter, type TaskMutationSnapshot, type TaskStore, type TaskWorkItem, type TaskWorkItemListFilter, type TaskWorkItemStore, type TeamAgentConfig, type TeamTeammateConfig, type Tenant, type TenantModelCatalog, type TenantModelPublicEntry, type TenantStatus, type TenantStore, type TestMcpServerToolsResponse, type Thread, type ThreadStore, type Timestamp, type ToolCall, type ToolCallUi, type ToolConfig, type ToolExecutor, type ToolLatticeProtocol, type ToolMessage, type TopologyEdge, type TranscriptionResult, type TrustedRunContext, type UIComponent, UIComponentType, type UIConfig, type UILatticeProtocol, type UpdateA2AApiKeyInput, type UpdateAgentWebAppInput, type UpdateCapabilityBundleInput, type UpdateChannelInstallationRequest, type UpdateCollectionRequest, type UpdateDatabaseConfigRequest, type UpdateMcpServerConfigRequest, type UpdateMenuItemInput, type UpdateMetricsServerConfigRequest, type UpdateModelProviderRequest, type UpdateProjectCapabilityBundlesResult, type UpdateProjectRequest, type UpdateRunStepRequest, type UpdateTaskRequest, type UpdateTenantRequest, type UpdateUserRequest, type UpdateUserTenantLinkRequest, type UpdateWorkflowRunRequest, type UpdateWorkspaceRequest, type User, type UserMessage, type UserPushSubscription, type UserPushSubscriptionStore, type UserStatus, type UserStore, type UserTenantLink, type UserTenantLinkStore, type UserTenantRole, type VectorStoreConfig, type VectorStoreCreateParams, type VectorStoreLatticeProtocol, type VectorStoreProvider, WORKSPACE_PUBLIC_ROOM_PROJECT_PREFIX, type WechatChannelInstallationConfig, type WecomChannelInstallationConfig, type WorkflowAgentConfig, type WorkflowRun, type WorkflowRunStatus, type WorkflowTrackingStore, type Workspace, type WorkspaceStore, type YamlAgentStep, type YamlMapStep, type YamlParallelBlock, type YamlTopLevelStep, type YamlWorkflow, affinityEchoHeaders, assertGenericProjectConfig, buildAffinityMissChunk, createAgentWebAppStreamProjectionContext, descriptorDataValue, effectiveGrants, firstNonEmptyString, getSubAgentsFromConfig, getToolsFromConfig, hasTools, isA2ARemoteAgentConfig, isDeepAgentConfig, isExecutionResultEventKey, isMcpUiRef, isProcessingAgentConfig, isProjectRoomEventId, isTeamAgentConfig, isWorkflowAgentConfig, isWorkspacePublicRoomProjectId, normalizeTaskMetadataScalar, parseAgentWebAppGenUIBlock, parseMcpUiRef, parseModelKey, parseProjectRoomEventId, parseQueuedExecutionMode, parseTaskBeliefState, parseTrustedRunContext, projectAgentWebAppChunk, projectRoomUserEventScope, replaceTaskBeliefState, requireProjectTaskWorkItemStore, resolveRunScope, snapshotExactArray, snapshotExactRecord, snapshotProjectRoomBotMembershipRealtime, snapshotProjectRoomMembershipRealtime, snapshotProjectRoomMessageRealtime, taskBeliefStatesEqual, threadAffinityHeaders, toModelKey, toProjectRoomPublicBotMembership, toProjectRoomPublicMembership, toProjectRoomPublicMessage };
8215
+ /**
8216
+ * Time range accepted by an observability dashboard.
8217
+ */
8218
+ type ObservabilityDashboardRange = "1h" | "24h" | "7d" | "30d";
8219
+ /**
8220
+ * Input passed by the gateway to the selected observability provider.
8221
+ */
8222
+ interface ObservabilityDashboardInput {
8223
+ /** Time window to aggregate. */
8224
+ range: ObservabilityDashboardRange;
8225
+ /** Tenant resolved from the authenticated request, never from the client. */
8226
+ tenantId: string;
8227
+ }
8228
+ /**
8229
+ * Provider-owned dashboard result.
8230
+ *
8231
+ * The `payload` shape belongs to the provider; consumers must check `version`
8232
+ * before rendering it.
8233
+ */
8234
+ interface ObservabilityDashboardResult {
8235
+ /** Provider payload version. */
8236
+ version: number;
8237
+ /** Section keys that could not be loaded. */
8238
+ warnings?: string[];
8239
+ /** Provider-specific dashboard data. */
8240
+ payload: unknown;
8241
+ }
8242
+ /**
8243
+ * Cross-provider response envelope returned by the gateway.
8244
+ */
8245
+ interface ObservabilityDashboardEnvelope {
8246
+ /** Provider type, also used as the UI element key suffix. */
8247
+ provider: string;
8248
+ /** Requested time window. */
8249
+ range: ObservabilityDashboardRange;
8250
+ /** Server generation timestamp. */
8251
+ generatedAt: string;
8252
+ /** Provider payload version. */
8253
+ version: number;
8254
+ /** Section keys that could not be loaded. */
8255
+ warnings?: string[];
8256
+ /** Provider-specific dashboard data. */
8257
+ payload: unknown;
8258
+ }
8259
+ /** Prefix used to register a dashboard renderer in the GenUI element registry. */
8260
+ declare const OBSERVABILITY_DASHBOARD_ELEMENT_KEY_PREFIX = "observability_dashboard_";
8261
+ /**
8262
+ * Returns the GenUI element key for a provider dashboard.
8263
+ *
8264
+ * @param provider - Provider type such as `"langfuse"`.
8265
+ * @returns The registry key used by both the provider renderer and the panel.
8266
+ */
8267
+ declare function observabilityDashboardElementKey(provider: string): string;
8268
+ /** Version of the built-in Langfuse dashboard payload. */
8269
+ declare const LANGFUSE_OBSERVABILITY_DASHBOARD_VERSION = 3;
8270
+ /** One point in a Langfuse dashboard time series. */
8271
+ interface LangfuseObservabilitySeriesPoint {
8272
+ /** ISO timestamp of the bucket start. */
8273
+ bucket: string;
8274
+ /** Aggregated value, or `null` when the bucket has no value. */
8275
+ value: number | null;
8276
+ }
8277
+ /** Agent breakdown row, derived from the `assistant:<id>` trace tag. */
8278
+ interface LangfuseAgentBreakdownRow {
8279
+ /** Assistant id from the trace tag. */
8280
+ assistantId: string;
8281
+ /** Display name from the trace name, when Langfuse captured one. */
8282
+ name?: string;
8283
+ /** Root-observation count, i.e. invocations started by this agent. */
8284
+ calls: number;
8285
+ /** All observations emitted by this agent. */
8286
+ observations: number;
8287
+ /** Total cost in USD. */
8288
+ costUsd: number;
8289
+ /** Input tokens consumed. */
8290
+ inputTokens: number;
8291
+ /** Output tokens produced. */
8292
+ outputTokens: number;
8293
+ /** Error-level observation count. */
8294
+ errorCount: number;
8295
+ /** Error ratio in `[0, 1]` over observations. */
8296
+ errorRate: number;
8297
+ }
8298
+ /** One model's cost over time. */
8299
+ interface LangfuseModelCostSeries {
8300
+ /** Model name. */
8301
+ model: string;
8302
+ /** Cost points for this model. */
8303
+ points: LangfuseObservabilitySeriesPoint[];
8304
+ }
8305
+ /** Model breakdown row. */
8306
+ interface LangfuseModelBreakdownRow {
8307
+ /** Model name reported by Langfuse. */
8308
+ model: string;
8309
+ /** Observation count. */
8310
+ count: number;
8311
+ /** Total cost in USD. */
8312
+ costUsd: number;
8313
+ /** Input tokens consumed. */
8314
+ inputTokens: number;
8315
+ /** Output tokens produced. */
8316
+ outputTokens: number;
8317
+ /** p95 generation latency in milliseconds, or `null` when unknown. */
8318
+ p95LatencyMs: number | null;
8319
+ }
8320
+ /** Tool breakdown row. */
8321
+ interface LangfuseToolBreakdownRow {
8322
+ /** Tool observation name. */
8323
+ tool: string;
8324
+ /** Observation count. */
8325
+ count: number;
8326
+ }
8327
+ /**
8328
+ * Built-in Langfuse dashboard payload.
8329
+ *
8330
+ * Aggregated for one tenant and time range; it never contains prompts,
8331
+ * completions, user text, or credentials.
8332
+ */
8333
+ interface LangfuseObservabilityDashboardPayload {
8334
+ /** Provider sample rate; values below 1 mean the numbers are sampled. */
8335
+ samplingRate: number;
8336
+ /** Tracing environment used for the query, when configured. */
8337
+ environment?: string;
8338
+ kpis: {
8339
+ traces: number;
8340
+ costUsd: number;
8341
+ inputTokens: number;
8342
+ outputTokens: number;
8343
+ /** Error observation ratio in `[0, 1]`. */
8344
+ errorRate: number;
8345
+ };
8346
+ series: {
8347
+ traces: LangfuseObservabilitySeriesPoint[];
8348
+ cost: LangfuseObservabilitySeriesPoint[];
8349
+ tokens: {
8350
+ input: LangfuseObservabilitySeriesPoint[];
8351
+ output: LangfuseObservabilitySeriesPoint[];
8352
+ };
8353
+ latency: {
8354
+ p50: LangfuseObservabilitySeriesPoint[];
8355
+ p95: LangfuseObservabilitySeriesPoint[];
8356
+ p99: LangfuseObservabilitySeriesPoint[];
8357
+ };
8358
+ errorRate: LangfuseObservabilitySeriesPoint[];
8359
+ toolCalls: LangfuseObservabilitySeriesPoint[];
8360
+ /** Per-model cost trend. Optional so older payloads keep working. */
8361
+ costByModel?: LangfuseModelCostSeries[];
8362
+ };
8363
+ agents: LangfuseAgentBreakdownRow[];
8364
+ models: LangfuseModelBreakdownRow[];
8365
+ tools: LangfuseToolBreakdownRow[];
8366
+ }
8367
+
8368
+ export { type A2AApiKeyEntry, type A2AApiKeyRecord, type A2AApiKeyStore, type A2AAuthContext, type A2AEventCursor, type A2ARemoteAgentConfig, AFFINITY_ECHO_HEADER, AFFINITY_MISS_CODE, AGENT_AFFINITY_HEADER, type AgentClient, type AgentConfig, type AgentConfigWithTools, type AgentInterrupt, type AgentLatticeProtocol, type AgentMenuConfig, type AgentMiddlewareConfig, type AgentRunConfig, AgentType, type AgentWebApp, type AgentWebAppAppearance, type AgentWebAppBootstrap, type AgentWebAppCalloutWidget, type AgentWebAppError, type AgentWebAppErrorCode, type AgentWebAppFeatures, type AgentWebAppGenUIBlock, type AgentWebAppIdentityAssurance, type AgentWebAppIdentityConfig, type AgentWebAppIdentityPolicy, type AgentWebAppInterrupt, type AgentWebAppIssuerConfig, type AgentWebAppQuickPrompt, type AgentWebAppRuntimeMessage, type AgentWebAppRuntimeThread, type AgentWebAppScope, type AgentWebAppStatus, type AgentWebAppStore, type AgentWebAppStorePatch, type AgentWebAppStreamEvent, type AgentWebAppStreamProjectionContext, type AgentWebAppTableWidget, type AgentWebAppThreadMetadata, type AgentWebAppUpdateOptions, type Assistant, type AssistantMessage, type AssistantStore, type Attachment, type AvailableModule, type BaseLatticeProtocol, type BaseMessage, type Binding, type BindingListParams, type BindingMutablePatch, type BindingRegistry, type BootstrapFilesConfig, type BrowserMiddlewareConfig, CHANNEL_REPLY_JOB_LIST_LIMIT_DEFAULT, CHANNEL_REPLY_JOB_LIST_LIMIT_MAX, CHANNEL_REPLY_JOB_LIST_LIMIT_MIN, type Callback, type CapabilityBundle, type CapabilityBundleDeleteResult, type CapabilityBundleStore, type CapabilityBundleUpdateConflict, type CapabilityFieldSource, type CapabilityOverride, type CapabilityPreview, type CapabilityPreviewIssue, type CapabilityRuntime, type ChannelAdapter, type ChannelBindingMigrationConflict, ChannelBindingMigrationConflictError, type ChannelInstallation, type ChannelInstallationStore, type ChannelInstallationType, type ChannelReplyJob, type ChannelReplyJobStatus, type ChannelReplyJobStore, type CheckpointMaintenance, type CheckpointStorage, type ClawMiddlewareConfig, type CodeEvalMiddlewareConfig, type Collection, type CollectionField, type CollectionFieldType, type CollectionMiddlewareConfig, type CollectionSchema, type CollectionStore, type ConnectionEntry, type ConnectionStore, type ConversationRecord, type CreateA2AApiKeyInput, type CreateAgentWebAppInput, type CreateAssistantRequest, type CreateBindingInput, type CreateCapabilityBundleInput, type CreateChannelInstallationInput, type CreateChannelInstallationRequest, type CreateChannelReplyJobInput, type CreateCollectionRequest, type CreateConversationInput, type CreateDatabaseConfigRequest, type CreateEvalCaseRequest, type CreateEvalProjectRequest, type CreateEvalRunRequest, type CreateEvalSuiteRequest, type CreateMcpServerConfigRequest, type CreateMenuItemInput, type CreateMetricsServerConfigRequest, type CreateModelProviderRequest, type CreateProjectRequest, type CreateRunStepRequest, type CreateShareRequest, type CreateSkillRequest, type CreateTaskRequest, type CreateTenantRequest, type CreateThreadRequest, type CreateUserRequest, type CreateUserTenantLinkRequest, type CreateWorkItemIfAbsentRequest, type CreateWorkItemRequest, type CreateWorkflowRunRequest, type CreateWorkspaceRequest, type CustomMenuConfig, type DataSource, type DatabaseConfig, type DatabaseConfigEntry, type DatabaseConfigStore, type DatabaseType, type DeepAgentConfig, type DescriptorDataValue, type DeveloperMessage, type DiscoveredModel, type DispatchResult, DuplicateChannelBindingSubjectError, EXECUTION_RESULT_EVENT_KEY_PATTERN, EXECUTION_RESULT_EVENT_KEY_PATTERN_SOURCE, EXECUTION_RESULT_EVENT_KEY_PREFIX, type EmbeddingsConfig, type EmbeddingsLatticeProtocol, type EvalCase, type EvalProject, type EvalProjectReport, type EvalRun, type EvalRunResult, type EvalStore, type EvalSuite, type ExecuteSqlQueryRequest, type ExecuteSqlQueryResponse, type ExpectedCapabilityBundleRevisions, type FileMenuConfig, type FilterCondition, type GraphBuildOptions, type HtmlMenuConfig, type IConversationStore, type ID, type InboundMessage, type InternalAgentNode, type InternalBaseNode, type InternalCreateCapabilityBundleInput, type InternalDSL, type InternalEdge, type InternalInput, type InternalInputNode, type InternalMapNode, type InternalNode, type InternalNodeConfig, type InternalOutput, type InternalState, type InternalStateField, type InternalTerminalNode, type InternalUpdateCapabilityBundleInput, type InterruptAnswerKey, type InterruptMessage, type InterruptPolicy, InvalidProjectCapabilityBundleConfigError, LANGFUSE_OBSERVABILITY_DASHBOARD_VERSION, type LLMConfig, type LangfuseAgentBreakdownRow, type LangfuseModelBreakdownRow, type LangfuseModelCostSeries, type LangfuseObservabilityDashboardPayload, type LangfuseObservabilitySeriesPoint, type LangfuseToolBreakdownRow, type LarkChannelInstallationConfig, type LatticeError, type LatticeEventBus, type LatticeMessage, type LeaseRecord, type LeaseStore, type LocalA2AProviderId, type LocalA2AProviderState, type LocalA2AProviderStatus, type LocalA2ATemplateDefinition, type LocalRuntimeConfig, type LoggerClient, type LoggerConfig, type LoggerContext, type LoggerLatticeProtocol, LoggerType, MAX_PENDING_EXECUTION_RESULTS_LIMIT, type McpAppMenuConfig, type McpClient, type McpClientOptions, type McpConnectionStatus, type McpLatticeMessage, type McpLatticeProtocol, McpMessageType, type McpServerConfig, type McpServerConfigEntry, type McpServerConfigStore, type McpStats, type McpTool, type McpToolResult, type McpTransportType, type McpUiCsp, type McpUiDisplayMode, type McpUiPermissions, type McpUiRef, type McpUiResourcePayload, type MemoryClient, type MemoryConfig, type MemoryLatticeProtocol, MemoryType, type MenuContentConfig, type MenuContentType, type MenuItem, type MenuRegistry, type MenuTarget, type Message, type MessageChunk, type MessageChunkType, MessageChunkTypes, type MessageContext, type MessageMiddleware, type MetricColumn, type MetricDataPoint, type MetricMeta, type MetricQueryResult, type MetricsMiddlewareConfig, type MetricsServerConfig, type MetricsServerConfigEntry, type MetricsServerConfigStore, type MetricsServerType, type MiddlewareType, type ModelDiscoveryResult, type ModelKind, type ModelLatticeProtocol, type ModelProviderApiStyle, type ModelProviderEntry, type ModelProviderErrorCode, type ModelProviderLlmProvider, type ModelProviderModelEntry, type ModelProviderProbeRequest, type ModelProviderProbeResult, type ModelProviderPublicEntry, type ModelProviderStatus, type ModelProviderStore, type ModelProviderUpstreamErrorCode, type ModelProviderWireProtocol, type ModelSelection, OBSERVABILITY_DASHBOARD_ELEMENT_KEY_PREFIX, type ObservabilityDashboardEnvelope, type ObservabilityDashboardInput, type ObservabilityDashboardRange, type ObservabilityDashboardResult, type OpenAuditAppendInput, type OpenAuditQuery, type OpenAuditRecord, type OpenAuditStore, type OpenCapabilitySource, type OpenCatalog, type OpenCatalogDomain, type OpenCatalogItem, type OpenCredentialKind, type OpenExecutionContext, type OpenExecutionResult, type OpenGrant, type OutboundMessage, type OutboundStreamChunk, type OutboxEvent, type OutboxStore, PROJECT_ROOM_TASK_DELEGATED_LABEL, PROJECT_ROOM_TASK_DELEGATED_SEPARATOR, PROJECT_ROOM_USER_CHANNEL_PROJECT, PROJECT_TASK_LIFECYCLE_ACTIONS, type PaginatedResult, type PaginationParams, type PinoFileOptions, type Plugin, type PluginConnection, type PluginConnectionFieldSchema, type PluginConnectionTestResult, type PluginContext, type PluginDeployment, type PluginDeploymentMode, type PluginDeploymentStatus, type PluginDeploymentStore, type PluginDiscoveredResource, type PluginMeta, type PluginMetaOutput, type PluginMiddlewareFactory, type PluginSkillDefinition, type PluginSkillResource, type PluginStandardConnectionConfig, type PluginToolMeta, type PluginToolUi, type PluginUiResource, type ProcessingAgentConfig, type Project, type ProjectBotMembership, type ProjectBotMembershipStatus, type ProjectBotMembershipStore, type ProjectBotRole, type ProjectCapabilityConfig, type ProjectFilter, type ProjectHumanRole, type ProjectKind, type ProjectLifecycleEventCursor, type ProjectLifecycleEventQuery, type ProjectMembership, type ProjectMembershipMutationResult, type ProjectMembershipStatus, type ProjectMembershipStore, type ProjectRoom, ProjectRoomBrokerCapacityError, type ProjectRoomBusinessEvent, type ProjectRoomBusinessEventDraft, type ProjectRoomControlEvent, ProjectRoomCursorError, type ProjectRoomEventBrokerProtocol, type ProjectRoomEventId, type ProjectRoomEventOf, type ProjectRoomEventScope, type ProjectRoomEventSubscription, type ProjectRoomMembershipAffectedEvent, type ProjectRoomMembershipChangedEvent, type ProjectRoomMention, type ProjectRoomMessage, type ProjectRoomMessageAuthor, type ProjectRoomMessageCreatedEvent, type ProjectRoomMessageCursor, type ProjectRoomMessageSource, type ProjectRoomMessageStore, type ProjectRoomPublicBotMembership, type ProjectRoomPublicMembership, type ProjectRoomPublicMessage, type ProjectRoomReadChangedEvent, type ProjectRoomReadState, type ProjectRoomReadStateStore, type ProjectRoomRealtimeActor, type ProjectRoomRosterChangedEvent, type ProjectRoomScopedBusinessEvent, type ProjectRoomSseWritable, type ProjectRoomStore, type ProjectRoomTaskChangedEvent, type ProjectRoomThreadMetadata, type ProjectRoomTrustedRunContext, type ProjectStore, type ProjectTaskLifecycleAction, ProjectTaskStoreUnsupportedError, type ProjectTaskThreadMetadata, type ProjectTaskTrustedRunContext, type ProjectTaskWorkItemStore, type ProviderModelInput, type PublicChannelInstallationType, type QueryParams, type QueryResultFormat, type QueryWorkflowRunsOptions, type QueryWorkflowRunsResult, type QueueClient, type QueueConfig, type QueueLatticeProtocol, type QueueResult, QueueType, type QueuedExecutionMode, REPLICA_HEADER, type ReactAgentConfig, type ReplyTarget, type ResourceAddress, type ResourceResolver, type Result, type RunCancelSignal, type RunScope, type RunStep, STORE_IDENTITY_SEPARATOR, type STTClient, type STTConfig, type STTModelLatticeProtocol, type SandboxMiddlewareConfig, type SandboxPluginConnectionDef, type SandboxPluginDiagnostic, type SandboxPluginManifest, type SandboxPluginToolDef, type ScheduleClient, type ScheduleConfig, type ScheduleCronOptions, ScheduleExecutionType, type ScheduleLatticeProtocol, type ScheduleOnceOptions, type ScheduleStorage, ScheduleType, type ScheduledTaskDefinition, ScheduledTaskStatus, type SchedulerMiddlewareConfig, type SemanticMetricsFilter, type SemanticMetricsQueryRequest, type SemanticMetricsQueryResponse, type SemanticMetricsServerConfig, type ShareRecord, type ShareResult, type ShareVisibility, type SharedResourceStore, type Skill, type SkillClient, type SkillClientType, type SkillConfig, type SkillLatticeProtocol, type SkillStore, type SkillStoreContext, type SqlMiddlewareConfig, type StepStatus, type StepType, type StorageType, type StoreItem, type StoreProtocol, type StorePutInput, type StoreSearchInput, StoreValidationError, type SystemMessage, type TableQueryRequest, type TableQueryResponse, type TaskBeliefDiagnosticCode, type TaskBeliefEntry, type TaskBeliefParseFailure, type TaskBeliefParseResult, type TaskBeliefParseSuccess, type TaskBeliefState, type TaskDependentListQuery, type TaskFileRef, type TaskHandler, type TaskItem, type TaskListFilter, type TaskMutationSnapshot, type TaskStore, type TaskWorkItem, type TaskWorkItemListFilter, type TaskWorkItemStore, type Tenant, type TenantModelCatalog, type TenantModelPublicEntry, type TenantStatus, type TenantStore, type TestMcpServerToolsResponse, type Thread, type ThreadCheckpointStorage, type ThreadStore, type Timestamp, type ToolCall, type ToolCallUi, type ToolConfig, type ToolExecutor, type ToolLatticeProtocol, type ToolMessage, type TopologyEdge, type TranscriptionResult, type TrustedRunContext, type UIComponent, UIComponentType, type UIConfig, type UILatticeProtocol, type UpdateA2AApiKeyInput, type UpdateAgentWebAppInput, type UpdateCapabilityBundleInput, type UpdateChannelInstallationRequest, type UpdateCollectionRequest, type UpdateDatabaseConfigRequest, type UpdateMcpServerConfigRequest, type UpdateMenuItemInput, type UpdateMetricsServerConfigRequest, type UpdateModelProviderRequest, type UpdateProjectCapabilityBundlesResult, type UpdateProjectRequest, type UpdateRunStepRequest, type UpdateTaskRequest, type UpdateTenantRequest, type UpdateUserRequest, type UpdateUserTenantLinkRequest, type UpdateWorkflowRunRequest, type UpdateWorkspaceRequest, type User, type UserMessage, type UserPushSubscription, type UserPushSubscriptionStore, type UserStatus, type UserStore, type UserTenantLink, type UserTenantLinkStore, type UserTenantRole, type VectorStoreConfig, type VectorStoreCreateParams, type VectorStoreLatticeProtocol, type VectorStoreProvider, WORKSPACE_PUBLIC_ROOM_PROJECT_PREFIX, type WechatChannelInstallationConfig, type WecomChannelInstallationConfig, type WorkflowAgentConfig, type WorkflowRun, type WorkflowRunStatus, type WorkflowTrackingStore, type Workspace, type WorkspaceStore, type YamlAgentStep, type YamlMapStep, type YamlParallelBlock, type YamlTopLevelStep, type YamlWorkflow, a2aEventCursorSchema, affinityEchoHeaders, assertGenericProjectConfig, assertStoreIdentity, assertStoreNamespacePrefix, assertValidCreateChannelReplyJobInput, buildAffinityMissChunk, createAgentWebAppStreamProjectionContext, descriptorDataValue, effectiveGrants, firstNonEmptyString, getSubAgentsFromConfig, getToolsFromConfig, hasTools, interruptAnswerKeySchema, isA2ARemoteAgentConfig, isDeepAgentConfig, isExecutionResultEventKey, isMcpUiRef, isProcessingAgentConfig, isProjectRoomEventId, isWorkflowAgentConfig, isWorkspacePublicRoomProjectId, normalizeChannelReplyJobListLimit, normalizeTaskMetadataScalar, observabilityDashboardElementKey, parseAgentWebAppGenUIBlock, parseMcpUiRef, parseModelKey, parseProjectRoomEventId, parseQueuedExecutionMode, parseTaskBeliefState, parseTrustedRunContext, projectAgentWebAppChunk, projectRoomUserEventScope, replaceTaskBeliefState, requireProjectTaskWorkItemStore, resolveRunScope, runCancelSignalSchema, snapshotExactArray, snapshotExactRecord, snapshotProjectRoomBotMembershipRealtime, snapshotProjectRoomMembershipRealtime, snapshotProjectRoomMessageRealtime, storeExpiresAt, storePaginationValue, taskBeliefStatesEqual, threadAffinityHeaders, toModelKey, toProjectRoomPublicBotMembership, toProjectRoomPublicMembership, toProjectRoomPublicMessage };