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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.cjs +178 -16
  2. package/dist/index.js +178 -16
  3. package/package.json +7 -7
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.2/node_modules/@ever-co/connect-contracts/dist/index.js
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
  ];
@@ -96,10 +102,14 @@ var USER_SELECTABLE_WORK_KINDS = [
96
102
  "repo",
97
103
  "app"
98
104
  ];
99
- var WORK_KINDS = [...USER_SELECTABLE_WORK_KINDS, "company", "campaign", "default"];
105
+ var WORK_KINDS = [...USER_SELECTABLE_WORK_KINDS, "company", "campaign", "project", "default"];
100
106
  new Set(WORK_KINDS);
101
107
  var GOAL_KINDS = ["metric", "delivery"];
102
108
  new Set(GOAL_KINDS);
109
+ var RECORD_VISIBILITIES = ["private", "team", "organization"];
110
+ new Set(RECORD_VISIBILITIES);
111
+ var RECORD_LIST_VIEWS = ["mine", "shared", "organization"];
112
+ new Set(RECORD_LIST_VIEWS);
103
113
  var VERSION = "1.0.0";
104
114
  var GTM_SKILLS = [
105
115
  // ── research ────────────────────────────────────────────────────────
@@ -663,6 +673,49 @@ var FLEET_AGENT_CREDENTIAL_FAMILIES = [
663
673
  FLEET_AGENT_CREDENTIAL_FAMILIES.flatMap(
664
674
  (family) => family.envNames
665
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();
666
719
  var WORKFLOW_EDGE_KINDS = [
667
720
  "sequential",
668
721
  "on_failure",
@@ -792,7 +845,7 @@ var PLAYBOOK_MIN_STEPS = 2;
792
845
  var PLAYBOOK_MAX_STEPS = 8;
793
846
  var PLAYBOOK_CAP_KEYS = ["maxPerRun", "maxSourcesTracked", "maxWordCount", "maxDecisionsPerRun"];
794
847
  var PLAYBOOK_CAP_MAX = 1e5;
795
- function isRecord5(value) {
848
+ function isRecord6(value) {
796
849
  return typeof value === "object" && value !== null && !Array.isArray(value);
797
850
  }
798
851
  function isNonEmptyString(value, max) {
@@ -802,7 +855,7 @@ function isOneOf2(value, allowed) {
802
855
  return typeof value === "string" && allowed.includes(value);
803
856
  }
804
857
  function validateGuardrailsShape(value, path) {
805
- if (!isRecord5(value)) return `${path} must be an object`;
858
+ if (!isRecord6(value)) return `${path} must be an object`;
806
859
  if (!isOneOf2(value.mode, PLAYBOOK_GUARDRAIL_MODES)) return `${path}.mode is not a known guardrail mode`;
807
860
  for (const key of ["autoApproveActionTypes", "blockedActionTypes"]) {
808
861
  const list = value[key];
@@ -817,7 +870,7 @@ function isFiniteNonNegative(value) {
817
870
  return typeof value === "number" && Number.isFinite(value) && value >= 0;
818
871
  }
819
872
  function validateCapsShape(value) {
820
- if (!isRecord5(value)) return "caps must be an object";
873
+ if (!isRecord6(value)) return "caps must be an object";
821
874
  for (const key of PLAYBOOK_CAP_KEYS) {
822
875
  const cap = value[key];
823
876
  if (cap === void 0) continue;
@@ -828,14 +881,14 @@ function validateCapsShape(value) {
828
881
  return null;
829
882
  }
830
883
  function validateProvisionGraph(value) {
831
- if (!isRecord5(value)) return "provision.workflowGraph must be an object";
884
+ if (!isRecord6(value)) return "provision.workflowGraph must be an object";
832
885
  if (!Array.isArray(value.nodes)) return "provision.workflowGraph.nodes must be a list";
833
886
  if (!Array.isArray(value.edges)) return "provision.workflowGraph.edges must be a list";
834
887
  const { valid, errors } = validateWorkflowGraph(value);
835
888
  return valid ? null : `provision.workflowGraph is invalid: ${errors[0] ?? "unknown error"}`;
836
889
  }
837
890
  function validatePlaybookEntry(value) {
838
- if (!isRecord5(value)) return "entry must be an object";
891
+ if (!isRecord6(value)) return "entry must be an object";
839
892
  if (typeof value.slug !== "string" || !PLAYBOOK_SLUG_PATTERN.test(value.slug)) {
840
893
  return "slug must match ^[a-z0-9][a-z0-9-]{0,63}$";
841
894
  }
@@ -851,11 +904,11 @@ function validatePlaybookEntry(value) {
851
904
  if (typeof value.icon !== "string") return "icon must be a string";
852
905
  if (!isOneOf2(value.costBand, PLAYBOOK_COST_BANDS)) return "costBand is not a known cost band";
853
906
  const estimate = value.estimatedTokensPerRun;
854
- if (!isRecord5(estimate) || !isFiniteNonNegative(estimate.min) || !isFiniteNonNegative(estimate.max) || estimate.max < estimate.min) {
907
+ if (!isRecord6(estimate) || !isFiniteNonNegative(estimate.min) || !isFiniteNonNegative(estimate.max) || estimate.max < estimate.min) {
855
908
  return "estimatedTokensPerRun must be { min, max } with 0 <= min <= max";
856
909
  }
857
910
  const trigger = value.trigger;
858
- if (!isRecord5(trigger)) return "trigger must be an object";
911
+ if (!isRecord6(trigger)) return "trigger must be an object";
859
912
  if (!isOneOf2(trigger.kind, PLAYBOOK_TRIGGER_KINDS)) return "trigger.kind is not a known trigger kind";
860
913
  if (!isNonEmptyString(trigger.description, PLAYBOOK_TEXT_LIMITS.shortText)) {
861
914
  return "trigger.description must be 1-200 characters";
@@ -865,7 +918,7 @@ function validatePlaybookEntry(value) {
865
918
  return "steps must hold between 2 and 8 steps";
866
919
  }
867
920
  for (const [index, step] of steps2.entries()) {
868
- if (!isRecord5(step)) return `steps[${index}] must be an object`;
921
+ if (!isRecord6(step)) return `steps[${index}] must be an object`;
869
922
  if (!isNonEmptyString(step.title, PLAYBOOK_TEXT_LIMITS.stepTitle)) {
870
923
  return `steps[${index}].title must be 1-120 characters`;
871
924
  }
@@ -877,7 +930,7 @@ function validatePlaybookEntry(value) {
877
930
  const connections = value.connections;
878
931
  if (!Array.isArray(connections)) return "connections must be a list";
879
932
  for (const [index, need] of connections.entries()) {
880
- if (!isRecord5(need)) return `connections[${index}] must be an object`;
933
+ if (!isRecord6(need)) return `connections[${index}] must be an object`;
881
934
  if (!isNonEmptyString(need.capability, 64)) return `connections[${index}].capability must be a capability name`;
882
935
  if (typeof need.required !== "boolean") return `connections[${index}].required must be a boolean`;
883
936
  if (!isNonEmptyString(need.reason, PLAYBOOK_TEXT_LIMITS.reason)) {
@@ -887,14 +940,14 @@ function validatePlaybookEntry(value) {
887
940
  const artefacts = value.artefacts;
888
941
  if (!Array.isArray(artefacts)) return "artefacts must be a list";
889
942
  for (const [index, artefact] of artefacts.entries()) {
890
- if (!isRecord5(artefact) || !isOneOf2(artefact.kind, PLAYBOOK_ARTEFACT_KINDS)) {
943
+ if (!isRecord6(artefact) || !isOneOf2(artefact.kind, PLAYBOOK_ARTEFACT_KINDS)) {
891
944
  return `artefacts[${index}].kind is not a known artefact kind`;
892
945
  }
893
946
  }
894
947
  const escalations = value.escalations;
895
948
  if (!Array.isArray(escalations)) return "escalations must be a list";
896
949
  for (const [index, point] of escalations.entries()) {
897
- if (!isRecord5(point) || !isOneOf2(point.becomes, PLAYBOOK_ESCALATION_TARGETS)) {
950
+ if (!isRecord6(point) || !isOneOf2(point.becomes, PLAYBOOK_ESCALATION_TARGETS)) {
898
951
  return `escalations[${index}].becomes must be approval or escalation`;
899
952
  }
900
953
  }
@@ -904,14 +957,14 @@ function validatePlaybookEntry(value) {
904
957
  return "tags must be a list of strings";
905
958
  }
906
959
  const provision = value.provision;
907
- if (!isRecord5(provision)) return "provision must be an object";
960
+ if (!isRecord6(provision)) return "provision must be an object";
908
961
  if (!isNonEmptyString(provision.agentTemplateSlug, 64)) return "provision.agentTemplateSlug is required";
909
962
  if (!isNonEmptyString(provision.agentName, PLAYBOOK_TEXT_LIMITS.shortText))
910
963
  return "provision.agentName is required";
911
964
  if (!Array.isArray(provision.skillSlugs) || provision.skillSlugs.some((slug) => typeof slug !== "string")) {
912
965
  return "provision.skillSlugs must be a list of skill slugs";
913
966
  }
914
- if (!isRecord5(provision.taskTemplate) || !isNonEmptyString(provision.taskTemplate.name, PLAYBOOK_TEXT_LIMITS.title)) {
967
+ if (!isRecord6(provision.taskTemplate) || !isNonEmptyString(provision.taskTemplate.name, PLAYBOOK_TEXT_LIMITS.title)) {
915
968
  return "provision.taskTemplate.name is required";
916
969
  }
917
970
  const guardrailsError = validateGuardrailsShape(provision.guardrailsAtAdoption, "provision.guardrailsAtAdoption");
@@ -950,7 +1003,7 @@ function sanitizePlaybookText(value, max) {
950
1003
  return value.replace(HTML_TAG_PATTERN, "").trim().slice(0, max);
951
1004
  }
952
1005
  function acceptPlaybookEntry(value) {
953
- if (!isRecord5(value)) return { entry: null, violation: "entry must be an object" };
1006
+ if (!isRecord6(value)) return { entry: null, violation: "entry must be an object" };
954
1007
  let sanitized;
955
1008
  try {
956
1009
  sanitized = sanitizePlaybookEntry(value);
@@ -1148,6 +1201,115 @@ var ACTION_CATEGORIES = Object.freeze([
1148
1201
  Object.freeze(
1149
1202
  ACTION_CATEGORIES.filter((c) => c !== "read.internal")
1150
1203
  );
1204
+ var DOMAIN_EVENT_CATALOG = [
1205
+ // EW-P2-6 — `org:write` (and the app) create Organizations.
1206
+ { type: "organization.created", domain: "organization", aggregateType: "organization", phase: "P2" },
1207
+ { type: "organization.updated", domain: "organization", aggregateType: "organization", phase: "P1" },
1208
+ {
1209
+ type: "organization.member.added",
1210
+ domain: "organization",
1211
+ aggregateType: "organization",
1212
+ phase: "P1",
1213
+ child: "member"
1214
+ },
1215
+ {
1216
+ type: "organization.member.updated",
1217
+ domain: "organization",
1218
+ aggregateType: "organization",
1219
+ phase: "P1",
1220
+ child: "member"
1221
+ },
1222
+ {
1223
+ type: "organization.member.removed",
1224
+ domain: "organization",
1225
+ aggregateType: "organization",
1226
+ phase: "P1",
1227
+ child: "member"
1228
+ },
1229
+ { type: "agent.created", domain: "agents", aggregateType: "agent", phase: "P1" },
1230
+ { type: "agent.updated", domain: "agents", aggregateType: "agent", phase: "P1" },
1231
+ { type: "agent.status_changed", domain: "agents", aggregateType: "agent", phase: "P1" },
1232
+ { type: "agent.archived", domain: "agents", aggregateType: "agent", phase: "P1" },
1233
+ { type: "agent.deleted", domain: "agents", aggregateType: "agent", phase: "P1" },
1234
+ { type: "team.created", domain: "teams", aggregateType: "team", phase: "P1" },
1235
+ { type: "team.updated", domain: "teams", aggregateType: "team", phase: "P1" },
1236
+ { type: "team.deleted", domain: "teams", aggregateType: "team", phase: "P1" },
1237
+ { type: "team.member.added", domain: "teams", aggregateType: "team", phase: "P1", child: "member" },
1238
+ { type: "team.member.updated", domain: "teams", aggregateType: "team", phase: "P1", child: "member" },
1239
+ { type: "team.member.removed", domain: "teams", aggregateType: "team", phase: "P1", child: "member" },
1240
+ { type: "team.resource.added", domain: "teams", aggregateType: "team", phase: "P1", child: "resource" },
1241
+ { type: "team.resource.removed", domain: "teams", aggregateType: "team", phase: "P1", child: "resource" },
1242
+ { type: "work.created", domain: "works", aggregateType: "work", phase: "P1" },
1243
+ { type: "work.updated", domain: "works", aggregateType: "work", phase: "P1" },
1244
+ { type: "work.archived", domain: "works", aggregateType: "work", phase: "P1" },
1245
+ { type: "work.deleted", domain: "works", aggregateType: "work", phase: "P1" },
1246
+ { type: "work.member.added", domain: "works", aggregateType: "work", phase: "P1", child: "member" },
1247
+ { type: "work.member.updated", domain: "works", aggregateType: "work", phase: "P1", child: "member" },
1248
+ { type: "work.member.removed", domain: "works", aggregateType: "work", phase: "P1", child: "member" },
1249
+ { type: "mission.created", domain: "missions", aggregateType: "mission", phase: "P2" },
1250
+ { type: "mission.updated", domain: "missions", aggregateType: "mission", phase: "P2" },
1251
+ { type: "mission.status_changed", domain: "missions", aggregateType: "mission", phase: "P2" },
1252
+ { type: "mission.deleted", domain: "missions", aggregateType: "mission", phase: "P2" },
1253
+ { type: "mission.goal.linked", domain: "missions", aggregateType: "mission", phase: "P2", child: "goal" },
1254
+ { type: "mission.goal.unlinked", domain: "missions", aggregateType: "mission", phase: "P2", child: "goal" },
1255
+ { type: "mission.work.linked", domain: "missions", aggregateType: "mission", phase: "P2", child: "work" },
1256
+ { type: "mission.work.unlinked", domain: "missions", aggregateType: "mission", phase: "P2", child: "work" },
1257
+ { type: "goal.created", domain: "goals", aggregateType: "goal", phase: "P2" },
1258
+ { type: "goal.updated", domain: "goals", aggregateType: "goal", phase: "P2" },
1259
+ { type: "goal.status_changed", domain: "goals", aggregateType: "goal", phase: "P2" },
1260
+ { type: "goal.archived", domain: "goals", aggregateType: "goal", phase: "P2" },
1261
+ { type: "goal.unarchived", domain: "goals", aggregateType: "goal", phase: "P2" },
1262
+ { type: "goal.deleted", domain: "goals", aggregateType: "goal", phase: "P2" },
1263
+ { type: "goal.progress_changed", domain: "goals", aggregateType: "goal", phase: "P2" },
1264
+ { type: "idea.created", domain: "ideas", aggregateType: "idea", phase: "P2" },
1265
+ { type: "idea.updated", domain: "ideas", aggregateType: "idea", phase: "P2" },
1266
+ { type: "idea.status_changed", domain: "ideas", aggregateType: "idea", phase: "P2" },
1267
+ { type: "idea.deleted", domain: "ideas", aggregateType: "idea", phase: "P2" },
1268
+ { type: "task.created", domain: "tasks", aggregateType: "task", phase: "P1" },
1269
+ { type: "task.updated", domain: "tasks", aggregateType: "task", phase: "P1" },
1270
+ { type: "task.transitioned", domain: "tasks", aggregateType: "task", phase: "P1" },
1271
+ { type: "task.deleted", domain: "tasks", aggregateType: "task", phase: "P1" },
1272
+ { type: "task.assignee.added", domain: "tasks", aggregateType: "task", phase: "P1", child: "assignee" },
1273
+ { type: "task.assignee.removed", domain: "tasks", aggregateType: "task", phase: "P1", child: "assignee" },
1274
+ { type: "task.watcher.added", domain: "tasks", aggregateType: "task", phase: "P1", child: "watcher" },
1275
+ { type: "task.watcher.removed", domain: "tasks", aggregateType: "task", phase: "P1", child: "watcher" },
1276
+ { type: "task.block.added", domain: "tasks", aggregateType: "task", phase: "P1", child: "block" },
1277
+ { type: "task.block.removed", domain: "tasks", aggregateType: "task", phase: "P1", child: "block" },
1278
+ { type: "task.relation.added", domain: "tasks", aggregateType: "task", phase: "P1", child: "relation" },
1279
+ { type: "task.relation.removed", domain: "tasks", aggregateType: "task", phase: "P1", child: "relation" },
1280
+ { type: "task.comment.created", domain: "tasks", aggregateType: "task", phase: "P1", child: "comment" },
1281
+ { type: "task.comment.updated", domain: "tasks", aggregateType: "task", phase: "P1", child: "comment" },
1282
+ { type: "task.comment.deleted", domain: "tasks", aggregateType: "task", phase: "P1", child: "comment" },
1283
+ { type: "task.attachment.added", domain: "tasks", aggregateType: "task", phase: "P3", child: "attachment" },
1284
+ { type: "task.attachment.removed", domain: "tasks", aggregateType: "task", phase: "P3", child: "attachment" },
1285
+ { type: "task.runtime_updated", domain: "tasks", aggregateType: "task", phase: "P1", optIn: true },
1286
+ { type: "inbox.item.created", domain: "inbox", aggregateType: "inbox_item", phase: "P3" },
1287
+ { type: "inbox.item.answered", domain: "inbox", aggregateType: "inbox_item", phase: "P3" },
1288
+ { type: "inbox.item.state_changed", domain: "inbox", aggregateType: "inbox_item", phase: "P3" },
1289
+ { type: "inbox.item.deleted", domain: "inbox", aggregateType: "inbox_item", phase: "P3" },
1290
+ { type: "kb.document.created", domain: "kb", aggregateType: "kb_document", phase: "P3" },
1291
+ { type: "kb.document.updated", domain: "kb", aggregateType: "kb_document", phase: "P3" },
1292
+ { type: "kb.document.moved", domain: "kb", aggregateType: "kb_document", phase: "P3" },
1293
+ { type: "kb.document.archived", domain: "kb", aggregateType: "kb_document", phase: "P3" },
1294
+ { type: "kb.document.unarchived", domain: "kb", aggregateType: "kb_document", phase: "P3" },
1295
+ { type: "kb.document.deleted", domain: "kb", aggregateType: "kb_document", phase: "P3" },
1296
+ { type: "kb.document.review_changed", domain: "kb", aggregateType: "kb_document", phase: "P3" },
1297
+ { type: "kb.folder.created", domain: "kb", aggregateType: "kb_folder", phase: "P3" },
1298
+ { type: "kb.folder.updated", domain: "kb", aggregateType: "kb_folder", phase: "P3" },
1299
+ { type: "kb.folder.deleted", domain: "kb", aggregateType: "kb_folder", phase: "P3" },
1300
+ { type: "email.message.received", domain: "email", aggregateType: "email_message", phase: "P4" },
1301
+ { type: "email.message.sent", domain: "email", aggregateType: "email_message", phase: "P4" },
1302
+ { type: "email.message.status_changed", domain: "email", aggregateType: "email_message", phase: "P4" },
1303
+ { type: "task.visibility_changed", domain: "visibility", aggregateType: "task", phase: "P1" },
1304
+ { type: "agent.visibility_changed", domain: "visibility", aggregateType: "agent", phase: "P1" },
1305
+ { type: "goal.visibility_changed", domain: "visibility", aggregateType: "goal", phase: "P2" },
1306
+ { type: "mission.visibility_changed", domain: "visibility", aggregateType: "mission", phase: "P2" },
1307
+ { type: "idea.visibility_changed", domain: "visibility", aggregateType: "idea", phase: "P2" }
1308
+ ];
1309
+ DOMAIN_EVENT_CATALOG.map((entry) => entry.type);
1310
+ new Map(
1311
+ DOMAIN_EVENT_CATALOG.map((entry) => [entry.type, entry])
1312
+ );
1151
1313
 
1152
1314
  // src/builtin-catalog.ts
1153
1315
  var ASK_BEFORE_EVERYTHING = {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // ../../../node_modules/.pnpm/@ever-co+connect-contracts@1.0.0-rc.2/node_modules/@ever-co/connect-contracts/dist/index.js
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
  ];
@@ -92,10 +98,14 @@ var USER_SELECTABLE_WORK_KINDS = [
92
98
  "repo",
93
99
  "app"
94
100
  ];
95
- var WORK_KINDS = [...USER_SELECTABLE_WORK_KINDS, "company", "campaign", "default"];
101
+ var WORK_KINDS = [...USER_SELECTABLE_WORK_KINDS, "company", "campaign", "project", "default"];
96
102
  new Set(WORK_KINDS);
97
103
  var GOAL_KINDS = ["metric", "delivery"];
98
104
  new Set(GOAL_KINDS);
105
+ var RECORD_VISIBILITIES = ["private", "team", "organization"];
106
+ new Set(RECORD_VISIBILITIES);
107
+ var RECORD_LIST_VIEWS = ["mine", "shared", "organization"];
108
+ new Set(RECORD_LIST_VIEWS);
99
109
  var VERSION = "1.0.0";
100
110
  var GTM_SKILLS = [
101
111
  // ── research ────────────────────────────────────────────────────────
@@ -659,6 +669,49 @@ var FLEET_AGENT_CREDENTIAL_FAMILIES = [
659
669
  FLEET_AGENT_CREDENTIAL_FAMILIES.flatMap(
660
670
  (family) => family.envNames
661
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();
662
715
  var WORKFLOW_EDGE_KINDS = [
663
716
  "sequential",
664
717
  "on_failure",
@@ -788,7 +841,7 @@ var PLAYBOOK_MIN_STEPS = 2;
788
841
  var PLAYBOOK_MAX_STEPS = 8;
789
842
  var PLAYBOOK_CAP_KEYS = ["maxPerRun", "maxSourcesTracked", "maxWordCount", "maxDecisionsPerRun"];
790
843
  var PLAYBOOK_CAP_MAX = 1e5;
791
- function isRecord5(value) {
844
+ function isRecord6(value) {
792
845
  return typeof value === "object" && value !== null && !Array.isArray(value);
793
846
  }
794
847
  function isNonEmptyString(value, max) {
@@ -798,7 +851,7 @@ function isOneOf2(value, allowed) {
798
851
  return typeof value === "string" && allowed.includes(value);
799
852
  }
800
853
  function validateGuardrailsShape(value, path) {
801
- if (!isRecord5(value)) return `${path} must be an object`;
854
+ if (!isRecord6(value)) return `${path} must be an object`;
802
855
  if (!isOneOf2(value.mode, PLAYBOOK_GUARDRAIL_MODES)) return `${path}.mode is not a known guardrail mode`;
803
856
  for (const key of ["autoApproveActionTypes", "blockedActionTypes"]) {
804
857
  const list = value[key];
@@ -813,7 +866,7 @@ function isFiniteNonNegative(value) {
813
866
  return typeof value === "number" && Number.isFinite(value) && value >= 0;
814
867
  }
815
868
  function validateCapsShape(value) {
816
- if (!isRecord5(value)) return "caps must be an object";
869
+ if (!isRecord6(value)) return "caps must be an object";
817
870
  for (const key of PLAYBOOK_CAP_KEYS) {
818
871
  const cap = value[key];
819
872
  if (cap === void 0) continue;
@@ -824,14 +877,14 @@ function validateCapsShape(value) {
824
877
  return null;
825
878
  }
826
879
  function validateProvisionGraph(value) {
827
- if (!isRecord5(value)) return "provision.workflowGraph must be an object";
880
+ if (!isRecord6(value)) return "provision.workflowGraph must be an object";
828
881
  if (!Array.isArray(value.nodes)) return "provision.workflowGraph.nodes must be a list";
829
882
  if (!Array.isArray(value.edges)) return "provision.workflowGraph.edges must be a list";
830
883
  const { valid, errors } = validateWorkflowGraph(value);
831
884
  return valid ? null : `provision.workflowGraph is invalid: ${errors[0] ?? "unknown error"}`;
832
885
  }
833
886
  function validatePlaybookEntry(value) {
834
- if (!isRecord5(value)) return "entry must be an object";
887
+ if (!isRecord6(value)) return "entry must be an object";
835
888
  if (typeof value.slug !== "string" || !PLAYBOOK_SLUG_PATTERN.test(value.slug)) {
836
889
  return "slug must match ^[a-z0-9][a-z0-9-]{0,63}$";
837
890
  }
@@ -847,11 +900,11 @@ function validatePlaybookEntry(value) {
847
900
  if (typeof value.icon !== "string") return "icon must be a string";
848
901
  if (!isOneOf2(value.costBand, PLAYBOOK_COST_BANDS)) return "costBand is not a known cost band";
849
902
  const estimate = value.estimatedTokensPerRun;
850
- if (!isRecord5(estimate) || !isFiniteNonNegative(estimate.min) || !isFiniteNonNegative(estimate.max) || estimate.max < estimate.min) {
903
+ if (!isRecord6(estimate) || !isFiniteNonNegative(estimate.min) || !isFiniteNonNegative(estimate.max) || estimate.max < estimate.min) {
851
904
  return "estimatedTokensPerRun must be { min, max } with 0 <= min <= max";
852
905
  }
853
906
  const trigger = value.trigger;
854
- if (!isRecord5(trigger)) return "trigger must be an object";
907
+ if (!isRecord6(trigger)) return "trigger must be an object";
855
908
  if (!isOneOf2(trigger.kind, PLAYBOOK_TRIGGER_KINDS)) return "trigger.kind is not a known trigger kind";
856
909
  if (!isNonEmptyString(trigger.description, PLAYBOOK_TEXT_LIMITS.shortText)) {
857
910
  return "trigger.description must be 1-200 characters";
@@ -861,7 +914,7 @@ function validatePlaybookEntry(value) {
861
914
  return "steps must hold between 2 and 8 steps";
862
915
  }
863
916
  for (const [index, step] of steps2.entries()) {
864
- if (!isRecord5(step)) return `steps[${index}] must be an object`;
917
+ if (!isRecord6(step)) return `steps[${index}] must be an object`;
865
918
  if (!isNonEmptyString(step.title, PLAYBOOK_TEXT_LIMITS.stepTitle)) {
866
919
  return `steps[${index}].title must be 1-120 characters`;
867
920
  }
@@ -873,7 +926,7 @@ function validatePlaybookEntry(value) {
873
926
  const connections = value.connections;
874
927
  if (!Array.isArray(connections)) return "connections must be a list";
875
928
  for (const [index, need] of connections.entries()) {
876
- if (!isRecord5(need)) return `connections[${index}] must be an object`;
929
+ if (!isRecord6(need)) return `connections[${index}] must be an object`;
877
930
  if (!isNonEmptyString(need.capability, 64)) return `connections[${index}].capability must be a capability name`;
878
931
  if (typeof need.required !== "boolean") return `connections[${index}].required must be a boolean`;
879
932
  if (!isNonEmptyString(need.reason, PLAYBOOK_TEXT_LIMITS.reason)) {
@@ -883,14 +936,14 @@ function validatePlaybookEntry(value) {
883
936
  const artefacts = value.artefacts;
884
937
  if (!Array.isArray(artefacts)) return "artefacts must be a list";
885
938
  for (const [index, artefact] of artefacts.entries()) {
886
- if (!isRecord5(artefact) || !isOneOf2(artefact.kind, PLAYBOOK_ARTEFACT_KINDS)) {
939
+ if (!isRecord6(artefact) || !isOneOf2(artefact.kind, PLAYBOOK_ARTEFACT_KINDS)) {
887
940
  return `artefacts[${index}].kind is not a known artefact kind`;
888
941
  }
889
942
  }
890
943
  const escalations = value.escalations;
891
944
  if (!Array.isArray(escalations)) return "escalations must be a list";
892
945
  for (const [index, point] of escalations.entries()) {
893
- if (!isRecord5(point) || !isOneOf2(point.becomes, PLAYBOOK_ESCALATION_TARGETS)) {
946
+ if (!isRecord6(point) || !isOneOf2(point.becomes, PLAYBOOK_ESCALATION_TARGETS)) {
894
947
  return `escalations[${index}].becomes must be approval or escalation`;
895
948
  }
896
949
  }
@@ -900,14 +953,14 @@ function validatePlaybookEntry(value) {
900
953
  return "tags must be a list of strings";
901
954
  }
902
955
  const provision = value.provision;
903
- if (!isRecord5(provision)) return "provision must be an object";
956
+ if (!isRecord6(provision)) return "provision must be an object";
904
957
  if (!isNonEmptyString(provision.agentTemplateSlug, 64)) return "provision.agentTemplateSlug is required";
905
958
  if (!isNonEmptyString(provision.agentName, PLAYBOOK_TEXT_LIMITS.shortText))
906
959
  return "provision.agentName is required";
907
960
  if (!Array.isArray(provision.skillSlugs) || provision.skillSlugs.some((slug) => typeof slug !== "string")) {
908
961
  return "provision.skillSlugs must be a list of skill slugs";
909
962
  }
910
- if (!isRecord5(provision.taskTemplate) || !isNonEmptyString(provision.taskTemplate.name, PLAYBOOK_TEXT_LIMITS.title)) {
963
+ if (!isRecord6(provision.taskTemplate) || !isNonEmptyString(provision.taskTemplate.name, PLAYBOOK_TEXT_LIMITS.title)) {
911
964
  return "provision.taskTemplate.name is required";
912
965
  }
913
966
  const guardrailsError = validateGuardrailsShape(provision.guardrailsAtAdoption, "provision.guardrailsAtAdoption");
@@ -946,7 +999,7 @@ function sanitizePlaybookText(value, max) {
946
999
  return value.replace(HTML_TAG_PATTERN, "").trim().slice(0, max);
947
1000
  }
948
1001
  function acceptPlaybookEntry(value) {
949
- if (!isRecord5(value)) return { entry: null, violation: "entry must be an object" };
1002
+ if (!isRecord6(value)) return { entry: null, violation: "entry must be an object" };
950
1003
  let sanitized;
951
1004
  try {
952
1005
  sanitized = sanitizePlaybookEntry(value);
@@ -1144,6 +1197,115 @@ var ACTION_CATEGORIES = Object.freeze([
1144
1197
  Object.freeze(
1145
1198
  ACTION_CATEGORIES.filter((c) => c !== "read.internal")
1146
1199
  );
1200
+ var DOMAIN_EVENT_CATALOG = [
1201
+ // EW-P2-6 — `org:write` (and the app) create Organizations.
1202
+ { type: "organization.created", domain: "organization", aggregateType: "organization", phase: "P2" },
1203
+ { type: "organization.updated", domain: "organization", aggregateType: "organization", phase: "P1" },
1204
+ {
1205
+ type: "organization.member.added",
1206
+ domain: "organization",
1207
+ aggregateType: "organization",
1208
+ phase: "P1",
1209
+ child: "member"
1210
+ },
1211
+ {
1212
+ type: "organization.member.updated",
1213
+ domain: "organization",
1214
+ aggregateType: "organization",
1215
+ phase: "P1",
1216
+ child: "member"
1217
+ },
1218
+ {
1219
+ type: "organization.member.removed",
1220
+ domain: "organization",
1221
+ aggregateType: "organization",
1222
+ phase: "P1",
1223
+ child: "member"
1224
+ },
1225
+ { type: "agent.created", domain: "agents", aggregateType: "agent", phase: "P1" },
1226
+ { type: "agent.updated", domain: "agents", aggregateType: "agent", phase: "P1" },
1227
+ { type: "agent.status_changed", domain: "agents", aggregateType: "agent", phase: "P1" },
1228
+ { type: "agent.archived", domain: "agents", aggregateType: "agent", phase: "P1" },
1229
+ { type: "agent.deleted", domain: "agents", aggregateType: "agent", phase: "P1" },
1230
+ { type: "team.created", domain: "teams", aggregateType: "team", phase: "P1" },
1231
+ { type: "team.updated", domain: "teams", aggregateType: "team", phase: "P1" },
1232
+ { type: "team.deleted", domain: "teams", aggregateType: "team", phase: "P1" },
1233
+ { type: "team.member.added", domain: "teams", aggregateType: "team", phase: "P1", child: "member" },
1234
+ { type: "team.member.updated", domain: "teams", aggregateType: "team", phase: "P1", child: "member" },
1235
+ { type: "team.member.removed", domain: "teams", aggregateType: "team", phase: "P1", child: "member" },
1236
+ { type: "team.resource.added", domain: "teams", aggregateType: "team", phase: "P1", child: "resource" },
1237
+ { type: "team.resource.removed", domain: "teams", aggregateType: "team", phase: "P1", child: "resource" },
1238
+ { type: "work.created", domain: "works", aggregateType: "work", phase: "P1" },
1239
+ { type: "work.updated", domain: "works", aggregateType: "work", phase: "P1" },
1240
+ { type: "work.archived", domain: "works", aggregateType: "work", phase: "P1" },
1241
+ { type: "work.deleted", domain: "works", aggregateType: "work", phase: "P1" },
1242
+ { type: "work.member.added", domain: "works", aggregateType: "work", phase: "P1", child: "member" },
1243
+ { type: "work.member.updated", domain: "works", aggregateType: "work", phase: "P1", child: "member" },
1244
+ { type: "work.member.removed", domain: "works", aggregateType: "work", phase: "P1", child: "member" },
1245
+ { type: "mission.created", domain: "missions", aggregateType: "mission", phase: "P2" },
1246
+ { type: "mission.updated", domain: "missions", aggregateType: "mission", phase: "P2" },
1247
+ { type: "mission.status_changed", domain: "missions", aggregateType: "mission", phase: "P2" },
1248
+ { type: "mission.deleted", domain: "missions", aggregateType: "mission", phase: "P2" },
1249
+ { type: "mission.goal.linked", domain: "missions", aggregateType: "mission", phase: "P2", child: "goal" },
1250
+ { type: "mission.goal.unlinked", domain: "missions", aggregateType: "mission", phase: "P2", child: "goal" },
1251
+ { type: "mission.work.linked", domain: "missions", aggregateType: "mission", phase: "P2", child: "work" },
1252
+ { type: "mission.work.unlinked", domain: "missions", aggregateType: "mission", phase: "P2", child: "work" },
1253
+ { type: "goal.created", domain: "goals", aggregateType: "goal", phase: "P2" },
1254
+ { type: "goal.updated", domain: "goals", aggregateType: "goal", phase: "P2" },
1255
+ { type: "goal.status_changed", domain: "goals", aggregateType: "goal", phase: "P2" },
1256
+ { type: "goal.archived", domain: "goals", aggregateType: "goal", phase: "P2" },
1257
+ { type: "goal.unarchived", domain: "goals", aggregateType: "goal", phase: "P2" },
1258
+ { type: "goal.deleted", domain: "goals", aggregateType: "goal", phase: "P2" },
1259
+ { type: "goal.progress_changed", domain: "goals", aggregateType: "goal", phase: "P2" },
1260
+ { type: "idea.created", domain: "ideas", aggregateType: "idea", phase: "P2" },
1261
+ { type: "idea.updated", domain: "ideas", aggregateType: "idea", phase: "P2" },
1262
+ { type: "idea.status_changed", domain: "ideas", aggregateType: "idea", phase: "P2" },
1263
+ { type: "idea.deleted", domain: "ideas", aggregateType: "idea", phase: "P2" },
1264
+ { type: "task.created", domain: "tasks", aggregateType: "task", phase: "P1" },
1265
+ { type: "task.updated", domain: "tasks", aggregateType: "task", phase: "P1" },
1266
+ { type: "task.transitioned", domain: "tasks", aggregateType: "task", phase: "P1" },
1267
+ { type: "task.deleted", domain: "tasks", aggregateType: "task", phase: "P1" },
1268
+ { type: "task.assignee.added", domain: "tasks", aggregateType: "task", phase: "P1", child: "assignee" },
1269
+ { type: "task.assignee.removed", domain: "tasks", aggregateType: "task", phase: "P1", child: "assignee" },
1270
+ { type: "task.watcher.added", domain: "tasks", aggregateType: "task", phase: "P1", child: "watcher" },
1271
+ { type: "task.watcher.removed", domain: "tasks", aggregateType: "task", phase: "P1", child: "watcher" },
1272
+ { type: "task.block.added", domain: "tasks", aggregateType: "task", phase: "P1", child: "block" },
1273
+ { type: "task.block.removed", domain: "tasks", aggregateType: "task", phase: "P1", child: "block" },
1274
+ { type: "task.relation.added", domain: "tasks", aggregateType: "task", phase: "P1", child: "relation" },
1275
+ { type: "task.relation.removed", domain: "tasks", aggregateType: "task", phase: "P1", child: "relation" },
1276
+ { type: "task.comment.created", domain: "tasks", aggregateType: "task", phase: "P1", child: "comment" },
1277
+ { type: "task.comment.updated", domain: "tasks", aggregateType: "task", phase: "P1", child: "comment" },
1278
+ { type: "task.comment.deleted", domain: "tasks", aggregateType: "task", phase: "P1", child: "comment" },
1279
+ { type: "task.attachment.added", domain: "tasks", aggregateType: "task", phase: "P3", child: "attachment" },
1280
+ { type: "task.attachment.removed", domain: "tasks", aggregateType: "task", phase: "P3", child: "attachment" },
1281
+ { type: "task.runtime_updated", domain: "tasks", aggregateType: "task", phase: "P1", optIn: true },
1282
+ { type: "inbox.item.created", domain: "inbox", aggregateType: "inbox_item", phase: "P3" },
1283
+ { type: "inbox.item.answered", domain: "inbox", aggregateType: "inbox_item", phase: "P3" },
1284
+ { type: "inbox.item.state_changed", domain: "inbox", aggregateType: "inbox_item", phase: "P3" },
1285
+ { type: "inbox.item.deleted", domain: "inbox", aggregateType: "inbox_item", phase: "P3" },
1286
+ { type: "kb.document.created", domain: "kb", aggregateType: "kb_document", phase: "P3" },
1287
+ { type: "kb.document.updated", domain: "kb", aggregateType: "kb_document", phase: "P3" },
1288
+ { type: "kb.document.moved", domain: "kb", aggregateType: "kb_document", phase: "P3" },
1289
+ { type: "kb.document.archived", domain: "kb", aggregateType: "kb_document", phase: "P3" },
1290
+ { type: "kb.document.unarchived", domain: "kb", aggregateType: "kb_document", phase: "P3" },
1291
+ { type: "kb.document.deleted", domain: "kb", aggregateType: "kb_document", phase: "P3" },
1292
+ { type: "kb.document.review_changed", domain: "kb", aggregateType: "kb_document", phase: "P3" },
1293
+ { type: "kb.folder.created", domain: "kb", aggregateType: "kb_folder", phase: "P3" },
1294
+ { type: "kb.folder.updated", domain: "kb", aggregateType: "kb_folder", phase: "P3" },
1295
+ { type: "kb.folder.deleted", domain: "kb", aggregateType: "kb_folder", phase: "P3" },
1296
+ { type: "email.message.received", domain: "email", aggregateType: "email_message", phase: "P4" },
1297
+ { type: "email.message.sent", domain: "email", aggregateType: "email_message", phase: "P4" },
1298
+ { type: "email.message.status_changed", domain: "email", aggregateType: "email_message", phase: "P4" },
1299
+ { type: "task.visibility_changed", domain: "visibility", aggregateType: "task", phase: "P1" },
1300
+ { type: "agent.visibility_changed", domain: "visibility", aggregateType: "agent", phase: "P1" },
1301
+ { type: "goal.visibility_changed", domain: "visibility", aggregateType: "goal", phase: "P2" },
1302
+ { type: "mission.visibility_changed", domain: "visibility", aggregateType: "mission", phase: "P2" },
1303
+ { type: "idea.visibility_changed", domain: "visibility", aggregateType: "idea", phase: "P2" }
1304
+ ];
1305
+ DOMAIN_EVENT_CATALOG.map((entry) => entry.type);
1306
+ new Map(
1307
+ DOMAIN_EVENT_CATALOG.map((entry) => [entry.type, entry])
1308
+ );
1147
1309
 
1148
1310
  // src/builtin-catalog.ts
1149
1311
  var ASK_BEFORE_EVERYTHING = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ever-works/everworks-playbooks-plugin",
3
- "version": "1.0.2",
3
+ "version": "1.0.5",
4
4
  "description": "Ever Works Playbooks — first-party playbook-provider plugin supplying the built-in Playbook catalogue: packaged outcomes with their trigger, steps, required capabilities, artefacts and escalation points.",
5
5
  "author": {
6
6
  "name": "Ever Co. LTD",
@@ -33,13 +33,13 @@
33
33
  "test:coverage": "vitest run --coverage"
34
34
  },
35
35
  "dependencies": {
36
- "@ever-works/contracts": "^1.0.4",
37
- "@ever-works/plugin": "^1.2.4"
36
+ "@ever-works/contracts": "^1.0.11",
37
+ "@ever-works/plugin": "^1.2.6"
38
38
  },
39
39
  "devDependencies": {
40
40
  "tsup": "^8.3.0",
41
41
  "typescript": "^5.9.3",
42
- "vitest": "^4.1.0"
42
+ "vitest": "^5.0.5"
43
43
  },
44
44
  "everworks": {
45
45
  "plugin": {
@@ -67,8 +67,8 @@
67
67
  "url": "https://github.com/ever-works/ever-works/issues"
68
68
  },
69
69
  "everworksRelease": {
70
- "contentHash": "sha256:6e403b98f451f1d10ca298c701f544145f1c5a512aa798f491e88c6d3803dac9",
71
- "commit": "5afea18479322951b23246dd492a05dc332e90ca",
72
- "source": "https://github.com/ever-works/ever-works/tree/5afea18479322951b23246dd492a05dc332e90ca/packages/plugins/everworks-playbooks"
70
+ "contentHash": "sha256:41f474dd1c6efa17ef0373b94e6b613980c5a3f22d3e96345509b17417c3ec4a",
71
+ "commit": "eff002871bfd7f9f8e0f984907f45265ae8b01e0",
72
+ "source": "https://github.com/ever-works/ever-works/tree/eff002871bfd7f9f8e0f984907f45265ae8b01e0/packages/plugins/everworks-playbooks"
73
73
  }
74
74
  }