@axiom-lattice/protocols 4.10.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 +113 -0
- package/dist/index.d.mts +506 -44
- package/dist/index.d.ts +506 -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 +17 -0
- package/src/ChannelReplyJobProtocol.ts +184 -0
- package/src/CheckpointStorageProtocol.ts +98 -0
- package/src/MessageProtocol.ts +8 -0
- package/src/ModelProviderProtocol.ts +65 -0
- package/src/RunCancelProtocol.ts +76 -0
- package/src/StoreProtocol.ts +181 -0
- package/src/ThreadStoreProtocol.ts +24 -0
- package/src/VectorStoreProviderProtocol.ts +9 -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.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";
|
|
@@ -1005,6 +1129,9 @@ export {
|
|
|
1005
1129
|
AFFINITY_MISS_CODE,
|
|
1006
1130
|
AGENT_AFFINITY_HEADER,
|
|
1007
1131
|
AgentType,
|
|
1132
|
+
CHANNEL_REPLY_JOB_LIST_LIMIT_DEFAULT,
|
|
1133
|
+
CHANNEL_REPLY_JOB_LIST_LIMIT_MAX,
|
|
1134
|
+
CHANNEL_REPLY_JOB_LIST_LIMIT_MIN,
|
|
1008
1135
|
ChannelBindingMigrationConflictError,
|
|
1009
1136
|
DuplicateChannelBindingSubjectError,
|
|
1010
1137
|
EXECUTION_RESULT_EVENT_KEY_PATTERN,
|
|
@@ -1025,13 +1152,19 @@ export {
|
|
|
1025
1152
|
ProjectTaskStoreUnsupportedError,
|
|
1026
1153
|
QueueType,
|
|
1027
1154
|
REPLICA_HEADER,
|
|
1155
|
+
STORE_IDENTITY_SEPARATOR,
|
|
1028
1156
|
ScheduleExecutionType,
|
|
1029
1157
|
ScheduleType,
|
|
1030
1158
|
ScheduledTaskStatus,
|
|
1159
|
+
StoreValidationError,
|
|
1031
1160
|
UIComponentType,
|
|
1032
1161
|
WORKSPACE_PUBLIC_ROOM_PROJECT_PREFIX,
|
|
1162
|
+
a2aEventCursorSchema,
|
|
1033
1163
|
affinityEchoHeaders,
|
|
1034
1164
|
assertGenericProjectConfig,
|
|
1165
|
+
assertStoreIdentity,
|
|
1166
|
+
assertStoreNamespacePrefix,
|
|
1167
|
+
assertValidCreateChannelReplyJobInput,
|
|
1035
1168
|
buildAffinityMissChunk,
|
|
1036
1169
|
createAgentWebAppStreamProjectionContext,
|
|
1037
1170
|
descriptorDataValue,
|
|
@@ -1040,15 +1173,16 @@ export {
|
|
|
1040
1173
|
getSubAgentsFromConfig,
|
|
1041
1174
|
getToolsFromConfig,
|
|
1042
1175
|
hasTools,
|
|
1176
|
+
interruptAnswerKeySchema,
|
|
1043
1177
|
isA2ARemoteAgentConfig,
|
|
1044
1178
|
isDeepAgentConfig,
|
|
1045
1179
|
isExecutionResultEventKey,
|
|
1046
1180
|
isMcpUiRef,
|
|
1047
1181
|
isProcessingAgentConfig,
|
|
1048
1182
|
isProjectRoomEventId,
|
|
1049
|
-
isTeamAgentConfig,
|
|
1050
1183
|
isWorkflowAgentConfig,
|
|
1051
1184
|
isWorkspacePublicRoomProjectId,
|
|
1185
|
+
normalizeChannelReplyJobListLimit,
|
|
1052
1186
|
normalizeTaskMetadataScalar,
|
|
1053
1187
|
parseAgentWebAppGenUIBlock,
|
|
1054
1188
|
parseMcpUiRef,
|
|
@@ -1062,11 +1196,14 @@ export {
|
|
|
1062
1196
|
replaceTaskBeliefState,
|
|
1063
1197
|
requireProjectTaskWorkItemStore,
|
|
1064
1198
|
resolveRunScope,
|
|
1199
|
+
runCancelSignalSchema,
|
|
1065
1200
|
snapshotExactArray,
|
|
1066
1201
|
snapshotExactRecord,
|
|
1067
1202
|
snapshotProjectRoomBotMembershipRealtime,
|
|
1068
1203
|
snapshotProjectRoomMembershipRealtime,
|
|
1069
1204
|
snapshotProjectRoomMessageRealtime,
|
|
1205
|
+
storeExpiresAt,
|
|
1206
|
+
storePaginationValue,
|
|
1070
1207
|
taskBeliefStatesEqual,
|
|
1071
1208
|
threadAffinityHeaders,
|
|
1072
1209
|
toModelKey,
|