@kb-labs/mcp-app 2.107.0 → 2.110.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.cjs +162 -124
- package/dist/bin.cjs.map +1 -1
- package/package.json +15 -15
package/dist/bin.cjs
CHANGED
|
@@ -1717,6 +1717,89 @@ var init_dist2 = __esm({
|
|
|
1717
1717
|
]);
|
|
1718
1718
|
}
|
|
1719
1719
|
});
|
|
1720
|
+
|
|
1721
|
+
// ../../../core/retry/dist/index.js
|
|
1722
|
+
function asRecord(value) {
|
|
1723
|
+
return typeof value === "object" && value !== null ? value : void 0;
|
|
1724
|
+
}
|
|
1725
|
+
function getStatus(value) {
|
|
1726
|
+
const response = asRecord(value?.response);
|
|
1727
|
+
const status = value?.status ?? value?.statusCode ?? response?.status;
|
|
1728
|
+
return typeof status === "number" ? status : void 0;
|
|
1729
|
+
}
|
|
1730
|
+
function getCode(value) {
|
|
1731
|
+
return typeof value?.code === "string" ? value.code : void 0;
|
|
1732
|
+
}
|
|
1733
|
+
function makeFailure(input, kind, source, context, code, transient = false, retrySafety = "never") {
|
|
1734
|
+
const record2 = asRecord(input);
|
|
1735
|
+
const message2 = input instanceof Error ? input.message : String(record2?.message ?? input ?? "Unknown failure");
|
|
1736
|
+
const retryAfterMs = typeof record2?.retryAfterMs === "number" ? record2.retryAfterMs : void 0;
|
|
1737
|
+
return {
|
|
1738
|
+
message: message2,
|
|
1739
|
+
code: code ?? getCode(record2) ?? "UNKNOWN_ERROR",
|
|
1740
|
+
kind,
|
|
1741
|
+
source,
|
|
1742
|
+
transient,
|
|
1743
|
+
retrySafety,
|
|
1744
|
+
phase: context.phase,
|
|
1745
|
+
retryAfterMs,
|
|
1746
|
+
details: asRecord(record2?.details)
|
|
1747
|
+
};
|
|
1748
|
+
}
|
|
1749
|
+
function classifyFailure(input, context = {}) {
|
|
1750
|
+
const record2 = asRecord(input);
|
|
1751
|
+
const source = context.source ?? record2?.source ?? "execution";
|
|
1752
|
+
const explicitKind = record2?.kind;
|
|
1753
|
+
const explicitCode = getCode(record2);
|
|
1754
|
+
const status = getStatus(record2);
|
|
1755
|
+
const code = explicitCode?.toUpperCase();
|
|
1756
|
+
if (explicitKind && ["command", "network", "timeout", "rate_limit", "server", "validation", "configuration", "authentication", "authorization", "not_found", "cancelled", "infrastructure", "unknown"].includes(explicitKind)) {
|
|
1757
|
+
const transient = ["network", "timeout", "rate_limit", "server"].includes(explicitKind);
|
|
1758
|
+
const safe = explicitKind === "network" && (code === "ECONNREFUSED" || code === "NETWORK_UNAVAILABLE");
|
|
1759
|
+
return makeFailure(input, explicitKind, source, context, code, transient, safe ? "safe" : transient ? "requires_idempotency" : "never");
|
|
1760
|
+
}
|
|
1761
|
+
if (code && NETWORK_CODES.has(code)) {
|
|
1762
|
+
return makeFailure(input, code === "ETIMEDOUT" ? "timeout" : "network", source, context, code, true, context.phase === "dispatch" ? "safe" : "requires_idempotency");
|
|
1763
|
+
}
|
|
1764
|
+
if (status !== void 0) {
|
|
1765
|
+
if (status === 429) {
|
|
1766
|
+
return makeFailure(input, "rate_limit", source, context, "HTTP_429", true, "safe");
|
|
1767
|
+
}
|
|
1768
|
+
if (status >= 500 || status === 408 || status === 425) {
|
|
1769
|
+
return makeFailure(input, status === 408 ? "timeout" : "server", source, context, `HTTP_${status}`, true, "requires_idempotency");
|
|
1770
|
+
}
|
|
1771
|
+
if (status >= 400) {
|
|
1772
|
+
return makeFailure(input, "validation", source, context, `HTTP_${status}`, false, "never");
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
const message2 = input instanceof Error ? input.message.toLowerCase() : String(record2?.message ?? input ?? "").toLowerCase();
|
|
1776
|
+
const name = typeof record2?.name === "string" ? record2.name.toLowerCase() : "";
|
|
1777
|
+
if (message2.includes("429") || message2.includes("rate limit") || message2.includes("too many requests") || message2.includes("quota exceeded") || name.includes("ratelimit")) {
|
|
1778
|
+
return makeFailure(input, "rate_limit", source, context, "RATE_LIMIT", true, "safe");
|
|
1779
|
+
}
|
|
1780
|
+
if (message2.includes("500") || message2.includes("502") || message2.includes("503") || message2.includes("504") || message2.includes("service unavailable") || message2.includes("bad gateway")) {
|
|
1781
|
+
return makeFailure(input, "server", source, context, "SERVER_ERROR", true, "requires_idempotency");
|
|
1782
|
+
}
|
|
1783
|
+
if (message2.includes("400") || message2.includes("401") || message2.includes("403") || message2.includes("404") || message2.includes("bad request") || message2.includes("unauthorized") || message2.includes("forbidden") || message2.includes("not found")) {
|
|
1784
|
+
return makeFailure(input, "validation", source, context, "CLIENT_ERROR");
|
|
1785
|
+
}
|
|
1786
|
+
if (message2.includes("timeout") || message2.includes("timed out") || message2.includes("etimedout") || message2.includes("deadline exceeded") || name.includes("timeout") || code?.includes("TIMEOUT")) {
|
|
1787
|
+
return makeFailure(input, "timeout", source, context, "TIMEOUT", true, "requires_idempotency");
|
|
1788
|
+
}
|
|
1789
|
+
if (message2.includes("unauthorized") || message2.includes("forbidden")) {
|
|
1790
|
+
return makeFailure(input, "authentication", source, context, "AUTHENTICATION_FAILED");
|
|
1791
|
+
}
|
|
1792
|
+
if (message2.includes("econn") || message2.includes("enotfound") || message2.includes("network") || message2.includes("socket") || message2.includes("dns") || message2.includes("host not connected") || name.includes("fetch") || name.includes("network")) {
|
|
1793
|
+
return makeFailure(input, "network", source, context, "NETWORK_ERROR", true, "requires_idempotency");
|
|
1794
|
+
}
|
|
1795
|
+
return makeFailure(input, source === "command" ? "command" : "unknown", source, context, code ?? "UNKNOWN_ERROR");
|
|
1796
|
+
}
|
|
1797
|
+
var NETWORK_CODES;
|
|
1798
|
+
var init_dist3 = __esm({
|
|
1799
|
+
"../../../core/retry/dist/index.js"() {
|
|
1800
|
+
NETWORK_CODES = /* @__PURE__ */ new Set(["ECONNRESET", "ECONNREFUSED", "ETIMEDOUT", "ENOTFOUND", "EAI_AGAIN", "EPIPE", "ECONNABORTED"]);
|
|
1801
|
+
}
|
|
1802
|
+
});
|
|
1720
1803
|
function getRateLimitConfig(configOrPreset) {
|
|
1721
1804
|
if (!configOrPreset) {
|
|
1722
1805
|
return RATE_LIMIT_PRESETS["openai-tier-2"];
|
|
@@ -1737,58 +1820,21 @@ function estimateBatchTokens(texts) {
|
|
|
1737
1820
|
return texts.reduce((sum, text) => sum + estimateTokens(text), 0);
|
|
1738
1821
|
}
|
|
1739
1822
|
function classifyError(error2) {
|
|
1740
|
-
|
|
1741
|
-
|
|
1823
|
+
const kind = classifyFailure(error2, { source: "transport" }).kind;
|
|
1824
|
+
if (kind === "rate_limit") {
|
|
1825
|
+
return "rate_limit";
|
|
1742
1826
|
}
|
|
1743
|
-
if (
|
|
1744
|
-
|
|
1745
|
-
const name = error2.name.toLowerCase();
|
|
1746
|
-
if (message2.includes("429") || message2.includes("rate limit") || message2.includes("too many requests") || message2.includes("quota exceeded") || name.includes("ratelimit")) {
|
|
1747
|
-
return "rate_limit";
|
|
1748
|
-
}
|
|
1749
|
-
if (message2.includes("timeout") || message2.includes("timed out") || message2.includes("etimedout") || message2.includes("deadline exceeded") || name.includes("timeout")) {
|
|
1750
|
-
return "timeout";
|
|
1751
|
-
}
|
|
1752
|
-
if (message2.includes("econnrefused") || message2.includes("econnreset") || message2.includes("enotfound") || message2.includes("network") || message2.includes("socket") || message2.includes("dns") || name.includes("fetch") || name.includes("network")) {
|
|
1753
|
-
return "network";
|
|
1754
|
-
}
|
|
1755
|
-
if (message2.includes("500") || message2.includes("502") || message2.includes("503") || message2.includes("504") || message2.includes("internal server") || message2.includes("bad gateway") || message2.includes("service unavailable") || message2.includes("gateway timeout")) {
|
|
1756
|
-
return "server_error";
|
|
1757
|
-
}
|
|
1758
|
-
if (message2.includes("400") || message2.includes("401") || message2.includes("403") || message2.includes("404") || message2.includes("bad request") || message2.includes("unauthorized") || message2.includes("forbidden") || message2.includes("not found")) {
|
|
1759
|
-
return "client_error";
|
|
1760
|
-
}
|
|
1827
|
+
if (kind === "timeout") {
|
|
1828
|
+
return "timeout";
|
|
1761
1829
|
}
|
|
1762
|
-
if (
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
return "server_error";
|
|
1771
|
-
}
|
|
1772
|
-
if (status >= 400) {
|
|
1773
|
-
return "client_error";
|
|
1774
|
-
}
|
|
1775
|
-
}
|
|
1776
|
-
const code = obj.code;
|
|
1777
|
-
if (typeof code === "string") {
|
|
1778
|
-
const lowerCode = code.toLowerCase();
|
|
1779
|
-
if (lowerCode.includes("timeout")) {
|
|
1780
|
-
return "timeout";
|
|
1781
|
-
}
|
|
1782
|
-
if (lowerCode.includes("econnrefused")) {
|
|
1783
|
-
return "network";
|
|
1784
|
-
}
|
|
1785
|
-
if (lowerCode.includes("econnreset")) {
|
|
1786
|
-
return "network";
|
|
1787
|
-
}
|
|
1788
|
-
if (lowerCode.includes("enotfound")) {
|
|
1789
|
-
return "network";
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1830
|
+
if (kind === "network") {
|
|
1831
|
+
return "network";
|
|
1832
|
+
}
|
|
1833
|
+
if (kind === "server") {
|
|
1834
|
+
return "server_error";
|
|
1835
|
+
}
|
|
1836
|
+
if (kind === "validation" || kind === "authentication" || kind === "authorization" || kind === "not_found") {
|
|
1837
|
+
return "client_error";
|
|
1792
1838
|
}
|
|
1793
1839
|
return "unknown";
|
|
1794
1840
|
}
|
|
@@ -1868,8 +1914,9 @@ function createQueuedVectorStore(broker, vectorStore) {
|
|
|
1868
1914
|
return new QueuedVectorStore(broker, vectorStore);
|
|
1869
1915
|
}
|
|
1870
1916
|
var DEFAULT_RETRY_CONFIG, DEFAULT_RATE_LIMIT_CONFIG, PriorityQueue, RATE_LIMIT_PRESETS, ResourceBroker, InMemoryRateLimitBackend, QueuedLLM, QueuedEmbeddings, QueuedVectorStore;
|
|
1871
|
-
var
|
|
1917
|
+
var init_dist4 = __esm({
|
|
1872
1918
|
"../../../core/resource-broker/dist/index.js"() {
|
|
1919
|
+
init_dist3();
|
|
1873
1920
|
DEFAULT_RETRY_CONFIG = {
|
|
1874
1921
|
maxRetries: 3,
|
|
1875
1922
|
baseDelay: 1e3,
|
|
@@ -14598,14 +14645,14 @@ var require_scope = __commonJS({
|
|
|
14598
14645
|
return (0, code_1._)`${scopeName}${name.scopePath}`;
|
|
14599
14646
|
});
|
|
14600
14647
|
}
|
|
14601
|
-
scopeCode(values = this._values, usedValues,
|
|
14648
|
+
scopeCode(values = this._values, usedValues, getCode2) {
|
|
14602
14649
|
return this._reduceValues(values, (name) => {
|
|
14603
14650
|
if (name.value === void 0)
|
|
14604
14651
|
throw new Error(`CodeGen: name "${name}" has no value`);
|
|
14605
14652
|
return name.value.code;
|
|
14606
|
-
}, usedValues,
|
|
14653
|
+
}, usedValues, getCode2);
|
|
14607
14654
|
}
|
|
14608
|
-
_reduceValues(values, valueCode, usedValues = {},
|
|
14655
|
+
_reduceValues(values, valueCode, usedValues = {}, getCode2) {
|
|
14609
14656
|
let code = code_1.nil;
|
|
14610
14657
|
for (const prefix in values) {
|
|
14611
14658
|
const vs = values[prefix];
|
|
@@ -14620,7 +14667,7 @@ var require_scope = __commonJS({
|
|
|
14620
14667
|
if (c) {
|
|
14621
14668
|
const def = this.opts.es5 ? exports$1.varKinds.var : exports$1.varKinds.const;
|
|
14622
14669
|
code = (0, code_1._)`${code}${def} ${name} = ${c};${this.opts._n}`;
|
|
14623
|
-
} else if (c =
|
|
14670
|
+
} else if (c = getCode2 === null || getCode2 === void 0 ? void 0 : getCode2(name)) {
|
|
14624
14671
|
code = (0, code_1._)`${code}${c}${this.opts._n}`;
|
|
14625
14672
|
} else {
|
|
14626
14673
|
throw new ValueError(name);
|
|
@@ -21474,7 +21521,7 @@ async function loadOverlays(projectRoot) {
|
|
|
21474
21521
|
return { overlays, diagnostics };
|
|
21475
21522
|
}
|
|
21476
21523
|
var import_ajv, import_ajv_formats, __defProp2, __getOwnPropNames2, __esm2, __export2, KbError, init_kb_error, fs_atomic_exports, init_fs_atomic, LRUCache, FSCache, GlobSchema, ProductOverridesSchema, ProductsMapSchema, ScopeV2Schema, ProfileMetaSchema, ProfileV2Schema, ResolvedScopeSchema, BundleProfileSourceSchema, ProfileTraceSchema, ScopeSelectionSchema, ajv, schemaMap, OVERLAY_DIRECTIVE_KEY;
|
|
21477
|
-
var
|
|
21524
|
+
var init_dist5 = __esm({
|
|
21478
21525
|
"../../../core/config/dist/index.js"() {
|
|
21479
21526
|
__toESM(require_dist());
|
|
21480
21527
|
init_zod();
|
|
@@ -21785,34 +21832,10 @@ function serializeError(error2) {
|
|
|
21785
21832
|
return serialize(error2);
|
|
21786
21833
|
}
|
|
21787
21834
|
function isRetryableError2(error2) {
|
|
21788
|
-
if (error2 instanceof TimeoutError) {
|
|
21789
|
-
return true;
|
|
21790
|
-
}
|
|
21791
21835
|
if (error2 instanceof CircuitOpenError) {
|
|
21792
21836
|
return false;
|
|
21793
21837
|
}
|
|
21794
|
-
|
|
21795
|
-
if (code) {
|
|
21796
|
-
const retryableCodes = [
|
|
21797
|
-
"ECONNRESET",
|
|
21798
|
-
// Connection reset
|
|
21799
|
-
"ECONNREFUSED",
|
|
21800
|
-
// Connection refused
|
|
21801
|
-
"ETIMEDOUT",
|
|
21802
|
-
// Operation timed out
|
|
21803
|
-
"ENOTFOUND",
|
|
21804
|
-
// DNS lookup failed
|
|
21805
|
-
"EAI_AGAIN"
|
|
21806
|
-
// DNS temporary failure
|
|
21807
|
-
];
|
|
21808
|
-
return retryableCodes.includes(code);
|
|
21809
|
-
}
|
|
21810
|
-
const e = error2;
|
|
21811
|
-
const status = e.status ?? e.statusCode;
|
|
21812
|
-
if (status) {
|
|
21813
|
-
return status === 503 || status === 429;
|
|
21814
|
-
}
|
|
21815
|
-
return false;
|
|
21838
|
+
return classifyFailure(error2, { source: "transport", phase: "dispatch" }).transient;
|
|
21816
21839
|
}
|
|
21817
21840
|
function getOperationTimeout(adapter, method) {
|
|
21818
21841
|
const exactKey = `${adapter}.${method}`;
|
|
@@ -21893,9 +21916,10 @@ function createProxyPlatform(options) {
|
|
|
21893
21916
|
};
|
|
21894
21917
|
}
|
|
21895
21918
|
var BulkTransferHelper, DEFAULT_SOCKET_PATH, UnixSocketServer, IPCServer, ChildIPCServer, TransportError, TimeoutError, CircuitOpenError, OPERATION_TIMEOUTS, IPCTransport, UnixSocketTransport, RemoteAdapter, CacheProxy, LLMProxy, EmbeddingsProxy, VectorStoreProxy, StorageProxy, DocumentDatabaseProxy, stripSignal, KVStoreProxy, stripSignal2, ConfigProxy, EventBusProxy, LoggerProxy;
|
|
21896
|
-
var
|
|
21919
|
+
var init_dist6 = __esm({
|
|
21897
21920
|
"../../../core/ipc/dist/index.js"() {
|
|
21898
21921
|
init_serializable();
|
|
21922
|
+
init_dist3();
|
|
21899
21923
|
BulkTransferHelper = class _BulkTransferHelper {
|
|
21900
21924
|
/** Map of temp file IDs to file paths (for cleanup) */
|
|
21901
21925
|
static tempFiles = /* @__PURE__ */ new Map();
|
|
@@ -23746,7 +23770,7 @@ function getProviderFromEntry(entry) {
|
|
|
23746
23770
|
return "default";
|
|
23747
23771
|
}
|
|
23748
23772
|
var TierResolver, CapabilityResolver, LLMRouter;
|
|
23749
|
-
var
|
|
23773
|
+
var init_dist7 = __esm({
|
|
23750
23774
|
"../../../core/llm-router/dist/index.js"() {
|
|
23751
23775
|
init_dist2();
|
|
23752
23776
|
TierResolver = class {
|
|
@@ -26354,7 +26378,7 @@ function makeAssemblyHook(getLogger2) {
|
|
|
26354
26378
|
);
|
|
26355
26379
|
}
|
|
26356
26380
|
function isCommandResult(value) {
|
|
26357
|
-
return typeof value === "object" && value !== null && "
|
|
26381
|
+
return typeof value === "object" && value !== null && "ok" in value && typeof value.ok === "boolean";
|
|
26358
26382
|
}
|
|
26359
26383
|
function toStandardMeta(executionMeta, descriptor) {
|
|
26360
26384
|
return {
|
|
@@ -26372,12 +26396,15 @@ function wrapCliResult(runResult, descriptor) {
|
|
|
26372
26396
|
const { data, executionMeta } = runResult;
|
|
26373
26397
|
const standardMeta = toStandardMeta(executionMeta, descriptor);
|
|
26374
26398
|
if (isCommandResult(data)) {
|
|
26399
|
+
const ok = data.ok;
|
|
26400
|
+
const exitCode = ok ? 0 : 1;
|
|
26375
26401
|
const mergedMeta = {
|
|
26376
26402
|
...data.meta,
|
|
26377
26403
|
...standardMeta
|
|
26378
26404
|
};
|
|
26379
26405
|
return {
|
|
26380
|
-
exitCode
|
|
26406
|
+
exitCode,
|
|
26407
|
+
ok,
|
|
26381
26408
|
result: data.result,
|
|
26382
26409
|
meta: mergedMeta
|
|
26383
26410
|
};
|
|
@@ -26385,22 +26412,24 @@ function wrapCliResult(runResult, descriptor) {
|
|
|
26385
26412
|
if (data === void 0 || data === null) {
|
|
26386
26413
|
return {
|
|
26387
26414
|
exitCode: 0,
|
|
26415
|
+
ok: true,
|
|
26388
26416
|
meta: standardMeta
|
|
26389
26417
|
};
|
|
26390
26418
|
}
|
|
26391
26419
|
return {
|
|
26392
26420
|
exitCode: 0,
|
|
26421
|
+
ok: true,
|
|
26393
26422
|
result: data,
|
|
26394
26423
|
meta: standardMeta
|
|
26395
26424
|
};
|
|
26396
26425
|
}
|
|
26397
26426
|
var PluginError, PermissionError, TimeoutError2, AbortError, PLATFORM_CONTEXT_KEY2, platformContext2, RUNTIME_CONTEXT_KEY2, runtimeContext2, HARDCODED_DENIED_PATTERNS, ALWAYS_ALLOWED, BLOCKED_COMMANDS, ANALYTICS_EVENT, EVENT_BUS_TOPIC, NAMESPACE_SEPARATOR, KV_NAMESPACE_SEPARATOR, validateName, wrapLogger, wrapLlm, wrapEmbeddings, wrapVectorStore, wrapCache, wrapStorage, wrapNotifier, ADAPTER_REGISTRY, PIPELINE_SLOTS, SLOT_ORDER, NOOP_LIFECYCLE, ANSI_RE;
|
|
26398
|
-
var
|
|
26427
|
+
var init_dist8 = __esm({
|
|
26399
26428
|
"../../../core/plugin-runtime/dist/index.js"() {
|
|
26400
26429
|
init_dist2();
|
|
26401
|
-
|
|
26430
|
+
init_dist4();
|
|
26431
|
+
init_dist7();
|
|
26402
26432
|
init_dist6();
|
|
26403
|
-
init_dist5();
|
|
26404
26433
|
PluginError = class _PluginError extends Error {
|
|
26405
26434
|
/**
|
|
26406
26435
|
* Error code for programmatic handling
|
|
@@ -27055,7 +27084,7 @@ function createDefaultIPCServerFactory() {
|
|
|
27055
27084
|
return async (platform2, executionId) => {
|
|
27056
27085
|
const platformContainer = ensurePlatformContainer(platform2);
|
|
27057
27086
|
if (process.platform === "win32") {
|
|
27058
|
-
const { UnixSocketServer: UnixSocketServer22, createSocketPath: createSocketPath2 } = await Promise.resolve().then(() => (
|
|
27087
|
+
const { UnixSocketServer: UnixSocketServer22, createSocketPath: createSocketPath2 } = await Promise.resolve().then(() => (init_dist6(), dist_exports));
|
|
27059
27088
|
const socketPath = createSocketPath2(`subprocess-${executionId}`);
|
|
27060
27089
|
const authToken = crypto4.randomBytes(32).toString("hex");
|
|
27061
27090
|
const serverConfig = { socketPath };
|
|
@@ -27063,7 +27092,7 @@ function createDefaultIPCServerFactory() {
|
|
|
27063
27092
|
const server = new UnixSocketServer22(platformContainer, serverConfig);
|
|
27064
27093
|
return new UnixSocketIPCServer(server, socketPath, authToken);
|
|
27065
27094
|
} else {
|
|
27066
|
-
const { UnixSocketServer: UnixSocketServer22, createSocketPath: createSocketPath2 } = await Promise.resolve().then(() => (
|
|
27095
|
+
const { UnixSocketServer: UnixSocketServer22, createSocketPath: createSocketPath2 } = await Promise.resolve().then(() => (init_dist6(), dist_exports));
|
|
27067
27096
|
const socketPath = createSocketPath2(`subprocess-${executionId}`);
|
|
27068
27097
|
const authToken = crypto4.randomBytes(32).toString("hex");
|
|
27069
27098
|
const serverConfig = { socketPath };
|
|
@@ -27254,12 +27283,12 @@ function buildRoutingBackend(localBackend, remoteFactory, provisionEnvironment,
|
|
|
27254
27283
|
};
|
|
27255
27284
|
}
|
|
27256
27285
|
var LocalWorkspaceManager, localWorkspaceManager, KNOWN_ERROR_CODES, ExecutionLayerError, TimeoutError3, AbortError2, HandlerContractError, HandlerNotFoundError, WorkspaceError, PermissionDeniedError, ValidationError, QueueFullError, AcquireTimeoutError, WorkerCrashedError, WorkerUnhealthyError, InProcessBackend, UnixSocketIPCServer, SubprocessBackend, UnixSocketPlatformTransportFactory, PoolStatsTracker, DEFAULT_STARTUP_TIMEOUT, DEFAULT_HEALTH_CHECK_TIMEOUT, Worker, PoolLifecycleManager, PoolQueueManager, PoolExecutor, WorkerPool, __dirname$1, WorkerPoolBackend, RemoteBackend, SubprocessRunnerAdapter, PROTOCOL_VERSION, DEFAULT_WORKER_POOL_CONFIG, IPCPlatformTransportFactory;
|
|
27257
|
-
var
|
|
27286
|
+
var init_dist9 = __esm({
|
|
27258
27287
|
"../../../core/plugin-execution-factory/dist/index.js"() {
|
|
27259
27288
|
init_dist();
|
|
27260
|
-
|
|
27289
|
+
init_dist8();
|
|
27261
27290
|
init_dist2();
|
|
27262
|
-
|
|
27291
|
+
init_dist6();
|
|
27263
27292
|
LocalWorkspaceManager = class {
|
|
27264
27293
|
async lease(config2, ctx) {
|
|
27265
27294
|
return {
|
|
@@ -29271,7 +29300,7 @@ function sleep2(ms) {
|
|
|
29271
29300
|
});
|
|
29272
29301
|
}
|
|
29273
29302
|
var DEFAULT_BUFFER_POLICY, AdaptiveBuffer, CALL_TIMEOUT_MS, HostCallDispatcher, globalDispatcher, GatewayDispatchTransport, HOSTS_COLLECTION, TOKENS_COLLECTION, docToDescriptor, HostStore, GatewayHostResolver;
|
|
29274
|
-
var
|
|
29303
|
+
var init_dist10 = __esm({
|
|
29275
29304
|
"../../gateway/core/dist/index.js"() {
|
|
29276
29305
|
DEFAULT_BUFFER_POLICY = {
|
|
29277
29306
|
minTTL: 3e4,
|
|
@@ -78129,7 +78158,7 @@ function extractEntityKinds(manifest) {
|
|
|
78129
78158
|
// ../../../core/runtime/dist/index.js
|
|
78130
78159
|
init_serializable();
|
|
78131
78160
|
init_dist2();
|
|
78132
|
-
|
|
78161
|
+
init_dist4();
|
|
78133
78162
|
|
|
78134
78163
|
// ../../../node_modules/.pnpm/ulid@2.4.0/node_modules/ulid/dist/index.esm.js
|
|
78135
78164
|
function createError(message2) {
|
|
@@ -78224,7 +78253,7 @@ function isDisposable(value) {
|
|
|
78224
78253
|
}
|
|
78225
78254
|
|
|
78226
78255
|
// ../../../core/runtime/dist/index.js
|
|
78227
|
-
|
|
78256
|
+
init_dist5();
|
|
78228
78257
|
var CSI = "\x1B[";
|
|
78229
78258
|
var RESET = "\x1B[0m";
|
|
78230
78259
|
var createColor = (...codes) => (text2) => `${CSI}${codes.join(";")}m${text2}${RESET}`;
|
|
@@ -83523,8 +83552,8 @@ async function initPlatform(config2 = {}, cwd = process.cwd(), uiProvider, platf
|
|
|
83523
83552
|
);
|
|
83524
83553
|
try {
|
|
83525
83554
|
if (execution.mode === "container" && execution.container) {
|
|
83526
|
-
const { createIsolatedExecutionBackend: createIsolatedExecutionBackend2 } = await Promise.resolve().then(() => (
|
|
83527
|
-
const { GatewayDispatchTransport: GatewayDispatchTransport2 } = await Promise.resolve().then(() => (
|
|
83555
|
+
const { createIsolatedExecutionBackend: createIsolatedExecutionBackend2 } = await Promise.resolve().then(() => (init_dist9(), dist_exports2));
|
|
83556
|
+
const { GatewayDispatchTransport: GatewayDispatchTransport2 } = await Promise.resolve().then(() => (init_dist10(), dist_exports3));
|
|
83528
83557
|
const containerCfg = execution.container;
|
|
83529
83558
|
const strictIsolation = {
|
|
83530
83559
|
buildTransport(ctx) {
|
|
@@ -83618,8 +83647,8 @@ async function initPlatform(config2 = {}, cwd = process.cwd(), uiProvider, platf
|
|
|
83618
83647
|
dispatchUrl: containerCfg.gatewayDispatchUrl
|
|
83619
83648
|
});
|
|
83620
83649
|
} else if (execution.workspaceAgent?.enabled && execution.workspaceAgent.gatewayUrl) {
|
|
83621
|
-
const { createIsolatedExecutionBackend: createIsolatedExecutionBackend2 } = await Promise.resolve().then(() => (
|
|
83622
|
-
const { GatewayHostResolver: GatewayHostResolver2, GatewayDispatchTransport: GatewayDispatchTransport2 } = await Promise.resolve().then(() => (
|
|
83650
|
+
const { createIsolatedExecutionBackend: createIsolatedExecutionBackend2 } = await Promise.resolve().then(() => (init_dist9(), dist_exports2));
|
|
83651
|
+
const { GatewayHostResolver: GatewayHostResolver2, GatewayDispatchTransport: GatewayDispatchTransport2 } = await Promise.resolve().then(() => (init_dist10(), dist_exports3));
|
|
83623
83652
|
const agentCfg = execution.workspaceAgent;
|
|
83624
83653
|
const hostResolver = new GatewayHostResolver2({
|
|
83625
83654
|
gatewayUrl: agentCfg.gatewayUrl,
|
|
@@ -83667,7 +83696,7 @@ async function initPlatform(config2 = {}, cwd = process.cwd(), uiProvider, platf
|
|
|
83667
83696
|
fallback: agentCfg.fallback ?? "local"
|
|
83668
83697
|
});
|
|
83669
83698
|
} else {
|
|
83670
|
-
const { createExecutionBackend: createExecutionBackend2 } = await Promise.resolve().then(() => (
|
|
83699
|
+
const { createExecutionBackend: createExecutionBackend2 } = await Promise.resolve().then(() => (init_dist9(), dist_exports2));
|
|
83671
83700
|
const factoryMode = execution.mode ?? "auto";
|
|
83672
83701
|
const executionBackend = createExecutionBackend2({
|
|
83673
83702
|
platform,
|
|
@@ -84522,10 +84551,10 @@ init_container();
|
|
|
84522
84551
|
init_adapter_status();
|
|
84523
84552
|
|
|
84524
84553
|
// src/bootstrap.ts
|
|
84525
|
-
|
|
84554
|
+
init_dist8();
|
|
84526
84555
|
|
|
84527
84556
|
// ../../../core/policy/dist/index.js
|
|
84528
|
-
|
|
84557
|
+
init_dist5();
|
|
84529
84558
|
var import_ajv2 = __toESM(require_ajv());
|
|
84530
84559
|
var import_ajv_formats2 = __toESM(require_dist2());
|
|
84531
84560
|
var DEFAULT_POLICY = {
|
|
@@ -107514,7 +107543,7 @@ function defineSystemCommand(config2) {
|
|
|
107514
107543
|
// ../../../cli/runtime/dist/index.js
|
|
107515
107544
|
__toESM(require_dist());
|
|
107516
107545
|
__toESM(require_cli_table3());
|
|
107517
|
-
|
|
107546
|
+
init_dist8();
|
|
107518
107547
|
__toESM(require_colorette());
|
|
107519
107548
|
var __require2 = /* @__PURE__ */ ((x) => typeof __require !== "undefined" ? __require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
107520
107549
|
get: (a, b) => (typeof __require !== "undefined" ? __require : a)[b]
|
|
@@ -109477,7 +109506,7 @@ defineSystemCommand({
|
|
|
109477
109506
|
});
|
|
109478
109507
|
ctx.platform?.logger?.info("Health check completed", { status: snapshot.status });
|
|
109479
109508
|
return {
|
|
109480
|
-
ok:
|
|
109509
|
+
ok: true,
|
|
109481
109510
|
status: snapshot.status === "healthy" ? "success" : "warning",
|
|
109482
109511
|
healthStatus: snapshot.status || "unhealthy",
|
|
109483
109512
|
snapshot
|
|
@@ -109501,11 +109530,11 @@ defineSystemCommand({
|
|
|
109501
109530
|
const jsonOutput = result.snapshot || {
|
|
109502
109531
|
schema: "kb.health/1",
|
|
109503
109532
|
status: result.healthStatus,
|
|
109504
|
-
error: result.error
|
|
109533
|
+
error: !result.ok ? result.error : void 0
|
|
109505
109534
|
};
|
|
109506
109535
|
ctx.ui?.json?.(jsonOutput);
|
|
109507
109536
|
} else {
|
|
109508
|
-
if (result.
|
|
109537
|
+
if (!result.ok) {
|
|
109509
109538
|
ctx.ui.error("System Health", {
|
|
109510
109539
|
sections: [
|
|
109511
109540
|
{
|
|
@@ -109970,12 +109999,12 @@ async function runTrace(ctx) {
|
|
|
109970
109999
|
}
|
|
109971
110000
|
}
|
|
109972
110001
|
const failing = stages.find((s) => s.status === "error") ?? stages.find((s) => s.status === "warning");
|
|
109973
|
-
|
|
109974
|
-
ok: !stages.some((s) => s.status === "error" || s.status === "warning"),
|
|
110002
|
+
const result = {
|
|
109975
110003
|
command: ctx.segments.join(" "),
|
|
109976
110004
|
stages,
|
|
109977
110005
|
verdict: failing ? { rootCause: failing.code, remediation: failing.remediation } : { rootCause: "NONE" }
|
|
109978
110006
|
};
|
|
110007
|
+
return failing ? { ok: false, error: failing.message, ...result } : { ok: true, ...result };
|
|
109979
110008
|
}
|
|
109980
110009
|
defineSystemCommand({
|
|
109981
110010
|
name: "diag",
|
|
@@ -110163,7 +110192,7 @@ defineSystemCommand({
|
|
|
110163
110192
|
errors: diagnostics.filter((d) => d.status === "error").length
|
|
110164
110193
|
};
|
|
110165
110194
|
ctx.platform?.logger?.info("Diag command completed", summary);
|
|
110166
|
-
return { ok: summary.errors
|
|
110195
|
+
return summary.errors === 0 ? { ok: true, diagnostics, summary } : { ok: false, error: `${summary.errors} diagnostic error(s) found`, diagnostics, summary };
|
|
110167
110196
|
},
|
|
110168
110197
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
110169
110198
|
formatter(result, ctx, flags) {
|
|
@@ -110251,7 +110280,10 @@ defineSystemCommand({
|
|
|
110251
110280
|
}
|
|
110252
110281
|
const report = registry22.getDiagnostics();
|
|
110253
110282
|
await registry22.dispose();
|
|
110254
|
-
|
|
110283
|
+
if (report.summary.errors === 0) {
|
|
110284
|
+
return { ok: true, report };
|
|
110285
|
+
}
|
|
110286
|
+
return { ok: false, error: `${report.summary.errors} diagnostic error(s) found`, report };
|
|
110255
110287
|
},
|
|
110256
110288
|
formatter(result, ctx, flags) {
|
|
110257
110289
|
if (flags.json) {
|
|
@@ -110634,7 +110666,8 @@ defineSystemCommand({
|
|
|
110634
110666
|
return;
|
|
110635
110667
|
}
|
|
110636
110668
|
if (!result.ok) {
|
|
110637
|
-
|
|
110669
|
+
const error2 = typeof result.error === "string" ? result.error : "Unknown";
|
|
110670
|
+
ctx.ui.error("Log Diagnose", { sections: [{ header: "Error", items: [error2] }] });
|
|
110638
110671
|
return;
|
|
110639
110672
|
}
|
|
110640
110673
|
const { summary, topErrors, bySource, period } = result;
|
|
@@ -110760,7 +110793,8 @@ defineSystemCommand({
|
|
|
110760
110793
|
return;
|
|
110761
110794
|
}
|
|
110762
110795
|
if (!result.ok) {
|
|
110763
|
-
|
|
110796
|
+
const error2 = typeof result.error === "string" ? result.error : "Unknown";
|
|
110797
|
+
ctx.ui.error("Log Context", { sections: [{ header: "Error", items: [error2] }] });
|
|
110764
110798
|
return;
|
|
110765
110799
|
}
|
|
110766
110800
|
const { timeline, correlationKey, byLevel } = data;
|
|
@@ -110941,7 +110975,8 @@ defineSystemCommand({
|
|
|
110941
110975
|
return;
|
|
110942
110976
|
}
|
|
110943
110977
|
if (!result.ok) {
|
|
110944
|
-
|
|
110978
|
+
const error2 = typeof result.error === "string" ? result.error : "Unknown";
|
|
110979
|
+
ctx.ui.error("Log Summarize", { sections: [{ header: "Error", items: [error2] }] });
|
|
110945
110980
|
return;
|
|
110946
110981
|
}
|
|
110947
110982
|
ctx.ui.write(`Question: ${result.question}
|
|
@@ -111010,7 +111045,8 @@ defineSystemCommand({
|
|
|
111010
111045
|
return;
|
|
111011
111046
|
}
|
|
111012
111047
|
if (!result.ok) {
|
|
111013
|
-
|
|
111048
|
+
const error2 = typeof result.error === "string" ? result.error : "Unknown";
|
|
111049
|
+
ctx.ui.error("Log Query", { sections: [{ header: "Error", items: [error2] }] });
|
|
111014
111050
|
return;
|
|
111015
111051
|
}
|
|
111016
111052
|
const raw = result._raw;
|
|
@@ -111072,7 +111108,8 @@ defineSystemCommand({
|
|
|
111072
111108
|
return;
|
|
111073
111109
|
}
|
|
111074
111110
|
if (!result.ok) {
|
|
111075
|
-
|
|
111111
|
+
const error2 = typeof result.error === "string" ? result.error : "Unknown";
|
|
111112
|
+
ctx.ui.error("Log Search", { sections: [{ header: "Error", items: [error2] }] });
|
|
111076
111113
|
return;
|
|
111077
111114
|
}
|
|
111078
111115
|
const raw = result._raw;
|
|
@@ -111138,7 +111175,8 @@ defineSystemCommand({
|
|
|
111138
111175
|
return;
|
|
111139
111176
|
}
|
|
111140
111177
|
if (!result.ok) {
|
|
111141
|
-
|
|
111178
|
+
const error2 = typeof result.error === "string" ? result.error : "Unknown";
|
|
111179
|
+
ctx.ui.error("Log Get", { sections: [{ header: "Error", items: [error2] }] });
|
|
111142
111180
|
return;
|
|
111143
111181
|
}
|
|
111144
111182
|
const rawLog = result._rawLog;
|
|
@@ -111232,7 +111270,8 @@ defineSystemCommand({
|
|
|
111232
111270
|
return;
|
|
111233
111271
|
}
|
|
111234
111272
|
if (!result.ok) {
|
|
111235
|
-
|
|
111273
|
+
const error2 = typeof result.error === "string" ? result.error : "Unknown error";
|
|
111274
|
+
ctx.ui.error("Log Stats", { sections: [{ header: "Error", items: [error2] }] });
|
|
111236
111275
|
return;
|
|
111237
111276
|
}
|
|
111238
111277
|
const sections = [];
|
|
@@ -111743,11 +111782,10 @@ defineSystemCommand({
|
|
|
111743
111782
|
installed: result.installed.length,
|
|
111744
111783
|
errors: result.errors.length
|
|
111745
111784
|
});
|
|
111746
|
-
|
|
111747
|
-
ok: result
|
|
111748
|
-
|
|
111749
|
-
|
|
111750
|
-
};
|
|
111785
|
+
if (result.ok) {
|
|
111786
|
+
return { ok: true, status: "success", sync: result };
|
|
111787
|
+
}
|
|
111788
|
+
return { ok: false, error: result.errors.join("; ") || "Platform sync failed", status: "error", sync: result };
|
|
111751
111789
|
},
|
|
111752
111790
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
111753
111791
|
formatter(result, ctx, flags) {
|
|
@@ -111758,7 +111796,7 @@ defineSystemCommand({
|
|
|
111758
111796
|
const sync2 = result.sync;
|
|
111759
111797
|
if (!sync2) {
|
|
111760
111798
|
ctx.ui.error("Platform Sync", {
|
|
111761
|
-
sections: [{ header: "Error", items: [
|
|
111799
|
+
sections: [{ header: "Error", items: ["Unknown error"] }]
|
|
111762
111800
|
});
|
|
111763
111801
|
return;
|
|
111764
111802
|
}
|