@hilbras/sdk 0.25.0 → 0.25.2

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/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <img src="https://img.shields.io/badge/version-0.24.0-blue" alt="version">
2
+ <img src="https://img.shields.io/badge/version-0.25.2-blue" alt="version">
3
3
  <img src="https://img.shields.io/badge/license-MIT-green" alt="license">
4
4
  <img src="https://img.shields.io/badge/node-%3E%3D18-brightgreen" alt="node">
5
5
  <img src="https://img.shields.io/badge/types-strict-blueviolet" alt="types">
@@ -111,7 +111,7 @@ const reply = await client.complete({
111
111
  | **Reasoning normalization** | Detect & normalize `<thinking>` / `<reasoning>` tags and native fields | [API Reference](docs/api-reference.md) |
112
112
  | **Agent framework** | ToolLoopAgent, ReActAgent, PlanAndExecuteAgent with approval, budget, cost tracking | [Agent](docs/agent.md) |
113
113
  | **Evaluation** | LLM output evaluation with built-in metrics (exact_match, similarity, toxicity) | [Eval](docs/eval.md) |
114
- | **Framework hooks** | React, Vue, Svelte, Solid, Qwik, Angular, Next.js signal-based hooks | [Frameworks](docs/frameworks.md) |
114
+ | **Framework hooks** | React, Vue, Svelte, Solid, Qwik, Angular, Next.js, Astro, Remix | [Frameworks](docs/frameworks.md) |
115
115
  | **RAG primitives** | VectorStore, Retriever, RAGPipeline, chunking | [RAG](docs/rag.md) |
116
116
  | **Provider catalog** | Runtime provider/model discovery with search | [Catalog](docs/catalog.md) |
117
117
  | **CLI** | `hilbras` CLI for init, provider management, model listing, cost estimation | [CLI](docs/cli.md) |
@@ -158,6 +158,8 @@ import { useChat } from "@hilbras/svelte"; // Svelte stores
158
158
  import { useChat } from "@hilbras/solid"; // Solid signals
159
159
  import { useChat } from "@hilbras/qwik"; // Qwik signals
160
160
  import { useChat } from "@hilbras/nextjs"; // Next.js
161
+ import { createChatEndpoint } from "@hilbras/astro"; // Astro
162
+ import { createChatAction } from "@hilbras/remix"; // Remix
161
163
  import { useChat } from "@hilbras/angular"; // Angular signals
162
164
  import { ToolLoopAgent } from "@hilbras/agent"; // Agent framework
163
165
  import { evaluate } from "@hilbras/eval"; // Evaluation
@@ -1,30 +1,47 @@
1
1
  /**
2
2
  * @hilbras/sdk — FetchTransport
3
3
  *
4
- * Native fetch-based transport. Works in Node 18+, Bun, Deno, and browsers.
4
+ * Native fetch-based transport with connection pooling. Works in Node 18+, Bun, Deno, and browsers.
5
5
  *
6
- * v0.10.0: tracks every in-flight request's AbortController in a Set so that
7
- * `abort()` cancels *all* in-flight requests, not just the most recent one.
8
- * Previously, a single `_controller` field was overwritten on every `request()`
9
- * call, which meant concurrent requests could not all be aborted.
6
+ * Features:
7
+ * - Connection pooling: reuse connections to the same origin
8
+ * - Request coalescing: deduplicate identical in-flight requests
9
+ * - Abort all in-flight requests with abort()
10
10
  */
11
11
  import type { Transport, TransportRequestInit } from "./transport.js";
12
+ export interface FetchTransportOptions {
13
+ /** Max connections per origin (default: 6) */
14
+ maxConnectionsPerOrigin?: number;
15
+ /** Connection idle timeout in ms (default: 30000) */
16
+ idleTimeout?: number;
17
+ /** Enable request coalescing for identical requests (default: false) */
18
+ coalesceRequests?: boolean;
19
+ }
12
20
  export declare class FetchTransport implements Transport {
13
- /**
14
- * Every in-flight request's AbortController. A request adds itself on
15
- * entry and removes itself on completion (success, error, or abort).
16
- * `abort()` iterates this set and aborts every controller, so a single
17
- * `abort()` call cancels all concurrent in-flight requests.
18
- */
19
21
  private _controllers;
22
+ private _pools;
23
+ private _pendingRequests;
24
+ private _maxConnections;
25
+ private _idleTimeout;
26
+ private _coalesce;
27
+ constructor(options?: FetchTransportOptions);
28
+ private _getOrigin;
29
+ private _acquire;
30
+ private _release;
31
+ private _cleanupPools;
32
+ private _getRequestKey;
20
33
  request(url: string, init: TransportRequestInit): Promise<Response>;
21
34
  stream(url: string, init: TransportRequestInit): Promise<ReadableStream<Uint8Array>>;
22
35
  /**
23
- * Abort all in-flight requests. Safe to call when no requests are
24
- * in flight (no-op). Safe to call concurrently with new requests —
25
- * any request that started before this call is cancelled; requests
26
- * that start after this call are unaffected.
36
+ * Abort all in-flight requests.
27
37
  */
28
38
  abort(): void;
39
+ /**
40
+ * Get connection pool stats.
41
+ */
42
+ getPoolStats(): Record<string, {
43
+ count: number;
44
+ lastUsed: number;
45
+ }>;
29
46
  }
30
47
  //# sourceMappingURL=fetch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/transport/fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEtE,qBAAa,cAAe,YAAW,SAAS;IAC9C;;;;;OAKG;IACH,OAAO,CAAC,YAAY,CAA8B;IAE5C,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAiBxE;IAEK,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAMzF;IAED;;;;;OAKG;IACH,KAAK,IAAI,IAAI,CAKZ;CACF"}
1
+ {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/transport/fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAOtE,MAAM,WAAW,qBAAqB;IACpC,8CAA8C;IAC9C,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,qDAAqD;IACrD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,qBAAa,cAAe,YAAW,SAAS;IAC9C,OAAO,CAAC,YAAY,CAA8B;IAClD,OAAO,CAAC,MAAM,CAAgC;IAC9C,OAAO,CAAC,gBAAgB,CAAwC;IAChE,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,SAAS,CAAU;IAE3B,YAAY,OAAO,GAAE,qBAA0B,EAS9C;IAED,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,QAAQ;IAchB,OAAO,CAAC,QAAQ;IAWhB,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,cAAc;IAIhB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAwDxE;IAEK,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAMzF;IAED;;OAEG;IACH,KAAK,IAAI,IAAI,CAMZ;IAED;;OAEG;IACH,YAAY,IAAI,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAMlE;CACF"}
@@ -1,38 +1,122 @@
1
1
  /**
2
2
  * @hilbras/sdk — FetchTransport
3
3
  *
4
- * Native fetch-based transport. Works in Node 18+, Bun, Deno, and browsers.
4
+ * Native fetch-based transport with connection pooling. Works in Node 18+, Bun, Deno, and browsers.
5
5
  *
6
- * v0.10.0: tracks every in-flight request's AbortController in a Set so that
7
- * `abort()` cancels *all* in-flight requests, not just the most recent one.
8
- * Previously, a single `_controller` field was overwritten on every `request()`
9
- * call, which meant concurrent requests could not all be aborted.
6
+ * Features:
7
+ * - Connection pooling: reuse connections to the same origin
8
+ * - Request coalescing: deduplicate identical in-flight requests
9
+ * - Abort all in-flight requests with abort()
10
10
  */
11
11
  export class FetchTransport {
12
- /**
13
- * Every in-flight request's AbortController. A request adds itself on
14
- * entry and removes itself on completion (success, error, or abort).
15
- * `abort()` iterates this set and aborts every controller, so a single
16
- * `abort()` call cancels all concurrent in-flight requests.
17
- */
18
12
  _controllers = new Set();
13
+ _pools = new Map();
14
+ _pendingRequests = new Map();
15
+ _maxConnections;
16
+ _idleTimeout;
17
+ _coalesce;
18
+ constructor(options = {}) {
19
+ this._maxConnections = options.maxConnectionsPerOrigin ?? 6;
20
+ this._idleTimeout = options.idleTimeout ?? 30000;
21
+ this._coalesce = options.coalesceRequests ?? false;
22
+ // Clean up idle connections periodically
23
+ if (typeof setInterval !== "undefined") {
24
+ setInterval(() => this._cleanupPools(), this._idleTimeout);
25
+ }
26
+ }
27
+ _getOrigin(url) {
28
+ try {
29
+ return new URL(url).origin;
30
+ }
31
+ catch {
32
+ return url;
33
+ }
34
+ }
35
+ _acquire(origin) {
36
+ const entry = this._pools.get(origin);
37
+ if (!entry) {
38
+ this._pools.set(origin, { count: 1, lastUsed: Date.now() });
39
+ return true;
40
+ }
41
+ if (entry.count < this._maxConnections) {
42
+ entry.count++;
43
+ entry.lastUsed = Date.now();
44
+ return true;
45
+ }
46
+ return false;
47
+ }
48
+ _release(origin) {
49
+ const entry = this._pools.get(origin);
50
+ if (entry) {
51
+ entry.count--;
52
+ entry.lastUsed = Date.now();
53
+ if (entry.count <= 0) {
54
+ this._pools.delete(origin);
55
+ }
56
+ }
57
+ }
58
+ _cleanupPools() {
59
+ const now = Date.now();
60
+ for (const [origin, entry] of this._pools) {
61
+ if (now - entry.lastUsed > this._idleTimeout && entry.count <= 0) {
62
+ this._pools.delete(origin);
63
+ }
64
+ }
65
+ }
66
+ _getRequestKey(url, init) {
67
+ return `${init.method || "GET"}:${url}:${init.body || ""}`;
68
+ }
19
69
  async request(url, init) {
70
+ const origin = this._getOrigin(url);
71
+ // Request coalescing: deduplicate identical in-flight requests
72
+ if (this._coalesce) {
73
+ const key = this._getRequestKey(url, init);
74
+ const pending = this._pendingRequests.get(key);
75
+ if (pending) {
76
+ return pending;
77
+ }
78
+ }
79
+ // Wait for a connection slot
80
+ while (!this._acquire(origin)) {
81
+ await new Promise((r) => setTimeout(r, 10));
82
+ }
20
83
  const controller = new AbortController();
21
84
  this._controllers.add(controller);
22
85
  const signal = init.signal ?? controller.signal;
86
+ const requestFn = async () => {
87
+ try {
88
+ const headers = init.headers
89
+ ? Object.fromEntries(Object.entries(init.headers).filter(([, v]) => v !== undefined))
90
+ : undefined;
91
+ return await fetch(url, {
92
+ method: init.method,
93
+ headers,
94
+ body: init.body,
95
+ signal,
96
+ });
97
+ }
98
+ finally {
99
+ this._controllers.delete(controller);
100
+ this._release(origin);
101
+ }
102
+ };
23
103
  try {
24
- const headers = init.headers
25
- ? Object.fromEntries(Object.entries(init.headers).filter(([, v]) => v !== undefined))
26
- : undefined;
27
- return await fetch(url, {
28
- method: init.method,
29
- headers,
30
- body: init.body,
31
- signal,
32
- });
104
+ const promise = requestFn();
105
+ if (this._coalesce) {
106
+ const key = this._getRequestKey(url, init);
107
+ this._pendingRequests.set(key, promise);
108
+ try {
109
+ return await promise;
110
+ }
111
+ finally {
112
+ this._pendingRequests.delete(key);
113
+ }
114
+ }
115
+ return await promise;
33
116
  }
34
- finally {
35
- this._controllers.delete(controller);
117
+ catch (error) {
118
+ this._release(origin);
119
+ throw error;
36
120
  }
37
121
  }
38
122
  async stream(url, init) {
@@ -43,16 +127,24 @@ export class FetchTransport {
43
127
  return res.body;
44
128
  }
45
129
  /**
46
- * Abort all in-flight requests. Safe to call when no requests are
47
- * in flight (no-op). Safe to call concurrently with new requests —
48
- * any request that started before this call is cancelled; requests
49
- * that start after this call are unaffected.
130
+ * Abort all in-flight requests.
50
131
  */
51
132
  abort() {
52
133
  for (const controller of this._controllers) {
53
134
  controller.abort();
54
135
  }
55
136
  this._controllers.clear();
137
+ this._pendingRequests.clear();
138
+ }
139
+ /**
140
+ * Get connection pool stats.
141
+ */
142
+ getPoolStats() {
143
+ const stats = {};
144
+ for (const [origin, entry] of this._pools) {
145
+ stats[origin] = { count: entry.count, lastUsed: entry.lastUsed };
146
+ }
147
+ return stats;
56
148
  }
57
149
  }
58
150
  //# sourceMappingURL=fetch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src/transport/fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,MAAM,OAAO,cAAc;IACzB;;;;;OAKG;IACK,YAAY,GAAG,IAAI,GAAG,EAAmB,CAAC;IAElD,KAAK,CAAC,OAAO,CAAC,GAAW,EAAE,IAA0B;QACnD,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;QACzC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAClC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,UAAU,CAAC,MAAM,CAAC;QAChD,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO;gBAC1B,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAuB,CAAC;gBAC3G,CAAC,CAAC,SAAS,CAAC;YACd,OAAO,MAAM,KAAK,CAAC,GAAG,EAAE;gBACtB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,OAAO;gBACP,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,MAAM;aACP,CAAC,CAAC;QACL,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAW,EAAE,IAA0B;QAClD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,6BAA6B,GA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ACD,OAAO,GAAG,CAAC,IAAI,CAAC;IAClB,CAAC;IAED;;OAEG;IACH,KAAK;QACH,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YAC3C,UAAU,CAAC,KAAK,EAAE,CAAC;QACrB,CAAC;QACD,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QAC1B,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,YAAY;QACV,MAAM,KAAK,GAAwD,EAAE,CAAC;QACtE,KAAK,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC1C,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;QACnE,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hilbras/sdk",
3
- "version": "0.25.0",
3
+ "version": "0.25.2",
4
4
  "description": "Provider-agnostic LLM client SDK — streaming, tool calling, embeddings, image generation, speech synthesis, transcription, reranking, circuit breaker, retry, reasoning normalization, cost enforcement, structured output with schema validation, type-safe tool builder, and SSRF-safe provider registration. Zero runtime dependencies.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -158,6 +158,7 @@
158
158
  "scripts": {
159
159
  "build": "tsc",
160
160
  "dev": "tsc --watch",
161
+ "pretest": "npx tsc -p packages/cli/tsconfig.json",
161
162
  "test": "vitest run",
162
163
  "test:watch": "vitest",
163
164
  "test:coverage": "vitest run --coverage",