@wayai/cli 0.3.334 → 0.3.335
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 +1368 -900
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -447,11 +447,11 @@ function captureException2(error, context) {
|
|
|
447
447
|
Sentry.captureException(error);
|
|
448
448
|
});
|
|
449
449
|
}
|
|
450
|
-
function addApiBreadcrumb(method,
|
|
450
|
+
function addApiBreadcrumb(method, path51) {
|
|
451
451
|
if (!initialized) return;
|
|
452
452
|
Sentry.addBreadcrumb({
|
|
453
453
|
category: "http",
|
|
454
|
-
message: `${method} ${
|
|
454
|
+
message: `${method} ${path51}`,
|
|
455
455
|
level: "info"
|
|
456
456
|
});
|
|
457
457
|
}
|
|
@@ -867,8 +867,8 @@ var init_ZodError = __esm({
|
|
|
867
867
|
"not_finite"
|
|
868
868
|
]);
|
|
869
869
|
quotelessJson = (obj) => {
|
|
870
|
-
const
|
|
871
|
-
return
|
|
870
|
+
const json2 = JSON.stringify(obj, null, 2);
|
|
871
|
+
return json2.replace(/"([^"]+)":/g, "$1:");
|
|
872
872
|
};
|
|
873
873
|
ZodError = class _ZodError extends Error {
|
|
874
874
|
get errors() {
|
|
@@ -1121,8 +1121,8 @@ var init_parseUtil = __esm({
|
|
|
1121
1121
|
init_errors2();
|
|
1122
1122
|
init_en();
|
|
1123
1123
|
makeIssue = (params) => {
|
|
1124
|
-
const { data, path:
|
|
1125
|
-
const fullPath = [...
|
|
1124
|
+
const { data, path: path51, errorMaps, issueData } = params;
|
|
1125
|
+
const fullPath = [...path51, ...issueData.path || []];
|
|
1126
1126
|
const fullIssue = {
|
|
1127
1127
|
...issueData,
|
|
1128
1128
|
path: fullPath
|
|
@@ -1433,11 +1433,11 @@ var init_types = __esm({
|
|
|
1433
1433
|
init_parseUtil();
|
|
1434
1434
|
init_util();
|
|
1435
1435
|
ParseInputLazyPath = class {
|
|
1436
|
-
constructor(parent, value,
|
|
1436
|
+
constructor(parent, value, path51, key) {
|
|
1437
1437
|
this._cachedPath = [];
|
|
1438
1438
|
this.parent = parent;
|
|
1439
1439
|
this.data = value;
|
|
1440
|
-
this._path =
|
|
1440
|
+
this._path = path51;
|
|
1441
1441
|
this._key = key;
|
|
1442
1442
|
}
|
|
1443
1443
|
get path() {
|
|
@@ -5172,6 +5172,9 @@ function toIso(epochMs) {
|
|
|
5172
5172
|
function fromIso(iso) {
|
|
5173
5173
|
return new Date(iso).getTime();
|
|
5174
5174
|
}
|
|
5175
|
+
function nowIso() {
|
|
5176
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
5177
|
+
}
|
|
5175
5178
|
function isIsoTimestamp(value) {
|
|
5176
5179
|
return typeof value === "string" && ISO_UTC_RE.test(value);
|
|
5177
5180
|
}
|
|
@@ -5189,8 +5192,8 @@ function optionalTrimmedText(max) {
|
|
|
5189
5192
|
}
|
|
5190
5193
|
function jsonLengthOrNull(value) {
|
|
5191
5194
|
try {
|
|
5192
|
-
const
|
|
5193
|
-
return typeof
|
|
5195
|
+
const json2 = JSON.stringify(value);
|
|
5196
|
+
return typeof json2 === "string" ? json2.length : null;
|
|
5194
5197
|
} catch {
|
|
5195
5198
|
return null;
|
|
5196
5199
|
}
|
|
@@ -6327,6 +6330,71 @@ var init_chunk_63UWXV4T = __esm({
|
|
|
6327
6330
|
}
|
|
6328
6331
|
});
|
|
6329
6332
|
|
|
6333
|
+
// ../../packages/core/dist/chunk-S4HVRNEQ.js
|
|
6334
|
+
var PERMISSIONS;
|
|
6335
|
+
var init_chunk_S4HVRNEQ = __esm({
|
|
6336
|
+
"../../packages/core/dist/chunk-S4HVRNEQ.js"() {
|
|
6337
|
+
"use strict";
|
|
6338
|
+
PERMISSIONS = [
|
|
6339
|
+
"hub:read",
|
|
6340
|
+
"hub:write",
|
|
6341
|
+
"hub:admin",
|
|
6342
|
+
"conversation:read",
|
|
6343
|
+
"conversation:write",
|
|
6344
|
+
"analytics:read",
|
|
6345
|
+
"billing:read",
|
|
6346
|
+
"billing:write",
|
|
6347
|
+
"org:read",
|
|
6348
|
+
"org:write",
|
|
6349
|
+
"org:admin",
|
|
6350
|
+
"contacts:write",
|
|
6351
|
+
"platform:admin",
|
|
6352
|
+
"*"
|
|
6353
|
+
];
|
|
6354
|
+
}
|
|
6355
|
+
});
|
|
6356
|
+
|
|
6357
|
+
// ../../packages/core/dist/chunk-WTIGECE5.js
|
|
6358
|
+
var MAX_NAME_LENGTH, MAX_HUBS_PER_GRANT, MAX_HUB_TAGS_PER_GRANT, MAX_GRANTS, permissionEnum, grantScopeSchema, grantSchema, createTokenBody, tokenOrgIdParam;
|
|
6359
|
+
var init_chunk_WTIGECE5 = __esm({
|
|
6360
|
+
"../../packages/core/dist/chunk-WTIGECE5.js"() {
|
|
6361
|
+
"use strict";
|
|
6362
|
+
init_chunk_S4HVRNEQ();
|
|
6363
|
+
init_chunk_HZ6CADSY();
|
|
6364
|
+
init_zod();
|
|
6365
|
+
MAX_NAME_LENGTH = 100;
|
|
6366
|
+
MAX_HUBS_PER_GRANT = 50;
|
|
6367
|
+
MAX_HUB_TAGS_PER_GRANT = 20;
|
|
6368
|
+
MAX_GRANTS = 20;
|
|
6369
|
+
permissionEnum = external_exports.enum(PERMISSIONS).refine(
|
|
6370
|
+
(p) => p !== "platform:admin",
|
|
6371
|
+
{ message: "platform:admin cannot be delegated via token creation" }
|
|
6372
|
+
);
|
|
6373
|
+
grantScopeSchema = external_exports.object({
|
|
6374
|
+
// Required: every token grant must declare its org tenancy. The handler
|
|
6375
|
+
// also strict-checks this as defense-in-depth, but failing at the Zod
|
|
6376
|
+
// boundary keeps the generated client type honest (org_id: string).
|
|
6377
|
+
org_id: external_exports.string().min(1),
|
|
6378
|
+
hubs: external_exports.array(external_exports.string().min(1)).min(1, "Each grant must have scope.hubs as a non-empty array").max(MAX_HUBS_PER_GRANT),
|
|
6379
|
+
hub_tags: external_exports.array(external_exports.string().min(1)).min(1, "scope.hub_tags must be a non-empty array if provided").max(MAX_HUB_TAGS_PER_GRANT).optional(),
|
|
6380
|
+
environments: external_exports.array(external_exports.enum(["production", "preview"])).min(1, "scope.environments must be a non-empty array if provided").optional()
|
|
6381
|
+
}).strict();
|
|
6382
|
+
grantSchema = external_exports.object({
|
|
6383
|
+
scope: grantScopeSchema,
|
|
6384
|
+
permissions: external_exports.array(permissionEnum).min(1, "Each grant must have permissions as a non-empty array")
|
|
6385
|
+
}).strict();
|
|
6386
|
+
createTokenBody = external_exports.object({
|
|
6387
|
+
name: external_exports.string().trim().min(1, "name is required").max(MAX_NAME_LENGTH, `name must be ${MAX_NAME_LENGTH} characters or fewer`),
|
|
6388
|
+
grants: external_exports.array(grantSchema).min(1, "grants must be a non-empty array").max(MAX_GRANTS),
|
|
6389
|
+
expires_at: external_exports.string().datetime({ message: "expires_at must be a valid ISO 8601 date" }).refine(
|
|
6390
|
+
(s) => new Date(s).getTime() > Date.now(),
|
|
6391
|
+
{ message: "expires_at must be in the future" }
|
|
6392
|
+
).optional()
|
|
6393
|
+
});
|
|
6394
|
+
tokenOrgIdParam = external_exports.object({ orgId: uuidSchema });
|
|
6395
|
+
}
|
|
6396
|
+
});
|
|
6397
|
+
|
|
6330
6398
|
// ../../packages/core/dist/chunk-WDAXZDJO.js
|
|
6331
6399
|
var TOOLSET_ANSWER_PERSON_PARTIES, toolsetAnswerPersonSchema, toolsetAnswerPersonsSchema;
|
|
6332
6400
|
var init_chunk_WDAXZDJO = __esm({
|
|
@@ -6414,6 +6482,33 @@ var init_chunk_ZC6YGHNX = __esm({
|
|
|
6414
6482
|
}
|
|
6415
6483
|
});
|
|
6416
6484
|
|
|
6485
|
+
// ../../packages/core/dist/chunk-5DGHIY7L.js
|
|
6486
|
+
var rekorBaseChangeMessageSchema;
|
|
6487
|
+
var init_chunk_5DGHIY7L = __esm({
|
|
6488
|
+
"../../packages/core/dist/chunk-5DGHIY7L.js"() {
|
|
6489
|
+
"use strict";
|
|
6490
|
+
init_zod();
|
|
6491
|
+
rekorBaseChangeMessageSchema = external_exports.object({
|
|
6492
|
+
/** The WayAI org UUID — one id namespace. */
|
|
6493
|
+
org_id: external_exports.string().uuid(),
|
|
6494
|
+
/**
|
|
6495
|
+
* Not a UUID: a preview base id is `{prod_base_id}--{slug}`. Immutable per base — a
|
|
6496
|
+
* preview clone is its OWN base_id — so `(base_id, scope)` keys never collide across
|
|
6497
|
+
* environments. Empty is never a real base id, so it is non-conforming rather than a
|
|
6498
|
+
* frame keyed on nothing.
|
|
6499
|
+
*/
|
|
6500
|
+
base_id: external_exports.string().min(1),
|
|
6501
|
+
/**
|
|
6502
|
+
* Rides along so the client scopes its refetch without a lookup; the inspector scopes
|
|
6503
|
+
* by side.
|
|
6504
|
+
*/
|
|
6505
|
+
environment: external_exports.enum(["production", "preview"]),
|
|
6506
|
+
/** Which pane refetches. `base` covers create/delete/promote/config changes. */
|
|
6507
|
+
scope: external_exports.enum(["records", "record_types", "files", "base"])
|
|
6508
|
+
});
|
|
6509
|
+
}
|
|
6510
|
+
});
|
|
6511
|
+
|
|
6417
6512
|
// ../../packages/core/dist/chunk-5FO3GNKP.js
|
|
6418
6513
|
var DATA_PROXY_MOUNT, DATA_PROXY_PREFIX, BASE_DESTRUCTION_MOUNT, BASE_DESTRUCTION_PREFIX, BASE_DESTRUCTION_CONFIRM_PATH, COMMUNITY_EMAIL_UNSUBSCRIBE_PATH, CONTACT_BOOK_EMAIL_UNSUBSCRIBE_PATH, AUTOMATION_WEBHOOK_MOUNT, MANAGED_AGENTS_WEBHOOK_MOUNT, TELEGRAM_VAULT_WEBHOOK_PATH;
|
|
6419
6514
|
var init_chunk_5FO3GNKP = __esm({
|
|
@@ -6433,8 +6528,8 @@ var init_chunk_5FO3GNKP = __esm({
|
|
|
6433
6528
|
});
|
|
6434
6529
|
|
|
6435
6530
|
// ../../packages/core/dist/chunk-7AYJHO5P.js
|
|
6436
|
-
function matchPath(pattern,
|
|
6437
|
-
const pathSegments2 =
|
|
6531
|
+
function matchPath(pattern, path51) {
|
|
6532
|
+
const pathSegments2 = path51.replace(/\/$/, "").split("/");
|
|
6438
6533
|
const isPrefix = pattern.endsWith("/*");
|
|
6439
6534
|
const patternSegments = (isPrefix ? pattern.slice(0, -2) : pattern).split("/");
|
|
6440
6535
|
if (isPrefix ? pathSegments2.length < patternSegments.length : pathSegments2.length !== patternSegments.length) {
|
|
@@ -6442,19 +6537,19 @@ function matchPath(pattern, path50) {
|
|
|
6442
6537
|
}
|
|
6443
6538
|
return patternSegments.every((segment, i) => segment === "*" ? pathSegments2[i] !== "" : segment === pathSegments2[i]);
|
|
6444
6539
|
}
|
|
6445
|
-
function getEndpointConfig(
|
|
6540
|
+
function getEndpointConfig(path51) {
|
|
6446
6541
|
for (const excluded of EXCLUDED_PATHS) {
|
|
6447
|
-
if (matchPath(excluded,
|
|
6542
|
+
if (matchPath(excluded, path51)) {
|
|
6448
6543
|
return null;
|
|
6449
6544
|
}
|
|
6450
6545
|
}
|
|
6451
|
-
const normalizedPath =
|
|
6546
|
+
const normalizedPath = path51.replace(/\/$/, "");
|
|
6452
6547
|
if (!normalizedPath.endsWith("/*") && Object.prototype.hasOwnProperty.call(ENDPOINT_CONFIGS, normalizedPath)) {
|
|
6453
6548
|
return ENDPOINT_CONFIGS[normalizedPath];
|
|
6454
6549
|
}
|
|
6455
6550
|
const sortedPatterns = Object.keys(ENDPOINT_CONFIGS).sort((a, b) => b.length - a.length);
|
|
6456
6551
|
for (const pattern of sortedPatterns) {
|
|
6457
|
-
if (matchPath(pattern,
|
|
6552
|
+
if (matchPath(pattern, path51)) {
|
|
6458
6553
|
return ENDPOINT_CONFIGS[pattern];
|
|
6459
6554
|
}
|
|
6460
6555
|
}
|
|
@@ -7356,71 +7451,6 @@ var init_chunk_TVUDMGWV = __esm({
|
|
|
7356
7451
|
}
|
|
7357
7452
|
});
|
|
7358
7453
|
|
|
7359
|
-
// ../../packages/core/dist/chunk-S4HVRNEQ.js
|
|
7360
|
-
var PERMISSIONS;
|
|
7361
|
-
var init_chunk_S4HVRNEQ = __esm({
|
|
7362
|
-
"../../packages/core/dist/chunk-S4HVRNEQ.js"() {
|
|
7363
|
-
"use strict";
|
|
7364
|
-
PERMISSIONS = [
|
|
7365
|
-
"hub:read",
|
|
7366
|
-
"hub:write",
|
|
7367
|
-
"hub:admin",
|
|
7368
|
-
"conversation:read",
|
|
7369
|
-
"conversation:write",
|
|
7370
|
-
"analytics:read",
|
|
7371
|
-
"billing:read",
|
|
7372
|
-
"billing:write",
|
|
7373
|
-
"org:read",
|
|
7374
|
-
"org:write",
|
|
7375
|
-
"org:admin",
|
|
7376
|
-
"contacts:write",
|
|
7377
|
-
"platform:admin",
|
|
7378
|
-
"*"
|
|
7379
|
-
];
|
|
7380
|
-
}
|
|
7381
|
-
});
|
|
7382
|
-
|
|
7383
|
-
// ../../packages/core/dist/chunk-WTIGECE5.js
|
|
7384
|
-
var MAX_NAME_LENGTH, MAX_HUBS_PER_GRANT, MAX_HUB_TAGS_PER_GRANT, MAX_GRANTS, permissionEnum, grantScopeSchema, grantSchema, createTokenBody, tokenOrgIdParam;
|
|
7385
|
-
var init_chunk_WTIGECE5 = __esm({
|
|
7386
|
-
"../../packages/core/dist/chunk-WTIGECE5.js"() {
|
|
7387
|
-
"use strict";
|
|
7388
|
-
init_chunk_S4HVRNEQ();
|
|
7389
|
-
init_chunk_HZ6CADSY();
|
|
7390
|
-
init_zod();
|
|
7391
|
-
MAX_NAME_LENGTH = 100;
|
|
7392
|
-
MAX_HUBS_PER_GRANT = 50;
|
|
7393
|
-
MAX_HUB_TAGS_PER_GRANT = 20;
|
|
7394
|
-
MAX_GRANTS = 20;
|
|
7395
|
-
permissionEnum = external_exports.enum(PERMISSIONS).refine(
|
|
7396
|
-
(p) => p !== "platform:admin",
|
|
7397
|
-
{ message: "platform:admin cannot be delegated via token creation" }
|
|
7398
|
-
);
|
|
7399
|
-
grantScopeSchema = external_exports.object({
|
|
7400
|
-
// Required: every token grant must declare its org tenancy. The handler
|
|
7401
|
-
// also strict-checks this as defense-in-depth, but failing at the Zod
|
|
7402
|
-
// boundary keeps the generated client type honest (org_id: string).
|
|
7403
|
-
org_id: external_exports.string().min(1),
|
|
7404
|
-
hubs: external_exports.array(external_exports.string().min(1)).min(1, "Each grant must have scope.hubs as a non-empty array").max(MAX_HUBS_PER_GRANT),
|
|
7405
|
-
hub_tags: external_exports.array(external_exports.string().min(1)).min(1, "scope.hub_tags must be a non-empty array if provided").max(MAX_HUB_TAGS_PER_GRANT).optional(),
|
|
7406
|
-
environments: external_exports.array(external_exports.enum(["production", "preview"])).min(1, "scope.environments must be a non-empty array if provided").optional()
|
|
7407
|
-
}).strict();
|
|
7408
|
-
grantSchema = external_exports.object({
|
|
7409
|
-
scope: grantScopeSchema,
|
|
7410
|
-
permissions: external_exports.array(permissionEnum).min(1, "Each grant must have permissions as a non-empty array")
|
|
7411
|
-
}).strict();
|
|
7412
|
-
createTokenBody = external_exports.object({
|
|
7413
|
-
name: external_exports.string().trim().min(1, "name is required").max(MAX_NAME_LENGTH, `name must be ${MAX_NAME_LENGTH} characters or fewer`),
|
|
7414
|
-
grants: external_exports.array(grantSchema).min(1, "grants must be a non-empty array").max(MAX_GRANTS),
|
|
7415
|
-
expires_at: external_exports.string().datetime({ message: "expires_at must be a valid ISO 8601 date" }).refine(
|
|
7416
|
-
(s) => new Date(s).getTime() > Date.now(),
|
|
7417
|
-
{ message: "expires_at must be in the future" }
|
|
7418
|
-
).optional()
|
|
7419
|
-
});
|
|
7420
|
-
tokenOrgIdParam = external_exports.object({ orgId: uuidSchema });
|
|
7421
|
-
}
|
|
7422
|
-
});
|
|
7423
|
-
|
|
7424
7454
|
// ../../packages/core/dist/chunk-ZVXO3XL6.js
|
|
7425
7455
|
var PEOPLE_CONTACT_PAGE_MAX, PEOPLE_CONTACT_PAGE_DEFAULT, PEOPLE_CONTACT_EMAIL_MAX_LENGTH, peopleUserIdSchema, peopleInviteEmailSchema, peopleContactInviteBody, peopleContactInviteIdParam, peopleContactUserIdParam, peopleContactBlockBody, peopleContactPageQuery, peopleOutgoingInviteSchema, peopleContactPersonSchema, peopleContactSchema, peopleIncomingInviteSchema, peopleBlockedUserSchema;
|
|
7426
7456
|
var init_chunk_ZVXO3XL6 = __esm({
|
|
@@ -7750,30 +7780,32 @@ var init_chunk_MGBAXT5Y = __esm({
|
|
|
7750
7780
|
}
|
|
7751
7781
|
});
|
|
7752
7782
|
|
|
7753
|
-
// ../../packages/core/dist/chunk-
|
|
7754
|
-
var
|
|
7755
|
-
var
|
|
7756
|
-
"../../packages/core/dist/chunk-
|
|
7783
|
+
// ../../packages/core/dist/chunk-YUZFHVB2.js
|
|
7784
|
+
var invitePreviewQuery, inviteRolePreviewResponse, inviteContactPreviewResponse, invitePreviewResponse, inviteUnsubscribeBody;
|
|
7785
|
+
var init_chunk_YUZFHVB2 = __esm({
|
|
7786
|
+
"../../packages/core/dist/chunk-YUZFHVB2.js"() {
|
|
7757
7787
|
"use strict";
|
|
7758
7788
|
init_zod();
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
/**
|
|
7770
|
-
* Rides along so the client scopes its refetch without a lookup; the inspector scopes
|
|
7771
|
-
* by side.
|
|
7772
|
-
*/
|
|
7773
|
-
environment: external_exports.enum(["production", "preview"]),
|
|
7774
|
-
/** Which pane refetches. `base` covers create/delete/promote/config changes. */
|
|
7775
|
-
scope: external_exports.enum(["records", "record_types", "files", "base"])
|
|
7789
|
+
invitePreviewQuery = external_exports.object({
|
|
7790
|
+
token: external_exports.string().min(1).max(2048)
|
|
7791
|
+
});
|
|
7792
|
+
inviteRolePreviewResponse = external_exports.object({
|
|
7793
|
+
inviter_name: external_exports.string(),
|
|
7794
|
+
entity_id: external_exports.string().uuid(),
|
|
7795
|
+
entity_name: external_exports.string(),
|
|
7796
|
+
entity_type: external_exports.enum(["org", "hub"]),
|
|
7797
|
+
role: external_exports.enum(["org_admin", "admin", "team_user", "user"]),
|
|
7798
|
+
expires_at: external_exports.string().datetime()
|
|
7776
7799
|
});
|
|
7800
|
+
inviteContactPreviewResponse = external_exports.object({
|
|
7801
|
+
inviter_name: external_exports.string().nullable(),
|
|
7802
|
+
entity_id: external_exports.string().uuid(),
|
|
7803
|
+
entity_type: external_exports.literal("contact"),
|
|
7804
|
+
role: external_exports.literal("contact"),
|
|
7805
|
+
expires_at: external_exports.string().datetime()
|
|
7806
|
+
});
|
|
7807
|
+
invitePreviewResponse = external_exports.union([inviteRolePreviewResponse, inviteContactPreviewResponse]);
|
|
7808
|
+
inviteUnsubscribeBody = external_exports.object({ token: external_exports.string().min(1).max(256) }).strict();
|
|
7777
7809
|
}
|
|
7778
7810
|
});
|
|
7779
7811
|
|
|
@@ -8057,16 +8089,16 @@ function parseCommunityLessonVideoUrl(url) {
|
|
|
8057
8089
|
const parts = /^https?:\/\/([^/?#]+)([^?#]*)(?:\?([^#]*))?(?:#.*)?$/i.exec(url.trim());
|
|
8058
8090
|
if (!parts) return null;
|
|
8059
8091
|
const host = parts[1].toLowerCase();
|
|
8060
|
-
const
|
|
8092
|
+
const path51 = parts[2] ?? "";
|
|
8061
8093
|
const query = parts[3] ?? "";
|
|
8062
8094
|
let id;
|
|
8063
8095
|
if (host === YOUTU_BE) {
|
|
8064
|
-
id = /^\/([A-Za-z0-9_-]{11})\/?$/.exec(
|
|
8096
|
+
id = /^\/([A-Za-z0-9_-]{11})\/?$/.exec(path51)?.[1];
|
|
8065
8097
|
} else if (YOUTUBE_HOSTS.has(host)) {
|
|
8066
|
-
if (
|
|
8098
|
+
if (path51 === "/watch" || path51 === "/watch/") {
|
|
8067
8099
|
id = query.split("&").find((param) => param.startsWith("v="))?.slice(2);
|
|
8068
8100
|
} else {
|
|
8069
|
-
id = YOUTUBE_ID_PATH.exec(
|
|
8101
|
+
id = YOUTUBE_ID_PATH.exec(path51)?.[1];
|
|
8070
8102
|
}
|
|
8071
8103
|
}
|
|
8072
8104
|
return id !== void 0 && YOUTUBE_ID.test(id) ? { provider: "youtube", id } : null;
|
|
@@ -8264,12 +8296,12 @@ function typeMatches(typeField, allowed) {
|
|
|
8264
8296
|
if (Array.isArray(typeField)) return typeField.every((t) => typeof t === "string" && allowed.has(t));
|
|
8265
8297
|
return false;
|
|
8266
8298
|
}
|
|
8267
|
-
function validateSchema(schema,
|
|
8299
|
+
function validateSchema(schema, path51, errors, opts = {}) {
|
|
8268
8300
|
if (typeof schema === "boolean") return;
|
|
8269
8301
|
const depth = opts.depth ?? 0;
|
|
8270
8302
|
if (depth > MAX_SCHEMA_DEPTH) {
|
|
8271
8303
|
errors.push({
|
|
8272
|
-
path:
|
|
8304
|
+
path: path51 || "<root>",
|
|
8273
8305
|
message: `schema nesting exceeds ${MAX_SCHEMA_DEPTH} levels`,
|
|
8274
8306
|
suggestion: "Flatten the schema; LLM providers reject deeply nested tool input_schemas."
|
|
8275
8307
|
});
|
|
@@ -8277,7 +8309,7 @@ function validateSchema(schema, path50, errors, opts = {}) {
|
|
|
8277
8309
|
}
|
|
8278
8310
|
if (!isRecord(schema)) {
|
|
8279
8311
|
errors.push({
|
|
8280
|
-
path:
|
|
8312
|
+
path: path51,
|
|
8281
8313
|
message: `expected object, got ${schema === null ? "null" : typeof schema}`
|
|
8282
8314
|
});
|
|
8283
8315
|
return;
|
|
@@ -8285,14 +8317,14 @@ function validateSchema(schema, path50, errors, opts = {}) {
|
|
|
8285
8317
|
if (opts.isRoot) {
|
|
8286
8318
|
if ("type" in schema && schema.type !== "object") {
|
|
8287
8319
|
errors.push({
|
|
8288
|
-
path:
|
|
8320
|
+
path: path51 ? `${path51}.type` : "type",
|
|
8289
8321
|
message: `root type must be 'object', got ${JSON.stringify(schema.type)}`,
|
|
8290
8322
|
suggestion: "Tool parameters at the root must be an object: `{ type: 'object', properties: { ... } }`."
|
|
8291
8323
|
});
|
|
8292
8324
|
}
|
|
8293
8325
|
} else if ("type" in schema && !typeMatches(schema.type, ALLOWED_TYPES)) {
|
|
8294
8326
|
errors.push({
|
|
8295
|
-
path: `${
|
|
8327
|
+
path: `${path51}.type`,
|
|
8296
8328
|
message: `type must be one of ${[...ALLOWED_TYPES].join("/")} or an array of those, got ${JSON.stringify(schema.type)}`
|
|
8297
8329
|
});
|
|
8298
8330
|
}
|
|
@@ -8302,25 +8334,25 @@ function validateSchema(schema, path50, errors, opts = {}) {
|
|
|
8302
8334
|
const isPlaceholder = PLACEHOLDER_TOKENS.includes(e);
|
|
8303
8335
|
const isOutcomePlaceholder = e === "[KANBAN_OUTCOME_VALUES]";
|
|
8304
8336
|
errors.push({
|
|
8305
|
-
path: `${
|
|
8337
|
+
path: `${path51}.enum`,
|
|
8306
8338
|
message: `enum must be a non-empty array of primitives, got string ${JSON.stringify(e)}`,
|
|
8307
8339
|
suggestion: isOutcomePlaceholder ? "Declare `outcomes` on the hub's terminal kanban status so the platform can render the placeholder into a valid array; with none configured the platform drops the parameter instead." : isPlaceholder ? "Set `operation: 'update_kanban_status'` on the tool and ensure at least one hub.kanban_status has `allowsAgentUpdate: true` so the platform can render the placeholder into a valid array." : 'Wrap the value in an array: `enum: ["value"]`.'
|
|
8308
8340
|
});
|
|
8309
8341
|
} else if (!Array.isArray(e)) {
|
|
8310
8342
|
errors.push({
|
|
8311
|
-
path: `${
|
|
8343
|
+
path: `${path51}.enum`,
|
|
8312
8344
|
message: `enum must be a non-empty array of primitives, got ${typeof e}`
|
|
8313
8345
|
});
|
|
8314
8346
|
} else if (e.length === 0) {
|
|
8315
8347
|
errors.push({
|
|
8316
|
-
path: `${
|
|
8348
|
+
path: `${path51}.enum`,
|
|
8317
8349
|
message: "enum must not be empty"
|
|
8318
8350
|
});
|
|
8319
8351
|
} else {
|
|
8320
8352
|
for (let i = 0; i < e.length; i++) {
|
|
8321
8353
|
if (!isPrimitive(e[i])) {
|
|
8322
8354
|
errors.push({
|
|
8323
|
-
path: `${
|
|
8355
|
+
path: `${path51}.enum[${i}]`,
|
|
8324
8356
|
message: `enum entry must be a primitive (string/number/boolean/null), got ${typeof e[i]}`
|
|
8325
8357
|
});
|
|
8326
8358
|
}
|
|
@@ -8330,7 +8362,7 @@ function validateSchema(schema, path50, errors, opts = {}) {
|
|
|
8330
8362
|
for (const key of ["exclusiveMinimum", "exclusiveMaximum"]) {
|
|
8331
8363
|
if (key in schema && typeof schema[key] === "boolean") {
|
|
8332
8364
|
errors.push({
|
|
8333
|
-
path: `${
|
|
8365
|
+
path: `${path51}.${key}`,
|
|
8334
8366
|
message: `${key} as boolean is draft-04 syntax; draft 2020-12 requires a numeric value`,
|
|
8335
8367
|
suggestion: `Replace with the numeric bound, e.g. \`${key}: 0\`.`
|
|
8336
8368
|
});
|
|
@@ -8339,45 +8371,45 @@ function validateSchema(schema, path50, errors, opts = {}) {
|
|
|
8339
8371
|
if ("properties" in schema) {
|
|
8340
8372
|
if (!isRecord(schema.properties)) {
|
|
8341
8373
|
errors.push({
|
|
8342
|
-
path: `${
|
|
8374
|
+
path: `${path51}.properties`,
|
|
8343
8375
|
message: `properties must be an object, got ${Array.isArray(schema.properties) ? "array" : typeof schema.properties}`
|
|
8344
8376
|
});
|
|
8345
8377
|
} else {
|
|
8346
8378
|
for (const [propName, propSchema] of Object.entries(schema.properties)) {
|
|
8347
|
-
validateSchema(propSchema, `${
|
|
8379
|
+
validateSchema(propSchema, `${path51}.properties.${propName}`, errors, { depth: depth + 1 });
|
|
8348
8380
|
}
|
|
8349
8381
|
}
|
|
8350
8382
|
}
|
|
8351
8383
|
if (schemaTypeIncludes(schema, "array") && "items" in schema) {
|
|
8352
8384
|
if (Array.isArray(schema.items)) {
|
|
8353
|
-
schema.items.forEach((sub, i) => validateSchema(sub, `${
|
|
8385
|
+
schema.items.forEach((sub, i) => validateSchema(sub, `${path51}.items[${i}]`, errors, { depth: depth + 1 }));
|
|
8354
8386
|
} else {
|
|
8355
|
-
validateSchema(schema.items, `${
|
|
8387
|
+
validateSchema(schema.items, `${path51}.items`, errors, { depth: depth + 1 });
|
|
8356
8388
|
}
|
|
8357
8389
|
}
|
|
8358
8390
|
for (const key of SUBSCHEMA_OBJECT_KEYWORDS) {
|
|
8359
8391
|
if (key in schema && isRecord(schema[key])) {
|
|
8360
|
-
validateSchema(schema[key], `${
|
|
8392
|
+
validateSchema(schema[key], `${path51}.${key}`, errors, { depth: depth + 1 });
|
|
8361
8393
|
}
|
|
8362
8394
|
}
|
|
8363
8395
|
for (const key of SUBSCHEMA_LIST_KEYWORDS) {
|
|
8364
8396
|
const list2 = schema[key];
|
|
8365
8397
|
if (Array.isArray(list2)) {
|
|
8366
|
-
list2.forEach((sub, i) => validateSchema(sub, `${
|
|
8398
|
+
list2.forEach((sub, i) => validateSchema(sub, `${path51}.${key}[${i}]`, errors, { depth: depth + 1 }));
|
|
8367
8399
|
}
|
|
8368
8400
|
}
|
|
8369
8401
|
for (const key of SUBSCHEMA_MAP_KEYWORDS) {
|
|
8370
8402
|
const map = schema[key];
|
|
8371
8403
|
if (isRecord(map)) {
|
|
8372
8404
|
for (const [name, sub] of Object.entries(map)) {
|
|
8373
|
-
validateSchema(sub, `${
|
|
8405
|
+
validateSchema(sub, `${path51}.${key}.${name}`, errors, { depth: depth + 1 });
|
|
8374
8406
|
}
|
|
8375
8407
|
}
|
|
8376
8408
|
}
|
|
8377
8409
|
const reportedPaths = new Set(errors.map((e) => e.path));
|
|
8378
8410
|
for (const [k, v] of Object.entries(schema)) {
|
|
8379
8411
|
if (typeof v !== "string") continue;
|
|
8380
|
-
const fieldPath = `${
|
|
8412
|
+
const fieldPath = `${path51}.${k}`;
|
|
8381
8413
|
if (reportedPaths.has(fieldPath)) continue;
|
|
8382
8414
|
for (const token of PLACEHOLDER_TOKENS) {
|
|
8383
8415
|
if (v === token) {
|
|
@@ -9053,32 +9085,19 @@ var init_chunk_2ZZZHXZR = __esm({
|
|
|
9053
9085
|
}
|
|
9054
9086
|
});
|
|
9055
9087
|
|
|
9056
|
-
// ../../packages/core/dist/chunk-
|
|
9057
|
-
var
|
|
9058
|
-
var
|
|
9059
|
-
"../../packages/core/dist/chunk-
|
|
9088
|
+
// ../../packages/core/dist/chunk-KSTYTQ7I.js
|
|
9089
|
+
var copilotSuggestBody, copilotSuggestResponse;
|
|
9090
|
+
var init_chunk_KSTYTQ7I = __esm({
|
|
9091
|
+
"../../packages/core/dist/chunk-KSTYTQ7I.js"() {
|
|
9060
9092
|
"use strict";
|
|
9061
9093
|
init_zod();
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
});
|
|
9065
|
-
inviteRolePreviewResponse = external_exports.object({
|
|
9066
|
-
inviter_name: external_exports.string(),
|
|
9067
|
-
entity_id: external_exports.string().uuid(),
|
|
9068
|
-
entity_name: external_exports.string(),
|
|
9069
|
-
entity_type: external_exports.enum(["org", "hub"]),
|
|
9070
|
-
role: external_exports.enum(["org_admin", "admin", "team_user", "user"]),
|
|
9071
|
-
expires_at: external_exports.string().datetime()
|
|
9094
|
+
copilotSuggestBody = external_exports.object({
|
|
9095
|
+
hub_id: external_exports.string().uuid()
|
|
9072
9096
|
});
|
|
9073
|
-
|
|
9074
|
-
|
|
9075
|
-
|
|
9076
|
-
entity_type: external_exports.literal("contact"),
|
|
9077
|
-
role: external_exports.literal("contact"),
|
|
9078
|
-
expires_at: external_exports.string().datetime()
|
|
9097
|
+
copilotSuggestResponse = external_exports.object({
|
|
9098
|
+
status: external_exports.enum(["processing", "skipped"]),
|
|
9099
|
+
reason: external_exports.string().optional()
|
|
9079
9100
|
});
|
|
9080
|
-
invitePreviewResponse = external_exports.union([inviteRolePreviewResponse, inviteContactPreviewResponse]);
|
|
9081
|
-
inviteUnsubscribeBody = external_exports.object({ token: external_exports.string().min(1).max(256) }).strict();
|
|
9082
9101
|
}
|
|
9083
9102
|
});
|
|
9084
9103
|
|
|
@@ -12188,9 +12207,9 @@ function monitorRuleActions(monitorConfig) {
|
|
|
12188
12207
|
if (!monitorConfig || typeof monitorConfig !== "object") return [];
|
|
12189
12208
|
const config = monitorConfig;
|
|
12190
12209
|
const found = [];
|
|
12191
|
-
const visit = (action,
|
|
12210
|
+
const visit = (action, path51) => {
|
|
12192
12211
|
if (!action || typeof action !== "object" || Array.isArray(action)) return;
|
|
12193
|
-
found.push({ action, path:
|
|
12212
|
+
found.push({ action, path: path51 });
|
|
12194
12213
|
};
|
|
12195
12214
|
if (Array.isArray(config.rules)) {
|
|
12196
12215
|
config.rules.forEach((rule, index) => {
|
|
@@ -12222,25 +12241,25 @@ function collectMonitorRuleIssues(monitorConfig) {
|
|
|
12222
12241
|
const trigger = resolveMonitorTrigger(monitorConfig);
|
|
12223
12242
|
const kinds = monitorRuleActionKinds(trigger);
|
|
12224
12243
|
const issues = [...callUtteranceRuleIssues(monitorConfig), ...automationGateIssues(monitorConfig)];
|
|
12225
|
-
for (const { action, path:
|
|
12226
|
-
if (trigger === "call_utterance" &&
|
|
12244
|
+
for (const { action, path: path51 } of monitorRuleActions(monitorConfig)) {
|
|
12245
|
+
if (trigger === "call_utterance" && path51[0] === "fallback") continue;
|
|
12227
12246
|
const kind = action.kind;
|
|
12228
12247
|
if (typeof kind === "string" && !kinds.includes(kind)) {
|
|
12229
|
-
issues.push({ path: [...
|
|
12248
|
+
issues.push({ path: [...path51, "kind"], message: monitorActionKindMessage(kind, trigger) });
|
|
12230
12249
|
}
|
|
12231
12250
|
const toolName = action.tool_name;
|
|
12232
12251
|
if (kind === "call_tool" && typeof toolName === "string" && isRefusedNativeToolName(toolName, trigger)) {
|
|
12233
|
-
issues.push({ path: [...
|
|
12252
|
+
issues.push({ path: [...path51, "tool_name"], message: monitorRuleToolNotAllowedMessage(toolName, trigger) });
|
|
12234
12253
|
continue;
|
|
12235
12254
|
}
|
|
12236
12255
|
if (kind === "call_tool" && toolName === INSERT_NOTE_TOOL_NAME) {
|
|
12237
|
-
issues.push(...insertNoteArgumentIssues(action,
|
|
12256
|
+
issues.push(...insertNoteArgumentIssues(action, path51));
|
|
12238
12257
|
}
|
|
12239
12258
|
if (kind === "call_tool" && toolName === RUN_MONITOR_TOOL_NAME) {
|
|
12240
12259
|
const callee = readRunMonitorCallee(action);
|
|
12241
12260
|
if (!callee.ok) {
|
|
12242
12261
|
issues.push({
|
|
12243
|
-
path: [...
|
|
12262
|
+
path: [...path51, "args", "monitor_name"],
|
|
12244
12263
|
message: runMonitorCalleeMessage(callee.reason)
|
|
12245
12264
|
});
|
|
12246
12265
|
}
|
|
@@ -12300,11 +12319,11 @@ function insertNoteTemplateMessage(reason3) {
|
|
|
12300
12319
|
return `insert_note's template is longer than the ${MONITOR_NOTE_TEMPLATE_MAX}-character limit.`;
|
|
12301
12320
|
}
|
|
12302
12321
|
}
|
|
12303
|
-
function insertNoteArgumentIssues(action,
|
|
12322
|
+
function insertNoteArgumentIssues(action, path51) {
|
|
12304
12323
|
const result = readInsertNoteTemplate(action);
|
|
12305
12324
|
if (result.ok) return [];
|
|
12306
12325
|
return [{
|
|
12307
|
-
path: [...
|
|
12326
|
+
path: [...path51, "args", "template"],
|
|
12308
12327
|
message: insertNoteTemplateMessage(result.reason)
|
|
12309
12328
|
}];
|
|
12310
12329
|
}
|
|
@@ -12836,19 +12855,39 @@ var init_chunk_QEEQN2NE = __esm({
|
|
|
12836
12855
|
}
|
|
12837
12856
|
});
|
|
12838
12857
|
|
|
12839
|
-
// ../../packages/core/dist/chunk-
|
|
12840
|
-
var
|
|
12841
|
-
var
|
|
12842
|
-
"../../packages/core/dist/chunk-
|
|
12858
|
+
// ../../packages/core/dist/chunk-5Y2NNQHX.js
|
|
12859
|
+
var CASE_SUBMISSION_ISSUED_KINDS, CASE_SUBMISSION_RENDER_STUCK_MS, CASE_SUBMISSION_MARK_ID_PATTERN, CASE_CORRECTION_REASON_MAX_LENGTH, submitCaseBody, correctCaseSubmissionBody, caseDeliveryQuery;
|
|
12860
|
+
var init_chunk_5Y2NNQHX = __esm({
|
|
12861
|
+
"../../packages/core/dist/chunk-5Y2NNQHX.js"() {
|
|
12843
12862
|
"use strict";
|
|
12863
|
+
init_chunk_HZ6CADSY();
|
|
12844
12864
|
init_zod();
|
|
12845
|
-
|
|
12846
|
-
|
|
12847
|
-
})
|
|
12848
|
-
|
|
12849
|
-
|
|
12850
|
-
|
|
12851
|
-
|
|
12865
|
+
CASE_SUBMISSION_ISSUED_KINDS = ["pdf", "docx", "csv"];
|
|
12866
|
+
CASE_SUBMISSION_RENDER_STUCK_MS = 3 * 60 * 60 * 1e3;
|
|
12867
|
+
CASE_SUBMISSION_MARK_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/[A-Z]{2,6}-[0-9]{4}-[0-9]{4,}\/[0-9]{2}-[a-z0-9-]+\/[a-z0-9]+(?:_[a-z0-9]+)*-v[1-9][0-9]*$/;
|
|
12868
|
+
CASE_CORRECTION_REASON_MAX_LENGTH = 2e3;
|
|
12869
|
+
submitCaseBody = external_exports.object({
|
|
12870
|
+
phase_id: uuidSchema,
|
|
12871
|
+
output_id: uuidSchema.optional()
|
|
12872
|
+
}).strict();
|
|
12873
|
+
correctCaseSubmissionBody = external_exports.object({
|
|
12874
|
+
reason: external_exports.string().trim().min(1).max(CASE_CORRECTION_REASON_MAX_LENGTH)
|
|
12875
|
+
}).strict();
|
|
12876
|
+
caseDeliveryQuery = external_exports.object({
|
|
12877
|
+
output_id: uuidSchema.optional(),
|
|
12878
|
+
submission_id: uuidSchema.optional()
|
|
12879
|
+
}).strict();
|
|
12880
|
+
}
|
|
12881
|
+
});
|
|
12882
|
+
|
|
12883
|
+
// ../../packages/core/dist/chunk-NNC2ZECG.js
|
|
12884
|
+
var caseVerifyQuery;
|
|
12885
|
+
var init_chunk_NNC2ZECG = __esm({
|
|
12886
|
+
"../../packages/core/dist/chunk-NNC2ZECG.js"() {
|
|
12887
|
+
"use strict";
|
|
12888
|
+
init_chunk_5Y2NNQHX();
|
|
12889
|
+
init_zod();
|
|
12890
|
+
caseVerifyQuery = external_exports.object({ id: external_exports.string().regex(CASE_SUBMISSION_MARK_ID_PATTERN) }).strict();
|
|
12852
12891
|
}
|
|
12853
12892
|
});
|
|
12854
12893
|
|
|
@@ -13278,8 +13317,8 @@ function evalInitialStateError(input) {
|
|
|
13278
13317
|
const parsed = evalInitialStateEntry.safeParse(entries[i]);
|
|
13279
13318
|
if (!parsed.success) {
|
|
13280
13319
|
const issue = parsed.error.issues[0];
|
|
13281
|
-
const
|
|
13282
|
-
return `initial_state[${i}].${
|
|
13320
|
+
const path51 = issue?.path.join(".") || "?";
|
|
13321
|
+
return `initial_state[${i}].${path51} is invalid: ${issue?.message ?? "malformed"}`;
|
|
13283
13322
|
}
|
|
13284
13323
|
if (seenSlugs.has(parsed.data.slug)) {
|
|
13285
13324
|
return `initial_state[${i}].slug "${parsed.data.slug}" is declared more than once`;
|
|
@@ -13805,12 +13844,12 @@ function validateFollowupLinks(followups, label3, ctx) {
|
|
|
13805
13844
|
const linkTargets = /* @__PURE__ */ new Set();
|
|
13806
13845
|
followups.forEach((followup, i) => {
|
|
13807
13846
|
const ref = followup?.after_followup_id;
|
|
13808
|
-
const
|
|
13847
|
+
const path51 = ["followups", i, "after_followup_id"];
|
|
13809
13848
|
if (followup?.type !== "inactivity_after_before_event") {
|
|
13810
13849
|
if (ref !== void 0) {
|
|
13811
13850
|
ctx.addIssue({
|
|
13812
13851
|
code: external_exports.ZodIssueCode.custom,
|
|
13813
|
-
path:
|
|
13852
|
+
path: path51,
|
|
13814
13853
|
message: `kanban status ${label3}: after_followup_id is only valid on inactivity_after_before_event followups (this one is ${followup?.type})`
|
|
13815
13854
|
});
|
|
13816
13855
|
}
|
|
@@ -13819,7 +13858,7 @@ function validateFollowupLinks(followups, label3, ctx) {
|
|
|
13819
13858
|
if (ref === void 0) {
|
|
13820
13859
|
ctx.addIssue({
|
|
13821
13860
|
code: external_exports.ZodIssueCode.custom,
|
|
13822
|
-
path:
|
|
13861
|
+
path: path51,
|
|
13823
13862
|
message: `kanban status ${label3}: inactivity_after_before_event requires after_followup_id naming the id of a before_event followup in the same status`
|
|
13824
13863
|
});
|
|
13825
13864
|
return;
|
|
@@ -13829,7 +13868,7 @@ function validateFollowupLinks(followups, label3, ctx) {
|
|
|
13829
13868
|
if (matches.length > 1) {
|
|
13830
13869
|
ctx.addIssue({
|
|
13831
13870
|
code: external_exports.ZodIssueCode.custom,
|
|
13832
|
-
path:
|
|
13871
|
+
path: path51,
|
|
13833
13872
|
message: `kanban status ${label3}: after_followup_id "${ref}" matches ${matches.length} followups \u2014 a link must name exactly one`
|
|
13834
13873
|
});
|
|
13835
13874
|
return;
|
|
@@ -13841,7 +13880,7 @@ function validateFollowupLinks(followups, label3, ctx) {
|
|
|
13841
13880
|
);
|
|
13842
13881
|
ctx.addIssue({
|
|
13843
13882
|
code: external_exports.ZodIssueCode.custom,
|
|
13844
|
-
path:
|
|
13883
|
+
path: path51,
|
|
13845
13884
|
message: hasIdlessBeforeEvent ? `kanban status ${label3}: after_followup_id "${ref}" matches no followup \u2014 a link target must declare an explicit id, and this status has before_event followups without one` : `kanban status ${label3}: after_followup_id "${ref}" matches no followup in this status`
|
|
13846
13885
|
});
|
|
13847
13886
|
return;
|
|
@@ -13849,7 +13888,7 @@ function validateFollowupLinks(followups, label3, ctx) {
|
|
|
13849
13888
|
if (target.type !== "before_event") {
|
|
13850
13889
|
ctx.addIssue({
|
|
13851
13890
|
code: external_exports.ZodIssueCode.custom,
|
|
13852
|
-
path:
|
|
13891
|
+
path: path51,
|
|
13853
13892
|
message: `kanban status ${label3}: after_followup_id "${ref}" points at a ${target.type} followup \u2014 only before_event followups can anchor a chain`
|
|
13854
13893
|
});
|
|
13855
13894
|
}
|
|
@@ -14642,10 +14681,10 @@ function refineHubAsCodePersons(config, ctx) {
|
|
|
14642
14681
|
function refineHubAsCodeEvalAttachments(config, ctx) {
|
|
14643
14682
|
const cfg = config;
|
|
14644
14683
|
const referencedHashes = /* @__PURE__ */ new Set();
|
|
14645
|
-
const addTurnIssue = (
|
|
14684
|
+
const addTurnIssue = (path51, turn, name) => {
|
|
14646
14685
|
const error = evalTurnAttachmentsError(turn);
|
|
14647
14686
|
if (error) {
|
|
14648
|
-
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path:
|
|
14687
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: path51, message: `${name}: ${error}` });
|
|
14649
14688
|
return;
|
|
14650
14689
|
}
|
|
14651
14690
|
for (const hash2 of collectTurnAttachmentHashes(turn)) referencedHashes.add(hash2);
|
|
@@ -14746,17 +14785,17 @@ function refineHubAsCodeCallOpenings(config, ctx) {
|
|
|
14746
14785
|
const agent = entry;
|
|
14747
14786
|
const openings = agent?.call_openings;
|
|
14748
14787
|
if (openings === void 0 || openings === null) return;
|
|
14749
|
-
const
|
|
14788
|
+
const path51 = ["agents", a, "call_openings"];
|
|
14750
14789
|
const name = `agent "${typeof agent?.name === "string" ? agent.name : "<unnamed>"}"`;
|
|
14751
14790
|
if (typeof openings !== "object" || Array.isArray(openings)) {
|
|
14752
|
-
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path:
|
|
14791
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: path51, message: `${name}: call_openings must map a language to an opening` });
|
|
14753
14792
|
return;
|
|
14754
14793
|
}
|
|
14755
14794
|
if (agent?.role !== "pilot_voice" && Object.keys(openings).length > 0) {
|
|
14756
|
-
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path:
|
|
14795
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: path51, message: `${name}: only a pilot_voice agent has call_openings` });
|
|
14757
14796
|
}
|
|
14758
14797
|
for (const [language, raw] of Object.entries(openings)) {
|
|
14759
|
-
const at = [...
|
|
14798
|
+
const at = [...path51, language];
|
|
14760
14799
|
if (!callOpeningLanguage.safeParse(language).success) {
|
|
14761
14800
|
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: at, message: `${name}: call_openings language must be one of ${CALL_OPENING_LANGUAGES.join(", ")}` });
|
|
14762
14801
|
continue;
|
|
@@ -14892,11 +14931,11 @@ function refineHubAsCodeDelegation(config, ctx) {
|
|
|
14892
14931
|
}
|
|
14893
14932
|
}
|
|
14894
14933
|
if (del.context_boundary === void 0) return;
|
|
14895
|
-
const
|
|
14934
|
+
const path51 = ["agents", agentIndex, "tools", "delegation", delIndex, "context_boundary"];
|
|
14896
14935
|
if (del.type !== "hub") {
|
|
14897
14936
|
ctx.addIssue({
|
|
14898
14937
|
code: external_exports.ZodIssueCode.custom,
|
|
14899
|
-
path:
|
|
14938
|
+
path: path51,
|
|
14900
14939
|
message: `context_boundary applies only to \`type: hub\` delegations (got type "${got(del.type)}")`
|
|
14901
14940
|
});
|
|
14902
14941
|
return;
|
|
@@ -14904,18 +14943,18 @@ function refineHubAsCodeDelegation(config, ctx) {
|
|
|
14904
14943
|
if (!CONTEXT_BOUNDARIES.includes(del.context_boundary)) {
|
|
14905
14944
|
ctx.addIssue({
|
|
14906
14945
|
code: external_exports.ZodIssueCode.custom,
|
|
14907
|
-
path:
|
|
14946
|
+
path: path51,
|
|
14908
14947
|
message: `context_boundary must be one of: ${CONTEXT_BOUNDARIES.join(", ")}`
|
|
14909
14948
|
});
|
|
14910
14949
|
}
|
|
14911
14950
|
});
|
|
14912
14951
|
});
|
|
14913
14952
|
}
|
|
14914
|
-
function refuseNonBooleanFlag(ctx, subject, entry, key,
|
|
14953
|
+
function refuseNonBooleanFlag(ctx, subject, entry, key, path51) {
|
|
14915
14954
|
const value = entry[key];
|
|
14916
14955
|
if (value === void 0 || typeof value === "boolean") return;
|
|
14917
14956
|
const shown3 = value === null || typeof value !== "object" ? JSON.stringify(value).slice(0, 40) : Array.isArray(value) ? "a list" : "an object";
|
|
14918
|
-
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: [...
|
|
14957
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: [...path51, key], message: `${subject}: ${key} must be true or false, got ${shown3}` });
|
|
14919
14958
|
}
|
|
14920
14959
|
function refineHubAsCodeFlags(config, ctx) {
|
|
14921
14960
|
const { agents, connections, evals, journeys, teams } = config;
|
|
@@ -15106,11 +15145,11 @@ function pathPastDepth(root, levels) {
|
|
|
15106
15145
|
function refusedNesting(value, at, ctx) {
|
|
15107
15146
|
const past = pathPastDepth(value, MAX_HUB_AS_CODE_DEPTH - at.length);
|
|
15108
15147
|
if (!past) return false;
|
|
15109
|
-
const
|
|
15148
|
+
const path51 = [...at, ...past].slice(0, NAMED_DEPTH_SEGMENTS).map((key) => typeof key === "string" ? key.slice(0, NAMED_DEPTH_KEY_CHARS) : key);
|
|
15110
15149
|
ctx.addIssue({
|
|
15111
15150
|
code: external_exports.ZodIssueCode.custom,
|
|
15112
|
-
path:
|
|
15113
|
-
message: `${fieldName(
|
|
15151
|
+
path: path51,
|
|
15152
|
+
message: `${fieldName(path51)}\u2026 nests deeper than ${MAX_HUB_AS_CODE_DEPTH} levels of arrays and objects`,
|
|
15114
15153
|
fatal: true
|
|
15115
15154
|
});
|
|
15116
15155
|
return true;
|
|
@@ -15127,15 +15166,15 @@ function refusedStringConfigNesting(config, ctx) {
|
|
|
15127
15166
|
}
|
|
15128
15167
|
function refusedUnreadableSection(config, ctx) {
|
|
15129
15168
|
if (!isPlainObject(config)) return false;
|
|
15130
|
-
const refused = (
|
|
15131
|
-
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path:
|
|
15169
|
+
const refused = (path51, must) => {
|
|
15170
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: path51, message: `${fieldName(path51)} must ${must}`, fatal: true });
|
|
15132
15171
|
return true;
|
|
15133
15172
|
};
|
|
15134
|
-
const badList = (value,
|
|
15173
|
+
const badList = (value, path51, reads = {}) => {
|
|
15135
15174
|
if (value === void 0 || value === null && reads.nullSection !== false) return false;
|
|
15136
|
-
if (!Array.isArray(value)) return refused(
|
|
15175
|
+
if (!Array.isArray(value)) return refused(path51, "be an array");
|
|
15137
15176
|
const nullAt = reads.nullEntries ? -1 : value.indexOf(null);
|
|
15138
|
-
return nullAt !== -1 && refused([...
|
|
15177
|
+
return nullAt !== -1 && refused([...path51, nullAt], "not be null");
|
|
15139
15178
|
};
|
|
15140
15179
|
const entries = (section) => Array.isArray(section) ? section : [];
|
|
15141
15180
|
return ["connections", "teams", "evals", "journeys", "agents", "eval_attachment_files", "call_opening_files"].some((section) => badList(config[section], [section])) || isPlainObject(config.hub) && badList(config.hub.tags, ["hub", "tags"], { nullEntries: true }) || [["evals", "history"], ["journeys", "transcript"]].some(([section, turns]) => entries(config[section]).some((entry, index) => isPlainObject(entry) && badList(entry[turns], [section, index, turns], { nullEntries: true }))) || entries(config.agents).some((agent, index) => {
|
|
@@ -15311,7 +15350,7 @@ var init_chunk_EO5MKW7Q = __esm({
|
|
|
15311
15350
|
MAX_HUB_AS_CODE_DEPTH = 128;
|
|
15312
15351
|
NAMED_DEPTH_SEGMENTS = 12;
|
|
15313
15352
|
NAMED_DEPTH_KEY_CHARS = 64;
|
|
15314
|
-
fieldName = (
|
|
15353
|
+
fieldName = (path51) => path51.reduce(
|
|
15315
15354
|
(name, key) => typeof key === "number" ? `${name}[${key}]` : name ? `${name}.${key}` : key,
|
|
15316
15355
|
""
|
|
15317
15356
|
);
|
|
@@ -15524,31 +15563,6 @@ var init_chunk_JDJ4EUOL = __esm({
|
|
|
15524
15563
|
}
|
|
15525
15564
|
});
|
|
15526
15565
|
|
|
15527
|
-
// ../../packages/core/dist/chunk-5Y2NNQHX.js
|
|
15528
|
-
var CASE_SUBMISSION_ISSUED_KINDS, CASE_SUBMISSION_RENDER_STUCK_MS, CASE_SUBMISSION_MARK_ID_PATTERN, CASE_CORRECTION_REASON_MAX_LENGTH, submitCaseBody, correctCaseSubmissionBody, caseDeliveryQuery;
|
|
15529
|
-
var init_chunk_5Y2NNQHX = __esm({
|
|
15530
|
-
"../../packages/core/dist/chunk-5Y2NNQHX.js"() {
|
|
15531
|
-
"use strict";
|
|
15532
|
-
init_chunk_HZ6CADSY();
|
|
15533
|
-
init_zod();
|
|
15534
|
-
CASE_SUBMISSION_ISSUED_KINDS = ["pdf", "docx", "csv"];
|
|
15535
|
-
CASE_SUBMISSION_RENDER_STUCK_MS = 3 * 60 * 60 * 1e3;
|
|
15536
|
-
CASE_SUBMISSION_MARK_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/[A-Z]{2,6}-[0-9]{4}-[0-9]{4,}\/[0-9]{2}-[a-z0-9-]+\/[a-z0-9]+(?:_[a-z0-9]+)*-v[1-9][0-9]*$/;
|
|
15537
|
-
CASE_CORRECTION_REASON_MAX_LENGTH = 2e3;
|
|
15538
|
-
submitCaseBody = external_exports.object({
|
|
15539
|
-
phase_id: uuidSchema,
|
|
15540
|
-
output_id: uuidSchema.optional()
|
|
15541
|
-
}).strict();
|
|
15542
|
-
correctCaseSubmissionBody = external_exports.object({
|
|
15543
|
-
reason: external_exports.string().trim().min(1).max(CASE_CORRECTION_REASON_MAX_LENGTH)
|
|
15544
|
-
}).strict();
|
|
15545
|
-
caseDeliveryQuery = external_exports.object({
|
|
15546
|
-
output_id: uuidSchema.optional(),
|
|
15547
|
-
submission_id: uuidSchema.optional()
|
|
15548
|
-
}).strict();
|
|
15549
|
-
}
|
|
15550
|
-
});
|
|
15551
|
-
|
|
15552
15566
|
// ../../packages/core/dist/chunk-KWRHZBGU.js
|
|
15553
15567
|
function fold(segment) {
|
|
15554
15568
|
return segment.toUpperCase().toLowerCase().replace(/ς/g, "\u03C3").replace(/ß/g, "ss").normalize("NFC");
|
|
@@ -15795,8 +15809,8 @@ var init_chunk_VROZDNLV = __esm({
|
|
|
15795
15809
|
CASE_UPLOADS_BUSY_REASON = "case_uploads_busy";
|
|
15796
15810
|
isBlob = (value) => typeof Blob !== "undefined" && value instanceof Blob;
|
|
15797
15811
|
caseUploadForm = external_exports.record(external_exports.string(), external_exports.unknown()).transform((form2, ctx) => {
|
|
15798
|
-
const refuse2 = (message,
|
|
15799
|
-
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message, path: [
|
|
15812
|
+
const refuse2 = (message, path51) => {
|
|
15813
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message, path: [path51] });
|
|
15800
15814
|
return external_exports.NEVER;
|
|
15801
15815
|
};
|
|
15802
15816
|
const text5 = form2[CASE_UPLOAD_REVISION_FIELD];
|
|
@@ -16005,17 +16019,17 @@ function fixedTextProblem(text5) {
|
|
|
16005
16019
|
}
|
|
16006
16020
|
return null;
|
|
16007
16021
|
}
|
|
16008
|
-
function casePieceSidecar(
|
|
16009
|
-
if (/\.yaml$/i.test(
|
|
16010
|
-
const sidecar =
|
|
16011
|
-
return sidecar ===
|
|
16022
|
+
function casePieceSidecar(path51) {
|
|
16023
|
+
if (/\.yaml$/i.test(path51)) return null;
|
|
16024
|
+
const sidecar = path51.replace(/\.[^./]+$/, ".yaml");
|
|
16025
|
+
return sidecar === path51 ? null : sidecar;
|
|
16012
16026
|
}
|
|
16013
16027
|
function pathsOverlap(a, b) {
|
|
16014
16028
|
return a === b || a.endsWith("/") && b.startsWith(a) || b.endsWith("/") && a.startsWith(b);
|
|
16015
16029
|
}
|
|
16016
|
-
function boundPathKey(
|
|
16017
|
-
const folder =
|
|
16018
|
-
const checked = checkCaseFilePath({ path: folder ? `${
|
|
16030
|
+
function boundPathKey(path51, folders) {
|
|
16031
|
+
const folder = path51.endsWith("/");
|
|
16032
|
+
const checked = checkCaseFilePath({ path: folder ? `${path51}${CHAPTER_PROBE}` : path51, type: "file" }, folders);
|
|
16019
16033
|
if (!checked.ok || checked.received) return null;
|
|
16020
16034
|
return folder ? checked.fold_key.slice(0, -CHAPTER_PROBE.length) : checked.fold_key;
|
|
16021
16035
|
}
|
|
@@ -16068,11 +16082,11 @@ function caseTypeDefinitionProblem(definition) {
|
|
|
16068
16082
|
if (output.format === "file" && output.output_items.length > 0) return problem("file_output_with_items", outputAt);
|
|
16069
16083
|
if (output.format === "file" && output.case_items_allowed) return problem("file_output_with_case_items", outputAt);
|
|
16070
16084
|
if (caseValuesRepeated(output.approving_team_ids)) return problem("approving_team_repeated", outputAt);
|
|
16071
|
-
for (const
|
|
16072
|
-
if (!
|
|
16073
|
-
const key = boundPathKey(
|
|
16085
|
+
for (const path51 of output.file_paths) {
|
|
16086
|
+
if (!path51.startsWith(`${phase.folder}/`)) return problem("file_path_outside_phase", outputAt);
|
|
16087
|
+
const key = boundPathKey(path51, folders);
|
|
16074
16088
|
if (key === null) return problem("file_path_not_writable", outputAt);
|
|
16075
|
-
if (output.format === "file" &&
|
|
16089
|
+
if (output.format === "file" && path51.endsWith("/")) return problem("file_path_folder_for_file", outputAt);
|
|
16076
16090
|
if (paths.some((held) => pathsOverlap(held, key))) return problem("file_path_overlaps", outputAt);
|
|
16077
16091
|
paths.push(key);
|
|
16078
16092
|
}
|
|
@@ -16193,8 +16207,8 @@ var init_chunk_PFPADFUC = __esm({
|
|
|
16193
16207
|
const { folder, code: targetCode } = resolveItemLink("", target);
|
|
16194
16208
|
return (!target.includes("/") || CASE_PHASE_FOLDER_PATTERN.test(folder)) && CASE_CODE_PATTERN.test(targetCode);
|
|
16195
16209
|
}, "An item is named by its code, or by its phase folder and code");
|
|
16196
|
-
filePath = external_exports.string().min(1).max(CASE_FILE_PATH_MAX_LENGTH).refine((
|
|
16197
|
-
const segments = (
|
|
16210
|
+
filePath = external_exports.string().min(1).max(CASE_FILE_PATH_MAX_LENGTH).refine((path51) => {
|
|
16211
|
+
const segments = (path51.endsWith("/") ? path51.slice(0, -1) : path51).split("/");
|
|
16198
16212
|
return segments.length >= 2 && segments.length <= 8 && CASE_PHASE_FOLDER_PATTERN.test(segments[0]) && segments.slice(1).every((segment) => FILE_PATH_SEGMENT_PATTERN.test(segment));
|
|
16199
16213
|
}, "A file path is the phase folder, then letters, digits, dots, dashes and underscores");
|
|
16200
16214
|
caseTypePartyRoleSchema = external_exports.object({
|
|
@@ -16570,14 +16584,22 @@ var init_chunk_M2IF4G6X = __esm({
|
|
|
16570
16584
|
}
|
|
16571
16585
|
});
|
|
16572
16586
|
|
|
16573
|
-
// ../../packages/core/dist/chunk-
|
|
16574
|
-
var
|
|
16575
|
-
var
|
|
16576
|
-
"../../packages/core/dist/chunk-
|
|
16587
|
+
// ../../packages/core/dist/chunk-UOPCLXCU.js
|
|
16588
|
+
var CASE_CHANGE_TOPICS, caseChangedFrameSchema;
|
|
16589
|
+
var init_chunk_UOPCLXCU = __esm({
|
|
16590
|
+
"../../packages/core/dist/chunk-UOPCLXCU.js"() {
|
|
16577
16591
|
"use strict";
|
|
16578
|
-
|
|
16592
|
+
init_chunk_733K4J4G();
|
|
16593
|
+
init_chunk_HZ6CADSY();
|
|
16579
16594
|
init_zod();
|
|
16580
|
-
|
|
16595
|
+
CASE_CHANGE_TOPICS = ["submission", "agenda", "access"];
|
|
16596
|
+
caseChangedFrameSchema = external_exports.object({
|
|
16597
|
+
org_id: uuidSchema,
|
|
16598
|
+
space_id: uuidSchema,
|
|
16599
|
+
/** The case, by its code; null for an `access` change, which names none. */
|
|
16600
|
+
code: caseRecordParam.shape.code.nullable(),
|
|
16601
|
+
topic: external_exports.enum(CASE_CHANGE_TOPICS)
|
|
16602
|
+
}).strict();
|
|
16581
16603
|
}
|
|
16582
16604
|
});
|
|
16583
16605
|
|
|
@@ -16622,7 +16644,7 @@ var init_chunk_U3X3BIQH = __esm({
|
|
|
16622
16644
|
}
|
|
16623
16645
|
});
|
|
16624
16646
|
|
|
16625
|
-
// ../../packages/core/dist/chunk-
|
|
16647
|
+
// ../../packages/core/dist/chunk-EYOBPUDN.js
|
|
16626
16648
|
function withProblem(shape, problemOf) {
|
|
16627
16649
|
return shape.superRefine((value, ctx) => {
|
|
16628
16650
|
const found = problemOf(value);
|
|
@@ -16659,8 +16681,8 @@ ${party.role}`);
|
|
|
16659
16681
|
return new Set(keys).size === keys.length ? null : { reason: "instrument_party_repeated", at: "parties" };
|
|
16660
16682
|
}
|
|
16661
16683
|
var CASE_REGISTRY_TYPE_CODE_PATTERN, CASE_REGISTRY_TYPE_CODE_MAX_LENGTH, CASE_REGISTRY_NAME_MAX_LENGTH, CASE_REGISTRY_TYPE_SCHEMA_MAX_CHARS, CASE_PARTY_ABBREVIATION_PATTERN, CASE_PARTY_PERSON_KINDS, CASE_PARTY_DOCUMENT_KINDS, CASE_PARTY_DOCUMENT_MAX_LENGTH, CASE_PARTY_GROUP_MEMBERS_MAX, CASE_INSTRUMENT_NUMBER_MAX_LENGTH, CASE_INSTRUMENT_ROLE_MAX_LENGTH, CASE_INSTRUMENT_PARTIES_MAX, CASE_REGISTRY_PAGE_MAX, CASE_REGISTRY_QUERY_MAX_LENGTH, trimmedName, dateSchema, attributesValues, registryTypeFields, createCaseRegistryTypeShape, updateCaseRegistryTypeShape, createCaseRegistryTypeBody, updateCaseRegistryTypeBody, saveCasePartyShape, saveCasePartyBody, saveCasePartyGroupShape, saveCasePartyGroupBody, caseInstrumentPartyInput, saveCaseInstrumentShape, saveCaseInstrumentBody, registryPage, searchText, casePartiesQuery, casePartyGroupsQuery, caseInstrumentsQuery, caseRegistryTypeParam, casePartyParam, casePartyGroupParam, caseInstrumentParam;
|
|
16662
|
-
var
|
|
16663
|
-
"../../packages/core/dist/chunk-
|
|
16684
|
+
var init_chunk_EYOBPUDN = __esm({
|
|
16685
|
+
"../../packages/core/dist/chunk-EYOBPUDN.js"() {
|
|
16664
16686
|
"use strict";
|
|
16665
16687
|
init_chunk_3T3D7LTE();
|
|
16666
16688
|
init_chunk_M2T55BV6();
|
|
@@ -16754,11 +16776,11 @@ var init_chunk_3LMWOJQX = __esm({
|
|
|
16754
16776
|
}
|
|
16755
16777
|
});
|
|
16756
16778
|
|
|
16757
|
-
// ../../packages/core/dist/chunk-
|
|
16779
|
+
// ../../packages/core/dist/chunk-6CHDJVQ6.js
|
|
16758
16780
|
function collectionUploadForm(field, shape) {
|
|
16759
16781
|
return external_exports.record(external_exports.string(), external_exports.unknown()).transform((form2, ctx) => {
|
|
16760
|
-
const refuse2 = (message,
|
|
16761
|
-
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message, path: [
|
|
16782
|
+
const refuse2 = (message, path51) => {
|
|
16783
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message, path: [path51] });
|
|
16762
16784
|
return external_exports.NEVER;
|
|
16763
16785
|
};
|
|
16764
16786
|
const text5 = form2[field];
|
|
@@ -16794,11 +16816,11 @@ function caseCollectionFileName(sent) {
|
|
|
16794
16816
|
return name || "document";
|
|
16795
16817
|
}
|
|
16796
16818
|
var CASE_COLLECTION_FOLDERS, CASE_COLLECTION_PARTS, isCaseCollectionPart, CASE_COLLECTION_TITLE_MAX_LENGTH, CASE_COLLECTION_TYPE_MAX_LENGTH, CASE_COLLECTION_REASON_MAX_LENGTH, CASE_COLLECTION_FILE_NAME_MAX_LENGTH, caseCollectionDocumentParam, dateOnly, title, registerCaseCollectionDocumentShape, addCaseCollectionVersionShape, CASE_COLLECTION_UPLOAD_BODY_MAX_BYTES, CASE_COLLECTION_DOCUMENT_FIELD, CASE_COLLECTION_VERSION_FIELD, caseCollectionDocumentUploadForm, caseCollectionVersionUploadForm, CASE_COLLECTION_PAGE_MAX, CASE_COLLECTION_CURSOR_MAX_LENGTH, caseCollectionQuery, CASE_COLLECTION_VERSIONS_PAGE_MAX, caseCollectionVersionsQuery, caseCollectionContentQuery;
|
|
16797
|
-
var
|
|
16798
|
-
"../../packages/core/dist/chunk-
|
|
16819
|
+
var init_chunk_6CHDJVQ6 = __esm({
|
|
16820
|
+
"../../packages/core/dist/chunk-6CHDJVQ6.js"() {
|
|
16799
16821
|
"use strict";
|
|
16800
16822
|
init_chunk_U3X3BIQH();
|
|
16801
|
-
|
|
16823
|
+
init_chunk_EYOBPUDN();
|
|
16802
16824
|
init_chunk_VROZDNLV();
|
|
16803
16825
|
init_chunk_3T3D7LTE();
|
|
16804
16826
|
init_chunk_M2T55BV6();
|
|
@@ -16860,7 +16882,7 @@ var init_chunk_PMBOHJKA = __esm({
|
|
|
16860
16882
|
}
|
|
16861
16883
|
});
|
|
16862
16884
|
|
|
16863
|
-
// ../../packages/core/dist/chunk-
|
|
16885
|
+
// ../../packages/core/dist/chunk-WYCUCSD5.js
|
|
16864
16886
|
function caseReceivedFormat(fileName) {
|
|
16865
16887
|
const dot = fileName.lastIndexOf(".");
|
|
16866
16888
|
if (dot < 0) return null;
|
|
@@ -16868,10 +16890,10 @@ function caseReceivedFormat(fileName) {
|
|
|
16868
16890
|
return isCaseReceivedFormat(extension) ? extension : null;
|
|
16869
16891
|
}
|
|
16870
16892
|
var ZIP_SIGNATURE, CASE_RECEIVED_FORMATS, isCaseReceivedFormat, CASE_RECEIVED_PARTS, CASE_RECEIVED_TITLE_MAX_LENGTH, CASE_RECEIVED_TYPE_MAX_LENGTH, CASE_RECEIVED_TEXT_MAX_BYTES, CASE_RECEIVED_UPLOAD_BODY_MAX_BYTES, CASE_RECEIVED_DOCUMENT_FIELD, caseReceivedParam, registerCaseReceivedDocumentShape, caseReceivedUploadForm, caseReceivedFileName, ZIP_DIRECTORY_MAX_BYTES, CONTENT_TYPES_MAX_BYTES, CONTENT_TYPES_INFLATED_MAX_BYTES, CASE_RECEIVED_PAGE_MAX, caseReceivedQuery, caseReceivedContentQuery;
|
|
16871
|
-
var
|
|
16872
|
-
"../../packages/core/dist/chunk-
|
|
16893
|
+
var init_chunk_WYCUCSD5 = __esm({
|
|
16894
|
+
"../../packages/core/dist/chunk-WYCUCSD5.js"() {
|
|
16873
16895
|
"use strict";
|
|
16874
|
-
|
|
16896
|
+
init_chunk_6CHDJVQ6();
|
|
16875
16897
|
init_chunk_U3X3BIQH();
|
|
16876
16898
|
init_chunk_VROZDNLV();
|
|
16877
16899
|
init_chunk_733K4J4G();
|
|
@@ -16909,8 +16931,8 @@ var init_chunk_ZB7W3DKK = __esm({
|
|
|
16909
16931
|
confidential: external_exports.boolean().default(false)
|
|
16910
16932
|
}).strict();
|
|
16911
16933
|
caseReceivedUploadForm = external_exports.record(external_exports.string(), external_exports.unknown()).transform((form2, ctx) => {
|
|
16912
|
-
const refuse2 = (message,
|
|
16913
|
-
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message, path: [
|
|
16934
|
+
const refuse2 = (message, path51) => {
|
|
16935
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message, path: [path51] });
|
|
16914
16936
|
return external_exports.NEVER;
|
|
16915
16937
|
};
|
|
16916
16938
|
const text5 = form2[CASE_RECEIVED_DOCUMENT_FIELD];
|
|
@@ -16949,237 +16971,6 @@ var init_chunk_ZB7W3DKK = __esm({
|
|
|
16949
16971
|
}
|
|
16950
16972
|
});
|
|
16951
16973
|
|
|
16952
|
-
// ../../packages/core/dist/chunk-H6V7NEWR.js
|
|
16953
|
-
function isCaseDueDate(value) {
|
|
16954
|
-
const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
|
|
16955
|
-
if (!match) return false;
|
|
16956
|
-
const [year, month, day] = [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
16957
|
-
if (year < CASE_DUE_DATE_MIN_YEAR || year > CASE_DUE_DATE_MAX_YEAR) return false;
|
|
16958
|
-
const date = new Date(Date.UTC(year, month - 1, day));
|
|
16959
|
-
return date.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day;
|
|
16960
|
-
}
|
|
16961
|
-
function setCaseDeadlinesProblem(body) {
|
|
16962
|
-
const seen = /* @__PURE__ */ new Set();
|
|
16963
|
-
for (const [index, phase] of body.phases.entries()) {
|
|
16964
|
-
if (seen.has(phase.phase_id)) return { reason: "phase_repeated", at: `phases.${index}.phase_id` };
|
|
16965
|
-
seen.add(phase.phase_id);
|
|
16966
|
-
}
|
|
16967
|
-
return null;
|
|
16968
|
-
}
|
|
16969
|
-
var CASE_DUE_DATE_MIN_YEAR, CASE_DUE_DATE_MAX_YEAR, CASE_DEADLINES_PHASES_MAX, CASE_OVERDUE_CASES_MAX, caseDueDateSchema, setCaseDeadlinesShape, setCaseDeadlinesBody, setCaseTaskPlanBody, setCaseOwnerBody, caseOverdueQuery;
|
|
16970
|
-
var init_chunk_H6V7NEWR = __esm({
|
|
16971
|
-
"../../packages/core/dist/chunk-H6V7NEWR.js"() {
|
|
16972
|
-
"use strict";
|
|
16973
|
-
init_chunk_3T3D7LTE();
|
|
16974
|
-
init_chunk_HZ6CADSY();
|
|
16975
|
-
init_zod();
|
|
16976
|
-
CASE_DUE_DATE_MIN_YEAR = 2e3;
|
|
16977
|
-
CASE_DUE_DATE_MAX_YEAR = 2100;
|
|
16978
|
-
CASE_DEADLINES_PHASES_MAX = 50;
|
|
16979
|
-
CASE_OVERDUE_CASES_MAX = 50;
|
|
16980
|
-
caseDueDateSchema = external_exports.string().refine(isCaseDueDate, "Not a calendar date (YYYY-MM-DD)");
|
|
16981
|
-
setCaseDeadlinesShape = external_exports.object({
|
|
16982
|
-
phases: external_exports.array(external_exports.object({ phase_id: uuidSchema, due_on: caseDueDateSchema.nullable() }).strict()).min(1).max(CASE_DEADLINES_PHASES_MAX)
|
|
16983
|
-
}).strict();
|
|
16984
|
-
setCaseDeadlinesBody = setCaseDeadlinesShape.superRefine((body, ctx) => {
|
|
16985
|
-
const found = setCaseDeadlinesProblem(body);
|
|
16986
|
-
if (found) {
|
|
16987
|
-
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: found.reason, path: found.at.split("."), params: { case_deadlines_reason: found.reason } });
|
|
16988
|
-
}
|
|
16989
|
-
});
|
|
16990
|
-
setCaseTaskPlanBody = external_exports.object({
|
|
16991
|
-
owner_person_id: uuidSchema.nullable(),
|
|
16992
|
-
due_on: caseDueDateSchema.nullable()
|
|
16993
|
-
}).strict();
|
|
16994
|
-
setCaseOwnerBody = external_exports.object({ owner_person_id: uuidSchema.nullable() }).strict();
|
|
16995
|
-
caseOverdueQuery = casePageQuery.extend({
|
|
16996
|
-
limit: external_exports.coerce.number().int().min(1).max(CASE_OVERDUE_CASES_MAX).optional()
|
|
16997
|
-
});
|
|
16998
|
-
}
|
|
16999
|
-
});
|
|
17000
|
-
|
|
17001
|
-
// ../../packages/core/dist/chunk-ZVIMTUGZ.js
|
|
17002
|
-
var CASE_GUEST_EMAIL_MAX, CASE_GUEST_INVITATIONS_PAGE_MAX, CASE_GUEST_INVITE_TOKEN_LENGTH, caseGuestEmailSchema, caseGuestInviteTokenSchema, inviteCaseGuestBody, caseGuestInvitationParam, caseGuestInvitationsQuery, joinCaseSpaceBody, caseJoinSearchParams;
|
|
17003
|
-
var init_chunk_ZVIMTUGZ = __esm({
|
|
17004
|
-
"../../packages/core/dist/chunk-ZVIMTUGZ.js"() {
|
|
17005
|
-
"use strict";
|
|
17006
|
-
init_chunk_3T3D7LTE();
|
|
17007
|
-
init_chunk_HZ6CADSY();
|
|
17008
|
-
init_zod();
|
|
17009
|
-
CASE_GUEST_EMAIL_MAX = 320;
|
|
17010
|
-
CASE_GUEST_INVITATIONS_PAGE_MAX = 100;
|
|
17011
|
-
CASE_GUEST_INVITE_TOKEN_LENGTH = 43;
|
|
17012
|
-
caseGuestEmailSchema = external_exports.string().trim().toLowerCase().max(CASE_GUEST_EMAIL_MAX).email();
|
|
17013
|
-
caseGuestInviteTokenSchema = external_exports.string().regex(new RegExp(`^[A-Za-z0-9_-]{${CASE_GUEST_INVITE_TOKEN_LENGTH}}$`));
|
|
17014
|
-
inviteCaseGuestBody = external_exports.object({ email: caseGuestEmailSchema }).strict();
|
|
17015
|
-
caseGuestInvitationParam = caseSpaceParam.extend({ invitation_id: uuidSchema });
|
|
17016
|
-
caseGuestInvitationsQuery = casePageQuery.extend({
|
|
17017
|
-
limit: external_exports.coerce.number().int().min(1).max(CASE_GUEST_INVITATIONS_PAGE_MAX).optional()
|
|
17018
|
-
});
|
|
17019
|
-
joinCaseSpaceBody = external_exports.object({ invite: caseGuestInviteTokenSchema }).strict();
|
|
17020
|
-
caseJoinSearchParams = external_exports.object({ org: uuidSchema, space: uuidSchema, invite: caseGuestInviteTokenSchema });
|
|
17021
|
-
}
|
|
17022
|
-
});
|
|
17023
|
-
|
|
17024
|
-
// ../../packages/core/dist/chunk-BVQCYBU6.js
|
|
17025
|
-
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;
|
|
17026
|
-
var init_chunk_BVQCYBU6 = __esm({
|
|
17027
|
-
"../../packages/core/dist/chunk-BVQCYBU6.js"() {
|
|
17028
|
-
"use strict";
|
|
17029
|
-
init_chunk_733K4J4G();
|
|
17030
|
-
init_chunk_3T3D7LTE();
|
|
17031
|
-
init_chunk_HZ6CADSY();
|
|
17032
|
-
init_zod();
|
|
17033
|
-
CASE_RELATION_TYPE_CODE_PATTERN = /^[a-z0-9]+(_[a-z0-9]+)*$/;
|
|
17034
|
-
CASE_RELATION_TYPE_CODE_MAX_LENGTH = 64;
|
|
17035
|
-
CASE_RELATION_TYPE_NAME_MAX_LENGTH = 200;
|
|
17036
|
-
CASE_RELATION_TYPES_PER_SPACE_MAX = 100;
|
|
17037
|
-
CASE_RELATION_DESCRIPTION_MAX_LENGTH = 500;
|
|
17038
|
-
CASE_RELATION_SIDES = ["origin", "destination"];
|
|
17039
|
-
CASE_EXTERNAL_SYSTEM_PATTERN = /^[A-Za-z0-9][A-Za-z0-9 ._-]{0,30}$/;
|
|
17040
|
-
CASE_EXTERNAL_NUMBER_MAX_LENGTH = 120;
|
|
17041
|
-
CASE_EXTERNAL_URL_MAX_LENGTH = 2048;
|
|
17042
|
-
trimmedName2 = external_exports.string().trim().min(1).max(CASE_RELATION_TYPE_NAME_MAX_LENGTH);
|
|
17043
|
-
relationTypeFields = { name: trimmedName2, inverse_name: trimmedName2, active: external_exports.boolean().default(true) };
|
|
17044
|
-
createCaseRelationTypeBody = external_exports.object({
|
|
17045
|
-
code: external_exports.string().trim().max(CASE_RELATION_TYPE_CODE_MAX_LENGTH).regex(CASE_RELATION_TYPE_CODE_PATTERN),
|
|
17046
|
-
...relationTypeFields
|
|
17047
|
-
}).strict();
|
|
17048
|
-
updateCaseRelationTypeBody = external_exports.object({ ...relationTypeFields, expected_updated_at: timestampSchema.optional() }).strict();
|
|
17049
|
-
relateCasesBody = external_exports.object({
|
|
17050
|
-
relation_type_id: uuidSchema,
|
|
17051
|
-
other_code: external_exports.string().max(CASE_RECORD_CODE_MAX_LENGTH).regex(CASE_RECORD_CODE_PATTERN),
|
|
17052
|
-
/** This case's side: `origin` reads the type's name ("continues"), `destination` its inverse. */
|
|
17053
|
-
side: external_exports.enum(CASE_RELATION_SIDES).default("origin"),
|
|
17054
|
-
description: external_exports.string().trim().min(1).max(CASE_RELATION_DESCRIPTION_MAX_LENGTH).nullable().default(null)
|
|
17055
|
-
}).strict();
|
|
17056
|
-
addCaseExternalReferenceBody = external_exports.object({
|
|
17057
|
-
system: external_exports.string().trim().regex(CASE_EXTERNAL_SYSTEM_PATTERN),
|
|
17058
|
-
number: external_exports.string().trim().min(1).max(CASE_EXTERNAL_NUMBER_MAX_LENGTH),
|
|
17059
|
-
url: external_exports.string().trim().max(CASE_EXTERNAL_URL_MAX_LENGTH).url().refine((url) => url.startsWith("https://"), "An https link").nullable().default(null)
|
|
17060
|
-
}).strict();
|
|
17061
|
-
caseRelationTypeParam = caseSpaceParam.extend({ relation_type_id: uuidSchema });
|
|
17062
|
-
caseRelationParam = caseRecordParam.extend({ relation_id: uuidSchema });
|
|
17063
|
-
caseExternalReferenceParam = caseRecordParam.extend({ reference_id: uuidSchema });
|
|
17064
|
-
caseRelationTypesQuery = casePageQuery.extend({
|
|
17065
|
-
limit: external_exports.coerce.number().int().min(1).max(CASE_RELATION_TYPES_PER_SPACE_MAX).optional()
|
|
17066
|
-
});
|
|
17067
|
-
}
|
|
17068
|
-
});
|
|
17069
|
-
|
|
17070
|
-
// ../../packages/core/dist/chunk-UOPCLXCU.js
|
|
17071
|
-
var CASE_CHANGE_TOPICS, caseChangedFrameSchema;
|
|
17072
|
-
var init_chunk_UOPCLXCU = __esm({
|
|
17073
|
-
"../../packages/core/dist/chunk-UOPCLXCU.js"() {
|
|
17074
|
-
"use strict";
|
|
17075
|
-
init_chunk_733K4J4G();
|
|
17076
|
-
init_chunk_HZ6CADSY();
|
|
17077
|
-
init_zod();
|
|
17078
|
-
CASE_CHANGE_TOPICS = ["submission", "agenda", "access"];
|
|
17079
|
-
caseChangedFrameSchema = external_exports.object({
|
|
17080
|
-
org_id: uuidSchema,
|
|
17081
|
-
space_id: uuidSchema,
|
|
17082
|
-
/** The case, by its code; null for an `access` change, which names none. */
|
|
17083
|
-
code: caseRecordParam.shape.code.nullable(),
|
|
17084
|
-
topic: external_exports.enum(CASE_CHANGE_TOPICS)
|
|
17085
|
-
}).strict();
|
|
17086
|
-
}
|
|
17087
|
-
});
|
|
17088
|
-
|
|
17089
|
-
// ../../packages/core/dist/chunk-Z3SV3XTC.js
|
|
17090
|
-
var caseAccessQuery;
|
|
17091
|
-
var init_chunk_Z3SV3XTC = __esm({
|
|
17092
|
-
"../../packages/core/dist/chunk-Z3SV3XTC.js"() {
|
|
17093
|
-
"use strict";
|
|
17094
|
-
init_chunk_HZ6CADSY();
|
|
17095
|
-
init_zod();
|
|
17096
|
-
caseAccessQuery = external_exports.object({ with_team_id: uuidSchema.optional() }).strict();
|
|
17097
|
-
}
|
|
17098
|
-
});
|
|
17099
|
-
|
|
17100
|
-
// ../../packages/core/dist/chunk-NHC27NIE.js
|
|
17101
|
-
var CASE_ADJUSTMENT_REASON_MAX_LENGTH, CASE_ADJUSTMENT_DISPENSATION_KINDS, reason, activateCasePhaseBody, dispenseCaseBody, addCaseTaskBody, addCaseInputBody, caseOwnItemSchema, addCaseItemBody;
|
|
17102
|
-
var init_chunk_NHC27NIE = __esm({
|
|
17103
|
-
"../../packages/core/dist/chunk-NHC27NIE.js"() {
|
|
17104
|
-
"use strict";
|
|
17105
|
-
init_chunk_PFPADFUC();
|
|
17106
|
-
init_chunk_HZ6CADSY();
|
|
17107
|
-
init_zod();
|
|
17108
|
-
CASE_ADJUSTMENT_REASON_MAX_LENGTH = 2e3;
|
|
17109
|
-
CASE_ADJUSTMENT_DISPENSATION_KINDS = ["phase", "item", "output", "input"];
|
|
17110
|
-
reason = external_exports.string().trim().min(1).max(CASE_ADJUSTMENT_REASON_MAX_LENGTH);
|
|
17111
|
-
activateCasePhaseBody = external_exports.object({ phase_id: uuidSchema, reason }).strict();
|
|
17112
|
-
dispenseCaseBody = external_exports.object({ kind: external_exports.enum(CASE_ADJUSTMENT_DISPENSATION_KINDS), target_id: uuidSchema, reason }).strict();
|
|
17113
|
-
addCaseTaskBody = external_exports.object({
|
|
17114
|
-
phase_id: uuidSchema,
|
|
17115
|
-
name: external_exports.string().trim().min(1).max(CASE_TASK_NAME_MAX_LENGTH),
|
|
17116
|
-
required: external_exports.boolean().default(false),
|
|
17117
|
-
/** Tasks of the same phase it waits for. */
|
|
17118
|
-
depends_on: external_exports.array(uuidSchema).max(CASE_TASK_DEPENDENCIES_MAX).default([])
|
|
17119
|
-
}).strict();
|
|
17120
|
-
addCaseInputBody = external_exports.object({
|
|
17121
|
-
phase_id: uuidSchema,
|
|
17122
|
-
input: casePhaseInputSchema.extend({ agenda_group: caseAgendaGroupCodeSchema.nullable().default(null) }),
|
|
17123
|
-
reason
|
|
17124
|
-
}).strict();
|
|
17125
|
-
caseOwnItemSchema = caseOutputItemSchema.omit({ waivable: true, template_mode: true, fixed_text: true }).extend({ agenda_group: caseAgendaGroupCodeSchema.nullable().default(null) });
|
|
17126
|
-
addCaseItemBody = external_exports.object({
|
|
17127
|
-
phase_id: uuidSchema,
|
|
17128
|
-
/** The phase's output it goes in. */
|
|
17129
|
-
output_id: uuidSchema,
|
|
17130
|
-
item: caseOwnItemSchema,
|
|
17131
|
-
reason
|
|
17132
|
-
}).strict();
|
|
17133
|
-
}
|
|
17134
|
-
});
|
|
17135
|
-
|
|
17136
|
-
// ../../packages/core/dist/chunk-UMAPAGFH.js
|
|
17137
|
-
var CASE_AGENDA_VALUE_MAX_LENGTH, CASE_AGENDA_JUSTIFICATION_MAX_LENGTH, CASE_AGENDA_EVIDENCE_MAX_LENGTH, CASE_AGENDA_COMMENT_MAX_LENGTH, CASE_AGENDA_VERDICTS, comment, caseAgendaGroupParam, caseAgendaDecisionParam, caseAgendaQuery, caseApprovedDecisionsQuery, proposeCaseAgendaValueBody, decideCaseAgendaBody, dispenseCaseAgendaBody, addCaseDecisionBody;
|
|
17138
|
-
var init_chunk_UMAPAGFH = __esm({
|
|
17139
|
-
"../../packages/core/dist/chunk-UMAPAGFH.js"() {
|
|
17140
|
-
"use strict";
|
|
17141
|
-
init_chunk_733K4J4G();
|
|
17142
|
-
init_chunk_PFPADFUC();
|
|
17143
|
-
init_chunk_3T3D7LTE();
|
|
17144
|
-
init_chunk_M2T55BV6();
|
|
17145
|
-
init_chunk_HZ6CADSY();
|
|
17146
|
-
init_zod();
|
|
17147
|
-
CASE_AGENDA_VALUE_MAX_LENGTH = 2e3;
|
|
17148
|
-
CASE_AGENDA_JUSTIFICATION_MAX_LENGTH = 2e3;
|
|
17149
|
-
CASE_AGENDA_EVIDENCE_MAX_LENGTH = 500;
|
|
17150
|
-
CASE_AGENDA_COMMENT_MAX_LENGTH = 2e3;
|
|
17151
|
-
CASE_AGENDA_VERDICTS = ["approve", "return"];
|
|
17152
|
-
comment = external_exports.string().trim().min(1).max(CASE_AGENDA_COMMENT_MAX_LENGTH);
|
|
17153
|
-
caseAgendaGroupParam = caseRecordParam.extend({ group_id: uuidSchema });
|
|
17154
|
-
caseAgendaDecisionParam = caseRecordParam.extend({ decision_code: caseDecisionCodeSchema });
|
|
17155
|
-
caseAgendaQuery = external_exports.object({
|
|
17156
|
-
phase_id: uuidSchema,
|
|
17157
|
-
cursor: external_exports.string().min(1).max(CASE_PAGE_CURSOR_MAX_LENGTH).optional()
|
|
17158
|
-
});
|
|
17159
|
-
caseApprovedDecisionsQuery = external_exports.object({
|
|
17160
|
-
confidential: external_exports.enum(["true", "false"]).optional().transform((value) => value === "true")
|
|
17161
|
-
});
|
|
17162
|
-
proposeCaseAgendaValueBody = external_exports.object({
|
|
17163
|
-
/** As written: a numeric type also takes a string of digits with a `.` or `,` decimal mark (Rito's). */
|
|
17164
|
-
value: external_exports.union([external_exports.number(), external_exports.boolean(), external_exports.string().max(CASE_AGENDA_VALUE_MAX_LENGTH)]),
|
|
17165
|
-
justification: external_exports.string().trim().min(1).max(CASE_AGENDA_JUSTIFICATION_MAX_LENGTH),
|
|
17166
|
-
evidence: external_exports.string().trim().max(CASE_AGENDA_EVIDENCE_MAX_LENGTH).nullable().default(null).transform((text5) => text5 || null),
|
|
17167
|
-
/** Required on an approved group: why it is revised. */
|
|
17168
|
-
reason: comment.nullable().default(null)
|
|
17169
|
-
}).strict();
|
|
17170
|
-
decideCaseAgendaBody = external_exports.object({
|
|
17171
|
-
decision: external_exports.enum(CASE_AGENDA_VERDICTS),
|
|
17172
|
-
/** The sending its decider read (`CaseAgendaGroupView.sending_id`). */
|
|
17173
|
-
sending_id: uuidSchema,
|
|
17174
|
-
comment: comment.nullable().default(null)
|
|
17175
|
-
}).strict().superRefine((body, ctx) => {
|
|
17176
|
-
if (body.decision === "return" && body.comment === null) ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "A return needs its comment", path: ["comment"] });
|
|
17177
|
-
});
|
|
17178
|
-
dispenseCaseAgendaBody = external_exports.object({ reason: comment }).strict();
|
|
17179
|
-
addCaseDecisionBody = external_exports.object({ decision: caseAgendaDecisionSchema, reason: comment }).strict();
|
|
17180
|
-
}
|
|
17181
|
-
});
|
|
17182
|
-
|
|
17183
16974
|
// ../../packages/core/dist/chunk-7TQYAKCB.js
|
|
17184
16975
|
function addCaseNoteProblem(note) {
|
|
17185
16976
|
return note.origin !== null && note.kind !== "contribution" ? { reason: "origin_not_contribution", at: "origin" } : null;
|
|
@@ -17260,7 +17051,7 @@ var init_chunk_S7UAXLHJ = __esm({
|
|
|
17260
17051
|
});
|
|
17261
17052
|
|
|
17262
17053
|
// ../../packages/core/dist/chunk-S4NDHW3Q.js
|
|
17263
|
-
var CASE_VERSION_DECISION_REASON_MAX_LENGTH, CASE_VERSION_DECISIONS, caseVersionDecisionReason,
|
|
17054
|
+
var CASE_VERSION_DECISION_REASON_MAX_LENGTH, CASE_VERSION_DECISIONS, caseVersionDecisionReason, reason, lineNumber2, recordCaseReferenceBody, CASE_PASSAGE_REVERSED_REASON, citeCasePassageBody, decideCaseVersionBody;
|
|
17264
17055
|
var init_chunk_S4NDHW3Q = __esm({
|
|
17265
17056
|
"../../packages/core/dist/chunk-S4NDHW3Q.js"() {
|
|
17266
17057
|
"use strict";
|
|
@@ -17270,7 +17061,7 @@ var init_chunk_S4NDHW3Q = __esm({
|
|
|
17270
17061
|
CASE_VERSION_DECISION_REASON_MAX_LENGTH = 2e3;
|
|
17271
17062
|
CASE_VERSION_DECISIONS = ["adopt", "keep"];
|
|
17272
17063
|
caseVersionDecisionReason = external_exports.string().trim().min(1).max(CASE_VERSION_DECISION_REASON_MAX_LENGTH);
|
|
17273
|
-
|
|
17064
|
+
reason = caseVersionDecisionReason;
|
|
17274
17065
|
lineNumber2 = casePassageLineSchema;
|
|
17275
17066
|
recordCaseReferenceBody = external_exports.object({
|
|
17276
17067
|
document_id: uuidSchema,
|
|
@@ -17290,25 +17081,26 @@ var init_chunk_S4NDHW3Q = __esm({
|
|
|
17290
17081
|
decision: external_exports.enum(CASE_VERSION_DECISIONS),
|
|
17291
17082
|
/** The newer version its decider read as current. */
|
|
17292
17083
|
expect_version_id: uuidSchema,
|
|
17293
|
-
reason:
|
|
17084
|
+
reason: reason.nullable().default(null)
|
|
17294
17085
|
}).strict().superRefine((body, ctx) => {
|
|
17295
17086
|
if (body.decision === "keep" && body.reason === null) ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "A version kept needs its reason", path: ["reason"] });
|
|
17296
17087
|
});
|
|
17297
17088
|
}
|
|
17298
17089
|
});
|
|
17299
17090
|
|
|
17300
|
-
// ../../packages/core/dist/chunk-
|
|
17301
|
-
var caseInputLinkParam, linkCaseInputBody, CASE_COLLECTION_CASES_PAGE_MAX, caseCollectionCasesQuery, CASE_REFERENCES_PAGE_MAX, caseReferencesQuery;
|
|
17302
|
-
var
|
|
17303
|
-
"../../packages/core/dist/chunk-
|
|
17091
|
+
// ../../packages/core/dist/chunk-UZ72OHQN.js
|
|
17092
|
+
var caseInputLinkParam, caseCollectionDocumentOfCaseParam, linkCaseInputBody, CASE_COLLECTION_CASES_PAGE_MAX, caseCollectionCasesQuery, CASE_REFERENCES_PAGE_MAX, caseReferencesQuery;
|
|
17093
|
+
var init_chunk_UZ72OHQN = __esm({
|
|
17094
|
+
"../../packages/core/dist/chunk-UZ72OHQN.js"() {
|
|
17304
17095
|
"use strict";
|
|
17305
|
-
|
|
17096
|
+
init_chunk_6CHDJVQ6();
|
|
17306
17097
|
init_chunk_S4NDHW3Q();
|
|
17307
17098
|
init_chunk_733K4J4G();
|
|
17308
17099
|
init_chunk_3T3D7LTE();
|
|
17309
17100
|
init_chunk_HZ6CADSY();
|
|
17310
17101
|
init_zod();
|
|
17311
17102
|
caseInputLinkParam = caseRecordParam.extend({ input_id: uuidSchema });
|
|
17103
|
+
caseCollectionDocumentOfCaseParam = caseRecordParam.extend({ document_id: uuidSchema });
|
|
17312
17104
|
linkCaseInputBody = external_exports.object({
|
|
17313
17105
|
document_id: uuidSchema,
|
|
17314
17106
|
/** The document's version its writer read as current, or an earlier one it keeps, with its `reason`. */
|
|
@@ -17327,6 +17119,329 @@ var init_chunk_W4XY3TYX = __esm({
|
|
|
17327
17119
|
}
|
|
17328
17120
|
});
|
|
17329
17121
|
|
|
17122
|
+
// ../../packages/core/dist/chunk-H6V7NEWR.js
|
|
17123
|
+
function isCaseDueDate(value) {
|
|
17124
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
|
|
17125
|
+
if (!match) return false;
|
|
17126
|
+
const [year, month, day] = [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
17127
|
+
if (year < CASE_DUE_DATE_MIN_YEAR || year > CASE_DUE_DATE_MAX_YEAR) return false;
|
|
17128
|
+
const date = new Date(Date.UTC(year, month - 1, day));
|
|
17129
|
+
return date.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day;
|
|
17130
|
+
}
|
|
17131
|
+
function setCaseDeadlinesProblem(body) {
|
|
17132
|
+
const seen = /* @__PURE__ */ new Set();
|
|
17133
|
+
for (const [index, phase] of body.phases.entries()) {
|
|
17134
|
+
if (seen.has(phase.phase_id)) return { reason: "phase_repeated", at: `phases.${index}.phase_id` };
|
|
17135
|
+
seen.add(phase.phase_id);
|
|
17136
|
+
}
|
|
17137
|
+
return null;
|
|
17138
|
+
}
|
|
17139
|
+
var CASE_DUE_DATE_MIN_YEAR, CASE_DUE_DATE_MAX_YEAR, CASE_DEADLINES_PHASES_MAX, CASE_OVERDUE_CASES_MAX, caseDueDateSchema, setCaseDeadlinesShape, setCaseDeadlinesBody, setCaseTaskPlanBody, setCaseOwnerBody, caseOverdueQuery;
|
|
17140
|
+
var init_chunk_H6V7NEWR = __esm({
|
|
17141
|
+
"../../packages/core/dist/chunk-H6V7NEWR.js"() {
|
|
17142
|
+
"use strict";
|
|
17143
|
+
init_chunk_3T3D7LTE();
|
|
17144
|
+
init_chunk_HZ6CADSY();
|
|
17145
|
+
init_zod();
|
|
17146
|
+
CASE_DUE_DATE_MIN_YEAR = 2e3;
|
|
17147
|
+
CASE_DUE_DATE_MAX_YEAR = 2100;
|
|
17148
|
+
CASE_DEADLINES_PHASES_MAX = 50;
|
|
17149
|
+
CASE_OVERDUE_CASES_MAX = 50;
|
|
17150
|
+
caseDueDateSchema = external_exports.string().refine(isCaseDueDate, "Not a calendar date (YYYY-MM-DD)");
|
|
17151
|
+
setCaseDeadlinesShape = external_exports.object({
|
|
17152
|
+
phases: external_exports.array(external_exports.object({ phase_id: uuidSchema, due_on: caseDueDateSchema.nullable() }).strict()).min(1).max(CASE_DEADLINES_PHASES_MAX)
|
|
17153
|
+
}).strict();
|
|
17154
|
+
setCaseDeadlinesBody = setCaseDeadlinesShape.superRefine((body, ctx) => {
|
|
17155
|
+
const found = setCaseDeadlinesProblem(body);
|
|
17156
|
+
if (found) {
|
|
17157
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: found.reason, path: found.at.split("."), params: { case_deadlines_reason: found.reason } });
|
|
17158
|
+
}
|
|
17159
|
+
});
|
|
17160
|
+
setCaseTaskPlanBody = external_exports.object({
|
|
17161
|
+
owner_person_id: uuidSchema.nullable(),
|
|
17162
|
+
due_on: caseDueDateSchema.nullable()
|
|
17163
|
+
}).strict();
|
|
17164
|
+
setCaseOwnerBody = external_exports.object({ owner_person_id: uuidSchema.nullable() }).strict();
|
|
17165
|
+
caseOverdueQuery = casePageQuery.extend({
|
|
17166
|
+
limit: external_exports.coerce.number().int().min(1).max(CASE_OVERDUE_CASES_MAX).optional()
|
|
17167
|
+
});
|
|
17168
|
+
}
|
|
17169
|
+
});
|
|
17170
|
+
|
|
17171
|
+
// ../../packages/core/dist/chunk-ZVIMTUGZ.js
|
|
17172
|
+
var CASE_GUEST_EMAIL_MAX, CASE_GUEST_INVITATIONS_PAGE_MAX, CASE_GUEST_INVITE_TOKEN_LENGTH, caseGuestEmailSchema, caseGuestInviteTokenSchema, inviteCaseGuestBody, caseGuestInvitationParam, caseGuestInvitationsQuery, joinCaseSpaceBody, caseJoinSearchParams;
|
|
17173
|
+
var init_chunk_ZVIMTUGZ = __esm({
|
|
17174
|
+
"../../packages/core/dist/chunk-ZVIMTUGZ.js"() {
|
|
17175
|
+
"use strict";
|
|
17176
|
+
init_chunk_3T3D7LTE();
|
|
17177
|
+
init_chunk_HZ6CADSY();
|
|
17178
|
+
init_zod();
|
|
17179
|
+
CASE_GUEST_EMAIL_MAX = 320;
|
|
17180
|
+
CASE_GUEST_INVITATIONS_PAGE_MAX = 100;
|
|
17181
|
+
CASE_GUEST_INVITE_TOKEN_LENGTH = 43;
|
|
17182
|
+
caseGuestEmailSchema = external_exports.string().trim().toLowerCase().max(CASE_GUEST_EMAIL_MAX).email();
|
|
17183
|
+
caseGuestInviteTokenSchema = external_exports.string().regex(new RegExp(`^[A-Za-z0-9_-]{${CASE_GUEST_INVITE_TOKEN_LENGTH}}$`));
|
|
17184
|
+
inviteCaseGuestBody = external_exports.object({ email: caseGuestEmailSchema }).strict();
|
|
17185
|
+
caseGuestInvitationParam = caseSpaceParam.extend({ invitation_id: uuidSchema });
|
|
17186
|
+
caseGuestInvitationsQuery = casePageQuery.extend({
|
|
17187
|
+
limit: external_exports.coerce.number().int().min(1).max(CASE_GUEST_INVITATIONS_PAGE_MAX).optional()
|
|
17188
|
+
});
|
|
17189
|
+
joinCaseSpaceBody = external_exports.object({ invite: caseGuestInviteTokenSchema }).strict();
|
|
17190
|
+
caseJoinSearchParams = external_exports.object({ org: uuidSchema, space: uuidSchema, invite: caseGuestInviteTokenSchema });
|
|
17191
|
+
}
|
|
17192
|
+
});
|
|
17193
|
+
|
|
17194
|
+
// ../../packages/core/dist/chunk-BVQCYBU6.js
|
|
17195
|
+
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;
|
|
17196
|
+
var init_chunk_BVQCYBU6 = __esm({
|
|
17197
|
+
"../../packages/core/dist/chunk-BVQCYBU6.js"() {
|
|
17198
|
+
"use strict";
|
|
17199
|
+
init_chunk_733K4J4G();
|
|
17200
|
+
init_chunk_3T3D7LTE();
|
|
17201
|
+
init_chunk_HZ6CADSY();
|
|
17202
|
+
init_zod();
|
|
17203
|
+
CASE_RELATION_TYPE_CODE_PATTERN = /^[a-z0-9]+(_[a-z0-9]+)*$/;
|
|
17204
|
+
CASE_RELATION_TYPE_CODE_MAX_LENGTH = 64;
|
|
17205
|
+
CASE_RELATION_TYPE_NAME_MAX_LENGTH = 200;
|
|
17206
|
+
CASE_RELATION_TYPES_PER_SPACE_MAX = 100;
|
|
17207
|
+
CASE_RELATION_DESCRIPTION_MAX_LENGTH = 500;
|
|
17208
|
+
CASE_RELATION_SIDES = ["origin", "destination"];
|
|
17209
|
+
CASE_EXTERNAL_SYSTEM_PATTERN = /^[A-Za-z0-9][A-Za-z0-9 ._-]{0,30}$/;
|
|
17210
|
+
CASE_EXTERNAL_NUMBER_MAX_LENGTH = 120;
|
|
17211
|
+
CASE_EXTERNAL_URL_MAX_LENGTH = 2048;
|
|
17212
|
+
trimmedName2 = external_exports.string().trim().min(1).max(CASE_RELATION_TYPE_NAME_MAX_LENGTH);
|
|
17213
|
+
relationTypeFields = { name: trimmedName2, inverse_name: trimmedName2, active: external_exports.boolean().default(true) };
|
|
17214
|
+
createCaseRelationTypeBody = external_exports.object({
|
|
17215
|
+
code: external_exports.string().trim().max(CASE_RELATION_TYPE_CODE_MAX_LENGTH).regex(CASE_RELATION_TYPE_CODE_PATTERN),
|
|
17216
|
+
...relationTypeFields
|
|
17217
|
+
}).strict();
|
|
17218
|
+
updateCaseRelationTypeBody = external_exports.object({ ...relationTypeFields, expected_updated_at: timestampSchema.optional() }).strict();
|
|
17219
|
+
relateCasesBody = external_exports.object({
|
|
17220
|
+
relation_type_id: uuidSchema,
|
|
17221
|
+
other_code: external_exports.string().max(CASE_RECORD_CODE_MAX_LENGTH).regex(CASE_RECORD_CODE_PATTERN),
|
|
17222
|
+
/** This case's side: `origin` reads the type's name ("continues"), `destination` its inverse. */
|
|
17223
|
+
side: external_exports.enum(CASE_RELATION_SIDES).default("origin"),
|
|
17224
|
+
description: external_exports.string().trim().min(1).max(CASE_RELATION_DESCRIPTION_MAX_LENGTH).nullable().default(null)
|
|
17225
|
+
}).strict();
|
|
17226
|
+
addCaseExternalReferenceBody = external_exports.object({
|
|
17227
|
+
system: external_exports.string().trim().regex(CASE_EXTERNAL_SYSTEM_PATTERN),
|
|
17228
|
+
number: external_exports.string().trim().min(1).max(CASE_EXTERNAL_NUMBER_MAX_LENGTH),
|
|
17229
|
+
url: external_exports.string().trim().max(CASE_EXTERNAL_URL_MAX_LENGTH).url().refine((url) => url.startsWith("https://"), "An https link").nullable().default(null)
|
|
17230
|
+
}).strict();
|
|
17231
|
+
caseRelationTypeParam = caseSpaceParam.extend({ relation_type_id: uuidSchema });
|
|
17232
|
+
caseRelationParam = caseRecordParam.extend({ relation_id: uuidSchema });
|
|
17233
|
+
caseExternalReferenceParam = caseRecordParam.extend({ reference_id: uuidSchema });
|
|
17234
|
+
caseRelationTypesQuery = casePageQuery.extend({
|
|
17235
|
+
limit: external_exports.coerce.number().int().min(1).max(CASE_RELATION_TYPES_PER_SPACE_MAX).optional()
|
|
17236
|
+
});
|
|
17237
|
+
}
|
|
17238
|
+
});
|
|
17239
|
+
|
|
17240
|
+
// ../../packages/core/dist/chunk-Z3SV3XTC.js
|
|
17241
|
+
var caseAccessQuery;
|
|
17242
|
+
var init_chunk_Z3SV3XTC = __esm({
|
|
17243
|
+
"../../packages/core/dist/chunk-Z3SV3XTC.js"() {
|
|
17244
|
+
"use strict";
|
|
17245
|
+
init_chunk_HZ6CADSY();
|
|
17246
|
+
init_zod();
|
|
17247
|
+
caseAccessQuery = external_exports.object({ with_team_id: uuidSchema.optional() }).strict();
|
|
17248
|
+
}
|
|
17249
|
+
});
|
|
17250
|
+
|
|
17251
|
+
// ../../packages/core/dist/chunk-NHC27NIE.js
|
|
17252
|
+
var CASE_ADJUSTMENT_REASON_MAX_LENGTH, CASE_ADJUSTMENT_DISPENSATION_KINDS, reason2, activateCasePhaseBody, dispenseCaseBody, addCaseTaskBody, addCaseInputBody, caseOwnItemSchema, addCaseItemBody;
|
|
17253
|
+
var init_chunk_NHC27NIE = __esm({
|
|
17254
|
+
"../../packages/core/dist/chunk-NHC27NIE.js"() {
|
|
17255
|
+
"use strict";
|
|
17256
|
+
init_chunk_PFPADFUC();
|
|
17257
|
+
init_chunk_HZ6CADSY();
|
|
17258
|
+
init_zod();
|
|
17259
|
+
CASE_ADJUSTMENT_REASON_MAX_LENGTH = 2e3;
|
|
17260
|
+
CASE_ADJUSTMENT_DISPENSATION_KINDS = ["phase", "item", "output", "input"];
|
|
17261
|
+
reason2 = external_exports.string().trim().min(1).max(CASE_ADJUSTMENT_REASON_MAX_LENGTH);
|
|
17262
|
+
activateCasePhaseBody = external_exports.object({ phase_id: uuidSchema, reason: reason2 }).strict();
|
|
17263
|
+
dispenseCaseBody = external_exports.object({ kind: external_exports.enum(CASE_ADJUSTMENT_DISPENSATION_KINDS), target_id: uuidSchema, reason: reason2 }).strict();
|
|
17264
|
+
addCaseTaskBody = external_exports.object({
|
|
17265
|
+
phase_id: uuidSchema,
|
|
17266
|
+
name: external_exports.string().trim().min(1).max(CASE_TASK_NAME_MAX_LENGTH),
|
|
17267
|
+
required: external_exports.boolean().default(false),
|
|
17268
|
+
/** Tasks of the same phase it waits for. */
|
|
17269
|
+
depends_on: external_exports.array(uuidSchema).max(CASE_TASK_DEPENDENCIES_MAX).default([])
|
|
17270
|
+
}).strict();
|
|
17271
|
+
addCaseInputBody = external_exports.object({
|
|
17272
|
+
phase_id: uuidSchema,
|
|
17273
|
+
input: casePhaseInputSchema.extend({ agenda_group: caseAgendaGroupCodeSchema.nullable().default(null) }),
|
|
17274
|
+
reason: reason2
|
|
17275
|
+
}).strict();
|
|
17276
|
+
caseOwnItemSchema = caseOutputItemSchema.omit({ waivable: true, template_mode: true, fixed_text: true }).extend({ agenda_group: caseAgendaGroupCodeSchema.nullable().default(null) });
|
|
17277
|
+
addCaseItemBody = external_exports.object({
|
|
17278
|
+
phase_id: uuidSchema,
|
|
17279
|
+
/** The phase's output it goes in. */
|
|
17280
|
+
output_id: uuidSchema,
|
|
17281
|
+
item: caseOwnItemSchema,
|
|
17282
|
+
reason: reason2
|
|
17283
|
+
}).strict();
|
|
17284
|
+
}
|
|
17285
|
+
});
|
|
17286
|
+
|
|
17287
|
+
// ../../packages/core/dist/chunk-UMAPAGFH.js
|
|
17288
|
+
var CASE_AGENDA_VALUE_MAX_LENGTH, CASE_AGENDA_JUSTIFICATION_MAX_LENGTH, CASE_AGENDA_EVIDENCE_MAX_LENGTH, CASE_AGENDA_COMMENT_MAX_LENGTH, CASE_AGENDA_VERDICTS, comment, caseAgendaGroupParam, caseAgendaDecisionParam, caseAgendaQuery, caseApprovedDecisionsQuery, proposeCaseAgendaValueBody, decideCaseAgendaBody, dispenseCaseAgendaBody, addCaseDecisionBody;
|
|
17289
|
+
var init_chunk_UMAPAGFH = __esm({
|
|
17290
|
+
"../../packages/core/dist/chunk-UMAPAGFH.js"() {
|
|
17291
|
+
"use strict";
|
|
17292
|
+
init_chunk_733K4J4G();
|
|
17293
|
+
init_chunk_PFPADFUC();
|
|
17294
|
+
init_chunk_3T3D7LTE();
|
|
17295
|
+
init_chunk_M2T55BV6();
|
|
17296
|
+
init_chunk_HZ6CADSY();
|
|
17297
|
+
init_zod();
|
|
17298
|
+
CASE_AGENDA_VALUE_MAX_LENGTH = 2e3;
|
|
17299
|
+
CASE_AGENDA_JUSTIFICATION_MAX_LENGTH = 2e3;
|
|
17300
|
+
CASE_AGENDA_EVIDENCE_MAX_LENGTH = 500;
|
|
17301
|
+
CASE_AGENDA_COMMENT_MAX_LENGTH = 2e3;
|
|
17302
|
+
CASE_AGENDA_VERDICTS = ["approve", "return"];
|
|
17303
|
+
comment = external_exports.string().trim().min(1).max(CASE_AGENDA_COMMENT_MAX_LENGTH);
|
|
17304
|
+
caseAgendaGroupParam = caseRecordParam.extend({ group_id: uuidSchema });
|
|
17305
|
+
caseAgendaDecisionParam = caseRecordParam.extend({ decision_code: caseDecisionCodeSchema });
|
|
17306
|
+
caseAgendaQuery = external_exports.object({
|
|
17307
|
+
phase_id: uuidSchema,
|
|
17308
|
+
cursor: external_exports.string().min(1).max(CASE_PAGE_CURSOR_MAX_LENGTH).optional()
|
|
17309
|
+
});
|
|
17310
|
+
caseApprovedDecisionsQuery = external_exports.object({
|
|
17311
|
+
confidential: external_exports.enum(["true", "false"]).optional().transform((value) => value === "true")
|
|
17312
|
+
});
|
|
17313
|
+
proposeCaseAgendaValueBody = external_exports.object({
|
|
17314
|
+
/** As written: a numeric type also takes a string of digits with a `.` or `,` decimal mark (Rito's). */
|
|
17315
|
+
value: external_exports.union([external_exports.number(), external_exports.boolean(), external_exports.string().max(CASE_AGENDA_VALUE_MAX_LENGTH)]),
|
|
17316
|
+
justification: external_exports.string().trim().min(1).max(CASE_AGENDA_JUSTIFICATION_MAX_LENGTH),
|
|
17317
|
+
evidence: external_exports.string().trim().max(CASE_AGENDA_EVIDENCE_MAX_LENGTH).nullable().default(null).transform((text5) => text5 || null),
|
|
17318
|
+
/** Required on an approved group: why it is revised. */
|
|
17319
|
+
reason: comment.nullable().default(null)
|
|
17320
|
+
}).strict();
|
|
17321
|
+
decideCaseAgendaBody = external_exports.object({
|
|
17322
|
+
decision: external_exports.enum(CASE_AGENDA_VERDICTS),
|
|
17323
|
+
/** The sending its decider read (`CaseAgendaGroupView.sending_id`). */
|
|
17324
|
+
sending_id: uuidSchema,
|
|
17325
|
+
comment: comment.nullable().default(null)
|
|
17326
|
+
}).strict().superRefine((body, ctx) => {
|
|
17327
|
+
if (body.decision === "return" && body.comment === null) ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "A return needs its comment", path: ["comment"] });
|
|
17328
|
+
});
|
|
17329
|
+
dispenseCaseAgendaBody = external_exports.object({ reason: comment }).strict();
|
|
17330
|
+
addCaseDecisionBody = external_exports.object({ decision: caseAgendaDecisionSchema, reason: comment }).strict();
|
|
17331
|
+
}
|
|
17332
|
+
});
|
|
17333
|
+
|
|
17334
|
+
// ../../packages/core/dist/chunk-2PZIF56U.js
|
|
17335
|
+
var analyticsHubIdParam, analyticsVariableIdParam, updateVariablePinBody, updateAnalyticsViewBody, NUMERIC_FILTER_OPS, TEXT_FILTER_OPS, CATEGORICAL_FILTER_OPS, VARIABLE_FILTER_OPS, STRUCTURED_QUERY_OPS, STRUCTURED_QUERY_AGGREGATIONS, filterValueSchema, conversationsBody, analyticsConversationIdParam, messagesQuery, conversationDetailDataQuery, analyticsDataBody, structuredQueryBody, analyticsSqlBody, analyticsSqlTable, analyticsSqlSchemaQuery;
|
|
17336
|
+
var init_chunk_2PZIF56U = __esm({
|
|
17337
|
+
"../../packages/core/dist/chunk-2PZIF56U.js"() {
|
|
17338
|
+
"use strict";
|
|
17339
|
+
init_zod();
|
|
17340
|
+
analyticsHubIdParam = external_exports.object({
|
|
17341
|
+
hubId: external_exports.string().uuid()
|
|
17342
|
+
});
|
|
17343
|
+
analyticsVariableIdParam = external_exports.object({
|
|
17344
|
+
variableId: external_exports.string().uuid()
|
|
17345
|
+
});
|
|
17346
|
+
updateVariablePinBody = external_exports.object({
|
|
17347
|
+
pin: external_exports.union([external_exports.boolean(), external_exports.string()])
|
|
17348
|
+
});
|
|
17349
|
+
updateAnalyticsViewBody = external_exports.object({
|
|
17350
|
+
// 64 covers UUIDs (36) and the `sys:{name}` synthetic IDs for system variables.
|
|
17351
|
+
selected_variable_ids: external_exports.array(external_exports.string().min(1).max(64)).max(200)
|
|
17352
|
+
});
|
|
17353
|
+
NUMERIC_FILTER_OPS = ["eq", "neq", "gt", "gte", "lt", "lte"];
|
|
17354
|
+
TEXT_FILTER_OPS = ["equals", "not_equals", "contains", "not_contains", "starts_with", "ends_with"];
|
|
17355
|
+
CATEGORICAL_FILTER_OPS = ["is", "is_not", "in", "not_in"];
|
|
17356
|
+
VARIABLE_FILTER_OPS = [
|
|
17357
|
+
...NUMERIC_FILTER_OPS,
|
|
17358
|
+
...TEXT_FILTER_OPS,
|
|
17359
|
+
...CATEGORICAL_FILTER_OPS
|
|
17360
|
+
];
|
|
17361
|
+
STRUCTURED_QUERY_OPS = ["eq", "neq", "gt", "gte", "lt", "lte", "in", "not_in", "like"];
|
|
17362
|
+
STRUCTURED_QUERY_AGGREGATIONS = ["avg", "sum", "min", "max", "count", "quantile", "stddevPop", "corr", "uniq"];
|
|
17363
|
+
filterValueSchema = external_exports.object({
|
|
17364
|
+
variable_id: external_exports.string(),
|
|
17365
|
+
filter_type: external_exports.enum(VARIABLE_FILTER_OPS),
|
|
17366
|
+
filter_value: external_exports.union([external_exports.string(), external_exports.number()])
|
|
17367
|
+
});
|
|
17368
|
+
conversationsBody = external_exports.object({
|
|
17369
|
+
hub_id: external_exports.string().uuid(),
|
|
17370
|
+
time_interval: external_exports.object({
|
|
17371
|
+
start: external_exports.string().optional(),
|
|
17372
|
+
end: external_exports.string().optional()
|
|
17373
|
+
}).optional(),
|
|
17374
|
+
filters: external_exports.array(filterValueSchema).optional(),
|
|
17375
|
+
limit: external_exports.number().int().positive().max(500).default(50),
|
|
17376
|
+
offset: external_exports.number().int().min(0).default(0)
|
|
17377
|
+
});
|
|
17378
|
+
analyticsConversationIdParam = external_exports.object({
|
|
17379
|
+
conversationId: external_exports.string().uuid()
|
|
17380
|
+
});
|
|
17381
|
+
messagesQuery = external_exports.object({
|
|
17382
|
+
hub_id: external_exports.string().uuid(),
|
|
17383
|
+
limit: external_exports.string().regex(/^\d+$/).optional(),
|
|
17384
|
+
offset: external_exports.string().regex(/^\d+$/).optional()
|
|
17385
|
+
});
|
|
17386
|
+
conversationDetailDataQuery = external_exports.object({
|
|
17387
|
+
hub_id: external_exports.string().uuid()
|
|
17388
|
+
});
|
|
17389
|
+
analyticsDataBody = external_exports.object({
|
|
17390
|
+
hub_id: external_exports.string().uuid(),
|
|
17391
|
+
periodicity: external_exports.enum(["daily", "weekly", "monthly", "yearly"]),
|
|
17392
|
+
time_interval: external_exports.object({
|
|
17393
|
+
start: external_exports.string(),
|
|
17394
|
+
end: external_exports.string()
|
|
17395
|
+
}),
|
|
17396
|
+
trend_analysis: external_exports.boolean(),
|
|
17397
|
+
filters: external_exports.array(filterValueSchema).optional(),
|
|
17398
|
+
selected_variables: external_exports.array(external_exports.string()),
|
|
17399
|
+
include_summary: external_exports.boolean().optional(),
|
|
17400
|
+
include_variables: external_exports.boolean().optional(),
|
|
17401
|
+
variable_origin: external_exports.enum(["agent", "system", "annotation"]).optional(),
|
|
17402
|
+
variable_category: external_exports.string().optional(),
|
|
17403
|
+
variables_only: external_exports.boolean().optional()
|
|
17404
|
+
});
|
|
17405
|
+
structuredQueryBody = external_exports.object({
|
|
17406
|
+
hub_id: external_exports.string().uuid(),
|
|
17407
|
+
metrics: external_exports.array(external_exports.object({
|
|
17408
|
+
column: external_exports.string(),
|
|
17409
|
+
aggregation: external_exports.enum(STRUCTURED_QUERY_AGGREGATIONS),
|
|
17410
|
+
alias: external_exports.string().optional(),
|
|
17411
|
+
corr_with: external_exports.string().optional(),
|
|
17412
|
+
quantile_level: external_exports.number().min(0).max(1).optional()
|
|
17413
|
+
})).min(1),
|
|
17414
|
+
group_by: external_exports.array(external_exports.string()).optional(),
|
|
17415
|
+
order_by: external_exports.array(external_exports.object({
|
|
17416
|
+
column: external_exports.string(),
|
|
17417
|
+
direction: external_exports.enum(["asc", "desc"]).optional()
|
|
17418
|
+
})).optional(),
|
|
17419
|
+
filters: external_exports.array(external_exports.object({
|
|
17420
|
+
column: external_exports.string(),
|
|
17421
|
+
operator: external_exports.enum(STRUCTURED_QUERY_OPS),
|
|
17422
|
+
value: external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()])
|
|
17423
|
+
})).optional(),
|
|
17424
|
+
time_range: external_exports.object({
|
|
17425
|
+
start: external_exports.string(),
|
|
17426
|
+
end: external_exports.string()
|
|
17427
|
+
}).optional(),
|
|
17428
|
+
limit: external_exports.number().int().positive().max(1e4).optional()
|
|
17429
|
+
});
|
|
17430
|
+
analyticsSqlBody = external_exports.object({
|
|
17431
|
+
hub_id: external_exports.string().uuid(),
|
|
17432
|
+
// Hard size cap before the validator runs — keeps lex/parse work bounded.
|
|
17433
|
+
sql: external_exports.string().min(1).max(8e3),
|
|
17434
|
+
limit: external_exports.number().int().positive().max(1e4).optional()
|
|
17435
|
+
});
|
|
17436
|
+
analyticsSqlTable = external_exports.enum(["conversation", "message"]);
|
|
17437
|
+
analyticsSqlSchemaQuery = external_exports.object({
|
|
17438
|
+
hub_id: external_exports.string().uuid(),
|
|
17439
|
+
// Defaulted so a client that predates the message table keeps its old response.
|
|
17440
|
+
table: analyticsSqlTable.default("conversation")
|
|
17441
|
+
});
|
|
17442
|
+
}
|
|
17443
|
+
});
|
|
17444
|
+
|
|
17330
17445
|
// ../../packages/core/dist/chunk-UEJOG2Q7.js
|
|
17331
17446
|
var archiveHubIdParam, archiveConversationParams, archiveListQuery, archiveMessageObservabilityParams;
|
|
17332
17447
|
var init_chunk_UEJOG2Q7 = __esm({
|
|
@@ -18232,117 +18347,6 @@ var init_chunk_A4YOU7H6 = __esm({
|
|
|
18232
18347
|
}
|
|
18233
18348
|
});
|
|
18234
18349
|
|
|
18235
|
-
// ../../packages/core/dist/chunk-2PZIF56U.js
|
|
18236
|
-
var analyticsHubIdParam, analyticsVariableIdParam, updateVariablePinBody, updateAnalyticsViewBody, NUMERIC_FILTER_OPS, TEXT_FILTER_OPS, CATEGORICAL_FILTER_OPS, VARIABLE_FILTER_OPS, STRUCTURED_QUERY_OPS, STRUCTURED_QUERY_AGGREGATIONS, filterValueSchema, conversationsBody, analyticsConversationIdParam, messagesQuery, conversationDetailDataQuery, analyticsDataBody, structuredQueryBody, analyticsSqlBody, analyticsSqlTable, analyticsSqlSchemaQuery;
|
|
18237
|
-
var init_chunk_2PZIF56U = __esm({
|
|
18238
|
-
"../../packages/core/dist/chunk-2PZIF56U.js"() {
|
|
18239
|
-
"use strict";
|
|
18240
|
-
init_zod();
|
|
18241
|
-
analyticsHubIdParam = external_exports.object({
|
|
18242
|
-
hubId: external_exports.string().uuid()
|
|
18243
|
-
});
|
|
18244
|
-
analyticsVariableIdParam = external_exports.object({
|
|
18245
|
-
variableId: external_exports.string().uuid()
|
|
18246
|
-
});
|
|
18247
|
-
updateVariablePinBody = external_exports.object({
|
|
18248
|
-
pin: external_exports.union([external_exports.boolean(), external_exports.string()])
|
|
18249
|
-
});
|
|
18250
|
-
updateAnalyticsViewBody = external_exports.object({
|
|
18251
|
-
// 64 covers UUIDs (36) and the `sys:{name}` synthetic IDs for system variables.
|
|
18252
|
-
selected_variable_ids: external_exports.array(external_exports.string().min(1).max(64)).max(200)
|
|
18253
|
-
});
|
|
18254
|
-
NUMERIC_FILTER_OPS = ["eq", "neq", "gt", "gte", "lt", "lte"];
|
|
18255
|
-
TEXT_FILTER_OPS = ["equals", "not_equals", "contains", "not_contains", "starts_with", "ends_with"];
|
|
18256
|
-
CATEGORICAL_FILTER_OPS = ["is", "is_not", "in", "not_in"];
|
|
18257
|
-
VARIABLE_FILTER_OPS = [
|
|
18258
|
-
...NUMERIC_FILTER_OPS,
|
|
18259
|
-
...TEXT_FILTER_OPS,
|
|
18260
|
-
...CATEGORICAL_FILTER_OPS
|
|
18261
|
-
];
|
|
18262
|
-
STRUCTURED_QUERY_OPS = ["eq", "neq", "gt", "gte", "lt", "lte", "in", "not_in", "like"];
|
|
18263
|
-
STRUCTURED_QUERY_AGGREGATIONS = ["avg", "sum", "min", "max", "count", "quantile", "stddevPop", "corr", "uniq"];
|
|
18264
|
-
filterValueSchema = external_exports.object({
|
|
18265
|
-
variable_id: external_exports.string(),
|
|
18266
|
-
filter_type: external_exports.enum(VARIABLE_FILTER_OPS),
|
|
18267
|
-
filter_value: external_exports.union([external_exports.string(), external_exports.number()])
|
|
18268
|
-
});
|
|
18269
|
-
conversationsBody = external_exports.object({
|
|
18270
|
-
hub_id: external_exports.string().uuid(),
|
|
18271
|
-
time_interval: external_exports.object({
|
|
18272
|
-
start: external_exports.string().optional(),
|
|
18273
|
-
end: external_exports.string().optional()
|
|
18274
|
-
}).optional(),
|
|
18275
|
-
filters: external_exports.array(filterValueSchema).optional(),
|
|
18276
|
-
limit: external_exports.number().int().positive().max(500).default(50),
|
|
18277
|
-
offset: external_exports.number().int().min(0).default(0)
|
|
18278
|
-
});
|
|
18279
|
-
analyticsConversationIdParam = external_exports.object({
|
|
18280
|
-
conversationId: external_exports.string().uuid()
|
|
18281
|
-
});
|
|
18282
|
-
messagesQuery = external_exports.object({
|
|
18283
|
-
hub_id: external_exports.string().uuid(),
|
|
18284
|
-
limit: external_exports.string().regex(/^\d+$/).optional(),
|
|
18285
|
-
offset: external_exports.string().regex(/^\d+$/).optional()
|
|
18286
|
-
});
|
|
18287
|
-
conversationDetailDataQuery = external_exports.object({
|
|
18288
|
-
hub_id: external_exports.string().uuid()
|
|
18289
|
-
});
|
|
18290
|
-
analyticsDataBody = external_exports.object({
|
|
18291
|
-
hub_id: external_exports.string().uuid(),
|
|
18292
|
-
periodicity: external_exports.enum(["daily", "weekly", "monthly", "yearly"]),
|
|
18293
|
-
time_interval: external_exports.object({
|
|
18294
|
-
start: external_exports.string(),
|
|
18295
|
-
end: external_exports.string()
|
|
18296
|
-
}),
|
|
18297
|
-
trend_analysis: external_exports.boolean(),
|
|
18298
|
-
filters: external_exports.array(filterValueSchema).optional(),
|
|
18299
|
-
selected_variables: external_exports.array(external_exports.string()),
|
|
18300
|
-
include_summary: external_exports.boolean().optional(),
|
|
18301
|
-
include_variables: external_exports.boolean().optional(),
|
|
18302
|
-
variable_origin: external_exports.enum(["agent", "system", "annotation"]).optional(),
|
|
18303
|
-
variable_category: external_exports.string().optional(),
|
|
18304
|
-
variables_only: external_exports.boolean().optional()
|
|
18305
|
-
});
|
|
18306
|
-
structuredQueryBody = external_exports.object({
|
|
18307
|
-
hub_id: external_exports.string().uuid(),
|
|
18308
|
-
metrics: external_exports.array(external_exports.object({
|
|
18309
|
-
column: external_exports.string(),
|
|
18310
|
-
aggregation: external_exports.enum(STRUCTURED_QUERY_AGGREGATIONS),
|
|
18311
|
-
alias: external_exports.string().optional(),
|
|
18312
|
-
corr_with: external_exports.string().optional(),
|
|
18313
|
-
quantile_level: external_exports.number().min(0).max(1).optional()
|
|
18314
|
-
})).min(1),
|
|
18315
|
-
group_by: external_exports.array(external_exports.string()).optional(),
|
|
18316
|
-
order_by: external_exports.array(external_exports.object({
|
|
18317
|
-
column: external_exports.string(),
|
|
18318
|
-
direction: external_exports.enum(["asc", "desc"]).optional()
|
|
18319
|
-
})).optional(),
|
|
18320
|
-
filters: external_exports.array(external_exports.object({
|
|
18321
|
-
column: external_exports.string(),
|
|
18322
|
-
operator: external_exports.enum(STRUCTURED_QUERY_OPS),
|
|
18323
|
-
value: external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()])
|
|
18324
|
-
})).optional(),
|
|
18325
|
-
time_range: external_exports.object({
|
|
18326
|
-
start: external_exports.string(),
|
|
18327
|
-
end: external_exports.string()
|
|
18328
|
-
}).optional(),
|
|
18329
|
-
limit: external_exports.number().int().positive().max(1e4).optional()
|
|
18330
|
-
});
|
|
18331
|
-
analyticsSqlBody = external_exports.object({
|
|
18332
|
-
hub_id: external_exports.string().uuid(),
|
|
18333
|
-
// Hard size cap before the validator runs — keeps lex/parse work bounded.
|
|
18334
|
-
sql: external_exports.string().min(1).max(8e3),
|
|
18335
|
-
limit: external_exports.number().int().positive().max(1e4).optional()
|
|
18336
|
-
});
|
|
18337
|
-
analyticsSqlTable = external_exports.enum(["conversation", "message"]);
|
|
18338
|
-
analyticsSqlSchemaQuery = external_exports.object({
|
|
18339
|
-
hub_id: external_exports.string().uuid(),
|
|
18340
|
-
// Defaulted so a client that predates the message table keeps its old response.
|
|
18341
|
-
table: analyticsSqlTable.default("conversation")
|
|
18342
|
-
});
|
|
18343
|
-
}
|
|
18344
|
-
});
|
|
18345
|
-
|
|
18346
18350
|
// ../../packages/core/dist/chunk-ZRXP6OOJ.js
|
|
18347
18351
|
function capped(max, field) {
|
|
18348
18352
|
return (value, ctx) => {
|
|
@@ -18404,17 +18408,18 @@ var init_contracts = __esm({
|
|
|
18404
18408
|
init_chunk_C7UAGRXF();
|
|
18405
18409
|
init_chunk_IPXBFWUU();
|
|
18406
18410
|
init_chunk_63UWXV4T();
|
|
18411
|
+
init_chunk_WTIGECE5();
|
|
18407
18412
|
init_chunk_WDAXZDJO();
|
|
18408
18413
|
init_chunk_ZC6YGHNX();
|
|
18414
|
+
init_chunk_5DGHIY7L();
|
|
18409
18415
|
init_chunk_ITIQ7XWD();
|
|
18410
18416
|
init_chunk_IPDOHAZ5();
|
|
18411
18417
|
init_chunk_PFGVH2CX();
|
|
18412
18418
|
init_chunk_TVUDMGWV();
|
|
18413
|
-
init_chunk_WTIGECE5();
|
|
18414
18419
|
init_chunk_ZXK6N2HN();
|
|
18415
18420
|
init_chunk_Y7CFCYX4();
|
|
18416
18421
|
init_chunk_MGBAXT5Y();
|
|
18417
|
-
|
|
18422
|
+
init_chunk_YUZFHVB2();
|
|
18418
18423
|
init_chunk_I3O2RACG();
|
|
18419
18424
|
init_chunk_CMRECH67();
|
|
18420
18425
|
init_chunk_34LE6P7E();
|
|
@@ -18423,19 +18428,20 @@ var init_contracts = __esm({
|
|
|
18423
18428
|
init_chunk_SSPK6ISL();
|
|
18424
18429
|
init_chunk_SY6PLCPK();
|
|
18425
18430
|
init_chunk_2ZZZHXZR();
|
|
18426
|
-
|
|
18431
|
+
init_chunk_KSTYTQ7I();
|
|
18427
18432
|
init_chunk_LKBSHANA();
|
|
18428
18433
|
init_chunk_LX3D5LCB();
|
|
18429
18434
|
init_chunk_C4HEZ7ZI();
|
|
18430
18435
|
init_chunk_IR2NOSI3();
|
|
18431
18436
|
init_chunk_OPETF4GS();
|
|
18437
|
+
init_chunk_UCYWGWQT();
|
|
18432
18438
|
init_chunk_YULHXJ5M();
|
|
18433
18439
|
init_chunk_V4FRPRH5();
|
|
18434
18440
|
init_chunk_LWMLR2WI();
|
|
18435
18441
|
init_chunk_ACGAI25T();
|
|
18436
18442
|
init_chunk_MH4O3YEX();
|
|
18437
18443
|
init_chunk_QEEQN2NE();
|
|
18438
|
-
|
|
18444
|
+
init_chunk_NNC2ZECG();
|
|
18439
18445
|
init_chunk_7CYHPF35();
|
|
18440
18446
|
init_chunk_NETRUHZF();
|
|
18441
18447
|
init_chunk_EO5MKW7Q();
|
|
@@ -18445,29 +18451,29 @@ var init_contracts = __esm({
|
|
|
18445
18451
|
init_chunk_2YEGUQR7();
|
|
18446
18452
|
init_chunk_AHISKXHA();
|
|
18447
18453
|
init_chunk_JDJ4EUOL();
|
|
18448
|
-
init_chunk_UCYWGWQT();
|
|
18449
18454
|
init_chunk_6AYIXGDT();
|
|
18450
18455
|
init_chunk_Q7NWJA2G();
|
|
18451
18456
|
init_chunk_K3PD6AOF();
|
|
18452
18457
|
init_chunk_KVMROYDC();
|
|
18453
18458
|
init_chunk_M2IF4G6X();
|
|
18454
|
-
|
|
18459
|
+
init_chunk_UOPCLXCU();
|
|
18455
18460
|
init_chunk_7CZSLDOE();
|
|
18456
18461
|
init_chunk_2YVCHUBL();
|
|
18457
18462
|
init_chunk_BT77VXJU();
|
|
18458
|
-
|
|
18463
|
+
init_chunk_WYCUCSD5();
|
|
18464
|
+
init_chunk_UZ72OHQN();
|
|
18465
|
+
init_chunk_6CHDJVQ6();
|
|
18466
|
+
init_chunk_U3X3BIQH();
|
|
18467
|
+
init_chunk_EYOBPUDN();
|
|
18459
18468
|
init_chunk_H6V7NEWR();
|
|
18460
18469
|
init_chunk_ZVIMTUGZ();
|
|
18461
18470
|
init_chunk_BVQCYBU6();
|
|
18462
|
-
|
|
18471
|
+
init_chunk_5PKKFSSF();
|
|
18463
18472
|
init_chunk_Z3SV3XTC();
|
|
18464
18473
|
init_chunk_NHC27NIE();
|
|
18465
18474
|
init_chunk_UMAPAGFH();
|
|
18466
|
-
init_chunk_W4XY3TYX();
|
|
18467
|
-
init_chunk_PMBOHJKA();
|
|
18468
|
-
init_chunk_U3X3BIQH();
|
|
18469
|
-
init_chunk_3LMWOJQX();
|
|
18470
18475
|
init_chunk_S4NDHW3Q();
|
|
18476
|
+
init_chunk_2PZIF56U();
|
|
18471
18477
|
init_chunk_UEJOG2Q7();
|
|
18472
18478
|
init_chunk_KEN2DASI();
|
|
18473
18479
|
init_chunk_YFNR2VM4();
|
|
@@ -18479,7 +18485,6 @@ var init_contracts = __esm({
|
|
|
18479
18485
|
init_chunk_PZPOUXJR();
|
|
18480
18486
|
init_chunk_LBDH7LCG();
|
|
18481
18487
|
init_chunk_4LXDRTO4();
|
|
18482
|
-
init_chunk_5PKKFSSF();
|
|
18483
18488
|
init_chunk_NVKU5PPQ();
|
|
18484
18489
|
init_chunk_A4YOU7H6();
|
|
18485
18490
|
init_chunk_FECLIZTY();
|
|
@@ -18490,7 +18495,6 @@ var init_contracts = __esm({
|
|
|
18490
18495
|
init_chunk_X5PZZVTS();
|
|
18491
18496
|
init_chunk_PIZTARVG();
|
|
18492
18497
|
init_chunk_OMPT4ZHR();
|
|
18493
|
-
init_chunk_2PZIF56U();
|
|
18494
18498
|
init_chunk_6J742GLA();
|
|
18495
18499
|
init_chunk_ZRXP6OOJ();
|
|
18496
18500
|
init_chunk_BGNWWR6B();
|
|
@@ -19694,15 +19698,15 @@ function unreadArgumentRefusal(invocation, args2, reads, splitsAtFirstLongFlag)
|
|
|
19694
19698
|
function entryFlagRefusal(command2, args2, dataNamespaces) {
|
|
19695
19699
|
if (command2 === void 0 || HELP_AND_VERSION.includes(command2)) return null;
|
|
19696
19700
|
if (dataNamespaces.has(command2)) return null;
|
|
19697
|
-
const
|
|
19701
|
+
const words2 = [command2];
|
|
19698
19702
|
for (const arg of args2.slice(0, 2)) {
|
|
19699
19703
|
if (!/^[a-z][a-z-]*$/.test(arg)) break;
|
|
19700
|
-
|
|
19704
|
+
words2.push(arg);
|
|
19701
19705
|
}
|
|
19702
|
-
let named =
|
|
19703
|
-
let reads = PARSER_READS.get(
|
|
19704
|
-
while (reads === void 0 && --named > 0) reads = PARSER_READS.get(
|
|
19705
|
-
const invocation = `wayai ${
|
|
19706
|
+
let named = words2.length;
|
|
19707
|
+
let reads = PARSER_READS.get(words2.join(" "));
|
|
19708
|
+
while (reads === void 0 && --named > 0) reads = PARSER_READS.get(words2.slice(0, named).join(" "));
|
|
19709
|
+
const invocation = `wayai ${words2.slice(0, named || words2.length).join(" ")}`;
|
|
19706
19710
|
if (reads === "all") return null;
|
|
19707
19711
|
const dryRuns = args2.filter(isDryRunToken);
|
|
19708
19712
|
const readsBare = typeof reads === "object" && reads.dryRun === true;
|
|
@@ -20037,9 +20041,9 @@ function oldLayoutEntries(root, skills, oldLayout) {
|
|
|
20037
20041
|
function assertOldLayoutConvertible(root, skills, oldLayout, pullCommand3) {
|
|
20038
20042
|
const { leftover } = oldLayoutEntries(root, skills, oldLayout);
|
|
20039
20043
|
if (leftover.length === 0) return;
|
|
20040
|
-
const
|
|
20044
|
+
const one5 = leftover.length === 1;
|
|
20041
20045
|
throw expected(
|
|
20042
|
-
`${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 ${
|
|
20046
|
+
`${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 ${one5 ? "it" : "them"} out of ${path8.basename(root)}/ (a knowledge backup belongs outside the workspace), then run \`${pullCommand3}\` again. Nothing was written.`
|
|
20043
20047
|
);
|
|
20044
20048
|
}
|
|
20045
20049
|
function removeConvertedOldResources(root, skills, log, opts = {}) {
|
|
@@ -20295,10 +20299,10 @@ var init_resource_files = __esm({
|
|
|
20295
20299
|
var init_case_received_documents = __esm({
|
|
20296
20300
|
"../../packages/core/dist/contracts/case-received-documents.js"() {
|
|
20297
20301
|
"use strict";
|
|
20298
|
-
|
|
20299
|
-
|
|
20302
|
+
init_chunk_WYCUCSD5();
|
|
20303
|
+
init_chunk_6CHDJVQ6();
|
|
20300
20304
|
init_chunk_U3X3BIQH();
|
|
20301
|
-
|
|
20305
|
+
init_chunk_EYOBPUDN();
|
|
20302
20306
|
init_chunk_VROZDNLV();
|
|
20303
20307
|
init_chunk_733K4J4G();
|
|
20304
20308
|
init_chunk_PFPADFUC();
|
|
@@ -20356,10 +20360,10 @@ function toDataProxyPath(v1Path) {
|
|
|
20356
20360
|
}
|
|
20357
20361
|
return `${DATA_PROXY_PREFIX}${v1Path.slice(REKOR_V1_PREFIX.length)}`;
|
|
20358
20362
|
}
|
|
20359
|
-
function withOrgSelector(
|
|
20360
|
-
if (!orgId) return
|
|
20361
|
-
const separator =
|
|
20362
|
-
return `${
|
|
20363
|
+
function withOrgSelector(path51, orgId) {
|
|
20364
|
+
if (!orgId) return path51;
|
|
20365
|
+
const separator = path51.includes("?") ? "&" : "?";
|
|
20366
|
+
return `${path51}${separator}${DATA_PROXY_ORG_QUERY_PARAM}=${encodeURIComponent(orgId)}`;
|
|
20363
20367
|
}
|
|
20364
20368
|
function dataErrorMessage(err) {
|
|
20365
20369
|
if (!(err instanceof ApiError)) return null;
|
|
@@ -20399,13 +20403,13 @@ var init_api_client = __esm({
|
|
|
20399
20403
|
* telling them apart by body shape misreads one for the other.
|
|
20400
20404
|
*/
|
|
20401
20405
|
path;
|
|
20402
|
-
constructor(method,
|
|
20406
|
+
constructor(method, path51, status, body) {
|
|
20403
20407
|
const safeBody = maskSecretsInMessage(body);
|
|
20404
|
-
super(`API request failed: ${method} ${
|
|
20408
|
+
super(`API request failed: ${method} ${path51} (${status}): ${safeBody}`);
|
|
20405
20409
|
this.name = "ApiError";
|
|
20406
20410
|
this.status = status;
|
|
20407
20411
|
this.body = safeBody;
|
|
20408
|
-
this.path =
|
|
20412
|
+
this.path = path51;
|
|
20409
20413
|
}
|
|
20410
20414
|
/** True when the status code is a 4xx client error (expected user-facing condition, not a bug). */
|
|
20411
20415
|
get isExpected() {
|
|
@@ -20565,6 +20569,10 @@ var init_api_client = __esm({
|
|
|
20565
20569
|
async getCasePhaseWork(ref, phaseId) {
|
|
20566
20570
|
return this.request("GET", `${casePath(ref)}/phases/${encodeURIComponent(phaseId)}/work`);
|
|
20567
20571
|
}
|
|
20572
|
+
/** A phase's newest submission and its manifest, or null when it has none. */
|
|
20573
|
+
async getCaseDelivery(ref, phaseId) {
|
|
20574
|
+
return this.request("GET", `${casePath(ref)}/phases/${encodeURIComponent(phaseId)}/delivery`);
|
|
20575
|
+
}
|
|
20568
20576
|
/** A page of one phase's agenda groups. */
|
|
20569
20577
|
async getCaseAgenda(ref, phaseId, cursor) {
|
|
20570
20578
|
const params = new URLSearchParams({ phase_id: phaseId });
|
|
@@ -20605,8 +20613,8 @@ var init_api_client = __esm({
|
|
|
20605
20613
|
return this.request("GET", `${casePath(ref)}/files${qs ? `?${qs}` : ""}`);
|
|
20606
20614
|
}
|
|
20607
20615
|
/** A case file's bytes as the case holds them now. */
|
|
20608
|
-
async getCaseFileContent(ref,
|
|
20609
|
-
return (await this.download(`${casePath(ref)}/files/content?${new URLSearchParams({ path:
|
|
20616
|
+
async getCaseFileContent(ref, path51) {
|
|
20617
|
+
return (await this.download(`${casePath(ref)}/files/content?${new URLSearchParams({ path: path51 })}`)).bytes;
|
|
20610
20618
|
}
|
|
20611
20619
|
/**
|
|
20612
20620
|
* One revision of the case's files, in one multipart request: the revision's JSON, and each content it sends as a
|
|
@@ -20814,8 +20822,8 @@ var init_api_client = __esm({
|
|
|
20814
20822
|
...opts?.check && { check: true }
|
|
20815
20823
|
});
|
|
20816
20824
|
}
|
|
20817
|
-
async lookup(
|
|
20818
|
-
const params = new URLSearchParams({ path:
|
|
20825
|
+
async lookup(path51, opts) {
|
|
20826
|
+
const params = new URLSearchParams({ path: path51 });
|
|
20819
20827
|
if (opts?.organizationId) params.set("organization_id", opts.organizationId);
|
|
20820
20828
|
return this.request("GET", `/api/ci/lookup?${params.toString()}`);
|
|
20821
20829
|
}
|
|
@@ -21355,9 +21363,9 @@ var init_api_client = __esm({
|
|
|
21355
21363
|
`/api/admin/data-explorer/debug/observability/${encodeURIComponent(hubId)}/conversations/${encodeURIComponent(conversationId)}${qs}`
|
|
21356
21364
|
);
|
|
21357
21365
|
}
|
|
21358
|
-
async request(method,
|
|
21359
|
-
addApiBreadcrumb(method,
|
|
21360
|
-
const url = `${this.apiUrl}${
|
|
21366
|
+
async request(method, path51, body, extraHeaders, contentType) {
|
|
21367
|
+
addApiBreadcrumb(method, path51);
|
|
21368
|
+
const url = `${this.apiUrl}${path51}`;
|
|
21361
21369
|
let refreshedOn401 = false;
|
|
21362
21370
|
for (let retry = 0; ; retry++) {
|
|
21363
21371
|
let response = await this.send(url, method, body, extraHeaders, contentType);
|
|
@@ -21382,7 +21390,7 @@ var init_api_client = __esm({
|
|
|
21382
21390
|
await delay(RETRYABLE_BACKOFF_MS[retry]);
|
|
21383
21391
|
continue;
|
|
21384
21392
|
}
|
|
21385
|
-
throw new ApiError(method,
|
|
21393
|
+
throw new ApiError(method, path51, response.status, errorBody);
|
|
21386
21394
|
}
|
|
21387
21395
|
}
|
|
21388
21396
|
/**
|
|
@@ -21452,9 +21460,9 @@ var init_api_client = __esm({
|
|
|
21452
21460
|
return this.download(withOrgSelector(toDataProxyPath(v1Path), orgId));
|
|
21453
21461
|
}
|
|
21454
21462
|
/** A backend path's raw bytes (`dataDownload`'s read, for any path). */
|
|
21455
|
-
async download(
|
|
21456
|
-
addApiBreadcrumb("GET",
|
|
21457
|
-
const url = `${this.apiUrl}${
|
|
21463
|
+
async download(path51) {
|
|
21464
|
+
addApiBreadcrumb("GET", path51);
|
|
21465
|
+
const url = `${this.apiUrl}${path51}`;
|
|
21458
21466
|
let response = await this.send(url, "GET");
|
|
21459
21467
|
if (response.status === 401 && this.onUnauthorized) {
|
|
21460
21468
|
let refreshed;
|
|
@@ -21468,7 +21476,7 @@ var init_api_client = __esm({
|
|
|
21468
21476
|
}
|
|
21469
21477
|
}
|
|
21470
21478
|
if (!response.ok) {
|
|
21471
|
-
throw new ApiError("GET",
|
|
21479
|
+
throw new ApiError("GET", path51, response.status, await response.text());
|
|
21472
21480
|
}
|
|
21473
21481
|
return {
|
|
21474
21482
|
bytes: new Uint8Array(await response.arrayBuffer()),
|
|
@@ -21911,9 +21919,9 @@ function getVersionCachePath(filename = CLI_CACHE_FILE) {
|
|
|
21911
21919
|
}
|
|
21912
21920
|
function readVersionCache(filename = CLI_CACHE_FILE) {
|
|
21913
21921
|
try {
|
|
21914
|
-
const
|
|
21915
|
-
if (!existsSync4(
|
|
21916
|
-
const parsed = JSON.parse(readFileSync6(
|
|
21922
|
+
const path51 = getVersionCachePath(filename);
|
|
21923
|
+
if (!existsSync4(path51)) return null;
|
|
21924
|
+
const parsed = JSON.parse(readFileSync6(path51, "utf-8"));
|
|
21917
21925
|
if (typeof parsed.lastCheck !== "number") return null;
|
|
21918
21926
|
if (parsed.latest !== null && typeof parsed.latest !== "string") return null;
|
|
21919
21927
|
return parsed;
|
|
@@ -21933,10 +21941,10 @@ function isVersionCacheStale(filename = CLI_CACHE_FILE, maxAgeMs = MAX_AGE_24H_M
|
|
|
21933
21941
|
return Date.now() - cache.lastCheck > maxAgeMs;
|
|
21934
21942
|
}
|
|
21935
21943
|
function writeVersionCache(filename, cache) {
|
|
21936
|
-
const
|
|
21937
|
-
const dir = dirname6(
|
|
21944
|
+
const path51 = getVersionCachePath(filename);
|
|
21945
|
+
const dir = dirname6(path51);
|
|
21938
21946
|
if (!existsSync4(dir)) mkdirSync2(dir, { recursive: true });
|
|
21939
|
-
writeFileSync2(
|
|
21947
|
+
writeFileSync2(path51, JSON.stringify(cache));
|
|
21940
21948
|
}
|
|
21941
21949
|
function touchVersionCache(filename) {
|
|
21942
21950
|
writeVersionCache(filename, { lastCheck: Date.now(), latest: readVersionCache(filename)?.latest ?? null });
|
|
@@ -21975,14 +21983,14 @@ function parseFrontmatterVersion(content) {
|
|
|
21975
21983
|
function findInstalledSkills(projectRoot, paths = SKILL_INSTALL_PATHS) {
|
|
21976
21984
|
const found = [];
|
|
21977
21985
|
for (const rel of paths) {
|
|
21978
|
-
const
|
|
21979
|
-
if (!existsSync5(
|
|
21986
|
+
const path51 = join9(projectRoot, rel);
|
|
21987
|
+
if (!existsSync5(path51)) continue;
|
|
21980
21988
|
let version = null;
|
|
21981
21989
|
try {
|
|
21982
|
-
version = parseFrontmatterVersion(readFileSync7(
|
|
21990
|
+
version = parseFrontmatterVersion(readFileSync7(path51, "utf-8"));
|
|
21983
21991
|
} catch {
|
|
21984
21992
|
}
|
|
21985
|
-
found.push({ path:
|
|
21993
|
+
found.push({ path: path51, version });
|
|
21986
21994
|
}
|
|
21987
21995
|
return found;
|
|
21988
21996
|
}
|
|
@@ -23228,7 +23236,7 @@ function buildWorkspaceState(resolved) {
|
|
|
23228
23236
|
return { scoped: true, path: resolved.path, hub_count: hubCount };
|
|
23229
23237
|
}
|
|
23230
23238
|
async function statusCommand(args2, pkg2) {
|
|
23231
|
-
const { json } = parseArgs2(args2);
|
|
23239
|
+
const { json: json2 } = parseArgs2(args2);
|
|
23232
23240
|
const config = readConfig();
|
|
23233
23241
|
const resolvedRepo = resolveRepoConfig();
|
|
23234
23242
|
const repoConfig = resolvedRepo?.config ?? null;
|
|
@@ -23261,7 +23269,7 @@ async function statusCommand(args2, pkg2) {
|
|
|
23261
23269
|
worktree_binding: { hub_id: boundHubId },
|
|
23262
23270
|
worktree_lock: { hub_id: boundHubId }
|
|
23263
23271
|
};
|
|
23264
|
-
if (
|
|
23272
|
+
if (json2) {
|
|
23265
23273
|
console.log(JSON.stringify(snapshot2, null, 2));
|
|
23266
23274
|
} else {
|
|
23267
23275
|
console.log("Not logged in. Run `wayai login`.");
|
|
@@ -23318,7 +23326,7 @@ async function statusCommand(args2, pkg2) {
|
|
|
23318
23326
|
worktree_binding: { hub_id: boundHubId },
|
|
23319
23327
|
worktree_lock: { hub_id: boundHubId }
|
|
23320
23328
|
};
|
|
23321
|
-
if (
|
|
23329
|
+
if (json2) {
|
|
23322
23330
|
console.log(JSON.stringify(snapshot, null, 2));
|
|
23323
23331
|
return;
|
|
23324
23332
|
}
|
|
@@ -23394,11 +23402,11 @@ function parseArgs3(args2) {
|
|
|
23394
23402
|
return { json: args2.includes("--json") };
|
|
23395
23403
|
}
|
|
23396
23404
|
async function whoamiCommand(args2) {
|
|
23397
|
-
const { json } = parseArgs3(args2);
|
|
23405
|
+
const { json: json2 } = parseArgs3(args2);
|
|
23398
23406
|
const { config, accessToken } = await requireAuth();
|
|
23399
23407
|
const client = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
23400
23408
|
const me = await client.me();
|
|
23401
|
-
if (
|
|
23409
|
+
if (json2) {
|
|
23402
23410
|
console.log(JSON.stringify(me, null, 2));
|
|
23403
23411
|
return;
|
|
23404
23412
|
}
|
|
@@ -25915,12 +25923,12 @@ async function createDataClient(orgId, opts = {}) {
|
|
|
25915
25923
|
return orgId2;
|
|
25916
25924
|
}
|
|
25917
25925
|
return {
|
|
25918
|
-
async request(method,
|
|
25919
|
-
const envelope = await api.dataRequest(method,
|
|
25926
|
+
async request(method, path51, body, headers) {
|
|
25927
|
+
const envelope = await api.dataRequest(method, path51, body, org, headers);
|
|
25920
25928
|
return envelope.data;
|
|
25921
25929
|
},
|
|
25922
|
-
async requestRaw(method,
|
|
25923
|
-
const body_ = await api.dataRequest(method,
|
|
25930
|
+
async requestRaw(method, path51, body) {
|
|
25931
|
+
const body_ = await api.dataRequest(method, path51, body, org);
|
|
25924
25932
|
return body_;
|
|
25925
25933
|
},
|
|
25926
25934
|
async collectPages(makePath) {
|
|
@@ -30979,8 +30987,8 @@ var init_diff = __esm({
|
|
|
30979
30987
|
// src/lib/page-scaffold.ts
|
|
30980
30988
|
import * as yaml16 from "js-yaml";
|
|
30981
30989
|
function titleOf(slug) {
|
|
30982
|
-
const
|
|
30983
|
-
return
|
|
30990
|
+
const words2 = slug.split("-").join(" ");
|
|
30991
|
+
return words2.charAt(0).toUpperCase() + words2.slice(1);
|
|
30984
30992
|
}
|
|
30985
30993
|
function escapeHtml(text5) {
|
|
30986
30994
|
return text5.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
@@ -34262,15 +34270,15 @@ var init_caller_audio = __esm({
|
|
|
34262
34270
|
}
|
|
34263
34271
|
describe;
|
|
34264
34272
|
async clipFor(line) {
|
|
34265
|
-
const
|
|
34266
|
-
if (!
|
|
34273
|
+
const path51 = line.clip ? isAbsolute2(line.clip) ? line.clip : resolve10(this.planDir, line.clip) : this.dir ? join33(this.dir, `${line.n}.wav`) : null;
|
|
34274
|
+
if (!path51) throw new Error(`Line ${line.n} has no clip: give --clips <dir>, or a "clip" for it in the plan.`);
|
|
34267
34275
|
let buf;
|
|
34268
34276
|
try {
|
|
34269
|
-
buf = readFileSync17(
|
|
34277
|
+
buf = readFileSync17(path51);
|
|
34270
34278
|
} catch {
|
|
34271
|
-
throw new Error(`Line ${line.n}'s clip ${
|
|
34279
|
+
throw new Error(`Line ${line.n}'s clip ${path51} cannot be read.`);
|
|
34272
34280
|
}
|
|
34273
|
-
return parseWav(buf,
|
|
34281
|
+
return parseWav(buf, path51);
|
|
34274
34282
|
}
|
|
34275
34283
|
};
|
|
34276
34284
|
OPENAI_PCM_SAMPLE_RATE = 24e3;
|
|
@@ -34300,17 +34308,17 @@ ${text5}`).digest("hex");
|
|
|
34300
34308
|
return join33(this.cacheDir, `${key}.pcm`);
|
|
34301
34309
|
}
|
|
34302
34310
|
clipFor(line) {
|
|
34303
|
-
const
|
|
34304
|
-
let pending = this.inFlight.get(
|
|
34311
|
+
const path51 = this.cachePath(line.say);
|
|
34312
|
+
let pending = this.inFlight.get(path51);
|
|
34305
34313
|
if (!pending) {
|
|
34306
|
-
pending = this.readOrSynthesize(line,
|
|
34307
|
-
this.inFlight.set(
|
|
34314
|
+
pending = this.readOrSynthesize(line, path51);
|
|
34315
|
+
this.inFlight.set(path51, pending);
|
|
34308
34316
|
}
|
|
34309
34317
|
return pending;
|
|
34310
34318
|
}
|
|
34311
|
-
async readOrSynthesize(line,
|
|
34319
|
+
async readOrSynthesize(line, path51) {
|
|
34312
34320
|
try {
|
|
34313
|
-
return pcmClip(readFileSync17(
|
|
34321
|
+
return pcmClip(readFileSync17(path51));
|
|
34314
34322
|
} catch {
|
|
34315
34323
|
}
|
|
34316
34324
|
const res = await this.doFetch("https://api.openai.com/v1/audio/speech", {
|
|
@@ -34324,10 +34332,10 @@ ${text5}`).digest("hex");
|
|
|
34324
34332
|
}
|
|
34325
34333
|
const buf = Buffer.from(await res.arrayBuffer());
|
|
34326
34334
|
if (buf.length < 2) throw new Error(`OpenAI speech synthesis returned no audio for line ${line.n}.`);
|
|
34327
|
-
mkdirSync12(dirname12(
|
|
34328
|
-
const tmp = `${
|
|
34335
|
+
mkdirSync12(dirname12(path51), { recursive: true });
|
|
34336
|
+
const tmp = `${path51}.${process.pid}.tmp`;
|
|
34329
34337
|
writeFileSync7(tmp, buf);
|
|
34330
|
-
renameSync5(tmp,
|
|
34338
|
+
renameSync5(tmp, path51);
|
|
34331
34339
|
return pcmClip(buf);
|
|
34332
34340
|
}
|
|
34333
34341
|
};
|
|
@@ -35265,9 +35273,9 @@ function factLabel(fact) {
|
|
|
35265
35273
|
return `${fact.kind}:${fact.raw}`;
|
|
35266
35274
|
}
|
|
35267
35275
|
function tokens(text5) {
|
|
35268
|
-
const
|
|
35276
|
+
const words2 = normalizeText(text5).split(/[^a-z0-9]+/).filter((w) => w.length > 1 && !/^\d+$/.test(w) && !isNumberWord(w));
|
|
35269
35277
|
const facts = extractFacts(text5).map((f) => `#${f.kind}:${f.key}`);
|
|
35270
|
-
return /* @__PURE__ */ new Set([...
|
|
35278
|
+
return /* @__PURE__ */ new Set([...words2, ...facts]);
|
|
35271
35279
|
}
|
|
35272
35280
|
function similarity(a, b) {
|
|
35273
35281
|
const ta = tokens(a);
|
|
@@ -35306,8 +35314,8 @@ function percentile(values, p) {
|
|
|
35306
35314
|
function styleProblem(reply, maxSentenceWords) {
|
|
35307
35315
|
if (markdownToPlainText(reply) !== reply || LIST_MARKER.test(reply)) return "markdown";
|
|
35308
35316
|
for (const sentence of reply.split(/(?<=[.!?…])\s+|\n+/)) {
|
|
35309
|
-
const
|
|
35310
|
-
if (
|
|
35317
|
+
const words2 = sentence.trim().split(/\s+/).filter(Boolean).length;
|
|
35318
|
+
if (words2 > maxSentenceWords) return `a sentence of ${words2} words`;
|
|
35311
35319
|
}
|
|
35312
35320
|
return null;
|
|
35313
35321
|
}
|
|
@@ -35892,15 +35900,15 @@ function parseEvalCallArgs(args2) {
|
|
|
35892
35900
|
if (parsed.jsonPath) checkReportPath(parsed.jsonPath);
|
|
35893
35901
|
return parsed;
|
|
35894
35902
|
}
|
|
35895
|
-
function checkReportPath(
|
|
35896
|
-
const target = resolve11(
|
|
35903
|
+
function checkReportPath(path51) {
|
|
35904
|
+
const target = resolve11(path51);
|
|
35897
35905
|
const dir = dirname13(target);
|
|
35898
|
-
if (!existsSync17(dir) || !statSync8(dir).isDirectory()) fail(`--json ${
|
|
35899
|
-
if (existsSync17(target) && statSync8(target).isDirectory()) fail(`--json ${
|
|
35906
|
+
if (!existsSync17(dir) || !statSync8(dir).isDirectory()) fail(`--json ${path51}: the folder ${dir} does not exist.`);
|
|
35907
|
+
if (existsSync17(target) && statSync8(target).isDirectory()) fail(`--json ${path51} is a folder; name a file.`);
|
|
35900
35908
|
try {
|
|
35901
35909
|
accessSync(existsSync17(target) ? target : dir, fsConstants.W_OK);
|
|
35902
35910
|
} catch {
|
|
35903
|
-
fail(`--json ${
|
|
35911
|
+
fail(`--json ${path51} cannot be written here.`);
|
|
35904
35912
|
}
|
|
35905
35913
|
}
|
|
35906
35914
|
function suiteExitCode(report2, runs, reportWritten) {
|
|
@@ -37889,7 +37897,7 @@ function getFlagValue(args2, flag) {
|
|
|
37889
37897
|
return idx !== -1 ? args2[idx + 1] : void 0;
|
|
37890
37898
|
}
|
|
37891
37899
|
async function orgCreate(args2) {
|
|
37892
|
-
const
|
|
37900
|
+
const json2 = args2.includes("--json");
|
|
37893
37901
|
const name = firstPositional(args2);
|
|
37894
37902
|
if (!name) {
|
|
37895
37903
|
console.error('Usage: wayai org create "<name>" [--region <region>] [--json]');
|
|
@@ -37898,9 +37906,9 @@ async function orgCreate(args2) {
|
|
|
37898
37906
|
const region = getFlagValue(args2, "--region");
|
|
37899
37907
|
const { config, accessToken } = await requireAuth();
|
|
37900
37908
|
const client = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
37901
|
-
if (!
|
|
37909
|
+
if (!json2) console.log(`Creating organization "${name}"...`);
|
|
37902
37910
|
const { organization } = await client.createOrganization(name, region);
|
|
37903
|
-
if (
|
|
37911
|
+
if (json2) {
|
|
37904
37912
|
console.log(JSON.stringify(organization, null, 2));
|
|
37905
37913
|
return;
|
|
37906
37914
|
}
|
|
@@ -38021,24 +38029,24 @@ __export(list_exports, {
|
|
|
38021
38029
|
});
|
|
38022
38030
|
function parseArgs23(args2) {
|
|
38023
38031
|
let orgId;
|
|
38024
|
-
let
|
|
38032
|
+
let json2 = false;
|
|
38025
38033
|
for (let i = 0; i < args2.length; i++) {
|
|
38026
38034
|
if (args2[i] === "--org" && args2[i + 1]) {
|
|
38027
38035
|
orgId = args2[++i];
|
|
38028
38036
|
} else if (args2[i] === "--json") {
|
|
38029
|
-
|
|
38037
|
+
json2 = true;
|
|
38030
38038
|
}
|
|
38031
38039
|
}
|
|
38032
|
-
return { orgId, json };
|
|
38040
|
+
return { orgId, json: json2 };
|
|
38033
38041
|
}
|
|
38034
38042
|
async function listCommand(args2) {
|
|
38035
|
-
const { orgId, json } = parseArgs23(args2);
|
|
38043
|
+
const { orgId, json: json2 } = parseArgs23(args2);
|
|
38036
38044
|
const { config, accessToken } = await requireAuth();
|
|
38037
38045
|
const client = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
38038
38046
|
const { organizations } = await client.organizations();
|
|
38039
38047
|
const orgsToList = orgId ? organizations.filter((o) => o.id === orgId) : organizations;
|
|
38040
38048
|
if (orgsToList.length === 0) {
|
|
38041
|
-
if (
|
|
38049
|
+
if (json2) {
|
|
38042
38050
|
console.log(JSON.stringify({ organizations: [] }, null, 2));
|
|
38043
38051
|
} else {
|
|
38044
38052
|
console.log(orgId ? `Organization ${orgId} not found.` : "No organizations found.");
|
|
@@ -38048,7 +38056,7 @@ async function listCommand(args2) {
|
|
|
38048
38056
|
const results = await Promise.all(
|
|
38049
38057
|
orgsToList.map((org) => client.listHubs(org.id).then((r) => ({ org, hubs: r.hubs })))
|
|
38050
38058
|
);
|
|
38051
|
-
if (
|
|
38059
|
+
if (json2) {
|
|
38052
38060
|
const payload = {
|
|
38053
38061
|
organizations: results.map(({ org, hubs }) => ({
|
|
38054
38062
|
organization_id: org.id,
|
|
@@ -38149,7 +38157,7 @@ async function communitiesCommand(args2) {
|
|
|
38149
38157
|
console.log(USAGE3);
|
|
38150
38158
|
return;
|
|
38151
38159
|
}
|
|
38152
|
-
const { positionals, org, json, yes } = parse(args2);
|
|
38160
|
+
const { positionals, org, json: json2, yes } = parse(args2);
|
|
38153
38161
|
const [sub, ...rest] = positionals;
|
|
38154
38162
|
if (sub === void 0) throw usageError2("No subcommand given.");
|
|
38155
38163
|
if (!SUBCOMMANDS.includes(sub)) throw usageError2(`Unknown subcommand ${JSON.stringify(sub)}.`);
|
|
@@ -38166,19 +38174,19 @@ async function communitiesCommand(args2) {
|
|
|
38166
38174
|
switch (sub) {
|
|
38167
38175
|
case "list":
|
|
38168
38176
|
if (rest.length > 0) throw usageError2(`Unexpected argument ${JSON.stringify(rest[0])}.`);
|
|
38169
|
-
return runList(resolveOrgId(org),
|
|
38177
|
+
return runList(resolveOrgId(org), json2);
|
|
38170
38178
|
case "join-link": {
|
|
38171
38179
|
const [, selector, ...extra] = rest;
|
|
38172
38180
|
if (selector === void 0 || extra.length > 0) throw usageError2(`join-link ${action} takes one <community>.`);
|
|
38173
38181
|
if (changesLink && !yes && !isInteractive()) {
|
|
38174
38182
|
throw usageError2(`join-link ${action} asks before it changes the link; pass -y when not running in a terminal.`);
|
|
38175
38183
|
}
|
|
38176
|
-
return runJoinLink(action, targetOf(selector, org), { json, yes });
|
|
38184
|
+
return runJoinLink(action, targetOf(selector, org), { json: json2, yes });
|
|
38177
38185
|
}
|
|
38178
38186
|
case "stats": {
|
|
38179
38187
|
const [selector, ...extra] = rest;
|
|
38180
38188
|
if (selector === void 0 || extra.length > 0) throw usageError2("stats takes one <community>.");
|
|
38181
|
-
return runStats(targetOf(selector, org),
|
|
38189
|
+
return runStats(targetOf(selector, org), json2);
|
|
38182
38190
|
}
|
|
38183
38191
|
case "access": {
|
|
38184
38192
|
const [, selector, ...emails] = rest;
|
|
@@ -38191,16 +38199,16 @@ async function communitiesCommand(args2) {
|
|
|
38191
38199
|
throw usageError2("access remove asks before it removes anyone; pass -y when not running in a terminal.");
|
|
38192
38200
|
}
|
|
38193
38201
|
const target = targetOf(selector, org);
|
|
38194
|
-
if (action === "list") return runAccessList(target,
|
|
38195
|
-
if (action === "add") return runAccessAdd(target, valid,
|
|
38196
|
-
return runAccessRemove(target, valid[0], { json, yes });
|
|
38202
|
+
if (action === "list") return runAccessList(target, json2);
|
|
38203
|
+
if (action === "add") return runAccessAdd(target, valid, json2);
|
|
38204
|
+
return runAccessRemove(target, valid[0], { json: json2, yes });
|
|
38197
38205
|
}
|
|
38198
38206
|
}
|
|
38199
38207
|
}
|
|
38200
|
-
async function runList(orgId,
|
|
38208
|
+
async function runList(orgId, json2) {
|
|
38201
38209
|
const api = await communitiesClient();
|
|
38202
38210
|
const { data } = await callCommunities(api.listOrgCommunities(orgId), orgNotFound(orgId));
|
|
38203
|
-
if (
|
|
38211
|
+
if (json2) {
|
|
38204
38212
|
console.log(JSON.stringify(data, null, 2));
|
|
38205
38213
|
return;
|
|
38206
38214
|
}
|
|
@@ -38212,13 +38220,13 @@ async function runList(orgId, json) {
|
|
|
38212
38220
|
`);
|
|
38213
38221
|
printRows(data.map((c) => ({ name: c.name, community_id: c.community_id, created_at: c.created_at })));
|
|
38214
38222
|
}
|
|
38215
|
-
async function runJoinLink(action, target, { json, yes }) {
|
|
38223
|
+
async function runJoinLink(action, target, { json: json2, yes }) {
|
|
38216
38224
|
const api = await communitiesClient();
|
|
38217
38225
|
const { id, label: label3 } = await resolveCommunity(api, target);
|
|
38218
38226
|
const notFound = communityNotFound(label3);
|
|
38219
38227
|
if (action === "get") {
|
|
38220
38228
|
const { data: data2 } = await callCommunities(api.getCommunityJoinLink(id), notFound);
|
|
38221
|
-
printLink(data2, label3,
|
|
38229
|
+
printLink(data2, label3, json2);
|
|
38222
38230
|
return;
|
|
38223
38231
|
}
|
|
38224
38232
|
await warnThenAsk(
|
|
@@ -38233,14 +38241,14 @@ async function runJoinLink(action, target, { json, yes }) {
|
|
|
38233
38241
|
action === "rotate" ? api.replaceCommunityJoinLink(id) : api.disableCommunityJoinLink(id),
|
|
38234
38242
|
notFound
|
|
38235
38243
|
);
|
|
38236
|
-
printLink(data, label3,
|
|
38244
|
+
printLink(data, label3, json2);
|
|
38237
38245
|
}
|
|
38238
38246
|
async function warnThenAsk(warning, yes, aborted) {
|
|
38239
38247
|
for (const line of warning) console.error(line);
|
|
38240
38248
|
if (!yes && !await confirm("Proceed?")) throw expected(aborted);
|
|
38241
38249
|
}
|
|
38242
|
-
function printLink(link, label3,
|
|
38243
|
-
if (
|
|
38250
|
+
function printLink(link, label3, json2) {
|
|
38251
|
+
if (json2) {
|
|
38244
38252
|
console.log(JSON.stringify(link, null, 2));
|
|
38245
38253
|
return;
|
|
38246
38254
|
}
|
|
@@ -38251,11 +38259,11 @@ function printLink(link, label3, json) {
|
|
|
38251
38259
|
}
|
|
38252
38260
|
console.log(`The join link of ${label3} is off. \`wayai communities join-link rotate\` makes a new one.`);
|
|
38253
38261
|
}
|
|
38254
|
-
async function runStats(target,
|
|
38262
|
+
async function runStats(target, json2) {
|
|
38255
38263
|
const api = await communitiesClient();
|
|
38256
38264
|
const { id, label: label3 } = await resolveCommunity(api, target);
|
|
38257
38265
|
const { data } = await callCommunities(api.getCommunityStats(id), communityNotFound(label3));
|
|
38258
|
-
if (
|
|
38266
|
+
if (json2) {
|
|
38259
38267
|
console.log(JSON.stringify(data, null, 2));
|
|
38260
38268
|
return;
|
|
38261
38269
|
}
|
|
@@ -38335,12 +38343,12 @@ async function* accessPages(api, id, notFound) {
|
|
|
38335
38343
|
cursor = data.next_cursor ?? void 0;
|
|
38336
38344
|
} while (cursor !== void 0);
|
|
38337
38345
|
}
|
|
38338
|
-
async function runAccessList(target,
|
|
38346
|
+
async function runAccessList(target, json2) {
|
|
38339
38347
|
const api = await communitiesClient();
|
|
38340
38348
|
const { id, label: label3 } = await resolveCommunity(api, target);
|
|
38341
38349
|
const entries = [];
|
|
38342
38350
|
for await (const page of accessPages(api, id, communityNotFound(label3))) entries.push(...page);
|
|
38343
|
-
if (
|
|
38351
|
+
if (json2) {
|
|
38344
38352
|
console.log(JSON.stringify(entries, null, 2));
|
|
38345
38353
|
return;
|
|
38346
38354
|
}
|
|
@@ -38352,11 +38360,11 @@ async function runAccessList(target, json) {
|
|
|
38352
38360
|
`);
|
|
38353
38361
|
printRows(entries.map((entry) => ({ email: entry.email, added: entry.created_at })));
|
|
38354
38362
|
}
|
|
38355
|
-
async function runAccessAdd(target, emails,
|
|
38363
|
+
async function runAccessAdd(target, emails, json2) {
|
|
38356
38364
|
const api = await communitiesClient();
|
|
38357
38365
|
const { id, label: label3 } = await resolveCommunity(api, target);
|
|
38358
38366
|
const { data } = await callAccess(api.addCommunityAccess(id, { emails }), communityNotFound(label3), label3);
|
|
38359
|
-
if (
|
|
38367
|
+
if (json2) {
|
|
38360
38368
|
console.log(JSON.stringify(data, null, 2));
|
|
38361
38369
|
return;
|
|
38362
38370
|
}
|
|
@@ -38364,7 +38372,7 @@ async function runAccessAdd(target, emails, json) {
|
|
|
38364
38372
|
const listed3 = already === 0 ? "" : `; ${already} ${already === 1 ? "was" : "were"} already on it`;
|
|
38365
38373
|
console.log(`Added ${added.length} email(s) to the access list of ${label3}${listed3}.`);
|
|
38366
38374
|
}
|
|
38367
|
-
async function runAccessRemove(target, email, { json, yes }) {
|
|
38375
|
+
async function runAccessRemove(target, email, { json: json2, yes }) {
|
|
38368
38376
|
const api = await communitiesClient();
|
|
38369
38377
|
const { id, label: label3 } = await resolveCommunity(api, target);
|
|
38370
38378
|
let entry;
|
|
@@ -38383,7 +38391,7 @@ async function runAccessRemove(target, email, { json, yes }) {
|
|
|
38383
38391
|
`${email} is no longer on the access list of ${label3}, or you are not an owner or admin of its organization. Nothing was removed.`,
|
|
38384
38392
|
label3
|
|
38385
38393
|
);
|
|
38386
|
-
if (
|
|
38394
|
+
if (json2) {
|
|
38387
38395
|
console.log(JSON.stringify(entry, null, 2));
|
|
38388
38396
|
return;
|
|
38389
38397
|
}
|
|
@@ -40008,25 +40016,25 @@ var init_plan = __esm({
|
|
|
40008
40016
|
constructor(paths = []) {
|
|
40009
40017
|
for (const p of paths) this.add(p);
|
|
40010
40018
|
}
|
|
40011
|
-
add(
|
|
40012
|
-
this.cases.add(
|
|
40013
|
-
this.files.add(
|
|
40014
|
-
const segments =
|
|
40019
|
+
add(path51) {
|
|
40020
|
+
this.cases.add(path51);
|
|
40021
|
+
this.files.add(path51);
|
|
40022
|
+
const segments = path51.split("/");
|
|
40015
40023
|
for (let i = 1; i < segments.length; i++) {
|
|
40016
40024
|
const folder = segments.slice(0, i).join("/");
|
|
40017
|
-
if (!this.folders.has(folder)) this.folders.set(folder,
|
|
40025
|
+
if (!this.folders.has(folder)) this.folders.set(folder, path51);
|
|
40018
40026
|
}
|
|
40019
40027
|
}
|
|
40020
40028
|
/** The path `path` would collide with, and how; undefined when it collides with none. */
|
|
40021
|
-
clash(
|
|
40022
|
-
const twin = this.cases.twinOf(
|
|
40029
|
+
clash(path51) {
|
|
40030
|
+
const twin = this.cases.twinOf(path51);
|
|
40023
40031
|
if (twin !== void 0) return { reason: "case_twin", other: twin };
|
|
40024
|
-
const segments =
|
|
40032
|
+
const segments = path51.split("/");
|
|
40025
40033
|
for (let i = 1; i < segments.length; i++) {
|
|
40026
40034
|
const folder = segments.slice(0, i).join("/");
|
|
40027
40035
|
if (this.files.has(folder)) return { reason: "file_folder", other: folder };
|
|
40028
40036
|
}
|
|
40029
|
-
const inside = this.folders.get(
|
|
40037
|
+
const inside = this.folders.get(path51);
|
|
40030
40038
|
return inside === void 0 ? void 0 : { reason: "file_folder", other: inside };
|
|
40031
40039
|
}
|
|
40032
40040
|
};
|
|
@@ -40090,9 +40098,9 @@ async function openRemote2() {
|
|
|
40090
40098
|
)
|
|
40091
40099
|
});
|
|
40092
40100
|
return {
|
|
40093
|
-
request: (method,
|
|
40094
|
-
upload: (
|
|
40095
|
-
download: (
|
|
40101
|
+
request: (method, path51, body, headers) => pacer.run(() => client.request(method, path51, body, headers)),
|
|
40102
|
+
upload: (path51, bytes, contentType, headers) => pacer.run(() => client.upload(path51, bytes, contentType, headers)),
|
|
40103
|
+
download: (path51) => pacer.run(() => client.download(path51))
|
|
40096
40104
|
};
|
|
40097
40105
|
}
|
|
40098
40106
|
function filesRoot(t) {
|
|
@@ -40225,13 +40233,13 @@ async function pullFiles(opts) {
|
|
|
40225
40233
|
conflicts.push({ rel: w.rel, ...clash });
|
|
40226
40234
|
continue;
|
|
40227
40235
|
}
|
|
40228
|
-
const
|
|
40236
|
+
const path51 = filePath2(target, w.rel);
|
|
40229
40237
|
let bytes;
|
|
40230
40238
|
let version = w.remote.version;
|
|
40231
40239
|
try {
|
|
40232
|
-
bytes = (await client.download(
|
|
40240
|
+
bytes = (await client.download(path51)).bytes;
|
|
40233
40241
|
if (computeHash(bytes) !== w.remote.content_sha256) {
|
|
40234
|
-
const meta = await client.request("GET", `${
|
|
40242
|
+
const meta = await client.request("GET", `${path51}?meta=1`);
|
|
40235
40243
|
if (meta?.content_sha256 !== computeHash(bytes)) {
|
|
40236
40244
|
changedWhilePulling.push(w.rel);
|
|
40237
40245
|
continue;
|
|
@@ -40360,7 +40368,7 @@ Push ${n} change${n === 1 ? "" : "s"} to ${describeSync(target)}?`, opts.yes)) {
|
|
|
40360
40368
|
let pushed = 0;
|
|
40361
40369
|
const refusedDeletes = /* @__PURE__ */ new Set();
|
|
40362
40370
|
for (const step of plan.steps) {
|
|
40363
|
-
const
|
|
40371
|
+
const path51 = filePath2(target, step.rel);
|
|
40364
40372
|
const blockedBy = step.op === "create" ? step.after?.find((d) => refusedDeletes.has(d.rel)) : void 0;
|
|
40365
40373
|
if (blockedBy !== void 0) {
|
|
40366
40374
|
const conflict = { rel: step.rel, reason: blockedBy.reason, other: blockedBy.rel };
|
|
@@ -40370,7 +40378,7 @@ Push ${n} change${n === 1 ? "" : "s"} to ${describeSync(target)}?`, opts.yes)) {
|
|
|
40370
40378
|
}
|
|
40371
40379
|
try {
|
|
40372
40380
|
if (step.op === "delete") {
|
|
40373
|
-
await client.request("DELETE",
|
|
40381
|
+
await client.request("DELETE", path51, void 0, fileWriteHeaders({ ifMatch: step.ifMatch }));
|
|
40374
40382
|
delete record.files[step.rel];
|
|
40375
40383
|
} else {
|
|
40376
40384
|
const bytes = readLocal2(dir, step.rel);
|
|
@@ -40379,7 +40387,7 @@ Push ${n} change${n === 1 ? "" : "s"} to ${describeSync(target)}?`, opts.yes)) {
|
|
|
40379
40387
|
}
|
|
40380
40388
|
const contentType = step.op === "update" ? step.remote.content_type : guessMimeType(step.rel) ?? "application/octet-stream";
|
|
40381
40389
|
const row = await client.upload(
|
|
40382
|
-
|
|
40390
|
+
path51,
|
|
40383
40391
|
bytes,
|
|
40384
40392
|
contentType,
|
|
40385
40393
|
fileWriteHeaders({ ...step.op === "update" ? { ifMatch: step.ifMatch } : { createOnly: true }, label: label3 })
|
|
@@ -40466,9 +40474,420 @@ var init_sync3 = __esm({
|
|
|
40466
40474
|
}
|
|
40467
40475
|
});
|
|
40468
40476
|
|
|
40469
|
-
// src/cases/case-
|
|
40477
|
+
// src/cases/case-mirror.ts
|
|
40478
|
+
import * as crypto4 from "crypto";
|
|
40470
40479
|
import * as fs35 from "fs";
|
|
40480
|
+
import * as os4 from "os";
|
|
40471
40481
|
import * as path47 from "path";
|
|
40482
|
+
function shownEntries(revision, confidential) {
|
|
40483
|
+
return confidential ? revision.entries : revision.entries.filter((e) => !e.confidential && !isConfPath(e.path));
|
|
40484
|
+
}
|
|
40485
|
+
function isBaseline(b) {
|
|
40486
|
+
return isObject(b) && typeof b.at === "string" && typeof b.confidential === "boolean" && (b.revision_at === null || typeof b.revision_at === "string") && (b.status === null || typeof b.status === "string") && isStringMap(b.phases) && isStringMap(b.tasks) && isStringMap(b.groups) && isDeliveries(b.deliveries);
|
|
40487
|
+
}
|
|
40488
|
+
function isMirrorRecord(v) {
|
|
40489
|
+
return isObject(v) && typeof v.org_id === "string" && typeof v.space_id === "string" && typeof v.code === "string" && (v.last_pull === null || isBaseline(v.last_pull));
|
|
40490
|
+
}
|
|
40491
|
+
function mirrorFolder(root) {
|
|
40492
|
+
const dir = path47.join(root, CASE_MIRROR_DIR);
|
|
40493
|
+
let st;
|
|
40494
|
+
try {
|
|
40495
|
+
st = fs35.lstatSync(dir);
|
|
40496
|
+
} catch {
|
|
40497
|
+
return null;
|
|
40498
|
+
}
|
|
40499
|
+
if (!st.isDirectory()) {
|
|
40500
|
+
throw expected(`${safe2(dir)} is a symlink or not a folder. It is the case's mirror, which the CLI writes: move it aside, then pull again.`);
|
|
40501
|
+
}
|
|
40502
|
+
requireOwn(dir);
|
|
40503
|
+
return dir;
|
|
40504
|
+
}
|
|
40505
|
+
function readBaseline(root, detail, record) {
|
|
40506
|
+
const dir = mirrorFolder(root);
|
|
40507
|
+
if (!dir) return null;
|
|
40508
|
+
const file = path47.join(dir, RECORD_FILE2);
|
|
40509
|
+
requireOwn(file);
|
|
40510
|
+
const text5 = readRealFileOrThrow(root, file);
|
|
40511
|
+
if (text5 === null) return null;
|
|
40512
|
+
let parsed;
|
|
40513
|
+
try {
|
|
40514
|
+
parsed = JSON.parse(text5);
|
|
40515
|
+
} catch {
|
|
40516
|
+
return null;
|
|
40517
|
+
}
|
|
40518
|
+
if (!isMirrorRecord(parsed)) return null;
|
|
40519
|
+
if (parsed.org_id !== record.org_id || parsed.space_id !== record.space_id || parsed.code !== detail.code) return null;
|
|
40520
|
+
return parsed.last_pull;
|
|
40521
|
+
}
|
|
40522
|
+
async function readAgenda(calls, phaseId) {
|
|
40523
|
+
const { api, connection } = calls.session;
|
|
40524
|
+
const groups = [];
|
|
40525
|
+
let cursor;
|
|
40526
|
+
for (let page = 0; page < AGENDA_PAGES_READ2; page++) {
|
|
40527
|
+
const { groups: got, next_cursor } = (await calls.run(() => api.getCaseAgenda(connection, phaseId, cursor))).data;
|
|
40528
|
+
groups.push(...got);
|
|
40529
|
+
if (!next_cursor) return { groups, more: false };
|
|
40530
|
+
cursor = next_cursor;
|
|
40531
|
+
}
|
|
40532
|
+
return { groups, more: true };
|
|
40533
|
+
}
|
|
40534
|
+
async function readWork(calls, detail, confidential) {
|
|
40535
|
+
const { api, connection } = calls.session;
|
|
40536
|
+
const state = (await calls.run(() => api.getCaseState(connection))).data;
|
|
40537
|
+
if (state.view !== "work") return { state, phases: [], approved: [] };
|
|
40538
|
+
const folders = new Map(detail.phases.map((p) => [p.phase_id, p.folder]));
|
|
40539
|
+
const underWay = state.state.phases.filter((p) => p.status === "in_progress").map((p) => p.phase_id);
|
|
40540
|
+
const [phases, approved] = await Promise.all([
|
|
40541
|
+
Promise.all(underWay.map(async (phaseId) => {
|
|
40542
|
+
const [work, agenda, delivery] = await Promise.all([
|
|
40543
|
+
calls.run(() => api.getCasePhaseWork(connection, phaseId)),
|
|
40544
|
+
readAgenda(calls, phaseId),
|
|
40545
|
+
calls.run(() => api.getCaseDelivery(connection, phaseId))
|
|
40546
|
+
]);
|
|
40547
|
+
return { phase_id: phaseId, folder: folders.get(phaseId) ?? "", work: work.data, groups: agenda.groups, more_groups: agenda.more, delivery: delivery.data };
|
|
40548
|
+
})),
|
|
40549
|
+
calls.run(() => api.listCaseApprovedDecisions(connection, confidential))
|
|
40550
|
+
]);
|
|
40551
|
+
return { state, phases, approved: approved.data };
|
|
40552
|
+
}
|
|
40553
|
+
async function revisionsSince(calls, after, confidential) {
|
|
40554
|
+
const { api, connection } = calls.session;
|
|
40555
|
+
const out = [];
|
|
40556
|
+
let newest = after ?? null;
|
|
40557
|
+
let cursor;
|
|
40558
|
+
const pages = after === void 0 ? 1 : SUMMARY_REVISION_PAGES;
|
|
40559
|
+
for (let page = 0; page < pages; page++) {
|
|
40560
|
+
const { revisions, next_cursor } = (await calls.run(() => api.listCaseRevisions(connection, { cursor, limit: CASE_REVISIONS_PAGE_MAX }))).data;
|
|
40561
|
+
for (const revision of revisions) {
|
|
40562
|
+
if (after !== void 0 && after !== null && revision.created_at <= after) return { revisions: out, more: false, newest_at: newest };
|
|
40563
|
+
const entries = shownEntries(revision, confidential);
|
|
40564
|
+
if (entries.length === 0) continue;
|
|
40565
|
+
if (newest === null || revision.created_at > newest) newest = revision.created_at;
|
|
40566
|
+
if (after !== void 0) out.push({ ...revision, entries });
|
|
40567
|
+
}
|
|
40568
|
+
if (!next_cursor) return { revisions: out, more: false, newest_at: newest };
|
|
40569
|
+
cursor = next_cursor;
|
|
40570
|
+
}
|
|
40571
|
+
return { revisions: out, more: after !== void 0, newest_at: newest };
|
|
40572
|
+
}
|
|
40573
|
+
function snapshotOf(work) {
|
|
40574
|
+
if (!work) return { status: null, phases: {}, tasks: {}, groups: {}, deliveries: {} };
|
|
40575
|
+
if (work.state.view === "phases") {
|
|
40576
|
+
return { status: work.state.status, phases: Object.fromEntries(work.state.phases.map((p) => [p.phase_id, p.status])), tasks: {}, groups: {}, deliveries: {} };
|
|
40577
|
+
}
|
|
40578
|
+
const { state } = work.state;
|
|
40579
|
+
return {
|
|
40580
|
+
status: state.status,
|
|
40581
|
+
phases: Object.fromEntries(state.phases.map((p) => [p.phase_id, p.status])),
|
|
40582
|
+
tasks: Object.fromEntries(state.tasks.map((t) => [t.case_task_id, t.status])),
|
|
40583
|
+
groups: Object.fromEntries(state.agenda_groups.map((g) => [g.agenda_group_id, g.status])),
|
|
40584
|
+
deliveries: Object.fromEntries(work.phases.map((p) => [p.phase_id, p.delivery ? { submission_id: p.delivery.submission_id, state: p.delivery.state } : null]))
|
|
40585
|
+
};
|
|
40586
|
+
}
|
|
40587
|
+
function statusSections(detail, work, before, now) {
|
|
40588
|
+
const phase = new Map(detail.phases.map((p) => [p.phase_id, `${one2(p.folder)} (${one2(p.name)})`]));
|
|
40589
|
+
const task = new Map((detail.tasks ?? []).map((t) => [t.case_task_id, `${one2(t.name)} [${t.case_task_id}]`]));
|
|
40590
|
+
const group = new Map(work.phases.flatMap((p) => p.groups.map((g) => [g.agenda_group_id, `${one2(g.code)} (${one2(g.name)})`])));
|
|
40591
|
+
const changes = (prev, next, name, added) => Object.entries(next).flatMap(([id, status]) => {
|
|
40592
|
+
const was = prev[id];
|
|
40593
|
+
if (was === void 0) return added ? [`${name(id)}: new, ${words(status)}`] : [];
|
|
40594
|
+
return was === status ? [] : [`${name(id)}: ${words(was)} \u2192 ${words(status)}`];
|
|
40595
|
+
});
|
|
40596
|
+
const sections = [];
|
|
40597
|
+
if (before.status !== null && now.status !== null && before.status !== now.status) {
|
|
40598
|
+
sections.push({ title: "The case", lines: [`${words(before.status)} \u2192 ${words(now.status)}`] });
|
|
40599
|
+
}
|
|
40600
|
+
sections.push({ title: "Phases", lines: changes(before.phases, now.phases, (id) => phase.get(id) ?? "a phase", false) });
|
|
40601
|
+
sections.push({ title: "Tasks", lines: changes(before.tasks, now.tasks, (id) => task.get(id) ?? `a task [${id}]`, true) });
|
|
40602
|
+
sections.push({ title: "Agenda groups", lines: changes(before.groups, now.groups, (id) => group.get(id) ?? "an agenda group of a phase not under way", false) });
|
|
40603
|
+
const deliveries = work.phases.flatMap((p) => {
|
|
40604
|
+
if (!(p.phase_id in before.deliveries) || !p.delivery) return [];
|
|
40605
|
+
const was = before.deliveries[p.phase_id];
|
|
40606
|
+
if (was?.submission_id === p.delivery.submission_id && was.state === p.delivery.state) return [];
|
|
40607
|
+
const change = was?.submission_id === p.delivery.submission_id ? `its submission is now ${words(p.delivery.state)}` : `a new submission, ${words(p.delivery.state)}`;
|
|
40608
|
+
return [`${phase.get(p.phase_id) ?? "a phase"}: ${change}`];
|
|
40609
|
+
});
|
|
40610
|
+
sections.push({ title: "Deliveries", lines: deliveries });
|
|
40611
|
+
return sections;
|
|
40612
|
+
}
|
|
40613
|
+
function filesSection(input) {
|
|
40614
|
+
const now = new Map(input.files.filter((f) => input.inRun(f.path)).map((f) => [f.path, f.sha]));
|
|
40615
|
+
const before = new Map(Object.entries(input.record.files).filter(([rel]) => input.inRun(rel)).map(([rel, f]) => [rel, f.sha]));
|
|
40616
|
+
const lines = [];
|
|
40617
|
+
for (const [rel, sha] of now) {
|
|
40618
|
+
if (!before.has(rel)) lines.push(`+ ${safe2(rel)}`);
|
|
40619
|
+
else if (before.get(rel) !== sha) lines.push(`~ ${safe2(rel)}`);
|
|
40620
|
+
}
|
|
40621
|
+
for (const rel of before.keys()) if (!now.has(rel)) lines.push(`- ${safe2(rel)} (removed, or no longer readable here)`);
|
|
40622
|
+
return { title: "Files on the case that differ from what this clone last pulled", lines: lines.sort((a, b) => a.slice(2) < b.slice(2) ? -1 : 1) };
|
|
40623
|
+
}
|
|
40624
|
+
function revisionsSection(since, hideMessages) {
|
|
40625
|
+
const lines = since.revisions.flatMap((r) => {
|
|
40626
|
+
const author = r.author?.display_name ? one2(r.author.display_name) : "a person no longer named";
|
|
40627
|
+
const message = r.message !== null && !hideMessages ? `: ${one2(r.message)}` : "";
|
|
40628
|
+
return [`revision ${r.revision_id}, ${r.created_at}, ${author} (${r.channel})${message}`, ...r.entries.map((e) => ` ${safe2(e.path)}${e.sha === null ? " (removed)" : ""}`)];
|
|
40629
|
+
});
|
|
40630
|
+
if (since.more) lines.push("\u2026 and older ones: `wayai cases log` lists them all.");
|
|
40631
|
+
return { title: "Revisions", lines };
|
|
40632
|
+
}
|
|
40633
|
+
function renderSections(sections) {
|
|
40634
|
+
return sections.filter((s) => s.lines.length > 0).flatMap((s) => [`${s.title}:`, ...s.lines.map((l) => ` ${l}`)]);
|
|
40635
|
+
}
|
|
40636
|
+
function readme(detail, at, withheld, confidential) {
|
|
40637
|
+
const parts = withheld ? [
|
|
40638
|
+
"This authorization holds the Confidential right, and the case's own reads give it confidential content whatever",
|
|
40639
|
+
"it asks: without --confidential this mirror holds none of them (case, status, evidence, agenda, deliveries)."
|
|
40640
|
+
] : [
|
|
40641
|
+
"- `case.json`: the case: its type and version, owner, parties, phases and their folders, tasks, and your access.",
|
|
40642
|
+
"- `status.json`: its status: each phase's, task's and agenda group's, why each is not done, and who can move it.",
|
|
40643
|
+
"- `evidence.json`: each phase under way: its inputs with their links, its outputs and its items.",
|
|
40644
|
+
"- `agenda.json`: each phase under way: its agenda groups and decisions; and the approved decisions.",
|
|
40645
|
+
"- `deliveries.json`: each phase under way: its newest submission and manifest."
|
|
40646
|
+
];
|
|
40647
|
+
return [
|
|
40648
|
+
`# Case ${safe2(detail.code)}: read-only mirror`,
|
|
40649
|
+
"",
|
|
40650
|
+
`Written ${at} by \`wayai cases clone\` or \`pull\`. Every pull rewrites this folder whole, and \`wayai cases push\` never sends`,
|
|
40651
|
+
"anything in it: an edit here is lost and never reaches the case.",
|
|
40652
|
+
"",
|
|
40653
|
+
`- \`${SUMMARY_FILE}\`: what changed on the case since your last pull.`,
|
|
40654
|
+
...parts,
|
|
40655
|
+
`- \`${CASE_MIRROR_HOOK_FILE}\`: the session-start hook. It refreshes this folder, never with --confidential.`,
|
|
40656
|
+
`- \`${RECORD_FILE2}\`: what the next pull compares with.`,
|
|
40657
|
+
"",
|
|
40658
|
+
"Not here: the registered texts of linked inputs (no read of a collection document's text reaches a case token yet),",
|
|
40659
|
+
"and the drafting checks (`wayai cases check --phase <folder>` reads them live).",
|
|
40660
|
+
...confidential ? [] : ["", MIRROR_CONFIDENTIAL_NOTICE],
|
|
40661
|
+
""
|
|
40662
|
+
].join("\n");
|
|
40663
|
+
}
|
|
40664
|
+
function lockOwnerStopped(text5) {
|
|
40665
|
+
const owner = text5 === null ? null : /^(\d+) (\S+) [0-9a-f]+$/.exec(text5) ?? null;
|
|
40666
|
+
if (!owner || owner[2] !== os4.hostname()) return false;
|
|
40667
|
+
try {
|
|
40668
|
+
process.kill(Number(owner[1]), 0);
|
|
40669
|
+
return false;
|
|
40670
|
+
} catch (err) {
|
|
40671
|
+
return err.code === "ESRCH";
|
|
40672
|
+
}
|
|
40673
|
+
}
|
|
40674
|
+
async function lockMirror(root) {
|
|
40675
|
+
const dir = path47.join(root, CASE_MIRROR_DIR);
|
|
40676
|
+
if (!mirrorFolder(root)) {
|
|
40677
|
+
try {
|
|
40678
|
+
fs35.mkdirSync(dir, { mode: CASE_FOLDER_MODE });
|
|
40679
|
+
fs35.chmodSync(dir, CASE_FOLDER_MODE);
|
|
40680
|
+
} catch (err) {
|
|
40681
|
+
if (err.code !== "EEXIST") throw err;
|
|
40682
|
+
}
|
|
40683
|
+
mirrorFolder(root);
|
|
40684
|
+
}
|
|
40685
|
+
const lock = path47.join(dir, LOCK_FILE);
|
|
40686
|
+
const mine = `${process.pid} ${os4.hostname()} ${crypto4.randomBytes(16).toString("hex")}`;
|
|
40687
|
+
const held = (file) => {
|
|
40688
|
+
try {
|
|
40689
|
+
return fs35.readFileSync(file, "utf-8");
|
|
40690
|
+
} catch {
|
|
40691
|
+
return null;
|
|
40692
|
+
}
|
|
40693
|
+
};
|
|
40694
|
+
const refusal2 = (err) => {
|
|
40695
|
+
const code2 = err.code;
|
|
40696
|
+
return code2 === "EACCES" || code2 === "EPERM" || code2 === "EROFS" ? expected(`The mirror's folder ${safe2(dir)} cannot be written (${code2}). Make it writable by you (it is the CLI's to write), then pull again.`) : err;
|
|
40697
|
+
};
|
|
40698
|
+
const deadline = Date.now() + LOCK_WAIT_MS;
|
|
40699
|
+
for (; ; ) {
|
|
40700
|
+
try {
|
|
40701
|
+
const fd = fs35.openSync(lock, "wx", 420);
|
|
40702
|
+
try {
|
|
40703
|
+
fs35.writeFileSync(fd, mine);
|
|
40704
|
+
} finally {
|
|
40705
|
+
fs35.closeSync(fd);
|
|
40706
|
+
}
|
|
40707
|
+
return () => {
|
|
40708
|
+
if (held(lock) === mine) fs35.rmSync(lock, { force: true });
|
|
40709
|
+
};
|
|
40710
|
+
} catch (err) {
|
|
40711
|
+
if (err.code !== "EEXIST") throw refusal2(err);
|
|
40712
|
+
}
|
|
40713
|
+
const judged = held(lock);
|
|
40714
|
+
let age = 0;
|
|
40715
|
+
try {
|
|
40716
|
+
age = Date.now() - fs35.lstatSync(lock).mtimeMs;
|
|
40717
|
+
} catch (err) {
|
|
40718
|
+
if (err.code === "ENOENT") continue;
|
|
40719
|
+
throw refusal2(err);
|
|
40720
|
+
}
|
|
40721
|
+
if (judged !== null && (lockOwnerStopped(judged) || age > LOCK_STALE_MS)) {
|
|
40722
|
+
const aside = path47.join(dir, `${LOCK_FILE}.stale-${mine.split(" ")[2]}`);
|
|
40723
|
+
try {
|
|
40724
|
+
fs35.renameSync(lock, aside);
|
|
40725
|
+
} catch (err) {
|
|
40726
|
+
if (err.code === "ENOENT") continue;
|
|
40727
|
+
throw refusal2(err);
|
|
40728
|
+
}
|
|
40729
|
+
if (held(aside) !== judged) {
|
|
40730
|
+
try {
|
|
40731
|
+
fs35.linkSync(aside, lock);
|
|
40732
|
+
} catch {
|
|
40733
|
+
}
|
|
40734
|
+
}
|
|
40735
|
+
fs35.rmSync(aside, { force: true });
|
|
40736
|
+
continue;
|
|
40737
|
+
}
|
|
40738
|
+
if (Date.now() > deadline) {
|
|
40739
|
+
throw expected(`Another run has held the mirror at ${safe2(dir)} for ${Math.round(age / 1e3)} s. Pull again once it ends.`);
|
|
40740
|
+
}
|
|
40741
|
+
await new Promise((resolve16) => setTimeout(resolve16, LOCK_POLL_MS));
|
|
40742
|
+
}
|
|
40743
|
+
}
|
|
40744
|
+
function writeMirror(root, files) {
|
|
40745
|
+
const id = crypto4.randomBytes(8).toString("hex");
|
|
40746
|
+
const dir = path47.join(root, CASE_MIRROR_DIR);
|
|
40747
|
+
const temp = (name) => `.tmp-${id}-${name}`;
|
|
40748
|
+
try {
|
|
40749
|
+
for (const f of files) {
|
|
40750
|
+
writeCaseLocalFile(root, `${CASE_MIRROR_DIR}/${temp(f.name)}`, f.data);
|
|
40751
|
+
if (f.mode !== void 0) fs35.chmodSync(path47.join(dir, temp(f.name)), f.mode);
|
|
40752
|
+
}
|
|
40753
|
+
for (const f of files) {
|
|
40754
|
+
const target = path47.join(dir, f.name);
|
|
40755
|
+
let st;
|
|
40756
|
+
try {
|
|
40757
|
+
st = fs35.lstatSync(target);
|
|
40758
|
+
} catch {
|
|
40759
|
+
st = void 0;
|
|
40760
|
+
}
|
|
40761
|
+
if (st?.isDirectory()) fs35.rmSync(target, { recursive: true, force: true });
|
|
40762
|
+
fs35.renameSync(path47.join(dir, temp(f.name)), target);
|
|
40763
|
+
}
|
|
40764
|
+
const names = new Set(files.map((f) => f.name));
|
|
40765
|
+
for (const name of fs35.readdirSync(dir)) {
|
|
40766
|
+
if (!names.has(name) && name !== LOCK_FILE) fs35.rmSync(path47.join(dir, name), { recursive: true, force: true });
|
|
40767
|
+
}
|
|
40768
|
+
} finally {
|
|
40769
|
+
for (const f of files) fs35.rmSync(path47.join(dir, temp(f.name)), { force: true });
|
|
40770
|
+
}
|
|
40771
|
+
}
|
|
40772
|
+
async function writeCaseMirror(calls, input) {
|
|
40773
|
+
const { root, detail, confidential, mode } = input;
|
|
40774
|
+
const before = mode === "clone" ? null : readBaseline(root, detail, input.record);
|
|
40775
|
+
const withheld = detail.access.capabilities.includes("read_confidential") && !confidential;
|
|
40776
|
+
const readsRevisions = before !== null || mode !== "mirror-only";
|
|
40777
|
+
const [work, since] = await Promise.all([
|
|
40778
|
+
withheld ? null : readWork(calls, detail, confidential),
|
|
40779
|
+
readsRevisions ? revisionsSince(calls, before ? before.revision_at : void 0, confidential) : NO_REVISIONS
|
|
40780
|
+
]);
|
|
40781
|
+
const now = snapshotOf(work);
|
|
40782
|
+
const at = nowIso();
|
|
40783
|
+
let baseline;
|
|
40784
|
+
if (mode !== "mirror-only") {
|
|
40785
|
+
baseline = { at, confidential, revision_at: since.newest_at, ...now };
|
|
40786
|
+
} else if (before && before.confidential && !confidential) {
|
|
40787
|
+
baseline = {
|
|
40788
|
+
...before,
|
|
40789
|
+
confidential: false,
|
|
40790
|
+
status: now.status === null ? null : before.status,
|
|
40791
|
+
phases: within(before.phases, now.phases),
|
|
40792
|
+
tasks: within(before.tasks, now.tasks),
|
|
40793
|
+
groups: within(before.groups, now.groups),
|
|
40794
|
+
deliveries: within(before.deliveries, now.deliveries)
|
|
40795
|
+
};
|
|
40796
|
+
} else {
|
|
40797
|
+
baseline = before;
|
|
40798
|
+
}
|
|
40799
|
+
const sections = [];
|
|
40800
|
+
if (before) sections.push(revisionsSection(since, withheld));
|
|
40801
|
+
if (mode !== "clone") sections.push(filesSection(input));
|
|
40802
|
+
if (before && work) sections.push(...statusSections(detail, work, before, now));
|
|
40803
|
+
const lines = renderSections(sections);
|
|
40804
|
+
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.";
|
|
40805
|
+
const summary = [heading, ...lines.length ? lines : before ? ["Nothing changed."] : []];
|
|
40806
|
+
const notice = confidential ? [] : ["", MIRROR_CONFIDENTIAL_NOTICE];
|
|
40807
|
+
const files = [
|
|
40808
|
+
{ name: "README.md", data: Buffer.from(readme(detail, at, withheld, confidential), "utf-8") },
|
|
40809
|
+
{ name: SUMMARY_FILE, data: Buffer.from(`# Case ${safe2(detail.code)}: since the last pull
|
|
40810
|
+
|
|
40811
|
+
${[...summary, ...notice].join("\n")}
|
|
40812
|
+
`, "utf-8") },
|
|
40813
|
+
{ name: CASE_MIRROR_HOOK_FILE, data: Buffer.from(HOOK_SCRIPT, "utf-8"), mode: 493 },
|
|
40814
|
+
{ name: RECORD_FILE2, data: json({ org_id: input.record.org_id, space_id: input.record.space_id, code: detail.code, last_pull: baseline }) }
|
|
40815
|
+
];
|
|
40816
|
+
if (work) {
|
|
40817
|
+
files.push(
|
|
40818
|
+
{ name: "case.json", data: json(detail) },
|
|
40819
|
+
{ name: "status.json", data: json(work.state) },
|
|
40820
|
+
{ name: "evidence.json", data: json({ phases: work.phases.map((p) => ({ phase_id: p.phase_id, folder: p.folder, work: p.work })) }) },
|
|
40821
|
+
{ name: "agenda.json", data: json({ phases: work.phases.map((p) => ({ phase_id: p.phase_id, folder: p.folder, groups: p.groups, more_groups: p.more_groups })), approved: work.approved }) },
|
|
40822
|
+
{ name: "deliveries.json", data: json({ phases: work.phases.map((p) => ({ phase_id: p.phase_id, folder: p.folder, delivery: p.delivery })) }) }
|
|
40823
|
+
);
|
|
40824
|
+
}
|
|
40825
|
+
writeMirror(root, files);
|
|
40826
|
+
console.log(`
|
|
40827
|
+
Mirror of case ${safe2(detail.code)} written to ${safe2(path47.join(root, CASE_MIRROR_DIR))} (read-only: every pull rewrites it).`);
|
|
40828
|
+
for (const line of mode === "mirror-only" ? [...summary, ...notice] : summary) console.log(line);
|
|
40829
|
+
}
|
|
40830
|
+
async function withMirrorLock(root, step) {
|
|
40831
|
+
const unlock = await lockMirror(root);
|
|
40832
|
+
try {
|
|
40833
|
+
return await step();
|
|
40834
|
+
} finally {
|
|
40835
|
+
unlock();
|
|
40836
|
+
}
|
|
40837
|
+
}
|
|
40838
|
+
function printHookSetup(root) {
|
|
40839
|
+
const script = path47.join(root, CASE_MIRROR_DIR, CASE_MIRROR_HOOK_FILE);
|
|
40840
|
+
const command2 = `sh '${script.replaceAll("'", "'\\''")}'`;
|
|
40841
|
+
const settings = JSON.stringify({ hooks: { SessionStart: [{ hooks: [{ type: "command", command: command2 }] }] } });
|
|
40842
|
+
console.log(`
|
|
40843
|
+
Session-start hook: ${safe2(script)} refreshes the mirror (never with --confidential).`);
|
|
40844
|
+
console.log(`For Claude Code, add it to ${safe2(path47.join(root, ".claude", "settings.json"))}:`);
|
|
40845
|
+
console.log(` ${safe2(settings)}`);
|
|
40846
|
+
console.log(`For another agent, run at the start of each session: ${safe2(command2)}`);
|
|
40847
|
+
}
|
|
40848
|
+
var CASE_MIRROR_DIR, CASE_MIRROR_HOOK_FILE, RECORD_FILE2, SUMMARY_FILE, LOCK_FILE, LOCK_WAIT_MS, LOCK_STALE_MS, LOCK_POLL_MS, AGENDA_PAGES_READ2, SUMMARY_REVISION_PAGES, MIRROR_CONFIDENTIAL_NOTICE, safe2, one2, words, isConfPath, isObject, isStringMap, isDeliveries, NO_REVISIONS, within, HOOK_SCRIPT, json;
|
|
40849
|
+
var init_case_mirror = __esm({
|
|
40850
|
+
"src/cases/case-mirror.ts"() {
|
|
40851
|
+
"use strict";
|
|
40852
|
+
init_dist();
|
|
40853
|
+
init_case_files();
|
|
40854
|
+
init_expected();
|
|
40855
|
+
init_fs_safety();
|
|
40856
|
+
init_terminal_output();
|
|
40857
|
+
init_case_local_files();
|
|
40858
|
+
CASE_MIRROR_DIR = ".wayai-mirror";
|
|
40859
|
+
CASE_MIRROR_HOOK_FILE = "session-start.sh";
|
|
40860
|
+
RECORD_FILE2 = "record.json";
|
|
40861
|
+
SUMMARY_FILE = "since-last-pull.md";
|
|
40862
|
+
LOCK_FILE = ".lock";
|
|
40863
|
+
LOCK_WAIT_MS = 12e4;
|
|
40864
|
+
LOCK_STALE_MS = 10 * 6e4;
|
|
40865
|
+
LOCK_POLL_MS = 50;
|
|
40866
|
+
AGENDA_PAGES_READ2 = 5;
|
|
40867
|
+
SUMMARY_REVISION_PAGES = 2;
|
|
40868
|
+
MIRROR_CONFIDENTIAL_NOTICE = "Confidential content is left out unless you pass --confidential.";
|
|
40869
|
+
safe2 = (text5) => sanitizeTerminalText(text5);
|
|
40870
|
+
one2 = (text5) => sanitizeTerminalText(text5).replace(/\s*\n\s*/g, " ");
|
|
40871
|
+
words = (status) => status.replaceAll("_", " ");
|
|
40872
|
+
isConfPath = (rel) => rel.split("/")[0] === "conf";
|
|
40873
|
+
isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
40874
|
+
isStringMap = (v) => isObject(v) && Object.values(v).every((x) => typeof x === "string");
|
|
40875
|
+
isDeliveries = (v) => isObject(v) && Object.values(v).every((d) => d === null || isObject(d) && typeof d.submission_id === "string" && typeof d.state === "string");
|
|
40876
|
+
NO_REVISIONS = { revisions: [], more: false, newest_at: null };
|
|
40877
|
+
within = (prev, now) => Object.fromEntries(Object.entries(prev).filter(([key]) => key in now));
|
|
40878
|
+
HOOK_SCRIPT = `#!/bin/sh
|
|
40879
|
+
# Written by \`wayai cases clone\` and every \`wayai cases pull\` (this folder is rewritten whole: do not edit it).
|
|
40880
|
+
# The session-start hook: refreshes this clone's read-only mirror of its case. It never passes --confidential.
|
|
40881
|
+
exec wayai cases pull --mirror-only --dir "$(dirname "$0")/.."
|
|
40882
|
+
`;
|
|
40883
|
+
json = (value) => Buffer.from(`${JSON.stringify(value, null, 2)}
|
|
40884
|
+
`, "utf-8");
|
|
40885
|
+
}
|
|
40886
|
+
});
|
|
40887
|
+
|
|
40888
|
+
// src/cases/case-files.ts
|
|
40889
|
+
import * as fs36 from "fs";
|
|
40890
|
+
import * as path48 from "path";
|
|
40472
40891
|
function casesRequestsPerMinute() {
|
|
40473
40892
|
const budget = getEndpointConfig("/api/cases/org/space/cases/code/files")?.userLimit;
|
|
40474
40893
|
return budget ? Math.max(1, Math.floor(budget * 4 / 5)) : 48;
|
|
@@ -40481,7 +40900,7 @@ function assertWritableCasePaths(paths, phaseFolders) {
|
|
|
40481
40900
|
for (const rel of paths) {
|
|
40482
40901
|
const check = checkCaseFilePath({ path: rel, type: "file" }, phaseFolders);
|
|
40483
40902
|
if (!check.ok) {
|
|
40484
|
-
problems2.push(`${JSON.stringify(
|
|
40903
|
+
problems2.push(`${JSON.stringify(safe3(rel))}: a case path cannot be that (${check.reason})`);
|
|
40485
40904
|
continue;
|
|
40486
40905
|
}
|
|
40487
40906
|
const folded = check.fold_key.split("/");
|
|
@@ -40493,7 +40912,7 @@ function assertWritableCasePaths(paths, phaseFolders) {
|
|
|
40493
40912
|
if (known === void 0) {
|
|
40494
40913
|
spelled.set(key, spelling);
|
|
40495
40914
|
} else if (known !== spelling) {
|
|
40496
|
-
problems2.push(`${JSON.stringify(
|
|
40915
|
+
problems2.push(`${JSON.stringify(safe3(known))} and ${JSON.stringify(safe3(spelling))} differ only in case, so they would be one entry here`);
|
|
40497
40916
|
break;
|
|
40498
40917
|
}
|
|
40499
40918
|
}
|
|
@@ -40504,7 +40923,7 @@ function assertWritableCasePaths(paths, phaseFolders) {
|
|
|
40504
40923
|
const segments = key.split("/");
|
|
40505
40924
|
for (let i = 1; i < segments.length; i++) {
|
|
40506
40925
|
if (keys.has(segments.slice(0, i).join("/"))) {
|
|
40507
|
-
problems2.push(`${JSON.stringify(
|
|
40926
|
+
problems2.push(`${JSON.stringify(safe3(rel))} lies in a folder that is also a file`);
|
|
40508
40927
|
break;
|
|
40509
40928
|
}
|
|
40510
40929
|
}
|
|
@@ -40516,20 +40935,20 @@ function assertWritableCasePaths(paths, phaseFolders) {
|
|
|
40516
40935
|
}
|
|
40517
40936
|
function linkRefusal(rel) {
|
|
40518
40937
|
return expected(
|
|
40519
|
-
`${
|
|
40938
|
+
`${safe3(rel)} is a symlink, or not a regular file or folder. The CLI never follows one in a clone: replace it with the file or folder itself, or move it out of the clone.`
|
|
40520
40939
|
);
|
|
40521
40940
|
}
|
|
40522
40941
|
function scanClone(root, phaseFolders, confidential = true) {
|
|
40523
40942
|
const out = /* @__PURE__ */ new Map();
|
|
40524
40943
|
const walk = (abs, rel) => {
|
|
40525
|
-
for (const name of
|
|
40944
|
+
for (const name of fs36.readdirSync(abs).sort()) {
|
|
40526
40945
|
if (name.startsWith(".")) continue;
|
|
40527
|
-
const childAbs =
|
|
40946
|
+
const childAbs = path48.join(abs, name);
|
|
40528
40947
|
const childRel = `${rel}/${name}`;
|
|
40529
|
-
const st =
|
|
40948
|
+
const st = fs36.lstatSync(childAbs);
|
|
40530
40949
|
if (st.isDirectory() || st.isFile()) {
|
|
40531
40950
|
const problem = ownProblem(st);
|
|
40532
|
-
if (problem) throw expected(`Refused ${
|
|
40951
|
+
if (problem) throw expected(`Refused ${safe3(childRel)}: ${problem}. A case is read and written only in folders and files you own, never in one every user can write to.`);
|
|
40533
40952
|
}
|
|
40534
40953
|
if (st.isDirectory()) {
|
|
40535
40954
|
walk(childAbs, childRel);
|
|
@@ -40543,16 +40962,16 @@ function scanClone(root, phaseFolders, confidential = true) {
|
|
|
40543
40962
|
}
|
|
40544
40963
|
};
|
|
40545
40964
|
requireOwn(root);
|
|
40546
|
-
const top = new Set(
|
|
40965
|
+
const top = new Set(fs36.readdirSync(root));
|
|
40547
40966
|
const areas = [.../* @__PURE__ */ new Set([...phaseFolders, "analysis", ...confidential ? ["conf"] : []])].filter((area) => top.has(area));
|
|
40548
40967
|
if (top.has("instructions")) {
|
|
40549
|
-
if (!
|
|
40550
|
-
if (
|
|
40968
|
+
if (!fs36.lstatSync(path48.join(root, "instructions")).isDirectory()) throw linkRefusal("instructions");
|
|
40969
|
+
if (fs36.readdirSync(path48.join(root, "instructions")).includes("case")) areas.push("instructions/case");
|
|
40551
40970
|
}
|
|
40552
40971
|
for (const rel of areas) {
|
|
40553
|
-
const abs =
|
|
40554
|
-
if (!
|
|
40555
|
-
if (rel === "instructions/case") requireOwn(
|
|
40972
|
+
const abs = path48.join(root, ...rel.split("/"));
|
|
40973
|
+
if (!fs36.lstatSync(abs).isDirectory()) throw linkRefusal(rel);
|
|
40974
|
+
if (rel === "instructions/case") requireOwn(path48.join(root, "instructions"));
|
|
40556
40975
|
requireOwn(abs);
|
|
40557
40976
|
walk(abs, rel);
|
|
40558
40977
|
}
|
|
@@ -40584,11 +41003,11 @@ function sidesOf(record, local, files, confidential) {
|
|
|
40584
41003
|
function requireFiles(detail, confidential) {
|
|
40585
41004
|
const can = detail.access.capabilities;
|
|
40586
41005
|
if (!can.includes("view_work")) {
|
|
40587
|
-
throw expected(`Your access to case ${
|
|
41006
|
+
throw expected(`Your access to case ${safe3(detail.code)} does not reach its files: no team of yours reads its work.`);
|
|
40588
41007
|
}
|
|
40589
41008
|
if (confidential && !can.includes("read_confidential")) {
|
|
40590
41009
|
throw expected(
|
|
40591
|
-
`This machine's authorization on case ${
|
|
41010
|
+
`This machine's authorization on case ${safe3(detail.code)} does not hold the Confidential right, so --confidential reads nothing more. Run it without --confidential.`
|
|
40592
41011
|
);
|
|
40593
41012
|
}
|
|
40594
41013
|
}
|
|
@@ -40597,6 +41016,7 @@ async function pullInto(calls, detail, record, opts) {
|
|
|
40597
41016
|
const files = await calls.files();
|
|
40598
41017
|
assertWritableCasePaths([...sidesOf(record, /* @__PURE__ */ new Map(), files, opts.confidential).listed.keys()], phaseFolders);
|
|
40599
41018
|
const root = opts.root();
|
|
41019
|
+
mirrorFolder(root);
|
|
40600
41020
|
const local = scanClone(root, phaseFolders, opts.confidential);
|
|
40601
41021
|
const { synced: synced2, local: localIn, remote, listed: listed3, theirsListed } = sidesOf(record, local, files, opts.confidential);
|
|
40602
41022
|
const plan = planPull({ synced: synced2, local: localIn, remote, overwrite: opts.overwrite });
|
|
@@ -40605,7 +41025,7 @@ async function pullInto(calls, detail, record, opts) {
|
|
|
40605
41025
|
const replaced = [...plan.replacedLocal, ...opts.overwrite ? theirsLeft : []];
|
|
40606
41026
|
if (replaced.length > 0) {
|
|
40607
41027
|
console.log("These local changes would be replaced with the case's copies, or removed:");
|
|
40608
|
-
for (const rel of replaced) console.log(` ${
|
|
41028
|
+
for (const rel of replaced) console.log(` ${safe3(rel)}`);
|
|
40609
41029
|
if (!await agree(`Replace or remove ${replaced.length} local file(s)?`, opts.yes)) {
|
|
40610
41030
|
console.log("Cancelled.");
|
|
40611
41031
|
return;
|
|
@@ -40633,7 +41053,7 @@ async function pullInto(calls, detail, record, opts) {
|
|
|
40633
41053
|
conflicts.push({ rel, reason: "unresolved" });
|
|
40634
41054
|
} else if (matchesScan(root, rel, local.get(rel))) {
|
|
40635
41055
|
removeLocal(root, rel);
|
|
40636
|
-
changes.push(`${MARK.delete} ${
|
|
41056
|
+
changes.push(`${MARK.delete} ${safe3(rel)}`);
|
|
40637
41057
|
} else {
|
|
40638
41058
|
conflicts.push({ rel, reason: "edited_while_pulling" });
|
|
40639
41059
|
}
|
|
@@ -40645,7 +41065,7 @@ async function pullInto(calls, detail, record, opts) {
|
|
|
40645
41065
|
}
|
|
40646
41066
|
removeLocal(root, rel);
|
|
40647
41067
|
delete next.files[rel];
|
|
40648
|
-
changes.push(`${MARK.delete} ${
|
|
41068
|
+
changes.push(`${MARK.delete} ${safe3(rel)}`);
|
|
40649
41069
|
}
|
|
40650
41070
|
for (const w of plan.writes) {
|
|
40651
41071
|
const clash = diskClash(root, w.rel);
|
|
@@ -40661,7 +41081,7 @@ async function pullInto(calls, detail, record, opts) {
|
|
|
40661
41081
|
}
|
|
40662
41082
|
writeCaseLocalFile(root, w.rel, Buffer.from(bytes));
|
|
40663
41083
|
next.files[w.rel] = recordedFile(listed3.get(w.rel));
|
|
40664
|
-
changes.push(`${local.has(w.rel) ? MARK.update : MARK.create} ${
|
|
41084
|
+
changes.push(`${local.has(w.rel) ? MARK.update : MARK.create} ${safe3(w.rel)}`);
|
|
40665
41085
|
}
|
|
40666
41086
|
for (const c of plan.conflicts) {
|
|
40667
41087
|
if (c.reason === "both_changed" || c.reason === "exists_locally") {
|
|
@@ -40684,24 +41104,33 @@ async function pullInto(calls, detail, record, opts) {
|
|
|
40684
41104
|
}
|
|
40685
41105
|
const named = conflicts.filter((c) => !(c.reason === "unresolved" && rewritten.has(c.rel)));
|
|
40686
41106
|
const count = Object.keys(next.files).length;
|
|
40687
|
-
console.log(
|
|
41107
|
+
console.log(safe3(`${opts.verb} case ${record.code} into ${root} (${count} file${count === 1 ? "" : "s"} recorded).`));
|
|
40688
41108
|
printSection("Changes:", changes);
|
|
40689
|
-
printSection("Kept: your local changes, not pushed yet:", plan.kept.map((k) => `${
|
|
41109
|
+
printSection("Kept: your local changes, not pushed yet:", plan.kept.map((k) => `${safe3(k.rel)}: ${k.reason === "edited" ? "edited here" : "deleted here (push --prune removes it from the case)"}`));
|
|
40690
41110
|
printSection(
|
|
40691
41111
|
"Conflicts: your copy is kept. Resolve each, deleting any copy beside it, then push; or take the case's copies with `wayai cases pull --overwrite`:",
|
|
40692
41112
|
named.map((c) => conflictLine(c, PULL_CONFLICT2))
|
|
40693
41113
|
);
|
|
40694
|
-
printSection("Changed on the case while pulling: left as is; pull again to take it:", changedWhilePulling.map(
|
|
40695
|
-
printSection(`Not pulled: case paths ending in ${THEIRS_SUFFIX}, the name a conflict's copy takes here:`, theirsListed.map(
|
|
41114
|
+
printSection("Changed on the case while pulling: left as is; pull again to take it:", changedWhilePulling.map(safe3));
|
|
41115
|
+
printSection(`Not pulled: case paths ending in ${THEIRS_SUFFIX}, the name a conflict's copy takes here:`, theirsListed.map(safe3));
|
|
40696
41116
|
if (!opts.confidential) console.log(`
|
|
40697
41117
|
${CONFIDENTIAL_NOTICE}`);
|
|
40698
41118
|
if (named.length > 0) process.exitCode = 1;
|
|
41119
|
+
await withMirrorLock(root, () => writeCaseMirror(calls, {
|
|
41120
|
+
root,
|
|
41121
|
+
detail,
|
|
41122
|
+
files,
|
|
41123
|
+
record,
|
|
41124
|
+
inRun: inRunOf(outside),
|
|
41125
|
+
confidential: opts.confidential,
|
|
41126
|
+
mode: opts.verb === "Cloned" ? "clone" : "pull"
|
|
41127
|
+
}));
|
|
40699
41128
|
}
|
|
40700
41129
|
function cloneAt(dir) {
|
|
40701
41130
|
if (dir !== void 0) {
|
|
40702
41131
|
const root = caseLocalRoot(dir);
|
|
40703
41132
|
const record = readCloneRecord(root);
|
|
40704
|
-
if (!record) throw expected(`${
|
|
41133
|
+
if (!record) throw expected(`${safe3(dir)} is not a case clone: it holds no ${CASE_CLONE_RECORD_FILE}. Clone the case with \`wayai cases clone\`.`);
|
|
40705
41134
|
return { root, record };
|
|
40706
41135
|
}
|
|
40707
41136
|
const clone = findCaseClone(process.cwd());
|
|
@@ -40716,43 +41145,64 @@ async function caseClone(selector, opts) {
|
|
|
40716
41145
|
const calls = new CaseCalls(session);
|
|
40717
41146
|
const detail = await calls.detail();
|
|
40718
41147
|
requireFiles(detail, opts.confidential);
|
|
40719
|
-
const dir =
|
|
41148
|
+
const dir = path48.resolve(opts.dir ?? session.connection.code);
|
|
40720
41149
|
let exists = true;
|
|
40721
41150
|
let st;
|
|
40722
41151
|
try {
|
|
40723
|
-
st =
|
|
41152
|
+
st = fs36.lstatSync(dir);
|
|
40724
41153
|
} catch {
|
|
40725
41154
|
exists = false;
|
|
40726
41155
|
}
|
|
40727
|
-
if (st && !st.isDirectory()) throw expected(`${
|
|
41156
|
+
if (st && !st.isDirectory()) throw expected(`${safe3(dir)} is a symlink or not a folder: clone into a folder of its own.`);
|
|
40728
41157
|
if (exists) {
|
|
40729
41158
|
const existing = readCloneRecord(caseLocalRoot(dir));
|
|
40730
41159
|
if (existing) {
|
|
40731
|
-
throw expected(sameCase(existing, session.connection) ? `${
|
|
41160
|
+
throw expected(sameCase(existing, session.connection) ? `${safe3(dir)} is a clone of case ${safe3(existing.code)} already: run \`wayai cases pull\` there.` : `${safe3(dir)} is a clone of case ${safe3(existing.code)}: clone into another folder.`);
|
|
40732
41161
|
}
|
|
40733
41162
|
}
|
|
40734
|
-
const outer = findCaseClone(
|
|
40735
|
-
if (outer) throw expected(`${
|
|
41163
|
+
const outer = findCaseClone(path48.dirname(dir));
|
|
41164
|
+
if (outer) throw expected(`${safe3(dir)} lies inside the clone of case ${safe3(outer.record.code)} at ${safe3(outer.root)}: clone outside it.`);
|
|
40736
41165
|
const record = { org_id: session.connection.org_id, space_id: session.connection.space_id, code: session.connection.code, files: {} };
|
|
40737
41166
|
await pullInto(calls, detail, record, {
|
|
40738
41167
|
confidential: opts.confidential,
|
|
40739
41168
|
overwrite: false,
|
|
40740
41169
|
yes: false,
|
|
40741
41170
|
root: () => {
|
|
40742
|
-
if (!exists)
|
|
41171
|
+
if (!exists) fs36.mkdirSync(dir, { recursive: true, mode: CASE_FOLDER_MODE });
|
|
40743
41172
|
return caseLocalRoot(dir);
|
|
40744
41173
|
},
|
|
40745
41174
|
verb: "Cloned"
|
|
40746
41175
|
});
|
|
41176
|
+
printHookSetup(caseLocalRoot(dir));
|
|
40747
41177
|
}
|
|
40748
|
-
async function
|
|
40749
|
-
const { root, record } = cloneAt(
|
|
40750
|
-
const
|
|
40751
|
-
const calls = new CaseCalls(session);
|
|
41178
|
+
async function openClone(dir, confidential) {
|
|
41179
|
+
const { root, record } = cloneAt(dir);
|
|
41180
|
+
const calls = new CaseCalls(await cloneSession(root));
|
|
40752
41181
|
const detail = await calls.detail();
|
|
40753
|
-
requireFiles(detail,
|
|
41182
|
+
requireFiles(detail, confidential);
|
|
41183
|
+
return { root, record, calls, detail };
|
|
41184
|
+
}
|
|
41185
|
+
async function casePull(opts) {
|
|
41186
|
+
const { root, record, calls, detail } = await openClone(opts.dir, opts.confidential);
|
|
40754
41187
|
await pullInto(calls, detail, record, { ...opts, root: () => root, verb: "Pulled" });
|
|
40755
41188
|
}
|
|
41189
|
+
async function casePullMirror(opts) {
|
|
41190
|
+
const { root, record: opened, calls, detail } = await openClone(opts.dir, opts.confidential);
|
|
41191
|
+
mirrorFolder(root);
|
|
41192
|
+
await withMirrorLock(root, async () => {
|
|
41193
|
+
const record = readCloneRecord(root) ?? opened;
|
|
41194
|
+
const files = await calls.files();
|
|
41195
|
+
await writeCaseMirror(calls, {
|
|
41196
|
+
root,
|
|
41197
|
+
detail,
|
|
41198
|
+
files,
|
|
41199
|
+
record,
|
|
41200
|
+
inRun: inRunOf(outsideRun(record, files, opts.confidential)),
|
|
41201
|
+
confidential: opts.confidential,
|
|
41202
|
+
mode: "mirror-only"
|
|
41203
|
+
});
|
|
41204
|
+
});
|
|
41205
|
+
}
|
|
40756
41206
|
function leftOutReason(rel, phaseFolders, detail) {
|
|
40757
41207
|
const check = checkCaseFilePath({ path: rel, type: "file" }, phaseFolders);
|
|
40758
41208
|
if (!check.ok) return `the case takes no such path (${check.reason})`;
|
|
@@ -40778,7 +41228,7 @@ function uploadRefusal(err, session, entries) {
|
|
|
40778
41228
|
const reason3 = extractApiErrorReason(err);
|
|
40779
41229
|
const { at, paths } = refusalDetails(err, sent);
|
|
40780
41230
|
const list2 = paths.map((p) => `
|
|
40781
|
-
${
|
|
41231
|
+
${safe3(p)}`).join("");
|
|
40782
41232
|
if (err.status === 409 && reason3 === CASE_FILE_CONFLICT_REASON) {
|
|
40783
41233
|
return expected(`These files changed on the case since your last pull:${list2}
|
|
40784
41234
|
${nothing} Run \`wayai cases pull\`, then push again.`);
|
|
@@ -40796,7 +41246,7 @@ ${nothing} Write those files under other paths.`
|
|
|
40796
41246
|
if (err.status === 400 && reason3) {
|
|
40797
41247
|
const index = at === null ? null : /^entries\.(\d+)/.exec(at);
|
|
40798
41248
|
const where = index ? entries[Number(index[1])]?.path : void 0;
|
|
40799
|
-
return expected(`The case refused the revision (${
|
|
41249
|
+
return expected(`The case refused the revision (${safe3(reason3)}${where ? `, at ${safe3(where)}` : ""}). ${nothing}`);
|
|
40800
41250
|
}
|
|
40801
41251
|
return caseCallFailure(err, session.connection);
|
|
40802
41252
|
}
|
|
@@ -40820,7 +41270,7 @@ async function casePush(opts) {
|
|
|
40820
41270
|
const detail = await calls.detail();
|
|
40821
41271
|
requireFiles(detail, opts.confidential);
|
|
40822
41272
|
if (!detail.access.capabilities.includes("upload_document")) {
|
|
40823
|
-
throw expected(`Your access to case ${
|
|
41273
|
+
throw expected(`Your access to case ${safe3(detail.code)} does not write its files: that takes Edit level, on an open case.`);
|
|
40824
41274
|
}
|
|
40825
41275
|
const phaseFolders = phaseFoldersOf(detail);
|
|
40826
41276
|
const scanned = scanClone(root, phaseFolders, opts.confidential);
|
|
@@ -40830,7 +41280,7 @@ async function casePush(opts) {
|
|
|
40830
41280
|
if (theirs.length > 0) {
|
|
40831
41281
|
throw expected(
|
|
40832
41282
|
`Resolve these conflicts first: merge each into the file beside it, then delete the ${THEIRS_SUFFIX} copy.${theirs.map((t) => `
|
|
40833
|
-
${
|
|
41283
|
+
${safe3(t)}`).join("")}
|
|
40834
41284
|
Nothing was pushed.`
|
|
40835
41285
|
);
|
|
40836
41286
|
}
|
|
@@ -40843,7 +41293,7 @@ Nothing was pushed.`
|
|
|
40843
41293
|
const file = scanned.get(rel);
|
|
40844
41294
|
const reason3 = record.files[rel]?.sha === file?.content_sha256 ? null : leftOutReason(rel, phaseFolders, detail);
|
|
40845
41295
|
if (reason3) {
|
|
40846
|
-
leftOut.push(`${
|
|
41296
|
+
leftOut.push(`${safe3(rel)}: ${reason3}`);
|
|
40847
41297
|
leftOutPaths.add(rel);
|
|
40848
41298
|
} else if (file) {
|
|
40849
41299
|
local.set(rel, file);
|
|
@@ -40853,13 +41303,13 @@ Nothing was pushed.`
|
|
|
40853
41303
|
const recordIn = { ...record, files: Object.fromEntries(Object.entries(record.files).filter(([rel]) => !leftOutPaths.has(rel))) };
|
|
40854
41304
|
const { synced: synced2, local: localIn, remote, listed: listed3 } = sidesOf(recordIn, local, files, opts.confidential);
|
|
40855
41305
|
const plan = planPush({ synced: synced2, local: localIn, remote, prune: opts.prune });
|
|
40856
|
-
console.log(
|
|
40857
|
-
const steps = plan.steps.map((s) => `${MARK[s.op]} ${
|
|
41306
|
+
console.log(safe3(`Push ${root} \u2192 case ${record.code}`));
|
|
41307
|
+
const steps = plan.steps.map((s) => `${MARK[s.op]} ${safe3(s.rel)}${s.op === "create" ? ` (new, ${s.local.size} bytes)` : ""}`);
|
|
40858
41308
|
printSection("Changes:", steps);
|
|
40859
|
-
printSection("Changed on the case since your last pull: left as is; pull to take it:", plan.changedOnBase.map(
|
|
40860
|
-
printSection("Deleted on the case since your last pull, or no longer readable here: left as is; pull to remove your copy:", plan.deletedOnBase.map(
|
|
40861
|
-
printSection("On the case, not in your clone: left as is; pull to fetch it:", plan.onlyOnBase.map(
|
|
40862
|
-
printSection("Deleted in your clone: kept on the case; push with --prune to remove it:", plan.keptOnBase.map(
|
|
41309
|
+
printSection("Changed on the case since your last pull: left as is; pull to take it:", plan.changedOnBase.map(safe3));
|
|
41310
|
+
printSection("Deleted on the case since your last pull, or no longer readable here: left as is; pull to remove your copy:", plan.deletedOnBase.map(safe3));
|
|
41311
|
+
printSection("On the case, not in your clone: left as is; pull to fetch it:", plan.onlyOnBase.map(safe3));
|
|
41312
|
+
printSection("Deleted in your clone: kept on the case; push with --prune to remove it:", plan.keptOnBase.map(safe3));
|
|
40863
41313
|
printSection("Left out: not pushed from this clone:", leftOut);
|
|
40864
41314
|
printSection("Conflicts: not pushed:", plan.conflicts.map((c) => conflictLine(c, PUSH_CONFLICT2)));
|
|
40865
41315
|
if (!opts.confidential) console.log(`
|
|
@@ -40895,9 +41345,9 @@ ${CONFIDENTIAL_NOTICE}`);
|
|
|
40895
41345
|
entries.push({ path: step.rel, type: "file", expect_sha: step.ifMatch, sha: null });
|
|
40896
41346
|
continue;
|
|
40897
41347
|
}
|
|
40898
|
-
const bytes = readFileNoFollow(root,
|
|
41348
|
+
const bytes = readFileNoFollow(root, path48.join(root, ...step.rel.split("/")));
|
|
40899
41349
|
if (!bytes || computeHash(bytes) !== step.local.content_sha256) {
|
|
40900
|
-
throw expected(`${
|
|
41350
|
+
throw expected(`${safe3(step.rel)} changed while the push ran. Nothing was pushed; push again.`);
|
|
40901
41351
|
}
|
|
40902
41352
|
parts.set(step.local.content_sha256, bytes);
|
|
40903
41353
|
entries.push({ path: step.rel, type: "file", expect_sha: step.op === "update" ? step.ifMatch : null, sha: step.local.content_sha256 });
|
|
@@ -40917,7 +41367,7 @@ ${CONFIDENTIAL_NOTICE}`);
|
|
|
40917
41367
|
}
|
|
40918
41368
|
writeCloneRecord(root, next);
|
|
40919
41369
|
console.log(`
|
|
40920
|
-
Pushed revision ${saved.revision_id}: ${entries.length} change${entries.length === 1 ? "" : "s"} to case ${
|
|
41370
|
+
Pushed revision ${saved.revision_id}: ${entries.length} change${entries.length === 1 ? "" : "s"} to case ${safe3(record.code)}.`);
|
|
40921
41371
|
}
|
|
40922
41372
|
async function caseLog(selector, opts) {
|
|
40923
41373
|
const limit = opts.limit ?? LOG_DEFAULT;
|
|
@@ -40932,7 +41382,7 @@ async function caseLog(selector, opts) {
|
|
|
40932
41382
|
for (let page = 0; page < MAX_LOG_PAGES && shown3.length < limit; page++) {
|
|
40933
41383
|
const { revisions, next_cursor } = (await calls.run(() => session.api.listCaseRevisions(session.connection, { cursor, limit: CASE_REVISIONS_PAGE_MAX }))).data;
|
|
40934
41384
|
for (const revision of revisions) {
|
|
40935
|
-
const entries =
|
|
41385
|
+
const entries = shownEntries(revision, opts.confidential);
|
|
40936
41386
|
if (entries.length === 0) continue;
|
|
40937
41387
|
if (shown3.length === limit) {
|
|
40938
41388
|
more = true;
|
|
@@ -40948,21 +41398,21 @@ async function caseLog(selector, opts) {
|
|
|
40948
41398
|
console.log(JSON.stringify({ revisions: shown3, more }, null, 2));
|
|
40949
41399
|
return;
|
|
40950
41400
|
}
|
|
40951
|
-
if (shown3.length === 0) console.log(`Case ${
|
|
41401
|
+
if (shown3.length === 0) console.log(`Case ${safe3(detail.code)} has no revision you read here.`);
|
|
40952
41402
|
for (const r of shown3) {
|
|
40953
|
-
const author = r.author?.display_name ?
|
|
41403
|
+
const author = r.author?.display_name ? one3(r.author.display_name) : "a person no longer named";
|
|
40954
41404
|
console.log(`revision ${r.revision_id} ${r.created_at} ${author} (${r.channel})`);
|
|
40955
|
-
if (r.message !== null) console.log(` ${
|
|
41405
|
+
if (r.message !== null) console.log(` ${one3(r.message)}`);
|
|
40956
41406
|
else console.log(hideMessages ? " (message not shown without --confidential)" : " (message hidden)");
|
|
40957
|
-
if (r.session) console.log(` session: ${
|
|
40958
|
-
for (const e of r.entries) console.log(` ${
|
|
41407
|
+
if (r.session) console.log(` session: ${one3(r.session)}`);
|
|
41408
|
+
for (const e of r.entries) console.log(` ${safe3(e.path)}${e.sha === null ? " (removed)" : ""}`);
|
|
40959
41409
|
}
|
|
40960
41410
|
if (more && shown3.length > 0) console.log(`
|
|
40961
41411
|
Older revisions follow: --limit ${Math.min(LOG_MAX, limit * 2)} shows more.`);
|
|
40962
41412
|
if (!opts.confidential) console.log(`
|
|
40963
41413
|
${CONFIDENTIAL_NOTICE}`);
|
|
40964
41414
|
}
|
|
40965
|
-
var THEIRS_SUFFIX, MAX_LIST_PAGES2, LOG_DEFAULT, LOG_MAX, MAX_LOG_PAGES, PART_OVERHEAD_BYTES, CONFIDENTIAL_NOTICE,
|
|
41415
|
+
var THEIRS_SUFFIX, MAX_LIST_PAGES2, LOG_DEFAULT, LOG_MAX, MAX_LOG_PAGES, PART_OVERHEAD_BYTES, CONFIDENTIAL_NOTICE, safe3, one3, CaseCalls, phaseFoldersOf, isTheirs, recordedFile, PULL_CONFLICT2, inRunOf, PUSH_CONFLICT2;
|
|
40966
41416
|
var init_case_files2 = __esm({
|
|
40967
41417
|
"src/cases/case-files.ts"() {
|
|
40968
41418
|
"use strict";
|
|
@@ -40983,6 +41433,7 @@ var init_case_files2 = __esm({
|
|
|
40983
41433
|
init_case_session();
|
|
40984
41434
|
init_case_local_files();
|
|
40985
41435
|
init_case_clone_record();
|
|
41436
|
+
init_case_mirror();
|
|
40986
41437
|
THEIRS_SUFFIX = ".theirs";
|
|
40987
41438
|
MAX_LIST_PAGES2 = 200;
|
|
40988
41439
|
LOG_DEFAULT = 20;
|
|
@@ -40990,8 +41441,8 @@ var init_case_files2 = __esm({
|
|
|
40990
41441
|
MAX_LOG_PAGES = 40;
|
|
40991
41442
|
PART_OVERHEAD_BYTES = 512;
|
|
40992
41443
|
CONFIDENTIAL_NOTICE = "Confidential files are left out unless you pass --confidential.";
|
|
40993
|
-
|
|
40994
|
-
|
|
41444
|
+
safe3 = (text5) => sanitizeTerminalText(text5);
|
|
41445
|
+
one3 = (text5) => sanitizeTerminalText(text5).replace(/\s*\n\s*/g, " ");
|
|
40995
41446
|
CaseCalls = class {
|
|
40996
41447
|
constructor(session) {
|
|
40997
41448
|
this.session = session;
|
|
@@ -41039,7 +41490,6 @@ var init_case_files2 = __esm({
|
|
|
41039
41490
|
}
|
|
41040
41491
|
};
|
|
41041
41492
|
phaseFoldersOf = (detail) => detail.phases.map((p) => p.folder);
|
|
41042
|
-
isConfPath = (rel) => rel.split("/")[0] === "conf";
|
|
41043
41493
|
isTheirs = (rel) => rel.toLowerCase().endsWith(THEIRS_SUFFIX);
|
|
41044
41494
|
recordedFile = (f) => ({ sha: f.sha, confidential: f.confidential || isConfPath(f.path) });
|
|
41045
41495
|
PULL_CONFLICT2 = {
|
|
@@ -41052,6 +41502,7 @@ var init_case_files2 = __esm({
|
|
|
41052
41502
|
edited_while_pulling: "changed here while pulling: kept; pull again",
|
|
41053
41503
|
unresolved: "the case's copy of a conflict, still beside your file: merge it into that file, then delete it"
|
|
41054
41504
|
};
|
|
41505
|
+
inRunOf = (outside) => (rel) => !outside(rel) && !isTheirs(rel);
|
|
41055
41506
|
PUSH_CONFLICT2 = {
|
|
41056
41507
|
changed_on_base: "changed on the case since your last pull",
|
|
41057
41508
|
deleted_on_base: "deleted on the case since your last pull, or no longer readable by this authorization",
|
|
@@ -41098,7 +41549,7 @@ async function requireConfidential(session) {
|
|
|
41098
41549
|
const detail = (await call2(session, () => session.api.getCase(session.connection))).data;
|
|
41099
41550
|
if (!detail.access.capabilities.includes("read_confidential")) {
|
|
41100
41551
|
throw expected(
|
|
41101
|
-
`This machine's authorization on case ${
|
|
41552
|
+
`This machine's authorization on case ${one4(detail.code)} does not hold the Confidential right, so --confidential reads nothing more. Run it without --confidential.`
|
|
41102
41553
|
);
|
|
41103
41554
|
}
|
|
41104
41555
|
}
|
|
@@ -41111,7 +41562,7 @@ function block(label3, text5, none) {
|
|
|
41111
41562
|
for (const line of sanitizeTerminalText(text5).split("\n")) console.log(` | ${line}`);
|
|
41112
41563
|
}
|
|
41113
41564
|
function verdictCommand(connection, graph, pair) {
|
|
41114
|
-
return `wayai cases review verdict <${VERDICTS.join("|")}> ${
|
|
41565
|
+
return `wayai cases review verdict <${VERDICTS.join("|")}> ${one4(pair.source)} ${one4(pair.neighbor)} --revision ${one4(graph.revision_id ?? "")} --source-hash ${one4(pair.source_hash)} --neighbor-hash ${one4(pair.neighbor_hash)}${graph.confidential ? " --confidential" : ""} --case ${one4(connection.code)} --org ${one4(connection.org_id)} --space ${one4(connection.space_id)} --reason "<why>"`;
|
|
41115
41566
|
}
|
|
41116
41567
|
async function caseReview(session, opts) {
|
|
41117
41568
|
if (opts.confidential) await requireConfidential(session);
|
|
@@ -41134,15 +41585,15 @@ function printReview(connection, graph) {
|
|
|
41134
41585
|
notice();
|
|
41135
41586
|
return;
|
|
41136
41587
|
}
|
|
41137
|
-
console.log(`Review of case ${code2} at revision ${
|
|
41138
|
-
console.log(graph.base_revision_id ? `Base: revision ${
|
|
41588
|
+
console.log(`Review of case ${code2} at revision ${one4(graph.revision_id)}${graph.confidential ? ", with confidential content" : ""}.`);
|
|
41589
|
+
console.log(graph.base_revision_id ? `Base: revision ${one4(graph.base_revision_id)}. Nothing you read here is pending.` : "Base: each item's own, below. Something you read here is pending.");
|
|
41139
41590
|
const titles = new Map(graph.items.map((item) => [item.key, item.title]));
|
|
41140
41591
|
if (graph.items.length) {
|
|
41141
41592
|
console.log(`
|
|
41142
41593
|
Changed items (${graph.items.length}):`);
|
|
41143
41594
|
for (const item of graph.items) {
|
|
41144
|
-
console.log(` ${
|
|
41145
|
-
if (item.causes.length) console.log(` because: ${item.causes.map(
|
|
41595
|
+
console.log(` ${one4(item.key)}, "${one4(item.title)}" (${item.state}, round ${item.round}), in ${one4(item.path)}${item.base_revision_id ? `, since revision ${one4(item.base_revision_id)}` : ""}`);
|
|
41596
|
+
if (item.causes.length) console.log(` because: ${item.causes.map(one4).join("; ")}`);
|
|
41146
41597
|
block("before", item.before, "not there at its base");
|
|
41147
41598
|
block("now", item.text, "removed");
|
|
41148
41599
|
}
|
|
@@ -41152,8 +41603,8 @@ Changed items (${graph.items.length}):`);
|
|
|
41152
41603
|
Pairs awaiting a verdict (${graph.pairs.length}):`);
|
|
41153
41604
|
for (const pair of graph.pairs) {
|
|
41154
41605
|
const source = titles.get(pair.source);
|
|
41155
|
-
console.log(` ${
|
|
41156
|
-
if (pair.reasons.length) console.log(` connected: ${pair.reasons.map(
|
|
41606
|
+
console.log(` ${one4(pair.source)}${source ? ` "${one4(source)}"` : ""} \u2192 ${one4(pair.neighbor)} "${one4(pair.neighbor_title)}" (round ${pair.round} of ${CASE_REVIEW_ROUNDS_MAX}), in ${one4(pair.path)}`);
|
|
41607
|
+
if (pair.reasons.length) console.log(` connected: ${pair.reasons.map(one4).join("; ")}`);
|
|
41157
41608
|
console.log(` ${verdictCommand(connection, graph, pair)}`);
|
|
41158
41609
|
}
|
|
41159
41610
|
}
|
|
@@ -41161,16 +41612,16 @@ Pairs awaiting a verdict (${graph.pairs.length}):`);
|
|
|
41161
41612
|
console.log(`
|
|
41162
41613
|
Waiting for a change (${graph.waiting.length}):`);
|
|
41163
41614
|
for (const w of graph.waiting) {
|
|
41164
|
-
console.log(` ${
|
|
41165
|
-
console.log(` waits until ${
|
|
41615
|
+
console.log(` ${one4(w.source)} \u2192 ${one4(w.neighbor)} (round ${w.round}): needs a change: ${one4(w.reason)}`);
|
|
41616
|
+
console.log(` waits until ${one4(w.neighbor)} changes`);
|
|
41166
41617
|
}
|
|
41167
41618
|
}
|
|
41168
41619
|
if (graph.stopped.length) {
|
|
41169
41620
|
console.log(`
|
|
41170
41621
|
Stopped chains (${graph.stopped.length}): each took more than ${CASE_REVIEW_ROUNDS_MAX} rounds, so it takes no verdict.`);
|
|
41171
41622
|
for (const s of graph.stopped) {
|
|
41172
|
-
const waiting = s.waiting_sources.length ? `; waiting on it: ${s.waiting_sources.map(
|
|
41173
|
-
console.log(` ${
|
|
41623
|
+
const waiting = s.waiting_sources.length ? `; waiting on it: ${s.waiting_sources.map(one4).join(", ")}` : "";
|
|
41624
|
+
console.log(` ${one4(s.key)}, "${one4(s.title)}" (round ${s.round})${s.base_revision_id ? `, since revision ${one4(s.base_revision_id)}` : ""}${waiting}`);
|
|
41174
41625
|
}
|
|
41175
41626
|
console.log(` ${WEB_ONLY_NOTICE}`);
|
|
41176
41627
|
}
|
|
@@ -41179,8 +41630,8 @@ Stopped chains (${graph.stopped.length}): each took more than ${CASE_REVIEW_ROUN
|
|
|
41179
41630
|
console.log(`
|
|
41180
41631
|
For a person to look at (${warnings.length}):`);
|
|
41181
41632
|
for (const w of warnings) {
|
|
41182
|
-
const where = [w.path &&
|
|
41183
|
-
console.log(` ${WARNINGS[w.code] ??
|
|
41633
|
+
const where = [w.path && one4(w.path), w.subject && one4(w.subject)].filter(Boolean).join(": ");
|
|
41634
|
+
console.log(` ${WARNINGS[w.code] ?? one4(w.code)}${where ? ` [${where}]` : ""}`);
|
|
41184
41635
|
}
|
|
41185
41636
|
}
|
|
41186
41637
|
if (!graph.items.length && !graph.pairs.length && !graph.waiting.length && !graph.stopped.length) console.log("Nothing awaits review.");
|
|
@@ -41227,12 +41678,12 @@ async function caseReviewVerdict(session, body, opts) {
|
|
|
41227
41678
|
console.log(JSON.stringify(review, null, 2));
|
|
41228
41679
|
return;
|
|
41229
41680
|
}
|
|
41230
|
-
console.log(`Recorded ${review.verdict === "needs_change" ? "needs change" : review.verdict} on ${
|
|
41681
|
+
console.log(`Recorded ${review.verdict === "needs_change" ? "needs change" : review.verdict} on ${one4(review.source)} \u2192 ${one4(review.neighbor)}, round ${review.round} of ${CASE_REVIEW_ROUNDS_MAX}${review.confidential ? ", confidential" : ""}: ${review.review_id}`);
|
|
41231
41682
|
if (review.verdict === "needs_change") {
|
|
41232
|
-
console.log(`The pair waits until ${
|
|
41683
|
+
console.log(`The pair waits until ${one4(review.neighbor)} changes: change it, push, then read the review again.`);
|
|
41233
41684
|
}
|
|
41234
41685
|
}
|
|
41235
|
-
var VERDICTS, WEB_ONLY_NOTICE,
|
|
41686
|
+
var VERDICTS, WEB_ONLY_NOTICE, one4, WARNINGS;
|
|
41236
41687
|
var init_case_review2 = __esm({
|
|
41237
41688
|
"src/cases/case-review.ts"() {
|
|
41238
41689
|
"use strict";
|
|
@@ -41245,7 +41696,7 @@ var init_case_review2 = __esm({
|
|
|
41245
41696
|
init_case_review();
|
|
41246
41697
|
VERDICTS = recordCaseItemReviewBody.shape.verdict.options;
|
|
41247
41698
|
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.";
|
|
41248
|
-
|
|
41699
|
+
one4 = (value) => sanitizeTerminalText(value).replace(/\s*\n\s*/g, " ");
|
|
41249
41700
|
WARNINGS = {
|
|
41250
41701
|
outside_item: "text outside any item",
|
|
41251
41702
|
new_document_outside_item: "a new document with text outside any item",
|
|
@@ -41271,8 +41722,8 @@ __export(cases_exports, {
|
|
|
41271
41722
|
waitForPickup: () => waitForPickup,
|
|
41272
41723
|
webOrigin: () => webOrigin
|
|
41273
41724
|
});
|
|
41274
|
-
import * as
|
|
41275
|
-
import * as
|
|
41725
|
+
import * as crypto5 from "crypto";
|
|
41726
|
+
import * as os5 from "os";
|
|
41276
41727
|
import { parseArgs as parseArgs26 } from "util";
|
|
41277
41728
|
function usageError4(message) {
|
|
41278
41729
|
return expected(`${message}
|
|
@@ -41311,24 +41762,24 @@ async function casesCommand(args2) {
|
|
|
41311
41762
|
return disconnect(operands[0], { org: values.org, space: values.space });
|
|
41312
41763
|
}
|
|
41313
41764
|
const selector = { case: values.case, org: values.org, space: values.space };
|
|
41314
|
-
const
|
|
41765
|
+
const json2 = values.json === true;
|
|
41315
41766
|
const takesNone = () => {
|
|
41316
41767
|
if (operands.length) throw usageError4(`${name} takes no argument.`);
|
|
41317
41768
|
};
|
|
41318
41769
|
switch (name) {
|
|
41319
41770
|
case "brief":
|
|
41320
41771
|
takesNone();
|
|
41321
|
-
return caseBrief(await openCaseSession(selector), { json });
|
|
41772
|
+
return caseBrief(await openCaseSession(selector), { json: json2 });
|
|
41322
41773
|
case "next":
|
|
41323
41774
|
takesNone();
|
|
41324
|
-
return caseNext(await openCaseSession(selector), { json });
|
|
41775
|
+
return caseNext(await openCaseSession(selector), { json: json2 });
|
|
41325
41776
|
case "explain":
|
|
41326
41777
|
takesNone();
|
|
41327
|
-
return caseExplain(await openCaseSession(selector), { json, phase: values.phase });
|
|
41778
|
+
return caseExplain(await openCaseSession(selector), { json: json2, phase: values.phase });
|
|
41328
41779
|
case "check":
|
|
41329
41780
|
takesNone();
|
|
41330
41781
|
if (values.phase === void 0) throw usageError4("check takes --phase <folder>.");
|
|
41331
|
-
return caseCheck(await openCaseSession(selector), { json, phase: values.phase, output: values.output });
|
|
41782
|
+
return caseCheck(await openCaseSession(selector), { json: json2, phase: values.phase, output: values.output });
|
|
41332
41783
|
case "decisions": {
|
|
41333
41784
|
takesNone();
|
|
41334
41785
|
const session = await openCaseSession(selector);
|
|
@@ -41339,9 +41790,15 @@ async function casesCommand(args2) {
|
|
|
41339
41790
|
case "clone":
|
|
41340
41791
|
takesNone();
|
|
41341
41792
|
return caseClone(selector, { dir: values.dir, confidential: values.confidential === true });
|
|
41342
|
-
case "pull":
|
|
41793
|
+
case "pull": {
|
|
41343
41794
|
takesNone();
|
|
41344
|
-
|
|
41795
|
+
const confidential = values.confidential === true;
|
|
41796
|
+
if (values["mirror-only"] === true) {
|
|
41797
|
+
if (values.overwrite !== void 0 || values.yes !== void 0) throw usageError4("pull --mirror-only writes no file of the case: it takes neither --overwrite nor --yes.");
|
|
41798
|
+
return casePullMirror({ dir: values.dir, confidential });
|
|
41799
|
+
}
|
|
41800
|
+
return casePull({ dir: values.dir, overwrite: values.overwrite === true, yes: values.yes === true, confidential });
|
|
41801
|
+
}
|
|
41345
41802
|
case "push":
|
|
41346
41803
|
takesNone();
|
|
41347
41804
|
if (values.message === void 0 && values["dry-run"] !== true) throw usageError4('push takes a message: -m "<what this revision does>".');
|
|
@@ -41357,11 +41814,11 @@ async function casesCommand(args2) {
|
|
|
41357
41814
|
takesNone();
|
|
41358
41815
|
const limit = values.limit === void 0 ? void 0 : /^[0-9]+$/.test(values.limit) ? Number(values.limit) : NaN;
|
|
41359
41816
|
if (limit !== void 0 && !(limit >= 1 && limit <= LOG_MAX)) throw usageError4(`--limit takes 1 to ${LOG_MAX}.`);
|
|
41360
|
-
return caseLog(selector, { limit, json, confidential: values.confidential === true });
|
|
41817
|
+
return caseLog(selector, { limit, json: json2, confidential: values.confidential === true });
|
|
41361
41818
|
}
|
|
41362
41819
|
case "review":
|
|
41363
41820
|
takesNone();
|
|
41364
|
-
return caseReview(await openCaseSession(selector), { json, confidential: values.confidential === true });
|
|
41821
|
+
return caseReview(await openCaseSession(selector), { json: json2, confidential: values.confidential === true });
|
|
41365
41822
|
case "review verdict": {
|
|
41366
41823
|
if (operands.length !== 3) throw usageError4("review verdict takes consistent|needs_change, then <source> and <neighbor>.");
|
|
41367
41824
|
const [verdict, source, neighbor] = operands;
|
|
@@ -41376,7 +41833,7 @@ async function casesCommand(args2) {
|
|
|
41376
41833
|
markConfidential: values["mark-confidential"] === true,
|
|
41377
41834
|
confidential: values.confidential === true
|
|
41378
41835
|
});
|
|
41379
|
-
return caseReviewVerdict(await openCaseSession(selector), body, { json });
|
|
41836
|
+
return caseReviewVerdict(await openCaseSession(selector), body, { json: json2 });
|
|
41380
41837
|
}
|
|
41381
41838
|
case "note":
|
|
41382
41839
|
if (operands.length !== 1) throw usageError4("note takes its text as one argument: quote it.");
|
|
@@ -41409,7 +41866,7 @@ function caseRef(orgId, spaceId, code2) {
|
|
|
41409
41866
|
return parsed.data;
|
|
41410
41867
|
}
|
|
41411
41868
|
function machineLabel2(flag) {
|
|
41412
|
-
const parsed = createCaseAgentRequestBody.shape.machine_label.safeParse(flag ??
|
|
41869
|
+
const parsed = createCaseAgentRequestBody.shape.machine_label.safeParse(flag ?? os5.hostname().slice(0, CASE_AGENT_MACHINE_LABEL_MAX));
|
|
41413
41870
|
if (parsed.success) return parsed.data;
|
|
41414
41871
|
if (flag === void 0) throw usageError4("This machine's hostname cannot name it at approval: pass --label <machine>.");
|
|
41415
41872
|
throw usageError4(`--label takes 1 to ${CASE_AGENT_MACHINE_LABEL_MAX} characters, none of them a control character.`);
|
|
@@ -41427,13 +41884,13 @@ function webOrigin(apiUrl) {
|
|
|
41427
41884
|
else return null;
|
|
41428
41885
|
return `${url.protocol}//${host}${url.port ? `:${url.port}` : ""}`;
|
|
41429
41886
|
}
|
|
41430
|
-
function webLocation(apiUrl,
|
|
41887
|
+
function webLocation(apiUrl, path51) {
|
|
41431
41888
|
const origin = webOrigin(apiUrl);
|
|
41432
|
-
return origin ? `${origin}${
|
|
41889
|
+
return origin ? `${origin}${path51}` : `${path51} (in the WayAI web app)`;
|
|
41433
41890
|
}
|
|
41434
41891
|
function pickupSecret() {
|
|
41435
|
-
const bytes =
|
|
41436
|
-
return { secret: bytes.toString("hex"), challenge:
|
|
41892
|
+
const bytes = crypto5.randomBytes(32);
|
|
41893
|
+
return { secret: bytes.toString("hex"), challenge: crypto5.createHash("sha256").update(bytes).digest("hex") };
|
|
41437
41894
|
}
|
|
41438
41895
|
function connectFailure(err, stage) {
|
|
41439
41896
|
if (!(err instanceof ApiError)) return err;
|
|
@@ -41597,6 +42054,7 @@ var init_cases = __esm({
|
|
|
41597
42054
|
init_case_session();
|
|
41598
42055
|
init_case_work();
|
|
41599
42056
|
init_case_files2();
|
|
42057
|
+
init_case_mirror();
|
|
41600
42058
|
init_case_review2();
|
|
41601
42059
|
init_case_clone_record();
|
|
41602
42060
|
init_case_tokens();
|
|
@@ -41610,6 +42068,7 @@ Usage:
|
|
|
41610
42068
|
|
|
41611
42069
|
wayai cases clone [--dir <folder>] [--confidential]
|
|
41612
42070
|
wayai cases pull [--dir <clone>] [--overwrite] [--yes] [--confidential]
|
|
42071
|
+
wayai cases pull --mirror-only [--dir <clone>] [--confidential]
|
|
41613
42072
|
wayai cases push -m "<message>" [--session <tag>] [--prune] [--dry-run]
|
|
41614
42073
|
[--dir <clone>] [--confidential]
|
|
41615
42074
|
wayai cases log [--limit <n>] [--json] [--confidential]
|
|
@@ -41647,7 +42106,8 @@ when codes repeat).
|
|
|
41647
42106
|
clone Make a folder bound to the case (--dir, default ./<code>) and
|
|
41648
42107
|
write the case's files into it: its phase folders, analysis/,
|
|
41649
42108
|
conf/ and instructions/case/. Nothing else in the folder is read
|
|
41650
|
-
or written.
|
|
42109
|
+
or written, but the mirror. It prints the session-start hook to
|
|
42110
|
+
add to your agent.
|
|
41651
42111
|
pull Bring the clone up to date, keeping your local changes. A file
|
|
41652
42112
|
changed on both sides keeps yours, and the case's copy lands
|
|
41653
42113
|
beside it as <path>.theirs: merge it, then delete it. Pull exits 1
|
|
@@ -41655,6 +42115,13 @@ pull Bring the clone up to date, keeping your local changes. A file
|
|
|
41655
42115
|
with --confidential). --overwrite takes the case's copies
|
|
41656
42116
|
over your changes and removes those copies, after asking (--yes
|
|
41657
42117
|
agrees without a terminal).
|
|
42118
|
+
Clone and every pull then rewrite the clone's read-only mirror,
|
|
42119
|
+
${CASE_MIRROR_DIR}/: the case, its status, evidence, agenda and
|
|
42120
|
+
deliveries of the phases under way, and what changed since the
|
|
42121
|
+
last pull. Push never sends it; an edit there is lost.
|
|
42122
|
+
--mirror-only rewrites the mirror alone, leaving your files as
|
|
42123
|
+
they are: the session-start hook runs it, never with
|
|
42124
|
+
--confidential.
|
|
41658
42125
|
push Send the clone's changes as one revision, all of it or none. Each
|
|
41659
42126
|
file is checked against the copy you last pulled: if the case
|
|
41660
42127
|
changed since, nothing is pushed and nothing here changes; pull
|
|
@@ -41699,7 +42166,7 @@ received add Register a document a party sent, in one phase, with its
|
|
|
41699
42166
|
|
|
41700
42167
|
Confidential content is never asked for unless you pass --confidential:
|
|
41701
42168
|
without it, clone, pull, push and log leave every confidential file alone,
|
|
41702
|
-
and review
|
|
42169
|
+
and review and the mirror leave out confidential content.
|
|
41703
42170
|
The case's agents page in the web app shows the exact connect command.
|
|
41704
42171
|
After connecting, this machine still holds your \`wayai login\`:
|
|
41705
42172
|
\`wayai logout\` is the recommended next step, and the case token does not
|
|
@@ -41732,7 +42199,8 @@ need it.
|
|
|
41732
42199
|
revision: { type: "string" },
|
|
41733
42200
|
"source-hash": { type: "string" },
|
|
41734
42201
|
"neighbor-hash": { type: "string" },
|
|
41735
|
-
"mark-confidential": { type: "boolean" }
|
|
42202
|
+
"mark-confidential": { type: "boolean" },
|
|
42203
|
+
"mirror-only": { type: "boolean" }
|
|
41736
42204
|
};
|
|
41737
42205
|
SELECT = ["case", "org", "space"];
|
|
41738
42206
|
ADMITS = {
|
|
@@ -41748,7 +42216,7 @@ need it.
|
|
|
41748
42216
|
"received add": [...SELECT, "text", "phase", "type", "title", "confidential"],
|
|
41749
42217
|
clone: [...SELECT, "dir", "confidential"],
|
|
41750
42218
|
// A clone names its case: pull and push take the clone (--dir), never a case.
|
|
41751
|
-
pull: ["dir", "overwrite", "yes", "confidential"],
|
|
42219
|
+
pull: ["dir", "overwrite", "yes", "confidential", "mirror-only"],
|
|
41752
42220
|
push: ["dir", "message", "session", "prune", "dry-run", "confidential"],
|
|
41753
42221
|
log: [...SELECT, "limit", "json", "confidential"],
|
|
41754
42222
|
review: [...SELECT, "json", "confidential"],
|
|
@@ -42294,8 +42762,8 @@ refresh-preview: make the knowledge base's preview hold its production base's fi
|
|
|
42294
42762
|
});
|
|
42295
42763
|
|
|
42296
42764
|
// src/lib/file-map.ts
|
|
42297
|
-
import * as
|
|
42298
|
-
import * as
|
|
42765
|
+
import * as fs37 from "fs";
|
|
42766
|
+
import * as path49 from "path";
|
|
42299
42767
|
function isSafeRelPath(rel) {
|
|
42300
42768
|
if (rel.length === 0 || rel.length > 300) return false;
|
|
42301
42769
|
if (rel.startsWith("/") || rel.includes("\\")) return false;
|
|
@@ -42310,9 +42778,9 @@ function writeFileMap(targetDir, files) {
|
|
|
42310
42778
|
if (!isSafeRelPath(rel)) {
|
|
42311
42779
|
throw new Error(`Refusing to write unsafe path: ${rel}`);
|
|
42312
42780
|
}
|
|
42313
|
-
const abs =
|
|
42314
|
-
|
|
42315
|
-
|
|
42781
|
+
const abs = path49.join(targetDir, rel);
|
|
42782
|
+
fs37.mkdirSync(path49.dirname(abs), { recursive: true });
|
|
42783
|
+
fs37.writeFileSync(abs, body, "utf-8");
|
|
42316
42784
|
written.push(rel);
|
|
42317
42785
|
}
|
|
42318
42786
|
return written;
|
|
@@ -42402,8 +42870,8 @@ var admin_exports = {};
|
|
|
42402
42870
|
__export(admin_exports, {
|
|
42403
42871
|
adminCommand: () => adminCommand
|
|
42404
42872
|
});
|
|
42405
|
-
import * as
|
|
42406
|
-
import * as
|
|
42873
|
+
import * as fs38 from "fs";
|
|
42874
|
+
import * as path50 from "path";
|
|
42407
42875
|
async function adminCommand(args2) {
|
|
42408
42876
|
const [group, ...afterGroup] = args2;
|
|
42409
42877
|
if (!group) {
|
|
@@ -43044,13 +43512,13 @@ async function runSkillInstall(positional) {
|
|
|
43044
43512
|
throw err;
|
|
43045
43513
|
}
|
|
43046
43514
|
const root = findGitRoot() ?? process.cwd();
|
|
43047
|
-
const present = HARNESS_SKILL_DIRS.filter((dir) =>
|
|
43515
|
+
const present = HARNESS_SKILL_DIRS.filter((dir) => fs38.existsSync(path50.join(root, dir)));
|
|
43048
43516
|
const targets = present.length > 0 ? present : HARNESS_SKILL_DIRS;
|
|
43049
43517
|
const fileCount = Object.keys(res.files).length;
|
|
43050
43518
|
const relDirs = targets.map((harness) => {
|
|
43051
|
-
const targetDir =
|
|
43519
|
+
const targetDir = path50.join(root, harness, "skills", name);
|
|
43052
43520
|
writeFileMap(targetDir, res.files);
|
|
43053
|
-
return `${
|
|
43521
|
+
return `${path50.relative(root, targetDir)}/`;
|
|
43054
43522
|
});
|
|
43055
43523
|
console.log(`Installed skill "${name}" (${fileCount} file${fileCount === 1 ? "" : "s"}) \u2192 ${relDirs.join(", ")}`);
|
|
43056
43524
|
console.log("Reload your agent (e.g. restart Claude Code) to pick up the skill.");
|
|
@@ -45298,12 +45766,12 @@ async function reportEditCommand(args2) {
|
|
|
45298
45766
|
}
|
|
45299
45767
|
async function reportListCommand(args2) {
|
|
45300
45768
|
const status = flagValue2(args2, "--status");
|
|
45301
|
-
const
|
|
45769
|
+
const json2 = args2.includes("--json");
|
|
45302
45770
|
const { config, accessToken } = await requireAuth();
|
|
45303
45771
|
const client = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
45304
45772
|
try {
|
|
45305
45773
|
const result = await client.listMyReports(status);
|
|
45306
|
-
if (
|
|
45774
|
+
if (json2) {
|
|
45307
45775
|
console.log(JSON.stringify(result, null, 2));
|
|
45308
45776
|
return;
|
|
45309
45777
|
}
|
|
@@ -45321,7 +45789,7 @@ async function reportListCommand(args2) {
|
|
|
45321
45789
|
}
|
|
45322
45790
|
async function reportGetCommand(args2) {
|
|
45323
45791
|
const reportId = args2.find((a) => !a.startsWith("--"));
|
|
45324
|
-
const
|
|
45792
|
+
const json2 = args2.includes("--json");
|
|
45325
45793
|
if (!reportId) {
|
|
45326
45794
|
console.error("Usage: wayai report get <report_id> [--json]");
|
|
45327
45795
|
process.exit(1);
|
|
@@ -45330,7 +45798,7 @@ async function reportGetCommand(args2) {
|
|
|
45330
45798
|
const client = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
45331
45799
|
try {
|
|
45332
45800
|
const result = await client.getMyReport(reportId);
|
|
45333
|
-
if (
|
|
45801
|
+
if (json2) {
|
|
45334
45802
|
console.log(JSON.stringify(result, null, 2));
|
|
45335
45803
|
return;
|
|
45336
45804
|
}
|
|
@@ -45533,7 +46001,7 @@ var init_actions = __esm({
|
|
|
45533
46001
|
|
|
45534
46002
|
// src/data/commands/attachments.ts
|
|
45535
46003
|
import { Command as Command3 } from "commander";
|
|
45536
|
-
import { readFileSync as
|
|
46004
|
+
import { readFileSync as readFileSync22 } from "fs";
|
|
45537
46005
|
function findAttachmentByFilename(attachments, filename) {
|
|
45538
46006
|
return attachments.find((a) => a.key.endsWith(`/${filename}`)) ?? null;
|
|
45539
46007
|
}
|
|
@@ -45574,7 +46042,7 @@ function buildAttachmentsCommand() {
|
|
|
45574
46042
|
printOutput(data, outputFormat(this));
|
|
45575
46043
|
return;
|
|
45576
46044
|
}
|
|
45577
|
-
const body =
|
|
46045
|
+
const body = readFileSync22(opts.file);
|
|
45578
46046
|
await client.upload(uploadPathFrom(data?.upload_url), body, opts.contentType);
|
|
45579
46047
|
printOutput({ ...data, uploaded: true }, outputFormat(this));
|
|
45580
46048
|
});
|
|
@@ -45991,7 +46459,7 @@ var init_import = __esm({
|
|
|
45991
46459
|
|
|
45992
46460
|
// src/data/commands/providers.ts
|
|
45993
46461
|
import { Command as Command6 } from "commander";
|
|
45994
|
-
import { writeFileSync as
|
|
46462
|
+
import { writeFileSync as writeFileSync13 } from "fs";
|
|
45995
46463
|
function providerSegment(provider) {
|
|
45996
46464
|
if (!VALID_PROVIDERS.includes(provider)) {
|
|
45997
46465
|
throw expected(`Unknown provider ${JSON.stringify(provider)}. Expected one of: ${VALID_PROVIDERS_HELP}.`);
|
|
@@ -46024,7 +46492,7 @@ function buildBasesProvidersCommand() {
|
|
|
46024
46492
|
);
|
|
46025
46493
|
if (opts.to) {
|
|
46026
46494
|
try {
|
|
46027
|
-
|
|
46495
|
+
writeFileSync13(opts.to, JSON.stringify(data, null, 2));
|
|
46028
46496
|
} catch (e) {
|
|
46029
46497
|
throw expected(`--to ${opts.to}: ${e instanceof Error ? e.message : "could not be written"}`);
|
|
46030
46498
|
}
|
|
@@ -46145,7 +46613,7 @@ var init_credentials = __esm({
|
|
|
46145
46613
|
|
|
46146
46614
|
// src/data/commands/sql.ts
|
|
46147
46615
|
import { Command as Command8 } from "commander";
|
|
46148
|
-
import { readFileSync as
|
|
46616
|
+
import { readFileSync as readFileSync23 } from "fs";
|
|
46149
46617
|
function buildBasesSqlCommand() {
|
|
46150
46618
|
return withBaseOption(new Command8("sql")).description("Execute a read-only SQL query against base data").argument("[query]", "SQL query (SELECT only)").option("--file <path>", "Read SQL from a file instead of the argument").option(
|
|
46151
46619
|
"--param <kv...>",
|
|
@@ -46155,7 +46623,7 @@ function buildBasesSqlCommand() {
|
|
|
46155
46623
|
let query;
|
|
46156
46624
|
if (opts.file) {
|
|
46157
46625
|
try {
|
|
46158
|
-
query =
|
|
46626
|
+
query = readFileSync23(opts.file, "utf-8").trim();
|
|
46159
46627
|
} catch (e) {
|
|
46160
46628
|
throw expected(`--file ${opts.file}: ${e instanceof Error ? e.message : "could not be read"}`);
|
|
46161
46629
|
}
|
|
@@ -46315,16 +46783,16 @@ MCP URL: ${toolsetMcpUrl(slug)}`);
|
|
|
46315
46783
|
).option("--force", "Revoke even if the token appears to be in live use").action(async function(tokenId, opts) {
|
|
46316
46784
|
const client = await createDataClient();
|
|
46317
46785
|
const id = pathSegment(tokenId, "token id");
|
|
46318
|
-
const
|
|
46786
|
+
const path51 = (force) => `/v1/tokens/${id}${force ? "?force=true" : ""}`;
|
|
46319
46787
|
const format = outputFormat(this);
|
|
46320
46788
|
const revoked = (forced) => printOutput({ token_id: tokenId, revoked: true, forced }, format);
|
|
46321
46789
|
if (opts.force) {
|
|
46322
|
-
await client.request("DELETE",
|
|
46790
|
+
await client.request("DELETE", path51(true));
|
|
46323
46791
|
revoked(true);
|
|
46324
46792
|
return;
|
|
46325
46793
|
}
|
|
46326
46794
|
try {
|
|
46327
|
-
await client.request("DELETE",
|
|
46795
|
+
await client.request("DELETE", path51(false));
|
|
46328
46796
|
revoked(false);
|
|
46329
46797
|
} catch (err) {
|
|
46330
46798
|
if (!(err instanceof ApiError) || err.status !== 409 || dataErrorDetails(err)?.requires_force !== true) {
|
|
@@ -46339,7 +46807,7 @@ MCP URL: ${toolsetMcpUrl(slug)}`);
|
|
|
46339
46807
|
console.error("Aborted.");
|
|
46340
46808
|
return process.exit(1);
|
|
46341
46809
|
}
|
|
46342
|
-
await client.request("DELETE",
|
|
46810
|
+
await client.request("DELETE", path51(true));
|
|
46343
46811
|
revoked(true);
|
|
46344
46812
|
}
|
|
46345
46813
|
});
|
|
@@ -46387,29 +46855,29 @@ MCP URL: ${toolsetMcpUrl(slug)}`);
|
|
|
46387
46855
|
}
|
|
46388
46856
|
}
|
|
46389
46857
|
const format = outputFormat(this);
|
|
46390
|
-
const
|
|
46391
|
-
const note = (line) =>
|
|
46858
|
+
const json2 = format === "json";
|
|
46859
|
+
const note = (line) => json2 ? console.error(line) : console.log(line);
|
|
46392
46860
|
const printPreview = () => {
|
|
46393
46861
|
if (targets.length === 0) {
|
|
46394
46862
|
note("Nothing to prune.");
|
|
46395
46863
|
} else {
|
|
46396
46864
|
note(`Would revoke ${targets.length} token(s):`);
|
|
46397
|
-
if (!
|
|
46865
|
+
if (!json2) printOutput(targets, format);
|
|
46398
46866
|
}
|
|
46399
46867
|
if (skipped.length === 0) return;
|
|
46400
46868
|
note(`
|
|
46401
46869
|
Skipped ${skipped.length} stale token(s):`);
|
|
46402
|
-
if (!
|
|
46870
|
+
if (!json2) printOutput(skipped, format);
|
|
46403
46871
|
};
|
|
46404
46872
|
printPreview();
|
|
46405
46873
|
if (targets.length === 0) {
|
|
46406
|
-
if (
|
|
46874
|
+
if (json2) printOutput({ revoked: 0, failed: 0, targets, skipped }, format);
|
|
46407
46875
|
return;
|
|
46408
46876
|
}
|
|
46409
46877
|
if (!opts.yes) {
|
|
46410
46878
|
if (!isInteractive()) {
|
|
46411
46879
|
console.error("\nPreview only \u2014 re-run with --yes to revoke these tokens.");
|
|
46412
|
-
if (
|
|
46880
|
+
if (json2) printOutput({ preview: true, revoked: 0, failed: 0, targets, skipped }, format);
|
|
46413
46881
|
return process.exit(1);
|
|
46414
46882
|
}
|
|
46415
46883
|
if (!await confirm(`
|
|
@@ -46434,7 +46902,7 @@ Revoke ${targets.length} token(s)?`)) {
|
|
|
46434
46902
|
);
|
|
46435
46903
|
}
|
|
46436
46904
|
}
|
|
46437
|
-
if (
|
|
46905
|
+
if (json2) printOutput({ revoked, failed, targets, skipped }, format);
|
|
46438
46906
|
else console.log(`Revoked ${revoked} token(s)${failed > 0 ? `, ${failed} failed` : ""}.`);
|
|
46439
46907
|
if (failed > 0) return process.exit(1);
|
|
46440
46908
|
});
|
|
@@ -46491,9 +46959,9 @@ var init_base_tags = __esm({
|
|
|
46491
46959
|
|
|
46492
46960
|
// src/data/commands/bases.ts
|
|
46493
46961
|
import { Command as Command10 } from "commander";
|
|
46494
|
-
function pageOf(
|
|
46495
|
-
if (!cursor) return
|
|
46496
|
-
return `${
|
|
46962
|
+
function pageOf(path51, cursor) {
|
|
46963
|
+
if (!cursor) return path51;
|
|
46964
|
+
return `${path51}${path51.includes("?") ? "&" : "?"}cursor=${encodeURIComponent(cursor)}`;
|
|
46497
46965
|
}
|
|
46498
46966
|
function parseEnum(flag, value, allowed) {
|
|
46499
46967
|
if (value === void 0) return void 0;
|
|
@@ -46650,9 +47118,9 @@ function buildBasesCommand() {
|
|
|
46650
47118
|
});
|
|
46651
47119
|
bases.command("list-previews <origin-id>").description("List preview bases cloned from a base (production or preview)").action(async function(originId) {
|
|
46652
47120
|
const client = await createDataClient();
|
|
46653
|
-
const
|
|
47121
|
+
const path51 = `/v1/${pathSegment(originId, "origin base id")}/previews`;
|
|
46654
47122
|
printOutput(
|
|
46655
|
-
await client.collectPages((cursor) => pageOf(
|
|
47123
|
+
await client.collectPages((cursor) => pageOf(path51, cursor)),
|
|
46656
47124
|
outputFormat(this)
|
|
46657
47125
|
);
|
|
46658
47126
|
});
|
|
@@ -46691,9 +47159,9 @@ function buildBasesCommand() {
|
|
|
46691
47159
|
});
|
|
46692
47160
|
bases.command("promotions <production-id>").description("List promotion history for a production base").action(async function(productionId) {
|
|
46693
47161
|
const client = await createDataClient();
|
|
46694
|
-
const
|
|
47162
|
+
const path51 = `/v1/${pathSegment(productionId, "production base id")}/promotions`;
|
|
46695
47163
|
printOutput(
|
|
46696
|
-
await client.collectPages((cursor) => pageOf(
|
|
47164
|
+
await client.collectPages((cursor) => pageOf(path51, cursor)),
|
|
46697
47165
|
outputFormat(this)
|
|
46698
47166
|
);
|
|
46699
47167
|
});
|
|
@@ -46834,7 +47302,7 @@ var init_file_types = __esm({
|
|
|
46834
47302
|
|
|
46835
47303
|
// src/data/commands/files.ts
|
|
46836
47304
|
import { Command as Command12 } from "commander";
|
|
46837
|
-
import { readFileSync as
|
|
47305
|
+
import { readFileSync as readFileSync24, writeFileSync as writeFileSync14 } from "fs";
|
|
46838
47306
|
import { basename as basename30 } from "path";
|
|
46839
47307
|
function renderFileDiff(fileType, filePath3, from, to, d) {
|
|
46840
47308
|
console.log(sanitizeTerminalText(`${fileType}/${filePath3}: v${from} \u2192 v${to}`));
|
|
@@ -46891,7 +47359,7 @@ function buildFilesCommand() {
|
|
|
46891
47359
|
label: opts.label,
|
|
46892
47360
|
metadata: opts.metadata === void 0 ? void 0 : parseData(opts.metadata, "--metadata")
|
|
46893
47361
|
});
|
|
46894
|
-
const body =
|
|
47362
|
+
const body = readFileSync24(opts.file);
|
|
46895
47363
|
const client = await createDataClient();
|
|
46896
47364
|
printOutput(
|
|
46897
47365
|
await client.upload(
|
|
@@ -46923,7 +47391,7 @@ function buildFilesCommand() {
|
|
|
46923
47391
|
const { bytes } = await client.download(
|
|
46924
47392
|
`/v1/${base}/files/${pathSegment(fileType, "file_type")}/${encoded}${versionQs ? `?${versionQs}` : ""}`
|
|
46925
47393
|
);
|
|
46926
|
-
|
|
47394
|
+
writeFileSync14(out, bytes);
|
|
46927
47395
|
console.log(`Downloaded to ${out}`);
|
|
46928
47396
|
});
|
|
46929
47397
|
files.command("history <file_type> <path>").description("List the content versions of a file (newest first)").option("--limit <n>", "Max versions to return").option("--offset <n>", "Pagination offset").action(async function(fileType, filePath3, opts) {
|
|
@@ -47263,8 +47731,8 @@ function buildRecordsCommand() {
|
|
|
47263
47731
|
const body = { data: parseData(opts.data) };
|
|
47264
47732
|
if (opts.externalId) body.external_id = opts.externalId;
|
|
47265
47733
|
if (opts.externalSource) body.external_source = opts.externalSource;
|
|
47266
|
-
const
|
|
47267
|
-
printOutput(await client.request("PUT",
|
|
47734
|
+
const path51 = opts.id ? `/v1/${base}/records/${pathSegment(recordType2, "record_type")}/${pathSegment(opts.id, "--id")}` : `/v1/${base}/records/${pathSegment(recordType2, "record_type")}`;
|
|
47735
|
+
printOutput(await client.request("PUT", path51, body), outputFormat(this));
|
|
47268
47736
|
});
|
|
47269
47737
|
records.command("query <record_type>").description("List/search records: exact filters + fuzzy `search`, sorting, pagination").option(
|
|
47270
47738
|
"--external-source <source>",
|
|
@@ -47299,9 +47767,9 @@ function buildRecordsCommand() {
|
|
|
47299
47767
|
).action(async function(recordType2, id, opts) {
|
|
47300
47768
|
const base = pathSegment(requireBase(this), "--base");
|
|
47301
47769
|
const client = await createDataClient();
|
|
47302
|
-
let
|
|
47303
|
-
if (opts.externalSource)
|
|
47304
|
-
printOutput(await client.request("GET",
|
|
47770
|
+
let path51 = `/v1/${base}/records/${pathSegment(recordType2, "record_type")}/${recordKey(id, opts.externalSource)}`;
|
|
47771
|
+
if (opts.externalSource) path51 += `?external_source=${encodeURIComponent(opts.externalSource)}`;
|
|
47772
|
+
printOutput(await client.request("GET", path51), outputFormat(this));
|
|
47305
47773
|
});
|
|
47306
47774
|
records.command("delete <record_type> <id>").description(
|
|
47307
47775
|
"Delete a record by internal ID, or by external_id (pass --external-source to scope it)"
|
|
@@ -47315,11 +47783,11 @@ function buildRecordsCommand() {
|
|
|
47315
47783
|
}
|
|
47316
47784
|
const base = pathSegment(requireBase(this), "--base");
|
|
47317
47785
|
const client = await createDataClient();
|
|
47318
|
-
let
|
|
47786
|
+
let path51 = `/v1/${base}/records/${pathSegment(recordType2, "record_type")}/${recordKey(id, opts.externalSource)}`;
|
|
47319
47787
|
if (opts.externalSource) {
|
|
47320
|
-
|
|
47788
|
+
path51 += `?external_source=${encodeURIComponent(opts.externalSource)}&external_id=${encodeURIComponent(id)}`;
|
|
47321
47789
|
}
|
|
47322
|
-
await client.request("DELETE",
|
|
47790
|
+
await client.request("DELETE", path51);
|
|
47323
47791
|
console.log("Deleted");
|
|
47324
47792
|
});
|
|
47325
47793
|
records.command("history <id>").description(
|
|
@@ -47484,8 +47952,8 @@ function buildRelationshipsCommand() {
|
|
|
47484
47952
|
if (opts.data) body.data = parseData(opts.data);
|
|
47485
47953
|
const base = pathSegment(requireBase(this), "--base");
|
|
47486
47954
|
const client = await createDataClient();
|
|
47487
|
-
const
|
|
47488
|
-
printOutput(await client.request("PUT",
|
|
47955
|
+
const path51 = opts.id ? `/v1/${base}/relationships/${pathSegment(opts.id, "--id")}` : `/v1/${base}/relationships`;
|
|
47956
|
+
printOutput(await client.request("PUT", path51, body), outputFormat(this));
|
|
47489
47957
|
});
|
|
47490
47958
|
relationships.command("get <id>").description(
|
|
47491
47959
|
"Get a relationship by ID (or by its external key: pass the external_id with --rel-type)"
|
|
@@ -47718,8 +48186,8 @@ function buildToolsetsCommand() {
|
|
|
47718
48186
|
toolsets.command("get <slug>").description("Get a toolset").option("--resolved", "Include resolved record_type schemas").action(async function(slug, opts) {
|
|
47719
48187
|
const base = pathSegment(requireBase(this), "--base");
|
|
47720
48188
|
const client = await createDataClient();
|
|
47721
|
-
const
|
|
47722
|
-
printOutput(await client.request("GET",
|
|
48189
|
+
const path51 = opts.resolved ? `/v1/${base}/toolsets/${pathSegment(slug, "toolset slug")}/resolved` : `/v1/${base}/toolsets/${pathSegment(slug, "toolset slug")}`;
|
|
48190
|
+
printOutput(await client.request("GET", path51), outputFormat(this));
|
|
47723
48191
|
});
|
|
47724
48192
|
toolsets.command("list").description("List all toolsets").action(async function() {
|
|
47725
48193
|
const base = pathSegment(requireBase(this), "--base");
|
|
@@ -47854,9 +48322,9 @@ init_errors3();
|
|
|
47854
48322
|
init_mask_secrets();
|
|
47855
48323
|
init_utils();
|
|
47856
48324
|
init_registry();
|
|
47857
|
-
import { readFileSync as
|
|
48325
|
+
import { readFileSync as readFileSync25 } from "fs";
|
|
47858
48326
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
47859
|
-
import { dirname as dirname20, join as
|
|
48327
|
+
import { dirname as dirname20, join as join45 } from "path";
|
|
47860
48328
|
|
|
47861
48329
|
// src/lib/version-refresh.ts
|
|
47862
48330
|
init_version_cache();
|
|
@@ -48012,7 +48480,7 @@ Run \`wayai admin skill install\` to update.`);
|
|
|
48012
48480
|
|
|
48013
48481
|
// src/index.ts
|
|
48014
48482
|
var __dirname = dirname20(fileURLToPath2(import.meta.url));
|
|
48015
|
-
var pkg = JSON.parse(
|
|
48483
|
+
var pkg = JSON.parse(readFileSync25(join45(__dirname, "..", "package.json"), "utf-8"));
|
|
48016
48484
|
var [, , command, ...args] = process.argv;
|
|
48017
48485
|
var isBackgroundRefresh = command === REFRESH_COMMAND;
|
|
48018
48486
|
if (!isBackgroundRefresh) initSentry(command, pkg.version);
|