@wayai/cli 0.3.200 → 0.3.201
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 +945 -650
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9724,7 +9724,7 @@ var init_chunk_T2RKGBYS = __esm({
|
|
|
9724
9724
|
}
|
|
9725
9725
|
});
|
|
9726
9726
|
|
|
9727
|
-
// ../../packages/core/dist/chunk-
|
|
9727
|
+
// ../../packages/core/dist/chunk-KGAVH3Z7.js
|
|
9728
9728
|
function cacheReconcileIdCount(body) {
|
|
9729
9729
|
return body.conversations.length + body.histories.reduce((n, history) => n + history.conversation_ids.length, 0) + body.threads.length;
|
|
9730
9730
|
}
|
|
@@ -9784,9 +9784,9 @@ function parseCommunityLessonVideoUrl(url) {
|
|
|
9784
9784
|
}
|
|
9785
9785
|
return id !== void 0 && YOUTUBE_ID.test(id) ? { provider: "youtube", id } : null;
|
|
9786
9786
|
}
|
|
9787
|
-
var connectionIdParam, connectorIdParam, listConnectionsQuery, deleteConnectionQuery, addConnectionBody, editConnectionBody, PRODUCTION_DIRECT_FIELDS, setProductionCredentialBody, registerWhatsappQuery, registerWhatsappBody, retryProvisioningQuery, resendDomainStatusQuery, 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, ORG_TAG_NAME_REGEX, ORG_TAG_NAME_MAX_LENGTH, createOrgTagBody, updateOrgTagBody, orgCredentialIdParam, listOrgCredentialsQuery, createOrgCredentialBody, updateOrgCredentialBody, BASE_CREDENTIAL_MANAGED_BY, BASE_CREDENTIAL_NAME_MAX, baseCredentialNameSchema, createBaseCredentialLinkBody, baseCredentialLinkParams, baseCredentialLinkQuery, 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, analyticsSqlTable, analyticsSqlSchemaQuery, getConversationsQuery, getMessagesQuery, appMessageSenderType, appMessageReceiverType, apiChannelMessage, apiChannelMessageBody, appMessageBody, appMessageResponse, CALL_STATUSES, callStatus, CALL_END_REASONS, callEndReason, CALL_TRANSPORTS, callTransport, CALL_PARTICIPANT_TYPES, callParticipantType, callInstant, MAX_SDP_OFFER_LENGTH, sdpDescription, sdpOffer, MAX_CALL_REQUEST_BODY_BYTES, hubScoped, callSummaryFields, callSummary, callIdParam, createCallBody, createCallResponse, callReadyBody, callHangupBody, callStatusQuery, MAX_REPORTED_DELEGATION_IDS, callDelegationId, callDelegationsBody, callResponse, MAX_CALL_RECORDING_GAPS, callRecordingGap, callRecordingNoteMetadata, evalCallInstant, EVAL_CALL_MIN_SECONDS, EVAL_CALL_MAX_SECONDS, EVAL_CALL_SPOKEN_LINE_MAX_CHARS, hubScoped2, createEvalCallBody, createEvalCallResponse, evalCallConversationQuery, evalCallRecordQuery, evalCallSpeaker, evalCallUtterance, evalCallTurn, evalCallRecording, evalCallRecordResponse, evalCallFinishResponse, updateUserBody, updateProfileBody, pathnameRegex, updatePreferencesBody, registerPushTokenBody, deletePushTokenQuery, recordAiDisclosureAcceptanceBody, activityQuery, deletionModeSchema, deletionRequestBody, CACHE_RECONCILE_MAX_IDS, CACHE_RECONCILE_MAX_HUBS, cacheReconcileScopeSchema, cachedConversationPageSchema, cachedHistoryThreadSchema, cachedPeopleThreadSchema, cacheReconcileBody, archiveHubIdParam, archiveConversationParams, archiveListQuery, archiveMessageObservabilityParams, conversationIdParam, conversationHubQuery, claimBody, releaseBody, transferBody, closeBody, additionalContextPayloadSchema, kanbanUpdateBody, annotateConversationBody, observabilityParams, observabilityListParams, deleteUserConversationsBody, deleteUserConversationsResponse, sendMessageBody, listConversationsQuery, flagSourceSchema, getConversationsResponse, getConversationDetailParams, getConversationDetailQuery, getConversationDetailResponse, listWhatsAppTemplatesQuery, sendWhatsAppTemplateBody, copilotSuggestBody, copilotSuggestResponse, CONSULT_THREAD_STATUSES, consultThreadStatus, CONSULT_THREAD_TITLE_MAX, consultThreadTitle, consultThreadSummary, listConsultThreadsQuery, listConsultThreadsResponse, createConsultThreadBody, createConsultThreadResponse, consultThreadIdParam, updateConsultThreadBody, updateConsultThreadResponse, CONSULT_AWAIT_TIMEOUT_MS, billingOrgIdParam, subscriptionItemParams, spendCapBody, growthPacksBody, portalSessionBody, checkoutSessionBody, updateBillingCurrencyBody, invoicesQuery, planKeySchema, billingStatusSchema, billingPlanTypeSchema, dataUsageCountersSchema, REKOR_ENTITLEMENT_CONTRACT_VERSION, entitlementProjectionSchema, rekorEntitlementRefreshMessageSchema, downloadBody, uploadQuery, SIGN_URL_MAX_EXPIRES_IN_SECONDS, signUrlBody, templateIdParam, listTemplatesQuery, deleteTemplateQuery, templateStatusQuery, createTemplateBody, updateTemplateBody, submitTemplateBody, testTemplateBody, CONTACT_ENVIRONMENTS, CONTACT_NAME_MAX, CONTACT_EMAIL_MAX, CONTACT_PHONE_INPUT_MAX, CONTACT_INSTAGRAM_SID_MAX, CONTACT_METADATA_MAX_BYTES, CONTACT_LABEL_MAX, CONTACT_LABELS_MAX, CONTACT_SCOPE_TAGS_MAX, CONTACT_PAGE_MAX, CONTACT_IMPORT_BATCH_MAX, CONTACT_SEARCH_MAX, CONTACT_LIST_NAME_MAX, CONTACT_LIST_NAME_REGEX, CONTACT_LIST_DESCRIPTION_MAX, CONTACT_LIST_FILTER_MAX, CONTACT_LIST_PINS_PER_REQUEST_MAX, SUPPRESSION_SCOPES, SUPPRESSION_ID_REGEX, contactName, contactPhone, contactEmail, contactInstagramSid, contactLabel, contactLabels, contactMetadata, scopeTagIds, contactVisibilitySchema, hasIdentity, IDENTITY_REQUIRED, contactBookOrgQuery, contactBookContactParam, contactBookListParam, contactBookHubParam, contactBookPageQuery, listContactBookContactsQuery, listHubContactBookContactsQuery, contactBookLinkCandidatesQuery, listContactBookListMembersQuery, contactRowFields, createContactBookContactBody, updateContactBookContactBody, contactImportRowSchema, importContactBookContactsBody, linkContactBookContactBody, listName, contactListFilterSchema, createContactBookListBody, updateContactBookListBody, updateContactBookListPinsBody, suppressionIdentitySchema, createContactBookSuppressionBody, contactBookSuppressionParam, listContactBookSuppressionsQuery, CONTACT_BOOK_EMAIL_UNSUBSCRIBE_PATH, contactBookEmailUnsubscribeTokenSchema, contactBookEmailUnsubscribeQuery, orgListReferenceSchema, hubListNameSchema, HUB_LIST_FILTER_REQUIRED, hubContactListFilterSchema, hubContactListIdParam, hubContactListHubQuery, description, createHubContactListBody, updateHubContactListBody, AUTOMATION_TRIGGER_TYPES, AUTOMATION_EVENT_TYPES, AUTOMATION_TARGET_TYPES, AUTOMATION_ACTION_TYPES, AUTOMATION_CHANNEL_TYPES, AUTOMATION_PURPOSES, AUTOMATION_NAME_MAX, AUTOMATION_DESCRIPTION_MAX, AUTOMATION_INSTRUCTIONS_MAX, AUTOMATION_TEXT_MAX, AUTOMATION_CRON_MAX, AUTOMATION_WEBHOOK_AUTHS, AUTOMATION_WEBHOOK_HEADERS, AUTOMATION_WEBHOOK_BODY_MAX_BYTES, AUTOMATION_WEBHOOK_HEADER_NAME_MAX, AUTOMATION_WEBHOOK_MOUNT, WEBHOOK_RESERVED_HEADERS, automationTriggerSchema, automationTargetSchema, automationActionSchema, automationGateSchema, automationName, automationDescription, automationIdParam, automationHubQuery, automationWebhookParams, AUTOMATION_RUNS_PAGE_MAX, listAutomationRunsQuery, createAutomationBody, updateAutomationBody, AUTOMATION_ALERT_CATEGORIES, AUTOMATION_BLOCKED_ALERT_CATEGORY, automationEventSubscriberParam, VERSION_PART, MOBILE_APP_VERSION_RE, mobileAppVersionSchema, MOBILE_PLATFORMS, mobilePlatformSchema, mobileVersionPolicyQuery, mobileVersionPolicySchema, mobileVersionPolicyResponse, 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, updatePlatformConfigBody, updateFreeOrgLimitBody, adminScopedTargetShape, adminScopedTargetBody, 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, 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, META_ENTITY_ID_PATTERN, metaEntityId, whatsappCallbackBody, authMeResponse, wsTicketResponse, sessionCheckResponse, logoutResponse, magicCodeSendBody, magicCodeSendResponse, magicCodeVerifyBody, magicCodeVerifyResponse, passwordLoginBody, stateOperationBody, conversationListResourcesQuery, conversationReadResourceQuery, listPendingSchedulesQuery, listHubAggregateSchedulesQuery, reportSourceSchema, intakeReportSourceSchema, reportClassificationSchema, reportStatusSchema, reportLocaleSchema, reportMessageAuthorRoleSchema, reportMessageSchema, sentryRefStatusSchema, createReportBody, editReportBody, reporterReportSummarySchema, reporterListResponseSchema, getReportResponseSchema, reporterTransitionResponseSchema, contestReportBody, reporterListQuery, listReportsQuery, GITHUB_ISSUE_URL_REGEX, githubIssueUrlSchema, transitionReportBody, groupReportsBody, holdReportBody, clickhouseReadyResponse, bootstrapQuery, MAX_NAME_LENGTH, MAX_VALUE_LENGTH, MAX_TAGS, MAX_TAG_LENGTH, MAX_SCOPE_HUBS, MAX_SCOPE_TAGS, vaultSecretScopeSchema, vaultCreateBody, vaultUpdateBody, MAX_NAME_LENGTH2, MAX_HUBS_PER_GRANT, MAX_HUB_TAGS_PER_GRANT, MAX_GRANTS, permissionEnum, grantScopeSchema, grantSchema, createTokenBody, tokenOrgIdParam, invitePreviewQuery, inviteRolePreviewResponse, inviteContactPreviewResponse, invitePreviewResponse, inviteUnsubscribeBody, jsonSchemaSchema, hubUserIdentity, stateValueEntry, getHubUserContextResponse, updateHubUserBody, updateHubUserResponse, unlockHubUserNameResponse, stateResetParams, stateResetResponse, hubAlertsParam, hubAlertSeverity, hubAlert, hubAlertsListResponse, noticeSeveritySchema, noticeStatusSchema, NOTICE_SCOPE_REGEX, noticeScopeSchema, noticeLinkSchema, createNoticeBody, updateNoticeBody, listNoticesQuery, noticeIdParamSchema, ADMIN_SKILL_NAME_REGEX, adminSkillNameParam, 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, DATA_PROXY_MOUNT, DATA_PROXY_PREFIX, REKOR_V1_PREFIX, DATA_PROXY_ORG_QUERY_PARAM, MAX_PROVISIONING_BODY_BYTES, dataProxyQuery, rekorAttestation, REQUIRED_REKOR_ATTESTATION_HEADERS, BASE_DESTRUCTION_MOUNT, BASE_DESTRUCTION_PREFIX, BASE_DESTRUCTION_CONFIRM_PATH, baseDestructionConfirmBody, BASE_DESTRUCTION_GRACE_MS, BASE_DESTRUCTION_CONFIRM_TTL_MS, BASE_DESTRUCTION_ORG_QUERY_PARAM, baseDestructionQuery, baseDestructionParam, baseDestructionInitiateBody, baseDestructionStatus, baseDestructionRequest, baseDestructionListResponse, baseDestructionInitiateResponse, baseDestructionConfirmResponse, baseDestructionCancelResponse, rekorBaseChangeMessageSchema, PEOPLE_CONTACT_PAGE_MAX, PEOPLE_CONTACT_PAGE_DEFAULT, PEOPLE_CONTACT_EMAIL_MAX_LENGTH, peopleUserIdSchema, peopleInviteEmailSchema, peopleContactInviteBody, peopleContactInviteIdParam, peopleContactUserIdParam, peopleContactBlockBody, peopleContactPageQuery, peopleOutgoingInviteSchema, peopleContactPersonSchema, peopleContactSchema, peopleIncomingInviteSchema, peopleBlockedUserSchema, PEOPLE_THREAD_MESSAGE_MAX_LENGTH, PEOPLE_THREAD_MESSAGES_PAGE_MAX, PEOPLE_THREAD_PAGE_MAX, PEOPLE_THREAD_PAGE_DEFAULT, PEOPLE_GROUP_NAME_MAX_LENGTH, PEOPLE_GROUP_AVATAR_URL_MAX_LENGTH, PEOPLE_THREAD_ATTACHMENT_MAX_BYTES, PEOPLE_THREAD_ATTACHMENT_NAME_MAX_LENGTH, PEOPLE_ATTACHMENT_STORAGE_PER_USER_BYTES, PEOPLE_THREAD_ATTACHMENT_MAX_MB, PEOPLE_THREAD_ATTACHMENT_URL_TTL_SECONDS, PEOPLE_THREAD_ATTACHMENT_URLS_MAX, peopleThreadIdParam, peopleThreadMessageIdParam, peopleThreadListQuery, peopleThreadMessagesQuery, peopleThreadAttachmentUploadSchema, peopleThreadSendBody, peopleThreadAttachmentUrlsBody, peopleThreadReadBody, peopleThreadSettingsBody, peopleGroupNameSchema, peopleGroupAvatarUrlSchema, peopleGroupCreateBody, peopleOrgDirectBody, peopleGroupUpdateBody, peopleGroupInviteBody, peopleOrgErasureBody, peopleGroupLeaveBody, peopleGroupInviteIdParam, peopleGroupIncomingInviteIdParam, peopleGroupMemberParam, peopleThreadKindSchema, peopleThreadMemberSchema, peopleThreadLastMessageSchema, peopleGroupRoleSchema, peopleGroupSummarySchema, peopleThreadSummarySchema, peopleThreadAttachmentSchema, peopleThreadMessageSchema, peopleGroupMemberSchema, peopleGroupSentInviteSchema, peopleGroupIncomingInviteSchema, PEOPLE_REPORT_DETAILS_MAX_LENGTH, peopleReportReasonSchema, reportDetailsSchema, reportFields, peopleReportBody, PEOPLE_MODERATION_NOTE_MAX_LENGTH, ADMIN_PEOPLE_REPORTS_PAGE_MAX, ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT, peopleModerationActionSchema, moderationNoteSchema, adminPeopleReportListQuery, adminPeopleReportIdParam, adminPeopleMessageRemovalBody, adminPeopleSuspendBody, adminPeopleNoteBody, COMMUNITIES_PER_ORG_MAX, COMMUNITY_NAME_MAX_LENGTH, COMMUNITY_REGISTRY_CLOSED_REASON, COMMUNITY_JOIN_SOURCE_MAX_LENGTH, COMMUNITY_JOIN_FLOW_TOKEN_MAX_LENGTH, COMMUNITY_ROOM_NAME_MAX_LENGTH, COMMUNITY_MESSAGE_MAX_LENGTH, COMMUNITY_MESSAGES_PAGE_SIZE, COMMUNITY_ATTACHMENT_URLS_MAX, COMMUNITY_POST_TITLE_MAX_LENGTH, COMMUNITY_POST_SEARCH_MAX_LENGTH, COMMUNITY_RULES_MAX_LENGTH, COMMUNITY_SLOW_MODE_MAX_SECONDS, COMMUNITY_COURSES_LABEL_MAX_LENGTH, COMMUNITY_LIVE_TICKET_PREFIX, communityNameSchema, adminCreateCommunityBody, communityIdParam, communityJoinTokenSchema, communityJoinSourceSchema, communityJoinPreviewQuery, communityJoinBody, communityRoomKindSchema, communityRoomNameSchema, communityRoomIdParam, communityMessageIdParam, communityRoomCreateBody, communityRoomUpdateBody, communityMessagesQuery, communityMessageBodySchema, communityPostTitleSchema, communityAttachmentUploadSchema, communitySendBody, communityEditBody, communityPostIdParam, communityPostsQuery, communityAnswerBody, communityReadBody, communityAttachmentUrlsBody, communityPersonParam, communityOrgParam, communityPeopleQuery, communityCoursesLabelSchema, communitySettingsBody, communityBanBody, communityLockBody, communityPinBody, communityModLogQuery, communityReportsQuery, communityReportIdParam, communityLiveTicketSchema, communityLiveQuery, communityMuteBody, communityEmailUnsubscribeTokenSchema, COMMUNITY_EMAIL_UNSUBSCRIBE_PATH, communityEmailUnsubscribeQuery, COMMUNITY_COURSE_TITLE_MAX_LENGTH, COMMUNITY_COURSE_DESCRIPTION_MAX_LENGTH, COMMUNITY_LESSON_BODY_MAX_LENGTH, COMMUNITY_LESSON_LINKS_MAX, COMMUNITY_LESSON_URL_MAX_LENGTH, YOUTUBE_ID, YOUTUBE_HOSTS, YOUTU_BE, YOUTUBE_ID_PATH, communityCourseIdParam, communityCourseModuleIdParam, communityLessonIdParam, communityCourseTitleSchema, communityCourseDescriptionSchema, communityCoursePositionSchema, communityLessonVideoUrlSchema, communityLessonLinkSchema, communityLessonLinksSchema, communityLessonBodySchema, communityCourseCreateBody, communityCourseUpdateBody, communityModuleCreateBody, communityModuleUpdateBody, communityLessonCreateBody, communityLessonUpdateBody, COMMUNITY_LESSON_TREE_MAX_BYTES, COMMUNITY_LESSON_LINK_PROTOCOLS, LINK_SCHEME, adminSetGuideHubBody, GUIDE_HUB_INELIGIBLE_REASON;
|
|
9788
|
-
var
|
|
9789
|
-
"../../packages/core/dist/chunk-
|
|
9787
|
+
var connectionIdParam, connectorIdParam, listConnectionsQuery, deleteConnectionQuery, addConnectionBody, editConnectionBody, PRODUCTION_DIRECT_FIELDS, setProductionCredentialBody, registerWhatsappQuery, registerWhatsappBody, retryProvisioningQuery, resendDomainStatusQuery, 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, ORG_TAG_NAME_REGEX, ORG_TAG_NAME_MAX_LENGTH, createOrgTagBody, updateOrgTagBody, orgCredentialIdParam, listOrgCredentialsQuery, createOrgCredentialBody, updateOrgCredentialBody, BASE_CREDENTIAL_MANAGED_BY, BASE_CREDENTIAL_NAME_MAX, baseCredentialNameSchema, createBaseCredentialLinkBody, baseCredentialLinkParams, baseCredentialLinkQuery, 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, analyticsSqlTable, analyticsSqlSchemaQuery, getConversationsQuery, getMessagesQuery, appMessageSenderType, appMessageReceiverType, apiChannelMessage, apiChannelMessageBody, appMessageBody, appMessageResponse, CALL_STATUSES, callStatus, CALL_END_REASONS, callEndReason, CALL_TRANSPORTS, callTransport, CALL_PARTICIPANT_TYPES, callParticipantType, callInstant, MAX_SDP_OFFER_LENGTH, sdpDescription, sdpOffer, MAX_CALL_REQUEST_BODY_BYTES, hubScoped, callSummaryFields, callSummary, callIdParam, createCallBody, createCallResponse, callReadyBody, callHangupBody, callStatusQuery, MAX_REPORTED_DELEGATION_IDS, callDelegationId, callDelegationsBody, callResponse, MAX_CALL_RECORDING_GAPS, callRecordingGap, callRecordingNoteMetadata, evalCallInstant, EVAL_CALL_MIN_SECONDS, EVAL_CALL_MAX_SECONDS, EVAL_CALL_SPOKEN_LINE_MAX_CHARS, hubScoped2, createEvalCallBody, createEvalCallResponse, evalCallConversationQuery, evalCallRecordQuery, evalCallSpeaker, evalCallUtterance, evalCallTurn, evalCallRecording, evalCallRecordResponse, evalCallFinishResponse, updateUserBody, updateProfileBody, pathnameRegex, updatePreferencesBody, registerPushTokenBody, deletePushTokenQuery, recordAiDisclosureAcceptanceBody, activityQuery, deletionModeSchema, deletionRequestBody, CACHE_RECONCILE_MAX_IDS, CACHE_RECONCILE_MAX_HUBS, cacheReconcileScopeSchema, cachedConversationPageSchema, cachedHistoryThreadSchema, cachedPeopleThreadSchema, cacheReconcileBody, archiveHubIdParam, archiveConversationParams, archiveListQuery, archiveMessageObservabilityParams, conversationIdParam, conversationHubQuery, claimBody, releaseBody, transferBody, closeBody, additionalContextPayloadSchema, kanbanUpdateBody, annotateConversationBody, observabilityParams, observabilityListParams, deleteUserConversationsBody, deleteUserConversationsResponse, sendMessageBody, listConversationsQuery, flagSourceSchema, getConversationsResponse, getConversationDetailParams, getConversationDetailQuery, getConversationDetailResponse, listWhatsAppTemplatesQuery, sendWhatsAppTemplateBody, copilotSuggestBody, copilotSuggestResponse, CONSULT_THREAD_STATUSES, consultThreadStatus, CONSULT_THREAD_TITLE_MAX, consultThreadTitle, consultThreadSummary, listConsultThreadsQuery, listConsultThreadsResponse, createConsultThreadBody, createConsultThreadResponse, consultThreadIdParam, updateConsultThreadBody, updateConsultThreadResponse, CONSULT_AWAIT_TIMEOUT_MS, billingOrgIdParam, subscriptionItemParams, spendCapBody, growthPacksBody, portalSessionBody, checkoutSessionBody, updateBillingCurrencyBody, invoicesQuery, planKeySchema, billingStatusSchema, billingPlanTypeSchema, dataUsageCountersSchema, REKOR_ENTITLEMENT_CONTRACT_VERSION, entitlementProjectionSchema, rekorEntitlementRefreshMessageSchema, downloadBody, uploadQuery, SIGN_URL_MAX_EXPIRES_IN_SECONDS, signUrlBody, templateIdParam, listTemplatesQuery, deleteTemplateQuery, templateStatusQuery, createTemplateBody, updateTemplateBody, submitTemplateBody, testTemplateBody, CONTACT_ENVIRONMENTS, CONTACT_NAME_MAX, CONTACT_EMAIL_MAX, CONTACT_PHONE_INPUT_MAX, CONTACT_INSTAGRAM_SID_MAX, CONTACT_METADATA_MAX_BYTES, CONTACT_LABEL_MAX, CONTACT_LABELS_MAX, CONTACT_SCOPE_TAGS_MAX, CONTACT_PAGE_MAX, CONTACT_IMPORT_BATCH_MAX, CONTACT_SEARCH_MAX, CONTACT_LIST_NAME_MAX, CONTACT_LIST_NAME_REGEX, CONTACT_LIST_DESCRIPTION_MAX, CONTACT_LIST_FILTER_MAX, CONTACT_LIST_PINS_PER_REQUEST_MAX, SUPPRESSION_SCOPES, SUPPRESSION_ID_REGEX, contactName, contactPhone, contactEmail, contactInstagramSid, contactLabel, contactLabels, contactMetadata, scopeTagIds, contactVisibilitySchema, hasIdentity, IDENTITY_REQUIRED, contactBookOrgQuery, contactBookContactParam, contactBookListParam, contactBookHubParam, contactBookPageQuery, listContactBookContactsQuery, listHubContactBookContactsQuery, contactBookLinkCandidatesQuery, listContactBookListMembersQuery, contactRowFields, createContactBookContactBody, updateContactBookContactBody, contactImportRowSchema, importContactBookContactsBody, linkContactBookContactBody, listName, contactListFilterSchema, createContactBookListBody, updateContactBookListBody, updateContactBookListPinsBody, suppressionIdentitySchema, createContactBookSuppressionBody, contactBookSuppressionParam, listContactBookSuppressionsQuery, CONTACT_BOOK_EMAIL_UNSUBSCRIBE_PATH, contactBookEmailUnsubscribeTokenSchema, contactBookEmailUnsubscribeQuery, orgListReferenceSchema, hubListNameSchema, HUB_LIST_FILTER_REQUIRED, hubContactListFilterSchema, hubContactListIdParam, hubContactListHubQuery, description, createHubContactListBody, updateHubContactListBody, AUTOMATION_TRIGGER_TYPES, AUTOMATION_EVENT_TYPES, AUTOMATION_TARGET_TYPES, AUTOMATION_ACTION_TYPES, AUTOMATION_CHANNEL_TYPES, AUTOMATION_PURPOSES, AUTOMATION_NAME_MAX, AUTOMATION_DESCRIPTION_MAX, AUTOMATION_INSTRUCTIONS_MAX, AUTOMATION_TEXT_MAX, AUTOMATION_CRON_MAX, AUTOMATION_WEBHOOK_AUTHS, AUTOMATION_WEBHOOK_HEADERS, AUTOMATION_WEBHOOK_BODY_MAX_BYTES, AUTOMATION_WEBHOOK_HEADER_NAME_MAX, AUTOMATION_WEBHOOK_MOUNT, WEBHOOK_RESERVED_HEADERS, automationTriggerSchema, automationTargetSchema, automationActionSchema, automationGateSchema, automationName, automationDescription, automationIdParam, automationHubQuery, automationWebhookParams, AUTOMATION_RUNS_PAGE_MAX, listAutomationRunsQuery, createAutomationBody, updateAutomationBody, AUTOMATION_ALERT_CATEGORIES, AUTOMATION_BLOCKED_ALERT_CATEGORY, automationEventSubscriberParam, VERSION_PART, MOBILE_APP_VERSION_RE, mobileAppVersionSchema, MOBILE_PLATFORMS, mobilePlatformSchema, mobileVersionPolicyQuery, mobileVersionPolicySchema, mobileVersionPolicyResponse, 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, updatePlatformConfigBody, updateFreeOrgLimitBody, adminScopedTargetShape, adminScopedTargetBody, 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, 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, META_ENTITY_ID_PATTERN, metaEntityId, whatsappCallbackBody, authMeResponse, wsTicketResponse, sessionCheckResponse, logoutResponse, magicCodeSendBody, magicCodeSendResponse, magicCodeVerifyBody, magicCodeVerifyResponse, passwordLoginBody, stateOperationBody, conversationListResourcesQuery, conversationReadResourceQuery, listPendingSchedulesQuery, listHubAggregateSchedulesQuery, reportSourceSchema, intakeReportSourceSchema, reportClassificationSchema, reportStatusSchema, reportLocaleSchema, reportMessageAuthorRoleSchema, reportMessageSchema, sentryRefStatusSchema, createReportBody, editReportBody, reporterReportSummarySchema, reporterListResponseSchema, getReportResponseSchema, reporterTransitionResponseSchema, contestReportBody, reporterListQuery, listReportsQuery, GITHUB_ISSUE_URL_REGEX, githubIssueUrlSchema, transitionReportBody, groupReportsBody, holdReportBody, clickhouseReadyResponse, bootstrapQuery, MAX_NAME_LENGTH, MAX_VALUE_LENGTH, MAX_TAGS, MAX_TAG_LENGTH, MAX_SCOPE_HUBS, MAX_SCOPE_TAGS, vaultSecretScopeSchema, vaultCreateBody, vaultUpdateBody, MAX_NAME_LENGTH2, MAX_HUBS_PER_GRANT, MAX_HUB_TAGS_PER_GRANT, MAX_GRANTS, permissionEnum, grantScopeSchema, grantSchema, createTokenBody, tokenOrgIdParam, invitePreviewQuery, inviteRolePreviewResponse, inviteContactPreviewResponse, invitePreviewResponse, inviteUnsubscribeBody, jsonSchemaSchema, hubUserIdentity, stateValueEntry, getHubUserContextResponse, updateHubUserBody, updateHubUserResponse, unlockHubUserNameResponse, stateResetParams, stateResetResponse, hubAlertsParam, hubAlertSeverity, hubAlert, hubAlertsListResponse, noticeSeveritySchema, noticeStatusSchema, NOTICE_SCOPE_REGEX, noticeScopeSchema, noticeLinkSchema, createNoticeBody, updateNoticeBody, listNoticesQuery, noticeIdParamSchema, ADMIN_SKILL_NAME_REGEX, adminSkillNameParam, 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, DATA_PROXY_MOUNT, DATA_PROXY_PREFIX, REKOR_V1_PREFIX, DATA_PROXY_ORG_QUERY_PARAM, MAX_PROVISIONING_BODY_BYTES, dataProxyQuery, rekorAttestation, REQUIRED_REKOR_ATTESTATION_HEADERS, BASE_DESTRUCTION_MOUNT, BASE_DESTRUCTION_PREFIX, BASE_DESTRUCTION_CONFIRM_PATH, baseDestructionConfirmBody, BASE_DESTRUCTION_GRACE_MS, BASE_DESTRUCTION_CONFIRM_TTL_MS, BASE_DESTRUCTION_ORG_QUERY_PARAM, baseDestructionQuery, baseDestructionParam, baseDestructionInitiateBody, baseDestructionStatus, baseDestructionRequest, baseDestructionListResponse, baseDestructionInitiateResponse, baseDestructionConfirmResponse, baseDestructionCancelResponse, rekorBaseChangeMessageSchema, PEOPLE_CONTACT_PAGE_MAX, PEOPLE_CONTACT_PAGE_DEFAULT, PEOPLE_CONTACT_EMAIL_MAX_LENGTH, peopleUserIdSchema, peopleInviteEmailSchema, peopleContactInviteBody, peopleContactInviteIdParam, peopleContactUserIdParam, peopleContactBlockBody, peopleContactPageQuery, peopleOutgoingInviteSchema, peopleContactPersonSchema, peopleContactSchema, peopleIncomingInviteSchema, peopleBlockedUserSchema, PEOPLE_THREAD_MESSAGE_MAX_LENGTH, PEOPLE_THREAD_MESSAGES_PAGE_MAX, PEOPLE_THREAD_PAGE_MAX, PEOPLE_THREAD_PAGE_DEFAULT, PEOPLE_GROUP_NAME_MAX_LENGTH, PEOPLE_GROUP_AVATAR_URL_MAX_LENGTH, PEOPLE_THREAD_ATTACHMENT_MAX_BYTES, PEOPLE_THREAD_ATTACHMENT_NAME_MAX_LENGTH, PEOPLE_ATTACHMENT_STORAGE_PER_USER_BYTES, PEOPLE_THREAD_ATTACHMENT_MAX_MB, PEOPLE_THREAD_ATTACHMENT_URL_TTL_SECONDS, PEOPLE_THREAD_ATTACHMENT_URLS_MAX, peopleThreadIdParam, peopleThreadMessageIdParam, peopleThreadListQuery, peopleThreadMessagesQuery, peopleThreadAttachmentUploadSchema, peopleThreadSendBody, peopleThreadAttachmentUrlsBody, peopleThreadReadBody, peopleThreadSettingsBody, peopleGroupNameSchema, peopleGroupAvatarUrlSchema, peopleGroupCreateBody, peopleOrgDirectBody, peopleGroupUpdateBody, peopleGroupInviteBody, peopleOrgErasureBody, peopleGroupLeaveBody, peopleGroupInviteIdParam, peopleGroupIncomingInviteIdParam, peopleGroupMemberParam, peopleThreadKindSchema, peopleThreadMemberSchema, peopleThreadLastMessageSchema, peopleGroupRoleSchema, peopleGroupSummarySchema, peopleThreadSummarySchema, peopleThreadAttachmentSchema, peopleThreadMessageSchema, peopleGroupMemberSchema, peopleGroupSentInviteSchema, peopleGroupIncomingInviteSchema, PEOPLE_REPORT_DETAILS_MAX_LENGTH, peopleReportReasonSchema, reportDetailsSchema, reportFields, peopleReportBody, PEOPLE_MODERATION_NOTE_MAX_LENGTH, ADMIN_PEOPLE_REPORTS_PAGE_MAX, ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT, peopleModerationActionSchema, moderationNoteSchema, adminPeopleReportListQuery, adminPeopleReportIdParam, adminPeopleMessageRemovalBody, adminPeopleSuspendBody, adminPeopleNoteBody, COMMUNITIES_PER_ORG_MAX, COMMUNITY_NAME_MAX_LENGTH, COMMUNITY_REGISTRY_CLOSED_REASON, COMMUNITY_JOIN_SOURCE_MAX_LENGTH, COMMUNITY_JOIN_FLOW_TOKEN_MAX_LENGTH, COMMUNITY_ROOM_NAME_MAX_LENGTH, COMMUNITY_MESSAGE_MAX_LENGTH, COMMUNITY_MESSAGES_PAGE_SIZE, COMMUNITY_ATTACHMENT_URLS_MAX, COMMUNITY_POST_TITLE_MAX_LENGTH, COMMUNITY_POST_SEARCH_MAX_LENGTH, COMMUNITY_MEMBER_STATUSES, COMMUNITY_RULES_MAX_LENGTH, COMMUNITY_SLOW_MODE_MAX_SECONDS, COMMUNITY_COURSES_LABEL_MAX_LENGTH, COMMUNITY_LIVE_TICKET_PREFIX, COMMUNITY_STATS_DAYS, communityNameSchema, adminCreateCommunityBody, communityIdParam, communityJoinTokenSchema, communityJoinSourceSchema, communityJoinPreviewQuery, communityJoinBody, communityRoomKindSchema, communityRoomNameSchema, communityRoomIdParam, communityMessageIdParam, communityRoomCreateBody, communityRoomUpdateBody, communityMessagesQuery, communityMessageBodySchema, communityPostTitleSchema, communityAttachmentUploadSchema, communitySendBody, communityEditBody, communityPostIdParam, communityPostsQuery, communityAnswerBody, communityReadBody, communityAttachmentUrlsBody, communityPersonParam, communityOrgParam, communityPeopleQuery, communityCoursesLabelSchema, communitySettingsBody, communityBanBody, communityLockBody, communityPinBody, communityModLogQuery, communityReportsQuery, communityReportIdParam, communityLiveTicketSchema, communityLiveQuery, communityMuteBody, communityEmailUnsubscribeTokenSchema, COMMUNITY_EMAIL_UNSUBSCRIBE_PATH, communityEmailUnsubscribeQuery, COMMUNITY_COURSE_TITLE_MAX_LENGTH, COMMUNITY_COURSE_DESCRIPTION_MAX_LENGTH, COMMUNITY_LESSON_BODY_MAX_LENGTH, COMMUNITY_LESSON_LINKS_MAX, COMMUNITY_LESSON_URL_MAX_LENGTH, YOUTUBE_ID, YOUTUBE_HOSTS, YOUTU_BE, YOUTUBE_ID_PATH, communityCourseIdParam, communityCourseModuleIdParam, communityLessonIdParam, communityCourseTitleSchema, communityCourseDescriptionSchema, communityCoursePositionSchema, communityLessonVideoUrlSchema, communityLessonLinkSchema, communityLessonLinksSchema, communityLessonBodySchema, communityCourseCreateBody, communityCourseUpdateBody, communityModuleCreateBody, communityModuleUpdateBody, communityLessonCreateBody, communityLessonUpdateBody, COMMUNITY_LESSON_TREE_MAX_BYTES, COMMUNITY_LESSON_LINK_PROTOCOLS, LINK_SCHEME, adminSetGuideHubBody, GUIDE_HUB_INELIGIBLE_REASON;
|
|
9788
|
+
var init_chunk_KGAVH3Z7 = __esm({
|
|
9789
|
+
"../../packages/core/dist/chunk-KGAVH3Z7.js"() {
|
|
9790
9790
|
"use strict";
|
|
9791
9791
|
init_chunk_VORPHGDT();
|
|
9792
9792
|
init_chunk_POL7B3EM();
|
|
@@ -10865,7 +10865,8 @@ var init_chunk_FRU7E62M = __esm({
|
|
|
10865
10865
|
pathnameRegex = /^\/(?!\/)[A-Za-z0-9\-._~!$&'()*+,;=:@/?%]*$/;
|
|
10866
10866
|
updatePreferencesBody = external_exports.object({
|
|
10867
10867
|
last_viewed_nav: external_exports.string().regex(pathnameRegex, "Must be a URL pathname").max(2048).optional(),
|
|
10868
|
-
dismissed_agentic_shortcut: external_exports.boolean().optional()
|
|
10868
|
+
dismissed_agentic_shortcut: external_exports.boolean().optional(),
|
|
10869
|
+
opened_guide: external_exports.boolean().optional()
|
|
10869
10870
|
}).passthrough();
|
|
10870
10871
|
registerPushTokenBody = external_exports.object({
|
|
10871
10872
|
token: external_exports.string().min(1).max(512),
|
|
@@ -12820,10 +12821,12 @@ var init_chunk_FRU7E62M = __esm({
|
|
|
12820
12821
|
COMMUNITY_ATTACHMENT_URLS_MAX = COMMUNITY_MESSAGES_PAGE_SIZE + 2;
|
|
12821
12822
|
COMMUNITY_POST_TITLE_MAX_LENGTH = 200;
|
|
12822
12823
|
COMMUNITY_POST_SEARCH_MAX_LENGTH = 100;
|
|
12824
|
+
COMMUNITY_MEMBER_STATUSES = ["active", "left", "removed", "banned"];
|
|
12823
12825
|
COMMUNITY_RULES_MAX_LENGTH = 4e3;
|
|
12824
12826
|
COMMUNITY_SLOW_MODE_MAX_SECONDS = 21600;
|
|
12825
12827
|
COMMUNITY_COURSES_LABEL_MAX_LENGTH = 16;
|
|
12826
12828
|
COMMUNITY_LIVE_TICKET_PREFIX = "cst";
|
|
12829
|
+
COMMUNITY_STATS_DAYS = 30;
|
|
12827
12830
|
communityNameSchema = external_exports.string().trim().min(1).max(COMMUNITY_NAME_MAX_LENGTH);
|
|
12828
12831
|
adminCreateCommunityBody = external_exports.object({ org_id: uuidSchema, name: communityNameSchema }).strict();
|
|
12829
12832
|
communityIdParam = external_exports.object({ communityId: uuidSchema });
|
|
@@ -13257,7 +13260,7 @@ var init_chunk_BPDC67ML = __esm({
|
|
|
13257
13260
|
var init_contracts = __esm({
|
|
13258
13261
|
"../../packages/core/dist/contracts/index.js"() {
|
|
13259
13262
|
"use strict";
|
|
13260
|
-
|
|
13263
|
+
init_chunk_KGAVH3Z7();
|
|
13261
13264
|
init_chunk_VORPHGDT();
|
|
13262
13265
|
init_chunk_POL7B3EM();
|
|
13263
13266
|
init_chunk_T2RKGBYS();
|
|
@@ -13447,6 +13450,24 @@ var init_api_client = __esm({
|
|
|
13447
13450
|
async adminDestroyCommunity(communityId) {
|
|
13448
13451
|
return this.request("DELETE", `/api/admin/communities/${encodeURIComponent(communityId)}`);
|
|
13449
13452
|
}
|
|
13453
|
+
// The org-admin community routes (gh #5003, `wayai communities`): an owner or admin of the
|
|
13454
|
+
// community's org, on an interactive session only — a scoped token is refused with 403.
|
|
13455
|
+
async listOrgCommunities(orgId) {
|
|
13456
|
+
return this.request("GET", `/api/communities/orgs/${encodeURIComponent(orgId)}`);
|
|
13457
|
+
}
|
|
13458
|
+
async getCommunityJoinLink(communityId) {
|
|
13459
|
+
return this.request("GET", `/api/communities/${encodeURIComponent(communityId)}/join-link`);
|
|
13460
|
+
}
|
|
13461
|
+
/** A new token, and the link on: every link shared before stops working. */
|
|
13462
|
+
async replaceCommunityJoinLink(communityId) {
|
|
13463
|
+
return this.request("POST", `/api/communities/${encodeURIComponent(communityId)}/join-link`);
|
|
13464
|
+
}
|
|
13465
|
+
async disableCommunityJoinLink(communityId) {
|
|
13466
|
+
return this.request("DELETE", `/api/communities/${encodeURIComponent(communityId)}/join-link`);
|
|
13467
|
+
}
|
|
13468
|
+
async getCommunityStats(communityId) {
|
|
13469
|
+
return this.request("GET", `/api/communities/${encodeURIComponent(communityId)}/stats`);
|
|
13470
|
+
}
|
|
13450
13471
|
// Read which hub is the WayAI Guide (platform-admin gated, wayai#4948). Used by
|
|
13451
13472
|
// `wayai admin guide status`.
|
|
13452
13473
|
async adminGetGuide() {
|
|
@@ -14357,7 +14378,7 @@ var init_dist = __esm({
|
|
|
14357
14378
|
"../../packages/core/dist/index.js"() {
|
|
14358
14379
|
"use strict";
|
|
14359
14380
|
init_chunk_WSROLRJN();
|
|
14360
|
-
|
|
14381
|
+
init_chunk_KGAVH3Z7();
|
|
14361
14382
|
init_chunk_VORPHGDT();
|
|
14362
14383
|
init_chunk_POL7B3EM();
|
|
14363
14384
|
init_chunk_T2RKGBYS();
|
|
@@ -15865,7 +15886,7 @@ function parseDateArg(date, position) {
|
|
|
15865
15886
|
}
|
|
15866
15887
|
return position === "from" ? `${date}T00:00:00Z` : `${date}T23:59:59Z`;
|
|
15867
15888
|
}
|
|
15868
|
-
async function resolveOrganizationId(
|
|
15889
|
+
async function resolveOrganizationId(client2, orgIdFlag) {
|
|
15869
15890
|
if (orgIdFlag) {
|
|
15870
15891
|
if (!UUID_RE2.test(orgIdFlag)) {
|
|
15871
15892
|
console.error("Invalid --org value. Expected a UUID.");
|
|
@@ -15878,7 +15899,7 @@ async function resolveOrganizationId(client, orgIdFlag) {
|
|
|
15878
15899
|
if (repoConfig) {
|
|
15879
15900
|
return { organizationId: repoConfig.organization_id, organizationName: repoConfig.organization_name };
|
|
15880
15901
|
}
|
|
15881
|
-
const { organizations } = await
|
|
15902
|
+
const { organizations } = await client2.organizations();
|
|
15882
15903
|
if (organizations.length === 0) {
|
|
15883
15904
|
console.error("No organizations found. Create one in the WayAI platform first.");
|
|
15884
15905
|
process.exit(1);
|
|
@@ -15957,7 +15978,8 @@ var init_utils = __esm({
|
|
|
15957
15978
|
"admin",
|
|
15958
15979
|
"report",
|
|
15959
15980
|
"conversations",
|
|
15960
|
-
"alerts"
|
|
15981
|
+
"alerts",
|
|
15982
|
+
"communities"
|
|
15961
15983
|
]);
|
|
15962
15984
|
}
|
|
15963
15985
|
});
|
|
@@ -16970,10 +16992,10 @@ var init_skill_symlink = __esm({
|
|
|
16970
16992
|
async function nudgeReportActions(apiUrl, accessToken) {
|
|
16971
16993
|
if (!process.stdout.isTTY || process.env.CI) return;
|
|
16972
16994
|
try {
|
|
16973
|
-
const
|
|
16995
|
+
const client2 = new ApiClient({ apiUrl, accessToken });
|
|
16974
16996
|
const [shipped, dismissed] = await Promise.all([
|
|
16975
|
-
|
|
16976
|
-
|
|
16997
|
+
client2.listMyReports("shipped"),
|
|
16998
|
+
client2.listMyReports("dismissed")
|
|
16977
16999
|
]);
|
|
16978
17000
|
const actionable = [
|
|
16979
17001
|
// Shipped re-fires per shipment: a contested fix that's re-shipped is a NEW actionable event
|
|
@@ -17565,10 +17587,10 @@ async function statusCommand(args2, pkg2) {
|
|
|
17565
17587
|
let orgs = [];
|
|
17566
17588
|
let tokenValid = tokenLoaded && accessToken ? null : false;
|
|
17567
17589
|
if (tokenLoaded && accessToken) {
|
|
17568
|
-
const
|
|
17590
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
17569
17591
|
const [meResult, orgsResult] = await Promise.allSettled([
|
|
17570
|
-
|
|
17571
|
-
|
|
17592
|
+
client2.me(),
|
|
17593
|
+
client2.organizations()
|
|
17572
17594
|
]);
|
|
17573
17595
|
if (meResult.status === "fulfilled") {
|
|
17574
17596
|
userEmail = meResult.value.email || null;
|
|
@@ -17678,8 +17700,8 @@ function parseArgs2(args2) {
|
|
|
17678
17700
|
async function whoamiCommand(args2) {
|
|
17679
17701
|
const { json } = parseArgs2(args2);
|
|
17680
17702
|
const { config, accessToken } = await requireAuth();
|
|
17681
|
-
const
|
|
17682
|
-
const me = await
|
|
17703
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
17704
|
+
const me = await client2.me();
|
|
17683
17705
|
if (json) {
|
|
17684
17706
|
console.log(JSON.stringify(me, null, 2));
|
|
17685
17707
|
return;
|
|
@@ -17753,11 +17775,11 @@ async function initCommand(args2) {
|
|
|
17753
17775
|
}
|
|
17754
17776
|
}
|
|
17755
17777
|
const { config, accessToken } = await requireAuth();
|
|
17756
|
-
const
|
|
17778
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
17757
17779
|
if (directOrgId) {
|
|
17758
|
-
await initDirect(
|
|
17780
|
+
await initDirect(client2, directOrgId);
|
|
17759
17781
|
} else {
|
|
17760
|
-
await initInteractive(
|
|
17782
|
+
await initInteractive(client2, autoConfirm);
|
|
17761
17783
|
}
|
|
17762
17784
|
const gitRoot = findGitRoot();
|
|
17763
17785
|
if (gitRoot) {
|
|
@@ -17770,13 +17792,13 @@ async function initCommand(args2) {
|
|
|
17770
17792
|
`Run \`${SKILL_INSTALL_CMD}\` to install the WayAI skill in your AI harness, then \`wayai pull\` to fetch hub configuration.`
|
|
17771
17793
|
);
|
|
17772
17794
|
}
|
|
17773
|
-
async function initDirect(
|
|
17795
|
+
async function initDirect(client2, orgId) {
|
|
17774
17796
|
if (!UUID_RE2.test(orgId)) {
|
|
17775
17797
|
console.error("Invalid organization ID. Expected a UUID.");
|
|
17776
17798
|
process.exit(1);
|
|
17777
17799
|
}
|
|
17778
17800
|
console.log("Looking up organization...");
|
|
17779
|
-
const { organizations } = await
|
|
17801
|
+
const { organizations } = await client2.organizations();
|
|
17780
17802
|
const match = organizations.find((o) => o.id === orgId);
|
|
17781
17803
|
if (!match) {
|
|
17782
17804
|
console.error(`Organization ${orgId} not found among the orgs you can access.`);
|
|
@@ -17790,9 +17812,9 @@ async function initDirect(client, orgId) {
|
|
|
17790
17812
|
console.log(`
|
|
17791
17813
|
Wrote ${configPath3}`);
|
|
17792
17814
|
}
|
|
17793
|
-
async function initInteractive(
|
|
17815
|
+
async function initInteractive(client2, autoConfirm) {
|
|
17794
17816
|
console.log("Fetching organizations...");
|
|
17795
|
-
let organizations = (await
|
|
17817
|
+
let organizations = (await client2.organizations()).organizations;
|
|
17796
17818
|
if (organizations.length === 0) {
|
|
17797
17819
|
if (autoConfirm) {
|
|
17798
17820
|
console.error('No organizations found. Create one with `wayai org create "<name>"`, then re-run `wayai init`.');
|
|
@@ -17804,7 +17826,7 @@ async function initInteractive(client, autoConfirm) {
|
|
|
17804
17826
|
console.error('Cancelled. Create one later with `wayai org create "<name>"`.');
|
|
17805
17827
|
process.exit(1);
|
|
17806
17828
|
}
|
|
17807
|
-
const { organization } = await
|
|
17829
|
+
const { organization } = await client2.createOrganization(name);
|
|
17808
17830
|
console.log(`Created organization: ${organization.name} (${organization.id})`);
|
|
17809
17831
|
if (organization.region && !organization.region_explicit) {
|
|
17810
17832
|
console.log(` Region: ${organization.region} (closest to you \u2014 re-create with \`wayai org create --region\` to change)`);
|
|
@@ -20040,20 +20062,20 @@ function metaFromRecord(record, fallbackId) {
|
|
|
20040
20062
|
analytics: record.analytics
|
|
20041
20063
|
});
|
|
20042
20064
|
}
|
|
20043
|
-
function getBaseRecord(
|
|
20044
|
-
return
|
|
20065
|
+
function getBaseRecord(client2, id) {
|
|
20066
|
+
return client2.request("GET", `/v1/bases/${pathSegment(id, "base id")}`);
|
|
20045
20067
|
}
|
|
20046
|
-
function getConfig(
|
|
20047
|
-
return
|
|
20068
|
+
function getConfig(client2, id) {
|
|
20069
|
+
return client2.request("GET", `/v1/${pathSegment(id, "base id")}/config`);
|
|
20048
20070
|
}
|
|
20049
|
-
function diffConfig(
|
|
20050
|
-
return
|
|
20071
|
+
function diffConfig(client2, id, local) {
|
|
20072
|
+
return client2.request("POST", `/v1/${pathSegment(id, "base id")}/config/diff`, local);
|
|
20051
20073
|
}
|
|
20052
|
-
function applyConfig(
|
|
20053
|
-
return
|
|
20074
|
+
function applyConfig(client2, id, local) {
|
|
20075
|
+
return client2.request("PUT", `/v1/${pathSegment(id, "base id")}/config`, local);
|
|
20054
20076
|
}
|
|
20055
|
-
function createPreview(
|
|
20056
|
-
return
|
|
20077
|
+
function createPreview(client2, originId, opts) {
|
|
20078
|
+
return client2.requestRaw("POST", `/v1/${pathSegment(originId, "origin base id")}/preview`, {
|
|
20057
20079
|
name: opts.name,
|
|
20058
20080
|
...opts.description ? { description: opts.description } : {},
|
|
20059
20081
|
// The tier is create-only, so this call is the ONLY chance to honor a tier
|
|
@@ -20061,8 +20083,8 @@ function createPreview(client, originId, opts) {
|
|
|
20061
20083
|
...opts.analytics ? { analytics: opts.analytics } : {}
|
|
20062
20084
|
});
|
|
20063
20085
|
}
|
|
20064
|
-
function deleteEntity(
|
|
20065
|
-
return
|
|
20086
|
+
function deleteEntity(client2, baseId, kind, id) {
|
|
20087
|
+
return client2.request(
|
|
20066
20088
|
"DELETE",
|
|
20067
20089
|
`/v1/${pathSegment(baseId, "base id")}/${ENTITY_DIRS[kind]}/${pathSegment(id, `${kind} id`)}`
|
|
20068
20090
|
);
|
|
@@ -20235,22 +20257,22 @@ function requireGitRoot(gitRoot) {
|
|
|
20235
20257
|
if (!gitRoot) throw expected("Not inside a git repository.");
|
|
20236
20258
|
return gitRoot;
|
|
20237
20259
|
}
|
|
20238
|
-
async function writeProductionMirror(
|
|
20260
|
+
async function writeProductionMirror(client2, basesDir, prodId, record) {
|
|
20239
20261
|
if (!isPathSafeId(prodId)) {
|
|
20240
20262
|
throw expected(`Refusing to mirror base ${JSON.stringify(prodId)}: not a usable base id.`);
|
|
20241
20263
|
}
|
|
20242
|
-
const config = await getConfig(
|
|
20264
|
+
const config = await getConfig(client2, prodId);
|
|
20243
20265
|
const folder = path22.join(basesDir, prodId);
|
|
20244
20266
|
writeBaseFolder(folder, { ...metaFromRecord(record, prodId), environment: "production" }, config);
|
|
20245
20267
|
markProductionMirror(folder, prodId);
|
|
20246
20268
|
ensureMirrorIgnored(folder);
|
|
20247
20269
|
return folder;
|
|
20248
20270
|
}
|
|
20249
|
-
async function mirrorLinkedProduction(
|
|
20271
|
+
async function mirrorLinkedProduction(client2, basesDir, originId) {
|
|
20250
20272
|
try {
|
|
20251
|
-
const record = await getBaseRecord(
|
|
20273
|
+
const record = await getBaseRecord(client2, originId);
|
|
20252
20274
|
if (record.environment !== "production") return;
|
|
20253
|
-
const folder = await writeProductionMirror(
|
|
20275
|
+
const folder = await writeProductionMirror(client2, basesDir, originId, record);
|
|
20254
20276
|
console.log(`Mirrored production base \u2192 ${folder} (read-only, git-ignored)`);
|
|
20255
20277
|
} catch (err) {
|
|
20256
20278
|
console.warn(
|
|
@@ -20269,11 +20291,11 @@ async function pullBase(gitRootOrNull, selector, args2) {
|
|
|
20269
20291
|
`Could not determine the base id for ${target.folder}. Pass the base id explicitly.`
|
|
20270
20292
|
);
|
|
20271
20293
|
}
|
|
20272
|
-
const
|
|
20294
|
+
const client2 = await createDataClient();
|
|
20273
20295
|
console.log("Fetching base configuration...");
|
|
20274
|
-
const record = await getBaseRecord(
|
|
20296
|
+
const record = await getBaseRecord(client2, baseId);
|
|
20275
20297
|
if (record.environment === "production") {
|
|
20276
|
-
const folder = await writeProductionMirror(
|
|
20298
|
+
const folder = await writeProductionMirror(client2, basesDir, record.id ?? baseId, record);
|
|
20277
20299
|
console.log(`Production base mirrored (read-only) \u2192 ${folder}`);
|
|
20278
20300
|
return;
|
|
20279
20301
|
}
|
|
@@ -20287,7 +20309,7 @@ async function pullBase(gitRootOrNull, selector, args2) {
|
|
|
20287
20309
|
return;
|
|
20288
20310
|
}
|
|
20289
20311
|
}
|
|
20290
|
-
const config = await getConfig(
|
|
20312
|
+
const config = await getConfig(client2, baseId);
|
|
20291
20313
|
const isFirstPull = !target.exists;
|
|
20292
20314
|
const delta = writeBaseFolder(target.folder, metaFromRecord(record, baseId), config);
|
|
20293
20315
|
console.log(`Base configuration written to ${target.folder}`);
|
|
@@ -20298,7 +20320,7 @@ async function pullBase(gitRootOrNull, selector, args2) {
|
|
|
20298
20320
|
console.log(" Credential values are not written. Manage them with `wayai bases credentials`.");
|
|
20299
20321
|
seedScopeIfEmpty("bases", baseId);
|
|
20300
20322
|
if (record.origin_base_id) {
|
|
20301
|
-
await mirrorLinkedProduction(
|
|
20323
|
+
await mirrorLinkedProduction(client2, basesDir, record.origin_base_id);
|
|
20302
20324
|
}
|
|
20303
20325
|
}
|
|
20304
20326
|
function printLintWarnings(warnings) {
|
|
@@ -20313,7 +20335,7 @@ ${YELLOW}Tool design \u2014 ${warnings.length} ${word} (advisory, not blocking):
|
|
|
20313
20335
|
);
|
|
20314
20336
|
}
|
|
20315
20337
|
}
|
|
20316
|
-
async function createDeclaredPreview(
|
|
20338
|
+
async function createDeclaredPreview(client2, target, parsed, autoConfirm) {
|
|
20317
20339
|
const { meta, config } = parsed;
|
|
20318
20340
|
if (!meta.origin_base_id) {
|
|
20319
20341
|
throw expected(
|
|
@@ -20331,7 +20353,7 @@ async function createDeclaredPreview(client, target, parsed, autoConfirm) {
|
|
|
20331
20353
|
return null;
|
|
20332
20354
|
}
|
|
20333
20355
|
}
|
|
20334
|
-
const record = await createPreview(
|
|
20356
|
+
const record = await createPreview(client2, meta.origin_base_id, {
|
|
20335
20357
|
name,
|
|
20336
20358
|
description: meta.description,
|
|
20337
20359
|
analytics: meta.analytics
|
|
@@ -20365,14 +20387,14 @@ async function pushBase(gitRootOrNull, selector, args2) {
|
|
|
20365
20387
|
);
|
|
20366
20388
|
return;
|
|
20367
20389
|
}
|
|
20368
|
-
const
|
|
20390
|
+
const client2 = await createDataClient();
|
|
20369
20391
|
let baseId = meta.base_id;
|
|
20370
20392
|
if (!baseId) {
|
|
20371
|
-
const created = await createDeclaredPreview(
|
|
20393
|
+
const created = await createDeclaredPreview(client2, target, parsed, autoConfirm);
|
|
20372
20394
|
if (!created) return;
|
|
20373
20395
|
baseId = created;
|
|
20374
20396
|
} else {
|
|
20375
|
-
const record = await getBaseRecord(
|
|
20397
|
+
const record = await getBaseRecord(client2, baseId);
|
|
20376
20398
|
if (record.environment && record.environment !== "preview") {
|
|
20377
20399
|
throw expected(
|
|
20378
20400
|
`"${sanitizeTerminalText(baseId)}" is a ${sanitizeTerminalText(record.environment)} base. Push operates on previews \u2014 promote with \`wayai bases promote\`.`
|
|
@@ -20380,7 +20402,7 @@ async function pushBase(gitRootOrNull, selector, args2) {
|
|
|
20380
20402
|
}
|
|
20381
20403
|
assertInScope("bases", baseId);
|
|
20382
20404
|
}
|
|
20383
|
-
const diff = await diffConfig(
|
|
20405
|
+
const diff = await diffConfig(client2, baseId, config);
|
|
20384
20406
|
printLintWarnings(diff.warnings);
|
|
20385
20407
|
if (isDiffEmpty(diff)) {
|
|
20386
20408
|
console.log(`No changes \u2014 preview "${sanitizeTerminalText(baseId)}" already matches your files.`);
|
|
@@ -20400,7 +20422,7 @@ Apply these changes to preview "${sanitizeTerminalText(baseId)}"?`);
|
|
|
20400
20422
|
return;
|
|
20401
20423
|
}
|
|
20402
20424
|
}
|
|
20403
|
-
const result = await applyConfig(
|
|
20425
|
+
const result = await applyConfig(client2, baseId, config);
|
|
20404
20426
|
const secretGroups = [
|
|
20405
20427
|
["trigger", result.new_trigger_secrets],
|
|
20406
20428
|
["inbound webhook", result.new_inbound_webhook_secrets]
|
|
@@ -20427,7 +20449,7 @@ ${RED}${removals.length} ${word} not in your files were left on the base. Re-run
|
|
|
20427
20449
|
Delete ${removals.length} server ${word} not in your files? Record types cascade to their records.`
|
|
20428
20450
|
)) {
|
|
20429
20451
|
for (const removal of removals) {
|
|
20430
|
-
await deleteEntity(
|
|
20452
|
+
await deleteEntity(client2, baseId, removal.kind, removal.id);
|
|
20431
20453
|
console.log(` - deleted ${removal.kind} ${sanitizeTerminalText(removal.id)}`);
|
|
20432
20454
|
}
|
|
20433
20455
|
} else {
|
|
@@ -20578,7 +20600,7 @@ function printLocalFileChanges(delta) {
|
|
|
20578
20600
|
emit(delta.removed, "-");
|
|
20579
20601
|
emit(delta.changed, "~");
|
|
20580
20602
|
}
|
|
20581
|
-
async function autoRenameAgentFiles(
|
|
20603
|
+
async function autoRenameAgentFiles(client2, hubId, hubFolder, organizationId, remoteConfig) {
|
|
20582
20604
|
requireRealHubFolder(hubFolder, false);
|
|
20583
20605
|
const agentsDir = path23.join(hubFolder, "agents");
|
|
20584
20606
|
let agentsWithIds = [];
|
|
@@ -20608,7 +20630,7 @@ async function autoRenameAgentFiles(client, hubId, hubFolder, organizationId, re
|
|
|
20608
20630
|
let remote = remoteConfig;
|
|
20609
20631
|
if (!remote) {
|
|
20610
20632
|
try {
|
|
20611
|
-
remote = await
|
|
20633
|
+
remote = await client2.pull(hubId, organizationId);
|
|
20612
20634
|
} catch (err) {
|
|
20613
20635
|
console.warn(` Warning: could not fetch remote state for auto-rename (${err instanceof Error ? err.message : String(err)}). File renames skipped.`);
|
|
20614
20636
|
return;
|
|
@@ -20708,9 +20730,9 @@ async function autoRenameAgentFiles(client, hubId, hubFolder, organizationId, re
|
|
|
20708
20730
|
}
|
|
20709
20731
|
}
|
|
20710
20732
|
}
|
|
20711
|
-
async function syncAfterPush(
|
|
20733
|
+
async function syncAfterPush(client2, hubId, hubFolder, organizationId) {
|
|
20712
20734
|
try {
|
|
20713
|
-
const remoteConfig = await
|
|
20735
|
+
const remoteConfig = await client2.pull(hubId, organizationId);
|
|
20714
20736
|
const delta = await materializeHubFolder(hubFolder, remoteConfig);
|
|
20715
20737
|
printLocalFileChanges(delta);
|
|
20716
20738
|
const finalFolder = autoRenameHubFolder(hubFolder, remoteConfig.hub.name, remoteConfig.hub_environment, hubId, remoteConfig.preview_label, remoteConfig.branch_name);
|
|
@@ -20721,22 +20743,22 @@ async function syncAfterPush(client, hubId, hubFolder, organizationId) {
|
|
|
20721
20743
|
console.warn(`Warning: could not sync local files after push (${err instanceof Error ? err.message : String(err)})`);
|
|
20722
20744
|
}
|
|
20723
20745
|
}
|
|
20724
|
-
async function pushSingleHub(
|
|
20746
|
+
async function pushSingleHub(client2, hubId, hubFolder, autoConfirm, organizationId, opts) {
|
|
20725
20747
|
let remoteConfig;
|
|
20726
20748
|
try {
|
|
20727
|
-
remoteConfig = await
|
|
20749
|
+
remoteConfig = await client2.pull(hubId, organizationId);
|
|
20728
20750
|
} catch (err) {
|
|
20729
20751
|
const fallbackConfig = parseHubFolder(hubFolder);
|
|
20730
20752
|
assertResourcePayloadFitsWithoutPruning(fallbackConfig, err);
|
|
20731
20753
|
}
|
|
20732
20754
|
if (!opts?.skipAgentRename) {
|
|
20733
|
-
await autoRenameAgentFiles(
|
|
20755
|
+
await autoRenameAgentFiles(client2, hubId, hubFolder, organizationId, remoteConfig);
|
|
20734
20756
|
}
|
|
20735
20757
|
console.log("Parsing local configuration...");
|
|
20736
20758
|
const localConfig = parseHubFolder(hubFolder);
|
|
20737
20759
|
const wireConfig = remoteConfig ? prepareResourcePayload(localConfig, remoteConfig) : localConfig;
|
|
20738
20760
|
console.log("Computing diff...");
|
|
20739
|
-
const diffResult = await
|
|
20761
|
+
const diffResult = await client2.diff(hubId, wireConfig, "push", organizationId);
|
|
20740
20762
|
printWarnings(diffResult.warnings);
|
|
20741
20763
|
if (shouldWarnIgnoredPreviewLabel(localConfig.preview_label, diffResult.preview_label)) {
|
|
20742
20764
|
console.warn(
|
|
@@ -20763,9 +20785,9 @@ async function pushSingleHub(client, hubId, hubFolder, autoConfirm, organization
|
|
|
20763
20785
|
}
|
|
20764
20786
|
}
|
|
20765
20787
|
console.log("Pushing changes...");
|
|
20766
|
-
const result = await
|
|
20788
|
+
const result = await client2.push(hubId, wireConfig, organizationId);
|
|
20767
20789
|
printSyncResult(result);
|
|
20768
|
-
await syncAfterPush(
|
|
20790
|
+
await syncAfterPush(client2, hubId, hubFolder, organizationId);
|
|
20769
20791
|
seedScopeIfEmpty("hubs", hubId);
|
|
20770
20792
|
return true;
|
|
20771
20793
|
}
|
|
@@ -20786,7 +20808,7 @@ function selectExistingHub(workspaceDir, allHubs, selector, wsLabel) {
|
|
|
20786
20808
|
if (previewHubs.length === 1) return previewHubs[0];
|
|
20787
20809
|
return null;
|
|
20788
20810
|
}
|
|
20789
|
-
async function createAndPushNewHub(
|
|
20811
|
+
async function createAndPushNewHub(client2, newHub, opts) {
|
|
20790
20812
|
const hubType = newHub.hubType || "chat";
|
|
20791
20813
|
console.log(`
|
|
20792
20814
|
New hub: "${newHub.hubName}" (${hubType})`);
|
|
@@ -20805,7 +20827,7 @@ New hub: "${newHub.hubName}" (${hubType})`);
|
|
|
20805
20827
|
}
|
|
20806
20828
|
const content = readRealFileOrThrow(newHub.hubFolder, hubYamlPath) ?? "";
|
|
20807
20829
|
console.log("Creating hub...");
|
|
20808
|
-
const createResult = await
|
|
20830
|
+
const createResult = await client2.createHub(opts.organizationId, {
|
|
20809
20831
|
hubName: newHub.hubName,
|
|
20810
20832
|
hubType,
|
|
20811
20833
|
previewLabel: opts.label?.trim() || void 0
|
|
@@ -20834,7 +20856,7 @@ ${content}`;
|
|
|
20834
20856
|
}
|
|
20835
20857
|
writeFileNoFollow(newHub.hubFolder, hubYamlPath, Buffer.from(updated, "utf-8"));
|
|
20836
20858
|
seedScopeIfEmpty("hubs", hubId);
|
|
20837
|
-
await pushSingleHub(
|
|
20859
|
+
await pushSingleHub(client2, hubId, newHub.hubFolder, opts.autoConfirm, opts.organizationId, { skipAgentRename: true });
|
|
20838
20860
|
}
|
|
20839
20861
|
function reportUnresolvedPushTarget(reason, existingHubs, newHubs, selector, wsLabel) {
|
|
20840
20862
|
if (reason === "none") {
|
|
@@ -20875,7 +20897,7 @@ async function pushCommand(args2) {
|
|
|
20875
20897
|
const repoConfig = requireRepoConfig();
|
|
20876
20898
|
const { organization_id: organizationId } = repoConfig;
|
|
20877
20899
|
const { config, accessToken } = await requireAuth();
|
|
20878
|
-
const
|
|
20900
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
20879
20901
|
const workspaceDir = resolveWorkspaceDir();
|
|
20880
20902
|
const wsLabel = hubsDirLabel(gitRoot);
|
|
20881
20903
|
if (!fs17.existsSync(workspaceDir)) {
|
|
@@ -20899,11 +20921,11 @@ async function pushCommand(args2) {
|
|
|
20899
20921
|
}
|
|
20900
20922
|
console.log(`Target hub: ${path23.basename(existing.hubFolder)} (${existing.hubId})`);
|
|
20901
20923
|
assertInScope("hubs", existing.hubId, path23.basename(existing.hubFolder));
|
|
20902
|
-
await pushSingleHub(
|
|
20924
|
+
await pushSingleHub(client2, existing.hubId, existing.hubFolder, autoConfirm, organizationId);
|
|
20903
20925
|
return;
|
|
20904
20926
|
}
|
|
20905
20927
|
assertScopeAllowsCreation("hubs", resolution.target.hub.hubName);
|
|
20906
|
-
await createAndPushNewHub(
|
|
20928
|
+
await createAndPushNewHub(client2, resolution.target.hub, { autoConfirm, label, organizationId });
|
|
20907
20929
|
}
|
|
20908
20930
|
var LOCAL_CHANGE_LIST_CAP;
|
|
20909
20931
|
var init_push = __esm({
|
|
@@ -20980,11 +21002,11 @@ async function pullCommand(args2) {
|
|
|
20980
21002
|
const repoConfig = requireRepoConfig();
|
|
20981
21003
|
const { organization_id: organizationId } = repoConfig;
|
|
20982
21004
|
const { config, accessToken } = await requireAuth();
|
|
20983
|
-
const
|
|
21005
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
20984
21006
|
const workspaceDir = resolveWorkspaceDir();
|
|
20985
21007
|
const { hubId, hubFolder: existingFolder } = resolveHubTarget(workspaceDir, hubSelector);
|
|
20986
21008
|
console.log("Fetching hub configuration...");
|
|
20987
|
-
const payload = await
|
|
21009
|
+
const payload = await client2.pull(hubId, organizationId);
|
|
20988
21010
|
if (payload.hub_environment === "production") {
|
|
20989
21011
|
const folder = await writeProductionMirror2(workspaceDir, payload);
|
|
20990
21012
|
console.log(`Production hub mirrored (read-only) \u2192 ${folder}`);
|
|
@@ -21023,7 +21045,7 @@ async function pullCommand(args2) {
|
|
|
21023
21045
|
let diffResult;
|
|
21024
21046
|
if (localPayload) {
|
|
21025
21047
|
try {
|
|
21026
|
-
diffResult = await
|
|
21048
|
+
diffResult = await client2.diff(hubId, prepareResourcePayload(localPayload, payload), "pull", organizationId);
|
|
21027
21049
|
} catch (err) {
|
|
21028
21050
|
if (!await replaceWithoutDiff(UNCOMPARABLE_LOCAL, err)) {
|
|
21029
21051
|
console.log("Cancelled.");
|
|
@@ -21069,7 +21091,7 @@ async function pullCommand(args2) {
|
|
|
21069
21091
|
}
|
|
21070
21092
|
if (wroteFiles) seedScopeIfEmpty("hubs", hubId);
|
|
21071
21093
|
if (payload.production_hub_id) {
|
|
21072
|
-
await mirrorLinkedProduction2(
|
|
21094
|
+
await mirrorLinkedProduction2(client2, workspaceDir, payload.production_hub_id, organizationId);
|
|
21073
21095
|
}
|
|
21074
21096
|
}
|
|
21075
21097
|
async function confirmReplaceWithoutDiff(why, err, hubFolder, hubId, autoConfirm) {
|
|
@@ -21092,9 +21114,9 @@ async function writeProductionMirror2(workspaceDir, prodPayload) {
|
|
|
21092
21114
|
prependMirrorMarker(finalFolder, prodPayload.hub_id);
|
|
21093
21115
|
return finalFolder;
|
|
21094
21116
|
}
|
|
21095
|
-
async function mirrorLinkedProduction2(
|
|
21117
|
+
async function mirrorLinkedProduction2(client2, workspaceDir, productionHubId, organizationId) {
|
|
21096
21118
|
try {
|
|
21097
|
-
const prodPayload = await
|
|
21119
|
+
const prodPayload = await client2.pull(productionHubId, organizationId);
|
|
21098
21120
|
const folder = await writeProductionMirror2(workspaceDir, prodPayload);
|
|
21099
21121
|
console.log(`Mirrored production hub \u2192 ${folder} (read-only)`);
|
|
21100
21122
|
} catch (err) {
|
|
@@ -21177,7 +21199,7 @@ async function createCommand(args2) {
|
|
|
21177
21199
|
const repoConfig = requireRepoConfig();
|
|
21178
21200
|
const { organization_id: organizationId } = repoConfig;
|
|
21179
21201
|
const { config, accessToken } = await requireAuth();
|
|
21180
|
-
const
|
|
21202
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
21181
21203
|
const workspaceDir = resolveWorkspaceDir();
|
|
21182
21204
|
const gitRoot = findGitRoot();
|
|
21183
21205
|
const wsLabel = hubsDirLabel(gitRoot);
|
|
@@ -21210,7 +21232,7 @@ async function createCommand(args2) {
|
|
|
21210
21232
|
process.exit(1);
|
|
21211
21233
|
}
|
|
21212
21234
|
assertScopeAllowsCreation("hubs", resolution.hub.hubName);
|
|
21213
|
-
await createAndPushNewHub(
|
|
21235
|
+
await createAndPushNewHub(client2, resolution.hub, { autoConfirm, label, organizationId });
|
|
21214
21236
|
}
|
|
21215
21237
|
var init_create = __esm({
|
|
21216
21238
|
"src/commands/create.ts"() {
|
|
@@ -21249,7 +21271,7 @@ async function diffCommand(args2) {
|
|
|
21249
21271
|
const repoConfig = requireRepoConfig();
|
|
21250
21272
|
const { organization_id: organizationId } = repoConfig;
|
|
21251
21273
|
const { config, accessToken } = await requireAuth();
|
|
21252
|
-
const
|
|
21274
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
21253
21275
|
const workspaceDir = resolveWorkspaceDir();
|
|
21254
21276
|
const gitRoot = findGitRoot();
|
|
21255
21277
|
if (gitRoot) warnLayoutOnce(gitRoot);
|
|
@@ -21267,7 +21289,7 @@ async function diffCommand(args2) {
|
|
|
21267
21289
|
console.log("This is a read-only production mirror \u2014 run `wayai diff --production` from the preview workspace instead.");
|
|
21268
21290
|
return;
|
|
21269
21291
|
}
|
|
21270
|
-
const { hubs } = await
|
|
21292
|
+
const { hubs } = await client2.listHubs(organizationId);
|
|
21271
21293
|
const entry = hubs.find((h) => h.hub_id === previewHubId);
|
|
21272
21294
|
const productionHubId = entry?.production_hub_id ?? null;
|
|
21273
21295
|
if (!productionHubId) {
|
|
@@ -21280,11 +21302,11 @@ async function diffCommand(args2) {
|
|
|
21280
21302
|
console.log(`Computing diff against ${label}...`);
|
|
21281
21303
|
let diffPayload = localConfig;
|
|
21282
21304
|
try {
|
|
21283
|
-
diffPayload = prepareResourcePayload(localConfig, await
|
|
21305
|
+
diffPayload = prepareResourcePayload(localConfig, await client2.pull(targetHubId, organizationId));
|
|
21284
21306
|
} catch (err) {
|
|
21285
21307
|
assertResourcePayloadFitsWithoutPruning(localConfig, err);
|
|
21286
21308
|
}
|
|
21287
|
-
const result = await
|
|
21309
|
+
const result = await client2.diff(targetHubId, diffPayload, "push", organizationId);
|
|
21288
21310
|
printWarnings(result.warnings);
|
|
21289
21311
|
if (!result.has_changes) {
|
|
21290
21312
|
console.log(`
|
|
@@ -21343,7 +21365,7 @@ async function replicateCommand(args2) {
|
|
|
21343
21365
|
const repoConfig = requireRepoConfig();
|
|
21344
21366
|
const { organization_id: organizationId } = repoConfig;
|
|
21345
21367
|
const { config, accessToken } = await requireAuth();
|
|
21346
|
-
const
|
|
21368
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
21347
21369
|
const workspaceDir = resolveWorkspaceDir();
|
|
21348
21370
|
const gitRoot = findGitRoot();
|
|
21349
21371
|
if (gitRoot) warnLayoutOnce(gitRoot);
|
|
@@ -21351,10 +21373,10 @@ async function replicateCommand(args2) {
|
|
|
21351
21373
|
console.log(
|
|
21352
21374
|
normalizedLabel ? `Replicating hub ${sourceHubId} into a new preview "${normalizedLabel}"...` : `Replicating hub ${sourceHubId} into a new preview...`
|
|
21353
21375
|
);
|
|
21354
|
-
const { data } = await
|
|
21376
|
+
const { data } = await client2.replicatePreview(sourceHubId, normalizedLabel ?? null);
|
|
21355
21377
|
const previewHubId = data.preview_hub_id;
|
|
21356
21378
|
console.log(`New preview hub created: ${previewHubId}`);
|
|
21357
|
-
const payload = await
|
|
21379
|
+
const payload = await client2.pull(previewHubId, organizationId);
|
|
21358
21380
|
let hubFolder = resolveHubFolder(
|
|
21359
21381
|
workspaceDir,
|
|
21360
21382
|
previewHubId,
|
|
@@ -21430,7 +21452,7 @@ async function relabelCommand(args2) {
|
|
|
21430
21452
|
}
|
|
21431
21453
|
requireRepoConfig();
|
|
21432
21454
|
const { config, accessToken } = await requireAuth();
|
|
21433
|
-
const
|
|
21455
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
21434
21456
|
const workspaceDir = resolveWorkspaceDir();
|
|
21435
21457
|
const gitRoot = findGitRoot();
|
|
21436
21458
|
const wsLabel = hubsDirLabel(gitRoot);
|
|
@@ -21455,7 +21477,7 @@ async function relabelCommand(args2) {
|
|
|
21455
21477
|
}
|
|
21456
21478
|
assertInScope("hubs", target.hubId, path27.basename(target.hubFolder));
|
|
21457
21479
|
console.log(normalizedLabel ? `Setting preview label to "${normalizedLabel}"...` : "Clearing preview label...");
|
|
21458
|
-
const { data } = await
|
|
21480
|
+
const { data } = await client2.relabelPreview(target.hubId, normalizedLabel);
|
|
21459
21481
|
const row = data[0];
|
|
21460
21482
|
const serverLabel = row.preview_label ?? null;
|
|
21461
21483
|
setPreviewLabelInHubYaml(target.hubFolder, serverLabel);
|
|
@@ -21528,19 +21550,19 @@ function renderHubDiff(result) {
|
|
|
21528
21550
|
for (const section of HUB_DIFF_SECTIONS) renderSection(SECTION_TITLES[section], result[section] ?? []);
|
|
21529
21551
|
console.log();
|
|
21530
21552
|
}
|
|
21531
|
-
async function runPublish(
|
|
21553
|
+
async function runPublish(client2, opts) {
|
|
21532
21554
|
const { hubId, localConfig, organizationId, autoConfirm } = opts;
|
|
21533
21555
|
const confirmFn = opts.confirmFn ?? confirm;
|
|
21534
21556
|
if (localConfig) {
|
|
21535
21557
|
let diffPayload = localConfig;
|
|
21536
|
-
if (
|
|
21558
|
+
if (client2.pull) {
|
|
21537
21559
|
try {
|
|
21538
|
-
diffPayload = prepareResourcePayload(localConfig, await
|
|
21560
|
+
diffPayload = prepareResourcePayload(localConfig, await client2.pull(hubId, organizationId));
|
|
21539
21561
|
} catch (err) {
|
|
21540
21562
|
assertResourcePayloadFitsWithoutPruning(localConfig, err);
|
|
21541
21563
|
}
|
|
21542
21564
|
}
|
|
21543
|
-
const pushDiff = await
|
|
21565
|
+
const pushDiff = await client2.diff(hubId, diffPayload, "push", organizationId);
|
|
21544
21566
|
if (pushDiff.has_changes) {
|
|
21545
21567
|
console.log("\n\x1B[33mYou have local changes not yet pushed to this preview.\x1B[0m");
|
|
21546
21568
|
console.log("Publishing promotes the PREVIEW (server) state \u2014 these local edits are NOT included.");
|
|
@@ -21554,7 +21576,7 @@ async function runPublish(client, opts) {
|
|
|
21554
21576
|
}
|
|
21555
21577
|
}
|
|
21556
21578
|
}
|
|
21557
|
-
const { data: diff } = await
|
|
21579
|
+
const { data: diff } = await client2.getHubDiff(hubId);
|
|
21558
21580
|
if (!diff.has_changes && !diff.is_first_publish) {
|
|
21559
21581
|
console.log("Production is already up to date. Nothing to sync.");
|
|
21560
21582
|
return "up-to-date";
|
|
@@ -21574,13 +21596,13 @@ async function runPublish(client, opts) {
|
|
|
21574
21596
|
}
|
|
21575
21597
|
if (diff.is_first_publish) {
|
|
21576
21598
|
console.log("Publishing...");
|
|
21577
|
-
const { data } = await
|
|
21599
|
+
const { data } = await client2.publishHub(hubId);
|
|
21578
21600
|
console.log(`
|
|
21579
21601
|
Published. Production hub: ${data.production_hub_id}`);
|
|
21580
21602
|
return "published";
|
|
21581
21603
|
}
|
|
21582
21604
|
console.log("Syncing...");
|
|
21583
|
-
await
|
|
21605
|
+
await client2.syncHub(hubId);
|
|
21584
21606
|
console.log("\nSynced preview changes to production.");
|
|
21585
21607
|
return "synced";
|
|
21586
21608
|
}
|
|
@@ -21589,7 +21611,7 @@ async function publishCommand(args2) {
|
|
|
21589
21611
|
const repoConfig = requireRepoConfig();
|
|
21590
21612
|
const { organization_id: organizationId } = repoConfig;
|
|
21591
21613
|
const { config, accessToken } = await requireAuth();
|
|
21592
|
-
const
|
|
21614
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
21593
21615
|
const workspaceDir = resolveWorkspaceDir();
|
|
21594
21616
|
const gitRoot = findGitRoot();
|
|
21595
21617
|
if (gitRoot) warnLayoutOnce(gitRoot);
|
|
@@ -21605,7 +21627,7 @@ async function publishCommand(args2) {
|
|
|
21605
21627
|
}
|
|
21606
21628
|
}
|
|
21607
21629
|
assertInScope("hubs", hubId, hubFolder ? path28.basename(hubFolder) : void 0);
|
|
21608
|
-
await runPublish(
|
|
21630
|
+
await runPublish(client2, { hubId, localConfig, organizationId, autoConfirm });
|
|
21609
21631
|
}
|
|
21610
21632
|
var STATUS_STYLE, SECTION_TITLES;
|
|
21611
21633
|
var init_publish = __esm({
|
|
@@ -22105,8 +22127,8 @@ async function sendMessageCommand(args2) {
|
|
|
22105
22127
|
if (stats.length > 0) console.error(`Attachments: ${fileDetail()} (base64 adds about a third).`);
|
|
22106
22128
|
process.exit(1);
|
|
22107
22129
|
}
|
|
22108
|
-
const
|
|
22109
|
-
const result = await
|
|
22130
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
22131
|
+
const result = await client2.sendMessage(hubId, message, {
|
|
22110
22132
|
conversationId,
|
|
22111
22133
|
...attachments.length > 0 && { attachments }
|
|
22112
22134
|
});
|
|
@@ -22265,10 +22287,10 @@ async function mapWithConcurrency(items, concurrency, worker) {
|
|
|
22265
22287
|
await Promise.all(runners);
|
|
22266
22288
|
return results;
|
|
22267
22289
|
}
|
|
22268
|
-
async function resolveTargets(
|
|
22290
|
+
async function resolveTargets(client2, orgs, errors) {
|
|
22269
22291
|
const perOrg = await mapWithConcurrency(orgs, CROSS_HUB_CONCURRENCY, async (org) => {
|
|
22270
22292
|
try {
|
|
22271
|
-
const { hubs } = await
|
|
22293
|
+
const { hubs } = await client2.listHubs(org.id);
|
|
22272
22294
|
const targets = [];
|
|
22273
22295
|
for (const hub of hubs) {
|
|
22274
22296
|
targets.push({
|
|
@@ -22309,10 +22331,10 @@ async function resolveTargets(client, orgs, errors) {
|
|
|
22309
22331
|
return true;
|
|
22310
22332
|
});
|
|
22311
22333
|
}
|
|
22312
|
-
async function listConversationsAcrossHubs(
|
|
22334
|
+
async function listConversationsAcrossHubs(client2, scope, opts) {
|
|
22313
22335
|
const errors = [];
|
|
22314
|
-
const orgs = scope.mode === "all" ? (await
|
|
22315
|
-
const targets = await resolveTargets(
|
|
22336
|
+
const orgs = scope.mode === "all" ? (await client2.organizations()).organizations : [{ id: scope.orgId, name: null }];
|
|
22337
|
+
const targets = await resolveTargets(client2, orgs, errors);
|
|
22316
22338
|
if (targets.length > MAX_CROSS_HUB_HUBS) {
|
|
22317
22339
|
throw expected(
|
|
22318
22340
|
`${targets.length} hubs are in scope, above the ${MAX_CROSS_HUB_HUBS}-hub cap for one cross-hub listing. Narrow the scope with --org <organization_id>.`
|
|
@@ -22323,7 +22345,7 @@ async function listConversationsAcrossHubs(client, scope, opts) {
|
|
|
22323
22345
|
const perHub = await mapWithConcurrency(targets, CROSS_HUB_CONCURRENCY, async (target) => {
|
|
22324
22346
|
const { derived, ...row } = target;
|
|
22325
22347
|
try {
|
|
22326
|
-
const result2 = await
|
|
22348
|
+
const result2 = await client2.getConversations(target.hub_id, opts);
|
|
22327
22349
|
hubsRead++;
|
|
22328
22350
|
return result2.conversations.map((conv) => ({ ...conv, ...row }));
|
|
22329
22351
|
} catch (err) {
|
|
@@ -22386,18 +22408,18 @@ var init_cross_hub_conversations = __esm({
|
|
|
22386
22408
|
});
|
|
22387
22409
|
|
|
22388
22410
|
// src/commands/observability.ts
|
|
22389
|
-
async function runConversationObservability(
|
|
22411
|
+
async function runConversationObservability(client2, hubId, conversationId, opts) {
|
|
22390
22412
|
if (opts.messageId) {
|
|
22391
22413
|
const result2 = await fallbackOn404(
|
|
22392
|
-
() =>
|
|
22393
|
-
() =>
|
|
22414
|
+
() => client2.getMessageObservability(hubId, conversationId, opts.messageId),
|
|
22415
|
+
() => client2.getArchivedMessageObservability(hubId, conversationId, opts.messageId)
|
|
22394
22416
|
);
|
|
22395
22417
|
renderRecord(result2.data, opts.jsonOutput);
|
|
22396
22418
|
return;
|
|
22397
22419
|
}
|
|
22398
22420
|
const result = await fallbackOn404(
|
|
22399
|
-
() =>
|
|
22400
|
-
() =>
|
|
22421
|
+
() => client2.listConversationObservability(hubId, conversationId),
|
|
22422
|
+
() => client2.listArchivedConversationObservability(hubId, conversationId)
|
|
22401
22423
|
);
|
|
22402
22424
|
renderList({
|
|
22403
22425
|
hubId: result.data.hub_id,
|
|
@@ -22417,8 +22439,8 @@ async function fallbackOn404(primary, fallback) {
|
|
|
22417
22439
|
throw err;
|
|
22418
22440
|
}
|
|
22419
22441
|
}
|
|
22420
|
-
async function runDebugObservability(
|
|
22421
|
-
const result = await
|
|
22442
|
+
async function runDebugObservability(client2, hubId, conversationId, opts) {
|
|
22443
|
+
const result = await client2.debugReadObservability(hubId, conversationId, {
|
|
22422
22444
|
messageId: opts.messageId
|
|
22423
22445
|
});
|
|
22424
22446
|
if (result.data.kind === "single") {
|
|
@@ -22694,7 +22716,7 @@ async function conversationsCommand(args2) {
|
|
|
22694
22716
|
}
|
|
22695
22717
|
}
|
|
22696
22718
|
}
|
|
22697
|
-
const
|
|
22719
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
22698
22720
|
const hasAnalyticsFlags = !!(period || from || to);
|
|
22699
22721
|
if (crossHubScope && (conversationId || subcommand)) {
|
|
22700
22722
|
console.error("--all/--org apply to the conversation LIST only. Drop them and pass --hub <id> to open one conversation.");
|
|
@@ -22706,7 +22728,7 @@ async function conversationsCommand(args2) {
|
|
|
22706
22728
|
process.exit(1);
|
|
22707
22729
|
}
|
|
22708
22730
|
try {
|
|
22709
|
-
await runConversationObservability(
|
|
22731
|
+
await runConversationObservability(client2, hubId, conversationId, { messageId, jsonOutput });
|
|
22710
22732
|
} catch (err) {
|
|
22711
22733
|
if (err instanceof ApiError && err.status === 404) {
|
|
22712
22734
|
console.error("Observability data not found. Either the conversation has no LLM turns yet, or R2 entries were purged.");
|
|
@@ -22733,7 +22755,7 @@ async function conversationsCommand(args2) {
|
|
|
22733
22755
|
for (const { key, value } of annotations) {
|
|
22734
22756
|
const inferred = value.trim() !== "" && Number.isFinite(Number(value)) ? "numeric" : "categorical";
|
|
22735
22757
|
const type = annotationType ?? inferred;
|
|
22736
|
-
await
|
|
22758
|
+
await client2.annotateConversation(hubId, conversationId, { key, value, type });
|
|
22737
22759
|
results.push({ key, type });
|
|
22738
22760
|
}
|
|
22739
22761
|
if (jsonOutput) {
|
|
@@ -22753,8 +22775,8 @@ async function conversationsCommand(args2) {
|
|
|
22753
22775
|
}
|
|
22754
22776
|
if (conversationId) {
|
|
22755
22777
|
const [result, schedules] = await Promise.all([
|
|
22756
|
-
|
|
22757
|
-
|
|
22778
|
+
client2.getConversation(hubId, conversationId, { limit, offset }),
|
|
22779
|
+
client2.getPendingSchedules(hubId, conversationId).catch(() => ({ entries: [], total: 0 }))
|
|
22758
22780
|
]);
|
|
22759
22781
|
if (jsonOutput) {
|
|
22760
22782
|
console.log(JSON.stringify({ ...result, pending_schedules: schedules }, null, 2));
|
|
@@ -22827,7 +22849,7 @@ async function conversationsCommand(args2) {
|
|
|
22827
22849
|
console.log(`Drill in: wayai conversations ${conversationId} observability (per-turn resolved prompt, tool calls, latency)`);
|
|
22828
22850
|
} else if (crossHubScope) {
|
|
22829
22851
|
const window = resolveActivityWindow(period, from, to);
|
|
22830
|
-
const result = await listConversationsAcrossHubs(
|
|
22852
|
+
const result = await listConversationsAcrossHubs(client2, crossHubScope, {
|
|
22831
22853
|
status,
|
|
22832
22854
|
limit,
|
|
22833
22855
|
offset,
|
|
@@ -22875,7 +22897,7 @@ Partial listing: ${result.scopes_failed} of ${result.scopes_total} scope(s) coul
|
|
|
22875
22897
|
}
|
|
22876
22898
|
} else if (status && hasAnalyticsFlags) {
|
|
22877
22899
|
const window = resolveActivityWindow(period, from, to);
|
|
22878
|
-
const result = await
|
|
22900
|
+
const result = await client2.getConversations(hubId, {
|
|
22879
22901
|
status,
|
|
22880
22902
|
limit,
|
|
22881
22903
|
offset,
|
|
@@ -22907,7 +22929,7 @@ Partial listing: ${result.scopes_failed} of ${result.scopes_total} scope(s) coul
|
|
|
22907
22929
|
console.error(err instanceof Error ? err.message : String(err));
|
|
22908
22930
|
process.exit(1);
|
|
22909
22931
|
}
|
|
22910
|
-
const result = await
|
|
22932
|
+
const result = await client2.getAnalyticsConversations({
|
|
22911
22933
|
hub_id: hubId,
|
|
22912
22934
|
time_interval: { start, end },
|
|
22913
22935
|
limit: limit ?? 50,
|
|
@@ -22937,7 +22959,7 @@ Partial listing: ${result.scopes_failed} of ${result.scopes_total} scope(s) coul
|
|
|
22937
22959
|
console.log(` ${conv.conversation_id} ${participant.padEnd(20)} ${msgs.padEnd(10)} ${updated}`);
|
|
22938
22960
|
}
|
|
22939
22961
|
} else {
|
|
22940
|
-
const result = await
|
|
22962
|
+
const result = await client2.getConversations(hubId, { status, limit, offset });
|
|
22941
22963
|
printIndexList(result, jsonOutput);
|
|
22942
22964
|
}
|
|
22943
22965
|
}
|
|
@@ -23154,10 +23176,10 @@ async function alertsCommand(args2) {
|
|
|
23154
23176
|
if (jsonOutput) args2.splice(jsonIdx, 1);
|
|
23155
23177
|
const hubId = resolveActiveHubId(args2);
|
|
23156
23178
|
const { config, accessToken } = await requireAuth();
|
|
23157
|
-
const
|
|
23179
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
23158
23180
|
let alerts;
|
|
23159
23181
|
try {
|
|
23160
|
-
({ alerts } = await
|
|
23182
|
+
({ alerts } = await client2.getHubAlerts(hubId));
|
|
23161
23183
|
} catch (err) {
|
|
23162
23184
|
if (err instanceof ApiError && err.status === 404) {
|
|
23163
23185
|
console.error(`Hub ${hubId} not found, or you lack read access to it.`);
|
|
@@ -23180,7 +23202,7 @@ async function alertsCommand(args2) {
|
|
|
23180
23202
|
}
|
|
23181
23203
|
const connLabels = /* @__PURE__ */ new Map();
|
|
23182
23204
|
try {
|
|
23183
|
-
const { connections } = await
|
|
23205
|
+
const { connections } = await client2.listConnections(hubId);
|
|
23184
23206
|
for (const conn of connections) {
|
|
23185
23207
|
if (!conn.connection_id) continue;
|
|
23186
23208
|
const name = conn.connection_display_name || conn.connector_name;
|
|
@@ -23239,8 +23261,8 @@ async function deleteHistoryCommand(args2) {
|
|
|
23239
23261
|
const skipConfirm = args2.includes("-y") || args2.includes("--yes");
|
|
23240
23262
|
const userIdFlag = parseStringFlag(args2, "--user-id");
|
|
23241
23263
|
const conversationId = parseStringFlag(args2, "--conversation-id");
|
|
23242
|
-
const
|
|
23243
|
-
const userId = userIdFlag ?? (await
|
|
23264
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
23265
|
+
const userId = userIdFlag ?? (await client2.me()).user_id;
|
|
23244
23266
|
if (!skipConfirm) {
|
|
23245
23267
|
const confirmed = await confirm(
|
|
23246
23268
|
"This will permanently delete conversation history on this hub. Continue?"
|
|
@@ -23250,7 +23272,7 @@ async function deleteHistoryCommand(args2) {
|
|
|
23250
23272
|
return;
|
|
23251
23273
|
}
|
|
23252
23274
|
}
|
|
23253
|
-
const result = await (conversationId ?
|
|
23275
|
+
const result = await (conversationId ? client2.deleteHistory(hubId, { userId, mode: "current", conversationId }) : client2.deleteHistory(hubId, { userId, mode: "all" }));
|
|
23254
23276
|
console.log(`Deletion accepted and running durably (erasure ${result.erasure_id}).`);
|
|
23255
23277
|
}
|
|
23256
23278
|
var init_delete_history = __esm({
|
|
@@ -23296,9 +23318,9 @@ async function syncSkillsCommand(args2) {
|
|
|
23296
23318
|
const { connectionId } = parseArgs12(args2);
|
|
23297
23319
|
requireRepoConfig();
|
|
23298
23320
|
const { config, accessToken } = await requireAuth();
|
|
23299
|
-
const
|
|
23321
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
23300
23322
|
console.log("Syncing skills...");
|
|
23301
|
-
const response = await
|
|
23323
|
+
const response = await client2.syncSkills(hubId, connectionId);
|
|
23302
23324
|
printSyncResults(response);
|
|
23303
23325
|
const hasFailed = response.results.some((r) => r.failed > 0);
|
|
23304
23326
|
if (hasFailed) {
|
|
@@ -23351,10 +23373,10 @@ async function syncMcpCommand(args2) {
|
|
|
23351
23373
|
}
|
|
23352
23374
|
const { organization_id: organizationId } = requireRepoConfig();
|
|
23353
23375
|
const { config, accessToken } = await requireAuth();
|
|
23354
|
-
const
|
|
23376
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
23355
23377
|
if (check) {
|
|
23356
23378
|
console.log(`Checking MCP tool-schema drift for connection "${connection}"...`);
|
|
23357
|
-
const result2 = await
|
|
23379
|
+
const result2 = await client2.syncMcp(hubId, connection, organizationId, { check: true });
|
|
23358
23380
|
const drift = result2.drift ?? [];
|
|
23359
23381
|
if (result2.reachable === false) {
|
|
23360
23382
|
console.log(
|
|
@@ -23388,7 +23410,7 @@ Run \`wayai sync-mcp --connection "${result2.connection_name}"\` to refresh the
|
|
|
23388
23410
|
process.exit(1);
|
|
23389
23411
|
}
|
|
23390
23412
|
console.log(`Syncing MCP tools for connection "${connection}"...`);
|
|
23391
|
-
const result = await
|
|
23413
|
+
const result = await client2.syncMcp(hubId, connection, organizationId);
|
|
23392
23414
|
console.log(
|
|
23393
23415
|
result.message ?? `Synced ${result.tools_count ?? 0} tool(s) and ${result.resources_count ?? 0} resource(s) from MCP server`
|
|
23394
23416
|
);
|
|
@@ -23484,8 +23506,8 @@ async function evalsListCommand(args2) {
|
|
|
23484
23506
|
enabledFilter = "false";
|
|
23485
23507
|
}
|
|
23486
23508
|
}
|
|
23487
|
-
const
|
|
23488
|
-
const result = await
|
|
23509
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
23510
|
+
const result = await client2.getEvals(hubId, { enabled: enabledFilter });
|
|
23489
23511
|
if (result.data.evals.length === 0) {
|
|
23490
23512
|
console.log("No evals found.");
|
|
23491
23513
|
return;
|
|
@@ -23522,9 +23544,9 @@ async function evalsSqlSubcommand(args2) {
|
|
|
23522
23544
|
process.exit(1);
|
|
23523
23545
|
}
|
|
23524
23546
|
}
|
|
23525
|
-
const
|
|
23547
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
23526
23548
|
if (schemaOnly) {
|
|
23527
|
-
const schema = await
|
|
23549
|
+
const schema = await client2.getEvalsSqlSchema(hubId);
|
|
23528
23550
|
if (jsonOutput) {
|
|
23529
23551
|
console.log(JSON.stringify(schema.data, null, 2));
|
|
23530
23552
|
return;
|
|
@@ -23537,7 +23559,7 @@ async function evalsSqlSubcommand(args2) {
|
|
|
23537
23559
|
console.error("Or run: wayai evals sql --schema to list available columns and paths.");
|
|
23538
23560
|
process.exit(1);
|
|
23539
23561
|
}
|
|
23540
|
-
const result = await
|
|
23562
|
+
const result = await client2.runEvalsSql({
|
|
23541
23563
|
hub_id: hubId,
|
|
23542
23564
|
sql,
|
|
23543
23565
|
...limit !== void 0 && { limit }
|
|
@@ -23790,12 +23812,12 @@ async function runEvalCommand(args2) {
|
|
|
23790
23812
|
);
|
|
23791
23813
|
process.exit(1);
|
|
23792
23814
|
}
|
|
23793
|
-
const
|
|
23815
|
+
const client2 = new ApiClient({
|
|
23794
23816
|
apiUrl: config.api_url,
|
|
23795
23817
|
accessToken,
|
|
23796
23818
|
onUnauthorized: () => getAccessToken(config)
|
|
23797
23819
|
});
|
|
23798
|
-
const evalsResult = await
|
|
23820
|
+
const evalsResult = await client2.getEvals(hubId, { enabled: "true" });
|
|
23799
23821
|
const enabledCount = evalsResult.data.evals.length;
|
|
23800
23822
|
if (enabledCount === 0) {
|
|
23801
23823
|
console.error("No enabled evals found for this hub. Enable evals in the platform UI first.");
|
|
@@ -23804,7 +23826,7 @@ async function runEvalCommand(args2) {
|
|
|
23804
23826
|
console.log(`Found ${enabledCount} enabled eval${enabledCount === 1 ? "" : "s"}`);
|
|
23805
23827
|
let scenarioSetId;
|
|
23806
23828
|
if (setName) {
|
|
23807
|
-
const setsResult = await
|
|
23829
|
+
const setsResult = await client2.listScenarioSets(hubId);
|
|
23808
23830
|
const match = setsResult.data.scenario_sets.find((s) => s.set_name === setName);
|
|
23809
23831
|
if (!match) {
|
|
23810
23832
|
const available = setsResult.data.scenario_sets.map((s) => s.set_name).join(", ") || "(none)";
|
|
@@ -23839,17 +23861,17 @@ async function runEvalCommand(args2) {
|
|
|
23839
23861
|
}
|
|
23840
23862
|
const now = /* @__PURE__ */ new Date();
|
|
23841
23863
|
const sessionName = `CLI run ${now.toISOString().slice(0, 16).replace("T", " ")}`;
|
|
23842
|
-
const createResult = await
|
|
23864
|
+
const createResult = await client2.createEvalSession(hubId, sessionName, { scenarioSetId, pacing, scenarioSelection, callMode });
|
|
23843
23865
|
if (callMode) console.log("Call mode: every turn runs as a call turn is written");
|
|
23844
23866
|
const sessionId = createResult.data.session.eval_session_id;
|
|
23845
23867
|
const signalController = installEvalSignalHandlers({
|
|
23846
23868
|
hubId,
|
|
23847
23869
|
sessionId,
|
|
23848
|
-
stop: () =>
|
|
23870
|
+
stop: () => client2.stopEvalSession(hubId, sessionId)
|
|
23849
23871
|
});
|
|
23850
23872
|
try {
|
|
23851
23873
|
await pollEvalSession({
|
|
23852
|
-
client,
|
|
23874
|
+
client: client2,
|
|
23853
23875
|
hubId,
|
|
23854
23876
|
sessionId,
|
|
23855
23877
|
sessionName,
|
|
@@ -23865,7 +23887,7 @@ async function runEvalCommand(args2) {
|
|
|
23865
23887
|
}
|
|
23866
23888
|
}
|
|
23867
23889
|
async function pollEvalSession(input) {
|
|
23868
|
-
const { client, hubId, sessionId, sessionName, pacing, fixtureOverride, noWait, timeoutSeconds } = input;
|
|
23890
|
+
const { client: client2, hubId, sessionId, sessionName, pacing, fixtureOverride, noWait, timeoutSeconds } = input;
|
|
23869
23891
|
const noQueue = input.noQueue || noWait;
|
|
23870
23892
|
let queuedSeconds = 0;
|
|
23871
23893
|
const runDeadlineMs = Date.now() + timeoutSeconds * 1e3;
|
|
@@ -23879,7 +23901,7 @@ async function pollEvalSession(input) {
|
|
|
23879
23901
|
try {
|
|
23880
23902
|
const queueStartedMs = Date.now();
|
|
23881
23903
|
const runResult = await runWithFixtureQueue({
|
|
23882
|
-
attempt: () => fixtureOverride ?
|
|
23904
|
+
attempt: () => fixtureOverride ? client2.runEvalSession(hubId, sessionId, fixtureOverride) : client2.runEvalSession(hubId, sessionId),
|
|
23883
23905
|
deadlineMs: runDeadlineMs,
|
|
23884
23906
|
noQueue,
|
|
23885
23907
|
now: () => Date.now(),
|
|
@@ -23925,7 +23947,7 @@ Session ID: ${sessionId}`);
|
|
|
23925
23947
|
if (Date.now() >= runDeadlineMs) break;
|
|
23926
23948
|
let details;
|
|
23927
23949
|
try {
|
|
23928
|
-
details = await
|
|
23950
|
+
details = await client2.getEvalSessionDetails(hubId, sessionId);
|
|
23929
23951
|
consecutivePollErrors = 0;
|
|
23930
23952
|
} catch (err) {
|
|
23931
23953
|
if (++consecutivePollErrors >= MAX_CONSECUTIVE_POLL_ERRORS) {
|
|
@@ -23950,7 +23972,7 @@ Lost connection to the eval session: ${extractApiMessage(err)}`);
|
|
|
23950
23972
|
printResultsTable(results, "compact");
|
|
23951
23973
|
if (results.some((r) => r.failed_runs > 0)) {
|
|
23952
23974
|
try {
|
|
23953
|
-
const runsResult = await
|
|
23975
|
+
const runsResult = await client2.getEvalSessionRuns(hubId, sessionId);
|
|
23954
23976
|
printFailingRuns(runsResult.data.runs);
|
|
23955
23977
|
} catch (err) {
|
|
23956
23978
|
console.error(`
|
|
@@ -24105,23 +24127,23 @@ async function evalResultsCommand(args2) {
|
|
|
24105
24127
|
console.error(" wayai eval-results --eval <name> [--runs] [--json]");
|
|
24106
24128
|
process.exit(1);
|
|
24107
24129
|
}
|
|
24108
|
-
const
|
|
24130
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
24109
24131
|
if (evalName && !sessionId) {
|
|
24110
|
-
sessionId = await findLatestSessionForEval(
|
|
24132
|
+
sessionId = await findLatestSessionForEval(client2, hubId, evalName);
|
|
24111
24133
|
}
|
|
24112
24134
|
if (!sessionId) {
|
|
24113
24135
|
return;
|
|
24114
24136
|
}
|
|
24115
24137
|
if (showRuns) {
|
|
24116
|
-
await showRunDetails(
|
|
24138
|
+
await showRunDetails(client2, hubId, sessionId, evalName, jsonOutput);
|
|
24117
24139
|
} else {
|
|
24118
|
-
await showAggregateResults(
|
|
24140
|
+
await showAggregateResults(client2, hubId, sessionId, jsonOutput);
|
|
24119
24141
|
}
|
|
24120
24142
|
}
|
|
24121
|
-
async function findLatestSessionForEval(
|
|
24143
|
+
async function findLatestSessionForEval(client2, hubId, evalName) {
|
|
24122
24144
|
const [evalsResult, sessionsResult] = await Promise.all([
|
|
24123
|
-
|
|
24124
|
-
|
|
24145
|
+
client2.getEvals(hubId),
|
|
24146
|
+
client2.getEvalSessions(hubId, { status: "completed" })
|
|
24125
24147
|
]);
|
|
24126
24148
|
const matchingEval = evalsResult.data.evals.find(
|
|
24127
24149
|
(e) => e.eval_name.toLowerCase() === evalName.toLowerCase()
|
|
@@ -24136,7 +24158,7 @@ async function findLatestSessionForEval(client, hubId, evalName) {
|
|
|
24136
24158
|
process.exit(1);
|
|
24137
24159
|
}
|
|
24138
24160
|
for (const session of completedSessions) {
|
|
24139
|
-
const details = await
|
|
24161
|
+
const details = await client2.getEvalSessionDetails(hubId, session.eval_session_id);
|
|
24140
24162
|
const hasEval = details.data.results.some((r) => r.eval_id === matchingEval.eval_id);
|
|
24141
24163
|
if (hasEval) {
|
|
24142
24164
|
return session.eval_session_id;
|
|
@@ -24145,8 +24167,8 @@ async function findLatestSessionForEval(client, hubId, evalName) {
|
|
|
24145
24167
|
console.error(`No completed session found containing eval "${evalName}".`);
|
|
24146
24168
|
process.exit(1);
|
|
24147
24169
|
}
|
|
24148
|
-
async function showAggregateResults(
|
|
24149
|
-
const details = await
|
|
24170
|
+
async function showAggregateResults(client2, hubId, sessionId, jsonOutput) {
|
|
24171
|
+
const details = await client2.getEvalSessionDetails(hubId, sessionId);
|
|
24150
24172
|
if (jsonOutput) {
|
|
24151
24173
|
console.log(JSON.stringify(details.data, null, 2));
|
|
24152
24174
|
return;
|
|
@@ -24164,8 +24186,8 @@ async function showAggregateResults(client, hubId, sessionId, jsonOutput) {
|
|
|
24164
24186
|
console.log("");
|
|
24165
24187
|
printResultsTable(results, "detailed");
|
|
24166
24188
|
}
|
|
24167
|
-
async function showRunDetails(
|
|
24168
|
-
const details = await
|
|
24189
|
+
async function showRunDetails(client2, hubId, sessionId, evalNameFilter, jsonOutput) {
|
|
24190
|
+
const details = await client2.getEvalSessionDetails(hubId, sessionId);
|
|
24169
24191
|
let evalId;
|
|
24170
24192
|
if (evalNameFilter) {
|
|
24171
24193
|
const matchingResult = details.data.results.find(
|
|
@@ -24175,7 +24197,7 @@ async function showRunDetails(client, hubId, sessionId, evalNameFilter, jsonOutp
|
|
|
24175
24197
|
evalId = matchingResult.eval_id;
|
|
24176
24198
|
}
|
|
24177
24199
|
}
|
|
24178
|
-
const runsResult = await
|
|
24200
|
+
const runsResult = await client2.getEvalSessionRuns(hubId, sessionId, { evalId });
|
|
24179
24201
|
if (jsonOutput) {
|
|
24180
24202
|
console.log(JSON.stringify(runsResult.data, null, 2));
|
|
24181
24203
|
return;
|
|
@@ -26017,14 +26039,14 @@ ${signal} received: hanging up the call in progress and closing its eval convers
|
|
|
26017
26039
|
dispose
|
|
26018
26040
|
};
|
|
26019
26041
|
}
|
|
26020
|
-
async function findJourney(
|
|
26042
|
+
async function findJourney(client2, hubId, selector) {
|
|
26021
26043
|
if (UUID_RE3.test(selector)) {
|
|
26022
26044
|
try {
|
|
26023
|
-
return (await
|
|
26045
|
+
return (await client2.getJourney(hubId, selector)).data.journey;
|
|
26024
26046
|
} catch {
|
|
26025
26047
|
}
|
|
26026
26048
|
}
|
|
26027
|
-
return (await
|
|
26049
|
+
return (await client2.listJourneys(hubId)).data.journeys.find((j) => j.journey_name === selector) ?? null;
|
|
26028
26050
|
}
|
|
26029
26051
|
async function evalCallCommand(argv) {
|
|
26030
26052
|
if (wantsHelp(argv)) {
|
|
@@ -26044,8 +26066,8 @@ async function evalCallCommand(argv) {
|
|
|
26044
26066
|
console.error(extractApiMessage(err));
|
|
26045
26067
|
process.exit(1);
|
|
26046
26068
|
}
|
|
26047
|
-
const
|
|
26048
|
-
const journey = await findJourney(
|
|
26069
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken, onUnauthorized: () => getAccessToken(config) });
|
|
26070
|
+
const journey = await findJourney(client2, hubId, options.journey);
|
|
26049
26071
|
if (!journey) {
|
|
26050
26072
|
console.error(`No journey "${options.journey}" on this hub.`);
|
|
26051
26073
|
process.exit(1);
|
|
@@ -26066,7 +26088,7 @@ async function evalCallCommand(argv) {
|
|
|
26066
26088
|
let report2;
|
|
26067
26089
|
try {
|
|
26068
26090
|
report2 = await runCallEvalSuite({
|
|
26069
|
-
api:
|
|
26091
|
+
api: client2,
|
|
26070
26092
|
hubId,
|
|
26071
26093
|
script,
|
|
26072
26094
|
audio,
|
|
@@ -26232,7 +26254,7 @@ async function evalCaptureCommand(args2) {
|
|
|
26232
26254
|
const parsed = parseArgs14(args2);
|
|
26233
26255
|
const { config, accessToken } = await requireAuth();
|
|
26234
26256
|
requireRepoConfig();
|
|
26235
|
-
const
|
|
26257
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
26236
26258
|
const hubFolder = findLocalHubFolder(hubId);
|
|
26237
26259
|
if (!hubFolder) {
|
|
26238
26260
|
console.error("Could not find a local hub folder for this hub. Run `wayai pull` first.");
|
|
@@ -26264,15 +26286,15 @@ async function evalCaptureCommand(args2) {
|
|
|
26264
26286
|
process.exit(1);
|
|
26265
26287
|
}
|
|
26266
26288
|
console.log("Resolving scenario set...");
|
|
26267
|
-
const sets = await
|
|
26289
|
+
const sets = await client2.listScenarioSets(hubId);
|
|
26268
26290
|
let scenarioSetId = sets.data.scenario_sets.find((s) => s.set_name === targetSetName)?.scenario_set_id;
|
|
26269
26291
|
if (!scenarioSetId) {
|
|
26270
26292
|
console.log(`Creating scenario set "${targetSetName}"...`);
|
|
26271
|
-
const created = await
|
|
26293
|
+
const created = await client2.createScenarioSet(hubId, targetSetName);
|
|
26272
26294
|
scenarioSetId = created.data.scenario_set.scenario_set_id;
|
|
26273
26295
|
}
|
|
26274
26296
|
console.log(`Capturing conversation ${parsed.conversationId}...`);
|
|
26275
|
-
const result = await
|
|
26297
|
+
const result = await client2.createScenarioFromConversation({
|
|
26276
26298
|
hub_id: hubId,
|
|
26277
26299
|
conversation_id: parsed.conversationId,
|
|
26278
26300
|
scenario_set_id: scenarioSetId,
|
|
@@ -26360,10 +26382,10 @@ async function journeyCaptureCommand(args2) {
|
|
|
26360
26382
|
const parsed = parseArgs15(args2);
|
|
26361
26383
|
const { config, accessToken } = await requireAuth();
|
|
26362
26384
|
requireRepoConfig();
|
|
26363
|
-
const
|
|
26385
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
26364
26386
|
const journeyName = parsed.journeyName ?? `Journey ${parsed.conversationId.slice(0, 8)}`;
|
|
26365
26387
|
console.log(`Capturing conversation ${parsed.conversationId} as a journey...`);
|
|
26366
|
-
const result = await
|
|
26388
|
+
const result = await client2.createJourneyFromConversation({
|
|
26367
26389
|
hub_id: hubId,
|
|
26368
26390
|
conversation_id: parsed.conversationId,
|
|
26369
26391
|
journey_name: journeyName,
|
|
@@ -26407,9 +26429,9 @@ async function evalSessionStopCommand(args2) {
|
|
|
26407
26429
|
console.error(`Invalid session id: ${sessionId}`);
|
|
26408
26430
|
process.exit(1);
|
|
26409
26431
|
}
|
|
26410
|
-
const
|
|
26432
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
26411
26433
|
try {
|
|
26412
|
-
const outcome = classifyStopOutcome(await
|
|
26434
|
+
const outcome = classifyStopOutcome(await client2.stopEvalSession(hubId, sessionId));
|
|
26413
26435
|
if (outcome.kind === "already_finished") {
|
|
26414
26436
|
console.log(`Eval session ${sessionId} had already finished (${outcome.status}) \u2014 nothing was cancelled.`);
|
|
26415
26437
|
console.log(`See its results: ${formatEvalResultsCommand(sessionId, hubId)}`);
|
|
@@ -26462,7 +26484,7 @@ async function evalSessionDeleteCommand(args2) {
|
|
|
26462
26484
|
console.error(`Invalid session id: ${sessionId}`);
|
|
26463
26485
|
process.exit(1);
|
|
26464
26486
|
}
|
|
26465
|
-
const
|
|
26487
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
26466
26488
|
if (deleteAll) {
|
|
26467
26489
|
if (!skipConfirm) {
|
|
26468
26490
|
const confirmed = await confirm(
|
|
@@ -26474,7 +26496,7 @@ async function evalSessionDeleteCommand(args2) {
|
|
|
26474
26496
|
}
|
|
26475
26497
|
}
|
|
26476
26498
|
try {
|
|
26477
|
-
const result = await
|
|
26499
|
+
const result = await client2.deleteAllEvalSessions(hubId);
|
|
26478
26500
|
console.log(
|
|
26479
26501
|
`Deleted ${result.data.deleted_sessions} session(s) and ${result.data.deleted_conversations} eval conversation(s).`
|
|
26480
26502
|
);
|
|
@@ -26498,7 +26520,7 @@ async function evalSessionDeleteCommand(args2) {
|
|
|
26498
26520
|
}
|
|
26499
26521
|
}
|
|
26500
26522
|
try {
|
|
26501
|
-
const result = await
|
|
26523
|
+
const result = await client2.deleteEvalSession(hubId, sessionId);
|
|
26502
26524
|
const deletedConversations = result.data?.deleted_conversations ?? 0;
|
|
26503
26525
|
console.log(`Deleted session ${sessionId} (${deletedConversations} eval conversation(s)).`);
|
|
26504
26526
|
} catch (err) {
|
|
@@ -26714,9 +26736,9 @@ async function analyticsSummaryCommand(args2) {
|
|
|
26714
26736
|
jsonOutput = true;
|
|
26715
26737
|
}
|
|
26716
26738
|
}
|
|
26717
|
-
const
|
|
26739
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
26718
26740
|
if (listMetrics) {
|
|
26719
|
-
const result2 = await
|
|
26741
|
+
const result2 = await client2.getAnalyticsVariables(hubId);
|
|
26720
26742
|
if (jsonOutput) {
|
|
26721
26743
|
console.log(JSON.stringify(result2.data, null, 2));
|
|
26722
26744
|
return;
|
|
@@ -26759,7 +26781,7 @@ async function analyticsSummaryCommand(args2) {
|
|
|
26759
26781
|
let variableNameMap;
|
|
26760
26782
|
const needsCatalog = metricNames && metricNames.length > 0 || filterArgs.length > 0;
|
|
26761
26783
|
if (needsCatalog) {
|
|
26762
|
-
const varsResult = await
|
|
26784
|
+
const varsResult = await client2.getAnalyticsVariables(hubId);
|
|
26763
26785
|
allVars = Object.values(varsResult.data.variablesByCategory).flat();
|
|
26764
26786
|
variableNameMap = new Map(allVars.map((v) => [v.variable_id, v.variable_name]));
|
|
26765
26787
|
}
|
|
@@ -26784,7 +26806,7 @@ Available metrics:
|
|
|
26784
26806
|
if (filterArgs.length > 0 && allVars) {
|
|
26785
26807
|
parsedFilters = filterArgs.map((raw) => parseFilterByName(raw, allVars));
|
|
26786
26808
|
}
|
|
26787
|
-
const result = await
|
|
26809
|
+
const result = await client2.getAnalyticsData({
|
|
26788
26810
|
hub_id: hubId,
|
|
26789
26811
|
selected_variables: selectedVariables,
|
|
26790
26812
|
time_interval: { start, end },
|
|
@@ -26918,8 +26940,8 @@ async function analyticsQuerySubcommand(args2) {
|
|
|
26918
26940
|
const filters = filterArgs.map(parseStructuredFilter);
|
|
26919
26941
|
const orderBy = orderByArgs.map(parseOrderBy);
|
|
26920
26942
|
const groupBy = groupByRaw ? groupByRaw.split(",").map((s) => s.trim()).filter(Boolean) : void 0;
|
|
26921
|
-
const
|
|
26922
|
-
const result = await
|
|
26943
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
26944
|
+
const result = await client2.runAnalyticsQuery({
|
|
26923
26945
|
hub_id: hubId,
|
|
26924
26946
|
metrics,
|
|
26925
26947
|
...groupBy && groupBy.length > 0 && { group_by: groupBy },
|
|
@@ -26957,11 +26979,11 @@ async function analyticsSqlSubcommand(args2) {
|
|
|
26957
26979
|
process.exit(1);
|
|
26958
26980
|
}
|
|
26959
26981
|
}
|
|
26960
|
-
const
|
|
26982
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
26961
26983
|
if (schemaOnly) {
|
|
26962
26984
|
const [conversation, message] = await Promise.all([
|
|
26963
|
-
|
|
26964
|
-
|
|
26985
|
+
client2.getAnalyticsSqlSchema(hubId, "conversation"),
|
|
26986
|
+
client2.getAnalyticsSqlSchema(hubId, "message")
|
|
26965
26987
|
]);
|
|
26966
26988
|
const notes = messageGrainNotes();
|
|
26967
26989
|
if (jsonOutput) {
|
|
@@ -26984,7 +27006,7 @@ async function analyticsSqlSubcommand(args2) {
|
|
|
26984
27006
|
console.error("Or run: wayai analytics sql --schema to list available columns and paths (data.* paths need a cast).");
|
|
26985
27007
|
process.exit(1);
|
|
26986
27008
|
}
|
|
26987
|
-
const result = await
|
|
27009
|
+
const result = await client2.runAnalyticsSql({
|
|
26988
27010
|
hub_id: hubId,
|
|
26989
27011
|
sql,
|
|
26990
27012
|
...limit !== void 0 && { limit }
|
|
@@ -27351,11 +27373,11 @@ async function createCredentialCommand(args2) {
|
|
|
27351
27373
|
process.exit(1);
|
|
27352
27374
|
}
|
|
27353
27375
|
const { config, accessToken } = await requireAuth();
|
|
27354
|
-
const
|
|
27355
|
-
const { organizationId } = await resolveOrganizationId(
|
|
27376
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
27377
|
+
const { organizationId } = await resolveOrganizationId(client2, parsed.orgId);
|
|
27356
27378
|
let tagIds;
|
|
27357
27379
|
if (parsed.tags.length > 0) {
|
|
27358
|
-
const orgTags = await
|
|
27380
|
+
const orgTags = await client2.listOrgTags(organizationId);
|
|
27359
27381
|
tagIds = resolveTagIds(parsed.tags, orgTags.data || []);
|
|
27360
27382
|
}
|
|
27361
27383
|
const secrets = {};
|
|
@@ -27398,7 +27420,7 @@ async function createCredentialCommand(args2) {
|
|
|
27398
27420
|
console.log(`Creating credential "${parsed.name}" (${authType})...`);
|
|
27399
27421
|
let result;
|
|
27400
27422
|
try {
|
|
27401
|
-
result = await
|
|
27423
|
+
result = await client2.createOrgCredential({
|
|
27402
27424
|
organization_id: organizationId,
|
|
27403
27425
|
credential_display_name: parsed.name,
|
|
27404
27426
|
authentication_type: authType,
|
|
@@ -27488,9 +27510,9 @@ async function updateCredentialCommand(args2) {
|
|
|
27488
27510
|
process.exit(1);
|
|
27489
27511
|
}
|
|
27490
27512
|
const { config, accessToken } = await requireAuth();
|
|
27491
|
-
const
|
|
27492
|
-
const { organizationId } = await resolveOrganizationId(
|
|
27493
|
-
const list = await
|
|
27513
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
27514
|
+
const { organizationId } = await resolveOrganizationId(client2, parsed.orgId);
|
|
27515
|
+
const list = await client2.listOrgCredentials(organizationId);
|
|
27494
27516
|
const matches = (list.data || []).filter((c) => c.credential_display_name === parsed.name);
|
|
27495
27517
|
if (matches.length === 0) {
|
|
27496
27518
|
console.error(`No credential named "${parsed.name}" found in this organization.`);
|
|
@@ -27548,13 +27570,13 @@ async function updateCredentialCommand(args2) {
|
|
|
27548
27570
|
if (parsed.description !== void 0) body.credential_description = parsed.description;
|
|
27549
27571
|
if (parsed.environment) body.environment = parsed.environment;
|
|
27550
27572
|
if (parsed.hasTagFlag) {
|
|
27551
|
-
const orgTags = await
|
|
27573
|
+
const orgTags = await client2.listOrgTags(organizationId);
|
|
27552
27574
|
body.tags = resolveTagIds(parsed.tags, orgTags.data || []);
|
|
27553
27575
|
}
|
|
27554
27576
|
console.log(`Updating credential "${parsed.name}"...`);
|
|
27555
27577
|
let result;
|
|
27556
27578
|
try {
|
|
27557
|
-
result = await
|
|
27579
|
+
result = await client2.updateOrgCredential(credential.organization_credential_id, organizationId, body);
|
|
27558
27580
|
} catch (err) {
|
|
27559
27581
|
if (err instanceof ApiError && err.status === 409) {
|
|
27560
27582
|
console.error(`
|
|
@@ -27625,10 +27647,10 @@ async function setConnectionCredentialCommand(args2) {
|
|
|
27625
27647
|
}
|
|
27626
27648
|
const { organization_id: organizationId } = requireRepoConfig();
|
|
27627
27649
|
const { config, accessToken } = await requireAuth();
|
|
27628
|
-
const
|
|
27650
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
27629
27651
|
let environment = localHubEnvironment(hubId);
|
|
27630
27652
|
if (!environment) {
|
|
27631
|
-
const { hubs } = await
|
|
27653
|
+
const { hubs } = await client2.listHubs(organizationId);
|
|
27632
27654
|
if (hubs.some((h) => h.hub_id === hubId)) environment = "preview";
|
|
27633
27655
|
else if (hubs.some((h) => h.production_hub_id === hubId)) environment = "production";
|
|
27634
27656
|
}
|
|
@@ -27636,7 +27658,7 @@ async function setConnectionCredentialCommand(args2) {
|
|
|
27636
27658
|
usage2(`Could not resolve hub "${hubId}". Pull it first (\`wayai pull --hub ${hubId}\`) or check the id.`);
|
|
27637
27659
|
}
|
|
27638
27660
|
const isProduction = environment === "production";
|
|
27639
|
-
const { connections } = await
|
|
27661
|
+
const { connections } = await client2.listConnections(hubId);
|
|
27640
27662
|
const conn = connections.find(
|
|
27641
27663
|
(c) => c.connection_id === parsed.connection || c.connection_display_name === parsed.connection
|
|
27642
27664
|
);
|
|
@@ -27644,7 +27666,7 @@ async function setConnectionCredentialCommand(args2) {
|
|
|
27644
27666
|
const connectionId = conn.connection_id;
|
|
27645
27667
|
const body = { hub_id: hubId };
|
|
27646
27668
|
if (orgMode) {
|
|
27647
|
-
const { data: creds } = await
|
|
27669
|
+
const { data: creds } = await client2.listOrgCredentials(organizationId);
|
|
27648
27670
|
const cred = creds.find((c) => c.credential_display_name === parsed.orgCredential);
|
|
27649
27671
|
if (!cred) usage2(`Organization credential "${parsed.orgCredential}" not found.`);
|
|
27650
27672
|
body.organization_credential_id = cred.organization_credential_id;
|
|
@@ -27659,9 +27681,9 @@ async function setConnectionCredentialCommand(args2) {
|
|
|
27659
27681
|
const target = isProduction ? "production" : "preview";
|
|
27660
27682
|
console.log(`Setting ${orgMode ? `org credential "${parsed.orgCredential}"` : `${parsed.field}`} on ${target} connection "${conn.connection_display_name}"...`);
|
|
27661
27683
|
if (isProduction) {
|
|
27662
|
-
await
|
|
27684
|
+
await client2.setProductionConnectionCredential(connectionId, body);
|
|
27663
27685
|
} else {
|
|
27664
|
-
await
|
|
27686
|
+
await client2.setPreviewConnectionCredential(connectionId, body);
|
|
27665
27687
|
}
|
|
27666
27688
|
console.log("Credential set.");
|
|
27667
27689
|
}
|
|
@@ -27781,8 +27803,8 @@ async function resolveContext() {
|
|
|
27781
27803
|
}
|
|
27782
27804
|
warnLayoutOnce(gitRoot);
|
|
27783
27805
|
const { config, accessToken } = await requireAuth();
|
|
27784
|
-
const
|
|
27785
|
-
return { orgId, orgDir: getOrgDir(gitRoot), client };
|
|
27806
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
27807
|
+
return { orgId, orgDir: getOrgDir(gitRoot), client: client2 };
|
|
27786
27808
|
}
|
|
27787
27809
|
async function orgCommand(args2) {
|
|
27788
27810
|
const sub = args2[0];
|
|
@@ -27825,9 +27847,9 @@ async function orgCreate(args2) {
|
|
|
27825
27847
|
}
|
|
27826
27848
|
const region = getFlagValue(args2, "--region");
|
|
27827
27849
|
const { config, accessToken } = await requireAuth();
|
|
27828
|
-
const
|
|
27850
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
27829
27851
|
if (!json) console.log(`Creating organization "${name}"...`);
|
|
27830
|
-
const { organization } = await
|
|
27852
|
+
const { organization } = await client2.createOrganization(name, region);
|
|
27831
27853
|
if (json) {
|
|
27832
27854
|
console.log(JSON.stringify(organization, null, 2));
|
|
27833
27855
|
return;
|
|
@@ -27842,12 +27864,12 @@ Scope a repo to it with \`wayai init --org ${organization.id}\`.`);
|
|
|
27842
27864
|
}
|
|
27843
27865
|
async function orgPull(args2) {
|
|
27844
27866
|
const { autoConfirm } = parseFlags(args2);
|
|
27845
|
-
const { orgId, orgDir, client } = await resolveContext();
|
|
27867
|
+
const { orgId, orgDir, client: client2 } = await resolveContext();
|
|
27846
27868
|
console.log("Fetching organization resources...");
|
|
27847
|
-
const payload = await
|
|
27869
|
+
const payload = await client2.pullOrgResources(orgId);
|
|
27848
27870
|
if (orgManifestExists(orgDir) && !autoConfirm) {
|
|
27849
27871
|
const local = parseOrgResources(orgDir);
|
|
27850
|
-
const diff = await
|
|
27872
|
+
const diff = await client2.diffOrgResources(orgId, local, "push");
|
|
27851
27873
|
if (diff.has_changes) {
|
|
27852
27874
|
console.log("\nLocal org/ differs from the platform. Pulling overwrites local with the platform state:");
|
|
27853
27875
|
printDiff(diff.summary);
|
|
@@ -27864,13 +27886,13 @@ async function orgPull(args2) {
|
|
|
27864
27886
|
}
|
|
27865
27887
|
async function orgDiff(args2) {
|
|
27866
27888
|
void args2;
|
|
27867
|
-
const { orgId, orgDir, client } = await resolveContext();
|
|
27889
|
+
const { orgId, orgDir, client: client2 } = await resolveContext();
|
|
27868
27890
|
if (!orgManifestExists(orgDir)) {
|
|
27869
27891
|
console.error(`No ${orgDir}/resources.yaml found. Run \`wayai org pull\` first.`);
|
|
27870
27892
|
process.exit(1);
|
|
27871
27893
|
}
|
|
27872
27894
|
const local = parseOrgResources(orgDir);
|
|
27873
|
-
const diff = await
|
|
27895
|
+
const diff = await client2.diffOrgResources(orgId, local, "push");
|
|
27874
27896
|
if (!diff.has_changes) {
|
|
27875
27897
|
console.log("No changes \u2014 org/ matches the platform.");
|
|
27876
27898
|
return;
|
|
@@ -27880,13 +27902,13 @@ async function orgDiff(args2) {
|
|
|
27880
27902
|
}
|
|
27881
27903
|
async function orgPush(args2) {
|
|
27882
27904
|
const { autoConfirm } = parseFlags(args2);
|
|
27883
|
-
const { orgId, orgDir, client } = await resolveContext();
|
|
27905
|
+
const { orgId, orgDir, client: client2 } = await resolveContext();
|
|
27884
27906
|
if (!orgManifestExists(orgDir)) {
|
|
27885
27907
|
console.error(`No ${orgDir}/resources.yaml found. Run \`wayai org pull\` first.`);
|
|
27886
27908
|
process.exit(1);
|
|
27887
27909
|
}
|
|
27888
27910
|
const local = parseOrgResources(orgDir);
|
|
27889
|
-
const diff = await
|
|
27911
|
+
const diff = await client2.diffOrgResources(orgId, local, "push");
|
|
27890
27912
|
if (!diff.has_changes) {
|
|
27891
27913
|
console.log("No changes \u2014 org/ already matches the platform.");
|
|
27892
27914
|
return;
|
|
@@ -27900,7 +27922,7 @@ async function orgPush(args2) {
|
|
|
27900
27922
|
return;
|
|
27901
27923
|
}
|
|
27902
27924
|
}
|
|
27903
|
-
const result = await
|
|
27925
|
+
const result = await client2.pushOrgResources(orgId, local);
|
|
27904
27926
|
const c = result.changes;
|
|
27905
27927
|
console.log(
|
|
27906
27928
|
`Pushed: ${c.resources_created} created, ${c.resources_updated} updated, ${c.resources_deleted} deleted; ${c.resource_files_uploaded} file(s) uploaded, ${c.resource_files_deleted} deleted.`
|
|
@@ -27913,7 +27935,7 @@ async function orgPush(args2) {
|
|
|
27913
27935
|
console.warn("\nCompleted with errors:");
|
|
27914
27936
|
for (const e of result.errors) console.warn(` - ${e}`);
|
|
27915
27937
|
}
|
|
27916
|
-
const refreshed = await
|
|
27938
|
+
const refreshed = await client2.pullOrgResources(orgId);
|
|
27917
27939
|
writeOrgResources(orgDir, refreshed);
|
|
27918
27940
|
await downloadOrgBinaryFiles(orgDir, refreshed);
|
|
27919
27941
|
}
|
|
@@ -27952,8 +27974,8 @@ function parseArgs19(args2) {
|
|
|
27952
27974
|
async function listCommand(args2) {
|
|
27953
27975
|
const { orgId, json } = parseArgs19(args2);
|
|
27954
27976
|
const { config, accessToken } = await requireAuth();
|
|
27955
|
-
const
|
|
27956
|
-
const { organizations } = await
|
|
27977
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
27978
|
+
const { organizations } = await client2.organizations();
|
|
27957
27979
|
const orgsToList = orgId ? organizations.filter((o) => o.id === orgId) : organizations;
|
|
27958
27980
|
if (orgsToList.length === 0) {
|
|
27959
27981
|
if (json) {
|
|
@@ -27964,7 +27986,7 @@ async function listCommand(args2) {
|
|
|
27964
27986
|
return;
|
|
27965
27987
|
}
|
|
27966
27988
|
const results = await Promise.all(
|
|
27967
|
-
orgsToList.map((org) =>
|
|
27989
|
+
orgsToList.map((org) => client2.listHubs(org.id).then((r) => ({ org, hubs: r.hubs })))
|
|
27968
27990
|
);
|
|
27969
27991
|
if (json) {
|
|
27970
27992
|
const payload = {
|
|
@@ -28002,6 +28024,373 @@ var init_list = __esm({
|
|
|
28002
28024
|
}
|
|
28003
28025
|
});
|
|
28004
28026
|
|
|
28027
|
+
// src/data/output.ts
|
|
28028
|
+
function printOutput(data, format) {
|
|
28029
|
+
if (format === "json") {
|
|
28030
|
+
console.log(JSON.stringify(data, null, 2));
|
|
28031
|
+
return;
|
|
28032
|
+
}
|
|
28033
|
+
if (Array.isArray(data)) {
|
|
28034
|
+
printRows(data);
|
|
28035
|
+
return;
|
|
28036
|
+
}
|
|
28037
|
+
if (typeof data === "object" && data !== null) {
|
|
28038
|
+
printFields(data);
|
|
28039
|
+
return;
|
|
28040
|
+
}
|
|
28041
|
+
console.log(formatCell2(data));
|
|
28042
|
+
}
|
|
28043
|
+
function printRows(rows) {
|
|
28044
|
+
if (rows.length === 0) {
|
|
28045
|
+
console.log("(no results)");
|
|
28046
|
+
return;
|
|
28047
|
+
}
|
|
28048
|
+
const columns = [];
|
|
28049
|
+
const seen = /* @__PURE__ */ new Set();
|
|
28050
|
+
for (const row of rows) {
|
|
28051
|
+
for (const key of Object.keys(row ?? {})) {
|
|
28052
|
+
if (seen.has(key)) continue;
|
|
28053
|
+
seen.add(key);
|
|
28054
|
+
columns.push(key);
|
|
28055
|
+
}
|
|
28056
|
+
}
|
|
28057
|
+
const headers = columns.map((c) => sanitizeTerminalText(c));
|
|
28058
|
+
const cells = rows.map((row) => columns.map((c) => cellAt(row, c)));
|
|
28059
|
+
const widths = columns.map(
|
|
28060
|
+
(_, i) => cells.reduce((width, row) => Math.max(width, row[i].length), headers[i].length)
|
|
28061
|
+
);
|
|
28062
|
+
console.log(headers.map((c, i) => c.padEnd(widths[i])).join(" "));
|
|
28063
|
+
console.log(widths.map((w) => "-".repeat(w)).join(" "));
|
|
28064
|
+
for (const row of cells) {
|
|
28065
|
+
console.log(row.map((cell, i) => cell.padEnd(widths[i])).join(" "));
|
|
28066
|
+
}
|
|
28067
|
+
}
|
|
28068
|
+
function printFields(obj) {
|
|
28069
|
+
const entries = Object.entries(obj).map(([key, value]) => ({
|
|
28070
|
+
key: sanitizeTerminalText(key),
|
|
28071
|
+
value
|
|
28072
|
+
}));
|
|
28073
|
+
if (entries.length === 0) {
|
|
28074
|
+
console.log("(empty)");
|
|
28075
|
+
return;
|
|
28076
|
+
}
|
|
28077
|
+
const width = entries.reduce((w, e) => Math.max(w, e.key.length), 0);
|
|
28078
|
+
for (const { key, value } of entries) {
|
|
28079
|
+
console.log(`${key.padEnd(width)} ${formatCell2(value)}`);
|
|
28080
|
+
}
|
|
28081
|
+
}
|
|
28082
|
+
function printBatchResult(response) {
|
|
28083
|
+
const obj = response && typeof response === "object" ? response : {};
|
|
28084
|
+
const results = Array.isArray(obj.results) ? obj.results : [];
|
|
28085
|
+
const batchId = typeof obj.batch_id === "string" ? obj.batch_id : "(none)";
|
|
28086
|
+
console.log(
|
|
28087
|
+
`batch_id: ${sanitizeTerminalText(batchId)} \xB7 ${results.length} operation${results.length === 1 ? "" : "s"}`
|
|
28088
|
+
);
|
|
28089
|
+
if (results.length === 0) return;
|
|
28090
|
+
printRows(
|
|
28091
|
+
results.map((r, i) => ({
|
|
28092
|
+
"#": String(i),
|
|
28093
|
+
operation: r?.type ?? "",
|
|
28094
|
+
result: summarizeBatchResult(r)
|
|
28095
|
+
}))
|
|
28096
|
+
);
|
|
28097
|
+
}
|
|
28098
|
+
function summarizeBatchResult(r) {
|
|
28099
|
+
if (!r || typeof r !== "object") return String(r ?? "");
|
|
28100
|
+
if (r.deleted === true) return "deleted";
|
|
28101
|
+
const entity = r.record ?? r.relationship ?? r.record_type;
|
|
28102
|
+
if (entity && typeof entity === "object") {
|
|
28103
|
+
const e = entity;
|
|
28104
|
+
const id = typeof e.id === "string" ? e.id : void 0;
|
|
28105
|
+
const label = typeof e.record_type === "string" ? e.record_type : typeof e.rel_type === "string" ? e.rel_type : typeof e.name === "string" ? e.name : void 0;
|
|
28106
|
+
const version = e.version != null ? ` v${String(e.version)}` : "";
|
|
28107
|
+
if (id && label) return `${label}/${id}${version}`;
|
|
28108
|
+
if (id) return `${id}${version}`;
|
|
28109
|
+
}
|
|
28110
|
+
return JSON.stringify(r);
|
|
28111
|
+
}
|
|
28112
|
+
function cellAt(row, column) {
|
|
28113
|
+
return formatCell2(row?.[column]);
|
|
28114
|
+
}
|
|
28115
|
+
function formatCell2(value) {
|
|
28116
|
+
if (value === null || value === void 0) return "";
|
|
28117
|
+
if (typeof value === "object") return sanitizeTerminalText(JSON.stringify(value));
|
|
28118
|
+
return sanitizeTerminalText(String(value));
|
|
28119
|
+
}
|
|
28120
|
+
var init_output = __esm({
|
|
28121
|
+
"src/data/output.ts"() {
|
|
28122
|
+
"use strict";
|
|
28123
|
+
init_terminal_output();
|
|
28124
|
+
}
|
|
28125
|
+
});
|
|
28126
|
+
|
|
28127
|
+
// src/commands/communities.ts
|
|
28128
|
+
var communities_exports = {};
|
|
28129
|
+
__export(communities_exports, {
|
|
28130
|
+
communitiesCommand: () => communitiesCommand
|
|
28131
|
+
});
|
|
28132
|
+
import { parseArgs as parseArgs20 } from "util";
|
|
28133
|
+
function parse(args2) {
|
|
28134
|
+
try {
|
|
28135
|
+
const { values, positionals } = parseArgs20({
|
|
28136
|
+
args: args2,
|
|
28137
|
+
options: { org: { type: "string" }, json: { type: "boolean" }, yes: { type: "boolean", short: "y" } },
|
|
28138
|
+
allowPositionals: true,
|
|
28139
|
+
strict: true
|
|
28140
|
+
});
|
|
28141
|
+
return { positionals, org: values.org, json: values.json === true, yes: values.yes === true };
|
|
28142
|
+
} catch (err) {
|
|
28143
|
+
throw usageError(err instanceof Error ? err.message : String(err));
|
|
28144
|
+
}
|
|
28145
|
+
}
|
|
28146
|
+
function usageError(message) {
|
|
28147
|
+
return expected(`${message}
|
|
28148
|
+
|
|
28149
|
+
${USAGE2}`);
|
|
28150
|
+
}
|
|
28151
|
+
function resolveOrgId(flag) {
|
|
28152
|
+
if (flag !== void 0) {
|
|
28153
|
+
const parsed = communityOrgParam.safeParse({ orgId: flag });
|
|
28154
|
+
if (!parsed.success) throw expected(`Invalid --org ${JSON.stringify(flag)}: expected an organization id (a UUID).`);
|
|
28155
|
+
return parsed.data.orgId;
|
|
28156
|
+
}
|
|
28157
|
+
const bound = readRepoConfigUnlessBlocked()?.organization_id;
|
|
28158
|
+
if (bound) return bound;
|
|
28159
|
+
throw expected("No organization: pass --org <org_id>, or run this inside a workspace scoped with `wayai init`.");
|
|
28160
|
+
}
|
|
28161
|
+
function targetOf(selector, orgFlag) {
|
|
28162
|
+
const asId = communityIdParam.safeParse({ communityId: selector });
|
|
28163
|
+
if (asId.success) {
|
|
28164
|
+
if (orgFlag !== void 0) resolveOrgId(orgFlag);
|
|
28165
|
+
return { kind: "id", id: asId.data.communityId };
|
|
28166
|
+
}
|
|
28167
|
+
return { kind: "name", name: selector, orgId: resolveOrgId(orgFlag) };
|
|
28168
|
+
}
|
|
28169
|
+
function communitiesFailure(err, notFound) {
|
|
28170
|
+
if (!(err instanceof ApiError)) return err;
|
|
28171
|
+
if (err.status === 403 && extractApiErrorCode(err) === "AUTHORIZATION_ERROR") {
|
|
28172
|
+
const override2 = envTokenOverride() ? " WAYAI_TOKEN is set in this shell and is sent instead of your sign-in: unset it first." : "";
|
|
28173
|
+
return expected(
|
|
28174
|
+
`Communities are managed from a browser sign-in only, and this login is an API token. Run \`wayai login\` (without --token).${override2}`
|
|
28175
|
+
);
|
|
28176
|
+
}
|
|
28177
|
+
if (err.status === 404) return expected(notFound);
|
|
28178
|
+
if (err.status === 429) {
|
|
28179
|
+
const seconds2 = retryAfterSeconds(err);
|
|
28180
|
+
return expected(
|
|
28181
|
+
`Too many requests: every community request shares one per-person budget with your web console and your messages. Try again ${seconds2 === null ? "in a minute" : `in ${seconds2} s`}.`
|
|
28182
|
+
);
|
|
28183
|
+
}
|
|
28184
|
+
return err;
|
|
28185
|
+
}
|
|
28186
|
+
function retryAfterSeconds(err) {
|
|
28187
|
+
try {
|
|
28188
|
+
const value = JSON.parse(err.body).details?.retryAfter;
|
|
28189
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.ceil(value) : null;
|
|
28190
|
+
} catch {
|
|
28191
|
+
return null;
|
|
28192
|
+
}
|
|
28193
|
+
}
|
|
28194
|
+
async function call(request, notFound) {
|
|
28195
|
+
try {
|
|
28196
|
+
return await request;
|
|
28197
|
+
} catch (err) {
|
|
28198
|
+
throw communitiesFailure(err, notFound);
|
|
28199
|
+
}
|
|
28200
|
+
}
|
|
28201
|
+
async function client() {
|
|
28202
|
+
const { config, accessToken } = await requireAuth();
|
|
28203
|
+
return new ApiClient({ apiUrl: config.api_url, accessToken, onUnauthorized: () => getAccessToken(config) });
|
|
28204
|
+
}
|
|
28205
|
+
async function resolveCommunity(api, target) {
|
|
28206
|
+
if (target.kind === "id") return { id: target.id, label: target.id };
|
|
28207
|
+
const { data } = await call(api.listOrgCommunities(target.orgId), orgNotFound(target.orgId));
|
|
28208
|
+
const matches = data.filter((c) => c.name === target.name);
|
|
28209
|
+
if (matches.length === 1) {
|
|
28210
|
+
const [c] = matches;
|
|
28211
|
+
return { id: c.community_id, label: `"${sanitizeTerminalText(c.name)}" (${c.community_id})` };
|
|
28212
|
+
}
|
|
28213
|
+
if (matches.length === 0) {
|
|
28214
|
+
throw expected(
|
|
28215
|
+
`No community named ${JSON.stringify(target.name)} in organization ${target.orgId}. Run \`wayai communities list\` to see its communities.`
|
|
28216
|
+
);
|
|
28217
|
+
}
|
|
28218
|
+
throw expected(
|
|
28219
|
+
`${matches.length} communities in organization ${target.orgId} are named ${JSON.stringify(target.name)}; name one by its id:
|
|
28220
|
+
${matches.map((c) => ` ${c.community_id} created ${c.created_at}`).join("\n")}`
|
|
28221
|
+
);
|
|
28222
|
+
}
|
|
28223
|
+
async function communitiesCommand(args2) {
|
|
28224
|
+
if (wantsHelp(args2) || args2.length === 0) {
|
|
28225
|
+
console.log(USAGE2);
|
|
28226
|
+
return;
|
|
28227
|
+
}
|
|
28228
|
+
const { positionals, org, json, yes } = parse(args2);
|
|
28229
|
+
const [sub, ...rest] = positionals;
|
|
28230
|
+
if (sub === void 0) throw usageError("No subcommand given.");
|
|
28231
|
+
if (!SUBCOMMANDS.includes(sub)) throw usageError(`Unknown subcommand ${JSON.stringify(sub)}.`);
|
|
28232
|
+
const [action] = rest;
|
|
28233
|
+
if (sub === "join-link" && !JOIN_LINK_ACTIONS.includes(action)) {
|
|
28234
|
+
throw usageError("join-link takes get, rotate or off.");
|
|
28235
|
+
}
|
|
28236
|
+
const changesLink = sub === "join-link" && action !== "get";
|
|
28237
|
+
if (yes && !changesLink) throw usageError("-y applies only to `join-link rotate` and `join-link off`.");
|
|
28238
|
+
switch (sub) {
|
|
28239
|
+
case "list":
|
|
28240
|
+
if (rest.length > 0) throw usageError(`Unexpected argument ${JSON.stringify(rest[0])}.`);
|
|
28241
|
+
return runList(resolveOrgId(org), json);
|
|
28242
|
+
case "join-link": {
|
|
28243
|
+
const [, selector, ...extra] = rest;
|
|
28244
|
+
if (selector === void 0 || extra.length > 0) throw usageError(`join-link ${action} takes one <community>.`);
|
|
28245
|
+
if (changesLink && !yes && !isInteractive()) {
|
|
28246
|
+
throw usageError(`join-link ${action} asks before it changes the link; pass -y when not running in a terminal.`);
|
|
28247
|
+
}
|
|
28248
|
+
return runJoinLink(action, targetOf(selector, org), { json, yes });
|
|
28249
|
+
}
|
|
28250
|
+
case "stats": {
|
|
28251
|
+
const [selector, ...extra] = rest;
|
|
28252
|
+
if (selector === void 0 || extra.length > 0) throw usageError("stats takes one <community>.");
|
|
28253
|
+
return runStats(targetOf(selector, org), json);
|
|
28254
|
+
}
|
|
28255
|
+
}
|
|
28256
|
+
}
|
|
28257
|
+
async function runList(orgId, json) {
|
|
28258
|
+
const api = await client();
|
|
28259
|
+
const { data } = await call(api.listOrgCommunities(orgId), orgNotFound(orgId));
|
|
28260
|
+
if (json) {
|
|
28261
|
+
console.log(JSON.stringify(data, null, 2));
|
|
28262
|
+
return;
|
|
28263
|
+
}
|
|
28264
|
+
if (data.length === 0) {
|
|
28265
|
+
console.log(`Organization ${orgId} owns no communities.`);
|
|
28266
|
+
return;
|
|
28267
|
+
}
|
|
28268
|
+
console.log(`Communities of ${sanitizeTerminalText(data[0].org_name)} (${orgId})
|
|
28269
|
+
`);
|
|
28270
|
+
printRows(data.map((c) => ({ name: c.name, community_id: c.community_id, created_at: c.created_at })));
|
|
28271
|
+
}
|
|
28272
|
+
async function runJoinLink(action, target, { json, yes }) {
|
|
28273
|
+
const api = await client();
|
|
28274
|
+
const { id, label } = await resolveCommunity(api, target);
|
|
28275
|
+
const notFound = communityNotFound(label);
|
|
28276
|
+
if (action === "get") {
|
|
28277
|
+
const { data: data2 } = await call(api.getCommunityJoinLink(id), notFound);
|
|
28278
|
+
printLink(data2, label, json);
|
|
28279
|
+
return;
|
|
28280
|
+
}
|
|
28281
|
+
console.error(
|
|
28282
|
+
action === "rotate" ? `This replaces the join link of ${label} with a new one and turns it on.` : `This turns off the join link of ${label}.`
|
|
28283
|
+
);
|
|
28284
|
+
console.error("Every link shared before stops working.");
|
|
28285
|
+
if (!yes && !await confirm("Proceed?")) throw expected("Aborted: the join link is unchanged.");
|
|
28286
|
+
const { data } = await call(
|
|
28287
|
+
action === "rotate" ? api.replaceCommunityJoinLink(id) : api.disableCommunityJoinLink(id),
|
|
28288
|
+
notFound
|
|
28289
|
+
);
|
|
28290
|
+
printLink(data, label, json);
|
|
28291
|
+
}
|
|
28292
|
+
function printLink(link, label, json) {
|
|
28293
|
+
if (json) {
|
|
28294
|
+
console.log(JSON.stringify(link, null, 2));
|
|
28295
|
+
return;
|
|
28296
|
+
}
|
|
28297
|
+
if (link.enabled && link.url) {
|
|
28298
|
+
console.log(`The join link of ${label} is on:`);
|
|
28299
|
+
console.log(sanitizeTerminalText(link.url));
|
|
28300
|
+
return;
|
|
28301
|
+
}
|
|
28302
|
+
console.log(`The join link of ${label} is off. \`wayai communities join-link rotate\` makes a new one.`);
|
|
28303
|
+
}
|
|
28304
|
+
async function runStats(target, json) {
|
|
28305
|
+
const api = await client();
|
|
28306
|
+
const { id, label } = await resolveCommunity(api, target);
|
|
28307
|
+
const { data } = await call(api.getCommunityStats(id), communityNotFound(label));
|
|
28308
|
+
if (json) {
|
|
28309
|
+
console.log(JSON.stringify(data, null, 2));
|
|
28310
|
+
return;
|
|
28311
|
+
}
|
|
28312
|
+
printStats(data, label);
|
|
28313
|
+
}
|
|
28314
|
+
function printStats(stats, label) {
|
|
28315
|
+
const { members, joins } = stats;
|
|
28316
|
+
const sum = (key) => stats.days.reduce((total, day) => total + day[key], 0);
|
|
28317
|
+
const [chat, posts, replies] = [sum("messages"), sum("posts"), sum("replies")];
|
|
28318
|
+
console.log(`Stats of ${label}
|
|
28319
|
+
`);
|
|
28320
|
+
console.log(`Members ${COMMUNITY_MEMBER_STATUSES.map((status) => `${members[status]} ${status}`).join(" \xB7 ")}`);
|
|
28321
|
+
console.log(`Active ${stats.active_members_7d} in the last 7 days`);
|
|
28322
|
+
console.log(`Joins ${joins.joins_30d} in the last 30 days \xB7 ${joins.joins_7d} in the last 7`);
|
|
28323
|
+
console.log(`New accounts ${joins.new_accounts_30d} in the last 30 days \xB7 ${joins.new_accounts_7d} in the last 7 (made in the join flow)`);
|
|
28324
|
+
console.log(
|
|
28325
|
+
`Messages ${chat + posts + replies} in the last ${COMMUNITY_STATS_DAYS} days (${chat} chat \xB7 ${posts} posts \xB7 ${replies} replies)`
|
|
28326
|
+
);
|
|
28327
|
+
console.log("\nJoins by source tag, last 30 days");
|
|
28328
|
+
if (stats.joins_by_source.length === 0) {
|
|
28329
|
+
console.log(" Nobody joined in the last 30 days.");
|
|
28330
|
+
} else {
|
|
28331
|
+
printRows(stats.joins_by_source.map((s) => ({
|
|
28332
|
+
source: s.source ?? "(no tag)",
|
|
28333
|
+
joins_7d: s.joins_7d,
|
|
28334
|
+
joins_30d: s.joins_30d,
|
|
28335
|
+
new_accounts_30d: s.new_accounts_30d
|
|
28336
|
+
})));
|
|
28337
|
+
}
|
|
28338
|
+
const courses = stats.courses ?? [];
|
|
28339
|
+
if (courses.length === 0) return;
|
|
28340
|
+
console.log("\nCourse completions, per lesson");
|
|
28341
|
+
for (const course of courses) {
|
|
28342
|
+
console.log(` ${sanitizeTerminalText(course.title)}${course.published ? "" : " (draft)"}`);
|
|
28343
|
+
for (const lesson of course.lessons) {
|
|
28344
|
+
console.log(` ${String(lesson.completions).padStart(6)} ${sanitizeTerminalText(lesson.title)}${lesson.published ? "" : " (draft)"}`);
|
|
28345
|
+
}
|
|
28346
|
+
}
|
|
28347
|
+
}
|
|
28348
|
+
var USAGE2, SUBCOMMANDS, JOIN_LINK_ACTIONS, orgNotFound, communityNotFound;
|
|
28349
|
+
var init_communities = __esm({
|
|
28350
|
+
"src/commands/communities.ts"() {
|
|
28351
|
+
"use strict";
|
|
28352
|
+
init_contracts();
|
|
28353
|
+
init_auth();
|
|
28354
|
+
init_api_client();
|
|
28355
|
+
init_errors2();
|
|
28356
|
+
init_expected();
|
|
28357
|
+
init_repo_config();
|
|
28358
|
+
init_terminal_output();
|
|
28359
|
+
init_token_store();
|
|
28360
|
+
init_utils();
|
|
28361
|
+
init_helpers();
|
|
28362
|
+
init_output();
|
|
28363
|
+
USAGE2 = `
|
|
28364
|
+
wayai communities \u2014 an organization's communities, for its owners and admins
|
|
28365
|
+
|
|
28366
|
+
Usage:
|
|
28367
|
+
wayai communities list [--org <org_id>] [--json]
|
|
28368
|
+
wayai communities join-link get <community> [--org <org_id>] [--json]
|
|
28369
|
+
wayai communities join-link rotate <community> [--org <org_id>] [-y] [--json]
|
|
28370
|
+
wayai communities join-link off <community> [--org <org_id>] [-y] [--json]
|
|
28371
|
+
wayai communities stats <community> [--org <org_id>] [--json]
|
|
28372
|
+
|
|
28373
|
+
<community> is a community id, or its exact name within the organization.
|
|
28374
|
+
The organization is --org, else this repo's (wayai-ws/wayai.yaml).
|
|
28375
|
+
|
|
28376
|
+
join-link get Print the join link, or that it is off
|
|
28377
|
+
join-link rotate Replace the link with a new one and turn it on
|
|
28378
|
+
join-link off Turn the link off
|
|
28379
|
+
stats Members, joins by source, messages and course completions
|
|
28380
|
+
|
|
28381
|
+
rotate and off make every link shared before stop working. Both ask first;
|
|
28382
|
+
-y skips the question, and is required when not run in a terminal.
|
|
28383
|
+
|
|
28384
|
+
These commands need a browser sign-in (\`wayai login\`). An API token
|
|
28385
|
+
(\`wayai login --token\`, or WAYAI_TOKEN) is refused.
|
|
28386
|
+
`.trim();
|
|
28387
|
+
SUBCOMMANDS = ["list", "join-link", "stats"];
|
|
28388
|
+
JOIN_LINK_ACTIONS = ["get", "rotate", "off"];
|
|
28389
|
+
orgNotFound = (orgId) => `Organization ${orgId} not found, or you are not an owner or admin of it.`;
|
|
28390
|
+
communityNotFound = (label) => `Community ${label} not found, or you are not an owner or admin of its organization.`;
|
|
28391
|
+
}
|
|
28392
|
+
});
|
|
28393
|
+
|
|
28005
28394
|
// src/lib/report-edit-args.ts
|
|
28006
28395
|
function parseReportEditArgs(args2) {
|
|
28007
28396
|
const patch = {};
|
|
@@ -28419,10 +28808,10 @@ async function runDoTables(positional) {
|
|
|
28419
28808
|
const type = validateType(positional[0]);
|
|
28420
28809
|
const id = positional[1];
|
|
28421
28810
|
const { config, accessToken } = await requireAuth();
|
|
28422
|
-
const
|
|
28811
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
28423
28812
|
let response;
|
|
28424
28813
|
try {
|
|
28425
|
-
response = await
|
|
28814
|
+
response = await client2.debugListTables(type, id);
|
|
28426
28815
|
} catch (err) {
|
|
28427
28816
|
exitOnApiError(err);
|
|
28428
28817
|
throw err;
|
|
@@ -28444,10 +28833,10 @@ async function runDoRead(positional, flagArgs) {
|
|
|
28444
28833
|
const table = positional[2];
|
|
28445
28834
|
const { limit, filterId, jsonOutput } = parseFlags2(flagArgs, ["--limit", "--id", "--json"]);
|
|
28446
28835
|
const { config, accessToken } = await requireAuth();
|
|
28447
|
-
const
|
|
28836
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
28448
28837
|
let response;
|
|
28449
28838
|
try {
|
|
28450
|
-
response = await
|
|
28839
|
+
response = await client2.debugReadTable(type, id, table, { limit, id: filterId });
|
|
28451
28840
|
} catch (err) {
|
|
28452
28841
|
exitOnApiError(err);
|
|
28453
28842
|
throw err;
|
|
@@ -28456,10 +28845,10 @@ async function runDoRead(positional, flagArgs) {
|
|
|
28456
28845
|
}
|
|
28457
28846
|
async function runAnalyticsTables() {
|
|
28458
28847
|
const { config, accessToken } = await requireAuth();
|
|
28459
|
-
const
|
|
28848
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
28460
28849
|
let response;
|
|
28461
28850
|
try {
|
|
28462
|
-
response = await
|
|
28851
|
+
response = await client2.debugListAnalyticsTables();
|
|
28463
28852
|
} catch (err) {
|
|
28464
28853
|
exitOnApiError(err);
|
|
28465
28854
|
throw err;
|
|
@@ -28479,10 +28868,10 @@ async function runAnalyticsRead(positional, flagArgs) {
|
|
|
28479
28868
|
const table = validateAnalyticsTable(positional[0]);
|
|
28480
28869
|
const flags = parseFlags2(flagArgs, ["--limit", "--json", "--conversation-id", "--hub-id", "--message-id"]);
|
|
28481
28870
|
const { config, accessToken } = await requireAuth();
|
|
28482
|
-
const
|
|
28871
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
28483
28872
|
let response;
|
|
28484
28873
|
try {
|
|
28485
|
-
response = await
|
|
28874
|
+
response = await client2.debugReadAnalyticsTable(table, {
|
|
28486
28875
|
conversationId: flags.conversationId,
|
|
28487
28876
|
hubId: flags.hubId,
|
|
28488
28877
|
messageId: flags.messageId,
|
|
@@ -28503,12 +28892,12 @@ async function runArchiveRead(positional, flagArgs) {
|
|
|
28503
28892
|
const conversationId = positional[1];
|
|
28504
28893
|
const flags = parseFlags2(flagArgs, ["--json", "--message-id", "--sandbox", "--out"]);
|
|
28505
28894
|
const { config, accessToken } = await requireAuth();
|
|
28506
|
-
const
|
|
28895
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
28507
28896
|
if (flags.sandbox) {
|
|
28508
28897
|
const outPath = flags.out || `${conversationId}-sandbox.zip`;
|
|
28509
28898
|
let zip;
|
|
28510
28899
|
try {
|
|
28511
|
-
zip = await
|
|
28900
|
+
zip = await client2.downloadArchiveSandboxFs(hubId, conversationId);
|
|
28512
28901
|
} catch (err) {
|
|
28513
28902
|
if (err instanceof ApiError && err.status === 404) {
|
|
28514
28903
|
console.error("Sandbox archive not found. This conversation had no harness sandbox, or the R2 blob was purged.");
|
|
@@ -28523,7 +28912,7 @@ async function runArchiveRead(positional, flagArgs) {
|
|
|
28523
28912
|
}
|
|
28524
28913
|
let response;
|
|
28525
28914
|
try {
|
|
28526
|
-
response = await
|
|
28915
|
+
response = await client2.debugReadArchive(hubId, conversationId, {
|
|
28527
28916
|
messageId: flags.messageId
|
|
28528
28917
|
});
|
|
28529
28918
|
} catch (err) {
|
|
@@ -28568,9 +28957,9 @@ async function runObservabilityRead(positional, flagArgs) {
|
|
|
28568
28957
|
const conversationId = positional[1];
|
|
28569
28958
|
const flags = parseFlags2(flagArgs, ["--json", "--message-id"]);
|
|
28570
28959
|
const { config, accessToken } = await requireAuth();
|
|
28571
|
-
const
|
|
28960
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
28572
28961
|
try {
|
|
28573
|
-
await runDebugObservability(
|
|
28962
|
+
await runDebugObservability(client2, hubId, conversationId, {
|
|
28574
28963
|
messageId: flags.messageId,
|
|
28575
28964
|
jsonOutput: flags.jsonOutput
|
|
28576
28965
|
});
|
|
@@ -28650,10 +29039,10 @@ async function runSkillInstall(positional) {
|
|
|
28650
29039
|
process.exit(1);
|
|
28651
29040
|
}
|
|
28652
29041
|
const { config, accessToken } = await requireAuth();
|
|
28653
|
-
const
|
|
29042
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
28654
29043
|
let res;
|
|
28655
29044
|
try {
|
|
28656
|
-
res = await
|
|
29045
|
+
res = await client2.adminSkillInstall(name);
|
|
28657
29046
|
} catch (err) {
|
|
28658
29047
|
exitOnApiError(err);
|
|
28659
29048
|
throw err;
|
|
@@ -28671,7 +29060,7 @@ async function runSkillInstall(positional) {
|
|
|
28671
29060
|
console.log("Reload your agent (e.g. restart Claude Code) to pick up the skill.");
|
|
28672
29061
|
}
|
|
28673
29062
|
async function runSandboxExec(positional, flagArgs) {
|
|
28674
|
-
const
|
|
29063
|
+
const USAGE3 = 'wayai admin sandbox exec [--cmd "<command>" | <command>] --hub <hub_id> --connection <connection_id> [--egress open|allowlist|isolated] [--allow <host> ...] [--timeout <ms>] [--json]';
|
|
28675
29064
|
let hubId;
|
|
28676
29065
|
let connectionId;
|
|
28677
29066
|
let egress;
|
|
@@ -28725,7 +29114,7 @@ async function runSandboxExec(positional, flagArgs) {
|
|
|
28725
29114
|
const positionalCmd = positional[0];
|
|
28726
29115
|
if (positional.length > 1) {
|
|
28727
29116
|
console.error("Provide the command as a single quoted argument (or use --cmd).");
|
|
28728
|
-
console.error(
|
|
29117
|
+
console.error(USAGE3);
|
|
28729
29118
|
process.exit(1);
|
|
28730
29119
|
}
|
|
28731
29120
|
if (positionalCmd && cmdFlag) {
|
|
@@ -28734,7 +29123,7 @@ async function runSandboxExec(positional, flagArgs) {
|
|
|
28734
29123
|
}
|
|
28735
29124
|
const cmd = cmdFlag ?? positionalCmd;
|
|
28736
29125
|
if (!cmd || !hubId || !connectionId) {
|
|
28737
|
-
console.error(
|
|
29126
|
+
console.error(USAGE3);
|
|
28738
29127
|
process.exit(1);
|
|
28739
29128
|
}
|
|
28740
29129
|
const body = {
|
|
@@ -28746,10 +29135,10 @@ async function runSandboxExec(positional, flagArgs) {
|
|
|
28746
29135
|
...timeoutMs !== void 0 ? { timeout_ms: timeoutMs } : {}
|
|
28747
29136
|
};
|
|
28748
29137
|
const { config, accessToken } = await requireAuth();
|
|
28749
|
-
const
|
|
29138
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
28750
29139
|
let response;
|
|
28751
29140
|
try {
|
|
28752
|
-
response = await
|
|
29141
|
+
response = await client2.adminSandboxExec(body);
|
|
28753
29142
|
} catch (err) {
|
|
28754
29143
|
exitOnApiError(err);
|
|
28755
29144
|
throw err;
|
|
@@ -28831,8 +29220,8 @@ function parseScopedTargetFlags(flagArgs, usage3, opts = {}) {
|
|
|
28831
29220
|
return { body: { scope: "hub", hub_id: hubId, dry_run: dryRun }, targetLabel: `hub ${hubId}`, dryRun, yes, jsonOutput };
|
|
28832
29221
|
}
|
|
28833
29222
|
async function runRepairTeamOrphans(flagArgs) {
|
|
28834
|
-
const
|
|
28835
|
-
const { body, targetLabel, dryRun, yes, jsonOutput } = parseScopedTargetFlags(flagArgs,
|
|
29223
|
+
const USAGE3 = "wayai admin hubs repair-team-orphans --all | --org <org_id> | --hub <hub_id> [--dry-run] [--yes] [--json]";
|
|
29224
|
+
const { body, targetLabel, dryRun, yes, jsonOutput } = parseScopedTargetFlags(flagArgs, USAGE3);
|
|
28836
29225
|
if (!dryRun && !yes && !jsonOutput) {
|
|
28837
29226
|
console.log(`About to PURGE dangling team references in: ${targetLabel}.`);
|
|
28838
29227
|
console.log("Memberships pointing at a deleted team are removed (HubDO + UserDO mirror); conversations pinned to one are unassigned.");
|
|
@@ -28844,10 +29233,10 @@ async function runRepairTeamOrphans(flagArgs) {
|
|
|
28844
29233
|
}
|
|
28845
29234
|
}
|
|
28846
29235
|
const { config, accessToken } = await requireAuth();
|
|
28847
|
-
const
|
|
29236
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
28848
29237
|
let response;
|
|
28849
29238
|
try {
|
|
28850
|
-
response = await
|
|
29239
|
+
response = await client2.adminRepairTeamOrphans(body);
|
|
28851
29240
|
} catch (err) {
|
|
28852
29241
|
exitOnApiError(err);
|
|
28853
29242
|
throw err;
|
|
@@ -28878,7 +29267,7 @@ async function runRepairTeamOrphans(flagArgs) {
|
|
|
28878
29267
|
}
|
|
28879
29268
|
}
|
|
28880
29269
|
async function runRepairBranchingOrphans(flagArgs) {
|
|
28881
|
-
const
|
|
29270
|
+
const USAGE3 = "wayai admin hubs repair-branching-orphans --all | --org <org_id> | --hub <hub_id> [--id <type>:<id> ...] [--dry-run] [--yes] [--json]";
|
|
28882
29271
|
const targets = [];
|
|
28883
29272
|
const scopeArgs = [];
|
|
28884
29273
|
for (let i = 0; i < flagArgs.length; i++) {
|
|
@@ -28896,10 +29285,10 @@ async function runRepairBranchingOrphans(flagArgs) {
|
|
|
28896
29285
|
}
|
|
28897
29286
|
targets.push({ entity_type: entityType, entity_id: entityId });
|
|
28898
29287
|
}
|
|
28899
|
-
const { body, targetLabel, dryRun, yes, jsonOutput } = parseScopedTargetFlags(scopeArgs,
|
|
29288
|
+
const { body, targetLabel, dryRun, yes, jsonOutput } = parseScopedTargetFlags(scopeArgs, USAGE3);
|
|
28900
29289
|
if (targets.length > 0 && body.scope !== "hub") {
|
|
28901
29290
|
console.error("--id deletes rows of ONE production hub: combine it with --hub <hub_id>.");
|
|
28902
|
-
console.error(
|
|
29291
|
+
console.error(USAGE3);
|
|
28903
29292
|
process.exit(1);
|
|
28904
29293
|
}
|
|
28905
29294
|
if (targets.length > 0 && !dryRun && !yes && !jsonOutput) {
|
|
@@ -28914,10 +29303,10 @@ async function runRepairBranchingOrphans(flagArgs) {
|
|
|
28914
29303
|
}
|
|
28915
29304
|
}
|
|
28916
29305
|
const { config, accessToken } = await requireAuth();
|
|
28917
|
-
const
|
|
29306
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
28918
29307
|
let response;
|
|
28919
29308
|
try {
|
|
28920
|
-
response = await
|
|
29309
|
+
response = await client2.adminRepairBranchingOrphans(targets.length > 0 ? { ...body, targets } : body);
|
|
28921
29310
|
} catch (err) {
|
|
28922
29311
|
exitOnApiError(err);
|
|
28923
29312
|
throw err;
|
|
@@ -28961,8 +29350,8 @@ async function runRepairBranchingOrphans(flagArgs) {
|
|
|
28961
29350
|
}
|
|
28962
29351
|
}
|
|
28963
29352
|
async function runRepairLegacyOrgGrants(flagArgs) {
|
|
28964
|
-
const
|
|
28965
|
-
const scoped = parseScopedTargetFlags(flagArgs,
|
|
29353
|
+
const USAGE3 = "wayai admin orgs repair-legacy-grants --all | --org <org_id> [--dry-run] [--yes] [--json]";
|
|
29354
|
+
const scoped = parseScopedTargetFlags(flagArgs, USAGE3, {
|
|
28966
29355
|
scopes: ["all", "org"],
|
|
28967
29356
|
allLabel: "ALL organizations (platform-wide)"
|
|
28968
29357
|
});
|
|
@@ -28980,10 +29369,10 @@ async function runRepairLegacyOrgGrants(flagArgs) {
|
|
|
28980
29369
|
}
|
|
28981
29370
|
}
|
|
28982
29371
|
const { config, accessToken } = await requireAuth();
|
|
28983
|
-
const
|
|
29372
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
28984
29373
|
let response;
|
|
28985
29374
|
try {
|
|
28986
|
-
response = await
|
|
29375
|
+
response = await client2.adminRepairLegacyOrgGrants(body);
|
|
28987
29376
|
} catch (err) {
|
|
28988
29377
|
exitOnApiError(err);
|
|
28989
29378
|
throw err;
|
|
@@ -29014,8 +29403,8 @@ async function runRepairLegacyOrgGrants(flagArgs) {
|
|
|
29014
29403
|
}
|
|
29015
29404
|
}
|
|
29016
29405
|
async function runHarnessMassDestroy(flagArgs) {
|
|
29017
|
-
const
|
|
29018
|
-
const { body, targetLabel, dryRun, yes, jsonOutput } = parseScopedTargetFlags(flagArgs,
|
|
29406
|
+
const USAGE3 = "wayai admin harness mass-destroy --all | --org <org_id> | --hub <hub_id> [--dry-run] [--yes] [--json]";
|
|
29407
|
+
const { body, targetLabel, dryRun, yes, jsonOutput } = parseScopedTargetFlags(flagArgs, USAGE3);
|
|
29019
29408
|
if (!dryRun && !yes && !jsonOutput) {
|
|
29020
29409
|
console.log(`About to REAP every live harness sandbox / token / slot in: ${targetLabel}.`);
|
|
29021
29410
|
console.log("This destroys running sandboxes and revokes their tokens. Run with --dry-run first to see the blast radius.");
|
|
@@ -29026,10 +29415,10 @@ async function runHarnessMassDestroy(flagArgs) {
|
|
|
29026
29415
|
}
|
|
29027
29416
|
}
|
|
29028
29417
|
const { config, accessToken } = await requireAuth();
|
|
29029
|
-
const
|
|
29418
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29030
29419
|
let response;
|
|
29031
29420
|
try {
|
|
29032
|
-
response = await
|
|
29421
|
+
response = await client2.adminHarnessMassDestroy(body);
|
|
29033
29422
|
} catch (err) {
|
|
29034
29423
|
exitOnApiError(err);
|
|
29035
29424
|
throw err;
|
|
@@ -29074,9 +29463,9 @@ function readGateValue(data, key) {
|
|
|
29074
29463
|
}
|
|
29075
29464
|
async function patchPlatformGate(gate, enable) {
|
|
29076
29465
|
const { config, accessToken } = await requireAuth();
|
|
29077
|
-
const
|
|
29466
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29078
29467
|
try {
|
|
29079
|
-
const res = await
|
|
29468
|
+
const res = await client2.adminUpdateConfig({ [gate.key]: enable ? 1 : 0 });
|
|
29080
29469
|
return readGateValue(res.data, gate.key);
|
|
29081
29470
|
} catch (err) {
|
|
29082
29471
|
exitOnApiError(err);
|
|
@@ -29086,10 +29475,10 @@ async function patchPlatformGate(gate, enable) {
|
|
|
29086
29475
|
async function runPlatformGateStatus(gate, flagArgs) {
|
|
29087
29476
|
rejectPlatformGateFlags(gate, "status", flagArgs);
|
|
29088
29477
|
const { config, accessToken } = await requireAuth();
|
|
29089
|
-
const
|
|
29478
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29090
29479
|
let data;
|
|
29091
29480
|
try {
|
|
29092
|
-
data = (await
|
|
29481
|
+
data = (await client2.adminGetConfig()).data;
|
|
29093
29482
|
} catch (err) {
|
|
29094
29483
|
exitOnApiError(err);
|
|
29095
29484
|
throw err;
|
|
@@ -29149,10 +29538,10 @@ async function runVoiceCallsPrice(flagArgs) {
|
|
|
29149
29538
|
process.exit(1);
|
|
29150
29539
|
}
|
|
29151
29540
|
const { config, accessToken } = await requireAuth();
|
|
29152
|
-
const
|
|
29541
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29153
29542
|
let data;
|
|
29154
29543
|
try {
|
|
29155
|
-
data = raw === void 0 ? (await
|
|
29544
|
+
data = raw === void 0 ? (await client2.adminGetConfig()).data : (await client2.adminUpdateConfig({ voice_call_minute_ops: Number(raw) })).data;
|
|
29156
29545
|
} catch (err) {
|
|
29157
29546
|
exitOnApiError(err);
|
|
29158
29547
|
throw err;
|
|
@@ -29209,10 +29598,10 @@ async function runCommunitiesCreate(flagArgs) {
|
|
|
29209
29598
|
process.exit(1);
|
|
29210
29599
|
}
|
|
29211
29600
|
const { config, accessToken } = await requireAuth();
|
|
29212
|
-
const
|
|
29601
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29213
29602
|
let data;
|
|
29214
29603
|
try {
|
|
29215
|
-
data = (await
|
|
29604
|
+
data = (await client2.adminCreateCommunity(parsed.data)).data;
|
|
29216
29605
|
} catch (err) {
|
|
29217
29606
|
if (err instanceof ApiError && err.status === 404) {
|
|
29218
29607
|
console.error(`Organization ${parsed.data.org_id} not found.`);
|
|
@@ -29267,10 +29656,10 @@ async function runCommunitiesDestroy(positional, flagArgs) {
|
|
|
29267
29656
|
}
|
|
29268
29657
|
}
|
|
29269
29658
|
const { config, accessToken } = await requireAuth();
|
|
29270
|
-
const
|
|
29659
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29271
29660
|
let data;
|
|
29272
29661
|
try {
|
|
29273
|
-
data = (await
|
|
29662
|
+
data = (await client2.adminDestroyCommunity(communityId)).data;
|
|
29274
29663
|
} catch (err) {
|
|
29275
29664
|
if (err instanceof ApiError && err.status === 404) {
|
|
29276
29665
|
console.error(`Community ${communityId} not found (never created, or already destroyed).`);
|
|
@@ -29309,10 +29698,10 @@ async function runGuideSetHub(positional, flagArgs) {
|
|
|
29309
29698
|
}
|
|
29310
29699
|
const hubId = parsed.data.hub_id;
|
|
29311
29700
|
const { config, accessToken } = await requireAuth();
|
|
29312
|
-
const
|
|
29701
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29313
29702
|
const put = async (dryRun) => {
|
|
29314
29703
|
try {
|
|
29315
|
-
return (await
|
|
29704
|
+
return (await client2.adminSetGuideHub({ hub_id: hubId, dry_run: dryRun })).data;
|
|
29316
29705
|
} catch (err) {
|
|
29317
29706
|
if (err instanceof ApiError && err.status === 404) {
|
|
29318
29707
|
console.error(`Hub ${hubId} not found (never created, or deleted).`);
|
|
@@ -29353,9 +29742,9 @@ async function runGuideClear(positional, flagArgs) {
|
|
|
29353
29742
|
}
|
|
29354
29743
|
const { jsonOutput } = parseGuideFlags(flagArgs, usage3, ["--json"]);
|
|
29355
29744
|
const { config, accessToken } = await requireAuth();
|
|
29356
|
-
const
|
|
29745
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29357
29746
|
try {
|
|
29358
|
-
const { data } = await
|
|
29747
|
+
const { data } = await client2.adminClearGuideHub();
|
|
29359
29748
|
if (jsonOutput) {
|
|
29360
29749
|
console.log(JSON.stringify(data, null, 2));
|
|
29361
29750
|
return;
|
|
@@ -29376,10 +29765,10 @@ async function runGuideStatus(positional, flagArgs) {
|
|
|
29376
29765
|
}
|
|
29377
29766
|
const { jsonOutput } = parseGuideFlags(flagArgs, usage3, ["--json"]);
|
|
29378
29767
|
const { config, accessToken } = await requireAuth();
|
|
29379
|
-
const
|
|
29768
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29380
29769
|
let data;
|
|
29381
29770
|
try {
|
|
29382
|
-
data = (await
|
|
29771
|
+
data = (await client2.adminGetGuide()).data;
|
|
29383
29772
|
} catch (err) {
|
|
29384
29773
|
exitOnApiError(err);
|
|
29385
29774
|
throw err;
|
|
@@ -29525,9 +29914,9 @@ function parseReportFlags(flagArgs) {
|
|
|
29525
29914
|
async function runReportList(flagArgs) {
|
|
29526
29915
|
const flags = parseReportFlags(flagArgs);
|
|
29527
29916
|
const { config, accessToken } = await requireAuth();
|
|
29528
|
-
const
|
|
29917
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29529
29918
|
try {
|
|
29530
|
-
const result = await
|
|
29919
|
+
const result = await client2.listAdminReports({
|
|
29531
29920
|
status: flags.status,
|
|
29532
29921
|
source: flags.source,
|
|
29533
29922
|
limit: flags.limit ? Number(flags.limit) : void 0,
|
|
@@ -29562,9 +29951,9 @@ async function runReportShow(positional) {
|
|
|
29562
29951
|
process.exit(1);
|
|
29563
29952
|
}
|
|
29564
29953
|
const { config, accessToken } = await requireAuth();
|
|
29565
|
-
const
|
|
29954
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29566
29955
|
try {
|
|
29567
|
-
const result = await
|
|
29956
|
+
const result = await client2.getAdminReport(reportId);
|
|
29568
29957
|
console.log(JSON.stringify(result.data, null, 2));
|
|
29569
29958
|
} catch (err) {
|
|
29570
29959
|
exitOnApiError(err);
|
|
@@ -29577,9 +29966,9 @@ async function runReportGroup(positional) {
|
|
|
29577
29966
|
process.exit(1);
|
|
29578
29967
|
}
|
|
29579
29968
|
const { config, accessToken } = await requireAuth();
|
|
29580
|
-
const
|
|
29969
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29581
29970
|
try {
|
|
29582
|
-
const result = await
|
|
29971
|
+
const result = await client2.groupAdminReports(canonicalId, memberIds);
|
|
29583
29972
|
console.log(`Grouped ${result.grouped} member(s) under ${result.canonical_id}`);
|
|
29584
29973
|
for (const s of result.skipped) {
|
|
29585
29974
|
const reason = s.reason === "different_gh_issue" ? `linked to a different GitHub issue (${s.detail})` : s.reason === "grouped_elsewhere" ? `already grouped under ${s.detail}` : s.reason === "terminal" ? `already ${s.detail} (terminal)` : "not found";
|
|
@@ -29596,9 +29985,9 @@ async function runReportUngroup(positional) {
|
|
|
29596
29985
|
process.exit(1);
|
|
29597
29986
|
}
|
|
29598
29987
|
const { config, accessToken } = await requireAuth();
|
|
29599
|
-
const
|
|
29988
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29600
29989
|
try {
|
|
29601
|
-
const result = await
|
|
29990
|
+
const result = await client2.ungroupAdminReport(memberId);
|
|
29602
29991
|
console.log(`Detached ${result.report.report_id} \u2192 ${result.report.status}`);
|
|
29603
29992
|
} catch (err) {
|
|
29604
29993
|
exitOnApiError(err);
|
|
@@ -29613,9 +30002,9 @@ async function runReportEscalate(positional, flagArgs) {
|
|
|
29613
30002
|
process.exit(1);
|
|
29614
30003
|
}
|
|
29615
30004
|
const { config, accessToken } = await requireAuth();
|
|
29616
|
-
const
|
|
30005
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29617
30006
|
try {
|
|
29618
|
-
const result = await
|
|
30007
|
+
const result = await client2.transitionAdminReport(reportId, {
|
|
29619
30008
|
target: "escalated",
|
|
29620
30009
|
gh_issue_url: ghUrl,
|
|
29621
30010
|
ai_verdict: flags.verdict
|
|
@@ -29641,10 +30030,10 @@ async function runReportShipped(positional, flagArgs) {
|
|
|
29641
30030
|
process.exit(1);
|
|
29642
30031
|
}
|
|
29643
30032
|
const { config, accessToken } = await requireAuth();
|
|
29644
|
-
const
|
|
30033
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29645
30034
|
try {
|
|
29646
30035
|
const note = flags.note && flags.note !== "true" ? flags.note : void 0;
|
|
29647
|
-
const result = await
|
|
30036
|
+
const result = await client2.transitionAdminReport(reportId, { target: "shipped", note });
|
|
29648
30037
|
console.log(`Report ${result.report.report_id} \u2192 ${result.report.status} (awaiting reporter verification)`);
|
|
29649
30038
|
} catch (err) {
|
|
29650
30039
|
exitOnApiError(err);
|
|
@@ -29657,9 +30046,9 @@ async function runReportAddressed(positional) {
|
|
|
29657
30046
|
process.exit(1);
|
|
29658
30047
|
}
|
|
29659
30048
|
const { config, accessToken } = await requireAuth();
|
|
29660
|
-
const
|
|
30049
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29661
30050
|
try {
|
|
29662
|
-
const result = await
|
|
30051
|
+
const result = await client2.transitionAdminReport(reportId, { target: "addressed" });
|
|
29663
30052
|
console.log(`Report ${result.report.report_id} \u2192 ${result.report.status}`);
|
|
29664
30053
|
if (result.cascaded_report_ids.length > 0) {
|
|
29665
30054
|
console.log(`Cascaded ${result.cascaded_report_ids.length} grouped member(s).`);
|
|
@@ -29677,9 +30066,9 @@ async function runReportDismiss(positional, flagArgs) {
|
|
|
29677
30066
|
process.exit(1);
|
|
29678
30067
|
}
|
|
29679
30068
|
const { config, accessToken } = await requireAuth();
|
|
29680
|
-
const
|
|
30069
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29681
30070
|
try {
|
|
29682
|
-
const result = await
|
|
30071
|
+
const result = await client2.transitionAdminReport(reportId, {
|
|
29683
30072
|
target: "dismissed",
|
|
29684
30073
|
dismissal_reason: reason,
|
|
29685
30074
|
ai_verdict: flags.verdict,
|
|
@@ -29700,9 +30089,9 @@ async function runReportHold(positional, flagArgs) {
|
|
|
29700
30089
|
process.exit(1);
|
|
29701
30090
|
}
|
|
29702
30091
|
const { config, accessToken } = await requireAuth();
|
|
29703
|
-
const
|
|
30092
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29704
30093
|
try {
|
|
29705
|
-
const result = await
|
|
30094
|
+
const result = await client2.holdAdminReport(reportId, reason);
|
|
29706
30095
|
console.log(
|
|
29707
30096
|
`Report ${result.report.report_id} held (cycle ${result.report.hold_count}) \u2014 remains ${result.report.status}.`
|
|
29708
30097
|
);
|
|
@@ -29723,9 +30112,9 @@ async function runReportUpdate(positional, flagArgs) {
|
|
|
29723
30112
|
process.exit(1);
|
|
29724
30113
|
}
|
|
29725
30114
|
const { config, accessToken } = await requireAuth();
|
|
29726
|
-
const
|
|
30115
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29727
30116
|
try {
|
|
29728
|
-
const result = await
|
|
30117
|
+
const result = await client2.updateAdminReport(reportId, patch);
|
|
29729
30118
|
console.log(`Report ${result.report_id} content updated (status: ${result.status}).`);
|
|
29730
30119
|
if (result.status === "escalated") {
|
|
29731
30120
|
console.log("Note: this edit is queue-local \u2014 the linked GitHub issue body is NOT updated.");
|
|
@@ -29741,9 +30130,9 @@ async function runPeopleList(flagArgs) {
|
|
|
29741
30130
|
const limit = flags.limit === void 0 ? void 0 : parsePositiveIntFlag("--limit", flagValue(flags, "limit"));
|
|
29742
30131
|
const offset = flagValue(flags, "offset");
|
|
29743
30132
|
const { config, accessToken } = await requireAuth();
|
|
29744
|
-
const
|
|
30133
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29745
30134
|
try {
|
|
29746
|
-
const result = await
|
|
30135
|
+
const result = await client2.listAdminPeopleReports({
|
|
29747
30136
|
pending: flags.pending === "true" ? "true" : void 0,
|
|
29748
30137
|
since,
|
|
29749
30138
|
limit,
|
|
@@ -29771,9 +30160,9 @@ async function runPeopleShow(positional) {
|
|
|
29771
30160
|
process.exit(1);
|
|
29772
30161
|
}
|
|
29773
30162
|
const { config, accessToken } = await requireAuth();
|
|
29774
|
-
const
|
|
30163
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29775
30164
|
try {
|
|
29776
|
-
const result = await
|
|
30165
|
+
const result = await client2.getAdminPeopleReport(reportId);
|
|
29777
30166
|
console.log(JSON.stringify(result.data, null, 2));
|
|
29778
30167
|
} catch (err) {
|
|
29779
30168
|
exitOnApiError(err);
|
|
@@ -29786,9 +30175,9 @@ async function runPeopleUser(positional) {
|
|
|
29786
30175
|
process.exit(1);
|
|
29787
30176
|
}
|
|
29788
30177
|
const { config, accessToken } = await requireAuth();
|
|
29789
|
-
const
|
|
30178
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29790
30179
|
try {
|
|
29791
|
-
const result = await
|
|
30180
|
+
const result = await client2.getAdminPeopleUser(userId);
|
|
29792
30181
|
console.log(JSON.stringify(result.data, null, 2));
|
|
29793
30182
|
} catch (err) {
|
|
29794
30183
|
exitOnApiError(err);
|
|
@@ -29807,9 +30196,9 @@ async function runPeopleDismiss(positional, flagArgs) {
|
|
|
29807
30196
|
}
|
|
29808
30197
|
const note = flagValue(parseReportFlags(flagArgs), "note");
|
|
29809
30198
|
const { config, accessToken } = await requireAuth();
|
|
29810
|
-
const
|
|
30199
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29811
30200
|
try {
|
|
29812
|
-
printPeopleAction(await
|
|
30201
|
+
printPeopleAction(await client2.dismissAdminPeopleReport(reportId, { note }));
|
|
29813
30202
|
} catch (err) {
|
|
29814
30203
|
exitOnApiError(err);
|
|
29815
30204
|
}
|
|
@@ -29833,10 +30222,10 @@ async function runPeopleRemoveMessage(positional, flagArgs) {
|
|
|
29833
30222
|
}
|
|
29834
30223
|
}
|
|
29835
30224
|
const { config, accessToken } = await requireAuth();
|
|
29836
|
-
const
|
|
30225
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29837
30226
|
try {
|
|
29838
30227
|
printPeopleAction(
|
|
29839
|
-
await
|
|
30228
|
+
await client2.removeAdminPeopleMessage({ report_id: reportId, message_id: messageId, note }),
|
|
29840
30229
|
"The message was already deleted."
|
|
29841
30230
|
);
|
|
29842
30231
|
} catch (err) {
|
|
@@ -29853,13 +30242,13 @@ async function runPeopleSuspension(suspend, positional, flagArgs) {
|
|
|
29853
30242
|
const note = flagValue(flags, "note");
|
|
29854
30243
|
const reportId = suspend ? flagValue(flags, "report") : void 0;
|
|
29855
30244
|
const { config, accessToken } = await requireAuth();
|
|
29856
|
-
const
|
|
30245
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29857
30246
|
try {
|
|
29858
30247
|
if (suspend) {
|
|
29859
|
-
printPeopleAction(await
|
|
30248
|
+
printPeopleAction(await client2.suspendAdminPeopleUser(userId, { report_id: reportId, note }), "The account was already suspended.");
|
|
29860
30249
|
console.log("It can no longer send messages or invites, accept invites, or create or change groups; in communities it cannot post, join, moderate or create rooms. Nobody else is told.");
|
|
29861
30250
|
} else {
|
|
29862
|
-
printPeopleAction(await
|
|
30251
|
+
printPeopleAction(await client2.unsuspendAdminPeopleUser(userId, { note }), "The account was not suspended.");
|
|
29863
30252
|
}
|
|
29864
30253
|
} catch (err) {
|
|
29865
30254
|
exitOnApiError(err);
|
|
@@ -29892,9 +30281,9 @@ async function runNoticeCreate(flagArgs) {
|
|
|
29892
30281
|
...flags.ends && flags.ends !== "true" ? { ends_at: flags.ends } : {}
|
|
29893
30282
|
};
|
|
29894
30283
|
const { config, accessToken } = await requireAuth();
|
|
29895
|
-
const
|
|
30284
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29896
30285
|
try {
|
|
29897
|
-
const result = await
|
|
30286
|
+
const result = await client2.createAdminNotice(body);
|
|
29898
30287
|
const n = result.data;
|
|
29899
30288
|
console.log(`Created notice ${n.notice_id} \u2014 [${n.severity} \xB7 ${n.scope}] ${n.title}`);
|
|
29900
30289
|
} catch (err) {
|
|
@@ -29904,9 +30293,9 @@ async function runNoticeCreate(flagArgs) {
|
|
|
29904
30293
|
async function runNoticeList(flagArgs) {
|
|
29905
30294
|
const flags = parseReportFlags(flagArgs);
|
|
29906
30295
|
const { config, accessToken } = await requireAuth();
|
|
29907
|
-
const
|
|
30296
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29908
30297
|
try {
|
|
29909
|
-
const result = await
|
|
30298
|
+
const result = await client2.listAdminNotices({
|
|
29910
30299
|
status: flags.status,
|
|
29911
30300
|
limit: flags.limit ? Number(flags.limit) : void 0,
|
|
29912
30301
|
offset: flags.offset ? Number(flags.offset) : void 0
|
|
@@ -29931,9 +30320,9 @@ async function runNoticeResolve(positional) {
|
|
|
29931
30320
|
process.exit(1);
|
|
29932
30321
|
}
|
|
29933
30322
|
const { config, accessToken } = await requireAuth();
|
|
29934
|
-
const
|
|
30323
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
29935
30324
|
try {
|
|
29936
|
-
const result = await
|
|
30325
|
+
const result = await client2.resolveAdminNotice(noticeId);
|
|
29937
30326
|
console.log(`Notice ${result.data.notice_id} resolved.`);
|
|
29938
30327
|
} catch (err) {
|
|
29939
30328
|
exitOnApiError(err);
|
|
@@ -30324,13 +30713,13 @@ async function reportCreateCommand(args2, cliVersion = null) {
|
|
|
30324
30713
|
console.error("");
|
|
30325
30714
|
}
|
|
30326
30715
|
const { config, accessToken } = await requireAuth();
|
|
30327
|
-
const
|
|
30716
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
30328
30717
|
const repoConfig = readRepoConfig();
|
|
30329
30718
|
const organizationId = repoConfig?.organization_id;
|
|
30330
30719
|
let contextWithAlerts = context;
|
|
30331
30720
|
if (hubId) {
|
|
30332
30721
|
try {
|
|
30333
|
-
const { alerts } = await
|
|
30722
|
+
const { alerts } = await client2.getHubAlerts(hubId);
|
|
30334
30723
|
const alertSummary = summarizeActiveAlertsForReport(alerts);
|
|
30335
30724
|
if (alertSummary) {
|
|
30336
30725
|
contextWithAlerts = context ? `${context}
|
|
@@ -30341,7 +30730,7 @@ ${alertSummary}` : alertSummary;
|
|
|
30341
30730
|
}
|
|
30342
30731
|
}
|
|
30343
30732
|
try {
|
|
30344
|
-
const result = await
|
|
30733
|
+
const result = await client2.submitReport({
|
|
30345
30734
|
title,
|
|
30346
30735
|
description: description2,
|
|
30347
30736
|
source,
|
|
@@ -30474,9 +30863,9 @@ async function reportEditCommand(args2) {
|
|
|
30474
30863
|
process.exit(1);
|
|
30475
30864
|
}
|
|
30476
30865
|
const { config, accessToken } = await requireAuth();
|
|
30477
|
-
const
|
|
30866
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
30478
30867
|
try {
|
|
30479
|
-
const result = await
|
|
30868
|
+
const result = await client2.editReport(reportId, patch);
|
|
30480
30869
|
console.log(`Report updated: ${result.report_id} (status: ${result.status})`);
|
|
30481
30870
|
console.log("The dedup fingerprint is unchanged and no notification was sent.");
|
|
30482
30871
|
} catch (err) {
|
|
@@ -30503,9 +30892,9 @@ async function reportListCommand(args2) {
|
|
|
30503
30892
|
const status = flagValue2(args2, "--status");
|
|
30504
30893
|
const json = args2.includes("--json");
|
|
30505
30894
|
const { config, accessToken } = await requireAuth();
|
|
30506
|
-
const
|
|
30895
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
30507
30896
|
try {
|
|
30508
|
-
const result = await
|
|
30897
|
+
const result = await client2.listMyReports(status);
|
|
30509
30898
|
if (json) {
|
|
30510
30899
|
console.log(JSON.stringify(result, null, 2));
|
|
30511
30900
|
return;
|
|
@@ -30530,9 +30919,9 @@ async function reportGetCommand(args2) {
|
|
|
30530
30919
|
process.exit(1);
|
|
30531
30920
|
}
|
|
30532
30921
|
const { config, accessToken } = await requireAuth();
|
|
30533
|
-
const
|
|
30922
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
30534
30923
|
try {
|
|
30535
|
-
const result = await
|
|
30924
|
+
const result = await client2.getMyReport(reportId);
|
|
30536
30925
|
if (json) {
|
|
30537
30926
|
console.log(JSON.stringify(result, null, 2));
|
|
30538
30927
|
return;
|
|
@@ -30569,9 +30958,9 @@ async function reportAcceptCommand(args2) {
|
|
|
30569
30958
|
process.exit(1);
|
|
30570
30959
|
}
|
|
30571
30960
|
const { config, accessToken } = await requireAuth();
|
|
30572
|
-
const
|
|
30961
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
30573
30962
|
try {
|
|
30574
|
-
const result = await
|
|
30963
|
+
const result = await client2.acceptReport(reportId);
|
|
30575
30964
|
console.log(`Accepted. Report ${result.report.report_id} \u2192 ${result.report.status}.`);
|
|
30576
30965
|
} catch (err) {
|
|
30577
30966
|
reportActionError(err);
|
|
@@ -30585,9 +30974,9 @@ async function reportContestCommand(args2) {
|
|
|
30585
30974
|
process.exit(1);
|
|
30586
30975
|
}
|
|
30587
30976
|
const { config, accessToken } = await requireAuth();
|
|
30588
|
-
const
|
|
30977
|
+
const client2 = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
30589
30978
|
try {
|
|
30590
|
-
const result = await
|
|
30979
|
+
const result = await client2.contestReport(reportId, reason);
|
|
30591
30980
|
console.log(`Contested. Report ${result.report.report_id} \u2192 ${result.report.status} (back to triage).`);
|
|
30592
30981
|
} catch (err) {
|
|
30593
30982
|
reportActionError(err);
|
|
@@ -30663,106 +31052,6 @@ var init_update = __esm({
|
|
|
30663
31052
|
}
|
|
30664
31053
|
});
|
|
30665
31054
|
|
|
30666
|
-
// src/data/output.ts
|
|
30667
|
-
function printOutput(data, format) {
|
|
30668
|
-
if (format === "json") {
|
|
30669
|
-
console.log(JSON.stringify(data, null, 2));
|
|
30670
|
-
return;
|
|
30671
|
-
}
|
|
30672
|
-
if (Array.isArray(data)) {
|
|
30673
|
-
printRows(data);
|
|
30674
|
-
return;
|
|
30675
|
-
}
|
|
30676
|
-
if (typeof data === "object" && data !== null) {
|
|
30677
|
-
printFields(data);
|
|
30678
|
-
return;
|
|
30679
|
-
}
|
|
30680
|
-
console.log(formatCell2(data));
|
|
30681
|
-
}
|
|
30682
|
-
function printRows(rows) {
|
|
30683
|
-
if (rows.length === 0) {
|
|
30684
|
-
console.log("(no results)");
|
|
30685
|
-
return;
|
|
30686
|
-
}
|
|
30687
|
-
const columns = [];
|
|
30688
|
-
const seen = /* @__PURE__ */ new Set();
|
|
30689
|
-
for (const row of rows) {
|
|
30690
|
-
for (const key of Object.keys(row ?? {})) {
|
|
30691
|
-
if (seen.has(key)) continue;
|
|
30692
|
-
seen.add(key);
|
|
30693
|
-
columns.push(key);
|
|
30694
|
-
}
|
|
30695
|
-
}
|
|
30696
|
-
const headers = columns.map((c) => sanitizeTerminalText(c));
|
|
30697
|
-
const cells = rows.map((row) => columns.map((c) => cellAt(row, c)));
|
|
30698
|
-
const widths = columns.map(
|
|
30699
|
-
(_, i) => cells.reduce((width, row) => Math.max(width, row[i].length), headers[i].length)
|
|
30700
|
-
);
|
|
30701
|
-
console.log(headers.map((c, i) => c.padEnd(widths[i])).join(" "));
|
|
30702
|
-
console.log(widths.map((w) => "-".repeat(w)).join(" "));
|
|
30703
|
-
for (const row of cells) {
|
|
30704
|
-
console.log(row.map((cell, i) => cell.padEnd(widths[i])).join(" "));
|
|
30705
|
-
}
|
|
30706
|
-
}
|
|
30707
|
-
function printFields(obj) {
|
|
30708
|
-
const entries = Object.entries(obj).map(([key, value]) => ({
|
|
30709
|
-
key: sanitizeTerminalText(key),
|
|
30710
|
-
value
|
|
30711
|
-
}));
|
|
30712
|
-
if (entries.length === 0) {
|
|
30713
|
-
console.log("(empty)");
|
|
30714
|
-
return;
|
|
30715
|
-
}
|
|
30716
|
-
const width = entries.reduce((w, e) => Math.max(w, e.key.length), 0);
|
|
30717
|
-
for (const { key, value } of entries) {
|
|
30718
|
-
console.log(`${key.padEnd(width)} ${formatCell2(value)}`);
|
|
30719
|
-
}
|
|
30720
|
-
}
|
|
30721
|
-
function printBatchResult(response) {
|
|
30722
|
-
const obj = response && typeof response === "object" ? response : {};
|
|
30723
|
-
const results = Array.isArray(obj.results) ? obj.results : [];
|
|
30724
|
-
const batchId = typeof obj.batch_id === "string" ? obj.batch_id : "(none)";
|
|
30725
|
-
console.log(
|
|
30726
|
-
`batch_id: ${sanitizeTerminalText(batchId)} \xB7 ${results.length} operation${results.length === 1 ? "" : "s"}`
|
|
30727
|
-
);
|
|
30728
|
-
if (results.length === 0) return;
|
|
30729
|
-
printRows(
|
|
30730
|
-
results.map((r, i) => ({
|
|
30731
|
-
"#": String(i),
|
|
30732
|
-
operation: r?.type ?? "",
|
|
30733
|
-
result: summarizeBatchResult(r)
|
|
30734
|
-
}))
|
|
30735
|
-
);
|
|
30736
|
-
}
|
|
30737
|
-
function summarizeBatchResult(r) {
|
|
30738
|
-
if (!r || typeof r !== "object") return String(r ?? "");
|
|
30739
|
-
if (r.deleted === true) return "deleted";
|
|
30740
|
-
const entity = r.record ?? r.relationship ?? r.record_type;
|
|
30741
|
-
if (entity && typeof entity === "object") {
|
|
30742
|
-
const e = entity;
|
|
30743
|
-
const id = typeof e.id === "string" ? e.id : void 0;
|
|
30744
|
-
const label = typeof e.record_type === "string" ? e.record_type : typeof e.rel_type === "string" ? e.rel_type : typeof e.name === "string" ? e.name : void 0;
|
|
30745
|
-
const version = e.version != null ? ` v${String(e.version)}` : "";
|
|
30746
|
-
if (id && label) return `${label}/${id}${version}`;
|
|
30747
|
-
if (id) return `${id}${version}`;
|
|
30748
|
-
}
|
|
30749
|
-
return JSON.stringify(r);
|
|
30750
|
-
}
|
|
30751
|
-
function cellAt(row, column) {
|
|
30752
|
-
return formatCell2(row?.[column]);
|
|
30753
|
-
}
|
|
30754
|
-
function formatCell2(value) {
|
|
30755
|
-
if (value === null || value === void 0) return "";
|
|
30756
|
-
if (typeof value === "object") return sanitizeTerminalText(JSON.stringify(value));
|
|
30757
|
-
return sanitizeTerminalText(String(value));
|
|
30758
|
-
}
|
|
30759
|
-
var init_output = __esm({
|
|
30760
|
-
"src/data/output.ts"() {
|
|
30761
|
-
"use strict";
|
|
30762
|
-
init_terminal_output();
|
|
30763
|
-
}
|
|
30764
|
-
});
|
|
30765
|
-
|
|
30766
31055
|
// src/data/commands/actions.ts
|
|
30767
31056
|
import { Command } from "commander";
|
|
30768
31057
|
function buildActionsCommand() {
|
|
@@ -30795,21 +31084,21 @@ function buildActionsCommand() {
|
|
|
30795
31084
|
if (opts.description) body.description = opts.description;
|
|
30796
31085
|
}
|
|
30797
31086
|
const base = pathSegment(requireBase(this), "--base");
|
|
30798
|
-
const
|
|
31087
|
+
const client2 = await createDataClient();
|
|
30799
31088
|
printOutput(
|
|
30800
|
-
await
|
|
31089
|
+
await client2.request("PUT", `/v1/${base}/actions/${pathSegment(id, "action id")}`, body),
|
|
30801
31090
|
outputFormat(this)
|
|
30802
31091
|
);
|
|
30803
31092
|
});
|
|
30804
31093
|
actions.command("get <id>").description("Get an Action by id").action(async function(id) {
|
|
30805
31094
|
const base = pathSegment(requireBase(this), "--base");
|
|
30806
|
-
const
|
|
30807
|
-
printOutput(await
|
|
31095
|
+
const client2 = await createDataClient();
|
|
31096
|
+
printOutput(await client2.request("GET", `/v1/${base}/actions/${pathSegment(id, "action id")}`), outputFormat(this));
|
|
30808
31097
|
});
|
|
30809
31098
|
actions.command("list").description("List Actions in this base").action(async function() {
|
|
30810
31099
|
const base = pathSegment(requireBase(this), "--base");
|
|
30811
|
-
const
|
|
30812
|
-
printOutput(await
|
|
31100
|
+
const client2 = await createDataClient();
|
|
31101
|
+
printOutput(await client2.request("GET", `/v1/${base}/actions`), outputFormat(this));
|
|
30813
31102
|
});
|
|
30814
31103
|
actions.command("delete <id>").description("Delete an Action").option("-y, --yes", "Skip confirmation").action(async function(id, opts) {
|
|
30815
31104
|
if (!opts.yes && !await confirm(`Delete action ${id}? This cannot be undone.`)) {
|
|
@@ -30817,8 +31106,8 @@ function buildActionsCommand() {
|
|
|
30817
31106
|
return;
|
|
30818
31107
|
}
|
|
30819
31108
|
const base = pathSegment(requireBase(this), "--base");
|
|
30820
|
-
const
|
|
30821
|
-
await
|
|
31109
|
+
const client2 = await createDataClient();
|
|
31110
|
+
await client2.request("DELETE", `/v1/${base}/actions/${pathSegment(id, "action id")}`);
|
|
30822
31111
|
console.log(`Deleted action ${id}`);
|
|
30823
31112
|
});
|
|
30824
31113
|
return actions;
|
|
@@ -30867,8 +31156,8 @@ function buildAttachmentsCommand() {
|
|
|
30867
31156
|
"Get a presigned upload URL for a record attachment. With --file, uploads the file content in one step."
|
|
30868
31157
|
).requiredOption("--filename <name>", "File name or path (e.g. docs/guide.md)").option("--content-type <type>", "MIME type", "application/octet-stream").option("--file <path>", "Local file to upload (skips presigned URL output, uploads directly)").action(async function(recordType2, id, opts) {
|
|
30869
31158
|
const base = pathSegment(requireBase(this), "--base");
|
|
30870
|
-
const
|
|
30871
|
-
const data = await
|
|
31159
|
+
const client2 = await createDataClient();
|
|
31160
|
+
const data = await client2.request(
|
|
30872
31161
|
"POST",
|
|
30873
31162
|
`/v1/${base}/records/${pathSegment(recordType2, "record_type")}/${pathSegment(id, "record id")}/attachments`,
|
|
30874
31163
|
{ filename: opts.filename, content_type: opts.contentType }
|
|
@@ -30878,13 +31167,13 @@ function buildAttachmentsCommand() {
|
|
|
30878
31167
|
return;
|
|
30879
31168
|
}
|
|
30880
31169
|
const body = readFileSync19(opts.file);
|
|
30881
|
-
await
|
|
31170
|
+
await client2.upload(uploadPathFrom(data?.upload_url), body, opts.contentType);
|
|
30882
31171
|
printOutput({ ...data, uploaded: true }, outputFormat(this));
|
|
30883
31172
|
});
|
|
30884
31173
|
attachments.command("url <record_type> <id>").description("Get a download URL for an attachment by filename").requiredOption("--filename <name>", "File name or path (e.g. docs/guide.md)").action(async function(recordType2, id, opts) {
|
|
30885
31174
|
const base = pathSegment(requireBase(this), "--base");
|
|
30886
|
-
const
|
|
30887
|
-
const rows = await
|
|
31175
|
+
const client2 = await createDataClient();
|
|
31176
|
+
const rows = await client2.request(
|
|
30888
31177
|
"GET",
|
|
30889
31178
|
`/v1/${base}/records/${pathSegment(recordType2, "record_type")}/${pathSegment(id, "record id")}/attachments`
|
|
30890
31179
|
);
|
|
@@ -30893,16 +31182,16 @@ function buildAttachmentsCommand() {
|
|
|
30893
31182
|
throw expected(`Attachment "${opts.filename}" not found`);
|
|
30894
31183
|
}
|
|
30895
31184
|
printOutput(
|
|
30896
|
-
{ download_url:
|
|
31185
|
+
{ download_url: client2.url(`/v1/${base}/attachments/${pathSegments(match.key, "attachment key")}`), ...match },
|
|
30897
31186
|
outputFormat(this)
|
|
30898
31187
|
);
|
|
30899
31188
|
});
|
|
30900
31189
|
attachments.command("list <record_type> <id>").description("List attachments for a record").option("--prefix <path>", "Filter by path prefix (e.g. docs/)").action(async function(recordType2, id, opts) {
|
|
30901
31190
|
const base = pathSegment(requireBase(this), "--base");
|
|
30902
|
-
const
|
|
31191
|
+
const client2 = await createDataClient();
|
|
30903
31192
|
const query = opts.prefix ? `?prefix=${encodeURIComponent(opts.prefix)}` : "";
|
|
30904
31193
|
printOutput(
|
|
30905
|
-
await
|
|
31194
|
+
await client2.request(
|
|
30906
31195
|
"GET",
|
|
30907
31196
|
`/v1/${base}/records/${pathSegment(recordType2, "record_type")}/${pathSegment(id, "record id")}/attachments${query}`
|
|
30908
31197
|
),
|
|
@@ -30917,8 +31206,8 @@ function buildAttachmentsCommand() {
|
|
|
30917
31206
|
return;
|
|
30918
31207
|
}
|
|
30919
31208
|
const base = pathSegment(requireBase(this), "--base");
|
|
30920
|
-
const
|
|
30921
|
-
await
|
|
31209
|
+
const client2 = await createDataClient();
|
|
31210
|
+
await client2.request(
|
|
30922
31211
|
"DELETE",
|
|
30923
31212
|
`/v1/${base}/records/${pathSegment(recordType2, "record_type")}/${pathSegment(id, "record id")}/attachments/${pathSegment(attachmentId, "attachment id")}`
|
|
30924
31213
|
);
|
|
@@ -30947,8 +31236,8 @@ function buildBasesBatchCommand() {
|
|
|
30947
31236
|
return withBaseOption(new Command3("batch")).description("Execute atomic batch operations (up to 1,000 operations)").requiredOption("--operations <json>", "Operations array (inline JSON or @filename)").action(async function(opts) {
|
|
30948
31237
|
const base = pathSegment(requireBase(this), "--base");
|
|
30949
31238
|
const operations = parseData(opts.operations, "--operations");
|
|
30950
|
-
const
|
|
30951
|
-
const data = await
|
|
31239
|
+
const client2 = await createDataClient();
|
|
31240
|
+
const data = await client2.request("POST", `/v1/${base}/batch`, {
|
|
30952
31241
|
operations: Array.isArray(operations) ? operations : [operations]
|
|
30953
31242
|
});
|
|
30954
31243
|
const format = outputFormat(this);
|
|
@@ -31037,10 +31326,10 @@ async function* readChunks(file, size, startChunk) {
|
|
|
31037
31326
|
}
|
|
31038
31327
|
if (rows.length > 0) yield { index, rows };
|
|
31039
31328
|
}
|
|
31040
|
-
async function beginSession(state,
|
|
31329
|
+
async function beginSession(state, client2, base, recordType2, requestKey) {
|
|
31041
31330
|
const res = await withRetry(
|
|
31042
31331
|
state,
|
|
31043
|
-
() =>
|
|
31332
|
+
() => client2.request("POST", `/v1/${base}/import/begin`, {
|
|
31044
31333
|
request_key: requestKey,
|
|
31045
31334
|
record_type: recordType2
|
|
31046
31335
|
}),
|
|
@@ -31087,12 +31376,12 @@ function buildBasesImportCommand() {
|
|
|
31087
31376
|
} catch {
|
|
31088
31377
|
throw expected(`--file ${opts.file}: not a readable file.`);
|
|
31089
31378
|
}
|
|
31090
|
-
const
|
|
31379
|
+
const client2 = await createDataClient();
|
|
31091
31380
|
const requestKey = opts.requestKey ?? `cli-${randomUUID()}`;
|
|
31092
31381
|
if (!opts.requestKey) {
|
|
31093
31382
|
console.error(`request_key: ${requestKey} (pass --request-key to resume this run)`);
|
|
31094
31383
|
}
|
|
31095
|
-
let session = await beginSession(state,
|
|
31384
|
+
let session = await beginSession(state, client2, base, recordType2, requestKey);
|
|
31096
31385
|
console.error(`import_id: ${session.import_id}`);
|
|
31097
31386
|
const importIds = [session.import_id];
|
|
31098
31387
|
let written = 0;
|
|
@@ -31107,7 +31396,7 @@ function buildBasesImportCommand() {
|
|
|
31107
31396
|
try {
|
|
31108
31397
|
result = await withRetry(
|
|
31109
31398
|
state,
|
|
31110
|
-
() =>
|
|
31399
|
+
() => client2.request("POST", `/v1/${base}/import/chunk`, body),
|
|
31111
31400
|
`chunk ${index}`
|
|
31112
31401
|
);
|
|
31113
31402
|
} catch (err) {
|
|
@@ -31118,12 +31407,12 @@ function buildBasesImportCommand() {
|
|
|
31118
31407
|
console.error(
|
|
31119
31408
|
` NOTE: this run now spans two import_ids; undo needs both. Previous: ${session.import_id}`
|
|
31120
31409
|
);
|
|
31121
|
-
session = await beginSession(state,
|
|
31410
|
+
session = await beginSession(state, client2, base, recordType2, requestKey);
|
|
31122
31411
|
importIds.push(session.import_id);
|
|
31123
31412
|
console.error(` import_id: ${session.import_id}`);
|
|
31124
31413
|
result = await withRetry(
|
|
31125
31414
|
state,
|
|
31126
|
-
() =>
|
|
31415
|
+
() => client2.request("POST", `/v1/${base}/import/chunk`, {
|
|
31127
31416
|
...body,
|
|
31128
31417
|
import_id: session.import_id
|
|
31129
31418
|
}),
|
|
@@ -31141,7 +31430,7 @@ function buildBasesImportCommand() {
|
|
|
31141
31430
|
if (opts.finalize) {
|
|
31142
31431
|
await withRetry(
|
|
31143
31432
|
state,
|
|
31144
|
-
() =>
|
|
31433
|
+
() => client2.request(
|
|
31145
31434
|
"POST",
|
|
31146
31435
|
`/v1/${base}/import/${pathSegment(session.import_id, "import id")}/finalize`
|
|
31147
31436
|
),
|
|
@@ -31174,9 +31463,9 @@ Stopped at chunk ${nextIndex}. To resume, re-run the SAME command with:
|
|
|
31174
31463
|
if (opts.limit) qs.set("limit", opts.limit);
|
|
31175
31464
|
if (opts.offset) qs.set("offset", opts.offset);
|
|
31176
31465
|
const suffix = qs.toString() ? `?${qs}` : "";
|
|
31177
|
-
const
|
|
31466
|
+
const client2 = await createDataClient();
|
|
31178
31467
|
printOutput(
|
|
31179
|
-
await
|
|
31468
|
+
await client2.request("GET", `/v1/${base}/import/sessions${suffix}`),
|
|
31180
31469
|
outputFormat(this)
|
|
31181
31470
|
);
|
|
31182
31471
|
});
|
|
@@ -31186,14 +31475,14 @@ Stopped at chunk ${nextIndex}. To resume, re-run the SAME command with:
|
|
|
31186
31475
|
const base = pathSegment(requireBase(this), "--base");
|
|
31187
31476
|
const format = outputFormat(this);
|
|
31188
31477
|
const state = { sawAmbiguous: false };
|
|
31189
|
-
const
|
|
31478
|
+
const client2 = await createDataClient();
|
|
31190
31479
|
if (!opts.yes && !isInteractive()) {
|
|
31191
31480
|
throw expected(
|
|
31192
31481
|
"Refusing to roll back an import without confirmation \u2014 pass --yes to run non-interactively."
|
|
31193
31482
|
);
|
|
31194
31483
|
}
|
|
31195
31484
|
if (!opts.yes) {
|
|
31196
|
-
const plan = await
|
|
31485
|
+
const plan = await client2.request("GET", `/v1/${base}/import/${pathSegment(importId, "import id")}/rollback-plan?counts=true`);
|
|
31197
31486
|
const n = plan.matched_records ?? 0;
|
|
31198
31487
|
if (n === 0) {
|
|
31199
31488
|
console.error("No rows left to undo \u2014 closing the import session.");
|
|
@@ -31214,7 +31503,7 @@ Stopped at chunk ${nextIndex}. To resume, re-run the SAME command with:
|
|
|
31214
31503
|
for (let sweep = 0; ; sweep++) {
|
|
31215
31504
|
const res = await withRetry(
|
|
31216
31505
|
state,
|
|
31217
|
-
() =>
|
|
31506
|
+
() => client2.request("POST", `/v1/${base}/import/${pathSegment(importId, "import id")}/rollback`),
|
|
31218
31507
|
"rollback"
|
|
31219
31508
|
);
|
|
31220
31509
|
records += res.swept.records;
|
|
@@ -31291,9 +31580,9 @@ function buildBasesProvidersCommand() {
|
|
|
31291
31580
|
providers.command("import <provider>").description(`Import tool definitions as record types. Providers: ${VALID_PROVIDERS_HELP}`).requiredOption("--tools <json>", "Tool definitions (inline JSON or @filename)").action(async function(provider, opts) {
|
|
31292
31581
|
const base = pathSegment(requireBase(this), "--base");
|
|
31293
31582
|
const tools = parseData(opts.tools, "--tools");
|
|
31294
|
-
const
|
|
31583
|
+
const client2 = await createDataClient();
|
|
31295
31584
|
printOutput(
|
|
31296
|
-
await
|
|
31585
|
+
await client2.request("POST", `/v1/${base}/providers/${providerSegment(provider)}/import`, {
|
|
31297
31586
|
tools: Array.isArray(tools) ? tools : [tools]
|
|
31298
31587
|
}),
|
|
31299
31588
|
outputFormat(this)
|
|
@@ -31303,8 +31592,8 @@ function buildBasesProvidersCommand() {
|
|
|
31303
31592
|
const base = pathSegment(requireBase(this), "--base");
|
|
31304
31593
|
const recordTypes = opts.recordTypes ? splitList(opts.recordTypes) : [];
|
|
31305
31594
|
const query = recordTypes.length ? `?record_types=${encodeURIComponent(recordTypes.join(","))}` : "";
|
|
31306
|
-
const
|
|
31307
|
-
const data = await
|
|
31595
|
+
const client2 = await createDataClient();
|
|
31596
|
+
const data = await client2.request(
|
|
31308
31597
|
"GET",
|
|
31309
31598
|
`/v1/${base}/providers/${providerSegment(provider)}/export${query}`
|
|
31310
31599
|
);
|
|
@@ -31330,9 +31619,9 @@ function buildBasesProvidersCommand() {
|
|
|
31330
31619
|
queryParts.push(`external_source=${encodeURIComponent(opts.externalSource)}`);
|
|
31331
31620
|
}
|
|
31332
31621
|
const qs = queryParts.length ? `?${queryParts.join("&")}` : "";
|
|
31333
|
-
const
|
|
31622
|
+
const client2 = await createDataClient();
|
|
31334
31623
|
printOutput(
|
|
31335
|
-
await
|
|
31624
|
+
await client2.request(
|
|
31336
31625
|
"POST",
|
|
31337
31626
|
`/v1/${base}/providers/${providerSegment(provider)}/records/${pathSegment(recordType2, "record_type")}${qs}`,
|
|
31338
31627
|
callData
|
|
@@ -31433,8 +31722,8 @@ function buildBasesReportCommand() {
|
|
|
31433
31722
|
);
|
|
31434
31723
|
body.cli_version = versions.cli_version;
|
|
31435
31724
|
if (versions.skill_version) body.skill_version = versions.skill_version;
|
|
31436
|
-
const
|
|
31437
|
-
const data = await
|
|
31725
|
+
const client2 = await createDataClient();
|
|
31726
|
+
const data = await client2.request("POST", "/v1/reports", body);
|
|
31438
31727
|
if (outputFormat(this) === "json") {
|
|
31439
31728
|
printOutput(data, "json");
|
|
31440
31729
|
return;
|
|
@@ -31455,10 +31744,10 @@ function buildBasesReportCommand() {
|
|
|
31455
31744
|
}
|
|
31456
31745
|
});
|
|
31457
31746
|
report2.command("list").description("List your reports, newest first").option("--status <s>", "Filter by status (e.g. shipped \u2014 awaiting your verification)").action(async function(opts) {
|
|
31458
|
-
const
|
|
31747
|
+
const client2 = await createDataClient();
|
|
31459
31748
|
const qs = opts.status ? `?status=${encodeURIComponent(opts.status)}` : "";
|
|
31460
31749
|
try {
|
|
31461
|
-
const rows = await
|
|
31750
|
+
const rows = await client2.request("GET", `/v1/reports${qs}`);
|
|
31462
31751
|
if (outputFormat(this) === "json") {
|
|
31463
31752
|
printOutput(rows, "json");
|
|
31464
31753
|
return;
|
|
@@ -31478,9 +31767,9 @@ function buildBasesReportCommand() {
|
|
|
31478
31767
|
}
|
|
31479
31768
|
});
|
|
31480
31769
|
report2.command("get <report_id>").description("Show one of your reports: status + the message thread").action(async function(reportId) {
|
|
31481
|
-
const
|
|
31770
|
+
const client2 = await createDataClient();
|
|
31482
31771
|
try {
|
|
31483
|
-
const data = await
|
|
31772
|
+
const data = await client2.request("GET", `/v1/reports/${pathSegment(reportId, "report id")}`);
|
|
31484
31773
|
if (outputFormat(this) === "json") {
|
|
31485
31774
|
printOutput(data, "json");
|
|
31486
31775
|
return;
|
|
@@ -31515,9 +31804,9 @@ function buildBasesReportCommand() {
|
|
|
31515
31804
|
}
|
|
31516
31805
|
});
|
|
31517
31806
|
report2.command("accept <report_id>").description("Accept a shipped fix (\u2192 addressed)").action(async function(reportId) {
|
|
31518
|
-
const
|
|
31807
|
+
const client2 = await createDataClient();
|
|
31519
31808
|
try {
|
|
31520
|
-
const data = await
|
|
31809
|
+
const data = await client2.request(
|
|
31521
31810
|
"POST",
|
|
31522
31811
|
`/v1/reports/${pathSegment(reportId, "report id")}/accept`
|
|
31523
31812
|
);
|
|
@@ -31531,9 +31820,9 @@ function buildBasesReportCommand() {
|
|
|
31531
31820
|
}
|
|
31532
31821
|
});
|
|
31533
31822
|
report2.command("contest <report_id>").description("Contest a shipped fix or a dismissal (\u2192 back to triage)").requiredOption("--reason <text>", "Why the fix/dismissal is wrong").action(async function(reportId, opts) {
|
|
31534
|
-
const
|
|
31823
|
+
const client2 = await createDataClient();
|
|
31535
31824
|
try {
|
|
31536
|
-
const data = await
|
|
31825
|
+
const data = await client2.request(
|
|
31537
31826
|
"POST",
|
|
31538
31827
|
`/v1/reports/${pathSegment(reportId, "report id")}/contest`,
|
|
31539
31828
|
{ reason: opts.reason }
|
|
@@ -31622,25 +31911,25 @@ function buildBasesCredentialsCommand() {
|
|
|
31622
31911
|
if (opts.contentType) body.content_type = opts.contentType;
|
|
31623
31912
|
if (opts.expiresAt) body.expires_at = opts.expiresAt;
|
|
31624
31913
|
if (opts.syncToProduction === false) body.sync_to_production = false;
|
|
31625
|
-
const
|
|
31914
|
+
const client2 = await createDataClient();
|
|
31626
31915
|
printOutput(
|
|
31627
|
-
await
|
|
31916
|
+
await client2.request("POST", credentialPath(base), body),
|
|
31628
31917
|
outputFormat(this)
|
|
31629
31918
|
);
|
|
31630
31919
|
});
|
|
31631
31920
|
credentials.command("list").description("List this base's credentials (values are never returned)").action(async function() {
|
|
31632
31921
|
const base = requireBase(this);
|
|
31633
|
-
const
|
|
31922
|
+
const client2 = await createDataClient();
|
|
31634
31923
|
printOutput(
|
|
31635
|
-
await
|
|
31924
|
+
await client2.request("GET", credentialPath(base)),
|
|
31636
31925
|
outputFormat(this)
|
|
31637
31926
|
);
|
|
31638
31927
|
});
|
|
31639
31928
|
credentials.command("get <id>").description("Get credential metadata (the value is never returned)").action(async function(id) {
|
|
31640
31929
|
const base = requireBase(this);
|
|
31641
|
-
const
|
|
31930
|
+
const client2 = await createDataClient();
|
|
31642
31931
|
printOutput(
|
|
31643
|
-
await
|
|
31932
|
+
await client2.request("GET", credentialPath(base, id)),
|
|
31644
31933
|
outputFormat(this)
|
|
31645
31934
|
);
|
|
31646
31935
|
});
|
|
@@ -31649,8 +31938,8 @@ function buildBasesCredentialsCommand() {
|
|
|
31649
31938
|
"the new credential value"
|
|
31650
31939
|
).action(async function(id, opts) {
|
|
31651
31940
|
const base = requireBase(this);
|
|
31652
|
-
const
|
|
31653
|
-
const existing = await
|
|
31941
|
+
const client2 = await createDataClient();
|
|
31942
|
+
const existing = await client2.request(
|
|
31654
31943
|
"GET",
|
|
31655
31944
|
credentialPath(base, id)
|
|
31656
31945
|
);
|
|
@@ -31662,7 +31951,7 @@ function buildBasesCredentialsCommand() {
|
|
|
31662
31951
|
const body = { value: await resolveValue(opts, "New credential value") };
|
|
31663
31952
|
if (opts.expiresAt) body.expires_at = opts.expiresAt;
|
|
31664
31953
|
printOutput(
|
|
31665
|
-
await
|
|
31954
|
+
await client2.request(
|
|
31666
31955
|
"POST",
|
|
31667
31956
|
`${credentialPath(base, id)}/rotate`,
|
|
31668
31957
|
body
|
|
@@ -31674,9 +31963,9 @@ function buildBasesCredentialsCommand() {
|
|
|
31674
31963
|
"Set the promote-time publish flag on a direct credential: on by default, off with --no-sync-to-production"
|
|
31675
31964
|
).option("--no-sync-to-production", "Do not publish this credential on promote").action(async function(id, opts) {
|
|
31676
31965
|
const base = requireBase(this);
|
|
31677
|
-
const
|
|
31966
|
+
const client2 = await createDataClient();
|
|
31678
31967
|
printOutput(
|
|
31679
|
-
await
|
|
31968
|
+
await client2.request("PUT", credentialPath(base, id), {
|
|
31680
31969
|
sync_to_production: opts.syncToProduction
|
|
31681
31970
|
}),
|
|
31682
31971
|
outputFormat(this)
|
|
@@ -31693,15 +31982,15 @@ function buildBasesCredentialsCommand() {
|
|
|
31693
31982
|
return;
|
|
31694
31983
|
}
|
|
31695
31984
|
}
|
|
31696
|
-
const
|
|
31697
|
-
await
|
|
31985
|
+
const client2 = await createDataClient();
|
|
31986
|
+
await client2.request("DELETE", credentialPath(base, id));
|
|
31698
31987
|
printOutput({ id, deleted: true }, outputFormat(this));
|
|
31699
31988
|
});
|
|
31700
31989
|
credentials.command("link").description("Project an organization credential onto this base").requiredOption("--org-credential <id>", "Organization credential id").option("--name <name>", "Credential name on the base (default: a slug of the credential's name)").action(async function(opts) {
|
|
31701
31990
|
const base = requireBase(this);
|
|
31702
|
-
const
|
|
31991
|
+
const client2 = await createDataClient();
|
|
31703
31992
|
printOutput(
|
|
31704
|
-
await
|
|
31993
|
+
await client2.linkBaseCredential(opts.orgCredential, {
|
|
31705
31994
|
base_id: base,
|
|
31706
31995
|
...opts.name ? { name: opts.name } : {}
|
|
31707
31996
|
}),
|
|
@@ -31710,8 +31999,8 @@ function buildBasesCredentialsCommand() {
|
|
|
31710
31999
|
});
|
|
31711
32000
|
credentials.command("unlink <id>").description("Remove an organization credential's projection from this base").requiredOption("--org-credential <id>", "Organization credential id").action(async function(id, opts) {
|
|
31712
32001
|
const base = requireBase(this);
|
|
31713
|
-
const
|
|
31714
|
-
await
|
|
32002
|
+
const client2 = await createDataClient();
|
|
32003
|
+
await client2.unlinkBaseCredential(opts.orgCredential, id, { base_id: base });
|
|
31715
32004
|
printOutput({ id, unlinked: true }, outputFormat(this));
|
|
31716
32005
|
});
|
|
31717
32006
|
return credentials;
|
|
@@ -31760,8 +32049,8 @@ function buildBasesSqlCommand() {
|
|
|
31760
32049
|
}
|
|
31761
32050
|
const body = { query };
|
|
31762
32051
|
if (Object.keys(params).length > 0) body.params = params;
|
|
31763
|
-
const
|
|
31764
|
-
printOutput(await
|
|
32052
|
+
const client2 = await createDataClient();
|
|
32053
|
+
printOutput(await client2.request("POST", `/v1/${base}/sql`, body), outputFormat(this));
|
|
31765
32054
|
});
|
|
31766
32055
|
}
|
|
31767
32056
|
var init_sql = __esm({
|
|
@@ -31811,8 +32100,8 @@ function applyTokenLifecycleOpts(body, opts) {
|
|
|
31811
32100
|
if (expiresAt) body.expires_at = expiresAt;
|
|
31812
32101
|
if (opts.description) body.description = opts.description;
|
|
31813
32102
|
}
|
|
31814
|
-
function listAllTokens(
|
|
31815
|
-
return
|
|
32103
|
+
function listAllTokens(client2) {
|
|
32104
|
+
return client2.collectPages(
|
|
31816
32105
|
(cursor) => `/v1/tokens?limit=${TOKEN_LIST_PAGE_LIMIT}${cursor ? `&cursor=${encodeURIComponent(cursor)}` : ""}`
|
|
31817
32106
|
);
|
|
31818
32107
|
}
|
|
@@ -31835,8 +32124,8 @@ function buildBasesTokensCommand() {
|
|
|
31835
32124
|
const grants = parseData(opts.grants, "--grants");
|
|
31836
32125
|
const body = { name: opts.name, grants };
|
|
31837
32126
|
applyTokenLifecycleOpts(body, opts);
|
|
31838
|
-
const
|
|
31839
|
-
const data = await
|
|
32127
|
+
const client2 = await createDataClient();
|
|
32128
|
+
const data = await client2.request("POST", "/v1/tokens", body);
|
|
31840
32129
|
printCreatedToken(data, tokenCreationOutput(this, opts));
|
|
31841
32130
|
});
|
|
31842
32131
|
addTokenLifecycleOptions(
|
|
@@ -31857,8 +32146,8 @@ function buildBasesTokensCommand() {
|
|
|
31857
32146
|
toolset_binding: { base_id: base, toolset_id: slug }
|
|
31858
32147
|
};
|
|
31859
32148
|
applyTokenLifecycleOpts(body, opts);
|
|
31860
|
-
const
|
|
31861
|
-
const data = await
|
|
32149
|
+
const client2 = await createDataClient();
|
|
32150
|
+
const data = await client2.request("POST", "/v1/tokens", body);
|
|
31862
32151
|
const output = tokenCreationOutput(this, opts);
|
|
31863
32152
|
printCreatedToken(data, output);
|
|
31864
32153
|
if (output === "table") {
|
|
@@ -31867,24 +32156,24 @@ MCP URL: ${toolsetMcpUrl(slug)}`);
|
|
|
31867
32156
|
}
|
|
31868
32157
|
});
|
|
31869
32158
|
tokens2.command("list").description("List API tokens (status, last_used_at, expires_at, description)").action(async function() {
|
|
31870
|
-
const
|
|
31871
|
-
printOutput(await listAllTokens(
|
|
32159
|
+
const client2 = await createDataClient();
|
|
32160
|
+
printOutput(await listAllTokens(client2), outputFormat(this));
|
|
31872
32161
|
});
|
|
31873
32162
|
tokens2.command("revoke <token_id>").description(
|
|
31874
32163
|
"Revoke an API token (permanent). A recently-used or toolset-bound token requires --force."
|
|
31875
32164
|
).option("--force", "Revoke even if the token appears to be in live use").action(async function(tokenId, opts) {
|
|
31876
|
-
const
|
|
32165
|
+
const client2 = await createDataClient();
|
|
31877
32166
|
const id = pathSegment(tokenId, "token id");
|
|
31878
32167
|
const path36 = (force) => `/v1/tokens/${id}${force ? "?force=true" : ""}`;
|
|
31879
32168
|
const format = outputFormat(this);
|
|
31880
32169
|
const revoked = (forced) => printOutput({ token_id: tokenId, revoked: true, forced }, format);
|
|
31881
32170
|
if (opts.force) {
|
|
31882
|
-
await
|
|
32171
|
+
await client2.request("DELETE", path36(true));
|
|
31883
32172
|
revoked(true);
|
|
31884
32173
|
return;
|
|
31885
32174
|
}
|
|
31886
32175
|
try {
|
|
31887
|
-
await
|
|
32176
|
+
await client2.request("DELETE", path36(false));
|
|
31888
32177
|
revoked(false);
|
|
31889
32178
|
} catch (err) {
|
|
31890
32179
|
if (!(err instanceof ApiError) || err.status !== 409 || dataErrorDetails(err)?.requires_force !== true) {
|
|
@@ -31899,7 +32188,7 @@ MCP URL: ${toolsetMcpUrl(slug)}`);
|
|
|
31899
32188
|
console.error("Aborted.");
|
|
31900
32189
|
return process.exit(1);
|
|
31901
32190
|
}
|
|
31902
|
-
await
|
|
32191
|
+
await client2.request("DELETE", path36(true));
|
|
31903
32192
|
revoked(true);
|
|
31904
32193
|
}
|
|
31905
32194
|
});
|
|
@@ -31910,8 +32199,8 @@ MCP URL: ${toolsetMcpUrl(slug)}`);
|
|
|
31910
32199
|
"Also prune tokens with no activity for this long (e.g. 30d). Skips toolset-bound and legacy usage-untracked tokens."
|
|
31911
32200
|
).option("--include-bound", "Allow pruning stale toolset-bound (consumer) tokens").option("-y, --yes", "Revoke without prompting (required when non-interactive)").action(async function(opts) {
|
|
31912
32201
|
const staleMs = opts.unusedSince ? parseDuration(opts.unusedSince, "--unused-since") : void 0;
|
|
31913
|
-
const
|
|
31914
|
-
const allTokens = await listAllTokens(
|
|
32202
|
+
const client2 = await createDataClient();
|
|
32203
|
+
const allTokens = await listAllTokens(client2);
|
|
31915
32204
|
const now = Date.now();
|
|
31916
32205
|
const targets = [];
|
|
31917
32206
|
const skipped = [];
|
|
@@ -31978,7 +32267,7 @@ Revoke ${targets.length} token(s)?`)) {
|
|
|
31978
32267
|
let failed = 0;
|
|
31979
32268
|
for (const t of targets) {
|
|
31980
32269
|
try {
|
|
31981
|
-
await
|
|
32270
|
+
await client2.request(
|
|
31982
32271
|
"DELETE",
|
|
31983
32272
|
`/v1/tokens/${pathSegment(t.token_id, "token id")}?force=true`
|
|
31984
32273
|
);
|
|
@@ -32019,12 +32308,12 @@ Output:
|
|
|
32019
32308
|
});
|
|
32020
32309
|
|
|
32021
32310
|
// src/data/base-tags.ts
|
|
32022
|
-
async function resolveBaseTags(rawTags,
|
|
32311
|
+
async function resolveBaseTags(rawTags, client2) {
|
|
32023
32312
|
const refs = splitList(rawTags);
|
|
32024
32313
|
if (refs.length === 0) return [];
|
|
32025
32314
|
let orgTags;
|
|
32026
32315
|
try {
|
|
32027
|
-
orgTags = await
|
|
32316
|
+
orgTags = await client2.listOrgTags();
|
|
32028
32317
|
} catch (err) {
|
|
32029
32318
|
if (!(err instanceof ApiError) || err.status !== 401 && err.status !== 403) throw err;
|
|
32030
32319
|
return refs;
|
|
@@ -32061,16 +32350,16 @@ function parseEnum(flag, value, allowed) {
|
|
|
32061
32350
|
function buildBasesCommand() {
|
|
32062
32351
|
const bases = new Command10("bases").description("Manage bases");
|
|
32063
32352
|
bases.command("list").description("List all bases").option("--tag <tag>", "Filter by tag").action(async function(opts) {
|
|
32064
|
-
const
|
|
32353
|
+
const client2 = await createDataClient();
|
|
32065
32354
|
const qs = opts.tag ? `?tag=${encodeURIComponent(opts.tag)}` : "";
|
|
32066
32355
|
printOutput(
|
|
32067
|
-
await
|
|
32356
|
+
await client2.collectPages((cursor) => pageOf(`/v1/bases${qs}`, cursor)),
|
|
32068
32357
|
outputFormat(this)
|
|
32069
32358
|
);
|
|
32070
32359
|
});
|
|
32071
32360
|
bases.command("get <id>").description("Get a base").action(async function(id) {
|
|
32072
|
-
const
|
|
32073
|
-
printOutput(await
|
|
32361
|
+
const client2 = await createDataClient();
|
|
32362
|
+
printOutput(await client2.request("GET", `/v1/bases/${pathSegment(id)}`), outputFormat(this));
|
|
32074
32363
|
});
|
|
32075
32364
|
bases.command("create <id>").description("Create a base").requiredOption("--name <name>", "Base name").option("--description <desc>", "Description").option("--tags <tags>", "Comma-separated organization tag names (e.g. clinica-medica,billing)").option(
|
|
32076
32365
|
"--timezone <tz>",
|
|
@@ -32084,12 +32373,12 @@ function buildBasesCommand() {
|
|
|
32084
32373
|
"preview"
|
|
32085
32374
|
]);
|
|
32086
32375
|
const target = basePathSegment(id);
|
|
32087
|
-
const
|
|
32376
|
+
const client2 = await createDataClient();
|
|
32088
32377
|
const body = { name: opts.name, description: opts.description };
|
|
32089
32378
|
if (environment) body.environment = environment;
|
|
32090
|
-
if (opts.tags) body.tags = await resolveBaseTags(opts.tags,
|
|
32379
|
+
if (opts.tags) body.tags = await resolveBaseTags(opts.tags, client2);
|
|
32091
32380
|
if (opts.timezone) body.settings = { timezone: opts.timezone };
|
|
32092
|
-
printOutput(await
|
|
32381
|
+
printOutput(await client2.request("PUT", `/v1/bases/${target}`, body), outputFormat(this));
|
|
32093
32382
|
});
|
|
32094
32383
|
bases.command("update <id>").description(
|
|
32095
32384
|
"Update a base's mutable config (display name, description, tags, default timezone/settings). The id/slug is immutable."
|
|
@@ -32113,11 +32402,11 @@ function buildBasesCommand() {
|
|
|
32113
32402
|
);
|
|
32114
32403
|
}
|
|
32115
32404
|
const target = basePathSegment(id);
|
|
32116
|
-
const
|
|
32405
|
+
const client2 = await createDataClient();
|
|
32117
32406
|
const body = {};
|
|
32118
32407
|
if (opts.name !== void 0) body.name = opts.name;
|
|
32119
32408
|
if (opts.description !== void 0) body.description = opts.description;
|
|
32120
|
-
if (opts.tags !== void 0) body.tags = await resolveBaseTags(opts.tags,
|
|
32409
|
+
if (opts.tags !== void 0) body.tags = await resolveBaseTags(opts.tags, client2);
|
|
32121
32410
|
if (integrations !== void 0) body.integrations = integrations;
|
|
32122
32411
|
if (opts.settings !== void 0 || opts.timezone !== void 0) {
|
|
32123
32412
|
let settings;
|
|
@@ -32133,21 +32422,21 @@ function buildBasesCommand() {
|
|
|
32133
32422
|
}
|
|
32134
32423
|
settings = parsed;
|
|
32135
32424
|
} else {
|
|
32136
|
-
const existing = await
|
|
32425
|
+
const existing = await client2.request("GET", `/v1/bases/${target}`);
|
|
32137
32426
|
settings = { ...existing?.settings ?? {} };
|
|
32138
32427
|
}
|
|
32139
32428
|
if (opts.timezone !== void 0) settings.timezone = opts.timezone;
|
|
32140
32429
|
body.settings = settings;
|
|
32141
32430
|
}
|
|
32142
|
-
printOutput(await
|
|
32431
|
+
printOutput(await client2.request("PUT", `/v1/bases/${target}`, body), outputFormat(this));
|
|
32143
32432
|
});
|
|
32144
32433
|
bases.command("rename <id>").description(
|
|
32145
32434
|
"Rename a base's display name (the id/slug is immutable \u2014 it scopes token grants, MCP endpoints, and references)"
|
|
32146
32435
|
).requiredOption("--name <name>", "New display name").action(async function(id, opts) {
|
|
32147
32436
|
const target = basePathSegment(id);
|
|
32148
|
-
const
|
|
32437
|
+
const client2 = await createDataClient();
|
|
32149
32438
|
printOutput(
|
|
32150
|
-
await
|
|
32439
|
+
await client2.request("PUT", `/v1/bases/${target}`, { name: opts.name }),
|
|
32151
32440
|
outputFormat(this)
|
|
32152
32441
|
);
|
|
32153
32442
|
});
|
|
@@ -32156,10 +32445,10 @@ function buildBasesCommand() {
|
|
|
32156
32445
|
"Comma-separated organization tag names (e.g. clinica-medica,billing). An empty value clears them"
|
|
32157
32446
|
).action(async function(id, opts) {
|
|
32158
32447
|
const target = basePathSegment(id);
|
|
32159
|
-
const
|
|
32160
|
-
const tags = await resolveBaseTags(opts.tags,
|
|
32448
|
+
const client2 = await createDataClient();
|
|
32449
|
+
const tags = await resolveBaseTags(opts.tags, client2);
|
|
32161
32450
|
printOutput(
|
|
32162
|
-
await
|
|
32451
|
+
await client2.request("PUT", `/v1/bases/${target}`, { tags }),
|
|
32163
32452
|
outputFormat(this)
|
|
32164
32453
|
);
|
|
32165
32454
|
});
|
|
@@ -32174,8 +32463,8 @@ function buildBasesCommand() {
|
|
|
32174
32463
|
console.log("Aborted");
|
|
32175
32464
|
return;
|
|
32176
32465
|
}
|
|
32177
|
-
const
|
|
32178
|
-
await
|
|
32466
|
+
const client2 = await createDataClient();
|
|
32467
|
+
await client2.request("DELETE", `/v1/bases/${pathSegment(id)}${opts.purge ? "?purge=true" : ""}`);
|
|
32179
32468
|
printOutput({ id, deleted: true, purged: opts.purge === true }, outputFormat(this));
|
|
32180
32469
|
});
|
|
32181
32470
|
bases.command("create-preview <origin-id>").description(
|
|
@@ -32188,14 +32477,14 @@ function buildBasesCommand() {
|
|
|
32188
32477
|
"Fail with 409 if the derived preview id already exists, instead of re-applying config onto it. Use for per-session ephemeral bases, where landing on a live sibling would corrupt both runs"
|
|
32189
32478
|
).action(async function(originId, opts) {
|
|
32190
32479
|
const integrations = parseEnum("--integrations", opts.integrations, ["enabled", "disabled"]);
|
|
32191
|
-
const
|
|
32480
|
+
const client2 = await createDataClient();
|
|
32192
32481
|
printOutput(
|
|
32193
32482
|
// `pathSegment`, not `basePathSegment`: the id at fault here is the
|
|
32194
32483
|
// ORIGIN's, which is immutable and not the caller's to re-spell. The API's
|
|
32195
32484
|
// `assertDerivablePreviewId` answers that case with the remedy instead of
|
|
32196
32485
|
// the charset, and refusing locally would replace it with a rule the
|
|
32197
32486
|
// caller cannot act on.
|
|
32198
|
-
await
|
|
32487
|
+
await client2.request("POST", `/v1/${pathSegment(originId, "origin base id")}/preview`, {
|
|
32199
32488
|
name: opts.name,
|
|
32200
32489
|
description: opts.description,
|
|
32201
32490
|
...integrations !== void 0 ? { integrations } : {},
|
|
@@ -32205,16 +32494,16 @@ function buildBasesCommand() {
|
|
|
32205
32494
|
);
|
|
32206
32495
|
});
|
|
32207
32496
|
bases.command("list-previews <origin-id>").description("List preview bases cloned from a base (production or preview)").action(async function(originId) {
|
|
32208
|
-
const
|
|
32497
|
+
const client2 = await createDataClient();
|
|
32209
32498
|
const path36 = `/v1/${pathSegment(originId, "origin base id")}/previews`;
|
|
32210
32499
|
printOutput(
|
|
32211
|
-
await
|
|
32500
|
+
await client2.collectPages((cursor) => pageOf(path36, cursor)),
|
|
32212
32501
|
outputFormat(this)
|
|
32213
32502
|
);
|
|
32214
32503
|
});
|
|
32215
32504
|
bases.command("promote <production-id>").description("Promote config from a preview base to production (human-only)").requiredOption("--from <preview-id>", "Source preview base id").option("--dry-run", "Show what would change without applying").option("--record-types <ids>", "Comma-separated record type ids to promote", splitList).option("--triggers <ids>", "Comma-separated trigger ids to promote", splitList).option("--inbound-webhooks <ids>", "Comma-separated inbound webhook ids to promote", splitList).action(async function(productionId, opts) {
|
|
32216
|
-
const
|
|
32217
|
-
const data = await
|
|
32505
|
+
const client2 = await createDataClient();
|
|
32506
|
+
const data = await client2.request("POST", `/v1/${pathSegment(productionId, "production base id")}/promote`, {
|
|
32218
32507
|
source_base_id: opts.from,
|
|
32219
32508
|
dry_run: opts.dryRun ?? false,
|
|
32220
32509
|
record_types: opts.recordTypes,
|
|
@@ -32245,19 +32534,19 @@ function buildBasesCommand() {
|
|
|
32245
32534
|
}
|
|
32246
32535
|
});
|
|
32247
32536
|
bases.command("rollback <production-id>").description("Roll back a promotion (human-only)").requiredOption("--promotion <promotion-id>", "Promotion id to roll back").action(async function(productionId, opts) {
|
|
32248
|
-
const
|
|
32537
|
+
const client2 = await createDataClient();
|
|
32249
32538
|
printOutput(
|
|
32250
|
-
await
|
|
32539
|
+
await client2.request("POST", `/v1/${pathSegment(productionId, "production base id")}/promote/rollback`, {
|
|
32251
32540
|
promotion_id: opts.promotion
|
|
32252
32541
|
}),
|
|
32253
32542
|
outputFormat(this)
|
|
32254
32543
|
);
|
|
32255
32544
|
});
|
|
32256
32545
|
bases.command("promotions <production-id>").description("List promotion history for a production base").action(async function(productionId) {
|
|
32257
|
-
const
|
|
32546
|
+
const client2 = await createDataClient();
|
|
32258
32547
|
const path36 = `/v1/${pathSegment(productionId, "production base id")}/promotions`;
|
|
32259
32548
|
printOutput(
|
|
32260
|
-
await
|
|
32549
|
+
await client2.collectPages((cursor) => pageOf(path36, cursor)),
|
|
32261
32550
|
outputFormat(this)
|
|
32262
32551
|
);
|
|
32263
32552
|
});
|
|
@@ -32343,20 +32632,20 @@ function buildFileTypesCommand() {
|
|
|
32343
32632
|
);
|
|
32344
32633
|
fileTypes.command("list").description("List all file types in a base").action(async function() {
|
|
32345
32634
|
const base = pathSegment(requireBase(this), "--base");
|
|
32346
|
-
const
|
|
32347
|
-
printOutput(await
|
|
32635
|
+
const client2 = await createDataClient();
|
|
32636
|
+
printOutput(await client2.request("GET", `/v1/${base}/file-types`), outputFormat(this));
|
|
32348
32637
|
});
|
|
32349
32638
|
fileTypes.command("get <id>").description("Get a file type").action(async function(id) {
|
|
32350
32639
|
const base = pathSegment(requireBase(this), "--base");
|
|
32351
|
-
const
|
|
32352
|
-
printOutput(await
|
|
32640
|
+
const client2 = await createDataClient();
|
|
32641
|
+
printOutput(await client2.request("GET", `/v1/${base}/file-types/${pathSegment(id, "file_type")}`), outputFormat(this));
|
|
32353
32642
|
});
|
|
32354
32643
|
fileTypes.command("upsert <id>").description("Create or update a file type (preview bases only)").requiredOption("--name <name>", "File type name").option("--description <desc>", "Description").option("--max-size <bytes>", "Max bytes per file (0 = unlimited)").option(
|
|
32355
32644
|
"--allowed-content-types <json>",
|
|
32356
32645
|
"Allowed content-types, JSON array (inline or @filename)"
|
|
32357
32646
|
).option("--metadata-schema <json>", "JSON Schema for file metadata (inline JSON or @filename)").action(async function(id, opts) {
|
|
32358
32647
|
const base = pathSegment(requireBase(this), "--base");
|
|
32359
|
-
const
|
|
32648
|
+
const client2 = await createDataClient();
|
|
32360
32649
|
const body = { name: opts.name };
|
|
32361
32650
|
if (opts.description) body.description = opts.description;
|
|
32362
32651
|
if (opts.maxSize !== void 0) body.max_size = parseByteCount("--max-size", opts.maxSize);
|
|
@@ -32365,7 +32654,7 @@ function buildFileTypesCommand() {
|
|
|
32365
32654
|
}
|
|
32366
32655
|
if (opts.metadataSchema) body.metadata_schema = parseData(opts.metadataSchema);
|
|
32367
32656
|
printOutput(
|
|
32368
|
-
await
|
|
32657
|
+
await client2.request("PUT", `/v1/${base}/file-types/${pathSegment(id, "file_type")}`, body),
|
|
32369
32658
|
outputFormat(this)
|
|
32370
32659
|
);
|
|
32371
32660
|
});
|
|
@@ -32377,8 +32666,8 @@ function buildFileTypesCommand() {
|
|
|
32377
32666
|
return;
|
|
32378
32667
|
}
|
|
32379
32668
|
const base = pathSegment(requireBase(this), "--base");
|
|
32380
|
-
const
|
|
32381
|
-
await
|
|
32669
|
+
const client2 = await createDataClient();
|
|
32670
|
+
await client2.request("DELETE", `/v1/${base}/file-types/${pathSegment(id, "file_type")}`);
|
|
32382
32671
|
console.log("Deleted");
|
|
32383
32672
|
});
|
|
32384
32673
|
return fileTypes;
|
|
@@ -32445,9 +32734,9 @@ function buildFilesCommand() {
|
|
|
32445
32734
|
).requiredOption("--file <local>", "Local file to upload").option("--content-type <type>", "MIME type", "application/octet-stream").action(async function(fileType, filePath, opts) {
|
|
32446
32735
|
const base = pathSegment(requireBase(this), "--base");
|
|
32447
32736
|
const body = readFileSync23(opts.file);
|
|
32448
|
-
const
|
|
32737
|
+
const client2 = await createDataClient();
|
|
32449
32738
|
printOutput(
|
|
32450
|
-
await
|
|
32739
|
+
await client2.upload(
|
|
32451
32740
|
`/v1/${base}/files/${pathSegment(fileType, "file_type")}/${pathSegments(filePath)}`,
|
|
32452
32741
|
body,
|
|
32453
32742
|
opts.contentType
|
|
@@ -32463,16 +32752,16 @@ function buildFilesCommand() {
|
|
|
32463
32752
|
const base = pathSegment(requireBase(this), "--base");
|
|
32464
32753
|
if (opts.meta) {
|
|
32465
32754
|
const qs = ["meta=1", versionQs].filter(Boolean).join("&");
|
|
32466
|
-
const
|
|
32755
|
+
const client3 = await createDataClient();
|
|
32467
32756
|
printOutput(
|
|
32468
|
-
await
|
|
32757
|
+
await client3.request("GET", `/v1/${base}/files/${pathSegment(fileType, "file_type")}/${encoded}?${qs}`),
|
|
32469
32758
|
outputFormat(this)
|
|
32470
32759
|
);
|
|
32471
32760
|
return;
|
|
32472
32761
|
}
|
|
32473
32762
|
const out = downloadTarget(filePath, opts.to);
|
|
32474
|
-
const
|
|
32475
|
-
const { bytes } = await
|
|
32763
|
+
const client2 = await createDataClient();
|
|
32764
|
+
const { bytes } = await client2.download(
|
|
32476
32765
|
`/v1/${base}/files/${pathSegment(fileType, "file_type")}/${encoded}${versionQs ? `?${versionQs}` : ""}`
|
|
32477
32766
|
);
|
|
32478
32767
|
writeFileSync12(out, bytes);
|
|
@@ -32480,12 +32769,12 @@ function buildFilesCommand() {
|
|
|
32480
32769
|
});
|
|
32481
32770
|
files.command("history <file_type> <path>").description("List the content versions of a file (newest first)").option("--limit <n>", "Max versions to return").option("--offset <n>", "Pagination offset").action(async function(fileType, filePath, opts) {
|
|
32482
32771
|
const base = pathSegment(requireBase(this), "--base");
|
|
32483
|
-
const
|
|
32772
|
+
const client2 = await createDataClient();
|
|
32484
32773
|
const qs = new URLSearchParams({ history: "1" });
|
|
32485
32774
|
if (opts.limit) qs.set("limit", opts.limit);
|
|
32486
32775
|
if (opts.offset) qs.set("offset", opts.offset);
|
|
32487
32776
|
printOutput(
|
|
32488
|
-
await
|
|
32777
|
+
await client2.request(
|
|
32489
32778
|
"GET",
|
|
32490
32779
|
`/v1/${base}/files/${pathSegment(fileType, "file_type")}/${pathSegments(filePath)}?${qs}`
|
|
32491
32780
|
),
|
|
@@ -32494,9 +32783,9 @@ function buildFilesCommand() {
|
|
|
32494
32783
|
});
|
|
32495
32784
|
files.command("diff <file_type> <path>").description("Diff two content versions of a file \u2014 metadata delta plus a text content diff").requiredOption("--from <n>", "Base version number").requiredOption("--to <n>", "Target version number").action(async function(fileType, filePath, opts) {
|
|
32496
32785
|
const base = pathSegment(requireBase(this), "--base");
|
|
32497
|
-
const
|
|
32786
|
+
const client2 = await createDataClient();
|
|
32498
32787
|
const qs = new URLSearchParams({ diff: "1", from: opts.from, to: opts.to });
|
|
32499
|
-
const data = await
|
|
32788
|
+
const data = await client2.request(
|
|
32500
32789
|
"GET",
|
|
32501
32790
|
`/v1/${base}/files/${pathSegment(fileType, "file_type")}/${pathSegments(filePath)}?${qs}`
|
|
32502
32791
|
);
|
|
@@ -32508,7 +32797,7 @@ function buildFilesCommand() {
|
|
|
32508
32797
|
});
|
|
32509
32798
|
files.command("list <file_type>").description("List files by path prefix").option("--prefix <path>", "Path prefix filter (e.g. q3/)").option("--depth <n>", "Max folder depth below the prefix (1 = immediate children)").option("--limit <n>", "Max results").option("--offset <n>", "Pagination offset").action(async function(fileType, opts) {
|
|
32510
32799
|
const base = pathSegment(requireBase(this), "--base");
|
|
32511
|
-
const
|
|
32800
|
+
const client2 = await createDataClient();
|
|
32512
32801
|
const qs = new URLSearchParams();
|
|
32513
32802
|
if (opts.prefix) qs.set("prefix", opts.prefix);
|
|
32514
32803
|
if (opts.depth) qs.set("depth", opts.depth);
|
|
@@ -32516,15 +32805,15 @@ function buildFilesCommand() {
|
|
|
32516
32805
|
if (opts.offset) qs.set("offset", opts.offset);
|
|
32517
32806
|
const q = qs.toString();
|
|
32518
32807
|
printOutput(
|
|
32519
|
-
await
|
|
32808
|
+
await client2.request("GET", `/v1/${base}/files/${pathSegment(fileType, "file_type")}${q ? `?${q}` : ""}`),
|
|
32520
32809
|
outputFormat(this)
|
|
32521
32810
|
);
|
|
32522
32811
|
});
|
|
32523
32812
|
files.command("mv <file_type> <from> <to>").description("Rename/move a file (the blob is untouched)").action(async function(fileType, from, to) {
|
|
32524
32813
|
const base = pathSegment(requireBase(this), "--base");
|
|
32525
|
-
const
|
|
32814
|
+
const client2 = await createDataClient();
|
|
32526
32815
|
printOutput(
|
|
32527
|
-
await
|
|
32816
|
+
await client2.request("PATCH", `/v1/${base}/files/${pathSegment(fileType, "file_type")}/${pathSegments(from)}`, {
|
|
32528
32817
|
new_path: to
|
|
32529
32818
|
}),
|
|
32530
32819
|
outputFormat(this)
|
|
@@ -32536,8 +32825,8 @@ function buildFilesCommand() {
|
|
|
32536
32825
|
return;
|
|
32537
32826
|
}
|
|
32538
32827
|
const base = pathSegment(requireBase(this), "--base");
|
|
32539
|
-
const
|
|
32540
|
-
await
|
|
32828
|
+
const client2 = await createDataClient();
|
|
32829
|
+
await client2.request("DELETE", `/v1/${base}/files/${pathSegment(fileType, "file_type")}/${pathSegments(filePath)}`);
|
|
32541
32830
|
console.log("Deleted");
|
|
32542
32831
|
});
|
|
32543
32832
|
files.command("mount <file_type>").description(
|
|
@@ -32575,9 +32864,9 @@ function buildFilesCommand() {
|
|
|
32575
32864
|
body.expires_in = n;
|
|
32576
32865
|
}
|
|
32577
32866
|
const base = pathSegment(requireBase(this), "--base");
|
|
32578
|
-
const
|
|
32867
|
+
const client2 = await createDataClient();
|
|
32579
32868
|
printOutput(
|
|
32580
|
-
await
|
|
32869
|
+
await client2.request("POST", `/v1/${base}/s3-credentials`, body),
|
|
32581
32870
|
outputFormat(this)
|
|
32582
32871
|
);
|
|
32583
32872
|
});
|
|
@@ -32636,10 +32925,10 @@ function buildInboundWebhooksCommand() {
|
|
|
32636
32925
|
if (opts.ingestAuth) body.ingest_auth = parseData(opts.ingestAuth);
|
|
32637
32926
|
if (opts.hydration) body.hydration = parseData(opts.hydration);
|
|
32638
32927
|
const base = pathSegment(requireBase(this), "--base");
|
|
32639
|
-
const
|
|
32928
|
+
const client2 = await createDataClient();
|
|
32640
32929
|
const inboundWebhookId = opts.id ?? randomUUID2();
|
|
32641
32930
|
printOutput(
|
|
32642
|
-
await
|
|
32931
|
+
await client2.request(
|
|
32643
32932
|
"PUT",
|
|
32644
32933
|
`/v1/${base}/inbound-webhooks/${pathSegment(inboundWebhookId, "--id")}`,
|
|
32645
32934
|
body
|
|
@@ -32649,28 +32938,28 @@ function buildInboundWebhooksCommand() {
|
|
|
32649
32938
|
});
|
|
32650
32939
|
inboundWebhooks.command("get <id>").description("Get an inbound webhook").action(async function(id) {
|
|
32651
32940
|
const base = pathSegment(requireBase(this), "--base");
|
|
32652
|
-
const
|
|
32941
|
+
const client2 = await createDataClient();
|
|
32653
32942
|
printOutput(
|
|
32654
|
-
await
|
|
32943
|
+
await client2.request("GET", `/v1/${base}/inbound-webhooks/${pathSegment(id, "inbound webhook id")}`),
|
|
32655
32944
|
outputFormat(this)
|
|
32656
32945
|
);
|
|
32657
32946
|
});
|
|
32658
32947
|
inboundWebhooks.command("list").description("List all inbound webhooks").action(async function() {
|
|
32659
32948
|
const base = pathSegment(requireBase(this), "--base");
|
|
32660
|
-
const
|
|
32661
|
-
printOutput(await
|
|
32949
|
+
const client2 = await createDataClient();
|
|
32950
|
+
printOutput(await client2.request("GET", `/v1/${base}/inbound-webhooks`), outputFormat(this));
|
|
32662
32951
|
});
|
|
32663
32952
|
inboundWebhooks.command("deliveries").description(
|
|
32664
32953
|
'List hydration delivery status for reference-style ("notification + fetch") webhooks'
|
|
32665
32954
|
).option("--status <status>", "Filter by status (pending|delivered|failed|dead)").option("--inbound-webhook <id>", "Filter to one inbound webhook").action(async function(opts) {
|
|
32666
32955
|
const base = pathSegment(requireBase(this), "--base");
|
|
32667
|
-
const
|
|
32956
|
+
const client2 = await createDataClient();
|
|
32668
32957
|
const params = new URLSearchParams();
|
|
32669
32958
|
if (opts.status) params.set("status", opts.status);
|
|
32670
32959
|
if (opts.inboundWebhook) params.set("inbound_webhook_id", opts.inboundWebhook);
|
|
32671
32960
|
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
32672
32961
|
printOutput(
|
|
32673
|
-
await
|
|
32962
|
+
await client2.request("GET", `/v1/${base}/inbound-webhooks/deliveries${qs}`),
|
|
32674
32963
|
outputFormat(this)
|
|
32675
32964
|
);
|
|
32676
32965
|
});
|
|
@@ -32680,8 +32969,8 @@ function buildInboundWebhooksCommand() {
|
|
|
32680
32969
|
return;
|
|
32681
32970
|
}
|
|
32682
32971
|
const base = pathSegment(requireBase(this), "--base");
|
|
32683
|
-
const
|
|
32684
|
-
await
|
|
32972
|
+
const client2 = await createDataClient();
|
|
32973
|
+
await client2.request("DELETE", `/v1/${base}/inbound-webhooks/${pathSegment(id, "inbound webhook id")}`);
|
|
32685
32974
|
console.log("Deleted");
|
|
32686
32975
|
});
|
|
32687
32976
|
return inboundWebhooks;
|
|
@@ -32701,14 +32990,14 @@ import { Command as Command14 } from "commander";
|
|
|
32701
32990
|
function buildQueryRelationshipsCommand() {
|
|
32702
32991
|
return new Command14("query-relationships").description("Query related records").argument("<record_type>", "RecordType of the source record").argument("<id>", "Source record ID").option("--type <type>", "Filter by relationship type").option("--direction <dir>", "Direction: outgoing, incoming, or both", "both").option("--limit <n>", "Max results", "50").option("--offset <n>", "Skip results", "0").action(async function(recordType2, id, opts) {
|
|
32703
32992
|
const base = pathSegment(requireBase(this), "--base");
|
|
32704
|
-
const
|
|
32993
|
+
const client2 = await createDataClient();
|
|
32705
32994
|
const params = new URLSearchParams();
|
|
32706
32995
|
if (opts.type) params.set("rel_type", opts.type);
|
|
32707
32996
|
params.set("direction", DIRECTIONS[opts.direction] ?? opts.direction);
|
|
32708
32997
|
params.set("limit", opts.limit);
|
|
32709
32998
|
params.set("offset", opts.offset);
|
|
32710
32999
|
printOutput(
|
|
32711
|
-
await
|
|
33000
|
+
await client2.request(
|
|
32712
33001
|
"GET",
|
|
32713
33002
|
`/v1/${base}/records/${pathSegment(recordType2, "record_type")}/${pathSegment(id, "record id")}/related?${params.toString()}`
|
|
32714
33003
|
),
|
|
@@ -32737,17 +33026,17 @@ function buildRecordTypesCommand() {
|
|
|
32737
33026
|
const recordTypes = new Command15("record-types").description("Manage record_types");
|
|
32738
33027
|
recordTypes.command("list").description("List all record_types in a base").action(async function() {
|
|
32739
33028
|
const base = pathSegment(requireBase(this), "--base");
|
|
32740
|
-
const
|
|
32741
|
-
printOutput(await
|
|
33029
|
+
const client2 = await createDataClient();
|
|
33030
|
+
printOutput(await client2.request("GET", `/v1/${base}/record-types`), outputFormat(this));
|
|
32742
33031
|
});
|
|
32743
33032
|
recordTypes.command("get <id>").description("Get a record_type").action(async function(id) {
|
|
32744
33033
|
const base = pathSegment(requireBase(this), "--base");
|
|
32745
|
-
const
|
|
32746
|
-
printOutput(await
|
|
33034
|
+
const client2 = await createDataClient();
|
|
33035
|
+
printOutput(await client2.request("GET", `/v1/${base}/record-types/${pathSegment(id, "record_type")}`), outputFormat(this));
|
|
32747
33036
|
});
|
|
32748
33037
|
recordTypes.command("upsert <id>").description("Create or update a record_type").requiredOption("--name <name>", "RecordType name").option("--description <desc>", "Description").option("--schema <json>", "JSON Schema (inline JSON or @filename)").option("--icon <icon>", "Icon name").option("--color <color>", "Hex color").option("--sources <json>", "External sources config (inline JSON or @filename)").action(async function(id, opts) {
|
|
32749
33038
|
const base = pathSegment(requireBase(this), "--base");
|
|
32750
|
-
const
|
|
33039
|
+
const client2 = await createDataClient();
|
|
32751
33040
|
const body = { name: opts.name };
|
|
32752
33041
|
if (opts.description) body.description = opts.description;
|
|
32753
33042
|
if (opts.schema) body.json_schema = parseData(opts.schema);
|
|
@@ -32755,7 +33044,7 @@ function buildRecordTypesCommand() {
|
|
|
32755
33044
|
if (opts.color) body.color = opts.color;
|
|
32756
33045
|
if (opts.sources) body.sources = parseData(opts.sources);
|
|
32757
33046
|
printOutput(
|
|
32758
|
-
await
|
|
33047
|
+
await client2.request("PUT", `/v1/${base}/record-types/${pathSegment(id, "record_type")}`, body),
|
|
32759
33048
|
outputFormat(this)
|
|
32760
33049
|
);
|
|
32761
33050
|
});
|
|
@@ -32765,17 +33054,17 @@ function buildRecordTypesCommand() {
|
|
|
32765
33054
|
return;
|
|
32766
33055
|
}
|
|
32767
33056
|
const base = pathSegment(requireBase(this), "--base");
|
|
32768
|
-
const
|
|
32769
|
-
await
|
|
33057
|
+
const client2 = await createDataClient();
|
|
33058
|
+
await client2.request("DELETE", `/v1/${base}/record-types/${pathSegment(id, "record_type")}`);
|
|
32770
33059
|
console.log("Deleted");
|
|
32771
33060
|
});
|
|
32772
33061
|
recordTypes.command("history <id>").description(
|
|
32773
33062
|
"View the change history (audit log) for a record_type \u2014 every schema/config version, who changed it, and when"
|
|
32774
33063
|
).option("--limit <n>", "Max results").option("--offset <n>", "Pagination offset").option("--diff", "Include field-level diffs between versions").action(async function(id, opts) {
|
|
32775
33064
|
const base = pathSegment(requireBase(this), "--base");
|
|
32776
|
-
const
|
|
33065
|
+
const client2 = await createDataClient();
|
|
32777
33066
|
printOutput(
|
|
32778
|
-
await
|
|
33067
|
+
await client2.request("GET", `/v1/${base}/audit/record-types/${pathSegment(id, "record_type")}${historyQuery(opts)}`),
|
|
32779
33068
|
outputFormat(this)
|
|
32780
33069
|
);
|
|
32781
33070
|
});
|
|
@@ -32800,12 +33089,12 @@ function buildRecordsCommand() {
|
|
|
32800
33089
|
const records = new Command16("records").description("Manage records");
|
|
32801
33090
|
records.command("upsert <record_type>").description("Create or update a record").requiredOption("--data <json>", "Record data (inline JSON or @filename)").option("--id <id>", "Internal record ID (UUID) to update a known record").option("--external-id <id>", "External/agent-supplied ID for idempotent upsert").option("--external-source <source>", "Source system for external_id (e.g. stripe)").action(async function(recordType2, opts) {
|
|
32802
33091
|
const base = pathSegment(requireBase(this), "--base");
|
|
32803
|
-
const
|
|
33092
|
+
const client2 = await createDataClient();
|
|
32804
33093
|
const body = { data: parseData(opts.data) };
|
|
32805
33094
|
if (opts.externalId) body.external_id = opts.externalId;
|
|
32806
33095
|
if (opts.externalSource) body.external_source = opts.externalSource;
|
|
32807
33096
|
const path36 = opts.id ? `/v1/${base}/records/${pathSegment(recordType2, "record_type")}/${pathSegment(opts.id, "--id")}` : `/v1/${base}/records/${pathSegment(recordType2, "record_type")}`;
|
|
32808
|
-
printOutput(await
|
|
33097
|
+
printOutput(await client2.request("PUT", path36, body), outputFormat(this));
|
|
32809
33098
|
});
|
|
32810
33099
|
records.command("query <record_type>").description("List/search records: exact filters + fuzzy `search`, sorting, pagination").option(
|
|
32811
33100
|
"--external-source <source>",
|
|
@@ -32818,7 +33107,7 @@ function buildRecordsCommand() {
|
|
|
32818
33107
|
'Sort expressions (inline JSON or @filename), e.g. [{"field":"data.created","direction":"desc"}]'
|
|
32819
33108
|
).option("--fields <list>", "Comma-separated field projection").option("--limit <n>", "Max results").option("--offset <n>", "Pagination offset").action(async function(recordType2, opts) {
|
|
32820
33109
|
const base = pathSegment(requireBase(this), "--base");
|
|
32821
|
-
const
|
|
33110
|
+
const client2 = await createDataClient();
|
|
32822
33111
|
const qs = new URLSearchParams();
|
|
32823
33112
|
if (opts.externalSource) qs.set("external_source", opts.externalSource);
|
|
32824
33113
|
if (opts.filter) qs.set("filter", JSON.stringify(parseData(opts.filter)));
|
|
@@ -32828,7 +33117,7 @@ function buildRecordsCommand() {
|
|
|
32828
33117
|
if (opts.offset) qs.set("offset", opts.offset);
|
|
32829
33118
|
const q = qs.toString();
|
|
32830
33119
|
printOutput(
|
|
32831
|
-
await
|
|
33120
|
+
await client2.request("GET", `/v1/${base}/records/${pathSegment(recordType2, "record_type")}${q ? `?${q}` : ""}`),
|
|
32832
33121
|
outputFormat(this)
|
|
32833
33122
|
);
|
|
32834
33123
|
});
|
|
@@ -32839,10 +33128,10 @@ function buildRecordsCommand() {
|
|
|
32839
33128
|
"Treat <id> as an external_id scoped to this source system (e.g. stripe)"
|
|
32840
33129
|
).action(async function(recordType2, id, opts) {
|
|
32841
33130
|
const base = pathSegment(requireBase(this), "--base");
|
|
32842
|
-
const
|
|
33131
|
+
const client2 = await createDataClient();
|
|
32843
33132
|
let path36 = `/v1/${base}/records/${pathSegment(recordType2, "record_type")}/${recordKey(id, opts.externalSource)}`;
|
|
32844
33133
|
if (opts.externalSource) path36 += `?external_source=${encodeURIComponent(opts.externalSource)}`;
|
|
32845
|
-
printOutput(await
|
|
33134
|
+
printOutput(await client2.request("GET", path36), outputFormat(this));
|
|
32846
33135
|
});
|
|
32847
33136
|
records.command("delete <record_type> <id>").description(
|
|
32848
33137
|
"Delete a record by internal ID, or by external_id (pass --external-source to scope it)"
|
|
@@ -32855,21 +33144,21 @@ function buildRecordsCommand() {
|
|
|
32855
33144
|
return;
|
|
32856
33145
|
}
|
|
32857
33146
|
const base = pathSegment(requireBase(this), "--base");
|
|
32858
|
-
const
|
|
33147
|
+
const client2 = await createDataClient();
|
|
32859
33148
|
let path36 = `/v1/${base}/records/${pathSegment(recordType2, "record_type")}/${recordKey(id, opts.externalSource)}`;
|
|
32860
33149
|
if (opts.externalSource) {
|
|
32861
33150
|
path36 += `?external_source=${encodeURIComponent(opts.externalSource)}&external_id=${encodeURIComponent(id)}`;
|
|
32862
33151
|
}
|
|
32863
|
-
await
|
|
33152
|
+
await client2.request("DELETE", path36);
|
|
32864
33153
|
console.log("Deleted");
|
|
32865
33154
|
});
|
|
32866
33155
|
records.command("history <id>").description(
|
|
32867
33156
|
"View the change history (audit log) for a record \u2014 every version, who changed it, and when"
|
|
32868
33157
|
).option("--limit <n>", "Max results").option("--offset <n>", "Pagination offset").option("--diff", "Include field-level diffs between versions").action(async function(id, opts) {
|
|
32869
33158
|
const base = pathSegment(requireBase(this), "--base");
|
|
32870
|
-
const
|
|
33159
|
+
const client2 = await createDataClient();
|
|
32871
33160
|
printOutput(
|
|
32872
|
-
await
|
|
33161
|
+
await client2.request("GET", `/v1/${base}/audit/records/${pathSegment(id, "record id")}${historyQuery(opts)}`),
|
|
32873
33162
|
outputFormat(this)
|
|
32874
33163
|
);
|
|
32875
33164
|
});
|
|
@@ -32893,17 +33182,17 @@ function buildRelationshipTypesCommand() {
|
|
|
32893
33182
|
);
|
|
32894
33183
|
relationshipTypes.command("list").description("List all relationship types in a base").action(async function() {
|
|
32895
33184
|
const base = pathSegment(requireBase(this), "--base");
|
|
32896
|
-
const
|
|
33185
|
+
const client2 = await createDataClient();
|
|
32897
33186
|
printOutput(
|
|
32898
|
-
await
|
|
33187
|
+
await client2.request("GET", `/v1/${base}/relationship-types`),
|
|
32899
33188
|
outputFormat(this)
|
|
32900
33189
|
);
|
|
32901
33190
|
});
|
|
32902
33191
|
relationshipTypes.command("get <rel_type>").description("Get a relationship type").action(async function(relType) {
|
|
32903
33192
|
const base = pathSegment(requireBase(this), "--base");
|
|
32904
|
-
const
|
|
33193
|
+
const client2 = await createDataClient();
|
|
32905
33194
|
printOutput(
|
|
32906
|
-
await
|
|
33195
|
+
await client2.request("GET", `/v1/${base}/relationship-types/${pathSegment(relType, "rel_type")}`),
|
|
32907
33196
|
outputFormat(this)
|
|
32908
33197
|
);
|
|
32909
33198
|
});
|
|
@@ -32918,14 +33207,14 @@ function buildRelationshipTypesCommand() {
|
|
|
32918
33207
|
"JSON array of allowed target record_types (inline JSON or @filename)"
|
|
32919
33208
|
).action(async function(relType, opts) {
|
|
32920
33209
|
const base = pathSegment(requireBase(this), "--base");
|
|
32921
|
-
const
|
|
33210
|
+
const client2 = await createDataClient();
|
|
32922
33211
|
const body = {};
|
|
32923
33212
|
if (opts.description) body.description = opts.description;
|
|
32924
33213
|
if (opts.schema) body.data_schema = parseData(opts.schema);
|
|
32925
33214
|
if (opts.sourceRecordTypes) body.source_record_types = parseData(opts.sourceRecordTypes);
|
|
32926
33215
|
if (opts.targetRecordTypes) body.target_record_types = parseData(opts.targetRecordTypes);
|
|
32927
33216
|
printOutput(
|
|
32928
|
-
await
|
|
33217
|
+
await client2.request("PUT", `/v1/${base}/relationship-types/${pathSegment(relType, "rel_type")}`, body),
|
|
32929
33218
|
outputFormat(this)
|
|
32930
33219
|
);
|
|
32931
33220
|
});
|
|
@@ -32935,17 +33224,17 @@ function buildRelationshipTypesCommand() {
|
|
|
32935
33224
|
return;
|
|
32936
33225
|
}
|
|
32937
33226
|
const base = pathSegment(requireBase(this), "--base");
|
|
32938
|
-
const
|
|
32939
|
-
await
|
|
33227
|
+
const client2 = await createDataClient();
|
|
33228
|
+
await client2.request("DELETE", `/v1/${base}/relationship-types/${pathSegment(relType, "rel_type")}`);
|
|
32940
33229
|
console.log("Deleted");
|
|
32941
33230
|
});
|
|
32942
33231
|
relationshipTypes.command("history <id>").description(
|
|
32943
33232
|
"View the change history (audit log) for a relationship type \u2014 every config version, who changed it, and when"
|
|
32944
33233
|
).option("--limit <n>", "Max results").option("--offset <n>", "Pagination offset").option("--diff", "Include field-level diffs between versions").action(async function(id, opts) {
|
|
32945
33234
|
const base = pathSegment(requireBase(this), "--base");
|
|
32946
|
-
const
|
|
33235
|
+
const client2 = await createDataClient();
|
|
32947
33236
|
printOutput(
|
|
32948
|
-
await
|
|
33237
|
+
await client2.request(
|
|
32949
33238
|
"GET",
|
|
32950
33239
|
`/v1/${base}/audit/relationship-types/${pathSegment(id, "rel_type")}${historyQuery(opts)}`
|
|
32951
33240
|
),
|
|
@@ -33024,9 +33313,9 @@ function buildRelationshipsCommand() {
|
|
|
33024
33313
|
if (opts.externalSource) body.external_source = opts.externalSource;
|
|
33025
33314
|
if (opts.data) body.data = parseData(opts.data);
|
|
33026
33315
|
const base = pathSegment(requireBase(this), "--base");
|
|
33027
|
-
const
|
|
33316
|
+
const client2 = await createDataClient();
|
|
33028
33317
|
const path36 = opts.id ? `/v1/${base}/relationships/${pathSegment(opts.id, "--id")}` : `/v1/${base}/relationships`;
|
|
33029
|
-
printOutput(await
|
|
33318
|
+
printOutput(await client2.request("PUT", path36, body), outputFormat(this));
|
|
33030
33319
|
});
|
|
33031
33320
|
relationships.command("get <id>").description(
|
|
33032
33321
|
"Get a relationship by ID (or by its external key: pass the external_id with --rel-type)"
|
|
@@ -33035,9 +33324,9 @@ function buildRelationshipsCommand() {
|
|
|
33035
33324
|
"Treat <id> as the relationship external_id, scoped to this relationship type"
|
|
33036
33325
|
).option("--external-source <name>", "Source system scoping the external_id (with --rel-type)").action(async function(id, opts) {
|
|
33037
33326
|
const base = pathSegment(requireBase(this), "--base");
|
|
33038
|
-
const
|
|
33327
|
+
const client2 = await createDataClient();
|
|
33039
33328
|
printOutput(
|
|
33040
|
-
await
|
|
33329
|
+
await client2.request(
|
|
33041
33330
|
"GET",
|
|
33042
33331
|
`/v1/${base}/relationships/${relationshipKey(id, opts.relType)}${byKeyQuery(opts.relType, opts.externalSource)}`
|
|
33043
33332
|
),
|
|
@@ -33055,8 +33344,8 @@ function buildRelationshipsCommand() {
|
|
|
33055
33344
|
return;
|
|
33056
33345
|
}
|
|
33057
33346
|
const base = pathSegment(requireBase(this), "--base");
|
|
33058
|
-
const
|
|
33059
|
-
await
|
|
33347
|
+
const client2 = await createDataClient();
|
|
33348
|
+
await client2.request(
|
|
33060
33349
|
"DELETE",
|
|
33061
33350
|
`/v1/${base}/relationships/${relationshipKey(id, opts.relType)}${byKeyQuery(opts.relType, opts.externalSource)}`
|
|
33062
33351
|
);
|
|
@@ -33066,9 +33355,9 @@ function buildRelationshipsCommand() {
|
|
|
33066
33355
|
"View the change history (audit log) for a relationship \u2014 every version, who changed it, and when"
|
|
33067
33356
|
).option("--limit <n>", "Max results").option("--offset <n>", "Pagination offset").option("--diff", "Include field-level diffs between versions").action(async function(id, opts) {
|
|
33068
33357
|
const base = pathSegment(requireBase(this), "--base");
|
|
33069
|
-
const
|
|
33358
|
+
const client2 = await createDataClient();
|
|
33070
33359
|
printOutput(
|
|
33071
|
-
await
|
|
33360
|
+
await client2.request("GET", `/v1/${base}/audit/relationships/${pathSegment(id, "relationship id")}${historyQuery(opts)}`),
|
|
33072
33361
|
outputFormat(this)
|
|
33073
33362
|
);
|
|
33074
33363
|
});
|
|
@@ -33095,9 +33384,9 @@ function buildSeedCommand() {
|
|
|
33095
33384
|
"Idempotently upsert the fixture (keyed by external_id, so re-applying never twins). Preview-only."
|
|
33096
33385
|
).action(async function(name) {
|
|
33097
33386
|
const base = pathSegment(requireBase(this), "--base");
|
|
33098
|
-
const
|
|
33387
|
+
const client2 = await createDataClient();
|
|
33099
33388
|
printOutput(
|
|
33100
|
-
await
|
|
33389
|
+
await client2.request("POST", `/v1/${base}/seeds/${pathSegment(name, "fixture name")}/apply`),
|
|
33101
33390
|
outputFormat(this)
|
|
33102
33391
|
);
|
|
33103
33392
|
});
|
|
@@ -33105,29 +33394,29 @@ function buildSeedCommand() {
|
|
|
33105
33394
|
"Restore the declared baseline: re-apply in place (fixing trigger-mutated records) and prune owned rows the fixture no longer declares. Record types listed in exclusive_record_types are treated as authoritative \u2014 reset also removes their non-declared records (agent-created residue) and any relationships referencing them. Preview-only."
|
|
33106
33395
|
).action(async function(name) {
|
|
33107
33396
|
const base = pathSegment(requireBase(this), "--base");
|
|
33108
|
-
const
|
|
33397
|
+
const client2 = await createDataClient();
|
|
33109
33398
|
printOutput(
|
|
33110
|
-
await
|
|
33399
|
+
await client2.request("POST", `/v1/${base}/seeds/${pathSegment(name, "fixture name")}/reset`),
|
|
33111
33400
|
outputFormat(this)
|
|
33112
33401
|
);
|
|
33113
33402
|
});
|
|
33114
33403
|
seed.command("clear <name>").description("Delete every row the fixture owns (teardown). Preview-only.").action(async function(name) {
|
|
33115
33404
|
const base = pathSegment(requireBase(this), "--base");
|
|
33116
|
-
const
|
|
33405
|
+
const client2 = await createDataClient();
|
|
33117
33406
|
printOutput(
|
|
33118
|
-
await
|
|
33407
|
+
await client2.request("POST", `/v1/${base}/seeds/${pathSegment(name, "fixture name")}/clear`),
|
|
33119
33408
|
outputFormat(this)
|
|
33120
33409
|
);
|
|
33121
33410
|
});
|
|
33122
33411
|
seed.command("list").description("List the seed fixtures defined on a base").action(async function() {
|
|
33123
33412
|
const base = pathSegment(requireBase(this), "--base");
|
|
33124
|
-
const
|
|
33125
|
-
printOutput(await
|
|
33413
|
+
const client2 = await createDataClient();
|
|
33414
|
+
printOutput(await client2.request("GET", `/v1/${base}/seeds`), outputFormat(this));
|
|
33126
33415
|
});
|
|
33127
33416
|
seed.command("get <name>").description("Show a seed fixture definition (its declared records and relationships)").action(async function(name) {
|
|
33128
33417
|
const base = pathSegment(requireBase(this), "--base");
|
|
33129
|
-
const
|
|
33130
|
-
printOutput(await
|
|
33418
|
+
const client2 = await createDataClient();
|
|
33419
|
+
printOutput(await client2.request("GET", `/v1/${base}/seeds/${pathSegment(name, "fixture name")}`), outputFormat(this));
|
|
33131
33420
|
});
|
|
33132
33421
|
const lease = seed.command("lease").description("Coordinate an isolated fixture lease");
|
|
33133
33422
|
lease.command("acquire <fixture>").description("Reset a fixture and atomically acquire the preview base for one eval run").requiredOption("--lease-id <uuidv7>", "Client-generated UUIDv7 (permanently single-use)").requiredOption(
|
|
@@ -33135,9 +33424,9 @@ function buildSeedCommand() {
|
|
|
33135
33424
|
"Safe ID: 1-200 letters/digits or ._:@/+~=- (descriptive only)"
|
|
33136
33425
|
).action(async function(fixture, opts) {
|
|
33137
33426
|
const base = pathSegment(requireBase(this), "--base");
|
|
33138
|
-
const
|
|
33427
|
+
const client2 = await createDataClient();
|
|
33139
33428
|
printOutput(
|
|
33140
|
-
await
|
|
33429
|
+
await client2.request("POST", `/v1/${base}/seed-leases/acquire`, {
|
|
33141
33430
|
lease_id: opts.leaseId,
|
|
33142
33431
|
fixture,
|
|
33143
33432
|
owner_ref: opts.ownerRef
|
|
@@ -33147,20 +33436,20 @@ function buildSeedCommand() {
|
|
|
33147
33436
|
});
|
|
33148
33437
|
lease.command("status").description("Inspect your lease, or learn only whether another actor has locked the base").option("--lease-id <uuidv7>", "Inspect a specific lease ID").action(async function(opts) {
|
|
33149
33438
|
const base = pathSegment(requireBase(this), "--base");
|
|
33150
|
-
const
|
|
33439
|
+
const client2 = await createDataClient();
|
|
33151
33440
|
const params = new URLSearchParams();
|
|
33152
33441
|
if (opts.leaseId !== void 0) params.set("lease_id", opts.leaseId);
|
|
33153
33442
|
const query = params.size > 0 ? `?${params.toString()}` : "";
|
|
33154
33443
|
printOutput(
|
|
33155
|
-
await
|
|
33444
|
+
await client2.request("GET", `/v1/${base}/seed-leases/status${query}`),
|
|
33156
33445
|
outputFormat(this)
|
|
33157
33446
|
);
|
|
33158
33447
|
});
|
|
33159
33448
|
lease.command("release <fixture>").description("Clear fixture-owned data and release the matching lease").requiredOption("--lease-id <uuidv7>", "The UUIDv7 used to acquire the lease").requiredOption("--owner-ref <ref>", "Same safe ID: 1-200 letters/digits or ._:@/+~=-").action(async function(fixture, opts) {
|
|
33160
33449
|
const base = pathSegment(requireBase(this), "--base");
|
|
33161
|
-
const
|
|
33450
|
+
const client2 = await createDataClient();
|
|
33162
33451
|
printOutput(
|
|
33163
|
-
await
|
|
33452
|
+
await client2.request("POST", `/v1/${base}/seed-leases/release`, {
|
|
33164
33453
|
lease_id: opts.leaseId,
|
|
33165
33454
|
fixture,
|
|
33166
33455
|
owner_ref: opts.ownerRef
|
|
@@ -33239,11 +33528,11 @@ function buildToolsetsCommand() {
|
|
|
33239
33528
|
if (opts.sqlQuery) body.sql_query = true;
|
|
33240
33529
|
}
|
|
33241
33530
|
const base = pathSegment(requireBase(this), "--base");
|
|
33242
|
-
const
|
|
33531
|
+
const client2 = await createDataClient();
|
|
33243
33532
|
const format = outputFormat(this);
|
|
33244
|
-
printOutput(await
|
|
33533
|
+
printOutput(await client2.request("PUT", `/v1/${base}/toolsets/${pathSegment(slug, "toolset slug")}`, body), format);
|
|
33245
33534
|
if (opts.mintToken) {
|
|
33246
|
-
const tokenData = await
|
|
33535
|
+
const tokenData = await client2.request("POST", "/v1/tokens", {
|
|
33247
33536
|
name: `${slug} consumer`,
|
|
33248
33537
|
toolset_binding: { base_id: base, toolset_id: slug }
|
|
33249
33538
|
});
|
|
@@ -33258,14 +33547,14 @@ function buildToolsetsCommand() {
|
|
|
33258
33547
|
});
|
|
33259
33548
|
toolsets.command("get <slug>").description("Get a toolset").option("--resolved", "Include resolved record_type schemas").action(async function(slug, opts) {
|
|
33260
33549
|
const base = pathSegment(requireBase(this), "--base");
|
|
33261
|
-
const
|
|
33550
|
+
const client2 = await createDataClient();
|
|
33262
33551
|
const path36 = opts.resolved ? `/v1/${base}/toolsets/${pathSegment(slug, "toolset slug")}/resolved` : `/v1/${base}/toolsets/${pathSegment(slug, "toolset slug")}`;
|
|
33263
|
-
printOutput(await
|
|
33552
|
+
printOutput(await client2.request("GET", path36), outputFormat(this));
|
|
33264
33553
|
});
|
|
33265
33554
|
toolsets.command("list").description("List all toolsets").action(async function() {
|
|
33266
33555
|
const base = pathSegment(requireBase(this), "--base");
|
|
33267
|
-
const
|
|
33268
|
-
printOutput(await
|
|
33556
|
+
const client2 = await createDataClient();
|
|
33557
|
+
printOutput(await client2.request("GET", `/v1/${base}/toolsets`), outputFormat(this));
|
|
33269
33558
|
});
|
|
33270
33559
|
toolsets.command("delete <slug>").description("Delete a toolset").option("-y, --yes", "Skip confirmation prompt").action(async function(slug, opts) {
|
|
33271
33560
|
if (!opts.yes && !await confirm(`Delete toolset "${slug}"? This cannot be undone.`)) {
|
|
@@ -33273,8 +33562,8 @@ function buildToolsetsCommand() {
|
|
|
33273
33562
|
return;
|
|
33274
33563
|
}
|
|
33275
33564
|
const base = pathSegment(requireBase(this), "--base");
|
|
33276
|
-
const
|
|
33277
|
-
await
|
|
33565
|
+
const client2 = await createDataClient();
|
|
33566
|
+
await client2.request("DELETE", `/v1/${base}/toolsets/${pathSegment(slug, "toolset slug")}`);
|
|
33278
33567
|
console.log("Deleted");
|
|
33279
33568
|
});
|
|
33280
33569
|
toolsets.command("url <slug>").description("Get the MCP connection URL for a toolset").action((slug) => {
|
|
@@ -33339,32 +33628,32 @@ function buildTriggersCommand() {
|
|
|
33339
33628
|
body.skip_cascade_writes = opts.skipCascadeWrites !== "false";
|
|
33340
33629
|
}
|
|
33341
33630
|
const base = pathSegment(requireBase(this), "--base");
|
|
33342
|
-
const
|
|
33631
|
+
const client2 = await createDataClient();
|
|
33343
33632
|
const triggerId = opts.id ?? randomUUID3();
|
|
33344
33633
|
printOutput(
|
|
33345
|
-
await
|
|
33634
|
+
await client2.request("PUT", `/v1/${base}/triggers/${pathSegment(triggerId, "--id")}`, body),
|
|
33346
33635
|
outputFormat(this)
|
|
33347
33636
|
);
|
|
33348
33637
|
});
|
|
33349
33638
|
triggers.command("get <id>").description("Get a trigger").action(async function(id) {
|
|
33350
33639
|
const base = pathSegment(requireBase(this), "--base");
|
|
33351
|
-
const
|
|
33352
|
-
printOutput(await
|
|
33640
|
+
const client2 = await createDataClient();
|
|
33641
|
+
printOutput(await client2.request("GET", `/v1/${base}/triggers/${pathSegment(id, "trigger id")}`), outputFormat(this));
|
|
33353
33642
|
});
|
|
33354
33643
|
triggers.command("list").description("List all triggers").action(async function() {
|
|
33355
33644
|
const base = pathSegment(requireBase(this), "--base");
|
|
33356
|
-
const
|
|
33357
|
-
printOutput(await
|
|
33645
|
+
const client2 = await createDataClient();
|
|
33646
|
+
printOutput(await client2.request("GET", `/v1/${base}/triggers`), outputFormat(this));
|
|
33358
33647
|
});
|
|
33359
33648
|
triggers.command("deliveries").description("List trigger delivery attempts (status, retries, errors)").option("--status <status>", "Filter by status (pending | delivered | failed | dead)").option("--trigger-id <id>", "Filter by trigger id").action(async function(opts) {
|
|
33360
33649
|
const base = pathSegment(requireBase(this), "--base");
|
|
33361
|
-
const
|
|
33650
|
+
const client2 = await createDataClient();
|
|
33362
33651
|
const params = new URLSearchParams();
|
|
33363
33652
|
if (opts.status) params.set("status", opts.status);
|
|
33364
33653
|
if (opts.triggerId) params.set("trigger_id", opts.triggerId);
|
|
33365
33654
|
const qs = params.toString();
|
|
33366
33655
|
printOutput(
|
|
33367
|
-
await
|
|
33656
|
+
await client2.request("GET", `/v1/${base}/triggers/deliveries${qs ? `?${qs}` : ""}`),
|
|
33368
33657
|
outputFormat(this)
|
|
33369
33658
|
);
|
|
33370
33659
|
});
|
|
@@ -33374,8 +33663,8 @@ function buildTriggersCommand() {
|
|
|
33374
33663
|
return;
|
|
33375
33664
|
}
|
|
33376
33665
|
const base = pathSegment(requireBase(this), "--base");
|
|
33377
|
-
const
|
|
33378
|
-
await
|
|
33666
|
+
const client2 = await createDataClient();
|
|
33667
|
+
await client2.request("DELETE", `/v1/${base}/triggers/${pathSegment(id, "trigger id")}`);
|
|
33379
33668
|
console.log("Deleted");
|
|
33380
33669
|
});
|
|
33381
33670
|
return triggers;
|
|
@@ -33556,8 +33845,8 @@ async function fetchAndCacheAdminSkillVersion() {
|
|
|
33556
33845
|
const config = readConfig2();
|
|
33557
33846
|
if (!config) return;
|
|
33558
33847
|
const accessToken = await getAccessToken2(config);
|
|
33559
|
-
const
|
|
33560
|
-
const res = await
|
|
33848
|
+
const client2 = new ApiClient2({ apiUrl: config.api_url, accessToken });
|
|
33849
|
+
const res = await client2.adminSkillInstall(ADMIN_SKILL_NAME);
|
|
33561
33850
|
const latest = parseFrontmatterVersion(res.files[SKILL_FILENAME] ?? "");
|
|
33562
33851
|
if (latest) {
|
|
33563
33852
|
try {
|
|
@@ -33830,6 +34119,11 @@ async function main() {
|
|
|
33830
34119
|
await listCommand2(args);
|
|
33831
34120
|
break;
|
|
33832
34121
|
}
|
|
34122
|
+
case "communities": {
|
|
34123
|
+
const { communitiesCommand: communitiesCommand2 } = await Promise.resolve().then(() => (init_communities(), communities_exports));
|
|
34124
|
+
await communitiesCommand2(args);
|
|
34125
|
+
break;
|
|
34126
|
+
}
|
|
33833
34127
|
case "admin": {
|
|
33834
34128
|
const { adminCommand: adminCommand2 } = await Promise.resolve().then(() => (init_admin(), admin_exports));
|
|
33835
34129
|
await adminCommand2(args);
|
|
@@ -33918,6 +34212,7 @@ Commands:
|
|
|
33918
34212
|
sync-skills Sync skills to Anthropic/OpenAI provider connections
|
|
33919
34213
|
sync-mcp Re-discover an MCP connection's tools (refresh stale schemas)
|
|
33920
34214
|
list List organizations and hubs
|
|
34215
|
+
communities An organization's communities: list, join link (get/rotate/off), stats \u2014 \`wayai communities --help\`
|
|
33921
34216
|
report create Report a platform bug (submits to the triage queue)
|
|
33922
34217
|
report edit Amend your own pending report (title/description/error/steps/context)
|
|
33923
34218
|
update Update CLI to the latest version
|