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