@campfire-interactive/cfi-ai-hub-client 2.0.2 → 2.0.3

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 (81) hide show
  1. package/dist/ai.d.ts +26 -0
  2. package/dist/ai.d.ts.map +1 -0
  3. package/dist/ai.js +66 -0
  4. package/dist/ai.js.map +1 -0
  5. package/dist/bom.d.ts +12 -0
  6. package/dist/bom.d.ts.map +1 -0
  7. package/dist/bom.js +64 -0
  8. package/dist/bom.js.map +1 -0
  9. package/dist/cache.d.ts +11 -0
  10. package/dist/cache.d.ts.map +1 -0
  11. package/dist/cache.js +37 -0
  12. package/dist/cache.js.map +1 -0
  13. package/dist/client.d.ts +31 -0
  14. package/dist/client.d.ts.map +1 -0
  15. package/dist/client.js +51 -0
  16. package/dist/client.js.map +1 -0
  17. package/dist/conversations.d.ts +28 -0
  18. package/dist/conversations.d.ts.map +1 -0
  19. package/dist/conversations.js +74 -0
  20. package/dist/conversations.js.map +1 -0
  21. package/dist/documents.d.ts +18 -0
  22. package/dist/documents.d.ts.map +1 -0
  23. package/dist/documents.js +28 -0
  24. package/dist/documents.js.map +1 -0
  25. package/dist/errors.d.ts +26 -0
  26. package/dist/errors.d.ts.map +1 -0
  27. package/dist/errors.js +55 -0
  28. package/dist/errors.js.map +1 -0
  29. package/dist/forecast.d.ts +61 -0
  30. package/dist/forecast.d.ts.map +1 -0
  31. package/dist/forecast.js +164 -0
  32. package/dist/forecast.js.map +1 -0
  33. package/dist/http.d.ts +42 -0
  34. package/dist/http.d.ts.map +1 -0
  35. package/dist/http.js +214 -0
  36. package/dist/http.js.map +1 -0
  37. package/dist/index.d.ts +21 -0
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +49 -0
  40. package/dist/index.js.map +1 -0
  41. package/dist/jobs.d.ts +33 -0
  42. package/dist/jobs.d.ts.map +1 -0
  43. package/dist/jobs.js +79 -0
  44. package/dist/jobs.js.map +1 -0
  45. package/dist/macro.d.ts +35 -0
  46. package/dist/macro.d.ts.map +1 -0
  47. package/dist/macro.js +64 -0
  48. package/dist/macro.js.map +1 -0
  49. package/dist/mock.d.ts +107 -0
  50. package/dist/mock.d.ts.map +1 -0
  51. package/dist/mock.js +497 -0
  52. package/dist/mock.js.map +1 -0
  53. package/dist/multipart.d.ts +4 -0
  54. package/dist/multipart.d.ts.map +1 -0
  55. package/dist/multipart.js +21 -0
  56. package/dist/multipart.js.map +1 -0
  57. package/dist/omsf.d.ts +22 -0
  58. package/dist/omsf.d.ts.map +1 -0
  59. package/dist/omsf.js +67 -0
  60. package/dist/omsf.js.map +1 -0
  61. package/dist/prompts.d.ts +24 -0
  62. package/dist/prompts.d.ts.map +1 -0
  63. package/dist/prompts.js +71 -0
  64. package/dist/prompts.js.map +1 -0
  65. package/dist/rag.d.ts +18 -0
  66. package/dist/rag.d.ts.map +1 -0
  67. package/dist/rag.js +39 -0
  68. package/dist/rag.js.map +1 -0
  69. package/dist/tracker.d.ts +15 -0
  70. package/dist/tracker.d.ts.map +1 -0
  71. package/dist/tracker.js +74 -0
  72. package/dist/tracker.js.map +1 -0
  73. package/dist/types.d.ts +713 -0
  74. package/dist/types.d.ts.map +1 -0
  75. package/dist/types.js +18 -0
  76. package/dist/types.js.map +1 -0
  77. package/dist/vendor.d.ts +8 -0
  78. package/dist/vendor.d.ts.map +1 -0
  79. package/dist/vendor.js +18 -0
  80. package/dist/vendor.js.map +1 -0
  81. package/package.json +1 -1
@@ -0,0 +1,61 @@
1
+ import type { HttpTransport } from './http';
2
+ import type { BatchForecastJobResponse, BatchForecastRequest, BatchForecastResult, ForecastHealthResponse, ForecastJobResponse, ForecastRequest, ForecastResponse, PollProgressOptions, ProgressResponse } from './types';
3
+ export declare class ForecastResource {
4
+ private readonly http;
5
+ constructor(http: HttpTransport);
6
+ /**
7
+ * Synchronous single-series forecast. Runs all requested models (or auto-selects
8
+ * the best model when `models` is omitted) and returns immediately.
9
+ *
10
+ * For large series or long horizons use `predictAsync` to avoid HTTP timeouts.
11
+ */
12
+ predict(request: ForecastRequest): Promise<ForecastResponse>;
13
+ /**
14
+ * Submit a single-series forecast as a background job.
15
+ * Returns a `progress_id` immediately — poll with `getJob` or `pollJob`.
16
+ */
17
+ predictAsync(request: ForecastRequest): Promise<ForecastJobResponse>;
18
+ /**
19
+ * Submit a batch of up to 500 series for concurrent background forecasting.
20
+ * Returns a `progress_id` immediately — poll with `getJob` or `pollBatchJob`.
21
+ */
22
+ predictBatch(request: BatchForecastRequest): Promise<BatchForecastJobResponse>;
23
+ /**
24
+ * Get the current status of a single-series background forecast job.
25
+ * When `status === 'completed'`, `data` contains the `ForecastResponse`.
26
+ */
27
+ getJob(progressId: string): Promise<ProgressResponse<ForecastResponse>>;
28
+ /**
29
+ * Get the current status of a batch background forecast job.
30
+ * When `status === 'completed'`, `data` contains the `BatchForecastResult`.
31
+ */
32
+ getBatchJob(progressId: string): Promise<ProgressResponse<BatchForecastResult>>;
33
+ /**
34
+ * Poll a single-series job until it reaches a terminal status.
35
+ * Throws `CfiAiHubError` on timeout or if the abort signal fires.
36
+ */
37
+ pollJob(progressId: string, options?: PollProgressOptions): Promise<ProgressResponse<ForecastResponse>>;
38
+ /**
39
+ * Poll a batch job until it reaches a terminal status.
40
+ * Throws `CfiAiHubError` on timeout or if the abort signal fires.
41
+ */
42
+ pollBatchJob(progressId: string, options?: PollProgressOptions): Promise<ProgressResponse<BatchForecastResult>>;
43
+ /**
44
+ * Convenience: submit a single-series async forecast and wait for the result.
45
+ * Equivalent to `predictAsync` followed by `pollJob`.
46
+ *
47
+ * @throws `CfiAiHubError` when the job fails, times out, or is aborted.
48
+ */
49
+ predictAsyncAndWait(request: ForecastRequest, options?: PollProgressOptions): Promise<ForecastResponse>;
50
+ /**
51
+ * Convenience: submit a batch and wait for the full result.
52
+ * Equivalent to `predictBatch` followed by `pollBatchJob`.
53
+ *
54
+ * @throws `CfiAiHubError` when the job fails, times out, or is aborted.
55
+ */
56
+ predictBatchAndWait(request: BatchForecastRequest, options?: PollProgressOptions): Promise<BatchForecastResult>;
57
+ /** Model load status, enabled models, and inference device configuration. */
58
+ health(): Promise<ForecastHealthResponse>;
59
+ private _poll;
60
+ }
61
+ //# sourceMappingURL=forecast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forecast.d.ts","sourceRoot":"","sources":["../src/forecast.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EACV,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAUjB,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAEhD;;;;;OAKG;IACG,OAAO,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAQlE;;;OAGG;IACG,YAAY,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAQ1E;;;OAGG;IACG,YAAY,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAQpF;;;OAGG;IACG,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IAO7E;;;OAGG;IACG,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;IAOrF;;;OAGG;IACG,OAAO,CACX,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IAI9C;;;OAGG;IACG,YAAY,CAChB,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;IAIjD;;;;;OAKG;IACG,mBAAmB,CACvB,OAAO,EAAE,eAAe,EACxB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,gBAAgB,CAAC;IAiB5B;;;;;OAKG;IACG,mBAAmB,CACvB,OAAO,EAAE,oBAAoB,EAC7B,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,mBAAmB,CAAC;IAiB/B,6EAA6E;IACvE,MAAM,IAAI,OAAO,CAAC,sBAAsB,CAAC;YAOjC,KAAK;CAmCpB"}
@@ -0,0 +1,164 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ForecastResource = void 0;
4
+ const errors_1 = require("./errors");
5
+ const types_1 = require("./types");
6
+ const TERMINAL_STATUSES = new Set([
7
+ types_1.ProgressStatus.DONE,
8
+ types_1.ProgressStatus.ERROR,
9
+ types_1.ProgressStatus.ABORT,
10
+ types_1.ProgressStatus.ABORT_WITH_MESSAGE,
11
+ ]);
12
+ class ForecastResource {
13
+ http;
14
+ constructor(http) {
15
+ this.http = http;
16
+ }
17
+ /**
18
+ * Synchronous single-series forecast. Runs all requested models (or auto-selects
19
+ * the best model when `models` is omitted) and returns immediately.
20
+ *
21
+ * For large series or long horizons use `predictAsync` to avoid HTTP timeouts.
22
+ */
23
+ async predict(request) {
24
+ return this.http.request({
25
+ method: 'POST',
26
+ path: '/forecast/predict',
27
+ body: request,
28
+ });
29
+ }
30
+ /**
31
+ * Submit a single-series forecast as a background job.
32
+ * Returns a `progress_id` immediately — poll with `getJob` or `pollJob`.
33
+ */
34
+ async predictAsync(request) {
35
+ return this.http.request({
36
+ method: 'POST',
37
+ path: '/forecast/predict-async',
38
+ body: request,
39
+ });
40
+ }
41
+ /**
42
+ * Submit a batch of up to 500 series for concurrent background forecasting.
43
+ * Returns a `progress_id` immediately — poll with `getJob` or `pollBatchJob`.
44
+ */
45
+ async predictBatch(request) {
46
+ return this.http.request({
47
+ method: 'POST',
48
+ path: '/forecast/predict-batch',
49
+ body: request,
50
+ });
51
+ }
52
+ /**
53
+ * Get the current status of a single-series background forecast job.
54
+ * When `status === 'completed'`, `data` contains the `ForecastResponse`.
55
+ */
56
+ async getJob(progressId) {
57
+ return this.http.request({
58
+ method: 'GET',
59
+ path: `/forecast/jobs/${encodeURIComponent(progressId)}`,
60
+ });
61
+ }
62
+ /**
63
+ * Get the current status of a batch background forecast job.
64
+ * When `status === 'completed'`, `data` contains the `BatchForecastResult`.
65
+ */
66
+ async getBatchJob(progressId) {
67
+ return this.http.request({
68
+ method: 'GET',
69
+ path: `/forecast/jobs/${encodeURIComponent(progressId)}`,
70
+ });
71
+ }
72
+ /**
73
+ * Poll a single-series job until it reaches a terminal status.
74
+ * Throws `CfiAiHubError` on timeout or if the abort signal fires.
75
+ */
76
+ async pollJob(progressId, options = {}) {
77
+ return this._poll(progressId, options);
78
+ }
79
+ /**
80
+ * Poll a batch job until it reaches a terminal status.
81
+ * Throws `CfiAiHubError` on timeout or if the abort signal fires.
82
+ */
83
+ async pollBatchJob(progressId, options = {}) {
84
+ return this._poll(progressId, options);
85
+ }
86
+ /**
87
+ * Convenience: submit a single-series async forecast and wait for the result.
88
+ * Equivalent to `predictAsync` followed by `pollJob`.
89
+ *
90
+ * @throws `CfiAiHubError` when the job fails, times out, or is aborted.
91
+ */
92
+ async predictAsyncAndWait(request, options = {}) {
93
+ const job = await this.predictAsync(request);
94
+ const result = await this.pollJob(job.progress_id, options);
95
+ if (result.status === types_1.ProgressStatus.ERROR) {
96
+ throw new errors_1.CfiAiHubError(result.error ?? 'Forecast job failed', 0, 'FORECAST_JOB_FAILED');
97
+ }
98
+ if (!result.data) {
99
+ throw new errors_1.CfiAiHubError('Forecast job completed but returned no data', 0, 'NO_DATA');
100
+ }
101
+ return result.data;
102
+ }
103
+ /**
104
+ * Convenience: submit a batch and wait for the full result.
105
+ * Equivalent to `predictBatch` followed by `pollBatchJob`.
106
+ *
107
+ * @throws `CfiAiHubError` when the job fails, times out, or is aborted.
108
+ */
109
+ async predictBatchAndWait(request, options = {}) {
110
+ const job = await this.predictBatch(request);
111
+ const result = await this.pollBatchJob(job.progress_id, options);
112
+ if (result.status === types_1.ProgressStatus.ERROR) {
113
+ throw new errors_1.CfiAiHubError(result.error ?? 'Batch forecast job failed', 0, 'BATCH_JOB_FAILED');
114
+ }
115
+ if (!result.data) {
116
+ throw new errors_1.CfiAiHubError('Batch job completed but returned no data', 0, 'NO_DATA');
117
+ }
118
+ return result.data;
119
+ }
120
+ /** Model load status, enabled models, and inference device configuration. */
121
+ async health() {
122
+ return this.http.request({
123
+ method: 'GET',
124
+ path: '/forecast/health',
125
+ });
126
+ }
127
+ async _poll(progressId, options) {
128
+ const intervalMs = options.intervalMs ?? 2000;
129
+ const timeoutMs = options.timeoutMs ?? 30 * 60 * 1000;
130
+ const deadline = Date.now() + timeoutMs;
131
+ while (true) {
132
+ if (options.signal?.aborted) {
133
+ throw new errors_1.CfiAiHubError('Polling aborted', 0, 'ABORTED');
134
+ }
135
+ const progress = await this.http.request({
136
+ method: 'GET',
137
+ path: `/forecast/jobs/${encodeURIComponent(progressId)}`,
138
+ });
139
+ options.onProgress?.(progress);
140
+ if (TERMINAL_STATUSES.has(progress.status)) {
141
+ return progress;
142
+ }
143
+ if (Date.now() >= deadline) {
144
+ throw new errors_1.CfiAiHubError(`Forecast job polling timed out after ${timeoutMs}ms for job ${progressId}`, 0, 'POLL_TIMEOUT');
145
+ }
146
+ await sleep(intervalMs, options.signal);
147
+ }
148
+ }
149
+ }
150
+ exports.ForecastResource = ForecastResource;
151
+ function sleep(ms, signal) {
152
+ return new Promise((resolve, reject) => {
153
+ const timer = setTimeout(() => {
154
+ signal?.removeEventListener('abort', onAbort);
155
+ resolve();
156
+ }, ms);
157
+ const onAbort = () => {
158
+ clearTimeout(timer);
159
+ reject(new errors_1.CfiAiHubError('Polling aborted', 0, 'ABORTED'));
160
+ };
161
+ signal?.addEventListener('abort', onAbort, { once: true });
162
+ });
163
+ }
164
+ //# sourceMappingURL=forecast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forecast.js","sourceRoot":"","sources":["../src/forecast.ts"],"names":[],"mappings":";;;AAAA,qCAAyC;AAazC,mCAAyC;AAEzC,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAS;IACxC,sBAAc,CAAC,IAAI;IACnB,sBAAc,CAAC,KAAK;IACpB,sBAAc,CAAC,KAAK;IACpB,sBAAc,CAAC,kBAAkB;CAClC,CAAC,CAAC;AAEH,MAAa,gBAAgB;IACE;IAA7B,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CAAC,OAAwB;QACpC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAmB;YACzC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,mBAAmB;YACzB,IAAI,EAAE,OAAO;SACd,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,YAAY,CAAC,OAAwB;QACzC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAsB;YAC5C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,yBAAyB;YAC/B,IAAI,EAAE,OAAO;SACd,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,YAAY,CAAC,OAA6B;QAC9C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA2B;YACjD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,yBAAyB;YAC/B,IAAI,EAAE,OAAO;SACd,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,UAAkB;QAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAqC;YAC3D,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,kBAAkB,kBAAkB,CAAC,UAAU,CAAC,EAAE;SACzD,CAAC,C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ETE' | 'PATCH';
4
+ path: string;
5
+ body?: unknown;
6
+ query?: Record<string, string | number | boolean | undefined | null>;
7
+ idempotencyKey?: string;
8
+ auth?: boolean;
9
+ }
10
+ interface HttpMultipartOptions {
11
+ method?: 'POST' | 'PUT' | 'PATCH';
12
+ path: string;
13
+ body: FormData;
14
+ query?: Record<string, string | number | boolean | undefined | null>;
15
+ idempotencyKey?: string;
16
+ auth?: boolean;
17
+ }
18
+ export declare class HttpTransport {
19
+ private readonly baseUrl;
20
+ private readonly getToken;
21
+ private readonly timeout;
22
+ private readonly etagCache;
23
+ constructor(config: CfiAiHubClientConfig);
24
+ request<T>(options: HttpRequestOptions): Promise<T>;
25
+ /**
26
+ * Stream Server-Sent Events from a POST endpoint.
27
+ *
28
+ * Yields parsed objects one per SSE frame (`data: {json}\n\n`). The hub
29
+ * emits errors as a final `{type: 'error', error: {...}}` chunk and ends
30
+ * the stream — callers iterate safely without try/catch around `for await`.
31
+ *
32
+ * Network / transport errors before the stream starts (timeout, 4xx/5xx
33
+ * on the initial response) DO throw — they're not part of the stream
34
+ * protocol.
35
+ */
36
+ streamSse<T>(options: HttpRequestOptions): AsyncIterable<T>;
37
+ requestMultipart<T>(options: HttpMultipartOptions): Promise<T>;
38
+ private buildUrl;
39
+ private execute;
40
+ }
41
+ export {};
42
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,UAAU,kBAAkB;IAC1B,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC;IACrE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,UAAU,oBAAoB;IAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,OAAO,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC;IACrE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiC;IAC1D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAsD;gBAEpE,MAAM,EAAE,oBAAoB;IAMlC,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC;IA6BzD;;;;;;;;;;OAUG;IACI,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,kBAAkB,GAAG,aAAa,CAAC,CAAC,CAAC;IAmE5D,gBAAgB,CAAC,CAAC,EAAE,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,CAAC,CAAC;IAqBpE,OAAO,CAAC,QAAQ;YAgBF,OAAO;CA2CtB"}
package/dist/http.js ADDED
@@ -0,0 +1,214 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpTransport = void 0;
4
+ const errors_1 = require("./errors");
5
+ class HttpTransport {
6
+ baseUrl;
7
+ getToken;
8
+ timeout;
9
+ etagCache = new Map();
10
+ constructor(config) {
11
+ this.baseUrl = config.baseUrl.replace(/\/+$/, '');
12
+ this.getToken = config.getToken;
13
+ this.timeout = config.timeout ?? 30_000;
14
+ }
15
+ async request(options) {
16
+ const url = this.buildUrl(options.path, options.query);
17
+ const headers = {
18
+ 'Content-Type': 'application/json',
19
+ Accept: 'application/json',
20
+ };
21
+ if (options.auth !== false) {
22
+ headers['Authorization'] = `Bearer ${await this.getToken()}`;
23
+ }
24
+ if (options.method !== 'GET') {
25
+ headers['Idempotency-Key'] = options.idempotencyKey ?? crypto.randomUUID();
26
+ }
27
+ const cacheKey = url.toString();
28
+ if (options.method === 'GET') {
29
+ const cached = this.etagCache.get(cacheKey);
30
+ if (cached)
31
+ headers['If-None-Match'] = cached.etag;
32
+ }
33
+ return this.execute(url.toString(), {
34
+ method: options.method,
35
+ headers,
36
+ body: options.body !== undefined ? JSON.stringify(options.body) : undefined,
37
+ }, options.method === 'GET' ? cacheKey : undefined);
38
+ }
39
+ /**
40
+ * Stream Server-Sent Events from a POST endpoint.
41
+ *
42
+ * Yields parsed objects one per SSE frame (`data: {json}\n\n`). The hub
43
+ * emits errors as a final `{type: 'error', error: {...}}` chunk and ends
44
+ * the stream — callers iterate safely without try/catch around `for await`.
45
+ *
46
+ * Network / transport errors before the stream starts (timeout, 4xx/5xx
47
+ * on the initial response) DO throw — they're not part of the stream
48
+ * protocol.
49
+ */
50
+ async *streamSse(options) {
51
+ const url = this.buildUrl(options.path, options.query);
52
+ const headers = {
53
+ 'Content-Type': 'application/json',
54
+ Accept: 'text/event-stream',
55
+ };
56
+ if (options.auth !== false) {
57
+ headers['Authorization'] = `Bearer ${await this.getToken()}`;
58
+ }
59
+ if (options.method !== 'GET') {
60
+ headers['Idempotency-Key'] = options.idempotencyKey ?? crypto.randomUUID();
61
+ }
62
+ const response = await fetch(url.toString(), {
63
+ method: options.method,
64
+ headers,
65
+ body: options.body !== undefined ? JSON.stringify(options.body) : undefined,
66
+ });
67
+ if (!response.ok) {
68
+ throw await buildError(response, response.headers.get('x-request-id') ?? undefined);
69
+ }
70
+ if (!response.body) {
71
+ throw new errors_1.CfiAiHubError('Empty stream body', 0, 'EMPTY_STREAM');
72
+ }
73
+ const reader = response.body.getReader();
74
+ const decoder = new TextDecoder();
75
+ let buffer = '';
76
+ try {
77
+ while (true) {
78
+ const { value, done } = await reader.read();
79
+ if (done)
80
+ break;
81
+ buffer += decoder.decode(value, { stream: true });
82
+ // SSE frames are separated by a blank line; one or more `data:` lines per frame.
83
+ let split;
84
+ while ((split = buffer.indexOf('\n\n')) !== -1) {
85
+ const frame = buffer.slice(0, split);
86
+ buffer = buffer.slice(split + 2);
87
+ const dataLines = frame
88
+ .split('\n')
89
+ .filter((l) => l.startsWith('data:'))
90
+ .map((l) => l.slice(5).trimStart());
91
+ if (!dataLines.length)
92
+ continue;
93
+ const payload = dataLines.join('\n');
94
+ try {
95
+ yield JSON.parse(payload);
96
+ }
97
+ catch {
98
+ // Tolerate non-JSON sentinel frames; skip them.
99
+ }
100
+ }
101
+ }
102
+ }
103
+ finally {
104
+ try {
105
+ await reader.cancel();
106
+ }
107
+ catch {
108
+ // ignore — already closed
109
+ }
110
+ }
111
+ }
112
+ async requestMultipart(options) {
113
+ const url = this.buildUrl(options.path, options.query);
114
+ const method = options.method ?? 'POST';
115
+ const headers = {
116
+ Accept: 'application/json',
117
+ };
118
+ if (options.auth !== false) {
119
+ headers['Authorization'] = `Bearer ${await this.getToken()}`;
120
+ }
121
+ headers['Idempotency-Key'] = options.idempotencyKey ?? crypto.randomUUID();
122
+ return this.execute(url.toString(), {
123
+ method,
124
+ headers,
125
+ body: options.body,
126
+ });
127
+ }
128
+ buildUrl(path, query) {
129
+ const normalizedPath = path.startsWith('/') ? path : `/${path}`;
130
+ const url = new URL(this.baseUrl + normalizedPath);
131
+ if (query) {
132
+ for (const [key, value] of Object.entries(query)) {
133
+ if (value !== undefined && value !== null) {
134
+ url.searchParams.set(key, String(value));
135
+ }
136
+ }
137
+ }
138
+ return url;
139
+ }
140
+ async execute(url, init, cacheKey) {
141
+ const controller = new AbortController();
142
+ const timer = setTimeout(() => controller.abort(), this.timeout);
143
+ let response;
144
+ try {
145
+ response = await fetch(url, { ...init, signal: controller.signal });
146
+ }
147
+ catch (err) {
148
+ if (err instanceof DOMException && err.name === 'AbortError') {
149
+ throw new errors_1.CfiAiHubError('Request timed out', 0, 'TIMEOUT');
150
+ }
151
+ throw err;
152
+ }
153
+ finally {
154
+ clearTimeout(timer);
155
+ }
156
+ if (cacheKey && response.status === 304) {
157
+ const cached = this.etagCache.get(cacheKey);
158
+ if (cached)
159
+ return cached.data;
160
+ }
161
+ if (response.status === 204) {
162
+ return undefined;
163
+ }
164
+ const etag = response.headers.get('etag');
165
+ const requestId = response.headers.get('x-request-id') ?? undefined;
166
+ if (!response.ok) {
167
+ throw await buildError(response, requestId);
168
+ }
169
+ const contentType = response.headers.get('content-type') ?? '';
170
+ const data = contentType.includes('application/json')
171
+ ? await response.json()
172
+ : (await response.text());
173
+ if (cacheKey && etag) {
174
+ this.etagCache.set(cacheKey, { etag, data });
175
+ }
176
+ return data;
177
+ }
178
+ }
179
+ exports.HttpTransport = HttpTransport;
180
+ async function buildError(response, requestId) {
181
+ let body = {};
182
+ try {
183
+ body = (await response.json());
184
+ }
185
+ catch {
186
+ // non-JSON error body
187
+ }
188
+ const message = (typeof body.detail === 'string' ? body.detail : undefined) ??
189
+ body.error ??
190
+ body.message ??
191
+ response.statusText ??
192
+ 'Request failed';
193
+ const details = Array.isArray(body.detail)
194
+ ? body.detail
195
+ : body.details;
196
+ switch (response.status) {
197
+ case 400:
198
+ case 422:
199
+ return new errors_1.ValidationError(message, requestId, details);
200
+ case 401:
201
+ return new errors_1.UnauthorizedError(message, requestId);
202
+ case 403:
203
+ return new errors_1.ForbiddenError(message, requestId);
204
+ case 404:
205
+ return new errors_1.NotFoundError(message, requestId);
206
+ case 409:
207
+ return new errors_1.ConflictError(message, requestId, details);
208
+ case 503:
209
+ return new errors_1.ServiceUnavailableError(message, requestId);
210
+ default:
211
+ return new errors_1.CfiAiHubError(message, response.status, body.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CAAC,IAAI,IAAI,OAAO,EACpB,SAAS,EACT,OAAO,CACR,CAAC;IACN,CAAC;AACH,CAAC"}
@@ -0,0 +1,21 @@
1
+ export { CfiAiHubClient } from './client';
2
+ export { MockCfiAiHubClient } from './mock';
3
+ export { AiResource } from './ai';
4
+ export { BomResource } from './bom';
5
+ export { OmsfResource } from './omsf';
6
+ export { VendorResource } from './vendor';
7
+ export { TrackerResource } from './tracker';
8
+ export { CacheResource } from './cache';
9
+ export { ForecastResource } from './forecast';
10
+ export { MacroResource } from './macro';
11
+ export { JobsResource } from './jobs';
12
+ export { PromptsResource } from './prompts';
13
+ export { RagResource } from './rag';
14
+ export { ConversationsResource } from './conversations';
15
+ export { DocumentsResource } from './documents';
16
+ export { ProgressStatus } from './types';
17
+ export type { CfiAiHubClientConfig, FileInput, ChatRequest, ChatResponse, EmbeddingRequest, EmbeddingResponse, SentimentRequest, SentimentResponse, SummarizeRequest, SummarizeResponse, AttributeFilter, BomProcessFileOptions, BomProcessResponse, BomSearchRequest, BomSearchResult, BomSearchResponse, BomStoreAttributesRequest, BomStoreAttributesResponse, BomSeedVectorDbRequest, BomSeedVectorDbFileOptions, VolumeAnalyzeResponse, FollowUpRequest, FollowUpResponse, ColumnDetectionResponse, IsoDate, FileComparisonConfig, FileComparisonResponse, VolumeDashboardResponse, OmsfHealthResponse, TenantConfigEntry, SegmentsInfo, CompareVendorFilesRequest, CompareVendorFilesResponse, ProgressStatusValue, ProgressResponse, AbortProgressInput, ActionResponse, PollProgressOptions, CacheGetResponse, CacheSetInput, CacheSetResponse, CacheDeleteResponse, CacheTokenInvalidateResponse, ForecastModelName, WeeklyDataPoint, ForecastRequest, WeeklyForecastPoint, ModelForecastResult, ModelSelectionInfo, ForecastResponse, ForecastJobResponse, BatchForecastRequest, BatchForecastJobResponse, BatchForecastResult, ForecastHealthResponse, MacroIndicatorType, MacroMonthlyValue, MacroUpsertRequest, MacroUpsertResponse, MacroDataPoint, MacroQueryResponse, MacroQueryOptions, MacroTypeInfo, MacroTypesResponse, HealthResponse, TableInfoColumn, TableInfoResponse, Tool, ToolCall, ToolResult, MessageRole, ConversationMessage, StreamingChatRequest, ChatChunkType, ChatChunk, StructuredRequest, StructuredResponse, JobStatus, SubmitJobRequest, JobResponse, JobListResponse, JobListOptions, JobResultDoneResponse, JobResultPendingResponse, PromptVersion, PromptListResponse, PromptVersionsResponse, CreatePromptVersionRequest, UpsertOverrideRequest, TenantPromptOverrideResponse, RenderPromptRequest, RenderPromptResponse, RagUpsertItem, RagUpsertRequest, RagUpsertResponse, RagRetrieveRequest, RagMatch, RagRetrieveResponse, CreateConversationRequest, ConversationMessageResponse, ConversationResponse, ConversationListResponse, ConversationListOptions, AppendMessageRequest, DocumentFormat, GenerateDocumentRequest, GenerateDocumentResponse, DocumentJobResult, } from './types';
18
+ export type { VolumeAnalyzeOptions, VolumeDashboardInput } from './omsf';
19
+ export type { MockSeedData } from './mock';
20
+ export { CfiAiHubError, NotFoundError, ValidationError, ConflictError, UnauthorizedError, ForbiddenError, ServiceUnavailableError, } from './errors';
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAG5C,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,aA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AAc,EACd,eAAe,EACf,iBAAiB,EAGjB,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,iBAAiB,EACjB,kBAAkB,EAElB,SAAS,EACT,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EAExB,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,qBAAqB,EACrB,4BAA4B,EAC5B,mBAAmB,EACnB,oBAAoB,EAEpB,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,QAAQ,EACR,mBAAmB,EAEnB,yBAAyB,EACzB,2BAA2B,EAC3B,oBAAoB,EACpB,wBAAwB,EACxB,uBAAuB,EACvB,oBAAoB,EAEpB,cAAc,EACd,uBAAuB,EACvB,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,SAAS,CAAC;AAGjB,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAGzE,YAAY,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAG3C,OAAO,EACL,aAAa,EACb,aAAa,EACb,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,uBAAuB,GACxB,MAAM,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,49 @@
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 = exports.ProgressStatus = exports.DocumentsResource = exports.ConversationsResource = exports.RagResource = exports.PromptsResource = exports.JobsResource = exports.MacroResource = exports.ForecastResource = exports.CacheResource = exports.TrackerResource = exports.VendorResource = exports.OmsfResource = exports.BomResource = exports.AiResource = exports.MockCfiAiHubClient = exports.CfiAiHubClient = void 0;
4
+ // Client
5
+ var client_1 = require("./client");
6
+ Object.defineProperty(exports, "CfiAiHubClient", { enumerable: true, get: function () { return client_1.CfiAiHubClient; } });
7
+ var mock_1 = require("./mock");
8
+ Object.defineProperty(exports, "MockCfiAiHubClient", { enumerable: true, get: function () { return mock_1.MockCfiAiHubClient; } });
9
+ // Resource classes (for type references)
10
+ var ai_1 = require("./ai");
11
+ Object.defineProperty(exports, "AiResource", { enumerable: true, get: function () { return ai_1.AiResource; } });
12
+ var bom_1 = require("./bom");
13
+ Object.defineProperty(exports, "BomResource", { enumerable: true, get: function () { return bom_1.BomResource; } });
14
+ var omsf_1 = require("./omsf");
15
+ Object.defineProperty(exports, "OmsfResource", { enumerable: true, get: function () { return omsf_1.OmsfResource; } });
16
+ var vendor_1 = require("./vendor");
17
+ Object.defineProperty(exports, "VendorResource", { enumerable: true, get: function () { return vendor_1.VendorResource; } });
18
+ var tracker_1 = require("./tracker");
19
+ Object.defineProperty(exports, "TrackerResource", { enumerable: true, get: function () { return tracker_1.TrackerResource; } });
20
+ var cache_1 = require("./cache");
21
+ Object.defineProperty(exports, "CacheResource", { enumerable: true, get: function () { return cache_1.CacheResource; } });
22
+ var forecast_1 = require("./forecast");
23
+ Object.defineProperty(exports, "ForecastResource", { enumerable: true, get: function () { return forecast_1.ForecastResource; } });
24
+ var macro_1 = require("./macro");
25
+ Object.defineProperty(exports, "MacroResource", { enumerable: true, get: function () { return macro_1.MacroResource; } });
26
+ // Phase 1 additions (1.1.0)
27
+ var jobs_1 = require("./jobs");
28
+ Object.defineProperty(exports, "JobsResource", { enumerable: true, get: function () { return jobs_1.JobsResource; } });
29
+ var prompts_1 = require("./prompts");
30
+ Object.defineProperty(exports, "PromptsResource", { enumerable: true, get: function () { return prompts_1.PromptsResource; } });
31
+ var rag_1 = require("./rag");
32
+ Object.defineProperty(exports, "RagResource", { enumerable: true, get: function () { return rag_1.RagResource; } });
33
+ var conversations_1 = require("./conversations");
34
+ Object.defineProperty(exports, "ConversationsResource", { enumerable: true, get: function () { return conversations_1.ConversationsResource; } });
35
+ var documents_1 = require("./documents");
36
+ Object.defineProperty(exports, "DocumentsResource", { enumerable: true, get: function () { return documents_1.DocumentsResource; } });
37
+ // Progress status constants
38
+ var types_1 = require("./types");
39
+ Object.defineProperty(exports, "ProgressStatus", { enumerable: true, get: function () { return types_1.ProgressStatus; } });
40
+ // Errors
41
+ var errors_1 = require("./errors");
42
+ Object.defineProperty(exports, "CfiAiHubError", { enumerable: true, get: function () { return errors_1.CfiAiHubError; } });
43
+ Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return errors_1.NotFoundError; } });
44
+ Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return errors_1.ValidationError; } });
45
+ Object.defineProperty(exports, "ConflictError", { enumerable: true, get: function () { return errors_1.ConflictError; } });
46
+ Object.defineProperty(exports, "UnauthorizedError", { enumerable: true, get: function () { return errors_1.UnauthorizedError; } });
47
+ Object.defineProperty(exports, "ForbiddenError", { enumerable: true, get: function () { return errors_1.ForbiddenError; } });
48
+ Object.defineProperty(exports, "ServiceUnavailableError", { enumerable: true, get: function () { return errors_1.ServiceUnavailableError; } });
49
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,SAAS;AACT,mCAA0C;AAAjC,wGAAA,cAAc,OAAA;AACvB,+BAA4C;AAAnC,0GAAA,kBAAkB,OAAA;AAE3B,yCAAyC;AACzC,2BAAkC;AAAzB,gGAAA,UAAU,OAAA;AACnB,6BAAoC;AAA3B,kGAAA,WAAW,OAAA;AACpB,+BAAsC;AAA7B,oGAAA,YAAY,OAAA;AACrB,mCAA0C;AAAjC,wGAAA,cAAc,OAAA;AACvB,qCAA4C;AAAnC,0GAAA,eAAe,OAAA;AACxB,iCAAwC;AAA/B,sGAAA,aAAa,OAAA;AACtB,uCAA8C;AAArC,4GAAA,gBAAgB,OAAA;AACzB,iCAAwC;AAA/B,sGAAA,aAAa,OAAA;AACtB,4BAA4B;AAC5B,+BAAsC;AAA7B,oGAAA,YAAY,OAAA;AACrB,qCAA4C;AAAnC,0GAAA,eAAe,OAAA;AACxB,6BAAoC;AAA3B,kGAAA,WAAW,OAAA;AACpB,iDAAwD;AAA/C,sHAAA,qBAAqB,OAAA;AAC9B,yCAAgD;AAAvC,8GAAA,iBAAiB,OAAA;AAE1B,4BAA4B;AAC5B,iCAAyC;AAAhC,uGAAA,cAAc,OAAA;AAyIvB,SAAS;AACT,mCAQkB;AAPhB,uGAAA,aAAa,OAAA;AACb,uGAAA,aAAa,OAAA;AACb,yGAAA,eAAe,OAAA;AACf,uGAAA,aAAa,OAAA;AACb,2GAAA,iBAAiB,OAAA;AACjB,wGAAA,cAAc,OAAA;AACd,iHAAA,uBAAuB,OAAA"}
package/dist/jobs.d.ts ADDED
@@ -0,0 +1,33 @@
1
+ import type { HttpTransport } from './http';
2
+ import type { JobListOptions, JobListResponse, JobResponse, JobResultDoneResponse, JobResultPendingResponse, SubmitJobRequest } from './types';
3
+ /**
4
+ * Async-jobs queue (capability C11).
5
+ *
6
+ * Submit a job, then poll {@link result} (or {@link get}) until terminal.
7
+ * Tenant ownership is enforced server-side; cross-tenant reads return 404.
8
+ */
9
+ export declare class JobsResource {
10
+ private readonly http;
11
+ constructor(http: HttpTransport);
12
+ submit(input: SubmitJobRequest): Promise<JobResponse>;
13
+ list(options?: JobListOptions): Promise<JobListResponse>;
14
+ get(jobId: string): Promise<JobResponse>;
15
+ /**
16
+ * Returns the job result if it's succeeded, else the current pending state.
17
+ * Hub returns 200+result on success, 202+progress while running, and
18
+ * surfaces 4xx/5xx for failed/cancelled jobs (which propagate as thrown
19
+ * errors from this method).
20
+ */
21
+ result(jobId: string): Promise<JobResultDoneResponse | JobResultPendingResponse>;
22
+ /** Request cooperative cancellation. Idempotent for terminal jobs. */
23
+ cancel(jobId: string): Promise<JobResponse>;
24
+ /**
25
+ * Convenience: poll until the job reaches a terminal state.
26
+ * Returns the final {@link JobResponse}. Throws if cancelled / failed.
27
+ */
28
+ pollUntilDone(jobId: string, options?: {
29
+ intervalMs?: number;
30
+ timeoutMs?: number;
31
+ }): Promise<JobResponse>;
32
+ }
33
+ //# sourceMappingURL=jobs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jobs.d.ts","sourceRoot":"","sources":["../src/jobs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,WAAW,EACX,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAEjB;;;;;GAKG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAE1C,MAAM,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,WAAW,CAAC;IAQrD,IAAI,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,eAAe,CAAC;IAY5D,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAO9C;;;;;OAKG;IACG,MAAM,CACV,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,qBAAqB,GAAG,wBAAwB,CAAC;IAO5D,sEAAsE;IAChE,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAOjD;;;OAGG;IACG,aAAa,CACjB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO,GACxD,OAAO,CAAC,WAAW,CAAC;CAcxB"}