@wayai/cli 0.3.41 → 0.3.43
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 +207 -141
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4547,7 +4547,7 @@ function slugifyKebab(input, maxLength = 64) {
|
|
|
4547
4547
|
function slugifySkillName(name) {
|
|
4548
4548
|
return slugifyKebab(name, 64);
|
|
4549
4549
|
}
|
|
4550
|
-
var APP_ERROR_BRAND, AppError, LLM_RATE_LIMIT_BRAND, LlmRateLimitError, LLM_PROVIDER_HTTP_BRAND, LlmProviderHttpError, 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, uuidSchema, paginationSchema, timestampSchema, idParamSchema, primaryRegionSchema, placementSourceSchema, orgIdParam, orgAdminIdParam, createOrganizationBody, updateOrganizationBody, addOrgAdminBody, agentIdParam, listAgentsQuery, agentConnectionsQuery, createAgentBody, updateAgentBody, SLUG_REGEX, slugSchema, INVISIBLE_NAME_CHARS, MAX_KANBAN_STATUSES, MAX_FOLLOWUPS_PER_STATUS, MAX_ADDITIONAL_CONTEXT_SCHEMA_BYTES, RESERVED_TEMPLATE_DUMP_NAME, kanbanStatusSlugSchema, followupSchema, EXCLUSIVE_FLAG_PAIRS, kanbanStatusSchema, kanbanStatusesArraySchema,
|
|
4550
|
+
var APP_ERROR_BRAND, AppError, LLM_RATE_LIMIT_BRAND, LlmRateLimitError, LLM_PROVIDER_HTTP_BRAND, LlmProviderHttpError, 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, uuidSchema, paginationSchema, timestampSchema, idParamSchema, primaryRegionSchema, placementSourceSchema, orgIdParam, orgAdminIdParam, createOrganizationBody, updateOrganizationBody, addOrgAdminBody, SUMMARIZATION_THRESHOLD_MIN, SUMMARIZATION_THRESHOLD_MAX, summarizationThresholdField, monitorConfigField, agentIdParam, listAgentsQuery, agentConnectionsQuery, createAgentBody, updateAgentBody, SLUG_REGEX, slugSchema, INVISIBLE_NAME_CHARS, MAX_KANBAN_STATUSES, MAX_FOLLOWUPS_PER_STATUS, MAX_ADDITIONAL_CONTEXT_SCHEMA_BYTES, RESERVED_TEMPLATE_DUMP_NAME, kanbanStatusSlugSchema, followupSchema, EXCLUSIVE_FLAG_PAIRS, kanbanStatusSchema, kanbanStatusesArraySchema, hubIdParam, hubAdminIdParam, hubUserIdParam, hubIdentityIdParam, hubTeamIdParam, hubTeamUserDeleteParam, hubSchemaQuery, createHubBody, updateHubBody, addHubAdminBody, addHubIdentityAuthorizationBody, contactDecisionBody, approveContactBody, listContactAccessQuery, createHubTeamBody, updateHubTeamBody, addHubTeamUserBody, reassignHubUserBody, replicatePreviewBody, claimCodeChannelParam, claimCodeDeleteParam, connectionIdParam, connectorIdParam, listConnectionsQuery, deleteConnectionQuery, addConnectionBody, editConnectionBody, 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, 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, PACING_INTERVAL_MIN_MS, PACING_INTERVAL_MAX_MS, EVAL_RUN_DEADLINE_MIN_MS, EVAL_RUN_DEADLINE_MAX_MS, paginationSchema2, evalIdParam, sessionIdParam, scenarioSetIdParam, hubIdQuery, createEvalBody, updateEvalBody, getEvalsQuery, toggleEvalBody, bulkToggleEvalsBody, pacingConfigSchema, sessionConfigSchema, createSessionBody, getSessionsQuery, getSessionResultsQuery, getSessionRunsQuery, evalAnalyticsQuery, getSessionCostQuery, compareSessionsQuery, evalsSqlBody, evalsSqlSchemaQuery, exportResultsQuery, validateEvalBody, hubAgentsQuery, createScenarioSetBody, updateScenarioSetBody, scenarioSetsHubQuery, createScenarioFromConversationBody, getConversationsQuery, getMessagesQuery, updateUserBody, updateProfileBody, pathnameRegex, updatePreferencesBody, activityQuery, deletionModeSchema, deletionRequestBody, archiveHubIdParam, archiveConversationParams, archiveListQuery, archiveMessageObservabilityParams, conversationIdParam, claimBody, releaseBody, transferBody, closeBody, additionalContextPayloadSchema, kanbanUpdateBody, observabilityParams, observabilityListParams, deleteUserConversationsBody, sendMessageBody, listConversationsQuery, getConversationDetailParams, getConversationDetailQuery, listWhatsAppTemplatesQuery, sendWhatsAppTemplateBody, billingOrgIdParam, subscriptionItemParams, spendCapBody, growthPacksBody, portalSessionBody, checkoutSessionBody, updateBillingCurrencyBody, invoicesQuery, downloadBody, uploadQuery, signUrlBody, completionsBody, 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, adminOrganizationsQuery, adminUserSearchQuery, kanbanSlugMigrationQuery, adjustQuotaBody, updatePlanBody, addAdminUserBody, updatePlatformConfigBody, updateFreeOrgLimitBody, 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, whatsappCallbackBody, authMeResponse, wsTicketResponse, sessionCheckResponse, logoutResponse, 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, WAYAI_WORKSPACE_LAYOUT, MAX_RESOURCE_FILE_SIZE;
|
|
4551
4551
|
var init_dist = __esm({
|
|
4552
4552
|
"../../packages/core/dist/index.js"() {
|
|
4553
4553
|
"use strict";
|
|
@@ -4761,6 +4761,19 @@ var init_dist = __esm({
|
|
|
4761
4761
|
addOrgAdminBody = external_exports.object({
|
|
4762
4762
|
user_email: external_exports.string().email("valid email is required")
|
|
4763
4763
|
});
|
|
4764
|
+
SUMMARIZATION_THRESHOLD_MIN = 1e3;
|
|
4765
|
+
SUMMARIZATION_THRESHOLD_MAX = 1e6;
|
|
4766
|
+
summarizationThresholdField = external_exports.number().int().min(SUMMARIZATION_THRESHOLD_MIN).max(SUMMARIZATION_THRESHOLD_MAX).nullable().optional();
|
|
4767
|
+
monitorConfigField = external_exports.object({
|
|
4768
|
+
delay_seconds: external_exports.number().int().min(10),
|
|
4769
|
+
flag_conditions: external_exports.array(
|
|
4770
|
+
external_exports.object({
|
|
4771
|
+
variable: external_exports.string(),
|
|
4772
|
+
operator: external_exports.enum(["=", "!="]),
|
|
4773
|
+
value: external_exports.union([external_exports.string(), external_exports.number()])
|
|
4774
|
+
})
|
|
4775
|
+
).optional()
|
|
4776
|
+
}).passthrough().nullable().optional();
|
|
4764
4777
|
agentIdParam = external_exports.object({
|
|
4765
4778
|
id: uuidSchema
|
|
4766
4779
|
});
|
|
@@ -4774,10 +4787,14 @@ var init_dist = __esm({
|
|
|
4774
4787
|
agent_name: external_exports.string().min(1),
|
|
4775
4788
|
hub_id: uuidSchema,
|
|
4776
4789
|
agent_role: external_exports.enum(AGENT_ROLES),
|
|
4777
|
-
additional_context_template: external_exports.string().max(2e4).optional()
|
|
4790
|
+
additional_context_template: external_exports.string().max(2e4).optional(),
|
|
4791
|
+
summarization_threshold_tokens: summarizationThresholdField,
|
|
4792
|
+
monitor_config: monitorConfigField
|
|
4778
4793
|
}).passthrough();
|
|
4779
4794
|
updateAgentBody = external_exports.object({
|
|
4780
|
-
additional_context_template: external_exports.string().max(2e4).optional()
|
|
4795
|
+
additional_context_template: external_exports.string().max(2e4).optional(),
|
|
4796
|
+
summarization_threshold_tokens: summarizationThresholdField,
|
|
4797
|
+
monitor_config: monitorConfigField
|
|
4781
4798
|
}).passthrough();
|
|
4782
4799
|
SLUG_REGEX = /^[a-z][a-z0-9_]{0,49}$/;
|
|
4783
4800
|
slugSchema = external_exports.string().regex(
|
|
@@ -4934,8 +4951,6 @@ var init_dist = __esm({
|
|
|
4934
4951
|
});
|
|
4935
4952
|
});
|
|
4936
4953
|
});
|
|
4937
|
-
SUMMARIZATION_THRESHOLD_MIN = 1e3;
|
|
4938
|
-
SUMMARIZATION_THRESHOLD_MAX = 1e6;
|
|
4939
4954
|
hubIdParam = external_exports.object({ id: uuidSchema });
|
|
4940
4955
|
hubAdminIdParam = external_exports.object({ id: uuidSchema, adminId: uuidSchema });
|
|
4941
4956
|
hubUserIdParam = external_exports.object({ id: uuidSchema, hubUserId: uuidSchema });
|
|
@@ -4956,7 +4971,8 @@ var init_dist = __esm({
|
|
|
4956
4971
|
unassigned_policy: external_exports.enum(["default_team", "auto_assign_random", "auto_assign_round_robin", "pull_queue"]).optional(),
|
|
4957
4972
|
default_hub_team_id: uuidSchema.nullable().optional(),
|
|
4958
4973
|
kanban_statuses: kanbanStatusesArraySchema.nullable().optional(),
|
|
4959
|
-
summarization_threshold_tokens
|
|
4974
|
+
// summarization_threshold_tokens relocated to the summarizer AGENT (PR4) — validated/
|
|
4975
|
+
// persisted via the agent path (.passthrough() agent body → HubDO column), not here.
|
|
4960
4976
|
auto_close_inactive_days: external_exports.number().int().min(1).max(180).optional(),
|
|
4961
4977
|
// Channel contact access control. Enum-validated explicitly (not via passthrough)
|
|
4962
4978
|
// so `language`/`access_approval_role` can't reach the DB with an invalid value.
|
|
@@ -6844,6 +6860,15 @@ function findGitRoot() {
|
|
|
6844
6860
|
return null;
|
|
6845
6861
|
}
|
|
6846
6862
|
}
|
|
6863
|
+
function findRepoRootSync() {
|
|
6864
|
+
let current = process.cwd();
|
|
6865
|
+
while (true) {
|
|
6866
|
+
if (fs2.existsSync(path2.join(current, ".git"))) return current;
|
|
6867
|
+
const parent = path2.dirname(current);
|
|
6868
|
+
if (parent === current) return null;
|
|
6869
|
+
current = parent;
|
|
6870
|
+
}
|
|
6871
|
+
}
|
|
6847
6872
|
function detectWorkspace() {
|
|
6848
6873
|
const gitRoot = findGitRoot();
|
|
6849
6874
|
if (!gitRoot) return null;
|
|
@@ -7297,8 +7322,8 @@ var init_utils = __esm({
|
|
|
7297
7322
|
});
|
|
7298
7323
|
|
|
7299
7324
|
// src/lib/version-cache.ts
|
|
7300
|
-
import { existsSync as existsSync4, readFileSync as readFileSync5 } from "fs";
|
|
7301
|
-
import { join as join6 } from "path";
|
|
7325
|
+
import { existsSync as existsSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync2, mkdirSync } from "fs";
|
|
7326
|
+
import { dirname as dirname3, join as join6 } from "path";
|
|
7302
7327
|
import { homedir as homedir2 } from "os";
|
|
7303
7328
|
function getVersionCachePath(filename = CLI_CACHE_FILE) {
|
|
7304
7329
|
return join6(homedir2(), ".wayai", filename);
|
|
@@ -7321,6 +7346,20 @@ function readCachedLatest(filename = CLI_CACHE_FILE, maxAgeMs = MAX_AGE_24H_MS)
|
|
|
7321
7346
|
if (Date.now() - cache.lastCheck > maxAgeMs) return null;
|
|
7322
7347
|
return cache.latest;
|
|
7323
7348
|
}
|
|
7349
|
+
function isVersionCacheStale(filename = CLI_CACHE_FILE, maxAgeMs = MAX_AGE_24H_MS) {
|
|
7350
|
+
const cache = readVersionCache(filename);
|
|
7351
|
+
if (!cache) return true;
|
|
7352
|
+
return Date.now() - cache.lastCheck > maxAgeMs;
|
|
7353
|
+
}
|
|
7354
|
+
function writeVersionCache(filename, cache) {
|
|
7355
|
+
const path19 = getVersionCachePath(filename);
|
|
7356
|
+
const dir = dirname3(path19);
|
|
7357
|
+
if (!existsSync4(dir)) mkdirSync(dir, { recursive: true });
|
|
7358
|
+
writeFileSync2(path19, JSON.stringify(cache));
|
|
7359
|
+
}
|
|
7360
|
+
function touchVersionCache(filename) {
|
|
7361
|
+
writeVersionCache(filename, { lastCheck: Date.now(), latest: readVersionCache(filename)?.latest ?? null });
|
|
7362
|
+
}
|
|
7324
7363
|
var MAX_AGE_24H_MS, CLI_CACHE_FILE, SKILL_CACHE_FILE;
|
|
7325
7364
|
var init_version_cache = __esm({
|
|
7326
7365
|
"src/lib/version-cache.ts"() {
|
|
@@ -8519,7 +8558,7 @@ async function tryOpenBrowser(url) {
|
|
|
8519
8558
|
return false;
|
|
8520
8559
|
}
|
|
8521
8560
|
try {
|
|
8522
|
-
const { execFile
|
|
8561
|
+
const { execFile } = await import("child_process");
|
|
8523
8562
|
const platform2 = process.platform;
|
|
8524
8563
|
let cmd;
|
|
8525
8564
|
let args2;
|
|
@@ -8534,7 +8573,7 @@ async function tryOpenBrowser(url) {
|
|
|
8534
8573
|
args2 = [url];
|
|
8535
8574
|
}
|
|
8536
8575
|
return new Promise((resolve4) => {
|
|
8537
|
-
|
|
8576
|
+
execFile(cmd, args2, (err) => resolve4(!err));
|
|
8538
8577
|
});
|
|
8539
8578
|
} catch {
|
|
8540
8579
|
return false;
|
|
@@ -8895,20 +8934,20 @@ __export(init_exports, {
|
|
|
8895
8934
|
parseArgs: () => parseArgs3,
|
|
8896
8935
|
writeWorkspaceFiles: () => writeWorkspaceFiles
|
|
8897
8936
|
});
|
|
8898
|
-
import { existsSync as existsSync8, mkdirSync as
|
|
8937
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync4, writeFileSync as writeFileSync6 } from "fs";
|
|
8899
8938
|
import path9 from "path";
|
|
8900
8939
|
function writeWorkspaceFiles(gitRoot) {
|
|
8901
8940
|
const created = [];
|
|
8902
8941
|
for (const { name, content } of SHIM_FILES) {
|
|
8903
8942
|
const filePath = path9.join(gitRoot, name);
|
|
8904
8943
|
if (!existsSync8(filePath)) {
|
|
8905
|
-
|
|
8944
|
+
writeFileSync6(filePath, content);
|
|
8906
8945
|
created.push(name);
|
|
8907
8946
|
}
|
|
8908
8947
|
}
|
|
8909
8948
|
const hubsDir = resolveLayout(gitRoot).hubsDir;
|
|
8910
8949
|
if (!existsSync8(hubsDir)) {
|
|
8911
|
-
|
|
8950
|
+
mkdirSync4(hubsDir, { recursive: true });
|
|
8912
8951
|
created.push(`${path9.relative(gitRoot, hubsDir)}/`);
|
|
8913
8952
|
}
|
|
8914
8953
|
return created;
|
|
@@ -12058,7 +12097,7 @@ function refineHubAsCodeKanbanStatuses2(config, ctx) {
|
|
|
12058
12097
|
}
|
|
12059
12098
|
}
|
|
12060
12099
|
}
|
|
12061
|
-
var uuidSchema2, paginationSchema3, timestampSchema2, idParamSchema2, primaryRegionSchema2, placementSourceSchema2, orgIdParam2, orgAdminIdParam2, createOrganizationBody2, updateOrganizationBody2, addOrgAdminBody2, AUTH_TYPE2, ORG_CREDENTIAL_AUTH_TYPES2, AUTH_TYPE_DISPLAY2, LEGACY_AUTH_TYPE_MAP2, VALID_AUTH_TYPES2, AGENT_ROLES2, SAFE_USER_ID_REGEX2, agentIdParam2, listAgentsQuery2, agentConnectionsQuery2, createAgentBody2, updateAgentBody2, SLUG_REGEX2, slugSchema2, INVISIBLE_NAME_CHARS2, MAX_KANBAN_STATUSES2, MAX_FOLLOWUPS_PER_STATUS2, MAX_ADDITIONAL_CONTEXT_SCHEMA_BYTES2, RESERVED_TEMPLATE_DUMP_NAME2, kanbanStatusSlugSchema2, followupSchema2, EXCLUSIVE_FLAG_PAIRS2, kanbanStatusSchema2, kanbanStatusesArraySchema2,
|
|
12100
|
+
var uuidSchema2, paginationSchema3, timestampSchema2, idParamSchema2, primaryRegionSchema2, placementSourceSchema2, orgIdParam2, orgAdminIdParam2, createOrganizationBody2, updateOrganizationBody2, addOrgAdminBody2, AUTH_TYPE2, ORG_CREDENTIAL_AUTH_TYPES2, AUTH_TYPE_DISPLAY2, LEGACY_AUTH_TYPE_MAP2, VALID_AUTH_TYPES2, AGENT_ROLES2, SAFE_USER_ID_REGEX2, SUMMARIZATION_THRESHOLD_MIN2, SUMMARIZATION_THRESHOLD_MAX2, summarizationThresholdField2, monitorConfigField2, agentIdParam2, listAgentsQuery2, agentConnectionsQuery2, createAgentBody2, updateAgentBody2, SLUG_REGEX2, slugSchema2, INVISIBLE_NAME_CHARS2, MAX_KANBAN_STATUSES2, MAX_FOLLOWUPS_PER_STATUS2, MAX_ADDITIONAL_CONTEXT_SCHEMA_BYTES2, RESERVED_TEMPLATE_DUMP_NAME2, kanbanStatusSlugSchema2, followupSchema2, EXCLUSIVE_FLAG_PAIRS2, kanbanStatusSchema2, kanbanStatusesArraySchema2, hubIdParam2, hubAdminIdParam2, hubUserIdParam2, hubIdentityIdParam2, hubTeamIdParam2, hubTeamUserDeleteParam2, hubSchemaQuery2, createHubBody2, updateHubBody2, addHubAdminBody2, addHubIdentityAuthorizationBody2, contactDecisionBody2, approveContactBody2, listContactAccessQuery2, createHubTeamBody2, updateHubTeamBody2, addHubTeamUserBody2, reassignHubUserBody2, replicatePreviewBody2, claimCodeChannelParam2, claimCodeDeleteParam2, connectionIdParam2, connectorIdParam2, listConnectionsQuery2, deleteConnectionQuery2, addConnectionBody2, editConnectionBody2, registerWhatsappQuery2, registerWhatsappBody2, retryProvisioningQuery2, resendDomainStatusQuery2, PLACEHOLDER_TOKENS2, ALLOWED_TYPES2, SUBSCHEMA_OBJECT_KEYWORDS2, SUBSCHEMA_LIST_KEYWORDS2, SUBSCHEMA_MAP_KEYWORDS2, MAX_SCHEMA_DEPTH2, toolIdParam2, listToolsQuery2, toolAgentQuery2, deleteToolQuery2, toolConnectionsQuery2, nativeToolIdSchema2, addNativeToolBody2, addMcpToolBody2, createCustomToolBody2, updateCustomToolBody2, updateToolExecutionConfigBody2, initialValueCreateSchema2, initialValueUpdateSchema2, stateIdParam2, listStatesQuery2, stateNameSchema2, createStateBody2, updateStateBody2, reorderStatesBody2, orgTagIdParam2, listOrgTagsQuery2, createOrgTagBody2, updateOrgTagBody2, orgCredentialIdParam2, listOrgCredentialsQuery2, createOrgCredentialBody2, updateOrgCredentialBody2, orgResourceIdParam2, orgResourceFileIdParam2, orgResourceFolderIdParam2, hubOrgResourceParam2, listOrgResourcesQuery2, orgIdQuery2, createOrgResourceBody2, updateOrgResourceBody2, createOrgResourceFolderBody2, updateOrgResourceFolderBody2, uploadOrgResourceFileBody2, updateOrgResourceFileBody2, uploadOrgSkillZipBody2, linkOrgResourceBody2, resourceIdParam2, listResourcesQuery2, createResourceBody2, updateResourceBody2, syncSkillsBody2, resourceFileIdParam2, listResourceFilesQuery2, createResourceFileBody2, updateResourceFileBody2, uploadResourceFileBody2, uploadSkillZipBody2, resourceFolderIdParam2, listResourceFoldersQuery2, createResourceFolderBody2, updateResourceFolderBody2, agentResourceQuery2, hubResourceQuery2, linkAgentResourceBody2, updateAgentResourceBody2, unlinkAgentResourceQuery2, navItemSchema2, hubCountResetBody2, navItemCountResetBody2, typingBody2, analyticsHubIdParam2, analyticsVariableIdParam2, updateVariablePinBody2, updateAnalyticsViewBody2, NUMERIC_FILTER_OPS2, TEXT_FILTER_OPS2, CATEGORICAL_FILTER_OPS2, VARIABLE_FILTER_OPS2, STRUCTURED_QUERY_OPS2, STRUCTURED_QUERY_AGGREGATIONS2, filterValueSchema2, conversationsBody2, analyticsConversationIdParam2, messagesQuery2, conversationDetailDataQuery2, analyticsDataBody2, structuredQueryBody2, analyticsSqlBody2, analyticsSqlSchemaQuery2, PACING_INTERVAL_MIN_MS2, PACING_INTERVAL_MAX_MS2, EVAL_RUN_DEADLINE_MIN_MS2, EVAL_RUN_DEADLINE_MAX_MS2, paginationSchema22, evalIdParam2, sessionIdParam2, scenarioSetIdParam2, hubIdQuery2, createEvalBody2, updateEvalBody2, getEvalsQuery2, toggleEvalBody2, bulkToggleEvalsBody2, pacingConfigSchema2, sessionConfigSchema2, createSessionBody2, getSessionsQuery2, getSessionResultsQuery2, getSessionRunsQuery2, evalAnalyticsQuery2, getSessionCostQuery2, compareSessionsQuery2, evalsSqlBody2, evalsSqlSchemaQuery2, exportResultsQuery2, validateEvalBody2, hubAgentsQuery2, createScenarioSetBody2, updateScenarioSetBody2, scenarioSetsHubQuery2, createScenarioFromConversationBody2, getConversationsQuery2, getMessagesQuery2, updateUserBody2, updateProfileBody2, pathnameRegex2, updatePreferencesBody2, activityQuery2, deletionModeSchema2, deletionRequestBody2, archiveHubIdParam2, archiveConversationParams2, archiveListQuery2, archiveMessageObservabilityParams2, conversationIdParam2, claimBody2, releaseBody2, transferBody2, closeBody2, additionalContextPayloadSchema2, kanbanUpdateBody2, observabilityParams2, observabilityListParams2, deleteUserConversationsBody2, sendMessageBody2, listConversationsQuery2, getConversationDetailParams2, getConversationDetailQuery2, listWhatsAppTemplatesQuery2, sendWhatsAppTemplateBody2, billingOrgIdParam2, subscriptionItemParams2, spendCapBody2, growthPacksBody2, portalSessionBody2, checkoutSessionBody2, updateBillingCurrencyBody2, invoicesQuery2, downloadBody2, uploadQuery2, signUrlBody2, completionsBody2, outboundSchemaQuery2, templateIdParam2, listTemplatesQuery2, deleteTemplateQuery2, templateStatusQuery2, createTemplateBody2, updateTemplateBody2, submitTemplateBody2, testTemplateBody2, contactIdParam2, listContactsQuery2, createContactBody2, updateContactBody2, listIdParam2, listListsQuery2, listListContactsQuery2, createListBody2, updateListBody2, addListContactsBody2, removeListContactsBody2, scheduleIdParam2, listSchedulesQuery2, listExecutionsQuery2, createScheduleBody2, updateScheduleBody2, uuidPattern2, ciUuidSchema2, hubAsCodeConfigSchema2, ciPullHubIdParam2, ciBranchParam2, ciPullQuery2, ciHubsQuery2, ciLookupQuery2, ciBranchesQuery2, ciSyncBody2, ciPushBody2, ciDiffBody2, ciPublishBody2, ciPublishPreviewBody2, ciSyncMcpBody2, ciOrgResourcesParam2, orgResourcesConfigSchema2, ciOrgResourcesPushBody2, ciOrgResourcesDiffBody2, adminOrgIdParam2, adminOrgAdminIdParam2, adminUserIdParam2, adminPlanIdParam2, adminOrganizationsQuery2, adminUserSearchQuery2, kanbanSlugMigrationQuery2, adjustQuotaBody2, updatePlanBody2, addAdminUserBody2, updatePlatformConfigBody2, updateFreeOrgLimitBody2, updatePricingPlanBody2, dataExplorerSearchQuery2, dataExplorerOrgIdParam2, dataExplorerHubIdParam2, dataExplorerConvIdParam2, dataExplorerDoInstancesQuery2, dataExplorerNsIdParam2, dataExplorerKvKeysQuery2, dataExplorerKvKeyParam2, uuidOrHexId2, dataExplorerDeleteOrgParam2, dataExplorerDeleteHubParam2, dataExplorerDeleteConvParam2, dataExplorerDeleteUserParam2, dataExplorerDeleteQuery2, dataExplorerKvDeleteQuery2, pitrDoNamespace2, pitrBookmarkParam2, pitrRestoreBody2, healthSamplingTriggerBody2, dataExplorerDebugDoType2, DEBUG_READ_MAX_LIMIT2, DEBUG_READ_DEFAULT_LIMIT2, DEBUG_DO_HEX_PREFIX2, debugDoEntityId2, debugTableName2, dataExplorerDebugTablesParam2, dataExplorerDebugRowsParam2, dataExplorerDebugRowsQuery2, dataExplorerDebugAnalyticsTable2, debugUuid2, dataExplorerDebugAnalyticsRowsParam2, dataExplorerDebugAnalyticsRowsQuery2, debugHubConvParam2, debugMessageIdQuery2, whatsappCallbackBody2, authMeResponse2, wsTicketResponse2, sessionCheckResponse2, logoutResponse2, browserParams2, browserFoldersQuery2, browserFilesQuery2, stateOperationBody2, conversationListResourcesQuery2, conversationReadResourceQuery2, listPendingSchedulesQuery2, listHubAggregateSchedulesQuery2, reportSourceSchema2, intakeReportSourceSchema2, reportClassificationSchema2, reportStatusSchema2, reportLocaleSchema2, reportMessageAuthorRoleSchema2, sentryRefStatusSchema2, createReportBody2, editReportBody2, contestReportBody2, reporterListQuery2, listReportsQuery2, GITHUB_ISSUE_URL_REGEX2, githubIssueUrlSchema2, transitionReportBody2, groupReportsBody2, holdReportBody2, clickhouseReadyResponse2, bootstrapQuery2, requestSnapshotChunkMessage2, MAX_NAME_LENGTH3, MAX_VALUE_LENGTH2, MAX_TAGS2, MAX_TAG_LENGTH2, MAX_SCOPE_HUBS2, MAX_SCOPE_TAGS2, vaultSecretScopeSchema2, vaultCreateBody2, vaultUpdateBody2, PERMISSIONS2, MAX_NAME_LENGTH22, MAX_HUBS_PER_GRANT2, MAX_HUB_TAGS_PER_GRANT2, MAX_GRANTS2, permissionEnum2, grantScopeSchema2, grantSchema2, createTokenBody2, tokenOrgIdParam2, tokenGrantScopeSchema2, tokenGrantSchema2, tokenMetadataSchema2, listTokensResponse2, createTokenResponse2, orgTokenSummarySchema2, listOrgTokensResponse2, invitePreviewQuery2, invitePreviewResponse2, discordTier2, discordBillingCycle2, discordMetadata2, discordOAuthStartResponse2, discordOAuthFinalizeBody2, discordOAuthFinalizeResponse2, discordDisconnectResponse2, jsonSchemaSchema2, hubUserIdentity2, stateValueEntry2, getHubUserContextResponse2, updateHubUserBody2, updateHubUserResponse2, unlockHubUserNameResponse2, stateResetParams2, stateResetResponse2, hubAlertsParam2, hubAlertSeverity2, hubAlert2, hubAlertsListResponse2, noticeSeveritySchema2, noticeStatusSchema2, NOTICE_SCOPE_REGEX2, noticeScopeSchema2, noticeLinkSchema2, createNoticeBody2, updateNoticeBody2, listNoticesQuery2, noticeIdParamSchema2;
|
|
12062
12101
|
var init_contracts = __esm({
|
|
12063
12102
|
"../../packages/core/dist/contracts/index.js"() {
|
|
12064
12103
|
"use strict";
|
|
@@ -12197,6 +12236,19 @@ var init_contracts = __esm({
|
|
|
12197
12236
|
"summarizer"
|
|
12198
12237
|
];
|
|
12199
12238
|
SAFE_USER_ID_REGEX2 = /^[A-Za-z0-9_-]{1,64}$/;
|
|
12239
|
+
SUMMARIZATION_THRESHOLD_MIN2 = 1e3;
|
|
12240
|
+
SUMMARIZATION_THRESHOLD_MAX2 = 1e6;
|
|
12241
|
+
summarizationThresholdField2 = external_exports.number().int().min(SUMMARIZATION_THRESHOLD_MIN2).max(SUMMARIZATION_THRESHOLD_MAX2).nullable().optional();
|
|
12242
|
+
monitorConfigField2 = external_exports.object({
|
|
12243
|
+
delay_seconds: external_exports.number().int().min(10),
|
|
12244
|
+
flag_conditions: external_exports.array(
|
|
12245
|
+
external_exports.object({
|
|
12246
|
+
variable: external_exports.string(),
|
|
12247
|
+
operator: external_exports.enum(["=", "!="]),
|
|
12248
|
+
value: external_exports.union([external_exports.string(), external_exports.number()])
|
|
12249
|
+
})
|
|
12250
|
+
).optional()
|
|
12251
|
+
}).passthrough().nullable().optional();
|
|
12200
12252
|
agentIdParam2 = external_exports.object({
|
|
12201
12253
|
id: uuidSchema2
|
|
12202
12254
|
});
|
|
@@ -12210,10 +12262,14 @@ var init_contracts = __esm({
|
|
|
12210
12262
|
agent_name: external_exports.string().min(1),
|
|
12211
12263
|
hub_id: uuidSchema2,
|
|
12212
12264
|
agent_role: external_exports.enum(AGENT_ROLES2),
|
|
12213
|
-
additional_context_template: external_exports.string().max(2e4).optional()
|
|
12265
|
+
additional_context_template: external_exports.string().max(2e4).optional(),
|
|
12266
|
+
summarization_threshold_tokens: summarizationThresholdField2,
|
|
12267
|
+
monitor_config: monitorConfigField2
|
|
12214
12268
|
}).passthrough();
|
|
12215
12269
|
updateAgentBody2 = external_exports.object({
|
|
12216
|
-
additional_context_template: external_exports.string().max(2e4).optional()
|
|
12270
|
+
additional_context_template: external_exports.string().max(2e4).optional(),
|
|
12271
|
+
summarization_threshold_tokens: summarizationThresholdField2,
|
|
12272
|
+
monitor_config: monitorConfigField2
|
|
12217
12273
|
}).passthrough();
|
|
12218
12274
|
SLUG_REGEX2 = /^[a-z][a-z0-9_]{0,49}$/;
|
|
12219
12275
|
slugSchema2 = external_exports.string().regex(
|
|
@@ -12370,8 +12426,6 @@ var init_contracts = __esm({
|
|
|
12370
12426
|
});
|
|
12371
12427
|
});
|
|
12372
12428
|
});
|
|
12373
|
-
SUMMARIZATION_THRESHOLD_MIN2 = 1e3;
|
|
12374
|
-
SUMMARIZATION_THRESHOLD_MAX2 = 1e6;
|
|
12375
12429
|
hubIdParam2 = external_exports.object({ id: uuidSchema2 });
|
|
12376
12430
|
hubAdminIdParam2 = external_exports.object({ id: uuidSchema2, adminId: uuidSchema2 });
|
|
12377
12431
|
hubUserIdParam2 = external_exports.object({ id: uuidSchema2, hubUserId: uuidSchema2 });
|
|
@@ -12392,7 +12446,8 @@ var init_contracts = __esm({
|
|
|
12392
12446
|
unassigned_policy: external_exports.enum(["default_team", "auto_assign_random", "auto_assign_round_robin", "pull_queue"]).optional(),
|
|
12393
12447
|
default_hub_team_id: uuidSchema2.nullable().optional(),
|
|
12394
12448
|
kanban_statuses: kanbanStatusesArraySchema2.nullable().optional(),
|
|
12395
|
-
summarization_threshold_tokens
|
|
12449
|
+
// summarization_threshold_tokens relocated to the summarizer AGENT (PR4) — validated/
|
|
12450
|
+
// persisted via the agent path (.passthrough() agent body → HubDO column), not here.
|
|
12396
12451
|
auto_close_inactive_days: external_exports.number().int().min(1).max(180).optional(),
|
|
12397
12452
|
// Channel contact access control. Enum-validated explicitly (not via passthrough)
|
|
12398
12453
|
// so `language`/`access_approval_role` can't reach the DB with an invalid value.
|
|
@@ -14344,11 +14399,6 @@ Available metrics:
|
|
|
14344
14399
|
console.log(` Avg response time: ${formatMinutes(s.avg_response_time)}`);
|
|
14345
14400
|
console.log(` AI response time: ${formatMinutes(s.assistant_response_time)}`);
|
|
14346
14401
|
console.log(` Support response time: ${formatMinutes(s.support_response_time)}`);
|
|
14347
|
-
if (s.threshold1_minutes) {
|
|
14348
|
-
console.log(` SLA (< ${s.threshold1_minutes}min): ${(s.rate_under_threshold1 * 100).toFixed(1)}%`);
|
|
14349
|
-
console.log(` SLA (< ${s.threshold2_minutes}min): ${(s.rate_under_threshold2 * 100).toFixed(1)}%`);
|
|
14350
|
-
console.log(` SLA (< ${s.threshold3_minutes}min): ${(s.rate_under_threshold3 * 100).toFixed(1)}%`);
|
|
14351
|
-
}
|
|
14352
14402
|
}
|
|
14353
14403
|
if (result.analytics && result.analytics.length > 0) {
|
|
14354
14404
|
console.log("\nMetrics:");
|
|
@@ -16229,7 +16279,7 @@ var init_admin = __esm({
|
|
|
16229
16279
|
|
|
16230
16280
|
// src/commands/report-create.ts
|
|
16231
16281
|
import { readFileSync as readFileSync14 } from "fs";
|
|
16232
|
-
import { dirname as
|
|
16282
|
+
import { dirname as dirname7, join as join19 } from "path";
|
|
16233
16283
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
16234
16284
|
function getCliVersion() {
|
|
16235
16285
|
try {
|
|
@@ -16340,7 +16390,7 @@ var init_report_create = __esm({
|
|
|
16340
16390
|
init_auth();
|
|
16341
16391
|
init_repo_config();
|
|
16342
16392
|
init_api_client();
|
|
16343
|
-
__dirname =
|
|
16393
|
+
__dirname = dirname7(fileURLToPath2(import.meta.url));
|
|
16344
16394
|
}
|
|
16345
16395
|
});
|
|
16346
16396
|
|
|
@@ -16616,18 +16666,125 @@ var init_update = __esm({
|
|
|
16616
16666
|
// src/index.ts
|
|
16617
16667
|
init_sentry();
|
|
16618
16668
|
init_utils();
|
|
16669
|
+
import { readFileSync as readFileSync15 } from "fs";
|
|
16670
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
16671
|
+
import { dirname as dirname8, join as join20 } from "path";
|
|
16672
|
+
|
|
16673
|
+
// src/lib/version-refresh.ts
|
|
16674
|
+
init_version_cache();
|
|
16675
|
+
init_skill_version();
|
|
16676
|
+
import { exec } from "child_process";
|
|
16677
|
+
var REFRESH_TIMEOUT_MS = 1e4;
|
|
16678
|
+
function refreshCliCache() {
|
|
16679
|
+
return new Promise((resolve4) => {
|
|
16680
|
+
exec("npm view @wayai/cli version", { timeout: REFRESH_TIMEOUT_MS }, (err, stdout) => {
|
|
16681
|
+
if (!err) {
|
|
16682
|
+
const latest = stdout.trim();
|
|
16683
|
+
if (latest) {
|
|
16684
|
+
try {
|
|
16685
|
+
writeVersionCache(CLI_CACHE_FILE, { lastCheck: Date.now(), latest });
|
|
16686
|
+
} catch {
|
|
16687
|
+
}
|
|
16688
|
+
}
|
|
16689
|
+
}
|
|
16690
|
+
resolve4();
|
|
16691
|
+
});
|
|
16692
|
+
});
|
|
16693
|
+
}
|
|
16694
|
+
async function refreshSkillCache() {
|
|
16695
|
+
const url = process.env.WAYAI_SKILL_RAW_URL || DEFAULT_SKILL_RAW_URL;
|
|
16696
|
+
const controller = new AbortController();
|
|
16697
|
+
const timer = setTimeout(() => controller.abort(), REFRESH_TIMEOUT_MS);
|
|
16698
|
+
try {
|
|
16699
|
+
const res = await fetch(url, { signal: controller.signal });
|
|
16700
|
+
if (res.ok) {
|
|
16701
|
+
const latest = parseFrontmatterVersion(await res.text());
|
|
16702
|
+
if (latest) {
|
|
16703
|
+
try {
|
|
16704
|
+
writeVersionCache(SKILL_CACHE_FILE, { lastCheck: Date.now(), latest });
|
|
16705
|
+
} catch {
|
|
16706
|
+
}
|
|
16707
|
+
}
|
|
16708
|
+
}
|
|
16709
|
+
} catch {
|
|
16710
|
+
} finally {
|
|
16711
|
+
clearTimeout(timer);
|
|
16712
|
+
}
|
|
16713
|
+
}
|
|
16714
|
+
async function refreshVersionCaches(opts) {
|
|
16715
|
+
await Promise.all([
|
|
16716
|
+
opts.cli ? refreshCliCache() : Promise.resolve(),
|
|
16717
|
+
opts.skill ? refreshSkillCache() : Promise.resolve()
|
|
16718
|
+
]);
|
|
16719
|
+
}
|
|
16720
|
+
|
|
16721
|
+
// src/lib/update-nudge.ts
|
|
16722
|
+
init_utils();
|
|
16619
16723
|
init_version_cache();
|
|
16620
16724
|
init_skill_version();
|
|
16621
16725
|
init_workspace();
|
|
16622
|
-
import {
|
|
16623
|
-
|
|
16624
|
-
|
|
16625
|
-
|
|
16626
|
-
|
|
16726
|
+
import { spawn } from "child_process";
|
|
16727
|
+
var REFRESH_COMMAND = "__refresh-version-cache";
|
|
16728
|
+
var ENV_REFRESH_CLI = "WAYAI_REFRESH_CLI";
|
|
16729
|
+
var ENV_REFRESH_SKILL = "WAYAI_REFRESH_SKILL";
|
|
16730
|
+
function isUpdateCheckDisabled() {
|
|
16731
|
+
return Boolean(
|
|
16732
|
+
process.env.NO_UPDATE_NOTIFIER || process.env.WAYAI_NO_UPDATE_CHECK || process.env.CI
|
|
16733
|
+
);
|
|
16734
|
+
}
|
|
16735
|
+
function scheduleVersionRefresh(opts, entryPath) {
|
|
16736
|
+
try {
|
|
16737
|
+
if (opts.cli) touchVersionCache(CLI_CACHE_FILE);
|
|
16738
|
+
if (opts.skill) touchVersionCache(SKILL_CACHE_FILE);
|
|
16739
|
+
spawn(process.execPath, [entryPath, REFRESH_COMMAND], {
|
|
16740
|
+
detached: true,
|
|
16741
|
+
stdio: "ignore",
|
|
16742
|
+
windowsHide: true,
|
|
16743
|
+
// no flashing console window on Windows (fires on every command past the TTL)
|
|
16744
|
+
env: {
|
|
16745
|
+
...process.env,
|
|
16746
|
+
[ENV_REFRESH_CLI]: opts.cli ? "1" : "",
|
|
16747
|
+
[ENV_REFRESH_SKILL]: opts.skill ? "1" : ""
|
|
16748
|
+
}
|
|
16749
|
+
}).unref();
|
|
16750
|
+
} catch {
|
|
16751
|
+
}
|
|
16752
|
+
}
|
|
16753
|
+
function showUpdateNudges(currentVersion, entryPath) {
|
|
16754
|
+
if (isUpdateCheckDisabled() || !process.stderr.isTTY) return;
|
|
16755
|
+
try {
|
|
16756
|
+
const cliLatest = readVersionCache(CLI_CACHE_FILE)?.latest ?? null;
|
|
16757
|
+
if (cliLatest && isNewerVersion(cliLatest, currentVersion)) {
|
|
16758
|
+
console.error(`
|
|
16759
|
+
Update available: ${currentVersion} \u2192 ${cliLatest}
|
|
16760
|
+
Run \`wayai update\` to update.`);
|
|
16761
|
+
}
|
|
16762
|
+
const installs = findInstalledSkills(findRepoRootSync() ?? process.cwd());
|
|
16763
|
+
const localSkillVersion = installs.length > 0 ? lowestInstalledVersion(installs) : null;
|
|
16764
|
+
if (localSkillVersion) {
|
|
16765
|
+
const skillLatest = readVersionCache(SKILL_CACHE_FILE)?.latest ?? null;
|
|
16766
|
+
if (skillLatest && isNewerVersion(skillLatest, localSkillVersion)) {
|
|
16767
|
+
console.error(`
|
|
16768
|
+
Skill update available: ${localSkillVersion} \u2192 ${skillLatest}
|
|
16769
|
+
Run \`npx skills add wayai-pro/wayai-skill -y\` to update.`);
|
|
16770
|
+
}
|
|
16771
|
+
}
|
|
16772
|
+
const cliStale = isVersionCacheStale(CLI_CACHE_FILE);
|
|
16773
|
+
const skillStale = localSkillVersion !== null && isVersionCacheStale(SKILL_CACHE_FILE);
|
|
16774
|
+
if (cliStale || skillStale) {
|
|
16775
|
+
scheduleVersionRefresh({ cli: cliStale, skill: skillStale }, entryPath);
|
|
16776
|
+
}
|
|
16777
|
+
} catch {
|
|
16778
|
+
}
|
|
16779
|
+
}
|
|
16780
|
+
|
|
16781
|
+
// src/index.ts
|
|
16782
|
+
var __dirname2 = dirname8(fileURLToPath3(import.meta.url));
|
|
16627
16783
|
var pkg = JSON.parse(readFileSync15(join20(__dirname2, "..", "package.json"), "utf-8"));
|
|
16628
16784
|
var [, , command, ...args] = process.argv;
|
|
16785
|
+
var isBackgroundRefresh = command === REFRESH_COMMAND;
|
|
16629
16786
|
var OWN_HELP_COMMANDS = /* @__PURE__ */ new Set(["eval", "admin", "report"]);
|
|
16630
|
-
initSentry(command);
|
|
16787
|
+
if (!isBackgroundRefresh) initSentry(command);
|
|
16631
16788
|
async function main() {
|
|
16632
16789
|
if (shouldInterceptHelp(command, args, OWN_HELP_COMMANDS)) {
|
|
16633
16790
|
printHelp3();
|
|
@@ -16880,119 +17037,28 @@ Examples:
|
|
|
16880
17037
|
`.trim());
|
|
16881
17038
|
}
|
|
16882
17039
|
var SKIP_UPDATE_CHECK = ["--version", "-v", "--help", "-h", "help", "update"];
|
|
16883
|
-
|
|
16884
|
-
function isUpdateCheckDisabled() {
|
|
16885
|
-
return Boolean(
|
|
16886
|
-
process.env.NO_UPDATE_NOTIFIER || process.env.WAYAI_NO_UPDATE_CHECK || process.env.CI
|
|
16887
|
-
);
|
|
16888
|
-
}
|
|
16889
|
-
function checkForUpdates() {
|
|
16890
|
-
if (isUpdateCheckDisabled()) return;
|
|
17040
|
+
async function runForeground() {
|
|
16891
17041
|
try {
|
|
16892
|
-
|
|
16893
|
-
|
|
16894
|
-
|
|
16895
|
-
if (cache && Date.now() - cache.lastCheck < UPDATE_CHECK_INTERVAL_MS) {
|
|
16896
|
-
if (cache.latest && isNewerVersion(cache.latest, pkg.version)) {
|
|
16897
|
-
console.error(
|
|
16898
|
-
`
|
|
16899
|
-
Update available: ${pkg.version} \u2192 ${cache.latest}
|
|
16900
|
-
Run \`wayai update\` to update.`
|
|
16901
|
-
);
|
|
16902
|
-
}
|
|
16903
|
-
return;
|
|
17042
|
+
await main();
|
|
17043
|
+
if (command && !SKIP_UPDATE_CHECK.includes(command) && !wantsHelp(args)) {
|
|
17044
|
+
showUpdateNudges(pkg.version, fileURLToPath3(import.meta.url));
|
|
16904
17045
|
}
|
|
16905
|
-
|
|
16906
|
-
|
|
16907
|
-
|
|
16908
|
-
|
|
17046
|
+
await closeSentry();
|
|
17047
|
+
} catch (err) {
|
|
17048
|
+
if (shouldReportToSentry(err)) {
|
|
17049
|
+
captureException2(err);
|
|
16909
17050
|
}
|
|
16910
|
-
|
|
16911
|
-
|
|
16912
|
-
|
|
16913
|
-
{ timeout: 5e3, shell: true },
|
|
16914
|
-
(err, stdout) => {
|
|
16915
|
-
if (err) return;
|
|
16916
|
-
const latest = stdout.trim();
|
|
16917
|
-
try {
|
|
16918
|
-
writeFileSync11(cachePath, JSON.stringify({ lastCheck: Date.now(), latest }));
|
|
16919
|
-
} catch {
|
|
16920
|
-
}
|
|
16921
|
-
if (latest && isNewerVersion(latest, pkg.version)) {
|
|
16922
|
-
console.error(
|
|
16923
|
-
`
|
|
16924
|
-
Update available: ${pkg.version} \u2192 ${latest}
|
|
16925
|
-
Run \`wayai update\` to update.`
|
|
16926
|
-
);
|
|
16927
|
-
}
|
|
16928
|
-
}
|
|
16929
|
-
);
|
|
16930
|
-
} catch {
|
|
17051
|
+
await closeSentry();
|
|
17052
|
+
console.error(err instanceof Error ? err.message : String(err));
|
|
17053
|
+
process.exit(1);
|
|
16931
17054
|
}
|
|
16932
17055
|
}
|
|
16933
|
-
|
|
16934
|
-
|
|
16935
|
-
|
|
16936
|
-
|
|
16937
|
-
|
|
16938
|
-
|
|
16939
|
-
|
|
16940
|
-
if (!localVersion) return;
|
|
16941
|
-
const cachePath = getVersionCachePath(SKILL_CACHE_FILE);
|
|
16942
|
-
const cacheDir = dirname7(cachePath);
|
|
16943
|
-
const cache = readVersionCache(SKILL_CACHE_FILE);
|
|
16944
|
-
if (cache && Date.now() - cache.lastCheck < UPDATE_CHECK_INTERVAL_MS) {
|
|
16945
|
-
if (cache.latest && isNewerVersion(cache.latest, localVersion)) {
|
|
16946
|
-
console.error(
|
|
16947
|
-
`
|
|
16948
|
-
Skill update available: ${localVersion} \u2192 ${cache.latest}
|
|
16949
|
-
Run \`npx skills add wayai-pro/wayai-skill -y\` to update.`
|
|
16950
|
-
);
|
|
16951
|
-
}
|
|
16952
|
-
return;
|
|
16953
|
-
}
|
|
16954
|
-
try {
|
|
16955
|
-
if (!existsSync15(cacheDir)) mkdirSync10(cacheDir, { recursive: true });
|
|
16956
|
-
writeFileSync11(cachePath, JSON.stringify({ lastCheck: Date.now(), latest: cache?.latest ?? null }));
|
|
16957
|
-
} catch {
|
|
16958
|
-
}
|
|
16959
|
-
const url = process.env.WAYAI_SKILL_RAW_URL || DEFAULT_SKILL_RAW_URL;
|
|
16960
|
-
const controller = new AbortController();
|
|
16961
|
-
const timer = setTimeout(() => controller.abort(), 5e3);
|
|
16962
|
-
fetch(url, { signal: controller.signal }).then((res) => res.ok ? res.text() : null).then((text) => {
|
|
16963
|
-
clearTimeout(timer);
|
|
16964
|
-
if (!text) return;
|
|
16965
|
-
const latest = parseFrontmatterVersion(text);
|
|
16966
|
-
if (!latest) return;
|
|
16967
|
-
try {
|
|
16968
|
-
writeFileSync11(cachePath, JSON.stringify({ lastCheck: Date.now(), latest }));
|
|
16969
|
-
} catch {
|
|
16970
|
-
}
|
|
16971
|
-
if (isNewerVersion(latest, localVersion)) {
|
|
16972
|
-
console.error(
|
|
16973
|
-
`
|
|
16974
|
-
Skill update available: ${localVersion} \u2192 ${latest}
|
|
16975
|
-
Run \`npx skills add wayai-pro/wayai-skill -y\` to update.`
|
|
16976
|
-
);
|
|
16977
|
-
}
|
|
16978
|
-
}).catch(() => {
|
|
16979
|
-
clearTimeout(timer);
|
|
16980
|
-
});
|
|
16981
|
-
} catch {
|
|
16982
|
-
}
|
|
17056
|
+
if (isBackgroundRefresh) {
|
|
17057
|
+
void refreshVersionCaches({
|
|
17058
|
+
cli: process.env[ENV_REFRESH_CLI] === "1",
|
|
17059
|
+
skill: process.env[ENV_REFRESH_SKILL] === "1"
|
|
17060
|
+
}).finally(() => process.exit(0));
|
|
17061
|
+
} else {
|
|
17062
|
+
void runForeground();
|
|
16983
17063
|
}
|
|
16984
|
-
main().then(async () => {
|
|
16985
|
-
if (command && !SKIP_UPDATE_CHECK.includes(command) && !wantsHelp(args)) {
|
|
16986
|
-
checkForUpdates();
|
|
16987
|
-
checkForSkillUpdates();
|
|
16988
|
-
}
|
|
16989
|
-
await closeSentry();
|
|
16990
|
-
}).catch(async (err) => {
|
|
16991
|
-
if (shouldReportToSentry(err)) {
|
|
16992
|
-
captureException2(err);
|
|
16993
|
-
}
|
|
16994
|
-
await closeSentry();
|
|
16995
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
16996
|
-
process.exit(1);
|
|
16997
|
-
});
|
|
16998
17064
|
//# sourceMappingURL=index.js.map
|