@airweave/sdk 0.9.41 → 0.9.43
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/cjs/Client.js +2 -2
- package/dist/cjs/api/resources/collections/client/Client.d.ts +53 -0
- package/dist/cjs/api/resources/collections/client/Client.js +261 -0
- package/dist/cjs/api/{types → resources/collections/client/requests}/ClassicSearchRequest.d.ts +5 -2
- package/dist/cjs/api/{types → resources/collections/client/requests}/InstantSearchRequest.d.ts +5 -2
- package/dist/cjs/api/resources/collections/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/types/AgenticSearchDoneEvent.d.ts +25 -0
- package/dist/cjs/api/types/AgenticSearchDoneEvent.js +5 -0
- package/dist/cjs/api/types/AgenticSearchErrorEvent.d.ts +8 -0
- package/dist/cjs/api/types/AgenticSearchErrorEvent.js +5 -0
- package/dist/cjs/api/types/AgenticSearchEvent.d.ts +25 -0
- package/dist/cjs/api/types/AgenticSearchEvent.js +5 -0
- package/dist/cjs/api/types/AgenticSearchRerankingEvent.d.ts +16 -0
- package/dist/cjs/api/types/AgenticSearchRerankingEvent.js +5 -0
- package/dist/cjs/api/types/AgenticSearchStartedEvent.d.ts +12 -0
- package/dist/cjs/api/types/AgenticSearchStartedEvent.js +5 -0
- package/dist/cjs/api/types/AgenticSearchThinkingEvent.d.ts +18 -0
- package/dist/cjs/api/types/AgenticSearchThinkingEvent.js +5 -0
- package/dist/cjs/api/types/AgenticSearchToolCallEvent.d.ts +38 -0
- package/dist/cjs/api/types/AgenticSearchToolCallEvent.js +21 -0
- package/dist/cjs/api/types/CollectToolStats.d.ts +15 -0
- package/dist/cjs/api/types/CollectToolStats.js +5 -0
- package/dist/cjs/api/types/CountToolStats.d.ts +10 -0
- package/dist/cjs/api/types/CountToolStats.js +5 -0
- package/dist/cjs/api/types/EntitySummary.d.ts +5 -0
- package/dist/cjs/api/types/ErrorToolStats.d.ts +9 -0
- package/dist/cjs/api/types/ErrorToolStats.js +5 -0
- package/dist/cjs/api/types/FinishToolStats.d.ts +13 -0
- package/dist/cjs/api/types/FinishToolStats.js +5 -0
- package/dist/cjs/api/types/NavigateToolStats.d.ts +13 -0
- package/dist/cjs/api/types/NavigateToolStats.js +5 -0
- package/dist/cjs/api/types/ReadToolStats.d.ts +15 -0
- package/dist/cjs/api/types/ReadToolStats.js +5 -0
- package/dist/cjs/api/types/ReviewToolStats.d.ts +12 -0
- package/dist/cjs/api/types/ReviewToolStats.js +5 -0
- package/dist/cjs/api/types/SearchToolStats.d.ts +14 -0
- package/dist/cjs/api/types/SearchToolStats.js +5 -0
- package/dist/cjs/api/types/index.d.ts +15 -2
- package/dist/cjs/api/types/index.js +15 -2
- package/dist/cjs/core/index.d.ts +1 -0
- package/dist/cjs/core/index.js +1 -0
- package/dist/cjs/core/stream/Stream.d.ts +46 -0
- package/dist/cjs/core/stream/Stream.js +169 -0
- package/dist/cjs/core/stream/index.d.ts +1 -0
- package/dist/cjs/core/stream/index.js +5 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/resources/collections/client/Client.d.mts +53 -0
- package/dist/esm/api/resources/collections/client/Client.mjs +261 -0
- package/dist/esm/api/{types → resources/collections/client/requests}/ClassicSearchRequest.d.mts +5 -2
- package/dist/esm/api/{types → resources/collections/client/requests}/InstantSearchRequest.d.mts +5 -2
- package/dist/esm/api/resources/collections/client/requests/index.d.mts +2 -0
- package/dist/esm/api/types/AgenticSearchDoneEvent.d.mts +25 -0
- package/dist/esm/api/types/AgenticSearchDoneEvent.mjs +4 -0
- package/dist/esm/api/types/AgenticSearchErrorEvent.d.mts +8 -0
- package/dist/esm/api/types/AgenticSearchErrorEvent.mjs +4 -0
- package/dist/esm/api/types/AgenticSearchEvent.d.mts +25 -0
- package/dist/esm/api/types/AgenticSearchEvent.mjs +4 -0
- package/dist/esm/api/types/AgenticSearchRerankingEvent.d.mts +16 -0
- package/dist/esm/api/types/AgenticSearchRerankingEvent.mjs +4 -0
- package/dist/esm/api/types/AgenticSearchStartedEvent.d.mts +12 -0
- package/dist/esm/api/types/AgenticSearchStartedEvent.mjs +4 -0
- package/dist/esm/api/types/AgenticSearchThinkingEvent.d.mts +18 -0
- package/dist/esm/api/types/AgenticSearchThinkingEvent.mjs +4 -0
- package/dist/esm/api/types/AgenticSearchToolCallEvent.d.mts +38 -0
- package/dist/esm/api/types/AgenticSearchToolCallEvent.mjs +18 -0
- package/dist/esm/api/types/CollectToolStats.d.mts +15 -0
- package/dist/esm/api/types/CollectToolStats.mjs +4 -0
- package/dist/esm/api/types/CountToolStats.d.mts +10 -0
- package/dist/esm/api/types/CountToolStats.mjs +4 -0
- package/dist/esm/api/types/EntitySummary.d.mts +5 -0
- package/dist/esm/api/types/ErrorToolStats.d.mts +9 -0
- package/dist/esm/api/types/ErrorToolStats.mjs +4 -0
- package/dist/esm/api/types/FinishToolStats.d.mts +13 -0
- package/dist/esm/api/types/FinishToolStats.mjs +4 -0
- package/dist/esm/api/types/NavigateToolStats.d.mts +13 -0
- package/dist/esm/api/types/NavigateToolStats.mjs +4 -0
- package/dist/esm/api/types/ReadToolStats.d.mts +15 -0
- package/dist/esm/api/types/ReadToolStats.mjs +4 -0
- package/dist/esm/api/types/ReviewToolStats.d.mts +12 -0
- package/dist/esm/api/types/ReviewToolStats.mjs +4 -0
- package/dist/esm/api/types/SearchToolStats.d.mts +14 -0
- package/dist/esm/api/types/SearchToolStats.mjs +4 -0
- package/dist/esm/api/types/index.d.mts +15 -2
- package/dist/esm/api/types/index.mjs +15 -2
- package/dist/esm/core/index.d.mts +1 -0
- package/dist/esm/core/index.mjs +1 -0
- package/dist/esm/core/stream/Stream.d.mts +46 -0
- package/dist/esm/core/stream/Stream.mjs +164 -0
- package/dist/esm/core/stream/index.d.mts +1 -0
- package/dist/esm/core/stream/index.mjs +1 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +295 -0
- /package/dist/cjs/api/{types → resources/collections/client/requests}/ClassicSearchRequest.js +0 -0
- /package/dist/cjs/api/{types → resources/collections/client/requests}/InstantSearchRequest.js +0 -0
- /package/dist/esm/api/{types → resources/collections/client/requests}/ClassicSearchRequest.mjs +0 -0
- /package/dist/esm/api/{types → resources/collections/client/requests}/InstantSearchRequest.mjs +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Stats from return_results_to_user.
|
|
6
|
+
*/
|
|
7
|
+
export interface FinishToolStats {
|
|
8
|
+
/** Whether the agent accepted the result set. */
|
|
9
|
+
accepted?: boolean;
|
|
10
|
+
total_collected?: number;
|
|
11
|
+
/** Warning if very few results collected relative to seen. */
|
|
12
|
+
warning?: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as AirweaveSDK from "../index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Stats from get_children, get_siblings, or get_parent.
|
|
7
|
+
*/
|
|
8
|
+
export interface NavigateToolStats {
|
|
9
|
+
result_count?: number;
|
|
10
|
+
/** Human-readable label, e.g. 'children of chan-engineering'. */
|
|
11
|
+
context_label?: string;
|
|
12
|
+
first_results?: AirweaveSDK.EntitySummary[];
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as AirweaveSDK from "../index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Stats from a read tool call.
|
|
7
|
+
*/
|
|
8
|
+
export interface ReadToolStats {
|
|
9
|
+
/** Entities successfully read. */
|
|
10
|
+
found?: number;
|
|
11
|
+
/** Entity IDs that weren't found. */
|
|
12
|
+
not_found?: number;
|
|
13
|
+
entities?: AirweaveSDK.EntitySummary[];
|
|
14
|
+
context_label?: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as AirweaveSDK from "../index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Stats from review_results.
|
|
7
|
+
*/
|
|
8
|
+
export interface ReviewToolStats {
|
|
9
|
+
total_collected?: number;
|
|
10
|
+
entity_count?: number;
|
|
11
|
+
first_results?: AirweaveSDK.EntitySummary[];
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as AirweaveSDK from "../index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Stats from a search tool call.
|
|
7
|
+
*/
|
|
8
|
+
export interface SearchToolStats {
|
|
9
|
+
/** Total results returned. */
|
|
10
|
+
result_count?: number;
|
|
11
|
+
/** Results not seen in previous searches. */
|
|
12
|
+
new_results?: number;
|
|
13
|
+
first_results?: AirweaveSDK.EntitySummary[];
|
|
14
|
+
}
|
|
@@ -26,7 +26,6 @@ export * from "./BrowseTreeResponse.js";
|
|
|
26
26
|
export * from "./CheckStatus.js";
|
|
27
27
|
export * from "./CheckoutSessionRequest.js";
|
|
28
28
|
export * from "./CheckoutSessionResponse.js";
|
|
29
|
-
export * from "./ClassicSearchRequest.js";
|
|
30
29
|
export * from "./Collection.js";
|
|
31
30
|
export * from "./CollectionStatus.js";
|
|
32
31
|
export * from "./ConfigField.js";
|
|
@@ -57,7 +56,6 @@ export * from "./FilterableField.js";
|
|
|
57
56
|
export * from "./HttpValidationError.js";
|
|
58
57
|
export * from "./HandlerConfig.js";
|
|
59
58
|
export * from "./HealthStatus.js";
|
|
60
|
-
export * from "./InstantSearchRequest.js";
|
|
61
59
|
export * from "./InternalAgenticSearchRequest.js";
|
|
62
60
|
export * from "./InvitationCreate.js";
|
|
63
61
|
export * from "./InvitationResponse.js";
|
|
@@ -120,3 +118,18 @@ export * from "./WebhookMessageWithAttempts.js";
|
|
|
120
118
|
export * from "./WebhookSubscription.js";
|
|
121
119
|
export * from "./WebhookSubscriptionDetail.js";
|
|
122
120
|
export * from "./RetrievalStrategy.js";
|
|
121
|
+
export * from "./AgenticSearchEvent.js";
|
|
122
|
+
export * from "./AgenticSearchStartedEvent.js";
|
|
123
|
+
export * from "./AgenticSearchThinkingEvent.js";
|
|
124
|
+
export * from "./AgenticSearchToolCallEvent.js";
|
|
125
|
+
export * from "./SearchToolStats.js";
|
|
126
|
+
export * from "./ReadToolStats.js";
|
|
127
|
+
export * from "./CollectToolStats.js";
|
|
128
|
+
export * from "./CountToolStats.js";
|
|
129
|
+
export * from "./NavigateToolStats.js";
|
|
130
|
+
export * from "./ReviewToolStats.js";
|
|
131
|
+
export * from "./FinishToolStats.js";
|
|
132
|
+
export * from "./ErrorToolStats.js";
|
|
133
|
+
export * from "./AgenticSearchRerankingEvent.js";
|
|
134
|
+
export * from "./AgenticSearchDoneEvent.js";
|
|
135
|
+
export * from "./AgenticSearchErrorEvent.js";
|
|
@@ -42,7 +42,6 @@ __exportStar(require("./BrowseTreeResponse.js"), exports);
|
|
|
42
42
|
__exportStar(require("./CheckStatus.js"), exports);
|
|
43
43
|
__exportStar(require("./CheckoutSessionRequest.js"), exports);
|
|
44
44
|
__exportStar(require("./CheckoutSessionResponse.js"), exports);
|
|
45
|
-
__exportStar(require("./ClassicSearchRequest.js"), exports);
|
|
46
45
|
__exportStar(require("./Collection.js"), exports);
|
|
47
46
|
__exportStar(require("./CollectionStatus.js"), exports);
|
|
48
47
|
__exportStar(require("./ConfigField.js"), exports);
|
|
@@ -73,7 +72,6 @@ __exportStar(require("./FilterableField.js"), exports);
|
|
|
73
72
|
__exportStar(require("./HttpValidationError.js"), exports);
|
|
74
73
|
__exportStar(require("./HandlerConfig.js"), exports);
|
|
75
74
|
__exportStar(require("./HealthStatus.js"), exports);
|
|
76
|
-
__exportStar(require("./InstantSearchRequest.js"), exports);
|
|
77
75
|
__exportStar(require("./InternalAgenticSearchRequest.js"), exports);
|
|
78
76
|
__exportStar(require("./InvitationCreate.js"), exports);
|
|
79
77
|
__exportStar(require("./InvitationResponse.js"), exports);
|
|
@@ -136,3 +134,18 @@ __exportStar(require("./WebhookMessageWithAttempts.js"), exports);
|
|
|
136
134
|
__exportStar(require("./WebhookSubscription.js"), exports);
|
|
137
135
|
__exportStar(require("./WebhookSubscriptionDetail.js"), exports);
|
|
138
136
|
__exportStar(require("./RetrievalStrategy.js"), exports);
|
|
137
|
+
__exportStar(require("./AgenticSearchEvent.js"), exports);
|
|
138
|
+
__exportStar(require("./AgenticSearchStartedEvent.js"), exports);
|
|
139
|
+
__exportStar(require("./AgenticSearchThinkingEvent.js"), exports);
|
|
140
|
+
__exportStar(require("./AgenticSearchToolCallEvent.js"), exports);
|
|
141
|
+
__exportStar(require("./SearchToolStats.js"), exports);
|
|
142
|
+
__exportStar(require("./ReadToolStats.js"), exports);
|
|
143
|
+
__exportStar(require("./CollectToolStats.js"), exports);
|
|
144
|
+
__exportStar(require("./CountToolStats.js"), exports);
|
|
145
|
+
__exportStar(require("./NavigateToolStats.js"), exports);
|
|
146
|
+
__exportStar(require("./ReviewToolStats.js"), exports);
|
|
147
|
+
__exportStar(require("./FinishToolStats.js"), exports);
|
|
148
|
+
__exportStar(require("./ErrorToolStats.js"), exports);
|
|
149
|
+
__exportStar(require("./AgenticSearchRerankingEvent.js"), exports);
|
|
150
|
+
__exportStar(require("./AgenticSearchDoneEvent.js"), exports);
|
|
151
|
+
__exportStar(require("./AgenticSearchErrorEvent.js"), exports);
|
package/dist/cjs/core/index.d.ts
CHANGED
package/dist/cjs/core/index.js
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare namespace Stream {
|
|
2
|
+
interface Args {
|
|
3
|
+
/**
|
|
4
|
+
* The HTTP response stream to read from.
|
|
5
|
+
*/
|
|
6
|
+
stream: ReadableStream;
|
|
7
|
+
/**
|
|
8
|
+
* The event shape to use for parsing the stream data.
|
|
9
|
+
*/
|
|
10
|
+
eventShape: JsonEvent | SseEvent;
|
|
11
|
+
/**
|
|
12
|
+
* An abort signal to stop the stream.
|
|
13
|
+
*/
|
|
14
|
+
signal?: AbortSignal;
|
|
15
|
+
}
|
|
16
|
+
interface JsonEvent {
|
|
17
|
+
type: "json";
|
|
18
|
+
messageTerminator: string;
|
|
19
|
+
}
|
|
20
|
+
interface SseEvent {
|
|
21
|
+
type: "sse";
|
|
22
|
+
streamTerminator?: string;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export declare class Stream<T> implements AsyncIterable<T> {
|
|
26
|
+
private stream;
|
|
27
|
+
private parse;
|
|
28
|
+
/**
|
|
29
|
+
* The prefix to use for each message. For example,
|
|
30
|
+
* for SSE, the prefix is "data: ".
|
|
31
|
+
*/
|
|
32
|
+
private prefix;
|
|
33
|
+
private messageTerminator;
|
|
34
|
+
private streamTerminator;
|
|
35
|
+
private controller;
|
|
36
|
+
constructor({ stream, parse, eventShape, signal }: Stream.Args & {
|
|
37
|
+
parse: (val: unknown) => Promise<T>;
|
|
38
|
+
});
|
|
39
|
+
private iterMessages;
|
|
40
|
+
[Symbol.asyncIterator](): AsyncIterator<T, void, unknown>;
|
|
41
|
+
private decodeChunk;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Browser polyfill for ReadableStream
|
|
45
|
+
*/
|
|
46
|
+
export declare function readableStreamAsyncIterable<T>(stream: any): AsyncIterableIterator<T>;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
12
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
13
|
+
var m = o[Symbol.asyncIterator], i;
|
|
14
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
15
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
16
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
17
|
+
};
|
|
18
|
+
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
19
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
20
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
21
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
22
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
23
|
+
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
24
|
+
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
25
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
26
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
27
|
+
function fulfill(value) { resume("next", value); }
|
|
28
|
+
function reject(value) { resume("throw", value); }
|
|
29
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.Stream = void 0;
|
|
33
|
+
exports.readableStreamAsyncIterable = readableStreamAsyncIterable;
|
|
34
|
+
const index_js_1 = require("../runtime/index.js");
|
|
35
|
+
const DATA_PREFIX = "data:";
|
|
36
|
+
class Stream {
|
|
37
|
+
constructor({ stream, parse, eventShape, signal }) {
|
|
38
|
+
this.controller = new AbortController();
|
|
39
|
+
this.stream = stream;
|
|
40
|
+
this.parse = parse;
|
|
41
|
+
if (eventShape.type === "sse") {
|
|
42
|
+
this.prefix = DATA_PREFIX;
|
|
43
|
+
this.messageTerminator = "\n";
|
|
44
|
+
this.streamTerminator = eventShape.streamTerminator;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
this.messageTerminator = eventShape.messageTerminator;
|
|
48
|
+
}
|
|
49
|
+
signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", () => this.controller.abort());
|
|
50
|
+
}
|
|
51
|
+
iterMessages() {
|
|
52
|
+
return __asyncGenerator(this, arguments, function* iterMessages_1() {
|
|
53
|
+
var _a, e_1, _b, _c;
|
|
54
|
+
this.controller.signal;
|
|
55
|
+
const stream = readableStreamAsyncIterable(this.stream);
|
|
56
|
+
let buf = "";
|
|
57
|
+
let prefixSeen = false;
|
|
58
|
+
try {
|
|
59
|
+
for (var _d = true, stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield __await(stream_1.next()), _a = stream_1_1.done, !_a; _d = true) {
|
|
60
|
+
_c = stream_1_1.value;
|
|
61
|
+
_d = false;
|
|
62
|
+
const chunk = _c;
|
|
63
|
+
buf += this.decodeChunk(chunk);
|
|
64
|
+
let terminatorIndex;
|
|
65
|
+
while ((terminatorIndex = buf.indexOf(this.messageTerminator)) >= 0) {
|
|
66
|
+
let line = buf.slice(0, terminatorIndex + 1);
|
|
67
|
+
buf = buf.slice(terminatorIndex + this.messageTerminator.length);
|
|
68
|
+
if (!line.trim()) {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (!prefixSeen && this.prefix != null) {
|
|
72
|
+
const prefixIndex = line.indexOf(this.prefix);
|
|
73
|
+
if (prefixIndex === -1) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
prefixSeen = true;
|
|
77
|
+
line = line.slice(prefixIndex + this.prefix.length);
|
|
78
|
+
}
|
|
79
|
+
if (this.streamTerminator != null && line.includes(this.streamTerminator)) {
|
|
80
|
+
return yield __await(void 0);
|
|
81
|
+
}
|
|
82
|
+
const message = yield __await(this.parse(JSON.parse(line)));
|
|
83
|
+
yield yield __await(message);
|
|
84
|
+
prefixSeen = false;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
89
|
+
finally {
|
|
90
|
+
try {
|
|
91
|
+
if (!_d && !_a && (_b = stream_1.return)) yield __await(_b.call(stream_1));
|
|
92
|
+
}
|
|
93
|
+
finally { if (e_1) throw e_1.error; }
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
[Symbol.asyncIterator]() {
|
|
98
|
+
return __asyncGenerator(this, arguments, function* _a() {
|
|
99
|
+
var _b, e_2, _c, _d;
|
|
100
|
+
try {
|
|
101
|
+
for (var _e = true, _f = __asyncValues(this.iterMessages()), _g; _g = yield __await(_f.next()), _b = _g.done, !_b; _e = true) {
|
|
102
|
+
_d = _g.value;
|
|
103
|
+
_e = false;
|
|
104
|
+
const message = _d;
|
|
105
|
+
yield yield __await(message);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
109
|
+
finally {
|
|
110
|
+
try {
|
|
111
|
+
if (!_e && !_b && (_c = _f.return)) yield __await(_c.call(_f));
|
|
112
|
+
}
|
|
113
|
+
finally { if (e_2) throw e_2.error; }
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
decodeChunk(chunk) {
|
|
118
|
+
let decoded = "";
|
|
119
|
+
// If TextDecoder is present, use it
|
|
120
|
+
if (typeof TextDecoder !== "undefined") {
|
|
121
|
+
const decoder = new TextDecoder("utf8");
|
|
122
|
+
decoded += decoder.decode(chunk);
|
|
123
|
+
}
|
|
124
|
+
// Buffer is present in Node.js environment
|
|
125
|
+
else if (index_js_1.RUNTIME.type === "node" && typeof chunk !== "undefined") {
|
|
126
|
+
decoded += Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
127
|
+
}
|
|
128
|
+
return decoded;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
exports.Stream = Stream;
|
|
132
|
+
/**
|
|
133
|
+
* Browser polyfill for ReadableStream
|
|
134
|
+
*/
|
|
135
|
+
// biome-ignore lint/suspicious/noExplicitAny: allow explicit any
|
|
136
|
+
function readableStreamAsyncIterable(stream) {
|
|
137
|
+
if (stream[Symbol.asyncIterator]) {
|
|
138
|
+
return stream;
|
|
139
|
+
}
|
|
140
|
+
const reader = stream.getReader();
|
|
141
|
+
return {
|
|
142
|
+
next() {
|
|
143
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
+
try {
|
|
145
|
+
const result = yield reader.read();
|
|
146
|
+
if (result === null || result === void 0 ? void 0 : result.done) {
|
|
147
|
+
reader.releaseLock();
|
|
148
|
+
} // release lock when stream becomes closed
|
|
149
|
+
return result;
|
|
150
|
+
}
|
|
151
|
+
catch (e) {
|
|
152
|
+
reader.releaseLock(); // release lock when stream becomes errored
|
|
153
|
+
throw e;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
},
|
|
157
|
+
return() {
|
|
158
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
159
|
+
const cancelPromise = reader.cancel();
|
|
160
|
+
reader.releaseLock();
|
|
161
|
+
yield cancelPromise;
|
|
162
|
+
return { done: true, value: undefined };
|
|
163
|
+
});
|
|
164
|
+
},
|
|
165
|
+
[Symbol.asyncIterator]() {
|
|
166
|
+
return this;
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Stream } from "./Stream.js";
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "v0.9.
|
|
1
|
+
export declare const SDK_VERSION = "v0.9.43";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/Client.mjs
CHANGED
|
@@ -12,8 +12,8 @@ export class AirweaveSDKClient {
|
|
|
12
12
|
this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
|
|
13
13
|
"X-Fern-Language": "JavaScript",
|
|
14
14
|
"X-Fern-SDK-Name": "@airweave/sdk",
|
|
15
|
-
"X-Fern-SDK-Version": "v0.9.
|
|
16
|
-
"User-Agent": "@airweave/sdk/v0.9.
|
|
15
|
+
"X-Fern-SDK-Version": "v0.9.43",
|
|
16
|
+
"User-Agent": "@airweave/sdk/v0.9.43",
|
|
17
17
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
18
18
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
19
19
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -149,5 +149,58 @@ export declare class Collections {
|
|
|
149
149
|
*/
|
|
150
150
|
update(readableId: string, request?: AirweaveSDK.CollectionUpdate, requestOptions?: Collections.RequestOptions): core.HttpResponsePromise<AirweaveSDK.Collection>;
|
|
151
151
|
private __update;
|
|
152
|
+
/**
|
|
153
|
+
* Direct vector search.
|
|
154
|
+
*
|
|
155
|
+
* @param {string} readableId
|
|
156
|
+
* @param {AirweaveSDK.InstantSearchRequest} request
|
|
157
|
+
* @param {Collections.RequestOptions} requestOptions - Request-specific configuration.
|
|
158
|
+
*
|
|
159
|
+
* @throws {@link AirweaveSDK.UnprocessableEntityError}
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* await client.collections.instantSearch("readable_id", {
|
|
163
|
+
* query: "query"
|
|
164
|
+
* })
|
|
165
|
+
*/
|
|
166
|
+
instantSearch(readableId: string, request: AirweaveSDK.InstantSearchRequest, requestOptions?: Collections.RequestOptions): core.HttpResponsePromise<AirweaveSDK.SearchV2Response>;
|
|
167
|
+
private __instantSearch;
|
|
168
|
+
/**
|
|
169
|
+
* AI-optimized search.
|
|
170
|
+
*
|
|
171
|
+
* @param {string} readableId
|
|
172
|
+
* @param {AirweaveSDK.ClassicSearchRequest} request
|
|
173
|
+
* @param {Collections.RequestOptions} requestOptions - Request-specific configuration.
|
|
174
|
+
*
|
|
175
|
+
* @throws {@link AirweaveSDK.UnprocessableEntityError}
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* await client.collections.classicSearch("readable_id", {
|
|
179
|
+
* query: "query"
|
|
180
|
+
* })
|
|
181
|
+
*/
|
|
182
|
+
classicSearch(readableId: string, request: AirweaveSDK.ClassicSearchRequest, requestOptions?: Collections.RequestOptions): core.HttpResponsePromise<AirweaveSDK.SearchV2Response>;
|
|
183
|
+
private __classicSearch;
|
|
184
|
+
/**
|
|
185
|
+
* Agent that iteratively searches, reads, navigates hierarchies, and collects results.
|
|
186
|
+
*
|
|
187
|
+
* @param {string} readableId
|
|
188
|
+
* @param {AirweaveSDK.AgenticSearchRequest} request
|
|
189
|
+
* @param {Collections.RequestOptions} requestOptions - Request-specific configuration.
|
|
190
|
+
*
|
|
191
|
+
* @throws {@link AirweaveSDK.UnprocessableEntityError}
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* await client.collections.agenticSearch("readable_id", {
|
|
195
|
+
* query: "query"
|
|
196
|
+
* })
|
|
197
|
+
*/
|
|
198
|
+
agenticSearch(readableId: string, request: AirweaveSDK.AgenticSearchRequest, requestOptions?: Collections.RequestOptions): core.HttpResponsePromise<AirweaveSDK.SearchV2Response>;
|
|
199
|
+
private __agenticSearch;
|
|
200
|
+
/**
|
|
201
|
+
* Streaming agentic search via Server-Sent Events. Returns real-time events as the agent searches.
|
|
202
|
+
*/
|
|
203
|
+
streamAgenticSearch(readableId: string, request: AirweaveSDK.AgenticSearchRequest, requestOptions?: Collections.RequestOptions): core.HttpResponsePromise<core.Stream<AirweaveSDK.AgenticSearchEvent>>;
|
|
204
|
+
private __streamAgenticSearch;
|
|
152
205
|
protected _getCustomAuthorizationHeaders(): Promise<Record<string, string | undefined>>;
|
|
153
206
|
}
|