@senticor/hive 1.135.0 → 1.136.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 +107 -5
  2. package/package.json +1 -1
package/hive.cjs CHANGED
@@ -10511,22 +10511,22 @@ var artifactName = injectedString(
10511
10511
  true ? "hive-cli" : void 0
10512
10512
  ) || String(process.env.HIVE_CLI_ARTIFACT_NAME || "hive-cli").trim() || "hive-cli";
10513
10513
  var packageVersion = injectedString(
10514
- true ? "1.135.0" : void 0
10514
+ true ? "1.136.0" : void 0
10515
10515
  ) || String(process.env.HIVE_CLI_PACKAGE_VERSION || "").trim() || readPackageVersion();
10516
10516
  var releaseVersion = injectedString(
10517
- true ? "1.135.0" : void 0
10517
+ true ? "1.136.0" : void 0
10518
10518
  ) || String(process.env.HIVE_CLI_RELEASE_VERSION || "").trim() || packageVersion || "dev";
10519
10519
  var releaseChannel = injectedString(
10520
10520
  true ? "final" : void 0
10521
10521
  ) || String(process.env.HIVE_CLI_RELEASE_CHANNEL || "").trim() || (releaseVersion.includes("-rc.") ? "rc" : releaseVersion === "dev" ? "dev" : "final");
10522
10522
  var buildCommit = injectedString(
10523
- true ? "2dcdc064620ccf9ed99765b54edf01c4202bce6e" : void 0
10523
+ true ? "5ee4dfebdc58dd6214b6a3a0ffa9f1bf7eb8f2de" : void 0
10524
10524
  ) || String(process.env.HIVE_CLI_BUILD_COMMIT || "").trim() || "unknown";
10525
10525
  var buildTimestamp = injectedString(
10526
- true ? "2026-11-11T15:38:30Z" : void 0
10526
+ true ? "2026-11-11T16:44:40Z" : void 0
10527
10527
  ) || String(process.env.HIVE_CLI_BUILD_TIMESTAMP || "").trim() || "unknown";
10528
10528
  var ociRef = injectedString(
10529
- true ? "registry.onstackit.cloud/senticor/hive-cli:1.135.0" : void 0
10529
+ true ? "registry.onstackit.cloud/senticor/hive-cli:1.136.0" : void 0
10530
10530
  ) || String(process.env.HIVE_CLI_OCI_REF || "").trim() || `registry.onstackit.cloud/senticor/${artifactName}:${releaseVersion}`;
10531
10531
  var RELEASE_INFO = Object.freeze({
10532
10532
  packageVersion,
@@ -35868,6 +35868,13 @@ var cells = defineCommand({
35868
35868
  })
35869
35869
  }
35870
35870
  });
35871
+ var templateRevisionArgs = withArgs({
35872
+ hash: { type: "string", description: "Content hash of the revision (sha256:\u2026), as publish-revision returned it" },
35873
+ acknowledge: { type: "string", description: "apply-revision: comma-separated finding codes you accept by name" },
35874
+ reason: { type: "string", description: "apply-revision: why, recorded in the audit row" },
35875
+ yes: { type: "boolean", description: "apply-revision: confirm the apply" },
35876
+ dryRun: { type: "boolean", description: "Print the request that would be sent; perform no write" }
35877
+ });
35871
35878
  var templates = defineCommand({
35872
35879
  meta: { name: "templates", description: "Mission templates" },
35873
35880
  args: withArgs(),
@@ -35905,9 +35912,104 @@ var templates = defineCommand({
35905
35912
  assertRemoteOk(res.status, res.data, "publish platform mission template");
35906
35913
  return output(res.data, fmt);
35907
35914
  }
35915
+ }),
35916
+ // #469: template revisions, published and applied per mission (tenant admin).
35917
+ revisions: defineCommand({
35918
+ meta: { name: "revisions", description: "List the tenant's published revisions of a template (--id; tenant admin)" },
35919
+ args: withArgs(),
35920
+ async run({ args }) {
35921
+ const { client, fmt } = ctx(args);
35922
+ req(args, "id");
35923
+ const res = await client.get(`/api/mission-templates/${enc(String(args.id))}/revisions`);
35924
+ assertTemplateRevisionOk(res.status, res.data, "list template revisions");
35925
+ return output(res.data, fmt);
35926
+ }
35927
+ }),
35928
+ "publish-revision": defineCommand({
35929
+ meta: { name: "publish-revision", description: "Publish an immutable revision of a tenant template (--file; tenant admin). Changes no mission." },
35930
+ args: withArgs(),
35931
+ async run({ args }) {
35932
+ const { client, fmt } = ctx(args);
35933
+ req(args, "file");
35934
+ const spec = readJsonFile(args.file);
35935
+ const templateId = String(spec?.templateId || "").trim();
35936
+ if (!templateId) throw commandError("TEMPLATE_ID_REQUIRED", 1, "The template file must contain a non-empty templateId.");
35937
+ const res = await client.post(`/api/mission-templates/${enc(templateId)}/revisions`, { spec });
35938
+ assertTemplateRevisionOk(res.status, res.data, "publish template revision");
35939
+ return output(res.data, fmt);
35940
+ }
35941
+ }),
35942
+ "preview-revision": defineCommand({
35943
+ meta: { name: "preview-revision", description: "Show what applying a revision would do to a mission (--id, --hash, mission pin or --mission-id). Changes nothing." },
35944
+ args: templateRevisionArgs,
35945
+ async run({ args }) {
35946
+ const { client, fmt } = ctx(args);
35947
+ req(args, "id");
35948
+ req(args, "hash");
35949
+ const missionId = requireMissionContext(args, "templates preview-revision");
35950
+ const res = await client.post(revisionPath(String(args.id), String(args.hash), "preview"), { missionId });
35951
+ assertTemplateRevisionOk(res.status, res.data, "preview template revision");
35952
+ return output(res.data, fmt);
35953
+ }
35954
+ }),
35955
+ "apply-revision": defineCommand({
35956
+ meta: {
35957
+ name: "apply-revision",
35958
+ description: "Apply a published revision to a mission (--id, --hash, mission pin or --mission-id, --acknowledge CODE[,CODE], --reason, --yes; tenant admin)"
35959
+ },
35960
+ args: templateRevisionArgs,
35961
+ async run({ args }) {
35962
+ const { client, fmt } = ctx(args);
35963
+ req(args, "id");
35964
+ req(args, "hash");
35965
+ const missionId = requireMissionContext(args, "templates apply-revision");
35966
+ const acknowledge = String(args.acknowledge ?? "").split(",").map((code) => code.trim()).filter(Boolean);
35967
+ const reason = String(args.reason ?? "").trim();
35968
+ const body = { missionId, acknowledge, ...reason ? { reason } : {} };
35969
+ const path10 = revisionPath(String(args.id), String(args.hash), "apply");
35970
+ if (args.dryRun) return output(dryRunResult("POST", path10, body), fmt);
35971
+ if (!args.yes) {
35972
+ throw commandError(
35973
+ "APPLY_CONFIRMATION_REQUIRED",
35974
+ 2,
35975
+ "Applying a revision changes how CHOS enforces this mission's records. Preview it with `hive templates preview-revision`, then re-run with --yes."
35976
+ );
35977
+ }
35978
+ const res = await client.post(path10, body);
35979
+ assertTemplateRevisionOk(res.status, res.data, "apply template revision");
35980
+ return output(res.data, fmt);
35981
+ }
35908
35982
  })
35909
35983
  }
35910
35984
  });
35985
+ function revisionPath(templateId, contentHash, action) {
35986
+ return `/api/mission-templates/${enc(templateId)}/revisions/${encodeURIComponent(contentHash)}/${action}`;
35987
+ }
35988
+ var TEMPLATE_REVISION_ERROR_CODES = /* @__PURE__ */ new Set([
35989
+ "MISSION_TEMPLATE_MANAGE_FORBIDDEN",
35990
+ "TEMPLATE_REVISION_INVALID",
35991
+ "TEMPLATE_REVISION_NOT_FOUND",
35992
+ "TEMPLATE_REVISION_TEMPLATE_MISMATCH",
35993
+ "TEMPLATE_APPLY_MISSION_UNBOUND",
35994
+ "TEMPLATE_APPLY_REFUSED",
35995
+ "TEMPLATE_APPLY_ACKNOWLEDGEMENT_REQUIRED",
35996
+ "TEMPLATE_APPLY_UNAVAILABLE",
35997
+ "EXPERIMENTAL_FEATURE_NOT_ENABLED"
35998
+ ]);
35999
+ function assertTemplateRevisionOk(status2, data, action) {
36000
+ if (isHttpOk(status2)) return;
36001
+ const body = recordOf3(data);
36002
+ const code = String(body.error || "").trim();
36003
+ if (!TEMPLATE_REVISION_ERROR_CODES.has(code)) return assertRemoteOk(status2, data, action);
36004
+ const findings = Array.isArray(body.findings) ? body.findings : [];
36005
+ const missing = Array.isArray(body.unacknowledged) ? body.unacknowledged.map(String) : [];
36006
+ const refused = findings.filter((f) => f.class === "refused").map((f) => String(f.code));
36007
+ const detail = [
36008
+ missing.length ? `Acknowledge by name: ${missing.join(", ")}.` : "",
36009
+ refused.length ? `Refused, no acknowledgement helps: ${[...new Set(refused)].join(", ")}.` : ""
36010
+ ].filter(Boolean).join(" ");
36011
+ throw commandError(code, EXIT_GUARDRAIL, [String(body.message || `${action} failed`), detail].filter(Boolean).join(" "));
36012
+ }
35911
36013
  var upgrade = defineCommand({
35912
36014
  meta: { name: "upgrade", description: "Install a newer hive CLI bundle with rollback support" },
35913
36015
  args: withArgs({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@senticor/hive",
3
- "version": "1.135.0",
3
+ "version": "1.136.0",
4
4
  "description": "Cognitive Hive OS — unified CLI",
5
5
  "type": "commonjs",
6
6
  "bin": {