@metamynd/agentsafe-signer 0.19.1 → 0.19.2

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/package.json +1 -1
  2. package/policy-core.mjs +9 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamynd/agentsafe-signer",
3
- "version": "0.19.1",
3
+ "version": "0.19.2",
4
4
  "description": "Local signer daemon for AgentSafe agent/service keys \u2014 the key never enters the calling guard's own process. See docs/design/agent-key-custody-local-signer-daemon-plan.md.",
5
5
  "type": "module",
6
6
  "main": "./daemon.mjs",
package/policy-core.mjs CHANGED
@@ -409,6 +409,11 @@ function requiredContextFor(predicates) {
409
409
  return [...fields].sort();
410
410
  }
411
411
 
412
+ // src/policy-core/own-entry.ts
413
+ function ownEntry(table, key) {
414
+ return typeof key === "string" && Object.prototype.hasOwnProperty.call(table, key) ? table[key] : void 0;
415
+ }
416
+
412
417
  // src/policy-core/standards-rules.ts
413
418
  var CONTEXT_UNVERIFIABLE = "CONTEXT_UNVERIFIABLE";
414
419
  var JURISDICTION_ATOM = "jurisdiction-not-allowed";
@@ -417,7 +422,7 @@ function documentEnforcesJurisdiction(doc) {
417
422
  }
418
423
  var PRECEDENCE = { allow: 0, observe: 1, escalate: 2, block: 3, suspend: 4, quarantine: 5, decommission: 6 };
419
424
  function atomFires(atom, ctx) {
420
- const pred = ATOM_REGISTRY[atom.predicate];
425
+ const pred = ownEntry(ATOM_REGISTRY, atom.predicate);
421
426
  if (!pred) return false;
422
427
  try {
423
428
  return !!pred(ctx, atom.config);
@@ -554,7 +559,7 @@ function validateMolecules(molecules) {
554
559
  }
555
560
  }
556
561
  for (const a of m.atoms ?? []) {
557
- if (!ATOM_REGISTRY[a.predicate]) {
562
+ if (!ownEntry(ATOM_REGISTRY, a.predicate)) {
558
563
  issues.push({ moleculeId: m.id, message: `unknown atom predicate '${a.predicate}'` });
559
564
  continue;
560
565
  }
@@ -602,10 +607,10 @@ function reasonFor(constraint, req) {
602
607
  const v = req.values[leftOperand];
603
608
  return v === void 0 || v === null || v === "" ? "JURISDICTION_REQUIRED" : "JURISDICTION_NOT_ALLOWED";
604
609
  }
605
- return REASON_BY_OPERAND[leftOperand] ?? `CONSTRAINT_FAILED:${leftOperand}`;
610
+ return ownEntry(REASON_BY_OPERAND, leftOperand) ?? `CONSTRAINT_FAILED:${leftOperand}`;
606
611
  }
607
612
  function constraintSatisfied(c, req, strict) {
608
- const op = OPERATORS[c.operator];
613
+ const op = ownEntry(OPERATORS, c.operator);
609
614
  if (!op) return false;
610
615
  const left = Object.prototype.hasOwnProperty.call(req.values, c.leftOperand) ? req.values[c.leftOperand] : void 0;
611
616
  if (!c.unit) return op(left, c.rightOperand);