@sellable/mcp 0.1.947 → 0.1.949
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/server.js +2 -1
- package/dist/tools/refill-v3-world-state-contract.d.ts +417 -0
- package/dist/tools/refill-v3-world-state-contract.js +59 -5
- package/dist/tools/refill-v3-world-state.d.ts +185 -291
- package/dist/tools/refill-v3-world-state.js +3 -3
- package/dist/tools/registry.d.ts +185 -291
- package/package.json +1 -1
- package/skills/campaign-daily-review/SKILL.md +9 -6
package/dist/server.js
CHANGED
|
@@ -65,6 +65,7 @@ import { advanceRefillV3Tool } from "./tools/refill-v3-advance.js";
|
|
|
65
65
|
import { continueRefillV3Tool } from "./tools/refill-v3-continue.js";
|
|
66
66
|
import { editRefillV3SelectedCampaignTool } from "./tools/refill-v3-edit-selected-campaign.js";
|
|
67
67
|
import { fillRefillV3ReadyTool } from "./tools/refill-v3-fill-ready.js";
|
|
68
|
+
import { projectRefillWorldStateForAgent } from "./tools/refill-v3-world-state-contract.js";
|
|
68
69
|
import { getRefillV3WorldStateTool } from "./tools/refill-v3-world-state.js";
|
|
69
70
|
import { refreshSenderEngagementCommand } from "./tools/refresh-sender-engagement.js";
|
|
70
71
|
import { allTools } from "./tools/registry.js";
|
|
@@ -476,7 +477,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
476
477
|
result = await runSchedulerSweep(args);
|
|
477
478
|
break;
|
|
478
479
|
case "refill_v3_world_state":
|
|
479
|
-
result = await getRefillV3WorldStateTool(args);
|
|
480
|
+
result = projectRefillWorldStateForAgent(await getRefillV3WorldStateTool(args));
|
|
480
481
|
break;
|
|
481
482
|
case "refill_v3_fill_ready":
|
|
482
483
|
result = await fillRefillV3ReadyTool(args);
|
|
@@ -753,6 +753,423 @@ export declare const REFILL_V3_WORLD_STATE_OUTPUT_SCHEMA: Readonly<{
|
|
|
753
753
|
};
|
|
754
754
|
};
|
|
755
755
|
}>;
|
|
756
|
+
/**
|
|
757
|
+
* What the public tool returns to an agent. Campaign facts are per campaign,
|
|
758
|
+
* so they are listed once; each row keeps only its own eligibility. Repeating
|
|
759
|
+
* them on every row made sellable.dev's observation 114,600 chars, past the
|
|
760
|
+
* agent host's 50K MCP read limit (Sep 30). `refill_v3_continue` and the
|
|
761
|
+
* backend route keep the full per-row shape.
|
|
762
|
+
*/
|
|
763
|
+
export type RefillWorldStateCampaignRef = Pick<CampaignOption, "id" | "eligible" | "reason">;
|
|
764
|
+
export type RefillWorldStateAgentCampaign = Omit<CampaignOption, "eligible" | "reason">;
|
|
765
|
+
export type RefillWorldStateAgentRow = Omit<RefillWorldStateRow, "activeCampaigns" | "inactiveCampaigns"> & {
|
|
766
|
+
activeCampaigns: RefillWorldStateCampaignRef[];
|
|
767
|
+
inactiveCampaigns: RefillWorldStateCampaignRef[];
|
|
768
|
+
};
|
|
769
|
+
export type RefillWorldStateAgentResult = Omit<RefillWorldStateResult, "rows"> & {
|
|
770
|
+
campaigns: RefillWorldStateAgentCampaign[];
|
|
771
|
+
rows: RefillWorldStateAgentRow[];
|
|
772
|
+
};
|
|
773
|
+
export declare function projectRefillWorldStateForAgent(result: RefillWorldStateResult): RefillWorldStateAgentResult;
|
|
774
|
+
export declare const REFILL_V3_WORLD_STATE_AGENT_OUTPUT_SCHEMA: Readonly<{
|
|
775
|
+
readonly type: "object";
|
|
776
|
+
readonly additionalProperties: false;
|
|
777
|
+
readonly required: readonly ["campaigns", "rows", "durationMs", "observationSideEffects"];
|
|
778
|
+
readonly properties: {
|
|
779
|
+
readonly campaigns: {
|
|
780
|
+
readonly type: "array";
|
|
781
|
+
readonly items: {
|
|
782
|
+
readonly type: "object";
|
|
783
|
+
readonly additionalProperties: false;
|
|
784
|
+
readonly required: ("name" | "status" | "id" | "evidence" | "activeJob" | "supply" | "leadSourceFamily" | "lanes" | "startEligible")[];
|
|
785
|
+
readonly properties: {
|
|
786
|
+
id: {
|
|
787
|
+
readonly type: "string";
|
|
788
|
+
readonly minLength: 1;
|
|
789
|
+
};
|
|
790
|
+
name: {
|
|
791
|
+
readonly type: "string";
|
|
792
|
+
};
|
|
793
|
+
status: {
|
|
794
|
+
readonly type: "string";
|
|
795
|
+
readonly enum: readonly ["ACTIVE", "PAUSED"];
|
|
796
|
+
};
|
|
797
|
+
lanes: {
|
|
798
|
+
readonly type: "array";
|
|
799
|
+
readonly minItems: 1;
|
|
800
|
+
readonly items: {
|
|
801
|
+
readonly type: "string";
|
|
802
|
+
readonly enum: readonly ["connection_invite", "paid_inmail"];
|
|
803
|
+
};
|
|
804
|
+
};
|
|
805
|
+
startEligible: {
|
|
806
|
+
readonly type: "boolean";
|
|
807
|
+
};
|
|
808
|
+
activeJob: {
|
|
809
|
+
readonly type: readonly ["object", "null"];
|
|
810
|
+
readonly additionalProperties: false;
|
|
811
|
+
readonly required: readonly ["id", "kind", "status"];
|
|
812
|
+
readonly properties: {
|
|
813
|
+
readonly id: {
|
|
814
|
+
readonly type: "string";
|
|
815
|
+
readonly minLength: 1;
|
|
816
|
+
};
|
|
817
|
+
readonly kind: {
|
|
818
|
+
readonly type: "string";
|
|
819
|
+
readonly enum: readonly ["enrichment", "message_generation", "source_expansion", "scheduling"];
|
|
820
|
+
};
|
|
821
|
+
readonly status: {
|
|
822
|
+
readonly type: "string";
|
|
823
|
+
readonly enum: readonly ["queued", "running"];
|
|
824
|
+
};
|
|
825
|
+
};
|
|
826
|
+
};
|
|
827
|
+
supply: {
|
|
828
|
+
readonly type: "object";
|
|
829
|
+
readonly additionalProperties: false;
|
|
830
|
+
readonly required: readonly ["readyToSchedule", "readyForApproval", "readyForMessageGeneration", "needsEnrichment"];
|
|
831
|
+
readonly properties: {
|
|
832
|
+
readonly readyToSchedule: {
|
|
833
|
+
readonly type: "integer";
|
|
834
|
+
readonly minimum: 0;
|
|
835
|
+
};
|
|
836
|
+
readonly readyForApproval: {
|
|
837
|
+
readonly type: "integer";
|
|
838
|
+
readonly minimum: 0;
|
|
839
|
+
};
|
|
840
|
+
readonly readyForMessageGeneration: {
|
|
841
|
+
readonly type: "integer";
|
|
842
|
+
readonly minimum: 0;
|
|
843
|
+
};
|
|
844
|
+
readonly needsEnrichment: {
|
|
845
|
+
readonly type: "integer";
|
|
846
|
+
readonly minimum: 0;
|
|
847
|
+
};
|
|
848
|
+
};
|
|
849
|
+
};
|
|
850
|
+
leadSourceFamily: {
|
|
851
|
+
readonly type: "string";
|
|
852
|
+
readonly enum: readonly ["post_engager", "signal_discovery", "cold"];
|
|
853
|
+
};
|
|
854
|
+
evidence: {
|
|
855
|
+
readonly type: "object";
|
|
856
|
+
readonly additionalProperties: false;
|
|
857
|
+
readonly required: readonly ["evergreen", "lastActualUseAt", "lastScheduledUseAt", "effectiveness", "supplyHealth"];
|
|
858
|
+
readonly properties: {
|
|
859
|
+
readonly evergreen: {
|
|
860
|
+
readonly type: "boolean";
|
|
861
|
+
};
|
|
862
|
+
readonly createdAt: {
|
|
863
|
+
readonly type: readonly ["string", "null"];
|
|
864
|
+
};
|
|
865
|
+
readonly lastActualUseAt: {
|
|
866
|
+
readonly type: readonly ["string", "null"];
|
|
867
|
+
};
|
|
868
|
+
readonly lastScheduledUseAt: {
|
|
869
|
+
readonly type: readonly ["string", "null"];
|
|
870
|
+
};
|
|
871
|
+
readonly effectiveness: {
|
|
872
|
+
readonly type: "string";
|
|
873
|
+
readonly enum: readonly ["unknown", "low", "medium", "high"];
|
|
874
|
+
};
|
|
875
|
+
readonly supplyHealth: {
|
|
876
|
+
readonly type: "string";
|
|
877
|
+
readonly enum: readonly ["unknown", "healthy", "thin", "dry"];
|
|
878
|
+
};
|
|
879
|
+
readonly engagement: {
|
|
880
|
+
readonly type: "object";
|
|
881
|
+
readonly additionalProperties: false;
|
|
882
|
+
readonly required: readonly ["sends", "accepted", "replied", "acceptRate", "replyRate"];
|
|
883
|
+
readonly properties: {
|
|
884
|
+
readonly sends: {
|
|
885
|
+
readonly type: "number";
|
|
886
|
+
readonly minimum: 0;
|
|
887
|
+
};
|
|
888
|
+
readonly accepted: {
|
|
889
|
+
readonly type: "number";
|
|
890
|
+
readonly minimum: 0;
|
|
891
|
+
};
|
|
892
|
+
readonly replied: {
|
|
893
|
+
readonly type: "number";
|
|
894
|
+
readonly minimum: 0;
|
|
895
|
+
};
|
|
896
|
+
readonly acceptRate: {
|
|
897
|
+
readonly type: "number";
|
|
898
|
+
readonly minimum: 0;
|
|
899
|
+
readonly maximum: 100;
|
|
900
|
+
};
|
|
901
|
+
readonly replyRate: {
|
|
902
|
+
readonly type: "number";
|
|
903
|
+
readonly minimum: 0;
|
|
904
|
+
readonly maximum: 100;
|
|
905
|
+
};
|
|
906
|
+
};
|
|
907
|
+
};
|
|
908
|
+
};
|
|
909
|
+
};
|
|
910
|
+
};
|
|
911
|
+
};
|
|
912
|
+
};
|
|
913
|
+
readonly rows: {
|
|
914
|
+
readonly type: "array";
|
|
915
|
+
readonly items: {
|
|
916
|
+
readonly properties: {
|
|
917
|
+
readonly activeCampaigns: {
|
|
918
|
+
readonly type: "array";
|
|
919
|
+
readonly items: {
|
|
920
|
+
readonly type: "object";
|
|
921
|
+
readonly additionalProperties: false;
|
|
922
|
+
readonly required: readonly ["id", "eligible", "reason"];
|
|
923
|
+
readonly properties: {
|
|
924
|
+
readonly id: {
|
|
925
|
+
readonly type: "string";
|
|
926
|
+
readonly minLength: 1;
|
|
927
|
+
};
|
|
928
|
+
readonly eligible: {
|
|
929
|
+
readonly type: "boolean";
|
|
930
|
+
};
|
|
931
|
+
readonly reason: {
|
|
932
|
+
readonly type: readonly ["object", "null"];
|
|
933
|
+
readonly additionalProperties: false;
|
|
934
|
+
readonly required: readonly ["kind", "codes", "message"];
|
|
935
|
+
readonly properties: {
|
|
936
|
+
readonly kind: {
|
|
937
|
+
readonly type: "string";
|
|
938
|
+
readonly enum: readonly ["unavailable", "retry_required", "invalid_campaign_configuration"];
|
|
939
|
+
};
|
|
940
|
+
readonly codes: {
|
|
941
|
+
readonly type: "array";
|
|
942
|
+
readonly items: {
|
|
943
|
+
readonly type: "string";
|
|
944
|
+
readonly enum: readonly ["global_cooldown", "connection_cooldown", "paid_inmail_cooldown", "endpoint_temporarily_unavailable", "date_in_past", "no_sending_hours", "sender_disconnected", "sender_limit_reached", "daily_target_met", "no_eligible_campaign", "no_ready_supply", "sales_nav_disconnected", "insufficient_paid_credits", "paid_inmail_connection_health_recheck_required", "paid_inmail_credit_refresh_failed", "invalid_paid_configuration", "campaign_table_missing", "campaign_sequence_invalid", "source_family_unresolved", "campaign_work_in_flight"];
|
|
945
|
+
};
|
|
946
|
+
};
|
|
947
|
+
readonly message: {
|
|
948
|
+
readonly type: "string";
|
|
949
|
+
};
|
|
950
|
+
readonly resumeAt: {
|
|
951
|
+
readonly type: "string";
|
|
952
|
+
};
|
|
953
|
+
};
|
|
954
|
+
};
|
|
955
|
+
};
|
|
956
|
+
};
|
|
957
|
+
};
|
|
958
|
+
readonly inactiveCampaigns: {
|
|
959
|
+
readonly type: "array";
|
|
960
|
+
readonly items: {
|
|
961
|
+
readonly type: "object";
|
|
962
|
+
readonly additionalProperties: false;
|
|
963
|
+
readonly required: readonly ["id", "eligible", "reason"];
|
|
964
|
+
readonly properties: {
|
|
965
|
+
readonly id: {
|
|
966
|
+
readonly type: "string";
|
|
967
|
+
readonly minLength: 1;
|
|
968
|
+
};
|
|
969
|
+
readonly eligible: {
|
|
970
|
+
readonly type: "boolean";
|
|
971
|
+
};
|
|
972
|
+
readonly reason: {
|
|
973
|
+
readonly type: readonly ["object", "null"];
|
|
974
|
+
readonly additionalProperties: false;
|
|
975
|
+
readonly required: readonly ["kind", "codes", "message"];
|
|
976
|
+
readonly properties: {
|
|
977
|
+
readonly kind: {
|
|
978
|
+
readonly type: "string";
|
|
979
|
+
readonly enum: readonly ["unavailable", "retry_required", "invalid_campaign_configuration"];
|
|
980
|
+
};
|
|
981
|
+
readonly codes: {
|
|
982
|
+
readonly type: "array";
|
|
983
|
+
readonly items: {
|
|
984
|
+
readonly type: "string";
|
|
985
|
+
readonly enum: readonly ["global_cooldown", "connection_cooldown", "paid_inmail_cooldown", "endpoint_temporarily_unavailable", "date_in_past", "no_sending_hours", "sender_disconnected", "sender_limit_reached", "daily_target_met", "no_eligible_campaign", "no_ready_supply", "sales_nav_disconnected", "insufficient_paid_credits", "paid_inmail_connection_health_recheck_required", "paid_inmail_credit_refresh_failed", "invalid_paid_configuration", "campaign_table_missing", "campaign_sequence_invalid", "source_family_unresolved", "campaign_work_in_flight"];
|
|
986
|
+
};
|
|
987
|
+
};
|
|
988
|
+
readonly message: {
|
|
989
|
+
readonly type: "string";
|
|
990
|
+
};
|
|
991
|
+
readonly resumeAt: {
|
|
992
|
+
readonly type: "string";
|
|
993
|
+
};
|
|
994
|
+
};
|
|
995
|
+
};
|
|
996
|
+
};
|
|
997
|
+
};
|
|
998
|
+
};
|
|
999
|
+
readonly date: {
|
|
1000
|
+
readonly type: "string";
|
|
1001
|
+
readonly pattern: "^\\d{4}-\\d{2}-\\d{2}$";
|
|
1002
|
+
};
|
|
1003
|
+
readonly sender: {
|
|
1004
|
+
readonly type: "object";
|
|
1005
|
+
readonly additionalProperties: false;
|
|
1006
|
+
readonly required: readonly ["id", "name", "timezone"];
|
|
1007
|
+
readonly properties: {
|
|
1008
|
+
readonly id: {
|
|
1009
|
+
readonly type: "string";
|
|
1010
|
+
readonly minLength: 1;
|
|
1011
|
+
};
|
|
1012
|
+
readonly name: {
|
|
1013
|
+
readonly type: "string";
|
|
1014
|
+
};
|
|
1015
|
+
readonly timezone: {
|
|
1016
|
+
readonly type: "string";
|
|
1017
|
+
readonly minLength: 1;
|
|
1018
|
+
};
|
|
1019
|
+
};
|
|
1020
|
+
};
|
|
1021
|
+
readonly lane: {
|
|
1022
|
+
readonly type: "string";
|
|
1023
|
+
readonly enum: readonly ["connection_invite", "paid_inmail"];
|
|
1024
|
+
};
|
|
1025
|
+
readonly targetSlots: {
|
|
1026
|
+
readonly type: "integer";
|
|
1027
|
+
readonly minimum: 0;
|
|
1028
|
+
};
|
|
1029
|
+
readonly takenSlots: {
|
|
1030
|
+
readonly type: "integer";
|
|
1031
|
+
readonly minimum: 0;
|
|
1032
|
+
};
|
|
1033
|
+
readonly remainingTargetGap: {
|
|
1034
|
+
readonly type: "integer";
|
|
1035
|
+
readonly minimum: 0;
|
|
1036
|
+
};
|
|
1037
|
+
readonly fillableSlotsNow: {
|
|
1038
|
+
readonly type: "integer";
|
|
1039
|
+
readonly minimum: 0;
|
|
1040
|
+
};
|
|
1041
|
+
readonly blockedGap: {
|
|
1042
|
+
readonly type: "integer";
|
|
1043
|
+
readonly minimum: 0;
|
|
1044
|
+
};
|
|
1045
|
+
readonly availableSlots: {
|
|
1046
|
+
readonly type: "integer";
|
|
1047
|
+
readonly minimum: 0;
|
|
1048
|
+
};
|
|
1049
|
+
readonly reason: {
|
|
1050
|
+
readonly type: readonly ["object", "null"];
|
|
1051
|
+
readonly additionalProperties: false;
|
|
1052
|
+
readonly required: readonly ["kind", "codes", "message"];
|
|
1053
|
+
readonly properties: {
|
|
1054
|
+
readonly kind: {
|
|
1055
|
+
readonly type: "string";
|
|
1056
|
+
readonly enum: readonly ["unavailable", "retry_required", "invalid_campaign_configuration"];
|
|
1057
|
+
};
|
|
1058
|
+
readonly codes: {
|
|
1059
|
+
readonly type: "array";
|
|
1060
|
+
readonly items: {
|
|
1061
|
+
readonly type: "string";
|
|
1062
|
+
readonly enum: readonly ["global_cooldown", "connection_cooldown", "paid_inmail_cooldown", "endpoint_temporarily_unavailable", "date_in_past", "no_sending_hours", "sender_disconnected", "sender_limit_reached", "daily_target_met", "no_eligible_campaign", "no_ready_supply", "sales_nav_disconnected", "insufficient_paid_credits", "paid_inmail_connection_health_recheck_required", "paid_inmail_credit_refresh_failed", "invalid_paid_configuration", "campaign_table_missing", "campaign_sequence_invalid", "source_family_unresolved", "campaign_work_in_flight"];
|
|
1063
|
+
};
|
|
1064
|
+
};
|
|
1065
|
+
readonly message: {
|
|
1066
|
+
readonly type: "string";
|
|
1067
|
+
};
|
|
1068
|
+
readonly resumeAt: {
|
|
1069
|
+
readonly type: "string";
|
|
1070
|
+
};
|
|
1071
|
+
};
|
|
1072
|
+
};
|
|
1073
|
+
readonly paidCreditEvidence: {
|
|
1074
|
+
readonly type: readonly ["object", "null"];
|
|
1075
|
+
readonly additionalProperties: false;
|
|
1076
|
+
readonly required: readonly ["availableCredits", "minimumRequired", "checkedAt", "fresh"];
|
|
1077
|
+
readonly properties: {
|
|
1078
|
+
readonly balance: {
|
|
1079
|
+
readonly type: readonly ["integer", "null"];
|
|
1080
|
+
readonly minimum: 0;
|
|
1081
|
+
};
|
|
1082
|
+
readonly sentSinceRefresh: {
|
|
1083
|
+
readonly type: "integer";
|
|
1084
|
+
readonly minimum: 0;
|
|
1085
|
+
};
|
|
1086
|
+
readonly safetyBuffer: {
|
|
1087
|
+
readonly type: "integer";
|
|
1088
|
+
readonly minimum: 0;
|
|
1089
|
+
};
|
|
1090
|
+
readonly availableCredits: {
|
|
1091
|
+
readonly type: readonly ["integer", "null"];
|
|
1092
|
+
readonly minimum: 0;
|
|
1093
|
+
};
|
|
1094
|
+
readonly committedScheduledPaidSends: {
|
|
1095
|
+
readonly type: "integer";
|
|
1096
|
+
readonly minimum: 0;
|
|
1097
|
+
};
|
|
1098
|
+
readonly minimumRequired: {
|
|
1099
|
+
readonly type: readonly ["integer", "null"];
|
|
1100
|
+
readonly minimum: 0;
|
|
1101
|
+
};
|
|
1102
|
+
readonly minimumRequiredSource: {
|
|
1103
|
+
readonly type: "string";
|
|
1104
|
+
readonly enum: readonly ["cell_column_config", "column_config", "request_override", "scheduler_default", "backend_policy", "missing_context_default"];
|
|
1105
|
+
};
|
|
1106
|
+
readonly placementBudget: {
|
|
1107
|
+
readonly type: readonly ["integer", "null"];
|
|
1108
|
+
readonly minimum: 0;
|
|
1109
|
+
};
|
|
1110
|
+
readonly checkedAt: {
|
|
1111
|
+
readonly type: readonly ["string", "null"];
|
|
1112
|
+
};
|
|
1113
|
+
readonly fresh: {
|
|
1114
|
+
readonly type: "boolean";
|
|
1115
|
+
};
|
|
1116
|
+
};
|
|
1117
|
+
};
|
|
1118
|
+
};
|
|
1119
|
+
readonly type: "object";
|
|
1120
|
+
readonly additionalProperties: false;
|
|
1121
|
+
readonly required: readonly ["date", "sender", "lane", "targetSlots", "takenSlots", "remainingTargetGap", "fillableSlotsNow", "blockedGap", "availableSlots", "reason", "activeCampaigns", "inactiveCampaigns"];
|
|
1122
|
+
};
|
|
1123
|
+
};
|
|
1124
|
+
readonly durationMs: {
|
|
1125
|
+
readonly type: "number";
|
|
1126
|
+
readonly minimum: 0;
|
|
1127
|
+
};
|
|
1128
|
+
readonly observationSideEffects: {
|
|
1129
|
+
readonly type: "object";
|
|
1130
|
+
readonly additionalProperties: false;
|
|
1131
|
+
readonly required: readonly ["scheduled", "placed", "sent", "campaignMutated", "approved", "enriched", "generated", "salesNavigatorActioned", "paidCreditCache"];
|
|
1132
|
+
readonly properties: {
|
|
1133
|
+
readonly scheduled: {
|
|
1134
|
+
readonly type: "boolean";
|
|
1135
|
+
readonly enum: readonly [false];
|
|
1136
|
+
};
|
|
1137
|
+
readonly placed: {
|
|
1138
|
+
readonly type: "boolean";
|
|
1139
|
+
readonly enum: readonly [false];
|
|
1140
|
+
};
|
|
1141
|
+
readonly sent: {
|
|
1142
|
+
readonly type: "boolean";
|
|
1143
|
+
readonly enum: readonly [false];
|
|
1144
|
+
};
|
|
1145
|
+
readonly campaignMutated: {
|
|
1146
|
+
readonly type: "boolean";
|
|
1147
|
+
readonly enum: readonly [false];
|
|
1148
|
+
};
|
|
1149
|
+
readonly approved: {
|
|
1150
|
+
readonly type: "boolean";
|
|
1151
|
+
readonly enum: readonly [false];
|
|
1152
|
+
};
|
|
1153
|
+
readonly enriched: {
|
|
1154
|
+
readonly type: "boolean";
|
|
1155
|
+
readonly enum: readonly [false];
|
|
1156
|
+
};
|
|
1157
|
+
readonly generated: {
|
|
1158
|
+
readonly type: "boolean";
|
|
1159
|
+
readonly enum: readonly [false];
|
|
1160
|
+
};
|
|
1161
|
+
readonly salesNavigatorActioned: {
|
|
1162
|
+
readonly type: "boolean";
|
|
1163
|
+
readonly enum: readonly [false];
|
|
1164
|
+
};
|
|
1165
|
+
readonly paidCreditCache: {
|
|
1166
|
+
readonly type: "string";
|
|
1167
|
+
readonly enum: readonly ["not_checked", "not_eligible", "fresh_cache_used", "refresh_started", "refreshed", "refresh_in_progress", "refresh_failed", "uncertain"];
|
|
1168
|
+
};
|
|
1169
|
+
};
|
|
1170
|
+
};
|
|
1171
|
+
};
|
|
1172
|
+
}>;
|
|
756
1173
|
/** Strict decoder shared by world-state and terminal-evidence package seams. */
|
|
757
1174
|
export declare function decodeRefillWorldStatePaidCreditEvidence(value: unknown): RefillWorldStatePaidCreditEvidence | null;
|
|
758
1175
|
/**
|
|
@@ -403,9 +403,61 @@ export const REFILL_V3_WORLD_STATE_OUTPUT_SCHEMA = Object.freeze({
|
|
|
403
403
|
},
|
|
404
404
|
},
|
|
405
405
|
});
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
406
|
+
export function projectRefillWorldStateForAgent(result) {
|
|
407
|
+
const campaigns = new Map();
|
|
408
|
+
const refs = (options) => options.map(({ eligible, reason, ...facts }) => {
|
|
409
|
+
if (!campaigns.has(facts.id))
|
|
410
|
+
campaigns.set(facts.id, facts);
|
|
411
|
+
return { id: facts.id, eligible, reason };
|
|
412
|
+
});
|
|
413
|
+
const rows = result.rows.map((row) => ({
|
|
414
|
+
...row,
|
|
415
|
+
activeCampaigns: refs(row.activeCampaigns),
|
|
416
|
+
inactiveCampaigns: refs(row.inactiveCampaigns),
|
|
417
|
+
}));
|
|
418
|
+
return { ...result, campaigns: [...campaigns.values()], rows };
|
|
419
|
+
}
|
|
420
|
+
const { eligible: _eligible, reason: _reason, ...AGENT_CAMPAIGN_PROPERTIES } = CAMPAIGN_SCHEMA.properties;
|
|
421
|
+
const CAMPAIGN_REF_SCHEMA = {
|
|
422
|
+
type: "object",
|
|
423
|
+
additionalProperties: false,
|
|
424
|
+
required: ["id", "eligible", "reason"],
|
|
425
|
+
properties: {
|
|
426
|
+
id: CAMPAIGN_SCHEMA.properties.id,
|
|
427
|
+
eligible: CAMPAIGN_SCHEMA.properties.eligible,
|
|
428
|
+
reason: REASON_SCHEMA,
|
|
429
|
+
},
|
|
430
|
+
};
|
|
431
|
+
const FULL_ROW_SCHEMA = REFILL_V3_WORLD_STATE_OUTPUT_SCHEMA.properties.rows.items;
|
|
432
|
+
export const REFILL_V3_WORLD_STATE_AGENT_OUTPUT_SCHEMA = Object.freeze({
|
|
433
|
+
type: "object",
|
|
434
|
+
additionalProperties: false,
|
|
435
|
+
required: ["campaigns", "rows", "durationMs", "observationSideEffects"],
|
|
436
|
+
properties: {
|
|
437
|
+
campaigns: {
|
|
438
|
+
type: "array",
|
|
439
|
+
items: {
|
|
440
|
+
type: "object",
|
|
441
|
+
additionalProperties: false,
|
|
442
|
+
required: CAMPAIGN_SCHEMA.required.filter((key) => key !== "eligible" && key !== "reason"),
|
|
443
|
+
properties: AGENT_CAMPAIGN_PROPERTIES,
|
|
444
|
+
},
|
|
445
|
+
},
|
|
446
|
+
rows: {
|
|
447
|
+
type: "array",
|
|
448
|
+
items: {
|
|
449
|
+
...FULL_ROW_SCHEMA,
|
|
450
|
+
properties: {
|
|
451
|
+
...FULL_ROW_SCHEMA.properties,
|
|
452
|
+
activeCampaigns: { type: "array", items: CAMPAIGN_REF_SCHEMA },
|
|
453
|
+
inactiveCampaigns: { type: "array", items: CAMPAIGN_REF_SCHEMA },
|
|
454
|
+
},
|
|
455
|
+
},
|
|
456
|
+
},
|
|
457
|
+
durationMs: REFILL_V3_WORLD_STATE_OUTPUT_SCHEMA.properties.durationMs,
|
|
458
|
+
observationSideEffects: REFILL_V3_WORLD_STATE_OUTPUT_SCHEMA.properties.observationSideEffects,
|
|
459
|
+
},
|
|
460
|
+
});
|
|
409
461
|
// ───────────────────────────────────────────────────────────────────────────
|
|
410
462
|
// Decoder
|
|
411
463
|
// ───────────────────────────────────────────────────────────────────────────
|
|
@@ -650,8 +702,10 @@ function decodeRow(value) {
|
|
|
650
702
|
if (value.remainingTargetGap !== remaining ||
|
|
651
703
|
value.fillableSlotsNow > remaining ||
|
|
652
704
|
value.availableSlots !== value.fillableSlotsNow ||
|
|
653
|
-
|
|
654
|
-
|
|
705
|
+
// Partial capacity is legitimate: a rolling-week advisory can block the
|
|
706
|
+
// remainder while the scheduler still authorizes some slots now.
|
|
707
|
+
value.fillableSlotsNow + value.blockedGap >
|
|
708
|
+
remaining) {
|
|
655
709
|
return null;
|
|
656
710
|
}
|
|
657
711
|
const sender = decodeSender(value.sender);
|