@super_studio/ecforce-ai-agent-server 0.2.0-canary.4 → 1.0.0-canary.7
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.
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.cjs +14 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.mjs +14 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.cjs +27 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.mjs +27 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectWithoutProperties.cjs +15 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectWithoutProperties.mjs +15 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectWithoutPropertiesLoose.cjs +14 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectWithoutPropertiesLoose.mjs +13 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPrimitive.cjs +16 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPrimitive.mjs +16 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPropertyKey.cjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPropertyKey.mjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/typeof.cjs +18 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/typeof.mjs +12 -0
- package/dist/index.cjs +7 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +3 -531
- package/dist/lib/constants.cjs +6 -0
- package/dist/lib/constants.mjs +6 -0
- package/dist/lib/constants.mjs.map +1 -0
- package/dist/lib/jwt.cjs +64 -0
- package/dist/lib/jwt.mjs +64 -0
- package/dist/lib/jwt.mjs.map +1 -0
- package/dist/mcp-auth.cjs +52 -0
- package/dist/mcp-auth.d.cts +38 -0
- package/dist/mcp-auth.d.cts.map +1 -0
- package/dist/mcp-auth.d.mts +38 -0
- package/dist/mcp-auth.d.mts.map +1 -0
- package/dist/mcp-auth.mjs +44 -129
- package/dist/mcp-auth.mjs.map +1 -0
- package/dist/sdk/__generated__/index.cjs +524 -0
- package/dist/sdk/__generated__/index.d.cts +1648 -0
- package/dist/sdk/__generated__/index.d.cts.map +1 -0
- package/dist/sdk/__generated__/index.d.mts +1648 -0
- package/dist/sdk/__generated__/index.d.mts.map +1 -0
- package/dist/sdk/__generated__/index.mjs +523 -0
- package/dist/sdk/__generated__/index.mjs.map +1 -0
- package/dist/sdk/index.cjs +21 -0
- package/dist/sdk/index.d.cts +22 -0
- package/dist/sdk/index.d.cts.map +1 -0
- package/dist/sdk/index.d.mts +22 -0
- package/dist/sdk/index.d.mts.map +1 -0
- package/dist/sdk/index.mjs +22 -0
- package/dist/sdk/index.mjs.map +1 -0
- package/package.json +14 -20
- package/src/sdk/__generated__/index.ts +2194 -532
- package/src/sdk/generate.ts +21 -1
- package/dist/chunk-FWCSY2DS.mjs +0 -37
- package/dist/chunk-ORMEWXMH.js +0 -37
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -532
- package/dist/lib/constants.d.ts +0 -2
- package/dist/lib/constants.d.ts.map +0 -1
- package/dist/lib/jwt.d.ts +0 -37
- package/dist/lib/jwt.d.ts.map +0 -1
- package/dist/mcp-auth.d.ts +0 -35
- package/dist/mcp-auth.d.ts.map +0 -1
- package/dist/mcp-auth.js +0 -136
- package/dist/sdk/__generated__/index.d.ts +0 -637
- package/dist/sdk/__generated__/index.d.ts.map +0 -1
- package/dist/sdk/generate.d.ts +0 -2
- package/dist/sdk/generate.d.ts.map +0 -1
- package/dist/sdk/index.d.ts +0 -19
- package/dist/sdk/index.d.ts.map +0 -1
- package/src/.tmp/test-script.ts +0 -18
package/dist/lib/jwt.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../src/lib/jwt.ts"],"names":[],"mappings":"AAAA;;GAEG;AAkBH,4EAA4E;AAC5E,wBAAsB,MAAM,CAAC,OAAO,GAAG,MAAM,EAC3C,MAAM,EAAE,eAAe,CAAC,OAAO,CAAC,mBAqBjC;AAED,qCAAqC;AACrC,wBAAsB,MAAM,CAAC,OAAO,GAAG,MAAM,EAC3C,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAqCzB;AA2BD,MAAM,WAAW,eAAe,CAAC,OAAO,GAAG,MAAM;IAC/C;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,uBAAuB;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;;OAOG;IACH,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
package/dist/mcp-auth.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 共通のMCPトークンのペイロード。
|
|
3
|
-
* すべてのapps(cdp, ma, bi)はこのトークンの形になります。
|
|
4
|
-
*/
|
|
5
|
-
export type MCPTokenPayload = {
|
|
6
|
-
source: string;
|
|
7
|
-
user: {
|
|
8
|
-
id: string;
|
|
9
|
-
name: string;
|
|
10
|
-
email: string;
|
|
11
|
-
projectId: string;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Uses Auth.js JWT encoding/decoding.
|
|
16
|
-
* @see https://github.com/nextauthjs/next-auth/blob/main/packages/core/src/jwt.ts
|
|
17
|
-
*/
|
|
18
|
-
export declare function createMCPToken(payload: MCPTokenPayload, options?: {
|
|
19
|
-
secret?: string;
|
|
20
|
-
salt?: string;
|
|
21
|
-
maxAge?: number;
|
|
22
|
-
}): Promise<{
|
|
23
|
-
token: string;
|
|
24
|
-
expiresAt: Date;
|
|
25
|
-
}>;
|
|
26
|
-
/**
|
|
27
|
-
* Uses Auth.js JWT encoding/decoding.
|
|
28
|
-
* @see https://github.com/nextauthjs/next-auth/blob/main/packages/core/src/jwt.ts
|
|
29
|
-
*/
|
|
30
|
-
export declare function decodeMCPToken(token: string, options?: {
|
|
31
|
-
secret?: string;
|
|
32
|
-
salt?: string;
|
|
33
|
-
}): Promise<MCPTokenPayload>;
|
|
34
|
-
export declare function getMcpToken(req: Request): string;
|
|
35
|
-
//# sourceMappingURL=mcp-auth.d.ts.map
|
package/dist/mcp-auth.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-auth.d.ts","sourceRoot":"","sources":["../src/mcp-auth.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH,CAAC;AAKF;;;GAGG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,eAAe,EACxB,OAAO,CAAC,EAAE;IACR,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;;;GAkBF;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;IACR,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GACA,OAAO,CAAC,eAAe,CAAC,CAe1B;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,UAMvC"}
|
package/dist/mcp-auth.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-ORMEWXMH.js');
|
|
2
|
-
|
|
3
|
-
// src/lib/jwt.ts
|
|
4
|
-
var _hkdf = require('@panva/hkdf');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _jose = require('jose');
|
|
11
|
-
var DEFAULT_MAX_AGE = 30 * 24 * 60 * 60;
|
|
12
|
-
var now = () => Date.now() / 1e3 | 0;
|
|
13
|
-
var alg = "dir";
|
|
14
|
-
var enc = "A256CBC-HS512";
|
|
15
|
-
async function encode(params) {
|
|
16
|
-
const { token = {}, secret, maxAge = DEFAULT_MAX_AGE, salt } = params;
|
|
17
|
-
const secrets = Array.isArray(secret) ? secret : [secret];
|
|
18
|
-
const encryptionSecret = await getDerivedEncryptionKey(
|
|
19
|
-
enc,
|
|
20
|
-
secrets[0],
|
|
21
|
-
salt
|
|
22
|
-
);
|
|
23
|
-
const thumbprint = await _jose.calculateJwkThumbprint.call(void 0,
|
|
24
|
-
{ kty: "oct", k: _jose.base64url.encode(encryptionSecret) },
|
|
25
|
-
`sha${encryptionSecret.byteLength << 3}`
|
|
26
|
-
);
|
|
27
|
-
return await new (0, _jose.EncryptJWT)(token).setProtectedHeader({ alg, enc, kid: thumbprint }).setIssuedAt().setExpirationTime(now() + maxAge).setJti(crypto.randomUUID()).encrypt(encryptionSecret);
|
|
28
|
-
}
|
|
29
|
-
async function decode(params) {
|
|
30
|
-
const { token, secret, salt } = params;
|
|
31
|
-
const secrets = Array.isArray(secret) ? secret : [secret];
|
|
32
|
-
if (!token) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
const { payload } = await _jose.jwtDecrypt.call(void 0,
|
|
36
|
-
token,
|
|
37
|
-
async ({ kid, enc: enc2 }) => {
|
|
38
|
-
for (const secret2 of secrets) {
|
|
39
|
-
const encryptionSecret = await getDerivedEncryptionKey(
|
|
40
|
-
enc2,
|
|
41
|
-
secret2,
|
|
42
|
-
salt
|
|
43
|
-
);
|
|
44
|
-
if (kid === void 0) {
|
|
45
|
-
return encryptionSecret;
|
|
46
|
-
}
|
|
47
|
-
const thumbprint = await _jose.calculateJwkThumbprint.call(void 0,
|
|
48
|
-
{ kty: "oct", k: _jose.base64url.encode(encryptionSecret) },
|
|
49
|
-
`sha${encryptionSecret.byteLength << 3}`
|
|
50
|
-
);
|
|
51
|
-
if (kid === thumbprint) {
|
|
52
|
-
return encryptionSecret;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
throw new Error("no matching decryption secret");
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
clockTolerance: 15,
|
|
59
|
-
keyManagementAlgorithms: [alg],
|
|
60
|
-
contentEncryptionAlgorithms: [enc, "A256GCM"]
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
return payload;
|
|
64
|
-
}
|
|
65
|
-
async function getDerivedEncryptionKey(enc2, keyMaterial, salt) {
|
|
66
|
-
let length;
|
|
67
|
-
switch (enc2) {
|
|
68
|
-
case "A256CBC-HS512":
|
|
69
|
-
length = 64;
|
|
70
|
-
break;
|
|
71
|
-
case "A256GCM":
|
|
72
|
-
length = 32;
|
|
73
|
-
break;
|
|
74
|
-
default:
|
|
75
|
-
throw new Error("Unsupported JWT Content Encryption Algorithm");
|
|
76
|
-
}
|
|
77
|
-
return await _hkdf.hkdf.call(void 0,
|
|
78
|
-
"sha256",
|
|
79
|
-
keyMaterial,
|
|
80
|
-
salt,
|
|
81
|
-
`Auth.js Generated Encryption Key (${salt})`,
|
|
82
|
-
length
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// src/mcp-auth.ts
|
|
87
|
-
var DEFAULT_MAX_AGE2 = 60 * 10;
|
|
88
|
-
var DEFAULT_SALT = process.env.STAGE === "local" ? "dev" : process.env.STAGE;
|
|
89
|
-
async function createMCPToken(payload, options) {
|
|
90
|
-
var _a, _b, _c;
|
|
91
|
-
const maxAge = (_a = options == null ? void 0 : options.maxAge) != null ? _a : DEFAULT_MAX_AGE2;
|
|
92
|
-
const secret = (_b = options == null ? void 0 : options.secret) != null ? _b : process.env.MCP_TOKEN_SECRET;
|
|
93
|
-
const salt = (_c = options == null ? void 0 : options.salt) != null ? _c : DEFAULT_SALT;
|
|
94
|
-
if (!secret || !salt) {
|
|
95
|
-
throw new Error("Secret or salt is not set");
|
|
96
|
-
}
|
|
97
|
-
const token = await encode({
|
|
98
|
-
token: payload,
|
|
99
|
-
secret,
|
|
100
|
-
salt,
|
|
101
|
-
maxAge
|
|
102
|
-
});
|
|
103
|
-
return {
|
|
104
|
-
token,
|
|
105
|
-
expiresAt: new Date(Date.now() + maxAge * 1e3)
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
async function decodeMCPToken(token, options) {
|
|
109
|
-
var _a, _b;
|
|
110
|
-
const secret = (_a = options == null ? void 0 : options.secret) != null ? _a : process.env.MCP_TOKEN_SECRET;
|
|
111
|
-
const salt = (_b = options == null ? void 0 : options.salt) != null ? _b : DEFAULT_SALT;
|
|
112
|
-
if (!secret || !salt) {
|
|
113
|
-
throw new Error("Secret or salt is not set");
|
|
114
|
-
}
|
|
115
|
-
const decoded = await decode({
|
|
116
|
-
token,
|
|
117
|
-
secret,
|
|
118
|
-
salt
|
|
119
|
-
});
|
|
120
|
-
if (!decoded) {
|
|
121
|
-
throw new Error("Invalid token");
|
|
122
|
-
}
|
|
123
|
-
return decoded;
|
|
124
|
-
}
|
|
125
|
-
function getMcpToken(req) {
|
|
126
|
-
const mcpToken = req.headers.get("X-MCP-Token");
|
|
127
|
-
if (!mcpToken || typeof mcpToken !== "string") {
|
|
128
|
-
throw new Error("Unauthorized");
|
|
129
|
-
}
|
|
130
|
-
return mcpToken;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
exports.createMCPToken = createMCPToken; exports.decodeMCPToken = decodeMCPToken; exports.getMcpToken = getMcpToken;
|