@wayai/cli 0.3.234 → 0.3.236

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6504,13 +6504,10 @@ var init_chunk_BEOHBREG = __esm({
6504
6504
  }
6505
6505
  });
6506
6506
 
6507
- // ../../packages/core/dist/chunk-OWAAYKPB.js
6508
- function declaresReview(schema) {
6509
- return typeof schema === "object" && schema !== null && schema[REVIEW_DECLARATION_KEY] !== void 0;
6510
- }
6511
- var TOOLSET_SLUG_PATTERN, REKOR_STRUCTURAL_ID_PATTERN, baseEnvironmentSchema, toolsetFileToolSchema, toolsetSurfaceSchema, toolsetConnectionBindingSchema, rekorToolsetToolsSchema, rekorBoundAttestation, rekorResolvedToolsetSchema, REVIEW_DECLARATION_KEY, resolvedRecordTypeSchema, reviewWritersSchema, sharedScopeSchema, resolvedFileToolSchema, rekorToolsetFileSchema, rekorToolsetFileListSchema, rekorToolsetFileGetSchema, rekorToolsetFilePutSchema, TOOLSET_CUSTOMER_FACING_REFUSAL_MARK, TOOLSET_CUSTOMER_FACING_REFUSAL;
6512
- var init_chunk_OWAAYKPB = __esm({
6513
- "../../packages/core/dist/chunk-OWAAYKPB.js"() {
6507
+ // ../../packages/core/dist/chunk-TPFTFBLF.js
6508
+ var TOOLSET_SLUG_PATTERN, REKOR_STRUCTURAL_ID_PATTERN, baseEnvironmentSchema, toolsetFileToolSchema, toolsetSurfaceSchema, toolsetConnectionBindingSchema, rekorToolsetToolsSchema, rekorBoundAttestation, rekorResolvedToolsetSchema, resolvedRecordTypeSchema, reviewWritersSchema, sharedScopeSchema, resolvedFileToolSchema, rekorToolsetFileSchema, rekorToolsetFileUrlAnswerSchema, rekorToolsetFileListSchema, rekorToolsetFileGetSchema, rekorToolsetFilePutSchema, TOOLSET_CUSTOMER_FACING_REFUSAL_MARK, TOOLSET_CUSTOMER_FACING_REFUSAL;
6509
+ var init_chunk_TPFTFBLF = __esm({
6510
+ "../../packages/core/dist/chunk-TPFTFBLF.js"() {
6514
6511
  "use strict";
6515
6512
  init_chunk_BEOHBREG();
6516
6513
  init_chunk_DHPUPI4Y();
@@ -6527,7 +6524,9 @@ var init_chunk_OWAAYKPB = __esm({
6527
6524
  list: external_exports.string().min(1).optional(),
6528
6525
  get: external_exports.string().min(1).optional(),
6529
6526
  put: external_exports.string().min(1).optional(),
6530
- delete: external_exports.string().min(1).optional()
6527
+ delete: external_exports.string().min(1).optional(),
6528
+ get_url: external_exports.string().min(1).optional(),
6529
+ put_url: external_exports.string().min(1).optional()
6531
6530
  })
6532
6531
  });
6533
6532
  toolsetSurfaceSchema = external_exports.object({
@@ -6550,20 +6549,21 @@ var init_chunk_OWAAYKPB = __esm({
6550
6549
  */
6551
6550
  unclassified_tools: external_exports.boolean().optional(),
6552
6551
  /**
6553
- * Any of its file tools writes: an operation other than `list` and `get` (`put`, `delete`, or one
6554
- * the data product adds later), or an entry this side cannot read. Absent on a surface recorded
6552
+ * Any of its file tools writes: an operation other than `list`, `get` and `get_url` (`put`, `delete`,
6553
+ * `put_url`, or one the data product adds later), or an entry this side cannot read. Absent on a surface recorded
6555
6554
  * before it was, which the customer-facing rule reads as writing until the connection's next tool
6556
6555
  * sync or token save records it.
6557
6556
  */
6558
6557
  file_writes: external_exports.boolean().optional(),
6559
6558
  /**
6560
- * A record type the toolset's actions or composite steps reach (the resolve's `record_types`) names it
6561
- * among its writers (`x-review.writers`, #5083 RK4): the toolset writes the type's drafts and reads its
6562
- * every record, drafts included. Or such a type's declaration this side cannot read, or a resolve
6563
- * reaching records that carries no record types. A type only its relationship tools reach is not
6564
- * judged: the resolve does not carry that type's declaration. Absent
6565
- * on a surface recorded before it was, which the customer-facing rule reads as writing, for a toolset
6566
- * reaching records, until the connection's next tool sync or token save records it.
6559
+ * A record type the resolve's `record_types` carries names the toolset among its writers
6560
+ * (`x-review.writers`, #5083 RK4): the toolset writes the type's drafts and reads its every record,
6561
+ * drafts included. Those are the types its actions and composite record steps reach, and every
6562
+ * reviewed type it reaches otherwise: at a relationship tool's or a composite relationship step's
6563
+ * end, in a `batch` entry, or, through `sql_query`, all of them (decision 198). Or such a type's
6564
+ * declaration this side cannot read, or a resolve reaching records that carries no record types.
6565
+ * Absent on a surface recorded before it was, which the customer-facing rule reads as writing, for a
6566
+ * toolset reaching records, until the connection's next tool sync or token save records it.
6567
6567
  */
6568
6568
  review_writes: external_exports.boolean().optional(),
6569
6569
  /**
@@ -6656,18 +6656,21 @@ var init_chunk_OWAAYKPB = __esm({
6656
6656
  /** The toolset serves one customer per call (#5083 RK2). Absent reads as not scoped. */
6657
6657
  customer_scope: external_exports.boolean().optional(),
6658
6658
  /**
6659
- * Each record type the toolset's actions and composite steps reach, by id, as the data product
6660
- * stores it (`json_schema` included). A reviewed type's `x-review` names its writers (#5083 RK4).
6659
+ * Record types the toolset reaches, by id, as the data product stores them (`json_schema`
6660
+ * included): each one its actions and composite record steps reach, and each reviewed one it
6661
+ * reaches otherwise (relationship ends, `batch` entries, every one through `sql_query`; #5083
6662
+ * decision 198). An unreviewed type it reaches only otherwise is not here. A reviewed type's
6663
+ * `x-review` names its writers (RK4).
6661
6664
  */
6662
6665
  record_types: external_exports.record(external_exports.unknown()).optional(),
6663
6666
  /**
6664
- * What each record type the toolset can reach is to a customer scope (`{ role }`, or null), by id:
6665
- * those `record_types` holds, and those only its relationship tools and steps reach (#5083 RK2).
6667
+ * What each record type the toolset's actions, composite steps and relationship tools reach is to a
6668
+ * customer scope (`{ role }`, or null), by id (#5083 RK2). A reviewed type `record_types` carries
6669
+ * because only a `batch` entry or `sql_query` reaches it has none.
6666
6670
  */
6667
6671
  record_type_scopes: external_exports.record(external_exports.unknown()).optional()
6668
6672
  }).passthrough()
6669
6673
  });
6670
- REVIEW_DECLARATION_KEY = "x-review";
6671
6674
  resolvedRecordTypeSchema = external_exports.object({ json_schema: external_exports.record(external_exports.unknown()) });
6672
6675
  reviewWritersSchema = external_exports.object({ writers: external_exports.array(external_exports.string()).optional() });
6673
6676
  sharedScopeSchema = external_exports.object({ role: external_exports.literal("shared") });
@@ -6684,6 +6687,14 @@ var init_chunk_OWAAYKPB = __esm({
6684
6687
  version: external_exports.number().int().min(1),
6685
6688
  content_type: external_exports.string().optional()
6686
6689
  }).passthrough();
6690
+ rekorToolsetFileUrlAnswerSchema = external_exports.object({
6691
+ data: external_exports.object({
6692
+ url: external_exports.string(),
6693
+ expires_at: external_exports.string(),
6694
+ path: external_exports.string(),
6695
+ content_sha256: external_exports.string()
6696
+ }).passthrough()
6697
+ });
6687
6698
  rekorToolsetFileListSchema = external_exports.object({ data: external_exports.array(rekorToolsetFileSchema) });
6688
6699
  rekorToolsetFileGetSchema = external_exports.object({
6689
6700
  data: rekorToolsetFileSchema.extend({
@@ -6693,7 +6704,7 @@ var init_chunk_OWAAYKPB = __esm({
6693
6704
  });
6694
6705
  rekorToolsetFilePutSchema = external_exports.object({ data: rekorToolsetFileSchema });
6695
6706
  TOOLSET_CUSTOMER_FACING_REFUSAL_MARK = "A customer-facing agent (a pilot, pilot specialist or pilot advisor) can use a toolset only when it exposes files alone: no record, composite or relationship tools, and neither sql_query nor batch";
6696
- TOOLSET_CUSTOMER_FACING_REFUSAL = `${TOOLSET_CUSTOMER_FACING_REFUSAL_MARK}, nor a file put or delete, nor a write of a reviewed record type \u2014 unless the toolset is customer-scoped, which admits its record, composite and relationship tools, since each of their calls reaches only the conversation's customer and shared records, or they only read approved records of reviewed shared record types`;
6707
+ TOOLSET_CUSTOMER_FACING_REFUSAL = `${TOOLSET_CUSTOMER_FACING_REFUSAL_MARK}, nor a file put, delete or put_url, nor a write of a reviewed record type \u2014 unless the toolset is customer-scoped, which admits its record, composite and relationship tools, since each of their calls reaches only the conversation's customer and shared records, or they only read approved records of reviewed shared record types`;
6697
6708
  }
6698
6709
  });
6699
6710
 
@@ -13416,10 +13427,10 @@ var init_chunk_3HSB6J4J = __esm({
13416
13427
  }
13417
13428
  });
13418
13429
 
13419
- // ../../packages/core/dist/chunk-XCDUP42J.js
13430
+ // ../../packages/core/dist/chunk-6IKFJ3GW.js
13420
13431
  var COMMUNITIES_PER_ORG_MAX, COMMUNITY_NAME_MAX_LENGTH, COMMUNITY_REGISTRY_CLOSED_REASON, COMMUNITY_MEMBERS_MAX, COMMUNITY_ADMISSIONS, COMMUNITY_ACCESS_MAX, COMMUNITY_ACCESS_ADD_MAX, COMMUNITY_ACCESS_FULL_REASON, COMMUNITY_JOIN_SOURCE_MAX_LENGTH, COMMUNITY_JOIN_FLOW_TOKEN_MAX_LENGTH, COMMUNITY_ROOMS_MAX, COMMUNITY_ROOM_NAME_MAX_LENGTH, COMMUNITY_MESSAGE_MAX_LENGTH, COMMUNITY_MESSAGES_PAGE_SIZE, COMMUNITY_ATTACHMENT_URLS_MAX, COMMUNITY_POST_TITLE_MAX_LENGTH, COMMUNITY_POST_SEARCH_MAX_LENGTH, COMMUNITY_MEMBER_STATUSES, COMMUNITY_RULES_MAX_LENGTH, COMMUNITY_SLOW_MODE_MAX_SECONDS, COMMUNITY_COURSES_LABEL_MAX_LENGTH, COMMUNITY_LIVE_TICKET_PREFIX, COMMUNITY_STATS_DAYS, communityNameSchema, adminCreateCommunityBody, communityIdParam, communityJoinTokenSchema, communityJoinSourceSchema, communityJoinPreviewQuery, communityJoinBody, communityRoomKindSchema, communityRoomNameSchema, communityRoomIdParam, communityMessageIdParam, communityRoomCreateBody, communityRoomUpdateBody, communityMessagesQuery, communityMessageBodySchema, communityPostTitleSchema, communityAttachmentUploadSchema, communitySendBody, communityEditBody, communityPostIdParam, communityPostsQuery, communityAnswerBody, communityReadBody, communityAttachmentUrlsBody, communityPersonParam, communityOrgParam, communityPeopleQuery, communityCoursesLabelSchema, communityAdmissionSchema, communitySettingsBody, communityAccessEmailSchema, communityAccessAddBody, communityAccessQuery, communityAccessIdParam, communityBanBody, communityLockBody, communityPinBody, communityModLogQuery, communityReportsQuery, communityReportIdParam, communityLiveTicketSchema, communityLiveQuery, communityMuteBody, communityEmailUnsubscribeTokenSchema, communityEmailUnsubscribeQuery;
13421
- var init_chunk_XCDUP42J = __esm({
13422
- "../../packages/core/dist/chunk-XCDUP42J.js"() {
13432
+ var init_chunk_6IKFJ3GW = __esm({
13433
+ "../../packages/core/dist/chunk-6IKFJ3GW.js"() {
13423
13434
  "use strict";
13424
13435
  init_chunk_6J742GLA();
13425
13436
  init_chunk_ZVXO3XL6();
@@ -13496,12 +13507,13 @@ var init_chunk_XCDUP42J = __esm({
13496
13507
  communityCoursesLabelSchema = external_exports.string().trim().max(COMMUNITY_COURSES_LABEL_MAX_LENGTH);
13497
13508
  communityAdmissionSchema = external_exports.enum(COMMUNITY_ADMISSIONS);
13498
13509
  communitySettingsBody = external_exports.object({
13510
+ name: communityNameSchema.optional(),
13499
13511
  rules: external_exports.string().trim().max(COMMUNITY_RULES_MAX_LENGTH).nullable().optional().transform((rules) => rules === "" ? null : rules),
13500
13512
  slow_mode_seconds: external_exports.number().int().min(0).max(COMMUNITY_SLOW_MODE_MAX_SECONDS).optional(),
13501
13513
  courses_label: communityCoursesLabelSchema.optional(),
13502
13514
  admission: communityAdmissionSchema.optional()
13503
13515
  }).strict().refine(
13504
- (b) => b.rules !== void 0 || b.slow_mode_seconds !== void 0 || b.courses_label !== void 0 || b.admission !== void 0,
13516
+ (b) => b.name !== void 0 || b.rules !== void 0 || b.slow_mode_seconds !== void 0 || b.courses_label !== void 0 || b.admission !== void 0,
13505
13517
  "nothing to change"
13506
13518
  );
13507
13519
  communityAccessEmailSchema = external_exports.string().trim().toLowerCase().max(CONTACT_EMAIL_MAX).email();
@@ -13524,7 +13536,7 @@ var init_chunk_XCDUP42J = __esm({
13524
13536
  }
13525
13537
  });
13526
13538
 
13527
- // ../../packages/core/dist/chunk-3KYTITOR.js
13539
+ // ../../packages/core/dist/chunk-ZLJP22IA.js
13528
13540
  function parseCommunityLessonVideoUrl(url) {
13529
13541
  const parts = /^https?:\/\/([^/?#]+)([^?#]*)(?:\?([^#]*))?(?:#.*)?$/i.exec(url.trim());
13530
13542
  if (!parts) return null;
@@ -13550,10 +13562,10 @@ function communityLessonVideoWatchUrl(video) {
13550
13562
  }
13551
13563
  }
13552
13564
  var COMMUNITY_COURSES_MAX, COMMUNITY_COURSE_MODULES_MAX, COMMUNITY_COURSE_LESSONS_MAX, COMMUNITY_LESSONS_MAX, COMMUNITY_COURSE_TITLE_MAX_LENGTH, COMMUNITY_COURSE_DESCRIPTION_MAX_LENGTH, COMMUNITY_LESSON_BODY_MAX_LENGTH, COMMUNITY_LESSON_LINKS_MAX, COMMUNITY_LESSON_URL_MAX_LENGTH, YOUTUBE_ID, YOUTUBE_HOSTS, YOUTU_BE, YOUTUBE_ID_PATH, communityCourseIdParam, communityCourseModuleIdParam, communityLessonIdParam, communityCourseTitleSchema, communityCourseDescriptionSchema, communityCoursePositionSchema, communityLessonVideoUrlSchema, communityLessonLinkSchema, communityLessonLinksSchema, communityLessonBodySchema, communityCourseCreateBody, communityCourseUpdateBody, communityModuleCreateBody, communityModuleUpdateBody, communityLessonCreateBody, communityLessonUpdateBody;
13553
- var init_chunk_3KYTITOR = __esm({
13554
- "../../packages/core/dist/chunk-3KYTITOR.js"() {
13565
+ var init_chunk_ZLJP22IA = __esm({
13566
+ "../../packages/core/dist/chunk-ZLJP22IA.js"() {
13555
13567
  "use strict";
13556
- init_chunk_XCDUP42J();
13568
+ init_chunk_6IKFJ3GW();
13557
13569
  init_chunk_HZ6CADSY();
13558
13570
  init_zod();
13559
13571
  COMMUNITY_COURSES_MAX = 20;
@@ -15076,7 +15088,7 @@ var init_contracts = __esm({
15076
15088
  init_chunk_Y7CFCYX4();
15077
15089
  init_chunk_5DGHIY7L();
15078
15090
  init_chunk_N4FMK4UY();
15079
- init_chunk_OWAAYKPB();
15091
+ init_chunk_TPFTFBLF();
15080
15092
  init_chunk_BEOHBREG();
15081
15093
  init_chunk_IPDOHAZ5();
15082
15094
  init_chunk_YUZFHVB2();
@@ -15099,8 +15111,8 @@ var init_contracts = __esm({
15099
15111
  init_chunk_VHQED53I();
15100
15112
  init_chunk_TY6K2EWO();
15101
15113
  init_chunk_JDJ4EUOL();
15102
- init_chunk_3KYTITOR();
15103
- init_chunk_XCDUP42J();
15114
+ init_chunk_ZLJP22IA();
15115
+ init_chunk_6IKFJ3GW();
15104
15116
  init_chunk_6J742GLA();
15105
15117
  init_chunk_ZVXO3XL6();
15106
15118
  init_chunk_YULHXJ5M();
@@ -22783,6 +22795,9 @@ function settingsContent(settings) {
22783
22795
  admission: settings.admission ?? DEFAULT_ADMISSION
22784
22796
  };
22785
22797
  }
22798
+ function nameContent(name) {
22799
+ return { name: toLf(name).trim() };
22800
+ }
22786
22801
  function roomContent(room) {
22787
22802
  return { name: toLf(room.name).trim(), archived: room.archived };
22788
22803
  }
@@ -22849,7 +22864,7 @@ function localName(name, id, taken, fallback) {
22849
22864
  const withPrefix = `${slug}--${id.slice(0, 8)}`;
22850
22865
  return taken.has(withPrefix) ? `${slug}--${id}` : withPrefix;
22851
22866
  }
22852
- var REV_VERSION, DEFAULT_ADMISSION, settingsRev, joinLinkRev, roomRev, courseRev, moduleRev, lessonRev;
22867
+ var REV_VERSION, DEFAULT_ADMISSION, settingsRev, joinLinkRev, nameRev, roomRev, courseRev, moduleRev, lessonRev;
22853
22868
  var init_model = __esm({
22854
22869
  "src/communities/model.ts"() {
22855
22870
  "use strict";
@@ -22865,6 +22880,7 @@ var init_model = __esm({
22865
22880
  ...c.admission === DEFAULT_ADMISSION ? [] : [c.admission]
22866
22881
  ]);
22867
22882
  joinLinkRev = (communityId, c) => rev(["join_link", communityId, c.enabled]);
22883
+ nameRev = (communityId, c) => rev(["name", communityId, c.name]);
22868
22884
  roomRev = (roomId, c) => rev(["room", roomId, c.name, c.archived]);
22869
22885
  courseRev = (courseId, c) => rev(["course", courseId, c.title, c.description, c.published]);
22870
22886
  moduleRev = (moduleId, c) => rev(["module", moduleId, c.title]);
@@ -23265,6 +23281,11 @@ function readCommunityFolder(folder) {
23265
23281
  problems2.push(`${COMMUNITY_FILE}: community_id must be the community's id (a UUID)`);
23266
23282
  }
23267
23283
  if (typeof doc.name !== "string") problems2.push(`${COMMUNITY_FILE}: name must be text`);
23284
+ else {
23285
+ const parsed = communityNameSchema.safeParse(doc.name);
23286
+ if (!parsed.success) problems2.push(`name: ${contractProblem(parsed.error)}`);
23287
+ }
23288
+ const nameRev2 = optionalString(doc, "name_rev", COMMUNITY_FILE, problems2);
23268
23289
  const settings = isMapping(doc.settings) ? doc.settings : null;
23269
23290
  if (!settings) problems2.push(`${COMMUNITY_FILE}: settings must be a mapping`);
23270
23291
  else unknownKeys(settings, SETTINGS_KEYS, `${COMMUNITY_FILE} settings`, problems2);
@@ -23291,6 +23312,7 @@ ${problems2.map((p) => ` - ${p}`).join("\n")}`);
23291
23312
  return {
23292
23313
  community_id: communityId,
23293
23314
  name: doc.name,
23315
+ ...nameRev2 === void 0 ? {} : { name_rev: nameRev2 },
23294
23316
  settings: {
23295
23317
  ...settingsRev2 === void 0 ? {} : { rev: settingsRev2 },
23296
23318
  slow_mode_seconds: slowMode,
@@ -23395,6 +23417,7 @@ function renderCommunityYaml(files) {
23395
23417
  const doc = {
23396
23418
  community_id: files.community_id,
23397
23419
  name: files.name,
23420
+ ...files.name_rev ? { name_rev: files.name_rev } : {},
23398
23421
  settings: {
23399
23422
  ...files.settings.rev ? { rev: files.settings.rev } : {},
23400
23423
  slow_mode_seconds: files.settings.slow_mode_seconds,
@@ -23456,7 +23479,7 @@ var init_files = __esm({
23456
23479
  init_utils();
23457
23480
  init_model();
23458
23481
  init_course_files();
23459
- TOP_KEYS = ["community_id", "name", "settings", "join_link_enabled", "join_link_rev", "rooms", "courses", "synced"];
23482
+ TOP_KEYS = ["community_id", "name", "name_rev", "settings", "join_link_enabled", "join_link_rev", "rooms", "courses", "synced"];
23460
23483
  SETTINGS_KEYS = ["rev", "slow_mode_seconds", "courses_label", "admission"];
23461
23484
  ROOM_KEYS = ["key", "id", "rev", "name", "kind", "archived"];
23462
23485
  }
@@ -24844,6 +24867,11 @@ function planSync(files, server) {
24844
24867
  const id = files.community_id;
24845
24868
  const fileSettings = fileSettingsContent(files);
24846
24869
  const settingsSide = serverSettings(id, server.settings);
24870
+ const fileName = nameContent(files.name);
24871
+ const serverName = nameContent(server.community.name);
24872
+ const nameServerRev = nameRev(id, serverName);
24873
+ const nameFileRev = nameRev(id, fileName);
24874
+ const nameState = files.name_rev === void 0 && nameFileRev === nameServerRev ? "converged" : classify(files.name_rev ?? nameFileRev, nameFileRev, nameServerRev);
24847
24875
  const joinLinkServerRev = joinLinkRev(id, { enabled: server.joinLink.enabled });
24848
24876
  const byId = new Map(server.rooms.map((room) => [room.room_id, room]));
24849
24877
  const rooms = [];
@@ -24864,6 +24892,12 @@ function planSync(files, server) {
24864
24892
  }
24865
24893
  const tracked = new Set(files.rooms.map((room) => room.id));
24866
24894
  return {
24895
+ name: {
24896
+ state: nameState,
24897
+ file: fileName.name,
24898
+ server: serverName.name,
24899
+ serverRev: nameServerRev
24900
+ },
24867
24901
  settings: {
24868
24902
  state: classify(files.settings.rev, settingsRev(id, fileSettings), settingsSide.rev),
24869
24903
  file: fileSettings,
@@ -24917,9 +24951,6 @@ function joinLinkChange(from, to) {
24917
24951
  }
24918
24952
  function pushProblems(files, server, plan) {
24919
24953
  const problems2 = unknownIdProblems(plan);
24920
- if (files.name !== server.community.name) {
24921
- problems2.push(`name: a community's name cannot change from the files (it is ${show(server.community.name)})`);
24922
- }
24923
24954
  for (const room of plan.rooms) {
24924
24955
  if (room.kind === "existing" && room.entry.kind !== room.server.kind) {
24925
24956
  problems2.push(`room ${room.entry.key}: kind cannot change once a room exists (it is ${room.server.kind})`);
@@ -24961,6 +24992,10 @@ function takeRoom(entry, room) {
24961
24992
  entry.archived = room.archived;
24962
24993
  entry.kind = room.kind;
24963
24994
  }
24995
+ function takeName(files, name) {
24996
+ files.name = name;
24997
+ files.name_rev = nameRev(files.community_id, nameContent(name));
24998
+ }
24964
24999
  function takeSettings(files, settings) {
24965
25000
  const { content, rev: rev2 } = serverSettings(files.community_id, settings);
24966
25001
  files.settings = {
@@ -24988,6 +25023,19 @@ function pushPhases(files, plan, remote, save, courses) {
24988
25023
  }
24989
25024
  function communityWrites(files, plan, remote, save) {
24990
25025
  const writes = [];
25026
+ if (plan.name.state === "local") {
25027
+ const name = plan.name.file;
25028
+ writes.push({
25029
+ label: "name",
25030
+ requests: 1,
25031
+ apply: async () => {
25032
+ const answered = (await remote.updateSettings({ name })).name;
25033
+ if (answered === void 0) throw expected("the server answered no name: it may be mid-deploy, push again in a moment");
25034
+ takeName(files, answered);
25035
+ save();
25036
+ }
25037
+ });
25038
+ }
24991
25039
  if (plan.settings.state === "local") {
24992
25040
  const body = settingsPatch(files, plan.settings.server);
24993
25041
  writes.push({
@@ -25059,6 +25107,10 @@ function communityWrites(files, plan, remote, save) {
25059
25107
  }
25060
25108
  function refreshConverged(files, plan) {
25061
25109
  let refreshed = 0;
25110
+ if (plan.name.state === "converged") {
25111
+ files.name_rev = plan.name.serverRev;
25112
+ refreshed++;
25113
+ }
25062
25114
  if (plan.settings.state === "converged") {
25063
25115
  files.settings.rev = plan.settings.serverRev;
25064
25116
  refreshed++;
@@ -25078,7 +25130,8 @@ function refreshConverged(files, plan) {
25078
25130
  }
25079
25131
  function pushListing(plan, courses) {
25080
25132
  const listing = emptyListing();
25081
- const { settings, joinLink } = plan;
25133
+ const { name, settings, joinLink } = plan;
25134
+ if (name.state === "local") listing.changes.push(`~ name: ${show(name.server)} \u2192 ${show(name.file)}`);
25082
25135
  if (settings.state === "local") {
25083
25136
  listing.changes.push(`~ settings: ${settingsChanges(settings.server, settings.file).join("; ")}`);
25084
25137
  if (settings.server.admission !== settings.file.admission) listing.changes.push(` ${admissionChange(settings.file.admission)}`);
@@ -25096,6 +25149,7 @@ function pushListing(plan, courses) {
25096
25149
  }
25097
25150
  }
25098
25151
  const named = (state) => [
25152
+ ...name.state === state ? ["name"] : [],
25099
25153
  ...settings.state === state ? ["settings"] : [],
25100
25154
  ...joinLink.state === state ? ["join link"] : [],
25101
25155
  ...plan.rooms.flatMap((room) => room.kind === "existing" && room.state === state ? [`room ${room.entry.key}`] : [])
@@ -25238,6 +25292,7 @@ function courseSaver(root, folder, community) {
25238
25292
  function changedSince(before, after) {
25239
25293
  const id = before.community.community_id;
25240
25294
  const changed = [];
25295
+ if (before.community.name !== after.community.name) changed.push("name");
25241
25296
  if (serverSettings(id, before.settings).rev !== serverSettings(id, after.settings).rev) changed.push("settings");
25242
25297
  if (before.joinLink.enabled !== after.joinLink.enabled || before.joinLink.url !== after.joinLink.url) {
25243
25298
  changed.push("join link");
@@ -25274,6 +25329,7 @@ function filesFromServer(server) {
25274
25329
  courses: [],
25275
25330
  unlistedCourses: []
25276
25331
  };
25332
+ takeName(files, server.community.name);
25277
25333
  takeSettings(files, server.settings);
25278
25334
  takeJoinLink(files, server.joinLink.enabled);
25279
25335
  addUntracked(files, server.rooms);
@@ -25287,11 +25343,12 @@ function pullMerge(files, server, plan, theirs) {
25287
25343
  if (state === "local") listing.kept.push(what);
25288
25344
  if (state === "conflict" && !theirs) listing.conflicts.push(what);
25289
25345
  };
25290
- if (files.name !== server.community.name) {
25291
- listing.changes.push(`~ name: ${show(files.name)} \u2192 ${show(server.community.name)}`);
25292
- files.name = server.community.name;
25346
+ const { name, settings, joinLink } = plan;
25347
+ if (takes(name.state)) {
25348
+ listing.changes.push(`~ name: ${show(files.name)} \u2192 ${show(name.server)}`);
25349
+ takeName(files, server.community.name);
25293
25350
  }
25294
- const { settings, joinLink } = plan;
25351
+ note(name.state, "name");
25295
25352
  if (takes(settings.state)) {
25296
25353
  listing.changes.push(`~ settings: ${settingsChanges(settings.file, settings.server).join("; ")}`);
25297
25354
  takeSettings(files, server.settings);
@@ -37385,16 +37442,6 @@ var init_batch = __esm({
37385
37442
  }
37386
37443
  });
37387
37444
 
37388
- // ../../packages/core/dist/contracts/rekor-toolset.js
37389
- var init_rekor_toolset = __esm({
37390
- "../../packages/core/dist/contracts/rekor-toolset.js"() {
37391
- "use strict";
37392
- init_chunk_OWAAYKPB();
37393
- init_chunk_BEOHBREG();
37394
- init_chunk_DHPUPI4Y();
37395
- }
37396
- });
37397
-
37398
37445
  // src/data/commands/import.ts
37399
37446
  import { createReadStream } from "fs";
37400
37447
  import { access, constants, stat } from "fs/promises";
@@ -37621,14 +37668,16 @@ Stopped at chunk ${nextIndex}. To resume, re-run the SAME command with:
37621
37668
  }
37622
37669
  if (!opts.yes) {
37623
37670
  const plan = await client.request("GET", `/v1/${base}/import/${pathSegment(importId, "import id")}/rollback-plan?counts=true`);
37624
- const n = plan.matched_records ?? 0;
37671
+ const matched = plan.matched_records ?? 0;
37672
+ const kept2 = Math.min(plan.kept?.records ?? 0, matched);
37673
+ const n = matched - kept2;
37625
37674
  if (n === 0) {
37626
- console.error("No rows left to undo \u2014 closing the import session.");
37675
+ console.error(
37676
+ kept2 > 0 ? `Nothing to delete: the ${approvedRecords(kept2)} left of this import ${kept2 === 1 ? "is" : "are"} kept, since only a person signed in to WayAI removes an approved record \u2014 closing the import session.` : "No rows left to undo \u2014 closing the import session."
37677
+ );
37627
37678
  } else {
37628
- const reviewed = await recordTypeIsReviewed(client, base, plan.record_type);
37629
- const count = `${reviewed ? "up to " : ""}${n} record${n === 1 ? "" : "s"}`;
37630
37679
  const ok = await confirm(
37631
- `Delete ${count} created by this import into "${sanitizeTerminalText(String(plan.record_type))}"${reviewed ? " (those approved now stay unless you are signed in to WayAI as a person)" : ""}, plus every relationship pointing at them?`
37680
+ `Delete ${n} record${n === 1 ? "" : "s"} created by this import into "${sanitizeTerminalText(String(plan.record_type))}"${kept2 > 0 ? ` (${approvedRecords(kept2)} stay: only a person signed in to WayAI removes an approved record)` : ""}, plus every relationship pointing at them?`
37632
37681
  );
37633
37682
  if (!ok) {
37634
37683
  console.error("Aborted.");
@@ -37693,23 +37742,13 @@ Stopped at chunk ${nextIndex}. To resume, re-run the SAME command with:
37693
37742
  });
37694
37743
  return importCmd;
37695
37744
  }
37696
- async function recordTypeIsReviewed(client, base, recordType2) {
37697
- if (recordType2 === null) return false;
37698
- try {
37699
- const type = await client.request(
37700
- "GET",
37701
- `/v1/${base}/record-types/${pathSegment(recordType2, "record_type")}`
37702
- );
37703
- return declaresReview(type?.json_schema);
37704
- } catch {
37705
- return true;
37706
- }
37745
+ function approvedRecords(n) {
37746
+ return `${n} approved record${n === 1 ? "" : "s"}`;
37707
37747
  }
37708
37748
  var MAX_CHUNK_ROWS, MAX_ATTEMPTS, MAX_ROLLBACK_SWEEPS, BASE_BACKOFF_MS, RETRYABLE_CODES, sleep2;
37709
37749
  var init_import = __esm({
37710
37750
  "src/data/commands/import.ts"() {
37711
37751
  "use strict";
37712
- init_rekor_toolset();
37713
37752
  init_client();
37714
37753
  init_output();
37715
37754
  init_helpers();