@campfire-interactive/cfi-ai-hub-client 2.0.2 → 2.0.4
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/ai.d.ts +26 -0
- package/dist/ai.d.ts.map +1 -0
- package/dist/ai.js +66 -0
- package/dist/ai.js.map +1 -0
- package/dist/bom.d.ts +12 -0
- package/dist/bom.d.ts.map +1 -0
- package/dist/bom.js +64 -0
- package/dist/bom.js.map +1 -0
- package/dist/cache.d.ts +11 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +37 -0
- package/dist/cache.js.map +1 -0
- package/dist/client.d.ts +31 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +51 -0
- package/dist/client.js.map +1 -0
- package/dist/conversations.d.ts +28 -0
- package/dist/conversations.d.ts.map +1 -0
- package/dist/conversations.js +74 -0
- package/dist/conversations.js.map +1 -0
- package/dist/documents.d.ts +18 -0
- package/dist/documents.d.ts.map +1 -0
- package/dist/documents.js +28 -0
- package/dist/documents.js.map +1 -0
- package/dist/errors.d.ts +26 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +55 -0
- package/dist/errors.js.map +1 -0
- package/dist/forecast.d.ts +61 -0
- package/dist/forecast.d.ts.map +1 -0
- package/dist/forecast.js +164 -0
- package/dist/forecast.js.map +1 -0
- package/dist/http.d.ts +42 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +214 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/jobs.d.ts +33 -0
- package/dist/jobs.d.ts.map +1 -0
- package/dist/jobs.js +79 -0
- package/dist/jobs.js.map +1 -0
- package/dist/macro.d.ts +35 -0
- package/dist/macro.d.ts.map +1 -0
- package/dist/macro.js +64 -0
- package/dist/macro.js.map +1 -0
- package/dist/mock.d.ts +107 -0
- package/dist/mock.d.ts.map +1 -0
- package/dist/mock.js +497 -0
- package/dist/mock.js.map +1 -0
- package/dist/multipart.d.ts +4 -0
- package/dist/multipart.d.ts.map +1 -0
- package/dist/multipart.js +21 -0
- package/dist/multipart.js.map +1 -0
- package/dist/omsf.d.ts +22 -0
- package/dist/omsf.d.ts.map +1 -0
- package/dist/omsf.js +67 -0
- package/dist/omsf.js.map +1 -0
- package/dist/prompts.d.ts +24 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +71 -0
- package/dist/prompts.js.map +1 -0
- package/dist/rag.d.ts +18 -0
- package/dist/rag.d.ts.map +1 -0
- package/dist/rag.js +39 -0
- package/dist/rag.js.map +1 -0
- package/dist/tracker.d.ts +15 -0
- package/dist/tracker.d.ts.map +1 -0
- package/dist/tracker.js +74 -0
- package/dist/tracker.js.map +1 -0
- package/dist/types.d.ts +716 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +18 -0
- package/dist/types.js.map +1 -0
- package/dist/vendor.d.ts +8 -0
- package/dist/vendor.d.ts.map +1 -0
- package/dist/vendor.js +18 -0
- package/dist/vendor.js.map +1 -0
- package/package.json +35 -35
package/dist/ai.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { HttpTransport } from './http';
|
|
2
|
+
import type { ChatChunk, ChatRequest, ChatResponse, EmbeddingRequest, EmbeddingResponse, SentimentRequest, SentimentResponse, StreamingChatRequest, StructuredRequest, StructuredResponse, SummarizeRequest, SummarizeResponse } from './types';
|
|
3
|
+
export declare class AiResource {
|
|
4
|
+
private readonly http;
|
|
5
|
+
constructor(http: HttpTransport);
|
|
6
|
+
chat(input: ChatRequest): Promise<ChatResponse>;
|
|
7
|
+
/**
|
|
8
|
+
* Stream a multi-turn chat completion. Yields ChatChunk events
|
|
9
|
+
* (`chunk` / `tool_call` / `done` / `error`).
|
|
10
|
+
*
|
|
11
|
+
* Errors emitted by the hub mid-stream surface as a final
|
|
12
|
+
* `{type: 'error', error: {...}}` chunk and end the iterator —
|
|
13
|
+
* callers don't need try/catch around `for await`.
|
|
14
|
+
*/
|
|
15
|
+
chatStream(input: StreamingChatRequest): AsyncIterable<ChatChunk>;
|
|
16
|
+
/**
|
|
17
|
+
* Force a JSON-schema-validated structured response. The hub retries
|
|
18
|
+
* up to `max_repair_retries` times on validation failure before
|
|
19
|
+
* surfacing 422 InvalidOutputError.
|
|
20
|
+
*/
|
|
21
|
+
structured(input: StructuredRequest): Promise<StructuredResponse>;
|
|
22
|
+
embeddings(input: EmbeddingRequest): Promise<EmbeddingResponse>;
|
|
23
|
+
sentiment(input: SentimentRequest): Promise<SentimentResponse>;
|
|
24
|
+
summarize(input: SummarizeRequest): Promise<SummarizeResponse>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=ai.d.ts.map
|
package/dist/ai.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAEjB,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAE1C,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IAQrD;;;;;;;OAOG;IACH,UAAU,CAAC,KAAK,EAAE,oBAAoB,GAAG,aAAa,CAAC,SAAS,CAAC;IAQjE;;;;OAIG;IACG,UAAU,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAQjE,UAAU,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAQ/D,SAAS,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAQ9D,SAAS,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAOrE"}
|
package/dist/ai.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AiResource = void 0;
|
|
4
|
+
class AiResource {
|
|
5
|
+
http;
|
|
6
|
+
constructor(http) {
|
|
7
|
+
this.http = http;
|
|
8
|
+
}
|
|
9
|
+
async chat(input) {
|
|
10
|
+
return this.http.request({
|
|
11
|
+
method: 'POST',
|
|
12
|
+
path: '/ai/chat',
|
|
13
|
+
body: input,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Stream a multi-turn chat completion. Yields ChatChunk events
|
|
18
|
+
* (`chunk` / `tool_call` / `done` / `error`).
|
|
19
|
+
*
|
|
20
|
+
* Errors emitted by the hub mid-stream surface as a final
|
|
21
|
+
* `{type: 'error', error: {...}}` chunk and end the iterator —
|
|
22
|
+
* callers don't need try/catch around `for await`.
|
|
23
|
+
*/
|
|
24
|
+
chatStream(input) {
|
|
25
|
+
return this.http.streamSse({
|
|
26
|
+
method: 'POST',
|
|
27
|
+
path: '/ai/chat/stream',
|
|
28
|
+
body: input,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Force a JSON-schema-validated structured response. The hub retries
|
|
33
|
+
* up to `max_repair_retries` times on validation failure before
|
|
34
|
+
* surfacing 422 InvalidOutputError.
|
|
35
|
+
*/
|
|
36
|
+
async structured(input) {
|
|
37
|
+
return this.http.request({
|
|
38
|
+
method: 'POST',
|
|
39
|
+
path: '/ai/structured',
|
|
40
|
+
body: input,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
async embeddings(input) {
|
|
44
|
+
return this.http.request({
|
|
45
|
+
method: 'POST',
|
|
46
|
+
path: '/ai/embeddings',
|
|
47
|
+
body: input,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
async sentiment(input) {
|
|
51
|
+
return this.http.request({
|
|
52
|
+
method: 'POST',
|
|
53
|
+
path: '/ai/sentiment',
|
|
54
|
+
body: input,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
async summarize(input) {
|
|
58
|
+
return this.http.request({
|
|
59
|
+
method: 'POST',
|
|
60
|
+
path: '/ai/summarize',
|
|
61
|
+
body: input,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.AiResource = AiResource;
|
|
66
|
+
//# sourceMappingURL=ai.js.map
|
package/dist/ai.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai.js","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":";;;AAgBA,MAAa,UAAU;IACQ;IAA7B,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD,KAAK,CAAC,IAAI,CAAC,KAAkB;QAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAe;YACrC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,UAAU,CAAC,KAA2B;QACpC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAY;YACpC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,iBAAiB;YACvB,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,UAAU,CAAC,KAAwB;QACvC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAqB;YAC3C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,KAAuB;QACtC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAoB;YAC1C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,KAAuB;QACrC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAoB;YAC1C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,KAAuB;QACrC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAoB;YAC1C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;IACL,CAAC;CACF;AA/DD,gCA+DC"}
|
package/dist/bom.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HttpTransport } from './http';
|
|
2
|
+
import type { BomProcessFileOptions, BomProcessResponse, BomSearchRequest, BomSearchResponse, BomSeedVectorDbFileOptions, BomSeedVectorDbRequest, BomStoreAttributesRequest, BomStoreAttributesResponse, FileInput } from './types';
|
|
3
|
+
export declare class BomResource {
|
|
4
|
+
private readonly http;
|
|
5
|
+
constructor(http: HttpTransport);
|
|
6
|
+
processFile(file: FileInput, options?: BomProcessFileOptions): Promise<BomProcessResponse>;
|
|
7
|
+
search(input: BomSearchRequest): Promise<BomSearchResponse>;
|
|
8
|
+
storeAttributes(input: BomStoreAttributesRequest): Promise<BomStoreAttributesResponse>;
|
|
9
|
+
seedVectorDbFromFile(file: FileInput, options?: BomSeedVectorDbFileOptions): Promise<BomProcessResponse>;
|
|
10
|
+
seedVectorDbFromJson(input: BomSeedVectorDbRequest, callbackUrl?: string): Promise<BomProcessResponse>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=bom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bom.d.ts","sourceRoot":"","sources":["../src/bom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE5C,OAAO,KAAK,EACV,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,0BAA0B,EAC1B,sBAAsB,EACtB,yBAAyB,EACzB,0BAA0B,EAC1B,SAAS,EACV,MAAM,SAAS,CAAC;AAEjB,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAE1C,WAAW,CACf,IAAI,EAAE,SAAS,EACf,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,kBAAkB,CAAC;IAqBxB,MAAM,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAQ3D,eAAe,CACnB,KAAK,EAAE,yBAAyB,GAC/B,OAAO,CAAC,0BAA0B,CAAC;IAQhC,oBAAoB,CACxB,IAAI,EAAE,SAAS,EACf,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,kBAAkB,CAAC;IAaxB,oBAAoB,CACxB,KAAK,EAAE,sBAAsB,EAC7B,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,kBAAkB,CAAC;CAQ/B"}
|
package/dist/bom.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BomResource = void 0;
|
|
4
|
+
const multipart_1 = require("./multipart");
|
|
5
|
+
class BomResource {
|
|
6
|
+
http;
|
|
7
|
+
constructor(http) {
|
|
8
|
+
this.http = http;
|
|
9
|
+
}
|
|
10
|
+
async processFile(file, options = {}) {
|
|
11
|
+
const form = new FormData();
|
|
12
|
+
(0, multipart_1.appendFile)(form, 'file', file);
|
|
13
|
+
(0, multipart_1.appendIfDefined)(form, 'sheet_name', options.sheetName);
|
|
14
|
+
(0, multipart_1.appendIfDefined)(form, 'output_filename', options.outputFilename);
|
|
15
|
+
(0, multipart_1.appendIfDefined)(form, 'model', options.model);
|
|
16
|
+
(0, multipart_1.appendIfDefined)(form, 'temperature', options.temperature);
|
|
17
|
+
(0, multipart_1.appendIfDefined)(form, 'use_direct_upload', options.useDirectUpload);
|
|
18
|
+
(0, multipart_1.appendIfDefined)(form, 'callback_url', options.callbackUrl);
|
|
19
|
+
(0, multipart_1.appendIfDefined)(form, 'backend_base_url', options.backendBaseUrl);
|
|
20
|
+
return this.http.requestMultipart({
|
|
21
|
+
path: '/bom/ai/processfile',
|
|
22
|
+
body: form,
|
|
23
|
+
query: {
|
|
24
|
+
configId: options.configId,
|
|
25
|
+
progId: options.progId,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
async search(input) {
|
|
30
|
+
return this.http.request({
|
|
31
|
+
method: 'POST',
|
|
32
|
+
path: '/bom/search',
|
|
33
|
+
body: input,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
async storeAttributes(input) {
|
|
37
|
+
return this.http.request({
|
|
38
|
+
method: 'POST',
|
|
39
|
+
path: '/bom/store-attributes',
|
|
40
|
+
body: input,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
async seedVectorDbFromFile(file, options = {}) {
|
|
44
|
+
const form = new FormData();
|
|
45
|
+
(0, multipart_1.appendFile)(form, 'file', file);
|
|
46
|
+
(0, multipart_1.appendIfDefined)(form, 'batch_size', options.batchSize);
|
|
47
|
+
(0, multipart_1.appendIfDefined)(form, 'start_id', options.startId);
|
|
48
|
+
(0, multipart_1.appendIfDefined)(form, 'callback_url', options.callbackUrl);
|
|
49
|
+
return this.http.requestMultipart({
|
|
50
|
+
path: '/bom/ai/seed-vector-db',
|
|
51
|
+
body: form,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
async seedVectorDbFromJson(input, callbackUrl) {
|
|
55
|
+
return this.http.request({
|
|
56
|
+
method: 'POST',
|
|
57
|
+
path: '/bom/ai/seed-vector-db-json',
|
|
58
|
+
body: input,
|
|
59
|
+
query: { callback_url: callbackUrl },
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.BomResource = BomResource;
|
|
64
|
+
//# sourceMappingURL=bom.js.map
|
package/dist/bom.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bom.js","sourceRoot":"","sources":["../src/bom.ts"],"names":[],"mappings":";;;AACA,2CAA0D;AAa1D,MAAa,WAAW;IACO;IAA7B,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD,KAAK,CAAC,WAAW,CACf,IAAe,EACf,UAAiC,EAAE;QAEnC,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC5B,IAAA,sBAAU,EAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAC/B,IAAA,2BAAe,EAAC,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QACvD,IAAA,2BAAe,EAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;QACjE,IAAA,2BAAe,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QAC9C,IAAA,2BAAe,EAAC,IAAI,EAAE,aAAa,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QAC1D,IAAA,2BAAe,EAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;QACpE,IAAA,2BAAe,EAAC,IAAI,EAAE,cAAc,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QAC3D,IAAA,2BAAe,EAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;QAElE,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAqB;YACpD,IAAI,EAAE,qBAAqB;YAC3B,IAAI,EAAE,IAAI;YACV,KAAK,EAAE;gBACL,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,MAAM,EAAE,OAAO,CAAC,MAAM;aACvB;SACF,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAuB;QAClC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAoB;YAC1C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,KAAgC;QAEhC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA6B;YACnD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,uBAAuB;YAC7B,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,oBAAoB,CACxB,IAAe,EACf,UAAsC,EAAE;QAExC,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC5B,IAAA,sBAAU,EAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAC/B,IAAA,2BAAe,EAAC,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QACvD,IAAA,2BAAe,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QACnD,IAAA,2BAAe,EAAC,IAAI,EAAE,cAAc,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QAE3D,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAqB;YACpD,IAAI,EAAE,wBAAwB;YAC9B,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,oBAAoB,CACxB,KAA6B,EAC7B,WAAoB;QAEpB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAqB;YAC3C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,6BAA6B;YACnC,IAAI,EAAE,KAAK;YACX,KAAK,EAAE,EAAE,YAAY,EAAE,WAAW,EAAE;SACrC,CAAC,CAAC;IACL,CAAC;CACF;AAxED,kCAwEC"}
|
package/dist/cache.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HttpTransport } from './http';
|
|
2
|
+
import type { CacheDeleteResponse, CacheGetResponse, CacheSetInput, CacheSetResponse, CacheTokenInvalidateResponse } from './types';
|
|
3
|
+
export declare class CacheResource {
|
|
4
|
+
private readonly http;
|
|
5
|
+
constructor(http: HttpTransport);
|
|
6
|
+
get<T = unknown>(key: string): Promise<CacheGetResponse<T>>;
|
|
7
|
+
set<T = unknown>(key: string, input: CacheSetInput<T>): Promise<CacheSetResponse>;
|
|
8
|
+
delete(key: string): Promise<CacheDeleteResponse>;
|
|
9
|
+
invalidateToken(): Promise<CacheTokenInvalidateResponse>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,4BAA4B,EAC7B,MAAM,SAAS,CAAC;AAEjB,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAE1C,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAO3D,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAQjF,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAOjD,eAAe,IAAI,OAAO,CAAC,4BAA4B,CAAC;CAO/D"}
|
package/dist/cache.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CacheResource = void 0;
|
|
4
|
+
class CacheResource {
|
|
5
|
+
http;
|
|
6
|
+
constructor(http) {
|
|
7
|
+
this.http = http;
|
|
8
|
+
}
|
|
9
|
+
async get(key) {
|
|
10
|
+
return this.http.request({
|
|
11
|
+
method: 'GET',
|
|
12
|
+
path: `/cache/${encodeURIComponent(key)}`,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
async set(key, input) {
|
|
16
|
+
return this.http.request({
|
|
17
|
+
method: 'POST',
|
|
18
|
+
path: `/cache/${encodeURIComponent(key)}`,
|
|
19
|
+
body: input,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
async delete(key) {
|
|
23
|
+
return this.http.request({
|
|
24
|
+
method: 'DELETE',
|
|
25
|
+
path: `/cache/${encodeURIComponent(key)}`,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
async invalidateToken() {
|
|
29
|
+
return this.http.request({
|
|
30
|
+
method: 'POST',
|
|
31
|
+
path: '/cache/token/invalidate',
|
|
32
|
+
body: {},
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.CacheResource = CacheResource;
|
|
37
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":";;;AASA,MAAa,aAAa;IACK;IAA7B,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD,KAAK,CAAC,GAAG,CAAc,GAAW;QAChC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAsB;YAC5C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,UAAU,kBAAkB,CAAC,GAAG,CAAC,EAAE;SAC1C,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,GAAG,CAAc,GAAW,EAAE,KAAuB;QACzD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAmB;YACzC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,UAAU,kBAAkB,CAAC,GAAG,CAAC,EAAE;YACzC,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAW;QACtB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAsB;YAC5C,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,UAAU,kBAAkB,CAAC,GAAG,CAAC,EAAE;SAC1C,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA+B;YACrD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,yBAAyB;YAC/B,IAAI,EAAE,EAAE;SACT,CAAC,CAAC;IACL,CAAC;CACF;AAhCD,sCAgCC"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AiResource } from './ai';
|
|
2
|
+
import { BomResource } from './bom';
|
|
3
|
+
import { OmsfResource } from './omsf';
|
|
4
|
+
import { VendorResource } from './vendor';
|
|
5
|
+
import { TrackerResource } from './tracker';
|
|
6
|
+
import { CacheResource } from './cache';
|
|
7
|
+
import { ForecastResource } from './forecast';
|
|
8
|
+
import { MacroResource } from './macro';
|
|
9
|
+
import { JobsResource } from './jobs';
|
|
10
|
+
import { PromptsResource } from './prompts';
|
|
11
|
+
import { RagResource } from './rag';
|
|
12
|
+
import { ConversationsResource } from './conversations';
|
|
13
|
+
import { DocumentsResource } from './documents';
|
|
14
|
+
import type { CfiAiHubClientConfig } from './types';
|
|
15
|
+
export declare class CfiAiHubClient {
|
|
16
|
+
readonly ai: AiResource;
|
|
17
|
+
readonly bom: BomResource;
|
|
18
|
+
readonly omsf: OmsfResource;
|
|
19
|
+
readonly vendor: VendorResource;
|
|
20
|
+
readonly tracker: TrackerResource;
|
|
21
|
+
readonly cache: CacheResource;
|
|
22
|
+
readonly forecast: ForecastResource;
|
|
23
|
+
readonly macro: MacroResource;
|
|
24
|
+
readonly jobs: JobsResource;
|
|
25
|
+
readonly prompts: PromptsResource;
|
|
26
|
+
readonly rag: RagResource;
|
|
27
|
+
readonly conversations: ConversationsResource;
|
|
28
|
+
readonly documents: DocumentsResource;
|
|
29
|
+
constructor(config: CfiAiHubClientConfig);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,qBAAa,cAAc;IACzB,QAAQ,CAAC,EAAE,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAE9B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,qBAAqB,CAAC;IAC9C,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;gBAE1B,MAAM,EAAE,oBAAoB;CAgBzC"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CfiAiHubClient = void 0;
|
|
4
|
+
const http_1 = require("./http");
|
|
5
|
+
const ai_1 = require("./ai");
|
|
6
|
+
const bom_1 = require("./bom");
|
|
7
|
+
const omsf_1 = require("./omsf");
|
|
8
|
+
const vendor_1 = require("./vendor");
|
|
9
|
+
const tracker_1 = require("./tracker");
|
|
10
|
+
const cache_1 = require("./cache");
|
|
11
|
+
const forecast_1 = require("./forecast");
|
|
12
|
+
const macro_1 = require("./macro");
|
|
13
|
+
const jobs_1 = require("./jobs");
|
|
14
|
+
const prompts_1 = require("./prompts");
|
|
15
|
+
const rag_1 = require("./rag");
|
|
16
|
+
const conversations_1 = require("./conversations");
|
|
17
|
+
const documents_1 = require("./documents");
|
|
18
|
+
class CfiAiHubClient {
|
|
19
|
+
ai;
|
|
20
|
+
bom;
|
|
21
|
+
omsf;
|
|
22
|
+
vendor;
|
|
23
|
+
tracker;
|
|
24
|
+
cache;
|
|
25
|
+
forecast;
|
|
26
|
+
macro;
|
|
27
|
+
// Phase 1 additions (1.1.0)
|
|
28
|
+
jobs;
|
|
29
|
+
prompts;
|
|
30
|
+
rag;
|
|
31
|
+
conversations;
|
|
32
|
+
documents;
|
|
33
|
+
constructor(config) {
|
|
34
|
+
const http = new http_1.HttpTransport(config);
|
|
35
|
+
this.ai = new ai_1.AiResource(http);
|
|
36
|
+
this.bom = new bom_1.BomResource(http);
|
|
37
|
+
this.omsf = new omsf_1.OmsfResource(http);
|
|
38
|
+
this.vendor = new vendor_1.VendorResource(http);
|
|
39
|
+
this.tracker = new tracker_1.TrackerResource(http);
|
|
40
|
+
this.cache = new cache_1.CacheResource(http);
|
|
41
|
+
this.forecast = new forecast_1.ForecastResource(http);
|
|
42
|
+
this.macro = new macro_1.MacroResource(http);
|
|
43
|
+
this.jobs = new jobs_1.JobsResource(http);
|
|
44
|
+
this.prompts = new prompts_1.PromptsResource(http);
|
|
45
|
+
this.rag = new rag_1.RagResource(http);
|
|
46
|
+
this.conversations = new conversations_1.ConversationsResource(http);
|
|
47
|
+
this.documents = new documents_1.DocumentsResource(http);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.CfiAiHubClient = CfiAiHubClient;
|
|
51
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAAA,iCAAuC;AACvC,6BAAkC;AAClC,+BAAoC;AACpC,iCAAsC;AACtC,qCAA0C;AAC1C,uCAA4C;AAC5C,mCAAwC;AACxC,yCAA8C;AAC9C,mCAAwC;AACxC,iCAAsC;AACtC,uCAA4C;AAC5C,+BAAoC;AACpC,mDAAwD;AACxD,2CAAgD;AAGhD,MAAa,cAAc;IAChB,EAAE,CAAa;IACf,GAAG,CAAc;IACjB,IAAI,CAAe;IACnB,MAAM,CAAiB;IACvB,OAAO,CAAkB;IACzB,KAAK,CAAgB;IACrB,QAAQ,CAAmB;IAC3B,KAAK,CAAgB;IAC9B,4BAA4B;IACnB,IAAI,CAAe;IACnB,OAAO,CAAkB;IACzB,GAAG,CAAc;IACjB,aAAa,CAAwB;IACrC,SAAS,CAAoB;IAEtC,YAAY,MAA4B;QACtC,MAAM,IAAI,GAAG,IAAI,oBAAa,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,CAAC,EAAE,GAAG,IAAI,eAAU,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,CAAC,GAAG,GAAG,IAAI,iBAAW,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,mBAAY,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,IAAI,uBAAc,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,IAAI,yBAAe,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,KAAK,GAAG,IAAI,qBAAa,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,IAAI,2BAAgB,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,KAAK,GAAG,IAAI,qBAAa,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,mBAAY,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,IAAI,yBAAe,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,GAAG,GAAG,IAAI,iBAAW,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,aAAa,GAAG,IAAI,qCAAqB,CAAC,IAAI,CAAC,CAAC;QACrD,IAAI,CAAC,SAAS,GAAG,IAAI,6BAAiB,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;CACF;AAhCD,wCAgCC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { HttpTransport } from './http';
|
|
2
|
+
import type { AppendMessageRequest, ChatChunk, ConversationListOptions, ConversationListResponse, ConversationMessageResponse, ConversationResponse, CreateConversationRequest } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Multi-turn chat thread persistence (capability C15).
|
|
5
|
+
*
|
|
6
|
+
* Conversations are tenant-scoped; cross-tenant reads return 404. Use
|
|
7
|
+
* {@link list} with metadata filters (`rfq_id`, `bom_id`, `program_id`,
|
|
8
|
+
* `feature`) to find threads scoped to a business entity.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ConversationsResource {
|
|
11
|
+
private readonly http;
|
|
12
|
+
constructor(http: HttpTransport);
|
|
13
|
+
create(input?: CreateConversationRequest): Promise<ConversationResponse>;
|
|
14
|
+
list(options?: ConversationListOptions): Promise<ConversationListResponse>;
|
|
15
|
+
get(conversationId: string): Promise<ConversationResponse>;
|
|
16
|
+
delete(conversationId: string): Promise<void>;
|
|
17
|
+
/** Plain append — useful when caller already has the assistant reply. */
|
|
18
|
+
appendMessage(conversationId: string, input: AppendMessageRequest): Promise<ConversationMessageResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* Append a user message and stream the assistant reply (SSE).
|
|
21
|
+
* Persists the user message immediately + the assistant message on
|
|
22
|
+
* stream completion (with usage metadata).
|
|
23
|
+
*
|
|
24
|
+
* Same chunk shape as {@link AiResource.chatStream}.
|
|
25
|
+
*/
|
|
26
|
+
appendMessageStream(conversationId: string, input: AppendMessageRequest): AsyncIterable<ChatChunk>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=conversations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../src/conversations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EACV,oBAAoB,EACpB,SAAS,EACT,uBAAuB,EACvB,wBAAwB,EACxB,2BAA2B,EAC3B,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,SAAS,CAAC;AAEjB;;;;;;GAMG;AACH,qBAAa,qBAAqB;IACpB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAE1C,MAAM,CACV,KAAK,GAAE,yBAA8B,GACpC,OAAO,CAAC,oBAAoB,CAAC;IAQ1B,IAAI,CACR,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,wBAAwB,CAAC;IAgB9B,GAAG,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAO1D,MAAM,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOnD,yEAAyE;IACnE,aAAa,CACjB,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC,2BAA2B,CAAC;IAQvC;;;;;;OAMG;IACH,mBAAmB,CACjB,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,oBAAoB,GAC1B,aAAa,CAAC,SAAS,CAAC;CAO5B"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConversationsResource = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Multi-turn chat thread persistence (capability C15).
|
|
6
|
+
*
|
|
7
|
+
* Conversations are tenant-scoped; cross-tenant reads return 404. Use
|
|
8
|
+
* {@link list} with metadata filters (`rfq_id`, `bom_id`, `program_id`,
|
|
9
|
+
* `feature`) to find threads scoped to a business entity.
|
|
10
|
+
*/
|
|
11
|
+
class ConversationsResource {
|
|
12
|
+
http;
|
|
13
|
+
constructor(http) {
|
|
14
|
+
this.http = http;
|
|
15
|
+
}
|
|
16
|
+
async create(input = {}) {
|
|
17
|
+
return this.http.request({
|
|
18
|
+
method: 'POST',
|
|
19
|
+
path: '/ai/conversations',
|
|
20
|
+
body: input,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
async list(options = {}) {
|
|
24
|
+
return this.http.request({
|
|
25
|
+
method: 'GET',
|
|
26
|
+
path: '/ai/conversations',
|
|
27
|
+
query: {
|
|
28
|
+
user_only: options.user_only,
|
|
29
|
+
include_deleted: options.include_deleted,
|
|
30
|
+
limit: options.limit,
|
|
31
|
+
rfq_id: options.rfq_id,
|
|
32
|
+
bom_id: options.bom_id,
|
|
33
|
+
program_id: options.program_id,
|
|
34
|
+
feature: options.feature,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
async get(conversationId) {
|
|
39
|
+
return this.http.request({
|
|
40
|
+
method: 'GET',
|
|
41
|
+
path: `/ai/conversations/${encodeURIComponent(conversationId)}`,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
async delete(conversationId) {
|
|
45
|
+
await this.http.request({
|
|
46
|
+
method: 'DELETE',
|
|
47
|
+
path: `/ai/conversations/${encodeURIComponent(conversationId)}`,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/** Plain append — useful when caller already has the assistant reply. */
|
|
51
|
+
async appendMessage(conversationId, input) {
|
|
52
|
+
return this.http.request({
|
|
53
|
+
method: 'POST',
|
|
54
|
+
path: `/ai/conversations/${encodeURIComponent(conversationId)}/messages`,
|
|
55
|
+
body: input,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Append a user message and stream the assistant reply (SSE).
|
|
60
|
+
* Persists the user message immediately + the assistant message on
|
|
61
|
+
* stream completion (with usage metadata).
|
|
62
|
+
*
|
|
63
|
+
* Same chunk shape as {@link AiResource.chatStream}.
|
|
64
|
+
*/
|
|
65
|
+
appendMessageStream(conversationId, input) {
|
|
66
|
+
return this.http.streamSse({
|
|
67
|
+
method: 'POST',
|
|
68
|
+
path: `/ai/conversations/${encodeURIComponent(conversationId)}/messages/stream`,
|
|
69
|
+
body: input,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.ConversationsResource = ConversationsResource;
|
|
74
|
+
//# sourceMappingURL=conversations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversations.js","sourceRoot":"","sources":["../src/conversations.ts"],"names":[],"mappings":";;;AAWA;;;;;;GAMG;AACH,MAAa,qBAAqB;IACH;IAA7B,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD,KAAK,CAAC,MAAM,CACV,QAAmC,EAAE;QAErC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAuB;YAC7C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,mBAAmB;YACzB,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,IAAI,CACR,UAAmC,EAAE;QAErC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA2B;YACjD,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE;gBACL,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,eAAe,EAAE,OAAO,CAAC,eAAe;gBACxC,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAO;aACzB;SACF,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,cAAsB;QAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAuB;YAC7C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,qBAAqB,kBAAkB,CAAC,cAAc,CAAC,EAAE;SAChE,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,cAAsB;QACjC,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAO;YAC5B,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,qBAAqB,kBAAkB,CAAC,cAAc,CAAC,EAAE;SAChE,CAAC,CAAC;IACL,CAAC;IAED,yEAAyE;IACzE,KAAK,CAAC,aAAa,CACjB,cAAsB,EACtB,KAA2B;QAE3B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA8B;YACpD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,qBAAqB,kBAAkB,CAAC,cAAc,CAAC,WAAW;YACxE,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,mBAAmB,CACjB,cAAsB,EACtB,KAA2B;QAE3B,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAY;YACpC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,qBAAqB,kBAAkB,CAAC,cAAc,CAAC,kBAAkB;YAC/E,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;IACL,CAAC;CACF;AA1ED,sDA0EC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { HttpTransport } from './http';
|
|
2
|
+
import type { GenerateDocumentRequest, GenerateDocumentResponse } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* AI-driven document generation (capability C12).
|
|
5
|
+
*
|
|
6
|
+
* Always async — `generate` submits a job and returns its id. Poll via
|
|
7
|
+
* {@link JobsResource.result} (or {@link JobsResource.pollUntilDone})
|
|
8
|
+
* to get the final {@link DocumentJobResult}.
|
|
9
|
+
*
|
|
10
|
+
* Today only `format: 'docx'` is supported by the hub; other formats
|
|
11
|
+
* return 422 with a clear message.
|
|
12
|
+
*/
|
|
13
|
+
export declare class DocumentsResource {
|
|
14
|
+
private readonly http;
|
|
15
|
+
constructor(http: HttpTransport);
|
|
16
|
+
generate(input: GenerateDocumentRequest): Promise<GenerateDocumentResponse>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=documents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../src/documents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EACV,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;GASG;AACH,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAE1C,QAAQ,CACZ,KAAK,EAAE,uBAAuB,GAC7B,OAAO,CAAC,wBAAwB,CAAC;CAOrC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DocumentsResource = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* AI-driven document generation (capability C12).
|
|
6
|
+
*
|
|
7
|
+
* Always async — `generate` submits a job and returns its id. Poll via
|
|
8
|
+
* {@link JobsResource.result} (or {@link JobsResource.pollUntilDone})
|
|
9
|
+
* to get the final {@link DocumentJobResult}.
|
|
10
|
+
*
|
|
11
|
+
* Today only `format: 'docx'` is supported by the hub; other formats
|
|
12
|
+
* return 422 with a clear message.
|
|
13
|
+
*/
|
|
14
|
+
class DocumentsResource {
|
|
15
|
+
http;
|
|
16
|
+
constructor(http) {
|
|
17
|
+
this.http = http;
|
|
18
|
+
}
|
|
19
|
+
async generate(input) {
|
|
20
|
+
return this.http.request({
|
|
21
|
+
method: 'POST',
|
|
22
|
+
path: '/ai/documents',
|
|
23
|
+
body: input,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.DocumentsResource = DocumentsResource;
|
|
28
|
+
//# sourceMappingURL=documents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documents.js","sourceRoot":"","sources":["../src/documents.ts"],"names":[],"mappings":";;;AAMA;;;;;;;;;GASG;AACH,MAAa,iBAAiB;IACC;IAA7B,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD,KAAK,CAAC,QAAQ,CACZ,KAA8B;QAE9B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA2B;YACjD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;IACL,CAAC;CACF;AAZD,8CAYC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare class CfiAiHubError extends Error {
|
|
2
|
+
readonly statusCode: number;
|
|
3
|
+
readonly code: string;
|
|
4
|
+
readonly requestId: string | undefined;
|
|
5
|
+
readonly details?: unknown[];
|
|
6
|
+
constructor(message: string, statusCode: number, code: string, requestId?: string, details?: unknown[]);
|
|
7
|
+
}
|
|
8
|
+
export declare class NotFoundError extends CfiAiHubError {
|
|
9
|
+
constructor(message: string, requestId?: string);
|
|
10
|
+
}
|
|
11
|
+
export declare class ValidationError extends CfiAiHubError {
|
|
12
|
+
constructor(message: string, requestId?: string, details?: unknown[]);
|
|
13
|
+
}
|
|
14
|
+
export declare class ConflictError extends CfiAiHubError {
|
|
15
|
+
constructor(message: string, requestId?: string, details?: unknown[]);
|
|
16
|
+
}
|
|
17
|
+
export declare class UnauthorizedError extends CfiAiHubError {
|
|
18
|
+
constructor(message: string, requestId?: string);
|
|
19
|
+
}
|
|
20
|
+
export declare class ForbiddenError extends CfiAiHubError {
|
|
21
|
+
constructor(message: string, requestId?: string);
|
|
22
|
+
}
|
|
23
|
+
export declare class ServiceUnavailableError extends CfiAiHubError {
|
|
24
|
+
constructor(message: string, requestId?: string);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,aAAc,SAAQ,KAAK;IACtC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;gBAG3B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,OAAO,EAAE;CAStB;AAED,qBAAa,aAAc,SAAQ,aAAa;gBAClC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;CAGhD;AAED,qBAAa,eAAgB,SAAQ,aAAa;gBACpC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE;CAGrE;AAED,qBAAa,aAAc,SAAQ,aAAa;gBAClC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE;CAGrE;AAED,qBAAa,iBAAkB,SAAQ,aAAa;gBACtC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;CAGhD;AAED,qBAAa,cAAe,SAAQ,aAAa;gBACnC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;CAGhD;AAED,qBAAa,uBAAwB,SAAQ,aAAa;gBAC5C,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;CAGhD"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServiceUnavailableError = exports.ForbiddenError = exports.UnauthorizedError = exports.ConflictError = exports.ValidationError = exports.NotFoundError = exports.CfiAiHubError = void 0;
|
|
4
|
+
class CfiAiHubError extends Error {
|
|
5
|
+
statusCode;
|
|
6
|
+
code;
|
|
7
|
+
requestId;
|
|
8
|
+
details;
|
|
9
|
+
constructor(message, statusCode, code, requestId, details) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = this.constructor.name;
|
|
12
|
+
this.statusCode = statusCode;
|
|
13
|
+
this.code = code;
|
|
14
|
+
this.requestId = requestId;
|
|
15
|
+
this.details = details;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.CfiAiHubError = CfiAiHubError;
|
|
19
|
+
class NotFoundError extends CfiAiHubError {
|
|
20
|
+
constructor(message, requestId) {
|
|
21
|
+
super(message, 404, 'NOT_FOUND', requestId);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.NotFoundError = NotFoundError;
|
|
25
|
+
class ValidationError extends CfiAiHubError {
|
|
26
|
+
constructor(message, requestId, details) {
|
|
27
|
+
super(message, 422, 'VALIDATION_ERROR', requestId, details);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.ValidationError = ValidationError;
|
|
31
|
+
class ConflictError extends CfiAiHubError {
|
|
32
|
+
constructor(message, requestId, details) {
|
|
33
|
+
super(message, 409, 'CONFLICT', requestId, details);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.ConflictError = ConflictError;
|
|
37
|
+
class UnauthorizedError extends CfiAiHubError {
|
|
38
|
+
constructor(message, requestId) {
|
|
39
|
+
super(message, 401, 'UNAUTHORIZED', requestId);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.UnauthorizedError = UnauthorizedError;
|
|
43
|
+
class ForbiddenError extends CfiAiHubError {
|
|
44
|
+
constructor(message, requestId) {
|
|
45
|
+
super(message, 403, 'FORBIDDEN', requestId);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.ForbiddenError = ForbiddenError;
|
|
49
|
+
class ServiceUnavailableError extends CfiAiHubError {
|
|
50
|
+
constructor(message, requestId) {
|
|
51
|
+
super(message, 503, 'SERVICE_UNAVAILABLE', requestId);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.ServiceUnavailableError = ServiceUnavailableError;
|
|
55
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,aAAc,SAAQ,KAAK;IAC7B,UAAU,CAAS;IACnB,IAAI,CAAS;IACb,SAAS,CAAqB;IAC9B,OAAO,CAAa;IAE7B,YACE,OAAe,EACf,UAAkB,EAClB,IAAY,EACZ,SAAkB,EAClB,OAAmB;QAEnB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AApBD,sCAoBC;AAED,MAAa,aAAc,SAAQ,aAAa;IAC9C,YAAY,OAAe,EAAE,SAAkB;QAC7C,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IAC9C,CAAC;CACF;AAJD,sCAIC;AAED,MAAa,eAAgB,SAAQ,aAAa;IAChD,YAAY,OAAe,EAAE,SAAkB,EAAE,OAAmB;QAClE,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,kBAAkB,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;CACF;AAJD,0CAIC;AAED,MAAa,aAAc,SAAQ,aAAa;IAC9C,YAAY,OAAe,EAAE,SAAkB,EAAE,OAAmB;QAClE,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;CACF;AAJD,sCAIC;AAED,MAAa,iBAAkB,SAAQ,aAAa;IAClD,YAAY,OAAe,EAAE,SAAkB;QAC7C,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;IACjD,CAAC;CACF;AAJD,8CAIC;AAED,MAAa,cAAe,SAAQ,aAAa;IAC/C,YAAY,OAAe,EAAE,SAAkB;QAC7C,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IAC9C,CAAC;CACF;AAJD,wCAIC;AAED,MAAa,uBAAwB,SAAQ,aAAa;IACxD,YAAY,OAAe,EAAE,SAAkB;QAC7C,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,qBAAqB,EAAE,SAAS,CAAC,CAAC;IACxD,CAAC;CACF;AAJD,0DAIC"}
|