@wayai/cli 0.3.101 → 0.3.103

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
@@ -26,7 +26,7 @@ function valueEnd(text, from, isEnd) {
26
26
  }
27
27
  return text.length;
28
28
  }
29
- function maskCredentialValues(text, keyRe, isValueEnd) {
29
+ function maskCredentialValues(text, keyRe, resolveValueEnd) {
30
30
  keyRe.lastIndex = 0;
31
31
  let out = "";
32
32
  let copied = 0;
@@ -35,7 +35,7 @@ function maskCredentialValues(text, keyRe, isValueEnd) {
35
35
  const valueStart = match.index + match[0].length;
36
36
  keyRe.lastIndex = valueStart;
37
37
  if (!isCredentialKey(match[1])) continue;
38
- const end = valueEnd(text, valueStart, isValueEnd);
38
+ const end = resolveValueEnd(text, valueStart);
39
39
  const value = text.slice(valueStart, end);
40
40
  if (value.length === 0 || FULLY_MASKED_VALUE_RE.test(value)) continue;
41
41
  out += text.slice(copied, valueStart) + "[REDACTED]";
@@ -76,19 +76,167 @@ function maskJwts(text) {
76
76
  }
77
77
  return out + text.slice(copied);
78
78
  }
79
- function maskSecretsInMessage(text) {
79
+ function jsonContainerEnd(text, from) {
80
+ const opener = text[from];
81
+ if (opener !== "{" && opener !== "[") return null;
82
+ const stack = [opener];
83
+ let inString = false;
84
+ for (let i = from + 1; i < text.length; i++) {
85
+ const char = text[i];
86
+ if (inString) {
87
+ if (char === "\\") {
88
+ i++;
89
+ } else if (char === '"') {
90
+ inString = false;
91
+ }
92
+ continue;
93
+ }
94
+ if (char === '"') {
95
+ inString = true;
96
+ } else if (char === "{" || char === "[") {
97
+ stack.push(char);
98
+ } else if (char === "}" || char === "]") {
99
+ const expected2 = char === "}" ? "{" : "[";
100
+ if (stack.pop() !== expected2) return null;
101
+ if (stack.length === 0) return i + 1;
102
+ }
103
+ }
104
+ return null;
105
+ }
106
+ function jsonNumberEnd(text, from) {
107
+ const match = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/.exec(text.slice(from));
108
+ if (!match) return null;
109
+ const end = from + match[0].length;
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;
113
+ }
114
+ function maskJsonCredentialValues(text) {
115
+ JSON_KEY_RE.lastIndex = 0;
116
+ let out = "";
117
+ let copied = 0;
118
+ let match;
119
+ while ((match = JSON_KEY_RE.exec(text)) !== null) {
120
+ const valueStart = match.index + match[0].length;
121
+ JSON_KEY_RE.lastIndex = valueStart;
122
+ const key = match[1];
123
+ const isNumericCredentialKey = NUMERIC_CREDENTIAL_KEY_RE.test(key);
124
+ if (!isCredentialKey(key) && !isNumericCredentialKey) continue;
125
+ if (text[valueStart] === '"') {
126
+ const contentStart = valueStart + 1;
127
+ const end = valueEnd(text, contentStart, isJsonValueEnd);
128
+ const value = text.slice(contentStart, end);
129
+ if (value.length === 0 || FULLY_MASKED_VALUE_RE.test(value)) continue;
130
+ out += text.slice(copied, contentStart) + "[REDACTED]";
131
+ copied = end;
132
+ JSON_KEY_RE.lastIndex = end;
133
+ continue;
134
+ }
135
+ if (text[valueStart] === "{" || text[valueStart] === "[") {
136
+ const end = jsonContainerEnd(text, valueStart) ?? text.length;
137
+ out += text.slice(copied, valueStart) + '"[REDACTED]"';
138
+ copied = end;
139
+ JSON_KEY_RE.lastIndex = end;
140
+ continue;
141
+ }
142
+ if (isNumericCredentialKey) {
143
+ const end = jsonNumberEnd(text, valueStart);
144
+ if (end !== null) {
145
+ out += text.slice(copied, valueStart) + '"[REDACTED]"';
146
+ copied = end;
147
+ JSON_KEY_RE.lastIndex = end;
148
+ }
149
+ }
150
+ }
151
+ return out + text.slice(copied);
152
+ }
153
+ function headerValueEnd(text, from) {
154
+ for (let i = from; i < text.length; i++) {
155
+ const char = text[i];
156
+ if (char === "\r" || char === "\n") return i;
157
+ if (char === "\\") {
158
+ let afterSlashes = i;
159
+ while (text[afterSlashes] === "\\") afterSlashes++;
160
+ const slashCount = afterSlashes - i;
161
+ if (slashCount % 2 === 1 && (text[afterSlashes] === "r" || text[afterSlashes] === "n")) {
162
+ return i;
163
+ }
164
+ if (slashCount % 2 === 1) afterSlashes++;
165
+ i = afterSlashes - 1;
166
+ continue;
167
+ }
168
+ if (char === '"') {
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] === "]") {
172
+ return i;
173
+ }
174
+ }
175
+ }
176
+ return text.length;
177
+ }
178
+ function isSerializedJsonContainer(text) {
179
+ const trimmed = text.trim();
180
+ if (trimmed[0] !== "{" && trimmed[0] !== "[") return false;
181
+ try {
182
+ const parsed = JSON.parse(trimmed);
183
+ return typeof parsed === "object" && parsed !== null;
184
+ } catch {
185
+ return false;
186
+ }
187
+ }
188
+ function maskNestedJsonStringValues(text, depth) {
189
+ let out = "";
190
+ let copied = 0;
191
+ for (let i = 0; i < text.length; i++) {
192
+ if (text[i] !== '"') continue;
193
+ const contentStart = i + 1;
194
+ const end = valueEnd(text, contentStart, isJsonValueEnd);
195
+ if (end === text.length) break;
196
+ let next = end + 1;
197
+ while (next < text.length && /\s/.test(text[next])) next++;
198
+ if (text[next] === ":") {
199
+ i = end;
200
+ continue;
201
+ }
202
+ const encoded = text.slice(contentStart, end);
203
+ let decoded;
204
+ try {
205
+ decoded = JSON.parse(`"${encoded}"`);
206
+ } catch {
207
+ i = end;
208
+ continue;
209
+ }
210
+ const masked = depth >= MAX_NESTED_JSON_STRING_DEPTH && isSerializedJsonContainer(decoded) ? "[REDACTED]" : maskSecretsInMessageAtDepth(decoded, depth + 1);
211
+ if (masked !== decoded) {
212
+ const reencoded = JSON.stringify(masked).slice(1, -1);
213
+ out += text.slice(copied, contentStart) + reencoded;
214
+ copied = end;
215
+ }
216
+ i = end;
217
+ }
218
+ return out + text.slice(copied);
219
+ }
220
+ function maskSecretsInMessageAtDepth(text, depth) {
80
221
  let out = maskJwts(text);
81
222
  for (const [pattern, replacement] of SHAPE_PATTERNS) out = out.replace(pattern, replacement);
82
- out = maskCredentialValues(out, JSON_KEY_RE, isJsonValueEnd);
83
- out = maskCredentialValues(out, QUERY_KEY_RE, isQueryValueEnd);
223
+ out = out.replace(BASIC_CREDENTIAL_RE, maskBasicCredential);
224
+ out = maskJsonCredentialValues(out);
225
+ if (depth <= MAX_NESTED_JSON_STRING_DEPTH) out = maskNestedJsonStringValues(out, depth);
226
+ out = maskCredentialValues(out, QUERY_KEY_RE, queryValueEnd);
227
+ out = maskCredentialValues(out, HEADER_KEY_RE, headerValueEnd);
84
228
  return out.replace(BASE64_RE, maskBase64);
85
229
  }
86
- var CREDENTIAL_KEY_RE, FULLY_MASKED_VALUE_RE, isCredentialKey, isBase64UrlChar, SHAPE_PATTERNS, JSON_KEY_RE, isJsonValueEnd, QUERY_KEY_RE, isQueryValueEnd, BASE64_RE, maskBase64;
230
+ function maskSecretsInMessage(text) {
231
+ return maskSecretsInMessageAtDepth(text, 0);
232
+ }
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;
87
234
  var init_mask_secrets = __esm({
88
235
  "src/lib/mask-secrets.ts"() {
89
236
  "use strict";
90
237
  CREDENTIAL_KEY_RE = /token|secret|credential|password|passwd|api[_-]?key|authorization|private[_-]?key|session[_-]?id|cookie|jwt/i;
91
- FULLY_MASKED_VALUE_RE = /^(?:Bearer\s+)?(?:way_|wst_)?\[REDACTED(?:_JWT|_BASE64)?\]$/;
238
+ NUMERIC_CREDENTIAL_KEY_RE = /(?:password|passwd|pin|token|secret|credential|api[_-]?key|authorization|private[_-]?key|session[_-]?id|cookie|jwt)$/i;
239
+ FULLY_MASKED_VALUE_RE = /^(?:(?:Bearer|Basic)\s+)?(?:way_|wst_)?\[REDACTED(?:_JWT|_BASE64)?\]$/;
92
240
  isCredentialKey = (key) => CREDENTIAL_KEY_RE.test(key);
93
241
  isBase64UrlChar = (char) => {
94
242
  const code = char.charCodeAt(0);
@@ -101,13 +249,40 @@ var init_mask_secrets = __esm({
101
249
  [/\bway_[A-Za-z0-9_-]{8,}/g, "way_[REDACTED]"],
102
250
  // wst_ single-use WebSocket tickets (same opaque base64url format).
103
251
  [/\bwst_[A-Za-z0-9_-]{8,}/g, "wst_[REDACTED]"],
104
- // Authorization: Bearer <opaque token> (anything not already masked above).
252
+ // Stripe API keys and webhook signing secrets. Keep this aligned with
253
+ // packages/core/src/redact.ts; both modules protect observability sinks.
254
+ [
255
+ /(^|[^A-Za-z0-9])(?:(?:sk|pk|rk)_(?:live|test)_[A-Za-z0-9]{8,}|whsec_[A-Za-z0-9]{8,})/g,
256
+ "$1[REDACTED]"
257
+ ],
258
+ // LLM provider API keys. The captured delimiter is deliberate: `_` may
259
+ // legitimately precede a key, while a letter/digit means the prefix is part
260
+ // of an ordinary identifier (for example `task-...` or `maxai-...`).
261
+ [
262
+ /(^|[^A-Za-z0-9])(?:sk-[A-Za-z0-9_-]{16,}|AIza[A-Za-z0-9_-]{16,}|xai-[A-Za-z0-9_-]{16,})/g,
263
+ "$1[REDACTED]"
264
+ ],
265
+ // Opaque Bearer credentials retain a precision floor. Basic credentials use
266
+ // the validated pass below because a single base64 quad such as `YTpi` is
267
+ // usable, but matching every four-letter word after "Basic" would destroy
268
+ // benign prose.
105
269
  [/(Bearer\s+)[A-Za-z0-9._~+/=-]{8,}/gi, "$1[REDACTED]"]
106
270
  ];
107
- JSON_KEY_RE = /"([A-Za-z0-9_.-]+)"\s*:\s*"/g;
271
+ BASIC_CREDENTIAL_RE = /(Basic\s+)([A-Za-z0-9+/]{4,}={0,2})(?![A-Za-z0-9+/=])/gi;
272
+ maskBasicCredential = (match, prefix, encoded) => {
273
+ try {
274
+ const padded = encoded + "=".repeat((4 - encoded.length % 4) % 4);
275
+ return atob(padded).includes(":") ? `${prefix}[REDACTED]` : match;
276
+ } catch {
277
+ return match;
278
+ }
279
+ };
280
+ JSON_KEY_RE = /"([A-Za-z0-9_.-]+)"\s*:\s*/g;
108
281
  isJsonValueEnd = (char) => char === '"';
109
282
  QUERY_KEY_RE = /(?:^|[?#&;,\s"'])([A-Za-z0-9_.-]+)=/g;
110
283
  isQueryValueEnd = (char) => char === "&" || char === ";" || char === '"' || /\s/.test(char);
284
+ queryValueEnd = (text, from) => valueEnd(text, from, isQueryValueEnd);
285
+ HEADER_KEY_RE = /(?:^|[^A-Za-z0-9_.\/\\-])([A-Za-z0-9_.-]+):[ \t]*/g;
111
286
  BASE64_RE = // Padded base64 bodies (wrapped DEKs, HMAC secrets, service-account material)
112
287
  // appearing outside any credential-named key — the shape the rules above miss.
113
288
  //
@@ -140,6 +315,7 @@ var init_mask_secrets = __esm({
140
315
  // {22,} + 1-2 pad chars => a 24-char floor, i.e. a 16-byte secret.
141
316
  /(?<![A-Za-z0-9+/])(?<![?&])[A-Za-z0-9+/]{22,}={1,2}(?![A-Za-z0-9+/=])/g;
142
317
  maskBase64 = (match) => match.length % 4 === 0 ? "[REDACTED_BASE64]" : match;
318
+ MAX_NESTED_JSON_STRING_DEPTH = 10;
143
319
  }
144
320
  });
145
321
 
@@ -5595,7 +5771,7 @@ function findStepBoundaries(transcript) {
5595
5771
  }
5596
5772
  return out;
5597
5773
  }
5598
- var UUID_RE, HEX_RE, WORKOS_ID_RE, OPAQUE_SECRET_RE, BASE64_SECRET_RE, BASE64_MARKER_RE, TOKEN_RE, SENSITIVE_FIELDS, SENSITIVE_KEY_ALTERNATION, SENSITIVE_KEY_PATTERN, JSON_CREDENTIAL_RE, QUERY_CREDENTIAL_RE, REDACTED, PROVIDER_TOKEN_RE, APP_ERROR_BRAND, AppError, LLM_RATE_LIMIT_BRAND, LlmRateLimitError, LLM_PROVIDER_HTTP_BRAND, LlmProviderHttpError, LLM_PROVIDER_TIMEOUT_BRAND, LlmProviderTimeoutError, ExternalServiceError, CHANNEL_PROVIDER_HTTP_BRAND, ChannelProviderHttpError, MEDIA_PROVIDER_HTTP_BRAND, MediaProviderHttpError, AUTH_TYPE, ORG_CREDENTIAL_AUTH_TYPES, AUTH_TYPE_DISPLAY, LEGACY_AUTH_TYPE_MAP, VALID_AUTH_TYPES, AGENT_ROLES, SAFE_USER_ID_REGEX, SUPPORTED_LOCALES, uuidSchema, paginationSchema, timestampSchema, idParamSchema, clientOptionalString, clientOptionalBoolean, clientOptionalNumber, messageAttachment, MAX_MESSAGE_BODY_BYTES, MAX_ATTACHMENTS_PER_MESSAGE, primaryRegionSchema, placementSourceSchema, orgIdParam, orgAdminIdParam, createOrganizationBody, updateOrganizationBody, addOrgAdminBody, SUMMARIZATION_THRESHOLD_MIN, SUMMARIZATION_THRESHOLD_MAX, summarizationThresholdField, monitorConfigField, agentIdParam, listAgentsQuery, agentConnectionsQuery, createAgentBody, updateAgentBody, AGENT_PARAMETER_TYPES, AGENT_PARAMETER_NAME_REGEX, agentParameterCreateSchema, MAX_AGENT_PARAMETERS_PER_REQUEST, createAgentParametersBody, SLUG_REGEX, slugSchema, INVISIBLE_NAME_CHARS, MAX_KANBAN_STATUSES, MAX_FOLLOWUPS_PER_STATUS, MAX_LANES, MAX_ADDITIONAL_CONTEXT_SCHEMA_BYTES, RESERVED_TEMPLATE_DUMP_NAME, kanbanStatusSlugSchema, followupSchema, EXCLUSIVE_FLAG_PAIRS, kanbanStatusSchema, kanbanStatusesArraySchema, laneSchema, lanesArraySchema, hubIdParam, hubAdminIdParam, hubUserIdParam, hubIdentityIdParam, hubTeamIdParam, hubTeamUserDeleteParam, hubSchemaQuery, PREVIEW_LABEL_MAX_LENGTH, MAX_ENDED_INDEX_RETENTION_DAYS, previewLabelField, createHubBody, updateHubBody, addHubAdminBody, addHubIdentityAuthorizationBody, contactDecisionBody, approveContactBody, listContactAccessQuery, createHubTeamBody, updateHubTeamBody, addHubTeamUserBody, reassignHubUserBody, replicatePreviewBody, updateChannelTestIdentitiesBody, claimCodeChannelParam, claimCodeDeleteParam, connectionIdParam, connectorIdParam, listConnectionsQuery, deleteConnectionQuery, addConnectionBody, editConnectionBody, PRODUCTION_DIRECT_FIELDS, setProductionCredentialBody, registerWhatsappQuery, registerWhatsappBody, retryProvisioningQuery, resendDomainStatusQuery, PLACEHOLDER_TOKENS, ALLOWED_TYPES, SUBSCHEMA_OBJECT_KEYWORDS, SUBSCHEMA_LIST_KEYWORDS, SUBSCHEMA_MAP_KEYWORDS, MAX_SCHEMA_DEPTH, toolIdParam, listToolsQuery, toolAgentQuery, deleteToolQuery, toolConnectionsQuery, nativeToolIdSchema, addNativeToolBody, addMcpToolBody, createCustomToolBody, updateCustomToolBody, updateToolExecutionConfigBody, initialValueCreateSchema, initialValueUpdateSchema, stateIdParam, listStatesQuery, stateNameSchema, createStateBody, updateStateBody, reorderStatesBody, variantAiModeSchema, experimentStatusSchema, overlayUpdateSchema, experimentIdParam, variantIdParam, listExperimentsQuery, listVariantsQuery, listOverridesQuery, deleteOverrideQuery, createExperimentBody, updateExperimentBody, setExperimentStatusBody, createVariantBody, updateVariantBody, upsertOverrideBody, orgTagIdParam, listOrgTagsQuery, createOrgTagBody, updateOrgTagBody, orgCredentialIdParam, listOrgCredentialsQuery, createOrgCredentialBody, updateOrgCredentialBody, orgResourceIdParam, orgResourceFileIdParam, orgResourceFolderIdParam, hubOrgResourceParam, listOrgResourcesQuery, orgIdQuery, createOrgResourceBody, updateOrgResourceBody, createOrgResourceFolderBody, updateOrgResourceFolderBody, uploadOrgResourceFileBody, updateOrgResourceFileBody, uploadOrgSkillZipBody, linkOrgResourceBody, resourceIdParam, listResourcesQuery, createResourceBody, updateResourceBody, syncSkillsBody, resourceFileIdParam, listResourceFilesQuery, createResourceFileBody, updateResourceFileBody, uploadResourceFileBody, uploadSkillZipBody, resourceFolderIdParam, listResourceFoldersQuery, createResourceFolderBody, updateResourceFolderBody, agentResourceQuery, hubResourceQuery, linkAgentResourceBody, updateAgentResourceBody, unlinkAgentResourceQuery, navItemSchema, hubCountResetBody, navItemCountResetBody, typingBody, 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, analyticsSqlSchemaQuery, EVAL_PACING_PRESET_NAMES, PACING_INTERVAL_MIN_MS, PACING_INTERVAL_MAX_MS, EVAL_RUN_DEADLINE_MIN_MS, EVAL_RUN_DEADLINE_MAX_MS, paginationSchema2, evalIdParam, sessionIdParam, scenarioSetIdParam, hubIdQuery, EVAL_INPUT_ROLES, EVAL_INPUT_ROLE_LIST, ROLE_ECHO_MAX, createEvalBody, updateEvalBody, getEvalsQuery, toggleEvalBody, bulkToggleEvalsBody, pacingConfigSchema, sessionConfigSchema, createSessionBody, getSessionsQuery, getSessionResultsQuery, getSessionRunsQuery, evalAnalyticsQuery, getSessionCostQuery, compareSessionsQuery, evalsSqlBody, evalsSqlSchemaQuery, exportResultsQuery, validateEvalBody, hubAgentsQuery, createScenarioSetBody, updateScenarioSetBody, scenarioSetsHubQuery, createScenarioFromConversationBody, createJourneyFromConversationBody, journeyIdParam, journeyToolCallSchema, journeyTurnSchema, journeyStepOverrideSchema, fixtureField, createJourneyBody, updateJourneyBody, getConversationsQuery, getMessagesQuery, appMessageSenderType, appMessageReceiverType, appMessageBody, updateUserBody, updateProfileBody, pathnameRegex, updatePreferencesBody, registerPushTokenBody, deletePushTokenQuery, activityQuery, deletionModeSchema, deletionRequestBody, archiveHubIdParam, archiveConversationParams, archiveListQuery, archiveMessageObservabilityParams, conversationIdParam, claimBody, releaseBody, transferBody, closeBody, additionalContextPayloadSchema, kanbanUpdateBody, annotateConversationBody, observabilityParams, observabilityListParams, deleteUserConversationsBody, sendMessageBody, listConversationsQuery, getConversationDetailParams, getConversationDetailQuery, listWhatsAppTemplatesQuery, sendWhatsAppTemplateBody, billingOrgIdParam, subscriptionItemParams, spendCapBody, growthPacksBody, portalSessionBody, checkoutSessionBody, updateBillingCurrencyBody, invoicesQuery, downloadBody, uploadQuery, signUrlBody, outboundSchemaQuery, templateIdParam, listTemplatesQuery, deleteTemplateQuery, templateStatusQuery, createTemplateBody, updateTemplateBody, submitTemplateBody, testTemplateBody, contactIdParam, listContactsQuery, createContactBody, updateContactBody, listIdParam, listListsQuery, listListContactsQuery, createListBody, updateListBody, addListContactsBody, removeListContactsBody, scheduleIdParam, listSchedulesQuery, listExecutionsQuery, createScheduleBody, updateScheduleBody, uuidPattern, ciUuidSchema, hubAsCodeConfigSchema, ciPullHubIdParam, ciBranchParam, ciPullQuery, ciHubsQuery, ciLookupQuery, ciBranchesQuery, ciSyncBody, ciPushBody, ciDiffBody, ciPublishBody, ciPublishPreviewBody, ciSyncMcpBody, ciOrgResourcesParam, orgResourcesConfigSchema, ciOrgResourcesPushBody, ciOrgResourcesDiffBody, adminOrgIdParam, adminOrgAdminIdParam, adminUserIdParam, adminPlanIdParam, adminHubIdParam, adminOrganizationsQuery, adminUserSearchQuery, kanbanSlugMigrationQuery, adjustQuotaBody, updatePlanBody, addAdminUserBody, updatePlatformConfigBody, updateFreeOrgLimitBody, adminSetOrgHarnessBody, adminSetHubHarnessBody, adminScopedTargetBody, updatePricingPlanBody, dataExplorerSearchQuery, dataExplorerOrgIdParam, dataExplorerHubIdParam, dataExplorerConvIdParam, dataExplorerDoInstancesQuery, dataExplorerNsIdParam, dataExplorerKvKeysQuery, dataExplorerKvKeyParam, uuidOrHexId, dataExplorerDeleteOrgParam, dataExplorerDeleteHubParam, dataExplorerDeleteConvParam, dataExplorerDeleteUserParam, dataExplorerDeleteQuery, dataExplorerKvDeleteQuery, pitrDoNamespace, pitrBookmarkParam, pitrRestoreBody, healthSamplingTriggerBody, dataExplorerDebugDoType, DEBUG_READ_MAX_LIMIT, DEBUG_READ_DEFAULT_LIMIT, DEBUG_DO_HEX_PREFIX, debugDoEntityId, debugTableName, dataExplorerDebugTablesParam, dataExplorerDebugRowsParam, dataExplorerDebugRowsQuery, dataExplorerDebugAnalyticsTable, debugUuid, dataExplorerDebugAnalyticsRowsParam, dataExplorerDebugAnalyticsRowsQuery, debugHubConvParam, debugMessageIdQuery, sandboxEgressPolicy, SANDBOX_EXEC_MAX_CMD_LENGTH, SANDBOX_EXEC_MAX_ALLOWLIST, SANDBOX_EXEC_MAX_TIMEOUT_MS, adminSandboxExecBody, whatsappCallbackBody, authMeResponse, wsTicketResponse, sessionCheckResponse, logoutResponse, magicCodeSendBody, magicCodeSendResponse, magicCodeVerifyBody, magicCodeVerifyResponse, browserParams, browserFoldersQuery, browserFilesQuery, stateOperationBody, conversationListResourcesQuery, conversationReadResourceQuery, listPendingSchedulesQuery, listHubAggregateSchedulesQuery, reportSourceSchema, intakeReportSourceSchema, reportClassificationSchema, reportStatusSchema, reportLocaleSchema, reportMessageAuthorRoleSchema, sentryRefStatusSchema, createReportBody, editReportBody, contestReportBody, reporterListQuery, listReportsQuery, GITHUB_ISSUE_URL_REGEX, githubIssueUrlSchema, transitionReportBody, groupReportsBody, holdReportBody, clickhouseReadyResponse, bootstrapQuery, requestSnapshotChunkMessage, MAX_NAME_LENGTH, MAX_VALUE_LENGTH, MAX_TAGS, MAX_TAG_LENGTH, MAX_SCOPE_HUBS, MAX_SCOPE_TAGS, vaultSecretScopeSchema, vaultCreateBody, vaultUpdateBody, PERMISSIONS, MAX_NAME_LENGTH2, MAX_HUBS_PER_GRANT, MAX_HUB_TAGS_PER_GRANT, MAX_GRANTS, permissionEnum, grantScopeSchema, grantSchema, createTokenBody, tokenOrgIdParam, tokenGrantScopeSchema, tokenGrantSchema, tokenMetadataSchema, listTokensResponse, createTokenResponse, orgTokenSummarySchema, listOrgTokensResponse, invitePreviewQuery, invitePreviewResponse, discordTier, discordBillingCycle, discordMetadata, discordOAuthStartResponse, discordOAuthFinalizeBody, discordOAuthFinalizeResponse, discordDisconnectResponse, jsonSchemaSchema, hubUserIdentity, stateValueEntry, getHubUserContextResponse, updateHubUserBody, updateHubUserResponse, unlockHubUserNameResponse, stateResetParams, stateResetResponse, hubAlertsParam, hubAlertSeverity, hubAlert, hubAlertsListResponse, noticeSeveritySchema, noticeStatusSchema, NOTICE_SCOPE_REGEX, noticeScopeSchema, noticeLinkSchema, createNoticeBody, updateNoticeBody, listNoticesQuery, noticeIdParamSchema, templateLocaleSchema, TEMPLATE_SLUG_REGEX, templateSlugSchema, templateStatusSchema, templateFileMapSchema, templateTextSchema, templateUsesEntrySchema, templateUsesSchema, templateYamlLocaleEntry, templateYamlWayaiBlock, templateTagsSchema, templateYamlSchema, templateHeroSchema, templatePushLocaleSchema, templatePushBody, templateListQuery, templateSlugParam, templateDetailQuery, ADMIN_SKILL_NAME_REGEX, adminSkillNameParam, WAYAI_WORKSPACE_LAYOUT, MAX_RESOURCE_FILE_SIZE;
5774
+ var UUID_RE, HEX_RE, WORKOS_ID_RE, OPAQUE_SECRET_RE, BASE64_SECRET_RE, BASE64_MARKER_RE, TOKEN_RE, SENSITIVE_FIELDS, SENSITIVE_KEY_ALTERNATION, SENSITIVE_KEY_PATTERN, JSON_CREDENTIAL_RE, QUERY_CREDENTIAL_RE, REDACTED, PROVIDER_TOKEN_RE, APP_ERROR_BRAND, AppError, LLM_RATE_LIMIT_BRAND, LlmRateLimitError, LLM_PROVIDER_HTTP_BRAND, LlmProviderHttpError, LLM_PROVIDER_CONTENT_BRAND, LlmProviderContentError, LLM_PROVIDER_TIMEOUT_BRAND, LlmProviderTimeoutError, ExternalServiceError, CHANNEL_PROVIDER_HTTP_BRAND, ChannelProviderHttpError, MEDIA_PROVIDER_HTTP_BRAND, MediaProviderHttpError, AUTH_TYPE, ORG_CREDENTIAL_AUTH_TYPES, AUTH_TYPE_DISPLAY, LEGACY_AUTH_TYPE_MAP, VALID_AUTH_TYPES, AGENT_ROLES, SAFE_USER_ID_REGEX, SUPPORTED_LOCALES, uuidSchema, paginationSchema, timestampSchema, idParamSchema, clientOptionalString, clientOptionalBoolean, clientOptionalNumber, messageAttachment, MAX_MESSAGE_BODY_BYTES, MAX_ATTACHMENTS_PER_MESSAGE, primaryRegionSchema, placementSourceSchema, orgIdParam, orgAdminIdParam, createOrganizationBody, updateOrganizationBody, addOrgAdminBody, SUMMARIZATION_THRESHOLD_MIN, SUMMARIZATION_THRESHOLD_MAX, summarizationThresholdField, monitorConfigField, agentIdParam, listAgentsQuery, agentConnectionsQuery, createAgentBody, updateAgentBody, AGENT_PARAMETER_TYPES, AGENT_PARAMETER_NAME_REGEX, agentParameterCreateSchema, MAX_AGENT_PARAMETERS_PER_REQUEST, createAgentParametersBody, SLUG_REGEX, slugSchema, INVISIBLE_NAME_CHARS, MAX_KANBAN_STATUSES, MAX_FOLLOWUPS_PER_STATUS, MAX_LANES, MAX_ADDITIONAL_CONTEXT_SCHEMA_BYTES, RESERVED_TEMPLATE_DUMP_NAME, kanbanStatusSlugSchema, followupSchema, EXCLUSIVE_FLAG_PAIRS, kanbanStatusSchema, kanbanStatusesArraySchema, laneSchema, lanesArraySchema, hubIdParam, hubAdminIdParam, hubUserIdParam, hubIdentityIdParam, hubTeamIdParam, hubTeamUserDeleteParam, hubSchemaQuery, PREVIEW_LABEL_MAX_LENGTH, MAX_ENDED_INDEX_RETENTION_DAYS, previewLabelField, createHubBody, updateHubBody, addHubAdminBody, addHubIdentityAuthorizationBody, contactDecisionBody, approveContactBody, listContactAccessQuery, createHubTeamBody, updateHubTeamBody, addHubTeamUserBody, reassignHubUserBody, replicatePreviewBody, updateChannelTestIdentitiesBody, claimCodeChannelParam, claimCodeDeleteParam, connectionIdParam, connectorIdParam, listConnectionsQuery, deleteConnectionQuery, addConnectionBody, editConnectionBody, PRODUCTION_DIRECT_FIELDS, setProductionCredentialBody, registerWhatsappQuery, registerWhatsappBody, retryProvisioningQuery, resendDomainStatusQuery, PLACEHOLDER_TOKENS, ALLOWED_TYPES, SUBSCHEMA_OBJECT_KEYWORDS, SUBSCHEMA_LIST_KEYWORDS, SUBSCHEMA_MAP_KEYWORDS, MAX_SCHEMA_DEPTH, toolIdParam, listToolsQuery, toolAgentQuery, deleteToolQuery, toolConnectionsQuery, nativeToolIdSchema, addNativeToolBody, addMcpToolBody, createCustomToolBody, updateCustomToolBody, updateToolExecutionConfigBody, initialValueCreateSchema, initialValueUpdateSchema, stateIdParam, listStatesQuery, stateNameSchema, createStateBody, updateStateBody, reorderStatesBody, variantAiModeSchema, experimentStatusSchema, overlayUpdateSchema, experimentIdParam, variantIdParam, listExperimentsQuery, listVariantsQuery, listOverridesQuery, deleteOverrideQuery, createExperimentBody, updateExperimentBody, setExperimentStatusBody, createVariantBody, updateVariantBody, upsertOverrideBody, orgTagIdParam, listOrgTagsQuery, createOrgTagBody, updateOrgTagBody, orgCredentialIdParam, listOrgCredentialsQuery, createOrgCredentialBody, updateOrgCredentialBody, orgResourceIdParam, orgResourceFileIdParam, orgResourceFolderIdParam, hubOrgResourceParam, listOrgResourcesQuery, orgIdQuery, createOrgResourceBody, updateOrgResourceBody, createOrgResourceFolderBody, updateOrgResourceFolderBody, uploadOrgResourceFileBody, updateOrgResourceFileBody, uploadOrgSkillZipBody, linkOrgResourceBody, resourceIdParam, listResourcesQuery, createResourceBody, updateResourceBody, syncSkillsBody, resourceFileIdParam, listResourceFilesQuery, createResourceFileBody, updateResourceFileBody, uploadResourceFileBody, uploadSkillZipBody, resourceFolderIdParam, listResourceFoldersQuery, createResourceFolderBody, updateResourceFolderBody, agentResourceQuery, hubResourceQuery, linkAgentResourceBody, updateAgentResourceBody, unlinkAgentResourceQuery, navItemSchema, hubCountResetBody, navItemCountResetBody, typingBody, 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, analyticsSqlSchemaQuery, EVAL_PACING_PRESET_NAMES, PACING_INTERVAL_MIN_MS, PACING_INTERVAL_MAX_MS, EVAL_RUN_DEADLINE_MIN_MS, EVAL_RUN_DEADLINE_MAX_MS, paginationSchema2, evalIdParam, sessionIdParam, scenarioSetIdParam, hubIdQuery, EVAL_INPUT_ROLES, EVAL_INPUT_ROLE_LIST, ROLE_ECHO_MAX, createEvalBody, updateEvalBody, getEvalsQuery, toggleEvalBody, bulkToggleEvalsBody, pacingConfigSchema, sessionConfigSchema, createSessionBody, getSessionsQuery, getSessionResultsQuery, getSessionRunsQuery, evalAnalyticsQuery, getSessionCostQuery, compareSessionsQuery, evalsSqlBody, evalsSqlSchemaQuery, exportResultsQuery, validateEvalBody, hubAgentsQuery, createScenarioSetBody, updateScenarioSetBody, scenarioSetsHubQuery, createScenarioFromConversationBody, createJourneyFromConversationBody, journeyIdParam, journeyToolCallSchema, journeyTurnSchema, journeyStepOverrideSchema, fixtureField, createJourneyBody, updateJourneyBody, getConversationsQuery, getMessagesQuery, appMessageSenderType, appMessageReceiverType, appMessageBody, updateUserBody, updateProfileBody, pathnameRegex, updatePreferencesBody, registerPushTokenBody, deletePushTokenQuery, activityQuery, deletionModeSchema, deletionRequestBody, archiveHubIdParam, archiveConversationParams, archiveListQuery, archiveMessageObservabilityParams, conversationIdParam, claimBody, releaseBody, transferBody, closeBody, additionalContextPayloadSchema, kanbanUpdateBody, annotateConversationBody, observabilityParams, observabilityListParams, deleteUserConversationsBody, sendMessageBody, listConversationsQuery, getConversationDetailParams, getConversationDetailQuery, listWhatsAppTemplatesQuery, sendWhatsAppTemplateBody, billingOrgIdParam, subscriptionItemParams, spendCapBody, growthPacksBody, portalSessionBody, checkoutSessionBody, updateBillingCurrencyBody, invoicesQuery, downloadBody, uploadQuery, signUrlBody, outboundSchemaQuery, templateIdParam, listTemplatesQuery, deleteTemplateQuery, templateStatusQuery, createTemplateBody, updateTemplateBody, submitTemplateBody, testTemplateBody, contactIdParam, listContactsQuery, createContactBody, updateContactBody, listIdParam, listListsQuery, listListContactsQuery, createListBody, updateListBody, addListContactsBody, removeListContactsBody, scheduleIdParam, listSchedulesQuery, listExecutionsQuery, createScheduleBody, updateScheduleBody, uuidPattern, ciUuidSchema, hubAsCodeConfigSchema, ciPullHubIdParam, ciBranchParam, ciPullQuery, ciHubsQuery, ciLookupQuery, ciBranchesQuery, ciSyncBody, ciPushBody, ciDiffBody, ciPublishBody, ciPublishPreviewBody, ciSyncMcpBody, ciOrgResourcesParam, orgResourcesConfigSchema, ciOrgResourcesPushBody, ciOrgResourcesDiffBody, adminOrgIdParam, adminOrgAdminIdParam, adminUserIdParam, adminPlanIdParam, adminHubIdParam, adminOrganizationsQuery, adminUserSearchQuery, kanbanSlugMigrationQuery, adjustQuotaBody, updatePlanBody, addAdminUserBody, updatePlatformConfigBody, updateFreeOrgLimitBody, adminSetOrgHarnessBody, adminSetHubHarnessBody, adminScopedTargetBody, updatePricingPlanBody, dataExplorerSearchQuery, dataExplorerOrgIdParam, dataExplorerHubIdParam, dataExplorerConvIdParam, dataExplorerDoInstancesQuery, dataExplorerNsIdParam, dataExplorerKvKeysQuery, dataExplorerKvKeyParam, uuidOrHexId, dataExplorerDeleteOrgParam, dataExplorerDeleteHubParam, dataExplorerDeleteConvParam, dataExplorerDeleteUserParam, dataExplorerDeleteQuery, dataExplorerKvDeleteQuery, pitrDoNamespace, pitrBookmarkParam, pitrRestoreBody, healthSamplingTriggerBody, dataExplorerDebugDoType, DEBUG_READ_MAX_LIMIT, DEBUG_READ_DEFAULT_LIMIT, DEBUG_DO_HEX_PREFIX, debugDoEntityId, debugTableName, dataExplorerDebugTablesParam, dataExplorerDebugRowsParam, dataExplorerDebugRowsQuery, dataExplorerDebugAnalyticsTable, debugUuid, dataExplorerDebugAnalyticsRowsParam, dataExplorerDebugAnalyticsRowsQuery, debugHubConvParam, debugMessageIdQuery, sandboxEgressPolicy, SANDBOX_EXEC_MAX_CMD_LENGTH, SANDBOX_EXEC_MAX_ALLOWLIST, SANDBOX_EXEC_MAX_TIMEOUT_MS, adminSandboxExecBody, whatsappCallbackBody, authMeResponse, wsTicketResponse, sessionCheckResponse, logoutResponse, magicCodeSendBody, magicCodeSendResponse, magicCodeVerifyBody, magicCodeVerifyResponse, browserParams, browserFoldersQuery, browserFilesQuery, stateOperationBody, conversationListResourcesQuery, conversationReadResourceQuery, listPendingSchedulesQuery, listHubAggregateSchedulesQuery, reportSourceSchema, intakeReportSourceSchema, reportClassificationSchema, reportStatusSchema, reportLocaleSchema, reportMessageAuthorRoleSchema, sentryRefStatusSchema, createReportBody, editReportBody, contestReportBody, reporterListQuery, listReportsQuery, GITHUB_ISSUE_URL_REGEX, githubIssueUrlSchema, transitionReportBody, groupReportsBody, holdReportBody, clickhouseReadyResponse, bootstrapQuery, requestSnapshotChunkMessage, MAX_NAME_LENGTH, MAX_VALUE_LENGTH, MAX_TAGS, MAX_TAG_LENGTH, MAX_SCOPE_HUBS, MAX_SCOPE_TAGS, vaultSecretScopeSchema, vaultCreateBody, vaultUpdateBody, PERMISSIONS, MAX_NAME_LENGTH2, MAX_HUBS_PER_GRANT, MAX_HUB_TAGS_PER_GRANT, MAX_GRANTS, permissionEnum, grantScopeSchema, grantSchema, createTokenBody, tokenOrgIdParam, tokenGrantScopeSchema, tokenGrantSchema, tokenMetadataSchema, listTokensResponse, createTokenResponse, orgTokenSummarySchema, listOrgTokensResponse, invitePreviewQuery, invitePreviewResponse, discordTier, discordBillingCycle, discordMetadata, discordOAuthStartResponse, discordOAuthFinalizeBody, discordOAuthFinalizeResponse, discordDisconnectResponse, jsonSchemaSchema, hubUserIdentity, stateValueEntry, getHubUserContextResponse, updateHubUserBody, updateHubUserResponse, unlockHubUserNameResponse, stateResetParams, stateResetResponse, hubAlertsParam, hubAlertSeverity, hubAlert, hubAlertsListResponse, noticeSeveritySchema, noticeStatusSchema, NOTICE_SCOPE_REGEX, noticeScopeSchema, noticeLinkSchema, createNoticeBody, updateNoticeBody, listNoticesQuery, noticeIdParamSchema, templateLocaleSchema, TEMPLATE_SLUG_REGEX, templateSlugSchema, templateStatusSchema, templateFileMapSchema, templateTextSchema, templateUsesEntrySchema, templateUsesSchema, templateYamlLocaleEntry, templateYamlWayaiBlock, templateTagsSchema, templateYamlSchema, templateHeroSchema, templatePushLocaleSchema, templatePushBody, templateListQuery, templateSlugParam, templateDetailQuery, ADMIN_SKILL_NAME_REGEX, adminSkillNameParam, WAYAI_WORKSPACE_LAYOUT, MAX_RESOURCE_FILE_SIZE;
5599
5775
  var init_dist = __esm({
5600
5776
  "../../packages/core/dist/index.js"() {
5601
5777
  "use strict";
@@ -5748,6 +5924,16 @@ var init_dist = __esm({
5748
5924
  }
5749
5925
  [LLM_PROVIDER_HTTP_BRAND] = true;
5750
5926
  };
5927
+ LLM_PROVIDER_CONTENT_BRAND = /* @__PURE__ */ Symbol.for("wayai.LlmProviderContentError");
5928
+ LlmProviderContentError = class extends Error {
5929
+ constructor(message, provider, providerError) {
5930
+ super(redactSecrets(message));
5931
+ this.provider = provider;
5932
+ this.providerError = providerError;
5933
+ this.name = "LlmProviderContentError";
5934
+ }
5935
+ [LLM_PROVIDER_CONTENT_BRAND] = true;
5936
+ };
5751
5937
  LLM_PROVIDER_TIMEOUT_BRAND = /* @__PURE__ */ Symbol.for("wayai.LlmProviderTimeoutError");
5752
5938
  LlmProviderTimeoutError = class extends Error {
5753
5939
  constructor(message, provider) {
@@ -11784,6 +11970,7 @@ var push_exports = {};
11784
11970
  __export(push_exports, {
11785
11971
  autoRenameAgentFiles: () => autoRenameAgentFiles,
11786
11972
  createAndPushNewHub: () => createAndPushNewHub,
11973
+ printErrors: () => printErrors,
11787
11974
  printSyncResult: () => printSyncResult,
11788
11975
  printWarnings: () => printWarnings,
11789
11976
  pushCommand: () => pushCommand,
@@ -11814,6 +12001,10 @@ function shouldWarnIgnoredPreviewLabel(localLabel, serverLabel) {
11814
12001
  return Boolean(localLabel) && serverLabel !== void 0 && localLabel !== serverLabel;
11815
12002
  }
11816
12003
  function printSyncResult(result) {
12004
+ if (result.errors && result.errors.length > 0) {
12005
+ printErrors(result.errors);
12006
+ throw new Error(`Sync failed with ${result.errors.length} error(s). No completion was reported; inspect the errors above.`);
12007
+ }
11817
12008
  console.log(`
11818
12009
  Sync complete. Preview hub: ${result.preview_hub_id}`);
11819
12010
  const c = result.changes;
@@ -11860,9 +12051,6 @@ Sync complete. Preview hub: ${result.preview_hub_id}`);
11860
12051
  if (parts.length > 0) {
11861
12052
  console.log(`Changes: ${parts.join(", ")}`);
11862
12053
  }
11863
- if (result.errors && result.errors.length > 0) {
11864
- printWarnings(result.errors);
11865
- }
11866
12054
  if (result.warnings && result.warnings.length > 0) {
11867
12055
  printWarnings(result.warnings.map((w) => w.message));
11868
12056
  }
@@ -11875,6 +12063,14 @@ function printWarnings(warnings) {
11875
12063
  console.log(` \x1B[33m! ${w}\x1B[0m`);
11876
12064
  }
11877
12065
  }
12066
+ function printErrors(errors) {
12067
+ if (errors.length === 0) return;
12068
+ console.error(`
12069
+ \x1B[31mErrors (${errors.length}):\x1B[0m`);
12070
+ for (const error of errors) {
12071
+ console.error(` \x1B[31m! ${error}\x1B[0m`);
12072
+ }
12073
+ }
11878
12074
  async function autoRenameAgentFiles(client, hubId, hubFolder, organizationId) {
11879
12075
  const agentsDir = path15.join(hubFolder, "agents");
11880
12076
  let agentsWithIds = [];