@ever-works/everworks-playbooks-plugin 1.0.3 → 1.0.6
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 +168 -15
- package/dist/index.js +168 -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,153 @@ 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();
|
|
719
|
+
var FLEET_RUN_TOKEN_ROUTES = Object.freeze([
|
|
720
|
+
// Works — reads, plus the settings update (its merge / check / command
|
|
721
|
+
// fields are refused for run tokens by the Works controller).
|
|
722
|
+
{ method: "GET", pathPattern: "/api/works" },
|
|
723
|
+
{ method: "GET", pathPattern: "/api/works/{id}" },
|
|
724
|
+
{ method: "PUT", pathPattern: "/api/works/{id}" },
|
|
725
|
+
{ method: "GET", pathPattern: "/api/works/{id}/config" },
|
|
726
|
+
{ method: "GET", pathPattern: "/api/works/{id}/items" },
|
|
727
|
+
{ method: "GET", pathPattern: "/api/works/{id}/categories-tags" },
|
|
728
|
+
{ method: "GET", pathPattern: "/api/works/{id}/history" },
|
|
729
|
+
{ method: "GET", pathPattern: "/api/works/{id}/generator-form" },
|
|
730
|
+
{ method: "GET", pathPattern: "/api/works/{id}/schedule" },
|
|
731
|
+
{ method: "GET", pathPattern: "/api/works/{id}/comparisons" },
|
|
732
|
+
{ method: "GET", pathPattern: "/api/works/{id}/comparisons/{slug}" },
|
|
733
|
+
// Knowledge Base (`apps/mcp/src/tools/kb`). A document a run token writes
|
|
734
|
+
// lands `proposed` (review-gated), see the KB controller. No unlock.
|
|
735
|
+
{ method: "GET", pathPattern: "/api/works/{id}/kb/documents" },
|
|
736
|
+
{ method: "POST", pathPattern: "/api/works/{id}/kb/documents" },
|
|
737
|
+
{ method: "GET", pathPattern: "/api/works/{id}/kb/documents/{docIdOrPath}" },
|
|
738
|
+
{ method: "PATCH", pathPattern: "/api/works/{id}/kb/documents/{docId}" },
|
|
739
|
+
{ method: "POST", pathPattern: "/api/works/{id}/kb/documents/{docId}/lock" },
|
|
740
|
+
// Deploy — reads and the capability check only.
|
|
741
|
+
{ method: "GET", pathPattern: "/api/deploy/works/{id}/domains" },
|
|
742
|
+
{ method: "GET", pathPattern: "/api/deploy/providers" },
|
|
743
|
+
{ method: "POST", pathPattern: "/api/deploy/works/{id}/check" },
|
|
744
|
+
// Plugins — read only.
|
|
745
|
+
{ method: "GET", pathPattern: "/api/plugins" },
|
|
746
|
+
{ method: "GET", pathPattern: "/api/plugins/{pluginId}" },
|
|
747
|
+
// Missions — reads, plus pause (the safe direction).
|
|
748
|
+
{ method: "GET", pathPattern: "/api/me/missions" },
|
|
749
|
+
{ method: "GET", pathPattern: "/api/me/missions/{id}" },
|
|
750
|
+
{ method: "GET", pathPattern: "/api/me/missions/{id}/budget" },
|
|
751
|
+
{ method: "GET", pathPattern: "/api/me/missions/{id}/works" },
|
|
752
|
+
{ method: "POST", pathPattern: "/api/me/missions/{id}/pause" },
|
|
753
|
+
// Ideas — reads, plus filing a new Idea (a proposal a person builds).
|
|
754
|
+
{ method: "POST", pathPattern: "/api/me/work-proposals" },
|
|
755
|
+
{ method: "GET", pathPattern: "/api/me/work-proposals" },
|
|
756
|
+
{ method: "GET", pathPattern: "/api/me/work-proposals/status" },
|
|
757
|
+
{ method: "GET", pathPattern: "/api/me/work-proposals/preferences" },
|
|
758
|
+
{ method: "GET", pathPattern: "/api/me/work-proposals/{id}" },
|
|
759
|
+
{ method: "GET", pathPattern: "/api/me/work-proposals/{id}/budget" },
|
|
760
|
+
// Account-wide usage.
|
|
761
|
+
{ method: "GET", pathPattern: "/api/me/usage/account-wide" },
|
|
762
|
+
// Tasks — reads and collaboration writes. Create / update / transition /
|
|
763
|
+
// assign / chat carry body refusals for run tokens in the Tasks
|
|
764
|
+
// controller (no checks, no schedule, no force, no dispatch, no @agent).
|
|
765
|
+
{ method: "GET", pathPattern: "/api/tasks" },
|
|
766
|
+
{ method: "POST", pathPattern: "/api/tasks" },
|
|
767
|
+
{ method: "GET", pathPattern: "/api/tasks/{id}" },
|
|
768
|
+
{ method: "PATCH", pathPattern: "/api/tasks/{id}" },
|
|
769
|
+
{ method: "GET", pathPattern: "/api/tasks/{id}/subtasks" },
|
|
770
|
+
{ method: "GET", pathPattern: "/api/tasks/{id}/activity" },
|
|
771
|
+
{ method: "POST", pathPattern: "/api/tasks/{id}/transition" },
|
|
772
|
+
{ method: "GET", pathPattern: "/api/tasks/{id}/run-candidates" },
|
|
773
|
+
{ method: "GET", pathPattern: "/api/tasks/{id}/pr-status" },
|
|
774
|
+
{ method: "GET", pathPattern: "/api/tasks/{id}/diff" },
|
|
775
|
+
{ method: "POST", pathPattern: "/api/tasks/{id}/assignees" },
|
|
776
|
+
{ method: "POST", pathPattern: "/api/tasks/{id}/reviewers" },
|
|
777
|
+
{ method: "POST", pathPattern: "/api/tasks/{id}/approvers" },
|
|
778
|
+
{ method: "POST", pathPattern: "/api/tasks/{id}/relations" },
|
|
779
|
+
{ method: "GET", pathPattern: "/api/tasks/{id}/escalations" },
|
|
780
|
+
{ method: "GET", pathPattern: "/api/tasks/{id}/chat" },
|
|
781
|
+
{ method: "POST", pathPattern: "/api/tasks/{id}/chat" },
|
|
782
|
+
{ method: "GET", pathPattern: "/api/tasks/{id}/spend" },
|
|
783
|
+
// Inbox — read only (no reply, no archive / delete / mark-read).
|
|
784
|
+
{ method: "GET", pathPattern: "/api/inbox" },
|
|
785
|
+
{ method: "GET", pathPattern: "/api/inbox/unread-count" },
|
|
786
|
+
{ method: "GET", pathPattern: "/api/inbox/{id}" },
|
|
787
|
+
// Goals — reads, a draft create, field-limited update, pause, and the
|
|
788
|
+
// ASKING side of the definition of done (propose, never approve).
|
|
789
|
+
{ method: "GET", pathPattern: "/api/me/goals" },
|
|
790
|
+
{ method: "POST", pathPattern: "/api/me/goals" },
|
|
791
|
+
{ method: "GET", pathPattern: "/api/me/goals/{id}" },
|
|
792
|
+
{ method: "PATCH", pathPattern: "/api/me/goals/{id}" },
|
|
793
|
+
{ method: "GET", pathPattern: "/api/me/goals/{id}/samples" },
|
|
794
|
+
{ method: "POST", pathPattern: "/api/me/goals/{id}/pause" },
|
|
795
|
+
{ method: "POST", pathPattern: "/api/me/goals/{id}/dod/propose" },
|
|
796
|
+
// Fleet — reads only.
|
|
797
|
+
{ method: "GET", pathPattern: "/api/fleet/nodes" },
|
|
798
|
+
{ method: "GET", pathPattern: "/api/fleet/nodes/{id}" },
|
|
799
|
+
{ method: "GET", pathPattern: "/api/fleet/runner-status" },
|
|
800
|
+
{ method: "GET", pathPattern: "/api/fleet/execution-preferences" },
|
|
801
|
+
{ method: "GET", pathPattern: "/api/fleet/agents/{agentId}/node-affinity" },
|
|
802
|
+
// Agents — reads, plus cancel and pause (the safe direction).
|
|
803
|
+
{ method: "GET", pathPattern: "/api/agents" },
|
|
804
|
+
{ method: "GET", pathPattern: "/api/agents/{id}" },
|
|
805
|
+
{ method: "GET", pathPattern: "/api/agents/{id}/runs" },
|
|
806
|
+
{ method: "GET", pathPattern: "/api/agents/{id}/runs/{runId}" },
|
|
807
|
+
{ method: "POST", pathPattern: "/api/agents/{id}/runs/{runId}/cancel" },
|
|
808
|
+
{ method: "POST", pathPattern: "/api/agents/{id}/pause" },
|
|
809
|
+
{ method: "GET", pathPattern: "/api/agents/{id}/budget" },
|
|
810
|
+
// Agent Plugins — read only (installing a package installs instructions).
|
|
811
|
+
{ method: "GET", pathPattern: "/api/agent-plugins" },
|
|
812
|
+
{ method: "GET", pathPattern: "/api/agent-plugins/findings" },
|
|
813
|
+
{ method: "GET", pathPattern: "/api/agent-plugins/catalog" },
|
|
814
|
+
{ method: "GET", pathPattern: "/api/agent-plugins/updates" }
|
|
815
|
+
]);
|
|
816
|
+
function splitSegments(normalizedPath) {
|
|
817
|
+
return normalizedPath.split("/").filter((segment) => segment.length > 0);
|
|
818
|
+
}
|
|
819
|
+
FLEET_RUN_TOKEN_ROUTES.map((route) => ({
|
|
820
|
+
method: route.method.toUpperCase(),
|
|
821
|
+
shape: splitSegments(route.pathPattern).map((part) => /^\{[^}]+\}$/.test(part) ? "*" : part.toLowerCase())
|
|
822
|
+
}));
|
|
670
823
|
var WORKFLOW_EDGE_KINDS = [
|
|
671
824
|
"sequential",
|
|
672
825
|
"on_failure",
|
|
@@ -796,7 +949,7 @@ var PLAYBOOK_MIN_STEPS = 2;
|
|
|
796
949
|
var PLAYBOOK_MAX_STEPS = 8;
|
|
797
950
|
var PLAYBOOK_CAP_KEYS = ["maxPerRun", "maxSourcesTracked", "maxWordCount", "maxDecisionsPerRun"];
|
|
798
951
|
var PLAYBOOK_CAP_MAX = 1e5;
|
|
799
|
-
function
|
|
952
|
+
function isRecord6(value) {
|
|
800
953
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
801
954
|
}
|
|
802
955
|
function isNonEmptyString(value, max) {
|
|
@@ -806,7 +959,7 @@ function isOneOf2(value, allowed) {
|
|
|
806
959
|
return typeof value === "string" && allowed.includes(value);
|
|
807
960
|
}
|
|
808
961
|
function validateGuardrailsShape(value, path) {
|
|
809
|
-
if (!
|
|
962
|
+
if (!isRecord6(value)) return `${path} must be an object`;
|
|
810
963
|
if (!isOneOf2(value.mode, PLAYBOOK_GUARDRAIL_MODES)) return `${path}.mode is not a known guardrail mode`;
|
|
811
964
|
for (const key of ["autoApproveActionTypes", "blockedActionTypes"]) {
|
|
812
965
|
const list = value[key];
|
|
@@ -821,7 +974,7 @@ function isFiniteNonNegative(value) {
|
|
|
821
974
|
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
822
975
|
}
|
|
823
976
|
function validateCapsShape(value) {
|
|
824
|
-
if (!
|
|
977
|
+
if (!isRecord6(value)) return "caps must be an object";
|
|
825
978
|
for (const key of PLAYBOOK_CAP_KEYS) {
|
|
826
979
|
const cap = value[key];
|
|
827
980
|
if (cap === void 0) continue;
|
|
@@ -832,14 +985,14 @@ function validateCapsShape(value) {
|
|
|
832
985
|
return null;
|
|
833
986
|
}
|
|
834
987
|
function validateProvisionGraph(value) {
|
|
835
|
-
if (!
|
|
988
|
+
if (!isRecord6(value)) return "provision.workflowGraph must be an object";
|
|
836
989
|
if (!Array.isArray(value.nodes)) return "provision.workflowGraph.nodes must be a list";
|
|
837
990
|
if (!Array.isArray(value.edges)) return "provision.workflowGraph.edges must be a list";
|
|
838
991
|
const { valid, errors } = validateWorkflowGraph(value);
|
|
839
992
|
return valid ? null : `provision.workflowGraph is invalid: ${errors[0] ?? "unknown error"}`;
|
|
840
993
|
}
|
|
841
994
|
function validatePlaybookEntry(value) {
|
|
842
|
-
if (!
|
|
995
|
+
if (!isRecord6(value)) return "entry must be an object";
|
|
843
996
|
if (typeof value.slug !== "string" || !PLAYBOOK_SLUG_PATTERN.test(value.slug)) {
|
|
844
997
|
return "slug must match ^[a-z0-9][a-z0-9-]{0,63}$";
|
|
845
998
|
}
|
|
@@ -855,11 +1008,11 @@ function validatePlaybookEntry(value) {
|
|
|
855
1008
|
if (typeof value.icon !== "string") return "icon must be a string";
|
|
856
1009
|
if (!isOneOf2(value.costBand, PLAYBOOK_COST_BANDS)) return "costBand is not a known cost band";
|
|
857
1010
|
const estimate = value.estimatedTokensPerRun;
|
|
858
|
-
if (!
|
|
1011
|
+
if (!isRecord6(estimate) || !isFiniteNonNegative(estimate.min) || !isFiniteNonNegative(estimate.max) || estimate.max < estimate.min) {
|
|
859
1012
|
return "estimatedTokensPerRun must be { min, max } with 0 <= min <= max";
|
|
860
1013
|
}
|
|
861
1014
|
const trigger = value.trigger;
|
|
862
|
-
if (!
|
|
1015
|
+
if (!isRecord6(trigger)) return "trigger must be an object";
|
|
863
1016
|
if (!isOneOf2(trigger.kind, PLAYBOOK_TRIGGER_KINDS)) return "trigger.kind is not a known trigger kind";
|
|
864
1017
|
if (!isNonEmptyString(trigger.description, PLAYBOOK_TEXT_LIMITS.shortText)) {
|
|
865
1018
|
return "trigger.description must be 1-200 characters";
|
|
@@ -869,7 +1022,7 @@ function validatePlaybookEntry(value) {
|
|
|
869
1022
|
return "steps must hold between 2 and 8 steps";
|
|
870
1023
|
}
|
|
871
1024
|
for (const [index, step] of steps2.entries()) {
|
|
872
|
-
if (!
|
|
1025
|
+
if (!isRecord6(step)) return `steps[${index}] must be an object`;
|
|
873
1026
|
if (!isNonEmptyString(step.title, PLAYBOOK_TEXT_LIMITS.stepTitle)) {
|
|
874
1027
|
return `steps[${index}].title must be 1-120 characters`;
|
|
875
1028
|
}
|
|
@@ -881,7 +1034,7 @@ function validatePlaybookEntry(value) {
|
|
|
881
1034
|
const connections = value.connections;
|
|
882
1035
|
if (!Array.isArray(connections)) return "connections must be a list";
|
|
883
1036
|
for (const [index, need] of connections.entries()) {
|
|
884
|
-
if (!
|
|
1037
|
+
if (!isRecord6(need)) return `connections[${index}] must be an object`;
|
|
885
1038
|
if (!isNonEmptyString(need.capability, 64)) return `connections[${index}].capability must be a capability name`;
|
|
886
1039
|
if (typeof need.required !== "boolean") return `connections[${index}].required must be a boolean`;
|
|
887
1040
|
if (!isNonEmptyString(need.reason, PLAYBOOK_TEXT_LIMITS.reason)) {
|
|
@@ -891,14 +1044,14 @@ function validatePlaybookEntry(value) {
|
|
|
891
1044
|
const artefacts = value.artefacts;
|
|
892
1045
|
if (!Array.isArray(artefacts)) return "artefacts must be a list";
|
|
893
1046
|
for (const [index, artefact] of artefacts.entries()) {
|
|
894
|
-
if (!
|
|
1047
|
+
if (!isRecord6(artefact) || !isOneOf2(artefact.kind, PLAYBOOK_ARTEFACT_KINDS)) {
|
|
895
1048
|
return `artefacts[${index}].kind is not a known artefact kind`;
|
|
896
1049
|
}
|
|
897
1050
|
}
|
|
898
1051
|
const escalations = value.escalations;
|
|
899
1052
|
if (!Array.isArray(escalations)) return "escalations must be a list";
|
|
900
1053
|
for (const [index, point] of escalations.entries()) {
|
|
901
|
-
if (!
|
|
1054
|
+
if (!isRecord6(point) || !isOneOf2(point.becomes, PLAYBOOK_ESCALATION_TARGETS)) {
|
|
902
1055
|
return `escalations[${index}].becomes must be approval or escalation`;
|
|
903
1056
|
}
|
|
904
1057
|
}
|
|
@@ -908,14 +1061,14 @@ function validatePlaybookEntry(value) {
|
|
|
908
1061
|
return "tags must be a list of strings";
|
|
909
1062
|
}
|
|
910
1063
|
const provision = value.provision;
|
|
911
|
-
if (!
|
|
1064
|
+
if (!isRecord6(provision)) return "provision must be an object";
|
|
912
1065
|
if (!isNonEmptyString(provision.agentTemplateSlug, 64)) return "provision.agentTemplateSlug is required";
|
|
913
1066
|
if (!isNonEmptyString(provision.agentName, PLAYBOOK_TEXT_LIMITS.shortText))
|
|
914
1067
|
return "provision.agentName is required";
|
|
915
1068
|
if (!Array.isArray(provision.skillSlugs) || provision.skillSlugs.some((slug) => typeof slug !== "string")) {
|
|
916
1069
|
return "provision.skillSlugs must be a list of skill slugs";
|
|
917
1070
|
}
|
|
918
|
-
if (!
|
|
1071
|
+
if (!isRecord6(provision.taskTemplate) || !isNonEmptyString(provision.taskTemplate.name, PLAYBOOK_TEXT_LIMITS.title)) {
|
|
919
1072
|
return "provision.taskTemplate.name is required";
|
|
920
1073
|
}
|
|
921
1074
|
const guardrailsError = validateGuardrailsShape(provision.guardrailsAtAdoption, "provision.guardrailsAtAdoption");
|
|
@@ -954,7 +1107,7 @@ function sanitizePlaybookText(value, max) {
|
|
|
954
1107
|
return value.replace(HTML_TAG_PATTERN, "").trim().slice(0, max);
|
|
955
1108
|
}
|
|
956
1109
|
function acceptPlaybookEntry(value) {
|
|
957
|
-
if (!
|
|
1110
|
+
if (!isRecord6(value)) return { entry: null, violation: "entry must be an object" };
|
|
958
1111
|
let sanitized;
|
|
959
1112
|
try {
|
|
960
1113
|
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,153 @@ 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();
|
|
715
|
+
var FLEET_RUN_TOKEN_ROUTES = Object.freeze([
|
|
716
|
+
// Works — reads, plus the settings update (its merge / check / command
|
|
717
|
+
// fields are refused for run tokens by the Works controller).
|
|
718
|
+
{ method: "GET", pathPattern: "/api/works" },
|
|
719
|
+
{ method: "GET", pathPattern: "/api/works/{id}" },
|
|
720
|
+
{ method: "PUT", pathPattern: "/api/works/{id}" },
|
|
721
|
+
{ method: "GET", pathPattern: "/api/works/{id}/config" },
|
|
722
|
+
{ method: "GET", pathPattern: "/api/works/{id}/items" },
|
|
723
|
+
{ method: "GET", pathPattern: "/api/works/{id}/categories-tags" },
|
|
724
|
+
{ method: "GET", pathPattern: "/api/works/{id}/history" },
|
|
725
|
+
{ method: "GET", pathPattern: "/api/works/{id}/generator-form" },
|
|
726
|
+
{ method: "GET", pathPattern: "/api/works/{id}/schedule" },
|
|
727
|
+
{ method: "GET", pathPattern: "/api/works/{id}/comparisons" },
|
|
728
|
+
{ method: "GET", pathPattern: "/api/works/{id}/comparisons/{slug}" },
|
|
729
|
+
// Knowledge Base (`apps/mcp/src/tools/kb`). A document a run token writes
|
|
730
|
+
// lands `proposed` (review-gated), see the KB controller. No unlock.
|
|
731
|
+
{ method: "GET", pathPattern: "/api/works/{id}/kb/documents" },
|
|
732
|
+
{ method: "POST", pathPattern: "/api/works/{id}/kb/documents" },
|
|
733
|
+
{ method: "GET", pathPattern: "/api/works/{id}/kb/documents/{docIdOrPath}" },
|
|
734
|
+
{ method: "PATCH", pathPattern: "/api/works/{id}/kb/documents/{docId}" },
|
|
735
|
+
{ method: "POST", pathPattern: "/api/works/{id}/kb/documents/{docId}/lock" },
|
|
736
|
+
// Deploy — reads and the capability check only.
|
|
737
|
+
{ method: "GET", pathPattern: "/api/deploy/works/{id}/domains" },
|
|
738
|
+
{ method: "GET", pathPattern: "/api/deploy/providers" },
|
|
739
|
+
{ method: "POST", pathPattern: "/api/deploy/works/{id}/check" },
|
|
740
|
+
// Plugins — read only.
|
|
741
|
+
{ method: "GET", pathPattern: "/api/plugins" },
|
|
742
|
+
{ method: "GET", pathPattern: "/api/plugins/{pluginId}" },
|
|
743
|
+
// Missions — reads, plus pause (the safe direction).
|
|
744
|
+
{ method: "GET", pathPattern: "/api/me/missions" },
|
|
745
|
+
{ method: "GET", pathPattern: "/api/me/missions/{id}" },
|
|
746
|
+
{ method: "GET", pathPattern: "/api/me/missions/{id}/budget" },
|
|
747
|
+
{ method: "GET", pathPattern: "/api/me/missions/{id}/works" },
|
|
748
|
+
{ method: "POST", pathPattern: "/api/me/missions/{id}/pause" },
|
|
749
|
+
// Ideas — reads, plus filing a new Idea (a proposal a person builds).
|
|
750
|
+
{ method: "POST", pathPattern: "/api/me/work-proposals" },
|
|
751
|
+
{ method: "GET", pathPattern: "/api/me/work-proposals" },
|
|
752
|
+
{ method: "GET", pathPattern: "/api/me/work-proposals/status" },
|
|
753
|
+
{ method: "GET", pathPattern: "/api/me/work-proposals/preferences" },
|
|
754
|
+
{ method: "GET", pathPattern: "/api/me/work-proposals/{id}" },
|
|
755
|
+
{ method: "GET", pathPattern: "/api/me/work-proposals/{id}/budget" },
|
|
756
|
+
// Account-wide usage.
|
|
757
|
+
{ method: "GET", pathPattern: "/api/me/usage/account-wide" },
|
|
758
|
+
// Tasks — reads and collaboration writes. Create / update / transition /
|
|
759
|
+
// assign / chat carry body refusals for run tokens in the Tasks
|
|
760
|
+
// controller (no checks, no schedule, no force, no dispatch, no @agent).
|
|
761
|
+
{ method: "GET", pathPattern: "/api/tasks" },
|
|
762
|
+
{ method: "POST", pathPattern: "/api/tasks" },
|
|
763
|
+
{ method: "GET", pathPattern: "/api/tasks/{id}" },
|
|
764
|
+
{ method: "PATCH", pathPattern: "/api/tasks/{id}" },
|
|
765
|
+
{ method: "GET", pathPattern: "/api/tasks/{id}/subtasks" },
|
|
766
|
+
{ method: "GET", pathPattern: "/api/tasks/{id}/activity" },
|
|
767
|
+
{ method: "POST", pathPattern: "/api/tasks/{id}/transition" },
|
|
768
|
+
{ method: "GET", pathPattern: "/api/tasks/{id}/run-candidates" },
|
|
769
|
+
{ method: "GET", pathPattern: "/api/tasks/{id}/pr-status" },
|
|
770
|
+
{ method: "GET", pathPattern: "/api/tasks/{id}/diff" },
|
|
771
|
+
{ method: "POST", pathPattern: "/api/tasks/{id}/assignees" },
|
|
772
|
+
{ method: "POST", pathPattern: "/api/tasks/{id}/reviewers" },
|
|
773
|
+
{ method: "POST", pathPattern: "/api/tasks/{id}/approvers" },
|
|
774
|
+
{ method: "POST", pathPattern: "/api/tasks/{id}/relations" },
|
|
775
|
+
{ method: "GET", pathPattern: "/api/tasks/{id}/escalations" },
|
|
776
|
+
{ method: "GET", pathPattern: "/api/tasks/{id}/chat" },
|
|
777
|
+
{ method: "POST", pathPattern: "/api/tasks/{id}/chat" },
|
|
778
|
+
{ method: "GET", pathPattern: "/api/tasks/{id}/spend" },
|
|
779
|
+
// Inbox — read only (no reply, no archive / delete / mark-read).
|
|
780
|
+
{ method: "GET", pathPattern: "/api/inbox" },
|
|
781
|
+
{ method: "GET", pathPattern: "/api/inbox/unread-count" },
|
|
782
|
+
{ method: "GET", pathPattern: "/api/inbox/{id}" },
|
|
783
|
+
// Goals — reads, a draft create, field-limited update, pause, and the
|
|
784
|
+
// ASKING side of the definition of done (propose, never approve).
|
|
785
|
+
{ method: "GET", pathPattern: "/api/me/goals" },
|
|
786
|
+
{ method: "POST", pathPattern: "/api/me/goals" },
|
|
787
|
+
{ method: "GET", pathPattern: "/api/me/goals/{id}" },
|
|
788
|
+
{ method: "PATCH", pathPattern: "/api/me/goals/{id}" },
|
|
789
|
+
{ method: "GET", pathPattern: "/api/me/goals/{id}/samples" },
|
|
790
|
+
{ method: "POST", pathPattern: "/api/me/goals/{id}/pause" },
|
|
791
|
+
{ method: "POST", pathPattern: "/api/me/goals/{id}/dod/propose" },
|
|
792
|
+
// Fleet — reads only.
|
|
793
|
+
{ method: "GET", pathPattern: "/api/fleet/nodes" },
|
|
794
|
+
{ method: "GET", pathPattern: "/api/fleet/nodes/{id}" },
|
|
795
|
+
{ method: "GET", pathPattern: "/api/fleet/runner-status" },
|
|
796
|
+
{ method: "GET", pathPattern: "/api/fleet/execution-preferences" },
|
|
797
|
+
{ method: "GET", pathPattern: "/api/fleet/agents/{agentId}/node-affinity" },
|
|
798
|
+
// Agents — reads, plus cancel and pause (the safe direction).
|
|
799
|
+
{ method: "GET", pathPattern: "/api/agents" },
|
|
800
|
+
{ method: "GET", pathPattern: "/api/agents/{id}" },
|
|
801
|
+
{ method: "GET", pathPattern: "/api/agents/{id}/runs" },
|
|
802
|
+
{ method: "GET", pathPattern: "/api/agents/{id}/runs/{runId}" },
|
|
803
|
+
{ method: "POST", pathPattern: "/api/agents/{id}/runs/{runId}/cancel" },
|
|
804
|
+
{ method: "POST", pathPattern: "/api/agents/{id}/pause" },
|
|
805
|
+
{ method: "GET", pathPattern: "/api/agents/{id}/budget" },
|
|
806
|
+
// Agent Plugins — read only (installing a package installs instructions).
|
|
807
|
+
{ method: "GET", pathPattern: "/api/agent-plugins" },
|
|
808
|
+
{ method: "GET", pathPattern: "/api/agent-plugins/findings" },
|
|
809
|
+
{ method: "GET", pathPattern: "/api/agent-plugins/catalog" },
|
|
810
|
+
{ method: "GET", pathPattern: "/api/agent-plugins/updates" }
|
|
811
|
+
]);
|
|
812
|
+
function splitSegments(normalizedPath) {
|
|
813
|
+
return normalizedPath.split("/").filter((segment) => segment.length > 0);
|
|
814
|
+
}
|
|
815
|
+
FLEET_RUN_TOKEN_ROUTES.map((route) => ({
|
|
816
|
+
method: route.method.toUpperCase(),
|
|
817
|
+
shape: splitSegments(route.pathPattern).map((part) => /^\{[^}]+\}$/.test(part) ? "*" : part.toLowerCase())
|
|
818
|
+
}));
|
|
666
819
|
var WORKFLOW_EDGE_KINDS = [
|
|
667
820
|
"sequential",
|
|
668
821
|
"on_failure",
|
|
@@ -792,7 +945,7 @@ var PLAYBOOK_MIN_STEPS = 2;
|
|
|
792
945
|
var PLAYBOOK_MAX_STEPS = 8;
|
|
793
946
|
var PLAYBOOK_CAP_KEYS = ["maxPerRun", "maxSourcesTracked", "maxWordCount", "maxDecisionsPerRun"];
|
|
794
947
|
var PLAYBOOK_CAP_MAX = 1e5;
|
|
795
|
-
function
|
|
948
|
+
function isRecord6(value) {
|
|
796
949
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
797
950
|
}
|
|
798
951
|
function isNonEmptyString(value, max) {
|
|
@@ -802,7 +955,7 @@ function isOneOf2(value, allowed) {
|
|
|
802
955
|
return typeof value === "string" && allowed.includes(value);
|
|
803
956
|
}
|
|
804
957
|
function validateGuardrailsShape(value, path) {
|
|
805
|
-
if (!
|
|
958
|
+
if (!isRecord6(value)) return `${path} must be an object`;
|
|
806
959
|
if (!isOneOf2(value.mode, PLAYBOOK_GUARDRAIL_MODES)) return `${path}.mode is not a known guardrail mode`;
|
|
807
960
|
for (const key of ["autoApproveActionTypes", "blockedActionTypes"]) {
|
|
808
961
|
const list = value[key];
|
|
@@ -817,7 +970,7 @@ function isFiniteNonNegative(value) {
|
|
|
817
970
|
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
818
971
|
}
|
|
819
972
|
function validateCapsShape(value) {
|
|
820
|
-
if (!
|
|
973
|
+
if (!isRecord6(value)) return "caps must be an object";
|
|
821
974
|
for (const key of PLAYBOOK_CAP_KEYS) {
|
|
822
975
|
const cap = value[key];
|
|
823
976
|
if (cap === void 0) continue;
|
|
@@ -828,14 +981,14 @@ function validateCapsShape(value) {
|
|
|
828
981
|
return null;
|
|
829
982
|
}
|
|
830
983
|
function validateProvisionGraph(value) {
|
|
831
|
-
if (!
|
|
984
|
+
if (!isRecord6(value)) return "provision.workflowGraph must be an object";
|
|
832
985
|
if (!Array.isArray(value.nodes)) return "provision.workflowGraph.nodes must be a list";
|
|
833
986
|
if (!Array.isArray(value.edges)) return "provision.workflowGraph.edges must be a list";
|
|
834
987
|
const { valid, errors } = validateWorkflowGraph(value);
|
|
835
988
|
return valid ? null : `provision.workflowGraph is invalid: ${errors[0] ?? "unknown error"}`;
|
|
836
989
|
}
|
|
837
990
|
function validatePlaybookEntry(value) {
|
|
838
|
-
if (!
|
|
991
|
+
if (!isRecord6(value)) return "entry must be an object";
|
|
839
992
|
if (typeof value.slug !== "string" || !PLAYBOOK_SLUG_PATTERN.test(value.slug)) {
|
|
840
993
|
return "slug must match ^[a-z0-9][a-z0-9-]{0,63}$";
|
|
841
994
|
}
|
|
@@ -851,11 +1004,11 @@ function validatePlaybookEntry(value) {
|
|
|
851
1004
|
if (typeof value.icon !== "string") return "icon must be a string";
|
|
852
1005
|
if (!isOneOf2(value.costBand, PLAYBOOK_COST_BANDS)) return "costBand is not a known cost band";
|
|
853
1006
|
const estimate = value.estimatedTokensPerRun;
|
|
854
|
-
if (!
|
|
1007
|
+
if (!isRecord6(estimate) || !isFiniteNonNegative(estimate.min) || !isFiniteNonNegative(estimate.max) || estimate.max < estimate.min) {
|
|
855
1008
|
return "estimatedTokensPerRun must be { min, max } with 0 <= min <= max";
|
|
856
1009
|
}
|
|
857
1010
|
const trigger = value.trigger;
|
|
858
|
-
if (!
|
|
1011
|
+
if (!isRecord6(trigger)) return "trigger must be an object";
|
|
859
1012
|
if (!isOneOf2(trigger.kind, PLAYBOOK_TRIGGER_KINDS)) return "trigger.kind is not a known trigger kind";
|
|
860
1013
|
if (!isNonEmptyString(trigger.description, PLAYBOOK_TEXT_LIMITS.shortText)) {
|
|
861
1014
|
return "trigger.description must be 1-200 characters";
|
|
@@ -865,7 +1018,7 @@ function validatePlaybookEntry(value) {
|
|
|
865
1018
|
return "steps must hold between 2 and 8 steps";
|
|
866
1019
|
}
|
|
867
1020
|
for (const [index, step] of steps2.entries()) {
|
|
868
|
-
if (!
|
|
1021
|
+
if (!isRecord6(step)) return `steps[${index}] must be an object`;
|
|
869
1022
|
if (!isNonEmptyString(step.title, PLAYBOOK_TEXT_LIMITS.stepTitle)) {
|
|
870
1023
|
return `steps[${index}].title must be 1-120 characters`;
|
|
871
1024
|
}
|
|
@@ -877,7 +1030,7 @@ function validatePlaybookEntry(value) {
|
|
|
877
1030
|
const connections = value.connections;
|
|
878
1031
|
if (!Array.isArray(connections)) return "connections must be a list";
|
|
879
1032
|
for (const [index, need] of connections.entries()) {
|
|
880
|
-
if (!
|
|
1033
|
+
if (!isRecord6(need)) return `connections[${index}] must be an object`;
|
|
881
1034
|
if (!isNonEmptyString(need.capability, 64)) return `connections[${index}].capability must be a capability name`;
|
|
882
1035
|
if (typeof need.required !== "boolean") return `connections[${index}].required must be a boolean`;
|
|
883
1036
|
if (!isNonEmptyString(need.reason, PLAYBOOK_TEXT_LIMITS.reason)) {
|
|
@@ -887,14 +1040,14 @@ function validatePlaybookEntry(value) {
|
|
|
887
1040
|
const artefacts = value.artefacts;
|
|
888
1041
|
if (!Array.isArray(artefacts)) return "artefacts must be a list";
|
|
889
1042
|
for (const [index, artefact] of artefacts.entries()) {
|
|
890
|
-
if (!
|
|
1043
|
+
if (!isRecord6(artefact) || !isOneOf2(artefact.kind, PLAYBOOK_ARTEFACT_KINDS)) {
|
|
891
1044
|
return `artefacts[${index}].kind is not a known artefact kind`;
|
|
892
1045
|
}
|
|
893
1046
|
}
|
|
894
1047
|
const escalations = value.escalations;
|
|
895
1048
|
if (!Array.isArray(escalations)) return "escalations must be a list";
|
|
896
1049
|
for (const [index, point] of escalations.entries()) {
|
|
897
|
-
if (!
|
|
1050
|
+
if (!isRecord6(point) || !isOneOf2(point.becomes, PLAYBOOK_ESCALATION_TARGETS)) {
|
|
898
1051
|
return `escalations[${index}].becomes must be approval or escalation`;
|
|
899
1052
|
}
|
|
900
1053
|
}
|
|
@@ -904,14 +1057,14 @@ function validatePlaybookEntry(value) {
|
|
|
904
1057
|
return "tags must be a list of strings";
|
|
905
1058
|
}
|
|
906
1059
|
const provision = value.provision;
|
|
907
|
-
if (!
|
|
1060
|
+
if (!isRecord6(provision)) return "provision must be an object";
|
|
908
1061
|
if (!isNonEmptyString(provision.agentTemplateSlug, 64)) return "provision.agentTemplateSlug is required";
|
|
909
1062
|
if (!isNonEmptyString(provision.agentName, PLAYBOOK_TEXT_LIMITS.shortText))
|
|
910
1063
|
return "provision.agentName is required";
|
|
911
1064
|
if (!Array.isArray(provision.skillSlugs) || provision.skillSlugs.some((slug) => typeof slug !== "string")) {
|
|
912
1065
|
return "provision.skillSlugs must be a list of skill slugs";
|
|
913
1066
|
}
|
|
914
|
-
if (!
|
|
1067
|
+
if (!isRecord6(provision.taskTemplate) || !isNonEmptyString(provision.taskTemplate.name, PLAYBOOK_TEXT_LIMITS.title)) {
|
|
915
1068
|
return "provision.taskTemplate.name is required";
|
|
916
1069
|
}
|
|
917
1070
|
const guardrailsError = validateGuardrailsShape(provision.guardrailsAtAdoption, "provision.guardrailsAtAdoption");
|
|
@@ -950,7 +1103,7 @@ function sanitizePlaybookText(value, max) {
|
|
|
950
1103
|
return value.replace(HTML_TAG_PATTERN, "").trim().slice(0, max);
|
|
951
1104
|
}
|
|
952
1105
|
function acceptPlaybookEntry(value) {
|
|
953
|
-
if (!
|
|
1106
|
+
if (!isRecord6(value)) return { entry: null, violation: "entry must be an object" };
|
|
954
1107
|
let sanitized;
|
|
955
1108
|
try {
|
|
956
1109
|
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.6",
|
|
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.12",
|
|
37
|
+
"@ever-works/plugin": "^1.2.8"
|
|
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:00ef5114af4e03b8cd1be73020847694804e88ce3cde0a87c238634e709bc503",
|
|
71
|
+
"commit": "efd11a2282ea3e514e93f754b9b008543a7cff60",
|
|
72
|
+
"source": "https://github.com/ever-works/ever-works/tree/efd11a2282ea3e514e93f754b9b008543a7cff60/packages/plugins/everworks-playbooks"
|
|
73
73
|
}
|
|
74
74
|
}
|