@heossi/qnsi 0.3.4 → 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/CHANGELOG.md +1 -1
- package/README.md +8 -8
- package/dist/_activation/types.d.ts +16 -0
- package/dist/_activation/types.d.ts.map +1 -1
- package/dist/_activation/types.js +8 -0
- package/dist/_activation/types.js.map +1 -1
- package/dist/_internal.d.ts +5 -5
- package/dist/_internal.d.ts.map +1 -1
- package/dist/_internal.js +11 -8
- package/dist/_internal.js.map +1 -1
- package/dist/audit.d.ts.map +1 -1
- package/dist/audit.js +26 -2
- package/dist/audit.js.map +1 -1
- package/dist/autogen/executor.d.ts +5 -5
- package/dist/autogen/executor.d.ts.map +1 -1
- package/dist/autogen/executor.js +8 -5
- package/dist/autogen/executor.js.map +1 -1
- package/dist/autogen/index.d.ts +4 -4
- package/dist/autogen/index.d.ts.map +1 -1
- package/dist/autogen/index.js +4 -16
- package/dist/autogen/index.js.map +1 -1
- package/dist/browser/sdk-package-version.d.ts +1 -1
- package/dist/browser/sdk-package-version.js +1 -1
- package/dist/cli/commands/access-control.js +6 -6
- package/dist/cli/commands/audit.js +1 -1
- package/dist/cli/commands/billing.js +3 -3
- package/dist/cli/commands/crypto-policy.js +4 -4
- package/dist/cli/commands/kms.js +5 -5
- package/dist/cli/commands/observability.js +1 -1
- package/dist/cli/commands/search.js +1 -1
- package/dist/cli/commands/security.js +4 -4
- package/dist/cli/commands/storage.js +2 -2
- package/dist/cli/commands/tenant.js +2 -2
- package/dist/cli/commands/vault.js +4 -4
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +22 -19
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/utils/audit-logger.d.ts.map +1 -1
- package/dist/cli/utils/audit-logger.js +4 -1
- package/dist/cli/utils/audit-logger.js.map +1 -1
- package/dist/cli/utils/auth.js +2 -2
- package/dist/cli/utils/backend-validator.d.ts.map +1 -1
- package/dist/cli/utils/backend-validator.js +4 -1
- package/dist/cli/utils/backend-validator.js.map +1 -1
- package/dist/client.d.ts +4 -4
- package/dist/client.js +1 -1
- package/dist/errors.d.ts +5 -5
- package/dist/errors.js +10 -10
- package/dist/index.d.ts +23 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -4
- package/dist/index.js.map +1 -1
- package/dist/internal/env-aliases.d.ts +10 -0
- package/dist/internal/env-aliases.d.ts.map +1 -0
- package/dist/internal/env-aliases.js +25 -0
- package/dist/internal/env-aliases.js.map +1 -0
- package/dist/kms.js +4 -4
- package/dist/langchain/index.d.ts +9 -9
- package/dist/langchain/index.d.ts.map +1 -1
- package/dist/langchain/index.js +7 -18
- package/dist/langchain/index.js.map +1 -1
- package/dist/langchain/toolkit.d.ts +6 -6
- package/dist/langchain/toolkit.d.ts.map +1 -1
- package/dist/langchain/toolkit.js +16 -13
- package/dist/langchain/toolkit.js.map +1 -1
- package/dist/langchain/tools/audit.d.ts +3 -3
- package/dist/langchain/tools/audit.js +1 -1
- package/dist/langchain/tools/kms.d.ts +5 -5
- package/dist/langchain/tools/kms.js +2 -2
- package/dist/langchain/tools/vault.d.ts +3 -3
- package/dist/langchain/tools/vault.js +3 -3
- package/dist/langchain/vault-client.d.ts +1 -1
- package/dist/langchain/vault-client.js +1 -1
- package/dist/llamaindex/index.d.ts +4 -4
- package/dist/llamaindex/index.d.ts.map +1 -1
- package/dist/llamaindex/index.js +4 -14
- package/dist/llamaindex/index.js.map +1 -1
- package/dist/llamaindex/vector-store.d.ts +5 -5
- package/dist/llamaindex/vector-store.d.ts.map +1 -1
- package/dist/llamaindex/vector-store.js +8 -5
- package/dist/llamaindex/vector-store.js.map +1 -1
- package/dist/storage.d.ts +1 -1
- package/dist/storage.js +3 -3
- package/dist/webhooks.d.ts +5 -5
- package/dist/webhooks.js +15 -15
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -39,15 +39,31 @@ export { AuditClient } from "./audit.js";
|
|
|
39
39
|
export { AuthClient } from "./auth.js";
|
|
40
40
|
export { BillingClient } from "./billing.js";
|
|
41
41
|
// QnsiClient is the canonical name (product is QNSI). QnspClient is kept as a
|
|
42
|
-
// back-compat alias for consumers on the pre-rebrand name.
|
|
43
|
-
export {
|
|
42
|
+
// @deprecated back-compat alias for consumers on the pre-rebrand name.
|
|
43
|
+
export { QnsiClient,
|
|
44
|
+
/** @deprecated Use `QnsiClient`. Kept for pre-rebrand consumers. */
|
|
45
|
+
QnsiClient as QnspClient, } from "./client.js";
|
|
44
46
|
export { CryptoInventoryClient } from "./crypto-inventory.js";
|
|
45
|
-
export {
|
|
47
|
+
export { QnsiApiError,
|
|
48
|
+
/** @deprecated Use `QnsiApiError`. */
|
|
49
|
+
QnsiApiError as QnspApiError, QnsiAuthError,
|
|
50
|
+
/** @deprecated Use `QnsiAuthError`. */
|
|
51
|
+
QnsiAuthError as QnspAuthError, QnsiError,
|
|
52
|
+
/** @deprecated Use `QnsiError`. */
|
|
53
|
+
QnsiError as QnspError, QnsiNetworkError,
|
|
54
|
+
/** @deprecated Use `QnsiNetworkError`. */
|
|
55
|
+
QnsiNetworkError as QnspNetworkError, QnsiWebhookError,
|
|
56
|
+
/** @deprecated Use `QnsiWebhookError`. */
|
|
57
|
+
QnsiWebhookError as QnspWebhookError, } from "./errors.js";
|
|
46
58
|
export { KmsClient } from "./kms.js";
|
|
47
59
|
export { SearchClient, } from "./search.js";
|
|
48
60
|
export { StorageClient } from "./storage.js";
|
|
49
61
|
export { TenantClient } from "./tenant.js";
|
|
50
62
|
// Service classes — exported so callers can construct mocks for testing.
|
|
51
63
|
export { VaultClient } from "./vault.js";
|
|
52
|
-
export { MAX_WEBHOOK_SKEW_MS,
|
|
64
|
+
export { MAX_WEBHOOK_SKEW_MS, parseQnsiWebhook,
|
|
65
|
+
/** @deprecated Use `parseQnsiWebhook`. */
|
|
66
|
+
parseQnsiWebhook as parseQnspWebhook, verifyQnsiWebhookSignature,
|
|
67
|
+
/** @deprecated Use `verifyQnsiWebhookSignature`. */
|
|
68
|
+
verifyQnsiWebhookSignature as verifyQnspWebhookSignature, } from "./webhooks.js";
|
|
53
69
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EACN,YAAY,GAIZ,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,QAAQ,GAKR,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,WAAW,EAAwB,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAqB,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,aAAa,EAA2B,MAAM,cAAc,CAAC;AACtE,8EAA8E;AAC9E,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EACN,YAAY,GAIZ,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,QAAQ,GAKR,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,WAAW,EAAwB,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAqB,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,aAAa,EAA2B,MAAM,cAAc,CAAC;AACtE,8EAA8E;AAC9E,uEAAuE;AACvE,OAAO,EACN,UAAU;AACV,oEAAoE;AACpE,UAAU,IAAI,UAAU,GAIxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAA8B,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EACN,YAAY;AACZ,sCAAsC;AACtC,YAAY,IAAI,YAAY,EAC5B,aAAa;AACb,uCAAuC;AACvC,aAAa,IAAI,aAAa,EAC9B,SAAS;AACT,mCAAmC;AACnC,SAAS,IAAI,SAAS,EACtB,gBAAgB;AAChB,0CAA0C;AAC1C,gBAAgB,IAAI,gBAAgB,EACpC,gBAAgB;AAChB,0CAA0C;AAC1C,gBAAgB,IAAI,gBAAgB,GACpC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAyB,SAAS,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAGN,YAAY,GAEZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAuB,aAAa,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAA4B,YAAY,EAAE,MAAM,aAAa,CAAC;AACrE,yEAAyE;AACzE,OAAO,EAA4B,WAAW,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EACN,mBAAmB,EACnB,gBAAgB;AAChB,0CAA0C;AAC1C,gBAAgB,IAAI,gBAAgB,EAIpC,0BAA0B;AAC1B,oDAAoD;AACpD,0BAA0B,IAAI,0BAA0B,GACxD,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QNSI env-var bridge (SDK-local copy — the published package cannot depend
|
|
3
|
+
* on internal workspace libs). Mirrors `QNSI_<NAME>` ↔ `QNSP_<NAME>` in
|
|
4
|
+
* process.env without overwriting explicitly-set values, so:
|
|
5
|
+
* - users following current docs (`QNSI_API_KEY`, `QNSI_TENANT_ID`, …) work;
|
|
6
|
+
* - users with legacy `QNSP_*` variables keep working forever.
|
|
7
|
+
* Call once, idempotently, before reading either family.
|
|
8
|
+
*/
|
|
9
|
+
export declare function bridgeQnsiEnv(env?: NodeJS.ProcessEnv): void;
|
|
10
|
+
//# sourceMappingURL=env-aliases.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-aliases.d.ts","sourceRoot":"","sources":["../../src/internal/env-aliases.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,IAAI,CAWxE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QNSI env-var bridge (SDK-local copy — the published package cannot depend
|
|
3
|
+
* on internal workspace libs). Mirrors `QNSI_<NAME>` ↔ `QNSP_<NAME>` in
|
|
4
|
+
* process.env without overwriting explicitly-set values, so:
|
|
5
|
+
* - users following current docs (`QNSI_API_KEY`, `QNSI_TENANT_ID`, …) work;
|
|
6
|
+
* - users with legacy `QNSP_*` variables keep working forever.
|
|
7
|
+
* Call once, idempotently, before reading either family.
|
|
8
|
+
*/
|
|
9
|
+
export function bridgeQnsiEnv(env = process.env) {
|
|
10
|
+
for (const [key, value] of Object.entries(env)) {
|
|
11
|
+
if (value === undefined)
|
|
12
|
+
continue;
|
|
13
|
+
if (key.startsWith("QNSP_")) {
|
|
14
|
+
const alias = `QNSI_${key.slice("QNSP_".length)}`;
|
|
15
|
+
if (env[alias] === undefined)
|
|
16
|
+
env[alias] = value;
|
|
17
|
+
}
|
|
18
|
+
else if (key.startsWith("QNSI_")) {
|
|
19
|
+
const alias = `QNSP_${key.slice("QNSI_".length)}`;
|
|
20
|
+
if (env[alias] === undefined)
|
|
21
|
+
env[alias] = value;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=env-aliases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-aliases.js","sourceRoot":"","sources":["../../src/internal/env-aliases.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,MAAyB,OAAO,CAAC,GAAG;IACjE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAChD,IAAI,KAAK,KAAK,SAAS;YAAE,SAAS;QAClC,IAAI,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAC7B,MAAM,KAAK,GAAG,QAAQ,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAClD,IAAI,GAAG,CAAC,KAAK,CAAC,KAAK,SAAS;gBAAE,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;QAClD,CAAC;aAAM,IAAI,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YACpC,MAAM,KAAK,GAAG,QAAQ,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAClD,IAAI,GAAG,CAAC,KAAK,CAAC,KAAK,SAAS;gBAAE,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;QAClD,CAAC;IACF,CAAC;AACF,CAAC"}
|
package/dist/kms.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* QNSP KMS — server-side PQC keys with sign, verify, wrap, and unwrap.
|
|
3
3
|
* Wraps `apps/kms-service` (`/kms/v1`).
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { QnsiApiError } from "./errors.js";
|
|
6
6
|
const PATH_PREFIX = "/proxy/kms/v1";
|
|
7
7
|
export class KmsClient {
|
|
8
8
|
internal;
|
|
@@ -45,7 +45,7 @@ export class KmsClient {
|
|
|
45
45
|
const body = { data: encodeB64(data) };
|
|
46
46
|
const resp = await this.internal.request("POST", `${PATH_PREFIX}/keys/${keyId}/sign`, body, opts);
|
|
47
47
|
if (!resp.signature) {
|
|
48
|
-
throw new
|
|
48
|
+
throw new QnsiApiError("kms.sign: response missing signature", 200);
|
|
49
49
|
}
|
|
50
50
|
return decodeB64(resp.signature);
|
|
51
51
|
}
|
|
@@ -65,7 +65,7 @@ export class KmsClient {
|
|
|
65
65
|
const resp = await this.internal.request("POST", `${PATH_PREFIX}/keys/${keyId}/wrap`, body, opts);
|
|
66
66
|
const wrapped = resp.wrappedKey ?? resp.ciphertextB64;
|
|
67
67
|
if (!wrapped) {
|
|
68
|
-
throw new
|
|
68
|
+
throw new QnsiApiError("kms.wrap: response missing wrappedKey/ciphertextB64", 200);
|
|
69
69
|
}
|
|
70
70
|
return decodeB64(wrapped);
|
|
71
71
|
}
|
|
@@ -78,7 +78,7 @@ export class KmsClient {
|
|
|
78
78
|
const resp = await this.internal.request("POST", `${PATH_PREFIX}/keys/${keyId}/unwrap`, body, opts);
|
|
79
79
|
const unwrapped = resp.dataKey ?? resp.plaintextB64;
|
|
80
80
|
if (!unwrapped) {
|
|
81
|
-
throw new
|
|
81
|
+
throw new QnsiApiError("kms.unwrap: response missing dataKey/plaintextB64", 200);
|
|
82
82
|
}
|
|
83
83
|
return decodeB64(unwrapped);
|
|
84
84
|
}
|
|
@@ -6,17 +6,17 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```typescript
|
|
9
|
-
* import {
|
|
9
|
+
* import { QnsiToolkit } from "@heossi/qnsi-langchain-qnsp";
|
|
10
10
|
*
|
|
11
|
-
* const toolkit = new
|
|
11
|
+
* const toolkit = new QnsiToolkit({ apiKey: process.env.QNSI_API_KEY });
|
|
12
12
|
* const tools = toolkit.getTools();
|
|
13
13
|
* ```
|
|
14
14
|
*/
|
|
15
|
-
export type {
|
|
16
|
-
export {
|
|
17
|
-
export type {
|
|
18
|
-
export {
|
|
19
|
-
export type {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
15
|
+
export type { QnsiToolkitConfig } from "./toolkit.js";
|
|
16
|
+
export { QnsiToolkit } from "./toolkit.js";
|
|
17
|
+
export type { QnsiAuditToolConfig } from "./tools/audit.js";
|
|
18
|
+
export { QnsiLogAgentActionTool } from "./tools/audit.js";
|
|
19
|
+
export type { QnsiKmsToolConfig } from "./tools/kms.js";
|
|
20
|
+
export { QnsiSignDataTool, QnsiVerifySignatureTool } from "./tools/kms.js";
|
|
21
|
+
export { QnsiReadSecretTool, QnsiRotateSecretTool, QnsiWriteSecretTool } from "./tools/vault.js";
|
|
22
22
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/langchain/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/langchain/index.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AAEH,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAE3E,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/langchain/index.js
CHANGED
|
@@ -1,23 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
* LangChain tools for QNSP — governed agents with PQC-encrypted secrets,
|
|
5
|
-
* quantum-safe signing, and immutable audit trails.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import { QnspToolkit } from "@heossi/qnsi-langchain-qnsp";
|
|
10
|
-
*
|
|
11
|
-
* const toolkit = new QnspToolkit({ apiKey: process.env.QNSP_API_KEY });
|
|
12
|
-
* const tools = toolkit.getTools();
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
1
|
+
import { bridgeQnsiEnv } from "../internal/env-aliases.js";
|
|
2
|
+
// Accept both QNSI_* (canonical) and legacy QNSP_* user env vars.
|
|
3
|
+
bridgeQnsiEnv();
|
|
15
4
|
// Toolkit (recommended entry point)
|
|
16
|
-
export {
|
|
5
|
+
export { QnsiToolkit } from "./toolkit.js";
|
|
17
6
|
// Individual audit tools
|
|
18
|
-
export {
|
|
7
|
+
export { QnsiLogAgentActionTool } from "./tools/audit.js";
|
|
19
8
|
// Individual KMS tools
|
|
20
|
-
export {
|
|
9
|
+
export { QnsiSignDataTool, QnsiVerifySignatureTool } from "./tools/kms.js";
|
|
21
10
|
// Individual vault tools
|
|
22
|
-
export {
|
|
11
|
+
export { QnsiReadSecretTool, QnsiRotateSecretTool, QnsiWriteSecretTool } from "./tools/vault.js";
|
|
23
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/langchain/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/langchain/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,kEAAkE;AAClE,aAAa,EAAE,CAAC;AAkBhB,oCAAoC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,yBAAyB;AACzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,uBAAuB;AACvB,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAC3E,yBAAyB;AACzB,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* ```typescript
|
|
10
|
-
* import {
|
|
10
|
+
* import { QnsiToolkit } from "@heossi/qnsi-langchain-qnsp";
|
|
11
11
|
* import { ChatOpenAI } from "@langchain/openai";
|
|
12
12
|
* import { AgentExecutor, createToolCallingAgent } from "langchain/agents";
|
|
13
13
|
*
|
|
14
|
-
* const toolkit = new
|
|
15
|
-
* apiKey: process.env.
|
|
14
|
+
* const toolkit = new QnsiToolkit({
|
|
15
|
+
* apiKey: process.env.QNSI_API_KEY,
|
|
16
16
|
* });
|
|
17
17
|
*
|
|
18
18
|
* const agent = createToolCallingAgent({
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
25
|
import type { StructuredTool } from "@langchain/core/tools";
|
|
26
|
-
export interface
|
|
26
|
+
export interface QnsiToolkitConfig {
|
|
27
27
|
/**
|
|
28
28
|
* QNSP API key. Get one at https://cloud.qnsi.heossi.com/api-keys
|
|
29
29
|
* The API key carries the tenant ID — no separate tenantId needed.
|
|
@@ -58,9 +58,9 @@ export interface QnspToolkitConfig {
|
|
|
58
58
|
* - KMS tools: sign and verify data with quantum-safe algorithms
|
|
59
59
|
* - Audit tools: write immutable, PQC-signed audit events
|
|
60
60
|
*/
|
|
61
|
-
export declare class
|
|
61
|
+
export declare class QnsiToolkit {
|
|
62
62
|
#private;
|
|
63
|
-
constructor(config:
|
|
63
|
+
constructor(config: QnsiToolkitConfig);
|
|
64
64
|
/**
|
|
65
65
|
* One-shot activation handshake against billing-service. Validates the API
|
|
66
66
|
* key, captures tenantId + tier, caches the activation token. Required:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolkit.d.ts","sourceRoot":"","sources":["../../src/langchain/toolkit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"toolkit.d.ts","sourceRoot":"","sources":["../../src/langchain/toolkit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAe5D,MAAM,WAAW,iBAAiB;IACjC;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,OAAO,GAAG,KAAK,GAAG,OAAO,CAAC,CAAC;CAC5D;AAED;;;;;;;GAOG;AACH,qBAAa,WAAW;;gBASX,MAAM,EAAE,iBAAiB;IAcrC;;;;;;;;OAQG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IA+B/B,wEAAwE;IACxE,QAAQ,IAAI,cAAc,EAAE;IAiB5B,kEAAkE;IAClE,aAAa,IAAI,cAAc,EAAE;IASjC,iDAAiD;IACjD,WAAW,IAAI,cAAc,EAAE;IAW/B,uDAAuD;IACvD,aAAa,IAAI,cAAc,EAAE;IAWjC,wDAAwD;IACxD,IAAI,WAAW,IAAI,OAAO,CAEzB;CACD"}
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* ```typescript
|
|
10
|
-
* import {
|
|
10
|
+
* import { QnsiToolkit } from "@heossi/qnsi-langchain-qnsp";
|
|
11
11
|
* import { ChatOpenAI } from "@langchain/openai";
|
|
12
12
|
* import { AgentExecutor, createToolCallingAgent } from "langchain/agents";
|
|
13
13
|
*
|
|
14
|
-
* const toolkit = new
|
|
15
|
-
* apiKey: process.env.
|
|
14
|
+
* const toolkit = new QnsiToolkit({
|
|
15
|
+
* apiKey: process.env.QNSI_API_KEY,
|
|
16
16
|
* });
|
|
17
17
|
*
|
|
18
18
|
* const agent = createToolCallingAgent({
|
|
@@ -23,10 +23,13 @@
|
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
25
|
import { activateSdk } from "../_activation/index.js";
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
26
|
+
import { bridgeQnsiEnv } from "../internal/env-aliases.js";
|
|
27
|
+
import { QnsiLogAgentActionTool } from "./tools/audit.js";
|
|
28
|
+
import { QnsiSignDataTool, QnsiVerifySignatureTool } from "./tools/kms.js";
|
|
29
|
+
import { QnsiReadSecretTool, QnsiRotateSecretTool, QnsiWriteSecretTool } from "./tools/vault.js";
|
|
29
30
|
import { VaultClient } from "./vault-client.js";
|
|
31
|
+
// Accept both QNSI_* (canonical) and legacy QNSP_* user env vars.
|
|
32
|
+
bridgeQnsiEnv();
|
|
30
33
|
const SDK_VERSION = "0.3.0";
|
|
31
34
|
/**
|
|
32
35
|
* QNSP Toolkit — a composable set of LangChain tools for governed AI agents.
|
|
@@ -36,7 +39,7 @@ const SDK_VERSION = "0.3.0";
|
|
|
36
39
|
* - KMS tools: sign and verify data with quantum-safe algorithms
|
|
37
40
|
* - Audit tools: write immutable, PQC-signed audit events
|
|
38
41
|
*/
|
|
39
|
-
export class
|
|
42
|
+
export class QnsiToolkit {
|
|
40
43
|
#apiKey;
|
|
41
44
|
#tenantId;
|
|
42
45
|
#baseUrl;
|
|
@@ -68,7 +71,7 @@ export class QnspToolkit {
|
|
|
68
71
|
async activate() {
|
|
69
72
|
const activation = await activateSdk({
|
|
70
73
|
apiKey: this.#apiKey,
|
|
71
|
-
sdkId: "langchain-
|
|
74
|
+
sdkId: "langchain-qnsi",
|
|
72
75
|
sdkVersion: SDK_VERSION,
|
|
73
76
|
platformUrl: this.#baseUrl,
|
|
74
77
|
});
|
|
@@ -111,9 +114,9 @@ export class QnspToolkit {
|
|
|
111
114
|
getVaultTools() {
|
|
112
115
|
this.#assertActivated();
|
|
113
116
|
return [
|
|
114
|
-
new
|
|
115
|
-
new
|
|
116
|
-
new
|
|
117
|
+
new QnsiReadSecretTool(this.#vaultClient),
|
|
118
|
+
new QnsiWriteSecretTool(this.#vaultClient),
|
|
119
|
+
new QnsiRotateSecretTool(this.#vaultClient),
|
|
117
120
|
];
|
|
118
121
|
}
|
|
119
122
|
/** Returns only the KMS tools (sign, verify). */
|
|
@@ -125,7 +128,7 @@ export class QnspToolkit {
|
|
|
125
128
|
tenantId: this.#tenantId,
|
|
126
129
|
timeoutMs: this.#timeoutMs,
|
|
127
130
|
};
|
|
128
|
-
return [new
|
|
131
|
+
return [new QnsiSignDataTool(kmsConfig), new QnsiVerifySignatureTool(kmsConfig)];
|
|
129
132
|
}
|
|
130
133
|
/** Returns only the audit tool (log agent actions). */
|
|
131
134
|
getAuditTools() {
|
|
@@ -136,7 +139,7 @@ export class QnspToolkit {
|
|
|
136
139
|
tenantId: this.#tenantId,
|
|
137
140
|
timeoutMs: this.#timeoutMs,
|
|
138
141
|
};
|
|
139
|
-
return [new
|
|
142
|
+
return [new QnsiLogAgentActionTool(auditConfig)];
|
|
140
143
|
}
|
|
141
144
|
/** True once `activate()` has resolved successfully. */
|
|
142
145
|
get isActivated() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolkit.js","sourceRoot":"","sources":["../../src/langchain/toolkit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"toolkit.js","sourceRoot":"","sources":["../../src/langchain/toolkit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACjG,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,C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W;QACV,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,MAAM,SAAS,GAAsB;YACpC,OAAO,EAAE,IAAI,CAAC,QAAQ;YACtB,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,QAAQ,EAAE,IAAI,CAAC,SAAS;YACxB,SAAS,EAAE,IAAI,CAAC,UAAU;SAC1B,CAAC;QACF,OAAO,CAAC,IAAI,gBAAgB,CAAC,SAAS,CAAC,EAAE,IAAI,uBAAuB,CAAC,SAAS,CAAC,CAAC,CAAC;IAClF,CAAC;IAED,uDAAuD;IACvD,aAAa;QACZ,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,MAAM,WAAW,GAAwB;YACxC,OAAO,EAAE,IAAI,CAAC,QAAQ;YACtB,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,QAAQ,EAAE,IAAI,CAAC,SAAS;YACxB,SAAS,EAAE,IAAI,CAAC,UAAU;SAC1B,CAAC;QACF,OAAO,CAAC,IAAI,sBAAsB,CAAC,WAAW,CAAC,CAAC,CAAC;IAClD,CAAC;IAED,wDAAwD;IACxD,IAAI,WAAW;QACd,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;CACD"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { StructuredTool, type ToolParams } from "@langchain/core/tools";
|
|
8
8
|
import { z } from "zod";
|
|
9
|
-
export interface
|
|
9
|
+
export interface QnsiAuditToolConfig {
|
|
10
10
|
/** Base URL for the QNSP API (e.g. https://api.qnsi.heossi.com) */
|
|
11
11
|
readonly baseUrl: string;
|
|
12
12
|
/** API key or Bearer token for authentication */
|
|
@@ -26,7 +26,7 @@ declare const logAgentActionSchema: z.ZodObject<{
|
|
|
26
26
|
* LangChain tool that writes an immutable, PQC-signed audit event to QNSP.
|
|
27
27
|
* Use this to create a tamper-evident record of every significant agent action.
|
|
28
28
|
*/
|
|
29
|
-
export declare class
|
|
29
|
+
export declare class QnsiLogAgentActionTool extends StructuredTool {
|
|
30
30
|
#private;
|
|
31
31
|
readonly name = "qnsp_log_agent_action";
|
|
32
32
|
readonly description = "Write an immutable, PQC-signed audit event to QNSP. Creates a tamper-evident record of agent actions, decisions, tool calls, and outputs. Use this for compliance, governance, and traceability of agent behavior.";
|
|
@@ -36,7 +36,7 @@ export declare class QnspLogAgentActionTool extends StructuredTool {
|
|
|
36
36
|
payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
37
37
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
38
38
|
}, z.core.$strip>;
|
|
39
|
-
constructor(config:
|
|
39
|
+
constructor(config: QnsiAuditToolConfig, fields?: ToolParams);
|
|
40
40
|
protected _call(input: z.infer<typeof logAgentActionSchema>): Promise<string>;
|
|
41
41
|
}
|
|
42
42
|
export {};
|
|
@@ -30,7 +30,7 @@ const logAgentActionSchema = z.object({
|
|
|
30
30
|
* LangChain tool that writes an immutable, PQC-signed audit event to QNSP.
|
|
31
31
|
* Use this to create a tamper-evident record of every significant agent action.
|
|
32
32
|
*/
|
|
33
|
-
export class
|
|
33
|
+
export class QnsiLogAgentActionTool extends StructuredTool {
|
|
34
34
|
name = "qnsp_log_agent_action";
|
|
35
35
|
description = "Write an immutable, PQC-signed audit event to QNSP. Creates a tamper-evident record of agent actions, decisions, tool calls, and outputs. Use this for compliance, governance, and traceability of agent behavior.";
|
|
36
36
|
schema = logAgentActionSchema;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { StructuredTool, type ToolParams } from "@langchain/core/tools";
|
|
8
8
|
import { z } from "zod";
|
|
9
|
-
export interface
|
|
9
|
+
export interface QnsiKmsToolConfig {
|
|
10
10
|
/** Base URL for the QNSP API (e.g. https://api.qnsi.heossi.com) */
|
|
11
11
|
readonly baseUrl: string;
|
|
12
12
|
/** API key or Bearer token for authentication */
|
|
@@ -24,7 +24,7 @@ declare const signDataSchema: z.ZodObject<{
|
|
|
24
24
|
/**
|
|
25
25
|
* LangChain tool that signs data with a PQC key (ML-DSA / SLH-DSA / FN-DSA).
|
|
26
26
|
*/
|
|
27
|
-
export declare class
|
|
27
|
+
export declare class QnsiSignDataTool extends StructuredTool {
|
|
28
28
|
#private;
|
|
29
29
|
readonly name = "qnsp_sign_data";
|
|
30
30
|
readonly description = "Sign data with a quantum-safe PQC key (ML-DSA, SLH-DSA, or FN-DSA). Returns a base64-encoded signature. Use this when an agent needs to cryptographically attest to data it produced or decisions it made.";
|
|
@@ -33,7 +33,7 @@ export declare class QnspSignDataTool extends StructuredTool {
|
|
|
33
33
|
data: z.ZodString;
|
|
34
34
|
context: z.ZodOptional<z.ZodString>;
|
|
35
35
|
}, z.core.$strip>;
|
|
36
|
-
constructor(config:
|
|
36
|
+
constructor(config: QnsiKmsToolConfig, fields?: ToolParams);
|
|
37
37
|
protected _call(input: z.infer<typeof signDataSchema>): Promise<string>;
|
|
38
38
|
}
|
|
39
39
|
declare const verifySignatureSchema: z.ZodObject<{
|
|
@@ -45,7 +45,7 @@ declare const verifySignatureSchema: z.ZodObject<{
|
|
|
45
45
|
/**
|
|
46
46
|
* LangChain tool that verifies a PQC signature against data and a key.
|
|
47
47
|
*/
|
|
48
|
-
export declare class
|
|
48
|
+
export declare class QnsiVerifySignatureTool extends StructuredTool {
|
|
49
49
|
#private;
|
|
50
50
|
readonly name = "qnsp_verify_signature";
|
|
51
51
|
readonly description = "Verify a quantum-safe PQC signature. Returns true/false and the algorithm used. Use this when an agent needs to verify the authenticity of data or attestations from other agents or services.";
|
|
@@ -55,7 +55,7 @@ export declare class QnspVerifySignatureTool extends StructuredTool {
|
|
|
55
55
|
signature: z.ZodString;
|
|
56
56
|
context: z.ZodOptional<z.ZodString>;
|
|
57
57
|
}, z.core.$strip>;
|
|
58
|
-
constructor(config:
|
|
58
|
+
constructor(config: QnsiKmsToolConfig, fields?: ToolParams);
|
|
59
59
|
protected _call(input: z.infer<typeof verifySignatureSchema>): Promise<string>;
|
|
60
60
|
}
|
|
61
61
|
export {};
|
|
@@ -21,7 +21,7 @@ const signDataSchema = z.object({
|
|
|
21
21
|
/**
|
|
22
22
|
* LangChain tool that signs data with a PQC key (ML-DSA / SLH-DSA / FN-DSA).
|
|
23
23
|
*/
|
|
24
|
-
export class
|
|
24
|
+
export class QnsiSignDataTool extends StructuredTool {
|
|
25
25
|
name = "qnsp_sign_data";
|
|
26
26
|
description = "Sign data with a quantum-safe PQC key (ML-DSA, SLH-DSA, or FN-DSA). Returns a base64-encoded signature. Use this when an agent needs to cryptographically attest to data it produced or decisions it made.";
|
|
27
27
|
schema = signDataSchema;
|
|
@@ -75,7 +75,7 @@ const verifySignatureSchema = z.object({
|
|
|
75
75
|
/**
|
|
76
76
|
* LangChain tool that verifies a PQC signature against data and a key.
|
|
77
77
|
*/
|
|
78
|
-
export class
|
|
78
|
+
export class QnsiVerifySignatureTool extends StructuredTool {
|
|
79
79
|
name = "qnsp_verify_signature";
|
|
80
80
|
description = "Verify a quantum-safe PQC signature. Returns true/false and the algorithm used. Use this when an agent needs to verify the authenticity of data or attestations from other agents or services.";
|
|
81
81
|
schema = verifySignatureSchema;
|
|
@@ -13,7 +13,7 @@ declare const readSecretSchema: z.ZodObject<{
|
|
|
13
13
|
/**
|
|
14
14
|
* LangChain tool that reads a PQC-encrypted secret from QNSP Vault.
|
|
15
15
|
*/
|
|
16
|
-
export declare class
|
|
16
|
+
export declare class QnsiReadSecretTool extends StructuredTool {
|
|
17
17
|
#private;
|
|
18
18
|
readonly name = "qnsp_read_secret";
|
|
19
19
|
readonly description = "Read a PQC-encrypted secret from QNSP Vault. Returns the secret name and encrypted envelope. Use this when an agent needs to retrieve a stored credential, API key, or sensitive value.";
|
|
@@ -32,7 +32,7 @@ declare const writeSecretSchema: z.ZodObject<{
|
|
|
32
32
|
/**
|
|
33
33
|
* LangChain tool that stores a PQC-encrypted secret in QNSP Vault.
|
|
34
34
|
*/
|
|
35
|
-
export declare class
|
|
35
|
+
export declare class QnsiWriteSecretTool extends StructuredTool {
|
|
36
36
|
#private;
|
|
37
37
|
readonly name = "qnsp_write_secret";
|
|
38
38
|
readonly description = "Store a PQC-encrypted secret in QNSP Vault. The payload must be base64-encoded. Returns the created secret ID. Use this when an agent needs to persist a credential, token, or sensitive value securely.";
|
|
@@ -53,7 +53,7 @@ declare const rotateSecretSchema: z.ZodObject<{
|
|
|
53
53
|
/**
|
|
54
54
|
* LangChain tool that rotates a secret in QNSP Vault with a new value.
|
|
55
55
|
*/
|
|
56
|
-
export declare class
|
|
56
|
+
export declare class QnsiRotateSecretTool extends StructuredTool {
|
|
57
57
|
#private;
|
|
58
58
|
readonly name = "qnsp_rotate_secret";
|
|
59
59
|
readonly description = "Rotate a secret in QNSP Vault with a new PQC-encrypted value. The previous version is retained for rollback. Use this when an agent needs to update a credential after rotation.";
|
|
@@ -13,7 +13,7 @@ const readSecretSchema = z.object({
|
|
|
13
13
|
/**
|
|
14
14
|
* LangChain tool that reads a PQC-encrypted secret from QNSP Vault.
|
|
15
15
|
*/
|
|
16
|
-
export class
|
|
16
|
+
export class QnsiReadSecretTool extends StructuredTool {
|
|
17
17
|
name = "qnsp_read_secret";
|
|
18
18
|
description = "Read a PQC-encrypted secret from QNSP Vault. Returns the secret name and encrypted envelope. Use this when an agent needs to retrieve a stored credential, API key, or sensitive value.";
|
|
19
19
|
schema = readSecretSchema;
|
|
@@ -47,7 +47,7 @@ const writeSecretSchema = z.object({
|
|
|
47
47
|
/**
|
|
48
48
|
* LangChain tool that stores a PQC-encrypted secret in QNSP Vault.
|
|
49
49
|
*/
|
|
50
|
-
export class
|
|
50
|
+
export class QnsiWriteSecretTool extends StructuredTool {
|
|
51
51
|
name = "qnsp_write_secret";
|
|
52
52
|
description = "Store a PQC-encrypted secret in QNSP Vault. The payload must be base64-encoded. Returns the created secret ID. Use this when an agent needs to persist a credential, token, or sensitive value securely.";
|
|
53
53
|
schema = writeSecretSchema;
|
|
@@ -81,7 +81,7 @@ const rotateSecretSchema = z.object({
|
|
|
81
81
|
/**
|
|
82
82
|
* LangChain tool that rotates a secret in QNSP Vault with a new value.
|
|
83
83
|
*/
|
|
84
|
-
export class
|
|
84
|
+
export class QnsiRotateSecretTool extends StructuredTool {
|
|
85
85
|
name = "qnsp_rotate_secret";
|
|
86
86
|
description = "Rotate a secret in QNSP Vault with a new PQC-encrypted value. The previous version is retained for rollback. Use this when an agent needs to update a credential after rotation.";
|
|
87
87
|
schema = rotateSecretSchema;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* consolidation): Bearer auth, `x-qnsp-tenant-id` header, 429 retry with
|
|
7
7
|
* exponential backoff + `Retry-After`, per-request timeout, `Vault API
|
|
8
8
|
* error: <status> <statusText>` on failure. Endpoints and request/response
|
|
9
|
-
* shapes are byte-for-byte preserved. Activation is owned by `
|
|
9
|
+
* shapes are byte-for-byte preserved. Activation is owned by `QnsiToolkit`
|
|
10
10
|
* (single `langchain-qnsp` handshake); the resolved tenant id is injected via
|
|
11
11
|
* {@link VaultClient.setTenantId} — so this subpath has no `@heossi/qnsi-*`
|
|
12
12
|
* workspace dependency (same pattern as `../_activation`).
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* consolidation): Bearer auth, `x-qnsp-tenant-id` header, 429 retry with
|
|
7
7
|
* exponential backoff + `Retry-After`, per-request timeout, `Vault API
|
|
8
8
|
* error: <status> <statusText>` on failure. Endpoints and request/response
|
|
9
|
-
* shapes are byte-for-byte preserved. Activation is owned by `
|
|
9
|
+
* shapes are byte-for-byte preserved. Activation is owned by `QnsiToolkit`
|
|
10
10
|
* (single `langchain-qnsp` handshake); the resolved tenant id is injected via
|
|
11
11
|
* {@link VaultClient.setTenantId} — so this subpath has no `@heossi/qnsi-*`
|
|
12
12
|
* workspace dependency (same pattern as `../_activation`).
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```typescript
|
|
9
|
-
* import {
|
|
9
|
+
* import { QnsiVectorStore } from "@heossi/qnsi/llamaindex";
|
|
10
10
|
*
|
|
11
|
-
* const store = new
|
|
11
|
+
* const store = new QnsiVectorStore({ apiKey: process.env.QNSI_API_KEY });
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
|
-
export type {
|
|
15
|
-
export {
|
|
14
|
+
export type { QnsiVectorStoreConfig, SearchSecurityEnvelope, TextNode, VectorStoreQuery, VectorStoreQueryResult, } from "./vector-store.js";
|
|
15
|
+
export { QnsiVectorStore } from "./vector-store.js";
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/llamaindex/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/llamaindex/index.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;GAYG;AAEH,YAAY,EACX,qBAAqB,EACrB,sBAAsB,EACtB,QAAQ,EACR,gBAAgB,EAChB,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/llamaindex/index.js
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* from the former standalone `@heossi/qnsi-llamaindex-qnsp` (2026-05-16).
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import { QnspVectorStore } from "@heossi/qnsi/llamaindex";
|
|
10
|
-
*
|
|
11
|
-
* const store = new QnspVectorStore({ apiKey: process.env.QNSP_API_KEY });
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
export { QnspVectorStore } from "./vector-store.js";
|
|
1
|
+
import { bridgeQnsiEnv } from "../internal/env-aliases.js";
|
|
2
|
+
// Accept both QNSI_* (canonical) and legacy QNSP_* user env vars.
|
|
3
|
+
bridgeQnsiEnv();
|
|
4
|
+
export { QnsiVectorStore } from "./vector-store.js";
|
|
15
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/llamaindex/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/llamaindex/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,kEAAkE;AAClE,aAAa,EAAE,CAAC;AAuBhB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -42,7 +42,7 @@ export interface VectorStoreQueryResult {
|
|
|
42
42
|
readonly similarities: number[];
|
|
43
43
|
readonly ids: string[];
|
|
44
44
|
}
|
|
45
|
-
export interface
|
|
45
|
+
export interface QnsiVectorStoreConfig {
|
|
46
46
|
/**
|
|
47
47
|
* QNSP API key. Get one at https://cloud.qnsi.heossi.com/api-keys
|
|
48
48
|
* The API key carries the tenant ID internally — no separate tenantId needed.
|
|
@@ -70,16 +70,16 @@ export interface QnspVectorStoreConfig {
|
|
|
70
70
|
*
|
|
71
71
|
* @example
|
|
72
72
|
* ```typescript
|
|
73
|
-
* import {
|
|
73
|
+
* import { QnsiVectorStore } from "@heossi/qnsi/llamaindex";
|
|
74
74
|
*
|
|
75
|
-
* const store = new
|
|
75
|
+
* const store = new QnsiVectorStore({ apiKey: process.env.QNSI_API_KEY });
|
|
76
76
|
* await store.add([{ id_: "doc-1", text: "Quantum-safe overview", metadata: {} }]);
|
|
77
77
|
* const result = await store.query({ queryStr: "post-quantum cryptography" });
|
|
78
78
|
* ```
|
|
79
79
|
*/
|
|
80
|
-
export declare class
|
|
80
|
+
export declare class QnsiVectorStore {
|
|
81
81
|
#private;
|
|
82
|
-
constructor(config:
|
|
82
|
+
constructor(config: QnsiVectorStoreConfig);
|
|
83
83
|
/**
|
|
84
84
|
* Add nodes to the QNSP encrypted search index. Returns indexed node IDs.
|
|
85
85
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-store.d.ts","sourceRoot":"","sources":["../../src/llamaindex/vector-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"vector-store.d.ts","sourceRoot":"","sources":["../../src/llamaindex/vector-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AA2BH,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,uBAAuB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChD,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;QACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;KAC3B,CAAC,CAAC;IACH,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC;AA0CD,MAAM,WAAW,QAAQ;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,QAAQ,CAAC,cAAc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