@wayai/cli 0.3.351 → 0.3.352
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 +1303 -822
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5363,6 +5363,13 @@ var init_chunk_Q7KIQHAZ = __esm({
|
|
|
5363
5363
|
}
|
|
5364
5364
|
});
|
|
5365
5365
|
|
|
5366
|
+
// ../../packages/core/dist/chunk-63UWXV4T.js
|
|
5367
|
+
var init_chunk_63UWXV4T = __esm({
|
|
5368
|
+
"../../packages/core/dist/chunk-63UWXV4T.js"() {
|
|
5369
|
+
"use strict";
|
|
5370
|
+
}
|
|
5371
|
+
});
|
|
5372
|
+
|
|
5366
5373
|
// ../../packages/core/dist/chunk-AYLAGFAD.js
|
|
5367
5374
|
var BASE_CREDENTIAL_NAME_MAX, BASE_CREDENTIAL_NAME_PATTERN, BASE_CREDENTIAL_NAME_CHARSET, baseCredentialNameSchema;
|
|
5368
5375
|
var init_chunk_AYLAGFAD = __esm({
|
|
@@ -6332,10 +6339,22 @@ var init_chunk_IPXBFWUU = __esm({
|
|
|
6332
6339
|
}
|
|
6333
6340
|
});
|
|
6334
6341
|
|
|
6335
|
-
// ../../packages/core/dist/chunk-
|
|
6336
|
-
var
|
|
6337
|
-
|
|
6342
|
+
// ../../packages/core/dist/chunk-TVUDMGWV.js
|
|
6343
|
+
var bootstrapQuery;
|
|
6344
|
+
var init_chunk_TVUDMGWV = __esm({
|
|
6345
|
+
"../../packages/core/dist/chunk-TVUDMGWV.js"() {
|
|
6338
6346
|
"use strict";
|
|
6347
|
+
init_zod();
|
|
6348
|
+
bootstrapQuery = external_exports.object({
|
|
6349
|
+
active_hub_id: external_exports.string().uuid().optional(),
|
|
6350
|
+
active_conversation_id: external_exports.string().uuid().optional(),
|
|
6351
|
+
active_nav: external_exports.enum(["chat", "task", "support"]).optional(),
|
|
6352
|
+
/**
|
|
6353
|
+
* The people thread the URL names (`/chat/threads/:threadId`, gh #4661): the snapshot
|
|
6354
|
+
* preloads it as `people.active_thread` when the viewer is a member.
|
|
6355
|
+
*/
|
|
6356
|
+
active_thread_id: external_exports.string().uuid().optional()
|
|
6357
|
+
});
|
|
6339
6358
|
}
|
|
6340
6359
|
});
|
|
6341
6360
|
|
|
@@ -6491,6 +6510,231 @@ var init_chunk_ZC6YGHNX = __esm({
|
|
|
6491
6510
|
}
|
|
6492
6511
|
});
|
|
6493
6512
|
|
|
6513
|
+
// ../../packages/core/dist/chunk-2YEGUQR7.js
|
|
6514
|
+
var PERSON_ID_PATTERN, CONTACT_PERSON_ID_PATTERN, PERSON_ID_FORM_MESSAGE, userPersonIdSchema, personIdSchema;
|
|
6515
|
+
var init_chunk_2YEGUQR7 = __esm({
|
|
6516
|
+
"../../packages/core/dist/chunk-2YEGUQR7.js"() {
|
|
6517
|
+
"use strict";
|
|
6518
|
+
init_zod();
|
|
6519
|
+
PERSON_ID_PATTERN = /^prs_[a-z2-7]{52}$/;
|
|
6520
|
+
CONTACT_PERSON_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
6521
|
+
PERSON_ID_FORM_MESSAGE = "Must be a person id (prs_\u2026) or a contact id (a lowercase UUID)";
|
|
6522
|
+
userPersonIdSchema = external_exports.string().regex(PERSON_ID_PATTERN, { message: "Must be a person id (prs_\u2026)" });
|
|
6523
|
+
personIdSchema = external_exports.string().refine(
|
|
6524
|
+
(value) => PERSON_ID_PATTERN.test(value) || CONTACT_PERSON_ID_PATTERN.test(value),
|
|
6525
|
+
{ message: PERSON_ID_FORM_MESSAGE }
|
|
6526
|
+
);
|
|
6527
|
+
}
|
|
6528
|
+
});
|
|
6529
|
+
|
|
6530
|
+
// ../../packages/core/dist/chunk-UAOHHCW5.js
|
|
6531
|
+
function normalizeContactPhone(raw) {
|
|
6532
|
+
const compact = raw.trim().replace(/[\s\-.()]/g, "");
|
|
6533
|
+
const withPlus = compact.startsWith("00") ? `+${compact.slice(2)}` : compact;
|
|
6534
|
+
return /^\+[1-9]\d{7,14}$/.test(withPlus) ? withPlus : null;
|
|
6535
|
+
}
|
|
6536
|
+
function normalizeContactLabel(raw) {
|
|
6537
|
+
return raw.trim().replace(/\s+/g, " ").toLowerCase();
|
|
6538
|
+
}
|
|
6539
|
+
function importRowLabels(row, batchLabels) {
|
|
6540
|
+
return [.../* @__PURE__ */ new Set([...row.labels ?? [], ...batchLabels ?? []])];
|
|
6541
|
+
}
|
|
6542
|
+
var CONTACT_ENVIRONMENTS, CONTACT_NAME_MAX, CONTACT_EMAIL_MAX, CONTACT_PHONE_INPUT_MAX, CONTACT_INSTAGRAM_SID_MAX, CONTACT_METADATA_MAX_BYTES, CONTACT_LABEL_MAX, CONTACT_LABELS_MAX, CONTACT_SCOPE_TAGS_MAX, CONTACT_PAGE_MAX, CONTACT_IMPORT_BATCH_MAX, CONTACT_SEARCH_MAX, CONTACT_LIST_NAME_MAX, CONTACT_LIST_NAME_REGEX, CONTACT_LIST_DESCRIPTION_MAX, CONTACT_LIST_FILTER_MAX, CONTACT_LIST_PINS_PER_REQUEST_MAX, SUPPRESSION_SCOPES, SUPPRESSION_ID_REGEX, contactName, contactPhone, contactEmail, contactInstagramSid, contactLabel, contactLabels, contactMetadata, scopeTagIds, contactVisibilitySchema, hasIdentity, IDENTITY_REQUIRED, contactBookOrgQuery, contactBookContactParam, contactBookListParam, contactBookHubParam, contactBookPageQuery, listContactBookContactsQuery, listHubContactBookContactsQuery, contactBookLinkCandidatesQuery, listContactBookListMembersQuery, contactRowFields, createContactBookContactBody, updateContactBookContactBody, contactImportRowSchema, importContactBookContactsBody, linkContactBookContactBody, listName, contactListFilterSchema, createContactBookListBody, updateContactBookListBody, updateContactBookListPinsBody, suppressionIdentitySchema, createContactBookSuppressionBody, contactBookSuppressionParam, listContactBookSuppressionsQuery, contactBookEmailUnsubscribeTokenSchema, contactBookEmailUnsubscribeQuery, orgListReferenceSchema;
|
|
6543
|
+
var init_chunk_UAOHHCW5 = __esm({
|
|
6544
|
+
"../../packages/core/dist/chunk-UAOHHCW5.js"() {
|
|
6545
|
+
"use strict";
|
|
6546
|
+
init_zod();
|
|
6547
|
+
CONTACT_ENVIRONMENTS = ["production", "preview", "all"];
|
|
6548
|
+
CONTACT_NAME_MAX = 200;
|
|
6549
|
+
CONTACT_EMAIL_MAX = 320;
|
|
6550
|
+
CONTACT_PHONE_INPUT_MAX = 40;
|
|
6551
|
+
CONTACT_INSTAGRAM_SID_MAX = 64;
|
|
6552
|
+
CONTACT_METADATA_MAX_BYTES = 4096;
|
|
6553
|
+
CONTACT_LABEL_MAX = 64;
|
|
6554
|
+
CONTACT_LABELS_MAX = 20;
|
|
6555
|
+
CONTACT_SCOPE_TAGS_MAX = 20;
|
|
6556
|
+
CONTACT_PAGE_MAX = 100;
|
|
6557
|
+
CONTACT_IMPORT_BATCH_MAX = 500;
|
|
6558
|
+
CONTACT_SEARCH_MAX = 100;
|
|
6559
|
+
CONTACT_LIST_NAME_MAX = 64;
|
|
6560
|
+
CONTACT_LIST_NAME_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
6561
|
+
CONTACT_LIST_DESCRIPTION_MAX = 1e3;
|
|
6562
|
+
CONTACT_LIST_FILTER_MAX = 20;
|
|
6563
|
+
CONTACT_LIST_PINS_PER_REQUEST_MAX = 100;
|
|
6564
|
+
SUPPRESSION_SCOPES = ["all", "marketing"];
|
|
6565
|
+
SUPPRESSION_ID_REGEX = /^[0-9a-f]{64}$/;
|
|
6566
|
+
contactName = external_exports.string().trim().min(1).max(CONTACT_NAME_MAX);
|
|
6567
|
+
contactPhone = external_exports.string().max(CONTACT_PHONE_INPUT_MAX).transform((raw, ctx) => {
|
|
6568
|
+
const phone = normalizeContactPhone(raw);
|
|
6569
|
+
if (phone === null) {
|
|
6570
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Phone must be an international number, e.g. +5511999999999" });
|
|
6571
|
+
return external_exports.NEVER;
|
|
6572
|
+
}
|
|
6573
|
+
return phone;
|
|
6574
|
+
});
|
|
6575
|
+
contactEmail = external_exports.string().trim().toLowerCase().max(CONTACT_EMAIL_MAX).email();
|
|
6576
|
+
contactInstagramSid = external_exports.string().trim().min(1).max(CONTACT_INSTAGRAM_SID_MAX);
|
|
6577
|
+
contactLabel = external_exports.string().max(CONTACT_LABEL_MAX).transform(normalizeContactLabel).refine((label3) => label3.length > 0, "A label cannot be empty").refine((label3) => !label3.includes(","), "A label cannot contain a comma");
|
|
6578
|
+
contactLabels = external_exports.array(contactLabel).max(CONTACT_LABELS_MAX).transform((labels) => [...new Set(labels)]);
|
|
6579
|
+
contactMetadata = external_exports.record(external_exports.unknown()).refine((metadata) => {
|
|
6580
|
+
try {
|
|
6581
|
+
return new TextEncoder().encode(JSON.stringify(metadata)).length <= CONTACT_METADATA_MAX_BYTES;
|
|
6582
|
+
} catch {
|
|
6583
|
+
return false;
|
|
6584
|
+
}
|
|
6585
|
+
}, `Metadata must serialize to at most ${CONTACT_METADATA_MAX_BYTES} bytes`);
|
|
6586
|
+
scopeTagIds = external_exports.array(external_exports.string().uuid()).min(1).max(CONTACT_SCOPE_TAGS_MAX).transform((ids) => [...new Set(ids)]);
|
|
6587
|
+
contactVisibilitySchema = external_exports.discriminatedUnion("scope", [
|
|
6588
|
+
external_exports.object({ scope: external_exports.literal("all_hubs") }).strict(),
|
|
6589
|
+
external_exports.object({ scope: external_exports.literal("tags"), tag_ids: scopeTagIds }).strict()
|
|
6590
|
+
]);
|
|
6591
|
+
hasIdentity = (row) => Boolean(row.phone || row.email || row.instagram_sid);
|
|
6592
|
+
IDENTITY_REQUIRED = "A contact needs a phone, an email or an Instagram id";
|
|
6593
|
+
contactBookOrgQuery = external_exports.object({
|
|
6594
|
+
organization_id: external_exports.string().uuid()
|
|
6595
|
+
});
|
|
6596
|
+
contactBookContactParam = external_exports.object({
|
|
6597
|
+
contactId: external_exports.string().uuid()
|
|
6598
|
+
});
|
|
6599
|
+
contactBookListParam = external_exports.object({
|
|
6600
|
+
listId: external_exports.string().uuid()
|
|
6601
|
+
});
|
|
6602
|
+
contactBookHubParam = external_exports.object({
|
|
6603
|
+
hubId: external_exports.string().uuid()
|
|
6604
|
+
});
|
|
6605
|
+
contactBookPageQuery = external_exports.object({
|
|
6606
|
+
cursor: external_exports.string().max(2048).optional(),
|
|
6607
|
+
limit: external_exports.coerce.number().int().min(1).max(CONTACT_PAGE_MAX).default(50)
|
|
6608
|
+
});
|
|
6609
|
+
listContactBookContactsQuery = contactBookOrgQuery.merge(contactBookPageQuery).extend({
|
|
6610
|
+
q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional(),
|
|
6611
|
+
label: external_exports.string().max(CONTACT_LABEL_MAX).transform(normalizeContactLabel).optional(),
|
|
6612
|
+
scope_tag_id: external_exports.string().uuid().optional()
|
|
6613
|
+
});
|
|
6614
|
+
listHubContactBookContactsQuery = contactBookPageQuery.extend({
|
|
6615
|
+
q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional()
|
|
6616
|
+
});
|
|
6617
|
+
contactBookLinkCandidatesQuery = contactBookOrgQuery.extend({
|
|
6618
|
+
email: contactEmail
|
|
6619
|
+
});
|
|
6620
|
+
listContactBookListMembersQuery = contactBookOrgQuery.merge(contactBookPageQuery);
|
|
6621
|
+
contactRowFields = {
|
|
6622
|
+
name: contactName,
|
|
6623
|
+
phone: contactPhone.nullish(),
|
|
6624
|
+
email: contactEmail.nullish(),
|
|
6625
|
+
instagram_sid: contactInstagramSid.nullish(),
|
|
6626
|
+
labels: contactLabels.optional(),
|
|
6627
|
+
metadata: contactMetadata.optional()
|
|
6628
|
+
};
|
|
6629
|
+
createContactBookContactBody = external_exports.object({
|
|
6630
|
+
organization_id: external_exports.string().uuid(),
|
|
6631
|
+
...contactRowFields,
|
|
6632
|
+
visibility: contactVisibilitySchema,
|
|
6633
|
+
environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
|
|
6634
|
+
}).strict().refine(hasIdentity, IDENTITY_REQUIRED);
|
|
6635
|
+
updateContactBookContactBody = external_exports.object({
|
|
6636
|
+
name: contactName.optional(),
|
|
6637
|
+
phone: contactPhone.nullable().optional(),
|
|
6638
|
+
email: contactEmail.nullable().optional(),
|
|
6639
|
+
instagram_sid: contactInstagramSid.nullable().optional(),
|
|
6640
|
+
labels: contactLabels.optional(),
|
|
6641
|
+
metadata: contactMetadata.optional(),
|
|
6642
|
+
visibility: contactVisibilitySchema.optional(),
|
|
6643
|
+
environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
|
|
6644
|
+
}).strict();
|
|
6645
|
+
contactImportRowSchema = external_exports.object(contactRowFields).strict().refine(hasIdentity, IDENTITY_REQUIRED);
|
|
6646
|
+
importContactBookContactsBody = external_exports.object({
|
|
6647
|
+
organization_id: external_exports.string().uuid(),
|
|
6648
|
+
visibility: contactVisibilitySchema,
|
|
6649
|
+
environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional(),
|
|
6650
|
+
labels: contactLabels.optional(),
|
|
6651
|
+
rows: external_exports.array(contactImportRowSchema).min(1).max(CONTACT_IMPORT_BATCH_MAX)
|
|
6652
|
+
}).strict().superRefine((batch, ctx) => {
|
|
6653
|
+
batch.rows.forEach((row, index) => {
|
|
6654
|
+
if (importRowLabels(row, batch.labels).length > CONTACT_LABELS_MAX) {
|
|
6655
|
+
ctx.addIssue({
|
|
6656
|
+
code: external_exports.ZodIssueCode.custom,
|
|
6657
|
+
path: ["rows", index, "labels"],
|
|
6658
|
+
message: `A contact holds at most ${CONTACT_LABELS_MAX} labels, the batch's included`
|
|
6659
|
+
});
|
|
6660
|
+
}
|
|
6661
|
+
});
|
|
6662
|
+
});
|
|
6663
|
+
linkContactBookContactBody = external_exports.object({
|
|
6664
|
+
user_id: external_exports.string().min(1).max(128)
|
|
6665
|
+
}).strict();
|
|
6666
|
+
listName = external_exports.string().trim().min(1).max(CONTACT_LIST_NAME_MAX).regex(CONTACT_LIST_NAME_REGEX, {
|
|
6667
|
+
message: 'Must be lowercase alphanumeric with hyphens (e.g. "vip-customers")'
|
|
6668
|
+
});
|
|
6669
|
+
contactListFilterSchema = external_exports.object({
|
|
6670
|
+
labels: external_exports.array(contactLabel).max(CONTACT_LIST_FILTER_MAX).transform((l) => [...new Set(l)]).default([]),
|
|
6671
|
+
scope_tag_ids: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_FILTER_MAX).transform((t) => [...new Set(t)]).default([])
|
|
6672
|
+
}).strict();
|
|
6673
|
+
createContactBookListBody = external_exports.object({
|
|
6674
|
+
organization_id: external_exports.string().uuid(),
|
|
6675
|
+
name: listName,
|
|
6676
|
+
description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullish(),
|
|
6677
|
+
filter: contactListFilterSchema.optional()
|
|
6678
|
+
}).strict();
|
|
6679
|
+
updateContactBookListBody = external_exports.object({
|
|
6680
|
+
name: listName.optional(),
|
|
6681
|
+
description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullable().optional(),
|
|
6682
|
+
filter: contactListFilterSchema.optional()
|
|
6683
|
+
}).strict();
|
|
6684
|
+
updateContactBookListPinsBody = external_exports.object({
|
|
6685
|
+
add: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([]),
|
|
6686
|
+
remove: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([])
|
|
6687
|
+
}).strict().refine((b) => b.add.length + b.remove.length > 0, "Add or remove at least one contact");
|
|
6688
|
+
suppressionIdentitySchema = external_exports.discriminatedUnion("kind", [
|
|
6689
|
+
external_exports.object({ kind: external_exports.literal("phone"), value: contactPhone }).strict(),
|
|
6690
|
+
external_exports.object({ kind: external_exports.literal("email"), value: contactEmail }).strict(),
|
|
6691
|
+
external_exports.object({ kind: external_exports.literal("instagram"), value: contactInstagramSid }).strict()
|
|
6692
|
+
]);
|
|
6693
|
+
createContactBookSuppressionBody = external_exports.object({
|
|
6694
|
+
organization_id: external_exports.string().uuid(),
|
|
6695
|
+
identity: suppressionIdentitySchema,
|
|
6696
|
+
scope: external_exports.enum(SUPPRESSION_SCOPES)
|
|
6697
|
+
}).strict();
|
|
6698
|
+
contactBookSuppressionParam = external_exports.object({
|
|
6699
|
+
suppressionId: external_exports.string().regex(SUPPRESSION_ID_REGEX)
|
|
6700
|
+
});
|
|
6701
|
+
listContactBookSuppressionsQuery = contactBookOrgQuery.merge(contactBookPageQuery);
|
|
6702
|
+
contactBookEmailUnsubscribeTokenSchema = external_exports.string().max(200).regex(/^[0-9a-f-]{36}\.[0-9a-f]{64}\.[0-9a-f]{64}$/i);
|
|
6703
|
+
contactBookEmailUnsubscribeQuery = external_exports.object({ token: contactBookEmailUnsubscribeTokenSchema });
|
|
6704
|
+
orgListReferenceSchema = listName;
|
|
6705
|
+
}
|
|
6706
|
+
});
|
|
6707
|
+
|
|
6708
|
+
// ../../packages/core/dist/chunk-MGBAXT5Y.js
|
|
6709
|
+
var PERSON_LINKS_MAX, PERSON_DENY_PAGE_MAX, personParam, personLinkParam, deniedPersonParam, listDeniedPersonsQuery, conversationCustomerPersonParam;
|
|
6710
|
+
var init_chunk_MGBAXT5Y = __esm({
|
|
6711
|
+
"../../packages/core/dist/chunk-MGBAXT5Y.js"() {
|
|
6712
|
+
"use strict";
|
|
6713
|
+
init_chunk_2YEGUQR7();
|
|
6714
|
+
init_chunk_UAOHHCW5();
|
|
6715
|
+
init_zod();
|
|
6716
|
+
PERSON_LINKS_MAX = 15;
|
|
6717
|
+
PERSON_DENY_PAGE_MAX = 100;
|
|
6718
|
+
personParam = external_exports.object({
|
|
6719
|
+
personId: userPersonIdSchema
|
|
6720
|
+
});
|
|
6721
|
+
personLinkParam = personParam.extend({
|
|
6722
|
+
targetId: personIdSchema
|
|
6723
|
+
});
|
|
6724
|
+
deniedPersonParam = external_exports.object({
|
|
6725
|
+
personId: personIdSchema
|
|
6726
|
+
});
|
|
6727
|
+
listDeniedPersonsQuery = contactBookOrgQuery.extend({
|
|
6728
|
+
cursor: personIdSchema.optional(),
|
|
6729
|
+
limit: external_exports.coerce.number().int().min(1).max(PERSON_DENY_PAGE_MAX).default(50)
|
|
6730
|
+
});
|
|
6731
|
+
conversationCustomerPersonParam = external_exports.object({
|
|
6732
|
+
hubId: external_exports.string().uuid(),
|
|
6733
|
+
conversationId: external_exports.string().uuid()
|
|
6734
|
+
});
|
|
6735
|
+
}
|
|
6736
|
+
});
|
|
6737
|
+
|
|
6494
6738
|
// ../../packages/core/dist/chunk-5DGHIY7L.js
|
|
6495
6739
|
var rekorBaseChangeMessageSchema;
|
|
6496
6740
|
var init_chunk_5DGHIY7L = __esm({
|
|
@@ -7449,22 +7693,41 @@ var init_chunk_PFGVH2CX = __esm({
|
|
|
7449
7693
|
}
|
|
7450
7694
|
});
|
|
7451
7695
|
|
|
7452
|
-
// ../../packages/core/dist/chunk-
|
|
7453
|
-
var
|
|
7454
|
-
var
|
|
7455
|
-
"../../packages/core/dist/chunk-
|
|
7696
|
+
// ../../packages/core/dist/chunk-FPSDNS2E.js
|
|
7697
|
+
var noticeSeveritySchema, noticeStatusSchema, NOTICE_SCOPE_REGEX, noticeScopeSchema, noticeLinkSchema, createNoticeBody, updateNoticeBody, listNoticesQuery, noticeIdParamSchema;
|
|
7698
|
+
var init_chunk_FPSDNS2E = __esm({
|
|
7699
|
+
"../../packages/core/dist/chunk-FPSDNS2E.js"() {
|
|
7456
7700
|
"use strict";
|
|
7457
7701
|
init_zod();
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7702
|
+
noticeSeveritySchema = external_exports.enum(["critical", "warn", "info"]);
|
|
7703
|
+
noticeStatusSchema = external_exports.enum(["active", "resolved"]);
|
|
7704
|
+
NOTICE_SCOPE_REGEX = /^(global|provider:[a-z0-9_-]{1,40}|service:[a-z0-9_-]{1,40})$/;
|
|
7705
|
+
noticeScopeSchema = external_exports.string().regex(NOTICE_SCOPE_REGEX, "scope must be 'global', 'provider:<x>', or 'service:<x>'");
|
|
7706
|
+
noticeLinkSchema = external_exports.string().url().refine((u) => /^https?:\/\//i.test(u), { message: "link must be an http(s) URL" });
|
|
7707
|
+
createNoticeBody = external_exports.object({
|
|
7708
|
+
severity: noticeSeveritySchema.default("info"),
|
|
7709
|
+
scope: noticeScopeSchema.default("global"),
|
|
7710
|
+
title: external_exports.string().trim().min(1).max(200),
|
|
7711
|
+
body: external_exports.string().max(2e3).optional(),
|
|
7712
|
+
link: noticeLinkSchema.optional(),
|
|
7713
|
+
starts_at: external_exports.string().datetime().optional(),
|
|
7714
|
+
ends_at: external_exports.string().datetime().optional()
|
|
7715
|
+
});
|
|
7716
|
+
updateNoticeBody = external_exports.object({
|
|
7717
|
+
severity: noticeSeveritySchema.optional(),
|
|
7718
|
+
scope: noticeScopeSchema.optional(),
|
|
7719
|
+
title: external_exports.string().trim().min(1).max(200).optional(),
|
|
7720
|
+
body: external_exports.string().max(2e3).nullable().optional(),
|
|
7721
|
+
link: noticeLinkSchema.nullable().optional(),
|
|
7722
|
+
starts_at: external_exports.string().datetime().optional(),
|
|
7723
|
+
ends_at: external_exports.string().datetime().nullable().optional()
|
|
7724
|
+
}).refine((b) => Object.keys(b).length > 0, { message: "at least one field must be provided" });
|
|
7725
|
+
listNoticesQuery = external_exports.object({
|
|
7726
|
+
status: noticeStatusSchema.optional(),
|
|
7727
|
+
limit: external_exports.coerce.number().int().min(1).max(200).optional(),
|
|
7728
|
+
offset: external_exports.coerce.number().int().min(0).optional()
|
|
7467
7729
|
});
|
|
7730
|
+
noticeIdParamSchema = external_exports.object({ id: external_exports.string().min(1) });
|
|
7468
7731
|
}
|
|
7469
7732
|
});
|
|
7470
7733
|
|
|
@@ -7974,231 +8237,6 @@ var init_chunk_Y7CFCYX4 = __esm({
|
|
|
7974
8237
|
}
|
|
7975
8238
|
});
|
|
7976
8239
|
|
|
7977
|
-
// ../../packages/core/dist/chunk-2YEGUQR7.js
|
|
7978
|
-
var PERSON_ID_PATTERN, CONTACT_PERSON_ID_PATTERN, PERSON_ID_FORM_MESSAGE, userPersonIdSchema, personIdSchema;
|
|
7979
|
-
var init_chunk_2YEGUQR7 = __esm({
|
|
7980
|
-
"../../packages/core/dist/chunk-2YEGUQR7.js"() {
|
|
7981
|
-
"use strict";
|
|
7982
|
-
init_zod();
|
|
7983
|
-
PERSON_ID_PATTERN = /^prs_[a-z2-7]{52}$/;
|
|
7984
|
-
CONTACT_PERSON_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
7985
|
-
PERSON_ID_FORM_MESSAGE = "Must be a person id (prs_\u2026) or a contact id (a lowercase UUID)";
|
|
7986
|
-
userPersonIdSchema = external_exports.string().regex(PERSON_ID_PATTERN, { message: "Must be a person id (prs_\u2026)" });
|
|
7987
|
-
personIdSchema = external_exports.string().refine(
|
|
7988
|
-
(value) => PERSON_ID_PATTERN.test(value) || CONTACT_PERSON_ID_PATTERN.test(value),
|
|
7989
|
-
{ message: PERSON_ID_FORM_MESSAGE }
|
|
7990
|
-
);
|
|
7991
|
-
}
|
|
7992
|
-
});
|
|
7993
|
-
|
|
7994
|
-
// ../../packages/core/dist/chunk-UAOHHCW5.js
|
|
7995
|
-
function normalizeContactPhone(raw) {
|
|
7996
|
-
const compact = raw.trim().replace(/[\s\-.()]/g, "");
|
|
7997
|
-
const withPlus = compact.startsWith("00") ? `+${compact.slice(2)}` : compact;
|
|
7998
|
-
return /^\+[1-9]\d{7,14}$/.test(withPlus) ? withPlus : null;
|
|
7999
|
-
}
|
|
8000
|
-
function normalizeContactLabel(raw) {
|
|
8001
|
-
return raw.trim().replace(/\s+/g, " ").toLowerCase();
|
|
8002
|
-
}
|
|
8003
|
-
function importRowLabels(row, batchLabels) {
|
|
8004
|
-
return [.../* @__PURE__ */ new Set([...row.labels ?? [], ...batchLabels ?? []])];
|
|
8005
|
-
}
|
|
8006
|
-
var CONTACT_ENVIRONMENTS, CONTACT_NAME_MAX, CONTACT_EMAIL_MAX, CONTACT_PHONE_INPUT_MAX, CONTACT_INSTAGRAM_SID_MAX, CONTACT_METADATA_MAX_BYTES, CONTACT_LABEL_MAX, CONTACT_LABELS_MAX, CONTACT_SCOPE_TAGS_MAX, CONTACT_PAGE_MAX, CONTACT_IMPORT_BATCH_MAX, CONTACT_SEARCH_MAX, CONTACT_LIST_NAME_MAX, CONTACT_LIST_NAME_REGEX, CONTACT_LIST_DESCRIPTION_MAX, CONTACT_LIST_FILTER_MAX, CONTACT_LIST_PINS_PER_REQUEST_MAX, SUPPRESSION_SCOPES, SUPPRESSION_ID_REGEX, contactName, contactPhone, contactEmail, contactInstagramSid, contactLabel, contactLabels, contactMetadata, scopeTagIds, contactVisibilitySchema, hasIdentity, IDENTITY_REQUIRED, contactBookOrgQuery, contactBookContactParam, contactBookListParam, contactBookHubParam, contactBookPageQuery, listContactBookContactsQuery, listHubContactBookContactsQuery, contactBookLinkCandidatesQuery, listContactBookListMembersQuery, contactRowFields, createContactBookContactBody, updateContactBookContactBody, contactImportRowSchema, importContactBookContactsBody, linkContactBookContactBody, listName, contactListFilterSchema, createContactBookListBody, updateContactBookListBody, updateContactBookListPinsBody, suppressionIdentitySchema, createContactBookSuppressionBody, contactBookSuppressionParam, listContactBookSuppressionsQuery, contactBookEmailUnsubscribeTokenSchema, contactBookEmailUnsubscribeQuery, orgListReferenceSchema;
|
|
8007
|
-
var init_chunk_UAOHHCW5 = __esm({
|
|
8008
|
-
"../../packages/core/dist/chunk-UAOHHCW5.js"() {
|
|
8009
|
-
"use strict";
|
|
8010
|
-
init_zod();
|
|
8011
|
-
CONTACT_ENVIRONMENTS = ["production", "preview", "all"];
|
|
8012
|
-
CONTACT_NAME_MAX = 200;
|
|
8013
|
-
CONTACT_EMAIL_MAX = 320;
|
|
8014
|
-
CONTACT_PHONE_INPUT_MAX = 40;
|
|
8015
|
-
CONTACT_INSTAGRAM_SID_MAX = 64;
|
|
8016
|
-
CONTACT_METADATA_MAX_BYTES = 4096;
|
|
8017
|
-
CONTACT_LABEL_MAX = 64;
|
|
8018
|
-
CONTACT_LABELS_MAX = 20;
|
|
8019
|
-
CONTACT_SCOPE_TAGS_MAX = 20;
|
|
8020
|
-
CONTACT_PAGE_MAX = 100;
|
|
8021
|
-
CONTACT_IMPORT_BATCH_MAX = 500;
|
|
8022
|
-
CONTACT_SEARCH_MAX = 100;
|
|
8023
|
-
CONTACT_LIST_NAME_MAX = 64;
|
|
8024
|
-
CONTACT_LIST_NAME_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
8025
|
-
CONTACT_LIST_DESCRIPTION_MAX = 1e3;
|
|
8026
|
-
CONTACT_LIST_FILTER_MAX = 20;
|
|
8027
|
-
CONTACT_LIST_PINS_PER_REQUEST_MAX = 100;
|
|
8028
|
-
SUPPRESSION_SCOPES = ["all", "marketing"];
|
|
8029
|
-
SUPPRESSION_ID_REGEX = /^[0-9a-f]{64}$/;
|
|
8030
|
-
contactName = external_exports.string().trim().min(1).max(CONTACT_NAME_MAX);
|
|
8031
|
-
contactPhone = external_exports.string().max(CONTACT_PHONE_INPUT_MAX).transform((raw, ctx) => {
|
|
8032
|
-
const phone = normalizeContactPhone(raw);
|
|
8033
|
-
if (phone === null) {
|
|
8034
|
-
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Phone must be an international number, e.g. +5511999999999" });
|
|
8035
|
-
return external_exports.NEVER;
|
|
8036
|
-
}
|
|
8037
|
-
return phone;
|
|
8038
|
-
});
|
|
8039
|
-
contactEmail = external_exports.string().trim().toLowerCase().max(CONTACT_EMAIL_MAX).email();
|
|
8040
|
-
contactInstagramSid = external_exports.string().trim().min(1).max(CONTACT_INSTAGRAM_SID_MAX);
|
|
8041
|
-
contactLabel = external_exports.string().max(CONTACT_LABEL_MAX).transform(normalizeContactLabel).refine((label3) => label3.length > 0, "A label cannot be empty").refine((label3) => !label3.includes(","), "A label cannot contain a comma");
|
|
8042
|
-
contactLabels = external_exports.array(contactLabel).max(CONTACT_LABELS_MAX).transform((labels) => [...new Set(labels)]);
|
|
8043
|
-
contactMetadata = external_exports.record(external_exports.unknown()).refine((metadata) => {
|
|
8044
|
-
try {
|
|
8045
|
-
return new TextEncoder().encode(JSON.stringify(metadata)).length <= CONTACT_METADATA_MAX_BYTES;
|
|
8046
|
-
} catch {
|
|
8047
|
-
return false;
|
|
8048
|
-
}
|
|
8049
|
-
}, `Metadata must serialize to at most ${CONTACT_METADATA_MAX_BYTES} bytes`);
|
|
8050
|
-
scopeTagIds = external_exports.array(external_exports.string().uuid()).min(1).max(CONTACT_SCOPE_TAGS_MAX).transform((ids) => [...new Set(ids)]);
|
|
8051
|
-
contactVisibilitySchema = external_exports.discriminatedUnion("scope", [
|
|
8052
|
-
external_exports.object({ scope: external_exports.literal("all_hubs") }).strict(),
|
|
8053
|
-
external_exports.object({ scope: external_exports.literal("tags"), tag_ids: scopeTagIds }).strict()
|
|
8054
|
-
]);
|
|
8055
|
-
hasIdentity = (row) => Boolean(row.phone || row.email || row.instagram_sid);
|
|
8056
|
-
IDENTITY_REQUIRED = "A contact needs a phone, an email or an Instagram id";
|
|
8057
|
-
contactBookOrgQuery = external_exports.object({
|
|
8058
|
-
organization_id: external_exports.string().uuid()
|
|
8059
|
-
});
|
|
8060
|
-
contactBookContactParam = external_exports.object({
|
|
8061
|
-
contactId: external_exports.string().uuid()
|
|
8062
|
-
});
|
|
8063
|
-
contactBookListParam = external_exports.object({
|
|
8064
|
-
listId: external_exports.string().uuid()
|
|
8065
|
-
});
|
|
8066
|
-
contactBookHubParam = external_exports.object({
|
|
8067
|
-
hubId: external_exports.string().uuid()
|
|
8068
|
-
});
|
|
8069
|
-
contactBookPageQuery = external_exports.object({
|
|
8070
|
-
cursor: external_exports.string().max(2048).optional(),
|
|
8071
|
-
limit: external_exports.coerce.number().int().min(1).max(CONTACT_PAGE_MAX).default(50)
|
|
8072
|
-
});
|
|
8073
|
-
listContactBookContactsQuery = contactBookOrgQuery.merge(contactBookPageQuery).extend({
|
|
8074
|
-
q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional(),
|
|
8075
|
-
label: external_exports.string().max(CONTACT_LABEL_MAX).transform(normalizeContactLabel).optional(),
|
|
8076
|
-
scope_tag_id: external_exports.string().uuid().optional()
|
|
8077
|
-
});
|
|
8078
|
-
listHubContactBookContactsQuery = contactBookPageQuery.extend({
|
|
8079
|
-
q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional()
|
|
8080
|
-
});
|
|
8081
|
-
contactBookLinkCandidatesQuery = contactBookOrgQuery.extend({
|
|
8082
|
-
email: contactEmail
|
|
8083
|
-
});
|
|
8084
|
-
listContactBookListMembersQuery = contactBookOrgQuery.merge(contactBookPageQuery);
|
|
8085
|
-
contactRowFields = {
|
|
8086
|
-
name: contactName,
|
|
8087
|
-
phone: contactPhone.nullish(),
|
|
8088
|
-
email: contactEmail.nullish(),
|
|
8089
|
-
instagram_sid: contactInstagramSid.nullish(),
|
|
8090
|
-
labels: contactLabels.optional(),
|
|
8091
|
-
metadata: contactMetadata.optional()
|
|
8092
|
-
};
|
|
8093
|
-
createContactBookContactBody = external_exports.object({
|
|
8094
|
-
organization_id: external_exports.string().uuid(),
|
|
8095
|
-
...contactRowFields,
|
|
8096
|
-
visibility: contactVisibilitySchema,
|
|
8097
|
-
environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
|
|
8098
|
-
}).strict().refine(hasIdentity, IDENTITY_REQUIRED);
|
|
8099
|
-
updateContactBookContactBody = external_exports.object({
|
|
8100
|
-
name: contactName.optional(),
|
|
8101
|
-
phone: contactPhone.nullable().optional(),
|
|
8102
|
-
email: contactEmail.nullable().optional(),
|
|
8103
|
-
instagram_sid: contactInstagramSid.nullable().optional(),
|
|
8104
|
-
labels: contactLabels.optional(),
|
|
8105
|
-
metadata: contactMetadata.optional(),
|
|
8106
|
-
visibility: contactVisibilitySchema.optional(),
|
|
8107
|
-
environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
|
|
8108
|
-
}).strict();
|
|
8109
|
-
contactImportRowSchema = external_exports.object(contactRowFields).strict().refine(hasIdentity, IDENTITY_REQUIRED);
|
|
8110
|
-
importContactBookContactsBody = external_exports.object({
|
|
8111
|
-
organization_id: external_exports.string().uuid(),
|
|
8112
|
-
visibility: contactVisibilitySchema,
|
|
8113
|
-
environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional(),
|
|
8114
|
-
labels: contactLabels.optional(),
|
|
8115
|
-
rows: external_exports.array(contactImportRowSchema).min(1).max(CONTACT_IMPORT_BATCH_MAX)
|
|
8116
|
-
}).strict().superRefine((batch, ctx) => {
|
|
8117
|
-
batch.rows.forEach((row, index) => {
|
|
8118
|
-
if (importRowLabels(row, batch.labels).length > CONTACT_LABELS_MAX) {
|
|
8119
|
-
ctx.addIssue({
|
|
8120
|
-
code: external_exports.ZodIssueCode.custom,
|
|
8121
|
-
path: ["rows", index, "labels"],
|
|
8122
|
-
message: `A contact holds at most ${CONTACT_LABELS_MAX} labels, the batch's included`
|
|
8123
|
-
});
|
|
8124
|
-
}
|
|
8125
|
-
});
|
|
8126
|
-
});
|
|
8127
|
-
linkContactBookContactBody = external_exports.object({
|
|
8128
|
-
user_id: external_exports.string().min(1).max(128)
|
|
8129
|
-
}).strict();
|
|
8130
|
-
listName = external_exports.string().trim().min(1).max(CONTACT_LIST_NAME_MAX).regex(CONTACT_LIST_NAME_REGEX, {
|
|
8131
|
-
message: 'Must be lowercase alphanumeric with hyphens (e.g. "vip-customers")'
|
|
8132
|
-
});
|
|
8133
|
-
contactListFilterSchema = external_exports.object({
|
|
8134
|
-
labels: external_exports.array(contactLabel).max(CONTACT_LIST_FILTER_MAX).transform((l) => [...new Set(l)]).default([]),
|
|
8135
|
-
scope_tag_ids: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_FILTER_MAX).transform((t) => [...new Set(t)]).default([])
|
|
8136
|
-
}).strict();
|
|
8137
|
-
createContactBookListBody = external_exports.object({
|
|
8138
|
-
organization_id: external_exports.string().uuid(),
|
|
8139
|
-
name: listName,
|
|
8140
|
-
description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullish(),
|
|
8141
|
-
filter: contactListFilterSchema.optional()
|
|
8142
|
-
}).strict();
|
|
8143
|
-
updateContactBookListBody = external_exports.object({
|
|
8144
|
-
name: listName.optional(),
|
|
8145
|
-
description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullable().optional(),
|
|
8146
|
-
filter: contactListFilterSchema.optional()
|
|
8147
|
-
}).strict();
|
|
8148
|
-
updateContactBookListPinsBody = external_exports.object({
|
|
8149
|
-
add: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([]),
|
|
8150
|
-
remove: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([])
|
|
8151
|
-
}).strict().refine((b) => b.add.length + b.remove.length > 0, "Add or remove at least one contact");
|
|
8152
|
-
suppressionIdentitySchema = external_exports.discriminatedUnion("kind", [
|
|
8153
|
-
external_exports.object({ kind: external_exports.literal("phone"), value: contactPhone }).strict(),
|
|
8154
|
-
external_exports.object({ kind: external_exports.literal("email"), value: contactEmail }).strict(),
|
|
8155
|
-
external_exports.object({ kind: external_exports.literal("instagram"), value: contactInstagramSid }).strict()
|
|
8156
|
-
]);
|
|
8157
|
-
createContactBookSuppressionBody = external_exports.object({
|
|
8158
|
-
organization_id: external_exports.string().uuid(),
|
|
8159
|
-
identity: suppressionIdentitySchema,
|
|
8160
|
-
scope: external_exports.enum(SUPPRESSION_SCOPES)
|
|
8161
|
-
}).strict();
|
|
8162
|
-
contactBookSuppressionParam = external_exports.object({
|
|
8163
|
-
suppressionId: external_exports.string().regex(SUPPRESSION_ID_REGEX)
|
|
8164
|
-
});
|
|
8165
|
-
listContactBookSuppressionsQuery = contactBookOrgQuery.merge(contactBookPageQuery);
|
|
8166
|
-
contactBookEmailUnsubscribeTokenSchema = external_exports.string().max(200).regex(/^[0-9a-f-]{36}\.[0-9a-f]{64}\.[0-9a-f]{64}$/i);
|
|
8167
|
-
contactBookEmailUnsubscribeQuery = external_exports.object({ token: contactBookEmailUnsubscribeTokenSchema });
|
|
8168
|
-
orgListReferenceSchema = listName;
|
|
8169
|
-
}
|
|
8170
|
-
});
|
|
8171
|
-
|
|
8172
|
-
// ../../packages/core/dist/chunk-MGBAXT5Y.js
|
|
8173
|
-
var PERSON_LINKS_MAX, PERSON_DENY_PAGE_MAX, personParam, personLinkParam, deniedPersonParam, listDeniedPersonsQuery, conversationCustomerPersonParam;
|
|
8174
|
-
var init_chunk_MGBAXT5Y = __esm({
|
|
8175
|
-
"../../packages/core/dist/chunk-MGBAXT5Y.js"() {
|
|
8176
|
-
"use strict";
|
|
8177
|
-
init_chunk_2YEGUQR7();
|
|
8178
|
-
init_chunk_UAOHHCW5();
|
|
8179
|
-
init_zod();
|
|
8180
|
-
PERSON_LINKS_MAX = 15;
|
|
8181
|
-
PERSON_DENY_PAGE_MAX = 100;
|
|
8182
|
-
personParam = external_exports.object({
|
|
8183
|
-
personId: userPersonIdSchema
|
|
8184
|
-
});
|
|
8185
|
-
personLinkParam = personParam.extend({
|
|
8186
|
-
targetId: personIdSchema
|
|
8187
|
-
});
|
|
8188
|
-
deniedPersonParam = external_exports.object({
|
|
8189
|
-
personId: personIdSchema
|
|
8190
|
-
});
|
|
8191
|
-
listDeniedPersonsQuery = contactBookOrgQuery.extend({
|
|
8192
|
-
cursor: personIdSchema.optional(),
|
|
8193
|
-
limit: external_exports.coerce.number().int().min(1).max(PERSON_DENY_PAGE_MAX).default(50)
|
|
8194
|
-
});
|
|
8195
|
-
conversationCustomerPersonParam = external_exports.object({
|
|
8196
|
-
hubId: external_exports.string().uuid(),
|
|
8197
|
-
conversationId: external_exports.string().uuid()
|
|
8198
|
-
});
|
|
8199
|
-
}
|
|
8200
|
-
});
|
|
8201
|
-
|
|
8202
8240
|
// ../../packages/core/dist/chunk-YUZFHVB2.js
|
|
8203
8241
|
var invitePreviewQuery, inviteRolePreviewResponse, inviteContactPreviewResponse, invitePreviewResponse, inviteUnsubscribeBody;
|
|
8204
8242
|
var init_chunk_YUZFHVB2 = __esm({
|
|
@@ -8645,41 +8683,18 @@ var init_chunk_34LE6P7E = __esm({
|
|
|
8645
8683
|
}
|
|
8646
8684
|
});
|
|
8647
8685
|
|
|
8648
|
-
// ../../packages/core/dist/chunk-
|
|
8649
|
-
var
|
|
8650
|
-
var
|
|
8651
|
-
"../../packages/core/dist/chunk-
|
|
8686
|
+
// ../../packages/core/dist/chunk-IR2NOSI3.js
|
|
8687
|
+
var adminSetGuideHubBody, GUIDE_HUB_INELIGIBLE_REASON;
|
|
8688
|
+
var init_chunk_IR2NOSI3 = __esm({
|
|
8689
|
+
"../../packages/core/dist/chunk-IR2NOSI3.js"() {
|
|
8652
8690
|
"use strict";
|
|
8691
|
+
init_chunk_HZ6CADSY();
|
|
8653
8692
|
init_zod();
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
createNoticeBody = external_exports.object({
|
|
8660
|
-
severity: noticeSeveritySchema.default("info"),
|
|
8661
|
-
scope: noticeScopeSchema.default("global"),
|
|
8662
|
-
title: external_exports.string().trim().min(1).max(200),
|
|
8663
|
-
body: external_exports.string().max(2e3).optional(),
|
|
8664
|
-
link: noticeLinkSchema.optional(),
|
|
8665
|
-
starts_at: external_exports.string().datetime().optional(),
|
|
8666
|
-
ends_at: external_exports.string().datetime().optional()
|
|
8667
|
-
});
|
|
8668
|
-
updateNoticeBody = external_exports.object({
|
|
8669
|
-
severity: noticeSeveritySchema.optional(),
|
|
8670
|
-
scope: noticeScopeSchema.optional(),
|
|
8671
|
-
title: external_exports.string().trim().min(1).max(200).optional(),
|
|
8672
|
-
body: external_exports.string().max(2e3).nullable().optional(),
|
|
8673
|
-
link: noticeLinkSchema.nullable().optional(),
|
|
8674
|
-
starts_at: external_exports.string().datetime().optional(),
|
|
8675
|
-
ends_at: external_exports.string().datetime().nullable().optional()
|
|
8676
|
-
}).refine((b) => Object.keys(b).length > 0, { message: "at least one field must be provided" });
|
|
8677
|
-
listNoticesQuery = external_exports.object({
|
|
8678
|
-
status: noticeStatusSchema.optional(),
|
|
8679
|
-
limit: external_exports.coerce.number().int().min(1).max(200).optional(),
|
|
8680
|
-
offset: external_exports.coerce.number().int().min(0).optional()
|
|
8681
|
-
});
|
|
8682
|
-
noticeIdParamSchema = external_exports.object({ id: external_exports.string().min(1) });
|
|
8693
|
+
adminSetGuideHubBody = external_exports.object({
|
|
8694
|
+
hub_id: uuidSchema,
|
|
8695
|
+
dry_run: external_exports.boolean().optional()
|
|
8696
|
+
}).strict();
|
|
8697
|
+
GUIDE_HUB_INELIGIBLE_REASON = "guide_hub_ineligible";
|
|
8683
8698
|
}
|
|
8684
8699
|
});
|
|
8685
8700
|
|
|
@@ -9146,6 +9161,29 @@ var init_chunk_2ZZZHXZR = __esm({
|
|
|
9146
9161
|
}
|
|
9147
9162
|
});
|
|
9148
9163
|
|
|
9164
|
+
// ../../packages/core/dist/chunk-MH4O3YEX.js
|
|
9165
|
+
var stateOperationBody;
|
|
9166
|
+
var init_chunk_MH4O3YEX = __esm({
|
|
9167
|
+
"../../packages/core/dist/chunk-MH4O3YEX.js"() {
|
|
9168
|
+
"use strict";
|
|
9169
|
+
init_chunk_6TSQ5HXC();
|
|
9170
|
+
init_zod();
|
|
9171
|
+
stateOperationBody = external_exports.object({
|
|
9172
|
+
hub_id: external_exports.string().uuid(),
|
|
9173
|
+
operation: external_exports.enum(["get", "update", "set_path", "reset"]),
|
|
9174
|
+
state_slug: slugSchema,
|
|
9175
|
+
/**
|
|
9176
|
+
* Deprecated and ignored. Scope is derived from the hub's state definition.
|
|
9177
|
+
* Kept on the schema so legacy bodies still validate.
|
|
9178
|
+
*/
|
|
9179
|
+
state_scope: external_exports.enum(["conversation", "user"]).optional(),
|
|
9180
|
+
updates: external_exports.record(external_exports.unknown()).optional(),
|
|
9181
|
+
path: external_exports.array(external_exports.string()).optional(),
|
|
9182
|
+
value: external_exports.unknown().optional()
|
|
9183
|
+
});
|
|
9184
|
+
}
|
|
9185
|
+
});
|
|
9186
|
+
|
|
9149
9187
|
// ../../packages/core/dist/chunk-IBL7FANV.js
|
|
9150
9188
|
var SUMMARIZATION_THRESHOLD_MIN, SUMMARIZATION_THRESHOLD_MAX;
|
|
9151
9189
|
var init_chunk_IBL7FANV = __esm({
|
|
@@ -12731,21 +12769,6 @@ var init_chunk_C4HEZ7ZI = __esm({
|
|
|
12731
12769
|
}
|
|
12732
12770
|
});
|
|
12733
12771
|
|
|
12734
|
-
// ../../packages/core/dist/chunk-IR2NOSI3.js
|
|
12735
|
-
var adminSetGuideHubBody, GUIDE_HUB_INELIGIBLE_REASON;
|
|
12736
|
-
var init_chunk_IR2NOSI3 = __esm({
|
|
12737
|
-
"../../packages/core/dist/chunk-IR2NOSI3.js"() {
|
|
12738
|
-
"use strict";
|
|
12739
|
-
init_chunk_HZ6CADSY();
|
|
12740
|
-
init_zod();
|
|
12741
|
-
adminSetGuideHubBody = external_exports.object({
|
|
12742
|
-
hub_id: uuidSchema,
|
|
12743
|
-
dry_run: external_exports.boolean().optional()
|
|
12744
|
-
}).strict();
|
|
12745
|
-
GUIDE_HUB_INELIGIBLE_REASON = "guide_hub_ineligible";
|
|
12746
|
-
}
|
|
12747
|
-
});
|
|
12748
|
-
|
|
12749
12772
|
// ../../packages/core/dist/chunk-YULHXJ5M.js
|
|
12750
12773
|
var COMMUNITY_LESSON_TREE_MAX_BYTES, COMMUNITY_LESSON_LINK_PROTOCOLS, COMMUNITY_LESSON_TREE_TOO_LARGE_REASON, COMMUNITY_LESSON_TREE_TOO_DEEP_REASON, COMMUNITY_LESSON_LINE_PREFIX_TOO_WIDE_REASON, LINK_SCHEME;
|
|
12751
12774
|
var init_chunk_YULHXJ5M = __esm({
|
|
@@ -12849,29 +12872,6 @@ var init_chunk_ACGAI25T = __esm({
|
|
|
12849
12872
|
}
|
|
12850
12873
|
});
|
|
12851
12874
|
|
|
12852
|
-
// ../../packages/core/dist/chunk-MH4O3YEX.js
|
|
12853
|
-
var stateOperationBody;
|
|
12854
|
-
var init_chunk_MH4O3YEX = __esm({
|
|
12855
|
-
"../../packages/core/dist/chunk-MH4O3YEX.js"() {
|
|
12856
|
-
"use strict";
|
|
12857
|
-
init_chunk_6TSQ5HXC();
|
|
12858
|
-
init_zod();
|
|
12859
|
-
stateOperationBody = external_exports.object({
|
|
12860
|
-
hub_id: external_exports.string().uuid(),
|
|
12861
|
-
operation: external_exports.enum(["get", "update", "set_path", "reset"]),
|
|
12862
|
-
state_slug: slugSchema,
|
|
12863
|
-
/**
|
|
12864
|
-
* Deprecated and ignored. Scope is derived from the hub's state definition.
|
|
12865
|
-
* Kept on the schema so legacy bodies still validate.
|
|
12866
|
-
*/
|
|
12867
|
-
state_scope: external_exports.enum(["conversation", "user"]).optional(),
|
|
12868
|
-
updates: external_exports.record(external_exports.unknown()).optional(),
|
|
12869
|
-
path: external_exports.array(external_exports.string()).optional(),
|
|
12870
|
-
value: external_exports.unknown().optional()
|
|
12871
|
-
});
|
|
12872
|
-
}
|
|
12873
|
-
});
|
|
12874
|
-
|
|
12875
12875
|
// ../../packages/core/dist/chunk-5Y2NNQHX.js
|
|
12876
12876
|
var CASE_SUBMISSION_ISSUED_KINDS, CASE_SUBMISSION_RENDER_STUCK_MS, CASE_SUBMISSION_MARK_ID_PATTERN, CASE_CORRECTION_REASON_MAX_LENGTH, submitCaseBody, correctCaseSubmissionBody, caseDeliveryQuery;
|
|
12877
12877
|
var init_chunk_5Y2NNQHX = __esm({
|
|
@@ -13802,6 +13802,57 @@ var init_chunk_LBDH7LCG = __esm({
|
|
|
13802
13802
|
}
|
|
13803
13803
|
});
|
|
13804
13804
|
|
|
13805
|
+
// ../../packages/core/dist/chunk-D3EP4TDU.js
|
|
13806
|
+
var primaryRegionSchema, placementSourceSchema, orgIdParam, orgAdminIdParam, createOrganizationBody, updateOrganizationBody, addOrgAdminBody;
|
|
13807
|
+
var init_chunk_D3EP4TDU = __esm({
|
|
13808
|
+
"../../packages/core/dist/chunk-D3EP4TDU.js"() {
|
|
13809
|
+
"use strict";
|
|
13810
|
+
init_chunk_HZ6CADSY();
|
|
13811
|
+
init_zod();
|
|
13812
|
+
primaryRegionSchema = external_exports.enum([
|
|
13813
|
+
"wnam",
|
|
13814
|
+
"enam",
|
|
13815
|
+
"sam",
|
|
13816
|
+
"weur",
|
|
13817
|
+
"eeur",
|
|
13818
|
+
"apac",
|
|
13819
|
+
"oc",
|
|
13820
|
+
"afr",
|
|
13821
|
+
"me"
|
|
13822
|
+
]);
|
|
13823
|
+
placementSourceSchema = external_exports.enum([
|
|
13824
|
+
"hub_config",
|
|
13825
|
+
"org_config",
|
|
13826
|
+
"parent_cascade",
|
|
13827
|
+
"cf_colo",
|
|
13828
|
+
"country",
|
|
13829
|
+
"fallback",
|
|
13830
|
+
"unpinned"
|
|
13831
|
+
]);
|
|
13832
|
+
orgIdParam = external_exports.object({
|
|
13833
|
+
id: uuidSchema
|
|
13834
|
+
});
|
|
13835
|
+
orgAdminIdParam = external_exports.object({
|
|
13836
|
+
id: uuidSchema,
|
|
13837
|
+
adminId: external_exports.string().min(1)
|
|
13838
|
+
});
|
|
13839
|
+
createOrganizationBody = external_exports.object({
|
|
13840
|
+
organization_name: external_exports.string().min(1, "organization_name is required"),
|
|
13841
|
+
// Write-once at creation; updateOrganizationBody does not accept this.
|
|
13842
|
+
primary_region: primaryRegionSchema.optional()
|
|
13843
|
+
});
|
|
13844
|
+
updateOrganizationBody = external_exports.object({
|
|
13845
|
+
organization_name: external_exports.string().min(1).optional(),
|
|
13846
|
+
organization_avatar_url: external_exports.string().url().nullable().optional(),
|
|
13847
|
+
timezone: external_exports.string().optional(),
|
|
13848
|
+
business_hours: external_exports.unknown().optional()
|
|
13849
|
+
}).passthrough();
|
|
13850
|
+
addOrgAdminBody = external_exports.object({
|
|
13851
|
+
user_email: external_exports.string().email("valid email is required")
|
|
13852
|
+
});
|
|
13853
|
+
}
|
|
13854
|
+
});
|
|
13855
|
+
|
|
13805
13856
|
// ../../packages/core/dist/chunk-X5PZZVTS.js
|
|
13806
13857
|
function isEventRelativeFollowupType(type) {
|
|
13807
13858
|
return typeof type === "string" && EVENT_RELATIVE_FOLLOWUP_TYPES.includes(type);
|
|
@@ -14200,57 +14251,6 @@ var init_chunk_X5PZZVTS = __esm({
|
|
|
14200
14251
|
}
|
|
14201
14252
|
});
|
|
14202
14253
|
|
|
14203
|
-
// ../../packages/core/dist/chunk-D3EP4TDU.js
|
|
14204
|
-
var primaryRegionSchema, placementSourceSchema, orgIdParam, orgAdminIdParam, createOrganizationBody, updateOrganizationBody, addOrgAdminBody;
|
|
14205
|
-
var init_chunk_D3EP4TDU = __esm({
|
|
14206
|
-
"../../packages/core/dist/chunk-D3EP4TDU.js"() {
|
|
14207
|
-
"use strict";
|
|
14208
|
-
init_chunk_HZ6CADSY();
|
|
14209
|
-
init_zod();
|
|
14210
|
-
primaryRegionSchema = external_exports.enum([
|
|
14211
|
-
"wnam",
|
|
14212
|
-
"enam",
|
|
14213
|
-
"sam",
|
|
14214
|
-
"weur",
|
|
14215
|
-
"eeur",
|
|
14216
|
-
"apac",
|
|
14217
|
-
"oc",
|
|
14218
|
-
"afr",
|
|
14219
|
-
"me"
|
|
14220
|
-
]);
|
|
14221
|
-
placementSourceSchema = external_exports.enum([
|
|
14222
|
-
"hub_config",
|
|
14223
|
-
"org_config",
|
|
14224
|
-
"parent_cascade",
|
|
14225
|
-
"cf_colo",
|
|
14226
|
-
"country",
|
|
14227
|
-
"fallback",
|
|
14228
|
-
"unpinned"
|
|
14229
|
-
]);
|
|
14230
|
-
orgIdParam = external_exports.object({
|
|
14231
|
-
id: uuidSchema
|
|
14232
|
-
});
|
|
14233
|
-
orgAdminIdParam = external_exports.object({
|
|
14234
|
-
id: uuidSchema,
|
|
14235
|
-
adminId: external_exports.string().min(1)
|
|
14236
|
-
});
|
|
14237
|
-
createOrganizationBody = external_exports.object({
|
|
14238
|
-
organization_name: external_exports.string().min(1, "organization_name is required"),
|
|
14239
|
-
// Write-once at creation; updateOrganizationBody does not accept this.
|
|
14240
|
-
primary_region: primaryRegionSchema.optional()
|
|
14241
|
-
});
|
|
14242
|
-
updateOrganizationBody = external_exports.object({
|
|
14243
|
-
organization_name: external_exports.string().min(1).optional(),
|
|
14244
|
-
organization_avatar_url: external_exports.string().url().nullable().optional(),
|
|
14245
|
-
timezone: external_exports.string().optional(),
|
|
14246
|
-
business_hours: external_exports.unknown().optional()
|
|
14247
|
-
}).passthrough();
|
|
14248
|
-
addOrgAdminBody = external_exports.object({
|
|
14249
|
-
user_email: external_exports.string().email("valid email is required")
|
|
14250
|
-
});
|
|
14251
|
-
}
|
|
14252
|
-
});
|
|
14253
|
-
|
|
14254
14254
|
// ../../packages/core/dist/chunk-PIZTARVG.js
|
|
14255
14255
|
function byLocale(entry) {
|
|
14256
14256
|
const shape = Object.fromEntries(SUPPORTED_LOCALES.map((locale) => [locale, entry.optional()]));
|
|
@@ -14289,7 +14289,7 @@ var init_chunk_PIZTARVG = __esm({
|
|
|
14289
14289
|
}
|
|
14290
14290
|
});
|
|
14291
14291
|
|
|
14292
|
-
// ../../packages/core/dist/chunk-
|
|
14292
|
+
// ../../packages/core/dist/chunk-ARK3766Q.js
|
|
14293
14293
|
function refineLaneReferences(val, ctx) {
|
|
14294
14294
|
const lanes = val.lanes;
|
|
14295
14295
|
const statuses = val.kanban_statuses;
|
|
@@ -14313,11 +14313,11 @@ function describeSyncWarning(warning) {
|
|
|
14313
14313
|
return `${label3}: ${parts.join("; ")}. Promote the base so production's tools match the preview's.`;
|
|
14314
14314
|
}
|
|
14315
14315
|
var hubIdParam, hubAdminIdParam, hubUserIdParam, hubAgentIdParam, hubIdentityIdParam, hubTeamIdParam, hubTeamUserDeleteParam, hubSchemaQuery, HUB_USERS_PAGE_SIZE_MAX, HUB_USERS_SEARCH_MAX, HUB_USERS_CHANNEL_TYPES, getHubUsersQuery, PREVIEW_LABEL_MAX_LENGTH, MAX_ENDED_INDEX_RETENTION_DAYS, MAX_EVAL_RETENTION_DAYS, MAX_END_USER_DAILY_MESSAGE_LIMIT, endUserDailyMessageLimitField, previewLabelField, hubTagsField, createHubBody, updateHubBody, HUB_TAG_CHANGE_REFUSED, hubTagChangeRefusalSchema, addHubAdminBody, addHubIdentityAuthorizationBody, contactDecisionBody, approveContactBody, CONTACT_ACCESS_PAGE_SIZE_MAX, listContactAccessQuery, createHubTeamBody, updateHubTeamBody, addHubTeamUserBody, reassignHubUserBody, replicatePreviewBody, HUB_DIFF_SECTION_SET, HUB_DIFF_SECTIONS, updateChannelTestIdentitiesBody, claimCodeChannelParam, claimCodeDeleteParam;
|
|
14316
|
-
var
|
|
14317
|
-
"../../packages/core/dist/chunk-
|
|
14316
|
+
var init_chunk_ARK3766Q = __esm({
|
|
14317
|
+
"../../packages/core/dist/chunk-ARK3766Q.js"() {
|
|
14318
14318
|
"use strict";
|
|
14319
|
-
init_chunk_X5PZZVTS();
|
|
14320
14319
|
init_chunk_D3EP4TDU();
|
|
14320
|
+
init_chunk_X5PZZVTS();
|
|
14321
14321
|
init_chunk_PIZTARVG();
|
|
14322
14322
|
init_chunk_HZ6CADSY();
|
|
14323
14323
|
init_zod();
|
|
@@ -14513,7 +14513,7 @@ var init_chunk_7NFNYPTF = __esm({
|
|
|
14513
14513
|
}
|
|
14514
14514
|
});
|
|
14515
14515
|
|
|
14516
|
-
// ../../packages/core/dist/chunk-
|
|
14516
|
+
// ../../packages/core/dist/chunk-LZHLURLT.js
|
|
14517
14517
|
function declaresNoConnection(agent) {
|
|
14518
14518
|
return agent.connection === null && !agent.connection_id;
|
|
14519
14519
|
}
|
|
@@ -15245,8 +15245,8 @@ function skillSectionsAsResources(scope) {
|
|
|
15245
15245
|
};
|
|
15246
15246
|
}
|
|
15247
15247
|
var MAX_10MB_BASE64_ENCODED_BYTES, MAX_EVAL_ATTACHMENT_ENCODED_BYTES, MAX_EVAL_ATTACHMENT_CARRIERS, MAX_EVAL_ATTACHMENT_AGGREGATE_ENCODED_BYTES, MAX_RESOURCE_ENCODED_BYTES, MAX_HUB_AS_CODE_RESOURCES, MAX_HUB_AS_CODE_RESOURCE_FILES, MAX_RESOURCE_AGGREGATE_ENCODED_BYTES, MAX_CI_CONFIG_BODY_BYTES, MAX_HUB_AS_CODE_PAGE_MANIFEST_CHARS, hubAsCodePagesSchema, MAX_CALL_OPENING_CARRIERS, MAX_CALL_OPENING_AGGREGATE_ENCODED_BYTES, HUB_AS_CODE_AGENT_TOOL_KEYS, hubAsCodeStateSchema, hubAsCodeResourceFileSchema, hubAsCodeResourceSchema, uuidPattern, ciUuidSchema, flagEntriesOf, boundedHubAsCodeResourcesSchema, isPlainObject, MIN_SKILLS_LAYOUT_CLI, MAX_HUB_AS_CODE_DEPTH, NAMED_DEPTH_SEGMENTS, NAMED_DEPTH_KEY_CHARS, fieldName, hubAsCodeConfigSchema, ciPullHubIdParam, ciBranchParam, ciPullQuery, ciHubsQuery, ciLookupQuery, ciBranchesQuery, ciSyncBody, ciPushBody, ciDiffBody, ciPublishBody, ciPublishPreviewBody, ciSyncMcpBody, ciOrgResourcesParam, orgResourcesConfigSchema, ciOrgResourcesPushBody, ciOrgResourcesDiffBody, CI_APPLY_ENTITY_KINDS, CI_APPLY_OPERATIONS, ciApplyErrorBaseSchema, ciApplyErrorSchema, ciSyncCountSchema, ciSyncChangesSchema, ciSyncWarningSchema, ciSyncResponseSchema;
|
|
15248
|
-
var
|
|
15249
|
-
"../../packages/core/dist/chunk-
|
|
15248
|
+
var init_chunk_LZHLURLT = __esm({
|
|
15249
|
+
"../../packages/core/dist/chunk-LZHLURLT.js"() {
|
|
15250
15250
|
"use strict";
|
|
15251
15251
|
init_chunk_QG3XMUEN();
|
|
15252
15252
|
init_chunk_EBUWHIFV();
|
|
@@ -15254,7 +15254,7 @@ var init_chunk_W3WJCAUF = __esm({
|
|
|
15254
15254
|
init_chunk_QMQGGR7Q();
|
|
15255
15255
|
init_chunk_LBDH7LCG();
|
|
15256
15256
|
init_chunk_4LXDRTO4();
|
|
15257
|
-
|
|
15257
|
+
init_chunk_ARK3766Q();
|
|
15258
15258
|
init_chunk_X5PZZVTS();
|
|
15259
15259
|
init_chunk_PIZTARVG();
|
|
15260
15260
|
init_chunk_S4VDZ7PZ();
|
|
@@ -16014,11 +16014,11 @@ function cycleIn(nodes, edges) {
|
|
|
16014
16014
|
function fixedTextProblem(text5) {
|
|
16015
16015
|
if (text5.includes("<!--")) return "item_fixed_text_comment";
|
|
16016
16016
|
if (/\{\{\s*fill\s*:/.test(text5)) return "item_fixed_text_fill";
|
|
16017
|
-
const
|
|
16017
|
+
const lines2 = text5.replace(/\r\n?/g, "\n").split("\n");
|
|
16018
16018
|
let fence = null;
|
|
16019
16019
|
let closedAt = -1;
|
|
16020
|
-
for (let i = 0; i <
|
|
16021
|
-
const line =
|
|
16020
|
+
for (let i = 0; i < lines2.length; i++) {
|
|
16021
|
+
const line = lines2[i];
|
|
16022
16022
|
const mark = /^ {0,3}(`{3,}|~{3,})/.exec(line)?.[1];
|
|
16023
16023
|
if (fence !== null) {
|
|
16024
16024
|
if (mark && mark[0] === fence[0] && mark.length >= fence.length && line.trim() === mark) {
|
|
@@ -16031,7 +16031,7 @@ function fixedTextProblem(text5) {
|
|
|
16031
16031
|
fence = mark;
|
|
16032
16032
|
continue;
|
|
16033
16033
|
}
|
|
16034
|
-
const setext = i > 0 && /^ {0,3}(=+|-+)[ \t]*$/.test(line) &&
|
|
16034
|
+
const setext = i > 0 && /^ {0,3}(=+|-+)[ \t]*$/.test(line) && lines2[i - 1].trim() !== "" && closedAt !== i - 1 && (i === 1 || lines2[i - 2].trim() === "");
|
|
16035
16035
|
if (/^ {0,3}#{1,6}([ \t]|$)/.test(line) || setext) return "item_fixed_text_heading";
|
|
16036
16036
|
}
|
|
16037
16037
|
return null;
|
|
@@ -16496,10 +16496,10 @@ var init_chunk_2YVCHUBL = __esm({
|
|
|
16496
16496
|
}
|
|
16497
16497
|
});
|
|
16498
16498
|
|
|
16499
|
-
// ../../packages/core/dist/chunk-
|
|
16499
|
+
// ../../packages/core/dist/chunk-NMGRRGDR.js
|
|
16500
16500
|
var casePhaseParam;
|
|
16501
|
-
var
|
|
16502
|
-
"../../packages/core/dist/chunk-
|
|
16501
|
+
var init_chunk_NMGRRGDR = __esm({
|
|
16502
|
+
"../../packages/core/dist/chunk-NMGRRGDR.js"() {
|
|
16503
16503
|
"use strict";
|
|
16504
16504
|
init_chunk_733K4J4G();
|
|
16505
16505
|
init_chunk_HZ6CADSY();
|
|
@@ -16507,10 +16507,10 @@ var init_chunk_RRU36I2I = __esm({
|
|
|
16507
16507
|
}
|
|
16508
16508
|
});
|
|
16509
16509
|
|
|
16510
|
-
// ../../packages/core/dist/chunk-
|
|
16510
|
+
// ../../packages/core/dist/chunk-XPOCPOMA.js
|
|
16511
16511
|
var CASE_CHECK_CSV_MAX_BYTES, CASE_DECISIONS_CSV_PATH, CASE_CONFIDENTIAL_DECISIONS_CSV_PATH, caseChecksQuery;
|
|
16512
|
-
var
|
|
16513
|
-
"../../packages/core/dist/chunk-
|
|
16512
|
+
var init_chunk_XPOCPOMA = __esm({
|
|
16513
|
+
"../../packages/core/dist/chunk-XPOCPOMA.js"() {
|
|
16514
16514
|
"use strict";
|
|
16515
16515
|
init_chunk_5Y2NNQHX();
|
|
16516
16516
|
init_chunk_HZ6CADSY();
|
|
@@ -16524,14 +16524,14 @@ var init_chunk_RHXF6X2Y = __esm({
|
|
|
16524
16524
|
}
|
|
16525
16525
|
});
|
|
16526
16526
|
|
|
16527
|
-
// ../../packages/core/dist/chunk-
|
|
16527
|
+
// ../../packages/core/dist/chunk-6MNNZ3G4.js
|
|
16528
16528
|
var CASE_REVIEW_DECISIONS, CASE_ISSUED_FORMATS, CASE_REVIEW_COMMENT_MAX_LENGTH, CASE_REVIEW_JUSTIFICATION_MAX_LENGTH, text2, caseSubmissionParam, decideCaseSubmissionBody, caseIssuedQuery, CASE_APPROVALS_STATES, caseApprovalsQuery, caseCompareDefaultQuery, caseApprovalsAgendaQuery;
|
|
16529
|
-
var
|
|
16530
|
-
"../../packages/core/dist/chunk-
|
|
16529
|
+
var init_chunk_6MNNZ3G4 = __esm({
|
|
16530
|
+
"../../packages/core/dist/chunk-6MNNZ3G4.js"() {
|
|
16531
16531
|
"use strict";
|
|
16532
16532
|
init_chunk_2YVCHUBL();
|
|
16533
|
-
|
|
16534
|
-
|
|
16533
|
+
init_chunk_NMGRRGDR();
|
|
16534
|
+
init_chunk_XPOCPOMA();
|
|
16535
16535
|
init_chunk_5Y2NNQHX();
|
|
16536
16536
|
init_chunk_VROZDNLV();
|
|
16537
16537
|
init_chunk_733K4J4G();
|
|
@@ -16608,6 +16608,25 @@ var init_chunk_M2IF4G6X = __esm({
|
|
|
16608
16608
|
}
|
|
16609
16609
|
});
|
|
16610
16610
|
|
|
16611
|
+
// ../../packages/core/dist/chunk-UOPCLXCU.js
|
|
16612
|
+
var CASE_CHANGE_TOPICS, caseChangedFrameSchema;
|
|
16613
|
+
var init_chunk_UOPCLXCU = __esm({
|
|
16614
|
+
"../../packages/core/dist/chunk-UOPCLXCU.js"() {
|
|
16615
|
+
"use strict";
|
|
16616
|
+
init_chunk_733K4J4G();
|
|
16617
|
+
init_chunk_HZ6CADSY();
|
|
16618
|
+
init_zod();
|
|
16619
|
+
CASE_CHANGE_TOPICS = ["submission", "agenda", "access"];
|
|
16620
|
+
caseChangedFrameSchema = external_exports.object({
|
|
16621
|
+
org_id: uuidSchema,
|
|
16622
|
+
space_id: uuidSchema,
|
|
16623
|
+
/** The case, by its code; null for an `access` change, which names none. */
|
|
16624
|
+
code: caseRecordParam.shape.code.nullable(),
|
|
16625
|
+
topic: external_exports.enum(CASE_CHANGE_TOPICS)
|
|
16626
|
+
}).strict();
|
|
16627
|
+
}
|
|
16628
|
+
});
|
|
16629
|
+
|
|
16611
16630
|
// ../../packages/core/dist/chunk-7CZSLDOE.js
|
|
16612
16631
|
var CASE_MEMBER_CASES_PAGE_MAX, caseMemberReachQuery;
|
|
16613
16632
|
var init_chunk_7CZSLDOE = __esm({
|
|
@@ -17048,6 +17067,156 @@ var init_chunk_ZVIMTUGZ = __esm({
|
|
|
17048
17067
|
}
|
|
17049
17068
|
});
|
|
17050
17069
|
|
|
17070
|
+
// ../../packages/core/dist/chunk-7TQYAKCB.js
|
|
17071
|
+
function addCaseNoteProblem(note) {
|
|
17072
|
+
return note.origin !== null && note.kind !== "contribution" ? { reason: "origin_not_contribution", at: "origin" } : null;
|
|
17073
|
+
}
|
|
17074
|
+
var CASE_NOTE_KINDS, CASE_NOTE_TEXT_MAX_LENGTH, CASE_NOTE_ORIGIN_MAX_LENGTH, CASE_NOTES_PAGE_MAX, addCaseNoteShape, addCaseNoteBody, caseNoteParam, caseTaskParam, caseNotesQuery;
|
|
17075
|
+
var init_chunk_7TQYAKCB = __esm({
|
|
17076
|
+
"../../packages/core/dist/chunk-7TQYAKCB.js"() {
|
|
17077
|
+
"use strict";
|
|
17078
|
+
init_chunk_733K4J4G();
|
|
17079
|
+
init_chunk_3T3D7LTE();
|
|
17080
|
+
init_chunk_HZ6CADSY();
|
|
17081
|
+
init_zod();
|
|
17082
|
+
CASE_NOTE_KINDS = ["observation", "next_step", "pending", "contribution"];
|
|
17083
|
+
CASE_NOTE_TEXT_MAX_LENGTH = 64 * 1024;
|
|
17084
|
+
CASE_NOTE_ORIGIN_MAX_LENGTH = 200;
|
|
17085
|
+
CASE_NOTES_PAGE_MAX = 100;
|
|
17086
|
+
addCaseNoteShape = external_exports.object({
|
|
17087
|
+
kind: external_exports.enum(CASE_NOTE_KINDS),
|
|
17088
|
+
text: external_exports.string().trim().min(1).max(CASE_NOTE_TEXT_MAX_LENGTH),
|
|
17089
|
+
/** A contribution's external author. */
|
|
17090
|
+
origin: external_exports.string().trim().min(1).max(CASE_NOTE_ORIGIN_MAX_LENGTH).nullable().default(null),
|
|
17091
|
+
/** A phase of the case (its version's phase id). */
|
|
17092
|
+
phase_id: uuidSchema.nullable().default(null),
|
|
17093
|
+
/** A task of the case, whose phase the note takes. */
|
|
17094
|
+
case_task_id: uuidSchema.nullable().default(null)
|
|
17095
|
+
}).strict();
|
|
17096
|
+
addCaseNoteBody = addCaseNoteShape.superRefine((note, ctx) => {
|
|
17097
|
+
const found = addCaseNoteProblem(note);
|
|
17098
|
+
if (found) ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: found.reason, path: [found.at], params: { case_note_reason: found.reason } });
|
|
17099
|
+
});
|
|
17100
|
+
caseNoteParam = caseRecordParam.extend({ note_id: uuidSchema });
|
|
17101
|
+
caseTaskParam = caseRecordParam.extend({ case_task_id: uuidSchema });
|
|
17102
|
+
caseNotesQuery = casePageQuery.extend({
|
|
17103
|
+
limit: external_exports.coerce.number().int().min(1).max(CASE_NOTES_PAGE_MAX).optional()
|
|
17104
|
+
});
|
|
17105
|
+
}
|
|
17106
|
+
});
|
|
17107
|
+
|
|
17108
|
+
// ../../packages/core/dist/chunk-S7UAXLHJ.js
|
|
17109
|
+
function casePassageLines(text5) {
|
|
17110
|
+
const lines2 = text5.replace(/\r\n/g, "\n").split("\n");
|
|
17111
|
+
if (lines2.at(-1) === "") lines2.pop();
|
|
17112
|
+
return lines2;
|
|
17113
|
+
}
|
|
17114
|
+
var CASE_COMMENT_TEXT_MAX_LENGTH, CASE_COMMENTS_PAGE_MAX, CASE_COMMENT_LINE_MAX, casePassageLineSchema, lineNumber, addCaseCommentShape, CASE_COMMENT_REVERSED_REASON, addCaseCommentBody, caseCommentsQuery, CASE_COMMENT_OUT_OF_RANGE_REASON;
|
|
17115
|
+
var init_chunk_S7UAXLHJ = __esm({
|
|
17116
|
+
"../../packages/core/dist/chunk-S7UAXLHJ.js"() {
|
|
17117
|
+
"use strict";
|
|
17118
|
+
init_chunk_7TQYAKCB();
|
|
17119
|
+
init_chunk_VROZDNLV();
|
|
17120
|
+
init_chunk_3T3D7LTE();
|
|
17121
|
+
init_chunk_HZ6CADSY();
|
|
17122
|
+
init_zod();
|
|
17123
|
+
CASE_COMMENT_TEXT_MAX_LENGTH = CASE_NOTE_TEXT_MAX_LENGTH;
|
|
17124
|
+
CASE_COMMENTS_PAGE_MAX = 100;
|
|
17125
|
+
CASE_COMMENT_LINE_MAX = CASE_FILE_COMPARE_MAX_BYTES;
|
|
17126
|
+
casePassageLineSchema = external_exports.number().int().min(1).max(CASE_COMMENT_LINE_MAX);
|
|
17127
|
+
lineNumber = casePassageLineSchema;
|
|
17128
|
+
addCaseCommentShape = external_exports.object({
|
|
17129
|
+
path: caseFileReadPath,
|
|
17130
|
+
/** The version: the revision that wrote it to `path`. */
|
|
17131
|
+
revision_id: uuidSchema,
|
|
17132
|
+
/** The passage's first and last lines, from 1, of the version's text ({@link casePassageLines}). */
|
|
17133
|
+
line_start: lineNumber,
|
|
17134
|
+
line_end: lineNumber,
|
|
17135
|
+
text: external_exports.string().trim().min(1).max(CASE_COMMENT_TEXT_MAX_LENGTH),
|
|
17136
|
+
/** Hidden from every reader without the Confidential right; only a holder of it may set it. */
|
|
17137
|
+
confidential: external_exports.boolean().default(false)
|
|
17138
|
+
}).strict();
|
|
17139
|
+
CASE_COMMENT_REVERSED_REASON = "passage_reversed";
|
|
17140
|
+
addCaseCommentBody = addCaseCommentShape.superRefine((comment2, ctx) => {
|
|
17141
|
+
if (comment2.line_end < comment2.line_start) {
|
|
17142
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: CASE_COMMENT_REVERSED_REASON, path: ["line_end"] });
|
|
17143
|
+
}
|
|
17144
|
+
});
|
|
17145
|
+
caseCommentsQuery = casePageQuery.extend({
|
|
17146
|
+
path: caseFileReadPath,
|
|
17147
|
+
/** Absent: every version's comments on the path. */
|
|
17148
|
+
revision_id: uuidSchema.optional(),
|
|
17149
|
+
limit: external_exports.coerce.number().int().min(1).max(CASE_COMMENTS_PAGE_MAX).optional()
|
|
17150
|
+
});
|
|
17151
|
+
CASE_COMMENT_OUT_OF_RANGE_REASON = "passage_out_of_range";
|
|
17152
|
+
}
|
|
17153
|
+
});
|
|
17154
|
+
|
|
17155
|
+
// ../../packages/core/dist/chunk-U3L6QR6F.js
|
|
17156
|
+
var CASE_VERSION_DECISION_REASON_MAX_LENGTH, CASE_VERSION_DECISIONS, caseVersionDecisionReason, reason, lineNumber2, recordCaseReferenceBody, CASE_PASSAGE_REVERSED_REASON, citeCasePassageBody, decideCaseVersionBody, CASE_PASSAGE_LINK_CHANGED_REASON, CASE_PASSAGE_NO_TEXT_REASON, CASE_PASSAGE_OUT_OF_RANGE_REASON;
|
|
17157
|
+
var init_chunk_U3L6QR6F = __esm({
|
|
17158
|
+
"../../packages/core/dist/chunk-U3L6QR6F.js"() {
|
|
17159
|
+
"use strict";
|
|
17160
|
+
init_chunk_S7UAXLHJ();
|
|
17161
|
+
init_chunk_HZ6CADSY();
|
|
17162
|
+
init_zod();
|
|
17163
|
+
CASE_VERSION_DECISION_REASON_MAX_LENGTH = 2e3;
|
|
17164
|
+
CASE_VERSION_DECISIONS = ["adopt", "keep"];
|
|
17165
|
+
caseVersionDecisionReason = external_exports.string().trim().min(1).max(CASE_VERSION_DECISION_REASON_MAX_LENGTH);
|
|
17166
|
+
reason = caseVersionDecisionReason;
|
|
17167
|
+
lineNumber2 = casePassageLineSchema;
|
|
17168
|
+
recordCaseReferenceBody = external_exports.object({
|
|
17169
|
+
document_id: uuidSchema,
|
|
17170
|
+
/** The document's version its writer read as current. */
|
|
17171
|
+
version_id: uuidSchema
|
|
17172
|
+
}).strict();
|
|
17173
|
+
CASE_PASSAGE_REVERSED_REASON = CASE_COMMENT_REVERSED_REASON;
|
|
17174
|
+
citeCasePassageBody = external_exports.object({
|
|
17175
|
+
document_id: uuidSchema,
|
|
17176
|
+
version_id: uuidSchema,
|
|
17177
|
+
line_start: lineNumber2,
|
|
17178
|
+
line_end: lineNumber2
|
|
17179
|
+
}).strict().superRefine((body, ctx) => {
|
|
17180
|
+
if (body.line_end < body.line_start) ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: CASE_PASSAGE_REVERSED_REASON, path: ["line_end"] });
|
|
17181
|
+
});
|
|
17182
|
+
decideCaseVersionBody = external_exports.object({
|
|
17183
|
+
decision: external_exports.enum(CASE_VERSION_DECISIONS),
|
|
17184
|
+
/** The newer version its decider read as current. */
|
|
17185
|
+
expect_version_id: uuidSchema,
|
|
17186
|
+
reason: reason.nullable().default(null)
|
|
17187
|
+
}).strict().superRefine((body, ctx) => {
|
|
17188
|
+
if (body.decision === "keep" && body.reason === null) ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "A version kept needs its reason", path: ["reason"] });
|
|
17189
|
+
});
|
|
17190
|
+
CASE_PASSAGE_LINK_CHANGED_REASON = "link_changed";
|
|
17191
|
+
CASE_PASSAGE_NO_TEXT_REASON = "version_no_text";
|
|
17192
|
+
CASE_PASSAGE_OUT_OF_RANGE_REASON = CASE_COMMENT_OUT_OF_RANGE_REASON;
|
|
17193
|
+
}
|
|
17194
|
+
});
|
|
17195
|
+
|
|
17196
|
+
// ../../packages/core/dist/chunk-Q5LS3FKY.js
|
|
17197
|
+
var lines, ordered, citeCaseOfficialVersionPassageBody, citeCaseReceivedPassageBody, citeCaseSourcePassageBody, citeCaseInputPassageBody, caseSourceRefSchema;
|
|
17198
|
+
var init_chunk_Q5LS3FKY = __esm({
|
|
17199
|
+
"../../packages/core/dist/chunk-Q5LS3FKY.js"() {
|
|
17200
|
+
"use strict";
|
|
17201
|
+
init_chunk_U3L6QR6F();
|
|
17202
|
+
init_chunk_S7UAXLHJ();
|
|
17203
|
+
init_chunk_HZ6CADSY();
|
|
17204
|
+
init_zod();
|
|
17205
|
+
lines = { line_start: casePassageLineSchema, line_end: casePassageLineSchema };
|
|
17206
|
+
ordered = (body, ctx) => {
|
|
17207
|
+
if (body.line_end < body.line_start) ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: CASE_PASSAGE_REVERSED_REASON, path: ["line_end"] });
|
|
17208
|
+
};
|
|
17209
|
+
citeCaseOfficialVersionPassageBody = external_exports.object({ official_version_id: uuidSchema, ...lines }).strict().superRefine(ordered);
|
|
17210
|
+
citeCaseReceivedPassageBody = external_exports.object({ received_id: uuidSchema, ...lines }).strict().superRefine(ordered);
|
|
17211
|
+
citeCaseSourcePassageBody = external_exports.union([citeCaseOfficialVersionPassageBody, citeCaseReceivedPassageBody]);
|
|
17212
|
+
citeCaseInputPassageBody = external_exports.union([citeCasePassageBody, citeCaseOfficialVersionPassageBody, citeCaseReceivedPassageBody]);
|
|
17213
|
+
caseSourceRefSchema = external_exports.union([
|
|
17214
|
+
external_exports.object({ official_version_id: uuidSchema }).strict(),
|
|
17215
|
+
external_exports.object({ received_id: uuidSchema }).strict()
|
|
17216
|
+
]);
|
|
17217
|
+
}
|
|
17218
|
+
});
|
|
17219
|
+
|
|
17051
17220
|
// ../../packages/core/dist/chunk-BVQCYBU6.js
|
|
17052
17221
|
var CASE_RELATION_TYPE_CODE_PATTERN, CASE_RELATION_TYPE_CODE_MAX_LENGTH, CASE_RELATION_TYPE_NAME_MAX_LENGTH, CASE_RELATION_TYPES_PER_SPACE_MAX, CASE_RELATION_DESCRIPTION_MAX_LENGTH, CASE_RELATION_SIDES, CASE_EXTERNAL_SYSTEM_PATTERN, CASE_EXTERNAL_NUMBER_MAX_LENGTH, CASE_EXTERNAL_URL_MAX_LENGTH, trimmedName2, relationTypeFields, createCaseRelationTypeBody, updateCaseRelationTypeBody, relateCasesBody, addCaseExternalReferenceBody, caseRelationTypeParam, caseRelationParam, caseExternalReferenceParam, caseRelationTypesQuery;
|
|
17053
17222
|
var init_chunk_BVQCYBU6 = __esm({
|
|
@@ -17094,25 +17263,6 @@ var init_chunk_BVQCYBU6 = __esm({
|
|
|
17094
17263
|
}
|
|
17095
17264
|
});
|
|
17096
17265
|
|
|
17097
|
-
// ../../packages/core/dist/chunk-UOPCLXCU.js
|
|
17098
|
-
var CASE_CHANGE_TOPICS, caseChangedFrameSchema;
|
|
17099
|
-
var init_chunk_UOPCLXCU = __esm({
|
|
17100
|
-
"../../packages/core/dist/chunk-UOPCLXCU.js"() {
|
|
17101
|
-
"use strict";
|
|
17102
|
-
init_chunk_733K4J4G();
|
|
17103
|
-
init_chunk_HZ6CADSY();
|
|
17104
|
-
init_zod();
|
|
17105
|
-
CASE_CHANGE_TOPICS = ["submission", "agenda", "access"];
|
|
17106
|
-
caseChangedFrameSchema = external_exports.object({
|
|
17107
|
-
org_id: uuidSchema,
|
|
17108
|
-
space_id: uuidSchema,
|
|
17109
|
-
/** The case, by its code; null for an `access` change, which names none. */
|
|
17110
|
-
code: caseRecordParam.shape.code.nullable(),
|
|
17111
|
-
topic: external_exports.enum(CASE_CHANGE_TOPICS)
|
|
17112
|
-
}).strict();
|
|
17113
|
-
}
|
|
17114
|
-
});
|
|
17115
|
-
|
|
17116
17266
|
// ../../packages/core/dist/chunk-Z3SV3XTC.js
|
|
17117
17267
|
var caseAccessQuery;
|
|
17118
17268
|
var init_chunk_Z3SV3XTC = __esm({
|
|
@@ -17125,7 +17275,7 @@ var init_chunk_Z3SV3XTC = __esm({
|
|
|
17125
17275
|
});
|
|
17126
17276
|
|
|
17127
17277
|
// ../../packages/core/dist/chunk-NHC27NIE.js
|
|
17128
|
-
var CASE_ADJUSTMENT_REASON_MAX_LENGTH, CASE_ADJUSTMENT_DISPENSATION_KINDS,
|
|
17278
|
+
var CASE_ADJUSTMENT_REASON_MAX_LENGTH, CASE_ADJUSTMENT_DISPENSATION_KINDS, reason2, activateCasePhaseBody, dispenseCaseBody, addCaseTaskBody, addCaseInputBody, caseOwnItemSchema, addCaseItemBody;
|
|
17129
17279
|
var init_chunk_NHC27NIE = __esm({
|
|
17130
17280
|
"../../packages/core/dist/chunk-NHC27NIE.js"() {
|
|
17131
17281
|
"use strict";
|
|
@@ -17134,9 +17284,9 @@ var init_chunk_NHC27NIE = __esm({
|
|
|
17134
17284
|
init_zod();
|
|
17135
17285
|
CASE_ADJUSTMENT_REASON_MAX_LENGTH = 2e3;
|
|
17136
17286
|
CASE_ADJUSTMENT_DISPENSATION_KINDS = ["phase", "item", "output", "input"];
|
|
17137
|
-
|
|
17138
|
-
activateCasePhaseBody = external_exports.object({ phase_id: uuidSchema, reason }).strict();
|
|
17139
|
-
dispenseCaseBody = external_exports.object({ kind: external_exports.enum(CASE_ADJUSTMENT_DISPENSATION_KINDS), target_id: uuidSchema, reason }).strict();
|
|
17287
|
+
reason2 = external_exports.string().trim().min(1).max(CASE_ADJUSTMENT_REASON_MAX_LENGTH);
|
|
17288
|
+
activateCasePhaseBody = external_exports.object({ phase_id: uuidSchema, reason: reason2 }).strict();
|
|
17289
|
+
dispenseCaseBody = external_exports.object({ kind: external_exports.enum(CASE_ADJUSTMENT_DISPENSATION_KINDS), target_id: uuidSchema, reason: reason2 }).strict();
|
|
17140
17290
|
addCaseTaskBody = external_exports.object({
|
|
17141
17291
|
phase_id: uuidSchema,
|
|
17142
17292
|
name: external_exports.string().trim().min(1).max(CASE_TASK_NAME_MAX_LENGTH),
|
|
@@ -17147,7 +17297,7 @@ var init_chunk_NHC27NIE = __esm({
|
|
|
17147
17297
|
addCaseInputBody = external_exports.object({
|
|
17148
17298
|
phase_id: uuidSchema,
|
|
17149
17299
|
input: casePhaseInputSchema.extend({ agenda_group: caseAgendaGroupCodeSchema.nullable().default(null) }),
|
|
17150
|
-
reason
|
|
17300
|
+
reason: reason2
|
|
17151
17301
|
}).strict();
|
|
17152
17302
|
caseOwnItemSchema = caseOutputItemSchema.omit({ waivable: true, template_mode: true, fixed_text: true }).extend({ agenda_group: caseAgendaGroupCodeSchema.nullable().default(null) });
|
|
17153
17303
|
addCaseItemBody = external_exports.object({
|
|
@@ -17155,7 +17305,7 @@ var init_chunk_NHC27NIE = __esm({
|
|
|
17155
17305
|
/** The phase's output it goes in. */
|
|
17156
17306
|
output_id: uuidSchema,
|
|
17157
17307
|
item: caseOwnItemSchema,
|
|
17158
|
-
reason
|
|
17308
|
+
reason: reason2
|
|
17159
17309
|
}).strict();
|
|
17160
17310
|
}
|
|
17161
17311
|
});
|
|
@@ -17207,148 +17357,34 @@ var init_chunk_UMAPAGFH = __esm({
|
|
|
17207
17357
|
}
|
|
17208
17358
|
});
|
|
17209
17359
|
|
|
17210
|
-
// ../../packages/core/dist/chunk-
|
|
17211
|
-
|
|
17212
|
-
|
|
17213
|
-
|
|
17214
|
-
var CASE_NOTE_KINDS, CASE_NOTE_TEXT_MAX_LENGTH, CASE_NOTE_ORIGIN_MAX_LENGTH, CASE_NOTES_PAGE_MAX, addCaseNoteShape, addCaseNoteBody, caseNoteParam, caseTaskParam, caseNotesQuery;
|
|
17215
|
-
var init_chunk_7TQYAKCB = __esm({
|
|
17216
|
-
"../../packages/core/dist/chunk-7TQYAKCB.js"() {
|
|
17217
|
-
"use strict";
|
|
17218
|
-
init_chunk_733K4J4G();
|
|
17219
|
-
init_chunk_3T3D7LTE();
|
|
17220
|
-
init_chunk_HZ6CADSY();
|
|
17221
|
-
init_zod();
|
|
17222
|
-
CASE_NOTE_KINDS = ["observation", "next_step", "pending", "contribution"];
|
|
17223
|
-
CASE_NOTE_TEXT_MAX_LENGTH = 64 * 1024;
|
|
17224
|
-
CASE_NOTE_ORIGIN_MAX_LENGTH = 200;
|
|
17225
|
-
CASE_NOTES_PAGE_MAX = 100;
|
|
17226
|
-
addCaseNoteShape = external_exports.object({
|
|
17227
|
-
kind: external_exports.enum(CASE_NOTE_KINDS),
|
|
17228
|
-
text: external_exports.string().trim().min(1).max(CASE_NOTE_TEXT_MAX_LENGTH),
|
|
17229
|
-
/** A contribution's external author. */
|
|
17230
|
-
origin: external_exports.string().trim().min(1).max(CASE_NOTE_ORIGIN_MAX_LENGTH).nullable().default(null),
|
|
17231
|
-
/** A phase of the case (its version's phase id). */
|
|
17232
|
-
phase_id: uuidSchema.nullable().default(null),
|
|
17233
|
-
/** A task of the case, whose phase the note takes. */
|
|
17234
|
-
case_task_id: uuidSchema.nullable().default(null)
|
|
17235
|
-
}).strict();
|
|
17236
|
-
addCaseNoteBody = addCaseNoteShape.superRefine((note, ctx) => {
|
|
17237
|
-
const found = addCaseNoteProblem(note);
|
|
17238
|
-
if (found) ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: found.reason, path: [found.at], params: { case_note_reason: found.reason } });
|
|
17239
|
-
});
|
|
17240
|
-
caseNoteParam = caseRecordParam.extend({ note_id: uuidSchema });
|
|
17241
|
-
caseTaskParam = caseRecordParam.extend({ case_task_id: uuidSchema });
|
|
17242
|
-
caseNotesQuery = casePageQuery.extend({
|
|
17243
|
-
limit: external_exports.coerce.number().int().min(1).max(CASE_NOTES_PAGE_MAX).optional()
|
|
17244
|
-
});
|
|
17245
|
-
}
|
|
17246
|
-
});
|
|
17247
|
-
|
|
17248
|
-
// ../../packages/core/dist/chunk-S7UAXLHJ.js
|
|
17249
|
-
function casePassageLines(text5) {
|
|
17250
|
-
const lines = text5.replace(/\r\n/g, "\n").split("\n");
|
|
17251
|
-
if (lines.at(-1) === "") lines.pop();
|
|
17252
|
-
return lines;
|
|
17253
|
-
}
|
|
17254
|
-
var CASE_COMMENT_TEXT_MAX_LENGTH, CASE_COMMENTS_PAGE_MAX, CASE_COMMENT_LINE_MAX, casePassageLineSchema, lineNumber, addCaseCommentShape, CASE_COMMENT_REVERSED_REASON, addCaseCommentBody, caseCommentsQuery;
|
|
17255
|
-
var init_chunk_S7UAXLHJ = __esm({
|
|
17256
|
-
"../../packages/core/dist/chunk-S7UAXLHJ.js"() {
|
|
17257
|
-
"use strict";
|
|
17258
|
-
init_chunk_7TQYAKCB();
|
|
17259
|
-
init_chunk_VROZDNLV();
|
|
17260
|
-
init_chunk_3T3D7LTE();
|
|
17261
|
-
init_chunk_HZ6CADSY();
|
|
17262
|
-
init_zod();
|
|
17263
|
-
CASE_COMMENT_TEXT_MAX_LENGTH = CASE_NOTE_TEXT_MAX_LENGTH;
|
|
17264
|
-
CASE_COMMENTS_PAGE_MAX = 100;
|
|
17265
|
-
CASE_COMMENT_LINE_MAX = CASE_FILE_COMPARE_MAX_BYTES;
|
|
17266
|
-
casePassageLineSchema = external_exports.number().int().min(1).max(CASE_COMMENT_LINE_MAX);
|
|
17267
|
-
lineNumber = casePassageLineSchema;
|
|
17268
|
-
addCaseCommentShape = external_exports.object({
|
|
17269
|
-
path: caseFileReadPath,
|
|
17270
|
-
/** The version: the revision that wrote it to `path`. */
|
|
17271
|
-
revision_id: uuidSchema,
|
|
17272
|
-
/** The passage's first and last lines, from 1, of the version's text ({@link casePassageLines}). */
|
|
17273
|
-
line_start: lineNumber,
|
|
17274
|
-
line_end: lineNumber,
|
|
17275
|
-
text: external_exports.string().trim().min(1).max(CASE_COMMENT_TEXT_MAX_LENGTH),
|
|
17276
|
-
/** Hidden from every reader without the Confidential right; only a holder of it may set it. */
|
|
17277
|
-
confidential: external_exports.boolean().default(false)
|
|
17278
|
-
}).strict();
|
|
17279
|
-
CASE_COMMENT_REVERSED_REASON = "passage_reversed";
|
|
17280
|
-
addCaseCommentBody = addCaseCommentShape.superRefine((comment2, ctx) => {
|
|
17281
|
-
if (comment2.line_end < comment2.line_start) {
|
|
17282
|
-
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: CASE_COMMENT_REVERSED_REASON, path: ["line_end"] });
|
|
17283
|
-
}
|
|
17284
|
-
});
|
|
17285
|
-
caseCommentsQuery = casePageQuery.extend({
|
|
17286
|
-
path: caseFileReadPath,
|
|
17287
|
-
/** Absent: every version's comments on the path. */
|
|
17288
|
-
revision_id: uuidSchema.optional(),
|
|
17289
|
-
limit: external_exports.coerce.number().int().min(1).max(CASE_COMMENTS_PAGE_MAX).optional()
|
|
17290
|
-
});
|
|
17291
|
-
}
|
|
17292
|
-
});
|
|
17293
|
-
|
|
17294
|
-
// ../../packages/core/dist/chunk-S4NDHW3Q.js
|
|
17295
|
-
var CASE_VERSION_DECISION_REASON_MAX_LENGTH, CASE_VERSION_DECISIONS, caseVersionDecisionReason, reason2, lineNumber2, recordCaseReferenceBody, CASE_PASSAGE_REVERSED_REASON, citeCasePassageBody, decideCaseVersionBody;
|
|
17296
|
-
var init_chunk_S4NDHW3Q = __esm({
|
|
17297
|
-
"../../packages/core/dist/chunk-S4NDHW3Q.js"() {
|
|
17298
|
-
"use strict";
|
|
17299
|
-
init_chunk_S7UAXLHJ();
|
|
17300
|
-
init_chunk_HZ6CADSY();
|
|
17301
|
-
init_zod();
|
|
17302
|
-
CASE_VERSION_DECISION_REASON_MAX_LENGTH = 2e3;
|
|
17303
|
-
CASE_VERSION_DECISIONS = ["adopt", "keep"];
|
|
17304
|
-
caseVersionDecisionReason = external_exports.string().trim().min(1).max(CASE_VERSION_DECISION_REASON_MAX_LENGTH);
|
|
17305
|
-
reason2 = caseVersionDecisionReason;
|
|
17306
|
-
lineNumber2 = casePassageLineSchema;
|
|
17307
|
-
recordCaseReferenceBody = external_exports.object({
|
|
17308
|
-
document_id: uuidSchema,
|
|
17309
|
-
/** The document's version its writer read as current. */
|
|
17310
|
-
version_id: uuidSchema
|
|
17311
|
-
}).strict();
|
|
17312
|
-
CASE_PASSAGE_REVERSED_REASON = CASE_COMMENT_REVERSED_REASON;
|
|
17313
|
-
citeCasePassageBody = external_exports.object({
|
|
17314
|
-
document_id: uuidSchema,
|
|
17315
|
-
version_id: uuidSchema,
|
|
17316
|
-
line_start: lineNumber2,
|
|
17317
|
-
line_end: lineNumber2
|
|
17318
|
-
}).strict().superRefine((body, ctx) => {
|
|
17319
|
-
if (body.line_end < body.line_start) ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: CASE_PASSAGE_REVERSED_REASON, path: ["line_end"] });
|
|
17320
|
-
});
|
|
17321
|
-
decideCaseVersionBody = external_exports.object({
|
|
17322
|
-
decision: external_exports.enum(CASE_VERSION_DECISIONS),
|
|
17323
|
-
/** The newer version its decider read as current. */
|
|
17324
|
-
expect_version_id: uuidSchema,
|
|
17325
|
-
reason: reason2.nullable().default(null)
|
|
17326
|
-
}).strict().superRefine((body, ctx) => {
|
|
17327
|
-
if (body.decision === "keep" && body.reason === null) ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "A version kept needs its reason", path: ["reason"] });
|
|
17328
|
-
});
|
|
17329
|
-
}
|
|
17330
|
-
});
|
|
17331
|
-
|
|
17332
|
-
// ../../packages/core/dist/chunk-UZ72OHQN.js
|
|
17333
|
-
var caseInputLinkParam, caseCollectionDocumentOfCaseParam, linkCaseInputBody, CASE_COLLECTION_CASES_PAGE_MAX, caseCollectionCasesQuery, CASE_REFERENCES_PAGE_MAX, caseReferencesQuery;
|
|
17334
|
-
var init_chunk_UZ72OHQN = __esm({
|
|
17335
|
-
"../../packages/core/dist/chunk-UZ72OHQN.js"() {
|
|
17360
|
+
// ../../packages/core/dist/chunk-6ISR4YNG.js
|
|
17361
|
+
var caseInputLinkParam, caseCollectionDocumentOfCaseParam, linkCaseCollectionInputBody, linkCasePreviousOutputInputBody, linkCaseReceivedInputBody, linkCaseInputBody, CASE_LINK_OFFICIAL_VERSION_UNKNOWN_REASON, CASE_LINK_OUTPUT_NOT_PRIOR_REASON, CASE_LINK_RECEIVED_UNKNOWN_REASON, CASE_LINK_DOCUMENT_TYPE_MISMATCH_REASON, CASE_LINK_VERSION_NOT_CURRENT_REASON, CASE_COLLECTION_CASES_PAGE_MAX, caseCollectionCasesQuery, CASE_REFERENCES_PAGE_MAX, caseReferencesQuery;
|
|
17362
|
+
var init_chunk_6ISR4YNG = __esm({
|
|
17363
|
+
"../../packages/core/dist/chunk-6ISR4YNG.js"() {
|
|
17336
17364
|
"use strict";
|
|
17337
17365
|
init_chunk_6CHDJVQ6();
|
|
17338
|
-
|
|
17366
|
+
init_chunk_U3L6QR6F();
|
|
17339
17367
|
init_chunk_733K4J4G();
|
|
17340
17368
|
init_chunk_3T3D7LTE();
|
|
17341
17369
|
init_chunk_HZ6CADSY();
|
|
17342
17370
|
init_zod();
|
|
17343
17371
|
caseInputLinkParam = caseRecordParam.extend({ input_id: uuidSchema });
|
|
17344
17372
|
caseCollectionDocumentOfCaseParam = caseRecordParam.extend({ document_id: uuidSchema });
|
|
17345
|
-
|
|
17373
|
+
linkCaseCollectionInputBody = external_exports.object({
|
|
17346
17374
|
document_id: uuidSchema,
|
|
17347
17375
|
/** The document's version its writer read as current, or an earlier one it keeps, with its `reason`. */
|
|
17348
17376
|
version_id: uuidSchema,
|
|
17349
17377
|
/** Why an earlier version is kept: a version decision. Unread when `version_id` is the current one. */
|
|
17350
17378
|
reason: caseVersionDecisionReason.optional()
|
|
17351
17379
|
}).strict();
|
|
17380
|
+
linkCasePreviousOutputInputBody = external_exports.object({ official_version_id: uuidSchema }).strict();
|
|
17381
|
+
linkCaseReceivedInputBody = external_exports.object({ received_id: uuidSchema }).strict();
|
|
17382
|
+
linkCaseInputBody = external_exports.union([linkCaseCollectionInputBody, linkCasePreviousOutputInputBody, linkCaseReceivedInputBody]);
|
|
17383
|
+
CASE_LINK_OFFICIAL_VERSION_UNKNOWN_REASON = "official_version_unknown";
|
|
17384
|
+
CASE_LINK_OUTPUT_NOT_PRIOR_REASON = "output_not_prior";
|
|
17385
|
+
CASE_LINK_RECEIVED_UNKNOWN_REASON = "received_unknown";
|
|
17386
|
+
CASE_LINK_DOCUMENT_TYPE_MISMATCH_REASON = "document_type_mismatch";
|
|
17387
|
+
CASE_LINK_VERSION_NOT_CURRENT_REASON = "link_version_not_current";
|
|
17352
17388
|
CASE_COLLECTION_CASES_PAGE_MAX = 100;
|
|
17353
17389
|
caseCollectionCasesQuery = casePageQuery.extend({
|
|
17354
17390
|
limit: external_exports.coerce.number().int().min(1).max(CASE_COLLECTION_CASES_PAGE_MAX).optional()
|
|
@@ -17840,7 +17876,7 @@ var init_chunk_OMPT4ZHR = __esm({
|
|
|
17840
17876
|
}
|
|
17841
17877
|
});
|
|
17842
17878
|
|
|
17843
|
-
// ../../packages/core/dist/chunk-
|
|
17879
|
+
// ../../packages/core/dist/chunk-5XMPWEVS.js
|
|
17844
17880
|
function refineScopedTarget(data, ctx) {
|
|
17845
17881
|
if (data.scope === "org") {
|
|
17846
17882
|
if (!data.org_id) {
|
|
@@ -17866,13 +17902,13 @@ function refineScopedTarget(data, ctx) {
|
|
|
17866
17902
|
}
|
|
17867
17903
|
}
|
|
17868
17904
|
var adminOrgIdParam, adminOrgAdminIdParam, adminUserIdParam, PRICING_PLAN_ID_RE, adminPlanIdParam, adminOrganizationsQuery, adminUserSearchQuery, kanbanSlugMigrationQuery, adjustQuotaBody, updatePlanBody, addAdminUserBody, MAX_VOICE_CALL_MINUTE_OPS, voiceCallMinuteOps, AUTOMATION_GATE_EVALUATIONS_PER_OPERATION_BOUND, automationGateEvaluationsPerOperation, AUTOMATION_RUN_RETENTION_DAYS_MAX, automationRunRetentionDays, turnDeadlineSeconds, casesLimit, updatePlatformConfigBody, updateFreeOrgLimitBody, adminScopedTargetShape, adminScopedTargetBody, adminDryRunByDefaultTargetBody, WAYAI_HOST_TOKEN_TARGET_KINDS, WAYAI_HOST_TOKEN_MAX_TARGETS, adminClearWayaiHostTokensBody, BRANCHING_ORPHAN_ENTITY_TYPES, BRANCHING_ORPHAN_MAX_TARGETS, adminRepairBranchingOrphansBody, adminRepairLegacyOrgGrantsBody, adminRepairCredentialServicesBody, adminRepairCompedPlansBody, updatePricingPlanBody, dataExplorerSearchQuery, dataExplorerOrgIdParam, dataExplorerHubIdParam, dataExplorerConvIdParam, dataExplorerDoInstancesQuery, dataExplorerNsIdParam, dataExplorerKvKeysBody, dataExplorerKvKeyBody, uuidOrHexId, dataExplorerDeleteOrgParam, dataExplorerDeleteHubParam, dataExplorerDeleteConvParam, dataExplorerDeleteUserParam, dataExplorerDeleteQuery, dataExplorerKvDeleteBody, pitrDoNamespace, pitrBookmarkParam, pitrRestoreBody, healthSamplingTriggerBody, DEBUG_DO_HEX_PREFIX, debugDoEntityId, debugTableName, dataExplorerDebugTablesParam, dataExplorerDebugRowsParam, dataExplorerDebugRowsQuery, dataExplorerDebugAnalyticsTable, debugUuid, dataExplorerDebugAnalyticsRowsParam, dataExplorerDebugAnalyticsRowsQuery, dataExplorerDebugCountsDoType, dataExplorerDebugCountsParam, debugHubConvParam, debugMessageIdQuery;
|
|
17869
|
-
var
|
|
17870
|
-
"../../packages/core/dist/chunk-
|
|
17905
|
+
var init_chunk_5XMPWEVS = __esm({
|
|
17906
|
+
"../../packages/core/dist/chunk-5XMPWEVS.js"() {
|
|
17871
17907
|
"use strict";
|
|
17872
17908
|
init_chunk_FECLIZTY();
|
|
17873
17909
|
init_chunk_BFG4ZWR4();
|
|
17874
17910
|
init_chunk_UY32MQHG();
|
|
17875
|
-
|
|
17911
|
+
init_chunk_ARK3766Q();
|
|
17876
17912
|
init_chunk_OMPT4ZHR();
|
|
17877
17913
|
init_chunk_MIWZOSPI();
|
|
17878
17914
|
init_chunk_HZ6CADSY();
|
|
@@ -18028,9 +18064,10 @@ var init_chunk_OG7KTWHD = __esm({
|
|
|
18028
18064
|
cases_collection_bytes_quota: casesLimit(1024 ** 4).optional(),
|
|
18029
18065
|
/** How many days a case's agent authorization lasts before it must be approved again (`./case-agents.ts`). */
|
|
18030
18066
|
cases_agent_authorization_max_days: casesLimit(365).optional(),
|
|
18031
|
-
/** One graph review read's file versions and bytes (`./case-review.ts`). */
|
|
18067
|
+
/** One graph review read's file versions and bytes, and the pairs its computation finds (`./case-review.ts`). */
|
|
18032
18068
|
cases_review_files_max: casesLimit(5e4).optional(),
|
|
18033
18069
|
cases_review_bytes_max: casesLimit(64 * 1024 * 1024).optional(),
|
|
18070
|
+
cases_review_pairs_max: casesLimit(1e5).optional(),
|
|
18034
18071
|
/** How many automation gate evaluations bill one operation (`automationGateEvaluationsPerOperation`). */
|
|
18035
18072
|
automation_gate_evaluations_per_operation: automationGateEvaluationsPerOperation.optional(),
|
|
18036
18073
|
/** How many days a hub keeps an automation's runs (`automationRunRetentionDays`). */
|
|
@@ -18435,6 +18472,7 @@ var init_contracts = __esm({
|
|
|
18435
18472
|
"use strict";
|
|
18436
18473
|
init_chunk_RACEDHG6();
|
|
18437
18474
|
init_chunk_Q7KIQHAZ();
|
|
18475
|
+
init_chunk_63UWXV4T();
|
|
18438
18476
|
init_chunk_AYLAGFAD();
|
|
18439
18477
|
init_chunk_OPJ5OACS();
|
|
18440
18478
|
init_chunk_YVY2TZK2();
|
|
@@ -18443,71 +18481,71 @@ var init_contracts = __esm({
|
|
|
18443
18481
|
init_chunk_WONSSUXU();
|
|
18444
18482
|
init_chunk_C7UAGRXF();
|
|
18445
18483
|
init_chunk_IPXBFWUU();
|
|
18446
|
-
|
|
18484
|
+
init_chunk_TVUDMGWV();
|
|
18447
18485
|
init_chunk_WTIGECE5();
|
|
18448
18486
|
init_chunk_WDAXZDJO();
|
|
18449
18487
|
init_chunk_ZC6YGHNX();
|
|
18488
|
+
init_chunk_MGBAXT5Y();
|
|
18450
18489
|
init_chunk_5DGHIY7L();
|
|
18451
18490
|
init_chunk_TID3PAFF();
|
|
18452
18491
|
init_chunk_IPDOHAZ5();
|
|
18453
18492
|
init_chunk_PFGVH2CX();
|
|
18454
|
-
|
|
18493
|
+
init_chunk_FPSDNS2E();
|
|
18455
18494
|
init_chunk_TZH6DKKJ();
|
|
18456
18495
|
init_chunk_SSPK6ISL();
|
|
18457
18496
|
init_chunk_ZXK6N2HN();
|
|
18458
18497
|
init_chunk_Y7CFCYX4();
|
|
18459
|
-
init_chunk_MGBAXT5Y();
|
|
18460
18498
|
init_chunk_YUZFHVB2();
|
|
18461
18499
|
init_chunk_I3O2RACG();
|
|
18462
18500
|
init_chunk_CMRECH67();
|
|
18463
18501
|
init_chunk_34LE6P7E();
|
|
18464
|
-
|
|
18502
|
+
init_chunk_IR2NOSI3();
|
|
18465
18503
|
init_chunk_OPETF4GS();
|
|
18466
18504
|
init_chunk_SY6PLCPK();
|
|
18467
18505
|
init_chunk_2ZZZHXZR();
|
|
18506
|
+
init_chunk_MH4O3YEX();
|
|
18468
18507
|
init_chunk_QEEQN2NE();
|
|
18469
18508
|
init_chunk_KSTYTQ7I();
|
|
18470
18509
|
init_chunk_LKBSHANA();
|
|
18471
18510
|
init_chunk_LX3D5LCB();
|
|
18472
18511
|
init_chunk_C4HEZ7ZI();
|
|
18473
|
-
init_chunk_IR2NOSI3();
|
|
18474
18512
|
init_chunk_UCYWGWQT();
|
|
18475
18513
|
init_chunk_6AYIXGDT();
|
|
18476
18514
|
init_chunk_YULHXJ5M();
|
|
18477
18515
|
init_chunk_V4FRPRH5();
|
|
18478
18516
|
init_chunk_LWMLR2WI();
|
|
18479
18517
|
init_chunk_ACGAI25T();
|
|
18480
|
-
init_chunk_MH4O3YEX();
|
|
18481
18518
|
init_chunk_NNC2ZECG();
|
|
18482
18519
|
init_chunk_7CYHPF35();
|
|
18483
18520
|
init_chunk_NETRUHZF();
|
|
18484
|
-
|
|
18521
|
+
init_chunk_LZHLURLT();
|
|
18485
18522
|
init_chunk_QG3XMUEN();
|
|
18486
18523
|
init_chunk_EBUWHIFV();
|
|
18487
18524
|
init_chunk_PCQIFFYO();
|
|
18488
18525
|
init_chunk_AHISKXHA();
|
|
18489
18526
|
init_chunk_2YEGUQR7();
|
|
18490
18527
|
init_chunk_JDJ4EUOL();
|
|
18491
|
-
|
|
18528
|
+
init_chunk_6MNNZ3G4();
|
|
18492
18529
|
init_chunk_K3PD6AOF();
|
|
18493
18530
|
init_chunk_KVMROYDC();
|
|
18494
18531
|
init_chunk_M2IF4G6X();
|
|
18532
|
+
init_chunk_UOPCLXCU();
|
|
18495
18533
|
init_chunk_7CZSLDOE();
|
|
18496
18534
|
init_chunk_2YVCHUBL();
|
|
18497
|
-
|
|
18535
|
+
init_chunk_NMGRRGDR();
|
|
18498
18536
|
init_chunk_WYCUCSD5();
|
|
18499
18537
|
init_chunk_H6V7NEWR();
|
|
18500
18538
|
init_chunk_ZVIMTUGZ();
|
|
18539
|
+
init_chunk_Q5LS3FKY();
|
|
18501
18540
|
init_chunk_BVQCYBU6();
|
|
18502
|
-
init_chunk_UOPCLXCU();
|
|
18503
18541
|
init_chunk_Z3SV3XTC();
|
|
18504
18542
|
init_chunk_NHC27NIE();
|
|
18505
18543
|
init_chunk_UMAPAGFH();
|
|
18506
|
-
|
|
18544
|
+
init_chunk_6ISR4YNG();
|
|
18507
18545
|
init_chunk_6CHDJVQ6();
|
|
18508
18546
|
init_chunk_U3X3BIQH();
|
|
18509
18547
|
init_chunk_EYOBPUDN();
|
|
18510
|
-
|
|
18548
|
+
init_chunk_U3L6QR6F();
|
|
18511
18549
|
init_chunk_UEJOG2Q7();
|
|
18512
18550
|
init_chunk_KEN2DASI();
|
|
18513
18551
|
init_chunk_L5GC53VI();
|
|
@@ -18521,13 +18559,13 @@ var init_contracts = __esm({
|
|
|
18521
18559
|
init_chunk_4LXDRTO4();
|
|
18522
18560
|
init_chunk_5PKKFSSF();
|
|
18523
18561
|
init_chunk_NVKU5PPQ();
|
|
18524
|
-
|
|
18562
|
+
init_chunk_5XMPWEVS();
|
|
18525
18563
|
init_chunk_FECLIZTY();
|
|
18526
18564
|
init_chunk_BFG4ZWR4();
|
|
18527
18565
|
init_chunk_UY32MQHG();
|
|
18528
|
-
|
|
18529
|
-
init_chunk_X5PZZVTS();
|
|
18566
|
+
init_chunk_ARK3766Q();
|
|
18530
18567
|
init_chunk_D3EP4TDU();
|
|
18568
|
+
init_chunk_X5PZZVTS();
|
|
18531
18569
|
init_chunk_PIZTARVG();
|
|
18532
18570
|
init_chunk_OMPT4ZHR();
|
|
18533
18571
|
init_chunk_2PZIF56U();
|
|
@@ -18552,7 +18590,7 @@ var init_contracts = __esm({
|
|
|
18552
18590
|
init_chunk_MIWZOSPI();
|
|
18553
18591
|
init_chunk_2ISUBJG7();
|
|
18554
18592
|
init_chunk_C2UEA2KW();
|
|
18555
|
-
|
|
18593
|
+
init_chunk_XPOCPOMA();
|
|
18556
18594
|
init_chunk_5Y2NNQHX();
|
|
18557
18595
|
init_chunk_S7UAXLHJ();
|
|
18558
18596
|
init_chunk_7TQYAKCB();
|
|
@@ -20104,9 +20142,9 @@ function oldLayoutEntries(root, skills, oldLayout) {
|
|
|
20104
20142
|
function assertOldLayoutConvertible(root, skills, oldLayout, pullCommand3) {
|
|
20105
20143
|
const { leftover } = oldLayoutEntries(root, skills, oldLayout);
|
|
20106
20144
|
if (leftover.length === 0) return;
|
|
20107
|
-
const
|
|
20145
|
+
const one6 = leftover.length === 1;
|
|
20108
20146
|
throw expected(
|
|
20109
|
-
`${leftover.sort().join(", ")} would be removed or overwritten unseen. Converting a folder an older CLI wrote, \`${pullCommand3}\` writes ${SKILLS_DIR}/ from the platform and removes from ${OLD_RESOURCES_DIR}/ only the folders named after the skills it writes. Move ${
|
|
20147
|
+
`${leftover.sort().join(", ")} would be removed or overwritten unseen. Converting a folder an older CLI wrote, \`${pullCommand3}\` writes ${SKILLS_DIR}/ from the platform and removes from ${OLD_RESOURCES_DIR}/ only the folders named after the skills it writes. Move ${one6 ? "it" : "them"} out of ${path8.basename(root)}/ (a knowledge backup belongs outside the workspace), then run \`${pullCommand3}\` again. Nothing was written.`
|
|
20110
20148
|
);
|
|
20111
20149
|
}
|
|
20112
20150
|
function removeConvertedOldResources(root, skills, log, opts = {}) {
|
|
@@ -20750,6 +20788,18 @@ var init_api_client = __esm({
|
|
|
20750
20788
|
async getCaseInputLink(ref, inputId) {
|
|
20751
20789
|
return this.request("GET", `${casePath(ref)}/inputs/${encodeURIComponent(inputId)}/link`);
|
|
20752
20790
|
}
|
|
20791
|
+
/** An input's link to the case's own source (an earlier phase's official version, or a received document), with its cited passages. */
|
|
20792
|
+
async getCaseInputSourceLink(ref, inputId) {
|
|
20793
|
+
return this.request("GET", `${casePath(ref)}/inputs/${encodeURIComponent(inputId)}/source-link`);
|
|
20794
|
+
}
|
|
20795
|
+
/** Link an input: to a collection document's version, an earlier phase's official version, or a received document, by the body's fields. */
|
|
20796
|
+
async linkCaseInput(ref, inputId, body) {
|
|
20797
|
+
return this.request("PUT", `${casePath(ref)}/inputs/${encodeURIComponent(inputId)}/link`, body);
|
|
20798
|
+
}
|
|
20799
|
+
/** Cite a passage of what an input links, by its lines: the server hashes them and answers the passage it holds. */
|
|
20800
|
+
async citeCaseInputPassage(ref, inputId, body) {
|
|
20801
|
+
return this.request("POST", `${casePath(ref)}/inputs/${encodeURIComponent(inputId)}/passages`, body);
|
|
20802
|
+
}
|
|
20753
20803
|
/**
|
|
20754
20804
|
* One part of a collection document's version, through the case's own path, with the SHA-256 the space registered for
|
|
20755
20805
|
* it when the part was stored (the answer's `ETag`, `"<sha>"`); `sha` is null when no such tag is answered.
|
|
@@ -24782,8 +24832,8 @@ var init_parser = __esm({
|
|
|
24782
24832
|
|
|
24783
24833
|
// src/lib/diff-display.ts
|
|
24784
24834
|
function printDiff(summary) {
|
|
24785
|
-
const
|
|
24786
|
-
for (const line of
|
|
24835
|
+
const lines2 = summary.split("\n");
|
|
24836
|
+
for (const line of lines2) {
|
|
24787
24837
|
if (line.startsWith("**") && line.endsWith("**")) {
|
|
24788
24838
|
console.log(`
|
|
24789
24839
|
\x1B[1m${line.replace(/\*\*/g, "")}\x1B[0m`);
|
|
@@ -25310,7 +25360,7 @@ var init_hub_materializer = __esm({
|
|
|
25310
25360
|
var init_ci = __esm({
|
|
25311
25361
|
"../../packages/core/dist/contracts/ci.js"() {
|
|
25312
25362
|
"use strict";
|
|
25313
|
-
|
|
25363
|
+
init_chunk_LZHLURLT();
|
|
25314
25364
|
init_chunk_QG3XMUEN();
|
|
25315
25365
|
init_chunk_EBUWHIFV();
|
|
25316
25366
|
init_chunk_PCQIFFYO();
|
|
@@ -25319,9 +25369,9 @@ var init_ci = __esm({
|
|
|
25319
25369
|
init_chunk_QMQGGR7Q();
|
|
25320
25370
|
init_chunk_LBDH7LCG();
|
|
25321
25371
|
init_chunk_4LXDRTO4();
|
|
25322
|
-
|
|
25323
|
-
init_chunk_X5PZZVTS();
|
|
25372
|
+
init_chunk_ARK3766Q();
|
|
25324
25373
|
init_chunk_D3EP4TDU();
|
|
25374
|
+
init_chunk_X5PZZVTS();
|
|
25325
25375
|
init_chunk_PIZTARVG();
|
|
25326
25376
|
init_chunk_AMMLEB4T();
|
|
25327
25377
|
init_chunk_IBL7FANV();
|
|
@@ -26740,30 +26790,30 @@ function countChanges(diff) {
|
|
|
26740
26790
|
return { added, modified, removed };
|
|
26741
26791
|
}
|
|
26742
26792
|
function renderDiff(diff) {
|
|
26743
|
-
const
|
|
26793
|
+
const lines2 = [];
|
|
26744
26794
|
for (const kind of ENTITY_KINDS) {
|
|
26745
26795
|
const b = bucket(diff, kind);
|
|
26746
26796
|
if (!b || isEmptyBucket(b)) continue;
|
|
26747
|
-
|
|
26748
|
-
for (const e of b.added)
|
|
26749
|
-
for (const m of b.modified)
|
|
26797
|
+
lines2.push(`${BOLD}${ENTITY_LABELS[kind]}s${RESET}`);
|
|
26798
|
+
for (const e of b.added) lines2.push(`${GREEN} + ${sanitizeTerminalText(e.id)}${RESET}`);
|
|
26799
|
+
for (const m of b.modified) lines2.push(`${YELLOW} ~ ${sanitizeTerminalText(m.after.id)}${RESET}`);
|
|
26750
26800
|
for (const e of b.removed) {
|
|
26751
|
-
|
|
26801
|
+
lines2.push(
|
|
26752
26802
|
isPrunable(e.id) ? `${RED} - ${sanitizeTerminalText(e.id)}${RESET}` : `${YELLOW} = ${sanitizeTerminalText(e.id)} (kept: pull cannot write its id to a file)${RESET}`
|
|
26753
26803
|
);
|
|
26754
26804
|
}
|
|
26755
26805
|
}
|
|
26756
26806
|
const { added, modified, removed } = countChanges(diff);
|
|
26757
|
-
|
|
26758
|
-
|
|
26807
|
+
lines2.push("");
|
|
26808
|
+
lines2.push(
|
|
26759
26809
|
`${GREEN}${added} added${RESET}, ${YELLOW}${modified} modified${RESET}, ${RED}${removed} removed${RESET}`
|
|
26760
26810
|
);
|
|
26761
26811
|
if (removed > 0) {
|
|
26762
|
-
|
|
26812
|
+
lines2.push(
|
|
26763
26813
|
`${RED} ${removed} entit${removed === 1 ? "y" : "ies"} exist on the base but not in your files \u2014 re-run with --prune to delete (record types cascade to their records, file types to their files).${RESET}`
|
|
26764
26814
|
);
|
|
26765
26815
|
}
|
|
26766
|
-
return
|
|
26816
|
+
return lines2.join("\n");
|
|
26767
26817
|
}
|
|
26768
26818
|
var ENTITY_LABELS, GREEN, YELLOW, RED, BOLD, RESET;
|
|
26769
26819
|
var init_diff_format = __esm({
|
|
@@ -28450,11 +28500,11 @@ function lineDiffOf(a, b) {
|
|
|
28450
28500
|
}
|
|
28451
28501
|
return out;
|
|
28452
28502
|
}
|
|
28453
|
-
function printSection(title2,
|
|
28454
|
-
if (
|
|
28503
|
+
function printSection(title2, lines2) {
|
|
28504
|
+
if (lines2.length === 0) return;
|
|
28455
28505
|
console.log(`
|
|
28456
28506
|
${title2}`);
|
|
28457
|
-
for (const line of
|
|
28507
|
+
for (const line of lines2) console.log(` ${line}`);
|
|
28458
28508
|
}
|
|
28459
28509
|
function printListing(listing) {
|
|
28460
28510
|
printSection("Changes:", listing.changes);
|
|
@@ -30615,10 +30665,10 @@ function headingsOf(text5) {
|
|
|
30615
30665
|
return found;
|
|
30616
30666
|
}
|
|
30617
30667
|
function frontMatterOf(text5) {
|
|
30618
|
-
const
|
|
30619
|
-
if (
|
|
30668
|
+
const lines2 = text5.split(/\r?\n/);
|
|
30669
|
+
if (lines2[0] !== "---") return {};
|
|
30620
30670
|
const fields = {};
|
|
30621
|
-
for (const line of
|
|
30671
|
+
for (const line of lines2.slice(1)) {
|
|
30622
30672
|
if (line === "---") return fields;
|
|
30623
30673
|
const colon = line.indexOf(":");
|
|
30624
30674
|
if (colon > 0) fields[line.slice(0, colon).trim()] = line.slice(colon + 1).trim();
|
|
@@ -31808,17 +31858,17 @@ function changedLines(before, after) {
|
|
|
31808
31858
|
return lineDiffOf(a.slice(start, a.length - end), b.slice(start, b.length - end));
|
|
31809
31859
|
}
|
|
31810
31860
|
async function describeSteps(client, t, dir, steps) {
|
|
31811
|
-
const
|
|
31861
|
+
const lines2 = [];
|
|
31812
31862
|
for (const step of steps) {
|
|
31813
31863
|
const rel = safe2(step.rel);
|
|
31814
31864
|
if (step.op === "create") {
|
|
31815
|
-
|
|
31865
|
+
lines2.push(`${MARK.create} ${rel} (new, ${step.local.size} bytes)`);
|
|
31816
31866
|
} else if (step.op === "delete") {
|
|
31817
|
-
|
|
31867
|
+
lines2.push(`${MARK.delete} ${rel} (delete)`);
|
|
31818
31868
|
} else {
|
|
31819
|
-
|
|
31869
|
+
lines2.push(`${MARK.update} ${rel}`);
|
|
31820
31870
|
if (!isTextType(step.remote.content_type) || step.remote.size > MAX_DIFF_BYTES || step.local.size > MAX_DIFF_BYTES) {
|
|
31821
|
-
|
|
31871
|
+
lines2.push(` (content changed: ${step.remote.size} \u2192 ${step.local.size} bytes)`);
|
|
31822
31872
|
continue;
|
|
31823
31873
|
}
|
|
31824
31874
|
let bytes;
|
|
@@ -31826,15 +31876,15 @@ async function describeSteps(client, t, dir, steps) {
|
|
|
31826
31876
|
bytes = (await client.download(filePath2(t, step.rel))).bytes;
|
|
31827
31877
|
} catch (err) {
|
|
31828
31878
|
if (!isNotFound(err)) throw err;
|
|
31829
|
-
|
|
31879
|
+
lines2.push(" (deleted on the base since it was listed)");
|
|
31830
31880
|
continue;
|
|
31831
31881
|
}
|
|
31832
31882
|
const before = Buffer.from(bytes).toString("utf-8");
|
|
31833
31883
|
const after = readLocal(dir, step.rel).toString("utf-8");
|
|
31834
|
-
for (const line of changedLines(before, after))
|
|
31884
|
+
for (const line of changedLines(before, after)) lines2.push(` ${line}`);
|
|
31835
31885
|
}
|
|
31836
31886
|
}
|
|
31837
|
-
return
|
|
31887
|
+
return lines2;
|
|
31838
31888
|
}
|
|
31839
31889
|
function printPushNotes(plan) {
|
|
31840
31890
|
printSection("Changed on the base since your last pull \u2014 left as is; pull to take it:", plan.changedOnBase.map(safe2));
|
|
@@ -36047,7 +36097,7 @@ function activeAlerts(alerts) {
|
|
|
36047
36097
|
function summarizeActiveAlertsForReport(alerts) {
|
|
36048
36098
|
const active = activeAlerts(alerts);
|
|
36049
36099
|
if (active.length === 0) return null;
|
|
36050
|
-
const
|
|
36100
|
+
const lines2 = active.map((a) => {
|
|
36051
36101
|
const { label: label3 } = describeCategory(a.category);
|
|
36052
36102
|
const target = formatAlertTarget(a);
|
|
36053
36103
|
const providerBits = formatProviderBits(a);
|
|
@@ -36055,7 +36105,7 @@ function summarizeActiveAlertsForReport(alerts) {
|
|
|
36055
36105
|
return `- [${a.severity}] ${a.category} (${label3}) \xB7 ${target}${providerBits ? ` \xB7 ${providerBits}` : ""}${detailBit} \xB7 seen ${a.count}\xD7`;
|
|
36056
36106
|
});
|
|
36057
36107
|
return `Active hub alerts at report time (${active.length}):
|
|
36058
|
-
${
|
|
36108
|
+
${lines2.join("\n")}`;
|
|
36059
36109
|
}
|
|
36060
36110
|
var init_hub_alerts = __esm({
|
|
36061
36111
|
"src/lib/hub-alerts.ts"() {
|
|
@@ -38007,10 +38057,10 @@ var init_facts = __esm({
|
|
|
38007
38057
|
// src/lib/call-eval/script.ts
|
|
38008
38058
|
function parseCallPlan(raw) {
|
|
38009
38059
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) throw new Error('A call plan is a JSON object with a "lines" object.');
|
|
38010
|
-
const
|
|
38011
|
-
if (!
|
|
38060
|
+
const lines2 = raw.lines ?? {};
|
|
38061
|
+
if (!lines2 || typeof lines2 !== "object" || Array.isArray(lines2)) throw new Error(`The call plan's "lines" must be an object keyed by line number.`);
|
|
38012
38062
|
const out = {};
|
|
38013
|
-
for (const [key, value] of Object.entries(
|
|
38063
|
+
for (const [key, value] of Object.entries(lines2)) {
|
|
38014
38064
|
if (!/^[1-9]\d*$/.test(key)) throw new Error(`Call plan line "${key}" is not a line number (1, 2, \u2026).`);
|
|
38015
38065
|
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(`Call plan line ${key} must be an object.`);
|
|
38016
38066
|
const entry = value;
|
|
@@ -38044,16 +38094,16 @@ function readbackOf(value) {
|
|
|
38044
38094
|
return read;
|
|
38045
38095
|
}
|
|
38046
38096
|
function buildCallScript(journey, plan = { lines: {} }) {
|
|
38047
|
-
const
|
|
38097
|
+
const lines2 = [];
|
|
38048
38098
|
let current = null;
|
|
38049
38099
|
const flush = () => {
|
|
38050
38100
|
if (!current) return;
|
|
38051
|
-
const n =
|
|
38101
|
+
const n = lines2.length + 1;
|
|
38052
38102
|
const expectedReply = current.replies.join("\n").trim();
|
|
38053
38103
|
const expectedFacts = extractFacts(expectedReply);
|
|
38054
38104
|
const override2 = plan.lines[String(n)] ?? {};
|
|
38055
38105
|
const readback = override2.readback === void 0 ? dictatedIdentifier(current.say) : override2.readback === null ? null : readbackOf(override2.readback);
|
|
38056
|
-
|
|
38106
|
+
lines2.push({
|
|
38057
38107
|
n,
|
|
38058
38108
|
say: current.say,
|
|
38059
38109
|
expected_reply: expectedReply,
|
|
@@ -38075,15 +38125,15 @@ function buildCallScript(journey, plan = { lines: {} }) {
|
|
|
38075
38125
|
}
|
|
38076
38126
|
}
|
|
38077
38127
|
flush();
|
|
38078
|
-
if (
|
|
38079
|
-
if (
|
|
38128
|
+
if (lines2.length === 0) throw new Error(`Journey "${journey.journey_name}" has no caller line to say.`);
|
|
38129
|
+
if (lines2[0].interrupt) throw new Error("Line 1 cannot interrupt: the voice has said nothing to interrupt yet.");
|
|
38080
38130
|
for (const key of Object.keys(plan.lines)) {
|
|
38081
|
-
if (Number(key) >
|
|
38131
|
+
if (Number(key) > lines2.length) throw new Error(`The call plan names line ${key}, but the journey has ${lines2.length} caller line${lines2.length === 1 ? "" : "s"}.`);
|
|
38082
38132
|
}
|
|
38083
38133
|
return {
|
|
38084
38134
|
journey_id: journey.journey_id,
|
|
38085
38135
|
journey_name: journey.journey_name,
|
|
38086
|
-
lines
|
|
38136
|
+
lines: lines2
|
|
38087
38137
|
};
|
|
38088
38138
|
}
|
|
38089
38139
|
var PLAN_LINE_KEYS;
|
|
@@ -38168,11 +38218,11 @@ function similarity(a, b) {
|
|
|
38168
38218
|
for (const t of ta) if (tb.has(t)) shared += 1;
|
|
38169
38219
|
return shared / (ta.size + tb.size - shared);
|
|
38170
38220
|
}
|
|
38171
|
-
function alignLines(
|
|
38221
|
+
function alignLines(lines2, utterances) {
|
|
38172
38222
|
const caller = utterances.filter((u) => u.speaker === "user");
|
|
38173
38223
|
const out = /* @__PURE__ */ new Map();
|
|
38174
38224
|
let next = 0;
|
|
38175
|
-
for (const line of
|
|
38225
|
+
for (const line of lines2) {
|
|
38176
38226
|
let best = null;
|
|
38177
38227
|
for (let start = next; start <= Math.min(caller.length - 1, next + MAX_SKIP); start++) {
|
|
38178
38228
|
for (let end = start; end < Math.min(caller.length, start + MAX_GROUP); end++) {
|
|
@@ -38206,17 +38256,17 @@ function timelineMs(record, iso) {
|
|
|
38206
38256
|
return fromIso(iso) - fromIso(record.call.started_at);
|
|
38207
38257
|
}
|
|
38208
38258
|
function scoreRun(script, record, timings, thresholds = DEFAULT_THRESHOLDS) {
|
|
38209
|
-
const
|
|
38259
|
+
const lines2 = alignLines(script.lines, record.utterances);
|
|
38210
38260
|
const turnsByAnchor = /* @__PURE__ */ new Map();
|
|
38211
38261
|
for (const turn of record.turns) {
|
|
38212
38262
|
if (!turn.anchor_message_id) continue;
|
|
38213
38263
|
turnsByAnchor.set(turn.anchor_message_id, [...turnsByAnchor.get(turn.anchor_message_id) ?? [], turn]);
|
|
38214
38264
|
}
|
|
38215
|
-
const turnsOf = (n) => (
|
|
38265
|
+
const turnsOf = (n) => (lines2.get(n) ?? []).flatMap((u) => turnsByAnchor.get(u.message_id) ?? []);
|
|
38216
38266
|
const voice = record.utterances.filter((u) => u.speaker === "voice_agent");
|
|
38217
38267
|
const recognition = { expected: 0, recognized: 0, misses: [] };
|
|
38218
38268
|
for (const line of script.lines) {
|
|
38219
|
-
const heard = (
|
|
38269
|
+
const heard = (lines2.get(line.n) ?? []).map((u) => u.text).join(" ");
|
|
38220
38270
|
const vetted = buildVettedSet(heard ? [heard] : []);
|
|
38221
38271
|
for (const fact of extractFacts(line.say)) {
|
|
38222
38272
|
recognition.expected += 1;
|
|
@@ -38269,8 +38319,8 @@ function scoreRun(script, record, timings, thresholds = DEFAULT_THRESHOLDS) {
|
|
|
38269
38319
|
script.lines.forEach((line, i) => {
|
|
38270
38320
|
if (!line.readback) return;
|
|
38271
38321
|
readback.expected += 1;
|
|
38272
|
-
const own =
|
|
38273
|
-
const nextOwn = script.lines.slice(i + 1).map((l) =>
|
|
38322
|
+
const own = lines2.get(line.n) ?? [];
|
|
38323
|
+
const nextOwn = script.lines.slice(i + 1).map((l) => lines2.get(l.n) ?? []).find((u) => u.length > 0);
|
|
38274
38324
|
const from = own.length > 0 ? own[own.length - 1].end_ms : Number.POSITIVE_INFINITY;
|
|
38275
38325
|
const until = nextOwn ? nextOwn[0].start_ms : Number.POSITIVE_INFINITY;
|
|
38276
38326
|
const attempt = voice.filter((u) => u.start_ms >= from && u.start_ms < until).map((u) => readbackCandidate(u.text, line.readback.kind)).find((heard) => heard !== null) ?? null;
|
|
@@ -38641,40 +38691,40 @@ function problems(run) {
|
|
|
38641
38691
|
return out;
|
|
38642
38692
|
}
|
|
38643
38693
|
function formatSuiteReport(report2) {
|
|
38644
|
-
const
|
|
38645
|
-
|
|
38646
|
-
|
|
38647
|
-
|
|
38648
|
-
|
|
38649
|
-
for (const run of report2.runs)
|
|
38650
|
-
if (report2.skipped_runs > 0)
|
|
38651
|
-
if (report2.interrupted)
|
|
38652
|
-
|
|
38653
|
-
|
|
38694
|
+
const lines2 = [];
|
|
38695
|
+
lines2.push(`Call eval \u2014 journey "${shown3(report2.journey.name)}" (${report2.journey.id})`);
|
|
38696
|
+
lines2.push(`Caller audio: ${report2.audio}`);
|
|
38697
|
+
lines2.push(`Cap per run: ${report2.cap.maxCallSeconds} s of call, ${report2.cap.maxOperations} WayAI operations; suite: ${usd(report2.cap.maxSuiteUsd)} of provider time at ${usd(report2.cap.providerUsdPerMinute)}/min`);
|
|
38698
|
+
lines2.push("");
|
|
38699
|
+
for (const run of report2.runs) lines2.push(runLine(run));
|
|
38700
|
+
if (report2.skipped_runs > 0) lines2.push(` ${report2.skipped_runs} run(s) not started: the suite's budget would not hold another`);
|
|
38701
|
+
if (report2.interrupted) lines2.push(" Interrupted: the call in progress was hung up and closed, and no further run was started");
|
|
38702
|
+
lines2.push("");
|
|
38703
|
+
lines2.push(`Pass rate: ${report2.pass_rate.passed}/${report2.pass_rate.scored}`);
|
|
38654
38704
|
for (const name of SCORE_DIMENSIONS) {
|
|
38655
|
-
|
|
38705
|
+
lines2.push(` ${DIMENSION_LABELS[name].padEnd(28)} ${report2.dimensions[name].passed}/${report2.dimensions[name].scored}`);
|
|
38656
38706
|
}
|
|
38657
|
-
|
|
38658
|
-
|
|
38707
|
+
lines2.push(`Latency (caller end of speech \u2192 voice's first audio): p50 ${seconds(report2.latency.p50_ms)}, p95 ${seconds(report2.latency.p95_ms)} over ${report2.latency.samples} line(s)`);
|
|
38708
|
+
lines2.push(`Cost: provider ${usd(report2.cost.provider_usd)}, WayAI operations ${report2.cost.operations}`);
|
|
38659
38709
|
const failing = report2.runs.filter((r) => !runPassed(r));
|
|
38660
38710
|
if (failing.length > 0) {
|
|
38661
|
-
|
|
38662
|
-
|
|
38711
|
+
lines2.push("");
|
|
38712
|
+
lines2.push("Failures:");
|
|
38663
38713
|
for (const run of failing) {
|
|
38664
38714
|
const found = problems(run);
|
|
38665
|
-
|
|
38666
|
-
for (const more of found.slice(1))
|
|
38715
|
+
lines2.push(` run ${run.run}: ${found.length === 0 ? `ended ${run.status}${run.stopped_by ? ` (${run.stopped_by})` : ""}` : found[0]}`);
|
|
38716
|
+
for (const more of found.slice(1)) lines2.push(` ${more}`);
|
|
38667
38717
|
}
|
|
38668
38718
|
}
|
|
38669
38719
|
const review = report2.runs.flatMap((r) => (r.score?.unvetted.review ?? []).map((item) => ({ run: r.run, ...item })));
|
|
38670
38720
|
if (review.length > 0) {
|
|
38671
|
-
|
|
38672
|
-
|
|
38673
|
-
for (const item of review)
|
|
38721
|
+
lines2.push("");
|
|
38722
|
+
lines2.push("For review (policy or action wording no delegation result carried; not counted):");
|
|
38723
|
+
for (const item of review) lines2.push(` run ${item.run}: "${shown3(item.utterance)}" [${item.markers.join(", ")}]`);
|
|
38674
38724
|
}
|
|
38675
|
-
|
|
38676
|
-
|
|
38677
|
-
return
|
|
38725
|
+
lines2.push("");
|
|
38726
|
+
lines2.push("The judged half \u2014 style and unvetted claims as the hub's evaluator sees them \u2014 is the call-mode text run: wayai run-eval --call-mode");
|
|
38727
|
+
return lines2.join("\n");
|
|
38678
38728
|
}
|
|
38679
38729
|
var DIMENSION_LABELS, shown3;
|
|
38680
38730
|
var init_report = __esm({
|
|
@@ -41404,8 +41454,8 @@ function refuseFlags(sub, values, flags) {
|
|
|
41404
41454
|
function entryLine(entry) {
|
|
41405
41455
|
return ` ${text3(entry.person_id)} since ${text3(entry.created_at)}, by ${text3(entry.created_by)}`;
|
|
41406
41456
|
}
|
|
41407
|
-
function print(values, data,
|
|
41408
|
-
console.log(values.json ? JSON.stringify(data, null, 2) :
|
|
41457
|
+
function print(values, data, lines2) {
|
|
41458
|
+
console.log(values.json ? JSON.stringify(data, null, 2) : lines2.join("\n"));
|
|
41409
41459
|
}
|
|
41410
41460
|
async function persons(sub, positionals, values) {
|
|
41411
41461
|
const takesTo = sub === "link-person" || sub === "unlink-person";
|
|
@@ -41450,9 +41500,9 @@ async function persons(sub, positionals, values) {
|
|
|
41450
41500
|
}
|
|
41451
41501
|
case "denied-persons": {
|
|
41452
41502
|
const data = await api.listDeniedPersons(orgId, { cursor, limit });
|
|
41453
|
-
const
|
|
41454
|
-
if (data.next_cursor)
|
|
41455
|
-
print(values, data,
|
|
41503
|
+
const lines2 = data.denied.length === 0 ? ["Nothing is denied."] : ["Denied:", ...data.denied.map(entryLine)];
|
|
41504
|
+
if (data.next_cursor) lines2.push(`More: --cursor ${text3(data.next_cursor)}`);
|
|
41505
|
+
print(values, data, lines2);
|
|
41456
41506
|
return;
|
|
41457
41507
|
}
|
|
41458
41508
|
case "deny-person": {
|
|
@@ -42019,44 +42069,62 @@ async function readAgenda(calls, phaseId) {
|
|
|
42019
42069
|
}
|
|
42020
42070
|
return { groups, more: true };
|
|
42021
42071
|
}
|
|
42022
|
-
|
|
42072
|
+
function checkedText(base, file, answered, cited) {
|
|
42073
|
+
const unmatched = cited.map((p) => ({ passage_id: p.passage_id, line_start: p.line_start, line_end: p.line_end, passage_sha: p.passage_sha, matches: false }));
|
|
42074
|
+
const unwritten = (status, sha) => ({ text: { ...base, status, file: null, sha, passages: unmatched }, data: null });
|
|
42075
|
+
if (!answered) return unwritten("no_text", null);
|
|
42076
|
+
if (answered.sha === null || computeHash(answered.bytes) !== answered.sha) return unwritten("hash_mismatch", answered.sha);
|
|
42077
|
+
const lines2 = unmatched.length ? casePassageLines(new TextDecoder("utf-8").decode(answered.bytes)) : [];
|
|
42078
|
+
return {
|
|
42079
|
+
text: {
|
|
42080
|
+
...base,
|
|
42081
|
+
status: "written",
|
|
42082
|
+
file,
|
|
42083
|
+
sha: answered.sha,
|
|
42084
|
+
passages: unmatched.map((p) => {
|
|
42085
|
+
const inRange = p.line_start >= 1 && p.line_end >= p.line_start && p.line_end <= lines2.length;
|
|
42086
|
+
const text5 = Buffer.from(lines2.slice(p.line_start - 1, p.line_end).join("\n"), "utf-8");
|
|
42087
|
+
return { ...p, matches: inRange && computeHash(text5) === p.passage_sha };
|
|
42088
|
+
})
|
|
42089
|
+
},
|
|
42090
|
+
data: Buffer.from(answered.bytes.buffer, answered.bytes.byteOffset, answered.bytes.byteLength)
|
|
42091
|
+
};
|
|
42092
|
+
}
|
|
42093
|
+
async function readInputTexts(calls, folder, work, folders, listed3) {
|
|
42023
42094
|
const { api, connection } = calls.session;
|
|
42024
|
-
const
|
|
42025
|
-
const read = await Promise.all(linked.map(async (input) => {
|
|
42026
|
-
const view = (await calls.run(() => api.getCaseInputLink(connection, input.id))).data;
|
|
42027
|
-
if (!view?.readable) return null;
|
|
42028
|
-
const answered = await calls.run(() => notFound(api.getCaseCollectionContent(connection, view.document_id, { part: "text", version_id: view.version_id })));
|
|
42029
|
-
const passages = view.passages.filter((p) => p.version_id === view.version_id);
|
|
42030
|
-
const base = { input_id: input.id, key: input.key, name: input.name, document_id: view.document_id, version_id: view.version_id };
|
|
42031
|
-
const unmatched = passages.map((p) => ({ passage_id: p.passage_id, line_start: p.line_start, line_end: p.line_end, passage_sha: p.passage_sha, matches: false }));
|
|
42032
|
-
if (!answered) return { text: { ...base, status: "no_text", file: null, sha: null, passages: unmatched }, data: null };
|
|
42033
|
-
if (answered.sha === null || computeHash(answered.bytes) !== answered.sha) {
|
|
42034
|
-
return { text: { ...base, status: "hash_mismatch", file: null, sha: answered.sha, passages: unmatched }, data: null };
|
|
42035
|
-
}
|
|
42036
|
-
const lines = unmatched.length ? casePassageLines(new TextDecoder("utf-8").decode(answered.bytes)) : [];
|
|
42095
|
+
const read = await Promise.all(work.inputs.map(async (input) => {
|
|
42037
42096
|
const file = `${INPUTS_DIR}/${folder}/${segment(input.key, CASE_INPUT_KEY_PATTERN, input.id)}.md`;
|
|
42038
|
-
|
|
42039
|
-
|
|
42040
|
-
|
|
42041
|
-
|
|
42042
|
-
|
|
42043
|
-
|
|
42044
|
-
|
|
42045
|
-
|
|
42046
|
-
|
|
42047
|
-
|
|
42048
|
-
|
|
42049
|
-
|
|
42050
|
-
|
|
42051
|
-
|
|
42097
|
+
const named = { input_id: input.id, key: input.key, name: input.name };
|
|
42098
|
+
if (input.link?.readable === true) {
|
|
42099
|
+
const view2 = (await calls.run(() => api.getCaseInputLink(connection, input.id))).data;
|
|
42100
|
+
if (!view2?.readable) return null;
|
|
42101
|
+
const answered = await calls.run(() => notFound(api.getCaseCollectionContent(connection, view2.document_id, { part: "text", version_id: view2.version_id })));
|
|
42102
|
+
const base2 = { ...named, origin: "collection", document_id: view2.document_id, version_id: view2.version_id };
|
|
42103
|
+
return checkedText(base2, file, answered, view2.passages.filter((p) => p.version_id === view2.version_id));
|
|
42104
|
+
}
|
|
42105
|
+
if (input.source_link?.readable !== true) return null;
|
|
42106
|
+
const view = (await calls.run(() => api.getCaseInputSourceLink(connection, input.id))).data;
|
|
42107
|
+
if (!view?.readable) return null;
|
|
42108
|
+
if (view.kind === "official_version") {
|
|
42109
|
+
const base2 = { ...named, origin: "previous_output", official_version_id: view.official_version_id, version: view.version };
|
|
42110
|
+
const checked = checkedText(base2, file, null, view.passages.filter((p) => "official_version_id" in p && p.official_version_id === view.official_version_id));
|
|
42111
|
+
return view.has_text ? { text: { ...checked.text, status: "no_read" }, data: null } : checked;
|
|
42112
|
+
}
|
|
42113
|
+
const base = { ...named, origin: "received", received_id: view.received_id };
|
|
42114
|
+
const cited = view.passages.filter((p) => "received_id" in p && p.received_id === view.received_id);
|
|
42115
|
+
const phaseFolder = folders.get(view.phase_id);
|
|
42116
|
+
const rel = phaseFolder === void 0 ? void 0 : [`${phaseFolder}/received/${view.received_id}.text.md`, `conf/${phaseFolder}/received/${view.received_id}.text.md`].find((p) => listed3.has(p));
|
|
42117
|
+
const bytes = rel === void 0 ? null : await calls.run(() => notFound(api.getCaseFileContent(connection, rel)));
|
|
42118
|
+
return checkedText(base, file, bytes === null ? null : { bytes, sha: listed3.get(rel) }, cited);
|
|
42052
42119
|
}));
|
|
42053
42120
|
return read.filter((r) => r !== null);
|
|
42054
42121
|
}
|
|
42055
|
-
async function readWork(calls, detail, confidential) {
|
|
42122
|
+
async function readWork(calls, detail, confidential, listing) {
|
|
42056
42123
|
const { api, connection } = calls.session;
|
|
42057
42124
|
const state = (await calls.run(() => api.getCaseState(connection))).data;
|
|
42058
42125
|
if (state.view !== "work") return { state, phases: [], approved: [] };
|
|
42059
42126
|
const folders = new Map(detail.phases.map((p) => [p.phase_id, p.folder]));
|
|
42127
|
+
const listed3 = new Map(listing.files.filter((f) => listing.inRun(f.path)).map((f) => [f.path, f.sha]));
|
|
42060
42128
|
const underWay = state.state.phases.filter((p) => p.status === "in_progress").map((p) => p.phase_id);
|
|
42061
42129
|
const [phases, approved] = await Promise.all([
|
|
42062
42130
|
Promise.all(underWay.map(async (phaseId) => {
|
|
@@ -42064,7 +42132,7 @@ async function readWork(calls, detail, confidential) {
|
|
|
42064
42132
|
const [{ work, texts }, agenda, delivery] = await Promise.all([
|
|
42065
42133
|
calls.run(() => api.getCasePhaseWork(connection, phaseId)).then(async ({ data }) => ({
|
|
42066
42134
|
work: data,
|
|
42067
|
-
texts: await readInputTexts(calls, segment(folder, CASE_PHASE_FOLDER_PATTERN, phaseId), data)
|
|
42135
|
+
texts: await readInputTexts(calls, segment(folder, CASE_PHASE_FOLDER_PATTERN, phaseId), data, folders, listed3)
|
|
42068
42136
|
})),
|
|
42069
42137
|
readAgenda(calls, phaseId),
|
|
42070
42138
|
calls.run(() => api.getCaseDelivery(connection, phaseId))
|
|
@@ -42138,22 +42206,22 @@ function statusSections(detail, work, before, now) {
|
|
|
42138
42206
|
function filesSection(input) {
|
|
42139
42207
|
const now = new Map(input.files.filter((f) => input.inRun(f.path)).map((f) => [f.path, f.sha]));
|
|
42140
42208
|
const before = new Map(Object.entries(input.record.files).filter(([rel]) => input.inRun(rel)).map(([rel, f]) => [rel, f.sha]));
|
|
42141
|
-
const
|
|
42209
|
+
const lines2 = [];
|
|
42142
42210
|
for (const [rel, sha] of now) {
|
|
42143
|
-
if (!before.has(rel))
|
|
42144
|
-
else if (before.get(rel) !== sha)
|
|
42211
|
+
if (!before.has(rel)) lines2.push(`+ ${safe6(rel)}`);
|
|
42212
|
+
else if (before.get(rel) !== sha) lines2.push(`~ ${safe6(rel)}`);
|
|
42145
42213
|
}
|
|
42146
|
-
for (const rel of before.keys()) if (!now.has(rel))
|
|
42147
|
-
return { title: "Files on the case that differ from what this clone last pulled", lines:
|
|
42214
|
+
for (const rel of before.keys()) if (!now.has(rel)) lines2.push(`- ${safe6(rel)} (removed, or no longer readable here)`);
|
|
42215
|
+
return { title: "Files on the case that differ from what this clone last pulled", lines: lines2.sort((a, b) => a.slice(2) < b.slice(2) ? -1 : 1) };
|
|
42148
42216
|
}
|
|
42149
42217
|
function revisionsSection(since, hideMessages) {
|
|
42150
|
-
const
|
|
42218
|
+
const lines2 = since.revisions.flatMap((r) => {
|
|
42151
42219
|
const author = r.author?.display_name ? one(r.author.display_name) : "a person no longer named";
|
|
42152
42220
|
const message = r.message !== null && !hideMessages ? `: ${one(r.message)}` : "";
|
|
42153
42221
|
return [`revision ${r.revision_id}, ${r.created_at}, ${author} (${r.channel})${message}`, ...r.entries.map((e) => ` ${safe6(e.path)}${e.sha === null ? " (removed)" : ""}`)];
|
|
42154
42222
|
});
|
|
42155
|
-
if (since.more)
|
|
42156
|
-
return { title: "Revisions", lines };
|
|
42223
|
+
if (since.more) lines2.push("\u2026 and older ones: `wayai cases log` lists them all.");
|
|
42224
|
+
return { title: "Revisions", lines: lines2 };
|
|
42157
42225
|
}
|
|
42158
42226
|
function renderSections(sections) {
|
|
42159
42227
|
return sections.filter((s) => s.lines.length > 0).flatMap((s) => [`${s.title}:`, ...s.lines.map((l) => ` ${l}`)]);
|
|
@@ -42164,7 +42232,9 @@ function unwrittenLines(work) {
|
|
|
42164
42232
|
if (text5.status === "hash_mismatch") {
|
|
42165
42233
|
return [`${name}: not written, its bytes do not hash to the SHA-256 the space registered for it${text5.sha === null ? " (none was answered)" : ""}.`];
|
|
42166
42234
|
}
|
|
42167
|
-
|
|
42235
|
+
if (text5.status === "no_read") return [`${name}: not written, no read this authorization makes gives the text of an earlier phase's official version.`];
|
|
42236
|
+
if (text5.status !== "no_text") return [];
|
|
42237
|
+
return [text5.origin === "collection" ? `${name}: the version it links holds no registered text, or is no longer readable here.` : `${name}: the source it links holds no text, or it is no longer readable here.`];
|
|
42168
42238
|
}));
|
|
42169
42239
|
}
|
|
42170
42240
|
function packageReadme(pkg2) {
|
|
@@ -42189,11 +42259,13 @@ function readme(detail, at, withheld, confidential, unwritten, pkg2) {
|
|
|
42189
42259
|
"- `evidence.json`: each phase under way: its inputs with their links, its outputs and its items.",
|
|
42190
42260
|
"- `agenda.json`: each phase under way: its agenda groups and decisions; and the approved decisions.",
|
|
42191
42261
|
"- `deliveries.json`: each phase under way: its newest submission and manifest.",
|
|
42192
|
-
`- \`${INPUTS_FILE}\`: each phase under way: each input whose link you may read, the version it links
|
|
42193
|
-
"
|
|
42194
|
-
|
|
42195
|
-
|
|
42196
|
-
" names
|
|
42262
|
+
`- \`${INPUTS_FILE}\`: each phase under way: each input whose link you may read, the version or source it links (a`,
|
|
42263
|
+
" collection document's version, an earlier phase's official version, a received document), where its text is here,",
|
|
42264
|
+
" and its cited passages (lines and hash, and whether they match the text here).",
|
|
42265
|
+
`- \`${INPUTS_DIR}/<phase folder>/<input key>.md\`: each such input's registered text, of the version or source its`,
|
|
42266
|
+
" link names, byte for byte and checked against the SHA-256 the space registered for it: line N here is the line N a",
|
|
42267
|
+
" citation names (each line ends at a line break). An earlier phase's official version's text is not here: no read",
|
|
42268
|
+
" this authorization makes gives it.",
|
|
42197
42269
|
...unwritten.length ? ["", "Linked inputs' texts not written:", ...unwritten.map((line) => `- ${line}`)] : []
|
|
42198
42270
|
];
|
|
42199
42271
|
return [
|
|
@@ -42345,7 +42417,7 @@ async function writeCaseMirror(calls, input) {
|
|
|
42345
42417
|
const readsRevisions = before !== null || mode !== "mirror-only";
|
|
42346
42418
|
const { api, connection } = calls.session;
|
|
42347
42419
|
const [work, since, pkg2] = await Promise.all([
|
|
42348
|
-
withheld ? null : readWork(calls, detail, confidential),
|
|
42420
|
+
withheld ? null : readWork(calls, detail, confidential, input),
|
|
42349
42421
|
readsRevisions ? revisionsSince(calls, before ? before.revision_at : void 0, confidential) : NO_REVISIONS,
|
|
42350
42422
|
// Asked with --confidential alone: unasked, the space leaves its marked files out, whatever right the reader holds.
|
|
42351
42423
|
readPackageDelivery({
|
|
@@ -42375,9 +42447,9 @@ async function writeCaseMirror(calls, input) {
|
|
|
42375
42447
|
if (before) sections.push(revisionsSection(since, withheld));
|
|
42376
42448
|
if (mode !== "clone") sections.push(filesSection(input));
|
|
42377
42449
|
if (before && work) sections.push(...statusSections(detail, work, before, now));
|
|
42378
|
-
const
|
|
42450
|
+
const lines2 = renderSections(sections);
|
|
42379
42451
|
const heading = mode === "clone" ? "This is the clone's first pull: there is nothing earlier to compare with." : before ? `Since the last pull (${before.at}):` : "No record of an earlier pull is in this clone's mirror: only its files are compared.";
|
|
42380
|
-
const summary = [heading, ...
|
|
42452
|
+
const summary = [heading, ...lines2.length ? lines2 : before ? ["Nothing changed."] : []];
|
|
42381
42453
|
const notice = confidential ? [] : ["", MIRROR_CONFIDENTIAL_NOTICE];
|
|
42382
42454
|
const unwritten = unwrittenLines(work);
|
|
42383
42455
|
const files = [
|
|
@@ -42481,7 +42553,7 @@ exec wayai cases pull --mirror-only --dir "$(dirname "$0")/.."
|
|
|
42481
42553
|
}
|
|
42482
42554
|
});
|
|
42483
42555
|
|
|
42484
|
-
// ../../packages/core/dist/chunk-
|
|
42556
|
+
// ../../packages/core/dist/chunk-GOGIAA5K.js
|
|
42485
42557
|
function firstAtOrAfter(sorted, from) {
|
|
42486
42558
|
let lo = 0;
|
|
42487
42559
|
let hi = sorted.length;
|
|
@@ -42492,7 +42564,7 @@ function firstAtOrAfter(sorted, from) {
|
|
|
42492
42564
|
}
|
|
42493
42565
|
return lo < sorted.length ? sorted[lo] : -1;
|
|
42494
42566
|
}
|
|
42495
|
-
function
|
|
42567
|
+
function segmentsOf(text5, state) {
|
|
42496
42568
|
const blankStarts = [];
|
|
42497
42569
|
for (let i = text5.indexOf("\n"); i >= 0; i = text5.indexOf("\n", i + 1)) {
|
|
42498
42570
|
BLANK_AFTER.lastIndex = i + 1;
|
|
@@ -42520,7 +42592,10 @@ function caseMarkdownSegments(text5) {
|
|
|
42520
42592
|
const close3 = new RegExp(`^ {0,3}${m[1][0]}{${m[1].length},}[ \\t]*\\r?$`, "gm");
|
|
42521
42593
|
close3.lastIndex = start;
|
|
42522
42594
|
const found = close3.exec(text5);
|
|
42523
|
-
if (!found)
|
|
42595
|
+
if (!found) {
|
|
42596
|
+
if (state) state.open = true;
|
|
42597
|
+
return text5.length;
|
|
42598
|
+
}
|
|
42524
42599
|
const end = found.index + found[0].length;
|
|
42525
42600
|
return text5[end] === "\n" ? end + 1 : end;
|
|
42526
42601
|
};
|
|
@@ -42558,6 +42633,7 @@ function caseMarkdownSegments(text5) {
|
|
|
42558
42633
|
continue;
|
|
42559
42634
|
}
|
|
42560
42635
|
commentNeverCloses = true;
|
|
42636
|
+
if (state) state.open = true;
|
|
42561
42637
|
}
|
|
42562
42638
|
if (text5[i] === "`") {
|
|
42563
42639
|
let j = i;
|
|
@@ -42701,31 +42777,32 @@ function anchorOf(text5) {
|
|
|
42701
42777
|
}
|
|
42702
42778
|
return null;
|
|
42703
42779
|
}
|
|
42704
|
-
function tableEnd(
|
|
42705
|
-
let columns = COLUMNS.test(
|
|
42706
|
-
if (columns < 0 && DASHES.test(
|
|
42707
|
-
for (let n = i + 1; n <
|
|
42708
|
-
if (COLUMNS.test(
|
|
42780
|
+
function tableEnd(lines2, i, state) {
|
|
42781
|
+
let columns = COLUMNS.test(lines2[i]) ? i : -1;
|
|
42782
|
+
if (columns < 0 && DASHES.test(lines2[i])) {
|
|
42783
|
+
for (let n = i + 1; n < lines2.length && lines2[n].trim() !== ""; n++) {
|
|
42784
|
+
if (COLUMNS.test(lines2[n])) {
|
|
42709
42785
|
columns = n;
|
|
42710
42786
|
break;
|
|
42711
42787
|
}
|
|
42712
42788
|
}
|
|
42713
42789
|
}
|
|
42714
42790
|
if (columns < 0) return -1;
|
|
42715
|
-
for (let n = columns + 1; n <
|
|
42716
|
-
if (atxHeading(
|
|
42717
|
-
if (DASHES.test(
|
|
42791
|
+
for (let n = columns + 1; n < lines2.length; n++) {
|
|
42792
|
+
if (atxHeading(lines2[n]) || FENCE.test(lines2[n])) return -1;
|
|
42793
|
+
if (DASHES.test(lines2[n]) || COLUMNS.test(lines2[n])) return n;
|
|
42718
42794
|
}
|
|
42795
|
+
if (state) state.open = true;
|
|
42719
42796
|
return -1;
|
|
42720
42797
|
}
|
|
42721
|
-
function readHeadings(
|
|
42798
|
+
function readHeadings(lines2, state) {
|
|
42722
42799
|
const headings = [];
|
|
42723
42800
|
let fence = null;
|
|
42724
42801
|
let closedAt = -1;
|
|
42725
42802
|
let tableUntil = -1;
|
|
42726
|
-
for (let i = 0; i <
|
|
42803
|
+
for (let i = 0; i < lines2.length; i++) {
|
|
42727
42804
|
if (i <= tableUntil) continue;
|
|
42728
|
-
const line =
|
|
42805
|
+
const line = lines2[i];
|
|
42729
42806
|
const mark = FENCE.exec(line);
|
|
42730
42807
|
if (fence !== null) {
|
|
42731
42808
|
if (mark && mark[1][0] === fence[0] && mark[1].length >= fence.length && line.trim() === mark[1]) {
|
|
@@ -42738,8 +42815,8 @@ function readHeadings(lines) {
|
|
|
42738
42815
|
fence = mark[1];
|
|
42739
42816
|
continue;
|
|
42740
42817
|
}
|
|
42741
|
-
if (i === 0 ||
|
|
42742
|
-
const end = tableEnd(
|
|
42818
|
+
if (i === 0 || lines2[i - 1].trim() === "") {
|
|
42819
|
+
const end = tableEnd(lines2, i, state);
|
|
42743
42820
|
if (end > i) {
|
|
42744
42821
|
tableUntil = end;
|
|
42745
42822
|
continue;
|
|
@@ -42750,23 +42827,24 @@ function readHeadings(lines) {
|
|
|
42750
42827
|
headings.push({ start: i, end: i + 1, ...atx });
|
|
42751
42828
|
continue;
|
|
42752
42829
|
}
|
|
42753
|
-
const previous =
|
|
42754
|
-
if (i > 0 && SETEXT_UNDERLINE.test(line) && previous.trim() !== "" && closedAt !== i - 1 && (i === 1 ||
|
|
42830
|
+
const previous = lines2[i - 1];
|
|
42831
|
+
if (i > 0 && SETEXT_UNDERLINE.test(line) && previous.trim() !== "" && closedAt !== i - 1 && (i === 1 || lines2[i - 2].trim() === "") && headings.at(-1)?.end !== i) {
|
|
42755
42832
|
headings.push({ start: i - 1, end: i + 1, level: line.includes("=") ? 1 : 2, text: previous.trim() });
|
|
42756
42833
|
}
|
|
42757
42834
|
}
|
|
42835
|
+
if (state && fence !== null) state.open = true;
|
|
42758
42836
|
return headings.map((h) => {
|
|
42759
42837
|
const anchor = anchorOf(h.text);
|
|
42760
42838
|
return { ...h, code: anchor?.code ?? null, title: anchor?.title ?? h.text };
|
|
42761
42839
|
});
|
|
42762
42840
|
}
|
|
42763
|
-
function bodyWithLines(text5) {
|
|
42841
|
+
function bodyWithLines(text5, state) {
|
|
42764
42842
|
const original = withoutBom(text5).replace(/\r\n/g, "\n");
|
|
42765
42843
|
const frontMatter = CASE_FRONT_MATTER.exec(original)?.[0] ?? "";
|
|
42766
42844
|
let line = 1 + (frontMatter.match(/\n/g)?.length ?? 0);
|
|
42767
42845
|
let body = "";
|
|
42768
42846
|
const origin = [line];
|
|
42769
|
-
for (const segment2 of
|
|
42847
|
+
for (const segment2 of segmentsOf(original.slice(frontMatter.length), state)) {
|
|
42770
42848
|
if (segment2.kind === "comment") {
|
|
42771
42849
|
line += segment2.content.match(/\n/g)?.length ?? 0;
|
|
42772
42850
|
continue;
|
|
@@ -42790,13 +42868,16 @@ function lastAtOrBefore(sorted, at) {
|
|
|
42790
42868
|
return lo;
|
|
42791
42869
|
}
|
|
42792
42870
|
function readCaseItems(text5) {
|
|
42793
|
-
|
|
42794
|
-
|
|
42871
|
+
return readItems(text5);
|
|
42872
|
+
}
|
|
42873
|
+
function readItems(text5, state) {
|
|
42874
|
+
const { body, frontMatter, origin } = bodyWithLines(text5, state);
|
|
42875
|
+
const lines2 = body.split("\n");
|
|
42795
42876
|
const lastLine = Math.max(1, casePassageLines(text5).length);
|
|
42796
|
-
const headings = readHeadings(
|
|
42877
|
+
const headings = readHeadings(lines2, state);
|
|
42797
42878
|
const lineMarks = [];
|
|
42798
42879
|
const malformed = [];
|
|
42799
|
-
|
|
42880
|
+
lines2.forEach((content, n) => {
|
|
42800
42881
|
const marks = [];
|
|
42801
42882
|
for (const { raw, content: inner } of lineMarkers(content)) {
|
|
42802
42883
|
const marker = inner === null ? null : readMarker(inner, origin[n]);
|
|
@@ -42806,8 +42887,8 @@ function readCaseItems(text5) {
|
|
|
42806
42887
|
lineMarks.push(marks);
|
|
42807
42888
|
});
|
|
42808
42889
|
const ends = new Array(headings.length);
|
|
42809
|
-
let nextAnchor =
|
|
42810
|
-
const nextAtLevel = new Array(7).fill(
|
|
42890
|
+
let nextAnchor = lines2.length;
|
|
42891
|
+
const nextAtLevel = new Array(7).fill(lines2.length);
|
|
42811
42892
|
for (let h = headings.length - 1; h >= 0; h--) {
|
|
42812
42893
|
const heading = headings[h];
|
|
42813
42894
|
let end = nextAnchor;
|
|
@@ -42816,9 +42897,9 @@ function readCaseItems(text5) {
|
|
|
42816
42897
|
nextAtLevel[heading.level] = heading.start;
|
|
42817
42898
|
if (heading.code !== null) nextAnchor = heading.start;
|
|
42818
42899
|
}
|
|
42819
|
-
const headingLine = new Array(
|
|
42900
|
+
const headingLine = new Array(lines2.length).fill(false);
|
|
42820
42901
|
for (const heading of headings) for (let n = heading.start; n < heading.end; n++) headingLine[n] = true;
|
|
42821
|
-
const inItem = new Array(
|
|
42902
|
+
const inItem = new Array(lines2.length).fill(false);
|
|
42822
42903
|
const items = [];
|
|
42823
42904
|
headings.forEach((heading, h) => {
|
|
42824
42905
|
if (heading.code === null) return;
|
|
@@ -42828,7 +42909,7 @@ function readCaseItems(text5) {
|
|
|
42828
42909
|
const images = [];
|
|
42829
42910
|
for (let n = heading.end; n < end; n++) {
|
|
42830
42911
|
for (const marker of lineMarks[n]) markers2.push(marker);
|
|
42831
|
-
for (const target of lineImages(
|
|
42912
|
+
for (const target of lineImages(lines2[n])) images.push({ target, line: origin[n] });
|
|
42832
42913
|
}
|
|
42833
42914
|
const internal = [];
|
|
42834
42915
|
for (let o = h + 1; o < headings.length && headings[o].start < end; o++) {
|
|
@@ -42836,7 +42917,7 @@ function readCaseItems(text5) {
|
|
|
42836
42917
|
if (other.start >= heading.end) internal.push({ level: other.level, text: other.title, line: origin[other.start] });
|
|
42837
42918
|
}
|
|
42838
42919
|
const prose = [];
|
|
42839
|
-
for (let n = heading.end; n < end; n++) if (!headingLine[n]) prose.push(
|
|
42920
|
+
for (let n = heading.end; n < end; n++) if (!headingLine[n]) prose.push(lines2[n]);
|
|
42840
42921
|
const proseText = prose.join("\n");
|
|
42841
42922
|
let withoutFills = "";
|
|
42842
42923
|
let from = 0;
|
|
@@ -42850,7 +42931,7 @@ function readCaseItems(text5) {
|
|
|
42850
42931
|
title: heading.title,
|
|
42851
42932
|
level: heading.level,
|
|
42852
42933
|
lines: { start: origin[heading.start], end: Math.max(origin[heading.start], Math.min(origin[end - 1], lastLine)) },
|
|
42853
|
-
text:
|
|
42934
|
+
text: lines2.slice(heading.end, end).join("\n"),
|
|
42854
42935
|
has_text: withoutFills.trim() !== "",
|
|
42855
42936
|
headings: internal,
|
|
42856
42937
|
markers: markers2,
|
|
@@ -42865,17 +42946,30 @@ function readCaseItems(text5) {
|
|
|
42865
42946
|
const fills = fillsOf(body).map((fill) => ({ text: fill.text, line: origin[lastAtOrBefore(lineStarts, fill.start)] }));
|
|
42866
42947
|
const markers = [];
|
|
42867
42948
|
for (const marks of lineMarks) for (const marker of marks) markers.push(marker);
|
|
42949
|
+
const outside = lines2.filter((_, n) => !inItem[n]);
|
|
42950
|
+
if (state) {
|
|
42951
|
+
let last = headings.length - 1;
|
|
42952
|
+
while (last >= 0 && headings[last].code === null) last--;
|
|
42953
|
+
state.open_level = last >= 0 && ends[last] === lines2.length ? headings[last].level : null;
|
|
42954
|
+
const anchored = headings.find((heading) => heading.code !== null)?.start ?? lines2.length;
|
|
42955
|
+
state.lead = {
|
|
42956
|
+
lines: lines2.slice(0, anchored),
|
|
42957
|
+
marks: lineMarks.slice(0, anchored),
|
|
42958
|
+
headings: headings.filter((heading) => heading.start < anchored).map((heading) => ({ start: heading.start, level: heading.level }))
|
|
42959
|
+
};
|
|
42960
|
+
state.outside = outside;
|
|
42961
|
+
}
|
|
42868
42962
|
return {
|
|
42869
42963
|
items,
|
|
42870
42964
|
markers,
|
|
42871
42965
|
fills,
|
|
42872
|
-
outside: { front_matter: frontMatter, body:
|
|
42966
|
+
outside: { front_matter: frontMatter, body: outside.join("\n") },
|
|
42873
42967
|
malformed_markers: malformed
|
|
42874
42968
|
};
|
|
42875
42969
|
}
|
|
42876
|
-
var CASE_COMPOSED_COVER, CASE_ITEM_READER_MAX_CHARS, FENCE_OPEN, BLANK_AFTER, CASE_FRONT_MATTER, withoutBom, FENCE, SETEXT_UNDERLINE, DASHES, COLUMNS, patternBody, CALCULATION_MARKER, DECISION_MARKER, DOCUMENT_MARKER, INPUT_MARKER, isSpace, isTabOrSpace, once;
|
|
42877
|
-
var
|
|
42878
|
-
"../../packages/core/dist/chunk-
|
|
42970
|
+
var CASE_COMPOSED_COVER, CASE_ITEM_READER_MAX_CHARS, FENCE_OPEN, BLANK_AFTER, CASE_FRONT_MATTER, FRONT_MATTER_OPENING, withoutBom, FENCE, SETEXT_UNDERLINE, DASHES, COLUMNS, patternBody, CALCULATION_MARKER, DECISION_MARKER, DOCUMENT_MARKER, INPUT_MARKER, isSpace, isTabOrSpace, once, OPENS_FRONT_MATTER;
|
|
42971
|
+
var init_chunk_GOGIAA5K = __esm({
|
|
42972
|
+
"../../packages/core/dist/chunk-GOGIAA5K.js"() {
|
|
42879
42973
|
"use strict";
|
|
42880
42974
|
init_chunk_S7UAXLHJ();
|
|
42881
42975
|
init_chunk_PFPADFUC();
|
|
@@ -42884,6 +42978,7 @@ var init_chunk_KAO33OFE = __esm({
|
|
|
42884
42978
|
FENCE_OPEN = / {0,3}(`{3,}|~{3,})([^\n]*)(?:\n|$)/y;
|
|
42885
42979
|
BLANK_AFTER = /[ \t]*\r?\n/y;
|
|
42886
42980
|
CASE_FRONT_MATTER = /^---\r?\n(?![ \t]*\r?\n)([\s\S]*?)\r?\n---/;
|
|
42981
|
+
FRONT_MATTER_OPENING = CASE_FRONT_MATTER.source.slice(0, CASE_FRONT_MATTER.source.indexOf("(["));
|
|
42887
42982
|
withoutBom = (text5) => text5.replace(/^\uFEFF/, "");
|
|
42888
42983
|
FENCE = /^ {0,3}(`{3,}|~{3,})/;
|
|
42889
42984
|
SETEXT_UNDERLINE = /^ {0,3}(=+|-+)[ \t]*$/;
|
|
@@ -42899,6 +42994,7 @@ var init_chunk_KAO33OFE = __esm({
|
|
|
42899
42994
|
isSpace = (c) => c !== void 0 && /\s/.test(c);
|
|
42900
42995
|
isTabOrSpace = (c) => c === " " || c === " ";
|
|
42901
42996
|
once = (values) => [...new Set(values)];
|
|
42997
|
+
OPENS_FRONT_MATTER = new RegExp(FRONT_MATTER_OPENING);
|
|
42902
42998
|
}
|
|
42903
42999
|
});
|
|
42904
43000
|
|
|
@@ -42906,7 +43002,7 @@ var init_chunk_KAO33OFE = __esm({
|
|
|
42906
43002
|
var init_case_item_reader = __esm({
|
|
42907
43003
|
"../../packages/core/dist/case-item-reader.js"() {
|
|
42908
43004
|
"use strict";
|
|
42909
|
-
|
|
43005
|
+
init_chunk_GOGIAA5K();
|
|
42910
43006
|
init_chunk_S7UAXLHJ();
|
|
42911
43007
|
init_chunk_7TQYAKCB();
|
|
42912
43008
|
init_chunk_VROZDNLV();
|
|
@@ -42944,12 +43040,12 @@ function skeletonParts(input) {
|
|
|
42944
43040
|
let underGrouping = false;
|
|
42945
43041
|
for (const item of input.items) {
|
|
42946
43042
|
const nested = !item.grouping && underGrouping;
|
|
42947
|
-
const
|
|
43043
|
+
const lines2 = [`${nested ? "###" : "##"} ${oneLine(item.title)} {#${item.code}}`, ""];
|
|
42948
43044
|
if (item.grouping) underGrouping = true;
|
|
42949
43045
|
const body = item.grouping ? null : item.template_mode === "fixed" && item.fixed_text !== null ? item.fixed_text.trim() : item.template !== null ? fillAttributes(item.template.trim(), input.attributes, missing) : `{{fill: ${oneLine(item.title)}}}`;
|
|
42950
|
-
if (body)
|
|
42951
|
-
if (nested) sections[sections.length - 1].lines.push(...
|
|
42952
|
-
else sections.push({ code: item.code, lines });
|
|
43046
|
+
if (body) lines2.push(body, "");
|
|
43047
|
+
if (nested) sections[sections.length - 1].lines.push(...lines2);
|
|
43048
|
+
else sections.push({ code: item.code, lines: lines2 });
|
|
42953
43049
|
}
|
|
42954
43050
|
return { cover, sections, missing: [...missing].sort() };
|
|
42955
43051
|
}
|
|
@@ -42973,12 +43069,289 @@ var init_case_skeleton = __esm({
|
|
|
42973
43069
|
MARK2 = /\{\{\s*([^{}:]+?)\s*(?::[^{}]*)?\}\}/g;
|
|
42974
43070
|
FILL = "fill";
|
|
42975
43071
|
oneLine = (text5) => text5.replace(/\s*\r?\n\s*/g, " ").trim();
|
|
42976
|
-
close2 = (
|
|
43072
|
+
close2 = (lines2) => `${lines2.join("\n").trimEnd()}
|
|
42977
43073
|
`;
|
|
42978
43074
|
fillsIn = (text5) => readCaseItems(text5).fills.length;
|
|
42979
43075
|
}
|
|
42980
43076
|
});
|
|
42981
43077
|
|
|
43078
|
+
// ../../packages/core/dist/contracts/case-collection-links.js
|
|
43079
|
+
var init_case_collection_links = __esm({
|
|
43080
|
+
"../../packages/core/dist/contracts/case-collection-links.js"() {
|
|
43081
|
+
"use strict";
|
|
43082
|
+
init_chunk_6ISR4YNG();
|
|
43083
|
+
init_chunk_6CHDJVQ6();
|
|
43084
|
+
init_chunk_U3X3BIQH();
|
|
43085
|
+
init_chunk_EYOBPUDN();
|
|
43086
|
+
init_chunk_U3L6QR6F();
|
|
43087
|
+
init_chunk_S7UAXLHJ();
|
|
43088
|
+
init_chunk_7TQYAKCB();
|
|
43089
|
+
init_chunk_VROZDNLV();
|
|
43090
|
+
init_chunk_733K4J4G();
|
|
43091
|
+
init_chunk_PFPADFUC();
|
|
43092
|
+
init_chunk_KWRHZBGU();
|
|
43093
|
+
init_chunk_3T3D7LTE();
|
|
43094
|
+
init_chunk_M2T55BV6();
|
|
43095
|
+
init_chunk_VYINA6YP();
|
|
43096
|
+
init_chunk_ZVXO3XL6();
|
|
43097
|
+
init_chunk_FBV7NLKO();
|
|
43098
|
+
init_chunk_WEXVYJ5H();
|
|
43099
|
+
init_chunk_HZ6CADSY();
|
|
43100
|
+
init_chunk_ICYO56QW();
|
|
43101
|
+
init_chunk_WFQDSQJK();
|
|
43102
|
+
init_chunk_ZTNFLGW5();
|
|
43103
|
+
}
|
|
43104
|
+
});
|
|
43105
|
+
|
|
43106
|
+
// ../../packages/core/dist/contracts/case-collection-citations.js
|
|
43107
|
+
var init_case_collection_citations = __esm({
|
|
43108
|
+
"../../packages/core/dist/contracts/case-collection-citations.js"() {
|
|
43109
|
+
"use strict";
|
|
43110
|
+
init_chunk_U3L6QR6F();
|
|
43111
|
+
init_chunk_S7UAXLHJ();
|
|
43112
|
+
init_chunk_7TQYAKCB();
|
|
43113
|
+
init_chunk_VROZDNLV();
|
|
43114
|
+
init_chunk_733K4J4G();
|
|
43115
|
+
init_chunk_PFPADFUC();
|
|
43116
|
+
init_chunk_KWRHZBGU();
|
|
43117
|
+
init_chunk_3T3D7LTE();
|
|
43118
|
+
init_chunk_M2T55BV6();
|
|
43119
|
+
init_chunk_VYINA6YP();
|
|
43120
|
+
init_chunk_ZVXO3XL6();
|
|
43121
|
+
init_chunk_FBV7NLKO();
|
|
43122
|
+
init_chunk_WEXVYJ5H();
|
|
43123
|
+
init_chunk_HZ6CADSY();
|
|
43124
|
+
init_chunk_ICYO56QW();
|
|
43125
|
+
init_chunk_WFQDSQJK();
|
|
43126
|
+
init_chunk_ZTNFLGW5();
|
|
43127
|
+
}
|
|
43128
|
+
});
|
|
43129
|
+
|
|
43130
|
+
// src/cases/case-inputs.ts
|
|
43131
|
+
function inputLinkState(input) {
|
|
43132
|
+
const unlinked = input.dispensation ? { state: "dispensed" } : { state: "unlinked" };
|
|
43133
|
+
if (input.origin === "collection") {
|
|
43134
|
+
const link2 = input.link;
|
|
43135
|
+
if (!link2) return unlinked;
|
|
43136
|
+
if (!link2.readable) return { state: "unreadable", linked_at: link2.linked_at };
|
|
43137
|
+
const source2 = {
|
|
43138
|
+
kind: "collection",
|
|
43139
|
+
document_id: link2.document_id,
|
|
43140
|
+
version_id: link2.version_id,
|
|
43141
|
+
document_title: link2.document_title,
|
|
43142
|
+
version_title: link2.version_title
|
|
43143
|
+
};
|
|
43144
|
+
return link2.pending_version_id ? { state: "undecided", linked_at: link2.linked_at, source: source2, current_id: link2.pending_version_id } : { state: "linked", linked_at: link2.linked_at, source: source2 };
|
|
43145
|
+
}
|
|
43146
|
+
const link = input.source_link;
|
|
43147
|
+
if (link === void 0) return input.dispensation ? { state: "dispensed" } : { state: "unknown" };
|
|
43148
|
+
if (link === null) return unlinked;
|
|
43149
|
+
if (!link.readable) return { state: "unreadable", linked_at: link.linked_at };
|
|
43150
|
+
if (link.kind === "received") {
|
|
43151
|
+
return {
|
|
43152
|
+
state: "linked",
|
|
43153
|
+
linked_at: link.linked_at,
|
|
43154
|
+
source: { kind: "received", received_id: link.received_id, title: link.title, type: link.type, phase_id: link.phase_id }
|
|
43155
|
+
};
|
|
43156
|
+
}
|
|
43157
|
+
const source = {
|
|
43158
|
+
kind: "official_version",
|
|
43159
|
+
official_version_id: link.official_version_id,
|
|
43160
|
+
output_code: link.output_code,
|
|
43161
|
+
phase_id: link.phase_id,
|
|
43162
|
+
version: link.version
|
|
43163
|
+
};
|
|
43164
|
+
return link.current_version_id === link.official_version_id ? { state: "linked", linked_at: link.linked_at, source } : { state: "undecided", linked_at: link.linked_at, source, current_id: link.current_version_id };
|
|
43165
|
+
}
|
|
43166
|
+
function linkCommand(key, folder, origin, id) {
|
|
43167
|
+
const [flag, placeholder] = origin === "previous_output" ? ["--official-version", "<official_version_id>"] : ["--received", "<received_id>"];
|
|
43168
|
+
return `wayai cases link ${one2(key)} --phase ${one2(folder)} ${flag} ${id ?? placeholder}`;
|
|
43169
|
+
}
|
|
43170
|
+
function linkHint(key, folder, origin) {
|
|
43171
|
+
if (origin === "collection") return "a person links it, in the web app";
|
|
43172
|
+
if (origin === "received") {
|
|
43173
|
+
return `link it to a received document of the case: \`${linkCommand(key, folder, origin)}\` (the id is in its files' names under a phase's received/)`;
|
|
43174
|
+
}
|
|
43175
|
+
return `link it to the current official version of an earlier phase's output: \`${linkCommand(key, folder, origin)}\` (no wayai cases command lists those: a person gives you the id, or links it in the web app)`;
|
|
43176
|
+
}
|
|
43177
|
+
function undecidedWords(input, folder, link, folders) {
|
|
43178
|
+
const linked = sourceWords(link.source, folders);
|
|
43179
|
+
if (link.source.kind === "collection") {
|
|
43180
|
+
return { text: `links ${linked}, and a newer version awaits a decision: a person decides on it, in the web app`, agent: false };
|
|
43181
|
+
}
|
|
43182
|
+
if (link.current_id === null) {
|
|
43183
|
+
return { text: `links ${linked}, which a correction superseded by a version not readable here: a person who reads it relinks it`, agent: false };
|
|
43184
|
+
}
|
|
43185
|
+
return {
|
|
43186
|
+
text: `links ${linked}, which a correction superseded: relink it to the current one: \`${linkCommand(input.key, folder, input.origin, link.current_id)}\``,
|
|
43187
|
+
agent: true
|
|
43188
|
+
};
|
|
43189
|
+
}
|
|
43190
|
+
function inputLine(input, folder, folders) {
|
|
43191
|
+
const head = `${one2(input.key)} (${one2(input.name)}), ${input.origin.replaceAll("_", " ")}${input.required ? ", required" : ""}`;
|
|
43192
|
+
const state = inputLinkState(input);
|
|
43193
|
+
switch (state.state) {
|
|
43194
|
+
case "linked":
|
|
43195
|
+
return `${head}: linked to ${sourceWords(state.source, folders)}`;
|
|
43196
|
+
case "undecided":
|
|
43197
|
+
return `${head}: ${undecidedWords(input, folder, state, folders).text}`;
|
|
43198
|
+
case "unreadable":
|
|
43199
|
+
return `${head}: linked, to a source not readable here`;
|
|
43200
|
+
case "dispensed":
|
|
43201
|
+
return `${head}: dispensed`;
|
|
43202
|
+
case "unknown":
|
|
43203
|
+
return `${head}: this server does not say whether it is linked`;
|
|
43204
|
+
case "unlinked":
|
|
43205
|
+
return `${head}: not linked; ${linkHint(input.key, folder, input.origin)}`;
|
|
43206
|
+
}
|
|
43207
|
+
}
|
|
43208
|
+
function findInput(work, phase, name) {
|
|
43209
|
+
const input = work.inputs.find((i) => i.key === name) ?? work.inputs.find((i) => i.id === name);
|
|
43210
|
+
if (input) return input;
|
|
43211
|
+
throw expected(`Phase ${phase.folder} has no input ${JSON.stringify(sanitizeTerminalText(name))} you may read. Its inputs: ${work.inputs.map((i) => one2(i.key)).join(", ") || "none"}.`);
|
|
43212
|
+
}
|
|
43213
|
+
function linkTarget(opts) {
|
|
43214
|
+
if (opts.officialVersion === void 0 === (opts.received === void 0)) {
|
|
43215
|
+
throw expected("link takes one of --official-version <id> (an input of origin previous_output) or --received <id> (an input of origin received).");
|
|
43216
|
+
}
|
|
43217
|
+
if (opts.officialVersion !== void 0) {
|
|
43218
|
+
if (!UUID_RE3.test(opts.officialVersion)) throw expected("--official-version takes an official version's id (a UUID).");
|
|
43219
|
+
return { official_version_id: opts.officialVersion };
|
|
43220
|
+
}
|
|
43221
|
+
if (!UUID_RE3.test(opts.received)) throw expected("--received takes a received document's id (a UUID).");
|
|
43222
|
+
return { received_id: opts.received };
|
|
43223
|
+
}
|
|
43224
|
+
function linkMismatch(input, label3, target) {
|
|
43225
|
+
if (input.origin === "collection") return `The ${label3} links a collection document: a person links it, in the web app.`;
|
|
43226
|
+
const wants = "official_version_id" in target ? "previous_output" : "received";
|
|
43227
|
+
if (input.origin === wants) return null;
|
|
43228
|
+
return input.origin === "previous_output" ? `The ${label3} links an earlier phase's official version: pass --official-version <id>.` : `The ${label3} links a received document of the case: pass --received <id>.`;
|
|
43229
|
+
}
|
|
43230
|
+
function detailOf(err, field) {
|
|
43231
|
+
try {
|
|
43232
|
+
const value = JSON.parse(err.body).details?.[field];
|
|
43233
|
+
return typeof value === "string" || value === null ? value : void 0;
|
|
43234
|
+
} catch {
|
|
43235
|
+
return void 0;
|
|
43236
|
+
}
|
|
43237
|
+
}
|
|
43238
|
+
function linkFailure(err, session, named) {
|
|
43239
|
+
if (!(err instanceof ApiError)) return err;
|
|
43240
|
+
const reason3 = extractApiErrorReason(err);
|
|
43241
|
+
const { label: label3 } = named;
|
|
43242
|
+
if (err.status === 409 && reason3 === CASE_LINK_VERSION_NOT_CURRENT_REASON) {
|
|
43243
|
+
const current = detailOf(err, "current_version_id");
|
|
43244
|
+
return expected(typeof current === "string" && UUID_RE3.test(current) ? `A correction superseded official version ${named.id}: link the current one: \`${linkCommand(named.key, named.folder, named.origin, current)}\`.` : `A correction superseded official version ${named.id}, and the current one is not readable here: a person who reads it links it.`);
|
|
43245
|
+
}
|
|
43246
|
+
if (err.status === 400) {
|
|
43247
|
+
switch (reason3) {
|
|
43248
|
+
case CASE_LINK_OFFICIAL_VERSION_UNKNOWN_REASON:
|
|
43249
|
+
return expected(`The case holds no official version ${named.id} this authorization may read.`);
|
|
43250
|
+
case CASE_LINK_OUTPUT_NOT_PRIOR_REASON:
|
|
43251
|
+
return expected(`Official version ${named.id} is of an output of no phase ${named.folder} depends on: the ${label3} links one of an earlier phase's.`);
|
|
43252
|
+
case CASE_LINK_RECEIVED_UNKNOWN_REASON:
|
|
43253
|
+
return expected(`The case holds no received document ${named.id} this authorization may read.`);
|
|
43254
|
+
case CASE_LINK_DOCUMENT_TYPE_MISMATCH_REASON:
|
|
43255
|
+
return expected(`${named.id} is not of the document type the ${label3} asks for.`);
|
|
43256
|
+
case CASE_CLOSED_REASON:
|
|
43257
|
+
return expected(`Case ${session.connection.code} is closed: it takes no link.`);
|
|
43258
|
+
default:
|
|
43259
|
+
break;
|
|
43260
|
+
}
|
|
43261
|
+
}
|
|
43262
|
+
if (err.status === 403) return expected(`Your access to case ${session.connection.code} does not link its inputs: that takes Edit level.`);
|
|
43263
|
+
return caseCallFailure(err, session.connection, `The ${label3} was not found`);
|
|
43264
|
+
}
|
|
43265
|
+
function passageLines(text5) {
|
|
43266
|
+
const m = /^([1-9][0-9]*)(?:-([1-9][0-9]*))?$/.exec(text5);
|
|
43267
|
+
if (!m) throw expected("cite takes its lines as <start> or <start>-<end> (as 12-18), from 1.");
|
|
43268
|
+
const lines2 = { line_start: Number(m[1]), line_end: Number(m[2] ?? m[1]) };
|
|
43269
|
+
if (lines2.line_end < lines2.line_start) throw expected("cite takes its lines with the last at or after the first.");
|
|
43270
|
+
return lines2;
|
|
43271
|
+
}
|
|
43272
|
+
function passageSource(input, label3) {
|
|
43273
|
+
const state = inputLinkState(input);
|
|
43274
|
+
if (state.state === "unreadable") throw expected(`The ${label3} links a source not readable here: no passage of it can be cited with this authorization.`);
|
|
43275
|
+
if (state.state === "unknown") throw expected(`This server does not say what the ${label3} links: no passage can be cited from here.`);
|
|
43276
|
+
if (state.state !== "linked" && state.state !== "undecided") throw expected(`The ${label3} is not linked: link it first.`);
|
|
43277
|
+
const { source } = state;
|
|
43278
|
+
if (source.kind === "collection") return { document_id: source.document_id, version_id: source.version_id };
|
|
43279
|
+
return source.kind === "official_version" ? { official_version_id: source.official_version_id } : { received_id: source.received_id };
|
|
43280
|
+
}
|
|
43281
|
+
function citeFailure(err, session, named) {
|
|
43282
|
+
if (!(err instanceof ApiError)) return err;
|
|
43283
|
+
const reason3 = extractApiErrorReason(err);
|
|
43284
|
+
if (err.status === 409 && reason3 === CASE_PASSAGE_LINK_CHANGED_REASON) {
|
|
43285
|
+
return expected(`The ${named.label} links another source since it was read: read it again (\`wayai cases explain --phase ${named.folder}\`), then cite.`);
|
|
43286
|
+
}
|
|
43287
|
+
if (err.status === 400) {
|
|
43288
|
+
switch (reason3) {
|
|
43289
|
+
case CASE_PASSAGE_OUT_OF_RANGE_REASON:
|
|
43290
|
+
return expected(`Lines ${named.lines.line_start}-${named.lines.line_end} run past the last line of what the ${named.label} links.`);
|
|
43291
|
+
case CASE_PASSAGE_NO_TEXT_REASON:
|
|
43292
|
+
return expected(`What the ${named.label} links holds no text to cite (a file piece, or a version with none).`);
|
|
43293
|
+
case CASE_CLOSED_REASON:
|
|
43294
|
+
return expected(`Case ${session.connection.code} is closed: it takes no passage.`);
|
|
43295
|
+
default:
|
|
43296
|
+
break;
|
|
43297
|
+
}
|
|
43298
|
+
}
|
|
43299
|
+
if (err.status === 403) return expected(`Your access to case ${session.connection.code} does not cite passages: that takes Edit level.`);
|
|
43300
|
+
return caseCallFailure(err, session.connection, `The ${named.label} was not found`);
|
|
43301
|
+
}
|
|
43302
|
+
var one2, sourceWords;
|
|
43303
|
+
var init_case_inputs = __esm({
|
|
43304
|
+
"src/cases/case-inputs.ts"() {
|
|
43305
|
+
"use strict";
|
|
43306
|
+
init_case_records();
|
|
43307
|
+
init_case_collection_links();
|
|
43308
|
+
init_case_collection_citations();
|
|
43309
|
+
init_api_client();
|
|
43310
|
+
init_errors3();
|
|
43311
|
+
init_expected();
|
|
43312
|
+
init_terminal_output();
|
|
43313
|
+
init_utils();
|
|
43314
|
+
init_case_session();
|
|
43315
|
+
one2 = (value) => sanitizeTerminalText(value).replace(/\s*\n\s*/g, " ");
|
|
43316
|
+
sourceWords = (source, folders) => {
|
|
43317
|
+
const folder = (phaseId) => one2(folders.get(phaseId) ?? phaseId);
|
|
43318
|
+
switch (source.kind) {
|
|
43319
|
+
case "collection":
|
|
43320
|
+
return `version "${one2(source.version_title)}" of document "${one2(source.document_title)}"`;
|
|
43321
|
+
case "official_version":
|
|
43322
|
+
return `version ${source.version} of output ${one2(source.output_code)} (phase ${folder(source.phase_id)}) [${source.official_version_id}]`;
|
|
43323
|
+
case "received":
|
|
43324
|
+
return `received document "${one2(source.title)}" (${one2(source.type)}), registered in ${folder(source.phase_id)} [${source.received_id}]`;
|
|
43325
|
+
}
|
|
43326
|
+
};
|
|
43327
|
+
}
|
|
43328
|
+
});
|
|
43329
|
+
|
|
43330
|
+
// ../../packages/core/dist/contracts/case-input-sources.js
|
|
43331
|
+
var init_case_input_sources = __esm({
|
|
43332
|
+
"../../packages/core/dist/contracts/case-input-sources.js"() {
|
|
43333
|
+
"use strict";
|
|
43334
|
+
init_chunk_Q5LS3FKY();
|
|
43335
|
+
init_chunk_U3L6QR6F();
|
|
43336
|
+
init_chunk_S7UAXLHJ();
|
|
43337
|
+
init_chunk_7TQYAKCB();
|
|
43338
|
+
init_chunk_VROZDNLV();
|
|
43339
|
+
init_chunk_733K4J4G();
|
|
43340
|
+
init_chunk_PFPADFUC();
|
|
43341
|
+
init_chunk_KWRHZBGU();
|
|
43342
|
+
init_chunk_3T3D7LTE();
|
|
43343
|
+
init_chunk_M2T55BV6();
|
|
43344
|
+
init_chunk_VYINA6YP();
|
|
43345
|
+
init_chunk_ZVXO3XL6();
|
|
43346
|
+
init_chunk_FBV7NLKO();
|
|
43347
|
+
init_chunk_WEXVYJ5H();
|
|
43348
|
+
init_chunk_HZ6CADSY();
|
|
43349
|
+
init_chunk_ICYO56QW();
|
|
43350
|
+
init_chunk_WFQDSQJK();
|
|
43351
|
+
init_chunk_ZTNFLGW5();
|
|
43352
|
+
}
|
|
43353
|
+
});
|
|
43354
|
+
|
|
42982
43355
|
// ../../packages/core/dist/contracts/case-notes.js
|
|
42983
43356
|
var init_case_notes = __esm({
|
|
42984
43357
|
"../../packages/core/dist/contracts/case-notes.js"() {
|
|
@@ -43004,7 +43377,7 @@ var init_case_notes = __esm({
|
|
|
43004
43377
|
var init_case_checks = __esm({
|
|
43005
43378
|
"../../packages/core/dist/contracts/case-checks.js"() {
|
|
43006
43379
|
"use strict";
|
|
43007
|
-
|
|
43380
|
+
init_chunk_XPOCPOMA();
|
|
43008
43381
|
init_chunk_5Y2NNQHX();
|
|
43009
43382
|
init_chunk_HZ6CADSY();
|
|
43010
43383
|
}
|
|
@@ -43038,7 +43411,7 @@ function blockerLine(b, names) {
|
|
|
43038
43411
|
case "task_pending":
|
|
43039
43412
|
return `${names.task(b.case_task_id)} is open`;
|
|
43040
43413
|
case "input_pending":
|
|
43041
|
-
return `${names.input(b.input_id)} is neither linked nor dispensed`;
|
|
43414
|
+
return `${names.input(b.input_id)} is neither linked nor dispensed${names.inputHint(b.input_id)}`;
|
|
43042
43415
|
case "agenda_group_pending":
|
|
43043
43416
|
return b.actor === "approver" ? `${names.group(b.agenda_group_id)} awaits approval by its teams` : `${names.group(b.agenda_group_id)} is ${statusWords(b.group_status)}: propose its values; a person at Conduct level sends it`;
|
|
43044
43417
|
case "task_dependency_pending":
|
|
@@ -43047,9 +43420,9 @@ function blockerLine(b, names) {
|
|
|
43047
43420
|
return `something confidential is pending (${b.actor})`;
|
|
43048
43421
|
}
|
|
43049
43422
|
}
|
|
43050
|
-
async function namesFor(session, detail, phaseIds) {
|
|
43423
|
+
async function namesFor(session, detail, phaseIds, opts = {}) {
|
|
43051
43424
|
const names = new CaseNames(session, detail);
|
|
43052
|
-
if (readsWork(detail)) for (const id of phaseIds) await names.readPhase(id);
|
|
43425
|
+
if (readsWork(detail)) for (const id of phaseIds) await names.readPhase(id, opts.agenda ?? true);
|
|
43053
43426
|
return names;
|
|
43054
43427
|
}
|
|
43055
43428
|
function printPhasesView(detail, state) {
|
|
@@ -43079,13 +43452,13 @@ async function caseBrief(session, opts) {
|
|
|
43079
43452
|
console.log(JSON.stringify({ case: detail, state, open_notes: notes }, null, 2));
|
|
43080
43453
|
return;
|
|
43081
43454
|
}
|
|
43082
|
-
const head = `${detail.code}, ${
|
|
43455
|
+
const head = `${detail.code}, ${one3(detail.type_name)} (version ${detail.version})${detail.confidential ? ", confidential" : ""}`;
|
|
43083
43456
|
console.log(head);
|
|
43084
43457
|
if (detail.closure) {
|
|
43085
|
-
console.log(`Closed on ${detail.closure.closed_at}${detail.closure.outcome_name ? `: ${
|
|
43458
|
+
console.log(`Closed on ${detail.closure.closed_at}${detail.closure.outcome_name ? `: ${one3(detail.closure.outcome_name)}` : ""}.`);
|
|
43086
43459
|
}
|
|
43087
|
-
if (detail.owner?.display_name) console.log(`Owner: ${
|
|
43088
|
-
if (detail.parties?.length) console.log(`Parties: ${detail.parties.map((p) => `${
|
|
43460
|
+
if (detail.owner?.display_name) console.log(`Owner: ${one3(detail.owner.display_name)}.`);
|
|
43461
|
+
if (detail.parties?.length) console.log(`Parties: ${detail.parties.map((p) => `${one3(p.role)}: ${one3(p.name)}`).join("; ")}.`);
|
|
43089
43462
|
if (state.view === "phases") {
|
|
43090
43463
|
printPhasesView(detail, state);
|
|
43091
43464
|
return;
|
|
@@ -43105,7 +43478,7 @@ async function caseBrief(session, opts) {
|
|
|
43105
43478
|
console.log(`Open tasks (${open.length}):`);
|
|
43106
43479
|
for (const t of open) {
|
|
43107
43480
|
const st = taskState.get(t.case_task_id);
|
|
43108
|
-
console.log(` ${byId.get(t.phase_id)?.folder ?? ""}: ${
|
|
43481
|
+
console.log(` ${byId.get(t.phase_id)?.folder ?? ""}: ${one3(t.name)}${t.required ? " (required)" : ""}${st?.status === "waiting" ? ", waits for another task" : ""}${st?.late ? ", late" : ""} [${t.case_task_id}]`);
|
|
43109
43482
|
}
|
|
43110
43483
|
}
|
|
43111
43484
|
if (notes.length) {
|
|
@@ -43122,7 +43495,8 @@ async function caseExplain(session, opts) {
|
|
|
43122
43495
|
return;
|
|
43123
43496
|
}
|
|
43124
43497
|
if (opts.json) {
|
|
43125
|
-
|
|
43498
|
+
const inputs2 = asked && readsWork(detail) ? (await namesFor(session, detail, [asked.phase_id], { agenda: false })).phaseInputs.get(asked.phase_id) ?? [] : null;
|
|
43499
|
+
console.log(JSON.stringify({ case: detail, state, ...inputs2 ? { inputs: inputs2.map(inputJson) } : {} }, null, 2));
|
|
43126
43500
|
return;
|
|
43127
43501
|
}
|
|
43128
43502
|
const phases = asked ? state.phases.filter((p) => p.phase_id === asked.phase_id) : state.phases;
|
|
@@ -43145,7 +43519,7 @@ async function caseExplain(session, opts) {
|
|
|
43145
43519
|
const shown4 = fullyNamed.has(p.phase_id) ? p.blockers : p.blockers.filter((b) => b.reason === "phase_dependency_pending" || b.reason === "phase_not_activated");
|
|
43146
43520
|
for (const b of shown4) console.log(` - ${blockerLine(b, names)}`);
|
|
43147
43521
|
const rest = p.blockers.length - shown4.length;
|
|
43148
|
-
if (rest > 0) console.log(` - and ${rest} requirement${rest === 1 ? "" : "s"} of its own (\`wayai cases explain --phase ${
|
|
43522
|
+
if (rest > 0) console.log(` - and ${rest} requirement${rest === 1 ? "" : "s"} of its own (\`wayai cases explain --phase ${one3(names.phaseRow(p.phase_id)?.folder ?? "")}\`)`);
|
|
43149
43523
|
}
|
|
43150
43524
|
const taskPhase = new Map((detail.tasks ?? []).map((t) => [t.case_task_id, t.phase_id]));
|
|
43151
43525
|
const tasks = state.tasks.filter((t) => fullyNamed.has(taskPhase.get(t.case_task_id) ?? ""));
|
|
@@ -43153,12 +43527,19 @@ async function caseExplain(session, opts) {
|
|
|
43153
43527
|
console.log("Open tasks:");
|
|
43154
43528
|
for (const t of tasks) console.log(` ${names.taskName(t.case_task_id)} [${t.case_task_id}]: ${t.blockers.map((b) => blockerLine(b, names)).join("; ")}`);
|
|
43155
43529
|
}
|
|
43530
|
+
const inputs = asked ? names.phaseInputs.get(asked.phase_id) ?? [] : [];
|
|
43531
|
+
if (inputs.length) {
|
|
43532
|
+
console.log(`Inputs of ${asked.folder}:`);
|
|
43533
|
+
const folders = names.folders();
|
|
43534
|
+
for (const i of inputs) console.log(` ${inputLine(i, asked.folder, folders)}`);
|
|
43535
|
+
}
|
|
43156
43536
|
}
|
|
43157
|
-
function agentWork(b) {
|
|
43537
|
+
function agentWork(b, names) {
|
|
43158
43538
|
switch (b.reason) {
|
|
43159
43539
|
case "output_pending":
|
|
43160
43540
|
return b.submission === null;
|
|
43161
43541
|
case "input_pending":
|
|
43542
|
+
return names.inputOrigin(b.input_id) !== "collection";
|
|
43162
43543
|
case "task_pending":
|
|
43163
43544
|
case "publication_pending":
|
|
43164
43545
|
return true;
|
|
@@ -43180,7 +43561,10 @@ async function caseNext(session, opts) {
|
|
|
43180
43561
|
return;
|
|
43181
43562
|
}
|
|
43182
43563
|
const underWay = state.phases.filter((p) => p.status === "in_progress");
|
|
43183
|
-
const notes =
|
|
43564
|
+
const [notes, names] = await Promise.all([
|
|
43565
|
+
readsWork(detail) ? openNotes(session) : [],
|
|
43566
|
+
namesFor(session, detail, underWay.map((p) => p.phase_id), { agenda: !opts.json })
|
|
43567
|
+
]);
|
|
43184
43568
|
const yours = [];
|
|
43185
43569
|
const others = [];
|
|
43186
43570
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -43189,28 +43573,38 @@ async function caseNext(session, opts) {
|
|
|
43189
43573
|
const key = blockerKey(b);
|
|
43190
43574
|
if (key && seen.has(key)) continue;
|
|
43191
43575
|
if (key) seen.add(key);
|
|
43192
|
-
(agentWork(b) ? yours : others).push({ phase_id: p.phase_id, blocker: b });
|
|
43576
|
+
(agentWork(b, names) ? yours : others).push({ phase_id: p.phase_id, blocker: b });
|
|
43193
43577
|
}
|
|
43194
43578
|
}
|
|
43579
|
+
const folders = names.folders();
|
|
43580
|
+
const undecided = underWay.flatMap((p) => (names.phaseInputs.get(p.phase_id) ?? []).flatMap((input) => {
|
|
43581
|
+
const link = inputLinkState(input);
|
|
43582
|
+
if (link.state !== "undecided") return [];
|
|
43583
|
+
const folder = folders.get(p.phase_id) ?? "";
|
|
43584
|
+
return [{ phase_id: p.phase_id, input, ...undecidedWords(input, folder, link, folders) }];
|
|
43585
|
+
}));
|
|
43195
43586
|
if (opts.json) {
|
|
43196
|
-
|
|
43587
|
+
const undecidedJson = undecided.map((u) => ({ phase_id: u.phase_id, ...inputJson(u.input), agent: u.agent }));
|
|
43588
|
+
console.log(JSON.stringify({ to_do: yours, waiting_on_others: others, undecided_inputs: undecidedJson, open_notes: notes }, null, 2));
|
|
43197
43589
|
return;
|
|
43198
43590
|
}
|
|
43199
|
-
const
|
|
43591
|
+
const undecidedLine = (u) => ` ${folders.get(u.phase_id) ?? ""}: ${names.input(u.input.id)} ${u.text}`;
|
|
43200
43592
|
if (underWay.length === 0) console.log(`No phase of ${detail.code} is under way.`);
|
|
43201
|
-
if (yours.length) {
|
|
43593
|
+
if (yours.length || undecided.some((u) => u.agent)) {
|
|
43202
43594
|
console.log("To do:");
|
|
43203
43595
|
for (const { phase_id, blocker } of yours) console.log(` ${names.phaseRow(phase_id)?.folder ?? ""}: ${blockerLine(blocker, names)}`);
|
|
43596
|
+
for (const u of undecided.filter((u2) => u2.agent)) console.log(undecidedLine(u));
|
|
43204
43597
|
}
|
|
43205
43598
|
if (notes.length) {
|
|
43206
43599
|
console.log("Open pending items and next steps:");
|
|
43207
43600
|
for (const n of notes) console.log(` ${noteLine(n)}`);
|
|
43208
43601
|
}
|
|
43209
|
-
if (others.length) {
|
|
43602
|
+
if (others.length || undecided.some((u) => !u.agent)) {
|
|
43210
43603
|
console.log("Waiting on someone else:");
|
|
43211
43604
|
for (const { phase_id, blocker } of others) console.log(` ${names.phaseRow(phase_id)?.folder ?? ""}: ${blockerLine(blocker, names)}`);
|
|
43605
|
+
for (const u of undecided.filter((u2) => !u2.agent)) console.log(undecidedLine(u));
|
|
43212
43606
|
}
|
|
43213
|
-
if (underWay.length && !yours.length && !notes.length && !others.length) console.log("Nothing is pending on the phases under way.");
|
|
43607
|
+
if (underWay.length && !yours.length && !notes.length && !others.length && !undecided.length) console.log("Nothing is pending on the phases under way.");
|
|
43214
43608
|
}
|
|
43215
43609
|
function clonePackageCheck(session) {
|
|
43216
43610
|
const clone = findCaseClone(process.cwd());
|
|
@@ -43232,7 +43626,7 @@ async function caseCheck(session, opts) {
|
|
|
43232
43626
|
const work = (await call2(session, () => session.api.getCasePhaseWork(session.connection, phase.phase_id))).data;
|
|
43233
43627
|
const output = work.outputs.find((o) => o.code === opts.output);
|
|
43234
43628
|
if (!output) {
|
|
43235
|
-
throw expected(`Phase ${phase.folder} has no output ${JSON.stringify(sanitizeTerminalText(opts.output))}. Its outputs: ${work.outputs.map((o) =>
|
|
43629
|
+
throw expected(`Phase ${phase.folder} has no output ${JSON.stringify(sanitizeTerminalText(opts.output))}. Its outputs: ${work.outputs.map((o) => one3(o.code)).join(", ") || "none"}.`);
|
|
43236
43630
|
}
|
|
43237
43631
|
outputId = output.id;
|
|
43238
43632
|
}
|
|
@@ -43248,13 +43642,13 @@ async function caseCheck(session, opts) {
|
|
|
43248
43642
|
const warnings = checks.problems.length - errors;
|
|
43249
43643
|
console.log(`Checks of ${phase.folder}${opts.output ? `, output ${opts.output}` : ""}, over the case's files as WayAI holds them: ${errors} error${errors === 1 ? "" : "s"}, ${warnings} warning${warnings === 1 ? "" : "s"}. A submit now would be ${checks.refused ? "refused" : "accepted by the checks"}.`);
|
|
43250
43644
|
for (const p of checks.problems) {
|
|
43251
|
-
const where = [p.output_code &&
|
|
43252
|
-
const what = p.confidential ? "about something confidential" : [p.subject &&
|
|
43645
|
+
const where = [p.output_code && one3(p.output_code), p.path && `${one3(p.path)}${p.line ? `:${p.line}` : ""}`].filter(Boolean).join(" ");
|
|
43646
|
+
const what = p.confidential ? "about something confidential" : [p.subject && one3(p.subject), p.expected !== null && `expected ${one3(p.expected)}`, p.found !== null && `found ${one3(p.found)}`, p.count !== null && `${p.count}\xD7`].filter(Boolean).join(", ");
|
|
43253
43647
|
console.log(` ${p.severity} ${p.code}${where ? ` [${where}]` : ""}${what ? `: ${what}` : ""}`);
|
|
43254
43648
|
}
|
|
43255
43649
|
if (checks.truncated) console.log(" (more problems were found than one answer carries)");
|
|
43256
43650
|
for (const c of checks.coverage) {
|
|
43257
|
-
console.log(`Coverage of ${
|
|
43651
|
+
console.log(`Coverage of ${one3(c.output_code)}: ${c.ready} of ${c.total} items ready${c.dispensed ? `, ${c.dispensed} dispensed` : ""}.`);
|
|
43258
43652
|
}
|
|
43259
43653
|
if (pkg2) for (const line of packageCheckLines(pkg2, CASE_MIRROR_DIR)) console.log(line);
|
|
43260
43654
|
}
|
|
@@ -43286,7 +43680,7 @@ async function caseDecisions(session, opts) {
|
|
|
43286
43680
|
}
|
|
43287
43681
|
}
|
|
43288
43682
|
for (const r of results) {
|
|
43289
|
-
const listed3 = r.rows.length ? `: ${r.rows.map((d) =>
|
|
43683
|
+
const listed3 = r.rows.length ? `: ${r.rows.map((d) => one3(d.code)).join(", ")}` : ", with its header alone: no decision is approved yet";
|
|
43290
43684
|
console.log(`${r.rel} ${r.outcome === "written" ? "written" : "already up to date"}${listed3}.`);
|
|
43291
43685
|
}
|
|
43292
43686
|
}
|
|
@@ -43305,7 +43699,7 @@ async function caseNote(session, text5, opts) {
|
|
|
43305
43699
|
async function caseNoteDone(session, noteId) {
|
|
43306
43700
|
if (!UUID_RE3.test(noteId)) throw expected("note done takes a note's id, as `wayai cases next` shows it.");
|
|
43307
43701
|
const note = (await call2(session, () => session.api.completeCaseNote(session.connection, noteId), `Note ${noteId} was not found`)).data;
|
|
43308
|
-
console.log(`Done: ${
|
|
43702
|
+
console.log(`Done: ${one3(note.text)}`);
|
|
43309
43703
|
}
|
|
43310
43704
|
function sizeOf(file) {
|
|
43311
43705
|
try {
|
|
@@ -43340,9 +43734,41 @@ async function caseReceivedAdd(session, file, opts) {
|
|
|
43340
43734
|
{ name, bytes },
|
|
43341
43735
|
text5
|
|
43342
43736
|
))).data;
|
|
43343
|
-
console.log(`${
|
|
43737
|
+
console.log(`${one3(received.title)} registered in ${phase.folder}/received/ of ${session.connection.code}: ${received.received_id}`);
|
|
43344
43738
|
if (received.text_origin === "agent") console.log("Its text is marked as converted by an agent, for whoever reviews it.");
|
|
43345
43739
|
}
|
|
43740
|
+
async function locateInput(session, inputName, phaseName) {
|
|
43741
|
+
const phase = findPhase(await loadCase(session), phaseName);
|
|
43742
|
+
const work = (await call2(session, () => session.api.getCasePhaseWork(session.connection, phase.phase_id))).data;
|
|
43743
|
+
const input = findInput(work, phase, inputName);
|
|
43744
|
+
return { phase, input, label: `input ${one3(input.key)} of ${phase.folder}` };
|
|
43745
|
+
}
|
|
43746
|
+
async function caseLink(session, inputName, opts) {
|
|
43747
|
+
const target = linkTarget(opts);
|
|
43748
|
+
const { phase, input, label: label3 } = await locateInput(session, inputName, opts.phase);
|
|
43749
|
+
const mismatch = linkMismatch(input, label3, target);
|
|
43750
|
+
if (mismatch) throw expected(mismatch);
|
|
43751
|
+
const [kind, id] = "official_version_id" in target ? ["official version", target.official_version_id] : ["received document", target.received_id];
|
|
43752
|
+
let linked;
|
|
43753
|
+
try {
|
|
43754
|
+
linked = (await session.api.linkCaseInput(session.connection, input.id, target)).data;
|
|
43755
|
+
} catch (err) {
|
|
43756
|
+
throw linkFailure(err, session, { label: label3, key: input.key, folder: phase.folder, origin: input.origin, id });
|
|
43757
|
+
}
|
|
43758
|
+
console.log(`Linked the ${label3} to ${kind} ${id} (linked since ${linked.linked_at}).`);
|
|
43759
|
+
}
|
|
43760
|
+
async function caseCite(session, inputName, lines2, opts) {
|
|
43761
|
+
const { phase, input, label: label3 } = await locateInput(session, inputName, opts.phase);
|
|
43762
|
+
const parsed = citeCaseInputPassageBody.safeParse({ ...passageSource(input, label3), ...lines2 });
|
|
43763
|
+
if (!parsed.success) throw expected(`The passage is refused: ${parsed.error.issues[0]?.message ?? "not of its shape"}.`);
|
|
43764
|
+
let passage;
|
|
43765
|
+
try {
|
|
43766
|
+
passage = (await session.api.citeCaseInputPassage(session.connection, input.id, parsed.data)).data;
|
|
43767
|
+
} catch (err) {
|
|
43768
|
+
throw citeFailure(err, session, { label: label3, folder: phase.folder, lines: lines2 });
|
|
43769
|
+
}
|
|
43770
|
+
console.log(`Cited lines ${passage.line_start}-${passage.line_end} of what the ${label3} links (SHA-256 ${passage.passage_sha}): ${passage.passage_id}`);
|
|
43771
|
+
}
|
|
43346
43772
|
function markedThroughout(work) {
|
|
43347
43773
|
const rows = [...work.inputs, ...work.items, ...work.items.flatMap((i) => i.item_links.depends_on)];
|
|
43348
43774
|
return rows.every((row) => typeof row.confidential === "boolean");
|
|
@@ -43376,7 +43802,7 @@ async function caseSkeleton(session, clone, opts) {
|
|
|
43376
43802
|
const workItems = opts.confidential ? work.items : work.items.filter((i) => i.confidential !== true);
|
|
43377
43803
|
const outputs = opts.output === void 0 ? work.outputs : work.outputs.filter((o) => o.code === opts.output);
|
|
43378
43804
|
if (opts.output !== void 0 && outputs.length === 0) {
|
|
43379
|
-
throw expected(`Phase ${phase.folder} has no output ${JSON.stringify(sanitizeTerminalText(opts.output))}. Its outputs: ${work.outputs.map((o) =>
|
|
43805
|
+
throw expected(`Phase ${phase.folder} has no output ${JSON.stringify(sanitizeTerminalText(opts.output))}. Its outputs: ${work.outputs.map((o) => one3(o.code)).join(", ") || "none"}.`);
|
|
43380
43806
|
}
|
|
43381
43807
|
const plans = await withMirrorLock(clone.root, async () => {
|
|
43382
43808
|
const pkg2 = deliveredPackage(clone.root, mirror);
|
|
@@ -43391,7 +43817,7 @@ async function caseSkeleton(session, clone, opts) {
|
|
|
43391
43817
|
};
|
|
43392
43818
|
if (!CASE_PHASE_FOLDER_PATTERN.test(phase.folder)) problems2.push(`the phase's folder ${JSON.stringify(sanitizeTerminalText(phase.folder))} is no phase folder`);
|
|
43393
43819
|
const planned = outputs.map((output) => {
|
|
43394
|
-
const code2 =
|
|
43820
|
+
const code2 = one3(output.code);
|
|
43395
43821
|
const bad = output.file_paths.filter((p) => !casePath2(p.endsWith("/") ? `${p}${CASE_COMPOSED_COVER}` : p, false));
|
|
43396
43822
|
for (const p of bad) problems2.push(`output ${code2}: ${JSON.stringify(sanitizeTerminalText(p))} is no path of this phase a document can be written at`);
|
|
43397
43823
|
if (bad.length) return null;
|
|
@@ -43412,7 +43838,7 @@ async function caseSkeleton(session, clone, opts) {
|
|
|
43412
43838
|
const rel = `templates/${phase.folder}/${item.code}.md`;
|
|
43413
43839
|
const file = pkg2.file(rel);
|
|
43414
43840
|
if (file.state !== "unlisted" && file.confidential && !opts.confidential) {
|
|
43415
|
-
problems2.push(`item ${
|
|
43841
|
+
problems2.push(`item ${one3(item.code)} of output ${code2}: its template is confidential, used only with --confidential`);
|
|
43416
43842
|
} else if (file.state === "ok") {
|
|
43417
43843
|
template = file.bytes.toString("utf-8");
|
|
43418
43844
|
} else if (file.state !== "unlisted") {
|
|
@@ -43437,7 +43863,7 @@ async function caseSkeleton(session, clone, opts) {
|
|
|
43437
43863
|
}
|
|
43438
43864
|
return planned.filter((p) => p !== null);
|
|
43439
43865
|
});
|
|
43440
|
-
console.log(`Skeleton of ${phase.folder}${opts.output ? `, output ${
|
|
43866
|
+
console.log(`Skeleton of ${phase.folder}${opts.output ? `, output ${one3(opts.output)}` : ""}:`);
|
|
43441
43867
|
let wrote = false;
|
|
43442
43868
|
for (const plan of plans) {
|
|
43443
43869
|
if ("skipped" in plan) {
|
|
@@ -43454,13 +43880,13 @@ async function caseSkeleton(session, clone, opts) {
|
|
|
43454
43880
|
const chapters = plan.path.endsWith("/") ? `, in ${written.length - 1} chapter${written.length === 2 ? "" : "s"}` : "";
|
|
43455
43881
|
console.log(` ${plan.code}: wrote ${sanitizeTerminalText(plan.path)}, ${plan.items} item${plan.items === 1 ? "" : "s"}${chapters}, ${fills} to fill.`);
|
|
43456
43882
|
for (const f of plan.files.filter((f2) => !written.includes(f2))) console.log(` ${sanitizeTerminalText(f.rel)} appeared while this ran: left as it is.`);
|
|
43457
|
-
if (plan.missing.length) console.log(` Attributes the case holds no value for, left as {{fill: \u2026}}: ${plan.missing.map(
|
|
43883
|
+
if (plan.missing.length) console.log(` Attributes the case holds no value for, left as {{fill: \u2026}}: ${plan.missing.map(one3).join(", ")}.`);
|
|
43458
43884
|
}
|
|
43459
43885
|
if (wrote) console.log("Replace each {{fill: \u2026}} with its text, then push.");
|
|
43460
43886
|
if (!opts.confidential) console.log(`
|
|
43461
43887
|
${SKELETON_CONFIDENTIAL_NOTICE}`);
|
|
43462
43888
|
}
|
|
43463
|
-
var NOTE_PAGES_READ, NOTES_PAGE, AGENDA_PAGES_READ2,
|
|
43889
|
+
var NOTE_PAGES_READ, NOTES_PAGE, AGENDA_PAGES_READ2, one3, loadCase, loadState, phaseLabel, statusWords, CaseNames, AWAITING, readsWork, PHASES_VIEW_NOTE, noteLine, inputJson, blockerKey, SKELETON_CONFIDENTIAL_REQUIRED, SKELETON_CONFIDENTIAL_NOTICE;
|
|
43464
43890
|
var init_case_work = __esm({
|
|
43465
43891
|
"src/cases/case-work.ts"() {
|
|
43466
43892
|
"use strict";
|
|
@@ -43473,6 +43899,8 @@ var init_case_work = __esm({
|
|
|
43473
43899
|
init_case_mirror();
|
|
43474
43900
|
init_case_package();
|
|
43475
43901
|
init_case_skeleton();
|
|
43902
|
+
init_case_inputs();
|
|
43903
|
+
init_case_input_sources();
|
|
43476
43904
|
init_case_item_reader();
|
|
43477
43905
|
init_case_file_paths();
|
|
43478
43906
|
init_case_types();
|
|
@@ -43482,32 +43910,36 @@ var init_case_work = __esm({
|
|
|
43482
43910
|
NOTE_PAGES_READ = 3;
|
|
43483
43911
|
NOTES_PAGE = CASE_NOTES_PAGE_MAX;
|
|
43484
43912
|
AGENDA_PAGES_READ2 = 5;
|
|
43485
|
-
|
|
43913
|
+
one3 = (value) => sanitizeTerminalText(value).replace(/\s*\n\s*/g, " ");
|
|
43486
43914
|
loadCase = async (s) => (await call2(s, () => s.api.getCase(s.connection))).data;
|
|
43487
43915
|
loadState = async (s) => (await call2(s, () => s.api.getCaseState(s.connection))).data;
|
|
43488
|
-
phaseLabel = (p) => `${
|
|
43916
|
+
phaseLabel = (p) => `${one3(p.folder)} (${one3(p.name)})`;
|
|
43489
43917
|
statusWords = (status) => status.replaceAll("_", " ");
|
|
43490
43918
|
CaseNames = class {
|
|
43491
43919
|
constructor(session, detail) {
|
|
43492
43920
|
this.session = session;
|
|
43493
43921
|
this.phases = new Map(detail.phases.map((p) => [p.phase_id, p]));
|
|
43494
|
-
this.tasks = new Map((detail.tasks ?? []).map((t) => [t.case_task_id,
|
|
43922
|
+
this.tasks = new Map((detail.tasks ?? []).map((t) => [t.case_task_id, one3(t.name)]));
|
|
43495
43923
|
}
|
|
43496
43924
|
phases;
|
|
43497
43925
|
tasks;
|
|
43498
43926
|
outputs = /* @__PURE__ */ new Map();
|
|
43499
43927
|
inputs = /* @__PURE__ */ new Map();
|
|
43500
43928
|
groups = /* @__PURE__ */ new Map();
|
|
43501
|
-
/**
|
|
43502
|
-
|
|
43929
|
+
/** Each phase read's inputs, in their order. */
|
|
43930
|
+
phaseInputs = /* @__PURE__ */ new Map();
|
|
43931
|
+
/** Read one phase's outputs and inputs, and (unless `agenda` is false) its agenda groups, to name them. */
|
|
43932
|
+
async readPhase(phaseId, agenda = true) {
|
|
43503
43933
|
const s = this.session;
|
|
43504
43934
|
const work = (await call2(s, () => s.api.getCasePhaseWork(s.connection, phaseId))).data;
|
|
43505
|
-
for (const o of work.outputs) this.outputs.set(o.id, `${
|
|
43506
|
-
|
|
43935
|
+
for (const o of work.outputs) this.outputs.set(o.id, `${one3(o.code)} (${one3(o.document_type)})`);
|
|
43936
|
+
const folder = this.phases.get(phaseId)?.folder ?? "";
|
|
43937
|
+
for (const i of work.inputs) this.inputs.set(i.id, { label: `${one3(i.key)} (${one3(i.name)})`, input: i, folder });
|
|
43938
|
+
this.phaseInputs.set(phaseId, work.inputs);
|
|
43507
43939
|
let cursor;
|
|
43508
|
-
for (let page = 0; page < AGENDA_PAGES_READ2; page++) {
|
|
43940
|
+
for (let page = 0; agenda && page < AGENDA_PAGES_READ2; page++) {
|
|
43509
43941
|
const { groups, next_cursor } = (await call2(s, () => s.api.getCaseAgenda(s.connection, phaseId, cursor))).data;
|
|
43510
|
-
for (const g of groups) this.groups.set(g.agenda_group_id, `${
|
|
43942
|
+
for (const g of groups) this.groups.set(g.agenda_group_id, `${one3(g.code)} (${one3(g.name)})`);
|
|
43511
43943
|
if (!next_cursor) break;
|
|
43512
43944
|
cursor = next_cursor;
|
|
43513
43945
|
}
|
|
@@ -43530,7 +43962,20 @@ var init_case_work = __esm({
|
|
|
43530
43962
|
return this.outputs.has(id) ? `output ${this.outputs.get(id)}` : "an output";
|
|
43531
43963
|
}
|
|
43532
43964
|
input(id) {
|
|
43533
|
-
return this.inputs.has(id) ? `input ${this.inputs.get(id)}` : "an input";
|
|
43965
|
+
return this.inputs.has(id) ? `input ${this.inputs.get(id).label}` : "an input";
|
|
43966
|
+
}
|
|
43967
|
+
/** How an unlinked input is linked (`./case-inputs.ts` `linkHint`), after a colon; nothing for one not read. */
|
|
43968
|
+
inputHint(id) {
|
|
43969
|
+
const named = this.inputs.get(id);
|
|
43970
|
+
return named ? `: ${linkHint(named.input.key, named.folder, named.input.origin)}` : "";
|
|
43971
|
+
}
|
|
43972
|
+
/** An input's origin, or undefined for one not read. */
|
|
43973
|
+
inputOrigin(id) {
|
|
43974
|
+
return this.inputs.get(id)?.input.origin;
|
|
43975
|
+
}
|
|
43976
|
+
/** Each phase's folder, by phase id. */
|
|
43977
|
+
folders() {
|
|
43978
|
+
return new Map([...this.phases].map(([id, p]) => [id, p.folder]));
|
|
43534
43979
|
}
|
|
43535
43980
|
group(id) {
|
|
43536
43981
|
return this.groups.has(id) ? `agenda group ${this.groups.get(id)}` : "an agenda group";
|
|
@@ -43544,7 +43989,8 @@ var init_case_work = __esm({
|
|
|
43544
43989
|
};
|
|
43545
43990
|
readsWork = (detail) => detail.access.capabilities.includes("view_work");
|
|
43546
43991
|
PHASES_VIEW_NOTE = "You see only the phases' status of this case: its work is not yours to read here.";
|
|
43547
|
-
noteLine = (n) => `${n.kind === "pending" ? "pending" : "next step"}: ${
|
|
43992
|
+
noteLine = (n) => `${n.kind === "pending" ? "pending" : "next step"}: ${one3(n.text)} [${n.note_id}]`;
|
|
43993
|
+
inputJson = (i) => ({ input_id: i.id, key: i.key, origin: i.origin, required: i.required, link: inputLinkState(i) });
|
|
43548
43994
|
blockerKey = (b) => {
|
|
43549
43995
|
switch (b.reason) {
|
|
43550
43996
|
case "output_pending":
|
|
@@ -44071,11 +44517,11 @@ async function caseLog(selector, opts) {
|
|
|
44071
44517
|
}
|
|
44072
44518
|
if (shown4.length === 0) console.log(`Case ${safe7(detail.code)} has no revision you read here.`);
|
|
44073
44519
|
for (const r of shown4) {
|
|
44074
|
-
const author = r.author?.display_name ?
|
|
44520
|
+
const author = r.author?.display_name ? one4(r.author.display_name) : "a person no longer named";
|
|
44075
44521
|
console.log(`revision ${r.revision_id} ${r.created_at} ${author} (${r.channel})`);
|
|
44076
|
-
if (r.message !== null) console.log(` ${
|
|
44522
|
+
if (r.message !== null) console.log(` ${one4(r.message)}`);
|
|
44077
44523
|
else console.log(hideMessages ? " (message not shown without --confidential)" : " (message hidden)");
|
|
44078
|
-
if (r.session) console.log(` session: ${
|
|
44524
|
+
if (r.session) console.log(` session: ${one4(r.session)}`);
|
|
44079
44525
|
for (const e of r.entries) console.log(` ${safe7(e.path)}${e.sha === null ? " (removed)" : ""}`);
|
|
44080
44526
|
}
|
|
44081
44527
|
if (more && shown4.length > 0) console.log(`
|
|
@@ -44083,7 +44529,7 @@ Older revisions follow: --limit ${Math.min(LOG_MAX, limit * 2)} shows more.`);
|
|
|
44083
44529
|
if (!opts.confidential) console.log(`
|
|
44084
44530
|
${CONFIDENTIAL_NOTICE}`);
|
|
44085
44531
|
}
|
|
44086
|
-
var THEIRS_SUFFIX, MAX_LIST_PAGES2, LOG_DEFAULT, LOG_MAX, MAX_LOG_PAGES, PART_OVERHEAD_BYTES, CONFIDENTIAL_NOTICE, safe7,
|
|
44532
|
+
var THEIRS_SUFFIX, MAX_LIST_PAGES2, LOG_DEFAULT, LOG_MAX, MAX_LOG_PAGES, PART_OVERHEAD_BYTES, CONFIDENTIAL_NOTICE, safe7, one4, CaseCalls, phaseFoldersOf, isTheirs, recordedFile, PULL_CONFLICT2, inRunOf, PUSH_CONFLICT2;
|
|
44087
44533
|
var init_case_files2 = __esm({
|
|
44088
44534
|
"src/cases/case-files.ts"() {
|
|
44089
44535
|
"use strict";
|
|
@@ -44113,7 +44559,7 @@ var init_case_files2 = __esm({
|
|
|
44113
44559
|
PART_OVERHEAD_BYTES = 512;
|
|
44114
44560
|
CONFIDENTIAL_NOTICE = "Confidential files are left out unless you pass --confidential.";
|
|
44115
44561
|
safe7 = (text5) => sanitizeTerminalText(text5);
|
|
44116
|
-
|
|
44562
|
+
one4 = (text5) => sanitizeTerminalText(text5).replace(/\s*\n\s*/g, " ");
|
|
44117
44563
|
CaseCalls = class {
|
|
44118
44564
|
constructor(session) {
|
|
44119
44565
|
this.session = session;
|
|
@@ -44220,7 +44666,7 @@ async function requireConfidential(session) {
|
|
|
44220
44666
|
const detail = (await call3(session, () => session.api.getCase(session.connection))).data;
|
|
44221
44667
|
if (!detail.access.capabilities.includes("read_confidential")) {
|
|
44222
44668
|
throw expected(
|
|
44223
|
-
`This machine's authorization on case ${
|
|
44669
|
+
`This machine's authorization on case ${one5(detail.code)} does not hold the Confidential right, so --confidential reads nothing more. Run it without --confidential.`
|
|
44224
44670
|
);
|
|
44225
44671
|
}
|
|
44226
44672
|
}
|
|
@@ -44233,7 +44679,7 @@ function block(label3, text5, none) {
|
|
|
44233
44679
|
for (const line of sanitizeTerminalText(text5).split("\n")) console.log(` | ${line}`);
|
|
44234
44680
|
}
|
|
44235
44681
|
function verdictCommand(connection, graph, pair) {
|
|
44236
|
-
return `wayai cases review verdict <${VERDICTS.join("|")}> ${
|
|
44682
|
+
return `wayai cases review verdict <${VERDICTS.join("|")}> ${one5(pair.source)} ${one5(pair.neighbor)} --revision ${one5(graph.revision_id ?? "")} --source-hash ${one5(pair.source_hash)} --neighbor-hash ${one5(pair.neighbor_hash)}${graph.confidential ? " --confidential" : ""} --case ${one5(connection.code)} --org ${one5(connection.org_id)} --space ${one5(connection.space_id)} --reason "<why>"`;
|
|
44237
44683
|
}
|
|
44238
44684
|
async function caseReview(session, opts) {
|
|
44239
44685
|
if (opts.confidential) await requireConfidential(session);
|
|
@@ -44256,15 +44702,15 @@ function printReview(connection, graph) {
|
|
|
44256
44702
|
notice();
|
|
44257
44703
|
return;
|
|
44258
44704
|
}
|
|
44259
|
-
console.log(`Review of case ${code2} at revision ${
|
|
44260
|
-
console.log(graph.base_revision_id ? `Base: revision ${
|
|
44705
|
+
console.log(`Review of case ${code2} at revision ${one5(graph.revision_id)}${graph.confidential ? ", with confidential content" : ""}.`);
|
|
44706
|
+
console.log(graph.base_revision_id ? `Base: revision ${one5(graph.base_revision_id)}. Nothing you read here is pending.` : "Base: each item's own, below. Something you read here is pending.");
|
|
44261
44707
|
const titles = new Map(graph.items.map((item) => [item.key, item.title]));
|
|
44262
44708
|
if (graph.items.length) {
|
|
44263
44709
|
console.log(`
|
|
44264
44710
|
Changed items (${graph.items.length}):`);
|
|
44265
44711
|
for (const item of graph.items) {
|
|
44266
|
-
console.log(` ${
|
|
44267
|
-
if (item.causes.length) console.log(` because: ${item.causes.map(
|
|
44712
|
+
console.log(` ${one5(item.key)}, "${one5(item.title)}" (${item.state}, round ${item.round}), in ${one5(item.path)}${item.base_revision_id ? `, since revision ${one5(item.base_revision_id)}` : ""}`);
|
|
44713
|
+
if (item.causes.length) console.log(` because: ${item.causes.map(one5).join("; ")}`);
|
|
44268
44714
|
block("before", item.before, "not there at its base");
|
|
44269
44715
|
block("now", item.text, "removed");
|
|
44270
44716
|
}
|
|
@@ -44274,8 +44720,8 @@ Changed items (${graph.items.length}):`);
|
|
|
44274
44720
|
Pairs awaiting a verdict (${graph.pairs.length}):`);
|
|
44275
44721
|
for (const pair of graph.pairs) {
|
|
44276
44722
|
const source = titles.get(pair.source);
|
|
44277
|
-
console.log(` ${
|
|
44278
|
-
if (pair.reasons.length) console.log(` connected: ${pair.reasons.map(
|
|
44723
|
+
console.log(` ${one5(pair.source)}${source ? ` "${one5(source)}"` : ""} \u2192 ${one5(pair.neighbor)} "${one5(pair.neighbor_title)}" (round ${pair.round} of ${CASE_REVIEW_ROUNDS_MAX}), in ${one5(pair.path)}`);
|
|
44724
|
+
if (pair.reasons.length) console.log(` connected: ${pair.reasons.map(one5).join("; ")}`);
|
|
44279
44725
|
console.log(` ${verdictCommand(connection, graph, pair)}`);
|
|
44280
44726
|
}
|
|
44281
44727
|
}
|
|
@@ -44283,16 +44729,16 @@ Pairs awaiting a verdict (${graph.pairs.length}):`);
|
|
|
44283
44729
|
console.log(`
|
|
44284
44730
|
Waiting for a change (${graph.waiting.length}):`);
|
|
44285
44731
|
for (const w of graph.waiting) {
|
|
44286
|
-
console.log(` ${
|
|
44287
|
-
console.log(` waits until ${
|
|
44732
|
+
console.log(` ${one5(w.source)} \u2192 ${one5(w.neighbor)} (round ${w.round}): needs a change: ${one5(w.reason)}`);
|
|
44733
|
+
console.log(` waits until ${one5(w.neighbor)} changes`);
|
|
44288
44734
|
}
|
|
44289
44735
|
}
|
|
44290
44736
|
if (graph.stopped.length) {
|
|
44291
44737
|
console.log(`
|
|
44292
44738
|
Stopped chains (${graph.stopped.length}): each took more than ${CASE_REVIEW_ROUNDS_MAX} rounds, so it takes no verdict.`);
|
|
44293
44739
|
for (const s of graph.stopped) {
|
|
44294
|
-
const waiting = s.waiting_sources.length ? `; waiting on it: ${s.waiting_sources.map(
|
|
44295
|
-
console.log(` ${
|
|
44740
|
+
const waiting = s.waiting_sources.length ? `; waiting on it: ${s.waiting_sources.map(one5).join(", ")}` : "";
|
|
44741
|
+
console.log(` ${one5(s.key)}, "${one5(s.title)}" (round ${s.round})${s.base_revision_id ? `, since revision ${one5(s.base_revision_id)}` : ""}${waiting}`);
|
|
44296
44742
|
}
|
|
44297
44743
|
console.log(` ${WEB_ONLY_NOTICE}`);
|
|
44298
44744
|
}
|
|
@@ -44301,8 +44747,8 @@ Stopped chains (${graph.stopped.length}): each took more than ${CASE_REVIEW_ROUN
|
|
|
44301
44747
|
console.log(`
|
|
44302
44748
|
For a person to look at (${warnings.length}):`);
|
|
44303
44749
|
for (const w of warnings) {
|
|
44304
|
-
const where = [w.path &&
|
|
44305
|
-
console.log(` ${WARNINGS[w.code] ??
|
|
44750
|
+
const where = [w.path && one5(w.path), w.subject && one5(w.subject)].filter(Boolean).join(": ");
|
|
44751
|
+
console.log(` ${WARNINGS[w.code] ?? one5(w.code)}${where ? ` [${where}]` : ""}`);
|
|
44306
44752
|
}
|
|
44307
44753
|
}
|
|
44308
44754
|
if (!graph.items.length && !graph.pairs.length && !graph.waiting.length && !graph.stopped.length) console.log("Nothing awaits review.");
|
|
@@ -44349,12 +44795,12 @@ async function caseReviewVerdict(session, body, opts) {
|
|
|
44349
44795
|
console.log(JSON.stringify(review, null, 2));
|
|
44350
44796
|
return;
|
|
44351
44797
|
}
|
|
44352
|
-
console.log(`Recorded ${review.verdict === "needs_change" ? "needs change" : review.verdict} on ${
|
|
44798
|
+
console.log(`Recorded ${review.verdict === "needs_change" ? "needs change" : review.verdict} on ${one5(review.source)} \u2192 ${one5(review.neighbor)}, round ${review.round} of ${CASE_REVIEW_ROUNDS_MAX}${review.confidential ? ", confidential" : ""}: ${review.review_id}`);
|
|
44353
44799
|
if (review.verdict === "needs_change") {
|
|
44354
|
-
console.log(`The pair waits until ${
|
|
44800
|
+
console.log(`The pair waits until ${one5(review.neighbor)} changes: change it, push, then read the review again.`);
|
|
44355
44801
|
}
|
|
44356
44802
|
}
|
|
44357
|
-
var VERDICTS, WEB_ONLY_NOTICE,
|
|
44803
|
+
var VERDICTS, WEB_ONLY_NOTICE, one5, WARNINGS;
|
|
44358
44804
|
var init_case_review2 = __esm({
|
|
44359
44805
|
"src/cases/case-review.ts"() {
|
|
44360
44806
|
"use strict";
|
|
@@ -44367,7 +44813,7 @@ var init_case_review2 = __esm({
|
|
|
44367
44813
|
init_case_review();
|
|
44368
44814
|
VERDICTS = recordCaseItemReviewBody.shape.verdict.options;
|
|
44369
44815
|
WEB_ONLY_NOTICE = "Keep and accepting a stopped chain are a person's, in the WayAI web app (the phase page's review): this CLI offers neither.";
|
|
44370
|
-
|
|
44816
|
+
one5 = (value) => sanitizeTerminalText(value).replace(/\s*\n\s*/g, " ");
|
|
44371
44817
|
WARNINGS = {
|
|
44372
44818
|
outside_item: "text outside any item",
|
|
44373
44819
|
new_document_outside_item: "a new document with text outside any item",
|
|
@@ -44547,6 +44993,22 @@ async function casesCommand(args2) {
|
|
|
44547
44993
|
confidential: values.confidential === true
|
|
44548
44994
|
});
|
|
44549
44995
|
}
|
|
44996
|
+
case "link": {
|
|
44997
|
+
if (operands.length !== 1) throw usageError4("link takes one <input>: its key, as `wayai cases explain --phase <folder>` names it.");
|
|
44998
|
+
if (values.phase === void 0) throw usageError4("link takes --phase <folder>.");
|
|
44999
|
+
linkTarget({ officialVersion: values["official-version"], received: values.received });
|
|
45000
|
+
return caseLink(await openCaseSession(selector), operands[0], {
|
|
45001
|
+
phase: values.phase,
|
|
45002
|
+
officialVersion: values["official-version"],
|
|
45003
|
+
received: values.received
|
|
45004
|
+
});
|
|
45005
|
+
}
|
|
45006
|
+
case "cite": {
|
|
45007
|
+
if (operands.length !== 2) throw usageError4("cite takes <input> and its lines, as <start> or <start>-<end>.");
|
|
45008
|
+
if (values.phase === void 0) throw usageError4("cite takes --phase <folder>.");
|
|
45009
|
+
const lines2 = passageLines(operands[1]);
|
|
45010
|
+
return caseCite(await openCaseSession(selector), operands[0], lines2, { phase: values.phase });
|
|
45011
|
+
}
|
|
44550
45012
|
default:
|
|
44551
45013
|
throw usageError4(`Unknown subcommand ${JSON.stringify(sanitizeTerminalText(name))}.`);
|
|
44552
45014
|
}
|
|
@@ -44730,6 +45192,7 @@ var init_cases = __esm({
|
|
|
44730
45192
|
init_web_origin();
|
|
44731
45193
|
init_case_session();
|
|
44732
45194
|
init_case_work();
|
|
45195
|
+
init_case_inputs();
|
|
44733
45196
|
init_case_files2();
|
|
44734
45197
|
init_case_mirror();
|
|
44735
45198
|
init_case_review2();
|
|
@@ -44774,6 +45237,9 @@ Usage:
|
|
|
44774
45237
|
wayai cases note done <note_id>
|
|
44775
45238
|
wayai cases received add <file> --text <markdown file> --phase <folder> --type <type>
|
|
44776
45239
|
[--title <title>] [--confidential]
|
|
45240
|
+
wayai cases link <input> --phase <folder>
|
|
45241
|
+
--official-version <official_version_id> | --received <received_id>
|
|
45242
|
+
wayai cases cite <input> <start>[-<end>] --phase <folder>
|
|
44777
45243
|
|
|
44778
45244
|
connect Ask to connect this machine to the case, wait while you approve it
|
|
44779
45245
|
in the WayAI web app, then keep the case's token in this machine's
|
|
@@ -44837,9 +45303,11 @@ review verdict Record consistent or needs_change on one pair, with a reason,
|
|
|
44837
45303
|
brief The case at a glance: status, phases under way, deadlines, open
|
|
44838
45304
|
tasks, open pending items and next steps.
|
|
44839
45305
|
next What to do next on the phases under way, then what waits on
|
|
44840
|
-
someone else
|
|
45306
|
+
someone else: an input to link (with the command that links it),
|
|
45307
|
+
and a linked one whose version a newer one replaced.
|
|
44841
45308
|
explain Why each phase and task is not done, and who can move it. --phase
|
|
44842
|
-
names everything holding one phase
|
|
45309
|
+
names everything holding one phase, and each of its inputs'
|
|
45310
|
+
links.
|
|
44843
45311
|
check A delivery's checks over the case's files as WayAI holds them:
|
|
44844
45312
|
a joint phase's, or one output's (--output). Inside a clone, it
|
|
44845
45313
|
also compares the case's package in the mirror with the published
|
|
@@ -44869,6 +45337,15 @@ note done Mark a pending item or next step done.
|
|
|
44869
45337
|
received add Register a document a party sent, in one phase, with its
|
|
44870
45338
|
Markdown text, read from the file --text names. --confidential registers it as
|
|
44871
45339
|
confidential, if the case lets you write one.
|
|
45340
|
+
link Link an input of one phase (its key, as explain --phase names it):
|
|
45341
|
+
one of origin previous_output to an earlier phase's current
|
|
45342
|
+
official version (--official-version), one of origin received to
|
|
45343
|
+
a received document of the case (--received; its id is in its
|
|
45344
|
+
files' names under a phase's received/). A collection input is
|
|
45345
|
+
linked in the web app.
|
|
45346
|
+
cite Cite a passage of what an input links now, by its lines (as
|
|
45347
|
+
12-18, numbered as the mirror's inputs/ texts number them): the
|
|
45348
|
+
case hashes them. Any origin.
|
|
44872
45349
|
|
|
44873
45350
|
The type commands are a space administrator's, with your own sign-in
|
|
44874
45351
|
(\`wayai login\`), never a case token: they write and read a case type as
|
|
@@ -44934,7 +45411,9 @@ need it.
|
|
|
44934
45411
|
"source-hash": { type: "string" },
|
|
44935
45412
|
"neighbor-hash": { type: "string" },
|
|
44936
45413
|
"mark-confidential": { type: "boolean" },
|
|
44937
|
-
"mirror-only": { type: "boolean" }
|
|
45414
|
+
"mirror-only": { type: "boolean" },
|
|
45415
|
+
"official-version": { type: "string" },
|
|
45416
|
+
received: { type: "string" }
|
|
44938
45417
|
};
|
|
44939
45418
|
SELECT = ["case", "org", "space"];
|
|
44940
45419
|
ADMITS = {
|
|
@@ -44950,6 +45429,8 @@ need it.
|
|
|
44950
45429
|
note: [...SELECT, "kind", "phase", "task", "origin"],
|
|
44951
45430
|
"note done": SELECT,
|
|
44952
45431
|
"received add": [...SELECT, "text", "phase", "type", "title", "confidential"],
|
|
45432
|
+
link: [...SELECT, "phase", "official-version", "received"],
|
|
45433
|
+
cite: [...SELECT, "phase"],
|
|
44953
45434
|
clone: [...SELECT, "dir", "confidential"],
|
|
44954
45435
|
// A clone names its case: pull and push take the clone (--dir), never a case.
|
|
44955
45436
|
pull: ["dir", "overwrite", "yes", "confidential", "mirror-only"],
|
|
@@ -45174,51 +45655,51 @@ function partyLine(party) {
|
|
|
45174
45655
|
}
|
|
45175
45656
|
function personsLines(data) {
|
|
45176
45657
|
if (!data.persons) return [];
|
|
45177
|
-
const
|
|
45658
|
+
const lines2 = ["", "Persons each call is for (matched on record types with person entries):"];
|
|
45178
45659
|
for (const persons2 of data.persons) {
|
|
45179
45660
|
const audience = persons2.audience === REKOR_PERSON_AUDIENCE_STAFF ? "a call for team members" : "customer-facing";
|
|
45180
|
-
|
|
45661
|
+
lines2.push(` ${TURN_NAMES[persons2.turn]}: ${audience}${persons2.full_reach ? ", full reach" : ""}`);
|
|
45181
45662
|
if (persons2.parties.length === 0) {
|
|
45182
|
-
|
|
45663
|
+
lines2.push(persons2.agent_all ? " no person; the agent holds $person: every person's records" : " no person; the agent does not hold $person: no person's records");
|
|
45183
45664
|
}
|
|
45184
|
-
for (const party of persons2.parties)
|
|
45665
|
+
for (const party of persons2.parties) lines2.push(` ${partyLine(party)}`);
|
|
45185
45666
|
}
|
|
45186
|
-
|
|
45187
|
-
return
|
|
45667
|
+
lines2.push(" Person entries are matched on calls for team members and customer-facing calls alike; a customer-facing call also reaches only record types with person entries in enforce or marked shared.");
|
|
45668
|
+
return lines2;
|
|
45188
45669
|
}
|
|
45189
45670
|
function formatExplanation(data) {
|
|
45190
|
-
const
|
|
45671
|
+
const lines2 = [];
|
|
45191
45672
|
const who = data.user_id === null ? "no person: the hub's \u2229 the agent's" : `person ${text4(data.user_id)}, ${data.kind ? kindName(data.kind) : "unknown kind"}`;
|
|
45192
|
-
|
|
45193
|
-
if (data.values_hub_id === null)
|
|
45194
|
-
else if (data.values_hub_id !== data.hub_id)
|
|
45673
|
+
lines2.push(`Hub ${text4(data.hub_id)}, agent ${text4(data.agent_id)}, ${who}`);
|
|
45674
|
+
if (data.values_hub_id === null) lines2.push("This preview hub was never published: it has no hub values, so it reaches nothing.");
|
|
45675
|
+
else if (data.values_hub_id !== data.hub_id) lines2.push(`Hub values are those of its production hub ${text4(data.values_hub_id)}.`);
|
|
45195
45676
|
if (data.customer_only) {
|
|
45196
|
-
|
|
45677
|
+
lines2.push("Customer-only: on an agent's call, held only on record types open to customer-facing calls (person rules or shared access). Every other type that enforces a dimension reaches nothing.");
|
|
45197
45678
|
}
|
|
45198
45679
|
if (data.conversations_reach_nothing) {
|
|
45199
|
-
|
|
45680
|
+
lines2.push("This person's own set reaches nothing, whatever the agent: every turn in their conversations, a team member's send or consult there included, reaches nothing either.");
|
|
45200
45681
|
}
|
|
45201
|
-
|
|
45682
|
+
lines2.push("", "Layers, intersected in order:");
|
|
45202
45683
|
const width = Math.max(...data.layers.map((layer) => LAYER_NAMES[layer.layer].length));
|
|
45203
45684
|
for (const layer of data.layers) {
|
|
45204
45685
|
const [first, ...rest] = layerLines(layer.values);
|
|
45205
|
-
|
|
45206
|
-
for (const line of rest)
|
|
45686
|
+
lines2.push(` ${LAYER_NAMES[layer.layer].padEnd(width)} ${first}`);
|
|
45687
|
+
for (const line of rest) lines2.push(` ${"".padEnd(width)} ${line}`);
|
|
45207
45688
|
}
|
|
45208
|
-
|
|
45209
|
-
if (data.dimensions.length === 0)
|
|
45689
|
+
lines2.push("", "Effective set:");
|
|
45690
|
+
if (data.dimensions.length === 0) lines2.push(" no dimension: the set reaches nothing on any scoped record type");
|
|
45210
45691
|
for (const dimension of data.dimensions) {
|
|
45211
|
-
|
|
45692
|
+
lines2.push(` ${text4(dimension.dimension_id)}: read ${list(dimension.read)}; write ${list(dimension.write)}`);
|
|
45212
45693
|
for (const removal of dimension.read_removed) {
|
|
45213
|
-
|
|
45694
|
+
lines2.push(` ${text4(removal.value_id)} not read: removed by ${removal.layers.map((layer) => LAYER_NAMES[layer]).join(", ")}`);
|
|
45214
45695
|
}
|
|
45215
45696
|
for (const removal of dimension.write_removed) {
|
|
45216
|
-
|
|
45697
|
+
lines2.push(` ${text4(removal.value_id)} read, not written: removed by ${removal.layers.map((layer) => LAYER_NAMES[layer]).join(", ")}`);
|
|
45217
45698
|
}
|
|
45218
45699
|
}
|
|
45219
|
-
|
|
45220
|
-
|
|
45221
|
-
return
|
|
45700
|
+
lines2.push("", "This set filters records only on record types a base enforces (x-access in enforce mode).");
|
|
45701
|
+
lines2.push(...personsLines(data));
|
|
45702
|
+
return lines2;
|
|
45222
45703
|
}
|
|
45223
45704
|
function failure3(err) {
|
|
45224
45705
|
if (err instanceof ApiError && err.isExpected) return expected(sanitizeTerminalText(extractApiMessage(err)));
|
|
@@ -48367,17 +48848,17 @@ function formatClientVersion(status) {
|
|
|
48367
48848
|
return withSkill.length <= 64 ? withSkill : cli.slice(0, 64);
|
|
48368
48849
|
}
|
|
48369
48850
|
function buildStaleToolingWarning(status) {
|
|
48370
|
-
const
|
|
48851
|
+
const lines2 = [];
|
|
48371
48852
|
if (status.cli.behind) {
|
|
48372
|
-
|
|
48853
|
+
lines2.push(` CLI ${status.cli.current} \u2192 ${status.cli.latest} (run: wayai update)`);
|
|
48373
48854
|
}
|
|
48374
48855
|
if (status.skill.behind) {
|
|
48375
|
-
|
|
48856
|
+
lines2.push(` Skill ${status.skill.current} \u2192 ${status.skill.latest} (run: npx skills add wayai-pro/wayai-skill -y)`);
|
|
48376
48857
|
}
|
|
48377
|
-
if (
|
|
48858
|
+
if (lines2.length === 0) return null;
|
|
48378
48859
|
return [
|
|
48379
48860
|
"Your WayAI tooling is behind the latest release:",
|
|
48380
|
-
...
|
|
48861
|
+
...lines2,
|
|
48381
48862
|
"",
|
|
48382
48863
|
"A stale CLI or skill is the most common cause of a false bug report \u2014 the issue may",
|
|
48383
48864
|
"already be fixed upstream. Update, then reproduce before reporting."
|