@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.js CHANGED
@@ -24,17 +24,22 @@ __export(index_exports, {
24
24
  AFFINITY_MISS_CODE: () => AFFINITY_MISS_CODE,
25
25
  AGENT_AFFINITY_HEADER: () => AGENT_AFFINITY_HEADER,
26
26
  AgentType: () => AgentType,
27
+ CHANNEL_REPLY_JOB_LIST_LIMIT_DEFAULT: () => CHANNEL_REPLY_JOB_LIST_LIMIT_DEFAULT,
28
+ CHANNEL_REPLY_JOB_LIST_LIMIT_MAX: () => CHANNEL_REPLY_JOB_LIST_LIMIT_MAX,
29
+ CHANNEL_REPLY_JOB_LIST_LIMIT_MIN: () => CHANNEL_REPLY_JOB_LIST_LIMIT_MIN,
27
30
  ChannelBindingMigrationConflictError: () => ChannelBindingMigrationConflictError,
28
31
  DuplicateChannelBindingSubjectError: () => DuplicateChannelBindingSubjectError,
29
32
  EXECUTION_RESULT_EVENT_KEY_PATTERN: () => EXECUTION_RESULT_EVENT_KEY_PATTERN,
30
33
  EXECUTION_RESULT_EVENT_KEY_PATTERN_SOURCE: () => EXECUTION_RESULT_EVENT_KEY_PATTERN_SOURCE,
31
34
  EXECUTION_RESULT_EVENT_KEY_PREFIX: () => EXECUTION_RESULT_EVENT_KEY_PREFIX,
32
35
  InvalidProjectCapabilityBundleConfigError: () => InvalidProjectCapabilityBundleConfigError,
36
+ LANGFUSE_OBSERVABILITY_DASHBOARD_VERSION: () => LANGFUSE_OBSERVABILITY_DASHBOARD_VERSION,
33
37
  LoggerType: () => LoggerType,
34
38
  MAX_PENDING_EXECUTION_RESULTS_LIMIT: () => MAX_PENDING_EXECUTION_RESULTS_LIMIT,
35
39
  McpMessageType: () => McpMessageType,
36
40
  MemoryType: () => MemoryType,
37
41
  MessageChunkTypes: () => MessageChunkTypes,
42
+ OBSERVABILITY_DASHBOARD_ELEMENT_KEY_PREFIX: () => OBSERVABILITY_DASHBOARD_ELEMENT_KEY_PREFIX,
38
43
  PROJECT_ROOM_TASK_DELEGATED_LABEL: () => PROJECT_ROOM_TASK_DELEGATED_LABEL,
39
44
  PROJECT_ROOM_TASK_DELEGATED_SEPARATOR: () => PROJECT_ROOM_TASK_DELEGATED_SEPARATOR,
40
45
  PROJECT_ROOM_USER_CHANNEL_PROJECT: () => PROJECT_ROOM_USER_CHANNEL_PROJECT,
@@ -44,13 +49,19 @@ __export(index_exports, {
44
49
  ProjectTaskStoreUnsupportedError: () => ProjectTaskStoreUnsupportedError,
45
50
  QueueType: () => QueueType,
46
51
  REPLICA_HEADER: () => REPLICA_HEADER,
52
+ STORE_IDENTITY_SEPARATOR: () => STORE_IDENTITY_SEPARATOR,
47
53
  ScheduleExecutionType: () => ScheduleExecutionType,
48
54
  ScheduleType: () => ScheduleType,
49
55
  ScheduledTaskStatus: () => ScheduledTaskStatus,
56
+ StoreValidationError: () => StoreValidationError,
50
57
  UIComponentType: () => UIComponentType,
51
58
  WORKSPACE_PUBLIC_ROOM_PROJECT_PREFIX: () => WORKSPACE_PUBLIC_ROOM_PROJECT_PREFIX,
59
+ a2aEventCursorSchema: () => a2aEventCursorSchema,
52
60
  affinityEchoHeaders: () => affinityEchoHeaders,
53
61
  assertGenericProjectConfig: () => assertGenericProjectConfig,
62
+ assertStoreIdentity: () => assertStoreIdentity,
63
+ assertStoreNamespacePrefix: () => assertStoreNamespacePrefix,
64
+ assertValidCreateChannelReplyJobInput: () => assertValidCreateChannelReplyJobInput,
54
65
  buildAffinityMissChunk: () => buildAffinityMissChunk,
55
66
  createAgentWebAppStreamProjectionContext: () => createAgentWebAppStreamProjectionContext,
56
67
  descriptorDataValue: () => descriptorDataValue,
@@ -59,16 +70,18 @@ __export(index_exports, {
59
70
  getSubAgentsFromConfig: () => getSubAgentsFromConfig,
60
71
  getToolsFromConfig: () => getToolsFromConfig,
61
72
  hasTools: () => hasTools,
73
+ interruptAnswerKeySchema: () => interruptAnswerKeySchema,
62
74
  isA2ARemoteAgentConfig: () => isA2ARemoteAgentConfig,
63
75
  isDeepAgentConfig: () => isDeepAgentConfig,
64
76
  isExecutionResultEventKey: () => isExecutionResultEventKey,
65
77
  isMcpUiRef: () => isMcpUiRef,
66
78
  isProcessingAgentConfig: () => isProcessingAgentConfig,
67
79
  isProjectRoomEventId: () => isProjectRoomEventId,
68
- isTeamAgentConfig: () => isTeamAgentConfig,
69
80
  isWorkflowAgentConfig: () => isWorkflowAgentConfig,
70
81
  isWorkspacePublicRoomProjectId: () => isWorkspacePublicRoomProjectId,
82
+ normalizeChannelReplyJobListLimit: () => normalizeChannelReplyJobListLimit,
71
83
  normalizeTaskMetadataScalar: () => normalizeTaskMetadataScalar,
84
+ observabilityDashboardElementKey: () => observabilityDashboardElementKey,
72
85
  parseAgentWebAppGenUIBlock: () => parseAgentWebAppGenUIBlock,
73
86
  parseMcpUiRef: () => parseMcpUiRef,
74
87
  parseModelKey: () => parseModelKey,
@@ -81,11 +94,14 @@ __export(index_exports, {
81
94
  replaceTaskBeliefState: () => replaceTaskBeliefState,
82
95
  requireProjectTaskWorkItemStore: () => requireProjectTaskWorkItemStore,
83
96
  resolveRunScope: () => resolveRunScope,
97
+ runCancelSignalSchema: () => runCancelSignalSchema,
84
98
  snapshotExactArray: () => snapshotExactArray,
85
99
  snapshotExactRecord: () => snapshotExactRecord,
86
100
  snapshotProjectRoomBotMembershipRealtime: () => snapshotProjectRoomBotMembershipRealtime,
87
101
  snapshotProjectRoomMembershipRealtime: () => snapshotProjectRoomMembershipRealtime,
88
102
  snapshotProjectRoomMessageRealtime: () => snapshotProjectRoomMessageRealtime,
103
+ storeExpiresAt: () => storeExpiresAt,
104
+ storePaginationValue: () => storePaginationValue,
89
105
  taskBeliefStatesEqual: () => taskBeliefStatesEqual,
90
106
  threadAffinityHeaders: () => threadAffinityHeaders,
91
107
  toModelKey: () => toModelKey,
@@ -99,15 +115,11 @@ module.exports = __toCommonJS(index_exports);
99
115
  var AgentType = /* @__PURE__ */ ((AgentType2) => {
100
116
  AgentType2["REACT"] = "react";
101
117
  AgentType2["DEEP_AGENT"] = "deep_agent";
102
- AgentType2["TEAM"] = "team";
103
118
  AgentType2["PROCESSING"] = "processing";
104
119
  AgentType2["A2A_REMOTE"] = "a2a_remote";
105
120
  AgentType2["WORKFLOW"] = "workflow";
106
121
  return AgentType2;
107
122
  })(AgentType || {});
108
- function isTeamAgentConfig(config) {
109
- return config.type === "team" /* TEAM */;
110
- }
111
123
  function isA2ARemoteAgentConfig(config) {
112
124
  return config.type === "a2a_remote" /* A2A_REMOTE */;
113
125
  }
@@ -676,6 +688,108 @@ function isRecord2(value) {
676
688
  var PROJECT_ROOM_TASK_DELEGATED_LABEL = "Task delegated";
677
689
  var PROJECT_ROOM_TASK_DELEGATED_SEPARATOR = " \xB7 ";
678
690
 
691
+ // src/StoreProtocol.ts
692
+ var STORE_IDENTITY_SEPARATOR = "";
693
+ var StoreValidationError = class extends Error {
694
+ constructor(message) {
695
+ super(message);
696
+ this.code = "STORE_IDENTITY_INVALID";
697
+ this.name = "StoreValidationError";
698
+ }
699
+ };
700
+ function validStoreSegment(value) {
701
+ return typeof value === "string" && value.length > 0 && !value.includes(STORE_IDENTITY_SEPARATOR);
702
+ }
703
+ function assertStoreIdentity(namespace, key) {
704
+ if (!Array.isArray(namespace) || namespace.length === 0) {
705
+ throw new StoreValidationError("namespace must be a non-empty string array");
706
+ }
707
+ for (const segment of namespace) {
708
+ if (!validStoreSegment(segment)) {
709
+ throw new StoreValidationError(
710
+ "namespace segments must be non-empty strings without the reserved separator"
711
+ );
712
+ }
713
+ }
714
+ if (!validStoreSegment(key)) {
715
+ throw new StoreValidationError(
716
+ "key must be a non-empty string without the reserved separator"
717
+ );
718
+ }
719
+ }
720
+ function assertStoreNamespacePrefix(prefix) {
721
+ if (!Array.isArray(prefix)) {
722
+ throw new StoreValidationError("namespace prefix must be a string array");
723
+ }
724
+ for (const segment of prefix) {
725
+ if (!validStoreSegment(segment)) {
726
+ throw new StoreValidationError(
727
+ "namespace segments must be non-empty strings without the reserved separator"
728
+ );
729
+ }
730
+ }
731
+ }
732
+ function storeExpiresAt(ttlMinutes, now = /* @__PURE__ */ new Date()) {
733
+ if (ttlMinutes === void 0) return void 0;
734
+ if (typeof ttlMinutes !== "number" || !Number.isFinite(ttlMinutes) || ttlMinutes <= 0) {
735
+ throw new StoreValidationError("ttlMinutes must be a positive number");
736
+ }
737
+ const expiresAt = new Date(now.getTime() + ttlMinutes * 6e4);
738
+ if (!Number.isFinite(expiresAt.getTime()) || expiresAt.getUTCFullYear() > 9999) {
739
+ throw new StoreValidationError("ttlMinutes is out of range");
740
+ }
741
+ return expiresAt;
742
+ }
743
+ function storePaginationValue(value, fallback) {
744
+ if (value === void 0) return fallback;
745
+ if (!Number.isSafeInteger(value) || value < 0) {
746
+ throw new StoreValidationError("limit/offset must be a non-negative safe integer");
747
+ }
748
+ return value;
749
+ }
750
+
751
+ // src/ChannelReplyJobProtocol.ts
752
+ var CHANNEL_REPLY_JOB_LIST_LIMIT_MIN = 1;
753
+ var CHANNEL_REPLY_JOB_LIST_LIMIT_MAX = 200;
754
+ var CHANNEL_REPLY_JOB_LIST_LIMIT_DEFAULT = 100;
755
+ function normalizeChannelReplyJobListLimit(limit) {
756
+ if (limit === void 0 || !Number.isFinite(limit)) {
757
+ return CHANNEL_REPLY_JOB_LIST_LIMIT_DEFAULT;
758
+ }
759
+ return Math.min(
760
+ CHANNEL_REPLY_JOB_LIST_LIMIT_MAX,
761
+ Math.max(CHANNEL_REPLY_JOB_LIST_LIMIT_MIN, Math.trunc(limit))
762
+ );
763
+ }
764
+ function assertValidCreateChannelReplyJobInput(input) {
765
+ if (input === null || typeof input !== "object") {
766
+ throw new Error("ChannelReplyJob create input is required");
767
+ }
768
+ const required = [
769
+ ["runId", input.runId],
770
+ ["tenantId", input.tenantId],
771
+ ["assistantId", input.assistantId],
772
+ ["threadId", input.threadId],
773
+ ["adapterChannel", input.adapterChannel],
774
+ ["channelInstallationId", input.channelInstallationId],
775
+ ["inputMessageId", input.inputMessageId]
776
+ ];
777
+ for (const [field, value] of required) {
778
+ if (typeof value !== "string" || value.trim() === "") {
779
+ throw new Error(`ChannelReplyJob requires a non-empty ${field}`);
780
+ }
781
+ }
782
+ if (typeof input.replyTarget !== "object" || input.replyTarget === null || Array.isArray(input.replyTarget)) {
783
+ throw new Error("ChannelReplyJob requires a replyTarget object");
784
+ }
785
+ if (typeof input.availableAt !== "number" || !Number.isFinite(input.availableAt)) {
786
+ throw new Error("ChannelReplyJob requires a finite availableAt");
787
+ }
788
+ if (input.streamCursor !== void 0 && input.streamCursor !== null && typeof input.streamCursor !== "string") {
789
+ throw new Error("ChannelReplyJob streamCursor must be a string");
790
+ }
791
+ }
792
+
679
793
  // src/ExactDataSnapshot.ts
680
794
  function ownDescriptorField(descriptor, key) {
681
795
  const field = Object.getOwnPropertyDescriptor(descriptor, key);
@@ -1038,6 +1152,32 @@ function resolveRunScope(runConfig) {
1038
1152
  };
1039
1153
  }
1040
1154
 
1155
+ // src/RunCancelProtocol.ts
1156
+ var import_zod = require("zod");
1157
+ var MAX_FIELD_LENGTH = 64 * 1024;
1158
+ var boundedString = import_zod.z.string().min(1).max(MAX_FIELD_LENGTH);
1159
+ var RUN_CANCEL_REASONS = ["abort", "a2a.cancel", "shutdown"];
1160
+ var runCancelSignalSchema = import_zod.z.object({
1161
+ commandId: boundedString,
1162
+ tenantId: boundedString,
1163
+ assistantId: boundedString,
1164
+ threadId: boundedString,
1165
+ runId: boundedString,
1166
+ reason: import_zod.z.enum(RUN_CANCEL_REASONS),
1167
+ createdAt: boundedString
1168
+ }).strict();
1169
+ var interruptAnswerKeySchema = import_zod.z.object({
1170
+ tenantId: boundedString,
1171
+ assistantId: boundedString,
1172
+ threadId: boundedString,
1173
+ interruptId: boundedString
1174
+ }).strict();
1175
+ var a2aEventCursorSchema = import_zod.z.object({
1176
+ taskId: boundedString,
1177
+ lastEventId: boundedString,
1178
+ updatedAt: boundedString
1179
+ }).strict();
1180
+
1041
1181
  // src/AgentAffinity.ts
1042
1182
  var AGENT_AFFINITY_HEADER = "x-axiom-affinity";
1043
1183
  var REPLICA_HEADER = "x-axiom-replica";
@@ -1074,6 +1214,7 @@ function effectiveGrants(record) {
1074
1214
 
1075
1215
  // src/McpUiProtocol.ts
1076
1216
  var MODES = ["inline", "fullscreen", "pip"];
1217
+ var MAX_MCP_UI_SCOPE_LENGTH = 4096;
1077
1218
  var isObj = (v) => typeof v === "object" && v !== null;
1078
1219
  function isMcpUiRef(value) {
1079
1220
  return parseMcpUiRef(value) !== null;
@@ -1093,27 +1234,47 @@ function parseMcpUiRef(value) {
1093
1234
  };
1094
1235
  }
1095
1236
  if (value.kind === "plugin" && typeof value.pluginType === "string" && typeof value.resource === "string") {
1096
- return { kind: "plugin", pluginType: value.pluginType, resource: value.resource, displayMode, ...title ? { title } : {} };
1237
+ const scope = typeof value.scope === "string" && value.scope.length > 0 && value.scope.length <= MAX_MCP_UI_SCOPE_LENGTH ? value.scope : void 0;
1238
+ return {
1239
+ kind: "plugin",
1240
+ pluginType: value.pluginType,
1241
+ resource: value.resource,
1242
+ displayMode,
1243
+ ...title ? { title } : {},
1244
+ ...scope ? { scope } : {}
1245
+ };
1097
1246
  }
1098
1247
  return null;
1099
1248
  }
1249
+
1250
+ // src/ObservabilityDashboardProtocol.ts
1251
+ var OBSERVABILITY_DASHBOARD_ELEMENT_KEY_PREFIX = "observability_dashboard_";
1252
+ function observabilityDashboardElementKey(provider) {
1253
+ return `${OBSERVABILITY_DASHBOARD_ELEMENT_KEY_PREFIX}${provider}`;
1254
+ }
1255
+ var LANGFUSE_OBSERVABILITY_DASHBOARD_VERSION = 3;
1100
1256
  // Annotate the CommonJS export names for ESM import in node:
1101
1257
  0 && (module.exports = {
1102
1258
  AFFINITY_ECHO_HEADER,
1103
1259
  AFFINITY_MISS_CODE,
1104
1260
  AGENT_AFFINITY_HEADER,
1105
1261
  AgentType,
1262
+ CHANNEL_REPLY_JOB_LIST_LIMIT_DEFAULT,
1263
+ CHANNEL_REPLY_JOB_LIST_LIMIT_MAX,
1264
+ CHANNEL_REPLY_JOB_LIST_LIMIT_MIN,
1106
1265
  ChannelBindingMigrationConflictError,
1107
1266
  DuplicateChannelBindingSubjectError,
1108
1267
  EXECUTION_RESULT_EVENT_KEY_PATTERN,
1109
1268
  EXECUTION_RESULT_EVENT_KEY_PATTERN_SOURCE,
1110
1269
  EXECUTION_RESULT_EVENT_KEY_PREFIX,
1111
1270
  InvalidProjectCapabilityBundleConfigError,
1271
+ LANGFUSE_OBSERVABILITY_DASHBOARD_VERSION,
1112
1272
  LoggerType,
1113
1273
  MAX_PENDING_EXECUTION_RESULTS_LIMIT,
1114
1274
  McpMessageType,
1115
1275
  MemoryType,
1116
1276
  MessageChunkTypes,
1277
+ OBSERVABILITY_DASHBOARD_ELEMENT_KEY_PREFIX,
1117
1278
  PROJECT_ROOM_TASK_DELEGATED_LABEL,
1118
1279
  PROJECT_ROOM_TASK_DELEGATED_SEPARATOR,
1119
1280
  PROJECT_ROOM_USER_CHANNEL_PROJECT,
@@ -1123,13 +1284,19 @@ function parseMcpUiRef(value) {
1123
1284
  ProjectTaskStoreUnsupportedError,
1124
1285
  QueueType,
1125
1286
  REPLICA_HEADER,
1287
+ STORE_IDENTITY_SEPARATOR,
1126
1288
  ScheduleExecutionType,
1127
1289
  ScheduleType,
1128
1290
  ScheduledTaskStatus,
1291
+ StoreValidationError,
1129
1292
  UIComponentType,
1130
1293
  WORKSPACE_PUBLIC_ROOM_PROJECT_PREFIX,
1294
+ a2aEventCursorSchema,
1131
1295
  affinityEchoHeaders,
1132
1296
  assertGenericProjectConfig,
1297
+ assertStoreIdentity,
1298
+ assertStoreNamespacePrefix,
1299
+ assertValidCreateChannelReplyJobInput,
1133
1300
  buildAffinityMissChunk,
1134
1301
  createAgentWebAppStreamProjectionContext,
1135
1302
  descriptorDataValue,
@@ -1138,16 +1305,18 @@ function parseMcpUiRef(value) {
1138
1305
  getSubAgentsFromConfig,
1139
1306
  getToolsFromConfig,
1140
1307
  hasTools,
1308
+ interruptAnswerKeySchema,
1141
1309
  isA2ARemoteAgentConfig,
1142
1310
  isDeepAgentConfig,
1143
1311
  isExecutionResultEventKey,
1144
1312
  isMcpUiRef,
1145
1313
  isProcessingAgentConfig,
1146
1314
  isProjectRoomEventId,
1147
- isTeamAgentConfig,
1148
1315
  isWorkflowAgentConfig,
1149
1316
  isWorkspacePublicRoomProjectId,
1317
+ normalizeChannelReplyJobListLimit,
1150
1318
  normalizeTaskMetadataScalar,
1319
+ observabilityDashboardElementKey,
1151
1320
  parseAgentWebAppGenUIBlock,
1152
1321
  parseMcpUiRef,
1153
1322
  parseModelKey,
@@ -1160,11 +1329,14 @@ function parseMcpUiRef(value) {
1160
1329
  replaceTaskBeliefState,
1161
1330
  requireProjectTaskWorkItemStore,
1162
1331
  resolveRunScope,
1332
+ runCancelSignalSchema,
1163
1333
  snapshotExactArray,
1164
1334
  snapshotExactRecord,
1165
1335
  snapshotProjectRoomBotMembershipRealtime,
1166
1336
  snapshotProjectRoomMembershipRealtime,
1167
1337
  snapshotProjectRoomMessageRealtime,
1338
+ storeExpiresAt,
1339
+ storePaginationValue,
1168
1340
  taskBeliefStatesEqual,
1169
1341
  threadAffinityHeaders,
1170
1342
  toModelKey,