@dakera-ai/dakera 0.6.1 → 0.6.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/dist/index.d.mts CHANGED
@@ -966,6 +966,8 @@ interface CrossAgentNetworkResponse {
966
966
  nodes: AgentNetworkNode[];
967
967
  edges: AgentNetworkEdge[];
968
968
  stats: AgentNetworkStats;
969
+ /** Total number of memory nodes in the network (added in server v0.6.2). */
970
+ node_count: number;
969
971
  }
970
972
  /** Request body for POST /v1/knowledge/network/cross-agent */
971
973
  interface CrossAgentNetworkRequest {
@@ -1744,6 +1746,16 @@ declare class DakeraClient {
1744
1746
  * ```
1745
1747
  */
1746
1748
  streamMemoryEvents(): AsyncGenerator<MemoryEvent>;
1749
+ /**
1750
+ * Return a URL with `?api_key=<key>` appended for use with browser-native
1751
+ * `EventSource`, which cannot send custom request headers.
1752
+ *
1753
+ * @example
1754
+ * ```ts
1755
+ * const src = new EventSource(client.sseUrl('/v1/namespaces/my-ns/events'));
1756
+ * ```
1757
+ */
1758
+ sseUrl(path: string): string;
1747
1759
  /** Low-level SSE streaming helper — parses the SSE wire format. */
1748
1760
  private _streamSse;
1749
1761
  /** Parse a single SSE event block into a {@link DakeraEvent}. */
package/dist/index.d.ts CHANGED
@@ -966,6 +966,8 @@ interface CrossAgentNetworkResponse {
966
966
  nodes: AgentNetworkNode[];
967
967
  edges: AgentNetworkEdge[];
968
968
  stats: AgentNetworkStats;
969
+ /** Total number of memory nodes in the network (added in server v0.6.2). */
970
+ node_count: number;
969
971
  }
970
972
  /** Request body for POST /v1/knowledge/network/cross-agent */
971
973
  interface CrossAgentNetworkRequest {
@@ -1744,6 +1746,16 @@ declare class DakeraClient {
1744
1746
  * ```
1745
1747
  */
1746
1748
  streamMemoryEvents(): AsyncGenerator<MemoryEvent>;
1749
+ /**
1750
+ * Return a URL with `?api_key=<key>` appended for use with browser-native
1751
+ * `EventSource`, which cannot send custom request headers.
1752
+ *
1753
+ * @example
1754
+ * ```ts
1755
+ * const src = new EventSource(client.sseUrl('/v1/namespaces/my-ns/events'));
1756
+ * ```
1757
+ */
1758
+ sseUrl(path: string): string;
1747
1759
  /** Low-level SSE streaming helper — parses the SSE wire format. */
1748
1760
  private _streamSse;
1749
1761
  /** Parse a single SSE event block into a {@link DakeraEvent}. */
package/dist/index.js CHANGED
@@ -1341,15 +1341,29 @@ var DakeraClient = class {
1341
1341
  const url = `${this.baseUrl}/v1/events/stream`;
1342
1342
  yield* this._streamSseMemory(url);
1343
1343
  }
1344
+ /**
1345
+ * Return a URL with `?api_key=<key>` appended for use with browser-native
1346
+ * `EventSource`, which cannot send custom request headers.
1347
+ *
1348
+ * @example
1349
+ * ```ts
1350
+ * const src = new EventSource(client.sseUrl('/v1/namespaces/my-ns/events'));
1351
+ * ```
1352
+ */
1353
+ sseUrl(path) {
1354
+ const base = `${this.baseUrl}${path}`;
1355
+ if (!this.apiKey) return base;
1356
+ const sep = base.includes("?") ? "&" : "?";
1357
+ return `${base}${sep}api_key=${encodeURIComponent(this.apiKey)}`;
1358
+ }
1344
1359
  /** Low-level SSE streaming helper — parses the SSE wire format. */
1345
1360
  async *_streamSse(url) {
1361
+ const sseUrl = this.apiKey ? `${url}${url.includes("?") ? "&" : "?"}api_key=${encodeURIComponent(this.apiKey)}` : url;
1346
1362
  const headers = {
1347
- ...this.headers,
1348
- // includes Authorization and any custom headers
1349
1363
  Accept: "text/event-stream",
1350
1364
  "Cache-Control": "no-cache"
1351
1365
  };
1352
- const response = await fetch(url, { headers });
1366
+ const response = await fetch(sseUrl, { headers });
1353
1367
  if (!response.ok || !response.body) {
1354
1368
  throw new Error(`SSE connection failed: ${response.status} ${response.statusText}`);
1355
1369
  }
@@ -1395,12 +1409,12 @@ var DakeraClient = class {
1395
1409
  * so callers receive a fully-populated {@link MemoryEvent}.
1396
1410
  */
1397
1411
  async *_streamSseMemory(url) {
1412
+ const sseUrl = this.apiKey ? `${url}${url.includes("?") ? "&" : "?"}api_key=${encodeURIComponent(this.apiKey)}` : url;
1398
1413
  const headers = {
1399
- ...this.headers,
1400
1414
  Accept: "text/event-stream",
1401
1415
  "Cache-Control": "no-cache"
1402
1416
  };
1403
- const response = await fetch(url, { headers });
1417
+ const response = await fetch(sseUrl, { headers });
1404
1418
  if (!response.ok || !response.body) {
1405
1419
  throw new Error(`SSE connection failed: ${response.status} ${response.statusText}`);
1406
1420
  }
package/dist/index.mjs CHANGED
@@ -1301,15 +1301,29 @@ var DakeraClient = class {
1301
1301
  const url = `${this.baseUrl}/v1/events/stream`;
1302
1302
  yield* this._streamSseMemory(url);
1303
1303
  }
1304
+ /**
1305
+ * Return a URL with `?api_key=<key>` appended for use with browser-native
1306
+ * `EventSource`, which cannot send custom request headers.
1307
+ *
1308
+ * @example
1309
+ * ```ts
1310
+ * const src = new EventSource(client.sseUrl('/v1/namespaces/my-ns/events'));
1311
+ * ```
1312
+ */
1313
+ sseUrl(path) {
1314
+ const base = `${this.baseUrl}${path}`;
1315
+ if (!this.apiKey) return base;
1316
+ const sep = base.includes("?") ? "&" : "?";
1317
+ return `${base}${sep}api_key=${encodeURIComponent(this.apiKey)}`;
1318
+ }
1304
1319
  /** Low-level SSE streaming helper — parses the SSE wire format. */
1305
1320
  async *_streamSse(url) {
1321
+ const sseUrl = this.apiKey ? `${url}${url.includes("?") ? "&" : "?"}api_key=${encodeURIComponent(this.apiKey)}` : url;
1306
1322
  const headers = {
1307
- ...this.headers,
1308
- // includes Authorization and any custom headers
1309
1323
  Accept: "text/event-stream",
1310
1324
  "Cache-Control": "no-cache"
1311
1325
  };
1312
- const response = await fetch(url, { headers });
1326
+ const response = await fetch(sseUrl, { headers });
1313
1327
  if (!response.ok || !response.body) {
1314
1328
  throw new Error(`SSE connection failed: ${response.status} ${response.statusText}`);
1315
1329
  }
@@ -1355,12 +1369,12 @@ var DakeraClient = class {
1355
1369
  * so callers receive a fully-populated {@link MemoryEvent}.
1356
1370
  */
1357
1371
  async *_streamSseMemory(url) {
1372
+ const sseUrl = this.apiKey ? `${url}${url.includes("?") ? "&" : "?"}api_key=${encodeURIComponent(this.apiKey)}` : url;
1358
1373
  const headers = {
1359
- ...this.headers,
1360
1374
  Accept: "text/event-stream",
1361
1375
  "Cache-Control": "no-cache"
1362
1376
  };
1363
- const response = await fetch(url, { headers });
1377
+ const response = await fetch(sseUrl, { headers });
1364
1378
  if (!response.ok || !response.body) {
1365
1379
  throw new Error(`SSE connection failed: ${response.status} ${response.statusText}`);
1366
1380
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dakera-ai/dakera",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "TypeScript/JavaScript SDK for Dakera AI memory platform",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",