@axiom-lattice/protocols 4.11.0 → 5.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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +83 -0
- package/dist/index.d.mts +431 -44
- package/dist/index.d.ts +431 -44
- package/dist/index.js +156 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +142 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/AgentInterruptProtocol.ts +15 -0
- package/src/AgentLatticeProtocol.ts +0 -49
- package/src/AgentWebAppRuntimeProtocol.ts +2 -0
- package/src/ChannelAdapterProtocol.ts +10 -0
- package/src/ChannelReplyJobProtocol.ts +184 -0
- package/src/CheckpointStorageProtocol.ts +98 -0
- package/src/MessageProtocol.ts +8 -0
- package/src/RunCancelProtocol.ts +76 -0
- package/src/StoreProtocol.ts +181 -0
- package/src/ThreadStoreProtocol.ts +24 -0
- package/src/__tests__/RunCancelProtocol.test.ts +148 -0
- package/src/__tests__/agent-web-app-types.test.ts +4 -0
- package/src/index.ts +5 -0
package/dist/index.js
CHANGED
|
@@ -24,6 +24,9 @@ __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,
|
|
@@ -44,13 +47,19 @@ __export(index_exports, {
|
|
|
44
47
|
ProjectTaskStoreUnsupportedError: () => ProjectTaskStoreUnsupportedError,
|
|
45
48
|
QueueType: () => QueueType,
|
|
46
49
|
REPLICA_HEADER: () => REPLICA_HEADER,
|
|
50
|
+
STORE_IDENTITY_SEPARATOR: () => STORE_IDENTITY_SEPARATOR,
|
|
47
51
|
ScheduleExecutionType: () => ScheduleExecutionType,
|
|
48
52
|
ScheduleType: () => ScheduleType,
|
|
49
53
|
ScheduledTaskStatus: () => ScheduledTaskStatus,
|
|
54
|
+
StoreValidationError: () => StoreValidationError,
|
|
50
55
|
UIComponentType: () => UIComponentType,
|
|
51
56
|
WORKSPACE_PUBLIC_ROOM_PROJECT_PREFIX: () => WORKSPACE_PUBLIC_ROOM_PROJECT_PREFIX,
|
|
57
|
+
a2aEventCursorSchema: () => a2aEventCursorSchema,
|
|
52
58
|
affinityEchoHeaders: () => affinityEchoHeaders,
|
|
53
59
|
assertGenericProjectConfig: () => assertGenericProjectConfig,
|
|
60
|
+
assertStoreIdentity: () => assertStoreIdentity,
|
|
61
|
+
assertStoreNamespacePrefix: () => assertStoreNamespacePrefix,
|
|
62
|
+
assertValidCreateChannelReplyJobInput: () => assertValidCreateChannelReplyJobInput,
|
|
54
63
|
buildAffinityMissChunk: () => buildAffinityMissChunk,
|
|
55
64
|
createAgentWebAppStreamProjectionContext: () => createAgentWebAppStreamProjectionContext,
|
|
56
65
|
descriptorDataValue: () => descriptorDataValue,
|
|
@@ -59,15 +68,16 @@ __export(index_exports, {
|
|
|
59
68
|
getSubAgentsFromConfig: () => getSubAgentsFromConfig,
|
|
60
69
|
getToolsFromConfig: () => getToolsFromConfig,
|
|
61
70
|
hasTools: () => hasTools,
|
|
71
|
+
interruptAnswerKeySchema: () => interruptAnswerKeySchema,
|
|
62
72
|
isA2ARemoteAgentConfig: () => isA2ARemoteAgentConfig,
|
|
63
73
|
isDeepAgentConfig: () => isDeepAgentConfig,
|
|
64
74
|
isExecutionResultEventKey: () => isExecutionResultEventKey,
|
|
65
75
|
isMcpUiRef: () => isMcpUiRef,
|
|
66
76
|
isProcessingAgentConfig: () => isProcessingAgentConfig,
|
|
67
77
|
isProjectRoomEventId: () => isProjectRoomEventId,
|
|
68
|
-
isTeamAgentConfig: () => isTeamAgentConfig,
|
|
69
78
|
isWorkflowAgentConfig: () => isWorkflowAgentConfig,
|
|
70
79
|
isWorkspacePublicRoomProjectId: () => isWorkspacePublicRoomProjectId,
|
|
80
|
+
normalizeChannelReplyJobListLimit: () => normalizeChannelReplyJobListLimit,
|
|
71
81
|
normalizeTaskMetadataScalar: () => normalizeTaskMetadataScalar,
|
|
72
82
|
parseAgentWebAppGenUIBlock: () => parseAgentWebAppGenUIBlock,
|
|
73
83
|
parseMcpUiRef: () => parseMcpUiRef,
|
|
@@ -81,11 +91,14 @@ __export(index_exports, {
|
|
|
81
91
|
replaceTaskBeliefState: () => replaceTaskBeliefState,
|
|
82
92
|
requireProjectTaskWorkItemStore: () => requireProjectTaskWorkItemStore,
|
|
83
93
|
resolveRunScope: () => resolveRunScope,
|
|
94
|
+
runCancelSignalSchema: () => runCancelSignalSchema,
|
|
84
95
|
snapshotExactArray: () => snapshotExactArray,
|
|
85
96
|
snapshotExactRecord: () => snapshotExactRecord,
|
|
86
97
|
snapshotProjectRoomBotMembershipRealtime: () => snapshotProjectRoomBotMembershipRealtime,
|
|
87
98
|
snapshotProjectRoomMembershipRealtime: () => snapshotProjectRoomMembershipRealtime,
|
|
88
99
|
snapshotProjectRoomMessageRealtime: () => snapshotProjectRoomMessageRealtime,
|
|
100
|
+
storeExpiresAt: () => storeExpiresAt,
|
|
101
|
+
storePaginationValue: () => storePaginationValue,
|
|
89
102
|
taskBeliefStatesEqual: () => taskBeliefStatesEqual,
|
|
90
103
|
threadAffinityHeaders: () => threadAffinityHeaders,
|
|
91
104
|
toModelKey: () => toModelKey,
|
|
@@ -99,15 +112,11 @@ module.exports = __toCommonJS(index_exports);
|
|
|
99
112
|
var AgentType = /* @__PURE__ */ ((AgentType2) => {
|
|
100
113
|
AgentType2["REACT"] = "react";
|
|
101
114
|
AgentType2["DEEP_AGENT"] = "deep_agent";
|
|
102
|
-
AgentType2["TEAM"] = "team";
|
|
103
115
|
AgentType2["PROCESSING"] = "processing";
|
|
104
116
|
AgentType2["A2A_REMOTE"] = "a2a_remote";
|
|
105
117
|
AgentType2["WORKFLOW"] = "workflow";
|
|
106
118
|
return AgentType2;
|
|
107
119
|
})(AgentType || {});
|
|
108
|
-
function isTeamAgentConfig(config) {
|
|
109
|
-
return config.type === "team" /* TEAM */;
|
|
110
|
-
}
|
|
111
120
|
function isA2ARemoteAgentConfig(config) {
|
|
112
121
|
return config.type === "a2a_remote" /* A2A_REMOTE */;
|
|
113
122
|
}
|
|
@@ -676,6 +685,108 @@ function isRecord2(value) {
|
|
|
676
685
|
var PROJECT_ROOM_TASK_DELEGATED_LABEL = "Task delegated";
|
|
677
686
|
var PROJECT_ROOM_TASK_DELEGATED_SEPARATOR = " \xB7 ";
|
|
678
687
|
|
|
688
|
+
// src/StoreProtocol.ts
|
|
689
|
+
var STORE_IDENTITY_SEPARATOR = "";
|
|
690
|
+
var StoreValidationError = class extends Error {
|
|
691
|
+
constructor(message) {
|
|
692
|
+
super(message);
|
|
693
|
+
this.code = "STORE_IDENTITY_INVALID";
|
|
694
|
+
this.name = "StoreValidationError";
|
|
695
|
+
}
|
|
696
|
+
};
|
|
697
|
+
function validStoreSegment(value) {
|
|
698
|
+
return typeof value === "string" && value.length > 0 && !value.includes(STORE_IDENTITY_SEPARATOR);
|
|
699
|
+
}
|
|
700
|
+
function assertStoreIdentity(namespace, key) {
|
|
701
|
+
if (!Array.isArray(namespace) || namespace.length === 0) {
|
|
702
|
+
throw new StoreValidationError("namespace must be a non-empty string array");
|
|
703
|
+
}
|
|
704
|
+
for (const segment of namespace) {
|
|
705
|
+
if (!validStoreSegment(segment)) {
|
|
706
|
+
throw new StoreValidationError(
|
|
707
|
+
"namespace segments must be non-empty strings without the reserved separator"
|
|
708
|
+
);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
if (!validStoreSegment(key)) {
|
|
712
|
+
throw new StoreValidationError(
|
|
713
|
+
"key must be a non-empty string without the reserved separator"
|
|
714
|
+
);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
function assertStoreNamespacePrefix(prefix) {
|
|
718
|
+
if (!Array.isArray(prefix)) {
|
|
719
|
+
throw new StoreValidationError("namespace prefix must be a string array");
|
|
720
|
+
}
|
|
721
|
+
for (const segment of prefix) {
|
|
722
|
+
if (!validStoreSegment(segment)) {
|
|
723
|
+
throw new StoreValidationError(
|
|
724
|
+
"namespace segments must be non-empty strings without the reserved separator"
|
|
725
|
+
);
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
function storeExpiresAt(ttlMinutes, now = /* @__PURE__ */ new Date()) {
|
|
730
|
+
if (ttlMinutes === void 0) return void 0;
|
|
731
|
+
if (typeof ttlMinutes !== "number" || !Number.isFinite(ttlMinutes) || ttlMinutes <= 0) {
|
|
732
|
+
throw new StoreValidationError("ttlMinutes must be a positive number");
|
|
733
|
+
}
|
|
734
|
+
const expiresAt = new Date(now.getTime() + ttlMinutes * 6e4);
|
|
735
|
+
if (!Number.isFinite(expiresAt.getTime()) || expiresAt.getUTCFullYear() > 9999) {
|
|
736
|
+
throw new StoreValidationError("ttlMinutes is out of range");
|
|
737
|
+
}
|
|
738
|
+
return expiresAt;
|
|
739
|
+
}
|
|
740
|
+
function storePaginationValue(value, fallback) {
|
|
741
|
+
if (value === void 0) return fallback;
|
|
742
|
+
if (!Number.isSafeInteger(value) || value < 0) {
|
|
743
|
+
throw new StoreValidationError("limit/offset must be a non-negative safe integer");
|
|
744
|
+
}
|
|
745
|
+
return value;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
// src/ChannelReplyJobProtocol.ts
|
|
749
|
+
var CHANNEL_REPLY_JOB_LIST_LIMIT_MIN = 1;
|
|
750
|
+
var CHANNEL_REPLY_JOB_LIST_LIMIT_MAX = 200;
|
|
751
|
+
var CHANNEL_REPLY_JOB_LIST_LIMIT_DEFAULT = 100;
|
|
752
|
+
function normalizeChannelReplyJobListLimit(limit) {
|
|
753
|
+
if (limit === void 0 || !Number.isFinite(limit)) {
|
|
754
|
+
return CHANNEL_REPLY_JOB_LIST_LIMIT_DEFAULT;
|
|
755
|
+
}
|
|
756
|
+
return Math.min(
|
|
757
|
+
CHANNEL_REPLY_JOB_LIST_LIMIT_MAX,
|
|
758
|
+
Math.max(CHANNEL_REPLY_JOB_LIST_LIMIT_MIN, Math.trunc(limit))
|
|
759
|
+
);
|
|
760
|
+
}
|
|
761
|
+
function assertValidCreateChannelReplyJobInput(input) {
|
|
762
|
+
if (input === null || typeof input !== "object") {
|
|
763
|
+
throw new Error("ChannelReplyJob create input is required");
|
|
764
|
+
}
|
|
765
|
+
const required = [
|
|
766
|
+
["runId", input.runId],
|
|
767
|
+
["tenantId", input.tenantId],
|
|
768
|
+
["assistantId", input.assistantId],
|
|
769
|
+
["threadId", input.threadId],
|
|
770
|
+
["adapterChannel", input.adapterChannel],
|
|
771
|
+
["channelInstallationId", input.channelInstallationId],
|
|
772
|
+
["inputMessageId", input.inputMessageId]
|
|
773
|
+
];
|
|
774
|
+
for (const [field, value] of required) {
|
|
775
|
+
if (typeof value !== "string" || value.trim() === "") {
|
|
776
|
+
throw new Error(`ChannelReplyJob requires a non-empty ${field}`);
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
if (typeof input.replyTarget !== "object" || input.replyTarget === null || Array.isArray(input.replyTarget)) {
|
|
780
|
+
throw new Error("ChannelReplyJob requires a replyTarget object");
|
|
781
|
+
}
|
|
782
|
+
if (typeof input.availableAt !== "number" || !Number.isFinite(input.availableAt)) {
|
|
783
|
+
throw new Error("ChannelReplyJob requires a finite availableAt");
|
|
784
|
+
}
|
|
785
|
+
if (input.streamCursor !== void 0 && input.streamCursor !== null && typeof input.streamCursor !== "string") {
|
|
786
|
+
throw new Error("ChannelReplyJob streamCursor must be a string");
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
|
|
679
790
|
// src/ExactDataSnapshot.ts
|
|
680
791
|
function ownDescriptorField(descriptor, key) {
|
|
681
792
|
const field = Object.getOwnPropertyDescriptor(descriptor, key);
|
|
@@ -1038,6 +1149,32 @@ function resolveRunScope(runConfig) {
|
|
|
1038
1149
|
};
|
|
1039
1150
|
}
|
|
1040
1151
|
|
|
1152
|
+
// src/RunCancelProtocol.ts
|
|
1153
|
+
var import_zod = require("zod");
|
|
1154
|
+
var MAX_FIELD_LENGTH = 64 * 1024;
|
|
1155
|
+
var boundedString = import_zod.z.string().min(1).max(MAX_FIELD_LENGTH);
|
|
1156
|
+
var RUN_CANCEL_REASONS = ["abort", "a2a.cancel", "shutdown"];
|
|
1157
|
+
var runCancelSignalSchema = import_zod.z.object({
|
|
1158
|
+
commandId: boundedString,
|
|
1159
|
+
tenantId: boundedString,
|
|
1160
|
+
assistantId: boundedString,
|
|
1161
|
+
threadId: boundedString,
|
|
1162
|
+
runId: boundedString,
|
|
1163
|
+
reason: import_zod.z.enum(RUN_CANCEL_REASONS),
|
|
1164
|
+
createdAt: boundedString
|
|
1165
|
+
}).strict();
|
|
1166
|
+
var interruptAnswerKeySchema = import_zod.z.object({
|
|
1167
|
+
tenantId: boundedString,
|
|
1168
|
+
assistantId: boundedString,
|
|
1169
|
+
threadId: boundedString,
|
|
1170
|
+
interruptId: boundedString
|
|
1171
|
+
}).strict();
|
|
1172
|
+
var a2aEventCursorSchema = import_zod.z.object({
|
|
1173
|
+
taskId: boundedString,
|
|
1174
|
+
lastEventId: boundedString,
|
|
1175
|
+
updatedAt: boundedString
|
|
1176
|
+
}).strict();
|
|
1177
|
+
|
|
1041
1178
|
// src/AgentAffinity.ts
|
|
1042
1179
|
var AGENT_AFFINITY_HEADER = "x-axiom-affinity";
|
|
1043
1180
|
var REPLICA_HEADER = "x-axiom-replica";
|
|
@@ -1103,6 +1240,9 @@ function parseMcpUiRef(value) {
|
|
|
1103
1240
|
AFFINITY_MISS_CODE,
|
|
1104
1241
|
AGENT_AFFINITY_HEADER,
|
|
1105
1242
|
AgentType,
|
|
1243
|
+
CHANNEL_REPLY_JOB_LIST_LIMIT_DEFAULT,
|
|
1244
|
+
CHANNEL_REPLY_JOB_LIST_LIMIT_MAX,
|
|
1245
|
+
CHANNEL_REPLY_JOB_LIST_LIMIT_MIN,
|
|
1106
1246
|
ChannelBindingMigrationConflictError,
|
|
1107
1247
|
DuplicateChannelBindingSubjectError,
|
|
1108
1248
|
EXECUTION_RESULT_EVENT_KEY_PATTERN,
|
|
@@ -1123,13 +1263,19 @@ function parseMcpUiRef(value) {
|
|
|
1123
1263
|
ProjectTaskStoreUnsupportedError,
|
|
1124
1264
|
QueueType,
|
|
1125
1265
|
REPLICA_HEADER,
|
|
1266
|
+
STORE_IDENTITY_SEPARATOR,
|
|
1126
1267
|
ScheduleExecutionType,
|
|
1127
1268
|
ScheduleType,
|
|
1128
1269
|
ScheduledTaskStatus,
|
|
1270
|
+
StoreValidationError,
|
|
1129
1271
|
UIComponentType,
|
|
1130
1272
|
WORKSPACE_PUBLIC_ROOM_PROJECT_PREFIX,
|
|
1273
|
+
a2aEventCursorSchema,
|
|
1131
1274
|
affinityEchoHeaders,
|
|
1132
1275
|
assertGenericProjectConfig,
|
|
1276
|
+
assertStoreIdentity,
|
|
1277
|
+
assertStoreNamespacePrefix,
|
|
1278
|
+
assertValidCreateChannelReplyJobInput,
|
|
1133
1279
|
buildAffinityMissChunk,
|
|
1134
1280
|
createAgentWebAppStreamProjectionContext,
|
|
1135
1281
|
descriptorDataValue,
|
|
@@ -1138,15 +1284,16 @@ function parseMcpUiRef(value) {
|
|
|
1138
1284
|
getSubAgentsFromConfig,
|
|
1139
1285
|
getToolsFromConfig,
|
|
1140
1286
|
hasTools,
|
|
1287
|
+
interruptAnswerKeySchema,
|
|
1141
1288
|
isA2ARemoteAgentConfig,
|
|
1142
1289
|
isDeepAgentConfig,
|
|
1143
1290
|
isExecutionResultEventKey,
|
|
1144
1291
|
isMcpUiRef,
|
|
1145
1292
|
isProcessingAgentConfig,
|
|
1146
1293
|
isProjectRoomEventId,
|
|
1147
|
-
isTeamAgentConfig,
|
|
1148
1294
|
isWorkflowAgentConfig,
|
|
1149
1295
|
isWorkspacePublicRoomProjectId,
|
|
1296
|
+
normalizeChannelReplyJobListLimit,
|
|
1150
1297
|
normalizeTaskMetadataScalar,
|
|
1151
1298
|
parseAgentWebAppGenUIBlock,
|
|
1152
1299
|
parseMcpUiRef,
|
|
@@ -1160,11 +1307,14 @@ function parseMcpUiRef(value) {
|
|
|
1160
1307
|
replaceTaskBeliefState,
|
|
1161
1308
|
requireProjectTaskWorkItemStore,
|
|
1162
1309
|
resolveRunScope,
|
|
1310
|
+
runCancelSignalSchema,
|
|
1163
1311
|
snapshotExactArray,
|
|
1164
1312
|
snapshotExactRecord,
|
|
1165
1313
|
snapshotProjectRoomBotMembershipRealtime,
|
|
1166
1314
|
snapshotProjectRoomMembershipRealtime,
|
|
1167
1315
|
snapshotProjectRoomMessageRealtime,
|
|
1316
|
+
storeExpiresAt,
|
|
1317
|
+
storePaginationValue,
|
|
1168
1318
|
taskBeliefStatesEqual,
|
|
1169
1319
|
threadAffinityHeaders,
|
|
1170
1320
|
toModelKey,
|