@kosha-ai/integration-hyperdx 0.0.0-stage → 0.5.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Codemancers
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,19 @@
1
- # Temporary Holding Version
1
+ # integration-hyperdx
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ HyperDX (ClickStack) for Kosha. Proxies HyperDX's API and MCP server with a
4
+ personal API access key the end user supplies. HyperDX is self-hosted, so
5
+ each configuration names its URL.
6
+
7
+ ```ts
8
+ hyperdx();
9
+ ```
10
+
11
+ See `docs/setup.md`, which the admin renders beside the configuration form.
12
+
13
+ ## Building
14
+
15
+ Run `nx build integration-hyperdx` to build the library.
16
+
17
+ ## Running unit tests
18
+
19
+ Run `nx test integration-hyperdx` to execute the unit tests via [Jest](https://jestjs.io).
@@ -0,0 +1,2 @@
1
+ export { hyperdx, hyperdx as default } from './lib/integration-hyperdx.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,8BAA8B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export { hyperdx, hyperdx as default } from './lib/integration-hyperdx.js';
@@ -0,0 +1,8 @@
1
+ import type { KoshaIntegration } from '@kosha-ai/integration-sdk';
2
+ /**
3
+ * HyperDX (ClickStack). Proxies its API and MCP server with a personal API
4
+ * access key. The app forwards `/api/*` to the API, so MCP is `/api/mcp`.
5
+ */
6
+ export declare function hyperdx(): KoshaIntegration;
7
+ export default hyperdx;
8
+ //# sourceMappingURL=integration-hyperdx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration-hyperdx.d.ts","sourceRoot":"","sources":["../../src/lib/integration-hyperdx.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AASlE;;;GAGG;AACH,wBAAgB,OAAO,IAAI,gBAAgB,CAgE1C;AAED,eAAe,OAAO,CAAC"}
@@ -0,0 +1,63 @@
1
+ import { apiKey, defineIntegration, packageDirs, } from '@kosha-ai/integration-sdk';
2
+ const { docsPath, migrationsPath } = packageDirs(import.meta.url);
3
+ /**
4
+ * HyperDX (ClickStack). Proxies its API and MCP server with a personal API
5
+ * access key. The app forwards `/api/*` to the API, so MCP is `/api/mcp`.
6
+ */
7
+ export function hyperdx() {
8
+ return defineIntegration({
9
+ key: 'hyperdx',
10
+ name: 'HyperDX',
11
+ docsUrl: 'https://clickhouse.com/docs/use-cases/observability/clickstack',
12
+ docsPath,
13
+ migrationsPath,
14
+ auth: apiKey({
15
+ credentialFields: [
16
+ {
17
+ key: 'credential',
18
+ label: 'Personal API access key',
19
+ type: 'string',
20
+ required: true,
21
+ secret: true,
22
+ help: 'HyperDX → Team Settings → API & Agents → Personal API access key.',
23
+ },
24
+ ],
25
+ }),
26
+ configFields: [
27
+ {
28
+ key: 'url',
29
+ label: 'HyperDX URL',
30
+ type: 'url',
31
+ required: true,
32
+ help: 'The URL your HyperDX is served on, e.g. https://hyperdx.example.com.',
33
+ },
34
+ ],
35
+ api: {
36
+ resolveBaseUrl: ({ fields }) => typeof fields?.['url'] === 'string'
37
+ ? fields['url'].replace(/\/+$/, '')
38
+ : undefined,
39
+ authHeaders: ({ accessToken }) => ({
40
+ Authorization: `Bearer ${accessToken}`,
41
+ }),
42
+ },
43
+ identity: {
44
+ /**
45
+ * Doubles as the credential check: a bad key gets 401. `/api/api/v2`
46
+ * because the API's own external API is under `/api/v2`, behind the
47
+ * app's `/api` prefix.
48
+ */
49
+ async fetchAccount({ accessToken, http }) {
50
+ const { user } = await http.get('/api/api/v2', {
51
+ accessToken,
52
+ });
53
+ if (!user?.email) {
54
+ throw new Error('HyperDX answered without a user, so the key is not valid.');
55
+ }
56
+ // The email, not `_id`: a connection keeps only this, and it is what
57
+ // an app shows as "connected as".
58
+ return { externalAccountId: user.email };
59
+ },
60
+ },
61
+ });
62
+ }
63
+ export default hyperdx;
Binary file
package/docs/setup.md ADDED
@@ -0,0 +1,30 @@
1
+ # HyperDX Setup
2
+
3
+ HyperDX authenticates with a **personal API access key**, not OAuth, so there
4
+ is no app to register. Each person connects with their own key.
5
+
6
+ ### 1. Enter the HyperDX URL
7
+
8
+ In **HyperDX URL**, enter the URL your HyperDX is served on. It can be http or
9
+ a private address, as long as Kosha can reach it.
10
+
11
+ ### 2. Copy the personal key
12
+
13
+ In HyperDX, **Team Settings → API & Agents**, copy the **Personal API access
14
+ key**.
15
+
16
+ ![HyperDX Team Settings, API & Agents, with the Personal API access key outlined](./images/hyperdx-api-keys.png)
17
+
18
+ The key reads as its holder, with their access to the team's data.
19
+
20
+ ### 3. Connect
21
+
22
+ Paste the key where your application asks for it. Kosha checks it with HyperDX
23
+ before storing it, and a bad key is refused.
24
+
25
+ ### Notes
26
+
27
+ - **A key stops working** when its holder is removed from the team or presses
28
+ **Rotate access key**. Connect again with the current key.
29
+ - **Paths** are relative to that URL: MCP is `/api/mcp`, the external API
30
+ `/api/api/v2/...`.
@@ -0,0 +1,49 @@
1
+ CREATE TABLE "hyperdx_configuration" (
2
+ "id" TEXT NOT NULL,
3
+ "environmentId" TEXT NOT NULL,
4
+ "name" TEXT NOT NULL,
5
+ "slug" TEXT NOT NULL,
6
+ -- Encrypted, so TEXT rather than JSONB.
7
+ "credentials" TEXT,
8
+ "url" TEXT NOT NULL,
9
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
10
+ "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
11
+
12
+ CONSTRAINT "hyperdx_configuration_pkey" PRIMARY KEY ("id")
13
+ );
14
+
15
+ CREATE TABLE "hyperdx_connection" (
16
+ "accountId" TEXT NOT NULL,
17
+ -- Copied from `account` so the unique index below can use it.
18
+ "userId" TEXT NOT NULL,
19
+ "environmentId" TEXT NOT NULL,
20
+ "configurationId" TEXT NOT NULL,
21
+ "metadata" JSONB,
22
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
23
+ "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
24
+
25
+ CONSTRAINT "hyperdx_connection_pkey" PRIMARY KEY ("accountId")
26
+ );
27
+
28
+ CREATE UNIQUE INDEX "hyperdx_configuration_environmentId_slug_key" ON "hyperdx_configuration"("environmentId", "slug");
29
+
30
+ CREATE INDEX "hyperdx_configuration_environmentId_idx" ON "hyperdx_configuration"("environmentId");
31
+
32
+ CREATE UNIQUE INDEX "hyperdx_connection_environmentId_configurationId_userId_key" ON "hyperdx_connection"("environmentId", "configurationId", "userId");
33
+
34
+ CREATE INDEX "hyperdx_connection_environmentId_idx" ON "hyperdx_connection"("environmentId");
35
+
36
+ CREATE INDEX "hyperdx_connection_configurationId_idx" ON "hyperdx_connection"("configurationId");
37
+
38
+ CREATE INDEX "hyperdx_connection_userId_idx" ON "hyperdx_connection"("userId");
39
+
40
+ ALTER TABLE "hyperdx_configuration" ADD CONSTRAINT "hyperdx_configuration_environmentId_fkey" FOREIGN KEY ("environmentId") REFERENCES "environment"("id") ON DELETE CASCADE ON UPDATE CASCADE;
41
+
42
+ ALTER TABLE "hyperdx_connection" ADD CONSTRAINT "hyperdx_connection_accountId_fkey" FOREIGN KEY ("accountId") REFERENCES "account"("id") ON DELETE CASCADE ON UPDATE CASCADE;
43
+
44
+ ALTER TABLE "hyperdx_connection" ADD CONSTRAINT "hyperdx_connection_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE;
45
+
46
+ ALTER TABLE "hyperdx_connection" ADD CONSTRAINT "hyperdx_connection_environmentId_fkey" FOREIGN KEY ("environmentId") REFERENCES "environment"("id") ON DELETE CASCADE ON UPDATE CASCADE;
47
+
48
+ -- RESTRICT: a configuration that still has connections cannot be deleted.
49
+ ALTER TABLE "hyperdx_connection" ADD CONSTRAINT "hyperdx_connection_configurationId_fkey" FOREIGN KEY ("configurationId") REFERENCES "hyperdx_configuration"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
package/package.json CHANGED
@@ -1,6 +1,57 @@
1
1
  {
2
2
  "name": "@kosha-ai/integration-hyperdx",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.5.0",
4
+ "description": "HyperDX integration for Kosha",
5
+ "keywords": [
6
+ "kosha",
7
+ "hyperdx",
8
+ "clickstack",
9
+ "api-key",
10
+ "integrations"
11
+ ],
12
+ "license": "MIT",
13
+ "homepage": "https://github.com/codemancers/kosha#readme",
14
+ "bugs": {
15
+ "url": "https://github.com/codemancers/kosha/issues"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/codemancers/kosha.git",
20
+ "directory": "packages/integrations/hyperdx"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "type": "module",
26
+ "main": "./dist/index.js",
27
+ "module": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
29
+ "exports": {
30
+ "./package.json": "./package.json",
31
+ ".": {
32
+ "@org/source": "./src/index.ts",
33
+ "types": "./dist/index.d.ts",
34
+ "import": "./dist/index.js",
35
+ "default": "./dist/index.js"
36
+ }
37
+ },
38
+ "files": [
39
+ "dist",
40
+ "docs",
41
+ "migrations",
42
+ "!**/*.tsbuildinfo"
43
+ ],
44
+ "dependencies": {
45
+ "tslib": "^2.3.0"
46
+ },
47
+ "kosha": {
48
+ "kind": "integration",
49
+ "key": "hyperdx"
50
+ },
51
+ "peerDependencies": {
52
+ "@kosha-ai/integration-sdk": "0.5.0"
53
+ },
54
+ "devDependencies": {
55
+ "@kosha-ai/integration-sdk": "0.5.0"
56
+ }
6
57
  }