@gravity-rail/sdk 4.0.0 → 6.0.0

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 (51) hide show
  1. package/README.md +4 -2
  2. package/dist/account-CSJJbLIj.d.cts +459 -0
  3. package/dist/account-CSJJbLIj.d.ts +459 -0
  4. package/dist/{path-CUY-Iw70.d.ts → agent_standing_job-CqKpMoHO.d.cts} +1068 -140
  5. package/dist/{path-B3b3_El9.d.cts → agent_standing_job-yehTe972.d.ts} +1068 -140
  6. package/dist/{chat-interaction-DXgKjFqZ.d.cts → chat-interaction-BtUtVszg.d.ts} +13512 -9340
  7. package/dist/{chat-interaction-a7U-tHfQ.d.ts → chat-interaction-CAfwlYvv.d.cts} +13512 -9340
  8. package/dist/{chunk-WHRIIBJ4.js → chunk-L4XC6KDG.js} +1773 -475
  9. package/dist/chunk-L4XC6KDG.js.map +1 -0
  10. package/dist/{chunk-D5VNVTUQ.js → chunk-P2MSMMMJ.js} +120 -2
  11. package/dist/chunk-P2MSMMMJ.js.map +1 -0
  12. package/dist/{chunk-ZLF3N3ZD.js → chunk-P2X5TOYY.js} +31 -5
  13. package/dist/chunk-P2X5TOYY.js.map +1 -0
  14. package/dist/helpers.cjs.map +1 -1
  15. package/dist/helpers.d.cts +3 -2
  16. package/dist/helpers.d.ts +3 -2
  17. package/dist/helpers.js +1 -1
  18. package/dist/index.cjs +1961 -917
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +87 -249
  21. package/dist/index.d.ts +87 -249
  22. package/dist/index.js +171 -458
  23. package/dist/index.js.map +1 -1
  24. package/dist/internal.cjs +1928 -448
  25. package/dist/internal.cjs.map +1 -1
  26. package/dist/internal.d.cts +2428 -263
  27. package/dist/internal.d.ts +2428 -263
  28. package/dist/internal.js +146 -27
  29. package/dist/internal.js.map +1 -1
  30. package/dist/{member-import-VOLKR5dY.d.ts → member-import-C5nnoGvW.d.ts} +1 -1
  31. package/dist/{member-import-BHtOru8g.d.cts → member-import-DhaNVT7s.d.cts} +1 -1
  32. package/dist/realtime.cjs +250 -3
  33. package/dist/realtime.cjs.map +1 -1
  34. package/dist/realtime.d.cts +87 -4
  35. package/dist/realtime.d.ts +87 -4
  36. package/dist/realtime.js +245 -3
  37. package/dist/realtime.js.map +1 -1
  38. package/dist/schemas.cjs +154 -19
  39. package/dist/schemas.cjs.map +1 -1
  40. package/dist/schemas.d.cts +624 -72
  41. package/dist/schemas.d.ts +624 -72
  42. package/dist/schemas.js +72 -21
  43. package/dist/schemas.js.map +1 -1
  44. package/dist/{tasks-CgptqCsN.d.cts → tasks-A12E_RLa.d.cts} +2243 -1979
  45. package/dist/{tasks-CgptqCsN.d.ts → tasks-DrmyOlRh.d.ts} +2243 -1979
  46. package/dist/{types-BXaWYGHj.d.cts → types-Bv6GtLZ2.d.cts} +25 -2
  47. package/dist/{types-BXaWYGHj.d.ts → types-Bv6GtLZ2.d.ts} +25 -2
  48. package/package.json +4 -4
  49. package/dist/chunk-D5VNVTUQ.js.map +0 -1
  50. package/dist/chunk-WHRIIBJ4.js.map +0 -1
  51. package/dist/chunk-ZLF3N3ZD.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,7 +1,5 @@
1
1
  import {
2
2
  AGENT_NOTE_ORIGINS,
3
- AbilityConfigIssueCode,
4
- AbilityConfigIssueSeverity,
5
3
  AbilityTypeSlugs,
6
4
  AccessGrantResourceType,
7
5
  AccessGrantStatus,
@@ -28,8 +26,7 @@ import {
28
26
  CapturedEffectKind,
29
27
  ChannelMessageDirection,
30
28
  ChannelMessageSource,
31
- ChannelMessagesUnavailableReason,
32
- ChatMuteReason,
29
+ ChatApi,
33
30
  ConsentMethod,
34
31
  CreateMemberContactPointRequestContactType,
35
32
  CreateMemberContactPointRequestPurpose,
@@ -69,6 +66,7 @@ import {
69
66
  InstallationsApi,
70
67
  InvitationStatus,
71
68
  JobPosition,
69
+ LinkFailureCode,
72
70
  MASKED_SECRET_SENTINEL,
73
71
  MAX_EMAIL_SEND_RECIPIENTS,
74
72
  MEMBER_RELATIONSHIP_KINDS,
@@ -86,10 +84,14 @@ import {
86
84
  ModelProvider,
87
85
  ModelType,
88
86
  NO_ASSISTANT_PARTICIPANT_CHAT_TYPES,
87
+ NotificationMarkerAction,
89
88
  OIDCAdminConfigViewProviderType,
90
89
  ORG_ONLY_RESOURCES,
90
+ OpenItemKind,
91
91
  OrgApi,
92
+ OrgApiKeyLimitUnconfirmedError,
92
93
  OrgFeature,
94
+ OrgWebhookScopeUnconfirmedError,
93
95
  PERMISSION_ADMIN,
94
96
  PERMISSION_CREATE,
95
97
  PERMISSION_DELETE,
@@ -103,14 +105,17 @@ import {
103
105
  PIDS_DISPOSITIONS,
104
106
  PIDS_SOURCES,
105
107
  POSITIVE_RATING_THRESHOLD,
108
+ PROPOSED_MESSAGE_BODY_MAX_LENGTH,
109
+ PROPOSED_MESSAGE_SETTLED_TOOL_NAME,
110
+ PROPOSED_MESSAGE_SETTLEMENT_STATUSES,
111
+ PROPOSED_MESSAGE_SUBJECT_MAX_LENGTH,
112
+ PROPOSED_MESSAGE_TOOL_NAMES,
106
113
  PhoneRunRefusal,
107
114
  ProductType,
108
115
  PromoCodeStatus,
109
116
  QUERY_VALUELESS_OPS,
110
117
  QueriesApi,
111
118
  REALTIME_MODEL_CUSTOM,
112
- REALTIME_MODEL_GEMINI,
113
- REALTIME_MODEL_GEMINI_VERTEX,
114
119
  REALTIME_MODEL_OPENAI,
115
120
  REALTIME_MODEL_OPENAI_2,
116
121
  REALTIME_MODEL_OPENAI_MINI,
@@ -151,6 +156,7 @@ import {
151
156
  SiteDnsRecordType,
152
157
  StediApi,
153
158
  SupervisorsApi,
159
+ SyncErrorCode,
154
160
  TTS_MODEL_AWS_POLLY_GENERATIVE,
155
161
  TTS_MODEL_AWS_POLLY_NEURAL,
156
162
  TTS_MODEL_DEEPGRAM_AURA_2,
@@ -173,7 +179,6 @@ import {
173
179
  UpdateMemberContactPointRequestSharing,
174
180
  VoiceIntegrityUseCase,
175
181
  WIDGET_SLUGS,
176
- WorkflowRoutingMode,
177
182
  WorkspaceFeature,
178
183
  WorkspaceProvisionStatus,
179
184
  archivedMemberConflictId,
@@ -206,15 +211,20 @@ import {
206
211
  isIdentifiedMemberContactConflict,
207
212
  isMemberContactConflict,
208
213
  isPositiveRating,
214
+ isProposedMessageSettlementStatus,
209
215
  isRegistryInitialized,
210
216
  isSMSDeliveryFailureStatus,
217
+ parseProposedMessage,
211
218
  pathDraftFromStorage,
212
219
  pathDraftToStorage,
213
220
  requiresAssistantParticipant,
214
221
  usesBuiltinAssistant,
215
222
  validateFeatureDependencies
216
- } from "./chunk-WHRIIBJ4.js";
223
+ } from "./chunk-L4XC6KDG.js";
217
224
  import {
225
+ AbilityConfigIssueCode,
226
+ AbilityConfigIssueSeverity,
227
+ AiDisclosure,
218
228
  AttendeeResponseStatus,
219
229
  AttendeeStatus,
220
230
  CalendarEventStatus,
@@ -222,13 +232,16 @@ import {
222
232
  CalendarScheduleAvailabilityType,
223
233
  CalendarScheduleRecurrence,
224
234
  CalendarSource,
235
+ ChannelMessagesUnavailableReason,
236
+ ChatMuteReason,
225
237
  DataCategory,
226
238
  DataFieldType,
227
239
  DataRecordRetirementResponseReason,
228
240
  DataSensitivity,
229
241
  DataTypeRecordScope,
230
- IndexStatus
231
- } from "./chunk-D5VNVTUQ.js";
242
+ IndexStatus,
243
+ ResponseLength
244
+ } from "./chunk-P2MSMMMJ.js";
232
245
  import {
233
246
  toSafeMemberImportPreview,
234
247
  toSafeMemberImportSummary
@@ -239,9 +252,14 @@ import {
239
252
  ChatInteractionController,
240
253
  getCookieValue,
241
254
  parseOrgAuthChallenge
242
- } from "./chunk-ZLF3N3ZD.js";
255
+ } from "./chunk-P2X5TOYY.js";
243
256
 
244
257
  // src/types/generated/organization_webhook.ts
258
+ var OrgWebhookDeliveryHealthState = {
259
+ healthy: "healthy",
260
+ failing: "failing",
261
+ held: "held"
262
+ };
245
263
  var OrgWebhookDeliveryResponseStatus = {
246
264
  pending: "pending",
247
265
  processing: "processing",
@@ -250,6 +268,13 @@ var OrgWebhookDeliveryResponseStatus = {
250
268
  expired: "expired"
251
269
  };
252
270
 
271
+ // src/types/generated/workspace_selection.ts
272
+ var WorkspaceScopeMode = {
273
+ all: "all",
274
+ selected: "selected",
275
+ none: "none"
276
+ };
277
+
253
278
  // src/types/generated/bundle_contract.ts
254
279
  var BundleGrantRequestGranteeType = {
255
280
  organization: "organization",
@@ -261,6 +286,26 @@ var FormBundleItemRecordScope = {
261
286
  anonymous: "anonymous"
262
287
  };
263
288
 
289
+ // src/types/generated/bundle_publication.ts
290
+ var BundlePublishItemChange = {
291
+ added: "added",
292
+ removed: "removed",
293
+ revisionChanged: "revisionChanged",
294
+ definitionChanged: "definitionChanged",
295
+ unchanged: "unchanged"
296
+ };
297
+ var BundlePublishItemReason = {
298
+ workflow_not_shareable: "workflow_not_shareable",
299
+ not_portable: "not_portable",
300
+ needed_by_another_item: "needed_by_another_item"
301
+ };
302
+ var BundlePublishItemStatus = {
303
+ ready: "ready",
304
+ held: "held",
305
+ left_out: "left_out",
306
+ blocked: "blocked"
307
+ };
308
+
264
309
  // src/types/generated/installation_contract.ts
265
310
  var InstallationItemChangeChange = {
266
311
  added: "added",
@@ -269,13 +314,19 @@ var InstallationItemChangeChange = {
269
314
  definitionChanged: "definitionChanged",
270
315
  unchanged: "unchanged"
271
316
  };
317
+ var InstallationPhoneNumberNoticeCode = {
318
+ webhooks_not_configured: "webhooks_not_configured",
319
+ webhooks_routed_elsewhere: "webhooks_routed_elsewhere",
320
+ number_not_assigned: "number_not_assigned"
321
+ };
272
322
  var ReferenceTargetInputKind = {
273
323
  file: "file",
274
324
  file_folder: "file_folder",
275
325
  image: "image",
276
326
  phone_number: "phone_number",
277
327
  member_role: "member_role",
278
- page: "page"
328
+ page: "page",
329
+ operator_group: "operator_group"
279
330
  };
280
331
  var ScalarTargetInputKind = {
281
332
  text: "text",
@@ -711,313 +762,7 @@ var MemberLabelBuilder = class extends WorkspaceBuilderResource {
711
762
  };
712
763
 
713
764
  // src/workspace-builder/journeys.ts
714
- var SECONDS_PER_DAY = 86400;
715
- function edgeKey(parentId, childId) {
716
- return `${parentId}:${childId}`;
717
- }
718
- function edgeCondition(options) {
719
- const clauses = [];
720
- if (options.afterDays !== void 0) {
721
- clauses.push(`days_since(parent_step.completed_at) >= ${options.afterDays}`);
722
- }
723
- if (options.when) clauses.push(`(${options.when})`);
724
- if (!clauses.length) return void 0;
725
- return clauses.join(" && ");
726
- }
727
- var JourneyStepBuilder = class extends WorkspaceBuilderResource {
728
- // journey-decoupling Phase 7: a Journey step no longer links to a Workflow.
729
- // A step nudges via EventRule actions instead of running a Workflow, so the
730
- // builder no longer accepts or emits a workflow reference.
731
- constructor(name, journey, order = 0, description = "", options = {}) {
732
- super();
733
- this.name = name;
734
- this.journey = journey;
735
- this.order = order;
736
- this.description = description;
737
- this.assigneeId = options.assigneeId;
738
- this.posX = options.posX;
739
- this.posY = options.posY;
740
- }
741
- name;
742
- journey;
743
- order;
744
- description;
745
- connections = [];
746
- rules = [];
747
- assigneeId;
748
- posX;
749
- posY;
750
- /** Wire an edge to `child` and return the CHILD, so chains read linearly. */
751
- connectsTo(child, options = {}) {
752
- if (child === this) {
753
- throw new Error(`Journey step '${this.name}' cannot connect to itself`);
754
- }
755
- const abandonSeconds = options.abandonAfterDays !== void 0 ? options.abandonAfterDays * SECONDS_PER_DAY : options.timeoutSeconds;
756
- this.connections.push({
757
- parent: this,
758
- child,
759
- condition: edgeCondition(options),
760
- required: options.required ?? false,
761
- timeoutSeconds: abandonSeconds,
762
- order: options.order,
763
- filterId: options.filterId
764
- });
765
- return child;
766
- }
767
- /**
768
- * Attach a `JOURNEY_STEP_EXECUTE` action — what this step actually DOES
769
- * when a member reaches it. A step with no rules is inert: the member
770
- * lands on it, nothing is sent, and the journey moves on.
771
- */
772
- onExecute(actionType, params = {}, options = {}) {
773
- this.rules.push({
774
- uuid: crypto.randomUUID(),
775
- actionType,
776
- actionParams: params,
777
- options
778
- });
779
- return this;
780
- }
781
- /**
782
- * Text the member. `phoneNumberUUID` is a workspace PhoneNumber with SMS
783
- * enabled. Pass `workflowUUID` to start an SMS workflow chat, or
784
- * `messageTemplate` for a one-off send.
785
- */
786
- sendsSms(params, options = {}) {
787
- return this.onExecute("sms:send" /* SMS_SEND */, params, options);
788
- }
789
- /**
790
- * Call the member. Both the workspace PhoneNumber uuid (voice enabled) and
791
- * the Workflow uuid that drives the call are required.
792
- */
793
- callsMember(params, options = {}) {
794
- return this.onExecute("phone:call" /* PHONE_CALL */, params, options);
795
- }
796
- /** Email the member from a workspace inbox. */
797
- sendsEmail(params, options = {}) {
798
- return this.onExecute("email:send" /* EMAIL_SEND */, params, options);
799
- }
800
- /** Label the member on arrival — pass label builders, not ids. */
801
- addsLabels(labels, options = {}) {
802
- return this.onExecute(
803
- "member:label" /* MEMBER_LABEL_ACTION */,
804
- { addLabelIds: labels },
805
- options
806
- );
807
- }
808
- /** True once this step has something to do when a member reaches it. */
809
- get hasOutreach() {
810
- return this.rules.length > 0;
811
- }
812
- eventRuleInputs() {
813
- return this.rules.map((rule) => ({
814
- uuid: rule.uuid,
815
- eventType: "journey_step:execute" /* JOURNEY_STEP_EXECUTE */,
816
- actionType: rule.actionType,
817
- actionParams: resolveRefs(rule.actionParams),
818
- ...rule.options.name ? { name: rule.options.name } : {},
819
- ...rule.options.when ? { conditions: rule.options.when } : {},
820
- ...rule.options.delaySeconds ? { delay: rule.options.delaySeconds } : {},
821
- active: rule.options.active ?? true
822
- }));
823
- }
824
- planLine() {
825
- const actions = this.rules.map((rule) => rule.actionType).join(" + ");
826
- return `Step: ${this.name}${actions ? ` (${actions})` : ""}`;
827
- }
828
- async apply(client) {
829
- if (this._existed) return;
830
- if (this.journey._id === void 0) return;
831
- const rules = this.eventRuleInputs();
832
- const payload = {
833
- name: this.name,
834
- description: this.description,
835
- order: this.order,
836
- ...this.assigneeId !== void 0 ? { assigneeId: this.assigneeId } : {},
837
- ...this.posX !== void 0 ? { posX: this.posX } : {},
838
- ...this.posY !== void 0 ? { posY: this.posY } : {},
839
- // Saved atomically with the step, so a partial failure cannot leave
840
- // an inert step behind.
841
- ...rules.length ? { eventRules: rules } : {}
842
- };
843
- const result = await client.createStep(this.journey._id, payload);
844
- this._id = result.id;
845
- this._uuid = result.uuid;
846
- this._created = true;
847
- }
848
- };
849
- var StartStepBuilder = class extends JourneyStepBuilder {
850
- get isImplicit() {
851
- return true;
852
- }
853
- planLine() {
854
- return "Step: Start (auto-created)";
855
- }
856
- async apply() {
857
- }
858
- };
859
- var LEGACY_JOURNEY_CREATION_GUIDANCE = "New legacy Journeys can no longer be created. Author a new Journey with ws.journeyV2() instead; ws.journey() only adopts and edits a legacy Journey that already exists in this workspace under the same name.";
860
- var LegacyJourneyCreationError = class extends Error {
861
- constructor() {
862
- super(LEGACY_JOURNEY_CREATION_GUIDANCE);
863
- this.name = "LegacyJourneyCreationError";
864
- }
865
- };
866
- var JourneyBuilder = class extends WorkspaceBuilderResource {
867
- constructor(name, options = {}) {
868
- super();
869
- this.name = name;
870
- this.description = options.description ?? "";
871
- this.start = new StartStepBuilder("Start", this, 0);
872
- this.steps.push(this.start);
873
- }
874
- name;
875
- description;
876
- steps = [];
877
- goals = [];
878
- /** The auto-created `Start` step — connect the first real step to it. */
879
- start;
880
- /** `parentId:childId` for every edge the server already has (see `adopt`). */
881
- existingEdges = /* @__PURE__ */ new Set();
882
- step(name, options = {}) {
883
- const step = new JourneyStepBuilder(
884
- name,
885
- this,
886
- options.order ?? this.steps.length,
887
- options.description ?? "",
888
- options
889
- );
890
- this.steps.push(step);
891
- return step;
892
- }
893
- /**
894
- * Declare a linear cadence: `Start → steps[0] → steps[1] → …`, each edge
895
- * carrying the matching entry from `spacing`.
896
- *
897
- * Chaining is not optional polish. A step created with no incoming edge is
898
- * a ROOT, and every root fires the moment a member enrols — a "three
899
- * follow-ups over four days" journey built without edges sends all three
900
- * at once.
901
- */
902
- sequence(steps, spacing = []) {
903
- let parent = this.start;
904
- steps.forEach((step, index) => {
905
- parent = parent.connectsTo(step, spacing[index] ?? {});
906
- });
907
- return this;
908
- }
909
- goal(name, options = {}) {
910
- this.goals.push({
911
- name,
912
- description: options.description ?? "",
913
- step: options.step,
914
- completionCel: options.completionCel ?? options.completion_cel,
915
- value: options.value,
916
- order: options.order ?? this.goals.length
917
- });
918
- return this;
919
- }
920
- /**
921
- * Authoring problems that make a journey silently misbehave at runtime.
922
- * Reported at plan/preview time, before anything is written.
923
- */
924
- validate() {
925
- const problems = [];
926
- const withParents = /* @__PURE__ */ new Set();
927
- for (const step of this.steps) {
928
- for (const connection of step.connections) withParents.add(connection.child);
929
- }
930
- for (const step of this.steps) {
931
- if (step === this.start) continue;
932
- if (!withParents.has(step)) {
933
- problems.push(
934
- `step '${step.name}' has no incoming edge \u2014 it is a root and fires for every member the moment they enrol. Connect it from journey.start or a prior step.`
935
- );
936
- }
937
- if (!step.hasOutreach) {
938
- problems.push(
939
- `step '${step.name}' has no JOURNEY_STEP_EXECUTE action \u2014 a member reaching it gets nothing. Add one with .sendsSms / .callsMember / .sendsEmail / .onExecute.`
940
- );
941
- }
942
- }
943
- if (!this.goals.length) {
944
- problems.push(`journey '${this.name}' has no goals \u2014 nothing measures whether it works.`);
945
- }
946
- return problems;
947
- }
948
- /**
949
- * Adopt an existing journey, its steps, and its EDGES, matched by name.
950
- *
951
- * Re-running a builder script is normal — a program is usually built in
952
- * stages as provisioning lands — and without adoption the second run would
953
- * create a duplicate journey and a duplicate set of steps beside the live
954
- * one, with members enrolled in neither.
955
- *
956
- * The edge set is recorded from the server's own `childConnections` rather
957
- * than inferred from "both steps exist". A first run that created the steps
958
- * and then failed before writing an edge leaves exactly that state, and
959
- * inferring would skip the missing edge on every subsequent run — leaving a
960
- * permanent root step that fires for every member at enrolment, silently.
961
- * The journey detail read eager-loads connections, so the real answer is
962
- * already in hand; there is no reason to guess.
963
- */
964
- adopt(existing) {
965
- super.adopt(existing);
966
- const existingSteps = existing.steps ?? [];
967
- const byName = new Map(existingSteps.map((step) => [step.name, step]));
968
- const startStep = existingSteps.find((step) => step.id === existing.startStepId) ?? byName.get("Start");
969
- if (startStep) this.start.adopt(startStep);
970
- for (const step of this.steps) {
971
- if (step === this.start) continue;
972
- const match = byName.get(step.name);
973
- if (match) step.adopt(match);
974
- }
975
- for (const step of existingSteps) {
976
- for (const edge of step.childConnections ?? []) {
977
- this.existingEdges.add(edgeKey(edge.parentStepId, edge.childStepId));
978
- }
979
- }
980
- }
981
- /** True when the server already has this exact edge. */
982
- hasEdge(parent, child) {
983
- if (parent._id === void 0 || child._id === void 0) return false;
984
- return this.existingEdges.has(edgeKey(parent._id, child._id));
985
- }
986
- planLine() {
987
- const parts = [];
988
- const real = this.steps.filter((step) => step !== this.start);
989
- if (real.length) parts.push(`${real.length} steps`);
990
- if (this.goals.length) parts.push(`${this.goals.length} goals`);
991
- return `Journey: ${this.name}${parts.length ? ` (${parts.join(", ")})` : ""}`;
992
- }
993
- async apply(_client) {
994
- if (this._existed) return;
995
- throw new LegacyJourneyCreationError();
996
- }
997
- };
998
- function buildJourneyConnectionPayload(connection) {
999
- if (!connection.parent._uuid || !connection.child._uuid) return void 0;
1000
- return {
1001
- parentStepUuid: connection.parent._uuid,
1002
- childStepUuid: connection.child._uuid,
1003
- ...connection.condition ? { celCondition: connection.condition } : {},
1004
- ...connection.required ? { required: true } : {},
1005
- ...connection.timeoutSeconds ? { timeoutSeconds: connection.timeoutSeconds } : {},
1006
- ...connection.order !== void 0 ? { order: connection.order } : {},
1007
- ...connection.filterId !== void 0 ? { filterId: connection.filterId } : {}
1008
- };
1009
- }
1010
- function buildJourneyGoalPayload(goal) {
1011
- return {
1012
- name: goal.name,
1013
- description: goal.description,
1014
- order: goal.order,
1015
- ...goal.step?._uuid ? { goalStepUuid: goal.step._uuid } : {},
1016
- ...goal.completionCel ? { completionCel: goal.completionCel } : {},
1017
- ...goal.value !== void 0 ? { value: goal.value } : {}
1018
- };
1019
- }
1020
- var V2RouteBuilder = class {
765
+ var RouteBuilder = class {
1021
766
  constructor(name, options = {}) {
1022
767
  this.name = name;
1023
768
  this.options = options;
@@ -1035,21 +780,21 @@ var V2RouteBuilder = class {
1035
780
  _ruleUuid;
1036
781
  /** Append a touch to this arm. Order is call order. */
1037
782
  touch(name, options = {}) {
1038
- const touch = new V2TouchBuilder(name, options);
783
+ const touch = new TouchBuilder(name, options);
1039
784
  this.touches.push(touch);
1040
785
  return touch;
1041
786
  }
1042
787
  };
1043
- var V2BranchBuilder = class {
788
+ var BranchBuilder = class {
1044
789
  routes = [];
1045
790
  /** Append a route. Declaration order is evaluation order. */
1046
791
  route(name, options = {}) {
1047
- const route = new V2RouteBuilder(name, options);
792
+ const route = new RouteBuilder(name, options);
1048
793
  this.routes.push(route);
1049
794
  return route;
1050
795
  }
1051
796
  };
1052
- var V2TouchBuilder = class {
797
+ var TouchBuilder = class {
1053
798
  /**
1054
799
  * The name is CANONICALIZED here, once, and everything downstream reads it:
1055
800
  * the `key:<name>` address, the payload, adoption's name lookup, and the
@@ -1085,11 +830,11 @@ var V2TouchBuilder = class {
1085
830
  * since a touch owns exactly one ordered route set.
1086
831
  */
1087
832
  branch() {
1088
- this._branch ??= new V2BranchBuilder();
833
+ this._branch ??= new BranchBuilder();
1089
834
  return this._branch;
1090
835
  }
1091
836
  /**
1092
- * The request-local address this step answers to (plan §3.8 / phase 6).
837
+ * The request-local address this step answers to .
1093
838
  *
1094
839
  * A saved step is addressed by its uuid; an unsaved one by a `key` derived
1095
840
  * from its authored name. Deriving from the NAME rather than minting a
@@ -1099,7 +844,7 @@ var V2TouchBuilder = class {
1099
844
  * payload carries. Names are already asserted unique within a journey,
1100
845
  * which is what makes a name-derived key unique.
1101
846
  *
1102
- * {@link V2EndingBuilder} INHERITS this rather than deriving its own: an
847
+ * {@link EndingBuilder} INHERITS this rather than deriving its own: an
1103
848
  * Ending's anchor key and a touch's key land in one server-side namespace
1104
849
  * (`stepKey` is one field), so two derivations that drifted would produce
1105
850
  * two spellings of the same address and a goal would 404 on the one its
@@ -1171,7 +916,7 @@ var V2TouchBuilder = class {
1171
916
  );
1172
917
  }
1173
918
  }
1174
- /** Attach a `JOURNEY_STEP_EXECUTE` action. Same contract as legacy. */
919
+ /** Attach a `JOURNEY_STEP_EXECUTE` action. */
1175
920
  onExecute(actionType, params = {}, options = {}) {
1176
921
  this.rules.push({
1177
922
  uuid: crypto.randomUUID(),
@@ -1206,7 +951,7 @@ var V2TouchBuilder = class {
1206
951
  }));
1207
952
  }
1208
953
  };
1209
- var V2EndingBuilder = class extends V2TouchBuilder {
954
+ var EndingBuilder = class extends TouchBuilder {
1210
955
  constructor(name, when, filterId) {
1211
956
  super(name);
1212
957
  this.when = when;
@@ -1229,7 +974,7 @@ var V2EndingBuilder = class extends V2TouchBuilder {
1229
974
  /**
1230
975
  * An Ending cannot carry a branch, and saying so is the whole override.
1231
976
  *
1232
- * `V2EndingBuilder extends V2TouchBuilder` for the identity and addressing
977
+ * `EndingBuilder extends TouchBuilder` for the identity and addressing
1233
978
  * an Ending's anchor shares with a touch, which also inherits every touch
1234
979
  * method — `branch()` among them. Inherited unchanged it would set
1235
980
  * `_branch` on an object nothing ever reads it from: the Ending serializer
@@ -1251,7 +996,7 @@ var V2EndingBuilder = class extends V2TouchBuilder {
1251
996
  );
1252
997
  }
1253
998
  };
1254
- var JourneyV2Builder = class extends WorkspaceBuilderResource {
999
+ var JourneyBuilder = class extends WorkspaceBuilderResource {
1255
1000
  constructor(name, options = {}) {
1256
1001
  super();
1257
1002
  this.name = name;
@@ -1270,18 +1015,22 @@ var JourneyV2Builder = class extends WorkspaceBuilderResource {
1270
1015
  /** Server status at adoption — decides whether a re-run must pause first. */
1271
1016
  _status;
1272
1017
  /**
1273
- * A v2 definition write is idempotent, so an ADOPTED journey is written
1274
- * too. That is the whole point of adopting one: the PUT is a full,
1275
- * uuid-keyed replacement, so re-running a script is how an author expresses
1276
- * an edit. The legacy builder stays create-only — its `apply()` only knows
1277
- * how to create, and re-running it would duplicate.
1018
+ * Server execution model at adoption. Only `'v2'` accepts the whole-definition
1019
+ * write `apply()` makes; anything else is refused at adoption, and `apply()`
1020
+ * re-checks it before its first write.
1021
+ */
1022
+ _executionModel;
1023
+ /**
1024
+ * A definition write is idempotent, so an ADOPTED journey is written too.
1025
+ * That is the whole point of adopting one: the PUT is a full, uuid-keyed
1026
+ * replacement, so re-running a script is how an author expresses an edit.
1278
1027
  */
1279
1028
  get appliesWhenExisting() {
1280
1029
  return true;
1281
1030
  }
1282
1031
  /** Append a touch to the timeline. Order is call order. */
1283
1032
  touch(name, options = {}) {
1284
- const touch = new V2TouchBuilder(name, options);
1033
+ const touch = new TouchBuilder(name, options);
1285
1034
  this.touches.push(touch);
1286
1035
  return touch;
1287
1036
  }
@@ -1313,7 +1062,7 @@ var JourneyV2Builder = class extends WorkspaceBuilderResource {
1313
1062
  }
1314
1063
  /** Append an Ending. Call order is evaluation order. */
1315
1064
  ending(name, options) {
1316
- const ending = new V2EndingBuilder(name, options.when, options.filterId);
1065
+ const ending = new EndingBuilder(name, options.when, options.filterId);
1317
1066
  this.endings.push(ending);
1318
1067
  return ending;
1319
1068
  }
@@ -1330,10 +1079,9 @@ var JourneyV2Builder = class extends WorkspaceBuilderResource {
1330
1079
  /**
1331
1080
  * Authoring problems the server's publish validator would reject.
1332
1081
  *
1333
- * A different rule set from the legacy builder's on purpose. "No incoming
1334
- * edge" has no meaning in a timeline — position is the order — and the v2
1335
- * checks here cover branch shape and Ending conditions. Steps without
1336
- * actions pass through, with or without a wait.
1082
+ * "No incoming edge" has no meaning in a timeline — position is the order —
1083
+ * so the checks here cover branch shape and Ending conditions. Touches
1084
+ * without actions pass through, with or without a wait.
1337
1085
  */
1338
1086
  validate() {
1339
1087
  const problems = [];
@@ -1426,7 +1174,7 @@ var JourneyV2Builder = class extends WorkspaceBuilderResource {
1426
1174
  /**
1427
1175
  * Every step a goal in THIS journey can anchor to, compared by object
1428
1176
  * identity — touches AND Endings, which is why the element type names both
1429
- * rather than leaning on `V2EndingBuilder extends V2TouchBuilder` to smuggle
1177
+ * rather than leaning on `EndingBuilder extends TouchBuilder` to smuggle
1430
1178
  * Endings in under a touch-only annotation.
1431
1179
  *
1432
1180
  * A goal anchored to some other journey's builder is not a near miss the
@@ -1445,7 +1193,7 @@ var JourneyV2Builder = class extends WorkspaceBuilderResource {
1445
1193
  if (routeCount) parts.push(`${routeCount} routes`);
1446
1194
  if (this.endings.length) parts.push(`${this.endings.length} endings`);
1447
1195
  if (this.goals.length) parts.push(`${this.goals.length} goals`);
1448
- return `Journey (v2): ${this.name}${parts.length ? ` (${parts.join(", ")})` : ""}`;
1196
+ return `Journey: ${this.name}${parts.length ? ` (${parts.join(", ")})` : ""}`;
1449
1197
  }
1450
1198
  /**
1451
1199
  * Re-attach every stable child identity the server already holds.
@@ -1478,9 +1226,13 @@ var JourneyV2Builder = class extends WorkspaceBuilderResource {
1478
1226
  * archives real member history.
1479
1227
  */
1480
1228
  adopt(existing) {
1229
+ if (existing.executionModel !== "v2") {
1230
+ throw new UnadoptableJourneyError(this.name, existing.id);
1231
+ }
1481
1232
  super.adopt(existing);
1482
1233
  this._expectedUpdatedAt = existing.updatedAt;
1483
1234
  this._status = existing.status;
1235
+ this._executionModel = existing.executionModel;
1484
1236
  this.assertUnambiguousNames();
1485
1237
  this.adoptChildIdentities(existing);
1486
1238
  }
@@ -1580,10 +1332,10 @@ var JourneyV2Builder = class extends WorkspaceBuilderResource {
1580
1332
  );
1581
1333
  return {
1582
1334
  expectedUpdatedAt: this._expectedUpdatedAt ?? "",
1583
- touches: this.touches.map((touch) => serializeV2Touch(touch, positions)),
1335
+ touches: this.touches.map((touch) => serializeTouch(touch, positions)),
1584
1336
  endings: this.endings.map((ending) => ({
1585
1337
  ...ending._ruleUuid ? { uuid: ending._ruleUuid } : {},
1586
- // Anchor address, exactly as `serializeV2Touch` sends a touch's:
1338
+ // Anchor address, exactly as `serializeTouch` sends a touch's:
1587
1339
  // the saved anchor's uuid, or the request-local `key` a goal in
1588
1340
  // this same save names it by. Both come from `_address`, so the
1589
1341
  // Ending and the goal cannot be sent under two spellings.
@@ -1605,7 +1357,7 @@ var JourneyV2Builder = class extends WorkspaceBuilderResource {
1605
1357
  ...goal._uuid ? { uuid: goal._uuid } : {},
1606
1358
  name: goal.name,
1607
1359
  ...goal.description ? { description: goal.description } : {},
1608
- ...serializeV2GoalAnchor(goal.step, index, owned),
1360
+ ...serializeGoalAnchor(goal.step, index, owned),
1609
1361
  ...goal.completionCel ? { completionCel: goal.completionCel } : {},
1610
1362
  ...goal.value !== void 0 ? { value: goal.value } : {}
1611
1363
  }))
@@ -1615,17 +1367,17 @@ var JourneyV2Builder = class extends WorkspaceBuilderResource {
1615
1367
  const problems = this.preflight();
1616
1368
  if (problems.length) {
1617
1369
  throw new Error(
1618
- `Journey (v2) has ${problems.length} problem(s) and was not applied:
1370
+ `Journey has ${problems.length} problem(s) and was not applied:
1619
1371
  ` + problems.map((problem) => ` - ${problem}`).join("\n")
1620
1372
  );
1621
1373
  }
1374
+ if (this._existed && this._executionModel !== "v2") {
1375
+ throw new UnadoptableJourneyError(this.name, this._id);
1376
+ }
1622
1377
  if (!this._existed) {
1623
1378
  const created = await client.createJourney({
1624
1379
  name: this.name,
1625
- description: this.description,
1626
- // Explicit, always: the v2 builder states its engine rather than
1627
- // relying on whatever the server's omitted-value default is.
1628
- executionModel: "v2"
1380
+ description: this.description
1629
1381
  });
1630
1382
  this._id = created.id;
1631
1383
  this._uuid = created.uuid;
@@ -1635,7 +1387,7 @@ var JourneyV2Builder = class extends WorkspaceBuilderResource {
1635
1387
  const paused = await client.updateJourney(this.id, { status: "paused" });
1636
1388
  this._expectedUpdatedAt = paused.updatedAt;
1637
1389
  }
1638
- const saved = await client.putJourneyV2Definition(this.id, this.definitionPayload());
1390
+ const saved = await client.putJourneyDefinition(this.id, this.definitionPayload());
1639
1391
  this._expectedUpdatedAt = saved.updatedAt;
1640
1392
  this.adoptWrittenUuids(saved);
1641
1393
  if (this.activate) {
@@ -1671,23 +1423,35 @@ function indexStoredByName(rows, referenced, owner, kind) {
1671
1423
  }
1672
1424
  return byName;
1673
1425
  }
1426
+ var UnadoptableJourneyError = class extends Error {
1427
+ journeyId;
1428
+ journeyName;
1429
+ constructor(name, id) {
1430
+ super(
1431
+ `Journey ${String(id)} ('${name}') is a Journey the builder cannot adopt: the script replaces a Journey's whole definition on save, and this Journey was built with the older Journey editor, which does not accept that write. Nothing was changed. Rebuild it as a current Journey, or rename the journey in the script so the builder creates a new one.`
1432
+ );
1433
+ this.name = "UnadoptableJourneyError";
1434
+ this.journeyId = id;
1435
+ this.journeyName = name;
1436
+ }
1437
+ };
1674
1438
  function assertUniqueNames(names, owner, kind) {
1675
1439
  const seen = /* @__PURE__ */ new Set();
1676
1440
  for (const name of names) {
1677
1441
  if (seen.has(name)) {
1678
1442
  throw new Error(
1679
- `${owner} has two ${kind}s named '${name}'. The v2 builder adopts an existing journey by name, so duplicates would attach a builder to either one at random \u2014 archiving the other's history on the next save. Rename one.`
1443
+ `${owner} has two ${kind}s named '${name}'. The builder adopts an existing journey by name, so duplicates would attach a builder to either one at random \u2014 archiving the other's history on the next save. Rename one.`
1680
1444
  );
1681
1445
  }
1682
1446
  seen.add(name);
1683
1447
  }
1684
1448
  }
1685
- function serializeV2Touch(touch, positions) {
1449
+ function serializeTouch(touch, positions) {
1686
1450
  return {
1687
1451
  ...touch._uuid ? { uuid: touch._uuid } : { key: touch._address },
1688
1452
  name: touch.name,
1689
1453
  ...touch.options.description ? { description: touch.options.description } : {},
1690
- ...touch.options.wait ? { wait: buildV2Wait(touch.options.wait, positions.get(touch)) } : {},
1454
+ ...touch.options.wait ? { wait: buildWait(touch.options.wait, positions.get(touch)) } : {},
1691
1455
  eventRules: touch.eventRuleInputs(),
1692
1456
  ...touch._branch ? {
1693
1457
  branch: {
@@ -1701,14 +1465,14 @@ function serializeV2Touch(touch, positions) {
1701
1465
  // same thing as omitted.
1702
1466
  ...route.options.when ? { celCondition: route.options.when } : {},
1703
1467
  ...route.options.filterId !== void 0 ? { filterId: route.options.filterId } : {},
1704
- touches: route.touches.map((armTouch) => serializeV2Touch(armTouch, positions)),
1468
+ touches: route.touches.map((armTouch) => serializeTouch(armTouch, positions)),
1705
1469
  ...route.options.continueAt ? { continueAt: route.options.continueAt._address } : {}
1706
1470
  }))
1707
1471
  }
1708
1472
  } : {}
1709
1473
  };
1710
1474
  }
1711
- function serializeV2GoalAnchor(step, goalIndex, owned) {
1475
+ function serializeGoalAnchor(step, goalIndex, owned) {
1712
1476
  if (!step) return {};
1713
1477
  if (!owned.has(step)) throw new Error(foreignAnchorProblem(goalIndex, anchorKind(step)));
1714
1478
  if (step._uuid) return { stepUuid: step._uuid };
@@ -1719,7 +1483,7 @@ function foreignAnchorProblem(goalIndex, kind) {
1719
1483
  }
1720
1484
  function waitExclusivityProblem(touchIndex) {
1721
1485
  const where = touchIndex === void 0 ? "this touch" : `touch at index ${touchIndex}`;
1722
- return `${where} sets both afterDays and when; fold the day count into \`when\`. A v2 wait is either a whole-day count or Advanced CEL, not both.`;
1486
+ return `${where} sets both afterDays and when; fold the day count into \`when\`. A wait is either a whole-day count or Advanced CEL, not both.`;
1723
1487
  }
1724
1488
  function sharedStepNameProblem(count) {
1725
1489
  return `${count} step name(s) are claimed more than once. Touches and Endings are one namespace: until a save mints their uuids they address themselves by name and the definition resolves those keys through one field, and once saved they are stored steps the next run cannot tell apart. Names are canonical (trimmed), as the API stores them. Rename one.`;
@@ -1728,9 +1492,9 @@ function namelessStepProblem(count) {
1728
1492
  return `${count} step(s) have an empty name once trimmed. A step's name is its request-local address until a save mints its uuid, so a nameless one has nothing to be addressed by, and the API refuses it. Name them.`;
1729
1493
  }
1730
1494
  function anchorKind(step) {
1731
- return step instanceof V2EndingBuilder ? "Ending" : "touch";
1495
+ return step instanceof EndingBuilder ? "Ending" : "touch";
1732
1496
  }
1733
- function buildV2Wait(wait, touchIndex) {
1497
+ function buildWait(wait, touchIndex) {
1734
1498
  if (wait.afterDays !== void 0 && wait.when) {
1735
1499
  throw new Error(waitExclusivityProblem(touchIndex));
1736
1500
  }
@@ -2001,11 +1765,9 @@ var PHASES = /* @__PURE__ */ new Map([
2001
1765
  [MemberFilterBuilder, 5],
2002
1766
  [RoutineBuilder, 6],
2003
1767
  [NotificationRuleBuilder, 6],
2004
- [JourneyBuilder, 7],
2005
- // Same phase as the legacy builder: a v2 Journey is written whole by its
2006
- // own apply(), so it has no child resources to sequence after it.
2007
- [JourneyV2Builder, 7],
2008
- [JourneyStepBuilder, 8]
1768
+ // A Journey is written whole by its own apply(), so it has no child
1769
+ // resources to sequence after it.
1770
+ [JourneyBuilder, 7]
2009
1771
  ]);
2010
1772
  var LIST_PAGE_SIZE = 100;
2011
1773
  async function collectPages(fetchPage) {
@@ -2058,32 +1820,17 @@ var WorkspaceBuilder = class {
2058
1820
  return label;
2059
1821
  }
2060
1822
  /**
2061
- * The legacy (additive step graph) builder, for EXISTING legacy Journeys.
1823
+ * A Journey timeline: ordered touches, structured waits, exclusive branches
1824
+ * and ordered Endings, written through the atomic definition endpoint.
2062
1825
  *
2063
- * It adopts a stored legacy Journey by exact name and edits it. It never
2064
- * creates one: when the workspace holds no Journey of that name, `apply()`
2065
- * refuses before any write with guidance to use {@link journeyV2}. The
2066
- * refusal happens at apply, not here, because adoption is resolved then.
1826
+ * The Journey is adopted by exact name when the workspace already holds one;
1827
+ * the write then replaces its definition whole.
2067
1828
  */
2068
1829
  journey(name, options = {}) {
2069
1830
  const journey = new JourneyBuilder(name, options);
2070
1831
  this.resources.push(journey);
2071
1832
  return journey;
2072
1833
  }
2073
- /**
2074
- * A Journey v2 timeline (plan §3.8): ordered touches, structured waits, and
2075
- * ordered Endings, written through the atomic definition endpoint.
2076
- *
2077
- * A separate factory rather than an option on {@link journey}, because the
2078
- * two return different builders with different vocabularies — `.touch()`
2079
- * and `.ending()` versus `.step()` and `.connectsTo()`. This is the builder
2080
- * that authors NEW Journeys; {@link journey} only edits existing legacy ones.
2081
- */
2082
- journeyV2(name, options = {}) {
2083
- const journey = new JourneyV2Builder(name, options);
2084
- this.resources.push(journey);
2085
- return journey;
2086
- }
2087
1834
  agent(name, options = {}) {
2088
1835
  const agent = new AgentBuilder(name, options);
2089
1836
  this.resources.push(agent);
@@ -2156,15 +1903,12 @@ ${"=".repeat(50)}`);
2156
1903
  `);
2157
1904
  }
2158
1905
  /**
2159
- * Print journey authoring problems that only bite at runtime — a step with
2160
- * no incoming edge fires for every member at enrolment, and a step with no
2161
- * action does nothing at all. Both look fine in the editor, so they are
1906
+ * Print journey authoring problems that only bite at runtime — a touch with
1907
+ * no action does nothing at all. It looks fine in the editor, so it is
2162
1908
  * surfaced before the write rather than discovered from a member's phone.
2163
1909
  */
2164
1910
  reportJourneyWarnings() {
2165
- const problems = this.resources.filter(
2166
- (resource) => resource instanceof JourneyBuilder || resource instanceof JourneyV2Builder
2167
- ).flatMap((journey) => journey.validate());
1911
+ const problems = this.resources.filter((resource) => resource instanceof JourneyBuilder).flatMap((journey) => journey.validate());
2168
1912
  if (!problems.length) return;
2169
1913
  writeLine("\n Journey warnings:");
2170
1914
  for (const problem of problems) writeLine(` ! ${problem}`);
@@ -2211,7 +1955,7 @@ ${"=".repeat(50)}`);
2211
1955
  }
2212
1956
  }
2213
1957
  for (const resource of this.resources) {
2214
- if (resource instanceof JourneyV2Builder) problems.push(...resource.preflight());
1958
+ if (resource instanceof JourneyBuilder) problems.push(...resource.preflight());
2215
1959
  }
2216
1960
  return [...new Set(problems)];
2217
1961
  }
@@ -2260,8 +2004,6 @@ ${"=".repeat(50)}`);
2260
2004
  }
2261
2005
  await this.applyTransitions();
2262
2006
  await this.applyEventRules(resources);
2263
- await this.applyJourneyConnections(resources);
2264
- await this.applyJourneyGoals(resources);
2265
2007
  const count = Object.values(summary).reduce((total, ids) => total + ids.length, 0);
2266
2008
  writeLine(`
2267
2009
  Done! Created ${count} resources.`);
@@ -2270,7 +2012,7 @@ Done! Created ${count} resources.`);
2270
2012
  async resolveExisting(resources) {
2271
2013
  assertUniqueJourneyNames(
2272
2014
  resources.filter(
2273
- (resource) => resource instanceof JourneyBuilder || resource instanceof JourneyV2Builder
2015
+ (resource) => resource instanceof JourneyBuilder
2274
2016
  )
2275
2017
  );
2276
2018
  const formSlugs = new Map(
@@ -2311,9 +2053,7 @@ Done! Created ${count} resources.`);
2311
2053
  }
2312
2054
  }
2313
2055
  const journeyNames = new Map(
2314
- resources.filter(
2315
- (resource) => resource instanceof JourneyBuilder || resource instanceof JourneyV2Builder
2316
- ).map((resource) => [resource.name, resource])
2056
+ resources.filter((resource) => resource instanceof JourneyBuilder).map((resource) => [resource.name, resource])
2317
2057
  );
2318
2058
  if (journeyNames.size) {
2319
2059
  const pageSize = 500;
@@ -2336,8 +2076,7 @@ Done! Created ${count} resources.`);
2336
2076
  }
2337
2077
  const existing = matches[0];
2338
2078
  const builder = journeyNames.get(name);
2339
- const detail = builder instanceof JourneyV2Builder ? await this.client.getJourneyAuthoring(existing.id) : await this.client.getJourney(existing.id);
2340
- builder.adopt(detail);
2079
+ builder.adopt(await this.client.getJourneyAuthoring(existing.id));
2341
2080
  }
2342
2081
  }
2343
2082
  const agentNames = new Map(
@@ -2392,6 +2131,7 @@ Done! Created ${count} resources.`);
2392
2131
  if (!identified.length) return;
2393
2132
  const byKey = new Map(identified);
2394
2133
  for (const existing of await this.client.getNotificationRules()) {
2134
+ if (existing.memberId == null) continue;
2395
2135
  const key = notificationRuleKey(
2396
2136
  existing.noticeType,
2397
2137
  existing.memberId,
@@ -2447,8 +2187,6 @@ Done! Created ${count} resources.`);
2447
2187
  const start = resource.startTask;
2448
2188
  const tasks = start === void 0 ? resource.tasks : [start, ...resource.tasks.filter((task) => task !== start)];
2449
2189
  all.push(...tasks);
2450
- } else if (resource instanceof JourneyBuilder) {
2451
- all.push(...resource.steps);
2452
2190
  }
2453
2191
  }
2454
2192
  return all.sort((a, b) => phaseFor(a) - phaseFor(b));
@@ -2470,17 +2208,7 @@ Done! Created ${count} resources.`);
2470
2208
  } else if (resource instanceof RoutineBuilder) {
2471
2209
  for (const rule of resource.rules)
2472
2210
  lines.push(`${rule.actionType} rule on '${resource.name}'`);
2473
- } else if (resource instanceof JourneyStepBuilder) {
2474
- for (const connection of resource.connections) {
2475
- const guard = connection.condition ? ` [${connection.condition}]` : "";
2476
- lines.push(`${connection.parent.name} -> ${connection.child.name}${guard}`);
2477
- }
2478
- for (const rule of resource.rules) {
2479
- lines.push(`${rule.actionType} on step '${resource.name}'`);
2480
- }
2481
2211
  } else if (resource instanceof JourneyBuilder) {
2482
- for (const goal of resource.goals) lines.push(`Goal: ${goal.name}`);
2483
- } else if (resource instanceof JourneyV2Builder) {
2484
2212
  resource.touches.forEach((touch, index) => {
2485
2213
  lines.push(`${index + 1}. ${touch.name}`);
2486
2214
  });
@@ -2594,37 +2322,6 @@ Done! Created ${count} resources.`);
2594
2322
  });
2595
2323
  return candidates.find((candidate) => eventRulesMatch(candidate, payload));
2596
2324
  }
2597
- async applyJourneyConnections(resources) {
2598
- for (const resource of resources) {
2599
- if (!(resource instanceof JourneyStepBuilder)) continue;
2600
- for (const connection of resource.connections) {
2601
- if (resource.journey._id === void 0) continue;
2602
- if (resource.journey.hasEdge(connection.parent, connection.child)) {
2603
- writeLine(` Exists: ${connection.parent.name} -> ${connection.child.name}`);
2604
- continue;
2605
- }
2606
- const payload = buildJourneyConnectionPayload(connection);
2607
- if (!payload) continue;
2608
- await this.client.createConnection(resource.journey._id, payload);
2609
- writeLine(` Wired: ${connection.parent.name} -> ${connection.child.name}`);
2610
- }
2611
- }
2612
- }
2613
- async applyJourneyGoals(resources) {
2614
- for (const resource of resources) {
2615
- if (!(resource instanceof JourneyBuilder) || resource._id === void 0) continue;
2616
- if (resource._existed) {
2617
- for (const goal of resource.goals) {
2618
- writeLine(` Skipped (journey already exists): Goal: ${goal.name}`);
2619
- }
2620
- continue;
2621
- }
2622
- for (const goal of resource.goals) {
2623
- await this.client.createGoal(resource._id, buildJourneyGoalPayload(goal));
2624
- writeLine(` Created goal: ${goal.name}`);
2625
- }
2626
- }
2627
- }
2628
2325
  };
2629
2326
  var ApplyError = class extends Error {
2630
2327
  createdSoFar;
@@ -2649,7 +2346,7 @@ function assertUniqueJourneyNames(journeys) {
2649
2346
  for (const journey of journeys) {
2650
2347
  if (seen.has(journey.name)) {
2651
2348
  throw new Error(
2652
- `This script declares two journeys named '${journey.name}'. A journey is adopted and re-applied by name, so only one of them could ever be written \u2014 and a v2 apply replaces the journey it adopted whole. Rename one.`
2349
+ `This script declares two journeys named '${journey.name}'. A journey is adopted and re-applied by name, so only one of them could ever be written \u2014 and an apply replaces the journey it adopted whole. Rename one.`
2653
2350
  );
2654
2351
  }
2655
2352
  seen.add(journey.name);
@@ -2663,10 +2360,7 @@ function resourceKey(resource) {
2663
2360
  if (resource instanceof MemberFilterBuilder) return "memberFilters";
2664
2361
  if (resource instanceof RoutineBuilder) return "routines";
2665
2362
  if (resource instanceof NotificationRuleBuilder) return "notificationRules";
2666
- if (resource instanceof JourneyBuilder || resource instanceof JourneyV2Builder) {
2667
- return "journeys";
2668
- }
2669
- if (resource instanceof JourneyStepBuilder) return "journeySteps";
2363
+ if (resource instanceof JourneyBuilder) return "journeys";
2670
2364
  if (resource instanceof AgentBuilder) return "agents";
2671
2365
  return "resources";
2672
2366
  }
@@ -2776,9 +2470,7 @@ function writeScopeForResource(resource) {
2776
2470
  if (resource instanceof RoutineBuilder || resource instanceof NotificationRuleBuilder) {
2777
2471
  return "automations:admin";
2778
2472
  }
2779
- if (resource instanceof JourneyBuilder || resource instanceof JourneyStepBuilder || resource instanceof JourneyV2Builder) {
2780
- return "journeys:write";
2781
- }
2473
+ if (resource instanceof JourneyBuilder) return "journeys:write";
2782
2474
  return null;
2783
2475
  }
2784
2476
  function scopeRetryHint(resource) {
@@ -2818,9 +2510,6 @@ function summarizeError(err) {
2818
2510
  }
2819
2511
  return msg.length > 240 ? `${msg.slice(0, 237)}...` : msg;
2820
2512
  }
2821
- if (err instanceof LegacyJourneyCreationError) {
2822
- return LEGACY_JOURNEY_CREATION_GUIDANCE;
2823
- }
2824
2513
  if (err instanceof Error) {
2825
2514
  return err.name || "Error";
2826
2515
  }
@@ -2845,6 +2534,7 @@ async function runWorkspaceScript(client, build, mode = "plan") {
2845
2534
 
2846
2535
  // src/types/generated/event_type.ts
2847
2536
  var ActivityCapability = {
2537
+ "apps:read": "apps:read",
2848
2538
  "assignments:read": "assignments:read",
2849
2539
  "chats:read": "chats:read",
2850
2540
  "journeys:read": "journeys:read",
@@ -2876,6 +2566,7 @@ var ActivityEventType = {
2876
2566
  chatawaiting_human: "chat.awaiting_human",
2877
2567
  chathuman_replied: "chat.human_replied",
2878
2568
  chatcall_ended: "chat.call_ended",
2569
+ chatauto_replied: "chat.auto_replied",
2879
2570
  chatsummary: "chat.summary",
2880
2571
  messagesent: "message.sent",
2881
2572
  messagesend_failed: "message.send_failed",
@@ -2910,8 +2601,11 @@ var ActivityEventType = {
2910
2601
  domainlinked: "domain.linked",
2911
2602
  domainverified: "domain.verified",
2912
2603
  configupdated: "config.updated",
2604
+ connectionauthorization_lost: "connection.authorization_lost",
2605
+ connectionauthorization_restored: "connection.authorization_restored",
2913
2606
  data_recordcreated: "data_record.created",
2914
- data_recordupdated: "data_record.updated"
2607
+ data_recordupdated: "data_record.updated",
2608
+ notificationdelivered: "notification.delivered"
2915
2609
  };
2916
2610
  var ActivityVisibility = {
2917
2611
  workspace: "workspace",
@@ -2984,6 +2678,7 @@ export {
2984
2678
  ActorKind,
2985
2679
  AgentBuilder,
2986
2680
  AiConnectorPolicy,
2681
+ AiDisclosure,
2987
2682
  ApiError,
2988
2683
  ApplyError,
2989
2684
  AppsApi,
@@ -2994,6 +2689,9 @@ export {
2994
2689
  BuildersApi,
2995
2690
  BulkMemberResultStatus,
2996
2691
  BundleGrantRequestGranteeType,
2692
+ BundlePublishItemChange,
2693
+ BundlePublishItemReason,
2694
+ BundlePublishItemStatus,
2997
2695
  BundlesApi,
2998
2696
  BusinessIndustry,
2999
2697
  BusinessType,
@@ -3010,6 +2708,7 @@ export {
3010
2708
  ChannelMessageDirection,
3011
2709
  ChannelMessageSource,
3012
2710
  ChannelMessagesUnavailableReason,
2711
+ ChatApi,
3013
2712
  ChatInteractionController,
3014
2713
  ChatMuteReason,
3015
2714
  ConsentMethod,
@@ -3058,11 +2757,11 @@ export {
3058
2757
  InboundRefusal,
3059
2758
  IndexStatus,
3060
2759
  InstallationItemChangeChange,
2760
+ InstallationPhoneNumberNoticeCode,
3061
2761
  InstallationsApi,
3062
2762
  InvitationStatus,
3063
2763
  JobPosition,
3064
2764
  JourneyBuilder,
3065
- JourneyStepBuilder,
3066
2765
  MASKED_SECRET_SENTINEL,
3067
2766
  MAX_EMAIL_SEND_RECIPIENTS,
3068
2767
  MEMBER_RELATIONSHIP_KINDS,
@@ -3083,12 +2782,17 @@ export {
3083
2782
  ModelProvider,
3084
2783
  ModelType,
3085
2784
  NO_ASSISTANT_PARTICIPANT_CHAT_TYPES,
2785
+ NotificationMarkerAction,
3086
2786
  NotificationRuleBuilder,
3087
2787
  OIDCAdminConfigViewProviderType,
3088
2788
  ORG_ONLY_RESOURCES,
2789
+ OpenItemKind,
3089
2790
  OrgApi,
2791
+ OrgApiKeyLimitUnconfirmedError,
3090
2792
  OrgFeature,
2793
+ OrgWebhookDeliveryHealthState,
3091
2794
  OrgWebhookDeliveryResponseStatus as OrgWebhookDeliveryStatus,
2795
+ OrgWebhookScopeUnconfirmedError,
3092
2796
  PERMISSION_ADMIN,
3093
2797
  PERMISSION_CREATE,
3094
2798
  PERMISSION_DELETE,
@@ -3102,14 +2806,17 @@ export {
3102
2806
  PIDS_DISPOSITIONS,
3103
2807
  PIDS_SOURCES,
3104
2808
  POSITIVE_RATING_THRESHOLD,
2809
+ PROPOSED_MESSAGE_BODY_MAX_LENGTH,
2810
+ PROPOSED_MESSAGE_SETTLED_TOOL_NAME,
2811
+ PROPOSED_MESSAGE_SETTLEMENT_STATUSES,
2812
+ PROPOSED_MESSAGE_SUBJECT_MAX_LENGTH,
2813
+ PROPOSED_MESSAGE_TOOL_NAMES,
3105
2814
  PhoneRunRefusal,
3106
2815
  ProductType,
3107
2816
  PromoCodeStatus,
3108
2817
  QUERY_VALUELESS_OPS,
3109
2818
  QueriesApi,
3110
2819
  REALTIME_MODEL_CUSTOM,
3111
- REALTIME_MODEL_GEMINI,
3112
- REALTIME_MODEL_GEMINI_VERTEX,
3113
2820
  REALTIME_MODEL_OPENAI,
3114
2821
  REALTIME_MODEL_OPENAI_2,
3115
2822
  REALTIME_MODEL_OPENAI_MINI,
@@ -3123,6 +2830,7 @@ export {
3123
2830
  RelationshipCardinality,
3124
2831
  Resource,
3125
2832
  ResourceWorkflowsApi,
2833
+ ResponseLength,
3126
2834
  RevisionHistorySegment,
3127
2835
  RoutineBuilder,
3128
2836
  RoutingActionType,
@@ -3154,6 +2862,8 @@ export {
3154
2862
  SiteDnsRecordType,
3155
2863
  StediApi,
3156
2864
  SupervisorsApi,
2865
+ SyncErrorCode,
2866
+ LinkFailureCode as SyncFailureCode,
3157
2867
  TTS_MODEL_AWS_POLLY_GENERATIVE,
3158
2868
  TTS_MODEL_AWS_POLLY_NEURAL,
3159
2869
  TTS_MODEL_DEEPGRAM_AURA_2,
@@ -3172,17 +2882,18 @@ export {
3172
2882
  UiPromptPresentedKind as UiPromptPresentedKindValues,
3173
2883
  UiPromptResponseKind as UiPromptResponseKindValues,
3174
2884
  UiPromptResponseStatus as UiPromptResponseStatusValues,
2885
+ UnadoptableJourneyError,
3175
2886
  UpdateMemberContactPointRequestContactType,
3176
2887
  UpdateMemberContactPointRequestPurpose,
3177
2888
  UpdateMemberContactPointRequestSharing,
3178
2889
  VoiceIntegrityUseCase,
3179
2890
  WIDGET_SLUGS,
3180
2891
  WorkflowBuilder,
3181
- WorkflowRoutingMode,
3182
2892
  WorkspaceBuilder,
3183
2893
  WorkspaceBuilderResource,
3184
2894
  WorkspaceFeature,
3185
2895
  WorkspaceProvisionStatus,
2896
+ WorkspaceScopeMode,
3186
2897
  archivedMemberConflictId,
3187
2898
  areDependenciesSatisfied,
3188
2899
  asIdentifiedMemberContactConflict,
@@ -3214,9 +2925,11 @@ export {
3214
2925
  isIdentifiedMemberContactConflict,
3215
2926
  isMemberContactConflict,
3216
2927
  isPositiveRating,
2928
+ isProposedMessageSettlementStatus,
3217
2929
  isRegistryInitialized,
3218
2930
  isSMSDeliveryFailureStatus,
3219
2931
  parseOrgAuthChallenge,
2932
+ parseProposedMessage,
3220
2933
  pathDraftFromStorage,
3221
2934
  pathDraftToStorage,
3222
2935
  requiresAssistantParticipant,