@wayai/cli 0.3.272 → 0.3.274

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
@@ -13996,7 +13996,7 @@ var init_chunk_TU4Y4MEX = __esm({
13996
13996
  }
13997
13997
  });
13998
13998
 
13999
- // ../../packages/core/dist/chunk-D7EMMHYQ.js
13999
+ // ../../packages/core/dist/chunk-LBKP4XCU.js
14000
14000
  function refineHubAsCodeCustomTools(config, ctx) {
14001
14001
  const agents = config.agents;
14002
14002
  if (!Array.isArray(agents)) return;
@@ -14345,7 +14345,7 @@ function refineHubAsCodeResources(config, ctx) {
14345
14345
  const files = resource?.files;
14346
14346
  if (!Array.isArray(files)) return;
14347
14347
  files.forEach((file, fileIndex) => {
14348
- const entry = file;
14348
+ const entry = file ?? {};
14349
14349
  if (typeof entry.content_base64 === "string") {
14350
14350
  aggregateEncoded += entry.content_base64.length;
14351
14351
  if (entry.content_base64.length > MAX_RESOURCE_ENCODED_BYTES) {
@@ -14421,26 +14421,40 @@ function refineHubAsCodeDelegation(config, ctx) {
14421
14421
  });
14422
14422
  });
14423
14423
  }
14424
- function refineHubAsCodeToolEnabled(config, ctx) {
14425
- const agents = config?.agents;
14426
- if (!Array.isArray(agents)) return;
14427
- const label2 = (name) => typeof name === "string" || typeof name === "number" ? name : "<unnamed>";
14428
- agents.forEach((agent, agentIndex) => {
14429
- const { name: agentName, tools } = agent ?? {};
14424
+ function refuseNonBooleanFlag(ctx, subject, entry, key, path45) {
14425
+ const value = entry[key];
14426
+ if (value === void 0 || typeof value === "boolean") return;
14427
+ const shown3 = value === null || typeof value !== "object" ? JSON.stringify(value).slice(0, 40) : Array.isArray(value) ? "a list" : "an object";
14428
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: [...path45, key], message: `${subject}: ${key} must be true or false, got ${shown3}` });
14429
+ }
14430
+ function refineHubAsCodeFlags(config, ctx) {
14431
+ const { agents, connections, evals, journeys, teams } = config;
14432
+ flagEntriesOf(agents).forEach((agent, agentIndex) => {
14433
+ const subject = `Agent "${flagEntryName(agent.name)}"`;
14434
+ const at = ["agents", agentIndex];
14435
+ refuseNonBooleanFlag(ctx, subject, agent, "enabled", at);
14436
+ flagEntriesOf(agent.resources).forEach((link, linkIndex) => {
14437
+ refuseNonBooleanFlag(ctx, `${subject}, skill "${flagEntryName(link.name)}"`, link, "enabled", [...at, "resources", linkIndex]);
14438
+ });
14430
14439
  for (const group of HUB_AS_CODE_AGENT_TOOL_KEYS) {
14431
- const entries = tools?.[group];
14432
- if (!Array.isArray(entries)) continue;
14433
- entries.forEach((entry, entryIndex) => {
14434
- const { enabled, name, tool } = entry ?? {};
14435
- if (enabled === void 0 || typeof enabled === "boolean") return;
14436
- ctx.addIssue({
14437
- code: external_exports.ZodIssueCode.custom,
14438
- path: ["agents", agentIndex, "tools", group, entryIndex, "enabled"],
14439
- message: `Agent "${label2(agentName)}", tool "${label2(name ?? tool)}": enabled must be true or false, got ${JSON.stringify(enabled).slice(0, 40)}`
14440
- });
14440
+ flagEntriesOf(agent.tools?.[group]).forEach((entry, entryIndex) => {
14441
+ const tool = `${subject}, tool "${flagEntryName(entry.name ?? entry.tool)}"`;
14442
+ const entryAt = [...at, "tools", group, entryIndex];
14443
+ refuseNonBooleanFlag(ctx, tool, entry, "enabled", entryAt);
14444
+ if (group === "custom" || group === "native") refuseNonBooleanFlag(ctx, tool, entry, "expose_schema_to_llm", entryAt);
14441
14445
  });
14442
14446
  }
14443
14447
  });
14448
+ for (const [section, noun, list2, keys] of [
14449
+ ["connections", "Connection", connections, ["enabled", "sync_credentials_to_production", "no_auth"]],
14450
+ ["evals", "Eval", evals, ["enabled"]],
14451
+ ["journeys", "Journey", journeys, ["enabled"]],
14452
+ ["teams", "Team", teams, ["display_only_if_claimed"]]
14453
+ ]) {
14454
+ flagEntriesOf(list2).forEach((entry, index) => {
14455
+ for (const key of keys) refuseNonBooleanFlag(ctx, `${noun} "${flagEntryName(entry.name)}"`, entry, key, [section, index]);
14456
+ });
14457
+ }
14444
14458
  }
14445
14459
  function refineHubAsCodeFlagConditions(config, ctx) {
14446
14460
  const agents = config?.agents;
@@ -14626,9 +14640,9 @@ function skillSectionsAsResources(scope) {
14626
14640
  return out;
14627
14641
  };
14628
14642
  }
14629
- 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, boundedHubAsCodeResourcesSchema, isPlainObject, MIN_SKILLS_LAYOUT_CLI, hubAsCodeConfigSchema, ciPullHubIdParam, ciBranchParam, ciPullQuery, ciHubsQuery, ciLookupQuery, ciBranchesQuery, ciSyncBody, ciPushBody, ciDiffBody, ciPublishBody, ciPublishPreviewBody, ciSyncMcpBody, ciOrgResourcesParam, orgResourcesConfigSchema, ciOrgResourcesPushBody, ciOrgResourcesDiffBody, CI_APPLY_ENTITY_KINDS, CI_APPLY_OPERATIONS, ciApplyErrorBaseSchema, ciApplyErrorSchema, ciSyncCountSchema, ciSyncChangesSchema, ciSyncWarningSchema, ciSyncResponseSchema;
14630
- var init_chunk_D7EMMHYQ = __esm({
14631
- "../../packages/core/dist/chunk-D7EMMHYQ.js"() {
14643
+ 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, flagEntryName, boundedHubAsCodeResourcesSchema, isPlainObject, MIN_SKILLS_LAYOUT_CLI, hubAsCodeConfigSchema, ciPullHubIdParam, ciBranchParam, ciPullQuery, ciHubsQuery, ciLookupQuery, ciBranchesQuery, ciSyncBody, ciPushBody, ciDiffBody, ciPublishBody, ciPublishPreviewBody, ciSyncMcpBody, ciOrgResourcesParam, orgResourcesConfigSchema, ciOrgResourcesPushBody, ciOrgResourcesDiffBody, CI_APPLY_ENTITY_KINDS, CI_APPLY_OPERATIONS, ciApplyErrorBaseSchema, ciApplyErrorSchema, ciSyncCountSchema, ciSyncChangesSchema, ciSyncWarningSchema, ciSyncResponseSchema;
14644
+ var init_chunk_LBKP4XCU = __esm({
14645
+ "../../packages/core/dist/chunk-LBKP4XCU.js"() {
14632
14646
  "use strict";
14633
14647
  init_chunk_SARVKRZB();
14634
14648
  init_chunk_HRKVCI5A();
@@ -14716,6 +14730,8 @@ var init_chunk_D7EMMHYQ = __esm({
14716
14730
  }).passthrough();
14717
14731
  uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
14718
14732
  ciUuidSchema = external_exports.string().regex(uuidPattern, "must be a valid UUID");
14733
+ flagEntriesOf = (list2) => Array.isArray(list2) ? list2.map((entry) => entry ?? {}) : [];
14734
+ flagEntryName = (name) => typeof name === "string" || typeof name === "number" ? name : "<unnamed>";
14719
14735
  boundedHubAsCodeResourcesSchema = external_exports.unknown().superRefine((resources, ctx) => {
14720
14736
  if (!Array.isArray(resources)) return;
14721
14737
  if (resources.length > MAX_HUB_AS_CODE_RESOURCES) {
@@ -14725,6 +14741,9 @@ var init_chunk_D7EMMHYQ = __esm({
14725
14741
  });
14726
14742
  return;
14727
14743
  }
14744
+ flagEntriesOf(resources).forEach((skill, index) => {
14745
+ refuseNonBooleanFlag(ctx, `Skill "${flagEntryName(skill.name)}"`, skill, "enabled", [index]);
14746
+ });
14728
14747
  let fileCount = 0;
14729
14748
  for (const resource of resources) {
14730
14749
  const files = resource?.files;
@@ -14763,7 +14782,7 @@ var init_chunk_D7EMMHYQ = __esm({
14763
14782
  refineHubAsCodeAccessValues(config, ctx);
14764
14783
  refineHubAsCodeResources(config, ctx);
14765
14784
  refineHubAsCodeDelegation(config, ctx);
14766
- refineHubAsCodeToolEnabled(config, ctx);
14785
+ refineHubAsCodeFlags(config, ctx);
14767
14786
  refineHubAsCodeFlagConditions(config, ctx);
14768
14787
  refineHubAsCodeMonitorConfig(config, ctx);
14769
14788
  refineHubAsCodeDecisionsModel(config, ctx);
@@ -16221,7 +16240,7 @@ var init_contracts = __esm({
16221
16240
  init_chunk_E4DIIOOE();
16222
16241
  init_chunk_7CYHPF35();
16223
16242
  init_chunk_BPCNB5RT();
16224
- init_chunk_D7EMMHYQ();
16243
+ init_chunk_LBKP4XCU();
16225
16244
  init_chunk_SARVKRZB();
16226
16245
  init_chunk_HRKVCI5A();
16227
16246
  init_chunk_ICE6SQZO();
@@ -17706,6 +17725,9 @@ function assertSkillEntryType(name, type) {
17706
17725
  if (type === void 0 || type === "skill") return;
17707
17726
  throw expected(`Skill "${name}" has \`type: ${String(type)}\`: a skill takes no type. Documents live in the knowledge base (\`wayai files\`).`);
17708
17727
  }
17728
+ function carryEnabled(written, target) {
17729
+ if (written !== void 0 && written !== true) target.enabled = written;
17730
+ }
17709
17731
  function renameKey(obj, from, to, map) {
17710
17732
  const out = {};
17711
17733
  for (const [key, value] of Object.entries(obj)) {
@@ -21779,7 +21801,7 @@ function parseEvalYaml(filePath2, relPath, setName, hubFolder, bytesByHash) {
21779
21801
  if (typeof data.id === "string") evalEntry.id = data.id;
21780
21802
  if (typeof data.agent_id === "string") evalEntry.agent_id = data.agent_id;
21781
21803
  if (typeof data.runs === "number") evalEntry.runs = data.runs;
21782
- if (data.enabled === false) evalEntry.enabled = false;
21804
+ carryEnabled(data.enabled, evalEntry);
21783
21805
  if (Array.isArray(data.history)) {
21784
21806
  evalEntry.history = data.history.map((turn, i) => {
21785
21807
  const t = { ...turn };
@@ -21912,7 +21934,7 @@ function parseJourneyYaml(filePath2, relPath, hubFolder, bytesByHash) {
21912
21934
  };
21913
21935
  if (typeof data.id === "string") journeyEntry.id = data.id;
21914
21936
  if (typeof data.agent_id === "string") journeyEntry.agent_id = data.agent_id;
21915
- if (data.enabled === false) journeyEntry.enabled = false;
21937
+ carryEnabled(data.enabled, journeyEntry);
21916
21938
  if (typeof data.evaluator_instructions === "string") {
21917
21939
  journeyEntry.evaluator_instructions = data.evaluator_instructions;
21918
21940
  }
@@ -22011,7 +22033,7 @@ function parseSkills(hubFolder, config, unreadable) {
22011
22033
  if (!old) assertSkillEntryType(skill.name, entry.type);
22012
22034
  if (entry.id) skill.id = entry.id;
22013
22035
  if (entry.description) skill.description = entry.description;
22014
- if (entry.enabled === false) skill.enabled = false;
22036
+ carryEnabled(entry.enabled, skill);
22015
22037
  if (entry.skill_name) skill.skill_name = entry.skill_name;
22016
22038
  const folder = old ? oldResourceFolder(skill) : skillFolder(skill);
22017
22039
  const dir = path17.join(root, folder);
@@ -34821,7 +34843,7 @@ function parseOrgSkills(orgDir, opts = {}) {
34821
34843
  if (!old) assertSkillEntryType(skill.name, entry.type);
34822
34844
  if (entry.id) skill.id = entry.id;
34823
34845
  if (entry.description) skill.description = entry.description;
34824
- if (entry.enabled === false) skill.enabled = false;
34846
+ carryEnabled(entry.enabled, skill);
34825
34847
  if (entry.skill_name) skill.skill_name = entry.skill_name;
34826
34848
  if (entry.environment) skill.environment = entry.environment;
34827
34849
  if (Array.isArray(entry.tags)) skill.tags = entry.tags;
@@ -34976,10 +34998,18 @@ async function orgPull(args2) {
34976
34998
  assertOrgDirConvertible(orgDir, payload);
34977
34999
  if (orgManifestExists(orgDir) && !autoConfirm) {
34978
35000
  const local = parseOrgSkills(orgDir, { readOldLayout: true });
34979
- const diff = await client.diffOrgSkills(orgId, local, "pull");
34980
- if (diff.has_changes) {
35001
+ let diff;
35002
+ try {
35003
+ diff = await client.diffOrgSkills(orgId, local, "pull");
35004
+ } catch (err) {
35005
+ console.log("\nThe platform could not compare your local org/, so the changes cannot be listed:");
35006
+ console.log(` ${extractApiMessage(err)}`);
35007
+ }
35008
+ if (diff?.has_changes) {
34981
35009
  console.log("\nLocal org/ differs from the platform. Pulling overwrites local with the platform state:");
34982
35010
  printDiff(diff.summary);
35011
+ }
35012
+ if (!diff || diff.has_changes) {
34983
35013
  const ok = await confirm("Overwrite local org/ with platform state?");
34984
35014
  if (!ok) {
34985
35015
  console.log("Cancelled.");
@@ -35056,6 +35086,7 @@ var init_org = __esm({
35056
35086
  init_layout();
35057
35087
  init_utils();
35058
35088
  init_diff_display();
35089
+ init_errors2();
35059
35090
  init_org_workspace();
35060
35091
  }
35061
35092
  });