@wayai/cli 0.3.272 → 0.3.273

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-JR6ZYRSI.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,35 @@ 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 } = 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") refuseNonBooleanFlag(ctx, tool, entry, "expose_schema_to_llm", entryAt);
14441
14445
  });
14442
14446
  }
14443
14447
  });
14448
+ for (const [section, noun, list2] of [["connections", "Connection", connections], ["evals", "Eval", evals], ["journeys", "Journey", journeys]]) {
14449
+ flagEntriesOf(list2).forEach((entry, index) => {
14450
+ refuseNonBooleanFlag(ctx, `${noun} "${flagEntryName(entry.name)}"`, entry, "enabled", [section, index]);
14451
+ });
14452
+ }
14444
14453
  }
14445
14454
  function refineHubAsCodeFlagConditions(config, ctx) {
14446
14455
  const agents = config?.agents;
@@ -14626,9 +14635,9 @@ function skillSectionsAsResources(scope) {
14626
14635
  return out;
14627
14636
  };
14628
14637
  }
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"() {
14638
+ 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;
14639
+ var init_chunk_JR6ZYRSI = __esm({
14640
+ "../../packages/core/dist/chunk-JR6ZYRSI.js"() {
14632
14641
  "use strict";
14633
14642
  init_chunk_SARVKRZB();
14634
14643
  init_chunk_HRKVCI5A();
@@ -14716,6 +14725,8 @@ var init_chunk_D7EMMHYQ = __esm({
14716
14725
  }).passthrough();
14717
14726
  uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
14718
14727
  ciUuidSchema = external_exports.string().regex(uuidPattern, "must be a valid UUID");
14728
+ flagEntriesOf = (list2) => Array.isArray(list2) ? list2.map((entry) => entry ?? {}) : [];
14729
+ flagEntryName = (name) => typeof name === "string" || typeof name === "number" ? name : "<unnamed>";
14719
14730
  boundedHubAsCodeResourcesSchema = external_exports.unknown().superRefine((resources, ctx) => {
14720
14731
  if (!Array.isArray(resources)) return;
14721
14732
  if (resources.length > MAX_HUB_AS_CODE_RESOURCES) {
@@ -14725,6 +14736,9 @@ var init_chunk_D7EMMHYQ = __esm({
14725
14736
  });
14726
14737
  return;
14727
14738
  }
14739
+ flagEntriesOf(resources).forEach((skill, index) => {
14740
+ refuseNonBooleanFlag(ctx, `Skill "${flagEntryName(skill.name)}"`, skill, "enabled", [index]);
14741
+ });
14728
14742
  let fileCount = 0;
14729
14743
  for (const resource of resources) {
14730
14744
  const files = resource?.files;
@@ -14763,7 +14777,7 @@ var init_chunk_D7EMMHYQ = __esm({
14763
14777
  refineHubAsCodeAccessValues(config, ctx);
14764
14778
  refineHubAsCodeResources(config, ctx);
14765
14779
  refineHubAsCodeDelegation(config, ctx);
14766
- refineHubAsCodeToolEnabled(config, ctx);
14780
+ refineHubAsCodeFlags(config, ctx);
14767
14781
  refineHubAsCodeFlagConditions(config, ctx);
14768
14782
  refineHubAsCodeMonitorConfig(config, ctx);
14769
14783
  refineHubAsCodeDecisionsModel(config, ctx);
@@ -16221,7 +16235,7 @@ var init_contracts = __esm({
16221
16235
  init_chunk_E4DIIOOE();
16222
16236
  init_chunk_7CYHPF35();
16223
16237
  init_chunk_BPCNB5RT();
16224
- init_chunk_D7EMMHYQ();
16238
+ init_chunk_JR6ZYRSI();
16225
16239
  init_chunk_SARVKRZB();
16226
16240
  init_chunk_HRKVCI5A();
16227
16241
  init_chunk_ICE6SQZO();
@@ -17706,6 +17720,9 @@ function assertSkillEntryType(name, type) {
17706
17720
  if (type === void 0 || type === "skill") return;
17707
17721
  throw expected(`Skill "${name}" has \`type: ${String(type)}\`: a skill takes no type. Documents live in the knowledge base (\`wayai files\`).`);
17708
17722
  }
17723
+ function carryEnabled(written, target) {
17724
+ if (written !== void 0 && written !== true) target.enabled = written;
17725
+ }
17709
17726
  function renameKey(obj, from, to, map) {
17710
17727
  const out = {};
17711
17728
  for (const [key, value] of Object.entries(obj)) {
@@ -21779,7 +21796,7 @@ function parseEvalYaml(filePath2, relPath, setName, hubFolder, bytesByHash) {
21779
21796
  if (typeof data.id === "string") evalEntry.id = data.id;
21780
21797
  if (typeof data.agent_id === "string") evalEntry.agent_id = data.agent_id;
21781
21798
  if (typeof data.runs === "number") evalEntry.runs = data.runs;
21782
- if (data.enabled === false) evalEntry.enabled = false;
21799
+ carryEnabled(data.enabled, evalEntry);
21783
21800
  if (Array.isArray(data.history)) {
21784
21801
  evalEntry.history = data.history.map((turn, i) => {
21785
21802
  const t = { ...turn };
@@ -21912,7 +21929,7 @@ function parseJourneyYaml(filePath2, relPath, hubFolder, bytesByHash) {
21912
21929
  };
21913
21930
  if (typeof data.id === "string") journeyEntry.id = data.id;
21914
21931
  if (typeof data.agent_id === "string") journeyEntry.agent_id = data.agent_id;
21915
- if (data.enabled === false) journeyEntry.enabled = false;
21932
+ carryEnabled(data.enabled, journeyEntry);
21916
21933
  if (typeof data.evaluator_instructions === "string") {
21917
21934
  journeyEntry.evaluator_instructions = data.evaluator_instructions;
21918
21935
  }
@@ -22011,7 +22028,7 @@ function parseSkills(hubFolder, config, unreadable) {
22011
22028
  if (!old) assertSkillEntryType(skill.name, entry.type);
22012
22029
  if (entry.id) skill.id = entry.id;
22013
22030
  if (entry.description) skill.description = entry.description;
22014
- if (entry.enabled === false) skill.enabled = false;
22031
+ carryEnabled(entry.enabled, skill);
22015
22032
  if (entry.skill_name) skill.skill_name = entry.skill_name;
22016
22033
  const folder = old ? oldResourceFolder(skill) : skillFolder(skill);
22017
22034
  const dir = path17.join(root, folder);
@@ -34821,7 +34838,7 @@ function parseOrgSkills(orgDir, opts = {}) {
34821
34838
  if (!old) assertSkillEntryType(skill.name, entry.type);
34822
34839
  if (entry.id) skill.id = entry.id;
34823
34840
  if (entry.description) skill.description = entry.description;
34824
- if (entry.enabled === false) skill.enabled = false;
34841
+ carryEnabled(entry.enabled, skill);
34825
34842
  if (entry.skill_name) skill.skill_name = entry.skill_name;
34826
34843
  if (entry.environment) skill.environment = entry.environment;
34827
34844
  if (Array.isArray(entry.tags)) skill.tags = entry.tags;
@@ -34976,10 +34993,18 @@ async function orgPull(args2) {
34976
34993
  assertOrgDirConvertible(orgDir, payload);
34977
34994
  if (orgManifestExists(orgDir) && !autoConfirm) {
34978
34995
  const local = parseOrgSkills(orgDir, { readOldLayout: true });
34979
- const diff = await client.diffOrgSkills(orgId, local, "pull");
34980
- if (diff.has_changes) {
34996
+ let diff;
34997
+ try {
34998
+ diff = await client.diffOrgSkills(orgId, local, "pull");
34999
+ } catch (err) {
35000
+ console.log("\nThe platform could not compare your local org/, so the changes cannot be listed:");
35001
+ console.log(` ${extractApiMessage(err)}`);
35002
+ }
35003
+ if (diff?.has_changes) {
34981
35004
  console.log("\nLocal org/ differs from the platform. Pulling overwrites local with the platform state:");
34982
35005
  printDiff(diff.summary);
35006
+ }
35007
+ if (!diff || diff.has_changes) {
34983
35008
  const ok = await confirm("Overwrite local org/ with platform state?");
34984
35009
  if (!ok) {
34985
35010
  console.log("Cancelled.");
@@ -35056,6 +35081,7 @@ var init_org = __esm({
35056
35081
  init_layout();
35057
35082
  init_utils();
35058
35083
  init_diff_display();
35084
+ init_errors2();
35059
35085
  init_org_workspace();
35060
35086
  }
35061
35087
  });