@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.mjs CHANGED
@@ -2,15 +2,11 @@
2
2
  var AgentType = /* @__PURE__ */ ((AgentType2) => {
3
3
  AgentType2["REACT"] = "react";
4
4
  AgentType2["DEEP_AGENT"] = "deep_agent";
5
- AgentType2["TEAM"] = "team";
6
5
  AgentType2["PROCESSING"] = "processing";
7
6
  AgentType2["A2A_REMOTE"] = "a2a_remote";
8
7
  AgentType2["WORKFLOW"] = "workflow";
9
8
  return AgentType2;
10
9
  })(AgentType || {});
11
- function isTeamAgentConfig(config) {
12
- return config.type === "team" /* TEAM */;
13
- }
14
10
  function isA2ARemoteAgentConfig(config) {
15
11
  return config.type === "a2a_remote" /* A2A_REMOTE */;
16
12
  }
@@ -579,6 +575,108 @@ function isRecord2(value) {
579
575
  var PROJECT_ROOM_TASK_DELEGATED_LABEL = "Task delegated";
580
576
  var PROJECT_ROOM_TASK_DELEGATED_SEPARATOR = " \xB7 ";
581
577
 
578
+ // src/StoreProtocol.ts
579
+ var STORE_IDENTITY_SEPARATOR = "";
580
+ var StoreValidationError = class extends Error {
581
+ constructor(message) {
582
+ super(message);
583
+ this.code = "STORE_IDENTITY_INVALID";
584
+ this.name = "StoreValidationError";
585
+ }
586
+ };
587
+ function validStoreSegment(value) {
588
+ return typeof value === "string" && value.length > 0 && !value.includes(STORE_IDENTITY_SEPARATOR);
589
+ }
590
+ function assertStoreIdentity(namespace, key) {
591
+ if (!Array.isArray(namespace) || namespace.length === 0) {
592
+ throw new StoreValidationError("namespace must be a non-empty string array");
593
+ }
594
+ for (const segment of namespace) {
595
+ if (!validStoreSegment(segment)) {
596
+ throw new StoreValidationError(
597
+ "namespace segments must be non-empty strings without the reserved separator"
598
+ );
599
+ }
600
+ }
601
+ if (!validStoreSegment(key)) {
602
+ throw new StoreValidationError(
603
+ "key must be a non-empty string without the reserved separator"
604
+ );
605
+ }
606
+ }
607
+ function assertStoreNamespacePrefix(prefix) {
608
+ if (!Array.isArray(prefix)) {
609
+ throw new StoreValidationError("namespace prefix must be a string array");
610
+ }
611
+ for (const segment of prefix) {
612
+ if (!validStoreSegment(segment)) {
613
+ throw new StoreValidationError(
614
+ "namespace segments must be non-empty strings without the reserved separator"
615
+ );
616
+ }
617
+ }
618
+ }
619
+ function storeExpiresAt(ttlMinutes, now = /* @__PURE__ */ new Date()) {
620
+ if (ttlMinutes === void 0) return void 0;
621
+ if (typeof ttlMinutes !== "number" || !Number.isFinite(ttlMinutes) || ttlMinutes <= 0) {
622
+ throw new StoreValidationError("ttlMinutes must be a positive number");
623
+ }
624
+ const expiresAt = new Date(now.getTime() + ttlMinutes * 6e4);
625
+ if (!Number.isFinite(expiresAt.getTime()) || expiresAt.getUTCFullYear() > 9999) {
626
+ throw new StoreValidationError("ttlMinutes is out of range");
627
+ }
628
+ return expiresAt;
629
+ }
630
+ function storePaginationValue(value, fallback) {
631
+ if (value === void 0) return fallback;
632
+ if (!Number.isSafeInteger(value) || value < 0) {
633
+ throw new StoreValidationError("limit/offset must be a non-negative safe integer");
634
+ }
635
+ return value;
636
+ }
637
+
638
+ // src/ChannelReplyJobProtocol.ts
639
+ var CHANNEL_REPLY_JOB_LIST_LIMIT_MIN = 1;
640
+ var CHANNEL_REPLY_JOB_LIST_LIMIT_MAX = 200;
641
+ var CHANNEL_REPLY_JOB_LIST_LIMIT_DEFAULT = 100;
642
+ function normalizeChannelReplyJobListLimit(limit) {
643
+ if (limit === void 0 || !Number.isFinite(limit)) {
644
+ return CHANNEL_REPLY_JOB_LIST_LIMIT_DEFAULT;
645
+ }
646
+ return Math.min(
647
+ CHANNEL_REPLY_JOB_LIST_LIMIT_MAX,
648
+ Math.max(CHANNEL_REPLY_JOB_LIST_LIMIT_MIN, Math.trunc(limit))
649
+ );
650
+ }
651
+ function assertValidCreateChannelReplyJobInput(input) {
652
+ if (input === null || typeof input !== "object") {
653
+ throw new Error("ChannelReplyJob create input is required");
654
+ }
655
+ const required = [
656
+ ["runId", input.runId],
657
+ ["tenantId", input.tenantId],
658
+ ["assistantId", input.assistantId],
659
+ ["threadId", input.threadId],
660
+ ["adapterChannel", input.adapterChannel],
661
+ ["channelInstallationId", input.channelInstallationId],
662
+ ["inputMessageId", input.inputMessageId]
663
+ ];
664
+ for (const [field, value] of required) {
665
+ if (typeof value !== "string" || value.trim() === "") {
666
+ throw new Error(`ChannelReplyJob requires a non-empty ${field}`);
667
+ }
668
+ }
669
+ if (typeof input.replyTarget !== "object" || input.replyTarget === null || Array.isArray(input.replyTarget)) {
670
+ throw new Error("ChannelReplyJob requires a replyTarget object");
671
+ }
672
+ if (typeof input.availableAt !== "number" || !Number.isFinite(input.availableAt)) {
673
+ throw new Error("ChannelReplyJob requires a finite availableAt");
674
+ }
675
+ if (input.streamCursor !== void 0 && input.streamCursor !== null && typeof input.streamCursor !== "string") {
676
+ throw new Error("ChannelReplyJob streamCursor must be a string");
677
+ }
678
+ }
679
+
582
680
  // src/ExactDataSnapshot.ts
583
681
  function ownDescriptorField(descriptor, key) {
584
682
  const field = Object.getOwnPropertyDescriptor(descriptor, key);
@@ -941,6 +1039,32 @@ function resolveRunScope(runConfig) {
941
1039
  };
942
1040
  }
943
1041
 
1042
+ // src/RunCancelProtocol.ts
1043
+ import { z } from "zod";
1044
+ var MAX_FIELD_LENGTH = 64 * 1024;
1045
+ var boundedString = z.string().min(1).max(MAX_FIELD_LENGTH);
1046
+ var RUN_CANCEL_REASONS = ["abort", "a2a.cancel", "shutdown"];
1047
+ var runCancelSignalSchema = z.object({
1048
+ commandId: boundedString,
1049
+ tenantId: boundedString,
1050
+ assistantId: boundedString,
1051
+ threadId: boundedString,
1052
+ runId: boundedString,
1053
+ reason: z.enum(RUN_CANCEL_REASONS),
1054
+ createdAt: boundedString
1055
+ }).strict();
1056
+ var interruptAnswerKeySchema = z.object({
1057
+ tenantId: boundedString,
1058
+ assistantId: boundedString,
1059
+ threadId: boundedString,
1060
+ interruptId: boundedString
1061
+ }).strict();
1062
+ var a2aEventCursorSchema = z.object({
1063
+ taskId: boundedString,
1064
+ lastEventId: boundedString,
1065
+ updatedAt: boundedString
1066
+ }).strict();
1067
+
944
1068
  // src/AgentAffinity.ts
945
1069
  var AGENT_AFFINITY_HEADER = "x-axiom-affinity";
946
1070
  var REPLICA_HEADER = "x-axiom-replica";
@@ -977,6 +1101,7 @@ function effectiveGrants(record) {
977
1101
 
978
1102
  // src/McpUiProtocol.ts
979
1103
  var MODES = ["inline", "fullscreen", "pip"];
1104
+ var MAX_MCP_UI_SCOPE_LENGTH = 4096;
980
1105
  var isObj = (v) => typeof v === "object" && v !== null;
981
1106
  function isMcpUiRef(value) {
982
1107
  return parseMcpUiRef(value) !== null;
@@ -996,26 +1121,46 @@ function parseMcpUiRef(value) {
996
1121
  };
997
1122
  }
998
1123
  if (value.kind === "plugin" && typeof value.pluginType === "string" && typeof value.resource === "string") {
999
- return { kind: "plugin", pluginType: value.pluginType, resource: value.resource, displayMode, ...title ? { title } : {} };
1124
+ const scope = typeof value.scope === "string" && value.scope.length > 0 && value.scope.length <= MAX_MCP_UI_SCOPE_LENGTH ? value.scope : void 0;
1125
+ return {
1126
+ kind: "plugin",
1127
+ pluginType: value.pluginType,
1128
+ resource: value.resource,
1129
+ displayMode,
1130
+ ...title ? { title } : {},
1131
+ ...scope ? { scope } : {}
1132
+ };
1000
1133
  }
1001
1134
  return null;
1002
1135
  }
1136
+
1137
+ // src/ObservabilityDashboardProtocol.ts
1138
+ var OBSERVABILITY_DASHBOARD_ELEMENT_KEY_PREFIX = "observability_dashboard_";
1139
+ function observabilityDashboardElementKey(provider) {
1140
+ return `${OBSERVABILITY_DASHBOARD_ELEMENT_KEY_PREFIX}${provider}`;
1141
+ }
1142
+ var LANGFUSE_OBSERVABILITY_DASHBOARD_VERSION = 3;
1003
1143
  export {
1004
1144
  AFFINITY_ECHO_HEADER,
1005
1145
  AFFINITY_MISS_CODE,
1006
1146
  AGENT_AFFINITY_HEADER,
1007
1147
  AgentType,
1148
+ CHANNEL_REPLY_JOB_LIST_LIMIT_DEFAULT,
1149
+ CHANNEL_REPLY_JOB_LIST_LIMIT_MAX,
1150
+ CHANNEL_REPLY_JOB_LIST_LIMIT_MIN,
1008
1151
  ChannelBindingMigrationConflictError,
1009
1152
  DuplicateChannelBindingSubjectError,
1010
1153
  EXECUTION_RESULT_EVENT_KEY_PATTERN,
1011
1154
  EXECUTION_RESULT_EVENT_KEY_PATTERN_SOURCE,
1012
1155
  EXECUTION_RESULT_EVENT_KEY_PREFIX,
1013
1156
  InvalidProjectCapabilityBundleConfigError,
1157
+ LANGFUSE_OBSERVABILITY_DASHBOARD_VERSION,
1014
1158
  LoggerType,
1015
1159
  MAX_PENDING_EXECUTION_RESULTS_LIMIT,
1016
1160
  McpMessageType,
1017
1161
  MemoryType,
1018
1162
  MessageChunkTypes,
1163
+ OBSERVABILITY_DASHBOARD_ELEMENT_KEY_PREFIX,
1019
1164
  PROJECT_ROOM_TASK_DELEGATED_LABEL,
1020
1165
  PROJECT_ROOM_TASK_DELEGATED_SEPARATOR,
1021
1166
  PROJECT_ROOM_USER_CHANNEL_PROJECT,
@@ -1025,13 +1170,19 @@ export {
1025
1170
  ProjectTaskStoreUnsupportedError,
1026
1171
  QueueType,
1027
1172
  REPLICA_HEADER,
1173
+ STORE_IDENTITY_SEPARATOR,
1028
1174
  ScheduleExecutionType,
1029
1175
  ScheduleType,
1030
1176
  ScheduledTaskStatus,
1177
+ StoreValidationError,
1031
1178
  UIComponentType,
1032
1179
  WORKSPACE_PUBLIC_ROOM_PROJECT_PREFIX,
1180
+ a2aEventCursorSchema,
1033
1181
  affinityEchoHeaders,
1034
1182
  assertGenericProjectConfig,
1183
+ assertStoreIdentity,
1184
+ assertStoreNamespacePrefix,
1185
+ assertValidCreateChannelReplyJobInput,
1035
1186
  buildAffinityMissChunk,
1036
1187
  createAgentWebAppStreamProjectionContext,
1037
1188
  descriptorDataValue,
@@ -1040,16 +1191,18 @@ export {
1040
1191
  getSubAgentsFromConfig,
1041
1192
  getToolsFromConfig,
1042
1193
  hasTools,
1194
+ interruptAnswerKeySchema,
1043
1195
  isA2ARemoteAgentConfig,
1044
1196
  isDeepAgentConfig,
1045
1197
  isExecutionResultEventKey,
1046
1198
  isMcpUiRef,
1047
1199
  isProcessingAgentConfig,
1048
1200
  isProjectRoomEventId,
1049
- isTeamAgentConfig,
1050
1201
  isWorkflowAgentConfig,
1051
1202
  isWorkspacePublicRoomProjectId,
1203
+ normalizeChannelReplyJobListLimit,
1052
1204
  normalizeTaskMetadataScalar,
1205
+ observabilityDashboardElementKey,
1053
1206
  parseAgentWebAppGenUIBlock,
1054
1207
  parseMcpUiRef,
1055
1208
  parseModelKey,
@@ -1062,11 +1215,14 @@ export {
1062
1215
  replaceTaskBeliefState,
1063
1216
  requireProjectTaskWorkItemStore,
1064
1217
  resolveRunScope,
1218
+ runCancelSignalSchema,
1065
1219
  snapshotExactArray,
1066
1220
  snapshotExactRecord,
1067
1221
  snapshotProjectRoomBotMembershipRealtime,
1068
1222
  snapshotProjectRoomMembershipRealtime,
1069
1223
  snapshotProjectRoomMessageRealtime,
1224
+ storeExpiresAt,
1225
+ storePaginationValue,
1070
1226
  taskBeliefStatesEqual,
1071
1227
  threadAffinityHeaders,
1072
1228
  toModelKey,