@axiom-lattice/protocols 4.6.1 → 4.7.1
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 +66 -0
- package/dist/index.d.mts +159 -2
- package/dist/index.d.ts +159 -2
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/AgentAffinity.ts +50 -0
- package/src/ConnectionStoreProtocol.ts +36 -0
- package/src/LeaseStoreProtocol.ts +44 -0
- package/src/OutboxStoreProtocol.ts +30 -0
- package/src/ProjectRoomRealtimeProtocol.ts +1 -1
- package/src/ScheduleLatticeProtocol.ts +18 -0
- package/src/__tests__/agentAffinity.test.ts +45 -0
- package/src/index.ts +3 -0
package/dist/index.js
CHANGED
|
@@ -20,6 +20,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
AFFINITY_ECHO_HEADER: () => AFFINITY_ECHO_HEADER,
|
|
24
|
+
AFFINITY_MISS_CODE: () => AFFINITY_MISS_CODE,
|
|
25
|
+
AGENT_AFFINITY_HEADER: () => AGENT_AFFINITY_HEADER,
|
|
23
26
|
AgentType: () => AgentType,
|
|
24
27
|
ChannelBindingMigrationConflictError: () => ChannelBindingMigrationConflictError,
|
|
25
28
|
DuplicateChannelBindingSubjectError: () => DuplicateChannelBindingSubjectError,
|
|
@@ -40,12 +43,15 @@ __export(index_exports, {
|
|
|
40
43
|
ProjectRoomCursorError: () => ProjectRoomCursorError,
|
|
41
44
|
ProjectTaskStoreUnsupportedError: () => ProjectTaskStoreUnsupportedError,
|
|
42
45
|
QueueType: () => QueueType,
|
|
46
|
+
REPLICA_HEADER: () => REPLICA_HEADER,
|
|
43
47
|
ScheduleExecutionType: () => ScheduleExecutionType,
|
|
44
48
|
ScheduleType: () => ScheduleType,
|
|
45
49
|
ScheduledTaskStatus: () => ScheduledTaskStatus,
|
|
46
50
|
UIComponentType: () => UIComponentType,
|
|
47
51
|
WORKSPACE_PUBLIC_ROOM_PROJECT_PREFIX: () => WORKSPACE_PUBLIC_ROOM_PROJECT_PREFIX,
|
|
52
|
+
affinityEchoHeaders: () => affinityEchoHeaders,
|
|
48
53
|
assertGenericProjectConfig: () => assertGenericProjectConfig,
|
|
54
|
+
buildAffinityMissChunk: () => buildAffinityMissChunk,
|
|
49
55
|
createAgentWebAppStreamProjectionContext: () => createAgentWebAppStreamProjectionContext,
|
|
50
56
|
descriptorDataValue: () => descriptorDataValue,
|
|
51
57
|
effectiveGrants: () => effectiveGrants,
|
|
@@ -81,6 +87,7 @@ __export(index_exports, {
|
|
|
81
87
|
snapshotProjectRoomMembershipRealtime: () => snapshotProjectRoomMembershipRealtime,
|
|
82
88
|
snapshotProjectRoomMessageRealtime: () => snapshotProjectRoomMessageRealtime,
|
|
83
89
|
taskBeliefStatesEqual: () => taskBeliefStatesEqual,
|
|
90
|
+
threadAffinityHeaders: () => threadAffinityHeaders,
|
|
84
91
|
toModelKey: () => toModelKey,
|
|
85
92
|
toProjectRoomPublicBotMembership: () => toProjectRoomPublicBotMembership,
|
|
86
93
|
toProjectRoomPublicMembership: () => toProjectRoomPublicMembership,
|
|
@@ -1027,6 +1034,31 @@ function resolveRunScope(runConfig) {
|
|
|
1027
1034
|
};
|
|
1028
1035
|
}
|
|
1029
1036
|
|
|
1037
|
+
// src/AgentAffinity.ts
|
|
1038
|
+
var AGENT_AFFINITY_HEADER = "x-axiom-affinity";
|
|
1039
|
+
var REPLICA_HEADER = "x-axiom-replica";
|
|
1040
|
+
var AFFINITY_ECHO_HEADER = "x-axiom-affinity-echo";
|
|
1041
|
+
function affinityEchoHeaders(value) {
|
|
1042
|
+
const single = Array.isArray(value) ? value[0] : value;
|
|
1043
|
+
return typeof single === "string" && single.length > 0 ? { [AFFINITY_ECHO_HEADER]: single } : {};
|
|
1044
|
+
}
|
|
1045
|
+
var AFFINITY_MISS_CODE = "AFFINITY_MISS";
|
|
1046
|
+
function threadAffinityHeaders(threadId) {
|
|
1047
|
+
return threadId ? { [AGENT_AFFINITY_HEADER]: threadId } : {};
|
|
1048
|
+
}
|
|
1049
|
+
function buildAffinityMissChunk(owner, threadId) {
|
|
1050
|
+
return {
|
|
1051
|
+
type: "error",
|
|
1052
|
+
data: {
|
|
1053
|
+
id: "",
|
|
1054
|
+
content: "Run is owned by another replica",
|
|
1055
|
+
code: AFFINITY_MISS_CODE,
|
|
1056
|
+
owner,
|
|
1057
|
+
thread_id: threadId
|
|
1058
|
+
}
|
|
1059
|
+
};
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1030
1062
|
// src/OpenProtocol.ts
|
|
1031
1063
|
function effectiveGrants(record) {
|
|
1032
1064
|
if (record.grants && record.grants.length > 0) return record.grants;
|
|
@@ -1063,6 +1095,9 @@ function parseMcpUiRef(value) {
|
|
|
1063
1095
|
}
|
|
1064
1096
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1065
1097
|
0 && (module.exports = {
|
|
1098
|
+
AFFINITY_ECHO_HEADER,
|
|
1099
|
+
AFFINITY_MISS_CODE,
|
|
1100
|
+
AGENT_AFFINITY_HEADER,
|
|
1066
1101
|
AgentType,
|
|
1067
1102
|
ChannelBindingMigrationConflictError,
|
|
1068
1103
|
DuplicateChannelBindingSubjectError,
|
|
@@ -1083,12 +1118,15 @@ function parseMcpUiRef(value) {
|
|
|
1083
1118
|
ProjectRoomCursorError,
|
|
1084
1119
|
ProjectTaskStoreUnsupportedError,
|
|
1085
1120
|
QueueType,
|
|
1121
|
+
REPLICA_HEADER,
|
|
1086
1122
|
ScheduleExecutionType,
|
|
1087
1123
|
ScheduleType,
|
|
1088
1124
|
ScheduledTaskStatus,
|
|
1089
1125
|
UIComponentType,
|
|
1090
1126
|
WORKSPACE_PUBLIC_ROOM_PROJECT_PREFIX,
|
|
1127
|
+
affinityEchoHeaders,
|
|
1091
1128
|
assertGenericProjectConfig,
|
|
1129
|
+
buildAffinityMissChunk,
|
|
1092
1130
|
createAgentWebAppStreamProjectionContext,
|
|
1093
1131
|
descriptorDataValue,
|
|
1094
1132
|
effectiveGrants,
|
|
@@ -1124,6 +1162,7 @@ function parseMcpUiRef(value) {
|
|
|
1124
1162
|
snapshotProjectRoomMembershipRealtime,
|
|
1125
1163
|
snapshotProjectRoomMessageRealtime,
|
|
1126
1164
|
taskBeliefStatesEqual,
|
|
1165
|
+
threadAffinityHeaders,
|
|
1127
1166
|
toModelKey,
|
|
1128
1167
|
toProjectRoomPublicBotMembership,
|
|
1129
1168
|
toProjectRoomPublicMembership,
|