@axiom-lattice/protocols 4.6.0 → 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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +59 -0
- package/dist/index.d.mts +152 -2
- package/dist/index.d.ts +152 -2
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/AgentAffinity.ts +50 -0
- package/src/LeaseStoreProtocol.ts +44 -0
- package/src/OutboxStoreProtocol.ts +30 -0
- package/src/ProjectRoomRealtimeProtocol.ts +1 -1
- package/src/RunScope.ts +44 -0
- package/src/ScheduleLatticeProtocol.ts +18 -0
- package/src/__tests__/RunScope.test.ts +38 -0
- package/src/__tests__/agentAffinity.test.ts +45 -0
- package/src/index.ts +4 -0
package/dist/index.mjs
CHANGED
|
@@ -922,6 +922,46 @@ function parseQueuedExecutionMode(value) {
|
|
|
922
922
|
return value;
|
|
923
923
|
}
|
|
924
924
|
|
|
925
|
+
// src/RunScope.ts
|
|
926
|
+
function firstNonEmptyString(...values) {
|
|
927
|
+
for (const value of values) {
|
|
928
|
+
if (typeof value === "string" && value.length > 0) return value;
|
|
929
|
+
}
|
|
930
|
+
return void 0;
|
|
931
|
+
}
|
|
932
|
+
function resolveRunScope(runConfig) {
|
|
933
|
+
const rc = runConfig && typeof runConfig === "object" && !Array.isArray(runConfig) ? runConfig : {};
|
|
934
|
+
return {
|
|
935
|
+
workspaceId: firstNonEmptyString(rc.workspaceId, rc["x-workspace-id"]),
|
|
936
|
+
projectId: firstNonEmptyString(rc.projectId, rc["x-project-id"])
|
|
937
|
+
};
|
|
938
|
+
}
|
|
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
|
+
|
|
925
965
|
// src/OpenProtocol.ts
|
|
926
966
|
function effectiveGrants(record) {
|
|
927
967
|
if (record.grants && record.grants.length > 0) return record.grants;
|
|
@@ -957,6 +997,9 @@ function parseMcpUiRef(value) {
|
|
|
957
997
|
return null;
|
|
958
998
|
}
|
|
959
999
|
export {
|
|
1000
|
+
AFFINITY_ECHO_HEADER,
|
|
1001
|
+
AFFINITY_MISS_CODE,
|
|
1002
|
+
AGENT_AFFINITY_HEADER,
|
|
960
1003
|
AgentType,
|
|
961
1004
|
ChannelBindingMigrationConflictError,
|
|
962
1005
|
DuplicateChannelBindingSubjectError,
|
|
@@ -977,15 +1020,19 @@ export {
|
|
|
977
1020
|
ProjectRoomCursorError,
|
|
978
1021
|
ProjectTaskStoreUnsupportedError,
|
|
979
1022
|
QueueType,
|
|
1023
|
+
REPLICA_HEADER,
|
|
980
1024
|
ScheduleExecutionType,
|
|
981
1025
|
ScheduleType,
|
|
982
1026
|
ScheduledTaskStatus,
|
|
983
1027
|
UIComponentType,
|
|
984
1028
|
WORKSPACE_PUBLIC_ROOM_PROJECT_PREFIX,
|
|
1029
|
+
affinityEchoHeaders,
|
|
985
1030
|
assertGenericProjectConfig,
|
|
1031
|
+
buildAffinityMissChunk,
|
|
986
1032
|
createAgentWebAppStreamProjectionContext,
|
|
987
1033
|
descriptorDataValue,
|
|
988
1034
|
effectiveGrants,
|
|
1035
|
+
firstNonEmptyString,
|
|
989
1036
|
getSubAgentsFromConfig,
|
|
990
1037
|
getToolsFromConfig,
|
|
991
1038
|
hasTools,
|
|
@@ -1010,12 +1057,14 @@ export {
|
|
|
1010
1057
|
projectRoomUserEventScope,
|
|
1011
1058
|
replaceTaskBeliefState,
|
|
1012
1059
|
requireProjectTaskWorkItemStore,
|
|
1060
|
+
resolveRunScope,
|
|
1013
1061
|
snapshotExactArray,
|
|
1014
1062
|
snapshotExactRecord,
|
|
1015
1063
|
snapshotProjectRoomBotMembershipRealtime,
|
|
1016
1064
|
snapshotProjectRoomMembershipRealtime,
|
|
1017
1065
|
snapshotProjectRoomMessageRealtime,
|
|
1018
1066
|
taskBeliefStatesEqual,
|
|
1067
|
+
threadAffinityHeaders,
|
|
1019
1068
|
toModelKey,
|
|
1020
1069
|
toProjectRoomPublicBotMembership,
|
|
1021
1070
|
toProjectRoomPublicMembership,
|