@senticor/hive 1.41.2 → 1.42.1

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.
Files changed (2) hide show
  1. package/hive.cjs +87 -17
  2. package/package.json +1 -1
package/hive.cjs CHANGED
@@ -8558,9 +8558,41 @@ var CliCommandError = class extends Error {
8558
8558
  function commandError(symbolicCode, exitCode, message, options) {
8559
8559
  return new CliCommandError(symbolicCode, exitCode, message, options);
8560
8560
  }
8561
- function remoteFailureRemediation(data) {
8561
+ function remoteErrorFields(data) {
8562
8562
  const body = data ?? {};
8563
- const code = String(body.error || body.code || "").trim().toUpperCase();
8563
+ const raw = body.error;
8564
+ if (raw && typeof raw === "object") {
8565
+ const nested = raw;
8566
+ return {
8567
+ code: String(nested.code ?? "").trim(),
8568
+ message: String(nested.message ?? "").trim()
8569
+ };
8570
+ }
8571
+ return {
8572
+ code: String(raw || body.code || "").trim(),
8573
+ message: String(body.message || "").trim()
8574
+ };
8575
+ }
8576
+ function fieldText(value) {
8577
+ if (value === null || value === void 0) return "";
8578
+ if (typeof value === "object") {
8579
+ try {
8580
+ const json2 = JSON.stringify(value);
8581
+ return json2 && json2 !== "{}" && json2 !== "[]" ? json2 : "";
8582
+ } catch {
8583
+ return "";
8584
+ }
8585
+ }
8586
+ return String(value).trim();
8587
+ }
8588
+ function schemaErrorFields(data) {
8589
+ const errors = data?.schemaErrors;
8590
+ if (!Array.isArray(errors)) return [];
8591
+ const paths = errors.map((entry) => String(entry?.instancePath ?? "").trim()).filter(Boolean).map((path9) => path9.replace(/^\//, ""));
8592
+ return [...new Set(paths)];
8593
+ }
8594
+ function remoteFailureRemediation(data) {
8595
+ const code = remoteErrorFields(data).code.toUpperCase();
8564
8596
  if (code === "TENANT_NOT_ALLOWED") {
8565
8597
  return "The requested tenant is not in your active memberships. For platform-admin operations (org/mission create) omit --tenant / HIVE_TENANT. If the tenant is saved in CLI config, run 'hive config clear --tenant'; then run 'hive diag authz' to list memberships and optionally pin one with 'hive config use --tenant=<displayKey>'.";
8566
8598
  }
@@ -8571,7 +8603,10 @@ function remoteFailureRemediation(data) {
8571
8603
  }
8572
8604
  function remoteFailureText(data) {
8573
8605
  const body = data;
8574
- const parts = [body?.error, body?.message, body?.detail].map((value) => String(value || "").trim()).filter(Boolean);
8606
+ const { code, message } = remoteErrorFields(data);
8607
+ const parts = [code, message, fieldText(body?.detail)].filter(Boolean);
8608
+ const fields = schemaErrorFields(data);
8609
+ if (fields.length) parts.push(`(offending field${fields.length > 1 ? "s" : ""}: ${fields.join(", ")})`);
8575
8610
  return [...new Set(parts)].join(": ") || "unexpected response";
8576
8611
  }
8577
8612
  function toStructuredError(err) {
@@ -8630,9 +8665,7 @@ function installRemoteFailureExit() {
8630
8665
  if (code !== EXIT_OK) return;
8631
8666
  const failure = pendingRemoteFailure();
8632
8667
  if (!failure) return;
8633
- const body = failure.body ?? {};
8634
- const bodyCode = String(body.error || body.code || "").trim();
8635
- const symbolic = bodyCode || remoteFailureCode(failure.status);
8668
+ const symbolic = remoteErrorFields(failure.body).code || remoteFailureCode(failure.status);
8636
8669
  const remediation = remoteFailureRemediation(failure.body) ?? (failure.status === 401 ? "Run 'hive login' to authenticate, or set HIVE_TOKEN." : void 0);
8637
8670
  const message = `${failure.method} ${failure.path} failed${failure.status ? ` (HTTP ${failure.status})` : ""}: ${remoteFailureText(failure.body)}`;
8638
8671
  if (isJsonMode()) {
@@ -9121,22 +9154,22 @@ var artifactName = injectedString(
9121
9154
  true ? "hive-cli" : void 0
9122
9155
  ) || String(process.env.HIVE_CLI_ARTIFACT_NAME || "hive-cli").trim() || "hive-cli";
9123
9156
  var packageVersion = injectedString(
9124
- true ? "1.41.2" : void 0
9157
+ true ? "1.42.1" : void 0
9125
9158
  ) || String(process.env.HIVE_CLI_PACKAGE_VERSION || "").trim() || readPackageVersion();
9126
9159
  var releaseVersion = injectedString(
9127
- true ? "1.41.2" : void 0
9160
+ true ? "1.42.1" : void 0
9128
9161
  ) || String(process.env.HIVE_CLI_RELEASE_VERSION || "").trim() || packageVersion || "dev";
9129
9162
  var releaseChannel = injectedString(
9130
9163
  true ? "final" : void 0
9131
9164
  ) || String(process.env.HIVE_CLI_RELEASE_CHANNEL || "").trim() || (releaseVersion.includes("-rc.") ? "rc" : releaseVersion === "dev" ? "dev" : "final");
9132
9165
  var buildCommit = injectedString(
9133
- true ? "033cb2fd56c2427d77ed43bf077370ccd57025e5" : void 0
9166
+ true ? "13c162232e544bfb80b687d2086ba9b9c573330f" : void 0
9134
9167
  ) || String(process.env.HIVE_CLI_BUILD_COMMIT || "").trim() || "unknown";
9135
9168
  var buildTimestamp = injectedString(
9136
- true ? "2026-09-21T15:39:14Z" : void 0
9169
+ true ? "2026-09-22T12:45:17Z" : void 0
9137
9170
  ) || String(process.env.HIVE_CLI_BUILD_TIMESTAMP || "").trim() || "unknown";
9138
9171
  var ociRef = injectedString(
9139
- true ? "registry.onstackit.cloud/senticor/hive-cli:1.41.2" : void 0
9172
+ true ? "registry.onstackit.cloud/senticor/hive-cli:1.42.1" : void 0
9140
9173
  ) || String(process.env.HIVE_CLI_OCI_REF || "").trim() || `registry.onstackit.cloud/senticor/${artifactName}:${releaseVersion}`;
9141
9174
  var RELEASE_INFO = Object.freeze({
9142
9175
  packageVersion,
@@ -25926,6 +25959,8 @@ var orgArgs = withArgs({
25926
25959
  kind: { type: "string", description: "Tenant kind: organization | customer (default organization)" },
25927
25960
  corsOrigin: { type: "string", description: "Allowed CORS origin, e.g. https://workbench.example" },
25928
25961
  frontendUrl: { type: "string", description: "Frontend URL for this tenant" },
25962
+ clearCorsOrigin: { type: "boolean", description: "Clear this tenant's stored corsOrigin (sends an explicit null)" },
25963
+ clearFrontendUrl: { type: "boolean", description: "Clear this tenant's stored frontendUrl (sends an explicit null)" },
25929
25964
  ownerPrincipalId: { type: "string", description: "UUID of the owning principal" },
25930
25965
  email: { type: "string", description: "Principal/user email" },
25931
25966
  displayName: { type: "string", description: "Principal display name" },
@@ -25947,6 +25982,43 @@ function ensureOk(status2, data, action) {
25947
25982
  remediation ? { remediation } : void 0
25948
25983
  );
25949
25984
  }
25985
+ function applyRuntimeConfig(args, body) {
25986
+ for (const [flag, clearFlag, key] of [
25987
+ ["corsOrigin", "clearCorsOrigin", "corsOrigin"],
25988
+ ["frontendUrl", "clearFrontendUrl", "frontendUrl"]
25989
+ ]) {
25990
+ const value = args[flag];
25991
+ const clear = args[clearFlag] === true;
25992
+ const kebab = key === "corsOrigin" ? "cors-origin" : "frontend-url";
25993
+ if (clear && value) {
25994
+ throw commandError(
25995
+ "CONFLICTING_ARGS",
25996
+ EXIT_GUARDRAIL,
25997
+ `--${kebab} and --clear-${kebab} are mutually exclusive \u2014 pass one or the other.`
25998
+ );
25999
+ }
26000
+ if (clear) {
26001
+ body[key] = null;
26002
+ continue;
26003
+ }
26004
+ if (typeof value === "string" && value.trim() === "") {
26005
+ throw commandError(
26006
+ "AMBIGUOUS_EMPTY_VALUE",
26007
+ EXIT_GUARDRAIL,
26008
+ `--${kebab} was given an empty value, which the API reads as 'not supplied' \u2014 it would report success and change nothing. Use --clear-${kebab} to clear the stored value, or pass a real value.`
26009
+ );
26010
+ }
26011
+ if (value) body[key] = value;
26012
+ }
26013
+ }
26014
+ function warnIgnoredRuntimeConfig(data) {
26015
+ const report = data?.runtimeConfig;
26016
+ const ignored = Array.isArray(report?.ignoredEmpty) ? report.ignoredEmpty : [];
26017
+ if (!ignored.length) return;
26018
+ console.error(
26019
+ `Warning: the server ignored ${ignored.join(", ")} (sent as an empty string) and left the stored value unchanged. Use --clear-cors-origin / --clear-frontend-url to clear a field.`
26020
+ );
26021
+ }
25950
26022
  function tenantDisplayKey(args) {
25951
26023
  const key = String(args.displayKey || args.tenantKey || args.tenant || "").trim() || void 0;
25952
26024
  if (key) assertCanonicalTenantSelector(key, "tenant display key");
@@ -26052,8 +26124,7 @@ var org = defineCommand({
26052
26124
  kind: args.kind || "organization",
26053
26125
  displayKey: args.displayKey
26054
26126
  };
26055
- if (args.corsOrigin) body.corsOrigin = args.corsOrigin;
26056
- if (args.frontendUrl) body.frontendUrl = args.frontendUrl;
26127
+ applyRuntimeConfig(args, body);
26057
26128
  if (args.ownerPrincipalId) body.ownerPrincipalId = args.ownerPrincipalId;
26058
26129
  const requestedKind = String(body.kind || "organization").trim();
26059
26130
  let res;
@@ -26088,6 +26159,7 @@ var org = defineCommand({
26088
26159
  }
26089
26160
  }
26090
26161
  ensureOk(res.status, res.data, "create tenant");
26162
+ warnIgnoredRuntimeConfig(res.data);
26091
26163
  const tenant = recordOf2(recordOf2(res.data).tenant);
26092
26164
  const pinKey = canonicalPinKey(tenant);
26093
26165
  const pinnable = Boolean(args.pin && pinKey);
@@ -26194,8 +26266,7 @@ var org = defineCommand({
26194
26266
  const kind = String(args.kind || "organization").trim();
26195
26267
  const { client, fmt } = ctx(args);
26196
26268
  const createBody = { kind, displayKey: args.displayKey };
26197
- if (args.corsOrigin) createBody.corsOrigin = args.corsOrigin;
26198
- if (args.frontendUrl) createBody.frontendUrl = args.frontendUrl;
26269
+ applyRuntimeConfig(args, createBody);
26199
26270
  if (args.ownerPrincipalId) createBody.ownerPrincipalId = args.ownerPrincipalId;
26200
26271
  let reusedTenant = false;
26201
26272
  let tenant;
@@ -28511,12 +28582,11 @@ var Ajv2 = ajvModule2.default ?? ajvModule2;
28511
28582
  var addFormats2 = ajvFormatsModule2.default ?? ajvFormatsModule2;
28512
28583
  function assertRemoteOk2(status2, data, action) {
28513
28584
  if (status2 && status2 >= 200 && status2 < 300) return;
28514
- const body = data;
28515
28585
  const remediation = remoteFailureRemediation(data);
28516
28586
  throw commandError(
28517
28587
  "REMOTE_FAILED",
28518
28588
  3,
28519
- `${action} failed${status2 ? ` (HTTP ${status2})` : ""}: ${body?.error || body?.message || body?.detail || "unexpected response"}${remediation ? ` \u2014 ${remediation}` : ""}`,
28589
+ `${action} failed${status2 ? ` (HTTP ${status2})` : ""}: ${remoteFailureText(data)}${remediation ? ` \u2014 ${remediation}` : ""}`,
28520
28590
  remediation ? { remediation } : void 0
28521
28591
  );
28522
28592
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@senticor/hive",
3
- "version": "1.41.2",
3
+ "version": "1.42.1",
4
4
  "description": "Cognitive Hive OS — unified CLI",
5
5
  "type": "commonjs",
6
6
  "bin": {