@ever-works/everworks-playbooks-plugin 1.0.3 → 1.0.5
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.cjs +64 -15
- package/dist/index.js +64 -15
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
// ../../../node_modules/.pnpm/@ever-co+connect-contracts@1.0.0-rc.
|
|
5
|
+
// ../../../node_modules/.pnpm/@ever-co+connect-contracts@1.0.0-rc.7/node_modules/@ever-co/connect-contracts/dist/index.js
|
|
6
6
|
var PROBLEM_CODES = [
|
|
7
7
|
"validation_failed",
|
|
8
8
|
"not_found",
|
|
@@ -56,6 +56,7 @@ var PROBLEM_CODES = [
|
|
|
56
56
|
"already_connected",
|
|
57
57
|
"already_linked",
|
|
58
58
|
"already_claimed",
|
|
59
|
+
"claim_locked",
|
|
59
60
|
"invalid_client",
|
|
60
61
|
"public_jwk_invalid",
|
|
61
62
|
"identifier_claimed",
|
|
@@ -81,6 +82,11 @@ var PROBLEM_CODES = [
|
|
|
81
82
|
"database_absent",
|
|
82
83
|
"database_unreachable",
|
|
83
84
|
"topic_private",
|
|
85
|
+
"realtime_disabled",
|
|
86
|
+
"topic_forbidden",
|
|
87
|
+
"topic_invalid",
|
|
88
|
+
"realtime_busy",
|
|
89
|
+
"too_many_streams",
|
|
84
90
|
"keys_unavailable",
|
|
85
91
|
"internal_error"
|
|
86
92
|
];
|
|
@@ -667,6 +673,49 @@ var FLEET_AGENT_CREDENTIAL_FAMILIES = [
|
|
|
667
673
|
FLEET_AGENT_CREDENTIAL_FAMILIES.flatMap(
|
|
668
674
|
(family) => family.envNames
|
|
669
675
|
);
|
|
676
|
+
var FLEET_LINK_FRAME_KINDS = {
|
|
677
|
+
/** Raw bytes: terminal output/input, log lines, file chunks. */
|
|
678
|
+
DATA: 1,
|
|
679
|
+
/** `[cols u16][rows u16]`. */
|
|
680
|
+
RESIZE: 2,
|
|
681
|
+
/** `[code i32]`. */
|
|
682
|
+
EXIT: 3,
|
|
683
|
+
/** UTF-8 JSON control message. */
|
|
684
|
+
JSON: 10,
|
|
685
|
+
/** UTF-8 reason code. */
|
|
686
|
+
CLOSE: 11,
|
|
687
|
+
/** A full picture (the existing computer-frame encoding). */
|
|
688
|
+
FRAME: 20,
|
|
689
|
+
/** A pointer / key / text event (the existing computer input encoding). */
|
|
690
|
+
INPUT: 21,
|
|
691
|
+
/** Changed tiles `[w][h][count]{x,y,w,h,len,jpeg}`. */
|
|
692
|
+
TILES: 23,
|
|
693
|
+
/** `[bytes u32]` credit. */
|
|
694
|
+
ACK: 30,
|
|
695
|
+
/** End of a stream. */
|
|
696
|
+
END: 31,
|
|
697
|
+
/** UTF-8 text ≤ 256 KiB, pasted into a desktop. */
|
|
698
|
+
CLIP: 40
|
|
699
|
+
};
|
|
700
|
+
new Set(Object.values(FLEET_LINK_FRAME_KINDS));
|
|
701
|
+
var FLEET_LINK_CONTROL_TYPES = [
|
|
702
|
+
"link.hello",
|
|
703
|
+
"link.ready",
|
|
704
|
+
"link.ping",
|
|
705
|
+
"link.pong",
|
|
706
|
+
"link.pause",
|
|
707
|
+
"link.resume",
|
|
708
|
+
"link.drain",
|
|
709
|
+
"channel.open",
|
|
710
|
+
"channel.ready",
|
|
711
|
+
"channel.refused",
|
|
712
|
+
"channel.close",
|
|
713
|
+
"operation.progress",
|
|
714
|
+
"operation.done",
|
|
715
|
+
"operation.cancel"
|
|
716
|
+
];
|
|
717
|
+
new Set(FLEET_LINK_CONTROL_TYPES);
|
|
718
|
+
new TextEncoder();
|
|
670
719
|
var WORKFLOW_EDGE_KINDS = [
|
|
671
720
|
"sequential",
|
|
672
721
|
"on_failure",
|
|
@@ -796,7 +845,7 @@ var PLAYBOOK_MIN_STEPS = 2;
|
|
|
796
845
|
var PLAYBOOK_MAX_STEPS = 8;
|
|
797
846
|
var PLAYBOOK_CAP_KEYS = ["maxPerRun", "maxSourcesTracked", "maxWordCount", "maxDecisionsPerRun"];
|
|
798
847
|
var PLAYBOOK_CAP_MAX = 1e5;
|
|
799
|
-
function
|
|
848
|
+
function isRecord6(value) {
|
|
800
849
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
801
850
|
}
|
|
802
851
|
function isNonEmptyString(value, max) {
|
|
@@ -806,7 +855,7 @@ function isOneOf2(value, allowed) {
|
|
|
806
855
|
return typeof value === "string" && allowed.includes(value);
|
|
807
856
|
}
|
|
808
857
|
function validateGuardrailsShape(value, path) {
|
|
809
|
-
if (!
|
|
858
|
+
if (!isRecord6(value)) return `${path} must be an object`;
|
|
810
859
|
if (!isOneOf2(value.mode, PLAYBOOK_GUARDRAIL_MODES)) return `${path}.mode is not a known guardrail mode`;
|
|
811
860
|
for (const key of ["autoApproveActionTypes", "blockedActionTypes"]) {
|
|
812
861
|
const list = value[key];
|
|
@@ -821,7 +870,7 @@ function isFiniteNonNegative(value) {
|
|
|
821
870
|
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
822
871
|
}
|
|
823
872
|
function validateCapsShape(value) {
|
|
824
|
-
if (!
|
|
873
|
+
if (!isRecord6(value)) return "caps must be an object";
|
|
825
874
|
for (const key of PLAYBOOK_CAP_KEYS) {
|
|
826
875
|
const cap = value[key];
|
|
827
876
|
if (cap === void 0) continue;
|
|
@@ -832,14 +881,14 @@ function validateCapsShape(value) {
|
|
|
832
881
|
return null;
|
|
833
882
|
}
|
|
834
883
|
function validateProvisionGraph(value) {
|
|
835
|
-
if (!
|
|
884
|
+
if (!isRecord6(value)) return "provision.workflowGraph must be an object";
|
|
836
885
|
if (!Array.isArray(value.nodes)) return "provision.workflowGraph.nodes must be a list";
|
|
837
886
|
if (!Array.isArray(value.edges)) return "provision.workflowGraph.edges must be a list";
|
|
838
887
|
const { valid, errors } = validateWorkflowGraph(value);
|
|
839
888
|
return valid ? null : `provision.workflowGraph is invalid: ${errors[0] ?? "unknown error"}`;
|
|
840
889
|
}
|
|
841
890
|
function validatePlaybookEntry(value) {
|
|
842
|
-
if (!
|
|
891
|
+
if (!isRecord6(value)) return "entry must be an object";
|
|
843
892
|
if (typeof value.slug !== "string" || !PLAYBOOK_SLUG_PATTERN.test(value.slug)) {
|
|
844
893
|
return "slug must match ^[a-z0-9][a-z0-9-]{0,63}$";
|
|
845
894
|
}
|
|
@@ -855,11 +904,11 @@ function validatePlaybookEntry(value) {
|
|
|
855
904
|
if (typeof value.icon !== "string") return "icon must be a string";
|
|
856
905
|
if (!isOneOf2(value.costBand, PLAYBOOK_COST_BANDS)) return "costBand is not a known cost band";
|
|
857
906
|
const estimate = value.estimatedTokensPerRun;
|
|
858
|
-
if (!
|
|
907
|
+
if (!isRecord6(estimate) || !isFiniteNonNegative(estimate.min) || !isFiniteNonNegative(estimate.max) || estimate.max < estimate.min) {
|
|
859
908
|
return "estimatedTokensPerRun must be { min, max } with 0 <= min <= max";
|
|
860
909
|
}
|
|
861
910
|
const trigger = value.trigger;
|
|
862
|
-
if (!
|
|
911
|
+
if (!isRecord6(trigger)) return "trigger must be an object";
|
|
863
912
|
if (!isOneOf2(trigger.kind, PLAYBOOK_TRIGGER_KINDS)) return "trigger.kind is not a known trigger kind";
|
|
864
913
|
if (!isNonEmptyString(trigger.description, PLAYBOOK_TEXT_LIMITS.shortText)) {
|
|
865
914
|
return "trigger.description must be 1-200 characters";
|
|
@@ -869,7 +918,7 @@ function validatePlaybookEntry(value) {
|
|
|
869
918
|
return "steps must hold between 2 and 8 steps";
|
|
870
919
|
}
|
|
871
920
|
for (const [index, step] of steps2.entries()) {
|
|
872
|
-
if (!
|
|
921
|
+
if (!isRecord6(step)) return `steps[${index}] must be an object`;
|
|
873
922
|
if (!isNonEmptyString(step.title, PLAYBOOK_TEXT_LIMITS.stepTitle)) {
|
|
874
923
|
return `steps[${index}].title must be 1-120 characters`;
|
|
875
924
|
}
|
|
@@ -881,7 +930,7 @@ function validatePlaybookEntry(value) {
|
|
|
881
930
|
const connections = value.connections;
|
|
882
931
|
if (!Array.isArray(connections)) return "connections must be a list";
|
|
883
932
|
for (const [index, need] of connections.entries()) {
|
|
884
|
-
if (!
|
|
933
|
+
if (!isRecord6(need)) return `connections[${index}] must be an object`;
|
|
885
934
|
if (!isNonEmptyString(need.capability, 64)) return `connections[${index}].capability must be a capability name`;
|
|
886
935
|
if (typeof need.required !== "boolean") return `connections[${index}].required must be a boolean`;
|
|
887
936
|
if (!isNonEmptyString(need.reason, PLAYBOOK_TEXT_LIMITS.reason)) {
|
|
@@ -891,14 +940,14 @@ function validatePlaybookEntry(value) {
|
|
|
891
940
|
const artefacts = value.artefacts;
|
|
892
941
|
if (!Array.isArray(artefacts)) return "artefacts must be a list";
|
|
893
942
|
for (const [index, artefact] of artefacts.entries()) {
|
|
894
|
-
if (!
|
|
943
|
+
if (!isRecord6(artefact) || !isOneOf2(artefact.kind, PLAYBOOK_ARTEFACT_KINDS)) {
|
|
895
944
|
return `artefacts[${index}].kind is not a known artefact kind`;
|
|
896
945
|
}
|
|
897
946
|
}
|
|
898
947
|
const escalations = value.escalations;
|
|
899
948
|
if (!Array.isArray(escalations)) return "escalations must be a list";
|
|
900
949
|
for (const [index, point] of escalations.entries()) {
|
|
901
|
-
if (!
|
|
950
|
+
if (!isRecord6(point) || !isOneOf2(point.becomes, PLAYBOOK_ESCALATION_TARGETS)) {
|
|
902
951
|
return `escalations[${index}].becomes must be approval or escalation`;
|
|
903
952
|
}
|
|
904
953
|
}
|
|
@@ -908,14 +957,14 @@ function validatePlaybookEntry(value) {
|
|
|
908
957
|
return "tags must be a list of strings";
|
|
909
958
|
}
|
|
910
959
|
const provision = value.provision;
|
|
911
|
-
if (!
|
|
960
|
+
if (!isRecord6(provision)) return "provision must be an object";
|
|
912
961
|
if (!isNonEmptyString(provision.agentTemplateSlug, 64)) return "provision.agentTemplateSlug is required";
|
|
913
962
|
if (!isNonEmptyString(provision.agentName, PLAYBOOK_TEXT_LIMITS.shortText))
|
|
914
963
|
return "provision.agentName is required";
|
|
915
964
|
if (!Array.isArray(provision.skillSlugs) || provision.skillSlugs.some((slug) => typeof slug !== "string")) {
|
|
916
965
|
return "provision.skillSlugs must be a list of skill slugs";
|
|
917
966
|
}
|
|
918
|
-
if (!
|
|
967
|
+
if (!isRecord6(provision.taskTemplate) || !isNonEmptyString(provision.taskTemplate.name, PLAYBOOK_TEXT_LIMITS.title)) {
|
|
919
968
|
return "provision.taskTemplate.name is required";
|
|
920
969
|
}
|
|
921
970
|
const guardrailsError = validateGuardrailsShape(provision.guardrailsAtAdoption, "provision.guardrailsAtAdoption");
|
|
@@ -954,7 +1003,7 @@ function sanitizePlaybookText(value, max) {
|
|
|
954
1003
|
return value.replace(HTML_TAG_PATTERN, "").trim().slice(0, max);
|
|
955
1004
|
}
|
|
956
1005
|
function acceptPlaybookEntry(value) {
|
|
957
|
-
if (!
|
|
1006
|
+
if (!isRecord6(value)) return { entry: null, violation: "entry must be an object" };
|
|
958
1007
|
let sanitized;
|
|
959
1008
|
try {
|
|
960
1009
|
sanitized = sanitizePlaybookEntry(value);
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../../../node_modules/.pnpm/@ever-co+connect-contracts@1.0.0-rc.
|
|
1
|
+
// ../../../node_modules/.pnpm/@ever-co+connect-contracts@1.0.0-rc.7/node_modules/@ever-co/connect-contracts/dist/index.js
|
|
2
2
|
var PROBLEM_CODES = [
|
|
3
3
|
"validation_failed",
|
|
4
4
|
"not_found",
|
|
@@ -52,6 +52,7 @@ var PROBLEM_CODES = [
|
|
|
52
52
|
"already_connected",
|
|
53
53
|
"already_linked",
|
|
54
54
|
"already_claimed",
|
|
55
|
+
"claim_locked",
|
|
55
56
|
"invalid_client",
|
|
56
57
|
"public_jwk_invalid",
|
|
57
58
|
"identifier_claimed",
|
|
@@ -77,6 +78,11 @@ var PROBLEM_CODES = [
|
|
|
77
78
|
"database_absent",
|
|
78
79
|
"database_unreachable",
|
|
79
80
|
"topic_private",
|
|
81
|
+
"realtime_disabled",
|
|
82
|
+
"topic_forbidden",
|
|
83
|
+
"topic_invalid",
|
|
84
|
+
"realtime_busy",
|
|
85
|
+
"too_many_streams",
|
|
80
86
|
"keys_unavailable",
|
|
81
87
|
"internal_error"
|
|
82
88
|
];
|
|
@@ -663,6 +669,49 @@ var FLEET_AGENT_CREDENTIAL_FAMILIES = [
|
|
|
663
669
|
FLEET_AGENT_CREDENTIAL_FAMILIES.flatMap(
|
|
664
670
|
(family) => family.envNames
|
|
665
671
|
);
|
|
672
|
+
var FLEET_LINK_FRAME_KINDS = {
|
|
673
|
+
/** Raw bytes: terminal output/input, log lines, file chunks. */
|
|
674
|
+
DATA: 1,
|
|
675
|
+
/** `[cols u16][rows u16]`. */
|
|
676
|
+
RESIZE: 2,
|
|
677
|
+
/** `[code i32]`. */
|
|
678
|
+
EXIT: 3,
|
|
679
|
+
/** UTF-8 JSON control message. */
|
|
680
|
+
JSON: 10,
|
|
681
|
+
/** UTF-8 reason code. */
|
|
682
|
+
CLOSE: 11,
|
|
683
|
+
/** A full picture (the existing computer-frame encoding). */
|
|
684
|
+
FRAME: 20,
|
|
685
|
+
/** A pointer / key / text event (the existing computer input encoding). */
|
|
686
|
+
INPUT: 21,
|
|
687
|
+
/** Changed tiles `[w][h][count]{x,y,w,h,len,jpeg}`. */
|
|
688
|
+
TILES: 23,
|
|
689
|
+
/** `[bytes u32]` credit. */
|
|
690
|
+
ACK: 30,
|
|
691
|
+
/** End of a stream. */
|
|
692
|
+
END: 31,
|
|
693
|
+
/** UTF-8 text ≤ 256 KiB, pasted into a desktop. */
|
|
694
|
+
CLIP: 40
|
|
695
|
+
};
|
|
696
|
+
new Set(Object.values(FLEET_LINK_FRAME_KINDS));
|
|
697
|
+
var FLEET_LINK_CONTROL_TYPES = [
|
|
698
|
+
"link.hello",
|
|
699
|
+
"link.ready",
|
|
700
|
+
"link.ping",
|
|
701
|
+
"link.pong",
|
|
702
|
+
"link.pause",
|
|
703
|
+
"link.resume",
|
|
704
|
+
"link.drain",
|
|
705
|
+
"channel.open",
|
|
706
|
+
"channel.ready",
|
|
707
|
+
"channel.refused",
|
|
708
|
+
"channel.close",
|
|
709
|
+
"operation.progress",
|
|
710
|
+
"operation.done",
|
|
711
|
+
"operation.cancel"
|
|
712
|
+
];
|
|
713
|
+
new Set(FLEET_LINK_CONTROL_TYPES);
|
|
714
|
+
new TextEncoder();
|
|
666
715
|
var WORKFLOW_EDGE_KINDS = [
|
|
667
716
|
"sequential",
|
|
668
717
|
"on_failure",
|
|
@@ -792,7 +841,7 @@ var PLAYBOOK_MIN_STEPS = 2;
|
|
|
792
841
|
var PLAYBOOK_MAX_STEPS = 8;
|
|
793
842
|
var PLAYBOOK_CAP_KEYS = ["maxPerRun", "maxSourcesTracked", "maxWordCount", "maxDecisionsPerRun"];
|
|
794
843
|
var PLAYBOOK_CAP_MAX = 1e5;
|
|
795
|
-
function
|
|
844
|
+
function isRecord6(value) {
|
|
796
845
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
797
846
|
}
|
|
798
847
|
function isNonEmptyString(value, max) {
|
|
@@ -802,7 +851,7 @@ function isOneOf2(value, allowed) {
|
|
|
802
851
|
return typeof value === "string" && allowed.includes(value);
|
|
803
852
|
}
|
|
804
853
|
function validateGuardrailsShape(value, path) {
|
|
805
|
-
if (!
|
|
854
|
+
if (!isRecord6(value)) return `${path} must be an object`;
|
|
806
855
|
if (!isOneOf2(value.mode, PLAYBOOK_GUARDRAIL_MODES)) return `${path}.mode is not a known guardrail mode`;
|
|
807
856
|
for (const key of ["autoApproveActionTypes", "blockedActionTypes"]) {
|
|
808
857
|
const list = value[key];
|
|
@@ -817,7 +866,7 @@ function isFiniteNonNegative(value) {
|
|
|
817
866
|
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
818
867
|
}
|
|
819
868
|
function validateCapsShape(value) {
|
|
820
|
-
if (!
|
|
869
|
+
if (!isRecord6(value)) return "caps must be an object";
|
|
821
870
|
for (const key of PLAYBOOK_CAP_KEYS) {
|
|
822
871
|
const cap = value[key];
|
|
823
872
|
if (cap === void 0) continue;
|
|
@@ -828,14 +877,14 @@ function validateCapsShape(value) {
|
|
|
828
877
|
return null;
|
|
829
878
|
}
|
|
830
879
|
function validateProvisionGraph(value) {
|
|
831
|
-
if (!
|
|
880
|
+
if (!isRecord6(value)) return "provision.workflowGraph must be an object";
|
|
832
881
|
if (!Array.isArray(value.nodes)) return "provision.workflowGraph.nodes must be a list";
|
|
833
882
|
if (!Array.isArray(value.edges)) return "provision.workflowGraph.edges must be a list";
|
|
834
883
|
const { valid, errors } = validateWorkflowGraph(value);
|
|
835
884
|
return valid ? null : `provision.workflowGraph is invalid: ${errors[0] ?? "unknown error"}`;
|
|
836
885
|
}
|
|
837
886
|
function validatePlaybookEntry(value) {
|
|
838
|
-
if (!
|
|
887
|
+
if (!isRecord6(value)) return "entry must be an object";
|
|
839
888
|
if (typeof value.slug !== "string" || !PLAYBOOK_SLUG_PATTERN.test(value.slug)) {
|
|
840
889
|
return "slug must match ^[a-z0-9][a-z0-9-]{0,63}$";
|
|
841
890
|
}
|
|
@@ -851,11 +900,11 @@ function validatePlaybookEntry(value) {
|
|
|
851
900
|
if (typeof value.icon !== "string") return "icon must be a string";
|
|
852
901
|
if (!isOneOf2(value.costBand, PLAYBOOK_COST_BANDS)) return "costBand is not a known cost band";
|
|
853
902
|
const estimate = value.estimatedTokensPerRun;
|
|
854
|
-
if (!
|
|
903
|
+
if (!isRecord6(estimate) || !isFiniteNonNegative(estimate.min) || !isFiniteNonNegative(estimate.max) || estimate.max < estimate.min) {
|
|
855
904
|
return "estimatedTokensPerRun must be { min, max } with 0 <= min <= max";
|
|
856
905
|
}
|
|
857
906
|
const trigger = value.trigger;
|
|
858
|
-
if (!
|
|
907
|
+
if (!isRecord6(trigger)) return "trigger must be an object";
|
|
859
908
|
if (!isOneOf2(trigger.kind, PLAYBOOK_TRIGGER_KINDS)) return "trigger.kind is not a known trigger kind";
|
|
860
909
|
if (!isNonEmptyString(trigger.description, PLAYBOOK_TEXT_LIMITS.shortText)) {
|
|
861
910
|
return "trigger.description must be 1-200 characters";
|
|
@@ -865,7 +914,7 @@ function validatePlaybookEntry(value) {
|
|
|
865
914
|
return "steps must hold between 2 and 8 steps";
|
|
866
915
|
}
|
|
867
916
|
for (const [index, step] of steps2.entries()) {
|
|
868
|
-
if (!
|
|
917
|
+
if (!isRecord6(step)) return `steps[${index}] must be an object`;
|
|
869
918
|
if (!isNonEmptyString(step.title, PLAYBOOK_TEXT_LIMITS.stepTitle)) {
|
|
870
919
|
return `steps[${index}].title must be 1-120 characters`;
|
|
871
920
|
}
|
|
@@ -877,7 +926,7 @@ function validatePlaybookEntry(value) {
|
|
|
877
926
|
const connections = value.connections;
|
|
878
927
|
if (!Array.isArray(connections)) return "connections must be a list";
|
|
879
928
|
for (const [index, need] of connections.entries()) {
|
|
880
|
-
if (!
|
|
929
|
+
if (!isRecord6(need)) return `connections[${index}] must be an object`;
|
|
881
930
|
if (!isNonEmptyString(need.capability, 64)) return `connections[${index}].capability must be a capability name`;
|
|
882
931
|
if (typeof need.required !== "boolean") return `connections[${index}].required must be a boolean`;
|
|
883
932
|
if (!isNonEmptyString(need.reason, PLAYBOOK_TEXT_LIMITS.reason)) {
|
|
@@ -887,14 +936,14 @@ function validatePlaybookEntry(value) {
|
|
|
887
936
|
const artefacts = value.artefacts;
|
|
888
937
|
if (!Array.isArray(artefacts)) return "artefacts must be a list";
|
|
889
938
|
for (const [index, artefact] of artefacts.entries()) {
|
|
890
|
-
if (!
|
|
939
|
+
if (!isRecord6(artefact) || !isOneOf2(artefact.kind, PLAYBOOK_ARTEFACT_KINDS)) {
|
|
891
940
|
return `artefacts[${index}].kind is not a known artefact kind`;
|
|
892
941
|
}
|
|
893
942
|
}
|
|
894
943
|
const escalations = value.escalations;
|
|
895
944
|
if (!Array.isArray(escalations)) return "escalations must be a list";
|
|
896
945
|
for (const [index, point] of escalations.entries()) {
|
|
897
|
-
if (!
|
|
946
|
+
if (!isRecord6(point) || !isOneOf2(point.becomes, PLAYBOOK_ESCALATION_TARGETS)) {
|
|
898
947
|
return `escalations[${index}].becomes must be approval or escalation`;
|
|
899
948
|
}
|
|
900
949
|
}
|
|
@@ -904,14 +953,14 @@ function validatePlaybookEntry(value) {
|
|
|
904
953
|
return "tags must be a list of strings";
|
|
905
954
|
}
|
|
906
955
|
const provision = value.provision;
|
|
907
|
-
if (!
|
|
956
|
+
if (!isRecord6(provision)) return "provision must be an object";
|
|
908
957
|
if (!isNonEmptyString(provision.agentTemplateSlug, 64)) return "provision.agentTemplateSlug is required";
|
|
909
958
|
if (!isNonEmptyString(provision.agentName, PLAYBOOK_TEXT_LIMITS.shortText))
|
|
910
959
|
return "provision.agentName is required";
|
|
911
960
|
if (!Array.isArray(provision.skillSlugs) || provision.skillSlugs.some((slug) => typeof slug !== "string")) {
|
|
912
961
|
return "provision.skillSlugs must be a list of skill slugs";
|
|
913
962
|
}
|
|
914
|
-
if (!
|
|
963
|
+
if (!isRecord6(provision.taskTemplate) || !isNonEmptyString(provision.taskTemplate.name, PLAYBOOK_TEXT_LIMITS.title)) {
|
|
915
964
|
return "provision.taskTemplate.name is required";
|
|
916
965
|
}
|
|
917
966
|
const guardrailsError = validateGuardrailsShape(provision.guardrailsAtAdoption, "provision.guardrailsAtAdoption");
|
|
@@ -950,7 +999,7 @@ function sanitizePlaybookText(value, max) {
|
|
|
950
999
|
return value.replace(HTML_TAG_PATTERN, "").trim().slice(0, max);
|
|
951
1000
|
}
|
|
952
1001
|
function acceptPlaybookEntry(value) {
|
|
953
|
-
if (!
|
|
1002
|
+
if (!isRecord6(value)) return { entry: null, violation: "entry must be an object" };
|
|
954
1003
|
let sanitized;
|
|
955
1004
|
try {
|
|
956
1005
|
sanitized = sanitizePlaybookEntry(value);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ever-works/everworks-playbooks-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Ever Works Playbooks — first-party playbook-provider plugin supplying the built-in Playbook catalogue: packaged outcomes with their trigger, steps, required capabilities, artefacts and escalation points.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Ever Co. LTD",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"test:coverage": "vitest run --coverage"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@ever-works/contracts": "^1.0.
|
|
37
|
-
"@ever-works/plugin": "^1.2.
|
|
36
|
+
"@ever-works/contracts": "^1.0.11",
|
|
37
|
+
"@ever-works/plugin": "^1.2.6"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"tsup": "^8.3.0",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"url": "https://github.com/ever-works/ever-works/issues"
|
|
68
68
|
},
|
|
69
69
|
"everworksRelease": {
|
|
70
|
-
"contentHash": "sha256:
|
|
71
|
-
"commit": "
|
|
72
|
-
"source": "https://github.com/ever-works/ever-works/tree/
|
|
70
|
+
"contentHash": "sha256:41f474dd1c6efa17ef0373b94e6b613980c5a3f22d3e96345509b17417c3ec4a",
|
|
71
|
+
"commit": "eff002871bfd7f9f8e0f984907f45265ae8b01e0",
|
|
72
|
+
"source": "https://github.com/ever-works/ever-works/tree/eff002871bfd7f9f8e0f984907f45265ae8b01e0/packages/plugins/everworks-playbooks"
|
|
73
73
|
}
|
|
74
74
|
}
|