@cavelon/cli 0.2.15 → 0.2.17

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.
@@ -3343,6 +3343,37 @@ var require_utils = __commonJS({
3343
3343
  }
3344
3344
  return output.join("");
3345
3345
  }
3346
+ function removeDotSegmentsRelative(path4) {
3347
+ if (path4 === "" || path4[0] === "/") {
3348
+ return removeDotSegments(path4);
3349
+ }
3350
+ const segments = path4.split("/");
3351
+ const last = segments.length - 1;
3352
+ const output = [];
3353
+ let trailingDirectory = false;
3354
+ for (let i = 0; i <= last; i++) {
3355
+ const segment = segments[i];
3356
+ if (segment === "." || segment === "..") {
3357
+ if (segment === "..") {
3358
+ if (output.length !== 0 && output[output.length - 1] !== "..") {
3359
+ output.pop();
3360
+ } else {
3361
+ output.push("..");
3362
+ }
3363
+ }
3364
+ trailingDirectory = i === last;
3365
+ } else {
3366
+ output.push(segment);
3367
+ }
3368
+ }
3369
+ if (trailingDirectory && output[output.length - 1] !== "..") {
3370
+ output.push("");
3371
+ }
3372
+ if (output.length === 0 || output[0] === "" || output[0].includes(":")) {
3373
+ output.unshift(".");
3374
+ }
3375
+ return output.join("/");
3376
+ }
3346
3377
  var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
3347
3378
  var HOST_DELIM_RE = /[@/?#:]/g;
3348
3379
  var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
@@ -3603,6 +3634,7 @@ var require_utils = __commonJS({
3603
3634
  encodeFragment,
3604
3635
  escapePreservingEscapes,
3605
3636
  removeDotSegments,
3637
+ removeDotSegmentsRelative,
3606
3638
  isIPv4,
3607
3639
  isUUID,
3608
3640
  normalizeIPv6,
@@ -3826,16 +3858,18 @@ var require_schemes = __commonJS({
3826
3858
  var require_fast_uri = __commonJS({
3827
3859
  "node_modules/fast-uri/index.js"(exports, module) {
3828
3860
  "use strict";
3829
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3861
+ var { normalizeIPv6, removeDotSegments, removeDotSegmentsRelative, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3830
3862
  var { SCHEMES, getSchemeHandler } = require_schemes();
3831
3863
  var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
3832
3864
  var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
3833
- function decodeValidScheme(scheme) {
3834
- const decodedScheme = unescape(String(scheme));
3835
- if (!VALID_SCHEME.test(decodedScheme)) {
3865
+ var MALFORMED_HOST_ERROR = "URI host is malformed.";
3866
+ var FORBIDDEN_DOMAIN_HOST_CHARACTER = /[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;
3867
+ function validateScheme(scheme) {
3868
+ const stringScheme = String(scheme);
3869
+ if (!VALID_SCHEME.test(stringScheme)) {
3836
3870
  throw new TypeError(MALFORMED_SCHEME_ERROR);
3837
3871
  }
3838
- return decodedScheme;
3872
+ return stringScheme;
3839
3873
  }
3840
3874
  function normalize(uri, options) {
3841
3875
  if (typeof uri === "string") {
@@ -3872,6 +3906,9 @@ var require_fast_uri = __commonJS({
3872
3906
  const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
3873
3907
  const resolvedHost = resolved.host;
3874
3908
  const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
3909
+ if (hasForbiddenDomainHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP)) {
3910
+ throw new Error(MALFORMED_HOST_ERROR);
3911
+ }
3875
3912
  canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
3876
3913
  const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost);
3877
3914
  if (resolved.error && !encodedASCIIHost) {
@@ -3913,14 +3950,15 @@ var require_fast_uri = __commonJS({
3913
3950
  if (relative.path[0] === "/") {
3914
3951
  target.path = removeDotSegments(relative.path);
3915
3952
  } else {
3916
- if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
3953
+ const baseHasAuthority = base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0;
3954
+ if (baseHasAuthority && !base.path) {
3917
3955
  target.path = "/" + relative.path;
3918
3956
  } else if (!base.path) {
3919
3957
  target.path = relative.path;
3920
3958
  } else {
3921
3959
  target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
3922
3960
  }
3923
- target.path = removeDotSegments(target.path);
3961
+ target.path = base.scheme === void 0 && !baseHasAuthority && target.path[0] !== "/" ? removeDotSegmentsRelative(target.path) : removeDotSegments(target.path);
3924
3962
  }
3925
3963
  target.query = relative.query;
3926
3964
  }
@@ -3958,12 +3996,13 @@ var require_fast_uri = __commonJS({
3958
3996
  const options = Object.assign({}, opts);
3959
3997
  const uriTokens = [];
3960
3998
  if (component.scheme) {
3961
- component.scheme = decodeValidScheme(component.scheme);
3999
+ component.scheme = validateScheme(component.scheme);
3962
4000
  }
3963
4001
  const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
3964
4002
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
3965
4003
  const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
3966
- const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
4004
+ const schemelessReference = (component.scheme === void 0 || options.reference === "suffix") && !hasAuthority;
4005
+ const pathNoScheme = !options.skipEscape && schemelessReference;
3967
4006
  if (component.path !== void 0) {
3968
4007
  if (!options.skipEscape) {
3969
4008
  component.path = serializePathEncoding(component.path, pathNoScheme);
@@ -3972,7 +4011,7 @@ var require_fast_uri = __commonJS({
3972
4011
  }
3973
4012
  }
3974
4013
  if (options.reference !== "suffix" && component.scheme) {
3975
- component.scheme = decodeValidScheme(component.scheme);
4014
+ component.scheme = validateScheme(component.scheme);
3976
4015
  uriTokens.push(component.scheme, ":");
3977
4016
  }
3978
4017
  const authority = recomposeAuthority(component);
@@ -3988,9 +4027,9 @@ var require_fast_uri = __commonJS({
3988
4027
  if (component.path !== void 0) {
3989
4028
  let s = component.path;
3990
4029
  if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
3991
- s = removeDotSegments(s);
4030
+ s = schemelessReference && s[0] !== "/" ? removeDotSegmentsRelative(s) : removeDotSegments(s);
3992
4031
  }
3993
- if (pathNoScheme) {
4032
+ if (schemelessReference) {
3994
4033
  s = serializePathEncoding(s, true);
3995
4034
  }
3996
4035
  if (authority === void 0 && s[0] === "/" && s[1] === "/") {
@@ -4037,16 +4076,34 @@ var require_fast_uri = __commonJS({
4037
4076
  return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
4038
4077
  }
4039
4078
  function canonicalizeHost(parsed, options, schemeHandler, isIP) {
4079
+ if (hasForbiddenDomainHost(parsed, options, schemeHandler, isIP)) {
4080
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4081
+ return true;
4082
+ }
4040
4083
  if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
4084
+ let url;
4041
4085
  try {
4042
- parsed.host = new URL("http://" + parsed.host).hostname;
4086
+ url = new URL("http://" + parsed.host);
4043
4087
  } catch (e) {
4044
4088
  parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
4045
4089
  return true;
4046
4090
  }
4091
+ if (!isHostOnlyURL(url)) {
4092
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4093
+ return true;
4094
+ }
4095
+ parsed.host = url.hostname;
4047
4096
  }
4048
4097
  return false;
4049
4098
  }
4099
+ function hasForbiddenDomainHost(parsed, options, schemeHandler, isIP) {
4100
+ return Boolean(
4101
+ parsed.host && isIP === false && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && FORBIDDEN_DOMAIN_HOST_CHARACTER.test(parsed.host)
4102
+ );
4103
+ }
4104
+ function isHostOnlyURL(url) {
4105
+ return url.username === "" && url.password === "" && url.port === "" && url.pathname === "/" && url.search === "" && url.hash === "" && url.hostname !== "";
4106
+ }
4050
4107
  function parseWithStatus(uri, opts) {
4051
4108
  const options = Object.assign({}, opts);
4052
4109
  const parsed = {
@@ -4101,9 +4158,8 @@ var require_fast_uri = __commonJS({
4101
4158
  parsed.query = matches[7];
4102
4159
  parsed.fragment = matches[8];
4103
4160
  if (parsed.scheme !== void 0) {
4104
- const decodedScheme = unescape(parsed.scheme);
4105
- if (VALID_SCHEME.test(decodedScheme)) {
4106
- parsed.scheme = decodedScheme.toLowerCase();
4161
+ if (VALID_SCHEME.test(parsed.scheme)) {
4162
+ parsed.scheme = parsed.scheme.toLowerCase();
4107
4163
  } else {
4108
4164
  parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
4109
4165
  malformedScheme = true;
@@ -4131,7 +4187,7 @@ var require_fast_uri = __commonJS({
4131
4187
  malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
4132
4188
  parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
4133
4189
  if (malformedIPLiteral) {
4134
- parsed.error = parsed.error || "URI host is malformed.";
4190
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4135
4191
  malformedAuthorityOrPort = true;
4136
4192
  }
4137
4193
  } else {
@@ -4159,7 +4215,7 @@ var require_fast_uri = __commonJS({
4159
4215
  if (!isIP) {
4160
4216
  host = normalizePercentEncoding(host.toLowerCase());
4161
4217
  }
4162
- parsed.host = reescapeHostDelimiters(host, isIP);
4218
+ parsed.host = isIP || options.scheme !== "null" ? reescapeHostDelimiters(host, isIP) : host;
4163
4219
  }
4164
4220
  if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
4165
4221
  if (parsed.path) {
@@ -3343,6 +3343,37 @@ var require_utils = __commonJS({
3343
3343
  }
3344
3344
  return output.join("");
3345
3345
  }
3346
+ function removeDotSegmentsRelative(path3) {
3347
+ if (path3 === "" || path3[0] === "/") {
3348
+ return removeDotSegments(path3);
3349
+ }
3350
+ const segments = path3.split("/");
3351
+ const last = segments.length - 1;
3352
+ const output = [];
3353
+ let trailingDirectory = false;
3354
+ for (let i = 0; i <= last; i++) {
3355
+ const segment = segments[i];
3356
+ if (segment === "." || segment === "..") {
3357
+ if (segment === "..") {
3358
+ if (output.length !== 0 && output[output.length - 1] !== "..") {
3359
+ output.pop();
3360
+ } else {
3361
+ output.push("..");
3362
+ }
3363
+ }
3364
+ trailingDirectory = i === last;
3365
+ } else {
3366
+ output.push(segment);
3367
+ }
3368
+ }
3369
+ if (trailingDirectory && output[output.length - 1] !== "..") {
3370
+ output.push("");
3371
+ }
3372
+ if (output.length === 0 || output[0] === "" || output[0].includes(":")) {
3373
+ output.unshift(".");
3374
+ }
3375
+ return output.join("/");
3376
+ }
3346
3377
  var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
3347
3378
  var HOST_DELIM_RE = /[@/?#:]/g;
3348
3379
  var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
@@ -3603,6 +3634,7 @@ var require_utils = __commonJS({
3603
3634
  encodeFragment,
3604
3635
  escapePreservingEscapes,
3605
3636
  removeDotSegments,
3637
+ removeDotSegmentsRelative,
3606
3638
  isIPv4,
3607
3639
  isUUID,
3608
3640
  normalizeIPv6,
@@ -3826,16 +3858,18 @@ var require_schemes = __commonJS({
3826
3858
  var require_fast_uri = __commonJS({
3827
3859
  "node_modules/fast-uri/index.js"(exports, module) {
3828
3860
  "use strict";
3829
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3861
+ var { normalizeIPv6, removeDotSegments, removeDotSegmentsRelative, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3830
3862
  var { SCHEMES, getSchemeHandler } = require_schemes();
3831
3863
  var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
3832
3864
  var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
3833
- function decodeValidScheme(scheme) {
3834
- const decodedScheme = unescape(String(scheme));
3835
- if (!VALID_SCHEME.test(decodedScheme)) {
3865
+ var MALFORMED_HOST_ERROR = "URI host is malformed.";
3866
+ var FORBIDDEN_DOMAIN_HOST_CHARACTER = /[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;
3867
+ function validateScheme(scheme) {
3868
+ const stringScheme = String(scheme);
3869
+ if (!VALID_SCHEME.test(stringScheme)) {
3836
3870
  throw new TypeError(MALFORMED_SCHEME_ERROR);
3837
3871
  }
3838
- return decodedScheme;
3872
+ return stringScheme;
3839
3873
  }
3840
3874
  function normalize(uri, options) {
3841
3875
  if (typeof uri === "string") {
@@ -3872,6 +3906,9 @@ var require_fast_uri = __commonJS({
3872
3906
  const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
3873
3907
  const resolvedHost = resolved.host;
3874
3908
  const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
3909
+ if (hasForbiddenDomainHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP)) {
3910
+ throw new Error(MALFORMED_HOST_ERROR);
3911
+ }
3875
3912
  canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
3876
3913
  const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost);
3877
3914
  if (resolved.error && !encodedASCIIHost) {
@@ -3913,14 +3950,15 @@ var require_fast_uri = __commonJS({
3913
3950
  if (relative.path[0] === "/") {
3914
3951
  target.path = removeDotSegments(relative.path);
3915
3952
  } else {
3916
- if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
3953
+ const baseHasAuthority = base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0;
3954
+ if (baseHasAuthority && !base.path) {
3917
3955
  target.path = "/" + relative.path;
3918
3956
  } else if (!base.path) {
3919
3957
  target.path = relative.path;
3920
3958
  } else {
3921
3959
  target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
3922
3960
  }
3923
- target.path = removeDotSegments(target.path);
3961
+ target.path = base.scheme === void 0 && !baseHasAuthority && target.path[0] !== "/" ? removeDotSegmentsRelative(target.path) : removeDotSegments(target.path);
3924
3962
  }
3925
3963
  target.query = relative.query;
3926
3964
  }
@@ -3958,12 +3996,13 @@ var require_fast_uri = __commonJS({
3958
3996
  const options = Object.assign({}, opts);
3959
3997
  const uriTokens = [];
3960
3998
  if (component.scheme) {
3961
- component.scheme = decodeValidScheme(component.scheme);
3999
+ component.scheme = validateScheme(component.scheme);
3962
4000
  }
3963
4001
  const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
3964
4002
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
3965
4003
  const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
3966
- const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
4004
+ const schemelessReference = (component.scheme === void 0 || options.reference === "suffix") && !hasAuthority;
4005
+ const pathNoScheme = !options.skipEscape && schemelessReference;
3967
4006
  if (component.path !== void 0) {
3968
4007
  if (!options.skipEscape) {
3969
4008
  component.path = serializePathEncoding(component.path, pathNoScheme);
@@ -3972,7 +4011,7 @@ var require_fast_uri = __commonJS({
3972
4011
  }
3973
4012
  }
3974
4013
  if (options.reference !== "suffix" && component.scheme) {
3975
- component.scheme = decodeValidScheme(component.scheme);
4014
+ component.scheme = validateScheme(component.scheme);
3976
4015
  uriTokens.push(component.scheme, ":");
3977
4016
  }
3978
4017
  const authority = recomposeAuthority(component);
@@ -3988,9 +4027,9 @@ var require_fast_uri = __commonJS({
3988
4027
  if (component.path !== void 0) {
3989
4028
  let s = component.path;
3990
4029
  if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
3991
- s = removeDotSegments(s);
4030
+ s = schemelessReference && s[0] !== "/" ? removeDotSegmentsRelative(s) : removeDotSegments(s);
3992
4031
  }
3993
- if (pathNoScheme) {
4032
+ if (schemelessReference) {
3994
4033
  s = serializePathEncoding(s, true);
3995
4034
  }
3996
4035
  if (authority === void 0 && s[0] === "/" && s[1] === "/") {
@@ -4037,16 +4076,34 @@ var require_fast_uri = __commonJS({
4037
4076
  return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
4038
4077
  }
4039
4078
  function canonicalizeHost(parsed, options, schemeHandler, isIP) {
4079
+ if (hasForbiddenDomainHost(parsed, options, schemeHandler, isIP)) {
4080
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4081
+ return true;
4082
+ }
4040
4083
  if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
4084
+ let url;
4041
4085
  try {
4042
- parsed.host = new URL("http://" + parsed.host).hostname;
4086
+ url = new URL("http://" + parsed.host);
4043
4087
  } catch (e) {
4044
4088
  parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
4045
4089
  return true;
4046
4090
  }
4091
+ if (!isHostOnlyURL(url)) {
4092
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4093
+ return true;
4094
+ }
4095
+ parsed.host = url.hostname;
4047
4096
  }
4048
4097
  return false;
4049
4098
  }
4099
+ function hasForbiddenDomainHost(parsed, options, schemeHandler, isIP) {
4100
+ return Boolean(
4101
+ parsed.host && isIP === false && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && FORBIDDEN_DOMAIN_HOST_CHARACTER.test(parsed.host)
4102
+ );
4103
+ }
4104
+ function isHostOnlyURL(url) {
4105
+ return url.username === "" && url.password === "" && url.port === "" && url.pathname === "/" && url.search === "" && url.hash === "" && url.hostname !== "";
4106
+ }
4050
4107
  function parseWithStatus(uri, opts) {
4051
4108
  const options = Object.assign({}, opts);
4052
4109
  const parsed = {
@@ -4101,9 +4158,8 @@ var require_fast_uri = __commonJS({
4101
4158
  parsed.query = matches[7];
4102
4159
  parsed.fragment = matches[8];
4103
4160
  if (parsed.scheme !== void 0) {
4104
- const decodedScheme = unescape(parsed.scheme);
4105
- if (VALID_SCHEME.test(decodedScheme)) {
4106
- parsed.scheme = decodedScheme.toLowerCase();
4161
+ if (VALID_SCHEME.test(parsed.scheme)) {
4162
+ parsed.scheme = parsed.scheme.toLowerCase();
4107
4163
  } else {
4108
4164
  parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
4109
4165
  malformedScheme = true;
@@ -4131,7 +4187,7 @@ var require_fast_uri = __commonJS({
4131
4187
  malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
4132
4188
  parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
4133
4189
  if (malformedIPLiteral) {
4134
- parsed.error = parsed.error || "URI host is malformed.";
4190
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4135
4191
  malformedAuthorityOrPort = true;
4136
4192
  }
4137
4193
  } else {
@@ -4159,7 +4215,7 @@ var require_fast_uri = __commonJS({
4159
4215
  if (!isIP) {
4160
4216
  host = normalizePercentEncoding(host.toLowerCase());
4161
4217
  }
4162
- parsed.host = reescapeHostDelimiters(host, isIP);
4218
+ parsed.host = isIP || options.scheme !== "null" ? reescapeHostDelimiters(host, isIP) : host;
4163
4219
  }
4164
4220
  if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
4165
4221
  if (parsed.path) {
@@ -214,9 +214,10 @@ function placeholder(key, field) {
214
214
  return `# ${toYaml({ [key]: fallback }).trimEnd().split("\n").join("\n# ")}`;
215
215
  }
216
216
  const PERSONA_HEADER = [
217
- "# The persona: who the assistant is, shared by every agent of this solution (an agent's",
218
- "# system_prompt says what that agent does). A commented field is not set; remove its #",
219
- "# to set it. Write the greeting and fallback texts in the language the assistant answers in.",
217
+ "# The persona: who the assistant is. Every agent takes these rules unless its",
218
+ "# response_rules turn individual rules off or skip_persona turns them all off.",
219
+ "# An agent's system_prompt says what it does. A commented field is not set; remove",
220
+ "# its # to set it. Write greeting and fallback texts in the language the assistant answers in.",
220
221
  ];
221
222
  export function personaYaml(value, fields) {
222
223
  const set = isObject(value) ? value : {};
@@ -11,6 +11,13 @@ format as a JSON Schema; `cavelon` splits it along that schema's top-level
11
11
  sections, so the files follow whatever the instance version defines. Do not
12
12
  assume a section or field exists: check the schema or the docs first.
13
13
 
14
+ Before reading from or changing the instance, follow cavelon-loop's connection
15
+ readiness check: discover the actual session's tools and call `whoami`.
16
+ Tell the person if tools, login or instance access fail; announce any CLI
17
+ fallback and check its `whoami`. Local authoring can continue without live
18
+ verification. Loaded skills alone do not establish a working connection.
19
+ An intentionally CLI-only setup checks `cavelon whoami --json` directly.
20
+
14
21
  ## New solutions: make the Canvas useful
15
22
 
16
23
  For a new ordinary chat or trigger solution, include its connected **Chat
@@ -205,7 +212,7 @@ with `cavelon harness default`).
205
212
  Every solution has a persona in `package/persona.yaml`. It is not an agent's
206
213
  instructions:
207
214
 
208
- - **The persona says who** the assistant is, for every agent of the solution:
215
+ - **The persona says who** the assistant is; agents inherit its rules by default:
209
216
  its name (`bot_name`), its voice and its boundaries (`persona_prompt`), the
210
217
  greeting a conversation opens with and the fallback it gives when it has no
211
218
  answer, its language (`language_hint`), response style, disclaimer and the
@@ -261,6 +268,22 @@ and fill the field in to set it. A file of comments only sets nothing.
261
268
  in a solution folder, `cavelon api` sends the folder's solution, and says
262
269
  so. Prefer the package file and `apply` over those operations.
263
270
 
271
+ ## Response rules by role
272
+
273
+ Check `cavelon schema persona` and `cavelon schema agents` first: older
274
+ instances do not publish these settings. An answering agent inherits all
275
+ persona rules by leaving `response_rules` unset. A consulted agent keeps
276
+ `citations: inherit` and turns every other response rule off. A structured or
277
+ internal agent uses `skip_persona: true`, which wins over individual overrides.
278
+ Do not simplify intermediate results that another agent or node consumes.
279
+
280
+ For `persona.plain_language`, choose `off` for ordinary wording, `on_request`
281
+ for simplification when asked, `auto` for a mixed audience, `lay` for general
282
+ readers or `expert` for specialists who still need clear language. Read
283
+ [Response rules and plain language](references/response-rules.md) when
284
+ setting them: it has the consulted-agent map, override semantics and a test
285
+ suite with a style judge criterion and a report-only long-sentence assertion.
286
+
264
287
  ## A chat turn's wait for attached files
265
288
 
266
289
  A solution sets how long a chat turn waits for a file it carries that is still
@@ -0,0 +1,94 @@
1
+ # Response rules and plain language
2
+
3
+ The persona supplies the shared response rules. An agent's `response_rules`
4
+ is a sparse map: an absent key or `inherit` takes the persona's rule, and
5
+ `off` disables that rule. `{}` inherits everything. `skip_persona: true`
6
+ turns every rule off and wins over the map; use it for structured JSON and
7
+ internal pipeline agents. An agent answering a person normally leaves both
8
+ settings unset.
9
+
10
+ For a consulted agent that returns evidence to the answering agent, keep the
11
+ citations and turn the other rules off in its entry in `package/agents.yaml`:
12
+
13
+ ```yaml
14
+ response_rules:
15
+ identity: off
16
+ citations: inherit
17
+ images: off
18
+ action_buttons: off
19
+ response_style: off
20
+ language_hint: off
21
+ plain_language: off
22
+ ```
23
+
24
+ Check the current map's keys in `cavelon schema agents` before authoring it.
25
+ `response_style` can also select a preset, for example
26
+ `{preset: concise}` (`balanced`, `detailed`, `conversational` and `formal`
27
+ are the other presets). `language_hint` can override with a language code;
28
+ `plain_language` can override with one of the levels below. The map is open
29
+ in the package schema: the instance's import preview validates its rule
30
+ values. A `config_invalid` blocker names `agents[i].response_rules`; correct
31
+ that entry before confirming.
32
+
33
+ ## Choose plain language
34
+
35
+ Set the solution's level in `package/persona.yaml`, for example:
36
+
37
+ ```yaml
38
+ plain_language: on_request
39
+ ```
40
+
41
+ | Level | Choose it when |
42
+ |---|---|
43
+ | `off` | The assistant should use ordinary wording without a plain-language instruction. This is the default. |
44
+ | `on_request` | People should be able to ask for a simpler explanation; until then, wording stays ordinary. |
45
+ | `auto` | The audience varies: the instance judges the reader once from the first messages. Test both general and specialist openings. |
46
+ | `lay` | The answer is for general readers: explain specialist terms and use short, direct sentences. |
47
+ | `expert` | Specialists need precise terminology in clear, direct prose. |
48
+
49
+ The instance composes the DIN 8581 plain-language instructions, ASD-STE100
50
+ guidance for technical content and an email layout for emails. Apply this
51
+ to the agent answering the person; consulted agents and pipeline stages
52
+ feeding another node should not simplify their intermediate output.
53
+
54
+ Omitting `plain_language` or an agent's `response_rules` on import preserves
55
+ the instance's saved value. To turn plain language off explicitly, set `off`;
56
+ to reset per-agent overrides to inheritance, set `{}`. A pull from an older
57
+ instance cannot be used to reset a newer instance's saved settings.
58
+
59
+ ## Check the wording with a suite
60
+
61
+ Add a case to a suite in `tests/`. Test the intended level, and for
62
+ `on_request` also test a follow-up asking for a simpler explanation. A style
63
+ judge criterion checks clarity and meaning; sentence length alone does not
64
+ prove either. For example, for the support FAQ:
65
+
66
+ ```yaml
67
+ test_cases:
68
+ - name: Explain returns in plain language
69
+ steps:
70
+ - user_message: Please explain in simple words how I return an order.
71
+ evaluation_criteria:
72
+ - text: Uses short, direct sentences and familiar words, explains necessary terms and preserves the return policy's facts.
73
+ dimension: style
74
+ - type: must_not_contain
75
+ label: Long sentence (26 or more words; heuristic)
76
+ value: '\b[^\s.!?]+(?:\s+[^\s.!?]+){25}\b'
77
+ match: regex
78
+ scope: model_answer
79
+ gate: false
80
+ ```
81
+
82
+ The assertion is report-only (`gate: false`): it is evaluated and shown, but
83
+ its failure does not fail the step. `scope: model_answer` leaves out text the
84
+ instance appends, such as a sources list. The regex is a rough signal:
85
+ abbreviations, lists and punctuation can skew it. Review the actual answer
86
+ and the judge's reasoning in `cavelon trace <run>`.
87
+
88
+ Run `cavelon validate`, preview and confirm `cavelon apply`, then
89
+ `cavelon test run --suite <name> --wait` and read the trace. Check
90
+ `cavelon schema test_suites.test_cases.steps.evaluation_criteria` before using
91
+ `gate` and `scope`. An older instance without the response-rule fields warns
92
+ `package_field_unknown` and lists them as ignored in the apply preview; do
93
+ not claim the settings took effect there. Wait for an instance that publishes
94
+ them, or omit them for that target.
@@ -6,6 +6,13 @@ license: Apache-2.0
6
6
 
7
7
  # Long-running work: loops and Sandboxes
8
8
 
9
+ Before instance work, follow cavelon-loop's connection readiness check:
10
+ discover this session's Cavelon tools and call `whoami`. Report unavailable
11
+ tools, login or instance access with a repair step; announce CLI fallback and
12
+ check its `whoami` too. A disconnected session is not evidence that a loop is
13
+ stopped or a job failed. Loaded skills do not establish a working connection.
14
+ An intentionally CLI-only setup checks `cavelon whoami --json` directly.
15
+
9
16
  A **Masterloop** node runs one solution again and again in bounded iterations
10
17
  until its check passes, its budget or deadline runs out, or a person stops it.
11
18
  Each iteration returns `continue`, `wait`, `done` or `blocked`. A loop starts
@@ -13,6 +13,16 @@ use it when you parse the result.
13
13
 
14
14
  ## Before anything
15
15
 
16
+ - **Verify the connection before instance work.** Discover this session's
17
+ Cavelon tools (use the client's tool search if deferred), then call
18
+ `whoami` for the selected solution folder. Loaded skills do not establish
19
+ connectivity. Tell the person immediately if the tools are unavailable,
20
+ login is missing or the instance cannot be reached, with a repair step.
21
+ Announce CLI fallback explicitly and check its `whoami` too. See
22
+ [connection readiness](references/connection-readiness.md) for diagnosis,
23
+ recovery and when to repeat the check. An intentionally CLI-only client
24
+ starts with `cavelon whoami --json` instead, without a missing-MCP warning.
25
+ Local authoring may continue.
16
26
  - **Select the local solution folder.** In a repository with several solutions,
17
27
  pass `solution_dir`, such as `solutions/review`, on MCP calls. It resolves
18
28
  inside the server's startup workspace and selects that folder's
@@ -39,10 +49,12 @@ use it when you parse the result.
39
49
  person who does it (the description says who), as for a secret. Where the
40
50
  instance does not say (an older one), try, and a refusal names what the
41
51
  credential lacks.
42
- - **Never handle a token.** If a command exits 7 (not authorised) or says no
43
- token, ask the person to run `cavelon login --instance <url>` themselves (in a
44
- terminal, or with a `!` prefix where your client offers one). Never ask them
45
- to paste a token to you, and never put one in a file or an argument.
52
+ - **Never handle a token.** A missing, expired or revoked credential needs
53
+ `cavelon login --instance <url>`, run by the person in their own terminal
54
+ (or with a `!` prefix where the client offers one). Exit 7 can also mean a
55
+ permission or tenant refusal: follow its role/target guidance rather than
56
+ requesting another login. Never ask for a token or put one in a file or
57
+ an argument.
46
58
  - **Secrets are set by a person.** When a preview or `cavelon secrets list`
47
59
  names a secret that is not set, tell the person the exact command to run in
48
60
  their terminal, `cavelon secrets set <name>` (as `apply` prints it, with its
@@ -200,7 +212,9 @@ in a pinned recovery snapshot and clears the draft; report its warnings.
200
212
  agent alone leaves the Canvas debug entry incomplete. Follow the
201
213
  authoring skill's Canvas entrypoints reference, including its Masterloop
202
214
  iteration exceptions. This does not activate a trigger or run its demo.
203
- 3. **Validate** offline: `cavelon validate`. Fix every error; `cavelon explain
215
+ 3. **Validate** the package: `cavelon validate`. Use `--offline` when the
216
+ instance must not be contacted; it uses cached metadata and reports checks
217
+ it cannot make. Fix every error; `cavelon explain
204
218
  <code>` says what a code means and how to fix it. Besides the schema it
205
219
  finds duplicate slugs, handoffs and test assertions naming an agent the
206
220
  package lacks, fields the schema does not have (with "did you mean"), and