@stigmer/mcp-server 3.13.0 → 3.14.0-dev.20260910084630

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.
@@ -64,9 +64,9 @@ export function domainError(ce) {
64
64
  // The messaging RPCs attach google.rpc.ErrorInfo to operator-actionable
65
65
  // preconditions (DD-005 D8); absence means the message alone carries
66
66
  // the contract.
67
- const details = ce.findDetails(ErrorInfoSchema);
68
- if (details.length > 0 && details[0].reason !== "") {
69
- payload.reason = details[0].reason;
67
+ const info = ce.findDetails(ErrorInfoSchema)[0];
68
+ if (info && info.reason !== "") {
69
+ payload.reason = info.reason;
70
70
  }
71
71
  return payload;
72
72
  }
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/domains/channels/errors.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,qEAAqE;AACrE,gEAAgE;AAChE,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,uEAAuE;AACvE,sEAAsE;AACtE,oEAAoE;AACpE,uEAAuE;AACvE,wEAAwE;AACxE,sEAAsE;AACtE,oEAAoE;AACpE,uEAAuE;AACvE,wDAAwD;AACxD,EAAE;AACF,uEAAuE;AACvE,uEAAuE;AACvE,4BAA4B;AAE5B,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,YAAY,GAAsB,IAAI,GAAG,CAAC;IAC9C,IAAI,CAAC,gBAAgB;IACrB,IAAI,CAAC,eAAe;IACpB,IAAI,CAAC,kBAAkB;CACxB,CAAC,CAAC;AAYH;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,C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AE,IAAI;aACd,CAAC;QACJ,CAAC;QACD,OAAO,WAAW,CAAC,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC,CAAC;IAChD,CAAC;AACH,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,WAAW,CAAC,EAAgB;IAC1C,MAAM,OAAO,GAAqB;QAChC,KAAK,EAAE,EAAE,CAAC,UAAU;QACpB,IAAI,EAAE,cAAc,CAAC,EAAE,CAAC,IAAI,CAAC;KAC9B,CAAC;IACF,wEAAwE;IACxE,qEAAqE;IACrE,gBAAgB;IAChB,MAAM,IAAI,GAAG,EAAE,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QAC/B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC/B,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,6EAA6E;AAC7E,SAAS,cAAc,CAAC,IAAU;IAChC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;AACzE,CAAC"}
@@ -59,9 +59,9 @@ export function domainError(ce) {
59
59
  error: ce.rawMessage,
60
60
  code: grpcStatusName(ce.code),
61
61
  };
62
- const details = ce.findDetails(ErrorInfoSchema);
63
- if (details.length > 0 && details[0].reason !== "") {
64
- payload.reason = details[0].reason;
62
+ const info = ce.findDetails(ErrorInfoSchema)[0];
63
+ if (info && info.reason !== "") {
64
+ payload.reason = info.reason;
65
65
  }
66
66
  return payload;
67
67
  }
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/domains/memory/errors.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yEAAyE;AACzE,oDAAoD;AACpD,EAAE;AACF,wEAAwE;AACxE,sEAAsE;AACtE,gEAAgE;AAChE,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W,EAAE,CAAC;AACzE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stigmer/mcp-server",
3
- "version": "3.13.0",
3
+ "version": "3.14.0-dev.20260910084630",
4
4
  "description": "Model Context Protocol server for the Stigmer platform — exposes Stigmer agents, skills, MCP servers, and workflows as MCP tools and resources",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -35,8 +35,8 @@
35
35
  "@connectrpc/connect": "^2.0.0",
36
36
  "@connectrpc/connect-node": "^2.1.1",
37
37
  "@modelcontextprotocol/sdk": "^1.26.0",
38
- "@stigmer/protos": "3.13.0",
39
- "@stigmer/sdk": "3.13.0",
38
+ "@stigmer/protos": "3.14.0-dev.20260910084630",
39
+ "@stigmer/sdk": "3.14.0-dev.20260910084630",
40
40
  "yaml": "^2.8.2",
41
41
  "zod": "^3.25.0"
42
42
  }
@@ -0,0 +1,52 @@
1
+ // Unit tests for the channels-domain error projection: the verbatim
2
+ // message and status name always; the google.rpc.ErrorInfo reason only
3
+ // when the server attached one with a non-empty reason (DD-005 D8 —
4
+ // absence means the message alone carries the contract).
5
+
6
+ import { Code, ConnectError } from "@connectrpc/connect";
7
+ import { create } from "@bufbuild/protobuf";
8
+ import { describe, expect, it } from "vitest";
9
+ import { ErrorInfoSchema } from "@stigmer/protos/google/rpc/error_details_pb";
10
+
11
+ import { domainError } from "./errors";
12
+
13
+ function preconditionWith(reason: string): ConnectError {
14
+ return new ConnectError(
15
+ "registry misconfigured",
16
+ Code.FailedPrecondition,
17
+ undefined,
18
+ [
19
+ {
20
+ desc: ErrorInfoSchema,
21
+ value: create(ErrorInfoSchema, { reason, domain: "stigmer.ai" }),
22
+ },
23
+ ],
24
+ );
25
+ }
26
+
27
+ describe("domainError", () => {
28
+ it("carries the ErrorInfo reason when the server attached one", () => {
29
+ expect(
30
+ domainError(preconditionWith("WHATSAPP_MANAGEMENT_SCOPE_MISSING")),
31
+ ).toEqual({
32
+ error: "registry misconfigured",
33
+ code: "FAILED_PRECONDITION",
34
+ reason: "WHATSAPP_MANAGEMENT_SCOPE_MISSING",
35
+ });
36
+ });
37
+
38
+ it("omits the reason key when the attached ErrorInfo has an empty reason", () => {
39
+ expect(domainError(preconditionWith(""))).toEqual({
40
+ error: "registry misconfigured",
41
+ code: "FAILED_PRECONDITION",
42
+ });
43
+ });
44
+
45
+ it("omits the reason key when no ErrorInfo detail is attached", () => {
46
+ const ce = new ConnectError("channel is required", Code.InvalidArgument);
47
+ expect(domainError(ce)).toEqual({
48
+ error: "channel is required",
49
+ code: "INVALID_ARGUMENT",
50
+ });
51
+ });
52
+ });
@@ -81,9 +81,9 @@ export function domainError(ce: ConnectError): ChannelToolError {
81
81
  // The messaging RPCs attach google.rpc.ErrorInfo to operator-actionable
82
82
  // preconditions (DD-005 D8); absence means the message alone carries
83
83
  // the contract.
84
- const details = ce.findDetails(ErrorInfoSchema);
85
- if (details.length > 0 && details[0].reason !== "") {
86
- payload.reason = details[0].reason;
84
+ const info = ce.findDetails(ErrorInfoSchema)[0];
85
+ if (info && info.reason !== "") {
86
+ payload.reason = info.reason;
87
87
  }
88
88
  return payload;
89
89
  }
@@ -0,0 +1,54 @@
1
+ // Unit tests for the memory-domain error projection: the verbatim message
2
+ // and status name always; the google.rpc.ErrorInfo reason only when the
3
+ // server attached one with a non-empty reason (absence means the message
4
+ // alone carries the contract — "memory is full" needs no reason code to
5
+ // be relayed honestly).
6
+
7
+ import { Code, ConnectError } from "@connectrpc/connect";
8
+ import { create } from "@bufbuild/protobuf";
9
+ import { describe, expect, it } from "vitest";
10
+ import { ErrorInfoSchema } from "@stigmer/protos/google/rpc/error_details_pb";
11
+
12
+ import { domainError } from "./errors";
13
+
14
+ function preconditionWith(reason: string): ConnectError {
15
+ return new ConnectError(
16
+ "memory is disabled for this organization",
17
+ Code.FailedPrecondition,
18
+ undefined,
19
+ [
20
+ {
21
+ desc: ErrorInfoSchema,
22
+ value: create(ErrorInfoSchema, { reason, domain: "stigmer.ai" }),
23
+ },
24
+ ],
25
+ );
26
+ }
27
+
28
+ describe("domainError", () => {
29
+ it("carries the ErrorInfo reason when the server attached one", () => {
30
+ expect(domainError(preconditionWith("MEMORY_DISABLED_FOR_ORG"))).toEqual({
31
+ error: "memory is disabled for this organization",
32
+ code: "FAILED_PRECONDITION",
33
+ reason: "MEMORY_DISABLED_FOR_ORG",
34
+ });
35
+ });
36
+
37
+ it("omits the reason key when the attached ErrorInfo has an empty reason", () => {
38
+ expect(domainError(preconditionWith(""))).toEqual({
39
+ error: "memory is disabled for this organization",
40
+ code: "FAILED_PRECONDITION",
41
+ });
42
+ });
43
+
44
+ it("omits the reason key when no ErrorInfo detail is attached", () => {
45
+ const ce = new ConnectError(
46
+ "memory content must be 1..500 characters",
47
+ Code.InvalidArgument,
48
+ );
49
+ expect(domainError(ce)).toEqual({
50
+ error: "memory content must be 1..500 characters",
51
+ code: "INVALID_ARGUMENT",
52
+ });
53
+ });
54
+ });
@@ -76,9 +76,9 @@ export function domainError(ce: ConnectError): MemoryToolError {
76
76
  error: ce.rawMessage,
77
77
  code: grpcStatusName(ce.code),
78
78
  };
79
- const details = ce.findDetails(ErrorInfoSchema);
80
- if (details.length > 0 && details[0].reason !== "") {
81
- payload.reason = details[0].reason;
79
+ const info = ce.findDetails(ErrorInfoSchema)[0];
80
+ if (info && info.reason !== "") {
81
+ payload.reason = info.reason;
82
82
  }
83
83
  return payload;
84
84
  }