@ever-works/everworks-playbooks-plugin 1.0.5 → 1.0.7

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.
Files changed (3) hide show
  1. package/dist/index.cjs +867 -20
  2. package/dist/index.js +867 -20
  3. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -710,8 +710,855 @@ var FLEET_LINK_CONTROL_TYPES = [
710
710
  "operation.done",
711
711
  "operation.cancel"
712
712
  ];
713
+ var FLEET_CREDENTIAL_FILE_PATTERNS = [
714
+ ".env",
715
+ ".env.*",
716
+ "*.pem",
717
+ "*.key",
718
+ "*.p12",
719
+ "*.pfx",
720
+ "*.jks",
721
+ "*.keystore",
722
+ "*.kdbx",
723
+ "id_rsa*",
724
+ "id_dsa*",
725
+ "id_ecdsa*",
726
+ "id_ed25519*",
727
+ "*.ppk",
728
+ ".netrc",
729
+ ".npmrc",
730
+ ".pypirc",
731
+ "credentials",
732
+ "credentials.json",
733
+ "service-account*.json",
734
+ ".aws/credentials",
735
+ "*.gpg",
736
+ "*.asc",
737
+ ".docker/config.json",
738
+ "kubeconfig",
739
+ ".kube/config"
740
+ ];
741
+ function globToRegExp(glob) {
742
+ const escaped = glob.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
743
+ return new RegExp(`^${escaped}$`, "i");
744
+ }
745
+ FLEET_CREDENTIAL_FILE_PATTERNS.filter((pattern) => !pattern.includes("/")).map(
746
+ globToRegExp
747
+ );
748
+ FLEET_CREDENTIAL_FILE_PATTERNS.filter((pattern) => pattern.includes("/")).map(
749
+ (pattern) => ({ segments: pattern.split("/").length, matcher: globToRegExp(pattern) })
750
+ );
713
751
  new Set(FLEET_LINK_CONTROL_TYPES);
714
752
  new TextEncoder();
753
+ var FLEET_RUN_TOKEN_ROUTES = Object.freeze([
754
+ // Works — reads, plus the settings update (its merge / check / command
755
+ // fields are refused for run tokens by the Works controller).
756
+ { method: "GET", pathPattern: "/api/works" },
757
+ { method: "GET", pathPattern: "/api/works/{id}" },
758
+ { method: "PUT", pathPattern: "/api/works/{id}" },
759
+ { method: "GET", pathPattern: "/api/works/{id}/config" },
760
+ { method: "GET", pathPattern: "/api/works/{id}/items" },
761
+ { method: "GET", pathPattern: "/api/works/{id}/categories-tags" },
762
+ { method: "GET", pathPattern: "/api/works/{id}/history" },
763
+ { method: "GET", pathPattern: "/api/works/{id}/generator-form" },
764
+ { method: "GET", pathPattern: "/api/works/{id}/schedule" },
765
+ { method: "GET", pathPattern: "/api/works/{id}/comparisons" },
766
+ { method: "GET", pathPattern: "/api/works/{id}/comparisons/{slug}" },
767
+ // Knowledge Base (`apps/mcp/src/tools/kb`). A document a run token writes
768
+ // lands `proposed` (review-gated), see the KB controller. No unlock.
769
+ { method: "GET", pathPattern: "/api/works/{id}/kb/documents" },
770
+ { method: "POST", pathPattern: "/api/works/{id}/kb/documents" },
771
+ { method: "GET", pathPattern: "/api/works/{id}/kb/documents/{docIdOrPath}" },
772
+ { method: "PATCH", pathPattern: "/api/works/{id}/kb/documents/{docId}" },
773
+ { method: "POST", pathPattern: "/api/works/{id}/kb/documents/{docId}/lock" },
774
+ // Deploy — reads and the capability check only.
775
+ { method: "GET", pathPattern: "/api/deploy/works/{id}/domains" },
776
+ { method: "GET", pathPattern: "/api/deploy/providers" },
777
+ { method: "POST", pathPattern: "/api/deploy/works/{id}/check" },
778
+ // Plugins — read only.
779
+ { method: "GET", pathPattern: "/api/plugins" },
780
+ { method: "GET", pathPattern: "/api/plugins/{pluginId}" },
781
+ // Missions — reads, plus pause (the safe direction).
782
+ { method: "GET", pathPattern: "/api/me/missions" },
783
+ { method: "GET", pathPattern: "/api/me/missions/{id}" },
784
+ { method: "GET", pathPattern: "/api/me/missions/{id}/budget" },
785
+ { method: "GET", pathPattern: "/api/me/missions/{id}/works" },
786
+ { method: "POST", pathPattern: "/api/me/missions/{id}/pause" },
787
+ // Ideas — reads, plus filing a new Idea (a proposal a person builds).
788
+ { method: "POST", pathPattern: "/api/me/work-proposals" },
789
+ { method: "GET", pathPattern: "/api/me/work-proposals" },
790
+ { method: "GET", pathPattern: "/api/me/work-proposals/status" },
791
+ { method: "GET", pathPattern: "/api/me/work-proposals/preferences" },
792
+ { method: "GET", pathPattern: "/api/me/work-proposals/{id}" },
793
+ { method: "GET", pathPattern: "/api/me/work-proposals/{id}/budget" },
794
+ // Account-wide usage.
795
+ { method: "GET", pathPattern: "/api/me/usage/account-wide" },
796
+ // Tasks — reads and collaboration writes. Create / update / transition /
797
+ // assign / chat carry body refusals for run tokens in the Tasks
798
+ // controller (no checks, no schedule, no force, no dispatch, no @agent).
799
+ { method: "GET", pathPattern: "/api/tasks" },
800
+ { method: "POST", pathPattern: "/api/tasks" },
801
+ { method: "GET", pathPattern: "/api/tasks/{id}" },
802
+ { method: "PATCH", pathPattern: "/api/tasks/{id}" },
803
+ { method: "GET", pathPattern: "/api/tasks/{id}/subtasks" },
804
+ { method: "GET", pathPattern: "/api/tasks/{id}/activity" },
805
+ { method: "POST", pathPattern: "/api/tasks/{id}/transition" },
806
+ { method: "GET", pathPattern: "/api/tasks/{id}/run-candidates" },
807
+ { method: "GET", pathPattern: "/api/tasks/{id}/pr-status" },
808
+ { method: "GET", pathPattern: "/api/tasks/{id}/diff" },
809
+ { method: "POST", pathPattern: "/api/tasks/{id}/assignees" },
810
+ { method: "POST", pathPattern: "/api/tasks/{id}/reviewers" },
811
+ { method: "POST", pathPattern: "/api/tasks/{id}/approvers" },
812
+ { method: "POST", pathPattern: "/api/tasks/{id}/relations" },
813
+ { method: "GET", pathPattern: "/api/tasks/{id}/escalations" },
814
+ { method: "GET", pathPattern: "/api/tasks/{id}/chat" },
815
+ { method: "POST", pathPattern: "/api/tasks/{id}/chat" },
816
+ { method: "GET", pathPattern: "/api/tasks/{id}/spend" },
817
+ // Inbox — read only (no reply, no archive / delete / mark-read).
818
+ { method: "GET", pathPattern: "/api/inbox" },
819
+ { method: "GET", pathPattern: "/api/inbox/unread-count" },
820
+ { method: "GET", pathPattern: "/api/inbox/{id}" },
821
+ // Goals — reads, a draft create, field-limited update, pause, and the
822
+ // ASKING side of the definition of done (propose, never approve).
823
+ { method: "GET", pathPattern: "/api/me/goals" },
824
+ { method: "POST", pathPattern: "/api/me/goals" },
825
+ { method: "GET", pathPattern: "/api/me/goals/{id}" },
826
+ { method: "PATCH", pathPattern: "/api/me/goals/{id}" },
827
+ { method: "GET", pathPattern: "/api/me/goals/{id}/samples" },
828
+ { method: "POST", pathPattern: "/api/me/goals/{id}/pause" },
829
+ { method: "POST", pathPattern: "/api/me/goals/{id}/dod/propose" },
830
+ // Fleet — reads only.
831
+ { method: "GET", pathPattern: "/api/fleet/nodes" },
832
+ { method: "GET", pathPattern: "/api/fleet/nodes/{id}" },
833
+ { method: "GET", pathPattern: "/api/fleet/runner-status" },
834
+ { method: "GET", pathPattern: "/api/fleet/execution-preferences" },
835
+ { method: "GET", pathPattern: "/api/fleet/agents/{agentId}/node-affinity" },
836
+ // Session git & actions (FL-06 FR-18): an Agent session asks the platform to
837
+ // open or update the pull request of ITS OWN checkout. The route refuses a
838
+ // checkout that is not the token's session's, and the Agent's "may open pull
839
+ // requests" permission applies; it never merges anything.
840
+ { method: "GET", pathPattern: "/api/fleet/checkouts/{id}/pull-request" },
841
+ { method: "POST", pathPattern: "/api/fleet/checkouts/{id}/pull-request" },
842
+ // Agents — reads, plus cancel and pause (the safe direction).
843
+ { method: "GET", pathPattern: "/api/agents" },
844
+ { method: "GET", pathPattern: "/api/agents/{id}" },
845
+ { method: "GET", pathPattern: "/api/agents/{id}/runs" },
846
+ { method: "GET", pathPattern: "/api/agents/{id}/runs/{runId}" },
847
+ { method: "POST", pathPattern: "/api/agents/{id}/runs/{runId}/cancel" },
848
+ { method: "POST", pathPattern: "/api/agents/{id}/pause" },
849
+ { method: "GET", pathPattern: "/api/agents/{id}/budget" },
850
+ // Agent Plugins — read only (installing a package installs instructions).
851
+ { method: "GET", pathPattern: "/api/agent-plugins" },
852
+ { method: "GET", pathPattern: "/api/agent-plugins/findings" },
853
+ { method: "GET", pathPattern: "/api/agent-plugins/catalog" },
854
+ { method: "GET", pathPattern: "/api/agent-plugins/updates" }
855
+ ]);
856
+ function splitSegments(normalizedPath) {
857
+ return normalizedPath.split("/").filter((segment) => segment.length > 0);
858
+ }
859
+ FLEET_RUN_TOKEN_ROUTES.map((route) => ({
860
+ method: route.method.toUpperCase(),
861
+ shape: splitSegments(route.pathPattern).map((part) => /^\{[^}]+\}$/.test(part) ? "*" : part.toLowerCase())
862
+ }));
863
+ function row(input) {
864
+ const rest = input.name.slice("fleet_".length);
865
+ const cut = rest.indexOf("_");
866
+ const family = cut === -1 ? rest : rest.slice(0, cut);
867
+ const verb = cut === -1 ? "" : rest.slice(cut + 1);
868
+ return Object.freeze({ ...input, family, verb });
869
+ }
870
+ function read(name, permissionFamily, owner, flag, status, extra = {}) {
871
+ return row({
872
+ name,
873
+ readOnly: true,
874
+ category: "read.internal",
875
+ permissionFamily,
876
+ owner,
877
+ phase: "P1",
878
+ flag,
879
+ status,
880
+ ...extra
881
+ });
882
+ }
883
+ function act(name, permissionFamily, owner, flag, status, annotation, extra = {}) {
884
+ return row({ name, permissionFamily, owner, phase: "P2", flag, status, ...annotation, ...extra });
885
+ }
886
+ var plain = (category, destructive = false) => ({
887
+ destructive,
888
+ confirmationClass: "plain",
889
+ category
890
+ });
891
+ var confirm = (category, destructive = true) => ({
892
+ destructive,
893
+ confirmationClass: "confirm",
894
+ category
895
+ });
896
+ var typed = (category) => ({
897
+ destructive: true,
898
+ confirmationClass: "confirm-destructive",
899
+ category
900
+ });
901
+ var GET = (path) => ({ method: "GET", path });
902
+ var POST = (path) => ({ method: "POST", path });
903
+ var PATCH = (path) => ({ method: "PATCH", path });
904
+ var DELETE = (path) => ({ method: "DELETE", path });
905
+ var FLEET_TOOL_CATALOGUE = Object.freeze([
906
+ // ── status (FL-19) ──
907
+ read("fleet_status", "view", "FL-19", "FLEET_ENABLED", "live", {
908
+ route: GET("/api/fleet/status"),
909
+ cli: "fleet status"
910
+ }),
911
+ // ── nodes (FL-19, FL-03, FL-15) ──
912
+ read("fleet_nodes_list", "view", "FL-19", "FLEET_ENABLED", "live", {
913
+ route: GET("/api/fleet/nodes"),
914
+ cli: "fleet nodes list"
915
+ }),
916
+ read("fleet_nodes_get", "view", "FL-19", "FLEET_ENABLED", "live", {
917
+ route: GET("/api/fleet/nodes/{id}"),
918
+ cli: "fleet nodes get"
919
+ }),
920
+ read("fleet_nodes_health", "view", "FL-03", "FLEET_ENABLED", "live", {
921
+ route: GET("/api/fleet/nodes/{id}/health"),
922
+ cli: "fleet nodes health"
923
+ }),
924
+ read("fleet_nodes_needs_a_look", "view", "FL-03", "FLEET_ENABLED", "live", {
925
+ route: GET("/api/fleet/nodes/{id}/needs-a-look"),
926
+ cli: "fleet nodes needs-a-look"
927
+ }),
928
+ read("fleet_nodes_git_identity_get", "view", "FL-15", "FLEET_CHECKOUTS_ENABLED", "live", {
929
+ route: GET("/api/fleet/nodes/{id}/git/identity"),
930
+ cli: "fleet nodes git-identity"
931
+ }),
932
+ act("fleet_nodes_wake", "machines", "FL-03", "FLEET_ENABLED", "live", plain("machine.admin"), {
933
+ route: POST("/api/fleet/nodes/{id}/wake"),
934
+ cli: "fleet nodes wake"
935
+ }),
936
+ act(
937
+ "fleet_nodes_git_identity_set",
938
+ "commands",
939
+ "FL-15",
940
+ "FLEET_CHECKOUTS_ENABLED",
941
+ "live",
942
+ confirm("machine.admin", false),
943
+ { route: POST("/api/fleet/nodes/{id}/git/identity"), cli: "fleet nodes git-identity --set" }
944
+ ),
945
+ // ── sessions (FL-04, FL-05, FL-06) ──
946
+ read("fleet_sessions_list", "sessions", "FL-04", "FLEET_SESSIONS_ENABLED", "live", {
947
+ route: GET("/api/fleet/sessions"),
948
+ cli: "fleet sessions list"
949
+ }),
950
+ read("fleet_sessions_read", "sessions", "FL-04", "FLEET_SESSIONS_ENABLED", "live", {
951
+ route: GET("/api/fleet/sessions/{id}"),
952
+ cli: "fleet sessions read"
953
+ }),
954
+ read("fleet_sessions_question", "sessions", "FL-05", "FLEET_SESSIONS_ENABLED", "live", {
955
+ route: GET("/api/fleet/sessions/{id}"),
956
+ cli: "fleet sessions question"
957
+ }),
958
+ read("fleet_sessions_actions_list", "sessions", "FL-06", "FLEET_SESSIONS_ENABLED", "planned", {
959
+ route: GET("/api/fleet/sessions/{id}/actions"),
960
+ cli: "fleet sessions actions"
961
+ }),
962
+ act("fleet_sessions_start", "sessions", "FL-04", "FLEET_SESSIONS_ENABLED", "live", plain("machine.run"), {
963
+ route: POST("/api/fleet/nodes/{id}/sessions"),
964
+ cli: "fleet sessions start"
965
+ }),
966
+ act("fleet_sessions_send", "sessions", "FL-04", "FLEET_SESSIONS_ENABLED", "live", plain("machine.run")),
967
+ act("fleet_sessions_answer", "sessions", "FL-05", "FLEET_SESSIONS_ENABLED", "live", confirm("machine.run", false), {
968
+ route: POST("/api/fleet/sessions/{id}/answer"),
969
+ cli: "fleet sessions answer",
970
+ confirmationNote: "questions only; a permission prompt is answered by a person (CONTRACTS R-32)"
971
+ }),
972
+ act("fleet_sessions_rename", "sessions", "FL-04", "FLEET_SESSIONS_ENABLED", "live", plain("write.internal"), {
973
+ route: PATCH("/api/fleet/sessions/{id}"),
974
+ cli: "fleet sessions rename"
975
+ }),
976
+ act("fleet_sessions_end", "sessions", "FL-04", "FLEET_SESSIONS_ENABLED", "live", confirm("machine.run"), {
977
+ route: POST("/api/fleet/sessions/{id}/end"),
978
+ cli: "fleet sessions end"
979
+ }),
980
+ act("fleet_sessions_action", "sessions", "FL-06", "FLEET_SESSIONS_ENABLED", "planned", plain("machine.run"), {
981
+ route: POST("/api/fleet/sessions/{id}/actions"),
982
+ cli: "fleet sessions action"
983
+ }),
984
+ // ── desktop (FL-07, FL-11 paste) ──
985
+ read("fleet_desktop_screenshot", "desktop", "FL-07", "FLEET_DESKTOP_ENABLED", "planned", {
986
+ route: GET("/api/fleet/nodes/{id}/desktop/screenshot"),
987
+ cli: "fleet desktop screenshot"
988
+ }),
989
+ read("fleet_desktop_displays", "desktop", "FL-07", "FLEET_DESKTOP_ENABLED", "planned", {
990
+ route: GET("/api/fleet/nodes/{id}/desktop/displays"),
991
+ cli: "fleet desktop displays"
992
+ }),
993
+ read("fleet_desktop_recordings_list", "desktop", "FL-07", "FLEET_DESKTOP_ENABLED", "planned", {
994
+ route: GET("/api/fleet/nodes/{id}/desktop/recordings"),
995
+ cli: "fleet desktop recordings"
996
+ }),
997
+ act("fleet_desktop_input", "desktop", "FL-07", "FLEET_DESKTOP_ENABLED", "planned", plain("machine.admin", true), {
998
+ route: POST("/api/fleet/nodes/{id}/desktop/input"),
999
+ cli: "fleet desktop input"
1000
+ }),
1001
+ act("fleet_desktop_set_display", "desktop", "FL-07", "FLEET_DESKTOP_ENABLED", "planned", plain("machine.admin"), {
1002
+ route: POST("/api/fleet/nodes/{id}/desktop/displays"),
1003
+ cli: "fleet desktop set-display"
1004
+ }),
1005
+ act("fleet_desktop_display_add", "desktop", "FL-07", "FLEET_DESKTOP_ENABLED", "planned", confirm("machine.admin"), {
1006
+ phase: "P3",
1007
+ route: POST("/api/fleet/nodes/{id}/desktop/displays/virtual"),
1008
+ cli: "fleet desktop display-add"
1009
+ }),
1010
+ act(
1011
+ "fleet_desktop_display_remove",
1012
+ "desktop",
1013
+ "FL-07",
1014
+ "FLEET_DESKTOP_ENABLED",
1015
+ "planned",
1016
+ confirm("machine.admin"),
1017
+ {
1018
+ phase: "P3",
1019
+ route: DELETE("/api/fleet/nodes/{id}/desktop/displays/virtual/{displayId}"),
1020
+ cli: "fleet desktop display-remove"
1021
+ }
1022
+ ),
1023
+ act(
1024
+ "fleet_desktop_paste",
1025
+ "desktop",
1026
+ "FL-11",
1027
+ "FLEET_MACHINE_FACTS_ENABLED",
1028
+ "planned",
1029
+ plain("machine.admin", true),
1030
+ {
1031
+ route: POST("/api/fleet/nodes/{id}/desktop/paste"),
1032
+ cli: "fleet desktop paste",
1033
+ confirmationNote: "denied unless a tool grant allows it (AW-15)"
1034
+ }
1035
+ ),
1036
+ // ── logs (FL-08) ──
1037
+ read("fleet_logs_sources", "logs", "FL-08", "FLEET_MACHINE_FACTS_ENABLED", "live", {
1038
+ route: GET("/api/fleet/nodes/{id}/logs/sources"),
1039
+ cli: "fleet logs sources"
1040
+ }),
1041
+ read("fleet_logs_read", "logs", "FL-08", "FLEET_MACHINE_FACTS_ENABLED", "live", {
1042
+ route: POST("/api/fleet/nodes/{id}/logs/read"),
1043
+ cli: "fleet logs read"
1044
+ }),
1045
+ // ── services (FL-09) ──
1046
+ read("fleet_services_list", "services", "FL-09", "FLEET_MACHINE_FACTS_ENABLED", "live", {
1047
+ route: GET("/api/fleet/nodes/{id}/services"),
1048
+ cli: "fleet services list"
1049
+ }),
1050
+ act("fleet_services_action", "services", "FL-09", "FLEET_MACHINE_FACTS_ENABLED", "live", confirm("machine.admin"), {
1051
+ route: POST("/api/fleet/nodes/{id}/services/{name}/{action}"),
1052
+ cli: "fleet services action",
1053
+ waitable: true,
1054
+ confirmationNote: "confirm; blast-radius when the node warns it could cut the machine off"
1055
+ }),
1056
+ // ── processes (FL-09) ──
1057
+ read("fleet_processes_list", "processes", "FL-09", "FLEET_MACHINE_FACTS_ENABLED", "live", {
1058
+ route: GET("/api/fleet/nodes/{id}/processes"),
1059
+ cli: "fleet processes list"
1060
+ }),
1061
+ act(
1062
+ "fleet_processes_signal",
1063
+ "processes",
1064
+ "FL-09",
1065
+ "FLEET_MACHINE_FACTS_ENABLED",
1066
+ "live",
1067
+ confirm("machine.admin"),
1068
+ { route: POST("/api/fleet/nodes/{id}/processes/{pid}/signal"), cli: "fleet processes signal" }
1069
+ ),
1070
+ // ── docker (FL-09) ──
1071
+ read("fleet_docker_containers_list", "docker", "FL-09", "FLEET_MACHINE_FACTS_ENABLED", "live", {
1072
+ route: GET("/api/fleet/nodes/{id}/docker/containers"),
1073
+ cli: "fleet docker containers"
1074
+ }),
1075
+ read("fleet_docker_images_list", "docker", "FL-09", "FLEET_MACHINE_FACTS_ENABLED", "live", {
1076
+ route: GET("/api/fleet/nodes/{id}/docker/images"),
1077
+ cli: "fleet docker images"
1078
+ }),
1079
+ read("fleet_docker_compose_list", "docker", "FL-09", "FLEET_MACHINE_FACTS_ENABLED", "live", {
1080
+ route: GET("/api/fleet/nodes/{id}/docker/compose"),
1081
+ cli: "fleet docker compose"
1082
+ }),
1083
+ read("fleet_docker_compose_describe", "docker", "FL-09", "FLEET_MACHINE_FACTS_ENABLED", "live", {
1084
+ cli: "fleet docker compose-describe"
1085
+ }),
1086
+ act(
1087
+ "fleet_docker_container_action",
1088
+ "docker",
1089
+ "FL-09",
1090
+ "FLEET_MACHINE_FACTS_ENABLED",
1091
+ "live",
1092
+ confirm("machine.admin"),
1093
+ {
1094
+ route: POST("/api/fleet/nodes/{id}/docker/containers/{cid}/{action}"),
1095
+ cli: "fleet docker container",
1096
+ waitable: true,
1097
+ confirmationNote: "confirm; remove is confirm-destructive"
1098
+ }
1099
+ ),
1100
+ act("fleet_docker_run", "docker", "FL-09", "FLEET_MACHINE_FACTS_ENABLED", "live", confirm("machine.admin", false), {
1101
+ route: POST("/api/fleet/nodes/{id}/docker/containers"),
1102
+ cli: "fleet docker run",
1103
+ waitable: true,
1104
+ alwaysHeld: true,
1105
+ confirmationNote: "an Agent proposes a run; a person types any secret values"
1106
+ }),
1107
+ act(
1108
+ "fleet_docker_image_action",
1109
+ "docker",
1110
+ "FL-09",
1111
+ "FLEET_MACHINE_FACTS_ENABLED",
1112
+ "live",
1113
+ confirm("machine.admin"),
1114
+ {
1115
+ route: POST("/api/fleet/nodes/{id}/docker/images/{iid}/{action}"),
1116
+ cli: "fleet docker image",
1117
+ waitable: true,
1118
+ confirmationNote: "pull is plain and not destructive; remove and prune confirm"
1119
+ }
1120
+ ),
1121
+ act(
1122
+ "fleet_docker_compose_action",
1123
+ "docker",
1124
+ "FL-09",
1125
+ "FLEET_MACHINE_FACTS_ENABLED",
1126
+ "live",
1127
+ confirm("machine.admin"),
1128
+ {
1129
+ route: POST("/api/fleet/nodes/{id}/docker/compose/{project}/{action}"),
1130
+ cli: "fleet docker compose-action",
1131
+ waitable: true,
1132
+ confirmationNote: "destructive for down"
1133
+ }
1134
+ ),
1135
+ act("fleet_docker_exec", "docker", "FL-09", "FLEET_MACHINE_FACTS_ENABLED", "planned", plain("machine.run"), {
1136
+ phase: "P3",
1137
+ cli: "fleet docker exec"
1138
+ }),
1139
+ // ── ports (FL-10) ──
1140
+ read("fleet_ports_list", "view", "FL-10", "FLEET_MACHINE_FACTS_ENABLED", "live", {
1141
+ route: GET("/api/fleet/nodes/{id}/ports"),
1142
+ cli: "fleet ports list"
1143
+ }),
1144
+ act("fleet_ports_open", "ports", "FL-10", "FLEET_MACHINE_FACTS_ENABLED", "live", plain("machine.run"), {
1145
+ route: POST("/api/fleet/nodes/{id}/ports/{port}/open"),
1146
+ cli: "fleet ports open"
1147
+ }),
1148
+ act("fleet_ports_preview_open", "ports", "FL-10", "FLEET_PORT_TUNNEL_ENABLED", "live", plain("machine.run"), {
1149
+ route: POST("/api/fleet/nodes/{id}/ports/{port}/preview"),
1150
+ cli: "fleet ports preview"
1151
+ }),
1152
+ act("fleet_ports_preview_close", "ports", "FL-10", "FLEET_PORT_TUNNEL_ENABLED", "live", plain("machine.run"), {
1153
+ route: DELETE("/api/fleet/nodes/{id}/ports/{port}/preview"),
1154
+ cli: "fleet ports preview-close"
1155
+ }),
1156
+ // ── files (FL-11) ──
1157
+ // P1 (FL-11 lane log decision 15): the roots read joins the family, and the list's route is the
1158
+ // one FL-11 built (`…/files/list` — `…/files` is the family's prefix, not a route).
1159
+ read("fleet_files_roots", "files", "FL-11", "FLEET_MACHINE_FACTS_ENABLED", "live", {
1160
+ route: GET("/api/fleet/nodes/{id}/files/roots"),
1161
+ cli: "fleet files roots"
1162
+ }),
1163
+ read("fleet_files_list", "files", "FL-11", "FLEET_MACHINE_FACTS_ENABLED", "live", {
1164
+ route: GET("/api/fleet/nodes/{id}/files/list"),
1165
+ cli: "fleet files list"
1166
+ }),
1167
+ read("fleet_files_stat", "files", "FL-11", "FLEET_MACHINE_FACTS_ENABLED", "live", {
1168
+ route: GET("/api/fleet/nodes/{id}/files/stat"),
1169
+ cli: "fleet files stat"
1170
+ }),
1171
+ read("fleet_files_read", "files", "FL-11", "FLEET_MACHINE_FACTS_ENABLED", "planned", {
1172
+ route: GET("/api/fleet/nodes/{id}/files/download"),
1173
+ cli: "fleet files get"
1174
+ }),
1175
+ act("fleet_files_write", "files", "FL-11", "FLEET_MACHINE_FACTS_ENABLED", "planned", confirm("machine.admin"), {
1176
+ route: POST("/api/fleet/nodes/{id}/files/upload"),
1177
+ cli: "fleet files put"
1178
+ }),
1179
+ act("fleet_files_copy", "files", "FL-11", "FLEET_MACHINE_FACTS_ENABLED", "live", confirm("machine.admin"), {
1180
+ route: POST("/api/fleet/nodes/{id}/files/copy"),
1181
+ cli: "fleet files cp",
1182
+ // FL-11 P2 (lane log decision 18): an Agent's copy is held for a person, like its delete.
1183
+ alwaysHeld: true
1184
+ }),
1185
+ act("fleet_files_delete", "files", "FL-11", "FLEET_MACHINE_FACTS_ENABLED", "live", typed("write.destructive"), {
1186
+ route: POST("/api/fleet/nodes/{id}/files/delete"),
1187
+ cli: "fleet files rm",
1188
+ alwaysHeld: true
1189
+ }),
1190
+ // ── commands (FL-12) ──
1191
+ read("fleet_commands_list", "commands", "FL-12", "FLEET_COMMANDS_ENABLED", "live", {
1192
+ route: GET("/api/fleet/commands"),
1193
+ cli: "fleet commands list"
1194
+ }),
1195
+ read("fleet_commands_get", "commands", "FL-12", "FLEET_COMMANDS_ENABLED", "live", {
1196
+ route: GET("/api/fleet/commands/{id}"),
1197
+ cli: "fleet commands get"
1198
+ }),
1199
+ act("fleet_commands_run", "commands", "FL-12", "FLEET_COMMANDS_ENABLED", "live", confirm("machine.run"), {
1200
+ route: POST("/api/fleet/commands"),
1201
+ cli: "fleet commands run",
1202
+ alwaysHeld: true
1203
+ }),
1204
+ act("fleet_commands_cancel", "commands", "FL-12", "FLEET_COMMANDS_ENABLED", "live", plain("machine.run"), {
1205
+ route: POST("/api/fleet/commands/{id}/cancel"),
1206
+ cli: "fleet commands cancel"
1207
+ }),
1208
+ // ── schedules (FL-13 P2: live — `apps/api/src/fleet/schedules/fleet-schedules.controller.ts`) ──
1209
+ read("fleet_schedules_list", "schedules", "FL-13", "FLEET_COMMANDS_ENABLED", "live", {
1210
+ route: GET("/api/fleet/schedules"),
1211
+ cli: "fleet schedules list"
1212
+ }),
1213
+ read("fleet_schedules_get", "schedules", "FL-13", "FLEET_COMMANDS_ENABLED", "live", {
1214
+ route: GET("/api/fleet/schedules/{id}"),
1215
+ cli: "fleet schedules get"
1216
+ }),
1217
+ read("fleet_schedules_runs", "schedules", "FL-13", "FLEET_COMMANDS_ENABLED", "live", {
1218
+ route: GET("/api/fleet/schedules/{id}/runs"),
1219
+ cli: "fleet schedules runs"
1220
+ }),
1221
+ act("fleet_schedules_create", "schedules", "FL-13", "FLEET_COMMANDS_ENABLED", "live", confirm("agent.fanout"), {
1222
+ route: POST("/api/fleet/schedules"),
1223
+ cli: "fleet schedules create"
1224
+ }),
1225
+ act("fleet_schedules_update", "schedules", "FL-13", "FLEET_COMMANDS_ENABLED", "live", confirm("agent.fanout"), {
1226
+ route: PATCH("/api/fleet/schedules/{id}"),
1227
+ cli: "fleet schedules update"
1228
+ }),
1229
+ act(
1230
+ "fleet_schedules_delete",
1231
+ "schedules",
1232
+ "FL-13",
1233
+ "FLEET_COMMANDS_ENABLED",
1234
+ "live",
1235
+ confirm("write.destructive"),
1236
+ { route: DELETE("/api/fleet/schedules/{id}"), cli: "fleet schedules delete" }
1237
+ ),
1238
+ act("fleet_schedules_run", "schedules", "FL-13", "FLEET_COMMANDS_ENABLED", "live", confirm("machine.run"), {
1239
+ route: POST("/api/fleet/schedules/{id}/run"),
1240
+ cli: "fleet schedules run"
1241
+ }),
1242
+ act("fleet_schedules_pause", "schedules", "FL-13", "FLEET_COMMANDS_ENABLED", "live", plain("agent.fanout"), {
1243
+ route: POST("/api/fleet/schedules/{id}/pause"),
1244
+ cli: "fleet schedules pause"
1245
+ }),
1246
+ act("fleet_schedules_resume", "schedules", "FL-13", "FLEET_COMMANDS_ENABLED", "live", plain("agent.fanout"), {
1247
+ route: POST("/api/fleet/schedules/{id}/resume"),
1248
+ cli: "fleet schedules resume"
1249
+ }),
1250
+ // ── checkouts (FL-14, FL-06) ──
1251
+ read("fleet_checkouts_list", "checkouts", "FL-14", "FLEET_CHECKOUTS_ENABLED", "live", {
1252
+ route: GET("/api/fleet/checkouts"),
1253
+ cli: "fleet checkouts list"
1254
+ }),
1255
+ read("fleet_checkouts_get", "checkouts", "FL-14", "FLEET_CHECKOUTS_ENABLED", "live", {
1256
+ route: GET("/api/fleet/checkouts/{id}"),
1257
+ cli: "fleet checkouts get"
1258
+ }),
1259
+ read("fleet_checkouts_changes", "checkouts", "FL-06", "FLEET_CHECKOUTS_ENABLED", "planned", {
1260
+ route: GET("/api/fleet/checkouts/{id}/changes"),
1261
+ cli: "fleet checkouts changes"
1262
+ }),
1263
+ act("fleet_checkouts_create", "checkouts", "FL-14", "FLEET_CHECKOUTS_ENABLED", "live", plain("machine.run"), {
1264
+ route: POST("/api/fleet/checkouts"),
1265
+ cli: "fleet checkouts create",
1266
+ waitable: true
1267
+ }),
1268
+ act("fleet_checkouts_sync", "checkouts", "FL-14", "FLEET_CHECKOUTS_ENABLED", "live", plain("machine.run"), {
1269
+ route: POST("/api/fleet/checkouts/{id}/sync"),
1270
+ cli: "fleet checkouts sync",
1271
+ waitable: true,
1272
+ confirmationNote: "plain for fetch; confirm for pull and push"
1273
+ }),
1274
+ act(
1275
+ "fleet_checkouts_archive",
1276
+ "checkouts",
1277
+ "FL-14",
1278
+ "FLEET_CHECKOUTS_ENABLED",
1279
+ "live",
1280
+ confirm("machine.run", false),
1281
+ { route: POST("/api/fleet/checkouts/{id}/archive"), cli: "fleet checkouts archive" }
1282
+ ),
1283
+ act(
1284
+ "fleet_checkouts_delete",
1285
+ "checkouts",
1286
+ "FL-14",
1287
+ "FLEET_CHECKOUTS_ENABLED",
1288
+ "live",
1289
+ confirm("write.destructive"),
1290
+ {
1291
+ route: DELETE("/api/fleet/checkouts/{id}"),
1292
+ cli: "fleet checkouts delete",
1293
+ confirmationNote: "confirm; confirm-destructive when it has uncommitted changes"
1294
+ }
1295
+ ),
1296
+ act(
1297
+ "fleet_checkouts_open_pull_request",
1298
+ "checkouts",
1299
+ "FL-06",
1300
+ "FLEET_CHECKOUTS_ENABLED",
1301
+ "planned",
1302
+ plain("publish.external"),
1303
+ { route: POST("/api/fleet/checkouts/{id}/pull-request"), cli: "fleet checkouts pull-request" }
1304
+ ),
1305
+ // ── tasks (FL-15) ── the hand-off itself is `fleet_sessions_start` with `taskId`
1306
+ read("fleet_tasks_handoff_options", "sessions", "FL-15", "FLEET_CHECKOUTS_ENABLED", "live", {
1307
+ route: GET("/api/fleet/tasks/{taskId}/handoff-options"),
1308
+ cli: "fleet tasks handoff-options"
1309
+ }),
1310
+ // ── virtual (FL-16) ── P1 shipped: Containers. A create, a stop and a destroy are held for
1311
+ // the owner's approval by the Agent tools (`agent-fleet-virtual-tools.ts`).
1312
+ read("fleet_virtual_list", "view", "FL-16", "FLEET_VIRTUAL_ENABLED", "live", {
1313
+ phase: "P3",
1314
+ route: GET("/api/fleet/nodes/{id}/virtual"),
1315
+ cli: "fleet virtual list"
1316
+ }),
1317
+ read("fleet_virtual_options", "view", "FL-16", "FLEET_VIRTUAL_ENABLED", "live", {
1318
+ phase: "P3",
1319
+ route: GET("/api/fleet/nodes/{id}/virtual/options"),
1320
+ cli: "fleet virtual options"
1321
+ }),
1322
+ act("fleet_virtual_create", "machines", "FL-16", "FLEET_VIRTUAL_ENABLED", "live", confirm("machine.admin"), {
1323
+ phase: "P3",
1324
+ route: POST("/api/fleet/nodes/{id}/virtual"),
1325
+ cli: "fleet virtual create",
1326
+ waitable: true,
1327
+ alwaysHeld: true
1328
+ }),
1329
+ act("fleet_virtual_power", "machines", "FL-16", "FLEET_VIRTUAL_ENABLED", "live", confirm("machine.admin"), {
1330
+ phase: "P3",
1331
+ route: POST("/api/fleet/nodes/{id}/virtual/{childId}/power"),
1332
+ cli: "fleet virtual power",
1333
+ waitable: true,
1334
+ confirmationNote: "plain to start; confirm to stop (an Agent's stop is held for the owner)"
1335
+ }),
1336
+ act("fleet_virtual_destroy", "machines", "FL-16", "FLEET_VIRTUAL_ENABLED", "live", typed("write.destructive"), {
1337
+ phase: "P3",
1338
+ route: POST("/api/fleet/nodes/{id}/virtual/{childId}/destroy"),
1339
+ cli: "fleet virtual destroy",
1340
+ waitable: true,
1341
+ alwaysHeld: true
1342
+ }),
1343
+ // ── cloud (FL-17) ── P1 shipped: providers, create, power, destroy, usage. A create, a power
1344
+ // change and a destroy are held for the owner's approval by the Agent tools
1345
+ // (`agent-fleet-cloud-tools.ts`); the idle policy arrives with P2.
1346
+ read("fleet_cloud_list", "view", "FL-17", "FLEET_CLOUD_ENABLED", "live", {
1347
+ phase: "P3",
1348
+ route: GET("/api/fleet/cloud"),
1349
+ cli: "fleet cloud list"
1350
+ }),
1351
+ read("fleet_cloud_options", "view", "FL-17", "FLEET_CLOUD_ENABLED", "live", {
1352
+ phase: "P3",
1353
+ route: GET("/api/fleet/providers/{plugin}/options"),
1354
+ cli: "fleet cloud options"
1355
+ }),
1356
+ read("fleet_cloud_usage", "view", "FL-17", "FLEET_CLOUD_ENABLED", "live", {
1357
+ phase: "P3",
1358
+ route: GET("/api/fleet/cloud/usage"),
1359
+ cli: "fleet cloud usage"
1360
+ }),
1361
+ act("fleet_cloud_create", "machines", "FL-17", "FLEET_CLOUD_ENABLED", "live", confirm("spend.metered"), {
1362
+ phase: "P3",
1363
+ route: POST("/api/fleet/cloud"),
1364
+ cli: "fleet cloud create",
1365
+ waitable: true,
1366
+ alwaysHeld: true,
1367
+ confirmationNote: "confirm with the price (acknowledgedPriceCents); also machine.admin"
1368
+ }),
1369
+ act("fleet_cloud_power", "machines", "FL-17", "FLEET_CLOUD_ENABLED", "live", confirm("machine.admin"), {
1370
+ phase: "P3",
1371
+ route: POST("/api/fleet/cloud/{id}/power"),
1372
+ cli: "fleet cloud power",
1373
+ waitable: true,
1374
+ alwaysHeld: true
1375
+ }),
1376
+ act("fleet_cloud_destroy", "machines", "FL-17", "FLEET_CLOUD_ENABLED", "live", typed("write.destructive"), {
1377
+ phase: "P3",
1378
+ // FL-17 plan §5 — `DELETE /api/fleet/cloud/{id}` answers the same (an alias).
1379
+ route: POST("/api/fleet/cloud/{id}/destroy"),
1380
+ cli: "fleet cloud destroy",
1381
+ waitable: true,
1382
+ alwaysHeld: true
1383
+ }),
1384
+ act("fleet_cloud_idle_policy", "machines", "FL-17", "FLEET_CLOUD_ENABLED", "planned", plain("machine.admin"), {
1385
+ phase: "P3",
1386
+ route: PATCH("/api/fleet/cloud/{id}/idle-policy"),
1387
+ cli: "fleet cloud idle-policy"
1388
+ }),
1389
+ // ── runners (FL-18) ──
1390
+ read("fleet_runners_list", "view", "FL-18", "FLEET_ACTIONS_RUNNERS_ENABLED", "planned", {
1391
+ phase: "P3",
1392
+ route: GET("/api/fleet/nodes/{id}/runners"),
1393
+ cli: "fleet runners list"
1394
+ }),
1395
+ read("fleet_runners_jobs", "view", "FL-18", "FLEET_ACTIONS_RUNNERS_ENABLED", "planned", {
1396
+ phase: "P3",
1397
+ route: GET("/api/fleet/runners/jobs"),
1398
+ cli: "fleet runners jobs"
1399
+ }),
1400
+ act(
1401
+ "fleet_runners_install",
1402
+ "machines",
1403
+ "FL-18",
1404
+ "FLEET_ACTIONS_RUNNERS_ENABLED",
1405
+ "planned",
1406
+ confirm("machine.admin"),
1407
+ { phase: "P3", route: POST("/api/fleet/nodes/{id}/runners"), cli: "fleet runners install", waitable: true }
1408
+ ),
1409
+ act(
1410
+ "fleet_runners_action",
1411
+ "machines",
1412
+ "FL-18",
1413
+ "FLEET_ACTIONS_RUNNERS_ENABLED",
1414
+ "planned",
1415
+ confirm("machine.admin"),
1416
+ {
1417
+ phase: "P3",
1418
+ route: POST("/api/fleet/nodes/{id}/runners/{runnerId}/{action}"),
1419
+ cli: "fleet runners action",
1420
+ waitable: true,
1421
+ confirmationNote: "plain to start; confirm to stop and restart"
1422
+ }
1423
+ ),
1424
+ act(
1425
+ "fleet_runners_remove",
1426
+ "machines",
1427
+ "FL-18",
1428
+ "FLEET_ACTIONS_RUNNERS_ENABLED",
1429
+ "planned",
1430
+ typed("write.destructive"),
1431
+ { phase: "P3", route: DELETE("/api/fleet/nodes/{id}/runners/{runnerId}"), cli: "fleet runners remove" }
1432
+ ),
1433
+ act(
1434
+ "fleet_runners_cancel_run",
1435
+ "machines",
1436
+ "FL-18",
1437
+ "FLEET_ACTIONS_RUNNERS_ENABLED",
1438
+ "planned",
1439
+ confirm("machine.admin"),
1440
+ { phase: "P3", route: POST("/api/fleet/runners/jobs/{jobId}/cancel"), cli: "fleet runners cancel-run" }
1441
+ ),
1442
+ // ── usage (FL-20) ──
1443
+ read("fleet_usage_get", "view", "FL-20", "FLEET_USAGE_SCAN_ENABLED", "planned", {
1444
+ route: GET("/api/fleet/usage"),
1445
+ cli: "fleet usage"
1446
+ }),
1447
+ // ── operations (FL-02, FL-19) ──
1448
+ read("fleet_operations_get", "view", "FL-02", "FLEET_NODE_LINK_ENABLED", "live", {
1449
+ route: GET("/api/fleet/operations/{id}"),
1450
+ cli: "fleet operations get"
1451
+ }),
1452
+ read("fleet_operations_list", "view", "FL-19", "FLEET_NODE_LINK_ENABLED", "live", {
1453
+ route: GET("/api/fleet/operations"),
1454
+ cli: "fleet operations list"
1455
+ }),
1456
+ act("fleet_operations_cancel", "view", "FL-02", "FLEET_NODE_LINK_ENABLED", "live", plain("machine.run"), {
1457
+ route: DELETE("/api/fleet/operations/{id}"),
1458
+ cli: "fleet operations cancel"
1459
+ })
1460
+ ]);
1461
+ new Map(
1462
+ FLEET_TOOL_CATALOGUE.map((entry) => [entry.name, entry])
1463
+ );
1464
+ var FLEET_VIRTUAL_SYSTEMS = [
1465
+ {
1466
+ id: "windows-11",
1467
+ kind: "vm",
1468
+ label: "Windows 11",
1469
+ family: "windows",
1470
+ arch: ["x64"],
1471
+ windowsEdition: "11",
1472
+ approxDiskGiB: 64,
1473
+ approxDownloadGiB: 6
1474
+ },
1475
+ {
1476
+ id: "windows-10",
1477
+ kind: "vm",
1478
+ label: "Windows 10",
1479
+ family: "windows",
1480
+ arch: ["x64"],
1481
+ windowsEdition: "10",
1482
+ approxDiskGiB: 64,
1483
+ approxDownloadGiB: 6
1484
+ },
1485
+ {
1486
+ id: "windows-server-2025",
1487
+ kind: "vm",
1488
+ label: "Windows Server 2025",
1489
+ family: "windows",
1490
+ arch: ["x64"],
1491
+ windowsEdition: "2025",
1492
+ approxDiskGiB: 64,
1493
+ approxDownloadGiB: 6
1494
+ },
1495
+ {
1496
+ id: "windows-server-2022",
1497
+ kind: "vm",
1498
+ label: "Windows Server 2022",
1499
+ family: "windows",
1500
+ arch: ["x64"],
1501
+ windowsEdition: "2022",
1502
+ approxDiskGiB: 64,
1503
+ approxDownloadGiB: 6
1504
+ },
1505
+ {
1506
+ id: "ubuntu-26.04",
1507
+ kind: "container",
1508
+ label: "Ubuntu 26.04",
1509
+ family: "ubuntu",
1510
+ arch: ["x64", "arm64"],
1511
+ approxDiskGiB: 3,
1512
+ approxDownloadGiB: 0.5
1513
+ },
1514
+ {
1515
+ id: "ubuntu-24.04",
1516
+ kind: "container",
1517
+ label: "Ubuntu 24.04",
1518
+ family: "ubuntu",
1519
+ arch: ["x64", "arm64"],
1520
+ approxDiskGiB: 3,
1521
+ approxDownloadGiB: 0.5
1522
+ },
1523
+ {
1524
+ id: "debian-13",
1525
+ kind: "container",
1526
+ label: "Debian 13",
1527
+ family: "debian",
1528
+ arch: ["x64", "arm64"],
1529
+ approxDiskGiB: 3,
1530
+ approxDownloadGiB: 0.5
1531
+ },
1532
+ {
1533
+ id: "fedora",
1534
+ kind: "container",
1535
+ label: "Fedora",
1536
+ family: "fedora",
1537
+ arch: ["x64", "arm64"],
1538
+ approxDiskGiB: 3,
1539
+ approxDownloadGiB: 0.6
1540
+ },
1541
+ {
1542
+ id: "alpine",
1543
+ kind: "container",
1544
+ label: "Alpine",
1545
+ family: "alpine",
1546
+ arch: ["x64", "arm64"],
1547
+ approxDiskGiB: 1,
1548
+ approxDownloadGiB: 0.2
1549
+ },
1550
+ {
1551
+ // Arch Linux publishes no official arm64 image (FR-6).
1552
+ id: "arch",
1553
+ kind: "container",
1554
+ label: "Arch Linux",
1555
+ family: "arch",
1556
+ arch: ["x64"],
1557
+ approxDiskGiB: 3,
1558
+ approxDownloadGiB: 0.7
1559
+ }
1560
+ ];
1561
+ FLEET_VIRTUAL_SYSTEMS.map((system) => system.id);
715
1562
  var WORKFLOW_EDGE_KINDS = [
716
1563
  "sequential",
717
1564
  "on_failure",
@@ -769,9 +1616,9 @@ function validateWorkflowGraph(graph) {
769
1616
  if (!nodeIds.has(edge.from)) errors.push(`edge "${edge.id}" leaves unknown node "${edge.from}"`);
770
1617
  if (!nodeIds.has(edge.to)) errors.push(`edge "${edge.id}" points at unknown node "${edge.to}"`);
771
1618
  if (edge.kind === "sequential") {
772
- const count = (sequentialBySource.get(edge.from) ?? 0) + 1;
773
- sequentialBySource.set(edge.from, count);
774
- if (count === 2) {
1619
+ const count4 = (sequentialBySource.get(edge.from) ?? 0) + 1;
1620
+ sequentialBySource.set(edge.from, count4);
1621
+ if (count4 === 2) {
775
1622
  errors.push(
776
1623
  `node "${edge.from}" has more than one sequential edge \u2014 use conditional or llm_decide to branch`
777
1624
  );
@@ -794,9 +1641,9 @@ function validateWorkflowGraph(graph) {
794
1641
  choicesBySource.set(edge.from, choices);
795
1642
  }
796
1643
  if (edge.fallback) {
797
- const count = (fallbacksBySource.get(edge.from) ?? 0) + 1;
798
- fallbacksBySource.set(edge.from, count);
799
- if (count === 2) {
1644
+ const count4 = (fallbacksBySource.get(edge.from) ?? 0) + 1;
1645
+ fallbacksBySource.set(edge.from, count4);
1646
+ if (count4 === 2) {
800
1647
  errors.push(`node "${edge.from}" has more than one llm_decide fallback arm`);
801
1648
  }
802
1649
  }
@@ -841,7 +1688,7 @@ var PLAYBOOK_MIN_STEPS = 2;
841
1688
  var PLAYBOOK_MAX_STEPS = 8;
842
1689
  var PLAYBOOK_CAP_KEYS = ["maxPerRun", "maxSourcesTracked", "maxWordCount", "maxDecisionsPerRun"];
843
1690
  var PLAYBOOK_CAP_MAX = 1e5;
844
- function isRecord6(value) {
1691
+ function isRecord7(value) {
845
1692
  return typeof value === "object" && value !== null && !Array.isArray(value);
846
1693
  }
847
1694
  function isNonEmptyString(value, max) {
@@ -851,7 +1698,7 @@ function isOneOf2(value, allowed) {
851
1698
  return typeof value === "string" && allowed.includes(value);
852
1699
  }
853
1700
  function validateGuardrailsShape(value, path) {
854
- if (!isRecord6(value)) return `${path} must be an object`;
1701
+ if (!isRecord7(value)) return `${path} must be an object`;
855
1702
  if (!isOneOf2(value.mode, PLAYBOOK_GUARDRAIL_MODES)) return `${path}.mode is not a known guardrail mode`;
856
1703
  for (const key of ["autoApproveActionTypes", "blockedActionTypes"]) {
857
1704
  const list = value[key];
@@ -866,7 +1713,7 @@ function isFiniteNonNegative(value) {
866
1713
  return typeof value === "number" && Number.isFinite(value) && value >= 0;
867
1714
  }
868
1715
  function validateCapsShape(value) {
869
- if (!isRecord6(value)) return "caps must be an object";
1716
+ if (!isRecord7(value)) return "caps must be an object";
870
1717
  for (const key of PLAYBOOK_CAP_KEYS) {
871
1718
  const cap = value[key];
872
1719
  if (cap === void 0) continue;
@@ -877,14 +1724,14 @@ function validateCapsShape(value) {
877
1724
  return null;
878
1725
  }
879
1726
  function validateProvisionGraph(value) {
880
- if (!isRecord6(value)) return "provision.workflowGraph must be an object";
1727
+ if (!isRecord7(value)) return "provision.workflowGraph must be an object";
881
1728
  if (!Array.isArray(value.nodes)) return "provision.workflowGraph.nodes must be a list";
882
1729
  if (!Array.isArray(value.edges)) return "provision.workflowGraph.edges must be a list";
883
1730
  const { valid, errors } = validateWorkflowGraph(value);
884
1731
  return valid ? null : `provision.workflowGraph is invalid: ${errors[0] ?? "unknown error"}`;
885
1732
  }
886
1733
  function validatePlaybookEntry(value) {
887
- if (!isRecord6(value)) return "entry must be an object";
1734
+ if (!isRecord7(value)) return "entry must be an object";
888
1735
  if (typeof value.slug !== "string" || !PLAYBOOK_SLUG_PATTERN.test(value.slug)) {
889
1736
  return "slug must match ^[a-z0-9][a-z0-9-]{0,63}$";
890
1737
  }
@@ -900,11 +1747,11 @@ function validatePlaybookEntry(value) {
900
1747
  if (typeof value.icon !== "string") return "icon must be a string";
901
1748
  if (!isOneOf2(value.costBand, PLAYBOOK_COST_BANDS)) return "costBand is not a known cost band";
902
1749
  const estimate = value.estimatedTokensPerRun;
903
- if (!isRecord6(estimate) || !isFiniteNonNegative(estimate.min) || !isFiniteNonNegative(estimate.max) || estimate.max < estimate.min) {
1750
+ if (!isRecord7(estimate) || !isFiniteNonNegative(estimate.min) || !isFiniteNonNegative(estimate.max) || estimate.max < estimate.min) {
904
1751
  return "estimatedTokensPerRun must be { min, max } with 0 <= min <= max";
905
1752
  }
906
1753
  const trigger = value.trigger;
907
- if (!isRecord6(trigger)) return "trigger must be an object";
1754
+ if (!isRecord7(trigger)) return "trigger must be an object";
908
1755
  if (!isOneOf2(trigger.kind, PLAYBOOK_TRIGGER_KINDS)) return "trigger.kind is not a known trigger kind";
909
1756
  if (!isNonEmptyString(trigger.description, PLAYBOOK_TEXT_LIMITS.shortText)) {
910
1757
  return "trigger.description must be 1-200 characters";
@@ -914,7 +1761,7 @@ function validatePlaybookEntry(value) {
914
1761
  return "steps must hold between 2 and 8 steps";
915
1762
  }
916
1763
  for (const [index, step] of steps2.entries()) {
917
- if (!isRecord6(step)) return `steps[${index}] must be an object`;
1764
+ if (!isRecord7(step)) return `steps[${index}] must be an object`;
918
1765
  if (!isNonEmptyString(step.title, PLAYBOOK_TEXT_LIMITS.stepTitle)) {
919
1766
  return `steps[${index}].title must be 1-120 characters`;
920
1767
  }
@@ -926,7 +1773,7 @@ function validatePlaybookEntry(value) {
926
1773
  const connections = value.connections;
927
1774
  if (!Array.isArray(connections)) return "connections must be a list";
928
1775
  for (const [index, need] of connections.entries()) {
929
- if (!isRecord6(need)) return `connections[${index}] must be an object`;
1776
+ if (!isRecord7(need)) return `connections[${index}] must be an object`;
930
1777
  if (!isNonEmptyString(need.capability, 64)) return `connections[${index}].capability must be a capability name`;
931
1778
  if (typeof need.required !== "boolean") return `connections[${index}].required must be a boolean`;
932
1779
  if (!isNonEmptyString(need.reason, PLAYBOOK_TEXT_LIMITS.reason)) {
@@ -936,14 +1783,14 @@ function validatePlaybookEntry(value) {
936
1783
  const artefacts = value.artefacts;
937
1784
  if (!Array.isArray(artefacts)) return "artefacts must be a list";
938
1785
  for (const [index, artefact] of artefacts.entries()) {
939
- if (!isRecord6(artefact) || !isOneOf2(artefact.kind, PLAYBOOK_ARTEFACT_KINDS)) {
1786
+ if (!isRecord7(artefact) || !isOneOf2(artefact.kind, PLAYBOOK_ARTEFACT_KINDS)) {
940
1787
  return `artefacts[${index}].kind is not a known artefact kind`;
941
1788
  }
942
1789
  }
943
1790
  const escalations = value.escalations;
944
1791
  if (!Array.isArray(escalations)) return "escalations must be a list";
945
1792
  for (const [index, point] of escalations.entries()) {
946
- if (!isRecord6(point) || !isOneOf2(point.becomes, PLAYBOOK_ESCALATION_TARGETS)) {
1793
+ if (!isRecord7(point) || !isOneOf2(point.becomes, PLAYBOOK_ESCALATION_TARGETS)) {
947
1794
  return `escalations[${index}].becomes must be approval or escalation`;
948
1795
  }
949
1796
  }
@@ -953,14 +1800,14 @@ function validatePlaybookEntry(value) {
953
1800
  return "tags must be a list of strings";
954
1801
  }
955
1802
  const provision = value.provision;
956
- if (!isRecord6(provision)) return "provision must be an object";
1803
+ if (!isRecord7(provision)) return "provision must be an object";
957
1804
  if (!isNonEmptyString(provision.agentTemplateSlug, 64)) return "provision.agentTemplateSlug is required";
958
1805
  if (!isNonEmptyString(provision.agentName, PLAYBOOK_TEXT_LIMITS.shortText))
959
1806
  return "provision.agentName is required";
960
1807
  if (!Array.isArray(provision.skillSlugs) || provision.skillSlugs.some((slug) => typeof slug !== "string")) {
961
1808
  return "provision.skillSlugs must be a list of skill slugs";
962
1809
  }
963
- if (!isRecord6(provision.taskTemplate) || !isNonEmptyString(provision.taskTemplate.name, PLAYBOOK_TEXT_LIMITS.title)) {
1810
+ if (!isRecord7(provision.taskTemplate) || !isNonEmptyString(provision.taskTemplate.name, PLAYBOOK_TEXT_LIMITS.title)) {
964
1811
  return "provision.taskTemplate.name is required";
965
1812
  }
966
1813
  const guardrailsError = validateGuardrailsShape(provision.guardrailsAtAdoption, "provision.guardrailsAtAdoption");
@@ -999,7 +1846,7 @@ function sanitizePlaybookText(value, max) {
999
1846
  return value.replace(HTML_TAG_PATTERN, "").trim().slice(0, max);
1000
1847
  }
1001
1848
  function acceptPlaybookEntry(value) {
1002
- if (!isRecord6(value)) return { entry: null, violation: "entry must be an object" };
1849
+ if (!isRecord7(value)) return { entry: null, violation: "entry must be an object" };
1003
1850
  let sanitized;
1004
1851
  try {
1005
1852
  sanitized = sanitizePlaybookEntry(value);