@shashu-ai/sdk 1.1.0 → 1.2.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +61 -44
  2. package/NOTICE +1 -1
  3. package/README.md +7 -4
  4. package/dist/{_joiner-CmR7qVK8.d.cts → _joiner-D_FGAaoc.d.cts} +1 -11
  5. package/dist/{_joiner-CmR7qVK8.d.ts → _joiner-D_FGAaoc.d.ts} +1 -11
  6. package/dist/{chunk-QJQ4MWQ4.js → chunk-CWC6GQTL.js} +2 -2
  7. package/dist/{chunk-QLK5CQSP.js → chunk-K4ZIXS2U.js} +1 -1
  8. package/dist/{chunk-WC3BKVXK.js → chunk-MLFWJAEH.js} +2 -2
  9. package/dist/{chunk-NTIOPTYF.js → chunk-MZGHCDWX.js} +23 -2
  10. package/dist/{chunk-QHWUNZQS.js → chunk-TI45NK2R.js} +2 -2
  11. package/dist/{chunk-L6GKR3SC.js → chunk-YSAQRZFP.js} +127 -12
  12. package/dist/index.cjs +80 -37
  13. package/dist/index.d.cts +17 -17
  14. package/dist/index.d.ts +17 -17
  15. package/dist/index.js +37 -119
  16. package/dist/{langchain-B9Q9eL7g.d.cts → langchain-CoNoZ_vQ.d.cts} +4 -4
  17. package/dist/{langchain-CHjjdhDr.d.ts → langchain-D9Xo9IMm.d.ts} +4 -4
  18. package/dist/middleware/anthropic.cjs +2 -2
  19. package/dist/middleware/anthropic.d.cts +3 -3
  20. package/dist/middleware/anthropic.d.ts +3 -3
  21. package/dist/middleware/anthropic.js +3 -3
  22. package/dist/middleware/google.cjs +1 -1
  23. package/dist/middleware/google.d.cts +2 -2
  24. package/dist/middleware/google.d.ts +2 -2
  25. package/dist/middleware/google.js +2 -2
  26. package/dist/middleware/langchain.cjs +159 -43
  27. package/dist/middleware/langchain.d.cts +3 -3
  28. package/dist/middleware/langchain.d.ts +3 -3
  29. package/dist/middleware/langchain.js +3 -3
  30. package/dist/middleware/vercel-ai.cjs +2 -2
  31. package/dist/middleware/vercel-ai.d.cts +3 -3
  32. package/dist/middleware/vercel-ai.d.ts +3 -3
  33. package/dist/middleware/vercel-ai.js +3 -3
  34. package/dist/{types-BLs_TMFv.d.ts → types-BQVfxZJP.d.cts} +7 -3
  35. package/dist/{types-BLs_TMFv.d.cts → types-BQVfxZJP.d.ts} +7 -3
  36. package/package.json +3 -4
@@ -1,3 +1,3 @@
1
- import '../types-BLs_TMFv.js';
2
- import '../_joiner-CmR7qVK8.js';
3
- export { g as DEFAULT_CORPUS, h as SOURCE, i as ShashuLangChainCallback, e as createShashuLangChainConfig, j as install, k as isInstalled, l as lcDocumentsToRagContext, u as uninstall } from '../langchain-CHjjdhDr.js';
1
+ import '../types-BQVfxZJP.js';
2
+ import '../_joiner-D_FGAaoc.js';
3
+ export { g as DEFAULT_CORPUS, h as SOURCE, i as ShashuLangChainCallback, e as createShashuLangChainConfig, j as install, k as isInstalled, l as lcDocumentsToRagContext, u as uninstall } from '../langchain-D9Xo9IMm.js';
@@ -7,9 +7,9 @@ import {
7
7
  isInstalled,
8
8
  lcDocumentsToRagContext,
9
9
  uninstall
10
- } from "../chunk-L6GKR3SC.js";
11
- import "../chunk-NTIOPTYF.js";
12
- import "../chunk-QJQ4MWQ4.js";
10
+ } from "../chunk-YSAQRZFP.js";
11
+ import "../chunk-MZGHCDWX.js";
12
+ import "../chunk-CWC6GQTL.js";
13
13
  export {
14
14
  DEFAULT_CORPUS,
15
15
  SOURCE,
@@ -99,7 +99,7 @@ function requireBaseUrl(baseUrl, opts) {
99
99
  var import_node_crypto2 = require("crypto");
100
100
 
101
101
  // src/version.ts
102
- var SDK_VERSION = "1.1.0";
102
+ var SDK_VERSION = "1.2.0";
103
103
 
104
104
  // src/tracer.ts
105
105
  var import_node_async_hooks = require("async_hooks");
@@ -744,7 +744,7 @@ function takeContextFor(body) {
744
744
  return mutated ? body : void 0;
745
745
  }
746
746
  function withRetrievalJoiner(underlying = globalFetch) {
747
- return async function trustgateJoiningFetch(input, init) {
747
+ return async function shashuJoiningFetch(input, init) {
748
748
  if (!hasEvents()) return underlying(input, init);
749
749
  if (isDisabled()) {
750
750
  clear();
@@ -1,5 +1,5 @@
1
- import { S as ShashuConfig } from '../types-BLs_TMFv.cjs';
2
- import { F as FetchLike } from '../_joiner-CmR7qVK8.cjs';
1
+ import { S as ShashuConfig } from '../types-BQVfxZJP.cjs';
2
+ import { F as FetchLike } from '../_joiner-D_FGAaoc.cjs';
3
3
 
4
4
  /**
5
5
  * Vercel AI SDK middleware: swap the provider to Shashu with one line.
@@ -54,7 +54,7 @@ declare function getShashuHeaders(workflowContext?: ShashuConfig['workflowContex
54
54
  * Returns `{}` when SHASHU_DISABLE is set: the provider client is then left
55
55
  * exactly as it was — its own endpoint, its own credential, no Shashu context
56
56
  * headers — which is the same no-op the Python SDK's patchers perform. The
57
- * caller's tg_sk_ key is deliberately NOT handed back, since it would be sent to
57
+ * caller's shashu_sk_ key is deliberately NOT handed back, since it would be sent to
58
58
  * the provider directly.
59
59
  *
60
60
  * @throws {ShashuConfigError} when no address is configured and the SDK is
@@ -1,5 +1,5 @@
1
- import { S as ShashuConfig } from '../types-BLs_TMFv.js';
2
- import { F as FetchLike } from '../_joiner-CmR7qVK8.js';
1
+ import { S as ShashuConfig } from '../types-BQVfxZJP.js';
2
+ import { F as FetchLike } from '../_joiner-D_FGAaoc.js';
3
3
 
4
4
  /**
5
5
  * Vercel AI SDK middleware: swap the provider to Shashu with one line.
@@ -54,7 +54,7 @@ declare function getShashuHeaders(workflowContext?: ShashuConfig['workflowContex
54
54
  * Returns `{}` when SHASHU_DISABLE is set: the provider client is then left
55
55
  * exactly as it was — its own endpoint, its own credential, no Shashu context
56
56
  * headers — which is the same no-op the Python SDK's patchers perform. The
57
- * caller's tg_sk_ key is deliberately NOT handed back, since it would be sent to
57
+ * caller's shashu_sk_ key is deliberately NOT handed back, since it would be sent to
58
58
  * the provider directly.
59
59
  *
60
60
  * @throws {ShashuConfigError} when no address is configured and the SDK is
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createShashuOpenAIOptions,
3
3
  getShashuHeaders
4
- } from "../chunk-QHWUNZQS.js";
5
- import "../chunk-NTIOPTYF.js";
6
- import "../chunk-QJQ4MWQ4.js";
4
+ } from "../chunk-TI45NK2R.js";
5
+ import "../chunk-MZGHCDWX.js";
6
+ import "../chunk-CWC6GQTL.js";
7
7
  export {
8
8
  createShashuOpenAIOptions,
9
9
  getShashuHeaders
@@ -29,9 +29,13 @@
29
29
  * has already spent its own three attempts on it.
30
30
  *
31
31
  * By default the SDK retries:
32
- * - connection-level failures reaching the gateway (the request never landed), and
32
+ * - transport failures before any request byte is sent (ECONNREFUSED, DNS,
33
+ * connect timeout), and
33
34
  * - HTTP 429 **that carries a retry time**, honoring it.
34
35
  *
36
+ * A dropped connection after the request has left is raised, not retried —
37
+ * the gateway may already have run the call.
38
+ *
35
39
  * 401/400/403/404, a 429 with no retry time, and 200-`content_filter` are never
36
40
  * retried — they are decisions, not transient failures.
37
41
  */
@@ -42,7 +46,7 @@ interface RetryPolicy {
42
46
  backoffBaseSeconds: number;
43
47
  /** Cap on any single backoff (seconds). Default 30. */
44
48
  backoffMaxSeconds: number;
45
- /** Retry connection-level failures (fetch TypeError). Default true. */
49
+ /** Retry transport failures that happen before any request byte is sent. Default true. */
46
50
  retryOnConnectionErrors: boolean;
47
51
  /** Retry HTTP 429. Default true. */
48
52
  retryOn429: boolean;
@@ -369,7 +373,7 @@ interface ShashuConfig {
369
373
  * ShashuConfigError, never a vendor host. See ./config.ts.
370
374
  */
371
375
  baseUrl?: string;
372
- /** API key (e.g. tg_sk_...). Sent as Authorization: Bearer <apiKey>; gateway handles provider routing. */
376
+ /** API key (e.g. shashu_sk_...). Sent as Authorization: Bearer <apiKey>; gateway handles provider routing. */
373
377
  apiKey?: string;
374
378
  /**
375
379
  * Callable returning the current cloud pass (string or Promise). Mutually
@@ -29,9 +29,13 @@
29
29
  * has already spent its own three attempts on it.
30
30
  *
31
31
  * By default the SDK retries:
32
- * - connection-level failures reaching the gateway (the request never landed), and
32
+ * - transport failures before any request byte is sent (ECONNREFUSED, DNS,
33
+ * connect timeout), and
33
34
  * - HTTP 429 **that carries a retry time**, honoring it.
34
35
  *
36
+ * A dropped connection after the request has left is raised, not retried —
37
+ * the gateway may already have run the call.
38
+ *
35
39
  * 401/400/403/404, a 429 with no retry time, and 200-`content_filter` are never
36
40
  * retried — they are decisions, not transient failures.
37
41
  */
@@ -42,7 +46,7 @@ interface RetryPolicy {
42
46
  backoffBaseSeconds: number;
43
47
  /** Cap on any single backoff (seconds). Default 30. */
44
48
  backoffMaxSeconds: number;
45
- /** Retry connection-level failures (fetch TypeError). Default true. */
49
+ /** Retry transport failures that happen before any request byte is sent. Default true. */
46
50
  retryOnConnectionErrors: boolean;
47
51
  /** Retry HTTP 429. Default true. */
48
52
  retryOn429: boolean;
@@ -369,7 +373,7 @@ interface ShashuConfig {
369
373
  * ShashuConfigError, never a vendor host. See ./config.ts.
370
374
  */
371
375
  baseUrl?: string;
372
- /** API key (e.g. tg_sk_...). Sent as Authorization: Bearer <apiKey>; gateway handles provider routing. */
376
+ /** API key (e.g. shashu_sk_...). Sent as Authorization: Bearer <apiKey>; gateway handles provider routing. */
373
377
  apiKey?: string;
374
378
  /**
375
379
  * Callable returning the current cloud pass (string or Promise). Mutually
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@shashu-ai/sdk",
3
3
  "type": "module",
4
- "version": "1.1.0",
5
- "description": "Node.js client for SHASHU by Trustgate AI, a self-hosted AI security gateway. Point it at your own gateway; there is no default endpoint.",
4
+ "version": "1.2.0",
5
+ "description": "Node.js client for SHASHU, a self-hosted AI security gateway. Point it at your own gateway; there is no default endpoint.",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
@@ -51,7 +51,6 @@
51
51
  },
52
52
  "keywords": [
53
53
  "shashu",
54
- "trustgate",
55
54
  "self-hosted",
56
55
  "ai-gateway",
57
56
  "security",
@@ -65,7 +64,7 @@
65
64
  "homepage": "https://shashu.ai",
66
65
  "repository": {
67
66
  "type": "git",
68
- "url": "https://github.com/trustgateai-io/shashu-node.git"
67
+ "url": "https://github.com/shashu-sec/shashu-node.git"
69
68
  },
70
69
  "devDependencies": {
71
70
  "@ai-sdk/openai": "2.0.66",