cngkit 1.1.18 → 1.1.20
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/LICENSE +1 -1
- package/README.md +94 -19
- package/dist/chunk-CIZBVLN5.js +35 -0
- package/dist/chunk-CIZBVLN5.js.map +1 -0
- package/dist/{chunk-IB5B3BLY.js → chunk-E2GLGGKO.js} +16 -4
- package/dist/chunk-E2GLGGKO.js.map +1 -0
- package/dist/chunk-MRXGD6TC.js +42 -0
- package/dist/chunk-MRXGD6TC.js.map +1 -0
- package/dist/{chunk-ZA4YOWPB.js → chunk-NGEWD4BW.js} +2 -1
- package/dist/chunk-NODJM6SH.js +658 -0
- package/dist/chunk-NODJM6SH.js.map +1 -0
- package/dist/chunk-SKK2XLRZ.js +1590 -0
- package/dist/chunk-SKK2XLRZ.js.map +1 -0
- package/dist/chunk-SMTQ3W3F.js +271 -0
- package/dist/chunk-SMTQ3W3F.js.map +1 -0
- package/dist/{chunk-FJ34NVQ4.js → chunk-WDI43VPW.js} +578 -88
- package/dist/chunk-WDI43VPW.js.map +1 -0
- package/dist/cli.js +107 -27
- package/dist/cli.js.map +1 -1
- package/dist/commands/coderoom/index.js +6 -6
- package/dist/commands/coderoom/index.js.map +1 -1
- package/dist/commands/coderoom/join.js +5 -5
- package/dist/commands/coderoom/share.js +5 -5
- package/dist/commands/hookify/index.js +6 -6
- package/dist/commands/hookify/index.js.map +1 -1
- package/dist/commands/hookify/ingest.js +52 -13
- package/dist/commands/hookify/ingest.js.map +1 -1
- package/dist/commands/hooks/index.js +25 -0
- package/dist/commands/hooks/index.js.map +1 -0
- package/dist/commands/hooks/install.js +40 -0
- package/dist/commands/hooks/install.js.map +1 -0
- package/dist/commands/hooks/uninstall.js +40 -0
- package/dist/commands/hooks/uninstall.js.map +1 -0
- package/dist/commands/index.js +5 -5
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/knowledges/audiences.js +6 -6
- package/dist/commands/knowledges/cat.js +31 -0
- package/dist/commands/knowledges/cat.js.map +1 -0
- package/dist/commands/knowledges/files.js +6 -6
- package/dist/commands/knowledges/find.js +66 -0
- package/dist/commands/knowledges/find.js.map +1 -0
- package/dist/commands/knowledges/glob.js +6 -6
- package/dist/commands/knowledges/grep.js +6 -6
- package/dist/commands/knowledges/head.js +41 -0
- package/dist/commands/knowledges/head.js.map +1 -0
- package/dist/commands/knowledges/index.js +6 -6
- package/dist/commands/knowledges/index.js.map +1 -1
- package/dist/commands/knowledges/list.js +7 -7
- package/dist/commands/knowledges/list.js.map +1 -1
- package/dist/commands/knowledges/ls.js +16 -7
- package/dist/commands/knowledges/ls.js.map +1 -1
- package/dist/commands/knowledges/read.js +6 -6
- package/dist/commands/knowledges/realpath.js +31 -0
- package/dist/commands/knowledges/realpath.js.map +1 -0
- package/dist/commands/knowledges/search.js +6 -6
- package/dist/commands/knowledges/stat.js +31 -0
- package/dist/commands/knowledges/stat.js.map +1 -0
- package/dist/commands/knowledges/status.js +6 -6
- package/dist/commands/knowledges/tail.js +41 -0
- package/dist/commands/knowledges/tail.js.map +1 -0
- package/dist/commands/knowledges/tree.js +46 -0
- package/dist/commands/knowledges/tree.js.map +1 -0
- package/dist/commands/login.js +4 -4
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/scrub.js +38 -15
- package/dist/commands/scrub.js.map +1 -1
- package/dist/commands/transcripts.js +44 -24
- package/dist/commands/transcripts.js.map +1 -1
- package/package.json +3 -4
- package/dist/chunk-C7HFDK4S.js +0 -393
- package/dist/chunk-C7HFDK4S.js.map +0 -1
- package/dist/chunk-CBIVTEZP.js +0 -222
- package/dist/chunk-CBIVTEZP.js.map +0 -1
- package/dist/chunk-FJ34NVQ4.js.map +0 -1
- package/dist/chunk-IB5B3BLY.js.map +0 -1
- package/dist/chunk-KSW6QT5Q.js +0 -628
- package/dist/chunk-KSW6QT5Q.js.map +0 -1
- package/dist/chunk-TWQDLZ6F.js +0 -26
- package/dist/chunk-TWQDLZ6F.js.map +0 -1
- /package/dist/{chunk-ZA4YOWPB.js.map → chunk-NGEWD4BW.js.map} +0 -0
|
@@ -1,10 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
resolveApiBaseUrl
|
|
3
|
-
} from "./chunk-CBIVTEZP.js";
|
|
4
1
|
import {
|
|
5
2
|
__export
|
|
6
3
|
} from "./chunk-PZ5AY32C.js";
|
|
7
4
|
|
|
5
|
+
// src/shared/config.ts
|
|
6
|
+
import { randomBytes, randomUUID } from "crypto";
|
|
7
|
+
import process2 from "process";
|
|
8
|
+
var packageVersion = "1.1.19";
|
|
9
|
+
var defaultApiBaseUrl = "https://curly.ng";
|
|
10
|
+
function resolveApiBaseUrl(options) {
|
|
11
|
+
void options;
|
|
12
|
+
return defaultApiBaseUrl;
|
|
13
|
+
}
|
|
14
|
+
function resolveOutputFormat() {
|
|
15
|
+
const value = process2.env.CNGKIT_FORMAT?.toLowerCase();
|
|
16
|
+
if (value === "json" || value === "markdown") {
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
return "text";
|
|
20
|
+
}
|
|
21
|
+
function parseOutputFormat(value) {
|
|
22
|
+
const normalizedValue = value.toLowerCase();
|
|
23
|
+
if (normalizedValue === "text" || normalizedValue === "json" || normalizedValue === "markdown") {
|
|
24
|
+
return normalizedValue;
|
|
25
|
+
}
|
|
26
|
+
throw new Error("Unknown --format value. Use one of: text, json, markdown.");
|
|
27
|
+
}
|
|
28
|
+
function createRoomCode() {
|
|
29
|
+
return randomBytes(4).toString("hex").toUpperCase();
|
|
30
|
+
}
|
|
31
|
+
function createPeerId() {
|
|
32
|
+
return randomUUID();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// src/shared/output.ts
|
|
36
|
+
import process3 from "process";
|
|
37
|
+
import { createElement, useEffect } from "react";
|
|
38
|
+
import { Static, Text, useStderr, useStdout } from "ink";
|
|
39
|
+
import Markdown from "@inkkit/ink-markdown";
|
|
40
|
+
|
|
8
41
|
// ../../packages/client/src/generated/core/json.ts
|
|
9
42
|
var toJson = (value, replacer, space) => {
|
|
10
43
|
return JSON.stringify(value, replacer, space);
|
|
@@ -294,7 +327,7 @@ var HarnessDatabaseBinding;
|
|
|
294
327
|
var HarnessSemanticSearchResponse;
|
|
295
328
|
((HarnessSemanticSearchResponse2) => {
|
|
296
329
|
HarnessSemanticSearchResponse2.Model = {
|
|
297
|
-
|
|
330
|
+
HarnessSemanticTextSearch: "harness-semantic-text-search"
|
|
298
331
|
};
|
|
299
332
|
})(HarnessSemanticSearchResponse || (HarnessSemanticSearchResponse = {}));
|
|
300
333
|
|
|
@@ -305,8 +338,21 @@ var HookifyIngestResponse;
|
|
|
305
338
|
Sync: "sync",
|
|
306
339
|
Async: "async"
|
|
307
340
|
};
|
|
341
|
+
HookifyIngestResponse2.Status = {
|
|
342
|
+
Completed: "completed",
|
|
343
|
+
Pending: "pending"
|
|
344
|
+
};
|
|
308
345
|
})(HookifyIngestResponse || (HookifyIngestResponse = {}));
|
|
309
346
|
|
|
347
|
+
// ../../packages/client/src/generated/api/types/HookifyRequestResponse.ts
|
|
348
|
+
var HookifyRequestResponse;
|
|
349
|
+
((HookifyRequestResponse2) => {
|
|
350
|
+
HookifyRequestResponse2.Status = {
|
|
351
|
+
Completed: "completed",
|
|
352
|
+
Pending: "pending"
|
|
353
|
+
};
|
|
354
|
+
})(HookifyRequestResponse || (HookifyRequestResponse = {}));
|
|
355
|
+
|
|
310
356
|
// ../../packages/client/src/generated/core/headers.ts
|
|
311
357
|
function mergeHeaders(...headersArray) {
|
|
312
358
|
const result = {};
|
|
@@ -2141,6 +2187,70 @@ var HarnessFilesystemClient = class {
|
|
|
2141
2187
|
}
|
|
2142
2188
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/harness/filesystem/read");
|
|
2143
2189
|
}
|
|
2190
|
+
/**
|
|
2191
|
+
* @param {CngApi.GetHarnessFilesystemTailRequest} request
|
|
2192
|
+
* @param {HarnessFilesystemClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
2193
|
+
*
|
|
2194
|
+
* @throws {@link CngApi.BadRequestError}
|
|
2195
|
+
* @throws {@link CngApi.NotFoundError}
|
|
2196
|
+
* @throws {@link CngApi.ContentTooLargeError}
|
|
2197
|
+
*
|
|
2198
|
+
* @example
|
|
2199
|
+
* await client.harnessFilesystem.getHarnessFilesystemTail({
|
|
2200
|
+
* file_path: "file_path"
|
|
2201
|
+
* })
|
|
2202
|
+
*/
|
|
2203
|
+
getHarnessFilesystemTail(request, requestOptions) {
|
|
2204
|
+
return HttpResponsePromise.fromPromise(this.__getHarnessFilesystemTail(request, requestOptions));
|
|
2205
|
+
}
|
|
2206
|
+
async __getHarnessFilesystemTail(request, requestOptions) {
|
|
2207
|
+
const { file_path: filePath, lines } = request;
|
|
2208
|
+
const _queryParams = {
|
|
2209
|
+
file_path: filePath,
|
|
2210
|
+
lines
|
|
2211
|
+
};
|
|
2212
|
+
const _headers = mergeHeaders(this._options?.headers, requestOptions?.headers);
|
|
2213
|
+
const _response = await fetcher({
|
|
2214
|
+
url: url_exports.join(
|
|
2215
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? CngApiEnvironment.Default,
|
|
2216
|
+
"api/harness/filesystem/tail"
|
|
2217
|
+
),
|
|
2218
|
+
method: "GET",
|
|
2219
|
+
headers: _headers,
|
|
2220
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
2221
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
2222
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
2223
|
+
abortSignal: requestOptions?.abortSignal,
|
|
2224
|
+
fetchFn: this._options?.fetch,
|
|
2225
|
+
logging: this._options.logging
|
|
2226
|
+
});
|
|
2227
|
+
if (_response.ok) {
|
|
2228
|
+
return {
|
|
2229
|
+
data: _response.body,
|
|
2230
|
+
rawResponse: _response.rawResponse
|
|
2231
|
+
};
|
|
2232
|
+
}
|
|
2233
|
+
if (_response.error.reason === "status-code") {
|
|
2234
|
+
switch (_response.error.statusCode) {
|
|
2235
|
+
case 400:
|
|
2236
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
2237
|
+
case 404:
|
|
2238
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
2239
|
+
case 413:
|
|
2240
|
+
throw new ContentTooLargeError(
|
|
2241
|
+
_response.error.body,
|
|
2242
|
+
_response.rawResponse
|
|
2243
|
+
);
|
|
2244
|
+
default:
|
|
2245
|
+
throw new CngApiError({
|
|
2246
|
+
statusCode: _response.error.statusCode,
|
|
2247
|
+
body: _response.error.body,
|
|
2248
|
+
rawResponse: _response.rawResponse
|
|
2249
|
+
});
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/harness/filesystem/tail");
|
|
2253
|
+
}
|
|
2144
2254
|
/**
|
|
2145
2255
|
* @param {CngApi.GetHarnessFilesystemGrepRequest} request
|
|
2146
2256
|
* @param {HarnessFilesystemClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -2302,6 +2412,60 @@ var HarnessFilesystemClient = class {
|
|
|
2302
2412
|
}
|
|
2303
2413
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/harness/filesystem/ls");
|
|
2304
2414
|
}
|
|
2415
|
+
/**
|
|
2416
|
+
* @param {CngApi.GetHarnessFilesystemTreeRequest} request
|
|
2417
|
+
* @param {HarnessFilesystemClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
2418
|
+
*
|
|
2419
|
+
* @throws {@link CngApi.BadRequestError}
|
|
2420
|
+
*
|
|
2421
|
+
* @example
|
|
2422
|
+
* await client.harnessFilesystem.getHarnessFilesystemTree()
|
|
2423
|
+
*/
|
|
2424
|
+
getHarnessFilesystemTree(request = {}, requestOptions) {
|
|
2425
|
+
return HttpResponsePromise.fromPromise(this.__getHarnessFilesystemTree(request, requestOptions));
|
|
2426
|
+
}
|
|
2427
|
+
async __getHarnessFilesystemTree(request = {}, requestOptions) {
|
|
2428
|
+
const { path, depth, limit } = request;
|
|
2429
|
+
const _queryParams = {
|
|
2430
|
+
path,
|
|
2431
|
+
depth,
|
|
2432
|
+
limit
|
|
2433
|
+
};
|
|
2434
|
+
const _headers = mergeHeaders(this._options?.headers, requestOptions?.headers);
|
|
2435
|
+
const _response = await fetcher({
|
|
2436
|
+
url: url_exports.join(
|
|
2437
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? CngApiEnvironment.Default,
|
|
2438
|
+
"api/harness/filesystem/tree"
|
|
2439
|
+
),
|
|
2440
|
+
method: "GET",
|
|
2441
|
+
headers: _headers,
|
|
2442
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
2443
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
2444
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
2445
|
+
abortSignal: requestOptions?.abortSignal,
|
|
2446
|
+
fetchFn: this._options?.fetch,
|
|
2447
|
+
logging: this._options.logging
|
|
2448
|
+
});
|
|
2449
|
+
if (_response.ok) {
|
|
2450
|
+
return {
|
|
2451
|
+
data: _response.body,
|
|
2452
|
+
rawResponse: _response.rawResponse
|
|
2453
|
+
};
|
|
2454
|
+
}
|
|
2455
|
+
if (_response.error.reason === "status-code") {
|
|
2456
|
+
switch (_response.error.statusCode) {
|
|
2457
|
+
case 400:
|
|
2458
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
2459
|
+
default:
|
|
2460
|
+
throw new CngApiError({
|
|
2461
|
+
statusCode: _response.error.statusCode,
|
|
2462
|
+
body: _response.error.body,
|
|
2463
|
+
rawResponse: _response.rawResponse
|
|
2464
|
+
});
|
|
2465
|
+
}
|
|
2466
|
+
}
|
|
2467
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/harness/filesystem/tree");
|
|
2468
|
+
}
|
|
2305
2469
|
/**
|
|
2306
2470
|
* @param {CngApi.GetHarnessFilesystemStatRequest} request
|
|
2307
2471
|
* @param {HarnessFilesystemClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -2359,6 +2523,62 @@ var HarnessFilesystemClient = class {
|
|
|
2359
2523
|
}
|
|
2360
2524
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/harness/filesystem/stat");
|
|
2361
2525
|
}
|
|
2526
|
+
/**
|
|
2527
|
+
* @param {CngApi.GetHarnessFilesystemFindRequest} request
|
|
2528
|
+
* @param {HarnessFilesystemClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
2529
|
+
*
|
|
2530
|
+
* @throws {@link CngApi.BadRequestError}
|
|
2531
|
+
*
|
|
2532
|
+
* @example
|
|
2533
|
+
* await client.harnessFilesystem.getHarnessFilesystemFind()
|
|
2534
|
+
*/
|
|
2535
|
+
getHarnessFilesystemFind(request = {}, requestOptions) {
|
|
2536
|
+
return HttpResponsePromise.fromPromise(this.__getHarnessFilesystemFind(request, requestOptions));
|
|
2537
|
+
}
|
|
2538
|
+
async __getHarnessFilesystemFind(request = {}, requestOptions) {
|
|
2539
|
+
const { path, name, type: type_, max_depth: maxDepth, limit } = request;
|
|
2540
|
+
const _queryParams = {
|
|
2541
|
+
path,
|
|
2542
|
+
name,
|
|
2543
|
+
type: type_ != null ? type_ : void 0,
|
|
2544
|
+
max_depth: maxDepth,
|
|
2545
|
+
limit
|
|
2546
|
+
};
|
|
2547
|
+
const _headers = mergeHeaders(this._options?.headers, requestOptions?.headers);
|
|
2548
|
+
const _response = await fetcher({
|
|
2549
|
+
url: url_exports.join(
|
|
2550
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? CngApiEnvironment.Default,
|
|
2551
|
+
"api/harness/filesystem/find"
|
|
2552
|
+
),
|
|
2553
|
+
method: "GET",
|
|
2554
|
+
headers: _headers,
|
|
2555
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
2556
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
2557
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
2558
|
+
abortSignal: requestOptions?.abortSignal,
|
|
2559
|
+
fetchFn: this._options?.fetch,
|
|
2560
|
+
logging: this._options.logging
|
|
2561
|
+
});
|
|
2562
|
+
if (_response.ok) {
|
|
2563
|
+
return {
|
|
2564
|
+
data: _response.body,
|
|
2565
|
+
rawResponse: _response.rawResponse
|
|
2566
|
+
};
|
|
2567
|
+
}
|
|
2568
|
+
if (_response.error.reason === "status-code") {
|
|
2569
|
+
switch (_response.error.statusCode) {
|
|
2570
|
+
case 400:
|
|
2571
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
2572
|
+
default:
|
|
2573
|
+
throw new CngApiError({
|
|
2574
|
+
statusCode: _response.error.statusCode,
|
|
2575
|
+
body: _response.error.body,
|
|
2576
|
+
rawResponse: _response.rawResponse
|
|
2577
|
+
});
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/harness/filesystem/find");
|
|
2581
|
+
}
|
|
2362
2582
|
};
|
|
2363
2583
|
|
|
2364
2584
|
// ../../packages/client/src/generated/api/resources/harnessInternalKnowledges/client/Client.ts
|
|
@@ -2374,12 +2594,12 @@ var HarnessInternalKnowledgesClient = class {
|
|
|
2374
2594
|
* @throws {@link CngApi.ServiceUnavailableError}
|
|
2375
2595
|
*
|
|
2376
2596
|
* @example
|
|
2377
|
-
* await client.harnessInternalKnowledges.
|
|
2597
|
+
* await client.harnessInternalKnowledges.createHarnessTopicAssetsSyncPlan()
|
|
2378
2598
|
*/
|
|
2379
|
-
|
|
2380
|
-
return HttpResponsePromise.fromPromise(this.
|
|
2599
|
+
createHarnessTopicAssetsSyncPlan(requestOptions) {
|
|
2600
|
+
return HttpResponsePromise.fromPromise(this.__createHarnessTopicAssetsSyncPlan(requestOptions));
|
|
2381
2601
|
}
|
|
2382
|
-
async
|
|
2602
|
+
async __createHarnessTopicAssetsSyncPlan(requestOptions) {
|
|
2383
2603
|
const _headers = mergeHeaders(this._options?.headers, requestOptions?.headers);
|
|
2384
2604
|
const _response = await fetcher({
|
|
2385
2605
|
url: url_exports.join(
|
|
@@ -2421,7 +2641,7 @@ var HarnessInternalKnowledgesClient = class {
|
|
|
2421
2641
|
);
|
|
2422
2642
|
}
|
|
2423
2643
|
/**
|
|
2424
|
-
* @param {CngApi.
|
|
2644
|
+
* @param {CngApi.GetHarnessTopicAssetRawFileRequest} request
|
|
2425
2645
|
* @param {HarnessInternalKnowledgesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
2426
2646
|
*
|
|
2427
2647
|
* @throws {@link CngApi.UnauthorizedError}
|
|
@@ -2429,15 +2649,15 @@ var HarnessInternalKnowledgesClient = class {
|
|
|
2429
2649
|
* @throws {@link CngApi.ServiceUnavailableError}
|
|
2430
2650
|
*
|
|
2431
2651
|
* @example
|
|
2432
|
-
* await client.harnessInternalKnowledges.
|
|
2652
|
+
* await client.harnessInternalKnowledges.getHarnessTopicAssetRawFile({
|
|
2433
2653
|
* path: "x",
|
|
2434
2654
|
* sha256: "sha256"
|
|
2435
2655
|
* })
|
|
2436
2656
|
*/
|
|
2437
|
-
|
|
2438
|
-
return HttpResponsePromise.fromPromise(this.
|
|
2657
|
+
getHarnessTopicAssetRawFile(request, requestOptions) {
|
|
2658
|
+
return HttpResponsePromise.fromPromise(this.__getHarnessTopicAssetRawFile(request, requestOptions));
|
|
2439
2659
|
}
|
|
2440
|
-
async
|
|
2660
|
+
async __getHarnessTopicAssetRawFile(request, requestOptions) {
|
|
2441
2661
|
const { path, sha256 } = request;
|
|
2442
2662
|
const _queryParams = {
|
|
2443
2663
|
path,
|
|
@@ -2491,12 +2711,12 @@ var HarnessInternalKnowledgesClient = class {
|
|
|
2491
2711
|
* @throws {@link CngApi.UnauthorizedError}
|
|
2492
2712
|
*
|
|
2493
2713
|
* @example
|
|
2494
|
-
* await client.harnessInternalKnowledges.
|
|
2714
|
+
* await client.harnessInternalKnowledges.listHarnessTopicAssetHashes()
|
|
2495
2715
|
*/
|
|
2496
|
-
|
|
2497
|
-
return HttpResponsePromise.fromPromise(this.
|
|
2716
|
+
listHarnessTopicAssetHashes(requestOptions) {
|
|
2717
|
+
return HttpResponsePromise.fromPromise(this.__listHarnessTopicAssetHashes(requestOptions));
|
|
2498
2718
|
}
|
|
2499
|
-
async
|
|
2719
|
+
async __listHarnessTopicAssetHashes(requestOptions) {
|
|
2500
2720
|
const _headers = mergeHeaders(this._options?.headers, requestOptions?.headers);
|
|
2501
2721
|
const _response = await fetcher({
|
|
2502
2722
|
url: url_exports.join(
|
|
@@ -2545,7 +2765,7 @@ var HarnessInternalKnowledgesClient = class {
|
|
|
2545
2765
|
* @throws {@link CngApi.ConflictError}
|
|
2546
2766
|
*
|
|
2547
2767
|
* @example
|
|
2548
|
-
* await client.harnessInternalKnowledges.
|
|
2768
|
+
* await client.harnessInternalKnowledges.replaceHarnessTopicAssets({
|
|
2549
2769
|
* uploadedAt: "uploadedAt",
|
|
2550
2770
|
* files: [{
|
|
2551
2771
|
* path: "path",
|
|
@@ -2553,18 +2773,20 @@ var HarnessInternalKnowledgesClient = class {
|
|
|
2553
2773
|
* size: 1,
|
|
2554
2774
|
* mode: "mode",
|
|
2555
2775
|
* assetKind: "skill",
|
|
2556
|
-
*
|
|
2776
|
+
* topicName: "topicName",
|
|
2557
2777
|
* displayTitle: "displayTitle",
|
|
2558
2778
|
* displayDescription: "displayDescription",
|
|
2559
2779
|
* displayRating: 1,
|
|
2780
|
+
* sourceText: "sourceText",
|
|
2781
|
+
* frontmatterText: "frontmatterText",
|
|
2560
2782
|
* bodyText: "bodyText"
|
|
2561
2783
|
* }]
|
|
2562
2784
|
* })
|
|
2563
2785
|
*/
|
|
2564
|
-
|
|
2565
|
-
return HttpResponsePromise.fromPromise(this.
|
|
2786
|
+
replaceHarnessTopicAssets(request, requestOptions) {
|
|
2787
|
+
return HttpResponsePromise.fromPromise(this.__replaceHarnessTopicAssets(request, requestOptions));
|
|
2566
2788
|
}
|
|
2567
|
-
async
|
|
2789
|
+
async __replaceHarnessTopicAssets(request, requestOptions) {
|
|
2568
2790
|
const _headers = mergeHeaders(this._options?.headers, requestOptions?.headers);
|
|
2569
2791
|
const _response = await fetcher({
|
|
2570
2792
|
url: url_exports.join(
|
|
@@ -2618,15 +2840,15 @@ var HarnessInternalKnowledgesClient = class {
|
|
|
2618
2840
|
* @throws {@link CngApi.ConflictError}
|
|
2619
2841
|
*
|
|
2620
2842
|
* @example
|
|
2621
|
-
* await client.harnessInternalKnowledges.
|
|
2843
|
+
* await client.harnessInternalKnowledges.deleteHarnessTopicAssets({
|
|
2622
2844
|
* uploadedAt: "uploadedAt",
|
|
2623
2845
|
* paths: ["paths"]
|
|
2624
2846
|
* })
|
|
2625
2847
|
*/
|
|
2626
|
-
|
|
2627
|
-
return HttpResponsePromise.fromPromise(this.
|
|
2848
|
+
deleteHarnessTopicAssets(request, requestOptions) {
|
|
2849
|
+
return HttpResponsePromise.fromPromise(this.__deleteHarnessTopicAssets(request, requestOptions));
|
|
2628
2850
|
}
|
|
2629
|
-
async
|
|
2851
|
+
async __deleteHarnessTopicAssets(request, requestOptions) {
|
|
2630
2852
|
const _headers = mergeHeaders(this._options?.headers, requestOptions?.headers);
|
|
2631
2853
|
const _response = await fetcher({
|
|
2632
2854
|
url: url_exports.join(
|
|
@@ -2676,35 +2898,27 @@ var HarnessInternalKnowledgesClient = class {
|
|
|
2676
2898
|
);
|
|
2677
2899
|
}
|
|
2678
2900
|
/**
|
|
2679
|
-
* @param {CngApi.HarnessUploadSubskillAssetsIndexRequest} request
|
|
2680
2901
|
* @param {HarnessInternalKnowledgesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
2681
2902
|
*
|
|
2682
2903
|
* @throws {@link CngApi.UnauthorizedError}
|
|
2683
|
-
* @throws {@link CngApi.
|
|
2904
|
+
* @throws {@link CngApi.ConflictError}
|
|
2684
2905
|
*
|
|
2685
2906
|
* @example
|
|
2686
|
-
* await client.harnessInternalKnowledges.
|
|
2687
|
-
* runId: "runId",
|
|
2688
|
-
* offset: 1,
|
|
2689
|
-
* limit: 1
|
|
2690
|
-
* })
|
|
2907
|
+
* await client.harnessInternalKnowledges.cleanHarnessKnowledgesCatalog()
|
|
2691
2908
|
*/
|
|
2692
|
-
|
|
2693
|
-
return HttpResponsePromise.fromPromise(this.
|
|
2909
|
+
cleanHarnessKnowledgesCatalog(requestOptions) {
|
|
2910
|
+
return HttpResponsePromise.fromPromise(this.__cleanHarnessKnowledgesCatalog(requestOptions));
|
|
2694
2911
|
}
|
|
2695
|
-
async
|
|
2912
|
+
async __cleanHarnessKnowledgesCatalog(requestOptions) {
|
|
2696
2913
|
const _headers = mergeHeaders(this._options?.headers, requestOptions?.headers);
|
|
2697
2914
|
const _response = await fetcher({
|
|
2698
2915
|
url: url_exports.join(
|
|
2699
2916
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? CngApiEnvironment.Default,
|
|
2700
|
-
"api/harness/internal/knowledges/
|
|
2917
|
+
"api/harness/internal/knowledges/catalog"
|
|
2701
2918
|
),
|
|
2702
|
-
method: "
|
|
2919
|
+
method: "DELETE",
|
|
2703
2920
|
headers: _headers,
|
|
2704
|
-
contentType: "application/json",
|
|
2705
2921
|
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
2706
|
-
requestType: "json",
|
|
2707
|
-
body: request,
|
|
2708
2922
|
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
2709
2923
|
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
2710
2924
|
abortSignal: requestOptions?.abortSignal,
|
|
@@ -2712,17 +2926,14 @@ var HarnessInternalKnowledgesClient = class {
|
|
|
2712
2926
|
logging: this._options.logging
|
|
2713
2927
|
});
|
|
2714
2928
|
if (_response.ok) {
|
|
2715
|
-
return {
|
|
2716
|
-
data: _response.body,
|
|
2717
|
-
rawResponse: _response.rawResponse
|
|
2718
|
-
};
|
|
2929
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2719
2930
|
}
|
|
2720
2931
|
if (_response.error.reason === "status-code") {
|
|
2721
2932
|
switch (_response.error.statusCode) {
|
|
2722
2933
|
case 401:
|
|
2723
2934
|
throw new UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
2724
|
-
case
|
|
2725
|
-
throw new
|
|
2935
|
+
case 409:
|
|
2936
|
+
throw new ConflictError(
|
|
2726
2937
|
_response.error.body,
|
|
2727
2938
|
_response.rawResponse
|
|
2728
2939
|
);
|
|
@@ -2737,8 +2948,8 @@ var HarnessInternalKnowledgesClient = class {
|
|
|
2737
2948
|
return handleNonStatusCodeError(
|
|
2738
2949
|
_response.error,
|
|
2739
2950
|
_response.rawResponse,
|
|
2740
|
-
"
|
|
2741
|
-
"/api/harness/internal/knowledges/
|
|
2951
|
+
"DELETE",
|
|
2952
|
+
"/api/harness/internal/knowledges/catalog"
|
|
2742
2953
|
);
|
|
2743
2954
|
}
|
|
2744
2955
|
};
|
|
@@ -2837,16 +3048,16 @@ var HarnessKnowledgesClient = class {
|
|
|
2837
3048
|
);
|
|
2838
3049
|
}
|
|
2839
3050
|
/**
|
|
2840
|
-
* @param {CngApi.
|
|
3051
|
+
* @param {CngApi.ListHarnessTopicAssetsRequest} request
|
|
2841
3052
|
* @param {HarnessKnowledgesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
2842
3053
|
*
|
|
2843
3054
|
* @example
|
|
2844
|
-
* await client.harnessKnowledges.
|
|
3055
|
+
* await client.harnessKnowledges.listHarnessTopicAssets()
|
|
2845
3056
|
*/
|
|
2846
|
-
|
|
2847
|
-
return HttpResponsePromise.fromPromise(this.
|
|
3057
|
+
listHarnessTopicAssets(request = {}, requestOptions) {
|
|
3058
|
+
return HttpResponsePromise.fromPromise(this.__listHarnessTopicAssets(request, requestOptions));
|
|
2848
3059
|
}
|
|
2849
|
-
async
|
|
3060
|
+
async __listHarnessTopicAssets(request = {}, requestOptions) {
|
|
2850
3061
|
const { q, audience, limit } = request;
|
|
2851
3062
|
const _queryParams = {
|
|
2852
3063
|
q,
|
|
@@ -2869,10 +3080,7 @@ var HarnessKnowledgesClient = class {
|
|
|
2869
3080
|
logging: this._options.logging
|
|
2870
3081
|
});
|
|
2871
3082
|
if (_response.ok) {
|
|
2872
|
-
return {
|
|
2873
|
-
data: _response.body,
|
|
2874
|
-
rawResponse: _response.rawResponse
|
|
2875
|
-
};
|
|
3083
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2876
3084
|
}
|
|
2877
3085
|
if (_response.error.reason === "status-code") {
|
|
2878
3086
|
throw new CngApiError({
|
|
@@ -3026,22 +3234,22 @@ var HarnessKnowledgesClient = class {
|
|
|
3026
3234
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/harness/knowledges/brain");
|
|
3027
3235
|
}
|
|
3028
3236
|
/**
|
|
3029
|
-
* Returns the full
|
|
3237
|
+
* Returns the full topic index for agent discovery. Use search for semantic lookup, or filesystem/read for content.
|
|
3030
3238
|
*
|
|
3031
3239
|
* @param {HarnessKnowledgesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
3032
3240
|
*
|
|
3033
3241
|
* @example
|
|
3034
|
-
* await client.harnessKnowledges.
|
|
3242
|
+
* await client.harnessKnowledges.listHarnessKnowledgesTopics()
|
|
3035
3243
|
*/
|
|
3036
|
-
|
|
3037
|
-
return HttpResponsePromise.fromPromise(this.
|
|
3244
|
+
listHarnessKnowledgesTopics(requestOptions) {
|
|
3245
|
+
return HttpResponsePromise.fromPromise(this.__listHarnessKnowledgesTopics(requestOptions));
|
|
3038
3246
|
}
|
|
3039
|
-
async
|
|
3247
|
+
async __listHarnessKnowledgesTopics(requestOptions) {
|
|
3040
3248
|
const _headers = mergeHeaders(this._options?.headers, requestOptions?.headers);
|
|
3041
3249
|
const _response = await fetcher({
|
|
3042
3250
|
url: url_exports.join(
|
|
3043
3251
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? CngApiEnvironment.Default,
|
|
3044
|
-
"api/harness/knowledges/
|
|
3252
|
+
"api/harness/knowledges/topics"
|
|
3045
3253
|
),
|
|
3046
3254
|
method: "GET",
|
|
3047
3255
|
headers: _headers,
|
|
@@ -3066,7 +3274,7 @@ var HarnessKnowledgesClient = class {
|
|
|
3066
3274
|
_response.error,
|
|
3067
3275
|
_response.rawResponse,
|
|
3068
3276
|
"GET",
|
|
3069
|
-
"/api/harness/knowledges/
|
|
3277
|
+
"/api/harness/knowledges/topics"
|
|
3070
3278
|
);
|
|
3071
3279
|
}
|
|
3072
3280
|
/**
|
|
@@ -3212,6 +3420,52 @@ var HookifyClient = class {
|
|
|
3212
3420
|
}
|
|
3213
3421
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/api/hookify/ingest");
|
|
3214
3422
|
}
|
|
3423
|
+
/**
|
|
3424
|
+
* @param {CngApi.GetHookifyRequestRequest} request
|
|
3425
|
+
* @param {HookifyClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
3426
|
+
*
|
|
3427
|
+
* @example
|
|
3428
|
+
* await client.hookify.getHookifyRequest({
|
|
3429
|
+
* requestId: "requestId"
|
|
3430
|
+
* })
|
|
3431
|
+
*/
|
|
3432
|
+
getHookifyRequest(request, requestOptions) {
|
|
3433
|
+
return HttpResponsePromise.fromPromise(this.__getHookifyRequest(request, requestOptions));
|
|
3434
|
+
}
|
|
3435
|
+
async __getHookifyRequest(request, requestOptions) {
|
|
3436
|
+
const { requestId } = request;
|
|
3437
|
+
const _headers = mergeHeaders(this._options?.headers, requestOptions?.headers);
|
|
3438
|
+
const _response = await fetcher({
|
|
3439
|
+
url: url_exports.join(
|
|
3440
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? CngApiEnvironment.Default,
|
|
3441
|
+
`api/hookify/requests/${url_exports.encodePathParam(requestId)}`
|
|
3442
|
+
),
|
|
3443
|
+
method: "GET",
|
|
3444
|
+
headers: _headers,
|
|
3445
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
3446
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
3447
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
3448
|
+
abortSignal: requestOptions?.abortSignal,
|
|
3449
|
+
fetchFn: this._options?.fetch,
|
|
3450
|
+
logging: this._options.logging
|
|
3451
|
+
});
|
|
3452
|
+
if (_response.ok) {
|
|
3453
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3454
|
+
}
|
|
3455
|
+
if (_response.error.reason === "status-code") {
|
|
3456
|
+
throw new CngApiError({
|
|
3457
|
+
statusCode: _response.error.statusCode,
|
|
3458
|
+
body: _response.error.body,
|
|
3459
|
+
rawResponse: _response.rawResponse
|
|
3460
|
+
});
|
|
3461
|
+
}
|
|
3462
|
+
return handleNonStatusCodeError(
|
|
3463
|
+
_response.error,
|
|
3464
|
+
_response.rawResponse,
|
|
3465
|
+
"GET",
|
|
3466
|
+
"/api/hookify/requests/{requestId}"
|
|
3467
|
+
);
|
|
3468
|
+
}
|
|
3215
3469
|
};
|
|
3216
3470
|
|
|
3217
3471
|
// ../../packages/client/src/generated/api/resources/llm/client/Client.ts
|
|
@@ -3551,32 +3805,268 @@ var logging;
|
|
|
3551
3805
|
logging2.ConsoleLogger = ConsoleLogger;
|
|
3552
3806
|
})(logging || (logging = {}));
|
|
3553
3807
|
|
|
3554
|
-
// src/shared/
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3808
|
+
// src/shared/theme.ts
|
|
3809
|
+
import { Chalk } from "chalk";
|
|
3810
|
+
var statusStylePropsByOutputStyle = {
|
|
3811
|
+
info: {
|
|
3812
|
+
color: "cyan"
|
|
3813
|
+
},
|
|
3814
|
+
success: {
|
|
3815
|
+
color: "green",
|
|
3816
|
+
bold: true
|
|
3817
|
+
},
|
|
3818
|
+
warning: {
|
|
3819
|
+
color: "yellow",
|
|
3820
|
+
bold: true
|
|
3821
|
+
},
|
|
3822
|
+
muted: {
|
|
3823
|
+
dimColor: true
|
|
3824
|
+
},
|
|
3825
|
+
error: {
|
|
3826
|
+
color: "red",
|
|
3827
|
+
bold: true
|
|
3828
|
+
}
|
|
3829
|
+
};
|
|
3830
|
+
function createMarkdownTheme(useColor) {
|
|
3831
|
+
const chalk = new Chalk({ level: useColor ? 1 : 0 });
|
|
3832
|
+
const identity = (value) => value;
|
|
3833
|
+
return {
|
|
3834
|
+
code: chalk.green,
|
|
3835
|
+
blockquote: chalk.dim.italic,
|
|
3836
|
+
html: chalk.gray,
|
|
3837
|
+
heading: chalk.blueBright.bold,
|
|
3838
|
+
firstHeading: chalk.magentaBright.bold,
|
|
3839
|
+
hr: chalk.gray,
|
|
3840
|
+
listitem: identity,
|
|
3841
|
+
table: identity,
|
|
3842
|
+
paragraph: identity,
|
|
3843
|
+
strong: chalk.bold,
|
|
3844
|
+
em: chalk.italic,
|
|
3845
|
+
codespan: chalk.cyanBright,
|
|
3846
|
+
del: chalk.dim.strikethrough,
|
|
3847
|
+
link: chalk.blueBright,
|
|
3848
|
+
href: chalk.blue.underline,
|
|
3849
|
+
text: identity,
|
|
3850
|
+
showSectionPrefix: false,
|
|
3851
|
+
reflowText: true,
|
|
3852
|
+
unescape: true,
|
|
3853
|
+
emoji: false,
|
|
3854
|
+
tab: 2
|
|
3855
|
+
};
|
|
3561
3856
|
}
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3857
|
+
|
|
3858
|
+
// src/shared/output.ts
|
|
3859
|
+
function createCommandOutput(sink) {
|
|
3860
|
+
const stdout = sink.stdout ?? process3.stdout;
|
|
3861
|
+
const stderr = sink.stderr ?? process3.stderr;
|
|
3862
|
+
return {
|
|
3863
|
+
info(message) {
|
|
3864
|
+
appendStyledMessage(sink, stdout, "stdout", "info", message);
|
|
3865
|
+
},
|
|
3866
|
+
success(message) {
|
|
3867
|
+
appendStyledMessage(sink, stdout, "stdout", "success", message);
|
|
3868
|
+
},
|
|
3869
|
+
warning(message) {
|
|
3870
|
+
appendStyledMessage(sink, stdout, "stdout", "warning", message);
|
|
3871
|
+
},
|
|
3872
|
+
muted(message) {
|
|
3873
|
+
appendStyledMessage(sink, stdout, "stdout", "muted", message);
|
|
3874
|
+
},
|
|
3875
|
+
markdown(message) {
|
|
3876
|
+
if (resolveOutputFormat() === "markdown") {
|
|
3877
|
+
stdout.write(`${message}
|
|
3878
|
+
`);
|
|
3879
|
+
return;
|
|
3880
|
+
}
|
|
3881
|
+
if (sink.appendMessage) {
|
|
3882
|
+
sink.appendMessage({ kind: "markdown", message: prepareMarkdownForTerminal(message) });
|
|
3883
|
+
return;
|
|
3884
|
+
}
|
|
3885
|
+
stdout.write(`${message}
|
|
3886
|
+
`);
|
|
3887
|
+
},
|
|
3888
|
+
component(element) {
|
|
3889
|
+
if (sink.appendMessage) {
|
|
3890
|
+
sink.appendMessage({ kind: "component", element });
|
|
3891
|
+
return;
|
|
3892
|
+
}
|
|
3893
|
+
stdout.write("\n");
|
|
3894
|
+
},
|
|
3895
|
+
raw(message) {
|
|
3896
|
+
stdout.write(`${message}
|
|
3897
|
+
`);
|
|
3898
|
+
},
|
|
3899
|
+
error(message) {
|
|
3900
|
+
appendStyledMessage(sink, stderr, "stderr", "error", message);
|
|
3901
|
+
}
|
|
3902
|
+
};
|
|
3903
|
+
}
|
|
3904
|
+
function CommandOutputMessages({
|
|
3905
|
+
messages
|
|
3906
|
+
}) {
|
|
3907
|
+
const { stdout } = useStdout();
|
|
3908
|
+
const width = clampMarkdownWidth(stdout.columns);
|
|
3909
|
+
const useColor = shouldRenderColor(stdout);
|
|
3910
|
+
if (messages.length === 0) {
|
|
3911
|
+
return null;
|
|
3912
|
+
}
|
|
3913
|
+
return createElement(
|
|
3914
|
+
Static,
|
|
3915
|
+
{
|
|
3916
|
+
items: [...messages],
|
|
3917
|
+
style: { flexDirection: "column" },
|
|
3918
|
+
children: (message) => createElement(CommandOutputMessageView, {
|
|
3919
|
+
key: message.id,
|
|
3920
|
+
message,
|
|
3921
|
+
useColor,
|
|
3922
|
+
width
|
|
3923
|
+
})
|
|
3924
|
+
}
|
|
3925
|
+
);
|
|
3926
|
+
}
|
|
3927
|
+
function CommandOutputMessageView({
|
|
3928
|
+
message,
|
|
3929
|
+
useColor,
|
|
3930
|
+
width
|
|
3931
|
+
}) {
|
|
3932
|
+
if (message.kind === "styled") {
|
|
3933
|
+
if (message.stream === "stderr") {
|
|
3934
|
+
return createElement(StderrLine, { message: message.message });
|
|
3935
|
+
}
|
|
3936
|
+
return createElement(
|
|
3937
|
+
Text,
|
|
3938
|
+
{
|
|
3939
|
+
...statusStylePropsByOutputStyle[message.style],
|
|
3940
|
+
wrap: "wrap"
|
|
3941
|
+
},
|
|
3942
|
+
message.message
|
|
3943
|
+
);
|
|
3944
|
+
}
|
|
3945
|
+
if (message.kind === "markdown") {
|
|
3946
|
+
return createElement(
|
|
3947
|
+
Markdown,
|
|
3948
|
+
{
|
|
3949
|
+
...createMarkdownTheme(useColor),
|
|
3950
|
+
width
|
|
3951
|
+
},
|
|
3952
|
+
message.message
|
|
3953
|
+
);
|
|
3954
|
+
}
|
|
3955
|
+
return message.element;
|
|
3956
|
+
}
|
|
3957
|
+
function StderrLine({ message }) {
|
|
3958
|
+
const { write } = useStderr();
|
|
3959
|
+
useEffect(() => {
|
|
3960
|
+
write(`${message}
|
|
3961
|
+
`);
|
|
3962
|
+
}, [message, write]);
|
|
3963
|
+
return null;
|
|
3964
|
+
}
|
|
3965
|
+
function formatError(error) {
|
|
3966
|
+
if (error instanceof CngApiError) {
|
|
3967
|
+
return formatApiError(error);
|
|
3968
|
+
}
|
|
3969
|
+
return error instanceof Error ? error.message : String(error);
|
|
3970
|
+
}
|
|
3971
|
+
function formatApiError(error) {
|
|
3972
|
+
if (resolveOutputFormat() === "json") {
|
|
3973
|
+
return error.message;
|
|
3974
|
+
}
|
|
3975
|
+
const statusCode = error.statusCode ?? 0;
|
|
3976
|
+
if (statusCode >= 500) {
|
|
3977
|
+
return `Backend error (${statusCode}). The service encountered an internal error.`;
|
|
3978
|
+
}
|
|
3979
|
+
if (statusCode >= 400) {
|
|
3980
|
+
const bodyMessage = extractBodyErrorMessage(error.body);
|
|
3981
|
+
if (bodyMessage) {
|
|
3982
|
+
return `Request error (${statusCode}): ${bodyMessage}`;
|
|
3983
|
+
}
|
|
3984
|
+
return `Request error (${statusCode}).`;
|
|
3985
|
+
}
|
|
3986
|
+
return error.message;
|
|
3987
|
+
}
|
|
3988
|
+
function extractBodyErrorMessage(body) {
|
|
3989
|
+
if (body == null || typeof body !== "object") {
|
|
3990
|
+
return void 0;
|
|
3991
|
+
}
|
|
3992
|
+
const record = body;
|
|
3993
|
+
const errorField = record.error;
|
|
3994
|
+
if (errorField != null && typeof errorField === "object") {
|
|
3995
|
+
const message = errorField.message;
|
|
3996
|
+
if (typeof message === "string") {
|
|
3997
|
+
return message;
|
|
3998
|
+
}
|
|
3999
|
+
}
|
|
4000
|
+
if (typeof record.message === "string") {
|
|
4001
|
+
return record.message;
|
|
4002
|
+
}
|
|
4003
|
+
return void 0;
|
|
4004
|
+
}
|
|
4005
|
+
function appendStyledMessage(sink, stream, streamName, style, message) {
|
|
4006
|
+
if (sink.appendMessage) {
|
|
4007
|
+
sink.appendMessage({ kind: "styled", stream: streamName, style, message });
|
|
4008
|
+
return;
|
|
4009
|
+
}
|
|
4010
|
+
stream.write(`${message}
|
|
4011
|
+
`);
|
|
4012
|
+
}
|
|
4013
|
+
function prepareMarkdownForTerminal(markdown) {
|
|
4014
|
+
if (!markdown.startsWith("---\n")) {
|
|
4015
|
+
return markdown;
|
|
4016
|
+
}
|
|
4017
|
+
const frontmatterEndIndex = markdown.indexOf("\n---", 4);
|
|
4018
|
+
if (frontmatterEndIndex < 0) {
|
|
4019
|
+
return formatFrontmatterForTerminal(markdown.slice(4).trimEnd());
|
|
4020
|
+
}
|
|
4021
|
+
const frontmatter = markdown.slice(4, frontmatterEndIndex).trimEnd();
|
|
4022
|
+
const body = markdown.slice(frontmatterEndIndex + "\n---".length).replace(/^\n+/, "");
|
|
4023
|
+
return `${formatFrontmatterForTerminal(frontmatter)}
|
|
4024
|
+
|
|
4025
|
+
${body}`;
|
|
4026
|
+
}
|
|
4027
|
+
function formatFrontmatterForTerminal(frontmatter) {
|
|
4028
|
+
return `## Metadata
|
|
4029
|
+
|
|
4030
|
+
\`\`\`yaml
|
|
4031
|
+
${frontmatter}
|
|
4032
|
+
\`\`\``;
|
|
4033
|
+
}
|
|
4034
|
+
function shouldRenderColor(stream) {
|
|
4035
|
+
if (process3.env.CNGKIT_NO_COLOR === "1") {
|
|
4036
|
+
return false;
|
|
4037
|
+
}
|
|
4038
|
+
const colorMode = process3.env.CNGKIT_COLOR?.toLowerCase();
|
|
4039
|
+
if (colorMode === "never" || colorMode === "0" || colorMode === "false") {
|
|
4040
|
+
return false;
|
|
4041
|
+
}
|
|
4042
|
+
if (colorMode === "always" || colorMode === "1" || colorMode === "true") {
|
|
4043
|
+
return true;
|
|
4044
|
+
}
|
|
4045
|
+
if (process3.env.FORCE_COLOR !== void 0 && process3.env.FORCE_COLOR !== "0") {
|
|
4046
|
+
return true;
|
|
4047
|
+
}
|
|
4048
|
+
if (process3.env.NO_COLOR !== void 0) {
|
|
4049
|
+
return false;
|
|
4050
|
+
}
|
|
4051
|
+
return stream.isTTY === true;
|
|
4052
|
+
}
|
|
4053
|
+
function clampMarkdownWidth(columns) {
|
|
4054
|
+
if (columns === void 0) {
|
|
4055
|
+
return 100;
|
|
3575
4056
|
}
|
|
4057
|
+
return Math.max(72, Math.min(columns, 120));
|
|
3576
4058
|
}
|
|
3577
4059
|
|
|
3578
4060
|
export {
|
|
3579
|
-
|
|
3580
|
-
|
|
4061
|
+
packageVersion,
|
|
4062
|
+
resolveApiBaseUrl,
|
|
4063
|
+
resolveOutputFormat,
|
|
4064
|
+
parseOutputFormat,
|
|
4065
|
+
createRoomCode,
|
|
4066
|
+
createPeerId,
|
|
4067
|
+
CngApiClient,
|
|
4068
|
+
createCommandOutput,
|
|
4069
|
+
CommandOutputMessages,
|
|
4070
|
+
formatError
|
|
3581
4071
|
};
|
|
3582
|
-
//# sourceMappingURL=chunk-
|
|
4072
|
+
//# sourceMappingURL=chunk-WDI43VPW.js.map
|