@senticor/hive 1.174.0 → 1.175.0

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 +321 -115
  2. package/package.json +1 -1
package/hive.cjs CHANGED
@@ -3303,8 +3303,8 @@ var require_utils = __commonJS({
3303
3303
  }
3304
3304
  return ind;
3305
3305
  }
3306
- function removeDotSegments(path10) {
3307
- let input2 = path10;
3306
+ function removeDotSegments(path11) {
3307
+ let input2 = path11;
3308
3308
  const output3 = [];
3309
3309
  let nextSlash = -1;
3310
3310
  let len = 0;
@@ -3714,8 +3714,8 @@ var require_schemes = __commonJS({
3714
3714
  }
3715
3715
  if (wsComponent.resourceName) {
3716
3716
  const queryIndex = wsComponent.resourceName.indexOf("?");
3717
- const path10 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
3718
- wsComponent.path = path10 && path10 !== "/" ? path10 : void 0;
3717
+ const path11 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
3718
+ wsComponent.path = path11 && path11 !== "/" ? path11 : void 0;
3719
3719
  wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
3720
3720
  wsComponent.resourceName = void 0;
3721
3721
  }
@@ -3774,7 +3774,7 @@ var require_schemes = __commonJS({
3774
3774
  urnComponent.nss = (uuidComponent.uuid || "").toLowerCase();
3775
3775
  return urnComponent;
3776
3776
  }
3777
- var http3 = (
3777
+ var http4 = (
3778
3778
  /** @type {SchemeHandler} */
3779
3779
  {
3780
3780
  scheme: "http",
@@ -3783,11 +3783,11 @@ var require_schemes = __commonJS({
3783
3783
  serialize: httpSerialize
3784
3784
  }
3785
3785
  );
3786
- var https3 = (
3786
+ var https4 = (
3787
3787
  /** @type {SchemeHandler} */
3788
3788
  {
3789
3789
  scheme: "https",
3790
- domainHost: http3.domainHost,
3790
+ domainHost: http4.domainHost,
3791
3791
  parse: httpParse,
3792
3792
  serialize: httpSerialize
3793
3793
  }
@@ -3831,8 +3831,8 @@ var require_schemes = __commonJS({
3831
3831
  var SCHEMES = (
3832
3832
  /** @type {Record<SchemeName, SchemeHandler>} */
3833
3833
  {
3834
- http: http3,
3835
- https: https3,
3834
+ http: http4,
3835
+ https: https4,
3836
3836
  ws,
3837
3837
  wss,
3838
3838
  urn,
@@ -8112,12 +8112,12 @@ var require_dist = __commonJS({
8112
8112
  throw new Error(`Unknown format "${name}"`);
8113
8113
  return f;
8114
8114
  };
8115
- function addFormats3(ajv, list, fs9, exportName) {
8115
+ function addFormats3(ajv, list, fs10, exportName) {
8116
8116
  var _a3;
8117
8117
  var _b;
8118
8118
  (_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
8119
8119
  for (const f of list)
8120
- ajv.addFormat(f, fs9[f]);
8120
+ ajv.addFormat(f, fs10[f]);
8121
8121
  }
8122
8122
  module2.exports = exports2 = formatsPlugin;
8123
8123
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -9599,7 +9599,7 @@ function fieldText(value) {
9599
9599
  function schemaErrorFields(data) {
9600
9600
  const errors = data?.schemaErrors;
9601
9601
  if (!Array.isArray(errors)) return [];
9602
- const paths = errors.map((entry) => String(entry?.instancePath ?? "").trim()).filter(Boolean).map((path10) => path10.replace(/^\//, ""));
9602
+ const paths = errors.map((entry) => String(entry?.instancePath ?? "").trim()).filter(Boolean).map((path11) => path11.replace(/^\//, ""));
9603
9603
  return [...new Set(paths)];
9604
9604
  }
9605
9605
  function remoteFailureRemediation(data, request) {
@@ -9839,8 +9839,8 @@ var HiveClient = class {
9839
9839
  return commandError(t.symbolic, t.code, `${t.message} To go on without the stored login, run 'hive logout' or set HIVE_TOKEN.`, cause === void 0 ? void 0 : { cause });
9840
9840
  }
9841
9841
  /** Low-level request helper (no external deps, uses Node built-ins) */
9842
- async _request(method, path10, body) {
9843
- const url2 = new import_node_url2.URL(path10, this.baseUrl);
9842
+ async _request(method, path11, body) {
9843
+ const url2 = new import_node_url2.URL(path11, this.baseUrl);
9844
9844
  const mod = url2.protocol === "https:" ? import_node_https2.default : import_node_http2.default;
9845
9845
  const headers = await this._baseHeaders("application/json, application/problem+json");
9846
9846
  let payload = null;
@@ -9870,7 +9870,7 @@ var HiveClient = class {
9870
9870
  `);
9871
9871
  }
9872
9872
  if (!isHttpOk(res.statusCode)) {
9873
- recordRemoteFailure({ method, path: path10, status: res.statusCode, body: data });
9873
+ recordRemoteFailure({ method, path: path11, status: res.statusCode, body: data });
9874
9874
  }
9875
9875
  resolve3({ status: res.statusCode, data });
9876
9876
  });
@@ -9886,8 +9886,8 @@ var HiveClient = class {
9886
9886
  * (a mission export, a document's bytes). Sends the same tenant and auth
9887
9887
  * headers. The caller reads or discards `body` and reports failures itself.
9888
9888
  */
9889
- async getRaw(path10) {
9890
- const url2 = new import_node_url2.URL(path10, this.baseUrl);
9889
+ async getRaw(path11) {
9890
+ const url2 = new import_node_url2.URL(path11, this.baseUrl);
9891
9891
  const mod = url2.protocol === "https:" ? import_node_https2.default : import_node_http2.default;
9892
9892
  const headers = await this._baseHeaders("*/*, application/problem+json");
9893
9893
  if (this.verbose) process.stderr.write(`\u2192 GET ${url2.href} (stream)
@@ -9902,20 +9902,20 @@ var HiveClient = class {
9902
9902
  req2.end();
9903
9903
  });
9904
9904
  }
9905
- get(path10) {
9906
- return this._request("GET", path10);
9905
+ get(path11) {
9906
+ return this._request("GET", path11);
9907
9907
  }
9908
- post(path10, body) {
9909
- return this._request("POST", path10, body || {});
9908
+ post(path11, body) {
9909
+ return this._request("POST", path11, body || {});
9910
9910
  }
9911
- put(path10, body) {
9912
- return this._request("PUT", path10, body || {});
9911
+ put(path11, body) {
9912
+ return this._request("PUT", path11, body || {});
9913
9913
  }
9914
- patch(path10, body) {
9915
- return this._request("PATCH", path10, body || {});
9914
+ patch(path11, body) {
9915
+ return this._request("PATCH", path11, body || {});
9916
9916
  }
9917
- del(path10) {
9918
- return this._request("DELETE", path10);
9917
+ del(path11) {
9918
+ return this._request("DELETE", path11);
9919
9919
  }
9920
9920
  };
9921
9921
 
@@ -10313,11 +10313,11 @@ function parseBoolish(value) {
10313
10313
  }
10314
10314
  function readTlsKeysFromEnvFile(file2) {
10315
10315
  const out = {};
10316
- const path10 = cleanString(file2);
10317
- if (!path10) return out;
10316
+ const path11 = cleanString(file2);
10317
+ if (!path11) return out;
10318
10318
  let text;
10319
10319
  try {
10320
- text = import_node_fs3.default.readFileSync(path10, "utf-8");
10320
+ text = import_node_fs3.default.readFileSync(path11, "utf-8");
10321
10321
  } catch {
10322
10322
  return out;
10323
10323
  }
@@ -10590,8 +10590,8 @@ function resolvePrincipal(args) {
10590
10590
  }
10591
10591
  return email3 ? { principalEmail: email3.toLowerCase() } : { principalSub: sub };
10592
10592
  }
10593
- function dryRunResult(method, path10, body) {
10594
- return body === void 0 ? { dryRun: true, method, path: path10 } : { dryRun: true, method, path: path10, body };
10593
+ function dryRunResult(method, path11, body) {
10594
+ return body === void 0 ? { dryRun: true, method, path: path11 } : { dryRun: true, method, path: path11, body };
10595
10595
  }
10596
10596
  function runScript(script) {
10597
10597
  try {
@@ -10636,22 +10636,22 @@ var artifactName = injectedString(
10636
10636
  true ? "hive-cli" : void 0
10637
10637
  ) || String(process.env.HIVE_CLI_ARTIFACT_NAME || "hive-cli").trim() || "hive-cli";
10638
10638
  var packageVersion = injectedString(
10639
- true ? "1.174.0" : void 0
10639
+ true ? "1.175.0" : void 0
10640
10640
  ) || String(process.env.HIVE_CLI_PACKAGE_VERSION || "").trim() || readPackageVersion();
10641
10641
  var releaseVersion = injectedString(
10642
- true ? "1.174.0" : void 0
10642
+ true ? "1.175.0" : void 0
10643
10643
  ) || String(process.env.HIVE_CLI_RELEASE_VERSION || "").trim() || packageVersion || "dev";
10644
10644
  var releaseChannel = injectedString(
10645
10645
  true ? "final" : void 0
10646
10646
  ) || String(process.env.HIVE_CLI_RELEASE_CHANNEL || "").trim() || (releaseVersion.includes("-rc.") ? "rc" : releaseVersion === "dev" ? "dev" : "final");
10647
10647
  var buildCommit = injectedString(
10648
- true ? "792954b5e1a29a3a02b8d6c430fd6dffe5e1c187" : void 0
10648
+ true ? "ece3eba8438b42c610915d453616f69f3af669f1" : void 0
10649
10649
  ) || String(process.env.HIVE_CLI_BUILD_COMMIT || "").trim() || "unknown";
10650
10650
  var buildTimestamp = injectedString(
10651
- true ? "2026-11-20T23:29:35Z" : void 0
10651
+ true ? "2026-11-21T15:21:41Z" : void 0
10652
10652
  ) || String(process.env.HIVE_CLI_BUILD_TIMESTAMP || "").trim() || "unknown";
10653
10653
  var ociRef = injectedString(
10654
- true ? "registry.onstackit.cloud/senticor/hive-cli:1.174.0" : void 0
10654
+ true ? "registry.onstackit.cloud/senticor/hive-cli:1.175.0" : void 0
10655
10655
  ) || String(process.env.HIVE_CLI_OCI_REF || "").trim() || `registry.onstackit.cloud/senticor/${artifactName}:${releaseVersion}`;
10656
10656
  var RELEASE_INFO = Object.freeze({
10657
10657
  packageVersion,
@@ -12829,10 +12829,10 @@ function mergeDefs(...defs) {
12829
12829
  function cloneDef(schema) {
12830
12830
  return mergeDefs(schema._zod.def);
12831
12831
  }
12832
- function getElementAtPath(obj, path10) {
12833
- if (!path10)
12832
+ function getElementAtPath(obj, path11) {
12833
+ if (!path11)
12834
12834
  return obj;
12835
- return path10.reduce((acc, key) => acc?.[key], obj);
12835
+ return path11.reduce((acc, key) => acc?.[key], obj);
12836
12836
  }
12837
12837
  function promiseAllObject(promisesObj) {
12838
12838
  const keys = Object.keys(promisesObj);
@@ -13172,11 +13172,11 @@ function explicitlyAborted(x, startIndex = 0) {
13172
13172
  }
13173
13173
  return false;
13174
13174
  }
13175
- function prefixIssues(path10, issues) {
13175
+ function prefixIssues(path11, issues) {
13176
13176
  return issues.map((iss) => {
13177
13177
  var _a3;
13178
13178
  (_a3 = iss).path ?? (_a3.path = []);
13179
- iss.path.unshift(path10);
13179
+ iss.path.unshift(path11);
13180
13180
  return iss;
13181
13181
  });
13182
13182
  }
@@ -13642,16 +13642,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
13642
13642
  }
13643
13643
  function formatError(error62, mapper = (issue2) => issue2.message) {
13644
13644
  const fieldErrors = { _errors: [] };
13645
- const processError = (error63, path10 = []) => {
13645
+ const processError = (error63, path11 = []) => {
13646
13646
  for (const issue2 of error63.issues) {
13647
13647
  if (issue2.code === "invalid_union" && issue2.errors.length) {
13648
- issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
13648
+ issue2.errors.map((issues) => processError({ issues }, [...path11, ...issue2.path]));
13649
13649
  } else if (issue2.code === "invalid_key") {
13650
- processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
13650
+ processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
13651
13651
  } else if (issue2.code === "invalid_element") {
13652
- processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
13652
+ processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
13653
13653
  } else {
13654
- const fullpath = [...path10, ...issue2.path];
13654
+ const fullpath = [...path11, ...issue2.path];
13655
13655
  if (fullpath.length === 0) {
13656
13656
  fieldErrors._errors.push(mapper(issue2));
13657
13657
  } else {
@@ -13690,17 +13690,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
13690
13690
  }
13691
13691
  function treeifyError(error62, mapper = (issue2) => issue2.message) {
13692
13692
  const result = { errors: [] };
13693
- const processError = (error63, path10 = []) => {
13693
+ const processError = (error63, path11 = []) => {
13694
13694
  var _a3;
13695
13695
  for (const issue2 of error63.issues) {
13696
13696
  if (issue2.code === "invalid_union" && issue2.errors.length) {
13697
- issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
13697
+ issue2.errors.map((issues) => processError({ issues }, [...path11, ...issue2.path]));
13698
13698
  } else if (issue2.code === "invalid_key") {
13699
- processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
13699
+ processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
13700
13700
  } else if (issue2.code === "invalid_element") {
13701
- processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
13701
+ processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
13702
13702
  } else {
13703
- const fullpath = [...path10, ...issue2.path];
13703
+ const fullpath = [...path11, ...issue2.path];
13704
13704
  if (fullpath.length === 0) {
13705
13705
  result.errors.push(mapper(issue2));
13706
13706
  continue;
@@ -13739,8 +13739,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
13739
13739
  }
13740
13740
  function toDotPath(_path) {
13741
13741
  const segs = [];
13742
- const path10 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
13743
- for (const seg of path10) {
13742
+ const path11 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
13743
+ for (const seg of path11) {
13744
13744
  if (typeof seg === "number")
13745
13745
  segs.push(`[${seg}]`);
13746
13746
  else if (typeof seg === "symbol")
@@ -30974,13 +30974,13 @@ function resolveRef(ref, ctx2) {
30974
30974
  if (!ref.startsWith("#")) {
30975
30975
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
30976
30976
  }
30977
- const path10 = ref.slice(1).split("/").filter(Boolean);
30978
- if (path10.length === 0) {
30977
+ const path11 = ref.slice(1).split("/").filter(Boolean);
30978
+ if (path11.length === 0) {
30979
30979
  return ctx2.rootSchema;
30980
30980
  }
30981
30981
  const defsKey = ctx2.version === "draft-2020-12" ? "$defs" : "definitions";
30982
- if (path10[0] === defsKey) {
30983
- const key = path10[1] === void 0 ? void 0 : decodeJSONPointerSegment(path10[1]);
30982
+ if (path11[0] === defsKey) {
30983
+ const key = path11[1] === void 0 ? void 0 : decodeJSONPointerSegment(path11[1]);
30984
30984
  if (!key || !ctx2.defs[key]) {
30985
30985
  throw new Error(`Reference not found: ${ref}`);
30986
30986
  }
@@ -31989,8 +31989,8 @@ function loadConfig(raw) {
31989
31989
  const result = BootstrapConfigSchema.safeParse(raw);
31990
31990
  if (!result.success) {
31991
31991
  const lines = result.error.issues.map((issue2) => {
31992
- const path10 = issue2.path.length ? issue2.path.join(".") : "(root)";
31993
- return ` \u2022 ${path10}: ${issue2.message}`;
31992
+ const path11 = issue2.path.length ? issue2.path.join(".") : "(root)";
31993
+ return ` \u2022 ${path11}: ${issue2.message}`;
31994
31994
  });
31995
31995
  throw new Error(`Invalid customer config:
31996
31996
  ${lines.join("\n")}`);
@@ -32076,7 +32076,7 @@ function createHttpClient(baseUrl, token, fetchImpl = fetch) {
32076
32076
  const base = baseUrl.replace(/\/$/, "");
32077
32077
  return {
32078
32078
  baseUrl: base,
32079
- async request(method, path10, opts = {}) {
32079
+ async request(method, path11, opts = {}) {
32080
32080
  const headers = {
32081
32081
  Authorization: `Bearer ${token}`,
32082
32082
  Accept: "application/json, application/problem+json"
@@ -32087,7 +32087,7 @@ function createHttpClient(baseUrl, token, fetchImpl = fetch) {
32087
32087
  headers["Content-Type"] = "application/json";
32088
32088
  body = JSON.stringify(opts.body);
32089
32089
  }
32090
- const res = await fetchImpl(`${base}${path10}`, { method, headers, body });
32090
+ const res = await fetchImpl(`${base}${path11}`, { method, headers, body });
32091
32091
  const rawText = await res.text().catch(() => "");
32092
32092
  let json2 = null;
32093
32093
  if (rawText) {
@@ -32110,21 +32110,21 @@ init_cjs_shims();
32110
32110
  // src/admin/state.mts
32111
32111
  init_cjs_shims();
32112
32112
  var import_node_fs7 = require("fs");
32113
- function readState(path10) {
32114
- if (!(0, import_node_fs7.existsSync)(path10)) return {};
32113
+ function readState(path11) {
32114
+ if (!(0, import_node_fs7.existsSync)(path11)) return {};
32115
32115
  try {
32116
- const parsed = JSON.parse((0, import_node_fs7.readFileSync)(path10, "utf-8"));
32116
+ const parsed = JSON.parse((0, import_node_fs7.readFileSync)(path11, "utf-8"));
32117
32117
  return parsed && typeof parsed === "object" ? parsed : {};
32118
32118
  } catch {
32119
32119
  return {};
32120
32120
  }
32121
32121
  }
32122
- function writeState(path10, state) {
32123
- (0, import_node_fs7.writeFileSync)(path10, `${JSON.stringify(state, null, 2)}
32122
+ function writeState(path11, state) {
32123
+ (0, import_node_fs7.writeFileSync)(path11, `${JSON.stringify(state, null, 2)}
32124
32124
  `, "utf-8");
32125
32125
  }
32126
- function mergeState(path10, patch2, now) {
32127
- const current = readState(path10);
32126
+ function mergeState(path11, patch2, now) {
32127
+ const current = readState(path11);
32128
32128
  const completed = /* @__PURE__ */ new Set([
32129
32129
  ...current.completedSteps ?? [],
32130
32130
  ...patch2.completedSteps ?? []
@@ -32135,7 +32135,7 @@ function mergeState(path10, patch2, now) {
32135
32135
  completedSteps: [...completed],
32136
32136
  ...now ? { updatedAt: now } : {}
32137
32137
  };
32138
- writeState(path10, merged);
32138
+ writeState(path11, merged);
32139
32139
  return merged;
32140
32140
  }
32141
32141
 
@@ -32237,8 +32237,8 @@ async function ensureMission(client, mission2, opts) {
32237
32237
  }
32238
32238
  const body = { userIntent: mission2.userIntent };
32239
32239
  if (mission2.instantiationConfig) body.instantiationConfig = mission2.instantiationConfig;
32240
- const path10 = `/api/mission-templates/${encodeURIComponent(mission2.templateId)}/instantiate`;
32241
- const res = await client.request("POST", path10, { body, tenant: opts.tenant });
32240
+ const path11 = `/api/mission-templates/${encodeURIComponent(mission2.templateId)}/instantiate`;
32241
+ const res = await client.request("POST", path11, { body, tenant: opts.tenant });
32242
32242
  if (!res.ok) {
32243
32243
  throw new Error(
32244
32244
  `Instantiate '${mission2.templateId}' failed (HTTP ${res.status}): ${res.text}`
@@ -32602,10 +32602,10 @@ function defaultStatePath(configDir, override, cwd = process.cwd()) {
32602
32602
  }
32603
32603
 
32604
32604
  // src/admin/admin.mts
32605
- function loadEnvFile(path10) {
32605
+ function loadEnvFile(path11) {
32606
32606
  let text;
32607
32607
  try {
32608
- text = (0, import_node_fs9.readFileSync)(path10, "utf-8");
32608
+ text = (0, import_node_fs9.readFileSync)(path11, "utf-8");
32609
32609
  } catch {
32610
32610
  return;
32611
32611
  }
@@ -33094,17 +33094,17 @@ async function changeMembership(args, target) {
33094
33094
  const { tenantId } = await resolveTenantId(args);
33095
33095
  const { client } = adminCtx(args);
33096
33096
  const before = await requireMember(client, tenantId, args);
33097
- const path10 = `/api/admin/orgs/${enc(tenantId)}/members`;
33097
+ const path11 = `/api/admin/orgs/${enc(tenantId)}/members`;
33098
33098
  let res;
33099
33099
  if (target === "suspended") {
33100
- res = await client.patch(`${path10}/${enc(before.membershipId)}`, { status: "suspended" });
33100
+ res = await client.patch(`${path11}/${enc(before.membershipId)}`, { status: "suspended" });
33101
33101
  } else if (target === "revoked") {
33102
- res = await client.del(`${path10}/${enc(before.membershipId)}`);
33102
+ res = await client.del(`${path11}/${enc(before.membershipId)}`);
33103
33103
  } else {
33104
33104
  if (!before.email) {
33105
33105
  throw commandError("EMAIL_UNKNOWN", 1, `Member ${before.principalId} has no email, which re-admission needs.`);
33106
33106
  }
33107
- res = await client.post(path10, { email: before.email, roles: [] });
33107
+ res = await client.post(path11, { email: before.email, roles: [] });
33108
33108
  }
33109
33109
  ensureOk(res.status, res.data, `${target === "active" ? "reactivate" : target === "revoked" ? "revoke" : "suspend"} membership`);
33110
33110
  const after = findMember(await listMembers(client, tenantId), { principalId: before.principalId });
@@ -33386,10 +33386,10 @@ var org = defineCommand({
33386
33386
  }
33387
33387
  const { tenantId } = await resolveTenantId(args);
33388
33388
  const { client, fmt } = adminCtx(args);
33389
- const path10 = `/api/admin/orgs/${enc(tenantId)}/delegable-roles`;
33390
- const before = await client.get(path10);
33389
+ const path11 = `/api/admin/orgs/${enc(tenantId)}/delegable-roles`;
33390
+ const before = await client.get(path11);
33391
33391
  ensureOk(before.status, before.data, "read delegable roles");
33392
- const res = await client.put(path10, { roles });
33392
+ const res = await client.put(path11, { roles });
33393
33393
  ensureOk(res.status, res.data, "set delegable roles");
33394
33394
  return output({ ...recordOf2(res.data), delegableRolesBefore: recordOf2(before.data).delegableRoles }, fmt);
33395
33395
  }
@@ -34927,8 +34927,8 @@ async function importMission(client, opts) {
34927
34927
  }
34928
34928
 
34929
34929
  // src/commands/core.ts
34930
- function readItemsFile(path10) {
34931
- const trimmed2 = (0, import_node_fs12.readFileSync)(path10, "utf-8").trim();
34930
+ function readItemsFile(path11) {
34931
+ const trimmed2 = (0, import_node_fs12.readFileSync)(path11, "utf-8").trim();
34932
34932
  if (trimmed2.startsWith("[")) {
34933
34933
  const arr = JSON.parse(trimmed2);
34934
34934
  if (!Array.isArray(arr)) throw new Error("--file JSON must be an array of row objects");
@@ -35450,7 +35450,7 @@ async function listMissionPages(client, args) {
35450
35450
  const view = String(args.view || (allTenants ? "summary" : "full"));
35451
35451
  if (view !== "summary" && view !== "full") throw commandError("INVALID_VIEW", 2, "--view must be summary or full");
35452
35452
  if (allTenants && view !== "summary") throw commandError("INVALID_VIEW", 2, "--all-tenants lists summaries only; drop --view full or --all-tenants");
35453
- const path10 = allTenants ? "/api/me/missions" : "/api/missions";
35453
+ const path11 = allTenants ? "/api/me/missions" : "/api/missions";
35454
35454
  const cap = args.limit === void 0 ? Infinity : Number(args.limit);
35455
35455
  if (args.limit !== void 0 && (!Number.isInteger(cap) || cap < 1)) {
35456
35456
  throw commandError("INVALID_LIMIT", 2, "--limit must be a positive integer");
@@ -35462,7 +35462,7 @@ async function listMissionPages(client, args) {
35462
35462
  for (let page = 0; page < MISSION_LIST_MAX_PAGES; page += 1) {
35463
35463
  const qs = new URLSearchParams({ view, limit: String(Math.min(MISSION_PAGE_MAX, cap - missions.length)) });
35464
35464
  if (cursor) qs.set("cursor", cursor);
35465
- const res = await client.get(`${path10}?${qs}`);
35465
+ const res = await client.get(`${path11}?${qs}`);
35466
35466
  const body = asObject2(res.data);
35467
35467
  if (!isHttpOk(res.status)) return body;
35468
35468
  if (view === "summary" && body.view !== "summary") {
@@ -35737,9 +35737,9 @@ var mission = defineCommand({
35737
35737
  const missionId = requireMissionContext(args, "mission member grant");
35738
35738
  const principal = resolvePrincipal(args);
35739
35739
  const body = { ...principal, role: validateMissionGrantRole(args.role) };
35740
- const path10 = `/api/missions/${enc(missionId)}/members`;
35741
- if (args.dryRun) return output(dryRunResult("POST", path10, body), fmt);
35742
- const res = await client.post(path10, body);
35740
+ const path11 = `/api/missions/${enc(missionId)}/members`;
35741
+ if (args.dryRun) return output(dryRunResult("POST", path11, body), fmt);
35742
+ const res = await client.post(path11, body);
35743
35743
  assertMissionMembershipOk(res.status, res.data, "grant mission member");
35744
35744
  const data = recordOf3(res.data);
35745
35745
  const created = data.created === true;
@@ -35765,9 +35765,9 @@ var mission = defineCommand({
35765
35765
  throw commandError("EMAIL_INVALID", 2, `--email '${raw}' is not an email. admit is by email; use \`mission members grant --principal-sub\` for an OIDC sub.`);
35766
35766
  }
35767
35767
  const body = { principalEmail: raw, role: validateMissionGrantRole(args.role) };
35768
- const path10 = `/api/missions/${enc(missionId)}/members`;
35769
- if (args.dryRun) return output(dryRunResult("POST", path10, body), fmt);
35770
- const res = await client.post(path10, body);
35768
+ const path11 = `/api/missions/${enc(missionId)}/members`;
35769
+ if (args.dryRun) return output(dryRunResult("POST", path11, body), fmt);
35770
+ const res = await client.post(path11, body);
35771
35771
  assertMissionMembershipOk(res.status, res.data, "admit mission member");
35772
35772
  const data = recordOf3(res.data);
35773
35773
  const created = data.created === true;
@@ -35819,9 +35819,9 @@ var mission = defineCommand({
35819
35819
  printContextNotice(args, { mission: true });
35820
35820
  const missionId = requireMissionContext(args, "mission member revoke");
35821
35821
  const userId = reqAny(args, "userId", "id", "principalSub");
35822
- const path10 = `/api/missions/${enc(missionId)}/members/${enc(userId)}`;
35823
- if (args.dryRun) return output(dryRunResult("DELETE", path10), fmt);
35824
- const res = await client.del(path10);
35822
+ const path11 = `/api/missions/${enc(missionId)}/members/${enc(userId)}`;
35823
+ if (args.dryRun) return output(dryRunResult("DELETE", path11), fmt);
35824
+ const res = await client.del(path11);
35825
35825
  if (res.status === 404 && recordOf3(res.data).error === "member_not_found") {
35826
35826
  remoteFailureHandled();
35827
35827
  return output({ revoked: false, notFound: true, userId }, fmt);
@@ -35848,8 +35848,8 @@ var mission = defineCommand({
35848
35848
  const principal = resolvePrincipal(args);
35849
35849
  const reason = String(args.reason ?? "").trim();
35850
35850
  const body = { ...principal, ...reason ? { reason } : {} };
35851
- const path10 = `/api/missions/${enc(missionId)}/owner`;
35852
- if (args.dryRun) return output(dryRunResult("PUT", path10, body), fmt);
35851
+ const path11 = `/api/missions/${enc(missionId)}/owner`;
35852
+ if (args.dryRun) return output(dryRunResult("PUT", path11, body), fmt);
35853
35853
  if (!args.yes) {
35854
35854
  throw commandError(
35855
35855
  "HANDOVER_CONFIRMATION_REQUIRED",
@@ -35857,7 +35857,7 @@ var mission = defineCommand({
35857
35857
  "Handing a mission over gives the new owner its owner rights and takes them from the current owner. Re-run with --yes."
35858
35858
  );
35859
35859
  }
35860
- const res = await client.put(path10, body);
35860
+ const res = await client.put(path11, body);
35861
35861
  assertMissionMembershipOk(res.status, res.data, "hand over mission");
35862
35862
  const data = recordOf3(res.data);
35863
35863
  return output(
@@ -35902,10 +35902,10 @@ var mission = defineCommand({
35902
35902
  "Changing tenantWideRead to true broadens mission visibility to the whole tenant. Re-run with --yes."
35903
35903
  );
35904
35904
  }
35905
- const path10 = `/api/missions/${enc(missionId)}/access-policy`;
35905
+ const path11 = `/api/missions/${enc(missionId)}/access-policy`;
35906
35906
  const body = { tenantWideRead };
35907
- if (args.dryRun) return output(dryRunResult("PATCH", path10, body), fmt);
35908
- const res = await client.patch(path10, body);
35907
+ if (args.dryRun) return output(dryRunResult("PATCH", path11, body), fmt);
35908
+ const res = await client.patch(path11, body);
35909
35909
  assertRemoteOk(res.status, res.data, "set mission access policy");
35910
35910
  return output({ updated: true, missionId, policy: recordOf3(res.data).policy ?? { tenantWideRead } }, fmt);
35911
35911
  }
@@ -36216,8 +36216,8 @@ var templates = defineCommand({
36216
36216
  const acknowledge = String(args.acknowledge ?? "").split(",").map((code) => code.trim()).filter(Boolean);
36217
36217
  const reason = String(args.reason ?? "").trim();
36218
36218
  const body = { missionId, acknowledge, ...reason ? { reason } : {} };
36219
- const path10 = revisionPath(String(args.id), String(args.hash), "apply");
36220
- if (args.dryRun) return output(dryRunResult("POST", path10, body), fmt);
36219
+ const path11 = revisionPath(String(args.id), String(args.hash), "apply");
36220
+ if (args.dryRun) return output(dryRunResult("POST", path11, body), fmt);
36221
36221
  if (!args.yes) {
36222
36222
  throw commandError(
36223
36223
  "APPLY_CONFIRMATION_REQUIRED",
@@ -36225,7 +36225,7 @@ var templates = defineCommand({
36225
36225
  "Applying a revision changes how CHOS enforces this mission's records. Preview it with `hive templates preview-revision`, then re-run with --yes."
36226
36226
  );
36227
36227
  }
36228
- const res = await client.post(path10, body);
36228
+ const res = await client.post(path11, body);
36229
36229
  assertTemplateRevisionOk(res.status, res.data, "apply template revision");
36230
36230
  return output(res.data, fmt);
36231
36231
  }
@@ -36296,8 +36296,8 @@ var upgrade = defineCommand({
36296
36296
 
36297
36297
  // src/commands/data.ts
36298
36298
  init_cjs_shims();
36299
- var import_node_fs14 = __toESM(require("fs"), 1);
36300
- var import_node_path13 = __toESM(require("path"), 1);
36299
+ var import_node_fs15 = __toESM(require("fs"), 1);
36300
+ var import_node_path14 = __toESM(require("path"), 1);
36301
36301
  var import_ajv = __toESM(require_ajv(), 1);
36302
36302
  var import__ = __toESM(require__(), 1);
36303
36303
  var ajvFormatsModule2 = __toESM(require_dist(), 1);
@@ -36593,13 +36593,13 @@ function appendStarterSchemaErrors(envelope, errors) {
36593
36593
  }
36594
36594
  }
36595
36595
  function formatSchemaError(error62) {
36596
- const path10 = error62.instancePath || "/";
36596
+ const path11 = error62.instancePath || "/";
36597
36597
  if (error62.keyword === "additionalProperties") {
36598
36598
  const params = recordOf4(error62.params);
36599
36599
  const prop = String(params.additionalProperty || "");
36600
- return `schema ${path10}: additional property '${prop}' is not allowed`;
36600
+ return `schema ${path11}: additional property '${prop}' is not allowed`;
36601
36601
  }
36602
- return `schema ${path10}: ${error62.message || error62.keyword}`;
36602
+ return `schema ${path11}: ${error62.message || error62.keyword}`;
36603
36603
  }
36604
36604
  function recordOf4(value) {
36605
36605
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
@@ -36729,6 +36729,211 @@ function statMaybe(inputPath) {
36729
36729
  }
36730
36730
  }
36731
36731
 
36732
+ // src/commands/record-files.ts
36733
+ init_cjs_shims();
36734
+ var import_node_crypto7 = require("crypto");
36735
+ var import_node_fs14 = __toESM(require("fs"), 1);
36736
+ var import_node_http3 = __toESM(require("http"), 1);
36737
+ var import_node_https3 = __toESM(require("https"), 1);
36738
+ var import_node_path13 = __toESM(require("path"), 1);
36739
+ var import_promises2 = require("stream/promises");
36740
+ var recordFlags = {
36741
+ id: { type: "string", description: "The record's id (required; --record-id also works)" },
36742
+ recordId: { type: "string", description: "Alias of --id" },
36743
+ key: { type: "string", description: "The record's data key that lists the files (default attachments)" }
36744
+ };
36745
+ var docFlag = { docId: { type: "string", description: "The document's id, from `hive record files list` (required)" } };
36746
+ var listArgs = withOwnArgs({ ...recordFlags });
36747
+ var attachArgs = withOwnArgs({
36748
+ ...recordFlags,
36749
+ file: { type: "string", description: "The local file to attach (required)" },
36750
+ kind: { type: "string", description: "What the file is, stored on the record's entry (e.g. cv)" },
36751
+ filename: { type: "string", description: "The file name to store (default: the local file's name)" }
36752
+ });
36753
+ var getArgs = withOwnArgs({ ...recordFlags, ...docFlag, out: { type: "string", description: "Save the file here (0600) and check its sha256" } });
36754
+ var archiveArgs = withOwnArgs({ ...recordFlags, ...docFlag, reason: { type: "string", description: "Why it is archived, kept with the document" } });
36755
+ function objectOf(value) {
36756
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
36757
+ }
36758
+ function recordIdOf(args) {
36759
+ return reqAny(args, "recordId", "id");
36760
+ }
36761
+ function docIdOf(args) {
36762
+ const docId = args.docId;
36763
+ if (typeof docId !== "string" || !docId.trim()) throw commandError("MISSING_ARGUMENT", 2, "--doc-id is required (see `hive record files list`)");
36764
+ return docId.trim();
36765
+ }
36766
+ function okOrThrow(res, action) {
36767
+ if (res.status && res.status >= 200 && res.status < 300) return objectOf(res.data);
36768
+ throw remoteFailureError(res.status, res.data, action, EXIT_REMOTE_FAILED);
36769
+ }
36770
+ function hostOf(url2) {
36771
+ return `${url2.protocol}//${url2.host}`;
36772
+ }
36773
+ function presignedUrl(value, what) {
36774
+ let url2;
36775
+ try {
36776
+ url2 = typeof value === "string" ? new URL(value) : null;
36777
+ } catch {
36778
+ url2 = null;
36779
+ }
36780
+ if (!url2 || url2.protocol !== "https:" && url2.protocol !== "http:") {
36781
+ throw commandError("REMOTE_FAILED", EXIT_REMOTE_FAILED, `the API answered without a usable ${what}`);
36782
+ }
36783
+ return url2;
36784
+ }
36785
+ function s3Error(body) {
36786
+ const code = /<Code>([^<]{1,100})<\/Code>/.exec(body)?.[1];
36787
+ const message = /<Message>([^<]{1,300})<\/Message>/.exec(body)?.[1];
36788
+ return [code, message].filter(Boolean).join(": ") || body.slice(0, 200).trim() || "no body";
36789
+ }
36790
+ function transportFailure(err, what, url2) {
36791
+ const code = err?.code;
36792
+ return commandError("REMOTE_FAILED", EXIT_REMOTE_FAILED, `${what} failed: could not reach ${hostOf(url2)}${typeof code === "string" ? ` (${code})` : ""}`);
36793
+ }
36794
+ function putFile(url2, method, headers, filePath, size) {
36795
+ const mod = url2.protocol === "https:" ? import_node_https3.default : import_node_http3.default;
36796
+ return new Promise((resolve3, reject) => {
36797
+ const req2 = mod.request(url2, { method, headers: { ...headers, "content-length": String(size) } }, (res) => {
36798
+ const chunks = [];
36799
+ res.on("data", (c) => chunks.push(c));
36800
+ res.on("end", () => resolve3({ status: res.statusCode ?? 0, body: Buffer.concat(chunks).toString("utf-8") }));
36801
+ res.on("error", reject);
36802
+ });
36803
+ req2.on("error", reject);
36804
+ import_node_fs14.default.createReadStream(filePath).on("error", (err) => req2.destroy(err)).pipe(req2);
36805
+ });
36806
+ }
36807
+ function download(url2, target) {
36808
+ const mod = url2.protocol === "https:" ? import_node_https3.default : import_node_http3.default;
36809
+ return new Promise((resolve3, reject) => {
36810
+ const req2 = mod.request(url2, { method: "GET" }, (res) => {
36811
+ const status2 = res.statusCode ?? 0;
36812
+ if (status2 < 200 || status2 >= 300) {
36813
+ const chunks = [];
36814
+ res.on("data", (c) => chunks.push(c));
36815
+ res.on("end", () => resolve3({ status: status2, sha256: "", bytes: 0, body: Buffer.concat(chunks).toString("utf-8") }));
36816
+ return;
36817
+ }
36818
+ const hash2 = (0, import_node_crypto7.createHash)("sha256");
36819
+ let bytes = 0;
36820
+ res.on("data", (c) => {
36821
+ hash2.update(c);
36822
+ bytes += c.length;
36823
+ });
36824
+ (0, import_promises2.pipeline)(res, import_node_fs14.default.createWriteStream(target, { mode: 384 })).then(() => resolve3({ status: status2, sha256: hash2.digest("hex"), bytes })).catch(reject);
36825
+ });
36826
+ req2.on("error", reject);
36827
+ req2.end();
36828
+ });
36829
+ }
36830
+ var recordFiles = defineCommand({
36831
+ meta: { name: "files", description: "A record's files: list, attach (upload slot + PUT + attach), get, archive. Needs HIVE_UPLOAD_SLOTS=on on the deployment" },
36832
+ args: listArgs,
36833
+ default: "list",
36834
+ subCommands: {
36835
+ list: defineCommand({
36836
+ meta: { name: "list", description: "The documents a record links (--id, [--key]): state active/archived/unavailable, owned, metadata only" },
36837
+ args: listArgs,
36838
+ async run({ args }) {
36839
+ const { client, fmt } = ctx(args);
36840
+ const recordId2 = recordIdOf(args);
36841
+ const res = await client.get(`/api/records/${enc(recordId2)}/attachments${queryString({ key: args.key })}`);
36842
+ return output(okOrThrow(res, "list the record's files"), fmt);
36843
+ }
36844
+ }),
36845
+ attach: defineCommand({
36846
+ meta: { name: "attach", description: "Attach a local file to a record (--id, --file, [--kind], [--key], [--filename]): upload slot, PUT, attach. Malware-scanned where the deployment requires it" },
36847
+ args: attachArgs,
36848
+ async run({ args }) {
36849
+ const recordId2 = recordIdOf(args);
36850
+ if (typeof args.file !== "string" || !args.file) throw commandError("MISSING_ARGUMENT", 2, "--file is required");
36851
+ const filePath = args.file;
36852
+ const size = import_node_fs14.default.statSync(filePath).size;
36853
+ if (size < 1) throw commandError("EMPTY_FILE", 1, `${filePath} is empty`);
36854
+ const filename = String(args.filename ?? "").trim() || import_node_path13.default.basename(filePath);
36855
+ const { client, fmt } = ctx(args);
36856
+ const slotBody = { filename, size };
36857
+ if (typeof args.kind === "string" && args.kind) slotBody.kind = args.kind;
36858
+ const slot = okOrThrow(await client.post(`/api/records/${enc(recordId2)}/upload-slots`, slotBody), "request an upload slot");
36859
+ const uploadId = String(slot.uploadId ?? "");
36860
+ if (!uploadId) throw commandError("REMOTE_FAILED", EXIT_REMOTE_FAILED, "the API answered the upload slot without an uploadId");
36861
+ const url2 = presignedUrl(slot.uploadUrl, "upload URL");
36862
+ const headers = {};
36863
+ for (const [name, value] of Object.entries(objectOf(slot.headers))) if (typeof value === "string") headers[name] = value;
36864
+ const method = typeof slot.method === "string" && slot.method ? slot.method : "PUT";
36865
+ if (client.verbose) process.stderr.write(`\u2192 ${method} ${hostOf(url2)} (upload slot ${uploadId}, ${size}B)
36866
+ `);
36867
+ let put;
36868
+ try {
36869
+ put = await putFile(url2, method, headers, filePath, size);
36870
+ } catch (err) {
36871
+ throw transportFailure(err, `uploading ${filename}`, url2);
36872
+ }
36873
+ if (client.verbose) process.stderr.write(`\u2190 ${put.status}
36874
+ `);
36875
+ if (put.status < 200 || put.status >= 300) {
36876
+ throw commandError(
36877
+ "UPLOAD_FAILED",
36878
+ EXIT_REMOTE_FAILED,
36879
+ `uploading ${filename} to slot ${uploadId} failed (HTTP ${put.status}): ${s3Error(put.body)}. Nothing was attached; the slot expires on its own.`
36880
+ );
36881
+ }
36882
+ const attachBody = { uploadId };
36883
+ if (typeof args.key === "string" && args.key) attachBody.key = args.key;
36884
+ const attached = okOrThrow(await client.post(`/api/records/${enc(recordId2)}/attachments`, attachBody), "attach the upload");
36885
+ return output({ ...attached, recordId: recordId2, uploadId }, fmt);
36886
+ }
36887
+ }),
36888
+ get: defineCommand({
36889
+ meta: { name: "get", description: "One file of a record (--id, --doc-id, [--key]): metadata, sha256, scan verdict; --out saves it and checks the sha256" },
36890
+ args: getArgs,
36891
+ async run({ args }) {
36892
+ const { client, fmt } = ctx(args);
36893
+ const recordId2 = recordIdOf(args);
36894
+ const docId = docIdOf(args);
36895
+ const res = await client.get(`/api/records/${enc(recordId2)}/attachments/${enc(docId)}${queryString({ key: args.key })}`);
36896
+ const { downloadUrl, downloadExpiresInSeconds: _ttl, ...rest } = okOrThrow(res, "read the record's file");
36897
+ if (typeof args.out !== "string" || !args.out) return output(rest, fmt);
36898
+ const target = args.out;
36899
+ const url2 = presignedUrl(downloadUrl, "download URL");
36900
+ if (client.verbose) process.stderr.write(`\u2192 GET ${hostOf(url2)} (download ${docId})
36901
+ `);
36902
+ let got;
36903
+ try {
36904
+ got = await download(url2, target);
36905
+ } catch (err) {
36906
+ import_node_fs14.default.rmSync(target, { force: true });
36907
+ throw transportFailure(err, `downloading ${docId}`, url2);
36908
+ }
36909
+ if (got.status < 200 || got.status >= 300) {
36910
+ throw commandError("DOWNLOAD_FAILED", EXIT_REMOTE_FAILED, `downloading ${docId} failed (HTTP ${got.status}): ${s3Error(got.body ?? "")}`);
36911
+ }
36912
+ const expected = objectOf(rest.document).sha256;
36913
+ if (typeof expected === "string" && expected && expected !== got.sha256) {
36914
+ import_node_fs14.default.rmSync(target, { force: true });
36915
+ throw commandError("CHECKSUM_MISMATCH", EXIT_REMOTE_FAILED, `downloaded ${docId} does not match its sha256 (expected ${expected}, got ${got.sha256}); the file was removed`);
36916
+ }
36917
+ return output({ ...rest, saved: { path: target, bytes: got.bytes, sha256: got.sha256, verified: typeof expected === "string" && expected === got.sha256 } }, fmt);
36918
+ }
36919
+ }),
36920
+ archive: defineCommand({
36921
+ meta: { name: "archive", description: "Archive a file the record owns (--id, --doc-id, [--reason]); a file it only links answers 409 ATTACHMENT_NOT_OWNED" },
36922
+ args: archiveArgs,
36923
+ async run({ args }) {
36924
+ const { client, fmt } = ctx(args);
36925
+ const recordId2 = recordIdOf(args);
36926
+ const docId = docIdOf(args);
36927
+ const body = {};
36928
+ if (typeof args.key === "string" && args.key) body.key = args.key;
36929
+ if (typeof args.reason === "string" && args.reason) body.reason = args.reason;
36930
+ const res = await client.post(`/api/records/${enc(recordId2)}/attachments/${enc(docId)}/archive`, body);
36931
+ return output(okOrThrow(res, "archive the record's file"), fmt);
36932
+ }
36933
+ })
36934
+ }
36935
+ });
36936
+
36732
36937
  // src/commands/data.ts
36733
36938
  var addFormats2 = ajvFormatsModule2.default ?? ajvFormatsModule2;
36734
36939
  function assertRemoteOk2(status2, data, action) {
@@ -36803,7 +37008,7 @@ function localValidationOutput(validation) {
36803
37008
  }
36804
37009
  function contentTypeFor(filePath, override) {
36805
37010
  if (typeof override === "string" && override.trim()) return override.trim();
36806
- const ext = import_node_path13.default.extname(filePath).toLowerCase();
37011
+ const ext = import_node_path14.default.extname(filePath).toLowerCase();
36807
37012
  if (ext === ".pdf") return "application/pdf";
36808
37013
  if (ext === ".xml") return "application/xml";
36809
37014
  if (ext === ".json") return "application/json";
@@ -36823,8 +37028,8 @@ var ingest = defineCommand({
36823
37028
  const body = { missionId: args.missionId, caseId: args.caseId };
36824
37029
  if (args.url) body.url = args.url;
36825
37030
  if (args.file) {
36826
- body.filename = import_node_path13.default.basename(args.file);
36827
- body.contentBase64 = import_node_fs14.default.readFileSync(args.file).toString("base64");
37031
+ body.filename = import_node_path14.default.basename(args.file);
37032
+ body.contentBase64 = import_node_fs15.default.readFileSync(args.file).toString("base64");
36828
37033
  }
36829
37034
  return output((await client.post("/api/ingest", body)).data, fmt);
36830
37035
  }
@@ -37123,6 +37328,7 @@ var record2 = defineCommand({
37123
37328
  return output((await client.post(`/api/records/bulk/unarchive${qs}`, recordBulkLifecycleBody(args, "record bulk-unarchive"))).data, fmt);
37124
37329
  }
37125
37330
  }),
37331
+ files: recordFiles,
37126
37332
  validate: defineCommand({
37127
37333
  meta: {
37128
37334
  name: "validate",
@@ -37486,10 +37692,10 @@ var document2 = defineCommand({
37486
37692
  const missionId = requireMissionContext(args, "document upload");
37487
37693
  req(args, "file");
37488
37694
  const filePath = String(args.file);
37489
- const bytes = import_node_fs14.default.readFileSync(filePath);
37695
+ const bytes = import_node_fs15.default.readFileSync(filePath);
37490
37696
  if (!bytes.length) throw commandError("EMPTY_FILE", 1, `${filePath} is empty`);
37491
37697
  const body = {
37492
- filename: args.filename || import_node_path13.default.basename(filePath),
37698
+ filename: args.filename || import_node_path14.default.basename(filePath),
37493
37699
  contentType: contentTypeFor(filePath, args.contentType),
37494
37700
  bytesBase64: bytes.toString("base64")
37495
37701
  };
@@ -38032,7 +38238,7 @@ var privacy = defineCommand({
38032
38238
 
38033
38239
  // src/commands/masking.ts
38034
38240
  init_cjs_shims();
38035
- var import_node_fs15 = __toESM(require("fs"), 1);
38241
+ var import_node_fs16 = __toESM(require("fs"), 1);
38036
38242
  var DEFAULT_TIMEOUT_S = 1800;
38037
38243
  var DEFAULT_POLL_MS = 2e3;
38038
38244
  var SUCCESS_STATES = /* @__PURE__ */ new Set(["awaiting_review", "exported"]);
@@ -38060,7 +38266,7 @@ var masking = defineCommand({
38060
38266
  const missionId = requireMissionContext(args, "masking submit");
38061
38267
  const timeoutS = positiveInt(args, "timeout", DEFAULT_TIMEOUT_S);
38062
38268
  const pollMs = positiveInt(args, "pollMs", DEFAULT_POLL_MS);
38063
- const bytes = import_node_fs15.default.readFileSync(String(args.file));
38269
+ const bytes = import_node_fs16.default.readFileSync(String(args.file));
38064
38270
  const { client, fmt } = ctx(args);
38065
38271
  printContextNotice(args, { mission: true });
38066
38272
  const submitted = await client.post(`/api/missions/${enc(missionId)}/masking/submit`, { bytesBase64: bytes.toString("base64") });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@senticor/hive",
3
- "version": "1.174.0",
3
+ "version": "1.175.0",
4
4
  "description": "Cognitive Hive OS — unified CLI",
5
5
  "type": "commonjs",
6
6
  "bin": {