cngkit 1.1.17 → 1.1.18

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 (44) hide show
  1. package/README.md +19 -1
  2. package/dist/{chunk-K36DKQWH.js → chunk-C7HFDK4S.js} +70 -4
  3. package/dist/chunk-C7HFDK4S.js.map +1 -0
  4. package/dist/{chunk-WYJTGGMN.js → chunk-CBIVTEZP.js} +2 -2
  5. package/dist/{chunk-WYJTGGMN.js.map → chunk-CBIVTEZP.js.map} +1 -1
  6. package/dist/{chunk-HRFI2IEP.js → chunk-FJ34NVQ4.js} +350 -2
  7. package/dist/chunk-FJ34NVQ4.js.map +1 -0
  8. package/dist/{chunk-5ZNV3FDG.js → chunk-IB5B3BLY.js} +3 -3
  9. package/dist/{chunk-BL3XMLIH.js → chunk-KSW6QT5Q.js} +57 -2
  10. package/dist/chunk-KSW6QT5Q.js.map +1 -0
  11. package/dist/{chunk-GT2MTS6E.js → chunk-TWQDLZ6F.js} +2 -2
  12. package/dist/{chunk-VCWNKNUE.js → chunk-ZA4YOWPB.js} +9 -1
  13. package/dist/chunk-ZA4YOWPB.js.map +1 -0
  14. package/dist/cli.js +31 -6
  15. package/dist/cli.js.map +1 -1
  16. package/dist/commands/coderoom/index.js +4 -4
  17. package/dist/commands/coderoom/join.js +5 -5
  18. package/dist/commands/coderoom/share.js +5 -5
  19. package/dist/commands/hookify/index.js +25 -0
  20. package/dist/commands/hookify/index.js.map +1 -0
  21. package/dist/commands/hookify/ingest.js +88 -0
  22. package/dist/commands/hookify/ingest.js.map +1 -0
  23. package/dist/commands/index.js +3 -3
  24. package/dist/commands/knowledges/audiences.js +6 -6
  25. package/dist/commands/knowledges/files.js +6 -6
  26. package/dist/commands/knowledges/glob.js +6 -6
  27. package/dist/commands/knowledges/grep.js +6 -6
  28. package/dist/commands/knowledges/index.js +4 -4
  29. package/dist/commands/knowledges/list.js +6 -6
  30. package/dist/commands/knowledges/ls.js +31 -0
  31. package/dist/commands/knowledges/ls.js.map +1 -0
  32. package/dist/commands/knowledges/read.js +6 -6
  33. package/dist/commands/knowledges/search.js +6 -6
  34. package/dist/commands/knowledges/status.js +6 -6
  35. package/dist/commands/login.js +3 -3
  36. package/dist/commands/scrub.js +3 -3
  37. package/dist/commands/transcripts.js +4 -4
  38. package/package.json +2 -2
  39. package/dist/chunk-BL3XMLIH.js.map +0 -1
  40. package/dist/chunk-HRFI2IEP.js.map +0 -1
  41. package/dist/chunk-K36DKQWH.js.map +0 -1
  42. package/dist/chunk-VCWNKNUE.js.map +0 -1
  43. /package/dist/{chunk-5ZNV3FDG.js.map → chunk-IB5B3BLY.js.map} +0 -0
  44. /package/dist/{chunk-GT2MTS6E.js.map → chunk-TWQDLZ6F.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveApiBaseUrl
3
- } from "./chunk-WYJTGGMN.js";
3
+ } from "./chunk-CBIVTEZP.js";
4
4
  import {
5
5
  __export
6
6
  } from "./chunk-PZ5AY32C.js";
@@ -298,6 +298,15 @@ var HarnessSemanticSearchResponse;
298
298
  };
299
299
  })(HarnessSemanticSearchResponse || (HarnessSemanticSearchResponse = {}));
300
300
 
301
+ // ../../packages/client/src/generated/api/types/HookifyIngestResponse.ts
302
+ var HookifyIngestResponse;
303
+ ((HookifyIngestResponse2) => {
304
+ HookifyIngestResponse2.Mode = {
305
+ Sync: "sync",
306
+ Async: "async"
307
+ };
308
+ })(HookifyIngestResponse || (HookifyIngestResponse = {}));
309
+
301
310
  // ../../packages/client/src/generated/core/headers.ts
302
311
  function mergeHeaders(...headersArray) {
303
312
  const result = {};
@@ -1447,6 +1456,174 @@ async function makePassthroughRequest(input, init, clientOptions, requestOptions
1447
1456
  return response;
1448
1457
  }
1449
1458
 
1459
+ // ../../packages/client/src/generated/core/file/index.ts
1460
+ var file_exports = {};
1461
+ __export(file_exports, {
1462
+ toBinaryUploadRequest: () => toBinaryUploadRequest,
1463
+ toMultipartDataPart: () => toMultipartDataPart
1464
+ });
1465
+
1466
+ // ../../packages/client/src/generated/core/file/file.ts
1467
+ async function toBinaryUploadRequest(file) {
1468
+ const { data, filename, contentLength, contentType } = await getFileWithMetadata(file);
1469
+ const request = {
1470
+ body: data,
1471
+ headers: {}
1472
+ };
1473
+ if (filename) {
1474
+ request.headers["Content-Disposition"] = `attachment; filename="${filename}"`;
1475
+ }
1476
+ if (contentType) {
1477
+ request.headers["Content-Type"] = contentType;
1478
+ }
1479
+ if (contentLength != null) {
1480
+ request.headers["Content-Length"] = contentLength.toString();
1481
+ }
1482
+ return request;
1483
+ }
1484
+ async function toMultipartDataPart(file) {
1485
+ const { data, filename, contentType } = await getFileWithMetadata(file, {
1486
+ noSniffFileSize: true
1487
+ });
1488
+ return {
1489
+ data,
1490
+ filename,
1491
+ contentType
1492
+ };
1493
+ }
1494
+ async function getFileWithMetadata(file, { noSniffFileSize } = {}) {
1495
+ if (isFileLike(file)) {
1496
+ return getFileWithMetadata(
1497
+ {
1498
+ data: file
1499
+ },
1500
+ { noSniffFileSize }
1501
+ );
1502
+ }
1503
+ if ("path" in file) {
1504
+ const fs = await import("fs");
1505
+ if (!fs?.createReadStream) {
1506
+ throw new Error("File path uploads are not supported in this environment.");
1507
+ }
1508
+ const data = fs.createReadStream(file.path);
1509
+ const contentLength = file.contentLength ?? (noSniffFileSize === true ? void 0 : await tryGetFileSizeFromPath(file.path));
1510
+ const filename = file.filename ?? getNameFromPath(file.path);
1511
+ return {
1512
+ data,
1513
+ filename,
1514
+ contentType: file.contentType,
1515
+ contentLength
1516
+ };
1517
+ }
1518
+ if ("data" in file) {
1519
+ const data = file.data;
1520
+ const contentLength = file.contentLength ?? await tryGetContentLengthFromFileLike(data, {
1521
+ noSniffFileSize
1522
+ });
1523
+ const filename = file.filename ?? tryGetNameFromFileLike(data);
1524
+ return {
1525
+ data,
1526
+ filename,
1527
+ contentType: file.contentType ?? tryGetContentTypeFromFileLike(data),
1528
+ contentLength
1529
+ };
1530
+ }
1531
+ throw new Error(`Invalid FileUpload of type ${typeof file}: ${JSON.stringify(file)}`);
1532
+ }
1533
+ function isFileLike(value) {
1534
+ return isBuffer(value) || isArrayBufferView(value) || isArrayBuffer(value) || isUint8Array(value) || isBlob(value) || isFile(value) || isStreamLike(value) || isReadableStream(value);
1535
+ }
1536
+ async function tryGetFileSizeFromPath(path) {
1537
+ try {
1538
+ const fs = await import("fs");
1539
+ if (!fs?.promises?.stat) {
1540
+ return void 0;
1541
+ }
1542
+ const fileStat = await fs.promises.stat(path);
1543
+ return fileStat.size;
1544
+ } catch (_fallbackError) {
1545
+ return void 0;
1546
+ }
1547
+ }
1548
+ function tryGetNameFromFileLike(data) {
1549
+ if (isNamedValue(data)) {
1550
+ return data.name;
1551
+ }
1552
+ if (isPathedValue(data)) {
1553
+ return getNameFromPath(data.path.toString());
1554
+ }
1555
+ return void 0;
1556
+ }
1557
+ async function tryGetContentLengthFromFileLike(data, { noSniffFileSize } = {}) {
1558
+ if (isBuffer(data)) {
1559
+ return data.length;
1560
+ }
1561
+ if (isArrayBufferView(data)) {
1562
+ return data.byteLength;
1563
+ }
1564
+ if (isArrayBuffer(data)) {
1565
+ return data.byteLength;
1566
+ }
1567
+ if (isBlob(data)) {
1568
+ return data.size;
1569
+ }
1570
+ if (isFile(data)) {
1571
+ return data.size;
1572
+ }
1573
+ if (noSniffFileSize === true) {
1574
+ return void 0;
1575
+ }
1576
+ if (isPathedValue(data)) {
1577
+ return await tryGetFileSizeFromPath(data.path.toString());
1578
+ }
1579
+ return void 0;
1580
+ }
1581
+ function tryGetContentTypeFromFileLike(data) {
1582
+ if (isBlob(data)) {
1583
+ return data.type;
1584
+ }
1585
+ if (isFile(data)) {
1586
+ return data.type;
1587
+ }
1588
+ return void 0;
1589
+ }
1590
+ function getNameFromPath(path) {
1591
+ const lastForwardSlash = path.lastIndexOf("/");
1592
+ const lastBackSlash = path.lastIndexOf("\\");
1593
+ const lastSlashIndex = Math.max(lastForwardSlash, lastBackSlash);
1594
+ return lastSlashIndex >= 0 ? path.substring(lastSlashIndex + 1) : path;
1595
+ }
1596
+ function isNamedValue(value) {
1597
+ return typeof value === "object" && value != null && "name" in value;
1598
+ }
1599
+ function isPathedValue(value) {
1600
+ return typeof value === "object" && value != null && "path" in value;
1601
+ }
1602
+ function isStreamLike(value) {
1603
+ return typeof value === "object" && value != null && ("read" in value || "pipe" in value);
1604
+ }
1605
+ function isReadableStream(value) {
1606
+ return typeof value === "object" && value != null && "getReader" in value;
1607
+ }
1608
+ function isBuffer(value) {
1609
+ return typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(value);
1610
+ }
1611
+ function isArrayBufferView(value) {
1612
+ return typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView(value);
1613
+ }
1614
+ function isArrayBuffer(value) {
1615
+ return typeof ArrayBuffer !== "undefined" && value instanceof ArrayBuffer;
1616
+ }
1617
+ function isUint8Array(value) {
1618
+ return typeof Uint8Array !== "undefined" && value instanceof Uint8Array;
1619
+ }
1620
+ function isBlob(value) {
1621
+ return typeof Blob !== "undefined" && value instanceof Blob;
1622
+ }
1623
+ function isFile(value) {
1624
+ return typeof File !== "undefined" && value instanceof File;
1625
+ }
1626
+
1450
1627
  // ../../packages/client/src/generated/core/logging/index.ts
1451
1628
  var logging_exports = {};
1452
1629
  __export(logging_exports, {
@@ -2072,6 +2249,116 @@ var HarnessFilesystemClient = class {
2072
2249
  }
2073
2250
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/harness/filesystem/glob");
2074
2251
  }
2252
+ /**
2253
+ * @param {CngApi.GetHarnessFilesystemLsRequest} request
2254
+ * @param {HarnessFilesystemClient.RequestOptions} requestOptions - Request-specific configuration.
2255
+ *
2256
+ * @throws {@link CngApi.BadRequestError}
2257
+ *
2258
+ * @example
2259
+ * await client.harnessFilesystem.getHarnessFilesystemLs()
2260
+ */
2261
+ getHarnessFilesystemLs(request = {}, requestOptions) {
2262
+ return HttpResponsePromise.fromPromise(this.__getHarnessFilesystemLs(request, requestOptions));
2263
+ }
2264
+ async __getHarnessFilesystemLs(request = {}, requestOptions) {
2265
+ const { path, limit } = request;
2266
+ const _queryParams = {
2267
+ path,
2268
+ limit
2269
+ };
2270
+ const _headers = mergeHeaders(this._options?.headers, requestOptions?.headers);
2271
+ const _response = await fetcher({
2272
+ url: url_exports.join(
2273
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? CngApiEnvironment.Default,
2274
+ "api/harness/filesystem/ls"
2275
+ ),
2276
+ method: "GET",
2277
+ headers: _headers,
2278
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
2279
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
2280
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
2281
+ abortSignal: requestOptions?.abortSignal,
2282
+ fetchFn: this._options?.fetch,
2283
+ logging: this._options.logging
2284
+ });
2285
+ if (_response.ok) {
2286
+ return {
2287
+ data: _response.body,
2288
+ rawResponse: _response.rawResponse
2289
+ };
2290
+ }
2291
+ if (_response.error.reason === "status-code") {
2292
+ switch (_response.error.statusCode) {
2293
+ case 400:
2294
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
2295
+ default:
2296
+ throw new CngApiError({
2297
+ statusCode: _response.error.statusCode,
2298
+ body: _response.error.body,
2299
+ rawResponse: _response.rawResponse
2300
+ });
2301
+ }
2302
+ }
2303
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/harness/filesystem/ls");
2304
+ }
2305
+ /**
2306
+ * @param {CngApi.GetHarnessFilesystemStatRequest} request
2307
+ * @param {HarnessFilesystemClient.RequestOptions} requestOptions - Request-specific configuration.
2308
+ *
2309
+ * @throws {@link CngApi.BadRequestError}
2310
+ * @throws {@link CngApi.NotFoundError}
2311
+ *
2312
+ * @example
2313
+ * await client.harnessFilesystem.getHarnessFilesystemStat({
2314
+ * path: "path"
2315
+ * })
2316
+ */
2317
+ getHarnessFilesystemStat(request, requestOptions) {
2318
+ return HttpResponsePromise.fromPromise(this.__getHarnessFilesystemStat(request, requestOptions));
2319
+ }
2320
+ async __getHarnessFilesystemStat(request, requestOptions) {
2321
+ const { path } = request;
2322
+ const _queryParams = {
2323
+ path
2324
+ };
2325
+ const _headers = mergeHeaders(this._options?.headers, requestOptions?.headers);
2326
+ const _response = await fetcher({
2327
+ url: url_exports.join(
2328
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? CngApiEnvironment.Default,
2329
+ "api/harness/filesystem/stat"
2330
+ ),
2331
+ method: "GET",
2332
+ headers: _headers,
2333
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
2334
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
2335
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
2336
+ abortSignal: requestOptions?.abortSignal,
2337
+ fetchFn: this._options?.fetch,
2338
+ logging: this._options.logging
2339
+ });
2340
+ if (_response.ok) {
2341
+ return {
2342
+ data: _response.body,
2343
+ rawResponse: _response.rawResponse
2344
+ };
2345
+ }
2346
+ if (_response.error.reason === "status-code") {
2347
+ switch (_response.error.statusCode) {
2348
+ case 400:
2349
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
2350
+ case 404:
2351
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
2352
+ default:
2353
+ throw new CngApiError({
2354
+ statusCode: _response.error.statusCode,
2355
+ body: _response.error.body,
2356
+ rawResponse: _response.rawResponse
2357
+ });
2358
+ }
2359
+ }
2360
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/harness/filesystem/stat");
2361
+ }
2075
2362
  };
2076
2363
 
2077
2364
  // ../../packages/client/src/generated/api/resources/harnessInternalKnowledges/client/Client.ts
@@ -2870,6 +3157,63 @@ var HarnessKnowledgesClient = class {
2870
3157
  }
2871
3158
  };
2872
3159
 
3160
+ // ../../packages/client/src/generated/api/resources/hookify/client/Client.ts
3161
+ var HookifyClient = class {
3162
+ _options;
3163
+ constructor(options = {}) {
3164
+ this._options = normalizeClientOptions(options);
3165
+ }
3166
+ /**
3167
+ * @param {core.file.Uploadable} uploadable
3168
+ * @param {CngApi.IngestHookifyHookRequest} request
3169
+ * @param {HookifyClient.RequestOptions} requestOptions - Request-specific configuration.
3170
+ */
3171
+ ingestHookifyHook(uploadable, request, requestOptions) {
3172
+ return HttpResponsePromise.fromPromise(this.__ingestHookifyHook(uploadable, request, requestOptions));
3173
+ }
3174
+ async __ingestHookifyHook(uploadable, request, requestOptions) {
3175
+ const _queryParams = {
3176
+ mode: request.mode != null ? request.mode : void 0,
3177
+ event: request.event
3178
+ };
3179
+ const _binaryUploadRequest = await file_exports.toBinaryUploadRequest(uploadable);
3180
+ const _headers = mergeHeaders(
3181
+ this._options?.headers,
3182
+ _binaryUploadRequest.headers,
3183
+ requestOptions?.headers
3184
+ );
3185
+ const _response = await fetcher({
3186
+ url: url_exports.join(
3187
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? CngApiEnvironment.Default,
3188
+ "api/hookify/ingest"
3189
+ ),
3190
+ method: "POST",
3191
+ headers: _headers,
3192
+ contentType: "application/octet-stream",
3193
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
3194
+ requestType: "bytes",
3195
+ duplex: "half",
3196
+ body: _binaryUploadRequest.body,
3197
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
3198
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
3199
+ abortSignal: requestOptions?.abortSignal,
3200
+ fetchFn: this._options?.fetch,
3201
+ logging: this._options.logging
3202
+ });
3203
+ if (_response.ok) {
3204
+ return { data: _response.body, rawResponse: _response.rawResponse };
3205
+ }
3206
+ if (_response.error.reason === "status-code") {
3207
+ throw new CngApiError({
3208
+ statusCode: _response.error.statusCode,
3209
+ body: _response.error.body,
3210
+ rawResponse: _response.rawResponse
3211
+ });
3212
+ }
3213
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/api/hookify/ingest");
3214
+ }
3215
+ };
3216
+
2873
3217
  // ../../packages/client/src/generated/api/resources/llm/client/Client.ts
2874
3218
  var LlmClient = class {
2875
3219
  _options;
@@ -3142,6 +3486,7 @@ var CngApiClient = class {
3142
3486
  _polar;
3143
3487
  _telemetry;
3144
3488
  _llm;
3489
+ _hookify;
3145
3490
  constructor(options = {}) {
3146
3491
  this._options = normalizeClientOptions(options);
3147
3492
  }
@@ -3169,6 +3514,9 @@ var CngApiClient = class {
3169
3514
  get llm() {
3170
3515
  return this._llm ??= new LlmClient(this._options);
3171
3516
  }
3517
+ get hookify() {
3518
+ return this._hookify ??= new HookifyClient(this._options);
3519
+ }
3172
3520
  /**
3173
3521
  * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
3174
3522
  * This is useful for making requests to endpoints not yet supported in the SDK.
@@ -3231,4 +3579,4 @@ export {
3231
3579
  createCngApiClient,
3232
3580
  readBackendHealth
3233
3581
  };
3234
- //# sourceMappingURL=chunk-HRFI2IEP.js.map
3582
+ //# sourceMappingURL=chunk-FJ34NVQ4.js.map