@suveren/gateway 0.36.2 → 0.37.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 (55) hide show
  1. package/dist/mcp-server/http.mjs +30 -12
  2. package/dist/ui/assets/{index-BQ5Pr6As.js → index-BC2bXeCQ.js} +26 -26
  3. package/dist/ui/index.html +1 -1
  4. package/node_modules/jose/README.md +2 -2
  5. package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +5 -4
  6. package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +4 -4
  7. package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +5 -4
  8. package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +5 -5
  9. package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +5 -4
  10. package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +5 -5
  11. package/node_modules/jose/dist/types/jws/compact/sign.d.ts +5 -4
  12. package/node_modules/jose/dist/types/jws/compact/verify.d.ts +5 -5
  13. package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +5 -4
  14. package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +6 -5
  15. package/node_modules/jose/dist/types/jws/general/sign.d.ts +9 -6
  16. package/node_modules/jose/dist/types/jws/general/verify.d.ts +7 -5
  17. package/node_modules/jose/dist/types/jwt/decrypt.d.ts +7 -6
  18. package/node_modules/jose/dist/types/jwt/encrypt.d.ts +1 -1
  19. package/node_modules/jose/dist/types/jwt/sign.d.ts +1 -1
  20. package/node_modules/jose/dist/types/jwt/unsecured.d.ts +1 -1
  21. package/node_modules/jose/dist/types/jwt/verify.d.ts +3 -5
  22. package/node_modules/jose/dist/types/key/export.d.ts +1 -1
  23. package/node_modules/jose/dist/types/key/generate_secret.d.ts +1 -1
  24. package/node_modules/jose/dist/types/key/import.d.ts +2 -2
  25. package/node_modules/jose/dist/types/types.d.ts +165 -107
  26. package/node_modules/jose/dist/types/util/decode_jwt.d.ts +2 -2
  27. package/node_modules/jose/dist/types/util/errors.d.ts +1 -1
  28. package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +3 -3
  29. package/node_modules/jose/dist/webapi/jwk/thumbprint.js +8 -8
  30. package/node_modules/jose/dist/webapi/jwks/local.js +2 -1
  31. package/node_modules/jose/dist/webapi/jwks/remote.js +4 -4
  32. package/node_modules/jose/dist/webapi/jws/general/sign.js +3 -3
  33. package/node_modules/jose/dist/webapi/jws/general/verify.js +3 -3
  34. package/node_modules/jose/dist/webapi/jwt/encrypt.js +2 -2
  35. package/node_modules/jose/dist/webapi/jwt/sign.js +2 -2
  36. package/node_modules/jose/dist/webapi/jwt/unsecured.js +3 -3
  37. package/node_modules/jose/dist/webapi/key/generate_secret.js +4 -4
  38. package/node_modules/jose/dist/webapi/lib/asn1.js +2 -2
  39. package/node_modules/jose/dist/webapi/lib/buffer_utils.js +4 -4
  40. package/node_modules/jose/dist/webapi/lib/content_encryption.js +8 -8
  41. package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +14 -14
  42. package/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +3 -3
  43. package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +2 -2
  44. package/node_modules/jose/dist/webapi/lib/jws_sign.js +11 -11
  45. package/node_modules/jose/dist/webapi/lib/jws_verify.js +19 -16
  46. package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +44 -43
  47. package/node_modules/jose/dist/webapi/lib/key.js +4 -4
  48. package/node_modules/jose/dist/webapi/lib/key_management.js +17 -17
  49. package/node_modules/jose/dist/webapi/lib/validate.js +10 -10
  50. package/node_modules/jose/dist/webapi/util/decode_jwt.js +12 -12
  51. package/node_modules/jose/dist/webapi/util/decode_protected_header.js +5 -5
  52. package/node_modules/jose/package.json +1 -1
  53. package/package.json +1 -1
  54. package/profiles/delegation/0.6.profile.json +183 -0
  55. package/profiles/index.json +2 -1
@@ -10527,7 +10527,7 @@ function unifiedLineDiff(before, after) {
10527
10527
  }
10528
10528
 
10529
10529
  // src/lib/builtins/setup.ts
10530
- import { getProfile as getProfile9 } from "@hap/core";
10530
+ import { getProfile as getProfile9, listProfiles } from "@hap/core";
10531
10531
  var DELEGATION_PROFILE = "delegation";
10532
10532
  var DELEGATION_INTENT_HINT = [
10533
10533
  "Why \u2014 With test data only, I want to find out which routine parts of my work an AI could take over, so people gain time \u2014 before anything touches real systems.",
@@ -10571,10 +10571,28 @@ function shortName(idOrName) {
10571
10571
  function versionOf(id) {
10572
10572
  return id.split("@")[1] ?? "";
10573
10573
  }
10574
- function delegationItselfRefusal(args) {
10575
- const requested = typeof args.profile === "string" ? args.profile : "";
10576
- if (shortName(requested) === DELEGATION_PROFILE) {
10577
- return "Delegation can never be proposed \u2014 the AI cannot widen its own delegation.";
10574
+ var MANDATE_ACTION = "mandate";
10575
+ function knownVersions(short) {
10576
+ const byId = /* @__PURE__ */ new Map();
10577
+ for (const key of listProfiles()) {
10578
+ if (shortName(key) !== short) continue;
10579
+ const p = getProfile9(key);
10580
+ if (p) byId.set(p.id, p);
10581
+ }
10582
+ return [...byId.values()];
10583
+ }
10584
+ function proposalTargetRefusal(args) {
10585
+ const requested = typeof args.profile === "string" ? shortName(args.profile.trim()) : "";
10586
+ const versions = requested ? knownVersions(requested) : [];
10587
+ if (versions.length === 0) {
10588
+ return { code: "UNKNOWN_PROFILE", message: `Unknown profile "${requested}" \u2014 not in this gateway's profile catalog.` };
10589
+ }
10590
+ if (versions.some((p) => p.boundsSchema?.actionTypes?.includes(MANDATE_ACTION))) {
10591
+ const name = versions.map((p) => p.name).find(Boolean) ?? requested;
10592
+ return {
10593
+ code: "DELEGATION_NOT_PROPOSABLE",
10594
+ message: `${name} can never be proposed \u2014 it lets an AI propose mandates, and the AI cannot widen its own delegation.`
10595
+ };
10578
10596
  }
10579
10597
  return void 0;
10580
10598
  }
@@ -10741,7 +10759,7 @@ function setupBuiltin(deps) {
10741
10759
  },
10742
10760
  create_mandate: {
10743
10761
  executionMapping: { profile: "allowed_profiles", mode: "allowed_modes" },
10744
- staticExecution: { action_type: "mandate" },
10762
+ staticExecution: { action_type: MANDATE_ACTION },
10745
10763
  actionLabel: "Mandate proposed",
10746
10764
  hideUnlessAuthorized: true,
10747
10765
  // Shown like the mandate screen: limits and scope by the profile's own names.
@@ -10830,7 +10848,7 @@ ${body}`);
10830
10848
  description: "Propose a new mandate for the person running this gateway \u2014 the authority another tool needs (e.g. sales quotes up to a value). Always goes to the person's current workspace (their team, or Personal if they are not in one) \u2014 there is no way to name a different one. A person approves or rejects the proposal; only after approval is the mandate created, exactly as if they had signed it on the mandate screen. Checked against the profile before the proposal: unknown limits, a mode the profile does not allow, or a team where the person may not give this mandate are refused at once. Outside simulation mode, the profile and mode you may propose are themselves limited by your Delegation mandate's scope \u2014 Delegation itself can never be proposed. Create only.",
10831
10849
  inputSchema: CREATE_MANDATE_INPUT_SCHEMA,
10832
10850
  validate: async (args) => {
10833
- const fixed = delegationItselfRefusal(args);
10851
+ const fixed = proposalTargetRefusal(args);
10834
10852
  if (fixed) {
10835
10853
  deps.state.denialLog?.record({
10836
10854
  ts: Date.now(),
@@ -10838,18 +10856,18 @@ ${body}`);
10838
10856
  integrationId: "setup",
10839
10857
  profile: DELEGATION_PROFILE,
10840
10858
  kind: "bound",
10841
- detail: fixed,
10859
+ detail: fixed.message,
10842
10860
  who: "gateway",
10843
- code: "DELEGATION_NOT_PROPOSABLE"
10861
+ code: fixed.code
10844
10862
  });
10845
- return fixed;
10863
+ return fixed.message;
10846
10864
  }
10847
10865
  const check = await controlPlaneMandate(true, mandateRequest(args));
10848
10866
  return check.ok ? void 0 : check.message;
10849
10867
  },
10850
10868
  handler: async (args) => {
10851
- const fixed = delegationItselfRefusal(args);
10852
- if (fixed) return { ...builtinText(`Refused: ${fixed}`), isError: true };
10869
+ const fixed = proposalTargetRefusal(args);
10870
+ if (fixed) return { ...builtinText(`Refused: ${fixed.message}`), isError: true };
10853
10871
  const r = await controlPlaneMandate(false, mandateRequest(args));
10854
10872
  if (!r.ok) return { ...builtinText(`Refused: ${r.message}`), isError: true };
10855
10873
  return builtinText(