@sendinel/mcp-server 1.0.223 → 1.0.224

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.
@@ -11,7 +11,7 @@ import { logTesterRequestAudit } from './tester-request-audit.js';
11
11
  import { approvalStore } from './tester-requests-store.js';
12
12
  import { createHash } from 'node:crypto';
13
13
  import { approvalSetupSummary, buildApprovalPreview, isHumanApprovalChannel, triggerChangeSummary, decodeHtmlEntities, stripHtmlComments } from '@sendinel/domain';
14
- import { requestContext } from '../db.js';
14
+ import { adminDb, requestContext } from '../db.js';
15
15
  import { getProjectId } from '../project.js';
16
16
  import { captureApprovalSnapshot, withoutApprovalSnapshot, withoutApprovalDisplay } from './approval-snapshot.js';
17
17
  import { fireWebhookEvent } from './webhook-events.js';
@@ -705,7 +705,31 @@ export function withApproval(action, handler, options = {}) {
705
705
  let decidedBy;
706
706
  let decisionChannel;
707
707
  let consumedAt;
708
- if (decision.tier !== 'autonomous') {
708
+ if (decision.tier === 'autonomous') {
709
+ try {
710
+ await assertResourcesBelongToActiveProject(action, params);
711
+ }
712
+ catch (error) {
713
+ if (!(error instanceof ResourceProjectRefusal))
714
+ throw error;
715
+ const actor = requestContext();
716
+ try {
717
+ const { error: auditError } = await adminDb().schema('email').from('audit_log').insert({
718
+ project_id: getProjectId(), actor_type: actor?.actorType ?? 'mcp', actor_id: actor?.actorId ?? null,
719
+ action: 'approval.resource_project_refused', resource_type: 'approval', channel: channelContext.channel,
720
+ details: { action, tool: action, owner_project_id: error.ownerProjectId },
721
+ });
722
+ if (auditError)
723
+ throw auditError;
724
+ }
725
+ catch {
726
+ // An unavailable audit store must never turn a refusal into execution.
727
+ console.warn('[mcp] Could not audit resource project refusal; request remains refused.');
728
+ }
729
+ return plainRefusalResult(error.message);
730
+ }
731
+ }
732
+ else {
709
733
  if (!approval_id) {
710
734
  const display = options.display ? await options.display(params) : undefined;
711
735
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendinel/mcp-server",
3
- "version": "1.0.223",
3
+ "version": "1.0.224",
4
4
  "description": "AI-controlled email operations control plane for campaigns, contacts, segments, analytics, and multi-provider sending via MCP.",
5
5
  "mcpName": "ai.sendinel/mcp-server",
6
6
  "type": "module",