@wayai/cli 0.3.286 → 0.3.288

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6273,7 +6273,7 @@ var init_chunk_5FO3GNKP = __esm({
6273
6273
  }
6274
6274
  });
6275
6275
 
6276
- // ../../packages/core/dist/chunk-JSLX2PRT.js
6276
+ // ../../packages/core/dist/chunk-WWLNKL2W.js
6277
6277
  function matchPath(pattern, path45) {
6278
6278
  const pathSegments2 = path45.replace(/\/$/, "").split("/");
6279
6279
  const isPrefix = pattern.endsWith("/*");
@@ -6302,8 +6302,8 @@ function getEndpointConfig(path45) {
6302
6302
  return { tier: "STANDARD" };
6303
6303
  }
6304
6304
  var ENDPOINT_CONFIGS, EXCLUDED_PATHS;
6305
- var init_chunk_JSLX2PRT = __esm({
6306
- "../../packages/core/dist/chunk-JSLX2PRT.js"() {
6305
+ var init_chunk_WWLNKL2W = __esm({
6306
+ "../../packages/core/dist/chunk-WWLNKL2W.js"() {
6307
6307
  "use strict";
6308
6308
  init_chunk_5FO3GNKP();
6309
6309
  ENDPOINT_CONFIGS = {
@@ -6629,6 +6629,9 @@ var init_chunk_JSLX2PRT = __esm({
6629
6629
  // takes the same strict, fail-closed budget as the other hub repairs. Exact path, for the same reason.
6630
6630
  "/api/admin/hubs/repair-knowledge-blobs": { tier: "STRICT", userLimit: 10, userWindow: 3600, failClosed: true },
6631
6631
  "/api/admin/hubs/repair-credential-links": { tier: "STRICT", userLimit: 10, userWindow: 3600, failClosed: true },
6632
+ // The credentials-vault importer (wayai#5644 D2-M6) decrypts and moves an org's credentials, or puts them back:
6633
+ // strict and fail-closed like the hub repairs, with room for the re-runs a bounded run takes (`max_puts`).
6634
+ "/api/admin/vault-import/*": { tier: "STRICT", userLimit: 60, userWindow: 3600, failClosed: true, userLimitKey: "/api/admin/vault-import/*" },
6632
6635
  // CI/GitOps endpoints - standard with user limits. 500 because `wayai push` makes four requests
6633
6636
  // (pull, diff, push, pull) and a GitOps job may push every hub at once with one token; when
6634
6637
  // each path held its own 100, that ran to 100 hubs a minute.
@@ -6785,7 +6788,7 @@ var init_chunk_JSLX2PRT = __esm({
6785
6788
  }
6786
6789
  });
6787
6790
 
6788
- // ../../packages/core/dist/chunk-YFHL2BKN.js
6791
+ // ../../packages/core/dist/chunk-LQ37IULI.js
6789
6792
  function fileSnapshotChanged(run) {
6790
6793
  return run.written + run.removed > 0;
6791
6794
  }
@@ -6826,10 +6829,10 @@ async function sendWithRetry(opts, cursor) {
6826
6829
  }
6827
6830
  }
6828
6831
  var rekorFileSnapshotAnswerSchema, FILE_SNAPSHOT_MAX_PAGES, FILE_SNAPSHOT_CONFLICT_ATTEMPTS, FILE_SNAPSHOT_PAGE_SPACING_MS, FILE_SNAPSHOT_CONFLICT_STATUS;
6829
- var init_chunk_YFHL2BKN = __esm({
6830
- "../../packages/core/dist/chunk-YFHL2BKN.js"() {
6832
+ var init_chunk_LQ37IULI = __esm({
6833
+ "../../packages/core/dist/chunk-LQ37IULI.js"() {
6831
6834
  "use strict";
6832
- init_chunk_JSLX2PRT();
6835
+ init_chunk_WWLNKL2W();
6833
6836
  init_chunk_5FO3GNKP();
6834
6837
  init_zod();
6835
6838
  rekorFileSnapshotAnswerSchema = external_exports.object({
@@ -12614,7 +12617,7 @@ var init_chunk_BPCNB5RT = __esm({
12614
12617
  }
12615
12618
  });
12616
12619
 
12617
- // ../../packages/core/dist/chunk-YWCYUPJV.js
12620
+ // ../../packages/core/dist/chunk-YI3ORIXJ.js
12618
12621
  function toolParametersViolations(params) {
12619
12622
  try {
12620
12623
  if (containsKanbanPlaceholders(params)) return [];
@@ -12638,28 +12641,30 @@ function toolConfigDescription(config) {
12638
12641
  function offeredToolDescription(config, toolDescription) {
12639
12642
  return toolConfigDescription(config) ?? nonBlank(toolDescription);
12640
12643
  }
12641
- function refineToolConfig(value, ctx) {
12642
- const raw = value.tool_config;
12643
- if (raw == null) return;
12644
- const params = extractToolParameters(raw);
12645
- if (params === void 0) {
12646
- const looksLikeObject = raw !== null && typeof raw === "object" && !Array.isArray(raw) || typeof raw === "string" && (() => {
12647
- try {
12648
- const parsed = JSON.parse(raw);
12649
- return parsed !== null && typeof parsed === "object" && !Array.isArray(parsed);
12650
- } catch {
12651
- return false;
12652
- }
12653
- })();
12654
- if (!looksLikeObject) {
12655
- ctx.addIssue({
12656
- code: external_exports.ZodIssueCode.custom,
12657
- path: ["tool_config"],
12658
- message: "tool_config must be an object"
12659
- });
12644
+ function customToolConfigObject(config) {
12645
+ let read = config;
12646
+ for (let layer = 0; layer < MAX_CUSTOM_TOOL_CONFIG_TEXT_LAYERS && typeof read === "string"; layer++) {
12647
+ try {
12648
+ read = JSON.parse(read);
12649
+ } catch {
12650
+ return read;
12660
12651
  }
12652
+ }
12653
+ return read;
12654
+ }
12655
+ function refineToolConfig(value, ctx) {
12656
+ if (value.tool_config == null) return;
12657
+ const config = customToolConfigObject(value.tool_config);
12658
+ if (config === null || typeof config !== "object" || Array.isArray(config)) {
12659
+ ctx.addIssue({
12660
+ code: external_exports.ZodIssueCode.custom,
12661
+ path: ["tool_config"],
12662
+ message: "tool_config must be an object"
12663
+ });
12661
12664
  return;
12662
12665
  }
12666
+ const params = extractToolParameters(config);
12667
+ if (params === void 0) return;
12663
12668
  for (const err of toolParametersViolations(params)) {
12664
12669
  ctx.addIssue({
12665
12670
  code: external_exports.ZodIssueCode.custom,
@@ -12668,9 +12673,9 @@ function refineToolConfig(value, ctx) {
12668
12673
  });
12669
12674
  }
12670
12675
  }
12671
- var nonBlank, DEFAULT_TOOL_CONFIG_DESCRIPTION, toolIdParam, listToolsQuery, toolAgentQuery, deleteToolQuery, toolConnectionsQuery, nativeToolIdSchema, CONTEXT_BOUNDARIES, contextBoundarySchema, addNativeToolBody, addMcpToolBody, toolReplaySettingsFields, toolReplaySettingsSchema, createCustomToolBody, updateCustomToolBody, updateToolExecutionConfigBody;
12672
- var init_chunk_YWCYUPJV = __esm({
12673
- "../../packages/core/dist/chunk-YWCYUPJV.js"() {
12676
+ var nonBlank, DEFAULT_TOOL_CONFIG_DESCRIPTION, MAX_CUSTOM_TOOL_CONFIG_TEXT_LAYERS, toolIdParam, listToolsQuery, toolAgentQuery, deleteToolQuery, toolConnectionsQuery, nativeToolIdSchema, CONTEXT_BOUNDARIES, contextBoundarySchema, addNativeToolBody, addMcpToolBody, toolReplaySettingsFields, toolReplaySettingsSchema, createCustomToolBody, updateCustomToolBody, updateToolExecutionConfigBody;
12677
+ var init_chunk_YI3ORIXJ = __esm({
12678
+ "../../packages/core/dist/chunk-YI3ORIXJ.js"() {
12674
12679
  "use strict";
12675
12680
  init_chunk_WEXVYJ5H();
12676
12681
  init_chunk_HZ6CADSY();
@@ -12678,6 +12683,7 @@ var init_chunk_YWCYUPJV = __esm({
12678
12683
  init_zod();
12679
12684
  nonBlank = (text4) => typeof text4 === "string" && text4.trim() !== "" ? text4 : void 0;
12680
12685
  DEFAULT_TOOL_CONFIG_DESCRIPTION = "Function description";
12686
+ MAX_CUSTOM_TOOL_CONFIG_TEXT_LAYERS = 16;
12681
12687
  toolIdParam = external_exports.object({ id: uuidSchema });
12682
12688
  listToolsQuery = external_exports.object({ agent_id: uuidSchema, hub_id: uuidSchema });
12683
12689
  toolAgentQuery = external_exports.object({ agent_id: uuidSchema, hub_id: uuidSchema });
@@ -13329,57 +13335,6 @@ var init_chunk_LBDH7LCG = __esm({
13329
13335
  }
13330
13336
  });
13331
13337
 
13332
- // ../../packages/core/dist/chunk-D3EP4TDU.js
13333
- var primaryRegionSchema, placementSourceSchema, orgIdParam, orgAdminIdParam, createOrganizationBody, updateOrganizationBody, addOrgAdminBody;
13334
- var init_chunk_D3EP4TDU = __esm({
13335
- "../../packages/core/dist/chunk-D3EP4TDU.js"() {
13336
- "use strict";
13337
- init_chunk_HZ6CADSY();
13338
- init_zod();
13339
- primaryRegionSchema = external_exports.enum([
13340
- "wnam",
13341
- "enam",
13342
- "sam",
13343
- "weur",
13344
- "eeur",
13345
- "apac",
13346
- "oc",
13347
- "afr",
13348
- "me"
13349
- ]);
13350
- placementSourceSchema = external_exports.enum([
13351
- "hub_config",
13352
- "org_config",
13353
- "parent_cascade",
13354
- "cf_colo",
13355
- "country",
13356
- "fallback",
13357
- "unpinned"
13358
- ]);
13359
- orgIdParam = external_exports.object({
13360
- id: uuidSchema
13361
- });
13362
- orgAdminIdParam = external_exports.object({
13363
- id: uuidSchema,
13364
- adminId: external_exports.string().min(1)
13365
- });
13366
- createOrganizationBody = external_exports.object({
13367
- organization_name: external_exports.string().min(1, "organization_name is required"),
13368
- // Write-once at creation; updateOrganizationBody does not accept this.
13369
- primary_region: primaryRegionSchema.optional()
13370
- });
13371
- updateOrganizationBody = external_exports.object({
13372
- organization_name: external_exports.string().min(1).optional(),
13373
- organization_avatar_url: external_exports.string().url().nullable().optional(),
13374
- timezone: external_exports.string().optional(),
13375
- business_hours: external_exports.unknown().optional()
13376
- }).passthrough();
13377
- addOrgAdminBody = external_exports.object({
13378
- user_email: external_exports.string().email("valid email is required")
13379
- });
13380
- }
13381
- });
13382
-
13383
13338
  // ../../packages/core/dist/chunk-X5PZZVTS.js
13384
13339
  function isEventRelativeFollowupType(type) {
13385
13340
  return typeof type === "string" && EVENT_RELATIVE_FOLLOWUP_TYPES.includes(type);
@@ -13778,6 +13733,57 @@ var init_chunk_X5PZZVTS = __esm({
13778
13733
  }
13779
13734
  });
13780
13735
 
13736
+ // ../../packages/core/dist/chunk-D3EP4TDU.js
13737
+ var primaryRegionSchema, placementSourceSchema, orgIdParam, orgAdminIdParam, createOrganizationBody, updateOrganizationBody, addOrgAdminBody;
13738
+ var init_chunk_D3EP4TDU = __esm({
13739
+ "../../packages/core/dist/chunk-D3EP4TDU.js"() {
13740
+ "use strict";
13741
+ init_chunk_HZ6CADSY();
13742
+ init_zod();
13743
+ primaryRegionSchema = external_exports.enum([
13744
+ "wnam",
13745
+ "enam",
13746
+ "sam",
13747
+ "weur",
13748
+ "eeur",
13749
+ "apac",
13750
+ "oc",
13751
+ "afr",
13752
+ "me"
13753
+ ]);
13754
+ placementSourceSchema = external_exports.enum([
13755
+ "hub_config",
13756
+ "org_config",
13757
+ "parent_cascade",
13758
+ "cf_colo",
13759
+ "country",
13760
+ "fallback",
13761
+ "unpinned"
13762
+ ]);
13763
+ orgIdParam = external_exports.object({
13764
+ id: uuidSchema
13765
+ });
13766
+ orgAdminIdParam = external_exports.object({
13767
+ id: uuidSchema,
13768
+ adminId: external_exports.string().min(1)
13769
+ });
13770
+ createOrganizationBody = external_exports.object({
13771
+ organization_name: external_exports.string().min(1, "organization_name is required"),
13772
+ // Write-once at creation; updateOrganizationBody does not accept this.
13773
+ primary_region: primaryRegionSchema.optional()
13774
+ });
13775
+ updateOrganizationBody = external_exports.object({
13776
+ organization_name: external_exports.string().min(1).optional(),
13777
+ organization_avatar_url: external_exports.string().url().nullable().optional(),
13778
+ timezone: external_exports.string().optional(),
13779
+ business_hours: external_exports.unknown().optional()
13780
+ }).passthrough();
13781
+ addOrgAdminBody = external_exports.object({
13782
+ user_email: external_exports.string().email("valid email is required")
13783
+ });
13784
+ }
13785
+ });
13786
+
13781
13787
  // ../../packages/core/dist/chunk-K5UAZWFF.js
13782
13788
  function byLocale(entry) {
13783
13789
  const shape = Object.fromEntries(SUPPORTED_LOCALES.map((locale) => [locale, entry.optional()]));
@@ -13816,7 +13822,7 @@ var init_chunk_K5UAZWFF = __esm({
13816
13822
  }
13817
13823
  });
13818
13824
 
13819
- // ../../packages/core/dist/chunk-7NQZRSSJ.js
13825
+ // ../../packages/core/dist/chunk-MO23HUAX.js
13820
13826
  function refineLaneReferences(val, ctx) {
13821
13827
  const lanes = val.lanes;
13822
13828
  const statuses = val.kanban_statuses;
@@ -13840,11 +13846,11 @@ function describeSyncWarning(warning) {
13840
13846
  return `${label2}: ${parts.join("; ")}. Promote the base so production's tools match the preview's.`;
13841
13847
  }
13842
13848
  var hubIdParam, hubAdminIdParam, hubUserIdParam, hubAgentIdParam, hubIdentityIdParam, hubTeamIdParam, hubTeamUserDeleteParam, hubSchemaQuery, HUB_USERS_PAGE_SIZE_MAX, HUB_USERS_SEARCH_MAX, HUB_USERS_CHANNEL_TYPES, getHubUsersQuery, PREVIEW_LABEL_MAX_LENGTH, MAX_ENDED_INDEX_RETENTION_DAYS, MAX_EVAL_RETENTION_DAYS, MAX_END_USER_DAILY_MESSAGE_LIMIT, endUserDailyMessageLimitField, previewLabelField, hubTagsField, createHubBody, updateHubBody, HUB_TAG_CHANGE_REFUSED, hubTagChangeRefusalSchema, addHubAdminBody, addHubIdentityAuthorizationBody, contactDecisionBody, approveContactBody, CONTACT_ACCESS_PAGE_SIZE_MAX, listContactAccessQuery, createHubTeamBody, updateHubTeamBody, addHubTeamUserBody, reassignHubUserBody, replicatePreviewBody, HUB_DIFF_SECTION_SET, HUB_DIFF_SECTIONS, updateChannelTestIdentitiesBody, claimCodeChannelParam, claimCodeDeleteParam;
13843
- var init_chunk_7NQZRSSJ = __esm({
13844
- "../../packages/core/dist/chunk-7NQZRSSJ.js"() {
13849
+ var init_chunk_MO23HUAX = __esm({
13850
+ "../../packages/core/dist/chunk-MO23HUAX.js"() {
13845
13851
  "use strict";
13846
- init_chunk_D3EP4TDU();
13847
13852
  init_chunk_X5PZZVTS();
13853
+ init_chunk_D3EP4TDU();
13848
13854
  init_chunk_K5UAZWFF();
13849
13855
  init_chunk_HZ6CADSY();
13850
13856
  init_zod();
@@ -14040,7 +14046,7 @@ var init_chunk_7NQZRSSJ = __esm({
14040
14046
  }
14041
14047
  });
14042
14048
 
14043
- // ../../packages/core/dist/chunk-VMPEOBYP.js
14049
+ // ../../packages/core/dist/chunk-YN7UXGAP.js
14044
14050
  function declaresNoConnection(agent) {
14045
14051
  return agent.connection === null && !agent.connection_id;
14046
14052
  }
@@ -14053,17 +14059,6 @@ function customToolConnectionRefusal(agentName, tool) {
14053
14059
  if (tool.connection || tool.connection_id) return null;
14054
14060
  return `Agent "${agentName}", tool "${tool.name}": connection is required. A custom tool calls through one of the hub's connections: name it.`;
14055
14061
  }
14056
- function customToolConfigObject(config) {
14057
- let read = config;
14058
- for (let layer = 0; layer < MAX_CUSTOM_TOOL_CONFIG_TEXT_LAYERS && typeof read === "string"; layer++) {
14059
- try {
14060
- read = JSON.parse(read);
14061
- } catch {
14062
- return read;
14063
- }
14064
- }
14065
- return read;
14066
- }
14067
14062
  function customToolDescriptionAfterPush(entry, row, writtenConfig) {
14068
14063
  const written = row ? writtenConfig : entry.config;
14069
14064
  const stated = toolConfigDescription(written);
@@ -14782,16 +14777,16 @@ function skillSectionsAsResources(scope) {
14782
14777
  return out;
14783
14778
  };
14784
14779
  }
14785
- var MAX_10MB_BASE64_ENCODED_BYTES, MAX_EVAL_ATTACHMENT_ENCODED_BYTES, MAX_EVAL_ATTACHMENT_CARRIERS, MAX_EVAL_ATTACHMENT_AGGREGATE_ENCODED_BYTES, MAX_RESOURCE_ENCODED_BYTES, MAX_HUB_AS_CODE_RESOURCES, MAX_HUB_AS_CODE_RESOURCE_FILES, MAX_RESOURCE_AGGREGATE_ENCODED_BYTES, MAX_CI_CONFIG_BODY_BYTES, MAX_HUB_AS_CODE_PAGE_MANIFEST_CHARS, hubAsCodePagesSchema, MAX_CUSTOM_TOOL_CONFIG_TEXT_LAYERS, MAX_CALL_OPENING_CARRIERS, MAX_CALL_OPENING_AGGREGATE_ENCODED_BYTES, HUB_AS_CODE_AGENT_TOOL_KEYS, hubAsCodeStateSchema, hubAsCodeResourceFileSchema, hubAsCodeResourceSchema, uuidPattern, ciUuidSchema, flagEntriesOf, boundedHubAsCodeResourcesSchema, isPlainObject, MIN_SKILLS_LAYOUT_CLI, MAX_HUB_AS_CODE_DEPTH, NAMED_DEPTH_SEGMENTS, NAMED_DEPTH_KEY_CHARS, fieldName, hubAsCodeConfigSchema, ciPullHubIdParam, ciBranchParam, ciPullQuery, ciHubsQuery, ciLookupQuery, ciBranchesQuery, ciSyncBody, ciPushBody, ciDiffBody, ciPublishBody, ciPublishPreviewBody, ciSyncMcpBody, ciOrgResourcesParam, orgResourcesConfigSchema, ciOrgResourcesPushBody, ciOrgResourcesDiffBody, CI_APPLY_ENTITY_KINDS, CI_APPLY_OPERATIONS, ciApplyErrorBaseSchema, ciApplyErrorSchema, ciSyncCountSchema, ciSyncChangesSchema, ciSyncWarningSchema, ciSyncResponseSchema;
14786
- var init_chunk_VMPEOBYP = __esm({
14787
- "../../packages/core/dist/chunk-VMPEOBYP.js"() {
14780
+ var MAX_10MB_BASE64_ENCODED_BYTES, MAX_EVAL_ATTACHMENT_ENCODED_BYTES, MAX_EVAL_ATTACHMENT_CARRIERS, MAX_EVAL_ATTACHMENT_AGGREGATE_ENCODED_BYTES, MAX_RESOURCE_ENCODED_BYTES, MAX_HUB_AS_CODE_RESOURCES, MAX_HUB_AS_CODE_RESOURCE_FILES, MAX_RESOURCE_AGGREGATE_ENCODED_BYTES, MAX_CI_CONFIG_BODY_BYTES, MAX_HUB_AS_CODE_PAGE_MANIFEST_CHARS, hubAsCodePagesSchema, MAX_CALL_OPENING_CARRIERS, MAX_CALL_OPENING_AGGREGATE_ENCODED_BYTES, HUB_AS_CODE_AGENT_TOOL_KEYS, hubAsCodeStateSchema, hubAsCodeResourceFileSchema, hubAsCodeResourceSchema, uuidPattern, ciUuidSchema, flagEntriesOf, boundedHubAsCodeResourcesSchema, isPlainObject, MIN_SKILLS_LAYOUT_CLI, MAX_HUB_AS_CODE_DEPTH, NAMED_DEPTH_SEGMENTS, NAMED_DEPTH_KEY_CHARS, fieldName, hubAsCodeConfigSchema, ciPullHubIdParam, ciBranchParam, ciPullQuery, ciHubsQuery, ciLookupQuery, ciBranchesQuery, ciSyncBody, ciPushBody, ciDiffBody, ciPublishBody, ciPublishPreviewBody, ciSyncMcpBody, ciOrgResourcesParam, orgResourcesConfigSchema, ciOrgResourcesPushBody, ciOrgResourcesDiffBody, CI_APPLY_ENTITY_KINDS, CI_APPLY_OPERATIONS, ciApplyErrorBaseSchema, ciApplyErrorSchema, ciSyncCountSchema, ciSyncChangesSchema, ciSyncWarningSchema, ciSyncResponseSchema;
14781
+ var init_chunk_YN7UXGAP = __esm({
14782
+ "../../packages/core/dist/chunk-YN7UXGAP.js"() {
14788
14783
  "use strict";
14789
- init_chunk_YWCYUPJV();
14784
+ init_chunk_YI3ORIXJ();
14790
14785
  init_chunk_HRKVCI5A();
14791
14786
  init_chunk_CZEJR5UE();
14792
14787
  init_chunk_LBDH7LCG();
14793
14788
  init_chunk_4LXDRTO4();
14794
- init_chunk_7NQZRSSJ();
14789
+ init_chunk_MO23HUAX();
14795
14790
  init_chunk_X5PZZVTS();
14796
14791
  init_chunk_K5UAZWFF();
14797
14792
  init_chunk_OAWG66J3();
@@ -14821,7 +14816,6 @@ var init_chunk_VMPEOBYP = __esm({
14821
14816
  }),
14822
14817
  html: external_exports.string().max(PAGE_HTML_MAX_BYTES, `a page's HTML is at most ${PAGE_HTML_MAX_BYTES / 1024} KiB`)
14823
14818
  }).strict()).max(PAGES_PER_HUB_MAX, `a hub holds at most ${PAGES_PER_HUB_MAX} pages`);
14824
- MAX_CUSTOM_TOOL_CONFIG_TEXT_LAYERS = 16;
14825
14819
  MAX_CALL_OPENING_CARRIERS = 30;
14826
14820
  MAX_CALL_OPENING_AGGREGATE_ENCODED_BYTES = 8 * 1024 * 1024;
14827
14821
  HUB_AS_CODE_AGENT_TOOL_KEYS = [
@@ -15168,10 +15162,10 @@ var init_chunk_BFG4ZWR4 = __esm({
15168
15162
  }
15169
15163
  });
15170
15164
 
15171
- // ../../packages/core/dist/chunk-4J5DPB3X.js
15165
+ // ../../packages/core/dist/chunk-HNVURBF4.js
15172
15166
  var dataExplorerDebugDoType, DEBUG_READ_MAX_LIMIT, DEBUG_READ_DEFAULT_LIMIT;
15173
- var init_chunk_4J5DPB3X = __esm({
15174
- "../../packages/core/dist/chunk-4J5DPB3X.js"() {
15167
+ var init_chunk_HNVURBF4 = __esm({
15168
+ "../../packages/core/dist/chunk-HNVURBF4.js"() {
15175
15169
  "use strict";
15176
15170
  init_zod();
15177
15171
  dataExplorerDebugDoType = external_exports.enum(["hub", "org", "conversation", "user", "platform", "thread", "community", "contact_book", "batch"]);
@@ -15282,7 +15276,7 @@ var init_chunk_OMPT4ZHR = __esm({
15282
15276
  }
15283
15277
  });
15284
15278
 
15285
- // ../../packages/core/dist/chunk-2IAHI2UA.js
15279
+ // ../../packages/core/dist/chunk-GMCS4EDW.js
15286
15280
  function refineScopedTarget(data, ctx) {
15287
15281
  if (data.scope === "org") {
15288
15282
  if (!data.org_id) {
@@ -15308,13 +15302,13 @@ function refineScopedTarget(data, ctx) {
15308
15302
  }
15309
15303
  }
15310
15304
  var adminOrgIdParam, adminOrgAdminIdParam, adminUserIdParam, PRICING_PLAN_ID_RE, adminPlanIdParam, adminOrganizationsQuery, adminUserSearchQuery, kanbanSlugMigrationQuery, adjustQuotaBody, updatePlanBody, addAdminUserBody, MAX_VOICE_CALL_MINUTE_OPS, voiceCallMinuteOps, AUTOMATION_GATE_EVALUATIONS_PER_OPERATION_BOUND, automationGateEvaluationsPerOperation, AUTOMATION_RUN_RETENTION_DAYS_MAX, automationRunRetentionDays, turnDeadlineSeconds, updatePlatformConfigBody, updateFreeOrgLimitBody, adminScopedTargetShape, adminScopedTargetBody, adminDryRunByDefaultTargetBody, BRANCHING_ORPHAN_ENTITY_TYPES, BRANCHING_ORPHAN_MAX_TARGETS, adminRepairBranchingOrphansBody, adminRepairLegacyOrgGrantsBody, adminRepairCompedPlansBody, updatePricingPlanBody, dataExplorerSearchQuery, dataExplorerOrgIdParam, dataExplorerHubIdParam, dataExplorerConvIdParam, dataExplorerDoInstancesQuery, dataExplorerNsIdParam, dataExplorerKvKeysBody, dataExplorerKvKeyBody, uuidOrHexId, dataExplorerDeleteOrgParam, dataExplorerDeleteHubParam, dataExplorerDeleteConvParam, dataExplorerDeleteUserParam, dataExplorerDeleteQuery, dataExplorerKvDeleteBody, pitrDoNamespace, pitrBookmarkParam, pitrRestoreBody, healthSamplingTriggerBody, DEBUG_DO_HEX_PREFIX, debugDoEntityId, debugTableName, dataExplorerDebugTablesParam, dataExplorerDebugRowsParam, dataExplorerDebugRowsQuery, dataExplorerDebugAnalyticsTable, debugUuid, dataExplorerDebugAnalyticsRowsParam, dataExplorerDebugAnalyticsRowsQuery, dataExplorerDebugCountsDoType, dataExplorerDebugCountsParam, debugHubConvParam, debugMessageIdQuery;
15311
- var init_chunk_2IAHI2UA = __esm({
15312
- "../../packages/core/dist/chunk-2IAHI2UA.js"() {
15305
+ var init_chunk_GMCS4EDW = __esm({
15306
+ "../../packages/core/dist/chunk-GMCS4EDW.js"() {
15313
15307
  "use strict";
15314
15308
  init_chunk_FECLIZTY();
15315
15309
  init_chunk_BFG4ZWR4();
15316
- init_chunk_4J5DPB3X();
15317
- init_chunk_7NQZRSSJ();
15310
+ init_chunk_HNVURBF4();
15311
+ init_chunk_MO23HUAX();
15318
15312
  init_chunk_OMPT4ZHR();
15319
15313
  init_chunk_HZ6CADSY();
15320
15314
  init_chunk_MIWZOSPI();
@@ -16367,7 +16361,7 @@ var init_contracts = __esm({
16367
16361
  init_chunk_5YNUTCJ2();
16368
16362
  init_chunk_ZC6YGHNX();
16369
16363
  init_chunk_5DGHIY7L();
16370
- init_chunk_YFHL2BKN();
16364
+ init_chunk_LQ37IULI();
16371
16365
  init_chunk_IPDOHAZ5();
16372
16366
  init_chunk_GPM7PE44();
16373
16367
  init_chunk_NZ6RQW6R();
@@ -16401,8 +16395,8 @@ var init_contracts = __esm({
16401
16395
  init_chunk_E4DIIOOE();
16402
16396
  init_chunk_7CYHPF35();
16403
16397
  init_chunk_BPCNB5RT();
16404
- init_chunk_VMPEOBYP();
16405
- init_chunk_YWCYUPJV();
16398
+ init_chunk_YN7UXGAP();
16399
+ init_chunk_YI3ORIXJ();
16406
16400
  init_chunk_HRKVCI5A();
16407
16401
  init_chunk_CZEJR5UE();
16408
16402
  init_chunk_4D6K4P4K();
@@ -16411,13 +16405,13 @@ var init_contracts = __esm({
16411
16405
  init_chunk_4LXDRTO4();
16412
16406
  init_chunk_JDJ4EUOL();
16413
16407
  init_chunk_NVKU5PPQ();
16414
- init_chunk_2IAHI2UA();
16408
+ init_chunk_GMCS4EDW();
16415
16409
  init_chunk_FECLIZTY();
16416
16410
  init_chunk_BFG4ZWR4();
16417
- init_chunk_4J5DPB3X();
16418
- init_chunk_7NQZRSSJ();
16419
- init_chunk_D3EP4TDU();
16411
+ init_chunk_HNVURBF4();
16412
+ init_chunk_MO23HUAX();
16420
16413
  init_chunk_X5PZZVTS();
16414
+ init_chunk_D3EP4TDU();
16421
16415
  init_chunk_K5UAZWFF();
16422
16416
  init_chunk_2PZIF56U();
16423
16417
  init_chunk_UEJOG2Q7();
@@ -16428,7 +16422,7 @@ var init_contracts = __esm({
16428
16422
  init_chunk_OAWG66J3();
16429
16423
  init_chunk_IG6QBZMA();
16430
16424
  init_chunk_OMPT4ZHR();
16431
- init_chunk_JSLX2PRT();
16425
+ init_chunk_WWLNKL2W();
16432
16426
  init_chunk_SOJMWM63();
16433
16427
  init_chunk_WTOA3ANF();
16434
16428
  init_chunk_5FO3GNKP();
@@ -16592,7 +16586,7 @@ var UUID_RE2, WAYAI_WORKSPACE_LAYOUT;
16592
16586
  var init_dist = __esm({
16593
16587
  "../../packages/core/dist/index.js"() {
16594
16588
  "use strict";
16595
- init_chunk_JSLX2PRT();
16589
+ init_chunk_WWLNKL2W();
16596
16590
  init_chunk_SOJMWM63();
16597
16591
  init_chunk_WTOA3ANF();
16598
16592
  init_chunk_5FO3GNKP();
@@ -17836,6 +17830,8 @@ var init_utils = __esm({
17836
17830
  ["admin hubs repair-credential-links", { positionals: 0, values: ["--org", "--hub"], dryRun: true }],
17837
17831
  ["admin hubs repair-knowledge-blobs", { positionals: 0, values: ["--org", "--hub"], dryRun: true }],
17838
17832
  ["admin orgs repair-legacy-grants", { positionals: 0, values: ["--org"], dryRun: true }],
17833
+ ["admin vault import", { positionals: 0, values: ["--org", "--connector", "--max-puts"] }],
17834
+ ["admin vault revert", { positionals: 0, values: ["--org", "--connector"] }],
17839
17835
  ["admin harness mass-destroy", { positionals: 0, values: ["--org", "--hub"], dryRun: true }],
17840
17836
  ["admin harness disable", { positionals: 0 }],
17841
17837
  ["admin harness enable", { positionals: 0 }],
@@ -17851,6 +17847,9 @@ var init_utils = __esm({
17851
17847
  ["admin guide set-hub", { positionals: 1 }],
17852
17848
  ["admin guide clear", { positionals: 0 }],
17853
17849
  ["admin guide status", { positionals: 0 }],
17850
+ ["admin vault-gate status", { positionals: 0 }],
17851
+ ["admin vault-gate add", { positionals: 1 }],
17852
+ ["admin vault-gate remove", { positionals: 1 }],
17854
17853
  ["admin voice-calls enable", { positionals: 0 }],
17855
17854
  ["admin voice-calls disable", { positionals: 0 }],
17856
17855
  ["admin voice-calls status", { positionals: 0 }],
@@ -18350,6 +18349,14 @@ var init_api_client = __esm({
18350
18349
  async adminRepairKnowledgeBlobs(body) {
18351
18350
  return this.request("POST", "/api/admin/hubs/repair-knowledge-blobs", body);
18352
18351
  }
18352
+ // Used by `wayai admin vault import` (platform-admin gated, wayai#5644).
18353
+ async adminVaultImportRun(body) {
18354
+ return this.request("POST", "/api/admin/vault-import/run", body);
18355
+ }
18356
+ // Used by `wayai admin vault revert` (platform-admin gated, wayai#5644).
18357
+ async adminVaultImportRevert(body) {
18358
+ return this.request("POST", "/api/admin/vault-import/revert", body);
18359
+ }
18353
18360
  // Used by `wayai admin hubs repair-credential-links` (platform-admin gated).
18354
18361
  async adminRepairCredentialLinks(body) {
18355
18362
  return this.request("POST", "/api/admin/hubs/repair-credential-links", body);
@@ -22765,17 +22772,17 @@ var init_hub_materializer = __esm({
22765
22772
  var init_ci = __esm({
22766
22773
  "../../packages/core/dist/contracts/ci.js"() {
22767
22774
  "use strict";
22768
- init_chunk_VMPEOBYP();
22769
- init_chunk_YWCYUPJV();
22775
+ init_chunk_YN7UXGAP();
22776
+ init_chunk_YI3ORIXJ();
22770
22777
  init_chunk_HRKVCI5A();
22771
22778
  init_chunk_CZEJR5UE();
22772
22779
  init_chunk_4D6K4P4K();
22773
22780
  init_chunk_2YEGUQR7();
22774
22781
  init_chunk_LBDH7LCG();
22775
22782
  init_chunk_4LXDRTO4();
22776
- init_chunk_7NQZRSSJ();
22777
- init_chunk_D3EP4TDU();
22783
+ init_chunk_MO23HUAX();
22778
22784
  init_chunk_X5PZZVTS();
22785
+ init_chunk_D3EP4TDU();
22779
22786
  init_chunk_K5UAZWFF();
22780
22787
  init_chunk_OAWG66J3();
22781
22788
  init_chunk_WTOA3ANF();
@@ -37801,6 +37808,23 @@ async function adminCommand(args2) {
37801
37808
  process.exit(1);
37802
37809
  }
37803
37810
  }
37811
+ if (group === "vault") {
37812
+ if (!sub) {
37813
+ printHelp2();
37814
+ process.exit(1);
37815
+ }
37816
+ switch (sub) {
37817
+ case "import":
37818
+ await runVaultImport(flagArgs);
37819
+ return;
37820
+ case "revert":
37821
+ await runVaultRevert(flagArgs);
37822
+ return;
37823
+ default:
37824
+ printHelp2();
37825
+ process.exit(1);
37826
+ }
37827
+ }
37804
37828
  if (group === "harness") {
37805
37829
  if (!sub) {
37806
37830
  printHelp2();
@@ -37890,6 +37914,26 @@ async function adminCommand(args2) {
37890
37914
  process.exit(1);
37891
37915
  }
37892
37916
  }
37917
+ if (group === "vault-gate") {
37918
+ if (!sub) {
37919
+ printHelp2();
37920
+ process.exit(1);
37921
+ }
37922
+ switch (sub) {
37923
+ case "status":
37924
+ await runVaultGateStatus(positional, flagArgs);
37925
+ return;
37926
+ case "add":
37927
+ await runVaultGateChange("add", positional, flagArgs);
37928
+ return;
37929
+ case "remove":
37930
+ await runVaultGateChange("remove", positional, flagArgs);
37931
+ return;
37932
+ default:
37933
+ printHelp2();
37934
+ process.exit(1);
37935
+ }
37936
+ }
37893
37937
  if (group === "voice-calls") {
37894
37938
  if (!sub) {
37895
37939
  printHelp2();
@@ -38392,6 +38436,110 @@ async function runRepairCredentialLinks(flagArgs) {
38392
38436
  console.log(` hub=${r.hub_id} connection=${r.connection_id} credential=${r.credential_id}: ${r.outcome}${reason}${stale}${written}`);
38393
38437
  }
38394
38438
  }
38439
+ function printVaultReport(data) {
38440
+ if (data.hubs_errored.length > 0) console.log(`WARNING: ${data.hubs_errored.length} hub(s) could not be read and were SKIPPED \u2014 re-run to cover them: ${data.hubs_errored.join(", ")}`);
38441
+ if (data.reenable.length === 0) return;
38442
+ console.log(`${data.dry_run ? "Would need" : "Need"} their channel enabled again, on the preview hub (${data.reenable.length}):`);
38443
+ for (const r of data.reenable) console.log(` hub=${r.hub_id}${r.preview ? " (preview)" : ""} connection=${r.connection_id} bot=${r.bot_username ?? "-"}${r.enabled ? "" : " (disabled)"}`);
38444
+ }
38445
+ function parseVaultFlags(flagArgs, usage3, allowMaxPuts) {
38446
+ let orgId;
38447
+ let connectorId;
38448
+ let maxPuts;
38449
+ let apply = false;
38450
+ let yes = false;
38451
+ let jsonOutput = false;
38452
+ for (let i = 0; i < flagArgs.length; i++) {
38453
+ const flag = flagArgs[i];
38454
+ if (flag === "--org") {
38455
+ orgId = requireFlagValue(flagArgs, ++i, "--org");
38456
+ } else if (flag === "--connector") {
38457
+ connectorId = requireFlagValue(flagArgs, ++i, "--connector");
38458
+ } else if (flag === "--max-puts" && allowMaxPuts) {
38459
+ maxPuts = parsePositiveIntFlag("--max-puts", flagArgs[++i]);
38460
+ } else if (flag === "--apply") {
38461
+ apply = true;
38462
+ } else if (flag === "--yes" || flag === "-y") {
38463
+ yes = true;
38464
+ } else if (flag === "--json") {
38465
+ jsonOutput = true;
38466
+ } else {
38467
+ console.error(`Unknown flag: ${flag}`);
38468
+ console.error(usage3);
38469
+ process.exit(1);
38470
+ }
38471
+ }
38472
+ if (!orgId || !connectorId) {
38473
+ console.error("--org and --connector are required.");
38474
+ console.error(usage3);
38475
+ process.exit(1);
38476
+ }
38477
+ return { orgId, connectorId, maxPuts, apply, yes, jsonOutput };
38478
+ }
38479
+ async function runVaultImport(flagArgs) {
38480
+ const USAGE8 = "wayai admin vault import --org <org_id> --connector <connector_id> [--max-puts <n>] [--apply] [--yes] [--json]";
38481
+ const { orgId, connectorId, maxPuts, apply, yes, jsonOutput } = parseVaultFlags(flagArgs, USAGE8, true);
38482
+ if (apply && !yes && !jsonOutput) {
38483
+ console.log(`About to MOVE organization ${orgId}'s credentials of connector ${connectorId} into the credentials vault.`);
38484
+ console.log("Run without --apply first to see what would move.");
38485
+ if (!await confirm("Proceed?")) {
38486
+ console.log("Aborted.");
38487
+ return;
38488
+ }
38489
+ }
38490
+ const { config, accessToken } = await requireAuth();
38491
+ const client = new ApiClient({ apiUrl: config.api_url, accessToken });
38492
+ let data;
38493
+ try {
38494
+ data = (await client.adminVaultImportRun({ org_id: orgId, connector_id: connectorId, dry_run: !apply, ...maxPuts ? { max_puts: maxPuts } : {} })).data;
38495
+ } catch (err) {
38496
+ exitOnApiError(err);
38497
+ throw err;
38498
+ }
38499
+ if (jsonOutput) {
38500
+ console.log(JSON.stringify(data, null, 2));
38501
+ return;
38502
+ }
38503
+ console.log(`vault import (${data.connector}) \u2014 ${data.dry_run ? "DRY RUN \u2014 nothing written" : "written"}: gate=${data.gate_open ? "open" : "CLOSED"} hubs_scanned=${data.hubs_scanned} values_remaining=${data.values_remaining}`);
38504
+ if (data.rate_limited) console.log("The vault's per-org rate limit stopped the run \u2014 re-run in a minute.");
38505
+ for (const c of data.counts) console.log(` ${c.field} ${c.link} ${c.stored}: rows=${c.rows} values=${c.values}`);
38506
+ for (const v of data.values) {
38507
+ console.log(` value ${v.field} \u2192 ${v.secret_id ?? "-"}: ${v.outcome}${v.code ? ` (${v.code})` : ""}`);
38508
+ for (const r of v.rows) console.log(` hub=${r.hub_id} connection=${r.connection_id}: ${r.outcome}`);
38509
+ }
38510
+ printVaultReport(data);
38511
+ }
38512
+ async function runVaultRevert(flagArgs) {
38513
+ const USAGE8 = "wayai admin vault revert --org <org_id> --connector <connector_id> [--apply] [--yes] [--json]";
38514
+ const { orgId, connectorId, apply, yes, jsonOutput } = parseVaultFlags(flagArgs, USAGE8, false);
38515
+ if (apply && !yes && !jsonOutput) {
38516
+ console.log(`About to PUT BACK organization ${orgId}'s moved credentials of connector ${connectorId}, and erase their vault entries.`);
38517
+ console.log("Run without --apply first to see what would go back.");
38518
+ if (!await confirm("Proceed?")) {
38519
+ console.log("Aborted.");
38520
+ return;
38521
+ }
38522
+ }
38523
+ const { config, accessToken } = await requireAuth();
38524
+ const client = new ApiClient({ apiUrl: config.api_url, accessToken });
38525
+ let data;
38526
+ try {
38527
+ data = (await client.adminVaultImportRevert({ org_id: orgId, connector_id: connectorId, dry_run: !apply })).data;
38528
+ } catch (err) {
38529
+ exitOnApiError(err);
38530
+ throw err;
38531
+ }
38532
+ if (jsonOutput) {
38533
+ console.log(JSON.stringify(data, null, 2));
38534
+ return;
38535
+ }
38536
+ console.log(`vault revert (${data.connector}) \u2014 ${data.dry_run ? "DRY RUN \u2014 nothing written" : "written"}: hubs_scanned=${data.hubs_scanned} undo_rows=${data.undo_rows}`);
38537
+ for (const v of data.values) {
38538
+ console.log(` value ${v.field} \u2190 ${v.secret_id}${v.code ? `: ${v.code}` : ""}`);
38539
+ for (const r of v.rows) console.log(` hub=${r.hub_id} connection=${r.connection_id}: ${r.outcome}`);
38540
+ }
38541
+ printVaultReport(data);
38542
+ }
38395
38543
  async function runRepairBranchingOrphans(flagArgs) {
38396
38544
  const USAGE8 = "wayai admin hubs repair-branching-orphans --all | --org <org_id> | --hub <hub_id> [--id <type>:<id> ...] [--dry-run] [--yes] [--json]";
38397
38545
  const targets = [];
@@ -38803,7 +38951,7 @@ async function runCommunitiesDestroy(positional, flagArgs) {
38803
38951
  function describeGuideHub(hub) {
38804
38952
  return `${hub.hub_name ?? "(unnamed)"} (${hub.hub_id}), owned by ${hub.organization_name ?? "(unnamed org)"} (${hub.organization_id})`;
38805
38953
  }
38806
- function parseGuideFlags(flagArgs, usage3, allowed) {
38954
+ function parseBooleanFlags(flagArgs, usage3, allowed) {
38807
38955
  for (const flag of flagArgs) {
38808
38956
  if (!allowed.includes(flag)) {
38809
38957
  console.error(`Unknown flag: ${flag}`);
@@ -38815,7 +38963,7 @@ function parseGuideFlags(flagArgs, usage3, allowed) {
38815
38963
  }
38816
38964
  async function runGuideSetHub(positional, flagArgs) {
38817
38965
  const usage3 = "wayai admin guide set-hub <hub_id> [--yes] [--json]";
38818
- const { yes, jsonOutput } = parseGuideFlags(flagArgs, usage3, ["--yes", "--json"]);
38966
+ const { yes, jsonOutput } = parseBooleanFlags(flagArgs, usage3, ["--yes", "--json"]);
38819
38967
  const parsed = adminSetGuideHubBody.safeParse({ hub_id: positional[0] });
38820
38968
  if (positional.length !== 1 || !parsed.success) {
38821
38969
  console.error("<hub_id> must be one hub id (a UUID).");
@@ -38866,7 +39014,7 @@ async function runGuideClear(positional, flagArgs) {
38866
39014
  console.error(usage3);
38867
39015
  process.exit(1);
38868
39016
  }
38869
- const { jsonOutput } = parseGuideFlags(flagArgs, usage3, ["--json"]);
39017
+ const { jsonOutput } = parseBooleanFlags(flagArgs, usage3, ["--json"]);
38870
39018
  const { config, accessToken } = await requireAuth();
38871
39019
  const client = new ApiClient({ apiUrl: config.api_url, accessToken });
38872
39020
  try {
@@ -38889,7 +39037,7 @@ async function runGuideStatus(positional, flagArgs) {
38889
39037
  console.error(usage3);
38890
39038
  process.exit(1);
38891
39039
  }
38892
- const { jsonOutput } = parseGuideFlags(flagArgs, usage3, ["--json"]);
39040
+ const { jsonOutput } = parseBooleanFlags(flagArgs, usage3, ["--json"]);
38893
39041
  const { config, accessToken } = await requireAuth();
38894
39042
  const client = new ApiClient({ apiUrl: config.api_url, accessToken });
38895
39043
  let data;
@@ -38915,6 +39063,114 @@ async function runGuideStatus(positional, flagArgs) {
38915
39063
  console.log(`Hub: ${describeGuideHub(data.hub)}`);
38916
39064
  console.log(`Environment: ${data.hub.hub_environment ?? "unknown"}; type: ${data.hub.hub_type ?? "unknown"}; app channel: ${data.hub.app_channel_enabled ? "enabled" : "DISABLED"}`);
38917
39065
  }
39066
+ function vaultGateConnectorName(connectorId) {
39067
+ for (const [name, id] of VAULT_GATE_CONNECTORS) if (id === connectorId) return name;
39068
+ return null;
39069
+ }
39070
+ function describeVaultGateEntry(connectorId) {
39071
+ const name = vaultGateConnectorName(connectorId);
39072
+ return name ? `${name} (${connectorId})` : `${connectorId} (no connector the vault holds)`;
39073
+ }
39074
+ function describeVaultGateList(ids) {
39075
+ return ids.length === 0 ? "(none: every connector's new credentials take the existing path)" : ids.map(describeVaultGateEntry).join(", ");
39076
+ }
39077
+ function readVaultGateList(data) {
39078
+ const raw = data.vault_connector_ids;
39079
+ if (raw === void 0 || raw === null) return [];
39080
+ let parsed;
39081
+ try {
39082
+ parsed = typeof raw === "string" ? JSON.parse(raw) : raw;
39083
+ } catch {
39084
+ parsed = void 0;
39085
+ }
39086
+ if (!Array.isArray(parsed) || !parsed.every((id) => uuidSchema.safeParse(id).success)) {
39087
+ console.error(`vault_connector_ids cannot be read as a list of connector ids: ${JSON.stringify(raw)}`);
39088
+ process.exit(1);
39089
+ }
39090
+ return parsed;
39091
+ }
39092
+ function resolveVaultGateConnector(arg, usage3) {
39093
+ const wanted = (arg ?? "").trim().toLowerCase();
39094
+ const id = VAULT_GATE_CONNECTORS.get(wanted) ?? (vaultGateConnectorName(wanted) ? wanted : null);
39095
+ if (!id) {
39096
+ const known = [...VAULT_GATE_CONNECTORS].map(([name, cid]) => `${name} (${cid})`).join(", ");
39097
+ console.error(arg ? `Refused: the credentials vault holds nothing of connector "${arg}". It holds only: ${known}.` : "A connector is required.");
39098
+ console.error(usage3);
39099
+ process.exit(1);
39100
+ }
39101
+ return id;
39102
+ }
39103
+ async function readVaultGateConfig(client) {
39104
+ try {
39105
+ return readVaultGateList((await client.adminGetConfig()).data);
39106
+ } catch (err) {
39107
+ exitOnApiError(err);
39108
+ throw err;
39109
+ }
39110
+ }
39111
+ async function runVaultGateStatus(positional, flagArgs) {
39112
+ const usage3 = "wayai admin vault-gate status [--json]";
39113
+ if (positional.length > 0) {
39114
+ console.error(usage3);
39115
+ process.exit(1);
39116
+ }
39117
+ const { jsonOutput } = parseBooleanFlags(flagArgs, usage3, ["--json"]);
39118
+ const { config, accessToken } = await requireAuth();
39119
+ const client = new ApiClient({ apiUrl: config.api_url, accessToken });
39120
+ const ids = await readVaultGateConfig(client);
39121
+ if (jsonOutput) {
39122
+ console.log(JSON.stringify({ vault_connector_ids: ids }, null, 2));
39123
+ return;
39124
+ }
39125
+ console.log(`vault_connector_ids (platform): ${describeVaultGateList(ids)}`);
39126
+ }
39127
+ async function runVaultGateChange(change, positional, flagArgs) {
39128
+ const usage3 = `wayai admin vault-gate ${change} <connector> [--yes] [--json]`;
39129
+ const { yes, jsonOutput } = parseBooleanFlags(flagArgs, usage3, ["--yes", "--json"]);
39130
+ if (positional.length !== 1) {
39131
+ console.error("Name one connector.");
39132
+ console.error(usage3);
39133
+ process.exit(1);
39134
+ }
39135
+ const connectorId = resolveVaultGateConnector(positional[0], usage3);
39136
+ const entry = describeVaultGateEntry(connectorId);
39137
+ const { config, accessToken } = await requireAuth();
39138
+ const client = new ApiClient({ apiUrl: config.api_url, accessToken });
39139
+ const before = await readVaultGateConfig(client);
39140
+ const listed2 = before.includes(connectorId);
39141
+ if (listed2 === (change === "add")) {
39142
+ if (jsonOutput) {
39143
+ console.log(JSON.stringify({ before, after: before, changed: false }, null, 2));
39144
+ return;
39145
+ }
39146
+ console.log(`Before: ${describeVaultGateList(before)}`);
39147
+ console.log(`${entry} is ${listed2 ? "already" : "not"} listed; nothing was written.`);
39148
+ return;
39149
+ }
39150
+ const next = change === "add" ? [...before, connectorId] : before.filter((id) => id !== connectorId);
39151
+ if (!jsonOutput) console.log(`Before: ${describeVaultGateList(before)}`);
39152
+ if (!yes && !jsonOutput) {
39153
+ console.log(change === "add" ? `About to add ${entry}: its connections' new credentials go to the credentials vault.` : `About to remove ${entry}: its connections' new credentials take the existing path again; ones the vault already holds stay there.`);
39154
+ const ok = await confirm("Proceed?");
39155
+ if (!ok) {
39156
+ console.log("Aborted.");
39157
+ return;
39158
+ }
39159
+ }
39160
+ let after;
39161
+ try {
39162
+ after = readVaultGateList((await client.adminUpdateConfig({ vault_connector_ids: next })).data);
39163
+ } catch (err) {
39164
+ exitOnApiError(err);
39165
+ throw err;
39166
+ }
39167
+ if (jsonOutput) {
39168
+ console.log(JSON.stringify({ before, after, changed: true }, null, 2));
39169
+ return;
39170
+ }
39171
+ console.log(`After: ${describeVaultGateList(after)}`);
39172
+ console.log(PLATFORM_CONFIG_PROPAGATION_NOTE);
39173
+ }
38918
39174
  function conflictReasonOf(err) {
38919
39175
  try {
38920
39176
  const reason = JSON.parse(err.body).details?.reason;
@@ -39526,6 +39782,12 @@ Usage:
39526
39782
  wayai admin orgs repair-legacy-grants --all | --org <org_id> [--dry-run] [--yes] [--json]
39527
39783
  Repair org-admin roster rows keyed by email with a NULL user_email (pre-#3922 platform-admin adds): grant the real access they never conferred, or drop the phantom seat. Idempotent \u2014 run --dry-run first
39528
39784
 
39785
+ wayai admin vault import --org <org_id> --connector <connector_id> [--max-puts <n>] [--apply] [--yes] [--json]
39786
+ Move one org's stored credentials of one connector into the credentials vault, no re-entry (#5644). A dry run by default (counts by field, link kind and form); --apply needs the connector's gate open, puts each distinct value once for the direct rows holding it (a field an org credential supplies stays), and keeps the old ciphertext 30 days for revert. Re-run until values_remaining is 0. Lists Telegram bots to enable again
39787
+
39788
+ wayai admin vault revert --org <org_id> --connector <connector_id> [--apply] [--yes] [--json]
39789
+ Put back what vault import moved, within 30 days, and erase the vault entries no row names. A dry run by default
39790
+
39529
39791
  wayai admin harness disable Flip the platform harness_enabled flag OFF (break-glass: blocks harness-agent writes and the per-turn kill switch aborts each harness turn on its next invocation)
39530
39792
  wayai admin harness enable Flip the platform harness_enabled flag ON
39531
39793
  wayai admin harness status Print the platform harness_enabled flag
@@ -39555,6 +39817,12 @@ Usage:
39555
39817
  wayai admin guide clear [--json] Turn the Guide off: nobody new is enrolled and the help entry is hidden
39556
39818
  wayai admin guide status [--json] Print which hub is the Guide, and its facts
39557
39819
 
39820
+ wayai admin vault-gate status [--json] Print the connectors whose new credentials go to the credentials vault
39821
+ wayai admin vault-gate add <connector> [--yes] [--json]
39822
+ List a connector (a vault connector's name, e.g. telegram, or its catalog id); prints before and after, confirms unless --yes
39823
+ wayai admin vault-gate remove <connector> [--yes] [--json]
39824
+ Stop listing it: its new credentials take the existing path again
39825
+
39558
39826
  Sources:
39559
39827
  do Live DO SQLite (existing conversation, hub config, etc.).
39560
39828
  analytics ClickHouse projections (conversation, message, schedule_event).
@@ -39654,6 +39922,11 @@ Sources:
39654
39922
  it from the help entry ("Ask WayAI"); its owning org pays. \`clear\` stops new
39655
39923
  enrollment and hides the help entry; people already enrolled keep their row.
39656
39924
  Changes land within about 60 s.
39925
+ vault-gate The credentials vault's gate, per connector and never per org: the PLATFORM-wide
39926
+ vault_connector_ids list. A listed connector's new credentials go to the vault,
39927
+ the row keeping only a reference; credentials the vault already holds stay there
39928
+ whichever way the gate is set. Only connectors the vault holds anything of are
39929
+ taken: ${[...VAULT_GATE_CONNECTORS.keys()].join(", ")}. Changes land within about 60 s.
39657
39930
 
39658
39931
  Types (do): ${VALID_TYPES.join(" | ")}
39659
39932
  Tables (analytics): ${VALID_ANALYTICS_TABLES.join(" | ")}
@@ -39691,7 +39964,7 @@ Audit + rate limit:
39691
39964
  across all sources. Platform-admin grant required.
39692
39965
  `.trim());
39693
39966
  }
39694
- var VALID_TYPES, VALID_ANALYTICS_TABLES, HARNESS_GATE, VOICE_CALLS_GATE, THREADS_GATE, COMMUNITIES_GATE, PLATFORM_CONFIG_PROPAGATION_NOTE, VALID_NOTICE_SEVERITIES;
39967
+ var VALID_TYPES, VALID_ANALYTICS_TABLES, HARNESS_GATE, VOICE_CALLS_GATE, THREADS_GATE, COMMUNITIES_GATE, PLATFORM_CONFIG_PROPAGATION_NOTE, VAULT_GATE_CONNECTORS, VALID_NOTICE_SEVERITIES;
39695
39968
  var init_admin = __esm({
39696
39969
  "src/commands/admin.ts"() {
39697
39970
  "use strict";
@@ -39732,6 +40005,9 @@ var init_admin = __esm({
39732
40005
  displayName: "Communities"
39733
40006
  };
39734
40007
  PLATFORM_CONFIG_PROPAGATION_NOTE = "Takes effect within about 60 s (the platform-config cache is dropped; KV deletes propagate eventually).";
40008
+ VAULT_GATE_CONNECTORS = /* @__PURE__ */ new Map([
40009
+ ["telegram", "a1b2c3d4-e5f6-4a89-b012-3e5e0d000002"]
40010
+ ]);
39735
40011
  VALID_NOTICE_SEVERITIES = ["critical", "warn", "info"];
39736
40012
  }
39737
40013
  });