@axiom-lattice/protocols 4.6.1 → 4.7.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
@@ -937,6 +937,31 @@ function resolveRunScope(runConfig) {
937
937
  };
938
938
  }
939
939
 
940
+ // src/AgentAffinity.ts
941
+ var AGENT_AFFINITY_HEADER = "x-axiom-affinity";
942
+ var REPLICA_HEADER = "x-axiom-replica";
943
+ var AFFINITY_ECHO_HEADER = "x-axiom-affinity-echo";
944
+ function affinityEchoHeaders(value) {
945
+ const single = Array.isArray(value) ? value[0] : value;
946
+ return typeof single === "string" && single.length > 0 ? { [AFFINITY_ECHO_HEADER]: single } : {};
947
+ }
948
+ var AFFINITY_MISS_CODE = "AFFINITY_MISS";
949
+ function threadAffinityHeaders(threadId) {
950
+ return threadId ? { [AGENT_AFFINITY_HEADER]: threadId } : {};
951
+ }
952
+ function buildAffinityMissChunk(owner, threadId) {
953
+ return {
954
+ type: "error",
955
+ data: {
956
+ id: "",
957
+ content: "Run is owned by another replica",
958
+ code: AFFINITY_MISS_CODE,
959
+ owner,
960
+ thread_id: threadId
961
+ }
962
+ };
963
+ }
964
+
940
965
  // src/OpenProtocol.ts
941
966
  function effectiveGrants(record) {
942
967
  if (record.grants && record.grants.length > 0) return record.grants;
@@ -972,6 +997,9 @@ function parseMcpUiRef(value) {
972
997
  return null;
973
998
  }
974
999
  export {
1000
+ AFFINITY_ECHO_HEADER,
1001
+ AFFINITY_MISS_CODE,
1002
+ AGENT_AFFINITY_HEADER,
975
1003
  AgentType,
976
1004
  ChannelBindingMigrationConflictError,
977
1005
  DuplicateChannelBindingSubjectError,
@@ -992,12 +1020,15 @@ export {
992
1020
  ProjectRoomCursorError,
993
1021
  ProjectTaskStoreUnsupportedError,
994
1022
  QueueType,
1023
+ REPLICA_HEADER,
995
1024
  ScheduleExecutionType,
996
1025
  ScheduleType,
997
1026
  ScheduledTaskStatus,
998
1027
  UIComponentType,
999
1028
  WORKSPACE_PUBLIC_ROOM_PROJECT_PREFIX,
1029
+ affinityEchoHeaders,
1000
1030
  assertGenericProjectConfig,
1031
+ buildAffinityMissChunk,
1001
1032
  createAgentWebAppStreamProjectionContext,
1002
1033
  descriptorDataValue,
1003
1034
  effectiveGrants,
@@ -1033,6 +1064,7 @@ export {
1033
1064
  snapshotProjectRoomMembershipRealtime,
1034
1065
  snapshotProjectRoomMessageRealtime,
1035
1066
  taskBeliefStatesEqual,
1067
+ threadAffinityHeaders,
1036
1068
  toModelKey,
1037
1069
  toProjectRoomPublicBotMembership,
1038
1070
  toProjectRoomPublicMembership,