@wayai/cli 0.3.244 → 0.3.246

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -16,44 +16,44 @@ var __export = (target, all) => {
16
16
  };
17
17
 
18
18
  // src/lib/mask-secrets.ts
19
- function valueEnd(text, from, isEnd) {
20
- for (let i = from; i < text.length; i++) {
21
- if (text[i] === "\\") {
19
+ function valueEnd(text2, from, isEnd) {
20
+ for (let i = from; i < text2.length; i++) {
21
+ if (text2[i] === "\\") {
22
22
  i++;
23
23
  continue;
24
24
  }
25
- if (isEnd(text[i])) return i;
25
+ if (isEnd(text2[i])) return i;
26
26
  }
27
- return text.length;
27
+ return text2.length;
28
28
  }
29
- function maskCredentialValues(text, keyRe, resolveValueEnd) {
29
+ function maskCredentialValues(text2, keyRe, resolveValueEnd) {
30
30
  keyRe.lastIndex = 0;
31
31
  let out = "";
32
32
  let copied = 0;
33
33
  let match;
34
- while ((match = keyRe.exec(text)) !== null) {
34
+ while ((match = keyRe.exec(text2)) !== null) {
35
35
  const valueStart = match.index + match[0].length;
36
36
  keyRe.lastIndex = valueStart;
37
37
  if (!isCredentialKey(match[1])) continue;
38
- const end = resolveValueEnd(text, valueStart);
39
- const value = text.slice(valueStart, end);
38
+ const end = resolveValueEnd(text2, valueStart);
39
+ const value = text2.slice(valueStart, end);
40
40
  if (value.length === 0 || FULLY_MASKED_VALUE_RE.test(value)) continue;
41
- out += text.slice(copied, valueStart) + "[REDACTED]";
41
+ out += text2.slice(copied, valueStart) + "[REDACTED]";
42
42
  copied = end;
43
43
  keyRe.lastIndex = end;
44
44
  }
45
- return out + text.slice(copied);
45
+ return out + text2.slice(copied);
46
46
  }
47
- function maskJwts(text) {
47
+ function maskJwts(text2) {
48
48
  let out = "";
49
49
  let copied = 0;
50
50
  let cursor = 0;
51
- while (cursor < text.length) {
52
- while (cursor < text.length && !isBase64UrlChar(text[cursor])) cursor++;
51
+ while (cursor < text2.length) {
52
+ while (cursor < text2.length && !isBase64UrlChar(text2[cursor])) cursor++;
53
53
  const headerStart = cursor;
54
54
  let tokenStart = -1;
55
- while (cursor < text.length && isBase64UrlChar(text[cursor])) {
56
- if (tokenStart < 0 && text[cursor] === "e" && text[cursor + 1] === "y" && text[cursor + 2] === "J") {
55
+ while (cursor < text2.length && isBase64UrlChar(text2[cursor])) {
56
+ if (tokenStart < 0 && text2[cursor] === "e" && text2[cursor + 1] === "y" && text2[cursor + 2] === "J") {
57
57
  tokenStart = cursor;
58
58
  }
59
59
  cursor++;
@@ -61,28 +61,28 @@ function maskJwts(text) {
61
61
  const headerEnd = cursor;
62
62
  if (headerStart === headerEnd) continue;
63
63
  const hasJwtHeader = tokenStart >= headerStart && tokenStart + 3 < headerEnd;
64
- if (!hasJwtHeader || text[headerEnd] !== ".") continue;
64
+ if (!hasJwtHeader || text2[headerEnd] !== ".") continue;
65
65
  const payloadStart = headerEnd + 1;
66
66
  cursor = payloadStart;
67
- while (cursor < text.length && isBase64UrlChar(text[cursor])) cursor++;
67
+ while (cursor < text2.length && isBase64UrlChar(text2[cursor])) cursor++;
68
68
  const payloadEnd = cursor;
69
- if (payloadEnd === payloadStart || text[payloadEnd] !== ".") continue;
69
+ if (payloadEnd === payloadStart || text2[payloadEnd] !== ".") continue;
70
70
  const signatureStart = payloadEnd + 1;
71
71
  cursor = signatureStart;
72
- while (cursor < text.length && isBase64UrlChar(text[cursor])) cursor++;
72
+ while (cursor < text2.length && isBase64UrlChar(text2[cursor])) cursor++;
73
73
  if (cursor === signatureStart) continue;
74
- out += text.slice(copied, tokenStart) + "[REDACTED_JWT]";
74
+ out += text2.slice(copied, tokenStart) + "[REDACTED_JWT]";
75
75
  copied = cursor;
76
76
  }
77
- return out + text.slice(copied);
77
+ return out + text2.slice(copied);
78
78
  }
79
- function jsonContainerEnd(text, from) {
80
- const opener = text[from];
79
+ function jsonContainerEnd(text2, from) {
80
+ const opener = text2[from];
81
81
  if (opener !== "{" && opener !== "[") return null;
82
82
  const stack = [opener];
83
83
  let inString = false;
84
- for (let i = from + 1; i < text.length; i++) {
85
- const char = text[i];
84
+ for (let i = from + 1; i < text2.length; i++) {
85
+ const char = text2[i];
86
86
  if (inString) {
87
87
  if (char === "\\") {
88
88
  i++;
@@ -103,62 +103,62 @@ function jsonContainerEnd(text, from) {
103
103
  }
104
104
  return null;
105
105
  }
106
- function jsonNumberEnd(text, from) {
107
- const match = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/.exec(text.slice(from));
106
+ function jsonNumberEnd(text2, from) {
107
+ const match = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/.exec(text2.slice(from));
108
108
  if (!match) return null;
109
109
  const end = from + match[0].length;
110
110
  let next = end;
111
- while (next < text.length && /\s/.test(text[next])) next++;
112
- return next === text.length || text[next] === "," || text[next] === "}" || text[next] === "]" ? end : null;
111
+ while (next < text2.length && /\s/.test(text2[next])) next++;
112
+ return next === text2.length || text2[next] === "," || text2[next] === "}" || text2[next] === "]" ? end : null;
113
113
  }
114
- function maskJsonCredentialValues(text) {
114
+ function maskJsonCredentialValues(text2) {
115
115
  JSON_KEY_RE.lastIndex = 0;
116
116
  let out = "";
117
117
  let copied = 0;
118
118
  let match;
119
- while ((match = JSON_KEY_RE.exec(text)) !== null) {
119
+ while ((match = JSON_KEY_RE.exec(text2)) !== null) {
120
120
  const valueStart = match.index + match[0].length;
121
121
  JSON_KEY_RE.lastIndex = valueStart;
122
122
  const key = match[1];
123
123
  const isNumericCredentialKey = NUMERIC_CREDENTIAL_KEY_RE.test(key);
124
124
  if (!isCredentialKey(key) && !isNumericCredentialKey) continue;
125
- if (text[valueStart] === '"') {
125
+ if (text2[valueStart] === '"') {
126
126
  const contentStart = valueStart + 1;
127
- const end = valueEnd(text, contentStart, isJsonValueEnd);
128
- const value = text.slice(contentStart, end);
127
+ const end = valueEnd(text2, contentStart, isJsonValueEnd);
128
+ const value = text2.slice(contentStart, end);
129
129
  if (value.length === 0 || FULLY_MASKED_VALUE_RE.test(value)) continue;
130
- out += text.slice(copied, contentStart) + "[REDACTED]";
130
+ out += text2.slice(copied, contentStart) + "[REDACTED]";
131
131
  copied = end;
132
132
  JSON_KEY_RE.lastIndex = end;
133
133
  continue;
134
134
  }
135
- if (text[valueStart] === "{" || text[valueStart] === "[") {
136
- const end = jsonContainerEnd(text, valueStart) ?? text.length;
137
- out += text.slice(copied, valueStart) + '"[REDACTED]"';
135
+ if (text2[valueStart] === "{" || text2[valueStart] === "[") {
136
+ const end = jsonContainerEnd(text2, valueStart) ?? text2.length;
137
+ out += text2.slice(copied, valueStart) + '"[REDACTED]"';
138
138
  copied = end;
139
139
  JSON_KEY_RE.lastIndex = end;
140
140
  continue;
141
141
  }
142
142
  if (isNumericCredentialKey) {
143
- const end = jsonNumberEnd(text, valueStart);
143
+ const end = jsonNumberEnd(text2, valueStart);
144
144
  if (end !== null) {
145
- out += text.slice(copied, valueStart) + '"[REDACTED]"';
145
+ out += text2.slice(copied, valueStart) + '"[REDACTED]"';
146
146
  copied = end;
147
147
  JSON_KEY_RE.lastIndex = end;
148
148
  }
149
149
  }
150
150
  }
151
- return out + text.slice(copied);
151
+ return out + text2.slice(copied);
152
152
  }
153
- function headerValueEnd(text, from) {
154
- for (let i = from; i < text.length; i++) {
155
- const char = text[i];
153
+ function headerValueEnd(text2, from) {
154
+ for (let i = from; i < text2.length; i++) {
155
+ const char = text2[i];
156
156
  if (char === "\r" || char === "\n") return i;
157
157
  if (char === "\\") {
158
158
  let afterSlashes = i;
159
- while (text[afterSlashes] === "\\") afterSlashes++;
159
+ while (text2[afterSlashes] === "\\") afterSlashes++;
160
160
  const slashCount = afterSlashes - i;
161
- if (slashCount % 2 === 1 && (text[afterSlashes] === "r" || text[afterSlashes] === "n")) {
161
+ if (slashCount % 2 === 1 && (text2[afterSlashes] === "r" || text2[afterSlashes] === "n")) {
162
162
  return i;
163
163
  }
164
164
  if (slashCount % 2 === 1) afterSlashes++;
@@ -167,16 +167,16 @@ function headerValueEnd(text, from) {
167
167
  }
168
168
  if (char === '"') {
169
169
  let next = i + 1;
170
- while (next < text.length && /\s/.test(text[next])) next++;
171
- if (next === text.length || text[next] === "," || text[next] === "}" || text[next] === "]") {
170
+ while (next < text2.length && /\s/.test(text2[next])) next++;
171
+ if (next === text2.length || text2[next] === "," || text2[next] === "}" || text2[next] === "]") {
172
172
  return i;
173
173
  }
174
174
  }
175
175
  }
176
- return text.length;
176
+ return text2.length;
177
177
  }
178
- function isSerializedJsonContainer(text) {
179
- const trimmed = text.trim();
178
+ function isSerializedJsonContainer(text2) {
179
+ const trimmed = text2.trim();
180
180
  if (trimmed[0] !== "{" && trimmed[0] !== "[") return false;
181
181
  try {
182
182
  const parsed = JSON.parse(trimmed);
@@ -185,21 +185,21 @@ function isSerializedJsonContainer(text) {
185
185
  return false;
186
186
  }
187
187
  }
188
- function maskNestedJsonStringValues(text, depth) {
188
+ function maskNestedJsonStringValues(text2, depth) {
189
189
  let out = "";
190
190
  let copied = 0;
191
- for (let i = 0; i < text.length; i++) {
192
- if (text[i] !== '"') continue;
191
+ for (let i = 0; i < text2.length; i++) {
192
+ if (text2[i] !== '"') continue;
193
193
  const contentStart = i + 1;
194
- const end = valueEnd(text, contentStart, isJsonValueEnd);
195
- if (end === text.length) break;
194
+ const end = valueEnd(text2, contentStart, isJsonValueEnd);
195
+ if (end === text2.length) break;
196
196
  let next = end + 1;
197
- while (next < text.length && /\s/.test(text[next])) next++;
198
- if (text[next] === ":") {
197
+ while (next < text2.length && /\s/.test(text2[next])) next++;
198
+ if (text2[next] === ":") {
199
199
  i = end;
200
200
  continue;
201
201
  }
202
- const encoded = text.slice(contentStart, end);
202
+ const encoded = text2.slice(contentStart, end);
203
203
  let decoded;
204
204
  try {
205
205
  decoded = JSON.parse(`"${encoded}"`);
@@ -210,15 +210,15 @@ function maskNestedJsonStringValues(text, depth) {
210
210
  const masked = depth >= MAX_NESTED_JSON_STRING_DEPTH && isSerializedJsonContainer(decoded) ? "[REDACTED]" : maskSecretsInMessageAtDepth(decoded, depth + 1);
211
211
  if (masked !== decoded) {
212
212
  const reencoded = JSON.stringify(masked).slice(1, -1);
213
- out += text.slice(copied, contentStart) + reencoded;
213
+ out += text2.slice(copied, contentStart) + reencoded;
214
214
  copied = end;
215
215
  }
216
216
  i = end;
217
217
  }
218
- return out + text.slice(copied);
218
+ return out + text2.slice(copied);
219
219
  }
220
- function maskSecretsInMessageAtDepth(text, depth) {
221
- let out = maskJwts(text);
220
+ function maskSecretsInMessageAtDepth(text2, depth) {
221
+ let out = maskJwts(text2);
222
222
  for (const [pattern, replacement] of SHAPE_PATTERNS) out = out.replace(pattern, replacement);
223
223
  out = out.replace(BASIC_CREDENTIAL_RE, maskBasicCredential);
224
224
  out = maskJsonCredentialValues(out);
@@ -227,8 +227,8 @@ function maskSecretsInMessageAtDepth(text, depth) {
227
227
  out = maskCredentialValues(out, HEADER_KEY_RE, headerValueEnd);
228
228
  return out.replace(BASE64_RE, maskBase64);
229
229
  }
230
- function maskSecretsInMessage(text) {
231
- return maskSecretsInMessageAtDepth(text, 0);
230
+ function maskSecretsInMessage(text2) {
231
+ return maskSecretsInMessageAtDepth(text2, 0);
232
232
  }
233
233
  var CREDENTIAL_KEY_RE, NUMERIC_CREDENTIAL_KEY_RE, FULLY_MASKED_VALUE_RE, isCredentialKey, isBase64UrlChar, SHAPE_PATTERNS, BASIC_CREDENTIAL_RE, maskBasicCredential, JSON_KEY_RE, isJsonValueEnd, QUERY_KEY_RE, isQueryValueEnd, queryValueEnd, HEADER_KEY_RE, BASE64_RE, maskBase64, MAX_NESTED_JSON_STRING_DEPTH;
234
234
  var init_mask_secrets = __esm({
@@ -287,7 +287,7 @@ var init_mask_secrets = __esm({
287
287
  isJsonValueEnd = (char) => char === '"';
288
288
  QUERY_KEY_RE = /(?:^|[?#&;,\s"'])([A-Za-z0-9_.-]+)=/g;
289
289
  isQueryValueEnd = (char) => char === "&" || char === ";" || char === '"' || /\s/.test(char);
290
- queryValueEnd = (text, from) => valueEnd(text, from, isQueryValueEnd);
290
+ queryValueEnd = (text2, from) => valueEnd(text2, from, isQueryValueEnd);
291
291
  HEADER_KEY_RE = /(?:^|[^A-Za-z0-9_.\/\\-])([A-Za-z0-9_.-]+):[ \t]*/g;
292
292
  BASE64_RE = // Padded base64 bodies (wrapped DEKs, HMAC secrets, service-account material)
293
293
  // appearing outside any credential-named key — the shape the rules above miss.
@@ -5396,6 +5396,19 @@ var init_chunk_RACEDHG6 = __esm({
5396
5396
  }
5397
5397
  });
5398
5398
 
5399
+ // ../../packages/core/dist/chunk-K2UY4M4E.js
5400
+ var accessExplainQuery;
5401
+ var init_chunk_K2UY4M4E = __esm({
5402
+ "../../packages/core/dist/chunk-K2UY4M4E.js"() {
5403
+ "use strict";
5404
+ init_chunk_HZ6CADSY();
5405
+ init_zod();
5406
+ accessExplainQuery = external_exports.object({
5407
+ user_id: external_exports.string().regex(USER_ID_REGEX).optional()
5408
+ });
5409
+ }
5410
+ });
5411
+
5399
5412
  // ../../packages/core/dist/chunk-WBFLPPDI.js
5400
5413
  var connectionIdParam, connectorIdParam, listConnectionsQuery, deleteConnectionQuery, addConnectionBody, editConnectionBody, PRODUCTION_DIRECT_FIELDS, BESIDE_LINK_FIELDS, setProductionCredentialBody, registerWhatsappQuery, registerWhatsappBody, retryProvisioningQuery, resendDomainStatusQuery;
5401
5414
  var init_chunk_WBFLPPDI = __esm({
@@ -6441,10 +6454,10 @@ var init_chunk_TUHJ5PQH = __esm({
6441
6454
  }
6442
6455
  });
6443
6456
 
6444
- // ../../packages/core/dist/chunk-3LY5HJUX.js
6445
- var REKOR_ACTOR_TYPE_HEADER, REKOR_ACTOR_ID_HEADER, REKOR_ACTOR_LABEL_HEADER, REKOR_ACTOR_ORG_HEADER, REKOR_ACTOR_ADMIN_HEADER, REKOR_CLIENT_HEADER, REKOR_TOOL_ID_HEADER, REKOR_CLIENTS, rekorClientSchema, MAX_REKOR_TOOL_ID_LENGTH, rekorToolIdSchema, REKOR_V1_PREFIX, DATA_PROXY_ORG_QUERY_PARAM, MAX_PROVISIONING_BODY_BYTES, dataProxyQuery, rekorAttestation, REQUIRED_REKOR_ATTESTATION_HEADERS, REKOR_BOUND_BASE_HEADER, REKOR_BOUND_TOOLSET_HEADER, REKOR_BOUND_TOKEN_HEADER, REKOR_BOUND_CUSTOMER_HEADER, REKOR_BOUND_ACCESS_HEADER, DATA_BASE_GENERATION_HEADER, REKOR_MAX_ACTOR_ID_LENGTH, REKOR_MAX_ACTOR_LABEL_LENGTH, REKOR_MAX_ACCESS_DIMENSIONS, REKOR_MAX_ACCESS_VALUES, REKOR_MAX_ACCESS_ID_LENGTH, REKOR_MAX_ACCESS_HEADER_LENGTH;
6446
- var init_chunk_3LY5HJUX = __esm({
6447
- "../../packages/core/dist/chunk-3LY5HJUX.js"() {
6457
+ // ../../packages/core/dist/chunk-TANTZFI3.js
6458
+ var REKOR_ACTOR_TYPE_HEADER, REKOR_ACTOR_ID_HEADER, REKOR_ACTOR_LABEL_HEADER, REKOR_ACTOR_ORG_HEADER, REKOR_ACTOR_ADMIN_HEADER, REKOR_CLIENT_HEADER, REKOR_TOOL_ID_HEADER, REKOR_CLIENTS, rekorClientSchema, MAX_REKOR_TOOL_ID_LENGTH, rekorToolIdSchema, REKOR_V1_PREFIX, DATA_PROXY_ORG_QUERY_PARAM, MAX_PROVISIONING_BODY_BYTES, dataProxyQuery, rekorAttestation, REQUIRED_REKOR_ATTESTATION_HEADERS, REKOR_BOUND_BASE_HEADER, REKOR_BOUND_TOOLSET_HEADER, REKOR_BOUND_TOKEN_HEADER, REKOR_BOUND_CUSTOMER_HEADER, REKOR_BOUND_ACCESS_HEADER, REKOR_BOUND_ACCESS_SCOPE_HEADER, REKOR_ACCESS_SCOPE_CUSTOMER, DATA_BASE_GENERATION_HEADER, REKOR_MAX_ACTOR_ID_LENGTH, REKOR_MAX_ACTOR_LABEL_LENGTH, REKOR_MAX_ACCESS_DIMENSIONS, REKOR_MAX_ACCESS_VALUES, REKOR_MAX_ACCESS_ID_LENGTH, REKOR_MAX_ACCESS_HEADER_LENGTH;
6459
+ var init_chunk_TANTZFI3 = __esm({
6460
+ "../../packages/core/dist/chunk-TANTZFI3.js"() {
6448
6461
  "use strict";
6449
6462
  init_zod();
6450
6463
  REKOR_ACTOR_TYPE_HEADER = "X-Rekor-Actor-Type";
@@ -6479,6 +6492,8 @@ var init_chunk_3LY5HJUX = __esm({
6479
6492
  REKOR_BOUND_TOKEN_HEADER = "X-Rekor-Bound-Token";
6480
6493
  REKOR_BOUND_CUSTOMER_HEADER = "X-Rekor-Bound-Customer";
6481
6494
  REKOR_BOUND_ACCESS_HEADER = "X-Rekor-Bound-Access";
6495
+ REKOR_BOUND_ACCESS_SCOPE_HEADER = "X-Rekor-Bound-Access-Scope";
6496
+ REKOR_ACCESS_SCOPE_CUSTOMER = "customer";
6482
6497
  DATA_BASE_GENERATION_HEADER = "X-Data-Base-Generation";
6483
6498
  REKOR_MAX_ACTOR_ID_LENGTH = 256;
6484
6499
  REKOR_MAX_ACTOR_LABEL_LENGTH = 256;
@@ -6489,7 +6504,7 @@ var init_chunk_3LY5HJUX = __esm({
6489
6504
  }
6490
6505
  });
6491
6506
 
6492
- // ../../packages/core/dist/chunk-BCDGY3GH.js
6507
+ // ../../packages/core/dist/chunk-OEDDM5YN.js
6493
6508
  function writeWithinRead(assignment) {
6494
6509
  return Object.values(assignment).every(({ read, write }) => read.includes(ACCESS_UNRESTRICTED) || !write.includes(ACCESS_UNRESTRICTED) && write.every((id) => read.includes(id)));
6495
6510
  }
@@ -6505,11 +6520,11 @@ function isEncodedAccessSet(raw) {
6505
6520
  function assignmentHasUnrestricted(assignment) {
6506
6521
  return Object.values(assignment).some((lists) => lists.read.includes(ACCESS_UNRESTRICTED) || lists.write.includes(ACCESS_UNRESTRICTED));
6507
6522
  }
6508
- var ACCESS_UNRESTRICTED, ACCESS_ID_REGEX, ACCESS_ID_MAX_LENGTH, MAX_ACCESS_DIMENSIONS_PER_ORG, MAX_ACCESS_VALUES_PER_DIMENSION, ACCESS_LABEL_MAX_LENGTH, accessIdSchema, accessLabelSchema, accessValueListSchema, accessAssignmentSchema, accessSetSchema, accessDimensionParam, accessValueParam, orgMemberParam, orgHubParam, createAccessDimensionBody, updateAccessDimensionBody, createAccessValueBody, updateAccessValueBody, setMemberAccessValuesBody, setHubUserAccessValuesBody, setAgentAccessValuesBody;
6509
- var init_chunk_BCDGY3GH = __esm({
6510
- "../../packages/core/dist/chunk-BCDGY3GH.js"() {
6523
+ var ACCESS_UNRESTRICTED, ACCESS_ID_REGEX, ACCESS_ID_MAX_LENGTH, MAX_ACCESS_DIMENSIONS_PER_ORG, MAX_ACCESS_VALUES_PER_DIMENSION, ACCESS_LABEL_MAX_LENGTH, accessIdSchema, accessLabelSchema, accessValueListSchema, accessAssignmentSchema, accessSetSchema, accessDimensionParam, accessValueParam, orgMemberParam, orgHubParam, createAccessDimensionBody, updateAccessDimensionBody, createAccessValueBody, updateAccessValueBody, setMemberAccessValuesBody, HUB_PERSON_KINDS, ACCESS_PERSON_KINDS, setHubUserAccessValuesBody, setAgentAccessValuesBody;
6524
+ var init_chunk_OEDDM5YN = __esm({
6525
+ "../../packages/core/dist/chunk-OEDDM5YN.js"() {
6511
6526
  "use strict";
6512
- init_chunk_3LY5HJUX();
6527
+ init_chunk_TANTZFI3();
6513
6528
  init_chunk_HZ6CADSY();
6514
6529
  init_zod();
6515
6530
  ACCESS_UNRESTRICTED = "*";
@@ -6520,7 +6535,7 @@ var init_chunk_BCDGY3GH = __esm({
6520
6535
  ACCESS_LABEL_MAX_LENGTH = 100;
6521
6536
  accessIdSchema = external_exports.string().min(1).max(ACCESS_ID_MAX_LENGTH).regex(ACCESS_ID_REGEX, { message: 'Must be ASCII letters, digits, "_" or "-", starting with a letter or digit (e.g. "class", "7A")' });
6522
6537
  accessLabelSchema = external_exports.string().trim().min(1).max(ACCESS_LABEL_MAX_LENGTH);
6523
- accessValueListSchema = external_exports.array(external_exports.union([accessIdSchema, external_exports.literal(ACCESS_UNRESTRICTED)])).max(MAX_ACCESS_VALUES_PER_DIMENSION).refine((list) => !list.includes(ACCESS_UNRESTRICTED) || list.length === 1, {
6538
+ accessValueListSchema = external_exports.array(external_exports.union([accessIdSchema, external_exports.literal(ACCESS_UNRESTRICTED)])).max(MAX_ACCESS_VALUES_PER_DIMENSION).refine((list2) => !list2.includes(ACCESS_UNRESTRICTED) || list2.length === 1, {
6524
6539
  message: `"${ACCESS_UNRESTRICTED}" reaches the dimension unrestricted, so it stands alone in its list`
6525
6540
  });
6526
6541
  accessAssignmentSchema = external_exports.record(
@@ -6567,6 +6582,8 @@ var init_chunk_BCDGY3GH = __esm({
6567
6582
  setMemberAccessValuesBody = external_exports.object({
6568
6583
  values: accessAssignmentSchema
6569
6584
  });
6585
+ HUB_PERSON_KINDS = ["hub_admin", "hub_team_member", "hub_user"];
6586
+ ACCESS_PERSON_KINDS = ["org_member", ...HUB_PERSON_KINDS, "public"];
6570
6587
  setHubUserAccessValuesBody = external_exports.object({
6571
6588
  values: accessAssignmentSchema.refine((assignment) => !assignmentHasUnrestricted(assignment), {
6572
6589
  message: `A hub user's values never hold "${ACCESS_UNRESTRICTED}"`
@@ -6578,13 +6595,13 @@ var init_chunk_BCDGY3GH = __esm({
6578
6595
  }
6579
6596
  });
6580
6597
 
6581
- // ../../packages/core/dist/chunk-QZTGWNFB.js
6598
+ // ../../packages/core/dist/chunk-7DA4MW5T.js
6582
6599
  var TOOLSET_SLUG_PATTERN, REKOR_STRUCTURAL_ID_PATTERN, baseEnvironmentSchema, toolsetFileToolSchema, toolsetSurfaceSchema, toolsetConnectionBindingSchema, rekorToolsetToolsSchema, rekorBoundAttestation, rekorResolvedToolsetSchema, resolvedRecordTypeSchema, reviewWritersSchema, sharedScopeSchema, resolvedFileToolSchema, rekorToolsetFileSchema, rekorToolsetFileUrlAnswerSchema, rekorToolsetFileListSchema, rekorToolsetFileGetSchema, rekorToolsetFilePutSchema, TOOLSET_CUSTOMER_FACING_REFUSAL_MARK, TOOLSET_CUSTOMER_FACING_REFUSAL;
6583
- var init_chunk_QZTGWNFB = __esm({
6584
- "../../packages/core/dist/chunk-QZTGWNFB.js"() {
6600
+ var init_chunk_7DA4MW5T = __esm({
6601
+ "../../packages/core/dist/chunk-7DA4MW5T.js"() {
6585
6602
  "use strict";
6586
- init_chunk_BCDGY3GH();
6587
- init_chunk_3LY5HJUX();
6603
+ init_chunk_OEDDM5YN();
6604
+ init_chunk_TANTZFI3();
6588
6605
  init_chunk_WNLWNFHH();
6589
6606
  init_zod();
6590
6607
  TOOLSET_SLUG_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;
@@ -6707,7 +6724,16 @@ var init_chunk_QZTGWNFB = __esm({
6707
6724
  */
6708
6725
  [REKOR_BOUND_ACCESS_HEADER]: external_exports.string().max(REKOR_MAX_ACCESS_HEADER_LENGTH).refine(isEncodedAccessSet, {
6709
6726
  message: "Not an access set"
6710
- }).optional()
6727
+ }).optional(),
6728
+ /**
6729
+ * Where the access set applies (#5358), when only on the call's customer's own records: its one value.
6730
+ * Sent only beside the set, which the far side holds it to (the refinement below).
6731
+ */
6732
+ [REKOR_BOUND_ACCESS_SCOPE_HEADER]: external_exports.literal(REKOR_ACCESS_SCOPE_CUSTOMER).optional()
6733
+ }).superRefine((bag, ctx) => {
6734
+ if (bag[REKOR_BOUND_ACCESS_SCOPE_HEADER] !== void 0 && bag[REKOR_BOUND_ACCESS_HEADER] === void 0) {
6735
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: [REKOR_BOUND_ACCESS_SCOPE_HEADER], message: "Accepted only beside an access set" });
6736
+ }
6711
6737
  });
6712
6738
  rekorResolvedToolsetSchema = external_exports.object({
6713
6739
  data: external_exports.object({
@@ -10884,9 +10910,9 @@ function validateSchema(schema, path42, errors, opts = {}) {
10884
10910
  }
10885
10911
  }
10886
10912
  for (const key of SUBSCHEMA_LIST_KEYWORDS) {
10887
- const list = schema[key];
10888
- if (Array.isArray(list)) {
10889
- list.forEach((sub, i) => validateSchema(sub, `${path42}.${key}[${i}]`, errors, { depth: depth + 1 }));
10913
+ const list2 = schema[key];
10914
+ if (Array.isArray(list2)) {
10915
+ list2.forEach((sub, i) => validateSchema(sub, `${path42}.${key}[${i}]`, errors, { depth: depth + 1 }));
10890
10916
  }
10891
10917
  }
10892
10918
  for (const key of SUBSCHEMA_MAP_KEYWORDS) {
@@ -11652,56 +11678,6 @@ var init_chunk_LBDH7LCG = __esm({
11652
11678
  }
11653
11679
  });
11654
11680
 
11655
- // ../../packages/core/dist/chunk-3VHMUK4W.js
11656
- var primaryRegionSchema, placementSourceSchema, orgIdParam, orgAdminIdParam, createOrganizationBody, updateOrganizationBody, addOrgAdminBody;
11657
- var init_chunk_3VHMUK4W = __esm({
11658
- "../../packages/core/dist/chunk-3VHMUK4W.js"() {
11659
- "use strict";
11660
- init_chunk_HZ6CADSY();
11661
- init_zod();
11662
- primaryRegionSchema = external_exports.enum([
11663
- "wnam",
11664
- "enam",
11665
- "sam",
11666
- "weur",
11667
- "eeur",
11668
- "apac",
11669
- "oc",
11670
- "afr",
11671
- "me"
11672
- ]);
11673
- placementSourceSchema = external_exports.enum([
11674
- "hub_config",
11675
- "org_config",
11676
- "parent_cascade",
11677
- "cf_colo",
11678
- "country",
11679
- "fallback"
11680
- ]);
11681
- orgIdParam = external_exports.object({
11682
- id: uuidSchema
11683
- });
11684
- orgAdminIdParam = external_exports.object({
11685
- id: uuidSchema,
11686
- adminId: external_exports.string().min(1)
11687
- });
11688
- createOrganizationBody = external_exports.object({
11689
- organization_name: external_exports.string().min(1, "organization_name is required"),
11690
- // Write-once at creation; updateOrganizationBody does not accept this.
11691
- primary_region: primaryRegionSchema.optional()
11692
- });
11693
- updateOrganizationBody = external_exports.object({
11694
- organization_name: external_exports.string().min(1).optional(),
11695
- organization_avatar_url: external_exports.string().url().nullable().optional(),
11696
- timezone: external_exports.string().optional(),
11697
- business_hours: external_exports.unknown().optional()
11698
- }).passthrough();
11699
- addOrgAdminBody = external_exports.object({
11700
- user_email: external_exports.string().email("valid email is required")
11701
- });
11702
- }
11703
- });
11704
-
11705
11681
  // ../../packages/core/dist/chunk-AMG6HKUQ.js
11706
11682
  function isEventRelativeFollowupType(type) {
11707
11683
  return typeof type === "string" && EVENT_RELATIVE_FOLLOWUP_TYPES.includes(type);
@@ -12096,6 +12072,56 @@ var init_chunk_AMG6HKUQ = __esm({
12096
12072
  }
12097
12073
  });
12098
12074
 
12075
+ // ../../packages/core/dist/chunk-3VHMUK4W.js
12076
+ var primaryRegionSchema, placementSourceSchema, orgIdParam, orgAdminIdParam, createOrganizationBody, updateOrganizationBody, addOrgAdminBody;
12077
+ var init_chunk_3VHMUK4W = __esm({
12078
+ "../../packages/core/dist/chunk-3VHMUK4W.js"() {
12079
+ "use strict";
12080
+ init_chunk_HZ6CADSY();
12081
+ init_zod();
12082
+ primaryRegionSchema = external_exports.enum([
12083
+ "wnam",
12084
+ "enam",
12085
+ "sam",
12086
+ "weur",
12087
+ "eeur",
12088
+ "apac",
12089
+ "oc",
12090
+ "afr",
12091
+ "me"
12092
+ ]);
12093
+ placementSourceSchema = external_exports.enum([
12094
+ "hub_config",
12095
+ "org_config",
12096
+ "parent_cascade",
12097
+ "cf_colo",
12098
+ "country",
12099
+ "fallback"
12100
+ ]);
12101
+ orgIdParam = external_exports.object({
12102
+ id: uuidSchema
12103
+ });
12104
+ orgAdminIdParam = external_exports.object({
12105
+ id: uuidSchema,
12106
+ adminId: external_exports.string().min(1)
12107
+ });
12108
+ createOrganizationBody = external_exports.object({
12109
+ organization_name: external_exports.string().min(1, "organization_name is required"),
12110
+ // Write-once at creation; updateOrganizationBody does not accept this.
12111
+ primary_region: primaryRegionSchema.optional()
12112
+ });
12113
+ updateOrganizationBody = external_exports.object({
12114
+ organization_name: external_exports.string().min(1).optional(),
12115
+ organization_avatar_url: external_exports.string().url().nullable().optional(),
12116
+ timezone: external_exports.string().optional(),
12117
+ business_hours: external_exports.unknown().optional()
12118
+ }).passthrough();
12119
+ addOrgAdminBody = external_exports.object({
12120
+ user_email: external_exports.string().email("valid email is required")
12121
+ });
12122
+ }
12123
+ });
12124
+
12099
12125
  // ../../packages/core/dist/chunk-XQBFXSYS.js
12100
12126
  function byLocale(entry) {
12101
12127
  const shape = Object.fromEntries(SUPPORTED_LOCALES.map((locale) => [locale, entry.optional()]));
@@ -12134,7 +12160,7 @@ var init_chunk_XQBFXSYS = __esm({
12134
12160
  }
12135
12161
  });
12136
12162
 
12137
- // ../../packages/core/dist/chunk-USFRRP7E.js
12163
+ // ../../packages/core/dist/chunk-C4EMATJL.js
12138
12164
  function refineLaneReferences(val, ctx) {
12139
12165
  const lanes = val.lanes;
12140
12166
  const statuses = val.kanban_statuses;
@@ -12158,11 +12184,11 @@ function describeSyncWarning(warning) {
12158
12184
  return `${label}: ${parts.join("; ")}. Promote the base so production's tools match the preview's.`;
12159
12185
  }
12160
12186
  var hubIdParam, hubAdminIdParam, hubUserIdParam, hubAgentIdParam, hubIdentityIdParam, hubTeamIdParam, hubTeamUserDeleteParam, hubSchemaQuery, HUB_USERS_PAGE_SIZE_MAX, HUB_USERS_SEARCH_MAX, HUB_USERS_CHANNEL_TYPES, getHubUsersQuery, PREVIEW_LABEL_MAX_LENGTH, MAX_ENDED_INDEX_RETENTION_DAYS, MAX_EVAL_RETENTION_DAYS, MAX_END_USER_DAILY_MESSAGE_LIMIT, endUserDailyMessageLimitField, previewLabelField, hubTagsField, createHubBody, updateHubBody, HUB_TAG_CHANGE_REFUSED, hubTagChangeRefusalSchema, addHubAdminBody, addHubIdentityAuthorizationBody, contactDecisionBody, approveContactBody, CONTACT_ACCESS_PAGE_SIZE_MAX, listContactAccessQuery, createHubTeamBody, updateHubTeamBody, addHubTeamUserBody, reassignHubUserBody, replicatePreviewBody, HUB_DIFF_SECTION_SET, HUB_DIFF_SECTIONS, updateChannelTestIdentitiesBody, claimCodeChannelParam, claimCodeDeleteParam;
12161
- var init_chunk_USFRRP7E = __esm({
12162
- "../../packages/core/dist/chunk-USFRRP7E.js"() {
12187
+ var init_chunk_C4EMATJL = __esm({
12188
+ "../../packages/core/dist/chunk-C4EMATJL.js"() {
12163
12189
  "use strict";
12164
- init_chunk_3VHMUK4W();
12165
12190
  init_chunk_AMG6HKUQ();
12191
+ init_chunk_3VHMUK4W();
12166
12192
  init_chunk_XQBFXSYS();
12167
12193
  init_chunk_HZ6CADSY();
12168
12194
  init_zod();
@@ -12357,7 +12383,7 @@ var init_chunk_USFRRP7E = __esm({
12357
12383
  }
12358
12384
  });
12359
12385
 
12360
- // ../../packages/core/dist/chunk-BGUEWUAI.js
12386
+ // ../../packages/core/dist/chunk-7NGYX3UI.js
12361
12387
  function refineHubAsCodeCustomTools(config, ctx) {
12362
12388
  const agents = config.agents;
12363
12389
  if (!Array.isArray(agents)) return;
@@ -12775,9 +12801,9 @@ function refineHubAsCodeDelegation(config, ctx) {
12775
12801
  function refineHubAsCodeFlagConditions(config, ctx) {
12776
12802
  const agents = config?.agents;
12777
12803
  if (!Array.isArray(agents)) return;
12778
- const checkList = (list, basePath) => {
12779
- if (!Array.isArray(list)) return;
12780
- list.forEach((row, rowIndex) => {
12804
+ const checkList = (list2, basePath) => {
12805
+ if (!Array.isArray(list2)) return;
12806
+ list2.forEach((row, rowIndex) => {
12781
12807
  const operator = row?.operator;
12782
12808
  if (!FLAG_CONDITION_OPERATORS.includes(operator)) {
12783
12809
  ctx.addIssue({
@@ -12957,16 +12983,16 @@ function skillSectionsAsResources(scope) {
12957
12983
  };
12958
12984
  }
12959
12985
  var MAX_10MB_BASE64_ENCODED_BYTES, MAX_EVAL_ATTACHMENT_ENCODED_BYTES, MAX_EVAL_ATTACHMENT_CARRIERS, MAX_EVAL_ATTACHMENT_AGGREGATE_ENCODED_BYTES, MAX_RESOURCE_ENCODED_BYTES, MAX_HUB_AS_CODE_RESOURCES, MAX_HUB_AS_CODE_RESOURCE_FILES, MAX_RESOURCE_AGGREGATE_ENCODED_BYTES, MAX_CI_CONFIG_BODY_BYTES, MAX_CALL_OPENING_CARRIERS, MAX_CALL_OPENING_AGGREGATE_ENCODED_BYTES, hubAsCodeStateSchema, hubAsCodeResourceFileSchema, hubAsCodeResourceSchema, uuidPattern, ciUuidSchema, boundedHubAsCodeResourcesSchema, isPlainObject, MIN_SKILLS_LAYOUT_CLI, hubAsCodeConfigSchema, ciPullHubIdParam, ciBranchParam, ciPullQuery, ciHubsQuery, ciLookupQuery, ciBranchesQuery, ciSyncBody, ciPushBody, ciDiffBody, ciPublishBody, ciPublishPreviewBody, ciSyncMcpBody, ciOrgResourcesParam, orgResourcesConfigSchema, ciOrgResourcesPushBody, ciOrgResourcesDiffBody, CI_APPLY_ENTITY_KINDS, CI_APPLY_OPERATIONS, ciApplyErrorBaseSchema, ciApplyErrorSchema, ciSyncCountSchema, ciSyncChangesSchema, ciSyncWarningSchema, ciSyncResponseSchema;
12960
- var init_chunk_BGUEWUAI = __esm({
12961
- "../../packages/core/dist/chunk-BGUEWUAI.js"() {
12986
+ var init_chunk_7NGYX3UI = __esm({
12987
+ "../../packages/core/dist/chunk-7NGYX3UI.js"() {
12962
12988
  "use strict";
12963
12989
  init_chunk_HCE5YOBD();
12964
- init_chunk_BCDGY3GH();
12990
+ init_chunk_OEDDM5YN();
12965
12991
  init_chunk_VQIITUAJ();
12966
12992
  init_chunk_VU7E2RFY();
12967
12993
  init_chunk_LBDH7LCG();
12968
12994
  init_chunk_4LXDRTO4();
12969
- init_chunk_USFRRP7E();
12995
+ init_chunk_C4EMATJL();
12970
12996
  init_chunk_AMG6HKUQ();
12971
12997
  init_chunk_XQBFXSYS();
12972
12998
  init_chunk_WEXVYJ5H();
@@ -14505,7 +14531,7 @@ var init_chunk_OMPT4ZHR = __esm({
14505
14531
  }
14506
14532
  });
14507
14533
 
14508
- // ../../packages/core/dist/chunk-6KBLVPN6.js
14534
+ // ../../packages/core/dist/chunk-AIHVFCWQ.js
14509
14535
  function refineScopedTarget(data, ctx) {
14510
14536
  if (data.scope === "org") {
14511
14537
  if (!data.org_id) {
@@ -14531,13 +14557,13 @@ function refineScopedTarget(data, ctx) {
14531
14557
  }
14532
14558
  }
14533
14559
  var adminOrgIdParam, adminOrgAdminIdParam, adminUserIdParam, PRICING_PLAN_ID_RE, adminPlanIdParam, adminOrganizationsQuery, adminUserSearchQuery, kanbanSlugMigrationQuery, adjustQuotaBody, updatePlanBody, addAdminUserBody, MAX_VOICE_CALL_MINUTE_OPS, voiceCallMinuteOps, AUTOMATION_GATE_EVALUATIONS_PER_OPERATION_BOUND, automationGateEvaluationsPerOperation, AUTOMATION_RUN_RETENTION_DAYS_MAX, automationRunRetentionDays, turnDeadlineSeconds, updatePlatformConfigBody, updateFreeOrgLimitBody, adminScopedTargetShape, adminScopedTargetBody, adminRepairKnowledgeBlobsBody, BRANCHING_ORPHAN_ENTITY_TYPES, BRANCHING_ORPHAN_MAX_TARGETS, adminRepairBranchingOrphansBody, adminRepairLegacyOrgGrantsBody, adminRepairCompedPlansBody, updatePricingPlanBody, dataExplorerSearchQuery, dataExplorerOrgIdParam, dataExplorerHubIdParam, dataExplorerConvIdParam, dataExplorerDoInstancesQuery, dataExplorerNsIdParam, dataExplorerKvKeysBody, dataExplorerKvKeyBody, uuidOrHexId, dataExplorerDeleteOrgParam, dataExplorerDeleteHubParam, dataExplorerDeleteConvParam, dataExplorerDeleteUserParam, dataExplorerDeleteQuery, dataExplorerKvDeleteBody, pitrDoNamespace, pitrBookmarkParam, pitrRestoreBody, healthSamplingTriggerBody, DEBUG_DO_HEX_PREFIX, debugDoEntityId, debugTableName, dataExplorerDebugTablesParam, dataExplorerDebugRowsParam, dataExplorerDebugRowsQuery, dataExplorerDebugAnalyticsTable, debugUuid, dataExplorerDebugAnalyticsRowsParam, dataExplorerDebugAnalyticsRowsQuery, dataExplorerDebugCountsDoType, dataExplorerDebugCountsParam, debugHubConvParam, debugMessageIdQuery;
14534
- var init_chunk_6KBLVPN6 = __esm({
14535
- "../../packages/core/dist/chunk-6KBLVPN6.js"() {
14560
+ var init_chunk_AIHVFCWQ = __esm({
14561
+ "../../packages/core/dist/chunk-AIHVFCWQ.js"() {
14536
14562
  "use strict";
14537
14563
  init_chunk_FECLIZTY();
14538
14564
  init_chunk_BFG4ZWR4();
14539
14565
  init_chunk_YZAIZJTO();
14540
- init_chunk_USFRRP7E();
14566
+ init_chunk_C4EMATJL();
14541
14567
  init_chunk_OMPT4ZHR();
14542
14568
  init_chunk_HZ6CADSY();
14543
14569
  init_chunk_MIWZOSPI();
@@ -15237,6 +15263,7 @@ var init_contracts = __esm({
15237
15263
  init_chunk_YVY2TZK2();
15238
15264
  init_chunk_VXEAR36B();
15239
15265
  init_chunk_RACEDHG6();
15266
+ init_chunk_K2UY4M4E();
15240
15267
  init_chunk_WBFLPPDI();
15241
15268
  init_chunk_IPXBFWUU();
15242
15269
  init_chunk_GPM7PE44();
@@ -15247,7 +15274,7 @@ var init_contracts = __esm({
15247
15274
  init_chunk_Y7CFCYX4();
15248
15275
  init_chunk_5DGHIY7L();
15249
15276
  init_chunk_TUHJ5PQH();
15250
- init_chunk_QZTGWNFB();
15277
+ init_chunk_7DA4MW5T();
15251
15278
  init_chunk_IPDOHAZ5();
15252
15279
  init_chunk_YUZFHVB2();
15253
15280
  init_chunk_I3O2RACG();
@@ -15265,10 +15292,10 @@ var init_contracts = __esm({
15265
15292
  init_chunk_KSTYTQ7I();
15266
15293
  init_chunk_LKBSHANA();
15267
15294
  init_chunk_BPCNB5RT();
15268
- init_chunk_BGUEWUAI();
15295
+ init_chunk_7NGYX3UI();
15269
15296
  init_chunk_HCE5YOBD();
15270
- init_chunk_BCDGY3GH();
15271
- init_chunk_3LY5HJUX();
15297
+ init_chunk_OEDDM5YN();
15298
+ init_chunk_TANTZFI3();
15272
15299
  init_chunk_VQIITUAJ();
15273
15300
  init_chunk_JDJ4EUOL();
15274
15301
  init_chunk_ZLJP22IA();
@@ -15293,13 +15320,13 @@ var init_contracts = __esm({
15293
15320
  init_chunk_5HA6FIE7();
15294
15321
  init_chunk_SAQNCSQ6();
15295
15322
  init_chunk_NVKU5PPQ();
15296
- init_chunk_6KBLVPN6();
15323
+ init_chunk_AIHVFCWQ();
15297
15324
  init_chunk_FECLIZTY();
15298
15325
  init_chunk_BFG4ZWR4();
15299
15326
  init_chunk_YZAIZJTO();
15300
- init_chunk_USFRRP7E();
15301
- init_chunk_3VHMUK4W();
15327
+ init_chunk_C4EMATJL();
15302
15328
  init_chunk_AMG6HKUQ();
15329
+ init_chunk_3VHMUK4W();
15303
15330
  init_chunk_XQBFXSYS();
15304
15331
  init_chunk_OMPT4ZHR();
15305
15332
  init_chunk_2PZIF56U();
@@ -15437,8 +15464,8 @@ async function uuidV5(namespace, name) {
15437
15464
  const out = digest.slice(0, 16);
15438
15465
  return bytesToUuid(setUuidVersion(out, 5));
15439
15466
  }
15440
- function markdownToPlainText(text) {
15441
- let result = text;
15467
+ function markdownToPlainText(text2) {
15468
+ let result = text2;
15442
15469
  result = result.replace(/```[\w]*\n?([\s\S]*?)```/g, "$1");
15443
15470
  result = result.replace(/`([^`]+)`/g, "$1");
15444
15471
  result = result.replace(/\*\*\*(.+?)\*\*\*/g, "$1");
@@ -16548,6 +16575,7 @@ var init_utils = __esm({
16548
16575
  "communities",
16549
16576
  "contacts",
16550
16577
  "dimensions",
16578
+ "access",
16551
16579
  "knowledge"
16552
16580
  ]);
16553
16581
  HELP_AND_VERSION = ["help", "--help", "-h", "--version", "-v"];
@@ -16557,6 +16585,7 @@ var init_utils = __esm({
16557
16585
  ["communities", "all"],
16558
16586
  ["contacts", "all"],
16559
16587
  ["dimensions", "all"],
16588
+ ["access", "all"],
16560
16589
  ["knowledge", "all"],
16561
16590
  ["use", "selectors"],
16562
16591
  ["unbind", "selectors"],
@@ -17250,6 +17279,18 @@ var init_api_client = __esm({
17250
17279
  const qs = new URLSearchParams({ organization_id: orgId, base_id: baseId2 });
17251
17280
  return this.request("DELETE", `/api/contact-book/contacts/${encodeURIComponent(contactId)}/customer?${qs}`);
17252
17281
  }
17282
+ /**
17283
+ * The access set every hub toolset call of an agent sends for a person, or for none (the hub's ∩ the
17284
+ * agent's), and the layer that removed each value (#5358 PR 15). Another person's takes an org-admin
17285
+ * grant on the hub's org.
17286
+ */
17287
+ async explainAccess(hubId, agentId, userId) {
17288
+ const qs = userId === void 0 ? "" : `?${new URLSearchParams({ user_id: userId })}`;
17289
+ return this.request(
17290
+ "GET",
17291
+ `/api/setup/hubs/${encodeURIComponent(hubId)}/agents/${encodeURIComponent(agentId)}/access-explain${qs}`
17292
+ );
17293
+ }
17253
17294
  /** An organization's access dimensions, each with every value, retired ones included (#5358). */
17254
17295
  async listAccessDimensions(orgId) {
17255
17296
  return this.request("GET", accessDimensions(orgId));
@@ -21957,16 +21998,16 @@ function pathSegments(value, label = "path") {
21957
21998
  function parseData(data, flag) {
21958
21999
  const prefix = flag ? `${flag}: ` : "";
21959
22000
  const source = data.startsWith("@") ? data.slice(1) : void 0;
21960
- let text = data;
22001
+ let text2 = data;
21961
22002
  if (source !== void 0) {
21962
22003
  try {
21963
- text = readFileSync14(source, "utf-8");
22004
+ text2 = readFileSync14(source, "utf-8");
21964
22005
  } catch (e) {
21965
22006
  throw expected(`${prefix}${source}: ${e instanceof Error ? e.message : "could not be read"}`);
21966
22007
  }
21967
22008
  }
21968
22009
  try {
21969
- return JSON.parse(text);
22010
+ return JSON.parse(text2);
21970
22011
  } catch (e) {
21971
22012
  const where = source !== void 0 ? ` in ${source}` : "";
21972
22013
  throw expected(`${prefix}invalid JSON${where}: ${e instanceof Error ? e.message : String(e)}`);
@@ -22964,8 +23005,8 @@ var init_pacer = __esm({
22964
23005
 
22965
23006
  // src/communities/model.ts
22966
23007
  import { createHash as createHash3 } from "crypto";
22967
- function toLf(text) {
22968
- return text.replace(/\r\n?/g, "\n");
23008
+ function toLf(text2) {
23009
+ return text2.replace(/\r\n?/g, "\n");
22969
23010
  }
22970
23011
  function normalizeRules(rules) {
22971
23012
  if (rules === null || rules === void 0) return null;
@@ -23140,8 +23181,8 @@ function readCourseSynced(raw, where, problems2) {
23140
23181
  else {
23141
23182
  for (const [moduleId, ids] of Object.entries(raw.lessons)) {
23142
23183
  if (!UUID_RE3.test(moduleId)) problems2.push(`${where}: synced.lessons: ${JSON.stringify(moduleId)} is not a module id`);
23143
- const list = readIdList(ids, `${where} synced.lessons.${moduleId}`, problems2);
23144
- if (list) lessons[moduleId] = list;
23184
+ const list2 = readIdList(ids, `${where} synced.lessons.${moduleId}`, problems2);
23185
+ if (list2) lessons[moduleId] = list2;
23145
23186
  }
23146
23187
  }
23147
23188
  }
@@ -23185,14 +23226,14 @@ function readCourseFolders(communityFolder, slugs, problems2) {
23185
23226
  }
23186
23227
  function readCourseFolder(communityFolder, folder, slug, problems2) {
23187
23228
  const where = `${COURSES_DIR}/${slug}/${COURSE_FILE}`;
23188
- const text = readRealFileOrThrow(communityFolder, path24.join(folder, COURSE_FILE));
23189
- if (text === null) {
23229
+ const text2 = readRealFileOrThrow(communityFolder, path24.join(folder, COURSE_FILE));
23230
+ if (text2 === null) {
23190
23231
  problems2.push(`${COURSES_DIR}/${slug}/: no ${COURSE_FILE}`);
23191
23232
  return null;
23192
23233
  }
23193
23234
  let doc;
23194
23235
  try {
23195
- doc = yaml12.load(text);
23236
+ doc = yaml12.load(text2);
23196
23237
  } catch (err) {
23197
23238
  problems2.push(`${where} is not valid YAML: ${err instanceof Error ? err.message : String(err)}`);
23198
23239
  return null;
@@ -23275,12 +23316,12 @@ function readModules(communityFolder, lessonsDir, raw, courseSlug, courseWhere,
23275
23316
  });
23276
23317
  return modules;
23277
23318
  }
23278
- function splitFrontmatter(text) {
23279
- if (!text.startsWith("---\n")) return null;
23280
- const close2 = text.indexOf("\n---\n", 3);
23281
- if (close2 === -1) return text.endsWith("\n---") ? { front: text.slice(4, -3), body: "" } : null;
23282
- const rest = text.slice(close2 + 5);
23283
- return { front: text.slice(4, close2 + 1), body: rest.endsWith("\n") ? rest.slice(0, -1) : rest };
23319
+ function splitFrontmatter(text2) {
23320
+ if (!text2.startsWith("---\n")) return null;
23321
+ const close2 = text2.indexOf("\n---\n", 3);
23322
+ if (close2 === -1) return text2.endsWith("\n---") ? { front: text2.slice(4, -3), body: "" } : null;
23323
+ const rest = text2.slice(close2 + 5);
23324
+ return { front: text2.slice(4, close2 + 1), body: rest.endsWith("\n") ? rest.slice(0, -1) : rest };
23284
23325
  }
23285
23326
  function readLessonFile(communityFolder, lessonsDir, courseSlug, slug, problems2) {
23286
23327
  const name = `${slug}${LESSON_FILE_EXT}`;
@@ -23447,14 +23488,14 @@ import * as yaml13 from "js-yaml";
23447
23488
  function readCommunityFolder(folder) {
23448
23489
  const where = path25.basename(folder);
23449
23490
  const yamlPath = path25.join(folder, COMMUNITY_FILE);
23450
- const text = readRealFileOrThrow(folder, yamlPath);
23451
- if (text === null) {
23491
+ const text2 = readRealFileOrThrow(folder, yamlPath);
23492
+ if (text2 === null) {
23452
23493
  throw expected(`No ${COMMUNITY_FILE} in ${where}/: pull the community first (wayai pull communities/<community_id>).`);
23453
23494
  }
23454
23495
  const rules = toLf(readRealFileOrThrow(folder, path25.join(folder, RULES_FILE)) ?? "");
23455
23496
  let doc;
23456
23497
  try {
23457
- doc = yaml13.load(text);
23498
+ doc = yaml13.load(text2);
23458
23499
  } catch (err) {
23459
23500
  throw expected(`${where}/${COMMUNITY_FILE} is not valid YAML: ${err instanceof Error ? err.message : String(err)}`);
23460
23501
  }
@@ -23625,8 +23666,8 @@ function renderCommunityYaml(files) {
23625
23666
  return yaml13.dump(doc, YAML_DUMP_OPTIONS);
23626
23667
  }
23627
23668
  function renderRules(rules) {
23628
- const text = toLf(rules).replace(/\n+$/, "");
23629
- return text === "" ? "" : `${text}
23669
+ const text2 = toLf(rules).replace(/\n+$/, "");
23670
+ return text2 === "" ? "" : `${text2}
23630
23671
  `;
23631
23672
  }
23632
23673
  function renderCommunityFiles(files) {
@@ -23718,7 +23759,7 @@ var init_listing = __esm({
23718
23759
  "src/communities/listing.ts"() {
23719
23760
  "use strict";
23720
23761
  init_terminal_output();
23721
- show = (text) => JSON.stringify(sanitizeTerminalText(text));
23762
+ show = (text2) => JSON.stringify(sanitizeTerminalText(text2));
23722
23763
  emptyListing = () => ({ changes: [], serverChanged: [], conflicts: [], leftAsIs: [], kept: [] });
23723
23764
  }
23724
23765
  });
@@ -23758,27 +23799,27 @@ function filesOrder(listed2, server, named) {
23758
23799
  return id === void 0 ? [] : [id];
23759
23800
  });
23760
23801
  }
23761
- function placeAt(list, id, position) {
23762
- const at = list.indexOf(id);
23763
- if (at >= 0) list.splice(at, 1);
23764
- list.splice(Math.min(position, list.length), 0, id);
23802
+ function placeAt(list2, id, position) {
23803
+ const at = list2.indexOf(id);
23804
+ if (at >= 0) list2.splice(at, 1);
23805
+ list2.splice(Math.min(position, list2.length), 0, id);
23765
23806
  }
23766
23807
  function sameOrder(a, b) {
23767
23808
  return a.length === b.length && a.every((id, i) => id === b[i]);
23768
23809
  }
23769
23810
  function reorderMoves(current, target) {
23770
- const list = [...current];
23771
- const present = target.filter((id) => list.includes(id));
23772
- const stay = longestRising(present, present.map((id) => list.indexOf(id)));
23811
+ const list2 = [...current];
23812
+ const present = target.filter((id) => list2.includes(id));
23813
+ const stay = longestRising(present, present.map((id) => list2.indexOf(id)));
23773
23814
  const moves = [];
23774
23815
  target.forEach((id, i) => {
23775
23816
  if (stay.has(id)) return;
23776
- const others = list.filter((other) => other !== id);
23817
+ const others = list2.filter((other) => other !== id);
23777
23818
  const position = i === 0 ? 0 : others.indexOf(target[i - 1]) + 1;
23778
23819
  moves.push({ id, position });
23779
- placeAt(list, id, position);
23820
+ placeAt(list2, id, position);
23780
23821
  });
23781
- const placed = list.filter((id) => target.includes(id));
23822
+ const placed = list2.filter((id) => target.includes(id));
23782
23823
  if (!sameOrder(placed, target)) {
23783
23824
  throw new Error(`reorderMoves: ${JSON.stringify(current)} \u2192 ${JSON.stringify(target)} left ${JSON.stringify(placed)}`);
23784
23825
  }
@@ -23857,16 +23898,16 @@ function takeCourse(folder, server, fields) {
23857
23898
  if (take("description", file.description !== side.description)) folder.description = server.description;
23858
23899
  if (take("published", file.published !== side.published)) folder.published = side.published;
23859
23900
  }
23860
- function orderVerdict(list, base, server) {
23901
+ function orderVerdict(list2, base, server) {
23861
23902
  const onServer = new Set(server);
23862
23903
  if (base === void 0) {
23863
- const shared2 = list.filter((id) => onServer.has(id));
23904
+ const shared2 = list2.filter((id) => onServer.has(id));
23864
23905
  return sameOrder(shared2, restrict(server, shared2)) ? "converged" : "conflict";
23865
23906
  }
23866
23907
  const inBase = new Set(base);
23867
- const shared = list.filter((id) => inBase.has(id) && onServer.has(id));
23868
- const added = list.filter((id) => !inBase.has(id) && onServer.has(id));
23869
- if (added.length > 0 && !sameGaps(added, shared, list, server)) return "conflict";
23908
+ const shared = list2.filter((id) => inBase.has(id) && onServer.has(id));
23909
+ const added = list2.filter((id) => !inBase.has(id) && onServer.has(id));
23910
+ if (added.length > 0 && !sameGaps(added, shared, list2, server)) return "conflict";
23870
23911
  const was = restrict(base, shared);
23871
23912
  const now = restrict(server, shared);
23872
23913
  return threeWay(!sameOrder(shared, was), !sameOrder(now, was), sameOrder(shared, now));
@@ -24000,25 +24041,25 @@ function append(order, id) {
24000
24041
  order.pinned?.push(id);
24001
24042
  order.touched = true;
24002
24043
  }
24003
- function insertAfter(list, item, order) {
24044
+ function insertAfter(list2, item, order) {
24004
24045
  let at = 0;
24005
24046
  for (let i = order.indexOf(item) - 1; i >= 0; i--) {
24006
- const k = list.indexOf(order[i]);
24047
+ const k = list2.indexOf(order[i]);
24007
24048
  if (k >= 0) {
24008
24049
  at = k + 1;
24009
24050
  break;
24010
24051
  }
24011
24052
  }
24012
- list.splice(at, 0, item);
24053
+ list2.splice(at, 0, item);
24013
24054
  }
24014
24055
  function shift(order, id, position) {
24015
24056
  placeAt(order.server, id, position);
24016
24057
  order.touched = true;
24017
24058
  }
24018
24059
  function leave(order, id) {
24019
- for (const list of [order.server, order.pinned ?? []]) {
24020
- const at = list.indexOf(id);
24021
- if (at >= 0) list.splice(at, 1);
24060
+ for (const list2 of [order.server, order.pinned ?? []]) {
24061
+ const at = list2.indexOf(id);
24062
+ if (at >= 0) list2.splice(at, 1);
24022
24063
  }
24023
24064
  order.touched = true;
24024
24065
  }
@@ -25681,7 +25722,7 @@ var init_sync2 = __esm({
25681
25722
  this.send(() => this.api.listCommunityRooms(this.communityId)),
25682
25723
  this.send(() => this.api.getCommunityJoinLink(this.communityId)),
25683
25724
  // Each course whole, as soon as the list names it.
25684
- this.listCourses().then((list) => Promise.all(list.map((course) => this.exportCourse(course.course_id))))
25725
+ this.listCourses().then((list2) => Promise.all(list2.map((course) => this.exportCourse(course.course_id))))
25685
25726
  ]);
25686
25727
  return { community, settings, rooms, joinLink, courses: new ServerCourses(courses) };
25687
25728
  }
@@ -28162,9 +28203,9 @@ async function conversationsCommand(args2) {
28162
28203
  if (result.partial || result.hubs_queried === 0) process.exit(1);
28163
28204
  return;
28164
28205
  }
28165
- for (const failure3 of result.errors) {
28166
- const where = failure3.scope_kind === "hub" ? `hub ${sanitizeTerminalText(failure3.hub_name || failure3.hub_id || "")} (${failure3.hub_id})` : `organization ${failure3.organization_id}`;
28167
- console.error(`Could not read ${where}: ${sanitizeTerminalText(failure3.error)}`);
28206
+ for (const failure4 of result.errors) {
28207
+ const where = failure4.scope_kind === "hub" ? `hub ${sanitizeTerminalText(failure4.hub_name || failure4.hub_id || "")} (${failure4.hub_id})` : `organization ${failure4.organization_id}`;
28208
+ console.error(`Could not read ${where}: ${sanitizeTerminalText(failure4.error)}`);
28168
28209
  }
28169
28210
  if (result.hubs_queried === 0) {
28170
28211
  console.error(
@@ -29554,10 +29595,10 @@ var init_caller_audio = __esm({
29554
29595
  /** Syntheses in flight, by cache file: two lines with the same words pay for one. */
29555
29596
  inFlight = /* @__PURE__ */ new Map();
29556
29597
  /** The cache file for a text: one per model, voice and exact text. */
29557
- cachePath(text) {
29598
+ cachePath(text2) {
29558
29599
  const key = createHash4("sha256").update(`${this.model}
29559
29600
  ${this.voice}
29560
- ${text}`).digest("hex");
29601
+ ${text2}`).digest("hex");
29561
29602
  return join31(this.cacheDir, `${key}.pcm`);
29562
29603
  }
29563
29604
  clipFor(line) {
@@ -29909,8 +29950,8 @@ function parseWrittenNumber(raw) {
29909
29950
  if (m) return { ...base, int: Number(m[1]), frac: m[2] };
29910
29951
  return { ...base, int: Number(base.digits || "0"), digitMode: true };
29911
29952
  }
29912
- function tokenize(text) {
29913
- const norm = normalizeText(text);
29953
+ function tokenize(text2) {
29954
+ const norm = normalizeText(text2);
29914
29955
  const out = [];
29915
29956
  const re = /r\$|\d[\d.,/:h-]*\d|\d|%|[a-z]+|[.\-/]/g;
29916
29957
  for (const m of norm.matchAll(re)) {
@@ -30028,8 +30069,8 @@ function num(tk) {
30028
30069
  function decimalString(n) {
30029
30070
  return n.frac ? `${n.int}.${n.frac.padEnd(2, "0")}` : String(n.int);
30030
30071
  }
30031
- function extractFacts(text) {
30032
- const toks = tokenize(text);
30072
+ function extractFacts(text2) {
30073
+ const toks = tokenize(text2);
30033
30074
  const facts = [];
30034
30075
  const used = /* @__PURE__ */ new Set();
30035
30076
  const push = (kind, key, from, to) => {
@@ -30157,10 +30198,10 @@ function extractFacts(text) {
30157
30198
  }
30158
30199
  return facts;
30159
30200
  }
30160
- function digitRuns(text) {
30201
+ function digitRuns(text2) {
30161
30202
  const runs = [];
30162
30203
  let cur = "";
30163
- for (const f of extractFacts(text)) {
30204
+ for (const f of extractFacts(text2)) {
30164
30205
  if (f.kind === "digits" || f.kind === "cpf" || f.kind === "number" && /^\d+$/.test(f.key)) cur += f.key;
30165
30206
  else {
30166
30207
  if (cur) runs.push(cur);
@@ -30224,21 +30265,21 @@ function isVetted(fact, vetted) {
30224
30265
  if (fact.kind === "number") return vetted.derivedNumbers.has(String(Number(fact.key)));
30225
30266
  return false;
30226
30267
  }
30227
- function readbackCandidate(text, kind) {
30268
+ function readbackCandidate(text2, kind) {
30228
30269
  if (kind === "cpf") {
30229
- const cpf = extractFacts(text).find((f) => f.kind === "cpf");
30270
+ const cpf = extractFacts(text2).find((f) => f.kind === "cpf");
30230
30271
  if (cpf) return cpf.key;
30231
- return digitRuns(text).find((r) => r.length >= 9 && r.length <= 13) ?? null;
30272
+ return digitRuns(text2).find((r) => r.length >= 9 && r.length <= 13) ?? null;
30232
30273
  }
30233
30274
  if (kind === "digits") {
30234
- const code = extractFacts(text).find((f) => (f.kind === "digits" || f.kind === "cpf") && f.key.length >= 5);
30275
+ const code = extractFacts(text2).find((f) => (f.kind === "digits" || f.kind === "cpf") && f.key.length >= 5);
30235
30276
  if (code) return code.key;
30236
- return digitRuns(text).find((r) => r.length >= 5) ?? null;
30277
+ return digitRuns(text2).find((r) => r.length >= 5) ?? null;
30237
30278
  }
30238
- return extractFacts(text).find((f) => f.kind === kind)?.key ?? null;
30279
+ return extractFacts(text2).find((f) => f.kind === kind)?.key ?? null;
30239
30280
  }
30240
- function claimMarkers(text) {
30241
- const n = normalizeText(text);
30281
+ function claimMarkers(text2) {
30282
+ const n = normalizeText(text2);
30242
30283
  return {
30243
30284
  policy: POLICY_MARKERS.filter((m) => n.includes(m)),
30244
30285
  action: ACTION_MARKERS.filter((m) => n.includes(m))
@@ -30399,10 +30440,10 @@ function parseCallPlan(raw) {
30399
30440
  }
30400
30441
  return { lines: out };
30401
30442
  }
30402
- function dictatedIdentifier(text) {
30403
- const fact = extractFacts(text).find((f) => f.kind === "cpf" || f.kind === "digits" && f.key.length >= 5);
30443
+ function dictatedIdentifier(text2) {
30444
+ const fact = extractFacts(text2).find((f) => f.kind === "cpf" || f.kind === "digits" && f.key.length >= 5);
30404
30445
  if (fact) return { kind: fact.kind, key: fact.key };
30405
- const run = digitRuns(text).find((r) => r.length >= 5);
30446
+ const run = digitRuns(text2).find((r) => r.length >= 5);
30406
30447
  return run ? { kind: run.length === 11 ? "cpf" : "digits", key: run } : null;
30407
30448
  }
30408
30449
  function readbackOf(value) {
@@ -30525,9 +30566,9 @@ var init_cost_cap = __esm({
30525
30566
  function factLabel(fact) {
30526
30567
  return `${fact.kind}:${fact.raw}`;
30527
30568
  }
30528
- function tokens(text) {
30529
- const words = normalizeText(text).split(/[^a-z0-9]+/).filter((w) => w.length > 1 && !/^\d+$/.test(w) && !isNumberWord(w));
30530
- const facts = extractFacts(text).map((f) => `#${f.kind}:${f.key}`);
30569
+ function tokens(text2) {
30570
+ const words = normalizeText(text2).split(/[^a-z0-9]+/).filter((w) => w.length > 1 && !/^\d+$/.test(w) && !isNumberWord(w));
30571
+ const facts = extractFacts(text2).map((f) => `#${f.kind}:${f.key}`);
30531
30572
  return /* @__PURE__ */ new Set([...words, ...facts]);
30532
30573
  }
30533
30574
  function similarity(a, b) {
@@ -31062,7 +31103,7 @@ var init_report = __esm({
31062
31103
  style: "style",
31063
31104
  latency: "latency"
31064
31105
  };
31065
- shown = (text) => text === null ? "nothing" : sanitizeTerminalText(text);
31106
+ shown = (text2) => text2 === null ? "nothing" : sanitizeTerminalText(text2);
31066
31107
  }
31067
31108
  });
31068
31109
 
@@ -32686,11 +32727,11 @@ async function updateCredentialCommand(args2) {
32686
32727
  const { config, accessToken } = await requireAuth();
32687
32728
  const client = new ApiClient({ apiUrl: config.api_url, accessToken });
32688
32729
  const { organizationId } = await resolveOrganizationId(client, parsed.orgId);
32689
- const list = await client.listOrgCredentials(organizationId);
32690
- const matches = (list.data || []).filter((c) => c.credential_display_name === parsed.name);
32730
+ const list2 = await client.listOrgCredentials(organizationId);
32731
+ const matches = (list2.data || []).filter((c) => c.credential_display_name === parsed.name);
32691
32732
  if (matches.length === 0) {
32692
32733
  console.error(`No credential named "${parsed.name}" found in this organization.`);
32693
- const available = (list.data || []).map((c) => c.credential_display_name);
32734
+ const available = (list2.data || []).map((c) => c.credential_display_name);
32694
32735
  if (available.length > 0) {
32695
32736
  console.error(`Available credentials: ${available.join(", ")}`);
32696
32737
  }
@@ -33943,9 +33984,9 @@ Usage:
33943
33984
  wayai dimensions restore-value <dimension> <value> [--org <org_id>] [--json]
33944
33985
 
33945
33986
  A record type in one of the organization's bases names a dimension in its x-access
33946
- declaration (for example "class"). Once that declaration can be enforced, a call will
33947
- reach only the records whose value (for example "7A") is among the caller's; nothing
33948
- filters any record yet. A dimension's and a value's id is
33987
+ declaration (for example "class"). Once the base switches that declaration to enforce,
33988
+ a call reaches only the records whose value (for example "7A") is among the caller's;
33989
+ in report mode it only counts what enforcing would hide. A dimension's and a value's id is
33949
33990
  fixed once created: change what people read with relabel. A value is never deleted:
33950
33991
  retire-value stops it from being assigned again, and records holding it still match.
33951
33992
  An organization holds at most ${MAX_ACCESS_DIMENSIONS_PER_ORG} dimensions of at most ${MAX_ACCESS_VALUES_PER_DIMENSION} values each, retired ones
@@ -33967,6 +34008,163 @@ organization admin.
33967
34008
  }
33968
34009
  });
33969
34010
 
34011
+ // src/commands/access.ts
34012
+ var access_exports = {};
34013
+ __export(access_exports, {
34014
+ accessCommand: () => accessCommand,
34015
+ formatExplanation: () => formatExplanation
34016
+ });
34017
+ import { parseArgs as parseArgs24 } from "util";
34018
+ function usageError4(message) {
34019
+ return expected(`${message}
34020
+
34021
+ ${USAGE5}`);
34022
+ }
34023
+ function parse4(args2) {
34024
+ try {
34025
+ return parseArgs24({
34026
+ args: args2,
34027
+ options: {
34028
+ hub: { type: "string" },
34029
+ agent: { type: "string" },
34030
+ user: { type: "string" },
34031
+ json: { type: "boolean" }
34032
+ },
34033
+ allowPositionals: true,
34034
+ strict: true
34035
+ });
34036
+ } catch (err) {
34037
+ throw usageError4(err instanceof Error ? err.message : String(err));
34038
+ }
34039
+ }
34040
+ function layerLines(values) {
34041
+ if (values === null) return ["narrows nothing (no values)"];
34042
+ const dimensions = Object.entries(values);
34043
+ if (dimensions.length === 0) return ["reaches nothing (unset, or no dimension)"];
34044
+ return dimensions.map(([dimension, { read, write }]) => `${text(dimension)}: read ${list(read)}; write ${list(write)}`);
34045
+ }
34046
+ function formatExplanation(data) {
34047
+ const lines = [];
34048
+ const who = data.user_id === null ? "no person: the hub's \u2229 the agent's" : `person ${text(data.user_id)}, ${data.kind ? kindName(data.kind) : "unknown kind"}`;
34049
+ lines.push(`Hub ${text(data.hub_id)}, agent ${text(data.agent_id)}, ${who}`);
34050
+ if (data.values_hub_id === null) lines.push("This preview hub was never published: it has no hub values, so it reaches nothing.");
34051
+ else if (data.values_hub_id !== data.hub_id) lines.push(`Hub values are those of its production hub ${text(data.values_hub_id)}.`);
34052
+ if (data.customer_only) {
34053
+ lines.push("Customer-only: held only on record types customer scope narrows to one customer, on a call naming its customer; every other scoped type reaches nothing.");
34054
+ }
34055
+ if (data.conversations_reach_nothing) {
34056
+ lines.push("This person's own set reaches nothing, whatever the agent: every turn in their conversations, a team member's send or consult there included, reaches nothing either.");
34057
+ }
34058
+ lines.push("", "Layers, intersected in order:");
34059
+ const width = Math.max(...data.layers.map((layer) => LAYER_NAMES[layer.layer].length));
34060
+ for (const layer of data.layers) {
34061
+ const [first, ...rest] = layerLines(layer.values);
34062
+ lines.push(` ${LAYER_NAMES[layer.layer].padEnd(width)} ${first}`);
34063
+ for (const line of rest) lines.push(` ${"".padEnd(width)} ${line}`);
34064
+ }
34065
+ lines.push("", "Effective set:");
34066
+ if (data.dimensions.length === 0) lines.push(" no dimension: the set reaches nothing on any scoped record type");
34067
+ for (const dimension of data.dimensions) {
34068
+ lines.push(` ${text(dimension.dimension_id)}: read ${list(dimension.read)}; write ${list(dimension.write)}`);
34069
+ for (const removal of dimension.read_removed) {
34070
+ lines.push(` ${text(removal.value_id)} not read: removed by ${removal.layers.map((layer) => LAYER_NAMES[layer]).join(", ")}`);
34071
+ }
34072
+ for (const removal of dimension.write_removed) {
34073
+ lines.push(` ${text(removal.value_id)} read, not written: removed by ${removal.layers.map((layer) => LAYER_NAMES[layer]).join(", ")}`);
34074
+ }
34075
+ }
34076
+ lines.push("", "This set filters records only on record types a base enforces (x-access in enforce mode).");
34077
+ return lines;
34078
+ }
34079
+ function failure3(err) {
34080
+ if (err instanceof ApiError && err.isExpected) return expected(sanitizeTerminalText(extractApiMessage(err)));
34081
+ return err;
34082
+ }
34083
+ async function accessCommand(args2) {
34084
+ if (wantsHelp(args2) || args2.length === 0) {
34085
+ console.log(USAGE5);
34086
+ return;
34087
+ }
34088
+ const { values, positionals } = parse4(args2);
34089
+ const [sub, ...rest] = positionals;
34090
+ if (sub !== "explain") throw usageError4(`Unknown subcommand ${JSON.stringify(sub)}.`);
34091
+ if (rest.length > 0) throw usageError4("explain takes no arguments.");
34092
+ if (values.agent === void 0) throw usageError4("explain needs --agent <agent_id>.");
34093
+ if (!UUID_RE3.test(values.agent)) throw expected(`Invalid --agent ${JSON.stringify(values.agent)}: expected an agent id (a UUID).`);
34094
+ if (values.user !== void 0 && !USER_ID_REGEX.test(values.user)) {
34095
+ throw expected(`Invalid --user ${JSON.stringify(values.user)}: expected a user id.`);
34096
+ }
34097
+ const hubId = resolveActiveHubId(values.hub === void 0 ? [] : ["--hub", values.hub]);
34098
+ const { config, accessToken } = await requireAuth();
34099
+ const api = new ApiClient({ apiUrl: config.api_url, accessToken, onUnauthorized: () => getAccessToken(config) });
34100
+ let data;
34101
+ try {
34102
+ ({ data } = await api.explainAccess(hubId, values.agent, values.user));
34103
+ } catch (err) {
34104
+ throw failure3(err);
34105
+ }
34106
+ console.log(values.json ? JSON.stringify(data, null, 2) : formatExplanation(data).join("\n"));
34107
+ }
34108
+ var USAGE5, LAYER_NAMES, kindName, text, list;
34109
+ var init_access = __esm({
34110
+ "src/commands/access.ts"() {
34111
+ "use strict";
34112
+ init_auth();
34113
+ init_api_client();
34114
+ init_errors2();
34115
+ init_expected();
34116
+ init_terminal_output();
34117
+ init_utils();
34118
+ init_workspace();
34119
+ init_contracts();
34120
+ USAGE5 = `
34121
+ wayai access explain \u2014 the access set a hub agent's toolset calls send, and why
34122
+
34123
+ Usage:
34124
+ wayai access explain --agent <agent_id> [--hub <uuid|folder>] [--user <user_id>] [--json]
34125
+
34126
+ Prints the read and write sets, per access dimension, that every hub toolset call of the
34127
+ agent sends, the layers they are the intersection of, and, for each value, the layers that
34128
+ removed it. Every layer only narrows:
34129
+ - with --user, or with no --user when you sign in as a person (yourself): that person's
34130
+ kind on the hub, the first that matches of org member, hub admin, hub team member,
34131
+ hub user and everyone else, then that kind's values \u2229 the hub's \u2229 the agent's. That
34132
+ is what their turn in their own conversation gets on a channel that verifies them (the
34133
+ app, WhatsApp, Instagram, Telegram); on any other they are everyone else.
34134
+ - with a scoped API token and no --user: the hub's \u2229 the agent's, what a hub
34135
+ automation's turn of the agent gets.
34136
+ Everyone else takes the hub's public values, customer-only: held only on record types that
34137
+ customer scope narrows to one customer, on a call naming its customer. A turn in another
34138
+ person's conversation is also cut to that person's set, a delegated task's to its
34139
+ delegation's, and a background agent's side-call's to its host turn's agent's values: those
34140
+ are not shown here. Explaining someone else matches no unredeemed team invite by their
34141
+ email: once they redeem one, its values apply.
34142
+
34143
+ These sets filter records only on record types a base enforces (x-access in enforce mode);
34144
+ a record type in report mode only counts what enforcing would hide.
34145
+
34146
+ The hub is --hub, else this workspace's. --user for anyone but yourself needs an
34147
+ organization admin.
34148
+ `.trim();
34149
+ LAYER_NAMES = {
34150
+ hub: "hub",
34151
+ org_member: "org member",
34152
+ hub_admin: "hub admin",
34153
+ hub_team_member: "hub team member",
34154
+ hub_user: "hub user",
34155
+ hub_public: "hub public values",
34156
+ initiator_agent: "consult initiator agent",
34157
+ delegation: "delegation",
34158
+ originator: "delegation originator",
34159
+ host_agent: "host agent",
34160
+ agent: "agent"
34161
+ };
34162
+ kindName = (kind) => kind === "public" ? "everyone else" : LAYER_NAMES[kind];
34163
+ text = (value) => sanitizeTerminalText(value);
34164
+ list = (ids) => ids.length === 0 ? "nothing" : ids.map(text).join(" ");
34165
+ }
34166
+ });
34167
+
33970
34168
  // src/data/files-sync/headers.ts
33971
34169
  function ifMatchValue(raw) {
33972
34170
  const hash = raw.trim().replace(/^W\//, "").replace(/^"(.*)"$/, "$1");
@@ -34116,11 +34314,11 @@ function ensureSyncDir(dir) {
34116
34314
  if (!fs28.lstatSync(dir).isDirectory()) throw symlinkRefusal(dir, "directory");
34117
34315
  }
34118
34316
  function readRecord(dir) {
34119
- const text = readRealFileOrThrow(dir, path39.join(dir, RECORD_FILE));
34120
- if (text === null) return null;
34317
+ const text2 = readRealFileOrThrow(dir, path39.join(dir, RECORD_FILE));
34318
+ if (text2 === null) return null;
34121
34319
  let parsed;
34122
34320
  try {
34123
- parsed = JSON.parse(text);
34321
+ parsed = JSON.parse(text2);
34124
34322
  } catch {
34125
34323
  parsed = void 0;
34126
34324
  }
@@ -34942,20 +35140,20 @@ __export(knowledge_exports, {
34942
35140
  knowledgeCommand: () => knowledgeCommand,
34943
35141
  parseKnowledgeArgs: () => parseKnowledgeArgs
34944
35142
  });
34945
- import { parseArgs as parseArgs24 } from "util";
34946
- function usageError4(message) {
35143
+ import { parseArgs as parseArgs25 } from "util";
35144
+ function usageError5(message) {
34947
35145
  return expected(`${message}
34948
- ${USAGE5}`);
35146
+ ${USAGE6}`);
34949
35147
  }
34950
35148
  function readArgs(args2) {
34951
35149
  try {
34952
- return parseArgs24({ args: args2, options: OPTIONS, allowPositionals: true, strict: true });
35150
+ return parseArgs25({ args: args2, options: OPTIONS, allowPositionals: true, strict: true });
34953
35151
  } catch (err) {
34954
- throw usageError4(err instanceof Error ? err.message : String(err));
35152
+ throw usageError5(err instanceof Error ? err.message : String(err));
34955
35153
  }
34956
35154
  }
34957
35155
  function parseKnowledgeArgs(args2) {
34958
- const [retired] = parseArgs24({ args: args2, options: OPTIONS, allowPositionals: true, strict: false }).positionals;
35156
+ const [retired] = parseArgs25({ args: args2, options: OPTIONS, allowPositionals: true, strict: false }).positionals;
34959
35157
  if (retired !== void 0 && RETIRED_VERBS.has(retired)) {
34960
35158
  throw expected(
34961
35159
  `\`wayai knowledge ${retired}\` is retired: knowledge resources are gone, and an organization's documents live in its knowledge base as files (\`wayai files pull\` and \`push\`).`
@@ -34964,25 +35162,25 @@ function parseKnowledgeArgs(args2) {
34964
35162
  const { values, positionals } = readArgs(args2);
34965
35163
  const [verb, ...extra] = positionals;
34966
35164
  if (verb !== "refresh-preview") {
34967
- throw usageError4(verb === void 0 ? "No subcommand given." : `Unknown subcommand ${JSON.stringify(verb)}.`);
35165
+ throw usageError5(verb === void 0 ? "No subcommand given." : `Unknown subcommand ${JSON.stringify(verb)}.`);
34968
35166
  }
34969
- if (extra.length > 0) throw usageError4(`Unexpected argument ${JSON.stringify(extra[0])}.`);
34970
- if (!values.org) throw usageError4("--org <org_id> is required.");
34971
- if (!UUID_RE3.test(values.org)) throw usageError4(`Invalid --org ${JSON.stringify(values.org)}: expected an organization id (a UUID).`);
34972
- if (!values.base) throw usageError4("--base <knowledge base> is required.");
35167
+ if (extra.length > 0) throw usageError5(`Unexpected argument ${JSON.stringify(extra[0])}.`);
35168
+ if (!values.org) throw usageError5("--org <org_id> is required.");
35169
+ if (!UUID_RE3.test(values.org)) throw usageError5(`Invalid --org ${JSON.stringify(values.org)}: expected an organization id (a UUID).`);
35170
+ if (!values.base) throw usageError5("--base <knowledge base> is required.");
34973
35171
  return { verb, orgId: values.org, base: values.base, yes: values.yes === true };
34974
35172
  }
34975
35173
  async function knowledgeCommand(args2) {
34976
35174
  if (wantsHelp(args2) || args2.length === 0) {
34977
- console.log(USAGE5);
35175
+ console.log(USAGE6);
34978
35176
  return;
34979
35177
  }
34980
35178
  const options = parseKnowledgeArgs(args2);
34981
- if (!options.yes && !isInteractive()) throw usageError4("It asks before it copies; pass -y when not running in a terminal.");
35179
+ if (!options.yes && !isInteractive()) throw usageError5("It asks before it copies; pass -y when not running in a terminal.");
34982
35180
  const data = await createDataClient(options.orgId, { refreshLogin: true });
34983
35181
  await refreshPreviewKnowledge(knowledgeBase(data), options, { log: (line) => console.log(line), confirm });
34984
35182
  }
34985
- var USAGE5, OPTIONS, RETIRED_VERBS;
35183
+ var USAGE6, OPTIONS, RETIRED_VERBS;
34986
35184
  var init_knowledge = __esm({
34987
35185
  "src/commands/knowledge.ts"() {
34988
35186
  "use strict";
@@ -34992,7 +35190,7 @@ var init_knowledge = __esm({
34992
35190
  init_helpers();
34993
35191
  init_remote();
34994
35192
  init_refresh_preview();
34995
- USAGE5 = `
35193
+ USAGE6 = `
34996
35194
  wayai knowledge \u2014 the organization's knowledge base
34997
35195
 
34998
35196
  Usage:
@@ -35528,8 +35726,8 @@ async function runArchiveRead(positional, flagArgs) {
35528
35726
  const id = String(m.message_id ?? "");
35529
35727
  const sender = String(m.sender_type ?? "");
35530
35728
  const ts = String(m.created_at ?? "");
35531
- const text = truncate2(String(m.message_text ?? ""), 80);
35532
- console.log(` ${id} | ${sender} | ${ts} | ${text}`);
35729
+ const text2 = truncate2(String(m.message_text ?? ""), 80);
35730
+ console.log(` ${id} | ${sender} | ${ts} | ${text2}`);
35533
35731
  }
35534
35732
  }
35535
35733
  }
@@ -35693,8 +35891,8 @@ function parseScopedTargetFlags(flagArgs, usage3, opts = {}) {
35693
35891
  return { body: { scope: "hub", hub_id: hubId, dry_run: dryRun }, targetLabel: `hub ${hubId}`, dryRun, yes, jsonOutput };
35694
35892
  }
35695
35893
  async function runRepairTeamOrphans(flagArgs) {
35696
- const USAGE6 = "wayai admin hubs repair-team-orphans --all | --org <org_id> | --hub <hub_id> [--dry-run] [--yes] [--json]";
35697
- const { body, targetLabel, dryRun, yes, jsonOutput } = parseScopedTargetFlags(flagArgs, USAGE6);
35894
+ const USAGE7 = "wayai admin hubs repair-team-orphans --all | --org <org_id> | --hub <hub_id> [--dry-run] [--yes] [--json]";
35895
+ const { body, targetLabel, dryRun, yes, jsonOutput } = parseScopedTargetFlags(flagArgs, USAGE7);
35698
35896
  if (!dryRun && !yes && !jsonOutput) {
35699
35897
  console.log(`About to PURGE dangling team references in: ${targetLabel}.`);
35700
35898
  console.log("Memberships pointing at a deleted team are removed (HubDO + UserDO mirror); conversations pinned to one are unassigned.");
@@ -35740,15 +35938,15 @@ async function runRepairTeamOrphans(flagArgs) {
35740
35938
  }
35741
35939
  }
35742
35940
  async function runRepairKnowledgeBlobs(flagArgs) {
35743
- const USAGE6 = "wayai admin hubs repair-knowledge-blobs --all | --org <org_id> | --hub <hub_id> [--apply] [--yes] [--json]";
35941
+ const USAGE7 = "wayai admin hubs repair-knowledge-blobs --all | --org <org_id> | --hub <hub_id> [--apply] [--yes] [--json]";
35744
35942
  const apply = flagArgs.includes("--apply");
35745
35943
  const { body, targetLabel, dryRun, yes, jsonOutput } = parseScopedTargetFlags(
35746
35944
  flagArgs.filter((arg) => arg !== "--apply"),
35747
- USAGE6
35945
+ USAGE7
35748
35946
  );
35749
35947
  if (apply && dryRun) {
35750
35948
  console.error("--apply and --dry-run contradict each other: a run is a dry run unless --apply is given.");
35751
- console.error(USAGE6);
35949
+ console.error(USAGE7);
35752
35950
  process.exit(1);
35753
35951
  }
35754
35952
  const input = { ...body, dry_run: !apply };
@@ -35798,7 +35996,7 @@ async function runRepairKnowledgeBlobs(flagArgs) {
35798
35996
  }
35799
35997
  }
35800
35998
  async function runRepairBranchingOrphans(flagArgs) {
35801
- const USAGE6 = "wayai admin hubs repair-branching-orphans --all | --org <org_id> | --hub <hub_id> [--id <type>:<id> ...] [--dry-run] [--yes] [--json]";
35999
+ const USAGE7 = "wayai admin hubs repair-branching-orphans --all | --org <org_id> | --hub <hub_id> [--id <type>:<id> ...] [--dry-run] [--yes] [--json]";
35802
36000
  const targets = [];
35803
36001
  const scopeArgs = [];
35804
36002
  for (let i = 0; i < flagArgs.length; i++) {
@@ -35816,10 +36014,10 @@ async function runRepairBranchingOrphans(flagArgs) {
35816
36014
  }
35817
36015
  targets.push({ entity_type: entityType, entity_id: entityId });
35818
36016
  }
35819
- const { body, targetLabel, dryRun, yes, jsonOutput } = parseScopedTargetFlags(scopeArgs, USAGE6);
36017
+ const { body, targetLabel, dryRun, yes, jsonOutput } = parseScopedTargetFlags(scopeArgs, USAGE7);
35820
36018
  if (targets.length > 0 && body.scope !== "hub") {
35821
36019
  console.error("--id deletes rows of ONE production hub: combine it with --hub <hub_id>.");
35822
- console.error(USAGE6);
36020
+ console.error(USAGE7);
35823
36021
  process.exit(1);
35824
36022
  }
35825
36023
  if (targets.length > 0 && !dryRun && !yes && !jsonOutput) {
@@ -35881,8 +36079,8 @@ async function runRepairBranchingOrphans(flagArgs) {
35881
36079
  }
35882
36080
  }
35883
36081
  async function runRepairLegacyOrgGrants(flagArgs) {
35884
- const USAGE6 = "wayai admin orgs repair-legacy-grants --all | --org <org_id> [--dry-run] [--yes] [--json]";
35885
- const scoped = parseScopedTargetFlags(flagArgs, USAGE6, {
36082
+ const USAGE7 = "wayai admin orgs repair-legacy-grants --all | --org <org_id> [--dry-run] [--yes] [--json]";
36083
+ const scoped = parseScopedTargetFlags(flagArgs, USAGE7, {
35886
36084
  scopes: ["all", "org"],
35887
36085
  allLabel: "ALL organizations (platform-wide)"
35888
36086
  });
@@ -35934,8 +36132,8 @@ async function runRepairLegacyOrgGrants(flagArgs) {
35934
36132
  }
35935
36133
  }
35936
36134
  async function runHarnessMassDestroy(flagArgs) {
35937
- const USAGE6 = "wayai admin harness mass-destroy --all | --org <org_id> | --hub <hub_id> [--dry-run] [--yes] [--json]";
35938
- const { body, targetLabel, dryRun, yes, jsonOutput } = parseScopedTargetFlags(flagArgs, USAGE6);
36135
+ const USAGE7 = "wayai admin harness mass-destroy --all | --org <org_id> | --hub <hub_id> [--dry-run] [--yes] [--json]";
36136
+ const { body, targetLabel, dryRun, yes, jsonOutput } = parseScopedTargetFlags(flagArgs, USAGE7);
35939
36137
  if (!dryRun && !yes && !jsonOutput) {
35940
36138
  console.log(`About to REAP every live harness session / token / slot in: ${targetLabel}.`);
35941
36139
  console.log("This destroys running harness sessions and revokes their tokens. Run with --dry-run first to see the blast radius.");
@@ -40526,6 +40724,11 @@ async function main() {
40526
40724
  await dimensionsCommand2(args);
40527
40725
  break;
40528
40726
  }
40727
+ case "access": {
40728
+ const { accessCommand: accessCommand2 } = await Promise.resolve().then(() => (init_access(), access_exports));
40729
+ await accessCommand2(args);
40730
+ break;
40731
+ }
40529
40732
  case "knowledge": {
40530
40733
  const { knowledgeCommand: knowledgeCommand2 } = await Promise.resolve().then(() => (init_knowledge(), knowledge_exports));
40531
40734
  await knowledgeCommand2(args);
@@ -40622,6 +40825,7 @@ Commands:
40622
40825
  communities An organization's communities: list, join link (get/rotate/off), stats, access list (list/add/remove) \u2014 \`wayai communities --help\`
40623
40826
  contacts Link a contact to its customer record in a base, or unlink it (browser sign-in only) \u2014 \`wayai contacts --help\`
40624
40827
  dimensions An organization's access dimensions and their values: list, create, relabel, add/retire values \u2014 \`wayai dimensions --help\`
40828
+ access explain The access set a hub agent's toolset calls send for a person, and which layer removed each value \u2014 \`wayai access --help\`
40625
40829
  knowledge refresh-preview Make the knowledge base's preview hold its production base's files \u2014 \`wayai knowledge --help\`
40626
40830
  report create Report a platform bug (submits to the triage queue)
40627
40831
  report edit Amend your own pending report (title/description/error/steps/context)